Generator improvements and cleanup
[govpp.git] / cmd / binapi-generator / objects.go
1 package main
2
3 // Package represents collection of objects parsed from VPP binary API JSON data
4 type Package struct {
5         APIVersion string
6         Services   []Service
7         Enums      []Enum
8         Aliases    []Alias
9         Types      []Type
10         Unions     []Union
11         Messages   []Message
12         RefMap     map[string]string
13 }
14
15 // Service represents VPP binary API service
16 type Service struct {
17         Name        string
18         RequestType string
19         ReplyType   string
20         Stream      bool
21         Events      []string
22 }
23
24 // Enum represents VPP binary API enum
25 type Enum struct {
26         Name    string
27         Type    string
28         Entries []EnumEntry
29 }
30
31 // EnumEntry represents VPP binary API enum entry
32 type EnumEntry struct {
33         Name  string
34         Value interface{}
35 }
36
37 // Alias represents VPP binary API alias
38 type Alias struct {
39         Name   string
40         Type   string
41         Length int
42 }
43
44 // Type represents VPP binary API type
45 type Type struct {
46         Name   string
47         CRC    string
48         Fields []Field
49 }
50
51 // Field represents VPP binary API object field
52 type Field struct {
53         Name     string
54         Type     string
55         Length   int
56         SizeFrom string
57 }
58
59 // Union represents VPP binary API union
60 type Union struct {
61         Name   string
62         CRC    string
63         Fields []Field
64 }
65
66 // Message represents VPP binary API message
67 type Message struct {
68         Name   string
69         CRC    string
70         Fields []Field
71 }
72
73 // MessageType represents the type of a VPP message
74 type MessageType int
75
76 const (
77         requestMessage MessageType = iota // VPP request message
78         replyMessage                      // VPP reply message
79         eventMessage                      // VPP event message
80         otherMessage                      // other VPP message
81 )