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