Skip to content

Commit eeffa32

Browse files
authored
Update ControlPing/Reply in core (#291)
* Update ControlPing/Reply in core package Signed-off-by: Ondrej Fabry <ondrej@fabry.dev> * Debug log for read msg header in socketclient Signed-off-by: Ondrej Fabry <ondrej@fabry.dev> * Import control ping messages from memclnt Signed-off-by: Ondrej Fabry <ondrej@fabry.dev> --------- Signed-off-by: Ondrej Fabry <ondrej@fabry.dev>
1 parent 7719146 commit eeffa32

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

adapter/socketclient/socketclient.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,11 @@ func readMsgHeader(r io.Reader, header []byte) (int, error) {
682682
}
683683
return 0, fmt.Errorf("invalid header (expected 16 bytes, got %d)", n)
684684
}
685+
if debug {
686+
log.Debugf(" - header read (%d/%d): % 0X", n, len(header), header)
687+
}
685688

686689
dataLen := binary.BigEndian.Uint32(header[8:12])
687-
688690
return int(dataLen), nil
689691
}
690692

core/control_ping.go

+5-20
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package core
22

33
import (
44
"go.fd.io/govpp/api"
5+
"go.fd.io/govpp/binapi/memclnt"
56
)
67

78
var (
@@ -19,23 +20,7 @@ func SetControlPingReply(m api.Message) {
1920
msgControlPingReply = m
2021
}
2122

22-
type ControlPing struct{}
23-
24-
func (*ControlPing) GetMessageName() string { return "control_ping" }
25-
func (*ControlPing) GetCrcString() string { return "51077d14" }
26-
func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage }
27-
28-
type ControlPingReply struct {
29-
Retval int32
30-
ClientIndex uint32
31-
VpePID uint32
32-
}
33-
34-
func (*ControlPingReply) GetMessageName() string { return "control_ping_reply" }
35-
func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" }
36-
func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage }
37-
38-
func init() {
39-
api.RegisterMessage((*ControlPing)(nil), "ControlPing")
40-
api.RegisterMessage((*ControlPingReply)(nil), "ControlPingReply")
41-
}
23+
type (
24+
ControlPing = memclnt.ControlPing
25+
ControlPingReply = memclnt.ControlPingReply
26+
)

0 commit comments

Comments
 (0)