6cced54497301bc0a1c64c1d8b01abcdab6a36ad
[govpp.git] / binapi / span / span.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 span contains generated bindings for API file span.api.
7 //
8 // Contents:
9 //   1 enum
10 //   4 messages
11 //
12 package span
13
14 import (
15         "strconv"
16
17         api "git.fd.io/govpp.git/api"
18         interface_types "git.fd.io/govpp.git/binapi/interface_types"
19         codec "git.fd.io/govpp.git/codec"
20 )
21
22 // This is a compile-time assertion to ensure that this generated file
23 // is compatible with the GoVPP api package it is being compiled against.
24 // A compilation error at this line likely means your copy of the
25 // GoVPP api package needs to be updated.
26 const _ = api.GoVppAPIPackageIsVersion2
27
28 const (
29         APIFile    = "span"
30         APIVersion = "2.0.0"
31         VersionCrc = 0x9f4dec7c
32 )
33
34 // SpanState defines enum 'span_state'.
35 type SpanState uint32
36
37 const (
38         SPAN_STATE_API_DISABLED SpanState = 0
39         SPAN_STATE_API_RX       SpanState = 1
40         SPAN_STATE_API_TX       SpanState = 2
41         SPAN_STATE_API_RX_TX    SpanState = 3
42 )
43
44 var (
45         SpanState_name = map[uint32]string{
46                 0: "SPAN_STATE_API_DISABLED",
47                 1: "SPAN_STATE_API_RX",
48                 2: "SPAN_STATE_API_TX",
49                 3: "SPAN_STATE_API_RX_TX",
50         }
51         SpanState_value = map[string]uint32{
52                 "SPAN_STATE_API_DISABLED": 0,
53                 "SPAN_STATE_API_RX":       1,
54                 "SPAN_STATE_API_TX":       2,
55                 "SPAN_STATE_API_RX_TX":    3,
56         }
57 )
58
59 func (x SpanState) String() string {
60         s, ok := SpanState_name[uint32(x)]
61         if ok {
62                 return s
63         }
64         return "SpanState(" + strconv.Itoa(int(x)) + ")"
65 }
66
67 // SwInterfaceSpanDetails defines message 'sw_interface_span_details'.
68 type SwInterfaceSpanDetails struct {
69         SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"`
70         SwIfIndexTo   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"`
71         State         SpanState                      `binapi:"span_state,name=state" json:"state,omitempty"`
72         IsL2          bool                           `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
73 }
74
75 func (m *SwInterfaceSpanDetails) Reset()               { *m = SwInterfaceSpanDetails{} }
76 func (*SwInterfaceSpanDetails) GetMessageName() string { return "sw_interface_span_details" }
77 func (*SwInterfaceSpanDetails) GetCrcString() string   { return "055643fc" }
78 func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType {
79         return api.ReplyMessage
80 }
81
82 func (m *SwInterfaceSpanDetails) Size() (size int) {
83         if m == nil {
84                 return 0
85         }
86         size += 4 // m.SwIfIndexFrom
87         size += 4 // m.SwIfIndexTo
88         size += 4 // m.State
89         size += 1 // m.IsL2
90         return size
91 }
92 func (m *SwInterfaceSpanDetails) Marshal(b []byte) ([]byte, error) {
93         if b == nil {
94                 b = make([]byte, m.Size())
95         }
96         buf := codec.NewBuffer(b)
97         buf.EncodeUint32(uint32(m.SwIfIndexFrom))
98         buf.EncodeUint32(uint32(m.SwIfIndexTo))
99         buf.EncodeUint32(uint32(m.State))
100         buf.EncodeBool(m.IsL2)
101         return buf.Bytes(), nil
102 }
103 func (m *SwInterfaceSpanDetails) Unmarshal(b []byte) error {
104         buf := codec.NewBuffer(b)
105         m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32())
106         m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32())
107         m.State = SpanState(buf.DecodeUint32())
108         m.IsL2 = buf.DecodeBool()
109         return nil
110 }
111
112 // SwInterfaceSpanDump defines message 'sw_interface_span_dump'.
113 type SwInterfaceSpanDump struct {
114         IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
115 }
116
117 func (m *SwInterfaceSpanDump) Reset()               { *m = SwInterfaceSpanDump{} }
118 func (*SwInterfaceSpanDump) GetMessageName() string { return "sw_interface_span_dump" }
119 func (*SwInterfaceSpanDump) GetCrcString() string   { return "d6cf0c3d" }
120 func (*SwInterfaceSpanDump) GetMessageType() api.MessageType {
121         return api.RequestMessage
122 }
123
124 func (m *SwInterfaceSpanDump) Size() (size int) {
125         if m == nil {
126                 return 0
127         }
128         size += 1 // m.IsL2
129         return size
130 }
131 func (m *SwInterfaceSpanDump) Marshal(b []byte) ([]byte, error) {
132         if b == nil {
133                 b = make([]byte, m.Size())
134         }
135         buf := codec.NewBuffer(b)
136         buf.EncodeBool(m.IsL2)
137         return buf.Bytes(), nil
138 }
139 func (m *SwInterfaceSpanDump) Unmarshal(b []byte) error {
140         buf := codec.NewBuffer(b)
141         m.IsL2 = buf.DecodeBool()
142         return nil
143 }
144
145 // SwInterfaceSpanEnableDisable defines message 'sw_interface_span_enable_disable'.
146 type SwInterfaceSpanEnableDisable struct {
147         SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"`
148         SwIfIndexTo   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"`
149         State         SpanState                      `binapi:"span_state,name=state" json:"state,omitempty"`
150         IsL2          bool                           `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
151 }
152
153 func (m *SwInterfaceSpanEnableDisable) Reset() { *m = SwInterfaceSpanEnableDisable{} }
154 func (*SwInterfaceSpanEnableDisable) GetMessageName() string {
155         return "sw_interface_span_enable_disable"
156 }
157 func (*SwInterfaceSpanEnableDisable) GetCrcString() string { return "acc8fea1" }
158 func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType {
159         return api.RequestMessage
160 }
161
162 func (m *SwInterfaceSpanEnableDisable) Size() (size int) {
163         if m == nil {
164                 return 0
165         }
166         size += 4 // m.SwIfIndexFrom
167         size += 4 // m.SwIfIndexTo
168         size += 4 // m.State
169         size += 1 // m.IsL2
170         return size
171 }
172 func (m *SwInterfaceSpanEnableDisable) Marshal(b []byte) ([]byte, error) {
173         if b == nil {
174                 b = make([]byte, m.Size())
175         }
176         buf := codec.NewBuffer(b)
177         buf.EncodeUint32(uint32(m.SwIfIndexFrom))
178         buf.EncodeUint32(uint32(m.SwIfIndexTo))
179         buf.EncodeUint32(uint32(m.State))
180         buf.EncodeBool(m.IsL2)
181         return buf.Bytes(), nil
182 }
183 func (m *SwInterfaceSpanEnableDisable) Unmarshal(b []byte) error {
184         buf := codec.NewBuffer(b)
185         m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32())
186         m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32())
187         m.State = SpanState(buf.DecodeUint32())
188         m.IsL2 = buf.DecodeBool()
189         return nil
190 }
191
192 // SwInterfaceSpanEnableDisableReply defines message 'sw_interface_span_enable_disable_reply'.
193 type SwInterfaceSpanEnableDisableReply struct {
194         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
195 }
196
197 func (m *SwInterfaceSpanEnableDisableReply) Reset() { *m = SwInterfaceSpanEnableDisableReply{} }
198 func (*SwInterfaceSpanEnableDisableReply) GetMessageName() string {
199         return "sw_interface_span_enable_disable_reply"
200 }
201 func (*SwInterfaceSpanEnableDisableReply) GetCrcString() string { return "e8d4e804" }
202 func (*SwInterfaceSpanEnableDisableReply) GetMessageType() api.MessageType {
203         return api.ReplyMessage
204 }
205
206 func (m *SwInterfaceSpanEnableDisableReply) Size() (size int) {
207         if m == nil {
208                 return 0
209         }
210         size += 4 // m.Retval
211         return size
212 }
213 func (m *SwInterfaceSpanEnableDisableReply) Marshal(b []byte) ([]byte, error) {
214         if b == nil {
215                 b = make([]byte, m.Size())
216         }
217         buf := codec.NewBuffer(b)
218         buf.EncodeInt32(m.Retval)
219         return buf.Bytes(), nil
220 }
221 func (m *SwInterfaceSpanEnableDisableReply) Unmarshal(b []byte) error {
222         buf := codec.NewBuffer(b)
223         m.Retval = buf.DecodeInt32()
224         return nil
225 }
226
227 func init() { file_span_binapi_init() }
228 func file_span_binapi_init() {
229         api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "sw_interface_span_details_055643fc")
230         api.RegisterMessage((*SwInterfaceSpanDump)(nil), "sw_interface_span_dump_d6cf0c3d")
231         api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "sw_interface_span_enable_disable_acc8fea1")
232         api.RegisterMessage((*SwInterfaceSpanEnableDisableReply)(nil), "sw_interface_span_enable_disable_reply_e8d4e804")
233 }
234
235 // Messages returns list of all messages in this module.
236 func AllMessages() []api.Message {
237         return []api.Message{
238                 (*SwInterfaceSpanDetails)(nil),
239                 (*SwInterfaceSpanDump)(nil),
240                 (*SwInterfaceSpanEnableDisable)(nil),
241                 (*SwInterfaceSpanEnableDisableReply)(nil),
242         }
243 }