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