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