binapigen: fix union size
[govpp.git] / binapi / avf / avf.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/avf.api.json
6
7 // Package avf contains generated bindings for API file avf.api.
8 //
9 // Contents:
10 //   4 messages
11 //
12 package avf
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    = "avf"
28         APIVersion = "1.0.0"
29         VersionCrc = 0xbaaa7124
30 )
31
32 // AvfCreate defines message 'avf_create'.
33 type AvfCreate struct {
34         PciAddr    uint32 `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"`
35         EnableElog int32  `binapi:"i32,name=enable_elog" json:"enable_elog,omitempty"`
36         RxqNum     uint16 `binapi:"u16,name=rxq_num" json:"rxq_num,omitempty"`
37         RxqSize    uint16 `binapi:"u16,name=rxq_size" json:"rxq_size,omitempty"`
38         TxqSize    uint16 `binapi:"u16,name=txq_size" json:"txq_size,omitempty"`
39 }
40
41 func (m *AvfCreate) Reset()               { *m = AvfCreate{} }
42 func (*AvfCreate) GetMessageName() string { return "avf_create" }
43 func (*AvfCreate) GetCrcString() string   { return "daab8ae2" }
44 func (*AvfCreate) GetMessageType() api.MessageType {
45         return api.RequestMessage
46 }
47
48 func (m *AvfCreate) Size() (size int) {
49         if m == nil {
50                 return 0
51         }
52         size += 4 // m.PciAddr
53         size += 4 // m.EnableElog
54         size += 2 // m.RxqNum
55         size += 2 // m.RxqSize
56         size += 2 // m.TxqSize
57         return size
58 }
59 func (m *AvfCreate) Marshal(b []byte) ([]byte, error) {
60         if b == nil {
61                 b = make([]byte, m.Size())
62         }
63         buf := codec.NewBuffer(b)
64         buf.EncodeUint32(m.PciAddr)
65         buf.EncodeInt32(m.EnableElog)
66         buf.EncodeUint16(m.RxqNum)
67         buf.EncodeUint16(m.RxqSize)
68         buf.EncodeUint16(m.TxqSize)
69         return buf.Bytes(), nil
70 }
71 func (m *AvfCreate) Unmarshal(b []byte) error {
72         buf := codec.NewBuffer(b)
73         m.PciAddr = buf.DecodeUint32()
74         m.EnableElog = buf.DecodeInt32()
75         m.RxqNum = buf.DecodeUint16()
76         m.RxqSize = buf.DecodeUint16()
77         m.TxqSize = buf.DecodeUint16()
78         return nil
79 }
80
81 // AvfCreateReply defines message 'avf_create_reply'.
82 type AvfCreateReply struct {
83         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
84         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
85 }
86
87 func (m *AvfCreateReply) Reset()               { *m = AvfCreateReply{} }
88 func (*AvfCreateReply) GetMessageName() string { return "avf_create_reply" }
89 func (*AvfCreateReply) GetCrcString() string   { return "5383d31f" }
90 func (*AvfCreateReply) GetMessageType() api.MessageType {
91         return api.ReplyMessage
92 }
93
94 func (m *AvfCreateReply) Size() (size int) {
95         if m == nil {
96                 return 0
97         }
98         size += 4 // m.Retval
99         size += 4 // m.SwIfIndex
100         return size
101 }
102 func (m *AvfCreateReply) Marshal(b []byte) ([]byte, error) {
103         if b == nil {
104                 b = make([]byte, m.Size())
105         }
106         buf := codec.NewBuffer(b)
107         buf.EncodeInt32(m.Retval)
108         buf.EncodeUint32(uint32(m.SwIfIndex))
109         return buf.Bytes(), nil
110 }
111 func (m *AvfCreateReply) Unmarshal(b []byte) error {
112         buf := codec.NewBuffer(b)
113         m.Retval = buf.DecodeInt32()
114         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
115         return nil
116 }
117
118 // AvfDelete defines message 'avf_delete'.
119 type AvfDelete struct {
120         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
121 }
122
123 func (m *AvfDelete) Reset()               { *m = AvfDelete{} }
124 func (*AvfDelete) GetMessageName() string { return "avf_delete" }
125 func (*AvfDelete) GetCrcString() string   { return "f9e6675e" }
126 func (*AvfDelete) GetMessageType() api.MessageType {
127         return api.RequestMessage
128 }
129
130 func (m *AvfDelete) Size() (size int) {
131         if m == nil {
132                 return 0
133         }
134         size += 4 // m.SwIfIndex
135         return size
136 }
137 func (m *AvfDelete) Marshal(b []byte) ([]byte, error) {
138         if b == nil {
139                 b = make([]byte, m.Size())
140         }
141         buf := codec.NewBuffer(b)
142         buf.EncodeUint32(uint32(m.SwIfIndex))
143         return buf.Bytes(), nil
144 }
145 func (m *AvfDelete) Unmarshal(b []byte) error {
146         buf := codec.NewBuffer(b)
147         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
148         return nil
149 }
150
151 // AvfDeleteReply defines message 'avf_delete_reply'.
152 type AvfDeleteReply struct {
153         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
154 }
155
156 func (m *AvfDeleteReply) Reset()               { *m = AvfDeleteReply{} }
157 func (*AvfDeleteReply) GetMessageName() string { return "avf_delete_reply" }
158 func (*AvfDeleteReply) GetCrcString() string   { return "e8d4e804" }
159 func (*AvfDeleteReply) GetMessageType() api.MessageType {
160         return api.ReplyMessage
161 }
162
163 func (m *AvfDeleteReply) Size() (size int) {
164         if m == nil {
165                 return 0
166         }
167         size += 4 // m.Retval
168         return size
169 }
170 func (m *AvfDeleteReply) Marshal(b []byte) ([]byte, error) {
171         if b == nil {
172                 b = make([]byte, m.Size())
173         }
174         buf := codec.NewBuffer(b)
175         buf.EncodeInt32(m.Retval)
176         return buf.Bytes(), nil
177 }
178 func (m *AvfDeleteReply) Unmarshal(b []byte) error {
179         buf := codec.NewBuffer(b)
180         m.Retval = buf.DecodeInt32()
181         return nil
182 }
183
184 func init() { file_avf_binapi_init() }
185 func file_avf_binapi_init() {
186         api.RegisterMessage((*AvfCreate)(nil), "avf_create_daab8ae2")
187         api.RegisterMessage((*AvfCreateReply)(nil), "avf_create_reply_5383d31f")
188         api.RegisterMessage((*AvfDelete)(nil), "avf_delete_f9e6675e")
189         api.RegisterMessage((*AvfDeleteReply)(nil), "avf_delete_reply_e8d4e804")
190 }
191
192 // Messages returns list of all messages in this module.
193 func AllMessages() []api.Message {
194         return []api.Message{
195                 (*AvfCreate)(nil),
196                 (*AvfCreateReply)(nil),
197                 (*AvfDelete)(nil),
198                 (*AvfDeleteReply)(nil),
199         }
200 }