Improve binapi generator
[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() int {
55         if m == nil {
56                 return 0
57         }
58         var size int
59         size += 4      // m.Entry.SwIfIndex
60         size += 1      // m.Entry.Peer.Af
61         size += 1 * 16 // m.Entry.Peer.Un
62         size += 1      // m.Entry.Nh.Af
63         size += 1 * 16 // m.Entry.Nh.Un
64         size += 4      // m.Entry.NhTableID
65         return size
66 }
67 func (m *TeibDetails) Marshal(b []byte) ([]byte, error) {
68         var buf *codec.Buffer
69         if b == nil {
70                 buf = codec.NewBuffer(make([]byte, m.Size()))
71         } else {
72                 buf = codec.NewBuffer(b)
73         }
74         buf.EncodeUint32(uint32(m.Entry.SwIfIndex))
75         buf.EncodeUint8(uint8(m.Entry.Peer.Af))
76         buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 0)
77         buf.EncodeUint8(uint8(m.Entry.Nh.Af))
78         buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 0)
79         buf.EncodeUint32(uint32(m.Entry.NhTableID))
80         return buf.Bytes(), nil
81 }
82 func (m *TeibDetails) Unmarshal(b []byte) error {
83         buf := codec.NewBuffer(b)
84         m.Entry.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
85         m.Entry.Peer.Af = ip_types.AddressFamily(buf.DecodeUint8())
86         copy(m.Entry.Peer.Un.XXX_UnionData[:], buf.DecodeBytes(16))
87         m.Entry.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8())
88         copy(m.Entry.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16))
89         m.Entry.NhTableID = buf.DecodeUint32()
90         return nil
91 }
92
93 // TeibDump defines message 'teib_dump'.
94 type TeibDump struct{}
95
96 func (m *TeibDump) Reset()               { *m = TeibDump{} }
97 func (*TeibDump) GetMessageName() string { return "teib_dump" }
98 func (*TeibDump) GetCrcString() string   { return "51077d14" }
99 func (*TeibDump) GetMessageType() api.MessageType {
100         return api.RequestMessage
101 }
102
103 func (m *TeibDump) Size() int {
104         if m == nil {
105                 return 0
106         }
107         var size int
108         return size
109 }
110 func (m *TeibDump) Marshal(b []byte) ([]byte, error) {
111         var buf *codec.Buffer
112         if b == nil {
113                 buf = codec.NewBuffer(make([]byte, m.Size()))
114         } else {
115                 buf = codec.NewBuffer(b)
116         }
117         return buf.Bytes(), nil
118 }
119 func (m *TeibDump) Unmarshal(b []byte) error {
120         return nil
121 }
122
123 // TeibEntryAddDel defines message 'teib_entry_add_del'.
124 type TeibEntryAddDel struct {
125         IsAdd uint8     `binapi:"u8,name=is_add" json:"is_add,omitempty"`
126         Entry TeibEntry `binapi:"teib_entry,name=entry" json:"entry,omitempty"`
127 }
128
129 func (m *TeibEntryAddDel) Reset()               { *m = TeibEntryAddDel{} }
130 func (*TeibEntryAddDel) GetMessageName() string { return "teib_entry_add_del" }
131 func (*TeibEntryAddDel) GetCrcString() string   { return "5aa0a538" }
132 func (*TeibEntryAddDel) GetMessageType() api.MessageType {
133         return api.RequestMessage
134 }
135
136 func (m *TeibEntryAddDel) Size() int {
137         if m == nil {
138                 return 0
139         }
140         var size int
141         size += 1      // m.IsAdd
142         size += 4      // m.Entry.SwIfIndex
143         size += 1      // m.Entry.Peer.Af
144         size += 1 * 16 // m.Entry.Peer.Un
145         size += 1      // m.Entry.Nh.Af
146         size += 1 * 16 // m.Entry.Nh.Un
147         size += 4      // m.Entry.NhTableID
148         return size
149 }
150 func (m *TeibEntryAddDel) Marshal(b []byte) ([]byte, error) {
151         var buf *codec.Buffer
152         if b == nil {
153                 buf = codec.NewBuffer(make([]byte, m.Size()))
154         } else {
155                 buf = codec.NewBuffer(b)
156         }
157         buf.EncodeUint8(uint8(m.IsAdd))
158         buf.EncodeUint32(uint32(m.Entry.SwIfIndex))
159         buf.EncodeUint8(uint8(m.Entry.Peer.Af))
160         buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 0)
161         buf.EncodeUint8(uint8(m.Entry.Nh.Af))
162         buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 0)
163         buf.EncodeUint32(uint32(m.Entry.NhTableID))
164         return buf.Bytes(), nil
165 }
166 func (m *TeibEntryAddDel) Unmarshal(b []byte) error {
167         buf := codec.NewBuffer(b)
168         m.IsAdd = buf.DecodeUint8()
169         m.Entry.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
170         m.Entry.Peer.Af = ip_types.AddressFamily(buf.DecodeUint8())
171         copy(m.Entry.Peer.Un.XXX_UnionData[:], buf.DecodeBytes(16))
172         m.Entry.Nh.Af = ip_types.AddressFamily(buf.DecodeUint8())
173         copy(m.Entry.Nh.Un.XXX_UnionData[:], buf.DecodeBytes(16))
174         m.Entry.NhTableID = buf.DecodeUint32()
175         return nil
176 }
177
178 // TeibEntryAddDelReply defines message 'teib_entry_add_del_reply'.
179 type TeibEntryAddDelReply struct {
180         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
181 }
182
183 func (m *TeibEntryAddDelReply) Reset()               { *m = TeibEntryAddDelReply{} }
184 func (*TeibEntryAddDelReply) GetMessageName() string { return "teib_entry_add_del_reply" }
185 func (*TeibEntryAddDelReply) GetCrcString() string   { return "e8d4e804" }
186 func (*TeibEntryAddDelReply) GetMessageType() api.MessageType {
187         return api.ReplyMessage
188 }
189
190 func (m *TeibEntryAddDelReply) Size() int {
191         if m == nil {
192                 return 0
193         }
194         var size int
195         size += 4 // m.Retval
196         return size
197 }
198 func (m *TeibEntryAddDelReply) Marshal(b []byte) ([]byte, error) {
199         var buf *codec.Buffer
200         if b == nil {
201                 buf = codec.NewBuffer(make([]byte, m.Size()))
202         } else {
203                 buf = codec.NewBuffer(b)
204         }
205         buf.EncodeUint32(uint32(m.Retval))
206         return buf.Bytes(), nil
207 }
208 func (m *TeibEntryAddDelReply) Unmarshal(b []byte) error {
209         buf := codec.NewBuffer(b)
210         m.Retval = int32(buf.DecodeUint32())
211         return nil
212 }
213
214 func init() { file_teib_binapi_init() }
215 func file_teib_binapi_init() {
216         api.RegisterMessage((*TeibDetails)(nil), "teib_details_e3b6a503")
217         api.RegisterMessage((*TeibDump)(nil), "teib_dump_51077d14")
218         api.RegisterMessage((*TeibEntryAddDel)(nil), "teib_entry_add_del_5aa0a538")
219         api.RegisterMessage((*TeibEntryAddDelReply)(nil), "teib_entry_add_del_reply_e8d4e804")
220 }
221
222 // Messages returns list of all messages in this module.
223 func AllMessages() []api.Message {
224         return []api.Message{
225                 (*TeibDetails)(nil),
226                 (*TeibDump)(nil),
227                 (*TeibEntryAddDel)(nil),
228                 (*TeibEntryAddDelReply)(nil),
229         }
230 }