github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/udp_ping/udp_ping.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/udp_ping.api.json
     6  
     7  // Package udp_ping contains generated bindings for API file udp_ping.api.
     8  //
     9  // Contents:
    10  // -  4 messages
    11  package udp_ping
    12  
    13  import (
    14  	ip_types "github.com/networkservicemesh/govpp/binapi/ip_types"
    15  	api "go.fd.io/govpp/api"
    16  	codec "go.fd.io/govpp/codec"
    17  )
    18  
    19  // This is a compile-time assertion to ensure that this generated file
    20  // is compatible with the GoVPP api package it is being compiled against.
    21  // A compilation error at this line likely means your copy of the
    22  // GoVPP api package needs to be updated.
    23  const _ = api.GoVppAPIPackageIsVersion2
    24  
    25  const (
    26  	APIFile    = "udp_ping"
    27  	APIVersion = "3.0.0"
    28  	VersionCrc = 0x16d961db
    29  )
    30  
    31  // UDP-Probe Add/Delete request
    32  //   - src_ip_address - Source ipv4/v6 address for the udp-ping flow
    33  //   - dst_ip_address - Destination ipv4/v6 address for the udp-ping flow
    34  //   - start_src_port - Starting source port of port range for udp-ping
    35  //   - end_src_port - End source port of port range for udp-ping
    36  //   - start_dst_port - Starting destination port of port range for udp-ping
    37  //   - end_dst_port - End destination port of port range for udp-ping
    38  //   - interval - Time interval in seconds at which udp-probe need to be sent
    39  //   - is_ipv4 - To determine whether IPv4 or IPv6 address is used
    40  //   - dis - TRUE is delete, FALSE if Add
    41  //
    42  // UDPPingAddDel defines message 'udp_ping_add_del'.
    43  type UDPPingAddDel struct {
    44  	SrcIPAddress ip_types.Address `binapi:"address,name=src_ip_address" json:"src_ip_address,omitempty"`
    45  	DstIPAddress ip_types.Address `binapi:"address,name=dst_ip_address" json:"dst_ip_address,omitempty"`
    46  	StartSrcPort uint16           `binapi:"u16,name=start_src_port" json:"start_src_port,omitempty"`
    47  	EndSrcPort   uint16           `binapi:"u16,name=end_src_port" json:"end_src_port,omitempty"`
    48  	StartDstPort uint16           `binapi:"u16,name=start_dst_port" json:"start_dst_port,omitempty"`
    49  	EndDstPort   uint16           `binapi:"u16,name=end_dst_port" json:"end_dst_port,omitempty"`
    50  	Interval     uint16           `binapi:"u16,name=interval" json:"interval,omitempty"`
    51  	Dis          uint8            `binapi:"u8,name=dis" json:"dis,omitempty"`
    52  	FaultDet     uint8            `binapi:"u8,name=fault_det" json:"fault_det,omitempty"`
    53  	Reserve      []byte           `binapi:"u8[3],name=reserve" json:"reserve,omitempty"`
    54  }
    55  
    56  func (m *UDPPingAddDel) Reset()               { *m = UDPPingAddDel{} }
    57  func (*UDPPingAddDel) GetMessageName() string { return "udp_ping_add_del" }
    58  func (*UDPPingAddDel) GetCrcString() string   { return "fa2628fc" }
    59  func (*UDPPingAddDel) GetMessageType() api.MessageType {
    60  	return api.RequestMessage
    61  }
    62  
    63  func (m *UDPPingAddDel) Size() (size int) {
    64  	if m == nil {
    65  		return 0
    66  	}
    67  	size += 1      // m.SrcIPAddress.Af
    68  	size += 1 * 16 // m.SrcIPAddress.Un
    69  	size += 1      // m.DstIPAddress.Af
    70  	size += 1 * 16 // m.DstIPAddress.Un
    71  	size += 2      // m.StartSrcPort
    72  	size += 2      // m.EndSrcPort
    73  	size += 2      // m.StartDstPort
    74  	size += 2      // m.EndDstPort
    75  	size += 2      // m.Interval
    76  	size += 1      // m.Dis
    77  	size += 1      // m.FaultDet
    78  	size += 1 * 3  // m.Reserve
    79  	return size
    80  }
    81  func (m *UDPPingAddDel) Marshal(b []byte) ([]byte, error) {
    82  	if b == nil {
    83  		b = make([]byte, m.Size())
    84  	}
    85  	buf := codec.NewBuffer(b)
    86  	buf.EncodeUint8(uint8(m.SrcIPAddress.Af))
    87  	buf.EncodeBytes(m.SrcIPAddress.Un.XXX_UnionData[:], 16)
    88  	buf.EncodeUint8(uint8(m.DstIPAddress.Af))
    89  	buf.EncodeBytes(m.DstIPAddress.Un.XXX_UnionData[:], 16)
    90  	buf.EncodeUint16(m.StartSrcPort)
    91  	buf.EncodeUint16(m.EndSrcPort)
    92  	buf.EncodeUint16(m.StartDstPort)
    93  	buf.EncodeUint16(m.EndDstPort)
    94  	buf.EncodeUint16(m.Interval)
    95  	buf.EncodeUint8(m.Dis)
    96  	buf.EncodeUint8(m.FaultDet)
    97  	buf.EncodeBytes(m.Reserve, 3)
    98  	return buf.Bytes(), nil
    99  }
   100  func (m *UDPPingAddDel) Unmarshal(b []byte) error {
   101  	buf := codec.NewBuffer(b)
   102  	m.SrcIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
   103  	copy(m.SrcIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   104  	m.DstIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
   105  	copy(m.DstIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
   106  	m.StartSrcPort = buf.DecodeUint16()
   107  	m.EndSrcPort = buf.DecodeUint16()
   108  	m.StartDstPort = buf.DecodeUint16()
   109  	m.EndDstPort = buf.DecodeUint16()
   110  	m.Interval = buf.DecodeUint16()
   111  	m.Dis = buf.DecodeUint8()
   112  	m.FaultDet = buf.DecodeUint8()
   113  	m.Reserve = make([]byte, 3)
   114  	copy(m.Reserve, buf.DecodeBytes(len(m.Reserve)))
   115  	return nil
   116  }
   117  
   118  // UDPPingAddDelReply defines message 'udp_ping_add_del_reply'.
   119  type UDPPingAddDelReply struct {
   120  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   121  }
   122  
   123  func (m *UDPPingAddDelReply) Reset()               { *m = UDPPingAddDelReply{} }
   124  func (*UDPPingAddDelReply) GetMessageName() string { return "udp_ping_add_del_reply" }
   125  func (*UDPPingAddDelReply) GetCrcString() string   { return "e8d4e804" }
   126  func (*UDPPingAddDelReply) GetMessageType() api.MessageType {
   127  	return api.ReplyMessage
   128  }
   129  
   130  func (m *UDPPingAddDelReply) Size() (size int) {
   131  	if m == nil {
   132  		return 0
   133  	}
   134  	size += 4 // m.Retval
   135  	return size
   136  }
   137  func (m *UDPPingAddDelReply) Marshal(b []byte) ([]byte, error) {
   138  	if b == nil {
   139  		b = make([]byte, m.Size())
   140  	}
   141  	buf := codec.NewBuffer(b)
   142  	buf.EncodeInt32(m.Retval)
   143  	return buf.Bytes(), nil
   144  }
   145  func (m *UDPPingAddDelReply) Unmarshal(b []byte) error {
   146  	buf := codec.NewBuffer(b)
   147  	m.Retval = buf.DecodeInt32()
   148  	return nil
   149  }
   150  
   151  // Udp-probe export add/del request
   152  //   - retval - return value for request
   153  //   - enable - If TRUE then enable export else disable
   154  //
   155  // UDPPingExport defines message 'udp_ping_export'.
   156  type UDPPingExport struct {
   157  	Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"`
   158  }
   159  
   160  func (m *UDPPingExport) Reset()               { *m = UDPPingExport{} }
   161  func (*UDPPingExport) GetMessageName() string { return "udp_ping_export" }
   162  func (*UDPPingExport) GetCrcString() string   { return "b3e225d2" }
   163  func (*UDPPingExport) GetMessageType() api.MessageType {
   164  	return api.RequestMessage
   165  }
   166  
   167  func (m *UDPPingExport) Size() (size int) {
   168  	if m == nil {
   169  		return 0
   170  	}
   171  	size += 1 // m.Enable
   172  	return size
   173  }
   174  func (m *UDPPingExport) Marshal(b []byte) ([]byte, error) {
   175  	if b == nil {
   176  		b = make([]byte, m.Size())
   177  	}
   178  	buf := codec.NewBuffer(b)
   179  	buf.EncodeBool(m.Enable)
   180  	return buf.Bytes(), nil
   181  }
   182  func (m *UDPPingExport) Unmarshal(b []byte) error {
   183  	buf := codec.NewBuffer(b)
   184  	m.Enable = buf.DecodeBool()
   185  	return nil
   186  }
   187  
   188  // UDPPingExportReply defines message 'udp_ping_export_reply'.
   189  type UDPPingExportReply struct {
   190  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   191  }
   192  
   193  func (m *UDPPingExportReply) Reset()               { *m = UDPPingExportReply{} }
   194  func (*UDPPingExportReply) GetMessageName() string { return "udp_ping_export_reply" }
   195  func (*UDPPingExportReply) GetCrcString() string   { return "e8d4e804" }
   196  func (*UDPPingExportReply) GetMessageType() api.MessageType {
   197  	return api.ReplyMessage
   198  }
   199  
   200  func (m *UDPPingExportReply) Size() (size int) {
   201  	if m == nil {
   202  		return 0
   203  	}
   204  	size += 4 // m.Retval
   205  	return size
   206  }
   207  func (m *UDPPingExportReply) Marshal(b []byte) ([]byte, error) {
   208  	if b == nil {
   209  		b = make([]byte, m.Size())
   210  	}
   211  	buf := codec.NewBuffer(b)
   212  	buf.EncodeInt32(m.Retval)
   213  	return buf.Bytes(), nil
   214  }
   215  func (m *UDPPingExportReply) Unmarshal(b []byte) error {
   216  	buf := codec.NewBuffer(b)
   217  	m.Retval = buf.DecodeInt32()
   218  	return nil
   219  }
   220  
   221  func init() { file_udp_ping_binapi_init() }
   222  func file_udp_ping_binapi_init() {
   223  	api.RegisterMessage((*UDPPingAddDel)(nil), "udp_ping_add_del_fa2628fc")
   224  	api.RegisterMessage((*UDPPingAddDelReply)(nil), "udp_ping_add_del_reply_e8d4e804")
   225  	api.RegisterMessage((*UDPPingExport)(nil), "udp_ping_export_b3e225d2")
   226  	api.RegisterMessage((*UDPPingExportReply)(nil), "udp_ping_export_reply_e8d4e804")
   227  }
   228  
   229  // Messages returns list of all messages in this module.
   230  func AllMessages() []api.Message {
   231  	return []api.Message{
   232  		(*UDPPingAddDel)(nil),
   233  		(*UDPPingAddDelReply)(nil),
   234  		(*UDPPingExport)(nil),
   235  		(*UDPPingExportReply)(nil),
   236  	}
   237  }