1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: .vppapi/core/udp.api.json
7 // Package udp contains generated bindings for API file udp.api.
20 api "git.fd.io/govpp.git/api"
21 codec "git.fd.io/govpp.git/codec"
27 // This is a compile-time assertion to ensure that this generated file
28 // is compatible with the GoVPP api package it is being compiled against.
29 // A compilation error at this line likely means your copy of the
30 // GoVPP api package needs to be updated.
31 const _ = api.GoVppAPIPackageIsVersion2
36 VersionCrc = 0xa6b4c475
39 // AddressFamily defines enum 'address_family'.
40 type AddressFamily uint32
43 ADDRESS_IP4 AddressFamily = 0
44 ADDRESS_IP6 AddressFamily = 1
48 AddressFamily_name = map[uint32]string{
52 AddressFamily_value = map[string]uint32{
58 func (x AddressFamily) String() string {
59 s, ok := AddressFamily_name[uint32(x)]
63 return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
66 // IPDscp defines enum 'ip_dscp'.
70 IP_API_DSCP_CS0 IPDscp = 0
71 IP_API_DSCP_CS1 IPDscp = 8
72 IP_API_DSCP_AF11 IPDscp = 10
73 IP_API_DSCP_AF12 IPDscp = 12
74 IP_API_DSCP_AF13 IPDscp = 14
75 IP_API_DSCP_CS2 IPDscp = 16
76 IP_API_DSCP_AF21 IPDscp = 18
77 IP_API_DSCP_AF22 IPDscp = 20
78 IP_API_DSCP_AF23 IPDscp = 22
79 IP_API_DSCP_CS3 IPDscp = 24
80 IP_API_DSCP_AF31 IPDscp = 26
81 IP_API_DSCP_AF32 IPDscp = 28
82 IP_API_DSCP_AF33 IPDscp = 30
83 IP_API_DSCP_CS4 IPDscp = 32
84 IP_API_DSCP_AF41 IPDscp = 34
85 IP_API_DSCP_AF42 IPDscp = 36
86 IP_API_DSCP_AF43 IPDscp = 38
87 IP_API_DSCP_CS5 IPDscp = 40
88 IP_API_DSCP_EF IPDscp = 46
89 IP_API_DSCP_CS6 IPDscp = 48
90 IP_API_DSCP_CS7 IPDscp = 50
94 IPDscp_name = map[uint8]string{
97 10: "IP_API_DSCP_AF11",
98 12: "IP_API_DSCP_AF12",
99 14: "IP_API_DSCP_AF13",
100 16: "IP_API_DSCP_CS2",
101 18: "IP_API_DSCP_AF21",
102 20: "IP_API_DSCP_AF22",
103 22: "IP_API_DSCP_AF23",
104 24: "IP_API_DSCP_CS3",
105 26: "IP_API_DSCP_AF31",
106 28: "IP_API_DSCP_AF32",
107 30: "IP_API_DSCP_AF33",
108 32: "IP_API_DSCP_CS4",
109 34: "IP_API_DSCP_AF41",
110 36: "IP_API_DSCP_AF42",
111 38: "IP_API_DSCP_AF43",
112 40: "IP_API_DSCP_CS5",
113 46: "IP_API_DSCP_EF",
114 48: "IP_API_DSCP_CS6",
115 50: "IP_API_DSCP_CS7",
117 IPDscp_value = map[string]uint8{
118 "IP_API_DSCP_CS0": 0,
119 "IP_API_DSCP_CS1": 8,
120 "IP_API_DSCP_AF11": 10,
121 "IP_API_DSCP_AF12": 12,
122 "IP_API_DSCP_AF13": 14,
123 "IP_API_DSCP_CS2": 16,
124 "IP_API_DSCP_AF21": 18,
125 "IP_API_DSCP_AF22": 20,
126 "IP_API_DSCP_AF23": 22,
127 "IP_API_DSCP_CS3": 24,
128 "IP_API_DSCP_AF31": 26,
129 "IP_API_DSCP_AF32": 28,
130 "IP_API_DSCP_AF33": 30,
131 "IP_API_DSCP_CS4": 32,
132 "IP_API_DSCP_AF41": 34,
133 "IP_API_DSCP_AF42": 36,
134 "IP_API_DSCP_AF43": 38,
135 "IP_API_DSCP_CS5": 40,
136 "IP_API_DSCP_EF": 46,
137 "IP_API_DSCP_CS6": 48,
138 "IP_API_DSCP_CS7": 50,
142 func (x IPDscp) String() string {
143 s, ok := IPDscp_name[uint8(x)]
147 return "IPDscp(" + strconv.Itoa(int(x)) + ")"
150 // IPEcn defines enum 'ip_ecn'.
154 IP_API_ECN_NONE IPEcn = 0
155 IP_API_ECN_ECT0 IPEcn = 1
156 IP_API_ECN_ECT1 IPEcn = 2
157 IP_API_ECN_CE IPEcn = 3
161 IPEcn_name = map[uint8]string{
162 0: "IP_API_ECN_NONE",
163 1: "IP_API_ECN_ECT0",
164 2: "IP_API_ECN_ECT1",
167 IPEcn_value = map[string]uint8{
168 "IP_API_ECN_NONE": 0,
169 "IP_API_ECN_ECT0": 1,
170 "IP_API_ECN_ECT1": 2,
175 func (x IPEcn) String() string {
176 s, ok := IPEcn_name[uint8(x)]
180 return "IPEcn(" + strconv.Itoa(int(x)) + ")"
183 // IPProto defines enum 'ip_proto'.
187 IP_API_PROTO_HOPOPT IPProto = 0
188 IP_API_PROTO_ICMP IPProto = 1
189 IP_API_PROTO_IGMP IPProto = 2
190 IP_API_PROTO_TCP IPProto = 6
191 IP_API_PROTO_UDP IPProto = 17
192 IP_API_PROTO_GRE IPProto = 47
193 IP_API_PROTO_AH IPProto = 50
194 IP_API_PROTO_ESP IPProto = 51
195 IP_API_PROTO_EIGRP IPProto = 88
196 IP_API_PROTO_OSPF IPProto = 89
197 IP_API_PROTO_SCTP IPProto = 132
198 IP_API_PROTO_RESERVED IPProto = 255
202 IPProto_name = map[uint32]string{
203 0: "IP_API_PROTO_HOPOPT",
204 1: "IP_API_PROTO_ICMP",
205 2: "IP_API_PROTO_IGMP",
206 6: "IP_API_PROTO_TCP",
207 17: "IP_API_PROTO_UDP",
208 47: "IP_API_PROTO_GRE",
209 50: "IP_API_PROTO_AH",
210 51: "IP_API_PROTO_ESP",
211 88: "IP_API_PROTO_EIGRP",
212 89: "IP_API_PROTO_OSPF",
213 132: "IP_API_PROTO_SCTP",
214 255: "IP_API_PROTO_RESERVED",
216 IPProto_value = map[string]uint32{
217 "IP_API_PROTO_HOPOPT": 0,
218 "IP_API_PROTO_ICMP": 1,
219 "IP_API_PROTO_IGMP": 2,
220 "IP_API_PROTO_TCP": 6,
221 "IP_API_PROTO_UDP": 17,
222 "IP_API_PROTO_GRE": 47,
223 "IP_API_PROTO_AH": 50,
224 "IP_API_PROTO_ESP": 51,
225 "IP_API_PROTO_EIGRP": 88,
226 "IP_API_PROTO_OSPF": 89,
227 "IP_API_PROTO_SCTP": 132,
228 "IP_API_PROTO_RESERVED": 255,
232 func (x IPProto) String() string {
233 s, ok := IPProto_name[uint32(x)]
237 return "IPProto(" + strconv.Itoa(int(x)) + ")"
240 // AddressWithPrefix defines alias 'address_with_prefix'.
241 type AddressWithPrefix Prefix
243 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
244 prefix, err := ParsePrefix(s)
246 return AddressWithPrefix{}, err
248 return AddressWithPrefix(prefix), nil
250 func (x AddressWithPrefix) String() string {
251 return Prefix(x).String()
253 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
254 return []byte(x.String()), nil
256 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
257 prefix, err := ParseAddressWithPrefix(string(text))
265 // IP4Address defines alias 'ip4_address'.
266 type IP4Address [4]uint8
268 func ParseIP4Address(s string) (IP4Address, error) {
269 ip := net.ParseIP(s).To4()
271 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
273 var ipaddr IP4Address
274 copy(ipaddr[:], ip.To4())
278 func (x IP4Address) ToIP() net.IP {
279 return net.IP(x[:]).To4()
281 func (x IP4Address) String() string {
282 return x.ToIP().String()
284 func (x *IP4Address) MarshalText() ([]byte, error) {
285 return []byte(x.String()), nil
287 func (x *IP4Address) UnmarshalText(text []byte) error {
288 ipaddr, err := ParseIP4Address(string(text))
296 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
297 type IP4AddressWithPrefix IP4Prefix
299 // IP6Address defines alias 'ip6_address'.
300 type IP6Address [16]uint8
302 func ParseIP6Address(s string) (IP6Address, error) {
303 ip := net.ParseIP(s).To16()
305 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
307 var ipaddr IP6Address
308 copy(ipaddr[:], ip.To16())
312 func (x IP6Address) ToIP() net.IP {
313 return net.IP(x[:]).To16()
315 func (x IP6Address) String() string {
316 return x.ToIP().String()
318 func (x *IP6Address) MarshalText() ([]byte, error) {
319 return []byte(x.String()), nil
321 func (x *IP6Address) UnmarshalText(text []byte) error {
322 ipaddr, err := ParseIP6Address(string(text))
330 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
331 type IP6AddressWithPrefix IP6Prefix
333 // Address defines type 'address'.
334 type Address struct {
335 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
336 Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"`
339 func ParseAddress(s string) (Address, error) {
342 return Address{}, fmt.Errorf("invalid address: %s", s)
346 addr.Af = ADDRESS_IP6
348 copy(ip6[:], ip.To16())
351 addr.Af = ADDRESS_IP4
353 copy(ip4[:], ip.To4())
358 func (x Address) ToIP() net.IP {
359 if x.Af == ADDRESS_IP6 {
361 return net.IP(ip6[:]).To16()
364 return net.IP(ip4[:]).To4()
367 func (x Address) String() string {
368 return x.ToIP().String()
370 func (x *Address) MarshalText() ([]byte, error) {
371 return []byte(x.String()), nil
373 func (x *Address) UnmarshalText(text []byte) error {
374 addr, err := ParseAddress(string(text))
382 // IP4Prefix defines type 'ip4_prefix'.
383 type IP4Prefix struct {
384 Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
385 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
388 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
389 hasPrefix := strings.Contains(s, "/")
391 ip, network, err := net.ParseCIDR(s)
393 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
395 maskSize, _ := network.Mask.Size()
396 prefix.Len = byte(maskSize)
397 prefix.Address, err = ParseIP4Address(ip.String())
399 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
403 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
405 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
407 prefix.Len = byte(defaultMaskSize)
408 prefix.Address, err = ParseIP4Address(ip.String())
410 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
415 func (x IP4Prefix) ToIPNet() *net.IPNet {
416 mask := net.CIDRMask(int(x.Len), 32)
417 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
420 func (x IP4Prefix) String() string {
421 ip := x.Address.String()
422 return ip + "/" + strconv.Itoa(int(x.Len))
424 func (x *IP4Prefix) MarshalText() ([]byte, error) {
425 return []byte(x.String()), nil
427 func (x *IP4Prefix) UnmarshalText(text []byte) error {
428 prefix, err := ParseIP4Prefix(string(text))
436 // IP6Prefix defines type 'ip6_prefix'.
437 type IP6Prefix struct {
438 Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
439 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
442 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
443 hasPrefix := strings.Contains(s, "/")
445 ip, network, err := net.ParseCIDR(s)
447 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
449 maskSize, _ := network.Mask.Size()
450 prefix.Len = byte(maskSize)
451 prefix.Address, err = ParseIP6Address(ip.String())
453 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
457 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
459 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
461 prefix.Len = byte(defaultMaskSize)
462 prefix.Address, err = ParseIP6Address(ip.String())
464 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
469 func (x IP6Prefix) ToIPNet() *net.IPNet {
470 mask := net.CIDRMask(int(x.Len), 128)
471 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
474 func (x IP6Prefix) String() string {
475 ip := x.Address.String()
476 return ip + "/" + strconv.Itoa(int(x.Len))
478 func (x *IP6Prefix) MarshalText() ([]byte, error) {
479 return []byte(x.String()), nil
481 func (x *IP6Prefix) UnmarshalText(text []byte) error {
482 prefix, err := ParseIP6Prefix(string(text))
490 // Mprefix defines type 'mprefix'.
491 type Mprefix struct {
492 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
493 GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
494 GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
495 SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
498 // Prefix defines type 'prefix'.
500 Address Address `binapi:"address,name=address" json:"address,omitempty"`
501 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
504 func ParsePrefix(ip string) (prefix Prefix, err error) {
505 hasPrefix := strings.Contains(ip, "/")
507 netIP, network, err := net.ParseCIDR(ip)
509 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
511 maskSize, _ := network.Mask.Size()
512 prefix.Len = byte(maskSize)
513 prefix.Address, err = ParseAddress(netIP.String())
515 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
518 netIP := net.ParseIP(ip)
519 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
520 if netIP.To4() == nil {
521 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
523 prefix.Len = byte(defaultMaskSize)
524 prefix.Address, err = ParseAddress(netIP.String())
526 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
531 func (x Prefix) ToIPNet() *net.IPNet {
533 if x.Address.Af == ADDRESS_IP4 {
534 mask = net.CIDRMask(int(x.Len), 32)
536 mask = net.CIDRMask(int(x.Len), 128)
538 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
541 func (x Prefix) String() string {
542 ip := x.Address.String()
543 return ip + "/" + strconv.Itoa(int(x.Len))
545 func (x *Prefix) MarshalText() ([]byte, error) {
546 return []byte(x.String()), nil
548 func (x *Prefix) UnmarshalText(text []byte) error {
549 prefix, err := ParsePrefix(string(text))
557 // PrefixMatcher defines type 'prefix_matcher'.
558 type PrefixMatcher struct {
559 Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
560 Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
563 // UDPEncap defines type 'udp_encap'.
564 type UDPEncap struct {
565 TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"`
566 SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"`
567 DstPort uint16 `binapi:"u16,name=dst_port" json:"dst_port,omitempty"`
568 SrcIP Address `binapi:"address,name=src_ip" json:"src_ip,omitempty"`
569 DstIP Address `binapi:"address,name=dst_ip" json:"dst_ip,omitempty"`
570 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
573 // AddressUnion defines union 'address_union'.
574 type AddressUnion struct {
577 XXX_UnionData [16]byte
580 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
584 func (u *AddressUnion) SetIP4(a IP4Address) {
585 buf := codec.NewBuffer(u.XXX_UnionData[:])
586 buf.EncodeBytes(a[:], 4)
588 func (u *AddressUnion) GetIP4() (a IP4Address) {
589 buf := codec.NewBuffer(u.XXX_UnionData[:])
590 copy(a[:], buf.DecodeBytes(4))
594 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
598 func (u *AddressUnion) SetIP6(a IP6Address) {
599 buf := codec.NewBuffer(u.XXX_UnionData[:])
600 buf.EncodeBytes(a[:], 16)
602 func (u *AddressUnion) GetIP6() (a IP6Address) {
603 buf := codec.NewBuffer(u.XXX_UnionData[:])
604 copy(a[:], buf.DecodeBytes(16))
608 // UDPEncapAdd defines message 'udp_encap_add'.
609 type UDPEncapAdd struct {
610 UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"`
613 func (m *UDPEncapAdd) Reset() { *m = UDPEncapAdd{} }
614 func (*UDPEncapAdd) GetMessageName() string { return "udp_encap_add" }
615 func (*UDPEncapAdd) GetCrcString() string { return "61d5fc48" }
616 func (*UDPEncapAdd) GetMessageType() api.MessageType {
617 return api.RequestMessage
620 func (m *UDPEncapAdd) Size() (size int) {
624 size += 4 // m.UDPEncap.TableID
625 size += 2 // m.UDPEncap.SrcPort
626 size += 2 // m.UDPEncap.DstPort
627 size += 4 // m.UDPEncap.SrcIP.Af
628 size += 1 * 16 // m.UDPEncap.SrcIP.Un
629 size += 4 // m.UDPEncap.DstIP.Af
630 size += 1 * 16 // m.UDPEncap.DstIP.Un
631 size += 4 // m.UDPEncap.ID
634 func (m *UDPEncapAdd) Marshal(b []byte) ([]byte, error) {
636 b = make([]byte, m.Size())
638 buf := codec.NewBuffer(b)
639 buf.EncodeUint32(m.UDPEncap.TableID)
640 buf.EncodeUint16(m.UDPEncap.SrcPort)
641 buf.EncodeUint16(m.UDPEncap.DstPort)
642 buf.EncodeUint32(uint32(m.UDPEncap.SrcIP.Af))
643 buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 16)
644 buf.EncodeUint32(uint32(m.UDPEncap.DstIP.Af))
645 buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 16)
646 buf.EncodeUint32(m.UDPEncap.ID)
647 return buf.Bytes(), nil
649 func (m *UDPEncapAdd) Unmarshal(b []byte) error {
650 buf := codec.NewBuffer(b)
651 m.UDPEncap.TableID = buf.DecodeUint32()
652 m.UDPEncap.SrcPort = buf.DecodeUint16()
653 m.UDPEncap.DstPort = buf.DecodeUint16()
654 m.UDPEncap.SrcIP.Af = AddressFamily(buf.DecodeUint32())
655 copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
656 m.UDPEncap.DstIP.Af = AddressFamily(buf.DecodeUint32())
657 copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
658 m.UDPEncap.ID = buf.DecodeUint32()
662 // UDPEncapAddReply defines message 'udp_encap_add_reply'.
663 type UDPEncapAddReply struct {
664 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
665 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
668 func (m *UDPEncapAddReply) Reset() { *m = UDPEncapAddReply{} }
669 func (*UDPEncapAddReply) GetMessageName() string { return "udp_encap_add_reply" }
670 func (*UDPEncapAddReply) GetCrcString() string { return "e2fc8294" }
671 func (*UDPEncapAddReply) GetMessageType() api.MessageType {
672 return api.ReplyMessage
675 func (m *UDPEncapAddReply) Size() (size int) {
679 size += 4 // m.Retval
683 func (m *UDPEncapAddReply) Marshal(b []byte) ([]byte, error) {
685 b = make([]byte, m.Size())
687 buf := codec.NewBuffer(b)
688 buf.EncodeInt32(m.Retval)
689 buf.EncodeUint32(m.ID)
690 return buf.Bytes(), nil
692 func (m *UDPEncapAddReply) Unmarshal(b []byte) error {
693 buf := codec.NewBuffer(b)
694 m.Retval = buf.DecodeInt32()
695 m.ID = buf.DecodeUint32()
699 // UDPEncapDel defines message 'udp_encap_del'.
700 type UDPEncapDel struct {
701 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
704 func (m *UDPEncapDel) Reset() { *m = UDPEncapDel{} }
705 func (*UDPEncapDel) GetMessageName() string { return "udp_encap_del" }
706 func (*UDPEncapDel) GetCrcString() string { return "3a91bde5" }
707 func (*UDPEncapDel) GetMessageType() api.MessageType {
708 return api.RequestMessage
711 func (m *UDPEncapDel) Size() (size int) {
718 func (m *UDPEncapDel) Marshal(b []byte) ([]byte, error) {
720 b = make([]byte, m.Size())
722 buf := codec.NewBuffer(b)
723 buf.EncodeUint32(m.ID)
724 return buf.Bytes(), nil
726 func (m *UDPEncapDel) Unmarshal(b []byte) error {
727 buf := codec.NewBuffer(b)
728 m.ID = buf.DecodeUint32()
732 // UDPEncapDelReply defines message 'udp_encap_del_reply'.
733 type UDPEncapDelReply struct {
734 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
737 func (m *UDPEncapDelReply) Reset() { *m = UDPEncapDelReply{} }
738 func (*UDPEncapDelReply) GetMessageName() string { return "udp_encap_del_reply" }
739 func (*UDPEncapDelReply) GetCrcString() string { return "e8d4e804" }
740 func (*UDPEncapDelReply) GetMessageType() api.MessageType {
741 return api.ReplyMessage
744 func (m *UDPEncapDelReply) Size() (size int) {
748 size += 4 // m.Retval
751 func (m *UDPEncapDelReply) Marshal(b []byte) ([]byte, error) {
753 b = make([]byte, m.Size())
755 buf := codec.NewBuffer(b)
756 buf.EncodeInt32(m.Retval)
757 return buf.Bytes(), nil
759 func (m *UDPEncapDelReply) Unmarshal(b []byte) error {
760 buf := codec.NewBuffer(b)
761 m.Retval = buf.DecodeInt32()
765 // UDPEncapDetails defines message 'udp_encap_details'.
766 type UDPEncapDetails struct {
767 UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"`
770 func (m *UDPEncapDetails) Reset() { *m = UDPEncapDetails{} }
771 func (*UDPEncapDetails) GetMessageName() string { return "udp_encap_details" }
772 func (*UDPEncapDetails) GetCrcString() string { return "87c82821" }
773 func (*UDPEncapDetails) GetMessageType() api.MessageType {
774 return api.ReplyMessage
777 func (m *UDPEncapDetails) Size() (size int) {
781 size += 4 // m.UDPEncap.TableID
782 size += 2 // m.UDPEncap.SrcPort
783 size += 2 // m.UDPEncap.DstPort
784 size += 4 // m.UDPEncap.SrcIP.Af
785 size += 1 * 16 // m.UDPEncap.SrcIP.Un
786 size += 4 // m.UDPEncap.DstIP.Af
787 size += 1 * 16 // m.UDPEncap.DstIP.Un
788 size += 4 // m.UDPEncap.ID
791 func (m *UDPEncapDetails) Marshal(b []byte) ([]byte, error) {
793 b = make([]byte, m.Size())
795 buf := codec.NewBuffer(b)
796 buf.EncodeUint32(m.UDPEncap.TableID)
797 buf.EncodeUint16(m.UDPEncap.SrcPort)
798 buf.EncodeUint16(m.UDPEncap.DstPort)
799 buf.EncodeUint32(uint32(m.UDPEncap.SrcIP.Af))
800 buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 16)
801 buf.EncodeUint32(uint32(m.UDPEncap.DstIP.Af))
802 buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 16)
803 buf.EncodeUint32(m.UDPEncap.ID)
804 return buf.Bytes(), nil
806 func (m *UDPEncapDetails) Unmarshal(b []byte) error {
807 buf := codec.NewBuffer(b)
808 m.UDPEncap.TableID = buf.DecodeUint32()
809 m.UDPEncap.SrcPort = buf.DecodeUint16()
810 m.UDPEncap.DstPort = buf.DecodeUint16()
811 m.UDPEncap.SrcIP.Af = AddressFamily(buf.DecodeUint32())
812 copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
813 m.UDPEncap.DstIP.Af = AddressFamily(buf.DecodeUint32())
814 copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
815 m.UDPEncap.ID = buf.DecodeUint32()
819 // UDPEncapDump defines message 'udp_encap_dump'.
820 type UDPEncapDump struct{}
822 func (m *UDPEncapDump) Reset() { *m = UDPEncapDump{} }
823 func (*UDPEncapDump) GetMessageName() string { return "udp_encap_dump" }
824 func (*UDPEncapDump) GetCrcString() string { return "51077d14" }
825 func (*UDPEncapDump) GetMessageType() api.MessageType {
826 return api.RequestMessage
829 func (m *UDPEncapDump) Size() (size int) {
835 func (m *UDPEncapDump) Marshal(b []byte) ([]byte, error) {
837 b = make([]byte, m.Size())
839 buf := codec.NewBuffer(b)
840 return buf.Bytes(), nil
842 func (m *UDPEncapDump) Unmarshal(b []byte) error {
846 func init() { file_udp_binapi_init() }
847 func file_udp_binapi_init() {
848 api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_61d5fc48")
849 api.RegisterMessage((*UDPEncapAddReply)(nil), "udp_encap_add_reply_e2fc8294")
850 api.RegisterMessage((*UDPEncapDel)(nil), "udp_encap_del_3a91bde5")
851 api.RegisterMessage((*UDPEncapDelReply)(nil), "udp_encap_del_reply_e8d4e804")
852 api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_87c82821")
853 api.RegisterMessage((*UDPEncapDump)(nil), "udp_encap_dump_51077d14")
856 // Messages returns list of all messages in this module.
857 func AllMessages() []api.Message {
858 return []api.Message{
860 (*UDPEncapAddReply)(nil),
862 (*UDPEncapDelReply)(nil),
863 (*UDPEncapDetails)(nil),
864 (*UDPEncapDump)(nil),