()
| 80 | } |
| 81 | |
| 82 | func (msg *Boolmsg) Serialize() []byte { |
| 83 | buf := make([]byte, msg.Len()) |
| 84 | native := nl.NativeEndian() |
| 85 | native.PutUint16(buf[0:2], uint16(msg.Len())) |
| 86 | native.PutUint16(buf[2:4], msg.Type) |
| 87 | if msg.Value { |
| 88 | native.PutUint32(buf[4:8], uint32(1)) |
| 89 | } else { |
| 90 | native.PutUint32(buf[4:8], uint32(0)) |
| 91 | } |
| 92 | return buf |
| 93 | } |
| 94 | |
| 95 | func (msg *Boolmsg) Len() int { |
| 96 | return unix.NLA_HDRLEN + 4 // alignment |