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)
// 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)
+}