github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/pppoe/pppoe.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/pppoe.api.json
     6  
     7  // Package pppoe contains generated bindings for API file pppoe.api.
     8  //
     9  // Contents:
    10  // -  6 messages
    11  package pppoe
    12  
    13  import (
    14  	ethernet_types "github.com/networkservicemesh/govpp/binapi/ethernet_types"
    15  	interface_types "github.com/networkservicemesh/govpp/binapi/interface_types"
    16  	ip_types "github.com/networkservicemesh/govpp/binapi/ip_types"
    17  	api "go.fd.io/govpp/api"
    18  	codec "go.fd.io/govpp/codec"
    19  )
    20  
    21  // This is a compile-time assertion to ensure that this generated file
    22  // is compatible with the GoVPP api package it is being compiled against.
    23  // A compilation error at this line likely means your copy of the
    24  // GoVPP api package needs to be updated.
    25  const _ = api.GoVppAPIPackageIsVersion2
    26  
    27  const (
    28  	APIFile    = "pppoe"
    29  	APIVersion = "2.0.0"
    30  	VersionCrc = 0xec9e86bf
    31  )
    32  
    33  // Create PPPOE control plane interface
    34  //   - sw_if_index - software index of the interface
    35  //   - is_add - to create or to delete
    36  //
    37  // PppoeAddDelCp defines message 'pppoe_add_del_cp'.
    38  type PppoeAddDelCp struct {
    39  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    40  	IsAdd     uint8                          `binapi:"u8,name=is_add" json:"is_add,omitempty"`
    41  }
    42  
    43  func (m *PppoeAddDelCp) Reset()               { *m = PppoeAddDelCp{} }
    44  func (*PppoeAddDelCp) GetMessageName() string { return "pppoe_add_del_cp" }
    45  func (*PppoeAddDelCp) GetCrcString() string   { return "eacd9aaa" }
    46  func (*PppoeAddDelCp) GetMessageType() api.MessageType {
    47  	return api.RequestMessage
    48  }
    49  
    50  func (m *PppoeAddDelCp) Size() (size int) {
    51  	if m == nil {
    52  		return 0
    53  	}
    54  	size += 4 // m.SwIfIndex
    55  	size += 1 // m.IsAdd
    56  	return size
    57  }
    58  func (m *PppoeAddDelCp) Marshal(b []byte) ([]byte, error) {
    59  	if b == nil {
    60  		b = make([]byte, m.Size())
    61  	}
    62  	buf := codec.NewBuffer(b)
    63  	buf.EncodeUint32(uint32(m.SwIfIndex))
    64  	buf.EncodeUint8(m.IsAdd)
    65  	return buf.Bytes(), nil
    66  }
    67  func (m *PppoeAddDelCp) Unmarshal(b []byte) error {
    68  	buf := codec.NewBuffer(b)
    69  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
    70  	m.IsAdd = buf.DecodeUint8()
    71  	return nil
    72  }
    73  
    74  // reply for create PPPOE control plane interface
    75  //   - retval - return code
    76  //
    77  // PppoeAddDelCpReply defines message 'pppoe_add_del_cp_reply'.
    78  type PppoeAddDelCpReply struct {
    79  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
    80  }
    81  
    82  func (m *PppoeAddDelCpReply) Reset()               { *m = PppoeAddDelCpReply{} }
    83  func (*PppoeAddDelCpReply) GetMessageName() string { return "pppoe_add_del_cp_reply" }
    84  func (*PppoeAddDelCpReply) GetCrcString() string   { return "e8d4e804" }
    85  func (*PppoeAddDelCpReply) GetMessageType() api.MessageType {
    86  	return api.ReplyMessage
    87  }
    88  
    89  func (m *PppoeAddDelCpReply) Size() (size int) {
    90  	if m == nil {
    91  		return 0
    92  	}
    93  	size += 4 // m.Retval
    94  	return size
    95  }
    96  func (m *PppoeAddDelCpReply) Marshal(b []byte) ([]byte, error) {
    97  	if b == nil {
    98  		b = make([]byte, m.Size())
    99  	}
   100  	buf := codec.NewBuffer(b)
   101  	buf.EncodeInt32(m.Retval)
   102  	return buf.Bytes(), nil
   103  }
   104  func (m *PppoeAddDelCpReply) Unmarshal(b []byte) error {
   105  	buf := codec.NewBuffer(b)
   106  	m.Retval = buf.DecodeInt32()
   107  	return nil
   108  }
   109  
   110  // Set or delete an PPPOE session
   111  //   - is_add - add address if non-zero, else delete
   112  //   - session_id - PPPoE session ID
   113  //   - client_ip - PPPOE session's client address.
   114  //   - decap_vrf_id - the vrf index for pppoe decaped packet
   115  //   - client_mac - the client ethernet address
   116  //
   117  // PppoeAddDelSession defines message 'pppoe_add_del_session'.
   118  type PppoeAddDelSession struct {
   119  	IsAdd      bool                      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
   120  	SessionID  uint16                    `binapi:"u16,name=session_id" json:"session_id,omitempty"`
   121  	ClientIP   ip_types.Address          `binapi:"address,name=client_ip" json:"client_ip,omitempty"`
   122  	DecapVrfID uint32                    `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"`
   123  	ClientMac  ethernet_types.MacAddress `binapi:"mac_address,name=client_mac" json:"client_mac,omitempty"`
   124  }
   125  
   126  func (m *PppoeAddDelSession) Reset()               { *m = PppoeAddDelSession{} }
   127  func (*PppoeAddDelSession) GetMessageName() string { return "pppoe_add_del_session" }
   128  func (*PppoeAddDelSession) GetCrcString() string   { return "f6fd759e" }
   129  func (*PppoeAddDelSession) GetMessageType() api.MessageType {
   130  	return api.RequestMessage
   131  }
   132  
   133  func (m *PppoeAddDelSession) Size() (size int) {
   134  	if m == nil {
   135  		return 0
   136  	}
   137  	size += 1      // m.IsAdd
   138  	size += 2      // m.SessionID
   139  	size += 1      // m.ClientIP.Af
   140  	size += 1 * 16 // m.ClientIP.Un
   141  	size += 4      // m.DecapVrfID
   142  	size += 1 * 6  // m.ClientMac
   143  	return size
   144  }
   145  func (m *PppoeAddDelSession) Marshal(b []byte) ([]byte, error) {
   146  	if b == nil {
   147  		b = make([]byte, m.Size())
   148  	}
   149  	buf := codec.NewBuffer(b)
   150  	buf.EncodeBool(m.IsAdd)
   151  	buf.EncodeUint16(m.SessionID)
   152  	buf.EncodeUint8(uint8(m.ClientIP.Af))
   153  	buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 16)
   154  	buf.EncodeUint32(m.DecapVrfID)
   155  	buf.EncodeBytes(m.ClientMac[:], 6)
   156  	return buf.Bytes(), nil
   157  }
   158  func (m *PppoeAddDelSession) Unmarshal(b []byte) error {
   159  	buf := codec.NewBuffer(b)
   160  	m.IsAdd = buf.DecodeBool()
   161  	m.SessionID = buf.DecodeUint16()
   162  	m.ClientIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
   163  	copy(m.ClientIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   164  	m.DecapVrfID = buf.DecodeUint32()
   165  	copy(m.ClientMac[:], buf.DecodeBytes(6))
   166  	return nil
   167  }
   168  
   169  // reply for set or delete an PPPOE session
   170  //   - retval - return code
   171  //   - sw_if_index - software index of the interface
   172  //
   173  // PppoeAddDelSessionReply defines message 'pppoe_add_del_session_reply'.
   174  type PppoeAddDelSessionReply struct {
   175  	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
   176  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   177  }
   178  
   179  func (m *PppoeAddDelSessionReply) Reset()               { *m = PppoeAddDelSessionReply{} }
   180  func (*PppoeAddDelSessionReply) GetMessageName() string { return "pppoe_add_del_session_reply" }
   181  func (*PppoeAddDelSessionReply) GetCrcString() string   { return "5383d31f" }
   182  func (*PppoeAddDelSessionReply) GetMessageType() api.MessageType {
   183  	return api.ReplyMessage
   184  }
   185  
   186  func (m *PppoeAddDelSessionReply) Size() (size int) {
   187  	if m == nil {
   188  		return 0
   189  	}
   190  	size += 4 // m.Retval
   191  	size += 4 // m.SwIfIndex
   192  	return size
   193  }
   194  func (m *PppoeAddDelSessionReply) Marshal(b []byte) ([]byte, error) {
   195  	if b == nil {
   196  		b = make([]byte, m.Size())
   197  	}
   198  	buf := codec.NewBuffer(b)
   199  	buf.EncodeInt32(m.Retval)
   200  	buf.EncodeUint32(uint32(m.SwIfIndex))
   201  	return buf.Bytes(), nil
   202  }
   203  func (m *PppoeAddDelSessionReply) Unmarshal(b []byte) error {
   204  	buf := codec.NewBuffer(b)
   205  	m.Retval = buf.DecodeInt32()
   206  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   207  	return nil
   208  }
   209  
   210  // dump details of an PPPOE session
   211  //   - sw_if_index - software index of the interface
   212  //   - session_id - PPPoE session ID
   213  //   - client_ip - PPPOE session's client address.
   214  //   - encap_if_index - the index of tx interface for pppoe encaped packet
   215  //   - decap_vrf_id - the vrf index for pppoe decaped packet
   216  //   - local_mac - the local ethernet address
   217  //   - client_mac - the client ethernet address
   218  //
   219  // PppoeSessionDetails defines message 'pppoe_session_details'.
   220  type PppoeSessionDetails struct {
   221  	SwIfIndex    interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   222  	SessionID    uint16                         `binapi:"u16,name=session_id" json:"session_id,omitempty"`
   223  	ClientIP     ip_types.Address               `binapi:"address,name=client_ip" json:"client_ip,omitempty"`
   224  	EncapIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=encap_if_index" json:"encap_if_index,omitempty"`
   225  	DecapVrfID   uint32                         `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"`
   226  	LocalMac     ethernet_types.MacAddress      `binapi:"mac_address,name=local_mac" json:"local_mac,omitempty"`
   227  	ClientMac    ethernet_types.MacAddress      `binapi:"mac_address,name=client_mac" json:"client_mac,omitempty"`
   228  }
   229  
   230  func (m *PppoeSessionDetails) Reset()               { *m = PppoeSessionDetails{} }
   231  func (*PppoeSessionDetails) GetMessageName() string { return "pppoe_session_details" }
   232  func (*PppoeSessionDetails) GetCrcString() string   { return "4b8e8a4a" }
   233  func (*PppoeSessionDetails) GetMessageType() api.MessageType {
   234  	return api.ReplyMessage
   235  }
   236  
   237  func (m *PppoeSessionDetails) Size() (size int) {
   238  	if m == nil {
   239  		return 0
   240  	}
   241  	size += 4      // m.SwIfIndex
   242  	size += 2      // m.SessionID
   243  	size += 1      // m.ClientIP.Af
   244  	size += 1 * 16 // m.ClientIP.Un
   245  	size += 4      // m.EncapIfIndex
   246  	size += 4      // m.DecapVrfID
   247  	size += 1 * 6  // m.LocalMac
   248  	size += 1 * 6  // m.ClientMac
   249  	return size
   250  }
   251  func (m *PppoeSessionDetails) Marshal(b []byte) ([]byte, error) {
   252  	if b == nil {
   253  		b = make([]byte, m.Size())
   254  	}
   255  	buf := codec.NewBuffer(b)
   256  	buf.EncodeUint32(uint32(m.SwIfIndex))
   257  	buf.EncodeUint16(m.SessionID)
   258  	buf.EncodeUint8(uint8(m.ClientIP.Af))
   259  	buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 16)
   260  	buf.EncodeUint32(uint32(m.EncapIfIndex))
   261  	buf.EncodeUint32(m.DecapVrfID)
   262  	buf.EncodeBytes(m.LocalMac[:], 6)
   263  	buf.EncodeBytes(m.ClientMac[:], 6)
   264  	return buf.Bytes(), nil
   265  }
   266  func (m *PppoeSessionDetails) Unmarshal(b []byte) error {
   267  	buf := codec.NewBuffer(b)
   268  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   269  	m.SessionID = buf.DecodeUint16()
   270  	m.ClientIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
   271  	copy(m.ClientIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   272  	m.EncapIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   273  	m.DecapVrfID = buf.DecodeUint32()
   274  	copy(m.LocalMac[:], buf.DecodeBytes(6))
   275  	copy(m.ClientMac[:], buf.DecodeBytes(6))
   276  	return nil
   277  }
   278  
   279  // Dump PPPOE session
   280  //   - sw_if_index - software index of the interface
   281  //
   282  // PppoeSessionDump defines message 'pppoe_session_dump'.
   283  type PppoeSessionDump struct {
   284  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
   285  }
   286  
   287  func (m *PppoeSessionDump) Reset()               { *m = PppoeSessionDump{} }
   288  func (*PppoeSessionDump) GetMessageName() string { return "pppoe_session_dump" }
   289  func (*PppoeSessionDump) GetCrcString() string   { return "f9e6675e" }
   290  func (*PppoeSessionDump) GetMessageType() api.MessageType {
   291  	return api.RequestMessage
   292  }
   293  
   294  func (m *PppoeSessionDump) Size() (size int) {
   295  	if m == nil {
   296  		return 0
   297  	}
   298  	size += 4 // m.SwIfIndex
   299  	return size
   300  }
   301  func (m *PppoeSessionDump) Marshal(b []byte) ([]byte, error) {
   302  	if b == nil {
   303  		b = make([]byte, m.Size())
   304  	}
   305  	buf := codec.NewBuffer(b)
   306  	buf.EncodeUint32(uint32(m.SwIfIndex))
   307  	return buf.Bytes(), nil
   308  }
   309  func (m *PppoeSessionDump) Unmarshal(b []byte) error {
   310  	buf := codec.NewBuffer(b)
   311  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
   312  	return nil
   313  }
   314  
   315  func init() { file_pppoe_binapi_init() }
   316  func file_pppoe_binapi_init() {
   317  	api.RegisterMessage((*PppoeAddDelCp)(nil), "pppoe_add_del_cp_eacd9aaa")
   318  	api.RegisterMessage((*PppoeAddDelCpReply)(nil), "pppoe_add_del_cp_reply_e8d4e804")
   319  	api.RegisterMessage((*PppoeAddDelSession)(nil), "pppoe_add_del_session_f6fd759e")
   320  	api.RegisterMessage((*PppoeAddDelSessionReply)(nil), "pppoe_add_del_session_reply_5383d31f")
   321  	api.RegisterMessage((*PppoeSessionDetails)(nil), "pppoe_session_details_4b8e8a4a")
   322  	api.RegisterMessage((*PppoeSessionDump)(nil), "pppoe_session_dump_f9e6675e")
   323  }
   324  
   325  // Messages returns list of all messages in this module.
   326  func AllMessages() []api.Message {
   327  	return []api.Message{
   328  		(*PppoeAddDelCp)(nil),
   329  		(*PppoeAddDelCpReply)(nil),
   330  		(*PppoeAddDelSession)(nil),
   331  		(*PppoeAddDelSessionReply)(nil),
   332  		(*PppoeSessionDetails)(nil),
   333  		(*PppoeSessionDump)(nil),
   334  	}
   335  }