Recognize stat_dir_type_empty
[govpp.git] / adapter / vpp_api.go
index 7d14633..b32f975 100644 (file)
@@ -16,10 +16,18 @@ package adapter
 
 import (
        "errors"
+       "fmt"
 )
 
-// ErrNotImplemented is an error returned when missing implementation.
-var ErrNotImplemented = errors.New("not implemented for this OS")
+const (
+       // DefaultBinapiSocket defines a default socket file path for VPP binary API.
+       DefaultBinapiSocket = "/run/vpp/api.sock"
+)
+
+var (
+       // ErrNotImplemented is an error returned when missing implementation.
+       ErrNotImplemented = errors.New("not implemented for this OS")
+)
 
 // MsgCallback defines func signature for message callback.
 type MsgCallback func(msgID uint16, data []byte)
@@ -45,3 +53,14 @@ type VppAPI interface {
        // WaitReady waits until adapter is ready.
        WaitReady() error
 }
+
+// UnknownMsgError is the error type usually returned by GetMsgID
+// method of VppAPI. It describes the name and CRC for the unknown message.
+type UnknownMsgError struct {
+       MsgName string
+       MsgCrc  string
+}
+
+func (u *UnknownMsgError) Error() string {
+       return fmt.Sprintf("unknown message: %s_%s", u.MsgName, u.MsgCrc)
+}