binapigen: fix union size
[govpp.git] / binapi / teib / teib.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/teib.api.json
6
7 // Package teib contains generated bindings for API file teib.api.
8 //
9 // Contents:
10 //   1 struct
11 //   4 messages
12 //
13 package teib
14
15 import (
16         api "git.fd.io/govpp.git/api"
17         interface_types "git.fd.io/govpp.git/binapi/interface_types"
18         ip_types "git.fd.io/govpp.git/binapi/ip_types"
19         codec "git.fd.io/govpp.git/codec"
20 )
21
22 // This is a compile-time assertion to ensure that this generated file
23 // is compatible with the GoVPP api package it is being compiled against.
24 // A compilation error at this line likely means your copy of the
25 // GoVPP api package needs to be updated.
26 const _ = api.GoVppAPIPackageIsVersion2
27
28 const (
29         APIFile    = "teib"
30         APIVersion = "1.0.0"
31         VersionCrc = 0xaac93c17
32 )
33
34 // TeibEntry defines type 'teib_entry'.
35 type TeibEntry struct {
36         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
37         Peer      ip_types.Address               `binapi:"address,name=peer" json:"peer,omitempty"`
38         Nh        ip_types.Address               `binapi:"address,name=nh" json:"nh,omitempty"`
39         NhTableID uint32                         `binapi:"u32,name=nh_table_id" json:"nh_table_id,omitempty"`
40 }
41
42 // TeibDetails defines message 'teib_details'.
43 type TeibDetails struct {
44         Entry TeibEntry `binapi:"teib_entry,name=entry" json:"entry,omitempty"`
45 }
46
47 func (m *TeibDetails) Reset()               { *m = TeibDetails{} }
48 func (*TeibDetails) GetMessageName() string { return "teib_details" }
49 func (*TeibDetails) GetCrcString() string   { return "e3b6a503" }
50 func (*TeibDetails) GetMessageType() api.MessageType {
51         return api.ReplyMessage
52 }
53
54 func (m *TeibDetails) Size() (size int) {
55         if m == nil {
56                 return 0
57         }
58         size += 4      // m.Entry.SwIfIndex
59         size += 1      // m.Entry.Peer.Af
60         size += 1 * 16 // m.Entry.Peer.Un
61         size += 1      // m.Entry.Nh.Af
62         size += 1 * 16 // m.Entry.Nh.Un
63         size += 4      // m.Entry.NhTableID
64         return size
65 }
66 func (m *TeibDetails) Marshal(b []byte) ([]byte, error) {
67         if b == nil {
68                 b = make([]byte, m.Size())
69         }
70         buf := codec.NewBuffer(b)
71         buf.EncodeUint32(uint32(m.Entry.SwIfIndex))
72         buf.EncodeUint8(uint8(m.Entry.Peer.Af))
73         buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 16)
74         buf.EncodeUint8(uint8(m.Entry.Nh.Af))
75         buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 16)
76         buf.EncodeUint32(m.Entry.NhTableID)
77         return buf.Bytes(), nil
78 }
79 func (m *TeibDetails) Unmarshal(b []byte) error {
80         buf := codec.NewBuffer(b)
81         m.Entry.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
82         m.Entry.Peer.Af = ip_types.AddressFamily(buf.DecodeUint8())
83         copy(m.Entry.Peer.Un.XXX_UnionData[:], buf.DecodeBytes(16))
84         m.Entry.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8())
85         copy(m.Entry.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16))
86         m.Entry.NhTableID = buf.DecodeUint32()
87         return nil
88 }
89
90 // TeibDump defines message 'teib_dump'.
91 type TeibDump struct{}
92
93 func (m *TeibDump) Reset()               { *m = TeibDump{} }
94 func (*TeibDump) GetMessageName() string { return "teib_dump" }
95 func (*TeibDump) GetCrcString() string   { return "51077d14" }
96 func (*TeibDump) GetMessageType() api.MessageType {
97         return api.RequestMessage
98 }
99
100 func (m *TeibDump) Size() (size int) {
101         if m == nil {
102                 return 0
103         }
104         return size
105 }
106 func (m *TeibDump) Marshal(b []byte) ([]byte, error) {
107         if b == nil {
108                 b = make([]byte, m.Size())
109         }
110         buf := codec.NewBuffer(b)
111         return buf.Bytes(), nil
112 }
113 func (m *TeibDump) Unmarshal(b []byte) error {
114         return nil
115 }
116
117 // TeibEntryAddDel defines message 'teib_entry_add_del'.
118 type TeibEntryAddDel struct {
119         IsAdd uint8     `binapi:"u8,name=is_add" json:"is_add,omitempty"`
120         Entry TeibEntry `binapi:"teib_entry,name=entry" json:"entry,omitempty"`
121 }
122
123 func (m *TeibEntryAddDel) Reset()               { *m = TeibEntryAddDel{} }
124 func (*TeibEntryAddDel) GetMessageName() string { return "teib_entry_add_del" }
125 func (*TeibEntryAddDel) GetCrcString() string   { return "5aa0a538" }
126 func (*TeibEntryAddDel) GetMessageType() api.MessageType {
127         return api.RequestMessage
128 }
129
130 func (m *TeibEntryAddDel) Size() (size int) {
131         if m == nil {
132                 return 0
133         }
134         size += 1      // m.IsAdd
135         size += 4      // m.Entry.SwIfIndex
136         size += 1      // m.Entry.Peer.Af
137         size += 1 * 16 // m.Entry.Peer.Un
138         size += 1      // m.Entry.Nh.Af
139         size += 1 * 16 // m.Entry.Nh.Un
140         size += 4      // m.Entry.NhTableID
141         return size
142 }
143 func (m *TeibEntryAddDel) Marshal(b []byte) ([]byte, error) {
144         if b == nil {
145                 b = make([]byte, m.Size())
146         }
147         buf := codec.NewBuffer(b)
148         buf.EncodeUint8(m.IsAdd)
149         buf.EncodeUint32(uint32(m.Entry.SwIfIndex))
150         buf.EncodeUint8(uint8(m.Entry.Peer.Af))
151         buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 16)
152         buf.EncodeUint8(uint8(m.Entry.Nh.Af))
153         buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 16)
154         buf.EncodeUint32(m.Entry.NhTableID)
155         return buf.Bytes(), nil
156 }
157 func (m *TeibEntryAddDel) Unmarshal(b []byte) error {
158         buf := codec.NewBuffer(b)
159         m.IsAdd = buf.DecodeUint8()
160         m.Entry.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
161         m.Entry.Peer.Af = ip_types.AddressFamily(buf.DecodeUint8())
162         copy(m.Entry.Peer.Un.XXX_UnionData[:], buf.DecodeBytes(16))
163         m.Entry.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8())
164         copy(m.Entry.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16))
165         m.Entry.NhTableID = buf.DecodeUint32()
166         return nil
167 }
168
169 // TeibEntryAddDelReply defines message 'teib_entry_add_del_reply'.
170 type TeibEntryAddDelReply struct {
171         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
172 }
173
174 func (m *TeibEntryAddDelReply) Reset()               { *m = TeibEntryAddDelReply{} }
175 func (*TeibEntryAddDelReply) GetMessageName() string { return "teib_entry_add_del_reply" }
176 func (*TeibEntryAddDelReply) GetCrcString() string   { return "e8d4e804" }
177 func (*TeibEntryAddDelReply) GetMessageType() api.MessageType {
178         return api.ReplyMessage
179 }
180
181 func (m *TeibEntryAddDelReply) Size() (size int) {
182         if m == nil {
183                 return 0
184         }
185         size += 4 // m.Retval
186         return size
187 }
188 func (m *TeibEntryAddDelReply) Marshal(b []byte) ([]byte, error) {
189         if b == nil {
190                 b = make([]byte, m.Size())
191         }
192         buf := codec.NewBuffer(b)
193         buf.EncodeInt32(m.Retval)
194         return buf.Bytes(), nil
195 }
196 func (m *TeibEntryAddDelReply) Unmarshal(b []byte) error {
197         buf := codec.NewBuffer(b)
198         m.Retval = buf.DecodeInt32()
199         return nil
200 }
201
202 func init() { file_teib_binapi_init() }
203 func file_teib_binapi_init() {
204         api.RegisterMessage((*TeibDetails)(nil), "teib_details_e3b6a503")
205         api.RegisterMessage((*TeibDump)(nil), "teib_dump_51077d14")
206         api.RegisterMessage((*TeibEntryAddDel)(nil), "teib_entry_add_del_5aa0a538")
207         api.RegisterMessage((*TeibEntryAddDelReply)(nil), "teib_entry_add_del_reply_e8d4e804")
208 }
209
210 // Messages returns list of all messages in this module.
211 func AllMessages() []api.Message {
212         return []api.Message{
213                 (*TeibDetails)(nil),
214                 (*TeibDump)(nil),
215                 (*TeibEntryAddDel)(nil),
216                 (*TeibEntryAddDelReply)(nil),
217         }
218 }