func (self *Match) Marshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } n = 0 binary.BigEndian.PutUint32(buff, self.Wildcards) n += 4 binary.BigEndian.PutUint16(buff[n:], self.InPort) n += 2 copy(buff[n:], self.EthSrc[:]) n += OFP_ETH_ALAN copy(buff[n:], self.EthDst[:]) n += OFP_ETH_ALAN binary.BigEndian.PutUint16(buff[n:], self.VlanId) n += 2 buff[n] = self.VlanPcp n += 2 // plus one padding byte binary.BigEndian.PutUint16(buff[n:], self.EthType) n += 2 buff[n] = self.NwTos n++ buff[n] = self.NwProto n += 3 // plus 2 padding byte binary.BigEndian.PutUint32(buff[n:], self.NwSrc) n += 4 binary.BigEndian.PutUint32(buff[n:], self.NwDst) n += 4 binary.BigEndian.PutUint16(buff[n:], self.TpSrc) n += 2 binary.BigEndian.PutUint16(buff[n:], self.TpDst) n += 2 return n, nil }
func (self *Match) Unmarshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } n = 0 self.Wildcards = binary.BigEndian.Uint32(buff) n += 4 self.InPort = binary.BigEndian.Uint16(buff[n:]) n += 2 copy(self.EthSrc[:], buff[n:]) n += OFP_ETH_ALAN copy(self.EthDst[:], buff[n:]) n += OFP_ETH_ALAN self.VlanId = binary.BigEndian.Uint16(buff[n:]) n += 2 self.VlanPcp = buff[n] n += 2 self.EthType = binary.BigEndian.Uint16(buff[n:]) n += 2 self.NwTos = buff[n] n++ self.NwProto = buff[n] n += 3 self.NwSrc = binary.BigEndian.Uint32(buff[n:]) n += 4 self.NwDst = binary.BigEndian.Uint32(buff[n:]) n += 4 self.TpSrc = binary.BigEndian.Uint16(buff[n:]) n += 2 self.TpDst = binary.BigEndian.Uint16(buff[n:]) return n, nil }
func (self *ActionVendorHeader) Unmarshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } if n, err = self.ActionHeader.Unmarshal(buff); err != nil { return n, err } self.Vendor = binary.BigEndian.Uint32(buff[n:]) n += 4 return n, nil }
func (self *ActionHeader) Unmarshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } n = 0 self.Type = ActionType(binary.BigEndian.Uint16(buff)) n += 2 self.Length = binary.BigEndian.Uint16(buff[n:]) n += 2 return n, nil }
func (self *ActionTpPort) Marshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } if n, err = self.ActionHeader.Marshal(buff); err != nil { return n, err } binary.BigEndian.PutUint16(buff[n:], self.Port) n += 4 return n, nil }
func (self *ActionHeader) Marshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } n = 0 binary.BigEndian.PutUint16(buff, uint16(self.Type)) n += 2 binary.BigEndian.PutUint16(buff[n:], self.Length) n += 2 return n, nil }
func (self *ActionNwTos) Unmarshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } if n, err = self.ActionHeader.Unmarshal(buff); err != nil { return n, err } self.Tos = buff[n] n += 4 return n, nil }
func (self *ActionDlAddr) Unmarshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } if n, err = self.ActionHeader.Unmarshal(buff); err != nil { return n, err } copy(self.Addr[:], buff[n:]) n += OFP_ETH_ALAN + 6 return n, nil }
func (self *ActionVlanPcp) Marshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } if n, err = self.ActionHeader.Marshal(buff); err != nil { return n, err } buff[n] = self.VlanPcp n += 4 return n, nil }
func (self *ActionEnqueue) Unmarshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } if n, err = self.ActionHeader.Unmarshal(buff); err != nil { return n, err } self.Port = binary.BigEndian.Uint16(buff[n:]) n += 8 self.QueueId = binary.BigEndian.Uint32(buff[n:]) return n, nil }
func (self *ActionOutput) Unmarshal(buff []byte) (n int, err error) { if len(buff) < self.Len() { return 0, ofp.NewNoBuffError() } if n, err = self.ActionHeader.Unmarshal(buff); err != nil { return n, err } self.Port = binary.BigEndian.Uint16(buff[n:]) n += 2 self.MaxLen = binary.BigEndian.Uint16(buff[n:]) n += 2 return n, nil }