binapigen: fix union size
[govpp.git] / binapi / http_static / http_static.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-dev
4 //  VPP:              20.05-release
5 // source: /usr/share/vpp/api/plugins/http_static.api.json
6
7 // Package http_static contains generated bindings for API file http_static.api.
8 //
9 // Contents:
10 //   2 messages
11 //
12 package http_static
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         codec "git.fd.io/govpp.git/codec"
17 )
18
19 // This is a compile-time assertion to ensure that this generated file
20 // is compatible with the GoVPP api package it is being compiled against.
21 // A compilation error at this line likely means your copy of the
22 // GoVPP api package needs to be updated.
23 const _ = api.GoVppAPIPackageIsVersion2
24
25 const (
26         APIFile    = "http_static"
27         APIVersion = "2.1.0"
28         VersionCrc = 0xd29e72e9
29 )
30
31 // HTTPStaticEnable defines message 'http_static_enable'.
32 type HTTPStaticEnable struct {
33         FifoSize           uint32 `binapi:"u32,name=fifo_size" json:"fifo_size,omitempty"`
34         CacheSizeLimit     uint32 `binapi:"u32,name=cache_size_limit" json:"cache_size_limit,omitempty"`
35         PreallocFifos      uint32 `binapi:"u32,name=prealloc_fifos" json:"prealloc_fifos,omitempty"`
36         PrivateSegmentSize uint32 `binapi:"u32,name=private_segment_size" json:"private_segment_size,omitempty"`
37         WwwRoot            string `binapi:"string[256],name=www_root" json:"www_root,omitempty"`
38         URI                string `binapi:"string[256],name=uri" json:"uri,omitempty"`
39 }
40
41 func (m *HTTPStaticEnable) Reset()               { *m = HTTPStaticEnable{} }
42 func (*HTTPStaticEnable) GetMessageName() string { return "http_static_enable" }
43 func (*HTTPStaticEnable) GetCrcString() string   { return "075f8292" }
44 func (*HTTPStaticEnable) GetMessageType() api.MessageType {
45         return api.RequestMessage
46 }
47
48 func (m *HTTPStaticEnable) Size() (size int) {
49         if m == nil {
50                 return 0
51         }
52         size += 4   // m.FifoSize
53         size += 4   // m.CacheSizeLimit
54         size += 4   // m.PreallocFifos
55         size += 4   // m.PrivateSegmentSize
56         size += 256 // m.WwwRoot
57         size += 256 // m.URI
58         return size
59 }
60 func (m *HTTPStaticEnable) Marshal(b []byte) ([]byte, error) {
61         if b == nil {
62                 b = make([]byte, m.Size())
63         }
64         buf := codec.NewBuffer(b)
65         buf.EncodeUint32(m.FifoSize)
66         buf.EncodeUint32(m.CacheSizeLimit)
67         buf.EncodeUint32(m.PreallocFifos)
68         buf.EncodeUint32(m.PrivateSegmentSize)
69         buf.EncodeString(m.WwwRoot, 256)
70         buf.EncodeString(m.URI, 256)
71         return buf.Bytes(), nil
72 }
73 func (m *HTTPStaticEnable) Unmarshal(b []byte) error {
74         buf := codec.NewBuffer(b)
75         m.FifoSize = buf.DecodeUint32()
76         m.CacheSizeLimit = buf.DecodeUint32()
77         m.PreallocFifos = buf.DecodeUint32()
78         m.PrivateSegmentSize = buf.DecodeUint32()
79         m.WwwRoot = buf.DecodeString(256)
80         m.URI = buf.DecodeString(256)
81         return nil
82 }
83
84 // HTTPStaticEnableReply defines message 'http_static_enable_reply'.
85 type HTTPStaticEnableReply struct {
86         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
87 }
88
89 func (m *HTTPStaticEnableReply) Reset()               { *m = HTTPStaticEnableReply{} }
90 func (*HTTPStaticEnableReply) GetMessageName() string { return "http_static_enable_reply" }
91 func (*HTTPStaticEnableReply) GetCrcString() string   { return "e8d4e804" }
92 func (*HTTPStaticEnableReply) GetMessageType() api.MessageType {
93         return api.ReplyMessage
94 }
95
96 func (m *HTTPStaticEnableReply) Size() (size int) {
97         if m == nil {
98                 return 0
99         }
100         size += 4 // m.Retval
101         return size
102 }
103 func (m *HTTPStaticEnableReply) Marshal(b []byte) ([]byte, error) {
104         if b == nil {
105                 b = make([]byte, m.Size())
106         }
107         buf := codec.NewBuffer(b)
108         buf.EncodeInt32(m.Retval)
109         return buf.Bytes(), nil
110 }
111 func (m *HTTPStaticEnableReply) Unmarshal(b []byte) error {
112         buf := codec.NewBuffer(b)
113         m.Retval = buf.DecodeInt32()
114         return nil
115 }
116
117 func init() { file_http_static_binapi_init() }
118 func file_http_static_binapi_init() {
119         api.RegisterMessage((*HTTPStaticEnable)(nil), "http_static_enable_075f8292")
120         api.RegisterMessage((*HTTPStaticEnableReply)(nil), "http_static_enable_reply_e8d4e804")
121 }
122
123 // Messages returns list of all messages in this module.
124 func AllMessages() []api.Message {
125         return []api.Message{
126                 (*HTTPStaticEnable)(nil),
127                 (*HTTPStaticEnableReply)(nil),
128         }
129 }