github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/gre/gre.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/gre.api.json
     6  
     7  // Package gre contains generated bindings for API file gre.api.
     8  //
     9  // Contents:
    10  //   1 enum
    11  //   1 struct
    12  //   4 messages
    13  //
    14  package gre
    15  
    16  import (
    17  	"strconv"
    18  
    19  	api "git.fd.io/govpp.git/api"
    20  	codec "git.fd.io/govpp.git/codec"
    21  	interface_types "github.com/edwarnicke/govpp/binapi/interface_types"
    22  	ip_types "github.com/edwarnicke/govpp/binapi/ip_types"
    23  	tunnel_types "github.com/edwarnicke/govpp/binapi/tunnel_types"
    24  )
    25  
    26  // This is a compile-time assertion to ensure that this generated file
    27  // is compatible with the GoVPP api package it is being compiled against.
    28  // A compilation error at this line likely means your copy of the
    29  // GoVPP api package needs to be updated.
    30  const _ = api.GoVppAPIPackageIsVersion2
    31  
    32  const (
    33  	APIFile    = "gre"
    34  	APIVersion = "2.1.1"
    35  	VersionCrc = 0x98b44dd1
    36  )
    37  
    38  // GreTunnelType defines enum 'gre_tunnel_type'.
    39  type GreTunnelType uint8
    40  
    41  const (
    42  	GRE_API_TUNNEL_TYPE_L3     GreTunnelType = 0
    43  	GRE_API_TUNNEL_TYPE_TEB    GreTunnelType = 1
    44  	GRE_API_TUNNEL_TYPE_ERSPAN GreTunnelType = 2
    45  )
    46  
    47  var (
    48  	GreTunnelType_name = map[uint8]string{
    49  		0: "GRE_API_TUNNEL_TYPE_L3",
    50  		1: "GRE_API_TUNNEL_TYPE_TEB",
    51  		2: "GRE_API_TUNNEL_TYPE_ERSPAN",
    52  	}
    53  	GreTunnelType_value = map[string]uint8{
    54  		"GRE_API_TUNNEL_TYPE_L3":     0,
    55  		"GRE_API_TUNNEL_TYPE_TEB":    1,
    56  		"GRE_API_TUNNEL_TYPE_ERSPAN": 2,
    57  	}
    58  )
    59  
    60  func (x GreTunnelType) String() string {
    61  	s, ok := GreTunnelType_name[uint8(x)]
    62  	if ok {
    63  		return s
    64  	}
    65  	return "GreTunnelType(" + strconv.Itoa(int(x)) + ")"
    66  }
    67  
    68  // GreTunnel defines type 'gre_tunnel'.
    69  type GreTunnel struct {
    70  	Type         GreTunnelType                      `binapi:"gre_tunnel_type,name=type" json:"type,omitempty"`
    71  	Mode         tunnel_types.TunnelMode            `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"`
    72  	Flags        tunnel_types.TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=flags" json:"flags,omitempty"`
    73  	SessionID    uint16                             `binapi:"u16,name=session_id" json:"session_id,omitempty"`
    74  	Instance     uint32                             `binapi:"u32,name=instance" json:"instance,omitempty"`
    75  	OuterTableID uint32                             `binapi:"u32,name=outer_table_id" json:"outer_table_id,omitempty"`
    76  	SwIfIndex    interface_types.InterfaceIndex     `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    77  	Src          ip_types.Address                   `binapi:"address,name=src" json:"src,omitempty"`
    78  	Dst          ip_types.Address                   `binapi:"address,name=dst" json:"dst,omitempty"`
    79  }
    80  
    81  // GreTunnelAddDel defines message 'gre_tunnel_add_del'.
    82  type GreTunnelAddDel struct {
    83  	IsAdd  bool      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
    84  	Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
    85  }
    86  
    87  func (m *GreTunnelAddDel) Reset()               { *m = GreTunnelAddDel{} }
    88  func (*GreTunnelAddDel) GetMessageName() string { return "gre_tunnel_add_del" }
    89  func (*GreTunnelAddDel) GetCrcString() string   { return "a27d7f17" }
    90  func (*GreTunnelAddDel) GetMessageType() api.MessageType {
    91  	return api.RequestMessage
    92  }
    93  
    94  func (m *GreTunnelAddDel) Size() (size int) {
    95  	if m == nil {
    96  		return 0
    97  	}
    98  	size += 1      // m.IsAdd
    99  	size += 1      // m.Tunnel.Type
   100  	size += 1      // m.Tunnel.Mode
   101  	size += 1      // m.Tunnel.Flags
   102  	size += 2      // m.Tunnel.SessionID
   103  	size += 4      // m.Tunnel.Instance
   104  	size += 4      // m.Tunnel.OuterTableID
   105  	size += 4      // m.Tunnel.SwIfIndex
   106  	size += 1      // m.Tunnel.Src.Af
   107  	size += 1 * 16 // m.Tunnel.Src.Un
   108  	size += 1      // m.Tunnel.Dst.Af
   109  	size += 1 * 16 // m.Tunnel.Dst.Un
   110  	return size
   111  }
   112  func (m *GreTunnelAddDel) Marshal(b []byte) ([]byte, error) {
   113  	if b == nil {
   114  		b = make([]byte, m.Size())
   115  	}
   116  	buf := codec.NewBuffer(b)
   117  	buf.EncodeBool(m.IsAdd)
   118  	buf.EncodeUint8(uint8(m.Tunnel.Type))
   119  	buf.EncodeUint8(uint8(m.Tunnel.Mode))
   120  	buf.EncodeUint8(uint8(m.Tunnel.Flags))
   121  	buf.EncodeUint16(m.Tunnel.SessionID)
   122  	buf.EncodeUint32(m.Tunnel.Instance)
   123  	buf.EncodeUint32(m.Tunnel.OuterTableID)
   124  	buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
   125  	buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
   126  	buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
   127  	buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
   128  	buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
   129  	return buf.Bytes(), nil
   130  }
   131  func (m *GreTunnelAddDel) Unmarshal(b []byte) error {
   132  	buf := codec.NewBuffer(b)
   133  	m.IsAdd = buf.DecodeBool()
   134  	m.Tunnel.Type = GreTunnelType(buf.DecodeUint8())
   135  	m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8())
   136  	m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8())
   137  	m.Tunnel.SessionID = buf.DecodeUint16()
   138  	m.Tunnel.Instance = buf.DecodeUint32()
   139  	m.Tunnel.OuterTableID = buf.DecodeUint32()
   140  	m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   141  	m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
   142  	copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   143  	m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
   144  	copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   145  	return nil
   146  }
   147  
   148  // GreTunnelAddDelReply defines message 'gre_tunnel_add_del_reply'.
   149  type GreTunnelAddDelReply struct {
   150  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   151  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   152  }
   153  
   154  func (m *GreTunnelAddDelReply) Reset()               { *m = GreTunnelAddDelReply{} }
   155  func (*GreTunnelAddDelReply) GetMessageName() string { return "gre_tunnel_add_del_reply" }
   156  func (*GreTunnelAddDelReply) GetCrcString() string   { return "5383d31f" }
   157  func (*GreTunnelAddDelReply) GetMessageType() api.MessageType {
   158  	return api.ReplyMessage
   159  }
   160  
   161  func (m *GreTunnelAddDelReply) Size() (size int) {
   162  	if m == nil {
   163  		return 0
   164  	}
   165  	size += 4 // m.Retval
   166  	size += 4 // m.SwIfIndex
   167  	return size
   168  }
   169  func (m *GreTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
   170  	if b == nil {
   171  		b = make([]byte, m.Size())
   172  	}
   173  	buf := codec.NewBuffer(b)
   174  	buf.EncodeInt32(m.Retval)
   175  	buf.EncodeUint32(uint32(m.SwIfIndex))
   176  	return buf.Bytes(), nil
   177  }
   178  func (m *GreTunnelAddDelReply) Unmarshal(b []byte) error {
   179  	buf := codec.NewBuffer(b)
   180  	m.Retval = buf.DecodeInt32()
   181  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   182  	return nil
   183  }
   184  
   185  // GreTunnelDetails defines message 'gre_tunnel_details'.
   186  type GreTunnelDetails struct {
   187  	Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
   188  }
   189  
   190  func (m *GreTunnelDetails) Reset()               { *m = GreTunnelDetails{} }
   191  func (*GreTunnelDetails) GetMessageName() string { return "gre_tunnel_details" }
   192  func (*GreTunnelDetails) GetCrcString() string   { return "24435433" }
   193  func (*GreTunnelDetails) GetMessageType() api.MessageType {
   194  	return api.ReplyMessage
   195  }
   196  
   197  func (m *GreTunnelDetails) Size() (size int) {
   198  	if m == nil {
   199  		return 0
   200  	}
   201  	size += 1      // m.Tunnel.Type
   202  	size += 1      // m.Tunnel.Mode
   203  	size += 1      // m.Tunnel.Flags
   204  	size += 2      // m.Tunnel.SessionID
   205  	size += 4      // m.Tunnel.Instance
   206  	size += 4      // m.Tunnel.OuterTableID
   207  	size += 4      // m.Tunnel.SwIfIndex
   208  	size += 1      // m.Tunnel.Src.Af
   209  	size += 1 * 16 // m.Tunnel.Src.Un
   210  	size += 1      // m.Tunnel.Dst.Af
   211  	size += 1 * 16 // m.Tunnel.Dst.Un
   212  	return size
   213  }
   214  func (m *GreTunnelDetails) Marshal(b []byte) ([]byte, error) {
   215  	if b == nil {
   216  		b = make([]byte, m.Size())
   217  	}
   218  	buf := codec.NewBuffer(b)
   219  	buf.EncodeUint8(uint8(m.Tunnel.Type))
   220  	buf.EncodeUint8(uint8(m.Tunnel.Mode))
   221  	buf.EncodeUint8(uint8(m.Tunnel.Flags))
   222  	buf.EncodeUint16(m.Tunnel.SessionID)
   223  	buf.EncodeUint32(m.Tunnel.Instance)
   224  	buf.EncodeUint32(m.Tunnel.OuterTableID)
   225  	buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
   226  	buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
   227  	buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
   228  	buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
   229  	buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
   230  	return buf.Bytes(), nil
   231  }
   232  func (m *GreTunnelDetails) Unmarshal(b []byte) error {
   233  	buf := codec.NewBuffer(b)
   234  	m.Tunnel.Type = GreTunnelType(buf.DecodeUint8())
   235  	m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8())
   236  	m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8())
   237  	m.Tunnel.SessionID = buf.DecodeUint16()
   238  	m.Tunnel.Instance = buf.DecodeUint32()
   239  	m.Tunnel.OuterTableID = buf.DecodeUint32()
   240  	m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   241  	m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
   242  	copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   243  	m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
   244  	copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   245  	return nil
   246  }
   247  
   248  // GreTunnelDump defines message 'gre_tunnel_dump'.
   249  type GreTunnelDump struct {
   250  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   251  }
   252  
   253  func (m *GreTunnelDump) Reset()               { *m = GreTunnelDump{} }
   254  func (*GreTunnelDump) GetMessageName() string { return "gre_tunnel_dump" }
   255  func (*GreTunnelDump) GetCrcString() string   { return "f9e6675e" }
   256  func (*GreTunnelDump) GetMessageType() api.MessageType {
   257  	return api.RequestMessage
   258  }
   259  
   260  func (m *GreTunnelDump) Size() (size int) {
   261  	if m == nil {
   262  		return 0
   263  	}
   264  	size += 4 // m.SwIfIndex
   265  	return size
   266  }
   267  func (m *GreTunnelDump) Marshal(b []byte) ([]byte, error) {
   268  	if b == nil {
   269  		b = make([]byte, m.Size())
   270  	}
   271  	buf := codec.NewBuffer(b)
   272  	buf.EncodeUint32(uint32(m.SwIfIndex))
   273  	return buf.Bytes(), nil
   274  }
   275  func (m *GreTunnelDump) Unmarshal(b []byte) error {
   276  	buf := codec.NewBuffer(b)
   277  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   278  	return nil
   279  }
   280  
   281  func init() { file_gre_binapi_init() }
   282  func file_gre_binapi_init() {
   283  	api.RegisterMessage((*GreTunnelAddDel)(nil), "gre_tunnel_add_del_a27d7f17")
   284  	api.RegisterMessage((*GreTunnelAddDelReply)(nil), "gre_tunnel_add_del_reply_5383d31f")
   285  	api.RegisterMessage((*GreTunnelDetails)(nil), "gre_tunnel_details_24435433")
   286  	api.RegisterMessage((*GreTunnelDump)(nil), "gre_tunnel_dump_f9e6675e")
   287  }
   288  
   289  // Messages returns list of all messages in this module.
   290  func AllMessages() []api.Message {
   291  	return []api.Message{
   292  		(*GreTunnelAddDel)(nil),
   293  		(*GreTunnelAddDelReply)(nil),
   294  		(*GreTunnelDetails)(nil),
   295  		(*GreTunnelDump)(nil),
   296  	}
   297  }