5 // Package represents collection of objects parsed from VPP binary API JSON data
13 RefMap map[string]string
16 // MessageType represents the type of a VPP message
20 requestMessage MessageType = iota // VPP request message
21 replyMessage // VPP reply message
22 eventMessage // VPP event message
23 otherMessage // other VPP message
26 // Message represents VPP binary API message
33 // Type represents VPP binary API type
40 // Union represents VPP binary API union
47 // Field represents VPP binary API object field
55 func (f *Field) IsArray() bool {
56 return f.Length > 0 || f.SizeFrom != ""
59 // Enum represents VPP binary API enum
66 // EnumEntry represents VPP binary API enum entry
67 type EnumEntry struct {
72 // Service represents VPP binary API service
81 func (s Service) MethodName() string {
82 reqTyp := camelCaseName(s.RequestType)
84 // method name is same as parameter type name by default
87 // use Dump as prefix instead of suffix for stream services
88 if m := strings.TrimSuffix(method, "Dump"); method != m {
96 func (s Service) IsDumpService() bool {
100 func (s Service) IsEventService() bool {
101 return len(s.Events) > 0
104 func (s Service) IsRequestService() bool {
105 // some binapi messages might have `null` reply (for example: memclnt)
106 return s.ReplyType != "" && s.ReplyType != "null" // not null
109 func getSizeOfType(typ *Type) (size int) {
110 for _, field := range typ.Fields {
111 if n := getBinapiTypeSize(field.Type); n > 0 {
112 if field.Length > 0 {
113 size += n * field.Length