Improve binapi generator
[govpp.git] / binapi / stn / stn.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/stn.api.json
6
7 // Package stn contains generated bindings for API file stn.api.
8 //
9 // Contents:
10 //   4 messages
11 //
12 package stn
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         interface_types "git.fd.io/govpp.git/binapi/interface_types"
17         ip_types "git.fd.io/govpp.git/binapi/ip_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    = "stn"
29         APIVersion = "2.0.0"
30         VersionCrc = 0x5a5079cd
31 )
32
33 // StnAddDelRule defines message 'stn_add_del_rule'.
34 type StnAddDelRule struct {
35         IPAddress ip_types.Address               `binapi:"address,name=ip_address" json:"ip_address,omitempty"`
36         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
37         IsAdd     bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
38 }
39
40 func (m *StnAddDelRule) Reset()               { *m = StnAddDelRule{} }
41 func (*StnAddDelRule) GetMessageName() string { return "stn_add_del_rule" }
42 func (*StnAddDelRule) GetCrcString() string   { return "53f751e6" }
43 func (*StnAddDelRule) GetMessageType() api.MessageType {
44         return api.RequestMessage
45 }
46
47 func (m *StnAddDelRule) Size() int {
48         if m == nil {
49                 return 0
50         }
51         var size int
52         size += 1      // m.IPAddress.Af
53         size += 1 * 16 // m.IPAddress.Un
54         size += 4      // m.SwIfIndex
55         size += 1      // m.IsAdd
56         return size
57 }
58 func (m *StnAddDelRule) Marshal(b []byte) ([]byte, error) {
59         var buf *codec.Buffer
60         if b == nil {
61                 buf = codec.NewBuffer(make([]byte, m.Size()))
62         } else {
63                 buf = codec.NewBuffer(b)
64         }
65         buf.EncodeUint8(uint8(m.IPAddress.Af))
66         buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
67         buf.EncodeUint32(uint32(m.SwIfIndex))
68         buf.EncodeBool(m.IsAdd)
69         return buf.Bytes(), nil
70 }
71 func (m *StnAddDelRule) Unmarshal(b []byte) error {
72         buf := codec.NewBuffer(b)
73         m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
74         copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
75         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
76         m.IsAdd = buf.DecodeBool()
77         return nil
78 }
79
80 // StnAddDelRuleReply defines message 'stn_add_del_rule_reply'.
81 type StnAddDelRuleReply struct {
82         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
83 }
84
85 func (m *StnAddDelRuleReply) Reset()               { *m = StnAddDelRuleReply{} }
86 func (*StnAddDelRuleReply) GetMessageName() string { return "stn_add_del_rule_reply" }
87 func (*StnAddDelRuleReply) GetCrcString() string   { return "e8d4e804" }
88 func (*StnAddDelRuleReply) GetMessageType() api.MessageType {
89         return api.ReplyMessage
90 }
91
92 func (m *StnAddDelRuleReply) Size() int {
93         if m == nil {
94                 return 0
95         }
96         var size int
97         size += 4 // m.Retval
98         return size
99 }
100 func (m *StnAddDelRuleReply) Marshal(b []byte) ([]byte, error) {
101         var buf *codec.Buffer
102         if b == nil {
103                 buf = codec.NewBuffer(make([]byte, m.Size()))
104         } else {
105                 buf = codec.NewBuffer(b)
106         }
107         buf.EncodeUint32(uint32(m.Retval))
108         return buf.Bytes(), nil
109 }
110 func (m *StnAddDelRuleReply) Unmarshal(b []byte) error {
111         buf := codec.NewBuffer(b)
112         m.Retval = int32(buf.DecodeUint32())
113         return nil
114 }
115
116 // StnRulesDetails defines message 'stn_rules_details'.
117 type StnRulesDetails struct {
118         IPAddress ip_types.Address               `binapi:"address,name=ip_address" json:"ip_address,omitempty"`
119         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
120 }
121
122 func (m *StnRulesDetails) Reset()               { *m = StnRulesDetails{} }
123 func (*StnRulesDetails) GetMessageName() string { return "stn_rules_details" }
124 func (*StnRulesDetails) GetCrcString() string   { return "b0f6606c" }
125 func (*StnRulesDetails) GetMessageType() api.MessageType {
126         return api.ReplyMessage
127 }
128
129 func (m *StnRulesDetails) Size() int {
130         if m == nil {
131                 return 0
132         }
133         var size int
134         size += 1      // m.IPAddress.Af
135         size += 1 * 16 // m.IPAddress.Un
136         size += 4      // m.SwIfIndex
137         return size
138 }
139 func (m *StnRulesDetails) 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.EncodeUint8(uint8(m.IPAddress.Af))
147         buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
148         buf.EncodeUint32(uint32(m.SwIfIndex))
149         return buf.Bytes(), nil
150 }
151 func (m *StnRulesDetails) Unmarshal(b []byte) error {
152         buf := codec.NewBuffer(b)
153         m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
154         copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
155         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
156         return nil
157 }
158
159 // StnRulesDump defines message 'stn_rules_dump'.
160 type StnRulesDump struct{}
161
162 func (m *StnRulesDump) Reset()               { *m = StnRulesDump{} }
163 func (*StnRulesDump) GetMessageName() string { return "stn_rules_dump" }
164 func (*StnRulesDump) GetCrcString() string   { return "51077d14" }
165 func (*StnRulesDump) GetMessageType() api.MessageType {
166         return api.RequestMessage
167 }
168
169 func (m *StnRulesDump) Size() int {
170         if m == nil {
171                 return 0
172         }
173         var size int
174         return size
175 }
176 func (m *StnRulesDump) Marshal(b []byte) ([]byte, error) {
177         var buf *codec.Buffer
178         if b == nil {
179                 buf = codec.NewBuffer(make([]byte, m.Size()))
180         } else {
181                 buf = codec.NewBuffer(b)
182         }
183         return buf.Bytes(), nil
184 }
185 func (m *StnRulesDump) Unmarshal(b []byte) error {
186         return nil
187 }
188
189 func init() { file_stn_binapi_init() }
190 func file_stn_binapi_init() {
191         api.RegisterMessage((*StnAddDelRule)(nil), "stn_add_del_rule_53f751e6")
192         api.RegisterMessage((*StnAddDelRuleReply)(nil), "stn_add_del_rule_reply_e8d4e804")
193         api.RegisterMessage((*StnRulesDetails)(nil), "stn_rules_details_b0f6606c")
194         api.RegisterMessage((*StnRulesDump)(nil), "stn_rules_dump_51077d14")
195 }
196
197 // Messages returns list of all messages in this module.
198 func AllMessages() []api.Message {
199         return []api.Message{
200                 (*StnAddDelRule)(nil),
201                 (*StnAddDelRuleReply)(nil),
202                 (*StnRulesDetails)(nil),
203                 (*StnRulesDump)(nil),
204         }
205 }