From 4102c72bce694babd94a481b1201d33895a6f9c5 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Wed, 27 Apr 2022 18:39:03 +0200 Subject: Update generated binapi to v22.02 & makefile changes This patch does some small updates to the Makefile. * `make gen-binapi-from-code` is removed, and moves to `gen-binapi-local` * `make build` is patched to build cmd & examples * `make binapi-generator` to build the api-generator without other binaries, as they typically require its output to build. * `make gen-binapi-local` runs the locally built binapi-generator to update the local bindings. It expects ${VPP_DIR} to be set and to point to a local vpp repository checked out with the right version * `make gen-binapi-internal` runs the locally built binapi-generator to update the bindings in `internal/testbinapi/binapi2001` Regarding VPP, notable changes when moving to v22.02 are : - ControlPing moved from vpe to memclnt - CliInband went from vpe to vlib Signed-off-by: Nathan Skrzypczak Change-Id: Ie5cd2d5ded7ecaffd9abc3ca675df40be272b1fa --- binapi/udp/udp.ba.go | 128 +++++++++++++++++++++++++++++++++++++++++++++-- binapi/udp/udp_rpc.ba.go | 16 ++++-- 2 files changed, 137 insertions(+), 7 deletions(-) (limited to 'binapi/udp') diff --git a/binapi/udp/udp.ba.go b/binapi/udp/udp.ba.go index ae14837..844c9c7 100644 --- a/binapi/udp/udp.ba.go +++ b/binapi/udp/udp.ba.go @@ -1,18 +1,21 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: // binapi-generator: v0.5.0-dev -// VPP: 21.06-release +// VPP: 22.02-release // source: /usr/share/vpp/api/core/udp.api.json // Package udp contains generated bindings for API file udp.api. // // Contents: -// 1 struct -// 6 messages +// 1 enum +// 2 structs +// 8 messages // package udp import ( + "strconv" + api "git.fd.io/govpp.git/api" ip_types "git.fd.io/govpp.git/binapi/ip_types" codec "git.fd.io/govpp.git/codec" @@ -27,9 +30,46 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "udp" APIVersion = "1.1.0" - VersionCrc = 0x65e4a4b3 + VersionCrc = 0x2d3db5fa +) + +// UDPDecapNextProto defines enum 'udp_decap_next_proto'. +type UDPDecapNextProto uint32 + +const ( + UDP_API_DECAP_PROTO_IP4 UDPDecapNextProto = 1 + UDP_API_DECAP_PROTO_IP6 UDPDecapNextProto = 2 + UDP_API_DECAP_PROTO_MPLS UDPDecapNextProto = 3 ) +var ( + UDPDecapNextProto_name = map[uint32]string{ + 1: "UDP_API_DECAP_PROTO_IP4", + 2: "UDP_API_DECAP_PROTO_IP6", + 3: "UDP_API_DECAP_PROTO_MPLS", + } + UDPDecapNextProto_value = map[string]uint32{ + "UDP_API_DECAP_PROTO_IP4": 1, + "UDP_API_DECAP_PROTO_IP6": 2, + "UDP_API_DECAP_PROTO_MPLS": 3, + } +) + +func (x UDPDecapNextProto) String() string { + s, ok := UDPDecapNextProto_name[uint32(x)] + if ok { + return s + } + return "UDPDecapNextProto(" + strconv.Itoa(int(x)) + ")" +} + +// UDPDecap defines type 'udp_decap'. +type UDPDecap struct { + IsIP4 uint8 `binapi:"u8,name=is_ip4" json:"is_ip4,omitempty"` + Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` + NextProto UDPDecapNextProto `binapi:"udp_decap_next_proto,name=next_proto" json:"next_proto,omitempty"` +} + // UDPEncap defines type 'udp_encap'. type UDPEncap struct { TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` @@ -40,6 +80,82 @@ type UDPEncap struct { ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` } +// UDPDecapAddDel defines message 'udp_decap_add_del'. +type UDPDecapAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + UDPDecap UDPDecap `binapi:"udp_decap,name=udp_decap" json:"udp_decap,omitempty"` +} + +func (m *UDPDecapAddDel) Reset() { *m = UDPDecapAddDel{} } +func (*UDPDecapAddDel) GetMessageName() string { return "udp_decap_add_del" } +func (*UDPDecapAddDel) GetCrcString() string { return "d155c6ac" } +func (*UDPDecapAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *UDPDecapAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.UDPDecap.IsIP4 + size += 2 // m.UDPDecap.Port + size += 4 // m.UDPDecap.NextProto + return size +} +func (m *UDPDecapAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(m.UDPDecap.IsIP4) + buf.EncodeUint16(m.UDPDecap.Port) + buf.EncodeUint32(uint32(m.UDPDecap.NextProto)) + return buf.Bytes(), nil +} +func (m *UDPDecapAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.UDPDecap.IsIP4 = buf.DecodeUint8() + m.UDPDecap.Port = buf.DecodeUint16() + m.UDPDecap.NextProto = UDPDecapNextProto(buf.DecodeUint32()) + return nil +} + +// UDPDecapAddDelReply defines message 'udp_decap_add_del_reply'. +type UDPDecapAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *UDPDecapAddDelReply) Reset() { *m = UDPDecapAddDelReply{} } +func (*UDPDecapAddDelReply) GetMessageName() string { return "udp_decap_add_del_reply" } +func (*UDPDecapAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*UDPDecapAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *UDPDecapAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *UDPDecapAddDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *UDPDecapAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // UDPEncapAdd defines message 'udp_encap_add'. type UDPEncapAdd struct { UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"` @@ -280,6 +396,8 @@ func (m *UDPEncapDump) Unmarshal(b []byte) error { func init() { file_udp_binapi_init() } func file_udp_binapi_init() { + api.RegisterMessage((*UDPDecapAddDel)(nil), "udp_decap_add_del_d155c6ac") + api.RegisterMessage((*UDPDecapAddDelReply)(nil), "udp_decap_add_del_reply_e8d4e804") api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_f74a60b1") api.RegisterMessage((*UDPEncapAddReply)(nil), "udp_encap_add_reply_e2fc8294") api.RegisterMessage((*UDPEncapDel)(nil), "udp_encap_del_3a91bde5") @@ -291,6 +409,8 @@ func file_udp_binapi_init() { // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*UDPDecapAddDel)(nil), + (*UDPDecapAddDelReply)(nil), (*UDPEncapAdd)(nil), (*UDPEncapAddReply)(nil), (*UDPEncapDel)(nil), diff --git a/binapi/udp/udp_rpc.ba.go b/binapi/udp/udp_rpc.ba.go index d2a8bd0..34a1b5a 100644 --- a/binapi/udp/udp_rpc.ba.go +++ b/binapi/udp/udp_rpc.ba.go @@ -8,11 +8,12 @@ import ( "io" api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" + memclnt "git.fd.io/govpp.git/binapi/memclnt" ) // RPCService defines RPC service udp. type RPCService interface { + UDPDecapAddDel(ctx context.Context, in *UDPDecapAddDel) (*UDPDecapAddDelReply, error) UDPEncapAdd(ctx context.Context, in *UDPEncapAdd) (*UDPEncapAddReply, error) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPEncapDelReply, error) UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPCService_UDPEncapDumpClient, error) @@ -26,6 +27,15 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) UDPDecapAddDel(ctx context.Context, in *UDPDecapAddDel) (*UDPDecapAddDelReply, error) { + out := new(UDPDecapAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) UDPEncapAdd(ctx context.Context, in *UDPEncapAdd) (*UDPEncapAddReply, error) { out := new(UDPEncapAddReply) err := c.conn.Invoke(ctx, in, out) @@ -53,7 +63,7 @@ func (c *serviceClient) UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -76,7 +86,7 @@ func (c *serviceClient_UDPEncapDumpClient) Recv() (*UDPEncapDetails, error) { switch m := msg.(type) { case *UDPEncapDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: err = c.Stream.Close() if err != nil { return nil, err -- cgit 1.2.3-korg