(e *encoder, l uint32)
| 131 | } |
| 132 | |
| 133 | func (o *optInfo) decode(e *encoder, l uint32) errno { |
| 134 | nlen := e.uint32() |
| 135 | if l < 6 || nlen > l-6 { |
| 136 | return errInvalid |
| 137 | } |
| 138 | name := make([]byte, nlen) |
| 139 | e.read(name) |
| 140 | o.name = string(name) |
| 141 | nreqs := e.uint16() |
| 142 | if (l-nlen-6)%2 != 0 || (l-nlen-6)/2 != uint32(nreqs) { |
| 143 | return errInvalid |
| 144 | } |
| 145 | for ; nreqs > 0; nreqs-- { |
| 146 | o.reqs = append(o.reqs, e.uint16()) |
| 147 | } |
| 148 | return 0 |
| 149 | } |
| 150 | |
| 151 | func (o *optInfo) encode(e *encoder) { |
| 152 | e.writeUint32(uint32(len(o.name))) |