github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/urpf/urpf.ba.go (about)

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