Improve binapi generator
[govpp.git] / binapi / pg / pg.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/core/pg.api.json
6
7 // Package pg contains generated bindings for API file pg.api.
8 //
9 // Contents:
10 //   6 messages
11 //
12 package pg
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         interface_types "git.fd.io/govpp.git/binapi/interface_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    = "pg"
28         APIVersion = "2.0.0"
29         VersionCrc = 0xb7fe86ae
30 )
31
32 // PgCapture defines message 'pg_capture'.
33 type PgCapture struct {
34         InterfaceID  interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"`
35         IsEnabled    bool                           `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"`
36         Count        uint32                         `binapi:"u32,name=count" json:"count,omitempty"`
37         PcapFileName string                         `binapi:"string[],name=pcap_file_name" json:"pcap_file_name,omitempty"`
38 }
39
40 func (m *PgCapture) Reset()               { *m = PgCapture{} }
41 func (*PgCapture) GetMessageName() string { return "pg_capture" }
42 func (*PgCapture) GetCrcString() string   { return "3712fb6c" }
43 func (*PgCapture) GetMessageType() api.MessageType {
44         return api.RequestMessage
45 }
46
47 func (m *PgCapture) Size() int {
48         if m == nil {
49                 return 0
50         }
51         var size int
52         size += 4                       // m.InterfaceID
53         size += 1                       // m.IsEnabled
54         size += 4                       // m.Count
55         size += 4 + len(m.PcapFileName) // m.PcapFileName
56         return size
57 }
58 func (m *PgCapture) Marshal(b []byte) ([]byte, error) {
59         var buf *codec.Buffer
60         if b == nil {
61                 buf = codec.NewBuffer(make([]byte, m.Size()))
62         } else {
63                 buf = codec.NewBuffer(b)
64         }
65         buf.EncodeUint32(uint32(m.InterfaceID))
66         buf.EncodeBool(m.IsEnabled)
67         buf.EncodeUint32(uint32(m.Count))
68         buf.EncodeString(m.PcapFileName, 0)
69         return buf.Bytes(), nil
70 }
71 func (m *PgCapture) Unmarshal(b []byte) error {
72         buf := codec.NewBuffer(b)
73         m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32())
74         m.IsEnabled = buf.DecodeBool()
75         m.Count = buf.DecodeUint32()
76         m.PcapFileName = buf.DecodeString(0)
77         return nil
78 }
79
80 // PgCaptureReply defines message 'pg_capture_reply'.
81 type PgCaptureReply struct {
82         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
83 }
84
85 func (m *PgCaptureReply) Reset()               { *m = PgCaptureReply{} }
86 func (*PgCaptureReply) GetMessageName() string { return "pg_capture_reply" }
87 func (*PgCaptureReply) GetCrcString() string   { return "e8d4e804" }
88 func (*PgCaptureReply) GetMessageType() api.MessageType {
89         return api.ReplyMessage
90 }
91
92 func (m *PgCaptureReply) Size() int {
93         if m == nil {
94                 return 0
95         }
96         var size int
97         size += 4 // m.Retval
98         return size
99 }
100 func (m *PgCaptureReply) Marshal(b []byte) ([]byte, error) {
101         var buf *codec.Buffer
102         if b == nil {
103                 buf = codec.NewBuffer(make([]byte, m.Size()))
104         } else {
105                 buf = codec.NewBuffer(b)
106         }
107         buf.EncodeUint32(uint32(m.Retval))
108         return buf.Bytes(), nil
109 }
110 func (m *PgCaptureReply) Unmarshal(b []byte) error {
111         buf := codec.NewBuffer(b)
112         m.Retval = int32(buf.DecodeUint32())
113         return nil
114 }
115
116 // PgCreateInterface defines message 'pg_create_interface'.
117 type PgCreateInterface struct {
118         InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"`
119         GsoEnabled  bool                           `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"`
120         GsoSize     uint32                         `binapi:"u32,name=gso_size" json:"gso_size,omitempty"`
121 }
122
123 func (m *PgCreateInterface) Reset()               { *m = PgCreateInterface{} }
124 func (*PgCreateInterface) GetMessageName() string { return "pg_create_interface" }
125 func (*PgCreateInterface) GetCrcString() string   { return "b7c893d7" }
126 func (*PgCreateInterface) GetMessageType() api.MessageType {
127         return api.RequestMessage
128 }
129
130 func (m *PgCreateInterface) Size() int {
131         if m == nil {
132                 return 0
133         }
134         var size int
135         size += 4 // m.InterfaceID
136         size += 1 // m.GsoEnabled
137         size += 4 // m.GsoSize
138         return size
139 }
140 func (m *PgCreateInterface) Marshal(b []byte) ([]byte, error) {
141         var buf *codec.Buffer
142         if b == nil {
143                 buf = codec.NewBuffer(make([]byte, m.Size()))
144         } else {
145                 buf = codec.NewBuffer(b)
146         }
147         buf.EncodeUint32(uint32(m.InterfaceID))
148         buf.EncodeBool(m.GsoEnabled)
149         buf.EncodeUint32(uint32(m.GsoSize))
150         return buf.Bytes(), nil
151 }
152 func (m *PgCreateInterface) Unmarshal(b []byte) error {
153         buf := codec.NewBuffer(b)
154         m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32())
155         m.GsoEnabled = buf.DecodeBool()
156         m.GsoSize = buf.DecodeUint32()
157         return nil
158 }
159
160 // PgCreateInterfaceReply defines message 'pg_create_interface_reply'.
161 type PgCreateInterfaceReply struct {
162         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
163         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
164 }
165
166 func (m *PgCreateInterfaceReply) Reset()               { *m = PgCreateInterfaceReply{} }
167 func (*PgCreateInterfaceReply) GetMessageName() string { return "pg_create_interface_reply" }
168 func (*PgCreateInterfaceReply) GetCrcString() string   { return "5383d31f" }
169 func (*PgCreateInterfaceReply) GetMessageType() api.MessageType {
170         return api.ReplyMessage
171 }
172
173 func (m *PgCreateInterfaceReply) Size() int {
174         if m == nil {
175                 return 0
176         }
177         var size int
178         size += 4 // m.Retval
179         size += 4 // m.SwIfIndex
180         return size
181 }
182 func (m *PgCreateInterfaceReply) Marshal(b []byte) ([]byte, error) {
183         var buf *codec.Buffer
184         if b == nil {
185                 buf = codec.NewBuffer(make([]byte, m.Size()))
186         } else {
187                 buf = codec.NewBuffer(b)
188         }
189         buf.EncodeUint32(uint32(m.Retval))
190         buf.EncodeUint32(uint32(m.SwIfIndex))
191         return buf.Bytes(), nil
192 }
193 func (m *PgCreateInterfaceReply) Unmarshal(b []byte) error {
194         buf := codec.NewBuffer(b)
195         m.Retval = int32(buf.DecodeUint32())
196         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
197         return nil
198 }
199
200 // PgEnableDisable defines message 'pg_enable_disable'.
201 type PgEnableDisable struct {
202         IsEnabled  bool   `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"`
203         StreamName string `binapi:"string[],name=stream_name" json:"stream_name,omitempty"`
204 }
205
206 func (m *PgEnableDisable) Reset()               { *m = PgEnableDisable{} }
207 func (*PgEnableDisable) GetMessageName() string { return "pg_enable_disable" }
208 func (*PgEnableDisable) GetCrcString() string   { return "01f94f3a" }
209 func (*PgEnableDisable) GetMessageType() api.MessageType {
210         return api.RequestMessage
211 }
212
213 func (m *PgEnableDisable) Size() int {
214         if m == nil {
215                 return 0
216         }
217         var size int
218         size += 1                     // m.IsEnabled
219         size += 4 + len(m.StreamName) // m.StreamName
220         return size
221 }
222 func (m *PgEnableDisable) Marshal(b []byte) ([]byte, error) {
223         var buf *codec.Buffer
224         if b == nil {
225                 buf = codec.NewBuffer(make([]byte, m.Size()))
226         } else {
227                 buf = codec.NewBuffer(b)
228         }
229         buf.EncodeBool(m.IsEnabled)
230         buf.EncodeString(m.StreamName, 0)
231         return buf.Bytes(), nil
232 }
233 func (m *PgEnableDisable) Unmarshal(b []byte) error {
234         buf := codec.NewBuffer(b)
235         m.IsEnabled = buf.DecodeBool()
236         m.StreamName = buf.DecodeString(0)
237         return nil
238 }
239
240 // PgEnableDisableReply defines message 'pg_enable_disable_reply'.
241 type PgEnableDisableReply struct {
242         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
243 }
244
245 func (m *PgEnableDisableReply) Reset()               { *m = PgEnableDisableReply{} }
246 func (*PgEnableDisableReply) GetMessageName() string { return "pg_enable_disable_reply" }
247 func (*PgEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
248 func (*PgEnableDisableReply) GetMessageType() api.MessageType {
249         return api.ReplyMessage
250 }
251
252 func (m *PgEnableDisableReply) Size() int {
253         if m == nil {
254                 return 0
255         }
256         var size int
257         size += 4 // m.Retval
258         return size
259 }
260 func (m *PgEnableDisableReply) Marshal(b []byte) ([]byte, error) {
261         var buf *codec.Buffer
262         if b == nil {
263                 buf = codec.NewBuffer(make([]byte, m.Size()))
264         } else {
265                 buf = codec.NewBuffer(b)
266         }
267         buf.EncodeUint32(uint32(m.Retval))
268         return buf.Bytes(), nil
269 }
270 func (m *PgEnableDisableReply) Unmarshal(b []byte) error {
271         buf := codec.NewBuffer(b)
272         m.Retval = int32(buf.DecodeUint32())
273         return nil
274 }
275
276 func init() { file_pg_binapi_init() }
277 func file_pg_binapi_init() {
278         api.RegisterMessage((*PgCapture)(nil), "pg_capture_3712fb6c")
279         api.RegisterMessage((*PgCaptureReply)(nil), "pg_capture_reply_e8d4e804")
280         api.RegisterMessage((*PgCreateInterface)(nil), "pg_create_interface_b7c893d7")
281         api.RegisterMessage((*PgCreateInterfaceReply)(nil), "pg_create_interface_reply_5383d31f")
282         api.RegisterMessage((*PgEnableDisable)(nil), "pg_enable_disable_01f94f3a")
283         api.RegisterMessage((*PgEnableDisableReply)(nil), "pg_enable_disable_reply_e8d4e804")
284 }
285
286 // Messages returns list of all messages in this module.
287 func AllMessages() []api.Message {
288         return []api.Message{
289                 (*PgCapture)(nil),
290                 (*PgCaptureReply)(nil),
291                 (*PgCreateInterface)(nil),
292                 (*PgCreateInterfaceReply)(nil),
293                 (*PgEnableDisable)(nil),
294                 (*PgEnableDisableReply)(nil),
295         }
296 }