diff options
Diffstat (limited to 'binapi/pppoe')
-rw-r--r-- | binapi/pppoe/pppoe.ba.go | 100 | ||||
-rw-r--r-- | binapi/pppoe/pppoe_rest.ba.go | 37 | ||||
-rw-r--r-- | binapi/pppoe/pppoe_rpc.ba.go | 27 |
3 files changed, 108 insertions, 56 deletions
diff --git a/binapi/pppoe/pppoe.ba.go b/binapi/pppoe/pppoe.ba.go index e01d3b5..97d15ae 100644 --- a/binapi/pppoe/pppoe.ba.go +++ b/binapi/pppoe/pppoe.ba.go @@ -1,22 +1,22 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.6.0-dev +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/pppoe.api.json // Package pppoe contains generated bindings for API file pppoe.api. // // Contents: -// 4 messages +// 6 messages // package pppoe import ( - api "git.fd.io/govpp.git/api" - ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/binapi/interface_types" - ip_types "git.fd.io/govpp.git/binapi/ip_types" - codec "git.fd.io/govpp.git/codec" + api "go.fd.io/govpp/api" + ethernet_types "go.fd.io/govpp/binapi/ethernet_types" + interface_types "go.fd.io/govpp/binapi/interface_types" + ip_types "go.fd.io/govpp/binapi/ip_types" + codec "go.fd.io/govpp/codec" ) // This is a compile-time assertion to ensure that this generated file @@ -28,9 +28,79 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "pppoe" APIVersion = "2.0.0" - VersionCrc = 0x24ebf557 + VersionCrc = 0xec9e86bf ) +// PppoeAddDelCp defines message 'pppoe_add_del_cp'. +type PppoeAddDelCp struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` +} + +func (m *PppoeAddDelCp) Reset() { *m = PppoeAddDelCp{} } +func (*PppoeAddDelCp) GetMessageName() string { return "pppoe_add_del_cp" } +func (*PppoeAddDelCp) GetCrcString() string { return "eacd9aaa" } +func (*PppoeAddDelCp) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PppoeAddDelCp) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + return size +} +func (m *PppoeAddDelCp) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(m.IsAdd) + return buf.Bytes(), nil +} +func (m *PppoeAddDelCp) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeUint8() + return nil +} + +// PppoeAddDelCpReply defines message 'pppoe_add_del_cp_reply'. +type PppoeAddDelCpReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PppoeAddDelCpReply) Reset() { *m = PppoeAddDelCpReply{} } +func (*PppoeAddDelCpReply) GetMessageName() string { return "pppoe_add_del_cp_reply" } +func (*PppoeAddDelCpReply) GetCrcString() string { return "e8d4e804" } +func (*PppoeAddDelCpReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PppoeAddDelCpReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *PppoeAddDelCpReply) 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 *PppoeAddDelCpReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // PppoeAddDelSession defines message 'pppoe_add_del_session'. type PppoeAddDelSession struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` @@ -42,7 +112,7 @@ type PppoeAddDelSession struct { func (m *PppoeAddDelSession) Reset() { *m = PppoeAddDelSession{} } func (*PppoeAddDelSession) GetMessageName() string { return "pppoe_add_del_session" } -func (*PppoeAddDelSession) GetCrcString() string { return "46ace853" } +func (*PppoeAddDelSession) GetCrcString() string { return "f6fd759e" } func (*PppoeAddDelSession) GetMessageType() api.MessageType { return api.RequestMessage } @@ -133,7 +203,7 @@ type PppoeSessionDetails struct { func (m *PppoeSessionDetails) Reset() { *m = PppoeSessionDetails{} } func (*PppoeSessionDetails) GetMessageName() string { return "pppoe_session_details" } -func (*PppoeSessionDetails) GetCrcString() string { return "332bc742" } +func (*PppoeSessionDetails) GetCrcString() string { return "4b8e8a4a" } func (*PppoeSessionDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -215,15 +285,19 @@ func (m *PppoeSessionDump) Unmarshal(b []byte) error { func init() { file_pppoe_binapi_init() } func file_pppoe_binapi_init() { - api.RegisterMessage((*PppoeAddDelSession)(nil), "pppoe_add_del_session_46ace853") + api.RegisterMessage((*PppoeAddDelCp)(nil), "pppoe_add_del_cp_eacd9aaa") + api.RegisterMessage((*PppoeAddDelCpReply)(nil), "pppoe_add_del_cp_reply_e8d4e804") + api.RegisterMessage((*PppoeAddDelSession)(nil), "pppoe_add_del_session_f6fd759e") api.RegisterMessage((*PppoeAddDelSessionReply)(nil), "pppoe_add_del_session_reply_5383d31f") - api.RegisterMessage((*PppoeSessionDetails)(nil), "pppoe_session_details_332bc742") + api.RegisterMessage((*PppoeSessionDetails)(nil), "pppoe_session_details_4b8e8a4a") api.RegisterMessage((*PppoeSessionDump)(nil), "pppoe_session_dump_f9e6675e") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*PppoeAddDelCp)(nil), + (*PppoeAddDelCpReply)(nil), (*PppoeAddDelSession)(nil), (*PppoeAddDelSessionReply)(nil), (*PppoeSessionDetails)(nil), diff --git a/binapi/pppoe/pppoe_rest.ba.go b/binapi/pppoe/pppoe_rest.ba.go deleted file mode 100644 index 6b01227..0000000 --- a/binapi/pppoe/pppoe_rest.ba.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pppoe - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pppoe_add_del_session", func(w http.ResponseWriter, req *http.Request) { - var request = new(PppoeAddDelSession) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PppoeAddDelSession(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/pppoe/pppoe_rpc.ba.go b/binapi/pppoe/pppoe_rpc.ba.go index 384d5a8..e743c58 100644 --- a/binapi/pppoe/pppoe_rpc.ba.go +++ b/binapi/pppoe/pppoe_rpc.ba.go @@ -5,13 +5,15 @@ package pppoe import ( "context" "fmt" - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" "io" + + api "go.fd.io/govpp/api" + memclnt "go.fd.io/govpp/binapi/memclnt" ) -// RPCService defines RPC service pppoe. +// RPCService defines RPC service pppoe. type RPCService interface { + PppoeAddDelCp(ctx context.Context, in *PppoeAddDelCp) (*PppoeAddDelCpReply, error) PppoeAddDelSession(ctx context.Context, in *PppoeAddDelSession) (*PppoeAddDelSessionReply, error) PppoeSessionDump(ctx context.Context, in *PppoeSessionDump) (RPCService_PppoeSessionDumpClient, error) } @@ -24,13 +26,22 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) PppoeAddDelCp(ctx context.Context, in *PppoeAddDelCp) (*PppoeAddDelCpReply, error) { + out := new(PppoeAddDelCpReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) PppoeAddDelSession(ctx context.Context, in *PppoeAddDelSession) (*PppoeAddDelSessionReply, error) { out := new(PppoeAddDelSessionReply) err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PppoeSessionDump(ctx context.Context, in *PppoeSessionDump) (RPCService_PppoeSessionDumpClient, error) { @@ -42,7 +53,7 @@ func (c *serviceClient) PppoeSessionDump(ctx context.Context, in *PppoeSessionDu 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 @@ -65,7 +76,11 @@ func (c *serviceClient_PppoeSessionDumpClient) Recv() (*PppoeSessionDetails, err switch m := msg.(type) { case *PppoeSessionDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: + err = c.Stream.Close() + if err != nil { + return nil, err + } return nil, io.EOF default: return nil, fmt.Errorf("unexpected message: %T %v", m, m) |