aboutsummaryrefslogtreecommitdiffstats
path: root/binapi/policer
diff options
context:
space:
mode:
Diffstat (limited to 'binapi/policer')
-rw-r--r--binapi/policer/policer.ba.go179
-rw-r--r--binapi/policer/policer_rest.ba.go37
-rw-r--r--binapi/policer/policer_rpc.ba.go37
3 files changed, 199 insertions, 54 deletions
diff --git a/binapi/policer/policer.ba.go b/binapi/policer/policer.ba.go
index 1314dce..e3c0a07 100644
--- a/binapi/policer/policer.ba.go
+++ b/binapi/policer/policer.ba.go
@@ -1,20 +1,21 @@
// 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/core/policer.api.json
// Package policer contains generated bindings for API file policer.api.
//
// Contents:
-// 4 messages
+// 8 messages
//
package policer
import (
- api "git.fd.io/govpp.git/api"
- policer_types "git.fd.io/govpp.git/binapi/policer_types"
- codec "git.fd.io/govpp.git/codec"
+ api "go.fd.io/govpp/api"
+ interface_types "go.fd.io/govpp/binapi/interface_types"
+ policer_types "go.fd.io/govpp/binapi/policer_types"
+ codec "go.fd.io/govpp/codec"
)
// This is a compile-time assertion to ensure that this generated file
@@ -26,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2
const (
APIFile = "policer"
APIVersion = "2.0.0"
- VersionCrc = 0xd9188811
+ VersionCrc = 0xf14848c
)
// PolicerAddDel defines message 'policer_add_del'.
@@ -48,7 +49,7 @@ type PolicerAddDel struct {
func (m *PolicerAddDel) Reset() { *m = PolicerAddDel{} }
func (*PolicerAddDel) GetMessageName() string { return "policer_add_del" }
-func (*PolicerAddDel) GetCrcString() string { return "cb948f6e" }
+func (*PolicerAddDel) GetCrcString() string { return "2b31dd38" }
func (*PolicerAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
@@ -156,6 +157,80 @@ func (m *PolicerAddDelReply) Unmarshal(b []byte) error {
return nil
}
+// PolicerBind defines message 'policer_bind'.
+type PolicerBind struct {
+ Name string `binapi:"string[64],name=name" json:"name,omitempty"`
+ WorkerIndex uint32 `binapi:"u32,name=worker_index" json:"worker_index,omitempty"`
+ BindEnable bool `binapi:"bool,name=bind_enable" json:"bind_enable,omitempty"`
+}
+
+func (m *PolicerBind) Reset() { *m = PolicerBind{} }
+func (*PolicerBind) GetMessageName() string { return "policer_bind" }
+func (*PolicerBind) GetCrcString() string { return "dcf516f9" }
+func (*PolicerBind) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *PolicerBind) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 64 // m.Name
+ size += 4 // m.WorkerIndex
+ size += 1 // m.BindEnable
+ return size
+}
+func (m *PolicerBind) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeString(m.Name, 64)
+ buf.EncodeUint32(m.WorkerIndex)
+ buf.EncodeBool(m.BindEnable)
+ return buf.Bytes(), nil
+}
+func (m *PolicerBind) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Name = buf.DecodeString(64)
+ m.WorkerIndex = buf.DecodeUint32()
+ m.BindEnable = buf.DecodeBool()
+ return nil
+}
+
+// PolicerBindReply defines message 'policer_bind_reply'.
+type PolicerBindReply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *PolicerBindReply) Reset() { *m = PolicerBindReply{} }
+func (*PolicerBindReply) GetMessageName() string { return "policer_bind_reply" }
+func (*PolicerBindReply) GetCrcString() string { return "e8d4e804" }
+func (*PolicerBindReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *PolicerBindReply) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.Retval
+ return size
+}
+func (m *PolicerBindReply) 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 *PolicerBindReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = buf.DecodeInt32()
+ return nil
+}
+
// PolicerDetails defines message 'policer_details'.
type PolicerDetails struct {
Name string `binapi:"string[64],name=name" json:"name,omitempty"`
@@ -183,7 +258,7 @@ type PolicerDetails struct {
func (m *PolicerDetails) Reset() { *m = PolicerDetails{} }
func (*PolicerDetails) GetMessageName() string { return "policer_details" }
-func (*PolicerDetails) GetCrcString() string { return "a43f781a" }
+func (*PolicerDetails) GetCrcString() string { return "72d0e248" }
func (*PolicerDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
@@ -315,12 +390,90 @@ func (m *PolicerDump) Unmarshal(b []byte) error {
return nil
}
+// PolicerInput defines message 'policer_input'.
+type PolicerInput struct {
+ Name string `binapi:"string[64],name=name" json:"name,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
+ Apply bool `binapi:"bool,name=apply" json:"apply,omitempty"`
+}
+
+func (m *PolicerInput) Reset() { *m = PolicerInput{} }
+func (*PolicerInput) GetMessageName() string { return "policer_input" }
+func (*PolicerInput) GetCrcString() string { return "233f0ef5" }
+func (*PolicerInput) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *PolicerInput) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 64 // m.Name
+ size += 4 // m.SwIfIndex
+ size += 1 // m.Apply
+ return size
+}
+func (m *PolicerInput) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeString(m.Name, 64)
+ buf.EncodeUint32(uint32(m.SwIfIndex))
+ buf.EncodeBool(m.Apply)
+ return buf.Bytes(), nil
+}
+func (m *PolicerInput) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Name = buf.DecodeString(64)
+ m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
+ m.Apply = buf.DecodeBool()
+ return nil
+}
+
+// PolicerInputReply defines message 'policer_input_reply'.
+type PolicerInputReply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *PolicerInputReply) Reset() { *m = PolicerInputReply{} }
+func (*PolicerInputReply) GetMessageName() string { return "policer_input_reply" }
+func (*PolicerInputReply) GetCrcString() string { return "e8d4e804" }
+func (*PolicerInputReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *PolicerInputReply) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.Retval
+ return size
+}
+func (m *PolicerInputReply) 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 *PolicerInputReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = buf.DecodeInt32()
+ return nil
+}
+
func init() { file_policer_binapi_init() }
func file_policer_binapi_init() {
- api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_cb948f6e")
+ api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_2b31dd38")
api.RegisterMessage((*PolicerAddDelReply)(nil), "policer_add_del_reply_a177cef2")
- api.RegisterMessage((*PolicerDetails)(nil), "policer_details_a43f781a")
+ api.RegisterMessage((*PolicerBind)(nil), "policer_bind_dcf516f9")
+ api.RegisterMessage((*PolicerBindReply)(nil), "policer_bind_reply_e8d4e804")
+ api.RegisterMessage((*PolicerDetails)(nil), "policer_details_72d0e248")
api.RegisterMessage((*PolicerDump)(nil), "policer_dump_35f1ae0f")
+ api.RegisterMessage((*PolicerInput)(nil), "policer_input_233f0ef5")
+ api.RegisterMessage((*PolicerInputReply)(nil), "policer_input_reply_e8d4e804")
}
// Messages returns list of all messages in this module.
@@ -328,7 +481,11 @@ func AllMessages() []api.Message {
return []api.Message{
(*PolicerAddDel)(nil),
(*PolicerAddDelReply)(nil),
+ (*PolicerBind)(nil),
+ (*PolicerBindReply)(nil),
(*PolicerDetails)(nil),
(*PolicerDump)(nil),
+ (*PolicerInput)(nil),
+ (*PolicerInputReply)(nil),
}
}
diff --git a/binapi/policer/policer_rest.ba.go b/binapi/policer/policer_rest.ba.go
deleted file mode 100644
index e53e42d..0000000
--- a/binapi/policer/policer_rest.ba.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
-
-package policer
-
-import (
- "encoding/json"
- "io/ioutil"
- "net/http"
-)
-
-func RESTHandler(rpc RPCService) http.Handler {
- mux := http.NewServeMux()
- mux.HandleFunc("/policer_add_del", func(w http.ResponseWriter, req *http.Request) {
- var request = new(PolicerAddDel)
- 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.PolicerAddDel(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/policer/policer_rpc.ba.go b/binapi/policer/policer_rpc.ba.go
index 9a7d8bf..8002bc0 100644
--- a/binapi/policer/policer_rpc.ba.go
+++ b/binapi/policer/policer_rpc.ba.go
@@ -5,15 +5,18 @@ package policer
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 policer.
+// RPCService defines RPC service policer.
type RPCService interface {
PolicerAddDel(ctx context.Context, in *PolicerAddDel) (*PolicerAddDelReply, error)
+ PolicerBind(ctx context.Context, in *PolicerBind) (*PolicerBindReply, error)
PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error)
+ PolicerInput(ctx context.Context, in *PolicerInput) (*PolicerInputReply, error)
}
type serviceClient struct {
@@ -30,7 +33,16 @@ func (c *serviceClient) PolicerAddDel(ctx context.Context, in *PolicerAddDel) (*
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
+}
+
+func (c *serviceClient) PolicerBind(ctx context.Context, in *PolicerBind) (*PolicerBindReply, error) {
+ out := new(PolicerBindReply)
+ err := c.conn.Invoke(ctx, in, out)
+ if err != nil {
+ return nil, err
+ }
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error) {
@@ -42,7 +54,7 @@ func (c *serviceClient) PolicerDump(ctx context.Context, in *PolicerDump) (RPCSe
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,9 +77,22 @@ func (c *serviceClient_PolicerDumpClient) Recv() (*PolicerDetails, error) {
switch m := msg.(type) {
case *PolicerDetails:
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)
}
}
+
+func (c *serviceClient) PolicerInput(ctx context.Context, in *PolicerInput) (*PolicerInputReply, error) {
+ out := new(PolicerInputReply)
+ err := c.conn.Invoke(ctx, in, out)
+ if err != nil {
+ return nil, err
+ }
+ return out, api.RetvalToVPPApiError(out.Retval)
+}