binapigen: fix union size
[govpp.git] / binapi / p2p_ethernet / p2p_ethernet.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/p2p_ethernet.api.json
6
7 // Package p2p_ethernet contains generated bindings for API file p2p_ethernet.api.
8 //
9 // Contents:
10 //   4 messages
11 //
12 package p2p_ethernet
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
17         interface_types "git.fd.io/govpp.git/binapi/interface_types"
18         codec "git.fd.io/govpp.git/codec"
19 )
20
21 // This is a compile-time assertion to ensure that this generated file
22 // is compatible with the GoVPP api package it is being compiled against.
23 // A compilation error at this line likely means your copy of the
24 // GoVPP api package needs to be updated.
25 const _ = api.GoVppAPIPackageIsVersion2
26
27 const (
28         APIFile    = "p2p_ethernet"
29         APIVersion = "1.0.0"
30         VersionCrc = 0xe34f63cd
31 )
32
33 // P2pEthernetAdd defines message 'p2p_ethernet_add'.
34 type P2pEthernetAdd struct {
35         ParentIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=parent_if_index" json:"parent_if_index,omitempty"`
36         SubifID       uint32                         `binapi:"u32,name=subif_id" json:"subif_id,omitempty"`
37         RemoteMac     ethernet_types.MacAddress      `binapi:"mac_address,name=remote_mac" json:"remote_mac,omitempty"`
38 }
39
40 func (m *P2pEthernetAdd) Reset()               { *m = P2pEthernetAdd{} }
41 func (*P2pEthernetAdd) GetMessageName() string { return "p2p_ethernet_add" }
42 func (*P2pEthernetAdd) GetCrcString() string   { return "eeb8e717" }
43 func (*P2pEthernetAdd) GetMessageType() api.MessageType {
44         return api.RequestMessage
45 }
46
47 func (m *P2pEthernetAdd) Size() (size int) {
48         if m == nil {
49                 return 0
50         }
51         size += 4     // m.ParentIfIndex
52         size += 4     // m.SubifID
53         size += 1 * 6 // m.RemoteMac
54         return size
55 }
56 func (m *P2pEthernetAdd) Marshal(b []byte) ([]byte, error) {
57         if b == nil {
58                 b = make([]byte, m.Size())
59         }
60         buf := codec.NewBuffer(b)
61         buf.EncodeUint32(uint32(m.ParentIfIndex))
62         buf.EncodeUint32(m.SubifID)
63         buf.EncodeBytes(m.RemoteMac[:], 6)
64         return buf.Bytes(), nil
65 }
66 func (m *P2pEthernetAdd) Unmarshal(b []byte) error {
67         buf := codec.NewBuffer(b)
68         m.ParentIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
69         m.SubifID = buf.DecodeUint32()
70         copy(m.RemoteMac[:], buf.DecodeBytes(6))
71         return nil
72 }
73
74 // P2pEthernetAddReply defines message 'p2p_ethernet_add_reply'.
75 type P2pEthernetAddReply struct {
76         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
77         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
78 }
79
80 func (m *P2pEthernetAddReply) Reset()               { *m = P2pEthernetAddReply{} }
81 func (*P2pEthernetAddReply) GetMessageName() string { return "p2p_ethernet_add_reply" }
82 func (*P2pEthernetAddReply) GetCrcString() string   { return "5383d31f" }
83 func (*P2pEthernetAddReply) GetMessageType() api.MessageType {
84         return api.ReplyMessage
85 }
86
87 func (m *P2pEthernetAddReply) Size() (size int) {
88         if m == nil {
89                 return 0
90         }
91         size += 4 // m.Retval
92         size += 4 // m.SwIfIndex
93         return size
94 }
95 func (m *P2pEthernetAddReply) Marshal(b []byte) ([]byte, error) {
96         if b == nil {
97                 b = make([]byte, m.Size())
98         }
99         buf := codec.NewBuffer(b)
100         buf.EncodeInt32(m.Retval)
101         buf.EncodeUint32(uint32(m.SwIfIndex))
102         return buf.Bytes(), nil
103 }
104 func (m *P2pEthernetAddReply) Unmarshal(b []byte) error {
105         buf := codec.NewBuffer(b)
106         m.Retval = buf.DecodeInt32()
107         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
108         return nil
109 }
110
111 // P2pEthernetDel defines message 'p2p_ethernet_del'.
112 type P2pEthernetDel struct {
113         ParentIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=parent_if_index" json:"parent_if_index,omitempty"`
114         RemoteMac     ethernet_types.MacAddress      `binapi:"mac_address,name=remote_mac" json:"remote_mac,omitempty"`
115 }
116
117 func (m *P2pEthernetDel) Reset()               { *m = P2pEthernetDel{} }
118 func (*P2pEthernetDel) GetMessageName() string { return "p2p_ethernet_del" }
119 func (*P2pEthernetDel) GetCrcString() string   { return "0b62c386" }
120 func (*P2pEthernetDel) GetMessageType() api.MessageType {
121         return api.RequestMessage
122 }
123
124 func (m *P2pEthernetDel) Size() (size int) {
125         if m == nil {
126                 return 0
127         }
128         size += 4     // m.ParentIfIndex
129         size += 1 * 6 // m.RemoteMac
130         return size
131 }
132 func (m *P2pEthernetDel) Marshal(b []byte) ([]byte, error) {
133         if b == nil {
134                 b = make([]byte, m.Size())
135         }
136         buf := codec.NewBuffer(b)
137         buf.EncodeUint32(uint32(m.ParentIfIndex))
138         buf.EncodeBytes(m.RemoteMac[:], 6)
139         return buf.Bytes(), nil
140 }
141 func (m *P2pEthernetDel) Unmarshal(b []byte) error {
142         buf := codec.NewBuffer(b)
143         m.ParentIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
144         copy(m.RemoteMac[:], buf.DecodeBytes(6))
145         return nil
146 }
147
148 // P2pEthernetDelReply defines message 'p2p_ethernet_del_reply'.
149 type P2pEthernetDelReply struct {
150         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
151 }
152
153 func (m *P2pEthernetDelReply) Reset()               { *m = P2pEthernetDelReply{} }
154 func (*P2pEthernetDelReply) GetMessageName() string { return "p2p_ethernet_del_reply" }
155 func (*P2pEthernetDelReply) GetCrcString() string   { return "e8d4e804" }
156 func (*P2pEthernetDelReply) GetMessageType() api.MessageType {
157         return api.ReplyMessage
158 }
159
160 func (m *P2pEthernetDelReply) Size() (size int) {
161         if m == nil {
162                 return 0
163         }
164         size += 4 // m.Retval
165         return size
166 }
167 func (m *P2pEthernetDelReply) Marshal(b []byte) ([]byte, error) {
168         if b == nil {
169                 b = make([]byte, m.Size())
170         }
171         buf := codec.NewBuffer(b)
172         buf.EncodeInt32(m.Retval)
173         return buf.Bytes(), nil
174 }
175 func (m *P2pEthernetDelReply) Unmarshal(b []byte) error {
176         buf := codec.NewBuffer(b)
177         m.Retval = buf.DecodeInt32()
178         return nil
179 }
180
181 func init() { file_p2p_ethernet_binapi_init() }
182 func file_p2p_ethernet_binapi_init() {
183         api.RegisterMessage((*P2pEthernetAdd)(nil), "p2p_ethernet_add_eeb8e717")
184         api.RegisterMessage((*P2pEthernetAddReply)(nil), "p2p_ethernet_add_reply_5383d31f")
185         api.RegisterMessage((*P2pEthernetDel)(nil), "p2p_ethernet_del_0b62c386")
186         api.RegisterMessage((*P2pEthernetDelReply)(nil), "p2p_ethernet_del_reply_e8d4e804")
187 }
188
189 // Messages returns list of all messages in this module.
190 func AllMessages() []api.Message {
191         return []api.Message{
192                 (*P2pEthernetAdd)(nil),
193                 (*P2pEthernetAddReply)(nil),
194                 (*P2pEthernetDel)(nil),
195                 (*P2pEthernetDelReply)(nil),
196         }
197 }