af76fdbc51ac39fecdd5ae60c8888073a101a30e
[govpp.git] / binapi / mss_clamp / mss_clamp.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.5.0-dev
4 //  VPP:              22.02-release
5 // source: /usr/share/vpp/api/plugins/mss_clamp.api.json
6
7 // Package mss_clamp contains generated bindings for API file mss_clamp.api.
8 //
9 // Contents:
10 //   1 enum
11 //   5 messages
12 //
13 package mss_clamp
14
15 import (
16         "strconv"
17
18         api "git.fd.io/govpp.git/api"
19         interface_types "git.fd.io/govpp.git/binapi/interface_types"
20         codec "git.fd.io/govpp.git/codec"
21 )
22
23 // This is a compile-time assertion to ensure that this generated file
24 // is compatible with the GoVPP api package it is being compiled against.
25 // A compilation error at this line likely means your copy of the
26 // GoVPP api package needs to be updated.
27 const _ = api.GoVppAPIPackageIsVersion2
28
29 const (
30         APIFile    = "mss_clamp"
31         APIVersion = "1.0.0"
32         VersionCrc = 0xea8186c0
33 )
34
35 // MssClampDir defines enum 'mss_clamp_dir'.
36 type MssClampDir uint8
37
38 const (
39         MSS_CLAMP_DIR_NONE MssClampDir = 0
40         MSS_CLAMP_DIR_RX   MssClampDir = 1
41         MSS_CLAMP_DIR_TX   MssClampDir = 2
42 )
43
44 var (
45         MssClampDir_name = map[uint8]string{
46                 0: "MSS_CLAMP_DIR_NONE",
47                 1: "MSS_CLAMP_DIR_RX",
48                 2: "MSS_CLAMP_DIR_TX",
49         }
50         MssClampDir_value = map[string]uint8{
51                 "MSS_CLAMP_DIR_NONE": 0,
52                 "MSS_CLAMP_DIR_RX":   1,
53                 "MSS_CLAMP_DIR_TX":   2,
54         }
55 )
56
57 func (x MssClampDir) String() string {
58         s, ok := MssClampDir_name[uint8(x)]
59         if ok {
60                 return s
61         }
62         str := func(n uint8) string {
63                 s, ok := MssClampDir_name[uint8(n)]
64                 if ok {
65                         return s
66                 }
67                 return "MssClampDir(" + strconv.Itoa(int(n)) + ")"
68         }
69         for i := uint8(0); i <= 8; i++ {
70                 val := uint8(x)
71                 if val&(1<<i) != 0 {
72                         if s != "" {
73                                 s += "|"
74                         }
75                         s += str(1 << i)
76                 }
77         }
78         if s == "" {
79                 return str(uint8(x))
80         }
81         return s
82 }
83
84 // MssClampDetails defines message 'mss_clamp_details'.
85 type MssClampDetails struct {
86         SwIfIndex     interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
87         IPv4Mss       uint16                         `binapi:"u16,name=ipv4_mss" json:"ipv4_mss,omitempty"`
88         IPv6Mss       uint16                         `binapi:"u16,name=ipv6_mss" json:"ipv6_mss,omitempty"`
89         IPv4Direction MssClampDir                    `binapi:"mss_clamp_dir,name=ipv4_direction" json:"ipv4_direction,omitempty"`
90         IPv6Direction MssClampDir                    `binapi:"mss_clamp_dir,name=ipv6_direction" json:"ipv6_direction,omitempty"`
91 }
92
93 func (m *MssClampDetails) Reset()               { *m = MssClampDetails{} }
94 func (*MssClampDetails) GetMessageName() string { return "mss_clamp_details" }
95 func (*MssClampDetails) GetCrcString() string   { return "d3a4de61" }
96 func (*MssClampDetails) GetMessageType() api.MessageType {
97         return api.ReplyMessage
98 }
99
100 func (m *MssClampDetails) Size() (size int) {
101         if m == nil {
102                 return 0
103         }
104         size += 4 // m.SwIfIndex
105         size += 2 // m.IPv4Mss
106         size += 2 // m.IPv6Mss
107         size += 1 // m.IPv4Direction
108         size += 1 // m.IPv6Direction
109         return size
110 }
111 func (m *MssClampDetails) Marshal(b []byte) ([]byte, error) {
112         if b == nil {
113                 b = make([]byte, m.Size())
114         }
115         buf := codec.NewBuffer(b)
116         buf.EncodeUint32(uint32(m.SwIfIndex))
117         buf.EncodeUint16(m.IPv4Mss)
118         buf.EncodeUint16(m.IPv6Mss)
119         buf.EncodeUint8(uint8(m.IPv4Direction))
120         buf.EncodeUint8(uint8(m.IPv6Direction))
121         return buf.Bytes(), nil
122 }
123 func (m *MssClampDetails) Unmarshal(b []byte) error {
124         buf := codec.NewBuffer(b)
125         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
126         m.IPv4Mss = buf.DecodeUint16()
127         m.IPv6Mss = buf.DecodeUint16()
128         m.IPv4Direction = MssClampDir(buf.DecodeUint8())
129         m.IPv6Direction = MssClampDir(buf.DecodeUint8())
130         return nil
131 }
132
133 // MssClampEnableDisable defines message 'mss_clamp_enable_disable'.
134 type MssClampEnableDisable struct {
135         SwIfIndex     interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
136         IPv4Mss       uint16                         `binapi:"u16,name=ipv4_mss" json:"ipv4_mss,omitempty"`
137         IPv6Mss       uint16                         `binapi:"u16,name=ipv6_mss" json:"ipv6_mss,omitempty"`
138         IPv4Direction MssClampDir                    `binapi:"mss_clamp_dir,name=ipv4_direction" json:"ipv4_direction,omitempty"`
139         IPv6Direction MssClampDir                    `binapi:"mss_clamp_dir,name=ipv6_direction" json:"ipv6_direction,omitempty"`
140 }
141
142 func (m *MssClampEnableDisable) Reset()               { *m = MssClampEnableDisable{} }
143 func (*MssClampEnableDisable) GetMessageName() string { return "mss_clamp_enable_disable" }
144 func (*MssClampEnableDisable) GetCrcString() string   { return "d31b44e3" }
145 func (*MssClampEnableDisable) GetMessageType() api.MessageType {
146         return api.RequestMessage
147 }
148
149 func (m *MssClampEnableDisable) Size() (size int) {
150         if m == nil {
151                 return 0
152         }
153         size += 4 // m.SwIfIndex
154         size += 2 // m.IPv4Mss
155         size += 2 // m.IPv6Mss
156         size += 1 // m.IPv4Direction
157         size += 1 // m.IPv6Direction
158         return size
159 }
160 func (m *MssClampEnableDisable) Marshal(b []byte) ([]byte, error) {
161         if b == nil {
162                 b = make([]byte, m.Size())
163         }
164         buf := codec.NewBuffer(b)
165         buf.EncodeUint32(uint32(m.SwIfIndex))
166         buf.EncodeUint16(m.IPv4Mss)
167         buf.EncodeUint16(m.IPv6Mss)
168         buf.EncodeUint8(uint8(m.IPv4Direction))
169         buf.EncodeUint8(uint8(m.IPv6Direction))
170         return buf.Bytes(), nil
171 }
172 func (m *MssClampEnableDisable) Unmarshal(b []byte) error {
173         buf := codec.NewBuffer(b)
174         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
175         m.IPv4Mss = buf.DecodeUint16()
176         m.IPv6Mss = buf.DecodeUint16()
177         m.IPv4Direction = MssClampDir(buf.DecodeUint8())
178         m.IPv6Direction = MssClampDir(buf.DecodeUint8())
179         return nil
180 }
181
182 // MssClampEnableDisableReply defines message 'mss_clamp_enable_disable_reply'.
183 type MssClampEnableDisableReply struct {
184         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
185 }
186
187 func (m *MssClampEnableDisableReply) Reset()               { *m = MssClampEnableDisableReply{} }
188 func (*MssClampEnableDisableReply) GetMessageName() string { return "mss_clamp_enable_disable_reply" }
189 func (*MssClampEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
190 func (*MssClampEnableDisableReply) GetMessageType() api.MessageType {
191         return api.ReplyMessage
192 }
193
194 func (m *MssClampEnableDisableReply) Size() (size int) {
195         if m == nil {
196                 return 0
197         }
198         size += 4 // m.Retval
199         return size
200 }
201 func (m *MssClampEnableDisableReply) Marshal(b []byte) ([]byte, error) {
202         if b == nil {
203                 b = make([]byte, m.Size())
204         }
205         buf := codec.NewBuffer(b)
206         buf.EncodeInt32(m.Retval)
207         return buf.Bytes(), nil
208 }
209 func (m *MssClampEnableDisableReply) Unmarshal(b []byte) error {
210         buf := codec.NewBuffer(b)
211         m.Retval = buf.DecodeInt32()
212         return nil
213 }
214
215 // MssClampGet defines message 'mss_clamp_get'.
216 type MssClampGet struct {
217         Cursor    uint32                         `binapi:"u32,name=cursor" json:"cursor,omitempty"`
218         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
219 }
220
221 func (m *MssClampGet) Reset()               { *m = MssClampGet{} }
222 func (*MssClampGet) GetMessageName() string { return "mss_clamp_get" }
223 func (*MssClampGet) GetCrcString() string   { return "47250981" }
224 func (*MssClampGet) GetMessageType() api.MessageType {
225         return api.RequestMessage
226 }
227
228 func (m *MssClampGet) Size() (size int) {
229         if m == nil {
230                 return 0
231         }
232         size += 4 // m.Cursor
233         size += 4 // m.SwIfIndex
234         return size
235 }
236 func (m *MssClampGet) Marshal(b []byte) ([]byte, error) {
237         if b == nil {
238                 b = make([]byte, m.Size())
239         }
240         buf := codec.NewBuffer(b)
241         buf.EncodeUint32(m.Cursor)
242         buf.EncodeUint32(uint32(m.SwIfIndex))
243         return buf.Bytes(), nil
244 }
245 func (m *MssClampGet) Unmarshal(b []byte) error {
246         buf := codec.NewBuffer(b)
247         m.Cursor = buf.DecodeUint32()
248         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
249         return nil
250 }
251
252 // MssClampGetReply defines message 'mss_clamp_get_reply'.
253 type MssClampGetReply struct {
254         Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
255         Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"`
256 }
257
258 func (m *MssClampGetReply) Reset()               { *m = MssClampGetReply{} }
259 func (*MssClampGetReply) GetMessageName() string { return "mss_clamp_get_reply" }
260 func (*MssClampGetReply) GetCrcString() string   { return "53b48f5d" }
261 func (*MssClampGetReply) GetMessageType() api.MessageType {
262         return api.ReplyMessage
263 }
264
265 func (m *MssClampGetReply) Size() (size int) {
266         if m == nil {
267                 return 0
268         }
269         size += 4 // m.Retval
270         size += 4 // m.Cursor
271         return size
272 }
273 func (m *MssClampGetReply) Marshal(b []byte) ([]byte, error) {
274         if b == nil {
275                 b = make([]byte, m.Size())
276         }
277         buf := codec.NewBuffer(b)
278         buf.EncodeInt32(m.Retval)
279         buf.EncodeUint32(m.Cursor)
280         return buf.Bytes(), nil
281 }
282 func (m *MssClampGetReply) Unmarshal(b []byte) error {
283         buf := codec.NewBuffer(b)
284         m.Retval = buf.DecodeInt32()
285         m.Cursor = buf.DecodeUint32()
286         return nil
287 }
288
289 func init() { file_mss_clamp_binapi_init() }
290 func file_mss_clamp_binapi_init() {
291         api.RegisterMessage((*MssClampDetails)(nil), "mss_clamp_details_d3a4de61")
292         api.RegisterMessage((*MssClampEnableDisable)(nil), "mss_clamp_enable_disable_d31b44e3")
293         api.RegisterMessage((*MssClampEnableDisableReply)(nil), "mss_clamp_enable_disable_reply_e8d4e804")
294         api.RegisterMessage((*MssClampGet)(nil), "mss_clamp_get_47250981")
295         api.RegisterMessage((*MssClampGetReply)(nil), "mss_clamp_get_reply_53b48f5d")
296 }
297
298 // Messages returns list of all messages in this module.
299 func AllMessages() []api.Message {
300         return []api.Message{
301                 (*MssClampDetails)(nil),
302                 (*MssClampEnableDisable)(nil),
303                 (*MssClampEnableDisableReply)(nil),
304                 (*MssClampGet)(nil),
305                 (*MssClampGetReply)(nil),
306         }
307 }