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