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