(fam byte, data []byte)
| 72 | } |
| 73 | |
| 74 | func (e *Socket) unmarshal(fam byte, data []byte) error { |
| 75 | ad, err := netlink.NewAttributeDecoder(data) |
| 76 | if err != nil { |
| 77 | return err |
| 78 | } |
| 79 | |
| 80 | ad.ByteOrder = binary.BigEndian |
| 81 | for ad.Next() { |
| 82 | switch ad.Type() { |
| 83 | case NFTA_SOCKET_DREG: |
| 84 | e.Register = ad.Uint32() |
| 85 | case NFTA_SOCKET_KEY: |
| 86 | e.Key = SocketKey(ad.Uint32()) |
| 87 | case NFTA_SOCKET_LEVEL: |
| 88 | e.Level = ad.Uint32() |
| 89 | } |
| 90 | } |
| 91 | return ad.Err() |
| 92 | } |