diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2019-09-09 09:56:59 +0200 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2019-09-09 09:56:59 +0200 |
commit | ccb7b913d54fafdf08b36ac7eb36e462b1ecc9eb (patch) | |
tree | 1cf8f9fa125e577a0887519f0c0c436891e0983a /adapter/socketclient/socketclient.go | |
parent | d06548e4f4492c181f04a5fc9bf994764278e68b (diff) |
Fix compatibility with latest master (20.01-rc0)
- fixed generator for new string types
- update simple client example
- regenerate examples binapi for VPP 19.08
Change-Id: If4fe78c130d95641f35f75cd0262b35b032acaf8
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'adapter/socketclient/socketclient.go')
-rw-r--r-- | adapter/socketclient/socketclient.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/adapter/socketclient/socketclient.go b/adapter/socketclient/socketclient.go index 1c425ba..043d253 100644 --- a/adapter/socketclient/socketclient.go +++ b/adapter/socketclient/socketclient.go @@ -32,7 +32,6 @@ import ( "git.fd.io/govpp.git/adapter" "git.fd.io/govpp.git/codec" - "git.fd.io/govpp.git/examples/binapi/memclnt" ) const ( @@ -313,9 +312,7 @@ const ( func (c *vppClient) open() error { msgCodec := new(codec.MsgCodec) - req := &memclnt.SockclntCreate{ - Name: []byte(ClientName), - } + req := &SockclntCreate{Name: ClientName} msg, err := msgCodec.EncodeMsg(req, sockCreateMsgId) if err != nil { Log.Debugln("Encode error:", err) @@ -343,7 +340,7 @@ func (c *vppClient) open() error { return err } - reply := new(memclnt.SockclntCreateReply) + reply := new(SockclntCreateReply) if err := msgCodec.DecodeMsg(msgReply, reply); err != nil { Log.Println("Decode error:", err) return err @@ -355,7 +352,8 @@ func (c *vppClient) open() error { c.clientIndex = reply.Index c.msgTable = make(map[string]uint16, reply.Count) for _, x := range reply.MessageTable { - name := string(bytes.TrimSuffix(bytes.Split(x.Name, []byte{0x00})[0], []byte{0x13})) + msgName := strings.Split(x.Name, "\x00")[0] + name := strings.TrimSuffix(msgName, "\x13") c.msgTable[name] = x.Index if strings.HasPrefix(name, "sockclnt_delete_") { c.sockDelMsgId = x.Index @@ -371,7 +369,7 @@ func (c *vppClient) open() error { func (c *vppClient) close() error { msgCodec := new(codec.MsgCodec) - req := &memclnt.SockclntDelete{ + req := &SockclntDelete{ Index: c.clientIndex, } msg, err := msgCodec.EncodeMsg(req, c.sockDelMsgId) @@ -406,7 +404,7 @@ func (c *vppClient) close() error { return err } - reply := new(memclnt.SockclntDeleteReply) + reply := new(SockclntDeleteReply) if err := msgCodec.DecodeMsg(msgReply, reply); err != nil { Log.Debugln("Decode error:", err) return err |