diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2022-04-27 18:39:03 +0200 |
---|---|---|
committer | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2022-05-30 18:49:13 +0200 |
commit | 4102c72bce694babd94a481b1201d33895a6f9c5 (patch) | |
tree | 1b11238ca4706008c88712f26942dd74ab9c14a6 /binapi/wireguard | |
parent | a4112fac7b86fe09650d2bb57969fe46404edd7d (diff) |
Update generated binapi to v22.02 & makefile changes
This patch does some small updates to the Makefile.
* `make gen-binapi-from-code` is removed, and moves to
`gen-binapi-local`
* `make build` is patched to build cmd & examples
* `make binapi-generator` to build the api-generator
without other binaries, as they typically require its
output to build.
* `make gen-binapi-local` runs the locally built binapi-generator
to update the local bindings. It expects ${VPP_DIR} to be set and
to point to a local vpp repository checked out with the right version
* `make gen-binapi-internal` runs the locally built binapi-generator
to update the bindings in `internal/testbinapi/binapi2001`
Regarding VPP, notable changes when moving to v22.02 are :
- ControlPing moved from vpe to memclnt
- CliInband went from vpe to vlib
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Change-Id: Ie5cd2d5ded7ecaffd9abc3ca675df40be272b1fa
Diffstat (limited to 'binapi/wireguard')
-rw-r--r-- | binapi/wireguard/wireguard.ba.go | 231 | ||||
-rw-r--r-- | binapi/wireguard/wireguard_rpc.ba.go | 30 |
2 files changed, 246 insertions, 15 deletions
diff --git a/binapi/wireguard/wireguard.ba.go b/binapi/wireguard/wireguard.ba.go index 8bfd735..01a9375 100644 --- a/binapi/wireguard/wireguard.ba.go +++ b/binapi/wireguard/wireguard.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: // binapi-generator: v0.5.0-dev -// VPP: 21.06-release +// VPP: 22.02-release // source: /usr/share/vpp/api/plugins/wireguard.api.json // Package wireguard contains generated bindings for API file wireguard.api. @@ -9,7 +9,7 @@ // Contents: // 1 enum // 2 structs -// 12 messages +// 17 messages // package wireguard @@ -31,7 +31,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "wireguard" APIVersion = "0.1.0" - VersionCrc = 0x1e1d4252 + VersionCrc = 0xb58de7e ) // WireguardPeerFlags defines enum 'wireguard_peer_flags'. @@ -39,14 +39,17 @@ type WireguardPeerFlags uint8 const ( WIREGUARD_PEER_STATUS_DEAD WireguardPeerFlags = 1 + WIREGUARD_PEER_ESTABLISHED WireguardPeerFlags = 2 ) var ( WireguardPeerFlags_name = map[uint8]string{ 1: "WIREGUARD_PEER_STATUS_DEAD", + 2: "WIREGUARD_PEER_ESTABLISHED", } WireguardPeerFlags_value = map[string]uint8{ "WIREGUARD_PEER_STATUS_DEAD": 1, + "WIREGUARD_PEER_ESTABLISHED": 2, } ) @@ -100,6 +103,156 @@ type WireguardPeer struct { AllowedIps []ip_types.Prefix `binapi:"prefix[n_allowed_ips],name=allowed_ips" json:"allowed_ips,omitempty"` } +// WantWireguardPeerEvents defines message 'want_wireguard_peer_events'. +// InProgress: the message form may change in the future versions +type WantWireguardPeerEvents struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + PeerIndex uint32 `binapi:"u32,name=peer_index,default=4294967295" json:"peer_index,omitempty"` + EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantWireguardPeerEvents) Reset() { *m = WantWireguardPeerEvents{} } +func (*WantWireguardPeerEvents) GetMessageName() string { return "want_wireguard_peer_events" } +func (*WantWireguardPeerEvents) GetCrcString() string { return "3bc666c8" } +func (*WantWireguardPeerEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantWireguardPeerEvents) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.PeerIndex + size += 4 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantWireguardPeerEvents) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(m.PeerIndex) + buf.EncodeUint32(m.EnableDisable) + buf.EncodeUint32(m.PID) + return buf.Bytes(), nil +} +func (m *WantWireguardPeerEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.PeerIndex = buf.DecodeUint32() + m.EnableDisable = buf.DecodeUint32() + m.PID = buf.DecodeUint32() + return nil +} + +// WantWireguardPeerEventsReply defines message 'want_wireguard_peer_events_reply'. +// InProgress: the message form may change in the future versions +type WantWireguardPeerEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantWireguardPeerEventsReply) Reset() { *m = WantWireguardPeerEventsReply{} } +func (*WantWireguardPeerEventsReply) GetMessageName() string { + return "want_wireguard_peer_events_reply" +} +func (*WantWireguardPeerEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantWireguardPeerEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantWireguardPeerEventsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WantWireguardPeerEventsReply) 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 *WantWireguardPeerEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// WgSetAsyncMode defines message 'wg_set_async_mode'. +// InProgress: the message form may change in the future versions +type WgSetAsyncMode struct { + AsyncEnable bool `binapi:"bool,name=async_enable" json:"async_enable,omitempty"` +} + +func (m *WgSetAsyncMode) Reset() { *m = WgSetAsyncMode{} } +func (*WgSetAsyncMode) GetMessageName() string { return "wg_set_async_mode" } +func (*WgSetAsyncMode) GetCrcString() string { return "a6465f7c" } +func (*WgSetAsyncMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WgSetAsyncMode) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.AsyncEnable + return size +} +func (m *WgSetAsyncMode) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.AsyncEnable) + return buf.Bytes(), nil +} +func (m *WgSetAsyncMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.AsyncEnable = buf.DecodeBool() + return nil +} + +// WgSetAsyncModeReply defines message 'wg_set_async_mode_reply'. +// InProgress: the message form may change in the future versions +type WgSetAsyncModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WgSetAsyncModeReply) Reset() { *m = WgSetAsyncModeReply{} } +func (*WgSetAsyncModeReply) GetMessageName() string { return "wg_set_async_mode_reply" } +func (*WgSetAsyncModeReply) GetCrcString() string { return "e8d4e804" } +func (*WgSetAsyncModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WgSetAsyncModeReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WgSetAsyncModeReply) 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 *WgSetAsyncModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + // WireguardInterfaceCreate defines message 'wireguard_interface_create'. // InProgress: the message form may change in the future versions type WireguardInterfaceCreate struct { @@ -368,7 +521,7 @@ type WireguardPeerAdd struct { func (m *WireguardPeerAdd) Reset() { *m = WireguardPeerAdd{} } func (*WireguardPeerAdd) GetMessageName() string { return "wireguard_peer_add" } -func (*WireguardPeerAdd) GetCrcString() string { return "ed792326" } +func (*WireguardPeerAdd) GetCrcString() string { return "aedf8d59" } func (*WireguardPeerAdd) GetMessageType() api.MessageType { return api.RequestMessage } @@ -482,6 +635,48 @@ func (m *WireguardPeerAddReply) Unmarshal(b []byte) error { return nil } +// WireguardPeerEvent defines message 'wireguard_peer_event'. +// InProgress: the message form may change in the future versions +type WireguardPeerEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + PeerIndex uint32 `binapi:"u32,name=peer_index" json:"peer_index,omitempty"` + Flags WireguardPeerFlags `binapi:"wireguard_peer_flags,name=flags" json:"flags,omitempty"` +} + +func (m *WireguardPeerEvent) Reset() { *m = WireguardPeerEvent{} } +func (*WireguardPeerEvent) GetMessageName() string { return "wireguard_peer_event" } +func (*WireguardPeerEvent) GetCrcString() string { return "4e1b5d67" } +func (*WireguardPeerEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *WireguardPeerEvent) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PID + size += 4 // m.PeerIndex + size += 1 // m.Flags + return size +} +func (m *WireguardPeerEvent) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PID) + buf.EncodeUint32(m.PeerIndex) + buf.EncodeUint8(uint8(m.Flags)) + return buf.Bytes(), nil +} +func (m *WireguardPeerEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.PeerIndex = buf.DecodeUint32() + m.Flags = WireguardPeerFlags(buf.DecodeUint8()) + return nil +} + // WireguardPeerRemove defines message 'wireguard_peer_remove'. // InProgress: the message form may change in the future versions type WireguardPeerRemove struct { @@ -558,7 +753,7 @@ type WireguardPeersDetails struct { func (m *WireguardPeersDetails) Reset() { *m = WireguardPeersDetails{} } func (*WireguardPeersDetails) GetMessageName() string { return "wireguard_peers_details" } -func (*WireguardPeersDetails) GetCrcString() string { return "2097f740" } +func (*WireguardPeersDetails) GetCrcString() string { return "29269d0e" } func (*WireguardPeersDetails) GetMessageType() api.MessageType { return api.ReplyMessage } @@ -636,11 +831,13 @@ func (m *WireguardPeersDetails) Unmarshal(b []byte) error { // WireguardPeersDump defines message 'wireguard_peers_dump'. // InProgress: the message form may change in the future versions -type WireguardPeersDump struct{} +type WireguardPeersDump struct { + PeerIndex uint32 `binapi:"u32,name=peer_index,default=4294967295" json:"peer_index,omitempty"` +} func (m *WireguardPeersDump) Reset() { *m = WireguardPeersDump{} } func (*WireguardPeersDump) GetMessageName() string { return "wireguard_peers_dump" } -func (*WireguardPeersDump) GetCrcString() string { return "51077d14" } +func (*WireguardPeersDump) GetCrcString() string { return "3b74607a" } func (*WireguardPeersDump) GetMessageType() api.MessageType { return api.RequestMessage } @@ -649,6 +846,7 @@ func (m *WireguardPeersDump) Size() (size int) { if m == nil { return 0 } + size += 4 // m.PeerIndex return size } func (m *WireguardPeersDump) Marshal(b []byte) ([]byte, error) { @@ -656,31 +854,43 @@ func (m *WireguardPeersDump) Marshal(b []byte) ([]byte, error) { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PeerIndex) return buf.Bytes(), nil } func (m *WireguardPeersDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PeerIndex = buf.DecodeUint32() return nil } func init() { file_wireguard_binapi_init() } func file_wireguard_binapi_init() { + api.RegisterMessage((*WantWireguardPeerEvents)(nil), "want_wireguard_peer_events_3bc666c8") + api.RegisterMessage((*WantWireguardPeerEventsReply)(nil), "want_wireguard_peer_events_reply_e8d4e804") + api.RegisterMessage((*WgSetAsyncMode)(nil), "wg_set_async_mode_a6465f7c") + api.RegisterMessage((*WgSetAsyncModeReply)(nil), "wg_set_async_mode_reply_e8d4e804") api.RegisterMessage((*WireguardInterfaceCreate)(nil), "wireguard_interface_create_a530137e") api.RegisterMessage((*WireguardInterfaceCreateReply)(nil), "wireguard_interface_create_reply_5383d31f") api.RegisterMessage((*WireguardInterfaceDelete)(nil), "wireguard_interface_delete_f9e6675e") api.RegisterMessage((*WireguardInterfaceDeleteReply)(nil), "wireguard_interface_delete_reply_e8d4e804") api.RegisterMessage((*WireguardInterfaceDetails)(nil), "wireguard_interface_details_0dd4865d") api.RegisterMessage((*WireguardInterfaceDump)(nil), "wireguard_interface_dump_2c954158") - api.RegisterMessage((*WireguardPeerAdd)(nil), "wireguard_peer_add_ed792326") + api.RegisterMessage((*WireguardPeerAdd)(nil), "wireguard_peer_add_aedf8d59") api.RegisterMessage((*WireguardPeerAddReply)(nil), "wireguard_peer_add_reply_084a0cd3") + api.RegisterMessage((*WireguardPeerEvent)(nil), "wireguard_peer_event_4e1b5d67") api.RegisterMessage((*WireguardPeerRemove)(nil), "wireguard_peer_remove_3b74607a") api.RegisterMessage((*WireguardPeerRemoveReply)(nil), "wireguard_peer_remove_reply_e8d4e804") - api.RegisterMessage((*WireguardPeersDetails)(nil), "wireguard_peers_details_2097f740") - api.RegisterMessage((*WireguardPeersDump)(nil), "wireguard_peers_dump_51077d14") + api.RegisterMessage((*WireguardPeersDetails)(nil), "wireguard_peers_details_29269d0e") + api.RegisterMessage((*WireguardPeersDump)(nil), "wireguard_peers_dump_3b74607a") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ + (*WantWireguardPeerEvents)(nil), + (*WantWireguardPeerEventsReply)(nil), + (*WgSetAsyncMode)(nil), + (*WgSetAsyncModeReply)(nil), (*WireguardInterfaceCreate)(nil), (*WireguardInterfaceCreateReply)(nil), (*WireguardInterfaceDelete)(nil), @@ -689,6 +899,7 @@ func AllMessages() []api.Message { (*WireguardInterfaceDump)(nil), (*WireguardPeerAdd)(nil), (*WireguardPeerAddReply)(nil), + (*WireguardPeerEvent)(nil), (*WireguardPeerRemove)(nil), (*WireguardPeerRemoveReply)(nil), (*WireguardPeersDetails)(nil), diff --git a/binapi/wireguard/wireguard_rpc.ba.go b/binapi/wireguard/wireguard_rpc.ba.go index 9d3a024..7463391 100644 --- a/binapi/wireguard/wireguard_rpc.ba.go +++ b/binapi/wireguard/wireguard_rpc.ba.go @@ -8,11 +8,13 @@ import ( "io" api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" + memclnt "git.fd.io/govpp.git/binapi/memclnt" ) // RPCService defines RPC service wireguard. type RPCService interface { + WantWireguardPeerEvents(ctx context.Context, in *WantWireguardPeerEvents) (*WantWireguardPeerEventsReply, error) + WgSetAsyncMode(ctx context.Context, in *WgSetAsyncMode) (*WgSetAsyncModeReply, error) WireguardInterfaceCreate(ctx context.Context, in *WireguardInterfaceCreate) (*WireguardInterfaceCreateReply, error) WireguardInterfaceDelete(ctx context.Context, in *WireguardInterfaceDelete) (*WireguardInterfaceDeleteReply, error) WireguardInterfaceDump(ctx context.Context, in *WireguardInterfaceDump) (RPCService_WireguardInterfaceDumpClient, error) @@ -29,6 +31,24 @@ func NewServiceClient(conn api.Connection) RPCService { return &serviceClient{conn} } +func (c *serviceClient) WantWireguardPeerEvents(ctx context.Context, in *WantWireguardPeerEvents) (*WantWireguardPeerEventsReply, error) { + out := new(WantWireguardPeerEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + +func (c *serviceClient) WgSetAsyncMode(ctx context.Context, in *WgSetAsyncMode) (*WgSetAsyncModeReply, error) { + out := new(WgSetAsyncModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) WireguardInterfaceCreate(ctx context.Context, in *WireguardInterfaceCreate) (*WireguardInterfaceCreateReply, error) { out := new(WireguardInterfaceCreateReply) err := c.conn.Invoke(ctx, in, out) @@ -56,7 +76,7 @@ func (c *serviceClient) WireguardInterfaceDump(ctx context.Context, in *Wireguar 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 @@ -79,7 +99,7 @@ func (c *serviceClient_WireguardInterfaceDumpClient) Recv() (*WireguardInterface switch m := msg.(type) { case *WireguardInterfaceDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: err = c.Stream.Close() if err != nil { return nil, err @@ -117,7 +137,7 @@ func (c *serviceClient) WireguardPeersDump(ctx context.Context, in *WireguardPee 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 @@ -140,7 +160,7 @@ func (c *serviceClient_WireguardPeersDumpClient) Recv() (*WireguardPeersDetails, switch m := msg.(type) { case *WireguardPeersDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: err = c.Stream.Close() if err != nil { return nil, err |