()
| 122 | } |
| 123 | |
| 124 | func (o *OptParamCapability) Serialize() ([]byte, error) { |
| 125 | buf := make([]byte, 2) |
| 126 | buf[0] = o.OptParamType |
| 127 | for _, cap := range o.OptCaps { |
| 128 | cbuf, err := cap.Serialize() |
| 129 | if err != nil { |
| 130 | return nil, err |
| 131 | } |
| 132 | buf = append(buf, cbuf...) |
| 133 | } |
| 134 | o.OptParamLen = uint8(len(buf) - 2) |
| 135 | buf[1] = o.OptParamLen |
| 136 | return buf, nil |
| 137 | } |
| 138 | |
| 139 | const ( |
| 140 | BGP_CAP_MULTIPROTOCOL uint8 = 1 // RFC2858 |