88f7e23eba5cdfc3687341d94869fdc314472207
[govpp.git] / binapi / graph / graph.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.5.0-dev
4 //  VPP:              22.02-release
5 // source: /usr/share/vpp/api/plugins/graph.api.json
6
7 // Package graph contains generated bindings for API file graph.api.
8 //
9 // Contents:
10 //   1 enum
11 //   3 messages
12 //
13 package graph
14
15 import (
16         "strconv"
17
18         api "git.fd.io/govpp.git/api"
19         codec "git.fd.io/govpp.git/codec"
20 )
21
22 // This is a compile-time assertion to ensure that this generated file
23 // is compatible with the GoVPP api package it is being compiled against.
24 // A compilation error at this line likely means your copy of the
25 // GoVPP api package needs to be updated.
26 const _ = api.GoVppAPIPackageIsVersion2
27
28 const (
29         APIFile    = "graph"
30         APIVersion = "1.0.0"
31         VersionCrc = 0xa0b3fd1c
32 )
33
34 // NodeFlag defines enum 'node_flag'.
35 type NodeFlag uint32
36
37 const (
38         NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH          NodeFlag = 1
39         NODE_FLAG_IS_OUTPUT                             NodeFlag = 2
40         NODE_FLAG_IS_DROP                               NodeFlag = 4
41         NODE_FLAG_IS_PUNT                               NodeFlag = 8
42         NODE_FLAG_IS_HANDOFF                            NodeFlag = 16
43         NODE_FLAG_TRACE                                 NodeFlag = 32
44         NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE NodeFlag = 64
45         NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE NodeFlag = 128
46         NODE_FLAG_TRACE_SUPPORTED                       NodeFlag = 256
47 )
48
49 var (
50         NodeFlag_name = map[uint32]string{
51                 1:   "NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH",
52                 2:   "NODE_FLAG_IS_OUTPUT",
53                 4:   "NODE_FLAG_IS_DROP",
54                 8:   "NODE_FLAG_IS_PUNT",
55                 16:  "NODE_FLAG_IS_HANDOFF",
56                 32:  "NODE_FLAG_TRACE",
57                 64:  "NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE",
58                 128: "NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE",
59                 256: "NODE_FLAG_TRACE_SUPPORTED",
60         }
61         NodeFlag_value = map[string]uint32{
62                 "NODE_FLAG_FRAME_NO_FREE_AFTER_DISPATCH":          1,
63                 "NODE_FLAG_IS_OUTPUT":                             2,
64                 "NODE_FLAG_IS_DROP":                               4,
65                 "NODE_FLAG_IS_PUNT":                               8,
66                 "NODE_FLAG_IS_HANDOFF":                            16,
67                 "NODE_FLAG_TRACE":                                 32,
68                 "NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE": 64,
69                 "NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE": 128,
70                 "NODE_FLAG_TRACE_SUPPORTED":                       256,
71         }
72 )
73
74 func (x NodeFlag) String() string {
75         s, ok := NodeFlag_name[uint32(x)]
76         if ok {
77                 return s
78         }
79         return "NodeFlag(" + strconv.Itoa(int(x)) + ")"
80 }
81
82 // GraphNodeDetails defines message 'graph_node_details'.
83 type GraphNodeDetails struct {
84         Index   uint32   `binapi:"u32,name=index" json:"index,omitempty"`
85         Name    string   `binapi:"string[64],name=name" json:"name,omitempty"`
86         Flags   NodeFlag `binapi:"node_flag,name=flags" json:"flags,omitempty"`
87         NArcs   uint32   `binapi:"u32,name=n_arcs" json:"-"`
88         ArcsOut []uint32 `binapi:"u32[n_arcs],name=arcs_out" json:"arcs_out,omitempty"`
89 }
90
91 func (m *GraphNodeDetails) Reset()               { *m = GraphNodeDetails{} }
92 func (*GraphNodeDetails) GetMessageName() string { return "graph_node_details" }
93 func (*GraphNodeDetails) GetCrcString() string   { return "ac762018" }
94 func (*GraphNodeDetails) GetMessageType() api.MessageType {
95         return api.ReplyMessage
96 }
97
98 func (m *GraphNodeDetails) Size() (size int) {
99         if m == nil {
100                 return 0
101         }
102         size += 4                  // m.Index
103         size += 64                 // m.Name
104         size += 4                  // m.Flags
105         size += 4                  // m.NArcs
106         size += 4 * len(m.ArcsOut) // m.ArcsOut
107         return size
108 }
109 func (m *GraphNodeDetails) Marshal(b []byte) ([]byte, error) {
110         if b == nil {
111                 b = make([]byte, m.Size())
112         }
113         buf := codec.NewBuffer(b)
114         buf.EncodeUint32(m.Index)
115         buf.EncodeString(m.Name, 64)
116         buf.EncodeUint32(uint32(m.Flags))
117         buf.EncodeUint32(uint32(len(m.ArcsOut)))
118         for i := 0; i < len(m.ArcsOut); i++ {
119                 var x uint32
120                 if i < len(m.ArcsOut) {
121                         x = uint32(m.ArcsOut[i])
122                 }
123                 buf.EncodeUint32(x)
124         }
125         return buf.Bytes(), nil
126 }
127 func (m *GraphNodeDetails) Unmarshal(b []byte) error {
128         buf := codec.NewBuffer(b)
129         m.Index = buf.DecodeUint32()
130         m.Name = buf.DecodeString(64)
131         m.Flags = NodeFlag(buf.DecodeUint32())
132         m.NArcs = buf.DecodeUint32()
133         m.ArcsOut = make([]uint32, m.NArcs)
134         for i := 0; i < len(m.ArcsOut); i++ {
135                 m.ArcsOut[i] = buf.DecodeUint32()
136         }
137         return nil
138 }
139
140 // GraphNodeGet defines message 'graph_node_get'.
141 type GraphNodeGet struct {
142         Cursor   uint32   `binapi:"u32,name=cursor" json:"cursor,omitempty"`
143         Index    uint32   `binapi:"u32,name=index" json:"index,omitempty"`
144         Name     string   `binapi:"string[64],name=name" json:"name,omitempty"`
145         Flags    NodeFlag `binapi:"node_flag,name=flags" json:"flags,omitempty"`
146         WantArcs bool     `binapi:"bool,name=want_arcs" json:"want_arcs,omitempty"`
147 }
148
149 func (m *GraphNodeGet) Reset()               { *m = GraphNodeGet{} }
150 func (*GraphNodeGet) GetMessageName() string { return "graph_node_get" }
151 func (*GraphNodeGet) GetCrcString() string   { return "39c8792e" }
152 func (*GraphNodeGet) GetMessageType() api.MessageType {
153         return api.RequestMessage
154 }
155
156 func (m *GraphNodeGet) Size() (size int) {
157         if m == nil {
158                 return 0
159         }
160         size += 4  // m.Cursor
161         size += 4  // m.Index
162         size += 64 // m.Name
163         size += 4  // m.Flags
164         size += 1  // m.WantArcs
165         return size
166 }
167 func (m *GraphNodeGet) Marshal(b []byte) ([]byte, error) {
168         if b == nil {
169                 b = make([]byte, m.Size())
170         }
171         buf := codec.NewBuffer(b)
172         buf.EncodeUint32(m.Cursor)
173         buf.EncodeUint32(m.Index)
174         buf.EncodeString(m.Name, 64)
175         buf.EncodeUint32(uint32(m.Flags))
176         buf.EncodeBool(m.WantArcs)
177         return buf.Bytes(), nil
178 }
179 func (m *GraphNodeGet) Unmarshal(b []byte) error {
180         buf := codec.NewBuffer(b)
181         m.Cursor = buf.DecodeUint32()
182         m.Index = buf.DecodeUint32()
183         m.Name = buf.DecodeString(64)
184         m.Flags = NodeFlag(buf.DecodeUint32())
185         m.WantArcs = buf.DecodeBool()
186         return nil
187 }
188
189 // GraphNodeGetReply defines message 'graph_node_get_reply'.
190 type GraphNodeGetReply struct {
191         Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
192         Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"`
193 }
194
195 func (m *GraphNodeGetReply) Reset()               { *m = GraphNodeGetReply{} }
196 func (*GraphNodeGetReply) GetMessageName() string { return "graph_node_get_reply" }
197 func (*GraphNodeGetReply) GetCrcString() string   { return "53b48f5d" }
198 func (*GraphNodeGetReply) GetMessageType() api.MessageType {
199         return api.ReplyMessage
200 }
201
202 func (m *GraphNodeGetReply) Size() (size int) {
203         if m == nil {
204                 return 0
205         }
206         size += 4 // m.Retval
207         size += 4 // m.Cursor
208         return size
209 }
210 func (m *GraphNodeGetReply) Marshal(b []byte) ([]byte, error) {
211         if b == nil {
212                 b = make([]byte, m.Size())
213         }
214         buf := codec.NewBuffer(b)
215         buf.EncodeInt32(m.Retval)
216         buf.EncodeUint32(m.Cursor)
217         return buf.Bytes(), nil
218 }
219 func (m *GraphNodeGetReply) Unmarshal(b []byte) error {
220         buf := codec.NewBuffer(b)
221         m.Retval = buf.DecodeInt32()
222         m.Cursor = buf.DecodeUint32()
223         return nil
224 }
225
226 func init() { file_graph_binapi_init() }
227 func file_graph_binapi_init() {
228         api.RegisterMessage((*GraphNodeDetails)(nil), "graph_node_details_ac762018")
229         api.RegisterMessage((*GraphNodeGet)(nil), "graph_node_get_39c8792e")
230         api.RegisterMessage((*GraphNodeGetReply)(nil), "graph_node_get_reply_53b48f5d")
231 }
232
233 // Messages returns list of all messages in this module.
234 func AllMessages() []api.Message {
235         return []api.Message{
236                 (*GraphNodeDetails)(nil),
237                 (*GraphNodeGet)(nil),
238                 (*GraphNodeGetReply)(nil),
239         }
240 }