Improve binapi generator
[govpp.git] / binapi / vrrp / vrrp.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-dev
4 //  VPP:              20.05-release
5 // source: /usr/share/vpp/api/plugins/vrrp.api.json
6
7 // Package vrrp contains generated bindings for API file vrrp.api.
8 //
9 // Contents:
10 //   2 enums
11 //   5 structs
12 //  14 messages
13 //
14 package vrrp
15
16 import (
17         api "git.fd.io/govpp.git/api"
18         ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
19         interface_types "git.fd.io/govpp.git/binapi/interface_types"
20         ip_types "git.fd.io/govpp.git/binapi/ip_types"
21         codec "git.fd.io/govpp.git/codec"
22         "strconv"
23 )
24
25 // This is a compile-time assertion to ensure that this generated file
26 // is compatible with the GoVPP api package it is being compiled against.
27 // A compilation error at this line likely means your copy of the
28 // GoVPP api package needs to be updated.
29 const _ = api.GoVppAPIPackageIsVersion2
30
31 const (
32         APIFile    = "vrrp"
33         APIVersion = "1.0.1"
34         VersionCrc = 0x1903f1f1
35 )
36
37 // VrrpVrFlags defines enum 'vrrp_vr_flags'.
38 type VrrpVrFlags uint32
39
40 const (
41         VRRP_API_VR_PREEMPT VrrpVrFlags = 1
42         VRRP_API_VR_ACCEPT  VrrpVrFlags = 2
43         VRRP_API_VR_UNICAST VrrpVrFlags = 4
44         VRRP_API_VR_IPV6    VrrpVrFlags = 8
45 )
46
47 var (
48         VrrpVrFlags_name = map[uint32]string{
49                 1: "VRRP_API_VR_PREEMPT",
50                 2: "VRRP_API_VR_ACCEPT",
51                 4: "VRRP_API_VR_UNICAST",
52                 8: "VRRP_API_VR_IPV6",
53         }
54         VrrpVrFlags_value = map[string]uint32{
55                 "VRRP_API_VR_PREEMPT": 1,
56                 "VRRP_API_VR_ACCEPT":  2,
57                 "VRRP_API_VR_UNICAST": 4,
58                 "VRRP_API_VR_IPV6":    8,
59         }
60 )
61
62 func (x VrrpVrFlags) String() string {
63         s, ok := VrrpVrFlags_name[uint32(x)]
64         if ok {
65                 return s
66         }
67         str := func(n uint32) string {
68                 s, ok := VrrpVrFlags_name[uint32(n)]
69                 if ok {
70                         return s
71                 }
72                 return "VrrpVrFlags(" + strconv.Itoa(int(n)) + ")"
73         }
74         for i := uint32(0); i <= 32; i++ {
75                 val := uint32(x)
76                 if val&(1<<i) != 0 {
77                         if s != "" {
78                                 s += "|"
79                         }
80                         s += str(1 << i)
81                 }
82         }
83         if s == "" {
84                 return str(uint32(x))
85         }
86         return s
87 }
88
89 // VrrpVrState defines enum 'vrrp_vr_state'.
90 type VrrpVrState uint32
91
92 const (
93         VRRP_API_VR_STATE_INIT      VrrpVrState = 0
94         VRRP_API_VR_STATE_BACKUP    VrrpVrState = 1
95         VRRP_API_VR_STATE_MASTER    VrrpVrState = 2
96         VRRP_API_VR_STATE_INTF_DOWN VrrpVrState = 3
97 )
98
99 var (
100         VrrpVrState_name = map[uint32]string{
101                 0: "VRRP_API_VR_STATE_INIT",
102                 1: "VRRP_API_VR_STATE_BACKUP",
103                 2: "VRRP_API_VR_STATE_MASTER",
104                 3: "VRRP_API_VR_STATE_INTF_DOWN",
105         }
106         VrrpVrState_value = map[string]uint32{
107                 "VRRP_API_VR_STATE_INIT":      0,
108                 "VRRP_API_VR_STATE_BACKUP":    1,
109                 "VRRP_API_VR_STATE_MASTER":    2,
110                 "VRRP_API_VR_STATE_INTF_DOWN": 3,
111         }
112 )
113
114 func (x VrrpVrState) String() string {
115         s, ok := VrrpVrState_name[uint32(x)]
116         if ok {
117                 return s
118         }
119         return "VrrpVrState(" + strconv.Itoa(int(x)) + ")"
120 }
121
122 // VrrpVrConf defines type 'vrrp_vr_conf'.
123 type VrrpVrConf struct {
124         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
125         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
126         Priority  uint8                          `binapi:"u8,name=priority" json:"priority,omitempty"`
127         Interval  uint16                         `binapi:"u16,name=interval" json:"interval,omitempty"`
128         Flags     VrrpVrFlags                    `binapi:"vrrp_vr_flags,name=flags" json:"flags,omitempty"`
129 }
130
131 // VrrpVrKey defines type 'vrrp_vr_key'.
132 type VrrpVrKey struct {
133         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
134         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
135         IsIPv6    uint8                          `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
136 }
137
138 // VrrpVrRuntime defines type 'vrrp_vr_runtime'.
139 type VrrpVrRuntime struct {
140         State         VrrpVrState               `binapi:"vrrp_vr_state,name=state" json:"state,omitempty"`
141         MasterAdvInt  uint16                    `binapi:"u16,name=master_adv_int" json:"master_adv_int,omitempty"`
142         Skew          uint16                    `binapi:"u16,name=skew" json:"skew,omitempty"`
143         MasterDownInt uint16                    `binapi:"u16,name=master_down_int" json:"master_down_int,omitempty"`
144         Mac           ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"`
145         Tracking      VrrpVrTracking            `binapi:"vrrp_vr_tracking,name=tracking" json:"tracking,omitempty"`
146 }
147
148 // VrrpVrTrackIf defines type 'vrrp_vr_track_if'.
149 type VrrpVrTrackIf struct {
150         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
151         Priority  uint8                          `binapi:"u8,name=priority" json:"priority,omitempty"`
152 }
153
154 // VrrpVrTracking defines type 'vrrp_vr_tracking'.
155 type VrrpVrTracking struct {
156         InterfacesDec uint32 `binapi:"u32,name=interfaces_dec" json:"interfaces_dec,omitempty"`
157         Priority      uint8  `binapi:"u8,name=priority" json:"priority,omitempty"`
158 }
159
160 // VrrpVrAddDel defines message 'vrrp_vr_add_del'.
161 type VrrpVrAddDel struct {
162         IsAdd     uint8                          `binapi:"u8,name=is_add" json:"is_add,omitempty"`
163         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
164         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
165         Priority  uint8                          `binapi:"u8,name=priority" json:"priority,omitempty"`
166         Interval  uint16                         `binapi:"u16,name=interval" json:"interval,omitempty"`
167         Flags     VrrpVrFlags                    `binapi:"vrrp_vr_flags,name=flags" json:"flags,omitempty"`
168         NAddrs    uint8                          `binapi:"u8,name=n_addrs" json:"-"`
169         Addrs     []ip_types.Address             `binapi:"address[n_addrs],name=addrs" json:"addrs,omitempty"`
170 }
171
172 func (m *VrrpVrAddDel) Reset()               { *m = VrrpVrAddDel{} }
173 func (*VrrpVrAddDel) GetMessageName() string { return "vrrp_vr_add_del" }
174 func (*VrrpVrAddDel) GetCrcString() string   { return "6dc4b881" }
175 func (*VrrpVrAddDel) GetMessageType() api.MessageType {
176         return api.RequestMessage
177 }
178
179 func (m *VrrpVrAddDel) Size() int {
180         if m == nil {
181                 return 0
182         }
183         var size int
184         size += 1 // m.IsAdd
185         size += 4 // m.SwIfIndex
186         size += 1 // m.VrID
187         size += 1 // m.Priority
188         size += 2 // m.Interval
189         size += 4 // m.Flags
190         size += 1 // m.NAddrs
191         for j1 := 0; j1 < len(m.Addrs); j1++ {
192                 var s1 ip_types.Address
193                 _ = s1
194                 if j1 < len(m.Addrs) {
195                         s1 = m.Addrs[j1]
196                 }
197                 size += 1      // s1.Af
198                 size += 1 * 16 // s1.Un
199         }
200         return size
201 }
202 func (m *VrrpVrAddDel) Marshal(b []byte) ([]byte, error) {
203         var buf *codec.Buffer
204         if b == nil {
205                 buf = codec.NewBuffer(make([]byte, m.Size()))
206         } else {
207                 buf = codec.NewBuffer(b)
208         }
209         buf.EncodeUint8(uint8(m.IsAdd))
210         buf.EncodeUint32(uint32(m.SwIfIndex))
211         buf.EncodeUint8(uint8(m.VrID))
212         buf.EncodeUint8(uint8(m.Priority))
213         buf.EncodeUint16(uint16(m.Interval))
214         buf.EncodeUint32(uint32(m.Flags))
215         buf.EncodeUint8(uint8(len(m.Addrs)))
216         for j0 := 0; j0 < len(m.Addrs); j0++ {
217                 var v0 ip_types.Address
218                 if j0 < len(m.Addrs) {
219                         v0 = m.Addrs[j0]
220                 }
221                 buf.EncodeUint8(uint8(v0.Af))
222                 buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0)
223         }
224         return buf.Bytes(), nil
225 }
226 func (m *VrrpVrAddDel) Unmarshal(b []byte) error {
227         buf := codec.NewBuffer(b)
228         m.IsAdd = buf.DecodeUint8()
229         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
230         m.VrID = buf.DecodeUint8()
231         m.Priority = buf.DecodeUint8()
232         m.Interval = buf.DecodeUint16()
233         m.Flags = VrrpVrFlags(buf.DecodeUint32())
234         m.NAddrs = buf.DecodeUint8()
235         m.Addrs = make([]ip_types.Address, int(m.NAddrs))
236         for j0 := 0; j0 < len(m.Addrs); j0++ {
237                 m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8())
238                 copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16))
239         }
240         return nil
241 }
242
243 // VrrpVrAddDelReply defines message 'vrrp_vr_add_del_reply'.
244 type VrrpVrAddDelReply struct {
245         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
246 }
247
248 func (m *VrrpVrAddDelReply) Reset()               { *m = VrrpVrAddDelReply{} }
249 func (*VrrpVrAddDelReply) GetMessageName() string { return "vrrp_vr_add_del_reply" }
250 func (*VrrpVrAddDelReply) GetCrcString() string   { return "e8d4e804" }
251 func (*VrrpVrAddDelReply) GetMessageType() api.MessageType {
252         return api.ReplyMessage
253 }
254
255 func (m *VrrpVrAddDelReply) Size() int {
256         if m == nil {
257                 return 0
258         }
259         var size int
260         size += 4 // m.Retval
261         return size
262 }
263 func (m *VrrpVrAddDelReply) Marshal(b []byte) ([]byte, error) {
264         var buf *codec.Buffer
265         if b == nil {
266                 buf = codec.NewBuffer(make([]byte, m.Size()))
267         } else {
268                 buf = codec.NewBuffer(b)
269         }
270         buf.EncodeUint32(uint32(m.Retval))
271         return buf.Bytes(), nil
272 }
273 func (m *VrrpVrAddDelReply) Unmarshal(b []byte) error {
274         buf := codec.NewBuffer(b)
275         m.Retval = int32(buf.DecodeUint32())
276         return nil
277 }
278
279 // VrrpVrDetails defines message 'vrrp_vr_details'.
280 type VrrpVrDetails struct {
281         Config  VrrpVrConf         `binapi:"vrrp_vr_conf,name=config" json:"config,omitempty"`
282         Runtime VrrpVrRuntime      `binapi:"vrrp_vr_runtime,name=runtime" json:"runtime,omitempty"`
283         NAddrs  uint8              `binapi:"u8,name=n_addrs" json:"-"`
284         Addrs   []ip_types.Address `binapi:"address[n_addrs],name=addrs" json:"addrs,omitempty"`
285 }
286
287 func (m *VrrpVrDetails) Reset()               { *m = VrrpVrDetails{} }
288 func (*VrrpVrDetails) GetMessageName() string { return "vrrp_vr_details" }
289 func (*VrrpVrDetails) GetCrcString() string   { return "0412fa71" }
290 func (*VrrpVrDetails) GetMessageType() api.MessageType {
291         return api.ReplyMessage
292 }
293
294 func (m *VrrpVrDetails) Size() int {
295         if m == nil {
296                 return 0
297         }
298         var size int
299         size += 4     // m.Config.SwIfIndex
300         size += 1     // m.Config.VrID
301         size += 1     // m.Config.Priority
302         size += 2     // m.Config.Interval
303         size += 4     // m.Config.Flags
304         size += 4     // m.Runtime.State
305         size += 2     // m.Runtime.MasterAdvInt
306         size += 2     // m.Runtime.Skew
307         size += 2     // m.Runtime.MasterDownInt
308         size += 1 * 6 // m.Runtime.Mac
309         size += 4     // m.Runtime.Tracking.InterfacesDec
310         size += 1     // m.Runtime.Tracking.Priority
311         size += 1     // m.NAddrs
312         for j1 := 0; j1 < len(m.Addrs); j1++ {
313                 var s1 ip_types.Address
314                 _ = s1
315                 if j1 < len(m.Addrs) {
316                         s1 = m.Addrs[j1]
317                 }
318                 size += 1      // s1.Af
319                 size += 1 * 16 // s1.Un
320         }
321         return size
322 }
323 func (m *VrrpVrDetails) Marshal(b []byte) ([]byte, error) {
324         var buf *codec.Buffer
325         if b == nil {
326                 buf = codec.NewBuffer(make([]byte, m.Size()))
327         } else {
328                 buf = codec.NewBuffer(b)
329         }
330         buf.EncodeUint32(uint32(m.Config.SwIfIndex))
331         buf.EncodeUint8(uint8(m.Config.VrID))
332         buf.EncodeUint8(uint8(m.Config.Priority))
333         buf.EncodeUint16(uint16(m.Config.Interval))
334         buf.EncodeUint32(uint32(m.Config.Flags))
335         buf.EncodeUint32(uint32(m.Runtime.State))
336         buf.EncodeUint16(uint16(m.Runtime.MasterAdvInt))
337         buf.EncodeUint16(uint16(m.Runtime.Skew))
338         buf.EncodeUint16(uint16(m.Runtime.MasterDownInt))
339         buf.EncodeBytes(m.Runtime.Mac[:], 6)
340         buf.EncodeUint32(uint32(m.Runtime.Tracking.InterfacesDec))
341         buf.EncodeUint8(uint8(m.Runtime.Tracking.Priority))
342         buf.EncodeUint8(uint8(len(m.Addrs)))
343         for j0 := 0; j0 < len(m.Addrs); j0++ {
344                 var v0 ip_types.Address
345                 if j0 < len(m.Addrs) {
346                         v0 = m.Addrs[j0]
347                 }
348                 buf.EncodeUint8(uint8(v0.Af))
349                 buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0)
350         }
351         return buf.Bytes(), nil
352 }
353 func (m *VrrpVrDetails) Unmarshal(b []byte) error {
354         buf := codec.NewBuffer(b)
355         m.Config.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
356         m.Config.VrID = buf.DecodeUint8()
357         m.Config.Priority = buf.DecodeUint8()
358         m.Config.Interval = buf.DecodeUint16()
359         m.Config.Flags = VrrpVrFlags(buf.DecodeUint32())
360         m.Runtime.State = VrrpVrState(buf.DecodeUint32())
361         m.Runtime.MasterAdvInt = buf.DecodeUint16()
362         m.Runtime.Skew = buf.DecodeUint16()
363         m.Runtime.MasterDownInt = buf.DecodeUint16()
364         copy(m.Runtime.Mac[:], buf.DecodeBytes(6))
365         m.Runtime.Tracking.InterfacesDec = buf.DecodeUint32()
366         m.Runtime.Tracking.Priority = buf.DecodeUint8()
367         m.NAddrs = buf.DecodeUint8()
368         m.Addrs = make([]ip_types.Address, int(m.NAddrs))
369         for j0 := 0; j0 < len(m.Addrs); j0++ {
370                 m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8())
371                 copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16))
372         }
373         return nil
374 }
375
376 // VrrpVrDump defines message 'vrrp_vr_dump'.
377 type VrrpVrDump struct {
378         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
379 }
380
381 func (m *VrrpVrDump) Reset()               { *m = VrrpVrDump{} }
382 func (*VrrpVrDump) GetMessageName() string { return "vrrp_vr_dump" }
383 func (*VrrpVrDump) GetCrcString() string   { return "f9e6675e" }
384 func (*VrrpVrDump) GetMessageType() api.MessageType {
385         return api.RequestMessage
386 }
387
388 func (m *VrrpVrDump) Size() int {
389         if m == nil {
390                 return 0
391         }
392         var size int
393         size += 4 // m.SwIfIndex
394         return size
395 }
396 func (m *VrrpVrDump) Marshal(b []byte) ([]byte, error) {
397         var buf *codec.Buffer
398         if b == nil {
399                 buf = codec.NewBuffer(make([]byte, m.Size()))
400         } else {
401                 buf = codec.NewBuffer(b)
402         }
403         buf.EncodeUint32(uint32(m.SwIfIndex))
404         return buf.Bytes(), nil
405 }
406 func (m *VrrpVrDump) Unmarshal(b []byte) error {
407         buf := codec.NewBuffer(b)
408         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
409         return nil
410 }
411
412 // VrrpVrPeerDetails defines message 'vrrp_vr_peer_details'.
413 type VrrpVrPeerDetails struct {
414         SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
415         VrID       uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
416         IsIPv6     uint8                          `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
417         NPeerAddrs uint8                          `binapi:"u8,name=n_peer_addrs" json:"-"`
418         PeerAddrs  []ip_types.Address             `binapi:"address[n_peer_addrs],name=peer_addrs" json:"peer_addrs,omitempty"`
419 }
420
421 func (m *VrrpVrPeerDetails) Reset()               { *m = VrrpVrPeerDetails{} }
422 func (*VrrpVrPeerDetails) GetMessageName() string { return "vrrp_vr_peer_details" }
423 func (*VrrpVrPeerDetails) GetCrcString() string   { return "abd9145e" }
424 func (*VrrpVrPeerDetails) GetMessageType() api.MessageType {
425         return api.RequestMessage
426 }
427
428 func (m *VrrpVrPeerDetails) Size() int {
429         if m == nil {
430                 return 0
431         }
432         var size int
433         size += 4 // m.SwIfIndex
434         size += 1 // m.VrID
435         size += 1 // m.IsIPv6
436         size += 1 // m.NPeerAddrs
437         for j1 := 0; j1 < len(m.PeerAddrs); j1++ {
438                 var s1 ip_types.Address
439                 _ = s1
440                 if j1 < len(m.PeerAddrs) {
441                         s1 = m.PeerAddrs[j1]
442                 }
443                 size += 1      // s1.Af
444                 size += 1 * 16 // s1.Un
445         }
446         return size
447 }
448 func (m *VrrpVrPeerDetails) Marshal(b []byte) ([]byte, error) {
449         var buf *codec.Buffer
450         if b == nil {
451                 buf = codec.NewBuffer(make([]byte, m.Size()))
452         } else {
453                 buf = codec.NewBuffer(b)
454         }
455         buf.EncodeUint32(uint32(m.SwIfIndex))
456         buf.EncodeUint8(uint8(m.VrID))
457         buf.EncodeUint8(uint8(m.IsIPv6))
458         buf.EncodeUint8(uint8(len(m.PeerAddrs)))
459         for j0 := 0; j0 < len(m.PeerAddrs); j0++ {
460                 var v0 ip_types.Address
461                 if j0 < len(m.PeerAddrs) {
462                         v0 = m.PeerAddrs[j0]
463                 }
464                 buf.EncodeUint8(uint8(v0.Af))
465                 buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0)
466         }
467         return buf.Bytes(), nil
468 }
469 func (m *VrrpVrPeerDetails) Unmarshal(b []byte) error {
470         buf := codec.NewBuffer(b)
471         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
472         m.VrID = buf.DecodeUint8()
473         m.IsIPv6 = buf.DecodeUint8()
474         m.NPeerAddrs = buf.DecodeUint8()
475         m.PeerAddrs = make([]ip_types.Address, int(m.NPeerAddrs))
476         for j0 := 0; j0 < len(m.PeerAddrs); j0++ {
477                 m.PeerAddrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8())
478                 copy(m.PeerAddrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16))
479         }
480         return nil
481 }
482
483 // VrrpVrPeerDump defines message 'vrrp_vr_peer_dump'.
484 type VrrpVrPeerDump struct {
485         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
486         IsIPv6    uint8                          `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
487         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
488 }
489
490 func (m *VrrpVrPeerDump) Reset()               { *m = VrrpVrPeerDump{} }
491 func (*VrrpVrPeerDump) GetMessageName() string { return "vrrp_vr_peer_dump" }
492 func (*VrrpVrPeerDump) GetCrcString() string   { return "6fa3f7c4" }
493 func (*VrrpVrPeerDump) GetMessageType() api.MessageType {
494         return api.RequestMessage
495 }
496
497 func (m *VrrpVrPeerDump) Size() int {
498         if m == nil {
499                 return 0
500         }
501         var size int
502         size += 4 // m.SwIfIndex
503         size += 1 // m.IsIPv6
504         size += 1 // m.VrID
505         return size
506 }
507 func (m *VrrpVrPeerDump) Marshal(b []byte) ([]byte, error) {
508         var buf *codec.Buffer
509         if b == nil {
510                 buf = codec.NewBuffer(make([]byte, m.Size()))
511         } else {
512                 buf = codec.NewBuffer(b)
513         }
514         buf.EncodeUint32(uint32(m.SwIfIndex))
515         buf.EncodeUint8(uint8(m.IsIPv6))
516         buf.EncodeUint8(uint8(m.VrID))
517         return buf.Bytes(), nil
518 }
519 func (m *VrrpVrPeerDump) Unmarshal(b []byte) error {
520         buf := codec.NewBuffer(b)
521         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
522         m.IsIPv6 = buf.DecodeUint8()
523         m.VrID = buf.DecodeUint8()
524         return nil
525 }
526
527 // VrrpVrSetPeers defines message 'vrrp_vr_set_peers'.
528 type VrrpVrSetPeers struct {
529         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
530         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
531         IsIPv6    uint8                          `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
532         NAddrs    uint8                          `binapi:"u8,name=n_addrs" json:"-"`
533         Addrs     []ip_types.Address             `binapi:"address[n_addrs],name=addrs" json:"addrs,omitempty"`
534 }
535
536 func (m *VrrpVrSetPeers) Reset()               { *m = VrrpVrSetPeers{} }
537 func (*VrrpVrSetPeers) GetMessageName() string { return "vrrp_vr_set_peers" }
538 func (*VrrpVrSetPeers) GetCrcString() string   { return "baa2e52b" }
539 func (*VrrpVrSetPeers) GetMessageType() api.MessageType {
540         return api.RequestMessage
541 }
542
543 func (m *VrrpVrSetPeers) Size() int {
544         if m == nil {
545                 return 0
546         }
547         var size int
548         size += 4 // m.SwIfIndex
549         size += 1 // m.VrID
550         size += 1 // m.IsIPv6
551         size += 1 // m.NAddrs
552         for j1 := 0; j1 < len(m.Addrs); j1++ {
553                 var s1 ip_types.Address
554                 _ = s1
555                 if j1 < len(m.Addrs) {
556                         s1 = m.Addrs[j1]
557                 }
558                 size += 1      // s1.Af
559                 size += 1 * 16 // s1.Un
560         }
561         return size
562 }
563 func (m *VrrpVrSetPeers) Marshal(b []byte) ([]byte, error) {
564         var buf *codec.Buffer
565         if b == nil {
566                 buf = codec.NewBuffer(make([]byte, m.Size()))
567         } else {
568                 buf = codec.NewBuffer(b)
569         }
570         buf.EncodeUint32(uint32(m.SwIfIndex))
571         buf.EncodeUint8(uint8(m.VrID))
572         buf.EncodeUint8(uint8(m.IsIPv6))
573         buf.EncodeUint8(uint8(len(m.Addrs)))
574         for j0 := 0; j0 < len(m.Addrs); j0++ {
575                 var v0 ip_types.Address
576                 if j0 < len(m.Addrs) {
577                         v0 = m.Addrs[j0]
578                 }
579                 buf.EncodeUint8(uint8(v0.Af))
580                 buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0)
581         }
582         return buf.Bytes(), nil
583 }
584 func (m *VrrpVrSetPeers) Unmarshal(b []byte) error {
585         buf := codec.NewBuffer(b)
586         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
587         m.VrID = buf.DecodeUint8()
588         m.IsIPv6 = buf.DecodeUint8()
589         m.NAddrs = buf.DecodeUint8()
590         m.Addrs = make([]ip_types.Address, int(m.NAddrs))
591         for j0 := 0; j0 < len(m.Addrs); j0++ {
592                 m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8())
593                 copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16))
594         }
595         return nil
596 }
597
598 // VrrpVrSetPeersReply defines message 'vrrp_vr_set_peers_reply'.
599 type VrrpVrSetPeersReply struct {
600         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
601 }
602
603 func (m *VrrpVrSetPeersReply) Reset()               { *m = VrrpVrSetPeersReply{} }
604 func (*VrrpVrSetPeersReply) GetMessageName() string { return "vrrp_vr_set_peers_reply" }
605 func (*VrrpVrSetPeersReply) GetCrcString() string   { return "e8d4e804" }
606 func (*VrrpVrSetPeersReply) GetMessageType() api.MessageType {
607         return api.ReplyMessage
608 }
609
610 func (m *VrrpVrSetPeersReply) Size() int {
611         if m == nil {
612                 return 0
613         }
614         var size int
615         size += 4 // m.Retval
616         return size
617 }
618 func (m *VrrpVrSetPeersReply) Marshal(b []byte) ([]byte, error) {
619         var buf *codec.Buffer
620         if b == nil {
621                 buf = codec.NewBuffer(make([]byte, m.Size()))
622         } else {
623                 buf = codec.NewBuffer(b)
624         }
625         buf.EncodeUint32(uint32(m.Retval))
626         return buf.Bytes(), nil
627 }
628 func (m *VrrpVrSetPeersReply) Unmarshal(b []byte) error {
629         buf := codec.NewBuffer(b)
630         m.Retval = int32(buf.DecodeUint32())
631         return nil
632 }
633
634 // VrrpVrStartStop defines message 'vrrp_vr_start_stop'.
635 type VrrpVrStartStop struct {
636         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
637         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
638         IsIPv6    uint8                          `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
639         IsStart   uint8                          `binapi:"u8,name=is_start" json:"is_start,omitempty"`
640 }
641
642 func (m *VrrpVrStartStop) Reset()               { *m = VrrpVrStartStop{} }
643 func (*VrrpVrStartStop) GetMessageName() string { return "vrrp_vr_start_stop" }
644 func (*VrrpVrStartStop) GetCrcString() string   { return "0662a3b7" }
645 func (*VrrpVrStartStop) GetMessageType() api.MessageType {
646         return api.RequestMessage
647 }
648
649 func (m *VrrpVrStartStop) Size() int {
650         if m == nil {
651                 return 0
652         }
653         var size int
654         size += 4 // m.SwIfIndex
655         size += 1 // m.VrID
656         size += 1 // m.IsIPv6
657         size += 1 // m.IsStart
658         return size
659 }
660 func (m *VrrpVrStartStop) Marshal(b []byte) ([]byte, error) {
661         var buf *codec.Buffer
662         if b == nil {
663                 buf = codec.NewBuffer(make([]byte, m.Size()))
664         } else {
665                 buf = codec.NewBuffer(b)
666         }
667         buf.EncodeUint32(uint32(m.SwIfIndex))
668         buf.EncodeUint8(uint8(m.VrID))
669         buf.EncodeUint8(uint8(m.IsIPv6))
670         buf.EncodeUint8(uint8(m.IsStart))
671         return buf.Bytes(), nil
672 }
673 func (m *VrrpVrStartStop) Unmarshal(b []byte) error {
674         buf := codec.NewBuffer(b)
675         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
676         m.VrID = buf.DecodeUint8()
677         m.IsIPv6 = buf.DecodeUint8()
678         m.IsStart = buf.DecodeUint8()
679         return nil
680 }
681
682 // VrrpVrStartStopReply defines message 'vrrp_vr_start_stop_reply'.
683 type VrrpVrStartStopReply struct {
684         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
685 }
686
687 func (m *VrrpVrStartStopReply) Reset()               { *m = VrrpVrStartStopReply{} }
688 func (*VrrpVrStartStopReply) GetMessageName() string { return "vrrp_vr_start_stop_reply" }
689 func (*VrrpVrStartStopReply) GetCrcString() string   { return "e8d4e804" }
690 func (*VrrpVrStartStopReply) GetMessageType() api.MessageType {
691         return api.ReplyMessage
692 }
693
694 func (m *VrrpVrStartStopReply) Size() int {
695         if m == nil {
696                 return 0
697         }
698         var size int
699         size += 4 // m.Retval
700         return size
701 }
702 func (m *VrrpVrStartStopReply) Marshal(b []byte) ([]byte, error) {
703         var buf *codec.Buffer
704         if b == nil {
705                 buf = codec.NewBuffer(make([]byte, m.Size()))
706         } else {
707                 buf = codec.NewBuffer(b)
708         }
709         buf.EncodeUint32(uint32(m.Retval))
710         return buf.Bytes(), nil
711 }
712 func (m *VrrpVrStartStopReply) Unmarshal(b []byte) error {
713         buf := codec.NewBuffer(b)
714         m.Retval = int32(buf.DecodeUint32())
715         return nil
716 }
717
718 // VrrpVrTrackIfAddDel defines message 'vrrp_vr_track_if_add_del'.
719 type VrrpVrTrackIfAddDel struct {
720         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
721         IsIPv6    uint8                          `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
722         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
723         IsAdd     uint8                          `binapi:"u8,name=is_add" json:"is_add,omitempty"`
724         NIfs      uint8                          `binapi:"u8,name=n_ifs" json:"-"`
725         Ifs       []VrrpVrTrackIf                `binapi:"vrrp_vr_track_if[n_ifs],name=ifs" json:"ifs,omitempty"`
726 }
727
728 func (m *VrrpVrTrackIfAddDel) Reset()               { *m = VrrpVrTrackIfAddDel{} }
729 func (*VrrpVrTrackIfAddDel) GetMessageName() string { return "vrrp_vr_track_if_add_del" }
730 func (*VrrpVrTrackIfAddDel) GetCrcString() string   { return "337f4ba4" }
731 func (*VrrpVrTrackIfAddDel) GetMessageType() api.MessageType {
732         return api.RequestMessage
733 }
734
735 func (m *VrrpVrTrackIfAddDel) Size() int {
736         if m == nil {
737                 return 0
738         }
739         var size int
740         size += 4 // m.SwIfIndex
741         size += 1 // m.IsIPv6
742         size += 1 // m.VrID
743         size += 1 // m.IsAdd
744         size += 1 // m.NIfs
745         for j1 := 0; j1 < len(m.Ifs); j1++ {
746                 var s1 VrrpVrTrackIf
747                 _ = s1
748                 if j1 < len(m.Ifs) {
749                         s1 = m.Ifs[j1]
750                 }
751                 size += 4 // s1.SwIfIndex
752                 size += 1 // s1.Priority
753         }
754         return size
755 }
756 func (m *VrrpVrTrackIfAddDel) Marshal(b []byte) ([]byte, error) {
757         var buf *codec.Buffer
758         if b == nil {
759                 buf = codec.NewBuffer(make([]byte, m.Size()))
760         } else {
761                 buf = codec.NewBuffer(b)
762         }
763         buf.EncodeUint32(uint32(m.SwIfIndex))
764         buf.EncodeUint8(uint8(m.IsIPv6))
765         buf.EncodeUint8(uint8(m.VrID))
766         buf.EncodeUint8(uint8(m.IsAdd))
767         buf.EncodeUint8(uint8(len(m.Ifs)))
768         for j0 := 0; j0 < len(m.Ifs); j0++ {
769                 var v0 VrrpVrTrackIf
770                 if j0 < len(m.Ifs) {
771                         v0 = m.Ifs[j0]
772                 }
773                 buf.EncodeUint32(uint32(v0.SwIfIndex))
774                 buf.EncodeUint8(uint8(v0.Priority))
775         }
776         return buf.Bytes(), nil
777 }
778 func (m *VrrpVrTrackIfAddDel) Unmarshal(b []byte) error {
779         buf := codec.NewBuffer(b)
780         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
781         m.IsIPv6 = buf.DecodeUint8()
782         m.VrID = buf.DecodeUint8()
783         m.IsAdd = buf.DecodeUint8()
784         m.NIfs = buf.DecodeUint8()
785         m.Ifs = make([]VrrpVrTrackIf, int(m.NIfs))
786         for j0 := 0; j0 < len(m.Ifs); j0++ {
787                 m.Ifs[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
788                 m.Ifs[j0].Priority = buf.DecodeUint8()
789         }
790         return nil
791 }
792
793 // VrrpVrTrackIfAddDelReply defines message 'vrrp_vr_track_if_add_del_reply'.
794 type VrrpVrTrackIfAddDelReply struct {
795         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
796 }
797
798 func (m *VrrpVrTrackIfAddDelReply) Reset()               { *m = VrrpVrTrackIfAddDelReply{} }
799 func (*VrrpVrTrackIfAddDelReply) GetMessageName() string { return "vrrp_vr_track_if_add_del_reply" }
800 func (*VrrpVrTrackIfAddDelReply) GetCrcString() string   { return "e8d4e804" }
801 func (*VrrpVrTrackIfAddDelReply) GetMessageType() api.MessageType {
802         return api.ReplyMessage
803 }
804
805 func (m *VrrpVrTrackIfAddDelReply) Size() int {
806         if m == nil {
807                 return 0
808         }
809         var size int
810         size += 4 // m.Retval
811         return size
812 }
813 func (m *VrrpVrTrackIfAddDelReply) Marshal(b []byte) ([]byte, error) {
814         var buf *codec.Buffer
815         if b == nil {
816                 buf = codec.NewBuffer(make([]byte, m.Size()))
817         } else {
818                 buf = codec.NewBuffer(b)
819         }
820         buf.EncodeUint32(uint32(m.Retval))
821         return buf.Bytes(), nil
822 }
823 func (m *VrrpVrTrackIfAddDelReply) Unmarshal(b []byte) error {
824         buf := codec.NewBuffer(b)
825         m.Retval = int32(buf.DecodeUint32())
826         return nil
827 }
828
829 // VrrpVrTrackIfDetails defines message 'vrrp_vr_track_if_details'.
830 type VrrpVrTrackIfDetails struct {
831         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
832         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
833         IsIPv6    uint8                          `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
834         NIfs      uint8                          `binapi:"u8,name=n_ifs" json:"-"`
835         Ifs       []VrrpVrTrackIf                `binapi:"vrrp_vr_track_if[n_ifs],name=ifs" json:"ifs,omitempty"`
836 }
837
838 func (m *VrrpVrTrackIfDetails) Reset()               { *m = VrrpVrTrackIfDetails{} }
839 func (*VrrpVrTrackIfDetails) GetMessageName() string { return "vrrp_vr_track_if_details" }
840 func (*VrrpVrTrackIfDetails) GetCrcString() string   { return "99bcca9c" }
841 func (*VrrpVrTrackIfDetails) GetMessageType() api.MessageType {
842         return api.RequestMessage
843 }
844
845 func (m *VrrpVrTrackIfDetails) Size() int {
846         if m == nil {
847                 return 0
848         }
849         var size int
850         size += 4 // m.SwIfIndex
851         size += 1 // m.VrID
852         size += 1 // m.IsIPv6
853         size += 1 // m.NIfs
854         for j1 := 0; j1 < len(m.Ifs); j1++ {
855                 var s1 VrrpVrTrackIf
856                 _ = s1
857                 if j1 < len(m.Ifs) {
858                         s1 = m.Ifs[j1]
859                 }
860                 size += 4 // s1.SwIfIndex
861                 size += 1 // s1.Priority
862         }
863         return size
864 }
865 func (m *VrrpVrTrackIfDetails) Marshal(b []byte) ([]byte, error) {
866         var buf *codec.Buffer
867         if b == nil {
868                 buf = codec.NewBuffer(make([]byte, m.Size()))
869         } else {
870                 buf = codec.NewBuffer(b)
871         }
872         buf.EncodeUint32(uint32(m.SwIfIndex))
873         buf.EncodeUint8(uint8(m.VrID))
874         buf.EncodeUint8(uint8(m.IsIPv6))
875         buf.EncodeUint8(uint8(len(m.Ifs)))
876         for j0 := 0; j0 < len(m.Ifs); j0++ {
877                 var v0 VrrpVrTrackIf
878                 if j0 < len(m.Ifs) {
879                         v0 = m.Ifs[j0]
880                 }
881                 buf.EncodeUint32(uint32(v0.SwIfIndex))
882                 buf.EncodeUint8(uint8(v0.Priority))
883         }
884         return buf.Bytes(), nil
885 }
886 func (m *VrrpVrTrackIfDetails) Unmarshal(b []byte) error {
887         buf := codec.NewBuffer(b)
888         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
889         m.VrID = buf.DecodeUint8()
890         m.IsIPv6 = buf.DecodeUint8()
891         m.NIfs = buf.DecodeUint8()
892         m.Ifs = make([]VrrpVrTrackIf, int(m.NIfs))
893         for j0 := 0; j0 < len(m.Ifs); j0++ {
894                 m.Ifs[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
895                 m.Ifs[j0].Priority = buf.DecodeUint8()
896         }
897         return nil
898 }
899
900 // VrrpVrTrackIfDump defines message 'vrrp_vr_track_if_dump'.
901 type VrrpVrTrackIfDump struct {
902         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
903         IsIPv6    uint8                          `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
904         VrID      uint8                          `binapi:"u8,name=vr_id" json:"vr_id,omitempty"`
905         DumpAll   uint8                          `binapi:"u8,name=dump_all" json:"dump_all,omitempty"`
906 }
907
908 func (m *VrrpVrTrackIfDump) Reset()               { *m = VrrpVrTrackIfDump{} }
909 func (*VrrpVrTrackIfDump) GetMessageName() string { return "vrrp_vr_track_if_dump" }
910 func (*VrrpVrTrackIfDump) GetCrcString() string   { return "a34dfc6d" }
911 func (*VrrpVrTrackIfDump) GetMessageType() api.MessageType {
912         return api.RequestMessage
913 }
914
915 func (m *VrrpVrTrackIfDump) Size() int {
916         if m == nil {
917                 return 0
918         }
919         var size int
920         size += 4 // m.SwIfIndex
921         size += 1 // m.IsIPv6
922         size += 1 // m.VrID
923         size += 1 // m.DumpAll
924         return size
925 }
926 func (m *VrrpVrTrackIfDump) Marshal(b []byte) ([]byte, error) {
927         var buf *codec.Buffer
928         if b == nil {
929                 buf = codec.NewBuffer(make([]byte, m.Size()))
930         } else {
931                 buf = codec.NewBuffer(b)
932         }
933         buf.EncodeUint32(uint32(m.SwIfIndex))
934         buf.EncodeUint8(uint8(m.IsIPv6))
935         buf.EncodeUint8(uint8(m.VrID))
936         buf.EncodeUint8(uint8(m.DumpAll))
937         return buf.Bytes(), nil
938 }
939 func (m *VrrpVrTrackIfDump) Unmarshal(b []byte) error {
940         buf := codec.NewBuffer(b)
941         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
942         m.IsIPv6 = buf.DecodeUint8()
943         m.VrID = buf.DecodeUint8()
944         m.DumpAll = buf.DecodeUint8()
945         return nil
946 }
947
948 func init() { file_vrrp_binapi_init() }
949 func file_vrrp_binapi_init() {
950         api.RegisterMessage((*VrrpVrAddDel)(nil), "vrrp_vr_add_del_6dc4b881")
951         api.RegisterMessage((*VrrpVrAddDelReply)(nil), "vrrp_vr_add_del_reply_e8d4e804")
952         api.RegisterMessage((*VrrpVrDetails)(nil), "vrrp_vr_details_0412fa71")
953         api.RegisterMessage((*VrrpVrDump)(nil), "vrrp_vr_dump_f9e6675e")
954         api.RegisterMessage((*VrrpVrPeerDetails)(nil), "vrrp_vr_peer_details_abd9145e")
955         api.RegisterMessage((*VrrpVrPeerDump)(nil), "vrrp_vr_peer_dump_6fa3f7c4")
956         api.RegisterMessage((*VrrpVrSetPeers)(nil), "vrrp_vr_set_peers_baa2e52b")
957         api.RegisterMessage((*VrrpVrSetPeersReply)(nil), "vrrp_vr_set_peers_reply_e8d4e804")
958         api.RegisterMessage((*VrrpVrStartStop)(nil), "vrrp_vr_start_stop_0662a3b7")
959         api.RegisterMessage((*VrrpVrStartStopReply)(nil), "vrrp_vr_start_stop_reply_e8d4e804")
960         api.RegisterMessage((*VrrpVrTrackIfAddDel)(nil), "vrrp_vr_track_if_add_del_337f4ba4")
961         api.RegisterMessage((*VrrpVrTrackIfAddDelReply)(nil), "vrrp_vr_track_if_add_del_reply_e8d4e804")
962         api.RegisterMessage((*VrrpVrTrackIfDetails)(nil), "vrrp_vr_track_if_details_99bcca9c")
963         api.RegisterMessage((*VrrpVrTrackIfDump)(nil), "vrrp_vr_track_if_dump_a34dfc6d")
964 }
965
966 // Messages returns list of all messages in this module.
967 func AllMessages() []api.Message {
968         return []api.Message{
969                 (*VrrpVrAddDel)(nil),
970                 (*VrrpVrAddDelReply)(nil),
971                 (*VrrpVrDetails)(nil),
972                 (*VrrpVrDump)(nil),
973                 (*VrrpVrPeerDetails)(nil),
974                 (*VrrpVrPeerDump)(nil),
975                 (*VrrpVrSetPeers)(nil),
976                 (*VrrpVrSetPeersReply)(nil),
977                 (*VrrpVrStartStop)(nil),
978                 (*VrrpVrStartStopReply)(nil),
979                 (*VrrpVrTrackIfAddDel)(nil),
980                 (*VrrpVrTrackIfAddDelReply)(nil),
981                 (*VrrpVrTrackIfDetails)(nil),
982                 (*VrrpVrTrackIfDump)(nil),
983         }
984 }