aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/binapi-generator/objects.go
diff options
context:
space:
mode:
authorRastislav Szabo <raszabo@cisco.com>2018-12-13 12:03:49 +0000
committerGerrit Code Review <gerrit@fd.io>2018-12-13 12:03:49 +0000
commit5f1917fd11e8562ef4094b7ce3a89af66ace5792 (patch)
tree02309976390883716e4a819d3b5969091069a750 /cmd/binapi-generator/objects.go
parent6bfc1a27011d44cbf915607feb276a847148dd30 (diff)
parent868b541e296dc47748ad03b8f0174c828d996529 (diff)
Merge "Add support for aliases and boolean type"
Diffstat (limited to 'cmd/binapi-generator/objects.go')
-rw-r--r--cmd/binapi-generator/objects.go21
1 files changed, 8 insertions, 13 deletions
diff --git a/cmd/binapi-generator/objects.go b/cmd/binapi-generator/objects.go
index 2681085..97318cb 100644
--- a/cmd/binapi-generator/objects.go
+++ b/cmd/binapi-generator/objects.go
@@ -8,6 +8,7 @@ type Package struct {
Enums []Enum
Unions []Union
Types []Type
+ Aliases []Alias
Messages []Message
Services []Service
RefMap map[string]string
@@ -37,6 +38,13 @@ type Type struct {
Fields []Field
}
+// Alias represents VPP binary API alias
+type Alias struct {
+ Name string
+ Type string
+ Length int
+}
+
// Union represents VPP binary API union
type Union struct {
Name string
@@ -105,16 +113,3 @@ func (s Service) IsRequestService() bool {
// some binapi messages might have `null` reply (for example: memclnt)
return s.ReplyType != "" && s.ReplyType != "null" // not null
}
-
-func getSizeOfType(typ *Type) (size int) {
- for _, field := range typ.Fields {
- if n := getBinapiTypeSize(field.Type); n > 0 {
- if field.Length > 0 {
- size += n * field.Length
- } else {
- size += n
- }
- }
- }
- return size
-}