binapigen: fix union size
[govpp.git] / binapi / pipe / pipe.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/pipe.api.json
6
7 // Package pipe contains generated bindings for API file pipe.api.
8 //
9 // Contents:
10 //   6 messages
11 //
12 package pipe
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    = "pipe"
28         APIVersion = "1.0.1"
29         VersionCrc = 0xd22736c9
30 )
31
32 // PipeCreate defines message 'pipe_create'.
33 type PipeCreate struct {
34         IsSpecified  bool   `binapi:"bool,name=is_specified" json:"is_specified,omitempty"`
35         UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"`
36 }
37
38 func (m *PipeCreate) Reset()               { *m = PipeCreate{} }
39 func (*PipeCreate) GetMessageName() string { return "pipe_create" }
40 func (*PipeCreate) GetCrcString() string   { return "bb263bd3" }
41 func (*PipeCreate) GetMessageType() api.MessageType {
42         return api.RequestMessage
43 }
44
45 func (m *PipeCreate) Size() (size int) {
46         if m == nil {
47                 return 0
48         }
49         size += 1 // m.IsSpecified
50         size += 4 // m.UserInstance
51         return size
52 }
53 func (m *PipeCreate) Marshal(b []byte) ([]byte, error) {
54         if b == nil {
55                 b = make([]byte, m.Size())
56         }
57         buf := codec.NewBuffer(b)
58         buf.EncodeBool(m.IsSpecified)
59         buf.EncodeUint32(m.UserInstance)
60         return buf.Bytes(), nil
61 }
62 func (m *PipeCreate) Unmarshal(b []byte) error {
63         buf := codec.NewBuffer(b)
64         m.IsSpecified = buf.DecodeBool()
65         m.UserInstance = buf.DecodeUint32()
66         return nil
67 }
68
69 // PipeCreateReply defines message 'pipe_create_reply'.
70 type PipeCreateReply struct {
71         Retval        int32                             `binapi:"i32,name=retval" json:"retval,omitempty"`
72         SwIfIndex     interface_types.InterfaceIndex    `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
73         PipeSwIfIndex [2]interface_types.InterfaceIndex `binapi:"interface_index[2],name=pipe_sw_if_index" json:"pipe_sw_if_index,omitempty"`
74 }
75
76 func (m *PipeCreateReply) Reset()               { *m = PipeCreateReply{} }
77 func (*PipeCreateReply) GetMessageName() string { return "pipe_create_reply" }
78 func (*PipeCreateReply) GetCrcString() string   { return "d4c2c2b3" }
79 func (*PipeCreateReply) GetMessageType() api.MessageType {
80         return api.ReplyMessage
81 }
82
83 func (m *PipeCreateReply) Size() (size int) {
84         if m == nil {
85                 return 0
86         }
87         size += 4 // m.Retval
88         size += 4 // m.SwIfIndex
89         for j1 := 0; j1 < 2; j1++ {
90                 size += 4 // m.PipeSwIfIndex[j1]
91         }
92         return size
93 }
94 func (m *PipeCreateReply) Marshal(b []byte) ([]byte, error) {
95         if b == nil {
96                 b = make([]byte, m.Size())
97         }
98         buf := codec.NewBuffer(b)
99         buf.EncodeInt32(m.Retval)
100         buf.EncodeUint32(uint32(m.SwIfIndex))
101         for j0 := 0; j0 < 2; j0++ {
102                 buf.EncodeUint32(uint32(m.PipeSwIfIndex[j0]))
103         }
104         return buf.Bytes(), nil
105 }
106 func (m *PipeCreateReply) Unmarshal(b []byte) error {
107         buf := codec.NewBuffer(b)
108         m.Retval = buf.DecodeInt32()
109         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
110         for j0 := 0; j0 < 2; j0++ {
111                 m.PipeSwIfIndex[j0] = interface_types.InterfaceIndex(buf.DecodeUint32())
112         }
113         return nil
114 }
115
116 // PipeDelete defines message 'pipe_delete'.
117 type PipeDelete struct {
118         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
119 }
120
121 func (m *PipeDelete) Reset()               { *m = PipeDelete{} }
122 func (*PipeDelete) GetMessageName() string { return "pipe_delete" }
123 func (*PipeDelete) GetCrcString() string   { return "f9e6675e" }
124 func (*PipeDelete) GetMessageType() api.MessageType {
125         return api.RequestMessage
126 }
127
128 func (m *PipeDelete) Size() (size int) {
129         if m == nil {
130                 return 0
131         }
132         size += 4 // m.SwIfIndex
133         return size
134 }
135 func (m *PipeDelete) Marshal(b []byte) ([]byte, error) {
136         if b == nil {
137                 b = make([]byte, m.Size())
138         }
139         buf := codec.NewBuffer(b)
140         buf.EncodeUint32(uint32(m.SwIfIndex))
141         return buf.Bytes(), nil
142 }
143 func (m *PipeDelete) Unmarshal(b []byte) error {
144         buf := codec.NewBuffer(b)
145         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
146         return nil
147 }
148
149 // PipeDeleteReply defines message 'pipe_delete_reply'.
150 type PipeDeleteReply struct {
151         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
152 }
153
154 func (m *PipeDeleteReply) Reset()               { *m = PipeDeleteReply{} }
155 func (*PipeDeleteReply) GetMessageName() string { return "pipe_delete_reply" }
156 func (*PipeDeleteReply) GetCrcString() string   { return "e8d4e804" }
157 func (*PipeDeleteReply) GetMessageType() api.MessageType {
158         return api.ReplyMessage
159 }
160
161 func (m *PipeDeleteReply) Size() (size int) {
162         if m == nil {
163                 return 0
164         }
165         size += 4 // m.Retval
166         return size
167 }
168 func (m *PipeDeleteReply) Marshal(b []byte) ([]byte, error) {
169         if b == nil {
170                 b = make([]byte, m.Size())
171         }
172         buf := codec.NewBuffer(b)
173         buf.EncodeInt32(m.Retval)
174         return buf.Bytes(), nil
175 }
176 func (m *PipeDeleteReply) Unmarshal(b []byte) error {
177         buf := codec.NewBuffer(b)
178         m.Retval = buf.DecodeInt32()
179         return nil
180 }
181
182 // PipeDetails defines message 'pipe_details'.
183 type PipeDetails struct {
184         SwIfIndex     interface_types.InterfaceIndex    `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
185         PipeSwIfIndex [2]interface_types.InterfaceIndex `binapi:"interface_index[2],name=pipe_sw_if_index" json:"pipe_sw_if_index,omitempty"`
186         Instance      uint32                            `binapi:"u32,name=instance" json:"instance,omitempty"`
187 }
188
189 func (m *PipeDetails) Reset()               { *m = PipeDetails{} }
190 func (*PipeDetails) GetMessageName() string { return "pipe_details" }
191 func (*PipeDetails) GetCrcString() string   { return "43ac107a" }
192 func (*PipeDetails) GetMessageType() api.MessageType {
193         return api.ReplyMessage
194 }
195
196 func (m *PipeDetails) Size() (size int) {
197         if m == nil {
198                 return 0
199         }
200         size += 4 // m.SwIfIndex
201         for j1 := 0; j1 < 2; j1++ {
202                 size += 4 // m.PipeSwIfIndex[j1]
203         }
204         size += 4 // m.Instance
205         return size
206 }
207 func (m *PipeDetails) Marshal(b []byte) ([]byte, error) {
208         if b == nil {
209                 b = make([]byte, m.Size())
210         }
211         buf := codec.NewBuffer(b)
212         buf.EncodeUint32(uint32(m.SwIfIndex))
213         for j0 := 0; j0 < 2; j0++ {
214                 buf.EncodeUint32(uint32(m.PipeSwIfIndex[j0]))
215         }
216         buf.EncodeUint32(m.Instance)
217         return buf.Bytes(), nil
218 }
219 func (m *PipeDetails) Unmarshal(b []byte) error {
220         buf := codec.NewBuffer(b)
221         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
222         for j0 := 0; j0 < 2; j0++ {
223                 m.PipeSwIfIndex[j0] = interface_types.InterfaceIndex(buf.DecodeUint32())
224         }
225         m.Instance = buf.DecodeUint32()
226         return nil
227 }
228
229 // PipeDump defines message 'pipe_dump'.
230 type PipeDump struct{}
231
232 func (m *PipeDump) Reset()               { *m = PipeDump{} }
233 func (*PipeDump) GetMessageName() string { return "pipe_dump" }
234 func (*PipeDump) GetCrcString() string   { return "51077d14" }
235 func (*PipeDump) GetMessageType() api.MessageType {
236         return api.RequestMessage
237 }
238
239 func (m *PipeDump) Size() (size int) {
240         if m == nil {
241                 return 0
242         }
243         return size
244 }
245 func (m *PipeDump) Marshal(b []byte) ([]byte, error) {
246         if b == nil {
247                 b = make([]byte, m.Size())
248         }
249         buf := codec.NewBuffer(b)
250         return buf.Bytes(), nil
251 }
252 func (m *PipeDump) Unmarshal(b []byte) error {
253         return nil
254 }
255
256 func init() { file_pipe_binapi_init() }
257 func file_pipe_binapi_init() {
258         api.RegisterMessage((*PipeCreate)(nil), "pipe_create_bb263bd3")
259         api.RegisterMessage((*PipeCreateReply)(nil), "pipe_create_reply_d4c2c2b3")
260         api.RegisterMessage((*PipeDelete)(nil), "pipe_delete_f9e6675e")
261         api.RegisterMessage((*PipeDeleteReply)(nil), "pipe_delete_reply_e8d4e804")
262         api.RegisterMessage((*PipeDetails)(nil), "pipe_details_43ac107a")
263         api.RegisterMessage((*PipeDump)(nil), "pipe_dump_51077d14")
264 }
265
266 // Messages returns list of all messages in this module.
267 func AllMessages() []api.Message {
268         return []api.Message{
269                 (*PipeCreate)(nil),
270                 (*PipeCreateReply)(nil),
271                 (*PipeDelete)(nil),
272                 (*PipeDeleteReply)(nil),
273                 (*PipeDetails)(nil),
274                 (*PipeDump)(nil),
275         }
276 }