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