binapigen: fix union size
[govpp.git] / binapi / tls_openssl / tls_openssl.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/tls_openssl.api.json
6
7 // Package tls_openssl contains generated bindings for API file tls_openssl.api.
8 //
9 // Contents:
10 //   2 messages
11 //
12 package tls_openssl
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    = "tls_openssl"
27         APIVersion = "2.0.0"
28         VersionCrc = 0x7386fbcd
29 )
30
31 // TLSOpensslSetEngine defines message 'tls_openssl_set_engine'.
32 type TLSOpensslSetEngine struct {
33         AsyncEnable uint32 `binapi:"u32,name=async_enable" json:"async_enable,omitempty"`
34         Engine      []byte `binapi:"u8[64],name=engine" json:"engine,omitempty"`
35         Algorithm   []byte `binapi:"u8[64],name=algorithm" json:"algorithm,omitempty"`
36         Ciphers     []byte `binapi:"u8[64],name=ciphers" json:"ciphers,omitempty"`
37 }
38
39 func (m *TLSOpensslSetEngine) Reset()               { *m = TLSOpensslSetEngine{} }
40 func (*TLSOpensslSetEngine) GetMessageName() string { return "tls_openssl_set_engine" }
41 func (*TLSOpensslSetEngine) GetCrcString() string   { return "e34d95c1" }
42 func (*TLSOpensslSetEngine) GetMessageType() api.MessageType {
43         return api.RequestMessage
44 }
45
46 func (m *TLSOpensslSetEngine) Size() (size int) {
47         if m == nil {
48                 return 0
49         }
50         size += 4      // m.AsyncEnable
51         size += 1 * 64 // m.Engine
52         size += 1 * 64 // m.Algorithm
53         size += 1 * 64 // m.Ciphers
54         return size
55 }
56 func (m *TLSOpensslSetEngine) Marshal(b []byte) ([]byte, error) {
57         if b == nil {
58                 b = make([]byte, m.Size())
59         }
60         buf := codec.NewBuffer(b)
61         buf.EncodeUint32(m.AsyncEnable)
62         buf.EncodeBytes(m.Engine, 64)
63         buf.EncodeBytes(m.Algorithm, 64)
64         buf.EncodeBytes(m.Ciphers, 64)
65         return buf.Bytes(), nil
66 }
67 func (m *TLSOpensslSetEngine) Unmarshal(b []byte) error {
68         buf := codec.NewBuffer(b)
69         m.AsyncEnable = buf.DecodeUint32()
70         m.Engine = make([]byte, 64)
71         copy(m.Engine, buf.DecodeBytes(len(m.Engine)))
72         m.Algorithm = make([]byte, 64)
73         copy(m.Algorithm, buf.DecodeBytes(len(m.Algorithm)))
74         m.Ciphers = make([]byte, 64)
75         copy(m.Ciphers, buf.DecodeBytes(len(m.Ciphers)))
76         return nil
77 }
78
79 // TLSOpensslSetEngineReply defines message 'tls_openssl_set_engine_reply'.
80 type TLSOpensslSetEngineReply struct {
81         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
82 }
83
84 func (m *TLSOpensslSetEngineReply) Reset()               { *m = TLSOpensslSetEngineReply{} }
85 func (*TLSOpensslSetEngineReply) GetMessageName() string { return "tls_openssl_set_engine_reply" }
86 func (*TLSOpensslSetEngineReply) GetCrcString() string   { return "e8d4e804" }
87 func (*TLSOpensslSetEngineReply) GetMessageType() api.MessageType {
88         return api.ReplyMessage
89 }
90
91 func (m *TLSOpensslSetEngineReply) Size() (size int) {
92         if m == nil {
93                 return 0
94         }
95         size += 4 // m.Retval
96         return size
97 }
98 func (m *TLSOpensslSetEngineReply) Marshal(b []byte) ([]byte, error) {
99         if b == nil {
100                 b = make([]byte, m.Size())
101         }
102         buf := codec.NewBuffer(b)
103         buf.EncodeInt32(m.Retval)
104         return buf.Bytes(), nil
105 }
106 func (m *TLSOpensslSetEngineReply) Unmarshal(b []byte) error {
107         buf := codec.NewBuffer(b)
108         m.Retval = buf.DecodeInt32()
109         return nil
110 }
111
112 func init() { file_tls_openssl_binapi_init() }
113 func file_tls_openssl_binapi_init() {
114         api.RegisterMessage((*TLSOpensslSetEngine)(nil), "tls_openssl_set_engine_e34d95c1")
115         api.RegisterMessage((*TLSOpensslSetEngineReply)(nil), "tls_openssl_set_engine_reply_e8d4e804")
116 }
117
118 // Messages returns list of all messages in this module.
119 func AllMessages() []api.Message {
120         return []api.Message{
121                 (*TLSOpensslSetEngine)(nil),
122                 (*TLSOpensslSetEngineReply)(nil),
123         }
124 }