From ef471318d66dd2832df4dc929d312f7cd5f7009a Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Wed, 26 Jun 2019 16:28:20 +0200 Subject: Improvements for binapi-generator and support VPP 19.04 in statsclient - RPC service client implementation for dumps requests now streams responses - RPC service generation is now enabled by default - examples now allow setting binapi socket address - input dir flag for binapi-generator will recursively look into dirs to support core/plugins in /usr/share/vpp/api - minor improvements in debug logs - add support for VPP 19.04 for statsclient Change-Id: I0939ee3aa6e9f850d073fc5c87aff4ccc56b0d70 Signed-off-by: Ondrej Fabry --- examples/binapi/memclnt/memclnt.ba.go | 134 +++++++++++++++++----------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'examples/binapi/memclnt/memclnt.ba.go') diff --git a/examples/binapi/memclnt/memclnt.ba.go b/examples/binapi/memclnt/memclnt.ba.go index 0fa28dd..d1ffe03 100644 --- a/examples/binapi/memclnt/memclnt.ba.go +++ b/examples/binapi/memclnt/memclnt.ba.go @@ -1,34 +1,24 @@ -// Code generated by GoVPP binapi-generator. DO NOT EDIT. +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. // source: /usr/share/vpp/api/core/memclnt.api.json /* -Package memclnt is a generated from VPP binary API module 'memclnt'. +Package memclnt is a generated VPP binary API for 'memclnt' module. - The memclnt module consists of: +It consists of: 2 types 22 messages 13 services */ package memclnt -import api "git.fd.io/govpp.git/api" -import bytes "bytes" -import context "context" -import strconv "strconv" -import struc "github.com/lunixbochs/struc" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = bytes.NewBuffer -var _ = context.Background -var _ = strconv.Itoa -var _ = struc.Pack - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package +import ( + bytes "bytes" + context "context" + api "git.fd.io/govpp.git/api" + struc "github.com/lunixbochs/struc" + io "io" + strconv "strconv" +) const ( // ModuleName is the name of this module. @@ -39,9 +29,7 @@ const ( VersionCrc = 0xb619530 ) -/* Types */ - -// MessageTableEntry represents VPP binary API type 'message_table_entry': +// MessageTableEntry represents VPP binary API type 'message_table_entry'. type MessageTableEntry struct { Index uint16 Name []byte `struc:"[64]byte"` @@ -54,7 +42,7 @@ func (*MessageTableEntry) GetCrcString() string { return "913bf1c6" } -// ModuleVersion represents VPP binary API type 'module_version': +// ModuleVersion represents VPP binary API type 'module_version'. type ModuleVersion struct { Major uint32 Minor uint32 @@ -69,9 +57,7 @@ func (*ModuleVersion) GetCrcString() string { return "4b6da11a" } -/* Messages */ - -// APIVersions represents VPP binary API message 'api_versions': +// APIVersions represents VPP binary API message 'api_versions'. type APIVersions struct{} func (*APIVersions) GetMessageName() string { @@ -84,7 +70,7 @@ func (*APIVersions) GetMessageType() api.MessageType { return api.RequestMessage } -// APIVersionsReply represents VPP binary API message 'api_versions_reply': +// APIVersionsReply represents VPP binary API message 'api_versions_reply'. type APIVersionsReply struct { Retval int32 Count uint32 `struc:"sizeof=APIVersions"` @@ -101,7 +87,7 @@ func (*APIVersionsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// GetFirstMsgID represents VPP binary API message 'get_first_msg_id': +// GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. type GetFirstMsgID struct { Name []byte `struc:"[64]byte"` } @@ -116,7 +102,7 @@ func (*GetFirstMsgID) GetMessageType() api.MessageType { return api.RequestMessage } -// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply': +// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. type GetFirstMsgIDReply struct { Retval int32 FirstMsgID uint16 @@ -132,7 +118,7 @@ func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntCreate represents VPP binary API message 'memclnt_create': +// MemclntCreate represents VPP binary API message 'memclnt_create'. type MemclntCreate struct { CtxQuota int32 InputQueue uint64 @@ -150,7 +136,7 @@ func (*MemclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply': +// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. type MemclntCreateReply struct { Response int32 Handle uint64 @@ -168,7 +154,7 @@ func (*MemclntCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntDelete represents VPP binary API message 'memclnt_delete': +// MemclntDelete represents VPP binary API message 'memclnt_delete'. type MemclntDelete struct { Index uint32 Handle uint64 @@ -185,7 +171,7 @@ func (*MemclntDelete) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply': +// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. type MemclntDeleteReply struct { Response int32 Handle uint64 @@ -201,7 +187,7 @@ func (*MemclntDeleteReply) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive': +// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. type MemclntKeepalive struct{} func (*MemclntKeepalive) GetMessageName() string { @@ -214,7 +200,7 @@ func (*MemclntKeepalive) GetMessageType() api.MessageType { return api.RequestMessage } -// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply': +// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. type MemclntKeepaliveReply struct { Retval int32 } @@ -229,7 +215,7 @@ func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout': +// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. type MemclntReadTimeout struct { Dummy uint8 } @@ -244,7 +230,7 @@ func (*MemclntReadTimeout) GetMessageType() api.MessageType { return api.OtherMessage } -// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend': +// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. type MemclntRxThreadSuspend struct { Dummy uint8 } @@ -259,7 +245,7 @@ func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { return api.OtherMessage } -// RPCCall represents VPP binary API message 'rpc_call': +// RPCCall represents VPP binary API message 'rpc_call'. type RPCCall struct { Function uint64 Multicast uint8 @@ -279,7 +265,7 @@ func (*RPCCall) GetMessageType() api.MessageType { return api.RequestMessage } -// RPCCallReply represents VPP binary API message 'rpc_call_reply': +// RPCCallReply represents VPP binary API message 'rpc_call_reply'. type RPCCallReply struct { Retval int32 } @@ -294,7 +280,7 @@ func (*RPCCallReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// RxThreadExit represents VPP binary API message 'rx_thread_exit': +// RxThreadExit represents VPP binary API message 'rx_thread_exit'. type RxThreadExit struct { Dummy uint8 } @@ -309,7 +295,7 @@ func (*RxThreadExit) GetMessageType() api.MessageType { return api.OtherMessage } -// SockInitShm represents VPP binary API message 'sock_init_shm': +// SockInitShm represents VPP binary API message 'sock_init_shm'. type SockInitShm struct { RequestedSize uint32 Nitems uint8 `struc:"sizeof=Configs"` @@ -326,7 +312,7 @@ func (*SockInitShm) GetMessageType() api.MessageType { return api.RequestMessage } -// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply': +// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. type SockInitShmReply struct { Retval int32 } @@ -341,7 +327,7 @@ func (*SockInitShmReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// SockclntCreate represents VPP binary API message 'sockclnt_create': +// SockclntCreate represents VPP binary API message 'sockclnt_create'. type SockclntCreate struct { Name []byte `struc:"[64]byte"` } @@ -356,7 +342,7 @@ func (*SockclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } -// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply': +// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. type SockclntCreateReply struct { Response int32 Index uint32 @@ -374,7 +360,7 @@ func (*SockclntCreateReply) GetMessageType() api.MessageType { return api.RequestMessage } -// SockclntDelete represents VPP binary API message 'sockclnt_delete': +// SockclntDelete represents VPP binary API message 'sockclnt_delete'. type SockclntDelete struct { Index uint32 } @@ -389,7 +375,7 @@ func (*SockclntDelete) GetMessageType() api.MessageType { return api.RequestMessage } -// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply': +// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. type SockclntDeleteReply struct { Response int32 } @@ -404,7 +390,7 @@ func (*SockclntDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } -// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids': +// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. type TracePluginMsgIds struct { PluginName []byte `struc:"[128]byte"` FirstMsgID uint16 @@ -474,8 +460,8 @@ func AllMessages() []api.Message { } } -// Service represents VPP binary API services in memclnt module. -type Service interface { +// RPCService represents RPC service API for memclnt module. +type RPCService interface { APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) @@ -491,15 +477,15 @@ type Service interface { TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error } -type service struct { +type serviceClient struct { ch api.Channel } -func NewService(ch api.Channel) Service { - return &service{ch} +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} } -func (c *service) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { +func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { out := new(APIVersionsReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -508,7 +494,7 @@ func (c *service) APIVersions(ctx context.Context, in *APIVersions) (*APIVersion return out, nil } -func (c *service) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { +func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { out := new(GetFirstMsgIDReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -517,7 +503,7 @@ func (c *service) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFir return out, nil } -func (c *service) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { +func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { out := new(MemclntCreateReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -526,7 +512,7 @@ func (c *service) MemclntCreate(ctx context.Context, in *MemclntCreate) (*Memcln return out, nil } -func (c *service) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { +func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { out := new(MemclntDeleteReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -535,7 +521,7 @@ func (c *service) MemclntDelete(ctx context.Context, in *MemclntDelete) (*Memcln return out, nil } -func (c *service) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { +func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { out := new(MemclntKeepaliveReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -544,17 +530,17 @@ func (c *service) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (* return out, nil } -func (c *service) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { +func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { c.ch.SendRequest(in) return nil } -func (c *service) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { +func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { c.ch.SendRequest(in) return nil } -func (c *service) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { +func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { out := new(RPCCallReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -563,12 +549,12 @@ func (c *service) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, erro return out, nil } -func (c *service) RxThreadExit(ctx context.Context, in *RxThreadExit) error { +func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { c.ch.SendRequest(in) return nil } -func (c *service) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { +func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { out := new(SockInitShmReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -577,7 +563,7 @@ func (c *service) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitSh return out, nil } -func (c *service) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { +func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { out := new(SockclntCreateReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -586,7 +572,7 @@ func (c *service) SockclntCreate(ctx context.Context, in *SockclntCreate) (*Sock return out, nil } -func (c *service) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { +func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { out := new(SockclntDeleteReply) err := c.ch.SendRequest(in).ReceiveReply(out) if err != nil { @@ -595,7 +581,21 @@ func (c *service) SockclntDelete(ctx context.Context, in *SockclntDelete) (*Sock return out, nil } -func (c *service) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { +func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { c.ch.SendRequest(in) return nil } + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack -- cgit 1.2.3-korg