aboutsummaryrefslogtreecommitdiffstats
path: root/proxy/server.go
diff options
context:
space:
mode:
authorMatus Mrekaj <matus.mrekaj@pantheon.tech>2019-10-16 15:13:44 +0200
committerOndrej Fabry <ofabry@cisco.com>2019-10-17 04:54:26 +0000
commitcc80dbcaaaca8bf1b6042fead850d456cf589a4e (patch)
treeaaa4711e9938699d36f48231eaa889f0bb839185 /proxy/server.go
parent9bf7175a26f29a8c0133883152afb98765edd8ca (diff)
add missing implementation for proxy
Signed-off-by: Matus Mrekaj <matus.mrekaj@pantheon.tech> Change-Id: I1ab9efb9e575e7993501e7774628cbb60d16ec43
Diffstat (limited to 'proxy/server.go')
-rw-r--r--proxy/server.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/proxy/server.go b/proxy/server.go
index df62356..20f01f0 100644
--- a/proxy/server.go
+++ b/proxy/server.go
@@ -4,6 +4,7 @@ import (
"fmt"
"log"
"reflect"
+ "time"
"git.fd.io/govpp.git/api"
)
@@ -66,6 +67,21 @@ type BinapiResponse struct {
Msgs []api.Message
}
+type BinapiCompatibilityRequest struct {
+ MsgName string
+ Crc string
+}
+
+type BinapiCompatibilityResponse struct {
+}
+
+type BinapiTimeoutRequest struct {
+ Timeout time.Duration
+}
+
+type BinapiTimeoutResponse struct {
+}
+
// BinapiRPC is a RPC server for proxying client request to api.Channel.
type BinapiRPC struct {
binapi api.Channel
@@ -107,3 +123,17 @@ func (s *BinapiRPC) Invoke(req BinapiRequest, resp *BinapiResponse) error {
return nil
}
+
+func (s *BinapiRPC) SetTimeout(req BinapiTimeoutRequest, _ *BinapiTimeoutResponse) error {
+ log.Printf("BinapiRPC.SetTimeout - REQ: %#v", req)
+ s.binapi.SetReplyTimeout(req.Timeout)
+ return nil
+}
+
+func (s *BinapiRPC) Compatibility(req BinapiCompatibilityRequest, _ *BinapiCompatibilityResponse) error {
+ log.Printf("BinapiRPC.Compatiblity - REQ: %#v", req)
+ if val, ok := api.GetRegisteredMessages()[req.MsgName+"_"+req.Crc]; ok {
+ return s.binapi.CheckCompatiblity(val)
+ }
+ return fmt.Errorf("compatibility check failed for the message: %s", req.MsgName+"_"+req.Crc)
+}