Improve binapi generator
[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() int {
48         if m == nil {
49                 return 0
50         }
51         var size int
52         size += 4     // m.ParentIfIndex
53         size += 4     // m.SubifID
54         size += 1 * 6 // m.RemoteMac
55         return size
56 }
57 func (m *P2pEthernetAdd) Marshal(b []byte) ([]byte, error) {
58         var buf *codec.Buffer
59         if b == nil {
60                 buf = codec.NewBuffer(make([]byte, m.Size()))
61         } else {
62                 buf = codec.NewBuffer(b)
63         }
64         buf.EncodeUint32(uint32(m.ParentIfIndex))
65         buf.EncodeUint32(uint32(m.SubifID))
66         buf.EncodeBytes(m.RemoteMac[:], 6)
67         return buf.Bytes(), nil
68 }
69 func (m *P2pEthernetAdd) Unmarshal(b []byte) error {
70         buf := codec.NewBuffer(b)
71         m.ParentIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
72         m.SubifID = buf.DecodeUint32()
73         copy(m.RemoteMac[:], buf.DecodeBytes(6))
74         return nil
75 }
76
77 // P2pEthernetAddReply defines message 'p2p_ethernet_add_reply'.
78 type P2pEthernetAddReply struct {
79         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
80         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
81 }
82
83 func (m *P2pEthernetAddReply) Reset()               { *m = P2pEthernetAddReply{} }
84 func (*P2pEthernetAddReply) GetMessageName() string { return "p2p_ethernet_add_reply" }
85 func (*P2pEthernetAddReply) GetCrcString() string   { return "5383d31f" }
86 func (*P2pEthernetAddReply) GetMessageType() api.MessageType {
87         return api.ReplyMessage
88 }
89
90 func (m *P2pEthernetAddReply) Size() int {
91         if m == nil {
92                 return 0
93         }
94         var size int
95         size += 4 // m.Retval
96         size += 4 // m.SwIfIndex
97         return size
98 }
99 func (m *P2pEthernetAddReply) Marshal(b []byte) ([]byte, error) {
100         var buf *codec.Buffer
101         if b == nil {
102                 buf = codec.NewBuffer(make([]byte, m.Size()))
103         } else {
104                 buf = codec.NewBuffer(b)
105         }
106         buf.EncodeUint32(uint32(m.Retval))
107         buf.EncodeUint32(uint32(m.SwIfIndex))
108         return buf.Bytes(), nil
109 }
110 func (m *P2pEthernetAddReply) Unmarshal(b []byte) error {
111         buf := codec.NewBuffer(b)
112         m.Retval = int32(buf.DecodeUint32())
113         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
114         return nil
115 }
116
117 // P2pEthernetDel defines message 'p2p_ethernet_del'.
118 type P2pEthernetDel struct {
119         ParentIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=parent_if_index" json:"parent_if_index,omitempty"`
120         RemoteMac     ethernet_types.MacAddress      `binapi:"mac_address,name=remote_mac" json:"remote_mac,omitempty"`
121 }
122
123 func (m *P2pEthernetDel) Reset()               { *m = P2pEthernetDel{} }
124 func (*P2pEthernetDel) GetMessageName() string { return "p2p_ethernet_del" }
125 func (*P2pEthernetDel) GetCrcString() string   { return "0b62c386" }
126 func (*P2pEthernetDel) GetMessageType() api.MessageType {
127         return api.RequestMessage
128 }
129
130 func (m *P2pEthernetDel) Size() int {
131         if m == nil {
132                 return 0
133         }
134         var size int
135         size += 4     // m.ParentIfIndex
136         size += 1 * 6 // m.RemoteMac
137         return size
138 }
139 func (m *P2pEthernetDel) Marshal(b []byte) ([]byte, error) {
140         var buf *codec.Buffer
141         if b == nil {
142                 buf = codec.NewBuffer(make([]byte, m.Size()))
143         } else {
144                 buf = codec.NewBuffer(b)
145         }
146         buf.EncodeUint32(uint32(m.ParentIfIndex))
147         buf.EncodeBytes(m.RemoteMac[:], 6)
148         return buf.Bytes(), nil
149 }
150 func (m *P2pEthernetDel) Unmarshal(b []byte) error {
151         buf := codec.NewBuffer(b)
152         m.ParentIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
153         copy(m.RemoteMac[:], buf.DecodeBytes(6))
154         return nil
155 }
156
157 // P2pEthernetDelReply defines message 'p2p_ethernet_del_reply'.
158 type P2pEthernetDelReply struct {
159         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
160 }
161
162 func (m *P2pEthernetDelReply) Reset()               { *m = P2pEthernetDelReply{} }
163 func (*P2pEthernetDelReply) GetMessageName() string { return "p2p_ethernet_del_reply" }
164 func (*P2pEthernetDelReply) GetCrcString() string   { return "e8d4e804" }
165 func (*P2pEthernetDelReply) GetMessageType() api.MessageType {
166         return api.ReplyMessage
167 }
168
169 func (m *P2pEthernetDelReply) Size() int {
170         if m == nil {
171                 return 0
172         }
173         var size int
174         size += 4 // m.Retval
175         return size
176 }
177 func (m *P2pEthernetDelReply) Marshal(b []byte) ([]byte, error) {
178         var buf *codec.Buffer
179         if b == nil {
180                 buf = codec.NewBuffer(make([]byte, m.Size()))
181         } else {
182                 buf = codec.NewBuffer(b)
183         }
184         buf.EncodeUint32(uint32(m.Retval))
185         return buf.Bytes(), nil
186 }
187 func (m *P2pEthernetDelReply) Unmarshal(b []byte) error {
188         buf := codec.NewBuffer(b)
189         m.Retval = int32(buf.DecodeUint32())
190         return nil
191 }
192
193 func init() { file_p2p_ethernet_binapi_init() }
194 func file_p2p_ethernet_binapi_init() {
195         api.RegisterMessage((*P2pEthernetAdd)(nil), "p2p_ethernet_add_eeb8e717")
196         api.RegisterMessage((*P2pEthernetAddReply)(nil), "p2p_ethernet_add_reply_5383d31f")
197         api.RegisterMessage((*P2pEthernetDel)(nil), "p2p_ethernet_del_0b62c386")
198         api.RegisterMessage((*P2pEthernetDelReply)(nil), "p2p_ethernet_del_reply_e8d4e804")
199 }
200
201 // Messages returns list of all messages in this module.
202 func AllMessages() []api.Message {
203         return []api.Message{
204                 (*P2pEthernetAdd)(nil),
205                 (*P2pEthernetAddReply)(nil),
206                 (*P2pEthernetDel)(nil),
207                 (*P2pEthernetDelReply)(nil),
208         }
209 }