a457715e8ce5cb81d22614e426ebd0b029e8aaf6
[govpp.git] / binapi / udp_ping / udp_ping.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-dev
4 //  VPP:              20.05-release
5
6 // Package udp_ping contains generated bindings for API file udp_ping.api.
7 //
8 // Contents:
9 //   4 messages
10 //
11 package udp_ping
12
13 import (
14         api "git.fd.io/govpp.git/api"
15         ip_types "git.fd.io/govpp.git/binapi/ip_types"
16         codec "git.fd.io/govpp.git/codec"
17 )
18
19 // This is a compile-time assertion to ensure that this generated file
20 // is compatible with the GoVPP api package it is being compiled against.
21 // A compilation error at this line likely means your copy of the
22 // GoVPP api package needs to be updated.
23 const _ = api.GoVppAPIPackageIsVersion2
24
25 const (
26         APIFile    = "udp_ping"
27         APIVersion = "3.0.0"
28         VersionCrc = 0x3b2c67de
29 )
30
31 // UDPPingAddDel defines message 'udp_ping_add_del'.
32 type UDPPingAddDel struct {
33         SrcIPAddress ip_types.Address `binapi:"address,name=src_ip_address" json:"src_ip_address,omitempty"`
34         DstIPAddress ip_types.Address `binapi:"address,name=dst_ip_address" json:"dst_ip_address,omitempty"`
35         StartSrcPort uint16           `binapi:"u16,name=start_src_port" json:"start_src_port,omitempty"`
36         EndSrcPort   uint16           `binapi:"u16,name=end_src_port" json:"end_src_port,omitempty"`
37         StartDstPort uint16           `binapi:"u16,name=start_dst_port" json:"start_dst_port,omitempty"`
38         EndDstPort   uint16           `binapi:"u16,name=end_dst_port" json:"end_dst_port,omitempty"`
39         Interval     uint16           `binapi:"u16,name=interval" json:"interval,omitempty"`
40         Dis          uint8            `binapi:"u8,name=dis" json:"dis,omitempty"`
41         FaultDet     uint8            `binapi:"u8,name=fault_det" json:"fault_det,omitempty"`
42         Reserve      []byte           `binapi:"u8[3],name=reserve" json:"reserve,omitempty"`
43 }
44
45 func (m *UDPPingAddDel) Reset()               { *m = UDPPingAddDel{} }
46 func (*UDPPingAddDel) GetMessageName() string { return "udp_ping_add_del" }
47 func (*UDPPingAddDel) GetCrcString() string   { return "c692b188" }
48 func (*UDPPingAddDel) GetMessageType() api.MessageType {
49         return api.RequestMessage
50 }
51
52 func (m *UDPPingAddDel) Size() (size int) {
53         if m == nil {
54                 return 0
55         }
56         size += 1      // m.SrcIPAddress.Af
57         size += 1 * 16 // m.SrcIPAddress.Un
58         size += 1      // m.DstIPAddress.Af
59         size += 1 * 16 // m.DstIPAddress.Un
60         size += 2      // m.StartSrcPort
61         size += 2      // m.EndSrcPort
62         size += 2      // m.StartDstPort
63         size += 2      // m.EndDstPort
64         size += 2      // m.Interval
65         size += 1      // m.Dis
66         size += 1      // m.FaultDet
67         size += 1 * 3  // m.Reserve
68         return size
69 }
70 func (m *UDPPingAddDel) Marshal(b []byte) ([]byte, error) {
71         if b == nil {
72                 b = make([]byte, m.Size())
73         }
74         buf := codec.NewBuffer(b)
75         buf.EncodeUint8(uint8(m.SrcIPAddress.Af))
76         buf.EncodeBytes(m.SrcIPAddress.Un.XXX_UnionData[:], 16)
77         buf.EncodeUint8(uint8(m.DstIPAddress.Af))
78         buf.EncodeBytes(m.DstIPAddress.Un.XXX_UnionData[:], 16)
79         buf.EncodeUint16(m.StartSrcPort)
80         buf.EncodeUint16(m.EndSrcPort)
81         buf.EncodeUint16(m.StartDstPort)
82         buf.EncodeUint16(m.EndDstPort)
83         buf.EncodeUint16(m.Interval)
84         buf.EncodeUint8(m.Dis)
85         buf.EncodeUint8(m.FaultDet)
86         buf.EncodeBytes(m.Reserve, 3)
87         return buf.Bytes(), nil
88 }
89 func (m *UDPPingAddDel) Unmarshal(b []byte) error {
90         buf := codec.NewBuffer(b)
91         m.SrcIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
92         copy(m.SrcIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
93         m.DstIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
94         copy(m.DstIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
95         m.StartSrcPort = buf.DecodeUint16()
96         m.EndSrcPort = buf.DecodeUint16()
97         m.StartDstPort = buf.DecodeUint16()
98         m.EndDstPort = buf.DecodeUint16()
99         m.Interval = buf.DecodeUint16()
100         m.Dis = buf.DecodeUint8()
101         m.FaultDet = buf.DecodeUint8()
102         m.Reserve = make([]byte, 3)
103         copy(m.Reserve, buf.DecodeBytes(len(m.Reserve)))
104         return nil
105 }
106
107 // UDPPingAddDelReply defines message 'udp_ping_add_del_reply'.
108 type UDPPingAddDelReply struct {
109         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
110 }
111
112 func (m *UDPPingAddDelReply) Reset()               { *m = UDPPingAddDelReply{} }
113 func (*UDPPingAddDelReply) GetMessageName() string { return "udp_ping_add_del_reply" }
114 func (*UDPPingAddDelReply) GetCrcString() string   { return "e8d4e804" }
115 func (*UDPPingAddDelReply) GetMessageType() api.MessageType {
116         return api.ReplyMessage
117 }
118
119 func (m *UDPPingAddDelReply) Size() (size int) {
120         if m == nil {
121                 return 0
122         }
123         size += 4 // m.Retval
124         return size
125 }
126 func (m *UDPPingAddDelReply) Marshal(b []byte) ([]byte, error) {
127         if b == nil {
128                 b = make([]byte, m.Size())
129         }
130         buf := codec.NewBuffer(b)
131         buf.EncodeInt32(m.Retval)
132         return buf.Bytes(), nil
133 }
134 func (m *UDPPingAddDelReply) Unmarshal(b []byte) error {
135         buf := codec.NewBuffer(b)
136         m.Retval = buf.DecodeInt32()
137         return nil
138 }
139
140 // UDPPingExport defines message 'udp_ping_export'.
141 type UDPPingExport struct {
142         Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"`
143 }
144
145 func (m *UDPPingExport) Reset()               { *m = UDPPingExport{} }
146 func (*UDPPingExport) GetMessageName() string { return "udp_ping_export" }
147 func (*UDPPingExport) GetCrcString() string   { return "b3e225d2" }
148 func (*UDPPingExport) GetMessageType() api.MessageType {
149         return api.RequestMessage
150 }
151
152 func (m *UDPPingExport) Size() (size int) {
153         if m == nil {
154                 return 0
155         }
156         size += 1 // m.Enable
157         return size
158 }
159 func (m *UDPPingExport) Marshal(b []byte) ([]byte, error) {
160         if b == nil {
161                 b = make([]byte, m.Size())
162         }
163         buf := codec.NewBuffer(b)
164         buf.EncodeBool(m.Enable)
165         return buf.Bytes(), nil
166 }
167 func (m *UDPPingExport) Unmarshal(b []byte) error {
168         buf := codec.NewBuffer(b)
169         m.Enable = buf.DecodeBool()
170         return nil
171 }
172
173 // UDPPingExportReply defines message 'udp_ping_export_reply'.
174 type UDPPingExportReply struct {
175         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
176 }
177
178 func (m *UDPPingExportReply) Reset()               { *m = UDPPingExportReply{} }
179 func (*UDPPingExportReply) GetMessageName() string { return "udp_ping_export_reply" }
180 func (*UDPPingExportReply) GetCrcString() string   { return "e8d4e804" }
181 func (*UDPPingExportReply) GetMessageType() api.MessageType {
182         return api.ReplyMessage
183 }
184
185 func (m *UDPPingExportReply) Size() (size int) {
186         if m == nil {
187                 return 0
188         }
189         size += 4 // m.Retval
190         return size
191 }
192 func (m *UDPPingExportReply) Marshal(b []byte) ([]byte, error) {
193         if b == nil {
194                 b = make([]byte, m.Size())
195         }
196         buf := codec.NewBuffer(b)
197         buf.EncodeInt32(m.Retval)
198         return buf.Bytes(), nil
199 }
200 func (m *UDPPingExportReply) Unmarshal(b []byte) error {
201         buf := codec.NewBuffer(b)
202         m.Retval = buf.DecodeInt32()
203         return nil
204 }
205
206 func init() { file_udp_ping_binapi_init() }
207 func file_udp_ping_binapi_init() {
208         api.RegisterMessage((*UDPPingAddDel)(nil), "udp_ping_add_del_c692b188")
209         api.RegisterMessage((*UDPPingAddDelReply)(nil), "udp_ping_add_del_reply_e8d4e804")
210         api.RegisterMessage((*UDPPingExport)(nil), "udp_ping_export_b3e225d2")
211         api.RegisterMessage((*UDPPingExportReply)(nil), "udp_ping_export_reply_e8d4e804")
212 }
213
214 // Messages returns list of all messages in this module.
215 func AllMessages() []api.Message {
216         return []api.Message{
217                 (*UDPPingAddDel)(nil),
218                 (*UDPPingAddDelReply)(nil),
219                 (*UDPPingExport)(nil),
220                 (*UDPPingExportReply)(nil),
221         }
222 }