aboutsummaryrefslogtreecommitdiffstats
path: root/binapi/policer
diff options
context:
space:
mode:
Diffstat (limited to 'binapi/policer')
-rw-r--r--binapi/policer/policer.ba.go346
-rw-r--r--binapi/policer/policer_rest.ba.go37
-rw-r--r--binapi/policer/policer_rpc.ba.go73
3 files changed, 456 insertions, 0 deletions
diff --git a/binapi/policer/policer.ba.go b/binapi/policer/policer.ba.go
new file mode 100644
index 0000000..f529a38
--- /dev/null
+++ b/binapi/policer/policer.ba.go
@@ -0,0 +1,346 @@
+// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
+// versions:
+// binapi-generator: v0.4.0-dev
+// VPP: 20.05-release
+// source: /usr/share/vpp/api/core/policer.api.json
+
+// Package policer contains generated bindings for API file policer.api.
+//
+// Contents:
+// 4 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"
+)
+
+// 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.GoVppAPIPackageIsVersion2
+
+const (
+ APIFile = "policer"
+ APIVersion = "2.0.0"
+ VersionCrc = 0xd9188811
+)
+
+// PolicerAddDel defines message 'policer_add_del'.
+type PolicerAddDel struct {
+ IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
+ Name string `binapi:"string[64],name=name" json:"name,omitempty"`
+ Cir uint32 `binapi:"u32,name=cir" json:"cir,omitempty"`
+ Eir uint32 `binapi:"u32,name=eir" json:"eir,omitempty"`
+ Cb uint64 `binapi:"u64,name=cb" json:"cb,omitempty"`
+ Eb uint64 `binapi:"u64,name=eb" json:"eb,omitempty"`
+ RateType policer_types.Sse2QosRateType `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"`
+ RoundType policer_types.Sse2QosRoundType `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"`
+ Type policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"`
+ ColorAware bool `binapi:"bool,name=color_aware" json:"color_aware,omitempty"`
+ ConformAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"`
+ ExceedAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"`
+ ViolateAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"`
+}
+
+func (m *PolicerAddDel) Reset() { *m = PolicerAddDel{} }
+func (*PolicerAddDel) GetMessageName() string { return "policer_add_del" }
+func (*PolicerAddDel) GetCrcString() string { return "cb948f6e" }
+func (*PolicerAddDel) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *PolicerAddDel) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 1 // m.IsAdd
+ size += 64 // m.Name
+ size += 4 // m.Cir
+ size += 4 // m.Eir
+ size += 8 // m.Cb
+ size += 8 // m.Eb
+ size += 1 // m.RateType
+ size += 1 // m.RoundType
+ size += 1 // m.Type
+ size += 1 // m.ColorAware
+ size += 1 // m.ConformAction.Type
+ size += 1 // m.ConformAction.Dscp
+ size += 1 // m.ExceedAction.Type
+ size += 1 // m.ExceedAction.Dscp
+ size += 1 // m.ViolateAction.Type
+ size += 1 // m.ViolateAction.Dscp
+ return size
+}
+func (m *PolicerAddDel) Marshal(b []byte) ([]byte, error) {
+ var buf *codec.Buffer
+ if b == nil {
+ buf = codec.NewBuffer(make([]byte, m.Size()))
+ } else {
+ buf = codec.NewBuffer(b)
+ }
+ buf.EncodeBool(m.IsAdd)
+ buf.EncodeString(m.Name, 64)
+ buf.EncodeUint32(uint32(m.Cir))
+ buf.EncodeUint32(uint32(m.Eir))
+ buf.EncodeUint64(uint64(m.Cb))
+ buf.EncodeUint64(uint64(m.Eb))
+ buf.EncodeUint8(uint8(m.RateType))
+ buf.EncodeUint8(uint8(m.RoundType))
+ buf.EncodeUint8(uint8(m.Type))
+ buf.EncodeBool(m.ColorAware)
+ buf.EncodeUint8(uint8(m.ConformAction.Type))
+ buf.EncodeUint8(uint8(m.ConformAction.Dscp))
+ buf.EncodeUint8(uint8(m.ExceedAction.Type))
+ buf.EncodeUint8(uint8(m.ExceedAction.Dscp))
+ buf.EncodeUint8(uint8(m.ViolateAction.Type))
+ buf.EncodeUint8(uint8(m.ViolateAction.Dscp))
+ return buf.Bytes(), nil
+}
+func (m *PolicerAddDel) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.IsAdd = buf.DecodeBool()
+ m.Name = buf.DecodeString(64)
+ m.Cir = buf.DecodeUint32()
+ m.Eir = buf.DecodeUint32()
+ m.Cb = buf.DecodeUint64()
+ m.Eb = buf.DecodeUint64()
+ m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8())
+ m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8())
+ m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8())
+ m.ColorAware = buf.DecodeBool()
+ m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
+ m.ConformAction.Dscp = buf.DecodeUint8()
+ m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
+ m.ExceedAction.Dscp = buf.DecodeUint8()
+ m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
+ m.ViolateAction.Dscp = buf.DecodeUint8()
+ return nil
+}
+
+// PolicerAddDelReply defines message 'policer_add_del_reply'.
+type PolicerAddDelReply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+ PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"`
+}
+
+func (m *PolicerAddDelReply) Reset() { *m = PolicerAddDelReply{} }
+func (*PolicerAddDelReply) GetMessageName() string { return "policer_add_del_reply" }
+func (*PolicerAddDelReply) GetCrcString() string { return "a177cef2" }
+func (*PolicerAddDelReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *PolicerAddDelReply) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 4 // m.Retval
+ size += 4 // m.PolicerIndex
+ return size
+}
+func (m *PolicerAddDelReply) Marshal(b []byte) ([]byte, error) {
+ var buf *codec.Buffer
+ if b == nil {
+ buf = codec.NewBuffer(make([]byte, m.Size()))
+ } else {
+ buf = codec.NewBuffer(b)
+ }
+ buf.EncodeUint32(uint32(m.Retval))
+ buf.EncodeUint32(uint32(m.PolicerIndex))
+ return buf.Bytes(), nil
+}
+func (m *PolicerAddDelReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = int32(buf.DecodeUint32())
+ m.PolicerIndex = buf.DecodeUint32()
+ return nil
+}
+
+// PolicerDetails defines message 'policer_details'.
+type PolicerDetails struct {
+ Name string `binapi:"string[64],name=name" json:"name,omitempty"`
+ Cir uint32 `binapi:"u32,name=cir" json:"cir,omitempty"`
+ Eir uint32 `binapi:"u32,name=eir" json:"eir,omitempty"`
+ Cb uint64 `binapi:"u64,name=cb" json:"cb,omitempty"`
+ Eb uint64 `binapi:"u64,name=eb" json:"eb,omitempty"`
+ RateType policer_types.Sse2QosRateType `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"`
+ RoundType policer_types.Sse2QosRoundType `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"`
+ Type policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"`
+ ConformAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"`
+ ExceedAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"`
+ ViolateAction policer_types.Sse2QosAction `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"`
+ SingleRate bool `binapi:"bool,name=single_rate" json:"single_rate,omitempty"`
+ ColorAware bool `binapi:"bool,name=color_aware" json:"color_aware,omitempty"`
+ Scale uint32 `binapi:"u32,name=scale" json:"scale,omitempty"`
+ CirTokensPerPeriod uint32 `binapi:"u32,name=cir_tokens_per_period" json:"cir_tokens_per_period,omitempty"`
+ PirTokensPerPeriod uint32 `binapi:"u32,name=pir_tokens_per_period" json:"pir_tokens_per_period,omitempty"`
+ CurrentLimit uint32 `binapi:"u32,name=current_limit" json:"current_limit,omitempty"`
+ CurrentBucket uint32 `binapi:"u32,name=current_bucket" json:"current_bucket,omitempty"`
+ ExtendedLimit uint32 `binapi:"u32,name=extended_limit" json:"extended_limit,omitempty"`
+ ExtendedBucket uint32 `binapi:"u32,name=extended_bucket" json:"extended_bucket,omitempty"`
+ LastUpdateTime uint64 `binapi:"u64,name=last_update_time" json:"last_update_time,omitempty"`
+}
+
+func (m *PolicerDetails) Reset() { *m = PolicerDetails{} }
+func (*PolicerDetails) GetMessageName() string { return "policer_details" }
+func (*PolicerDetails) GetCrcString() string { return "a43f781a" }
+func (*PolicerDetails) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *PolicerDetails) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 64 // m.Name
+ size += 4 // m.Cir
+ size += 4 // m.Eir
+ size += 8 // m.Cb
+ size += 8 // m.Eb
+ size += 1 // m.RateType
+ size += 1 // m.RoundType
+ size += 1 // m.Type
+ size += 1 // m.ConformAction.Type
+ size += 1 // m.ConformAction.Dscp
+ size += 1 // m.ExceedAction.Type
+ size += 1 // m.ExceedAction.Dscp
+ size += 1 // m.ViolateAction.Type
+ size += 1 // m.ViolateAction.Dscp
+ size += 1 // m.SingleRate
+ size += 1 // m.ColorAware
+ size += 4 // m.Scale
+ size += 4 // m.CirTokensPerPeriod
+ size += 4 // m.PirTokensPerPeriod
+ size += 4 // m.CurrentLimit
+ size += 4 // m.CurrentBucket
+ size += 4 // m.ExtendedLimit
+ size += 4 // m.ExtendedBucket
+ size += 8 // m.LastUpdateTime
+ return size
+}
+func (m *PolicerDetails) Marshal(b []byte) ([]byte, error) {
+ var buf *codec.Buffer
+ if b == nil {
+ buf = codec.NewBuffer(make([]byte, m.Size()))
+ } else {
+ buf = codec.NewBuffer(b)
+ }
+ buf.EncodeString(m.Name, 64)
+ buf.EncodeUint32(uint32(m.Cir))
+ buf.EncodeUint32(uint32(m.Eir))
+ buf.EncodeUint64(uint64(m.Cb))
+ buf.EncodeUint64(uint64(m.Eb))
+ buf.EncodeUint8(uint8(m.RateType))
+ buf.EncodeUint8(uint8(m.RoundType))
+ buf.EncodeUint8(uint8(m.Type))
+ buf.EncodeUint8(uint8(m.ConformAction.Type))
+ buf.EncodeUint8(uint8(m.ConformAction.Dscp))
+ buf.EncodeUint8(uint8(m.ExceedAction.Type))
+ buf.EncodeUint8(uint8(m.ExceedAction.Dscp))
+ buf.EncodeUint8(uint8(m.ViolateAction.Type))
+ buf.EncodeUint8(uint8(m.ViolateAction.Dscp))
+ buf.EncodeBool(m.SingleRate)
+ buf.EncodeBool(m.ColorAware)
+ buf.EncodeUint32(uint32(m.Scale))
+ buf.EncodeUint32(uint32(m.CirTokensPerPeriod))
+ buf.EncodeUint32(uint32(m.PirTokensPerPeriod))
+ buf.EncodeUint32(uint32(m.CurrentLimit))
+ buf.EncodeUint32(uint32(m.CurrentBucket))
+ buf.EncodeUint32(uint32(m.ExtendedLimit))
+ buf.EncodeUint32(uint32(m.ExtendedBucket))
+ buf.EncodeUint64(uint64(m.LastUpdateTime))
+ return buf.Bytes(), nil
+}
+func (m *PolicerDetails) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Name = buf.DecodeString(64)
+ m.Cir = buf.DecodeUint32()
+ m.Eir = buf.DecodeUint32()
+ m.Cb = buf.DecodeUint64()
+ m.Eb = buf.DecodeUint64()
+ m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8())
+ m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8())
+ m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8())
+ m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
+ m.ConformAction.Dscp = buf.DecodeUint8()
+ m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
+ m.ExceedAction.Dscp = buf.DecodeUint8()
+ m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
+ m.ViolateAction.Dscp = buf.DecodeUint8()
+ m.SingleRate = buf.DecodeBool()
+ m.ColorAware = buf.DecodeBool()
+ m.Scale = buf.DecodeUint32()
+ m.CirTokensPerPeriod = buf.DecodeUint32()
+ m.PirTokensPerPeriod = buf.DecodeUint32()
+ m.CurrentLimit = buf.DecodeUint32()
+ m.CurrentBucket = buf.DecodeUint32()
+ m.ExtendedLimit = buf.DecodeUint32()
+ m.ExtendedBucket = buf.DecodeUint32()
+ m.LastUpdateTime = buf.DecodeUint64()
+ return nil
+}
+
+// PolicerDump defines message 'policer_dump'.
+type PolicerDump struct {
+ MatchNameValid bool `binapi:"bool,name=match_name_valid" json:"match_name_valid,omitempty"`
+ MatchName string `binapi:"string[64],name=match_name" json:"match_name,omitempty"`
+}
+
+func (m *PolicerDump) Reset() { *m = PolicerDump{} }
+func (*PolicerDump) GetMessageName() string { return "policer_dump" }
+func (*PolicerDump) GetCrcString() string { return "35f1ae0f" }
+func (*PolicerDump) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *PolicerDump) Size() int {
+ if m == nil {
+ return 0
+ }
+ var size int
+ size += 1 // m.MatchNameValid
+ size += 64 // m.MatchName
+ return size
+}
+func (m *PolicerDump) Marshal(b []byte) ([]byte, error) {
+ var buf *codec.Buffer
+ if b == nil {
+ buf = codec.NewBuffer(make([]byte, m.Size()))
+ } else {
+ buf = codec.NewBuffer(b)
+ }
+ buf.EncodeBool(m.MatchNameValid)
+ buf.EncodeString(m.MatchName, 64)
+ return buf.Bytes(), nil
+}
+func (m *PolicerDump) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.MatchNameValid = buf.DecodeBool()
+ m.MatchName = buf.DecodeString(64)
+ return nil
+}
+
+func init() { file_policer_binapi_init() }
+func file_policer_binapi_init() {
+ api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_cb948f6e")
+ api.RegisterMessage((*PolicerAddDelReply)(nil), "policer_add_del_reply_a177cef2")
+ api.RegisterMessage((*PolicerDetails)(nil), "policer_details_a43f781a")
+ api.RegisterMessage((*PolicerDump)(nil), "policer_dump_35f1ae0f")
+}
+
+// Messages returns list of all messages in this module.
+func AllMessages() []api.Message {
+ return []api.Message{
+ (*PolicerAddDel)(nil),
+ (*PolicerAddDelReply)(nil),
+ (*PolicerDetails)(nil),
+ (*PolicerDump)(nil),
+ }
+}
diff --git a/binapi/policer/policer_rest.ba.go b/binapi/policer/policer_rest.ba.go
new file mode 100644
index 0000000..e53e42d
--- /dev/null
+++ b/binapi/policer/policer_rest.ba.go
@@ -0,0 +1,37 @@
+// 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
new file mode 100644
index 0000000..9a7d8bf
--- /dev/null
+++ b/binapi/policer/policer_rpc.ba.go
@@ -0,0 +1,73 @@
+// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
+
+package policer
+
+import (
+ "context"
+ "fmt"
+ api "git.fd.io/govpp.git/api"
+ vpe "git.fd.io/govpp.git/binapi/vpe"
+ "io"
+)
+
+// RPCService defines RPC service policer.
+type RPCService interface {
+ PolicerAddDel(ctx context.Context, in *PolicerAddDel) (*PolicerAddDelReply, error)
+ PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error)
+}
+
+type serviceClient struct {
+ conn api.Connection
+}
+
+func NewServiceClient(conn api.Connection) RPCService {
+ return &serviceClient{conn}
+}
+
+func (c *serviceClient) PolicerAddDel(ctx context.Context, in *PolicerAddDel) (*PolicerAddDelReply, error) {
+ out := new(PolicerAddDelReply)
+ err := c.conn.Invoke(ctx, in, out)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *serviceClient) PolicerDump(ctx context.Context, in *PolicerDump) (RPCService_PolicerDumpClient, error) {
+ stream, err := c.conn.NewStream(ctx)
+ if err != nil {
+ return nil, err
+ }
+ x := &serviceClient_PolicerDumpClient{stream}
+ if err := x.Stream.SendMsg(in); err != nil {
+ return nil, err
+ }
+ if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
+ return nil, err
+ }
+ return x, nil
+}
+
+type RPCService_PolicerDumpClient interface {
+ Recv() (*PolicerDetails, error)
+ api.Stream
+}
+
+type serviceClient_PolicerDumpClient struct {
+ api.Stream
+}
+
+func (c *serviceClient_PolicerDumpClient) Recv() (*PolicerDetails, error) {
+ msg, err := c.Stream.RecvMsg()
+ if err != nil {
+ return nil, err
+ }
+ switch m := msg.(type) {
+ case *PolicerDetails:
+ return m, nil
+ case *vpe.ControlPingReply:
+ return nil, io.EOF
+ default:
+ return nil, fmt.Errorf("unexpected message: %T %v", m, m)
+ }
+}