Improve binapi generator
[govpp.git] / binapigen / vppapi / api_schema.go
1 //  Copyright (c) 2020 Cisco and/or its affiliates.
2 //
3 //  Licensed under the Apache License, Version 2.0 (the "License");
4 //  you may not use this file except in compliance with the License.
5 //  You may obtain a copy of the License at:
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 //  Unless required by applicable law or agreed to in writing, software
10 //  distributed under the License is distributed on an "AS IS" BASIS,
11 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 //  See the License for the specific language governing permissions and
13 //  limitations under the License.
14
15 // Package vppapi parses VPP API files without any additional processing.
16 package vppapi
17
18 type (
19         File struct {
20                 Name string
21                 Path string
22                 CRC  string
23
24                 Options map[string]string `json:",omitempty"`
25                 Imports []string          `json:",omitempty"`
26
27                 AliasTypes  []AliasType  `json:",omitempty"`
28                 EnumTypes   []EnumType   `json:",omitempty"`
29                 StructTypes []StructType `json:",omitempty"`
30                 UnionTypes  []UnionType  `json:",omitempty"`
31
32                 Messages []Message `json:",omitempty"`
33                 Service  *Service  `json:",omitempty"`
34         }
35
36         AliasType struct {
37                 Name   string
38                 Type   string
39                 Length int `json:",omitempty"`
40         }
41
42         EnumType struct {
43                 Name    string
44                 Type    string
45                 Entries []EnumEntry
46         }
47
48         EnumEntry struct {
49                 Name  string
50                 Value uint32
51         }
52
53         StructType struct {
54                 Name   string
55                 Fields []Field
56         }
57
58         UnionType struct {
59                 Name   string
60                 Fields []Field
61         }
62
63         Message struct {
64                 Name   string
65                 Fields []Field
66                 CRC    string
67         }
68
69         Field struct {
70                 Name     string
71                 Type     string
72                 Length   int                    `json:",omitempty"`
73                 Array    bool                   `json:",omitempty"`
74                 SizeFrom string                 `json:",omitempty"`
75                 Meta     map[string]interface{} `json:",omitempty"`
76         }
77
78         Service struct {
79                 RPCs []RPC `json:",omitempty"`
80         }
81
82         RPC struct {
83                 Request   string
84                 Reply     string
85                 Stream    bool     `json:",omitempty"`
86                 StreamMsg string   `json:",omitempty"`
87                 Events    []string `json:",omitempty"`
88         }
89 )