MCPcopy Create free account
hub / github.com/google/nftables / marshalData

Method marshalData

expr/expr.go:458–470  ·  view source on GitHub ↗
(fam byte)

Source from the content-addressed store, hash-verified

456}
457
458func (e *Cmp) marshalData(fam byte) ([]byte, error) {
459 cmpData, err := netlink.MarshalAttributes([]netlink.Attribute{
460 {Type: unix.NFTA_DATA_VALUE, Data: e.Data},
461 })
462 if err != nil {
463 return nil, err
464 }
465 return netlink.MarshalAttributes([]netlink.Attribute{
466 {Type: unix.NFTA_CMP_SREG, Data: binaryutil.BigEndian.PutUint32(e.Register)},
467 {Type: unix.NFTA_CMP_OP, Data: binaryutil.BigEndian.PutUint32(uint32(e.Op))},
468 {Type: unix.NLA_F_NESTED | unix.NFTA_CMP_DATA, Data: cmpData},
469 })
470}
471
472func (e *Cmp) unmarshal(fam byte, data []byte) error {
473 ad, err := netlink.NewAttributeDecoder(data)

Callers 1

marshalMethod · 0.95

Calls 1

PutUint32Method · 0.65

Tested by

no test coverage detected