aboutsummaryrefslogtreecommitdiffstats
path: root/codec/msg_codec.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-07-22 04:40:55 +0200
committerOndrej Fabry <ofabry@cisco.com>2020-07-22 04:40:55 +0200
commit58da9ac6e691a8c660eb8ca838a154e11da0db68 (patch)
treea1bbda04c6d0621ce0fc20779276620f1820190b /codec/msg_codec.go
parenta155cd438c6558da266c1c5931361ea088b35653 (diff)
Fix binapigen decoding and minor improvements
- fixed allocating byte slices before copying decoded data - simplified encoding functions - several minor improvements Change-Id: I6669424b89eb86333805cb1b57e4551169980cc2 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'codec/msg_codec.go')
-rw-r--r--codec/msg_codec.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/codec/msg_codec.go b/codec/msg_codec.go
index 68cf3b1..6534e7d 100644
--- a/codec/msg_codec.go
+++ b/codec/msg_codec.go
@@ -24,6 +24,16 @@ import (
var DefaultCodec = new(MsgCodec)
+func EncodeMsg(msg api.Message, msgID uint16) (data []byte, err error) {
+ return DefaultCodec.EncodeMsg(msg, msgID)
+}
+func DecodeMsg(data []byte, msg api.Message) (err error) {
+ return DefaultCodec.DecodeMsg(data, msg)
+}
+func DecodeMsgContext(data []byte, msg api.Message) (context uint32, err error) {
+ return DefaultCodec.DecodeMsgContext(data, msg)
+}
+
// MsgCodec provides encoding and decoding functionality of `api.Message` structs into/from
// binary format as accepted by VPP.
type MsgCodec struct{}