Show VPPApiError value always and remove RegisterBinAPITypes for mock adapter
[govpp.git] / adapter / adapter.go
index d8f29c9..7d3d1e4 100644 (file)
 
 package adapter
 
+import (
+       "errors"
+)
+
+// ErrNotImplemented is an error returned when missing implementation.
+var ErrNotImplemented = errors.New("not implemented for this OS")
+
+// MsgCallback defines func signature for message callback.
+type MsgCallback func(msgID uint16, context uint32, data []byte)
+
 // VppAdapter provides connection to VPP. It is responsible for sending and receiving of binary-encoded messages to/from VPP.
 type VppAdapter interface {
        // Connect connects the process to VPP.
@@ -26,11 +36,11 @@ type VppAdapter interface {
        GetMsgID(msgName string, msgCrc string) (uint16, error)
 
        // SendMsg sends a binary-encoded message to VPP.
-       SendMsg(clientID uint32, data []byte) error
+       SendMsg(context uint32, data []byte) error
 
        // SetMsgCallback sets a callback function that will be called by the adapter whenever a message comes from VPP.
-       SetMsgCallback(func(context uint32, msgId uint16, data []byte))
+       SetMsgCallback(cb MsgCallback)
 
-       // WaitReady returns func which waits until adapter is ready.
-       WaitReady() func() error
+       // WaitReady waits until adapter is ready.
+       WaitReady() error
 }