+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TableID)
+ buf.EncodeUint8(m.Exact)
+ buf.EncodeUint8(uint8(m.Prefix.Address.Af))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
+ return buf.Bytes(), nil
+}
+func (m *IPRouteLookup) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.TableID = buf.DecodeUint32()
+ m.Exact = buf.DecodeUint8()
+ m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
+ copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
+ m.Prefix.Len = buf.DecodeUint8()
+ return nil
+}
+
+// IPRouteLookupReply defines message 'ip_route_lookup_reply'.
+type IPRouteLookupReply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+ Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"`
+}
+
+func (m *IPRouteLookupReply) Reset() { *m = IPRouteLookupReply{} }
+func (*IPRouteLookupReply) GetMessageName() string { return "ip_route_lookup_reply" }
+func (*IPRouteLookupReply) GetCrcString() string { return "5d8febcb" }
+func (*IPRouteLookupReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *IPRouteLookupReply) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.Retval
+ size += 4 // m.Route.TableID
+ size += 4 // m.Route.StatsIndex
+ size += 1 // m.Route.Prefix.Address.Af
+ size += 1 * 16 // m.Route.Prefix.Address.Un
+ size += 1 // m.Route.Prefix.Len
+ size += 1 // m.Route.NPaths
+ for j2 := 0; j2 < len(m.Route.Paths); j2++ {
+ var s2 fib_types.FibPath
+ _ = s2
+ if j2 < len(m.Route.Paths) {
+ s2 = m.Route.Paths[j2]
+ }
+ size += 4 // s2.SwIfIndex
+ size += 4 // s2.TableID
+ size += 4 // s2.RpfID
+ size += 1 // s2.Weight
+ size += 1 // s2.Preference
+ size += 4 // s2.Type
+ size += 4 // s2.Flags
+ size += 4 // s2.Proto
+ size += 1 * 16 // s2.Nh.Address
+ size += 4 // s2.Nh.ViaLabel
+ size += 4 // s2.Nh.ObjID
+ size += 4 // s2.Nh.ClassifyTableIndex
+ size += 1 // s2.NLabels
+ for j3 := 0; j3 < 16; j3++ {
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
+ }
+ }
+ return size
+}
+func (m *IPRouteLookupReply) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.Route.TableID)
+ buf.EncodeUint32(m.Route.StatsIndex)
+ buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af))
+ buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Route.Prefix.Len)
+ buf.EncodeUint8(uint8(len(m.Route.Paths)))
+ for j1 := 0; j1 < len(m.Route.Paths); j1++ {
+ var v1 fib_types.FibPath // Paths
+ if j1 < len(m.Route.Paths) {
+ v1 = m.Route.Paths[j1]
+ }
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
+ buf.EncodeUint32(uint32(v1.Type))
+ buf.EncodeUint32(uint32(v1.Flags))
+ buf.EncodeUint32(uint32(v1.Proto))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
+ for j2 := 0; j2 < 16; j2++ {
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
+ }
+ }
+ return buf.Bytes(), nil
+}
+func (m *IPRouteLookupReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = buf.DecodeInt32()
+ m.Route.TableID = buf.DecodeUint32()
+ m.Route.StatsIndex = buf.DecodeUint32()
+ m.Route.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
+ copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
+ m.Route.Prefix.Len = buf.DecodeUint8()
+ m.Route.NPaths = buf.DecodeUint8()
+ m.Route.Paths = make([]fib_types.FibPath, m.Route.NPaths)
+ for j1 := 0; j1 < len(m.Route.Paths); j1++ {
+ m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32()
+ m.Route.Paths[j1].TableID = buf.DecodeUint32()
+ m.Route.Paths[j1].RpfID = buf.DecodeUint32()
+ m.Route.Paths[j1].Weight = buf.DecodeUint8()
+ m.Route.Paths[j1].Preference = buf.DecodeUint8()
+ m.Route.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32())
+ m.Route.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32())
+ m.Route.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32())
+ copy(m.Route.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
+ m.Route.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
+ m.Route.Paths[j1].Nh.ObjID = buf.DecodeUint32()
+ m.Route.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
+ m.Route.Paths[j1].NLabels = buf.DecodeUint8()
+ for j2 := 0; j2 < 16; j2++ {
+ m.Route.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
+ m.Route.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
+ m.Route.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
+ m.Route.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
+ }
+ }
+ return nil
+}
+
+// IPRouteLookupV2 defines message 'ip_route_lookup_v2'.
+// InProgress: the message form may change in the future versions
+type IPRouteLookupV2 struct {
+ TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"`
+ Exact uint8 `binapi:"u8,name=exact" json:"exact,omitempty"`
+ Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"`
+}
+
+func (m *IPRouteLookupV2) Reset() { *m = IPRouteLookupV2{} }
+func (*IPRouteLookupV2) GetMessageName() string { return "ip_route_lookup_v2" }
+func (*IPRouteLookupV2) GetCrcString() string { return "710d6471" }
+func (*IPRouteLookupV2) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *IPRouteLookupV2) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.TableID
+ size += 1 // m.Exact
+ size += 1 // m.Prefix.Address.Af
+ size += 1 * 16 // m.Prefix.Address.Un
+ size += 1 // m.Prefix.Len
+ return size
+}
+func (m *IPRouteLookupV2) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TableID)
+ buf.EncodeUint8(m.Exact)
+ buf.EncodeUint8(uint8(m.Prefix.Address.Af))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
+ return buf.Bytes(), nil
+}
+func (m *IPRouteLookupV2) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.TableID = buf.DecodeUint32()
+ m.Exact = buf.DecodeUint8()
+ m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
+ copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
+ m.Prefix.Len = buf.DecodeUint8()
+ return nil
+}
+
+// IPRouteLookupV2Reply defines message 'ip_route_lookup_v2_reply'.
+// InProgress: the message form may change in the future versions
+type IPRouteLookupV2Reply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+ Route IPRouteV2 `binapi:"ip_route_v2,name=route" json:"route,omitempty"`
+}
+
+func (m *IPRouteLookupV2Reply) Reset() { *m = IPRouteLookupV2Reply{} }
+func (*IPRouteLookupV2Reply) GetMessageName() string { return "ip_route_lookup_v2_reply" }
+func (*IPRouteLookupV2Reply) GetCrcString() string { return "84cc9e03" }
+func (*IPRouteLookupV2Reply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *IPRouteLookupV2Reply) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.Retval
+ size += 4 // m.Route.TableID
+ size += 4 // m.Route.StatsIndex
+ size += 1 // m.Route.Prefix.Address.Af
+ size += 1 * 16 // m.Route.Prefix.Address.Un
+ size += 1 // m.Route.Prefix.Len
+ size += 1 // m.Route.NPaths
+ size += 1 // m.Route.Src
+ for j2 := 0; j2 < len(m.Route.Paths); j2++ {
+ var s2 fib_types.FibPath
+ _ = s2
+ if j2 < len(m.Route.Paths) {
+ s2 = m.Route.Paths[j2]
+ }
+ size += 4 // s2.SwIfIndex
+ size += 4 // s2.TableID
+ size += 4 // s2.RpfID
+ size += 1 // s2.Weight
+ size += 1 // s2.Preference
+ size += 4 // s2.Type
+ size += 4 // s2.Flags
+ size += 4 // s2.Proto
+ size += 1 * 16 // s2.Nh.Address
+ size += 4 // s2.Nh.ViaLabel
+ size += 4 // s2.Nh.ObjID
+ size += 4 // s2.Nh.ClassifyTableIndex
+ size += 1 // s2.NLabels
+ for j3 := 0; j3 < 16; j3++ {
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
+ }
+ }
+ return size
+}
+func (m *IPRouteLookupV2Reply) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.Route.TableID)
+ buf.EncodeUint32(m.Route.StatsIndex)
+ buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af))
+ buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Route.Prefix.Len)
+ buf.EncodeUint8(uint8(len(m.Route.Paths)))
+ buf.EncodeUint8(m.Route.Src)
+ for j1 := 0; j1 < len(m.Route.Paths); j1++ {
+ var v1 fib_types.FibPath // Paths
+ if j1 < len(m.Route.Paths) {
+ v1 = m.Route.Paths[j1]
+ }
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
+ buf.EncodeUint32(uint32(v1.Type))
+ buf.EncodeUint32(uint32(v1.Flags))
+ buf.EncodeUint32(uint32(v1.Proto))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
+ for j2 := 0; j2 < 16; j2++ {
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
+ }
+ }