binapigen: fix union size
[govpp.git] / binapi / sr / sr.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/sr.api.json
6
7 // Package sr contains generated bindings for API file sr.api.
8 //
9 // Contents:
10 //   1 struct
11 //  20 messages
12 //
13 package sr
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         sr_types "git.fd.io/govpp.git/binapi/sr_types"
20         codec "git.fd.io/govpp.git/codec"
21 )
22
23 // This is a compile-time assertion to ensure that this generated file
24 // is compatible with the GoVPP api package it is being compiled against.
25 // A compilation error at this line likely means your copy of the
26 // GoVPP api package needs to be updated.
27 const _ = api.GoVppAPIPackageIsVersion2
28
29 const (
30         APIFile    = "sr"
31         APIVersion = "2.0.0"
32         VersionCrc = 0xd85c77ca
33 )
34
35 // Srv6SidList defines type 'srv6_sid_list'.
36 type Srv6SidList struct {
37         NumSids uint8                   `binapi:"u8,name=num_sids" json:"num_sids,omitempty"`
38         Weight  uint32                  `binapi:"u32,name=weight" json:"weight,omitempty"`
39         Sids    [16]ip_types.IP6Address `binapi:"ip6_address[16],name=sids" json:"sids,omitempty"`
40 }
41
42 // SrLocalsidAddDel defines message 'sr_localsid_add_del'.
43 type SrLocalsidAddDel struct {
44         IsDel     bool                           `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"`
45         Localsid  ip_types.IP6Address            `binapi:"ip6_address,name=localsid" json:"localsid,omitempty"`
46         EndPsp    bool                           `binapi:"bool,name=end_psp" json:"end_psp,omitempty"`
47         Behavior  sr_types.SrBehavior            `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"`
48         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
49         VlanIndex uint32                         `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"`
50         FibTable  uint32                         `binapi:"u32,name=fib_table" json:"fib_table,omitempty"`
51         NhAddr    ip_types.Address               `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"`
52 }
53
54 func (m *SrLocalsidAddDel) Reset()               { *m = SrLocalsidAddDel{} }
55 func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" }
56 func (*SrLocalsidAddDel) GetCrcString() string   { return "26fa3309" }
57 func (*SrLocalsidAddDel) GetMessageType() api.MessageType {
58         return api.RequestMessage
59 }
60
61 func (m *SrLocalsidAddDel) Size() (size int) {
62         if m == nil {
63                 return 0
64         }
65         size += 1      // m.IsDel
66         size += 1 * 16 // m.Localsid
67         size += 1      // m.EndPsp
68         size += 1      // m.Behavior
69         size += 4      // m.SwIfIndex
70         size += 4      // m.VlanIndex
71         size += 4      // m.FibTable
72         size += 1      // m.NhAddr.Af
73         size += 1 * 16 // m.NhAddr.Un
74         return size
75 }
76 func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) {
77         if b == nil {
78                 b = make([]byte, m.Size())
79         }
80         buf := codec.NewBuffer(b)
81         buf.EncodeBool(m.IsDel)
82         buf.EncodeBytes(m.Localsid[:], 16)
83         buf.EncodeBool(m.EndPsp)
84         buf.EncodeUint8(uint8(m.Behavior))
85         buf.EncodeUint32(uint32(m.SwIfIndex))
86         buf.EncodeUint32(m.VlanIndex)
87         buf.EncodeUint32(m.FibTable)
88         buf.EncodeUint8(uint8(m.NhAddr.Af))
89         buf.EncodeBytes(m.NhAddr.Un.XXX_UnionData[:], 16)
90         return buf.Bytes(), nil
91 }
92 func (m *SrLocalsidAddDel) Unmarshal(b []byte) error {
93         buf := codec.NewBuffer(b)
94         m.IsDel = buf.DecodeBool()
95         copy(m.Localsid[:], buf.DecodeBytes(16))
96         m.EndPsp = buf.DecodeBool()
97         m.Behavior = sr_types.SrBehavior(buf.DecodeUint8())
98         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
99         m.VlanIndex = buf.DecodeUint32()
100         m.FibTable = buf.DecodeUint32()
101         m.NhAddr.Af = ip_types.AddressFamily(buf.DecodeUint8())
102         copy(m.NhAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
103         return nil
104 }
105
106 // SrLocalsidAddDelReply defines message 'sr_localsid_add_del_reply'.
107 type SrLocalsidAddDelReply struct {
108         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
109 }
110
111 func (m *SrLocalsidAddDelReply) Reset()               { *m = SrLocalsidAddDelReply{} }
112 func (*SrLocalsidAddDelReply) GetMessageName() string { return "sr_localsid_add_del_reply" }
113 func (*SrLocalsidAddDelReply) GetCrcString() string   { return "e8d4e804" }
114 func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType {
115         return api.ReplyMessage
116 }
117
118 func (m *SrLocalsidAddDelReply) Size() (size int) {
119         if m == nil {
120                 return 0
121         }
122         size += 4 // m.Retval
123         return size
124 }
125 func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) {
126         if b == nil {
127                 b = make([]byte, m.Size())
128         }
129         buf := codec.NewBuffer(b)
130         buf.EncodeInt32(m.Retval)
131         return buf.Bytes(), nil
132 }
133 func (m *SrLocalsidAddDelReply) Unmarshal(b []byte) error {
134         buf := codec.NewBuffer(b)
135         m.Retval = buf.DecodeInt32()
136         return nil
137 }
138
139 // SrLocalsidsDetails defines message 'sr_localsids_details'.
140 type SrLocalsidsDetails struct {
141         Addr                    ip_types.IP6Address `binapi:"ip6_address,name=addr" json:"addr,omitempty"`
142         EndPsp                  bool                `binapi:"bool,name=end_psp" json:"end_psp,omitempty"`
143         Behavior                sr_types.SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"`
144         FibTable                uint32              `binapi:"u32,name=fib_table" json:"fib_table,omitempty"`
145         VlanIndex               uint32              `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"`
146         XconnectNhAddr          ip_types.Address    `binapi:"address,name=xconnect_nh_addr" json:"xconnect_nh_addr,omitempty"`
147         XconnectIfaceOrVrfTable uint32              `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"`
148 }
149
150 func (m *SrLocalsidsDetails) Reset()               { *m = SrLocalsidsDetails{} }
151 func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" }
152 func (*SrLocalsidsDetails) GetCrcString() string   { return "6a6c0265" }
153 func (*SrLocalsidsDetails) GetMessageType() api.MessageType {
154         return api.ReplyMessage
155 }
156
157 func (m *SrLocalsidsDetails) Size() (size int) {
158         if m == nil {
159                 return 0
160         }
161         size += 1 * 16 // m.Addr
162         size += 1      // m.EndPsp
163         size += 1      // m.Behavior
164         size += 4      // m.FibTable
165         size += 4      // m.VlanIndex
166         size += 1      // m.XconnectNhAddr.Af
167         size += 1 * 16 // m.XconnectNhAddr.Un
168         size += 4      // m.XconnectIfaceOrVrfTable
169         return size
170 }
171 func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) {
172         if b == nil {
173                 b = make([]byte, m.Size())
174         }
175         buf := codec.NewBuffer(b)
176         buf.EncodeBytes(m.Addr[:], 16)
177         buf.EncodeBool(m.EndPsp)
178         buf.EncodeUint8(uint8(m.Behavior))
179         buf.EncodeUint32(m.FibTable)
180         buf.EncodeUint32(m.VlanIndex)
181         buf.EncodeUint8(uint8(m.XconnectNhAddr.Af))
182         buf.EncodeBytes(m.XconnectNhAddr.Un.XXX_UnionData[:], 16)
183         buf.EncodeUint32(m.XconnectIfaceOrVrfTable)
184         return buf.Bytes(), nil
185 }
186 func (m *SrLocalsidsDetails) Unmarshal(b []byte) error {
187         buf := codec.NewBuffer(b)
188         copy(m.Addr[:], buf.DecodeBytes(16))
189         m.EndPsp = buf.DecodeBool()
190         m.Behavior = sr_types.SrBehavior(buf.DecodeUint8())
191         m.FibTable = buf.DecodeUint32()
192         m.VlanIndex = buf.DecodeUint32()
193         m.XconnectNhAddr.Af = ip_types.AddressFamily(buf.DecodeUint8())
194         copy(m.XconnectNhAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16))
195         m.XconnectIfaceOrVrfTable = buf.DecodeUint32()
196         return nil
197 }
198
199 // SrLocalsidsDump defines message 'sr_localsids_dump'.
200 type SrLocalsidsDump struct{}
201
202 func (m *SrLocalsidsDump) Reset()               { *m = SrLocalsidsDump{} }
203 func (*SrLocalsidsDump) GetMessageName() string { return "sr_localsids_dump" }
204 func (*SrLocalsidsDump) GetCrcString() string   { return "51077d14" }
205 func (*SrLocalsidsDump) GetMessageType() api.MessageType {
206         return api.RequestMessage
207 }
208
209 func (m *SrLocalsidsDump) Size() (size int) {
210         if m == nil {
211                 return 0
212         }
213         return size
214 }
215 func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) {
216         if b == nil {
217                 b = make([]byte, m.Size())
218         }
219         buf := codec.NewBuffer(b)
220         return buf.Bytes(), nil
221 }
222 func (m *SrLocalsidsDump) Unmarshal(b []byte) error {
223         return nil
224 }
225
226 // SrPoliciesDetails defines message 'sr_policies_details'.
227 type SrPoliciesDetails struct {
228         Bsid        ip_types.IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"`
229         IsSpray     bool                `binapi:"bool,name=is_spray" json:"is_spray,omitempty"`
230         IsEncap     bool                `binapi:"bool,name=is_encap" json:"is_encap,omitempty"`
231         FibTable    uint32              `binapi:"u32,name=fib_table" json:"fib_table,omitempty"`
232         NumSidLists uint8               `binapi:"u8,name=num_sid_lists" json:"-"`
233         SidLists    []Srv6SidList       `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"`
234 }
235
236 func (m *SrPoliciesDetails) Reset()               { *m = SrPoliciesDetails{} }
237 func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" }
238 func (*SrPoliciesDetails) GetCrcString() string   { return "07ec2d93" }
239 func (*SrPoliciesDetails) GetMessageType() api.MessageType {
240         return api.ReplyMessage
241 }
242
243 func (m *SrPoliciesDetails) Size() (size int) {
244         if m == nil {
245                 return 0
246         }
247         size += 1 * 16 // m.Bsid
248         size += 1      // m.IsSpray
249         size += 1      // m.IsEncap
250         size += 4      // m.FibTable
251         size += 1      // m.NumSidLists
252         for j1 := 0; j1 < len(m.SidLists); j1++ {
253                 var s1 Srv6SidList
254                 _ = s1
255                 if j1 < len(m.SidLists) {
256                         s1 = m.SidLists[j1]
257                 }
258                 size += 1 // s1.NumSids
259                 size += 4 // s1.Weight
260                 for j2 := 0; j2 < 16; j2++ {
261                         size += 1 * 16 // s1.Sids[j2]
262                 }
263         }
264         return size
265 }
266 func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) {
267         if b == nil {
268                 b = make([]byte, m.Size())
269         }
270         buf := codec.NewBuffer(b)
271         buf.EncodeBytes(m.Bsid[:], 16)
272         buf.EncodeBool(m.IsSpray)
273         buf.EncodeBool(m.IsEncap)
274         buf.EncodeUint32(m.FibTable)
275         buf.EncodeUint8(uint8(len(m.SidLists)))
276         for j0 := 0; j0 < len(m.SidLists); j0++ {
277                 var v0 Srv6SidList // SidLists
278                 if j0 < len(m.SidLists) {
279                         v0 = m.SidLists[j0]
280                 }
281                 buf.EncodeUint8(v0.NumSids)
282                 buf.EncodeUint32(v0.Weight)
283                 for j1 := 0; j1 < 16; j1++ {
284                         buf.EncodeBytes(v0.Sids[j1][:], 16)
285                 }
286         }
287         return buf.Bytes(), nil
288 }
289 func (m *SrPoliciesDetails) Unmarshal(b []byte) error {
290         buf := codec.NewBuffer(b)
291         copy(m.Bsid[:], buf.DecodeBytes(16))
292         m.IsSpray = buf.DecodeBool()
293         m.IsEncap = buf.DecodeBool()
294         m.FibTable = buf.DecodeUint32()
295         m.NumSidLists = buf.DecodeUint8()
296         m.SidLists = make([]Srv6SidList, m.NumSidLists)
297         for j0 := 0; j0 < len(m.SidLists); j0++ {
298                 m.SidLists[j0].NumSids = buf.DecodeUint8()
299                 m.SidLists[j0].Weight = buf.DecodeUint32()
300                 for j1 := 0; j1 < 16; j1++ {
301                         copy(m.SidLists[j0].Sids[j1][:], buf.DecodeBytes(16))
302                 }
303         }
304         return nil
305 }
306
307 // SrPoliciesDump defines message 'sr_policies_dump'.
308 type SrPoliciesDump struct{}
309
310 func (m *SrPoliciesDump) Reset()               { *m = SrPoliciesDump{} }
311 func (*SrPoliciesDump) GetMessageName() string { return "sr_policies_dump" }
312 func (*SrPoliciesDump) GetCrcString() string   { return "51077d14" }
313 func (*SrPoliciesDump) GetMessageType() api.MessageType {
314         return api.RequestMessage
315 }
316
317 func (m *SrPoliciesDump) Size() (size int) {
318         if m == nil {
319                 return 0
320         }
321         return size
322 }
323 func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) {
324         if b == nil {
325                 b = make([]byte, m.Size())
326         }
327         buf := codec.NewBuffer(b)
328         return buf.Bytes(), nil
329 }
330 func (m *SrPoliciesDump) Unmarshal(b []byte) error {
331         return nil
332 }
333
334 // SrPolicyAdd defines message 'sr_policy_add'.
335 type SrPolicyAdd struct {
336         BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"`
337         Weight   uint32              `binapi:"u32,name=weight" json:"weight,omitempty"`
338         IsEncap  bool                `binapi:"bool,name=is_encap" json:"is_encap,omitempty"`
339         IsSpray  bool                `binapi:"bool,name=is_spray" json:"is_spray,omitempty"`
340         FibTable uint32              `binapi:"u32,name=fib_table" json:"fib_table,omitempty"`
341         Sids     Srv6SidList         `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"`
342 }
343
344 func (m *SrPolicyAdd) Reset()               { *m = SrPolicyAdd{} }
345 func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" }
346 func (*SrPolicyAdd) GetCrcString() string   { return "ec79ee6a" }
347 func (*SrPolicyAdd) GetMessageType() api.MessageType {
348         return api.RequestMessage
349 }
350
351 func (m *SrPolicyAdd) Size() (size int) {
352         if m == nil {
353                 return 0
354         }
355         size += 1 * 16 // m.BsidAddr
356         size += 4      // m.Weight
357         size += 1      // m.IsEncap
358         size += 1      // m.IsSpray
359         size += 4      // m.FibTable
360         size += 1      // m.Sids.NumSids
361         size += 4      // m.Sids.Weight
362         for j2 := 0; j2 < 16; j2++ {
363                 size += 1 * 16 // m.Sids.Sids[j2]
364         }
365         return size
366 }
367 func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) {
368         if b == nil {
369                 b = make([]byte, m.Size())
370         }
371         buf := codec.NewBuffer(b)
372         buf.EncodeBytes(m.BsidAddr[:], 16)
373         buf.EncodeUint32(m.Weight)
374         buf.EncodeBool(m.IsEncap)
375         buf.EncodeBool(m.IsSpray)
376         buf.EncodeUint32(m.FibTable)
377         buf.EncodeUint8(m.Sids.NumSids)
378         buf.EncodeUint32(m.Sids.Weight)
379         for j1 := 0; j1 < 16; j1++ {
380                 buf.EncodeBytes(m.Sids.Sids[j1][:], 16)
381         }
382         return buf.Bytes(), nil
383 }
384 func (m *SrPolicyAdd) Unmarshal(b []byte) error {
385         buf := codec.NewBuffer(b)
386         copy(m.BsidAddr[:], buf.DecodeBytes(16))
387         m.Weight = buf.DecodeUint32()
388         m.IsEncap = buf.DecodeBool()
389         m.IsSpray = buf.DecodeBool()
390         m.FibTable = buf.DecodeUint32()
391         m.Sids.NumSids = buf.DecodeUint8()
392         m.Sids.Weight = buf.DecodeUint32()
393         for j1 := 0; j1 < 16; j1++ {
394                 copy(m.Sids.Sids[j1][:], buf.DecodeBytes(16))
395         }
396         return nil
397 }
398
399 // SrPolicyAddReply defines message 'sr_policy_add_reply'.
400 type SrPolicyAddReply struct {
401         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
402 }
403
404 func (m *SrPolicyAddReply) Reset()               { *m = SrPolicyAddReply{} }
405 func (*SrPolicyAddReply) GetMessageName() string { return "sr_policy_add_reply" }
406 func (*SrPolicyAddReply) GetCrcString() string   { return "e8d4e804" }
407 func (*SrPolicyAddReply) GetMessageType() api.MessageType {
408         return api.ReplyMessage
409 }
410
411 func (m *SrPolicyAddReply) Size() (size int) {
412         if m == nil {
413                 return 0
414         }
415         size += 4 // m.Retval
416         return size
417 }
418 func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) {
419         if b == nil {
420                 b = make([]byte, m.Size())
421         }
422         buf := codec.NewBuffer(b)
423         buf.EncodeInt32(m.Retval)
424         return buf.Bytes(), nil
425 }
426 func (m *SrPolicyAddReply) Unmarshal(b []byte) error {
427         buf := codec.NewBuffer(b)
428         m.Retval = buf.DecodeInt32()
429         return nil
430 }
431
432 // SrPolicyDel defines message 'sr_policy_del'.
433 type SrPolicyDel struct {
434         BsidAddr      ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"`
435         SrPolicyIndex uint32              `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"`
436 }
437
438 func (m *SrPolicyDel) Reset()               { *m = SrPolicyDel{} }
439 func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" }
440 func (*SrPolicyDel) GetCrcString() string   { return "cb4d48d5" }
441 func (*SrPolicyDel) GetMessageType() api.MessageType {
442         return api.RequestMessage
443 }
444
445 func (m *SrPolicyDel) Size() (size int) {
446         if m == nil {
447                 return 0
448         }
449         size += 1 * 16 // m.BsidAddr
450         size += 4      // m.SrPolicyIndex
451         return size
452 }
453 func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) {
454         if b == nil {
455                 b = make([]byte, m.Size())
456         }
457         buf := codec.NewBuffer(b)
458         buf.EncodeBytes(m.BsidAddr[:], 16)
459         buf.EncodeUint32(m.SrPolicyIndex)
460         return buf.Bytes(), nil
461 }
462 func (m *SrPolicyDel) Unmarshal(b []byte) error {
463         buf := codec.NewBuffer(b)
464         copy(m.BsidAddr[:], buf.DecodeBytes(16))
465         m.SrPolicyIndex = buf.DecodeUint32()
466         return nil
467 }
468
469 // SrPolicyDelReply defines message 'sr_policy_del_reply'.
470 type SrPolicyDelReply struct {
471         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
472 }
473
474 func (m *SrPolicyDelReply) Reset()               { *m = SrPolicyDelReply{} }
475 func (*SrPolicyDelReply) GetMessageName() string { return "sr_policy_del_reply" }
476 func (*SrPolicyDelReply) GetCrcString() string   { return "e8d4e804" }
477 func (*SrPolicyDelReply) GetMessageType() api.MessageType {
478         return api.ReplyMessage
479 }
480
481 func (m *SrPolicyDelReply) Size() (size int) {
482         if m == nil {
483                 return 0
484         }
485         size += 4 // m.Retval
486         return size
487 }
488 func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) {
489         if b == nil {
490                 b = make([]byte, m.Size())
491         }
492         buf := codec.NewBuffer(b)
493         buf.EncodeInt32(m.Retval)
494         return buf.Bytes(), nil
495 }
496 func (m *SrPolicyDelReply) Unmarshal(b []byte) error {
497         buf := codec.NewBuffer(b)
498         m.Retval = buf.DecodeInt32()
499         return nil
500 }
501
502 // SrPolicyMod defines message 'sr_policy_mod'.
503 type SrPolicyMod struct {
504         BsidAddr      ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"`
505         SrPolicyIndex uint32              `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"`
506         FibTable      uint32              `binapi:"u32,name=fib_table" json:"fib_table,omitempty"`
507         Operation     sr_types.SrPolicyOp `binapi:"sr_policy_op,name=operation" json:"operation,omitempty"`
508         SlIndex       uint32              `binapi:"u32,name=sl_index" json:"sl_index,omitempty"`
509         Weight        uint32              `binapi:"u32,name=weight" json:"weight,omitempty"`
510         Sids          Srv6SidList         `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"`
511 }
512
513 func (m *SrPolicyMod) Reset()               { *m = SrPolicyMod{} }
514 func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" }
515 func (*SrPolicyMod) GetCrcString() string   { return "e531a102" }
516 func (*SrPolicyMod) GetMessageType() api.MessageType {
517         return api.RequestMessage
518 }
519
520 func (m *SrPolicyMod) Size() (size int) {
521         if m == nil {
522                 return 0
523         }
524         size += 1 * 16 // m.BsidAddr
525         size += 4      // m.SrPolicyIndex
526         size += 4      // m.FibTable
527         size += 1      // m.Operation
528         size += 4      // m.SlIndex
529         size += 4      // m.Weight
530         size += 1      // m.Sids.NumSids
531         size += 4      // m.Sids.Weight
532         for j2 := 0; j2 < 16; j2++ {
533                 size += 1 * 16 // m.Sids.Sids[j2]
534         }
535         return size
536 }
537 func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) {
538         if b == nil {
539                 b = make([]byte, m.Size())
540         }
541         buf := codec.NewBuffer(b)
542         buf.EncodeBytes(m.BsidAddr[:], 16)
543         buf.EncodeUint32(m.SrPolicyIndex)
544         buf.EncodeUint32(m.FibTable)
545         buf.EncodeUint8(uint8(m.Operation))
546         buf.EncodeUint32(m.SlIndex)
547         buf.EncodeUint32(m.Weight)
548         buf.EncodeUint8(m.Sids.NumSids)
549         buf.EncodeUint32(m.Sids.Weight)
550         for j1 := 0; j1 < 16; j1++ {
551                 buf.EncodeBytes(m.Sids.Sids[j1][:], 16)
552         }
553         return buf.Bytes(), nil
554 }
555 func (m *SrPolicyMod) Unmarshal(b []byte) error {
556         buf := codec.NewBuffer(b)
557         copy(m.BsidAddr[:], buf.DecodeBytes(16))
558         m.SrPolicyIndex = buf.DecodeUint32()
559         m.FibTable = buf.DecodeUint32()
560         m.Operation = sr_types.SrPolicyOp(buf.DecodeUint8())
561         m.SlIndex = buf.DecodeUint32()
562         m.Weight = buf.DecodeUint32()
563         m.Sids.NumSids = buf.DecodeUint8()
564         m.Sids.Weight = buf.DecodeUint32()
565         for j1 := 0; j1 < 16; j1++ {
566                 copy(m.Sids.Sids[j1][:], buf.DecodeBytes(16))
567         }
568         return nil
569 }
570
571 // SrPolicyModReply defines message 'sr_policy_mod_reply'.
572 type SrPolicyModReply struct {
573         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
574 }
575
576 func (m *SrPolicyModReply) Reset()               { *m = SrPolicyModReply{} }
577 func (*SrPolicyModReply) GetMessageName() string { return "sr_policy_mod_reply" }
578 func (*SrPolicyModReply) GetCrcString() string   { return "e8d4e804" }
579 func (*SrPolicyModReply) GetMessageType() api.MessageType {
580         return api.ReplyMessage
581 }
582
583 func (m *SrPolicyModReply) Size() (size int) {
584         if m == nil {
585                 return 0
586         }
587         size += 4 // m.Retval
588         return size
589 }
590 func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) {
591         if b == nil {
592                 b = make([]byte, m.Size())
593         }
594         buf := codec.NewBuffer(b)
595         buf.EncodeInt32(m.Retval)
596         return buf.Bytes(), nil
597 }
598 func (m *SrPolicyModReply) Unmarshal(b []byte) error {
599         buf := codec.NewBuffer(b)
600         m.Retval = buf.DecodeInt32()
601         return nil
602 }
603
604 // SrSetEncapHopLimit defines message 'sr_set_encap_hop_limit'.
605 type SrSetEncapHopLimit struct {
606         HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"`
607 }
608
609 func (m *SrSetEncapHopLimit) Reset()               { *m = SrSetEncapHopLimit{} }
610 func (*SrSetEncapHopLimit) GetMessageName() string { return "sr_set_encap_hop_limit" }
611 func (*SrSetEncapHopLimit) GetCrcString() string   { return "aa75d7d0" }
612 func (*SrSetEncapHopLimit) GetMessageType() api.MessageType {
613         return api.RequestMessage
614 }
615
616 func (m *SrSetEncapHopLimit) Size() (size int) {
617         if m == nil {
618                 return 0
619         }
620         size += 1 // m.HopLimit
621         return size
622 }
623 func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) {
624         if b == nil {
625                 b = make([]byte, m.Size())
626         }
627         buf := codec.NewBuffer(b)
628         buf.EncodeUint8(m.HopLimit)
629         return buf.Bytes(), nil
630 }
631 func (m *SrSetEncapHopLimit) Unmarshal(b []byte) error {
632         buf := codec.NewBuffer(b)
633         m.HopLimit = buf.DecodeUint8()
634         return nil
635 }
636
637 // SrSetEncapHopLimitReply defines message 'sr_set_encap_hop_limit_reply'.
638 type SrSetEncapHopLimitReply struct {
639         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
640 }
641
642 func (m *SrSetEncapHopLimitReply) Reset()               { *m = SrSetEncapHopLimitReply{} }
643 func (*SrSetEncapHopLimitReply) GetMessageName() string { return "sr_set_encap_hop_limit_reply" }
644 func (*SrSetEncapHopLimitReply) GetCrcString() string   { return "e8d4e804" }
645 func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType {
646         return api.ReplyMessage
647 }
648
649 func (m *SrSetEncapHopLimitReply) Size() (size int) {
650         if m == nil {
651                 return 0
652         }
653         size += 4 // m.Retval
654         return size
655 }
656 func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) {
657         if b == nil {
658                 b = make([]byte, m.Size())
659         }
660         buf := codec.NewBuffer(b)
661         buf.EncodeInt32(m.Retval)
662         return buf.Bytes(), nil
663 }
664 func (m *SrSetEncapHopLimitReply) Unmarshal(b []byte) error {
665         buf := codec.NewBuffer(b)
666         m.Retval = buf.DecodeInt32()
667         return nil
668 }
669
670 // SrSetEncapSource defines message 'sr_set_encap_source'.
671 type SrSetEncapSource struct {
672         EncapsSource ip_types.IP6Address `binapi:"ip6_address,name=encaps_source" json:"encaps_source,omitempty"`
673 }
674
675 func (m *SrSetEncapSource) Reset()               { *m = SrSetEncapSource{} }
676 func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" }
677 func (*SrSetEncapSource) GetCrcString() string   { return "d3bad5e1" }
678 func (*SrSetEncapSource) GetMessageType() api.MessageType {
679         return api.RequestMessage
680 }
681
682 func (m *SrSetEncapSource) Size() (size int) {
683         if m == nil {
684                 return 0
685         }
686         size += 1 * 16 // m.EncapsSource
687         return size
688 }
689 func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) {
690         if b == nil {
691                 b = make([]byte, m.Size())
692         }
693         buf := codec.NewBuffer(b)
694         buf.EncodeBytes(m.EncapsSource[:], 16)
695         return buf.Bytes(), nil
696 }
697 func (m *SrSetEncapSource) Unmarshal(b []byte) error {
698         buf := codec.NewBuffer(b)
699         copy(m.EncapsSource[:], buf.DecodeBytes(16))
700         return nil
701 }
702
703 // SrSetEncapSourceReply defines message 'sr_set_encap_source_reply'.
704 type SrSetEncapSourceReply struct {
705         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
706 }
707
708 func (m *SrSetEncapSourceReply) Reset()               { *m = SrSetEncapSourceReply{} }
709 func (*SrSetEncapSourceReply) GetMessageName() string { return "sr_set_encap_source_reply" }
710 func (*SrSetEncapSourceReply) GetCrcString() string   { return "e8d4e804" }
711 func (*SrSetEncapSourceReply) GetMessageType() api.MessageType {
712         return api.ReplyMessage
713 }
714
715 func (m *SrSetEncapSourceReply) Size() (size int) {
716         if m == nil {
717                 return 0
718         }
719         size += 4 // m.Retval
720         return size
721 }
722 func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) {
723         if b == nil {
724                 b = make([]byte, m.Size())
725         }
726         buf := codec.NewBuffer(b)
727         buf.EncodeInt32(m.Retval)
728         return buf.Bytes(), nil
729 }
730 func (m *SrSetEncapSourceReply) Unmarshal(b []byte) error {
731         buf := codec.NewBuffer(b)
732         m.Retval = buf.DecodeInt32()
733         return nil
734 }
735
736 // SrSteeringAddDel defines message 'sr_steering_add_del'.
737 type SrSteeringAddDel struct {
738         IsDel         bool                           `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"`
739         BsidAddr      ip_types.IP6Address            `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"`
740         SrPolicyIndex uint32                         `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"`
741         TableID       uint32                         `binapi:"u32,name=table_id" json:"table_id,omitempty"`
742         Prefix        ip_types.Prefix                `binapi:"prefix,name=prefix" json:"prefix,omitempty"`
743         SwIfIndex     interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
744         TrafficType   sr_types.SrSteer               `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"`
745 }
746
747 func (m *SrSteeringAddDel) Reset()               { *m = SrSteeringAddDel{} }
748 func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" }
749 func (*SrSteeringAddDel) GetCrcString() string   { return "3711dace" }
750 func (*SrSteeringAddDel) GetMessageType() api.MessageType {
751         return api.RequestMessage
752 }
753
754 func (m *SrSteeringAddDel) Size() (size int) {
755         if m == nil {
756                 return 0
757         }
758         size += 1      // m.IsDel
759         size += 1 * 16 // m.BsidAddr
760         size += 4      // m.SrPolicyIndex
761         size += 4      // m.TableID
762         size += 1      // m.Prefix.Address.Af
763         size += 1 * 16 // m.Prefix.Address.Un
764         size += 1      // m.Prefix.Len
765         size += 4      // m.SwIfIndex
766         size += 1      // m.TrafficType
767         return size
768 }
769 func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) {
770         if b == nil {
771                 b = make([]byte, m.Size())
772         }
773         buf := codec.NewBuffer(b)
774         buf.EncodeBool(m.IsDel)
775         buf.EncodeBytes(m.BsidAddr[:], 16)
776         buf.EncodeUint32(m.SrPolicyIndex)
777         buf.EncodeUint32(m.TableID)
778         buf.EncodeUint8(uint8(m.Prefix.Address.Af))
779         buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
780         buf.EncodeUint8(m.Prefix.Len)
781         buf.EncodeUint32(uint32(m.SwIfIndex))
782         buf.EncodeUint8(uint8(m.TrafficType))
783         return buf.Bytes(), nil
784 }
785 func (m *SrSteeringAddDel) Unmarshal(b []byte) error {
786         buf := codec.NewBuffer(b)
787         m.IsDel = buf.DecodeBool()
788         copy(m.BsidAddr[:], buf.DecodeBytes(16))
789         m.SrPolicyIndex = buf.DecodeUint32()
790         m.TableID = buf.DecodeUint32()
791         m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
792         copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
793         m.Prefix.Len = buf.DecodeUint8()
794         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
795         m.TrafficType = sr_types.SrSteer(buf.DecodeUint8())
796         return nil
797 }
798
799 // SrSteeringAddDelReply defines message 'sr_steering_add_del_reply'.
800 type SrSteeringAddDelReply struct {
801         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
802 }
803
804 func (m *SrSteeringAddDelReply) Reset()               { *m = SrSteeringAddDelReply{} }
805 func (*SrSteeringAddDelReply) GetMessageName() string { return "sr_steering_add_del_reply" }
806 func (*SrSteeringAddDelReply) GetCrcString() string   { return "e8d4e804" }
807 func (*SrSteeringAddDelReply) GetMessageType() api.MessageType {
808         return api.ReplyMessage
809 }
810
811 func (m *SrSteeringAddDelReply) Size() (size int) {
812         if m == nil {
813                 return 0
814         }
815         size += 4 // m.Retval
816         return size
817 }
818 func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) {
819         if b == nil {
820                 b = make([]byte, m.Size())
821         }
822         buf := codec.NewBuffer(b)
823         buf.EncodeInt32(m.Retval)
824         return buf.Bytes(), nil
825 }
826 func (m *SrSteeringAddDelReply) Unmarshal(b []byte) error {
827         buf := codec.NewBuffer(b)
828         m.Retval = buf.DecodeInt32()
829         return nil
830 }
831
832 // SrSteeringPolDetails defines message 'sr_steering_pol_details'.
833 type SrSteeringPolDetails struct {
834         TrafficType sr_types.SrSteer               `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"`
835         FibTable    uint32                         `binapi:"u32,name=fib_table" json:"fib_table,omitempty"`
836         Prefix      ip_types.Prefix                `binapi:"prefix,name=prefix" json:"prefix,omitempty"`
837         SwIfIndex   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
838         Bsid        ip_types.IP6Address            `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"`
839 }
840
841 func (m *SrSteeringPolDetails) Reset()               { *m = SrSteeringPolDetails{} }
842 func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" }
843 func (*SrSteeringPolDetails) GetCrcString() string   { return "1c1ee786" }
844 func (*SrSteeringPolDetails) GetMessageType() api.MessageType {
845         return api.ReplyMessage
846 }
847
848 func (m *SrSteeringPolDetails) Size() (size int) {
849         if m == nil {
850                 return 0
851         }
852         size += 1      // m.TrafficType
853         size += 4      // m.FibTable
854         size += 1      // m.Prefix.Address.Af
855         size += 1 * 16 // m.Prefix.Address.Un
856         size += 1      // m.Prefix.Len
857         size += 4      // m.SwIfIndex
858         size += 1 * 16 // m.Bsid
859         return size
860 }
861 func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) {
862         if b == nil {
863                 b = make([]byte, m.Size())
864         }
865         buf := codec.NewBuffer(b)
866         buf.EncodeUint8(uint8(m.TrafficType))
867         buf.EncodeUint32(m.FibTable)
868         buf.EncodeUint8(uint8(m.Prefix.Address.Af))
869         buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
870         buf.EncodeUint8(m.Prefix.Len)
871         buf.EncodeUint32(uint32(m.SwIfIndex))
872         buf.EncodeBytes(m.Bsid[:], 16)
873         return buf.Bytes(), nil
874 }
875 func (m *SrSteeringPolDetails) Unmarshal(b []byte) error {
876         buf := codec.NewBuffer(b)
877         m.TrafficType = sr_types.SrSteer(buf.DecodeUint8())
878         m.FibTable = buf.DecodeUint32()
879         m.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
880         copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
881         m.Prefix.Len = buf.DecodeUint8()
882         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
883         copy(m.Bsid[:], buf.DecodeBytes(16))
884         return nil
885 }
886
887 // SrSteeringPolDump defines message 'sr_steering_pol_dump'.
888 type SrSteeringPolDump struct{}
889
890 func (m *SrSteeringPolDump) Reset()               { *m = SrSteeringPolDump{} }
891 func (*SrSteeringPolDump) GetMessageName() string { return "sr_steering_pol_dump" }
892 func (*SrSteeringPolDump) GetCrcString() string   { return "51077d14" }
893 func (*SrSteeringPolDump) GetMessageType() api.MessageType {
894         return api.RequestMessage
895 }
896
897 func (m *SrSteeringPolDump) Size() (size int) {
898         if m == nil {
899                 return 0
900         }
901         return size
902 }
903 func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) {
904         if b == nil {
905                 b = make([]byte, m.Size())
906         }
907         buf := codec.NewBuffer(b)
908         return buf.Bytes(), nil
909 }
910 func (m *SrSteeringPolDump) Unmarshal(b []byte) error {
911         return nil
912 }
913
914 func init() { file_sr_binapi_init() }
915 func file_sr_binapi_init() {
916         api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr_localsid_add_del_26fa3309")
917         api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr_localsid_add_del_reply_e8d4e804")
918         api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr_localsids_details_6a6c0265")
919         api.RegisterMessage((*SrLocalsidsDump)(nil), "sr_localsids_dump_51077d14")
920         api.RegisterMessage((*SrPoliciesDetails)(nil), "sr_policies_details_07ec2d93")
921         api.RegisterMessage((*SrPoliciesDump)(nil), "sr_policies_dump_51077d14")
922         api.RegisterMessage((*SrPolicyAdd)(nil), "sr_policy_add_ec79ee6a")
923         api.RegisterMessage((*SrPolicyAddReply)(nil), "sr_policy_add_reply_e8d4e804")
924         api.RegisterMessage((*SrPolicyDel)(nil), "sr_policy_del_cb4d48d5")
925         api.RegisterMessage((*SrPolicyDelReply)(nil), "sr_policy_del_reply_e8d4e804")
926         api.RegisterMessage((*SrPolicyMod)(nil), "sr_policy_mod_e531a102")
927         api.RegisterMessage((*SrPolicyModReply)(nil), "sr_policy_mod_reply_e8d4e804")
928         api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr_set_encap_hop_limit_aa75d7d0")
929         api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr_set_encap_hop_limit_reply_e8d4e804")
930         api.RegisterMessage((*SrSetEncapSource)(nil), "sr_set_encap_source_d3bad5e1")
931         api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr_set_encap_source_reply_e8d4e804")
932         api.RegisterMessage((*SrSteeringAddDel)(nil), "sr_steering_add_del_3711dace")
933         api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr_steering_add_del_reply_e8d4e804")
934         api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr_steering_pol_details_1c1ee786")
935         api.RegisterMessage((*SrSteeringPolDump)(nil), "sr_steering_pol_dump_51077d14")
936 }
937
938 // Messages returns list of all messages in this module.
939 func AllMessages() []api.Message {
940         return []api.Message{
941                 (*SrLocalsidAddDel)(nil),
942                 (*SrLocalsidAddDelReply)(nil),
943                 (*SrLocalsidsDetails)(nil),
944                 (*SrLocalsidsDump)(nil),
945                 (*SrPoliciesDetails)(nil),
946                 (*SrPoliciesDump)(nil),
947                 (*SrPolicyAdd)(nil),
948                 (*SrPolicyAddReply)(nil),
949                 (*SrPolicyDel)(nil),
950                 (*SrPolicyDelReply)(nil),
951                 (*SrPolicyMod)(nil),
952                 (*SrPolicyModReply)(nil),
953                 (*SrSetEncapHopLimit)(nil),
954                 (*SrSetEncapHopLimitReply)(nil),
955                 (*SrSetEncapSource)(nil),
956                 (*SrSetEncapSourceReply)(nil),
957                 (*SrSteeringAddDel)(nil),
958                 (*SrSteeringAddDelReply)(nil),
959                 (*SrSteeringPolDetails)(nil),
960                 (*SrSteeringPolDump)(nil),
961         }
962 }