-// SetControlPingMessages sets the messages for ControlPing and ControlPingReply
-func SetControlPingMessages(controPing, controlPingReply api.Message) {
- msgControlPing = controPing
- msgControlPingReply = controlPingReply
+ c := &Connection{
+ vppClient: binapi,
+ maxAttempts: attempts,
+ recInterval: interval,
+ connChan: make(chan ConnectionEvent, NotificationChanBufSize),
+ codec: codec.DefaultCodec,
+ msgIDs: make(map[string]uint16),
+ msgMapByPath: make(map[string]map[uint16]api.Message),
+ channels: make(map[uint16]*Channel),
+ subscriptions: make(map[uint16][]*subscriptionCtx),
+ msgControlPing: msgControlPing,
+ msgControlPingReply: msgControlPingReply,
+ }
+ binapi.SetMsgCallback(c.msgCallback)
+ return c