binapigen: fix union size
[govpp.git] / binapi / l2e / l2e.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/l2e.api.json
6
7 // Package l2e contains generated bindings for API file l2e.api.
8 //
9 // Contents:
10 //   2 messages
11 //
12 package l2e
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         interface_types "git.fd.io/govpp.git/binapi/interface_types"
17         codec "git.fd.io/govpp.git/codec"
18 )
19
20 // This is a compile-time assertion to ensure that this generated file
21 // is compatible with the GoVPP api package it is being compiled against.
22 // A compilation error at this line likely means your copy of the
23 // GoVPP api package needs to be updated.
24 const _ = api.GoVppAPIPackageIsVersion2
25
26 const (
27         APIFile    = "l2e"
28         APIVersion = "1.0.0"
29         VersionCrc = 0x7c918b8
30 )
31
32 // L2Emulation defines message 'l2_emulation'.
33 type L2Emulation struct {
34         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
35         Enable    bool                           `binapi:"bool,name=enable" json:"enable,omitempty"`
36 }
37
38 func (m *L2Emulation) Reset()               { *m = L2Emulation{} }
39 func (*L2Emulation) GetMessageName() string { return "l2_emulation" }
40 func (*L2Emulation) GetCrcString() string   { return "ae6cfcfb" }
41 func (*L2Emulation) GetMessageType() api.MessageType {
42         return api.RequestMessage
43 }
44
45 func (m *L2Emulation) Size() (size int) {
46         if m == nil {
47                 return 0
48         }
49         size += 4 // m.SwIfIndex
50         size += 1 // m.Enable
51         return size
52 }
53 func (m *L2Emulation) Marshal(b []byte) ([]byte, error) {
54         if b == nil {
55                 b = make([]byte, m.Size())
56         }
57         buf := codec.NewBuffer(b)
58         buf.EncodeUint32(uint32(m.SwIfIndex))
59         buf.EncodeBool(m.Enable)
60         return buf.Bytes(), nil
61 }
62 func (m *L2Emulation) Unmarshal(b []byte) error {
63         buf := codec.NewBuffer(b)
64         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
65         m.Enable = buf.DecodeBool()
66         return nil
67 }
68
69 // L2EmulationReply defines message 'l2_emulation_reply'.
70 type L2EmulationReply struct {
71         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
72 }
73
74 func (m *L2EmulationReply) Reset()               { *m = L2EmulationReply{} }
75 func (*L2EmulationReply) GetMessageName() string { return "l2_emulation_reply" }
76 func (*L2EmulationReply) GetCrcString() string   { return "e8d4e804" }
77 func (*L2EmulationReply) GetMessageType() api.MessageType {
78         return api.ReplyMessage
79 }
80
81 func (m *L2EmulationReply) Size() (size int) {
82         if m == nil {
83                 return 0
84         }
85         size += 4 // m.Retval
86         return size
87 }
88 func (m *L2EmulationReply) Marshal(b []byte) ([]byte, error) {
89         if b == nil {
90                 b = make([]byte, m.Size())
91         }
92         buf := codec.NewBuffer(b)
93         buf.EncodeInt32(m.Retval)
94         return buf.Bytes(), nil
95 }
96 func (m *L2EmulationReply) Unmarshal(b []byte) error {
97         buf := codec.NewBuffer(b)
98         m.Retval = buf.DecodeInt32()
99         return nil
100 }
101
102 func init() { file_l2e_binapi_init() }
103 func file_l2e_binapi_init() {
104         api.RegisterMessage((*L2Emulation)(nil), "l2_emulation_ae6cfcfb")
105         api.RegisterMessage((*L2EmulationReply)(nil), "l2_emulation_reply_e8d4e804")
106 }
107
108 // Messages returns list of all messages in this module.
109 func AllMessages() []api.Message {
110         return []api.Message{
111                 (*L2Emulation)(nil),
112                 (*L2EmulationReply)(nil),
113         }
114 }