github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/pg/pg.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 // versions: 3 // binapi-generator: v0.4.0-dev 4 // VPP: 23.02-rc0~189-g57127b32a 5 // source: /usr/share/vpp/api/core/pg.api.json 6 7 // Package pg contains generated bindings for API file pg.api. 8 // 9 // Contents: 10 // 1 enum 11 // 10 messages 12 // 13 package pg 14 15 import ( 16 "strconv" 17 18 api "git.fd.io/govpp.git/api" 19 codec "git.fd.io/govpp.git/codec" 20 interface_types "github.com/edwarnicke/govpp/binapi/interface_types" 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 = "pg" 31 APIVersion = "2.0.0" 32 VersionCrc = 0x32a1ad3b 33 ) 34 35 // PgInterfaceMode defines enum 'pg_interface_mode'. 36 type PgInterfaceMode uint8 37 38 const ( 39 PG_API_MODE_ETHERNET PgInterfaceMode = 0 40 PG_API_MODE_IP4 PgInterfaceMode = 1 41 PG_API_MODE_IP6 PgInterfaceMode = 2 42 ) 43 44 var ( 45 PgInterfaceMode_name = map[uint8]string{ 46 0: "PG_API_MODE_ETHERNET", 47 1: "PG_API_MODE_IP4", 48 2: "PG_API_MODE_IP6", 49 } 50 PgInterfaceMode_value = map[string]uint8{ 51 "PG_API_MODE_ETHERNET": 0, 52 "PG_API_MODE_IP4": 1, 53 "PG_API_MODE_IP6": 2, 54 } 55 ) 56 57 func (x PgInterfaceMode) String() string { 58 s, ok := PgInterfaceMode_name[uint8(x)] 59 if ok { 60 return s 61 } 62 return "PgInterfaceMode(" + strconv.Itoa(int(x)) + ")" 63 } 64 65 // PgCapture defines message 'pg_capture'. 66 type PgCapture struct { 67 InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"` 68 IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` 69 Count uint32 `binapi:"u32,name=count" json:"count,omitempty"` 70 PcapFileName string `binapi:"string[],name=pcap_file_name" json:"pcap_file_name,omitempty"` 71 } 72 73 func (m *PgCapture) Reset() { *m = PgCapture{} } 74 func (*PgCapture) GetMessageName() string { return "pg_capture" } 75 func (*PgCapture) GetCrcString() string { return "3712fb6c" } 76 func (*PgCapture) GetMessageType() api.MessageType { 77 return api.RequestMessage 78 } 79 80 func (m *PgCapture) Size() (size int) { 81 if m == nil { 82 return 0 83 } 84 size += 4 // m.InterfaceID 85 size += 1 // m.IsEnabled 86 size += 4 // m.Count 87 size += 4 + len(m.PcapFileName) // m.PcapFileName 88 return size 89 } 90 func (m *PgCapture) Marshal(b []byte) ([]byte, error) { 91 if b == nil { 92 b = make([]byte, m.Size()) 93 } 94 buf := codec.NewBuffer(b) 95 buf.EncodeUint32(uint32(m.InterfaceID)) 96 buf.EncodeBool(m.IsEnabled) 97 buf.EncodeUint32(m.Count) 98 buf.EncodeString(m.PcapFileName, 0) 99 return buf.Bytes(), nil 100 } 101 func (m *PgCapture) Unmarshal(b []byte) error { 102 buf := codec.NewBuffer(b) 103 m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32()) 104 m.IsEnabled = buf.DecodeBool() 105 m.Count = buf.DecodeUint32() 106 m.PcapFileName = buf.DecodeString(0) 107 return nil 108 } 109 110 // PgCaptureReply defines message 'pg_capture_reply'. 111 type PgCaptureReply struct { 112 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 113 } 114 115 func (m *PgCaptureReply) Reset() { *m = PgCaptureReply{} } 116 func (*PgCaptureReply) GetMessageName() string { return "pg_capture_reply" } 117 func (*PgCaptureReply) GetCrcString() string { return "e8d4e804" } 118 func (*PgCaptureReply) GetMessageType() api.MessageType { 119 return api.ReplyMessage 120 } 121 122 func (m *PgCaptureReply) Size() (size int) { 123 if m == nil { 124 return 0 125 } 126 size += 4 // m.Retval 127 return size 128 } 129 func (m *PgCaptureReply) Marshal(b []byte) ([]byte, error) { 130 if b == nil { 131 b = make([]byte, m.Size()) 132 } 133 buf := codec.NewBuffer(b) 134 buf.EncodeInt32(m.Retval) 135 return buf.Bytes(), nil 136 } 137 func (m *PgCaptureReply) Unmarshal(b []byte) error { 138 buf := codec.NewBuffer(b) 139 m.Retval = buf.DecodeInt32() 140 return nil 141 } 142 143 // PgCreateInterface defines message 'pg_create_interface'. 144 type PgCreateInterface struct { 145 InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"` 146 GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"` 147 GsoSize uint32 `binapi:"u32,name=gso_size" json:"gso_size,omitempty"` 148 } 149 150 func (m *PgCreateInterface) Reset() { *m = PgCreateInterface{} } 151 func (*PgCreateInterface) GetMessageName() string { return "pg_create_interface" } 152 func (*PgCreateInterface) GetCrcString() string { return "b7c893d7" } 153 func (*PgCreateInterface) GetMessageType() api.MessageType { 154 return api.RequestMessage 155 } 156 157 func (m *PgCreateInterface) Size() (size int) { 158 if m == nil { 159 return 0 160 } 161 size += 4 // m.InterfaceID 162 size += 1 // m.GsoEnabled 163 size += 4 // m.GsoSize 164 return size 165 } 166 func (m *PgCreateInterface) Marshal(b []byte) ([]byte, error) { 167 if b == nil { 168 b = make([]byte, m.Size()) 169 } 170 buf := codec.NewBuffer(b) 171 buf.EncodeUint32(uint32(m.InterfaceID)) 172 buf.EncodeBool(m.GsoEnabled) 173 buf.EncodeUint32(m.GsoSize) 174 return buf.Bytes(), nil 175 } 176 func (m *PgCreateInterface) Unmarshal(b []byte) error { 177 buf := codec.NewBuffer(b) 178 m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32()) 179 m.GsoEnabled = buf.DecodeBool() 180 m.GsoSize = buf.DecodeUint32() 181 return nil 182 } 183 184 // PgCreateInterfaceReply defines message 'pg_create_interface_reply'. 185 type PgCreateInterfaceReply struct { 186 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 187 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 188 } 189 190 func (m *PgCreateInterfaceReply) Reset() { *m = PgCreateInterfaceReply{} } 191 func (*PgCreateInterfaceReply) GetMessageName() string { return "pg_create_interface_reply" } 192 func (*PgCreateInterfaceReply) GetCrcString() string { return "5383d31f" } 193 func (*PgCreateInterfaceReply) GetMessageType() api.MessageType { 194 return api.ReplyMessage 195 } 196 197 func (m *PgCreateInterfaceReply) Size() (size int) { 198 if m == nil { 199 return 0 200 } 201 size += 4 // m.Retval 202 size += 4 // m.SwIfIndex 203 return size 204 } 205 func (m *PgCreateInterfaceReply) Marshal(b []byte) ([]byte, error) { 206 if b == nil { 207 b = make([]byte, m.Size()) 208 } 209 buf := codec.NewBuffer(b) 210 buf.EncodeInt32(m.Retval) 211 buf.EncodeUint32(uint32(m.SwIfIndex)) 212 return buf.Bytes(), nil 213 } 214 func (m *PgCreateInterfaceReply) Unmarshal(b []byte) error { 215 buf := codec.NewBuffer(b) 216 m.Retval = buf.DecodeInt32() 217 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 218 return nil 219 } 220 221 // PgCreateInterfaceV2 defines message 'pg_create_interface_v2'. 222 type PgCreateInterfaceV2 struct { 223 InterfaceID interface_types.InterfaceIndex `binapi:"interface_index,name=interface_id" json:"interface_id,omitempty"` 224 GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"` 225 GsoSize uint32 `binapi:"u32,name=gso_size" json:"gso_size,omitempty"` 226 Mode PgInterfaceMode `binapi:"pg_interface_mode,name=mode" json:"mode,omitempty"` 227 } 228 229 func (m *PgCreateInterfaceV2) Reset() { *m = PgCreateInterfaceV2{} } 230 func (*PgCreateInterfaceV2) GetMessageName() string { return "pg_create_interface_v2" } 231 func (*PgCreateInterfaceV2) GetCrcString() string { return "8657466a" } 232 func (*PgCreateInterfaceV2) GetMessageType() api.MessageType { 233 return api.RequestMessage 234 } 235 236 func (m *PgCreateInterfaceV2) Size() (size int) { 237 if m == nil { 238 return 0 239 } 240 size += 4 // m.InterfaceID 241 size += 1 // m.GsoEnabled 242 size += 4 // m.GsoSize 243 size += 1 // m.Mode 244 return size 245 } 246 func (m *PgCreateInterfaceV2) Marshal(b []byte) ([]byte, error) { 247 if b == nil { 248 b = make([]byte, m.Size()) 249 } 250 buf := codec.NewBuffer(b) 251 buf.EncodeUint32(uint32(m.InterfaceID)) 252 buf.EncodeBool(m.GsoEnabled) 253 buf.EncodeUint32(m.GsoSize) 254 buf.EncodeUint8(uint8(m.Mode)) 255 return buf.Bytes(), nil 256 } 257 func (m *PgCreateInterfaceV2) Unmarshal(b []byte) error { 258 buf := codec.NewBuffer(b) 259 m.InterfaceID = interface_types.InterfaceIndex(buf.DecodeUint32()) 260 m.GsoEnabled = buf.DecodeBool() 261 m.GsoSize = buf.DecodeUint32() 262 m.Mode = PgInterfaceMode(buf.DecodeUint8()) 263 return nil 264 } 265 266 // PgCreateInterfaceV2Reply defines message 'pg_create_interface_v2_reply'. 267 type PgCreateInterfaceV2Reply struct { 268 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 269 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 270 } 271 272 func (m *PgCreateInterfaceV2Reply) Reset() { *m = PgCreateInterfaceV2Reply{} } 273 func (*PgCreateInterfaceV2Reply) GetMessageName() string { return "pg_create_interface_v2_reply" } 274 func (*PgCreateInterfaceV2Reply) GetCrcString() string { return "5383d31f" } 275 func (*PgCreateInterfaceV2Reply) GetMessageType() api.MessageType { 276 return api.ReplyMessage 277 } 278 279 func (m *PgCreateInterfaceV2Reply) Size() (size int) { 280 if m == nil { 281 return 0 282 } 283 size += 4 // m.Retval 284 size += 4 // m.SwIfIndex 285 return size 286 } 287 func (m *PgCreateInterfaceV2Reply) Marshal(b []byte) ([]byte, error) { 288 if b == nil { 289 b = make([]byte, m.Size()) 290 } 291 buf := codec.NewBuffer(b) 292 buf.EncodeInt32(m.Retval) 293 buf.EncodeUint32(uint32(m.SwIfIndex)) 294 return buf.Bytes(), nil 295 } 296 func (m *PgCreateInterfaceV2Reply) Unmarshal(b []byte) error { 297 buf := codec.NewBuffer(b) 298 m.Retval = buf.DecodeInt32() 299 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 300 return nil 301 } 302 303 // PgEnableDisable defines message 'pg_enable_disable'. 304 type PgEnableDisable struct { 305 IsEnabled bool `binapi:"bool,name=is_enabled,default=true" json:"is_enabled,omitempty"` 306 StreamName string `binapi:"string[],name=stream_name" json:"stream_name,omitempty"` 307 } 308 309 func (m *PgEnableDisable) Reset() { *m = PgEnableDisable{} } 310 func (*PgEnableDisable) GetMessageName() string { return "pg_enable_disable" } 311 func (*PgEnableDisable) GetCrcString() string { return "01f94f3a" } 312 func (*PgEnableDisable) GetMessageType() api.MessageType { 313 return api.RequestMessage 314 } 315 316 func (m *PgEnableDisable) Size() (size int) { 317 if m == nil { 318 return 0 319 } 320 size += 1 // m.IsEnabled 321 size += 4 + len(m.StreamName) // m.StreamName 322 return size 323 } 324 func (m *PgEnableDisable) Marshal(b []byte) ([]byte, error) { 325 if b == nil { 326 b = make([]byte, m.Size()) 327 } 328 buf := codec.NewBuffer(b) 329 buf.EncodeBool(m.IsEnabled) 330 buf.EncodeString(m.StreamName, 0) 331 return buf.Bytes(), nil 332 } 333 func (m *PgEnableDisable) Unmarshal(b []byte) error { 334 buf := codec.NewBuffer(b) 335 m.IsEnabled = buf.DecodeBool() 336 m.StreamName = buf.DecodeString(0) 337 return nil 338 } 339 340 // PgEnableDisableReply defines message 'pg_enable_disable_reply'. 341 type PgEnableDisableReply struct { 342 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 343 } 344 345 func (m *PgEnableDisableReply) Reset() { *m = PgEnableDisableReply{} } 346 func (*PgEnableDisableReply) GetMessageName() string { return "pg_enable_disable_reply" } 347 func (*PgEnableDisableReply) GetCrcString() string { return "e8d4e804" } 348 func (*PgEnableDisableReply) GetMessageType() api.MessageType { 349 return api.ReplyMessage 350 } 351 352 func (m *PgEnableDisableReply) Size() (size int) { 353 if m == nil { 354 return 0 355 } 356 size += 4 // m.Retval 357 return size 358 } 359 func (m *PgEnableDisableReply) Marshal(b []byte) ([]byte, error) { 360 if b == nil { 361 b = make([]byte, m.Size()) 362 } 363 buf := codec.NewBuffer(b) 364 buf.EncodeInt32(m.Retval) 365 return buf.Bytes(), nil 366 } 367 func (m *PgEnableDisableReply) Unmarshal(b []byte) error { 368 buf := codec.NewBuffer(b) 369 m.Retval = buf.DecodeInt32() 370 return nil 371 } 372 373 // PgInterfaceEnableDisableCoalesce defines message 'pg_interface_enable_disable_coalesce'. 374 // InProgress: the message form may change in the future versions 375 type PgInterfaceEnableDisableCoalesce struct { 376 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 377 CoalesceEnabled bool `binapi:"bool,name=coalesce_enabled" json:"coalesce_enabled,omitempty"` 378 } 379 380 func (m *PgInterfaceEnableDisableCoalesce) Reset() { *m = PgInterfaceEnableDisableCoalesce{} } 381 func (*PgInterfaceEnableDisableCoalesce) GetMessageName() string { 382 return "pg_interface_enable_disable_coalesce" 383 } 384 func (*PgInterfaceEnableDisableCoalesce) GetCrcString() string { return "a2ef99e7" } 385 func (*PgInterfaceEnableDisableCoalesce) GetMessageType() api.MessageType { 386 return api.RequestMessage 387 } 388 389 func (m *PgInterfaceEnableDisableCoalesce) Size() (size int) { 390 if m == nil { 391 return 0 392 } 393 size += 4 // m.SwIfIndex 394 size += 1 // m.CoalesceEnabled 395 return size 396 } 397 func (m *PgInterfaceEnableDisableCoalesce) Marshal(b []byte) ([]byte, error) { 398 if b == nil { 399 b = make([]byte, m.Size()) 400 } 401 buf := codec.NewBuffer(b) 402 buf.EncodeUint32(uint32(m.SwIfIndex)) 403 buf.EncodeBool(m.CoalesceEnabled) 404 return buf.Bytes(), nil 405 } 406 func (m *PgInterfaceEnableDisableCoalesce) Unmarshal(b []byte) error { 407 buf := codec.NewBuffer(b) 408 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 409 m.CoalesceEnabled = buf.DecodeBool() 410 return nil 411 } 412 413 // PgInterfaceEnableDisableCoalesceReply defines message 'pg_interface_enable_disable_coalesce_reply'. 414 // InProgress: the message form may change in the future versions 415 type PgInterfaceEnableDisableCoalesceReply struct { 416 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 417 } 418 419 func (m *PgInterfaceEnableDisableCoalesceReply) Reset() { *m = PgInterfaceEnableDisableCoalesceReply{} } 420 func (*PgInterfaceEnableDisableCoalesceReply) GetMessageName() string { 421 return "pg_interface_enable_disable_coalesce_reply" 422 } 423 func (*PgInterfaceEnableDisableCoalesceReply) GetCrcString() string { return "e8d4e804" } 424 func (*PgInterfaceEnableDisableCoalesceReply) GetMessageType() api.MessageType { 425 return api.ReplyMessage 426 } 427 428 func (m *PgInterfaceEnableDisableCoalesceReply) Size() (size int) { 429 if m == nil { 430 return 0 431 } 432 size += 4 // m.Retval 433 return size 434 } 435 func (m *PgInterfaceEnableDisableCoalesceReply) Marshal(b []byte) ([]byte, error) { 436 if b == nil { 437 b = make([]byte, m.Size()) 438 } 439 buf := codec.NewBuffer(b) 440 buf.EncodeInt32(m.Retval) 441 return buf.Bytes(), nil 442 } 443 func (m *PgInterfaceEnableDisableCoalesceReply) Unmarshal(b []byte) error { 444 buf := codec.NewBuffer(b) 445 m.Retval = buf.DecodeInt32() 446 return nil 447 } 448 449 func init() { file_pg_binapi_init() } 450 func file_pg_binapi_init() { 451 api.RegisterMessage((*PgCapture)(nil), "pg_capture_3712fb6c") 452 api.RegisterMessage((*PgCaptureReply)(nil), "pg_capture_reply_e8d4e804") 453 api.RegisterMessage((*PgCreateInterface)(nil), "pg_create_interface_b7c893d7") 454 api.RegisterMessage((*PgCreateInterfaceReply)(nil), "pg_create_interface_reply_5383d31f") 455 api.RegisterMessage((*PgCreateInterfaceV2)(nil), "pg_create_interface_v2_8657466a") 456 api.RegisterMessage((*PgCreateInterfaceV2Reply)(nil), "pg_create_interface_v2_reply_5383d31f") 457 api.RegisterMessage((*PgEnableDisable)(nil), "pg_enable_disable_01f94f3a") 458 api.RegisterMessage((*PgEnableDisableReply)(nil), "pg_enable_disable_reply_e8d4e804") 459 api.RegisterMessage((*PgInterfaceEnableDisableCoalesce)(nil), "pg_interface_enable_disable_coalesce_a2ef99e7") 460 api.RegisterMessage((*PgInterfaceEnableDisableCoalesceReply)(nil), "pg_interface_enable_disable_coalesce_reply_e8d4e804") 461 } 462 463 // Messages returns list of all messages in this module. 464 func AllMessages() []api.Message { 465 return []api.Message{ 466 (*PgCapture)(nil), 467 (*PgCaptureReply)(nil), 468 (*PgCreateInterface)(nil), 469 (*PgCreateInterfaceReply)(nil), 470 (*PgCreateInterfaceV2)(nil), 471 (*PgCreateInterfaceV2Reply)(nil), 472 (*PgEnableDisable)(nil), 473 (*PgEnableDisableReply)(nil), 474 (*PgInterfaceEnableDisableCoalesce)(nil), 475 (*PgInterfaceEnableDisableCoalesceReply)(nil), 476 } 477 }