aboutsummaryrefslogtreecommitdiffstats
path: root/binapi/udp
diff options
context:
space:
mode:
Diffstat (limited to 'binapi/udp')
-rw-r--r--binapi/udp/udp.ba.go144
-rw-r--r--binapi/udp/udp_rest.ba.go60
-rw-r--r--binapi/udp/udp_rpc.ba.go29
3 files changed, 154 insertions, 79 deletions
diff --git a/binapi/udp/udp.ba.go b/binapi/udp/udp.ba.go
index 7795100..b1a51d1 100644
--- a/binapi/udp/udp.ba.go
+++ b/binapi/udp/udp.ba.go
@@ -1,21 +1,24 @@
// 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/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 (
- api "git.fd.io/govpp.git/api"
- ip_types "git.fd.io/govpp.git/binapi/ip_types"
- codec "git.fd.io/govpp.git/codec"
+ "strconv"
+
+ api "go.fd.io/govpp/api"
+ 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
@@ -27,9 +30,46 @@ const _ = api.GoVppAPIPackageIsVersion2
const (
APIFile = "udp"
APIVersion = "1.1.0"
- VersionCrc = 0xb827bf4f
+ 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"`
@@ -47,7 +163,7 @@ type UDPEncapAdd struct {
func (m *UDPEncapAdd) Reset() { *m = UDPEncapAdd{} }
func (*UDPEncapAdd) GetMessageName() string { return "udp_encap_add" }
-func (*UDPEncapAdd) GetCrcString() string { return "61d5fc48" }
+func (*UDPEncapAdd) GetCrcString() string { return "f74a60b1" }
func (*UDPEncapAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
@@ -204,7 +320,7 @@ type UDPEncapDetails struct {
func (m *UDPEncapDetails) Reset() { *m = UDPEncapDetails{} }
func (*UDPEncapDetails) GetMessageName() string { return "udp_encap_details" }
-func (*UDPEncapDetails) GetCrcString() string { return "87c82821" }
+func (*UDPEncapDetails) GetCrcString() string { return "8cfb9c76" }
func (*UDPEncapDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
@@ -280,17 +396,21 @@ func (m *UDPEncapDump) Unmarshal(b []byte) error {
func init() { file_udp_binapi_init() }
func file_udp_binapi_init() {
- api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_61d5fc48")
+ 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")
api.RegisterMessage((*UDPEncapDelReply)(nil), "udp_encap_del_reply_e8d4e804")
- api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_87c82821")
+ api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_8cfb9c76")
api.RegisterMessage((*UDPEncapDump)(nil), "udp_encap_dump_51077d14")
}
// 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_rest.ba.go b/binapi/udp/udp_rest.ba.go
deleted file mode 100644
index fc584bb..0000000
--- a/binapi/udp/udp_rest.ba.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
-
-package udp
-
-import (
- "encoding/json"
- "io/ioutil"
- "net/http"
-)
-
-func RESTHandler(rpc RPCService) http.Handler {
- mux := http.NewServeMux()
- mux.HandleFunc("/udp_encap_add", func(w http.ResponseWriter, req *http.Request) {
- var request = new(UDPEncapAdd)
- 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.UDPEncapAdd(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)
- })
- mux.HandleFunc("/udp_encap_del", func(w http.ResponseWriter, req *http.Request) {
- var request = new(UDPEncapDel)
- 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.UDPEncapDel(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/udp/udp_rpc.ba.go b/binapi/udp/udp_rpc.ba.go
index adb495c..5a7a2e8 100644
--- a/binapi/udp/udp_rpc.ba.go
+++ b/binapi/udp/udp_rpc.ba.go
@@ -5,13 +5,15 @@ package udp
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 udp.
+// 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)
@@ -25,13 +27,22 @@ 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)
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPEncapDelReply, error) {
@@ -40,7 +51,7 @@ func (c *serviceClient) UDPEncapDel(ctx context.Context, in *UDPEncapDel) (*UDPE
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) UDPEncapDump(ctx context.Context, in *UDPEncapDump) (RPCService_UDPEncapDumpClient, error) {
@@ -52,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
@@ -75,7 +86,11 @@ 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
+ }
return nil, io.EOF
default:
return nil, fmt.Errorf("unexpected message: %T %v", m, m)