aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorRastislav Szabo <raszabo@cisco.com>2017-09-25 21:58:24 +0200
committerRastislav Szabo <raszabo@cisco.com>2017-09-25 21:58:24 +0200
commit8b66677c2382a8e739d437621de4473d5ec0b9f1 (patch)
treeac0999f92d20b2f1bc630ebcb6ffa2b5317c0baa /cmd
parent70ae7c10259161994e49bae8d095dcce840dfed4 (diff)
generator fix - add new message type
Change-Id: I5e2b312e086d18eb7fa3f349750caea20005f530 Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/binapi-generator/generator.go5
1 files changed, 5 insertions, 0 deletions
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")
}