From 8b66677c2382a8e739d437621de4473d5ec0b9f1 Mon Sep 17 00:00:00 2001 From: Rastislav Szabo Date: Mon, 25 Sep 2017 21:58:24 +0200 Subject: generator fix - add new message type Change-Id: I5e2b312e086d18eb7fa3f349750caea20005f530 Signed-off-by: Rastislav Szabo --- cmd/binapi-generator/generator.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmd') diff --git a/cmd/binapi-generator/generator.go b/cmd/binapi-generator/generator.go index e3efe0f..d8420f9 100644 --- a/cmd/binapi-generator/generator.go +++ b/cmd/binapi-generator/generator.go @@ -38,6 +38,7 @@ type messageType int const ( requestMessage messageType = iota // VPP request message replyMessage // VPP reply message + eventMessage // VPP event message otherMessage // other VPP message ) @@ -260,6 +261,8 @@ func generateMessage(ctx *context, w io.Writer, msg *jsongo.JSONNode, isType boo if ok { if j == 2 { if fieldName == "client_index" { + // "client_index" as the second member, this might be an event message or a request + msgType = eventMessage wasClientIndex = true } else if fieldName == "context" { // reply needs "context" as the second member @@ -465,6 +468,8 @@ func generateMessageTypeGetter(w io.Writer, structName string, msgType messageTy fmt.Fprintln(w, "\treturn api.RequestMessage") } else if msgType == replyMessage { fmt.Fprintln(w, "\treturn api.ReplyMessage") + } else if msgType == eventMessage { + fmt.Fprintln(w, "\treturn api.EventMessage") } else { fmt.Fprintln(w, "\treturn api.OtherMessage") } -- cgit 1.2.3-korg