go.ligato.io/vpp-agent/v3@v3.5.0/plugins/vpp/binapi/vpp2106/memif/memif.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 3 // Package memif contains generated bindings for API file memif.api. 4 // 5 // Contents: 6 // - 2 enums 7 // - 10 messages 8 package memif 9 10 import ( 11 "strconv" 12 13 api "go.fd.io/govpp/api" 14 codec "go.fd.io/govpp/codec" 15 ethernet_types "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2106/ethernet_types" 16 interface_types "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2106/interface_types" 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 = "memif" 27 APIVersion = "3.0.0" 28 VersionCrc = 0xd189f1e1 29 ) 30 31 // MemifMode defines enum 'memif_mode'. 32 type MemifMode uint32 33 34 const ( 35 MEMIF_MODE_API_ETHERNET MemifMode = 0 36 MEMIF_MODE_API_IP MemifMode = 1 37 MEMIF_MODE_API_PUNT_INJECT MemifMode = 2 38 ) 39 40 var ( 41 MemifMode_name = map[uint32]string{ 42 0: "MEMIF_MODE_API_ETHERNET", 43 1: "MEMIF_MODE_API_IP", 44 2: "MEMIF_MODE_API_PUNT_INJECT", 45 } 46 MemifMode_value = map[string]uint32{ 47 "MEMIF_MODE_API_ETHERNET": 0, 48 "MEMIF_MODE_API_IP": 1, 49 "MEMIF_MODE_API_PUNT_INJECT": 2, 50 } 51 ) 52 53 func (x MemifMode) String() string { 54 s, ok := MemifMode_name[uint32(x)] 55 if ok { 56 return s 57 } 58 return "MemifMode(" + strconv.Itoa(int(x)) + ")" 59 } 60 61 // MemifRole defines enum 'memif_role'. 62 type MemifRole uint32 63 64 const ( 65 MEMIF_ROLE_API_MASTER MemifRole = 0 66 MEMIF_ROLE_API_SLAVE MemifRole = 1 67 ) 68 69 var ( 70 MemifRole_name = map[uint32]string{ 71 0: "MEMIF_ROLE_API_MASTER", 72 1: "MEMIF_ROLE_API_SLAVE", 73 } 74 MemifRole_value = map[string]uint32{ 75 "MEMIF_ROLE_API_MASTER": 0, 76 "MEMIF_ROLE_API_SLAVE": 1, 77 } 78 ) 79 80 func (x MemifRole) String() string { 81 s, ok := MemifRole_name[uint32(x)] 82 if ok { 83 return s 84 } 85 return "MemifRole(" + strconv.Itoa(int(x)) + ")" 86 } 87 88 // MemifCreate defines message 'memif_create'. 89 type MemifCreate struct { 90 Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` 91 Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` 92 RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"` 93 TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"` 94 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 95 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` 96 RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` 97 BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` 98 NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"` 99 HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` 100 Secret string `binapi:"string[24],name=secret" json:"secret,omitempty"` 101 } 102 103 func (m *MemifCreate) Reset() { *m = MemifCreate{} } 104 func (*MemifCreate) GetMessageName() string { return "memif_create" } 105 func (*MemifCreate) GetCrcString() string { return "b1b25061" } 106 func (*MemifCreate) GetMessageType() api.MessageType { 107 return api.RequestMessage 108 } 109 110 func (m *MemifCreate) Size() (size int) { 111 if m == nil { 112 return 0 113 } 114 size += 4 // m.Role 115 size += 4 // m.Mode 116 size += 1 // m.RxQueues 117 size += 1 // m.TxQueues 118 size += 4 // m.ID 119 size += 4 // m.SocketID 120 size += 4 // m.RingSize 121 size += 2 // m.BufferSize 122 size += 1 // m.NoZeroCopy 123 size += 1 * 6 // m.HwAddr 124 size += 24 // m.Secret 125 return size 126 } 127 func (m *MemifCreate) Marshal(b []byte) ([]byte, error) { 128 if b == nil { 129 b = make([]byte, m.Size()) 130 } 131 buf := codec.NewBuffer(b) 132 buf.EncodeUint32(uint32(m.Role)) 133 buf.EncodeUint32(uint32(m.Mode)) 134 buf.EncodeUint8(m.RxQueues) 135 buf.EncodeUint8(m.TxQueues) 136 buf.EncodeUint32(m.ID) 137 buf.EncodeUint32(m.SocketID) 138 buf.EncodeUint32(m.RingSize) 139 buf.EncodeUint16(m.BufferSize) 140 buf.EncodeBool(m.NoZeroCopy) 141 buf.EncodeBytes(m.HwAddr[:], 6) 142 buf.EncodeString(m.Secret, 24) 143 return buf.Bytes(), nil 144 } 145 func (m *MemifCreate) Unmarshal(b []byte) error { 146 buf := codec.NewBuffer(b) 147 m.Role = MemifRole(buf.DecodeUint32()) 148 m.Mode = MemifMode(buf.DecodeUint32()) 149 m.RxQueues = buf.DecodeUint8() 150 m.TxQueues = buf.DecodeUint8() 151 m.ID = buf.DecodeUint32() 152 m.SocketID = buf.DecodeUint32() 153 m.RingSize = buf.DecodeUint32() 154 m.BufferSize = buf.DecodeUint16() 155 m.NoZeroCopy = buf.DecodeBool() 156 copy(m.HwAddr[:], buf.DecodeBytes(6)) 157 m.Secret = buf.DecodeString(24) 158 return nil 159 } 160 161 // MemifCreateReply defines message 'memif_create_reply'. 162 type MemifCreateReply struct { 163 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 164 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 165 } 166 167 func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } 168 func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" } 169 func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } 170 func (*MemifCreateReply) GetMessageType() api.MessageType { 171 return api.ReplyMessage 172 } 173 174 func (m *MemifCreateReply) Size() (size int) { 175 if m == nil { 176 return 0 177 } 178 size += 4 // m.Retval 179 size += 4 // m.SwIfIndex 180 return size 181 } 182 func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) { 183 if b == nil { 184 b = make([]byte, m.Size()) 185 } 186 buf := codec.NewBuffer(b) 187 buf.EncodeInt32(m.Retval) 188 buf.EncodeUint32(uint32(m.SwIfIndex)) 189 return buf.Bytes(), nil 190 } 191 func (m *MemifCreateReply) Unmarshal(b []byte) error { 192 buf := codec.NewBuffer(b) 193 m.Retval = buf.DecodeInt32() 194 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 195 return nil 196 } 197 198 // MemifDelete defines message 'memif_delete'. 199 type MemifDelete struct { 200 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 201 } 202 203 func (m *MemifDelete) Reset() { *m = MemifDelete{} } 204 func (*MemifDelete) GetMessageName() string { return "memif_delete" } 205 func (*MemifDelete) GetCrcString() string { return "f9e6675e" } 206 func (*MemifDelete) GetMessageType() api.MessageType { 207 return api.RequestMessage 208 } 209 210 func (m *MemifDelete) Size() (size int) { 211 if m == nil { 212 return 0 213 } 214 size += 4 // m.SwIfIndex 215 return size 216 } 217 func (m *MemifDelete) Marshal(b []byte) ([]byte, error) { 218 if b == nil { 219 b = make([]byte, m.Size()) 220 } 221 buf := codec.NewBuffer(b) 222 buf.EncodeUint32(uint32(m.SwIfIndex)) 223 return buf.Bytes(), nil 224 } 225 func (m *MemifDelete) Unmarshal(b []byte) error { 226 buf := codec.NewBuffer(b) 227 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 228 return nil 229 } 230 231 // MemifDeleteReply defines message 'memif_delete_reply'. 232 type MemifDeleteReply struct { 233 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 234 } 235 236 func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } 237 func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" } 238 func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } 239 func (*MemifDeleteReply) GetMessageType() api.MessageType { 240 return api.ReplyMessage 241 } 242 243 func (m *MemifDeleteReply) Size() (size int) { 244 if m == nil { 245 return 0 246 } 247 size += 4 // m.Retval 248 return size 249 } 250 func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) { 251 if b == nil { 252 b = make([]byte, m.Size()) 253 } 254 buf := codec.NewBuffer(b) 255 buf.EncodeInt32(m.Retval) 256 return buf.Bytes(), nil 257 } 258 func (m *MemifDeleteReply) Unmarshal(b []byte) error { 259 buf := codec.NewBuffer(b) 260 m.Retval = buf.DecodeInt32() 261 return nil 262 } 263 264 // MemifDetails defines message 'memif_details'. 265 type MemifDetails struct { 266 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 267 HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` 268 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 269 Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` 270 Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` 271 ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` 272 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` 273 RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` 274 BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` 275 Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` 276 IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty"` 277 } 278 279 func (m *MemifDetails) Reset() { *m = MemifDetails{} } 280 func (*MemifDetails) GetMessageName() string { return "memif_details" } 281 func (*MemifDetails) GetCrcString() string { return "da34feb9" } 282 func (*MemifDetails) GetMessageType() api.MessageType { 283 return api.ReplyMessage 284 } 285 286 func (m *MemifDetails) Size() (size int) { 287 if m == nil { 288 return 0 289 } 290 size += 4 // m.SwIfIndex 291 size += 1 * 6 // m.HwAddr 292 size += 4 // m.ID 293 size += 4 // m.Role 294 size += 4 // m.Mode 295 size += 1 // m.ZeroCopy 296 size += 4 // m.SocketID 297 size += 4 // m.RingSize 298 size += 2 // m.BufferSize 299 size += 4 // m.Flags 300 size += 64 // m.IfName 301 return size 302 } 303 func (m *MemifDetails) Marshal(b []byte) ([]byte, error) { 304 if b == nil { 305 b = make([]byte, m.Size()) 306 } 307 buf := codec.NewBuffer(b) 308 buf.EncodeUint32(uint32(m.SwIfIndex)) 309 buf.EncodeBytes(m.HwAddr[:], 6) 310 buf.EncodeUint32(m.ID) 311 buf.EncodeUint32(uint32(m.Role)) 312 buf.EncodeUint32(uint32(m.Mode)) 313 buf.EncodeBool(m.ZeroCopy) 314 buf.EncodeUint32(m.SocketID) 315 buf.EncodeUint32(m.RingSize) 316 buf.EncodeUint16(m.BufferSize) 317 buf.EncodeUint32(uint32(m.Flags)) 318 buf.EncodeString(m.IfName, 64) 319 return buf.Bytes(), nil 320 } 321 func (m *MemifDetails) Unmarshal(b []byte) error { 322 buf := codec.NewBuffer(b) 323 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 324 copy(m.HwAddr[:], buf.DecodeBytes(6)) 325 m.ID = buf.DecodeUint32() 326 m.Role = MemifRole(buf.DecodeUint32()) 327 m.Mode = MemifMode(buf.DecodeUint32()) 328 m.ZeroCopy = buf.DecodeBool() 329 m.SocketID = buf.DecodeUint32() 330 m.RingSize = buf.DecodeUint32() 331 m.BufferSize = buf.DecodeUint16() 332 m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32()) 333 m.IfName = buf.DecodeString(64) 334 return nil 335 } 336 337 // MemifDump defines message 'memif_dump'. 338 type MemifDump struct{} 339 340 func (m *MemifDump) Reset() { *m = MemifDump{} } 341 func (*MemifDump) GetMessageName() string { return "memif_dump" } 342 func (*MemifDump) GetCrcString() string { return "51077d14" } 343 func (*MemifDump) GetMessageType() api.MessageType { 344 return api.RequestMessage 345 } 346 347 func (m *MemifDump) Size() (size int) { 348 if m == nil { 349 return 0 350 } 351 return size 352 } 353 func (m *MemifDump) Marshal(b []byte) ([]byte, error) { 354 if b == nil { 355 b = make([]byte, m.Size()) 356 } 357 buf := codec.NewBuffer(b) 358 return buf.Bytes(), nil 359 } 360 func (m *MemifDump) Unmarshal(b []byte) error { 361 return nil 362 } 363 364 // MemifSocketFilenameAddDel defines message 'memif_socket_filename_add_del'. 365 type MemifSocketFilenameAddDel struct { 366 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 367 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` 368 SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"` 369 } 370 371 func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } 372 func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" } 373 func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } 374 func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { 375 return api.RequestMessage 376 } 377 378 func (m *MemifSocketFilenameAddDel) Size() (size int) { 379 if m == nil { 380 return 0 381 } 382 size += 1 // m.IsAdd 383 size += 4 // m.SocketID 384 size += 108 // m.SocketFilename 385 return size 386 } 387 func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) { 388 if b == nil { 389 b = make([]byte, m.Size()) 390 } 391 buf := codec.NewBuffer(b) 392 buf.EncodeBool(m.IsAdd) 393 buf.EncodeUint32(m.SocketID) 394 buf.EncodeString(m.SocketFilename, 108) 395 return buf.Bytes(), nil 396 } 397 func (m *MemifSocketFilenameAddDel) Unmarshal(b []byte) error { 398 buf := codec.NewBuffer(b) 399 m.IsAdd = buf.DecodeBool() 400 m.SocketID = buf.DecodeUint32() 401 m.SocketFilename = buf.DecodeString(108) 402 return nil 403 } 404 405 // MemifSocketFilenameAddDelReply defines message 'memif_socket_filename_add_del_reply'. 406 type MemifSocketFilenameAddDelReply struct { 407 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 408 } 409 410 func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} } 411 func (*MemifSocketFilenameAddDelReply) GetMessageName() string { 412 return "memif_socket_filename_add_del_reply" 413 } 414 func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } 415 func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { 416 return api.ReplyMessage 417 } 418 419 func (m *MemifSocketFilenameAddDelReply) Size() (size int) { 420 if m == nil { 421 return 0 422 } 423 size += 4 // m.Retval 424 return size 425 } 426 func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) { 427 if b == nil { 428 b = make([]byte, m.Size()) 429 } 430 buf := codec.NewBuffer(b) 431 buf.EncodeInt32(m.Retval) 432 return buf.Bytes(), nil 433 } 434 func (m *MemifSocketFilenameAddDelReply) Unmarshal(b []byte) error { 435 buf := codec.NewBuffer(b) 436 m.Retval = buf.DecodeInt32() 437 return nil 438 } 439 440 // MemifSocketFilenameDetails defines message 'memif_socket_filename_details'. 441 type MemifSocketFilenameDetails struct { 442 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` 443 SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"` 444 } 445 446 func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } 447 func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" } 448 func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } 449 func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { 450 return api.ReplyMessage 451 } 452 453 func (m *MemifSocketFilenameDetails) Size() (size int) { 454 if m == nil { 455 return 0 456 } 457 size += 4 // m.SocketID 458 size += 108 // m.SocketFilename 459 return size 460 } 461 func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) { 462 if b == nil { 463 b = make([]byte, m.Size()) 464 } 465 buf := codec.NewBuffer(b) 466 buf.EncodeUint32(m.SocketID) 467 buf.EncodeString(m.SocketFilename, 108) 468 return buf.Bytes(), nil 469 } 470 func (m *MemifSocketFilenameDetails) Unmarshal(b []byte) error { 471 buf := codec.NewBuffer(b) 472 m.SocketID = buf.DecodeUint32() 473 m.SocketFilename = buf.DecodeString(108) 474 return nil 475 } 476 477 // MemifSocketFilenameDump defines message 'memif_socket_filename_dump'. 478 type MemifSocketFilenameDump struct{} 479 480 func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} } 481 func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" } 482 func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } 483 func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { 484 return api.RequestMessage 485 } 486 487 func (m *MemifSocketFilenameDump) Size() (size int) { 488 if m == nil { 489 return 0 490 } 491 return size 492 } 493 func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) { 494 if b == nil { 495 b = make([]byte, m.Size()) 496 } 497 buf := codec.NewBuffer(b) 498 return buf.Bytes(), nil 499 } 500 func (m *MemifSocketFilenameDump) Unmarshal(b []byte) error { 501 return nil 502 } 503 504 func init() { file_memif_binapi_init() } 505 func file_memif_binapi_init() { 506 api.RegisterMessage((*MemifCreate)(nil), "memif_create_b1b25061") 507 api.RegisterMessage((*MemifCreateReply)(nil), "memif_create_reply_5383d31f") 508 api.RegisterMessage((*MemifDelete)(nil), "memif_delete_f9e6675e") 509 api.RegisterMessage((*MemifDeleteReply)(nil), "memif_delete_reply_e8d4e804") 510 api.RegisterMessage((*MemifDetails)(nil), "memif_details_da34feb9") 511 api.RegisterMessage((*MemifDump)(nil), "memif_dump_51077d14") 512 api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif_socket_filename_add_del_a2ce1a10") 513 api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif_socket_filename_add_del_reply_e8d4e804") 514 api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif_socket_filename_details_7ff326f7") 515 api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif_socket_filename_dump_51077d14") 516 } 517 518 // Messages returns list of all messages in this module. 519 func AllMessages() []api.Message { 520 return []api.Message{ 521 (*MemifCreate)(nil), 522 (*MemifCreateReply)(nil), 523 (*MemifDelete)(nil), 524 (*MemifDeleteReply)(nil), 525 (*MemifDetails)(nil), 526 (*MemifDump)(nil), 527 (*MemifSocketFilenameAddDel)(nil), 528 (*MemifSocketFilenameAddDelReply)(nil), 529 (*MemifSocketFilenameDetails)(nil), 530 (*MemifSocketFilenameDump)(nil), 531 } 532 }