github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/npt66/npt66.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/npt66.api.json
     6  
     7  // Package npt66 contains generated bindings for API file npt66.api.
     8  //
     9  // Contents:
    10  // -  2 messages
    11  package npt66
    12  
    13  import (
    14  	interface_types "github.com/networkservicemesh/govpp/binapi/interface_types"
    15  	ip_types "github.com/networkservicemesh/govpp/binapi/ip_types"
    16  	api "go.fd.io/govpp/api"
    17  	codec "go.fd.io/govpp/codec"
    18  )
    19  
    20  // This is a compile-time assertion to ensure that this generated file
    21  // is compatible with the GoVPP api package it is being compiled against.
    22  // A compilation error at this line likely means your copy of the
    23  // GoVPP api package needs to be updated.
    24  const _ = api.GoVppAPIPackageIsVersion2
    25  
    26  const (
    27  	APIFile    = "npt66"
    28  	APIVersion = "0.0.1"
    29  	VersionCrc = 0x4e353b99
    30  )
    31  
    32  // // Copyright(c) 2023 Cisco Systems, Inc.
    33  // Npt66BindingAddDel defines message 'npt66_binding_add_del'.
    34  type Npt66BindingAddDel struct {
    35  	IsAdd     bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
    36  	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
    37  	Internal  ip_types.IP6Prefix             `binapi:"ip6_prefix,name=internal" json:"internal,omitempty"`
    38  	External  ip_types.IP6Prefix             `binapi:"ip6_prefix,name=external" json:"external,omitempty"`
    39  }
    40  
    41  func (m *Npt66BindingAddDel) Reset()               { *m = Npt66BindingAddDel{} }
    42  func (*Npt66BindingAddDel) GetMessageName() string { return "npt66_binding_add_del" }
    43  func (*Npt66BindingAddDel) GetCrcString() string   { return "8aa10a52" }
    44  func (*Npt66BindingAddDel) GetMessageType() api.MessageType {
    45  	return api.RequestMessage
    46  }
    47  
    48  func (m *Npt66BindingAddDel) Size() (size int) {
    49  	if m == nil {
    50  		return 0
    51  	}
    52  	size += 1      // m.IsAdd
    53  	size += 4      // m.SwIfIndex
    54  	size += 1 * 16 // m.Internal.Address
    55  	size += 1      // m.Internal.Len
    56  	size += 1 * 16 // m.External.Address
    57  	size += 1      // m.External.Len
    58  	return size
    59  }
    60  func (m *Npt66BindingAddDel) Marshal(b []byte) ([]byte, error) {
    61  	if b == nil {
    62  		b = make([]byte, m.Size())
    63  	}
    64  	buf := codec.NewBuffer(b)
    65  	buf.EncodeBool(m.IsAdd)
    66  	buf.EncodeUint32(uint32(m.SwIfIndex))
    67  	buf.EncodeBytes(m.Internal.Address[:], 16)
    68  	buf.EncodeUint8(m.Internal.Len)
    69  	buf.EncodeBytes(m.External.Address[:], 16)
    70  	buf.EncodeUint8(m.External.Len)
    71  	return buf.Bytes(), nil
    72  }
    73  func (m *Npt66BindingAddDel) Unmarshal(b []byte) error {
    74  	buf := codec.NewBuffer(b)
    75  	m.IsAdd = buf.DecodeBool()
    76  	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
    77  	copy(m.Internal.Address[:], buf.DecodeBytes(16))
    78  	m.Internal.Len = buf.DecodeUint8()
    79  	copy(m.External.Address[:], buf.DecodeBytes(16))
    80  	m.External.Len = buf.DecodeUint8()
    81  	return nil
    82  }
    83  
    84  // Npt66BindingAddDelReply defines message 'npt66_binding_add_del_reply'.
    85  type Npt66BindingAddDelReply struct {
    86  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
    87  }
    88  
    89  func (m *Npt66BindingAddDelReply) Reset()               { *m = Npt66BindingAddDelReply{} }
    90  func (*Npt66BindingAddDelReply) GetMessageName() string { return "npt66_binding_add_del_reply" }
    91  func (*Npt66BindingAddDelReply) GetCrcString() string   { return "e8d4e804" }
    92  func (*Npt66BindingAddDelReply) GetMessageType() api.MessageType {
    93  	return api.ReplyMessage
    94  }
    95  
    96  func (m *Npt66BindingAddDelReply) Size() (size int) {
    97  	if m == nil {
    98  		return 0
    99  	}
   100  	size += 4 // m.Retval
   101  	return size
   102  }
   103  func (m *Npt66BindingAddDelReply) Marshal(b []byte) ([]byte, error) {
   104  	if b == nil {
   105  		b = make([]byte, m.Size())
   106  	}
   107  	buf := codec.NewBuffer(b)
   108  	buf.EncodeInt32(m.Retval)
   109  	return buf.Bytes(), nil
   110  }
   111  func (m *Npt66BindingAddDelReply) Unmarshal(b []byte) error {
   112  	buf := codec.NewBuffer(b)
   113  	m.Retval = buf.DecodeInt32()
   114  	return nil
   115  }
   116  
   117  func init() { file_npt66_binapi_init() }
   118  func file_npt66_binapi_init() {
   119  	api.RegisterMessage((*Npt66BindingAddDel)(nil), "npt66_binding_add_del_8aa10a52")
   120  	api.RegisterMessage((*Npt66BindingAddDelReply)(nil), "npt66_binding_add_del_reply_e8d4e804")
   121  }
   122  
   123  // Messages returns list of all messages in this module.
   124  func AllMessages() []api.Message {
   125  	return []api.Message{
   126  		(*Npt66BindingAddDel)(nil),
   127  		(*Npt66BindingAddDelReply)(nil),
   128  	}
   129  }