github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/urpf/urpf.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/plugins/urpf.api.json
     6  
     7  // Package urpf contains generated bindings for API file urpf.api.
     8  //
     9  // Contents:
    10  //   1 enum
    11  //   4 messages
    12  //
    13  package urpf
    14  
    15  import (
    16  	"strconv"
    17  
    18  	api "git.fd.io/govpp.git/api"
    19  	codec "git.fd.io/govpp.git/codec"
    20  	_ "github.com/edwarnicke/govpp/binapi/fib_types"
    21  	interface_types "github.com/edwarnicke/govpp/binapi/interface_types"
    22  	ip_types "github.com/edwarnicke/govpp/binapi/ip_types"
    23  )
    24  
    25  // This is a compile-time assertion to ensure that this generated file
    26  // is compatible with the GoVPP api package it is being compiled against.
    27  // A compilation error at this line likely means your copy of the
    28  // GoVPP api package needs to be updated.
    29  const _ = api.GoVppAPIPackageIsVersion2
    30  
    31  const (
    32  	APIFile    = "urpf"
    33  	APIVersion = "1.0.0"
    34  	VersionCrc = 0xd0c7b3c9
    35  )
    36  
    37  // UrpfMode defines enum 'urpf_mode'.
    38  type UrpfMode uint8
    39  
    40  const (
    41  	URPF_API_MODE_OFF    UrpfMode = 0
    42  	URPF_API_MODE_LOOSE  UrpfMode = 1
    43  	URPF_API_MODE_STRICT UrpfMode = 2
    44  )
    45  
    46  var (
    47  	UrpfMode_name = map[uint8]string{
    48  		0: "URPF_API_MODE_OFF",
    49  		1: "URPF_API_MODE_LOOSE",
    50  		2: "URPF_API_MODE_STRICT",
    51  	}
    52  	UrpfMode_value = map[string]uint8{
    53  		"URPF_API_MODE_OFF":    0,
    54  		"URPF_API_MODE_LOOSE":  1,
    55  		"URPF_API_MODE_STRICT": 2,
    56  	}
    57  )
    58  
    59  func (x UrpfMode) String() string {
    60  	s, ok := UrpfMode_name[uint8(x)]
    61  	if ok {
    62  		return s
    63  	}
    64  	return "UrpfMode(" + strconv.Itoa(int(x)) + ")"
    65  }
    66  
    67  // UrpfUpdate defines message 'urpf_update'.
    68  type UrpfUpdate struct {
    69  	IsInput   bool                           `binapi:"bool,name=is_input,default=true" json:"is_input,omitempty"`
    70  	Mode      UrpfMode                       `binapi:"urpf_mode,name=mode" json:"mode,omitempty"`
    71  	Af        ip_types.AddressFamily         `binapi:"address_family,name=af" json:"af,omitempty"`
    72  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    73  }
    74  
    75  func (m *UrpfUpdate) Reset()               { *m = UrpfUpdate{} }
    76  func (*UrpfUpdate) GetMessageName() string { return "urpf_update" }
    77  func (*UrpfUpdate) GetCrcString() string   { return "cc274cd1" }
    78  func (*UrpfUpdate) GetMessageType() api.MessageType {
    79  	return api.RequestMessage
    80  }
    81  
    82  func (m *UrpfUpdate) Size() (size int) {
    83  	if m == nil {
    84  		return 0
    85  	}
    86  	size += 1 // m.IsInput
    87  	size += 1 // m.Mode
    88  	size += 1 // m.Af
    89  	size += 4 // m.SwIfIndex
    90  	return size
    91  }
    92  func (m *UrpfUpdate) Marshal(b []byte) ([]byte, error) {
    93  	if b == nil {
    94  		b = make([]byte, m.Size())
    95  	}
    96  	buf := codec.NewBuffer(b)
    97  	buf.EncodeBool(m.IsInput)
    98  	buf.EncodeUint8(uint8(m.Mode))
    99  	buf.EncodeUint8(uint8(m.Af))
   100  	buf.EncodeUint32(uint32(m.SwIfIndex))
   101  	return buf.Bytes(), nil
   102  }
   103  func (m *UrpfUpdate) Unmarshal(b []byte) error {
   104  	buf := codec.NewBuffer(b)
   105  	m.IsInput = buf.DecodeBool()
   106  	m.Mode = UrpfMode(buf.DecodeUint8())
   107  	m.Af = ip_types.AddressFamily(buf.DecodeUint8())
   108  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   109  	return nil
   110  }
   111  
   112  // UrpfUpdateReply defines message 'urpf_update_reply'.
   113  type UrpfUpdateReply struct {
   114  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   115  }
   116  
   117  func (m *UrpfUpdateReply) Reset()               { *m = UrpfUpdateReply{} }
   118  func (*UrpfUpdateReply) GetMessageName() string { return "urpf_update_reply" }
   119  func (*UrpfUpdateReply) GetCrcString() string   { return "e8d4e804" }
   120  func (*UrpfUpdateReply) GetMessageType() api.MessageType {
   121  	return api.ReplyMessage
   122  }
   123  
   124  func (m *UrpfUpdateReply) Size() (size int) {
   125  	if m == nil {
   126  		return 0
   127  	}
   128  	size += 4 // m.Retval
   129  	return size
   130  }
   131  func (m *UrpfUpdateReply) Marshal(b []byte) ([]byte, error) {
   132  	if b == nil {
   133  		b = make([]byte, m.Size())
   134  	}
   135  	buf := codec.NewBuffer(b)
   136  	buf.EncodeInt32(m.Retval)
   137  	return buf.Bytes(), nil
   138  }
   139  func (m *UrpfUpdateReply) Unmarshal(b []byte) error {
   140  	buf := codec.NewBuffer(b)
   141  	m.Retval = buf.DecodeInt32()
   142  	return nil
   143  }
   144  
   145  // UrpfUpdateV2 defines message 'urpf_update_v2'.
   146  type UrpfUpdateV2 struct {
   147  	IsInput   bool                           `binapi:"bool,name=is_input,default=true" json:"is_input,omitempty"`
   148  	Mode      UrpfMode                       `binapi:"urpf_mode,name=mode" json:"mode,omitempty"`
   149  	Af        ip_types.AddressFamily         `binapi:"address_family,name=af" json:"af,omitempty"`
   150  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   151  	TableID   uint32                         `binapi:"u32,name=table_id,default=4294967295" json:"table_id,omitempty"`
   152  }
   153  
   154  func (m *UrpfUpdateV2) Reset()               { *m = UrpfUpdateV2{} }
   155  func (*UrpfUpdateV2) GetMessageName() string { return "urpf_update_v2" }
   156  func (*UrpfUpdateV2) GetCrcString() string   { return "b873d028" }
   157  func (*UrpfUpdateV2) GetMessageType() api.MessageType {
   158  	return api.RequestMessage
   159  }
   160  
   161  func (m *UrpfUpdateV2) Size() (size int) {
   162  	if m == nil {
   163  		return 0
   164  	}
   165  	size += 1 // m.IsInput
   166  	size += 1 // m.Mode
   167  	size += 1 // m.Af
   168  	size += 4 // m.SwIfIndex
   169  	size += 4 // m.TableID
   170  	return size
   171  }
   172  func (m *UrpfUpdateV2) Marshal(b []byte) ([]byte, error) {
   173  	if b == nil {
   174  		b = make([]byte, m.Size())
   175  	}
   176  	buf := codec.NewBuffer(b)
   177  	buf.EncodeBool(m.IsInput)
   178  	buf.EncodeUint8(uint8(m.Mode))
   179  	buf.EncodeUint8(uint8(m.Af))
   180  	buf.EncodeUint32(uint32(m.SwIfIndex))
   181  	buf.EncodeUint32(m.TableID)
   182  	return buf.Bytes(), nil
   183  }
   184  func (m *UrpfUpdateV2) Unmarshal(b []byte) error {
   185  	buf := codec.NewBuffer(b)
   186  	m.IsInput = buf.DecodeBool()
   187  	m.Mode = UrpfMode(buf.DecodeUint8())
   188  	m.Af = ip_types.AddressFamily(buf.DecodeUint8())
   189  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   190  	m.TableID = buf.DecodeUint32()
   191  	return nil
   192  }
   193  
   194  // UrpfUpdateV2Reply defines message 'urpf_update_v2_reply'.
   195  type UrpfUpdateV2Reply struct {
   196  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   197  }
   198  
   199  func (m *UrpfUpdateV2Reply) Reset()               { *m = UrpfUpdateV2Reply{} }
   200  func (*UrpfUpdateV2Reply) GetMessageName() string { return "urpf_update_v2_reply" }
   201  func (*UrpfUpdateV2Reply) GetCrcString() string   { return "e8d4e804" }
   202  func (*UrpfUpdateV2Reply) GetMessageType() api.MessageType {
   203  	return api.ReplyMessage
   204  }
   205  
   206  func (m *UrpfUpdateV2Reply) Size() (size int) {
   207  	if m == nil {
   208  		return 0
   209  	}
   210  	size += 4 // m.Retval
   211  	return size
   212  }
   213  func (m *UrpfUpdateV2Reply) 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 *UrpfUpdateV2Reply) Unmarshal(b []byte) error {
   222  	buf := codec.NewBuffer(b)
   223  	m.Retval = buf.DecodeInt32()
   224  	return nil
   225  }
   226  
   227  func init() { file_urpf_binapi_init() }
   228  func file_urpf_binapi_init() {
   229  	api.RegisterMessage((*UrpfUpdate)(nil), "urpf_update_cc274cd1")
   230  	api.RegisterMessage((*UrpfUpdateReply)(nil), "urpf_update_reply_e8d4e804")
   231  	api.RegisterMessage((*UrpfUpdateV2)(nil), "urpf_update_v2_b873d028")
   232  	api.RegisterMessage((*UrpfUpdateV2Reply)(nil), "urpf_update_v2_reply_e8d4e804")
   233  }
   234  
   235  // Messages returns list of all messages in this module.
   236  func AllMessages() []api.Message {
   237  	return []api.Message{
   238  		(*UrpfUpdate)(nil),
   239  		(*UrpfUpdateReply)(nil),
   240  		(*UrpfUpdateV2)(nil),
   241  		(*UrpfUpdateV2Reply)(nil),
   242  	}
   243  }