github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/crypto/crypto.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  // versions:
     3  //  binapi-generator: v0.4.0-dev
     4  //  VPP:              23.02-rc0~189-g57127b32a
     5  // source: /usr/share/vpp/api/core/crypto.api.json
     6  
     7  // Package crypto contains generated bindings for API file crypto.api.
     8  //
     9  // Contents:
    10  //   2 enums
    11  //   4 messages
    12  //
    13  package crypto
    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    = "crypto"
    30  	APIVersion = "1.0.1"
    31  	VersionCrc = 0x22355ec6
    32  )
    33  
    34  // CryptoDispatchMode defines enum 'crypto_dispatch_mode'.
    35  type CryptoDispatchMode uint8
    36  
    37  const (
    38  	CRYPTO_ASYNC_DISPATCH_POLLING   CryptoDispatchMode = 0
    39  	CRYPTO_ASYNC_DISPATCH_INTERRUPT CryptoDispatchMode = 1
    40  )
    41  
    42  var (
    43  	CryptoDispatchMode_name = map[uint8]string{
    44  		0: "CRYPTO_ASYNC_DISPATCH_POLLING",
    45  		1: "CRYPTO_ASYNC_DISPATCH_INTERRUPT",
    46  	}
    47  	CryptoDispatchMode_value = map[string]uint8{
    48  		"CRYPTO_ASYNC_DISPATCH_POLLING":   0,
    49  		"CRYPTO_ASYNC_DISPATCH_INTERRUPT": 1,
    50  	}
    51  )
    52  
    53  func (x CryptoDispatchMode) String() string {
    54  	s, ok := CryptoDispatchMode_name[uint8(x)]
    55  	if ok {
    56  		return s
    57  	}
    58  	return "CryptoDispatchMode(" + strconv.Itoa(int(x)) + ")"
    59  }
    60  
    61  // CryptoOpClassType defines enum 'crypto_op_class_type'.
    62  type CryptoOpClassType uint8
    63  
    64  const (
    65  	CRYPTO_API_OP_SIMPLE  CryptoOpClassType = 0
    66  	CRYPTO_API_OP_CHAINED CryptoOpClassType = 1
    67  	CRYPTO_API_OP_BOTH    CryptoOpClassType = 2
    68  )
    69  
    70  var (
    71  	CryptoOpClassType_name = map[uint8]string{
    72  		0: "CRYPTO_API_OP_SIMPLE",
    73  		1: "CRYPTO_API_OP_CHAINED",
    74  		2: "CRYPTO_API_OP_BOTH",
    75  	}
    76  	CryptoOpClassType_value = map[string]uint8{
    77  		"CRYPTO_API_OP_SIMPLE":  0,
    78  		"CRYPTO_API_OP_CHAINED": 1,
    79  		"CRYPTO_API_OP_BOTH":    2,
    80  	}
    81  )
    82  
    83  func (x CryptoOpClassType) String() string {
    84  	s, ok := CryptoOpClassType_name[uint8(x)]
    85  	if ok {
    86  		return s
    87  	}
    88  	return "CryptoOpClassType(" + strconv.Itoa(int(x)) + ")"
    89  }
    90  
    91  // CryptoSetAsyncDispatch defines message 'crypto_set_async_dispatch'.
    92  type CryptoSetAsyncDispatch struct {
    93  	Mode CryptoDispatchMode `binapi:"crypto_dispatch_mode,name=mode" json:"mode,omitempty"`
    94  }
    95  
    96  func (m *CryptoSetAsyncDispatch) Reset()               { *m = CryptoSetAsyncDispatch{} }
    97  func (*CryptoSetAsyncDispatch) GetMessageName() string { return "crypto_set_async_dispatch" }
    98  func (*CryptoSetAsyncDispatch) GetCrcString() string   { return "5ca4adc0" }
    99  func (*CryptoSetAsyncDispatch) GetMessageType() api.MessageType {
   100  	return api.RequestMessage
   101  }
   102  
   103  func (m *CryptoSetAsyncDispatch) Size() (size int) {
   104  	if m == nil {
   105  		return 0
   106  	}
   107  	size += 1 // m.Mode
   108  	return size
   109  }
   110  func (m *CryptoSetAsyncDispatch) Marshal(b []byte) ([]byte, error) {
   111  	if b == nil {
   112  		b = make([]byte, m.Size())
   113  	}
   114  	buf := codec.NewBuffer(b)
   115  	buf.EncodeUint8(uint8(m.Mode))
   116  	return buf.Bytes(), nil
   117  }
   118  func (m *CryptoSetAsyncDispatch) Unmarshal(b []byte) error {
   119  	buf := codec.NewBuffer(b)
   120  	m.Mode = CryptoDispatchMode(buf.DecodeUint8())
   121  	return nil
   122  }
   123  
   124  // CryptoSetAsyncDispatchReply defines message 'crypto_set_async_dispatch_reply'.
   125  type CryptoSetAsyncDispatchReply struct {
   126  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   127  }
   128  
   129  func (m *CryptoSetAsyncDispatchReply) Reset()               { *m = CryptoSetAsyncDispatchReply{} }
   130  func (*CryptoSetAsyncDispatchReply) GetMessageName() string { return "crypto_set_async_dispatch_reply" }
   131  func (*CryptoSetAsyncDispatchReply) GetCrcString() string   { return "e8d4e804" }
   132  func (*CryptoSetAsyncDispatchReply) GetMessageType() api.MessageType {
   133  	return api.ReplyMessage
   134  }
   135  
   136  func (m *CryptoSetAsyncDispatchReply) Size() (size int) {
   137  	if m == nil {
   138  		return 0
   139  	}
   140  	size += 4 // m.Retval
   141  	return size
   142  }
   143  func (m *CryptoSetAsyncDispatchReply) Marshal(b []byte) ([]byte, error) {
   144  	if b == nil {
   145  		b = make([]byte, m.Size())
   146  	}
   147  	buf := codec.NewBuffer(b)
   148  	buf.EncodeInt32(m.Retval)
   149  	return buf.Bytes(), nil
   150  }
   151  func (m *CryptoSetAsyncDispatchReply) Unmarshal(b []byte) error {
   152  	buf := codec.NewBuffer(b)
   153  	m.Retval = buf.DecodeInt32()
   154  	return nil
   155  }
   156  
   157  // CryptoSetHandler defines message 'crypto_set_handler'.
   158  type CryptoSetHandler struct {
   159  	AlgName string            `binapi:"string[32],name=alg_name" json:"alg_name,omitempty"`
   160  	Engine  string            `binapi:"string[16],name=engine" json:"engine,omitempty"`
   161  	Oct     CryptoOpClassType `binapi:"crypto_op_class_type,name=oct" json:"oct,omitempty"`
   162  	IsAsync uint8             `binapi:"u8,name=is_async" json:"is_async,omitempty"`
   163  }
   164  
   165  func (m *CryptoSetHandler) Reset()               { *m = CryptoSetHandler{} }
   166  func (*CryptoSetHandler) GetMessageName() string { return "crypto_set_handler" }
   167  func (*CryptoSetHandler) GetCrcString() string   { return "ce9ad00d" }
   168  func (*CryptoSetHandler) GetMessageType() api.MessageType {
   169  	return api.RequestMessage
   170  }
   171  
   172  func (m *CryptoSetHandler) Size() (size int) {
   173  	if m == nil {
   174  		return 0
   175  	}
   176  	size += 32 // m.AlgName
   177  	size += 16 // m.Engine
   178  	size += 1  // m.Oct
   179  	size += 1  // m.IsAsync
   180  	return size
   181  }
   182  func (m *CryptoSetHandler) Marshal(b []byte) ([]byte, error) {
   183  	if b == nil {
   184  		b = make([]byte, m.Size())
   185  	}
   186  	buf := codec.NewBuffer(b)
   187  	buf.EncodeString(m.AlgName, 32)
   188  	buf.EncodeString(m.Engine, 16)
   189  	buf.EncodeUint8(uint8(m.Oct))
   190  	buf.EncodeUint8(m.IsAsync)
   191  	return buf.Bytes(), nil
   192  }
   193  func (m *CryptoSetHandler) Unmarshal(b []byte) error {
   194  	buf := codec.NewBuffer(b)
   195  	m.AlgName = buf.DecodeString(32)
   196  	m.Engine = buf.DecodeString(16)
   197  	m.Oct = CryptoOpClassType(buf.DecodeUint8())
   198  	m.IsAsync = buf.DecodeUint8()
   199  	return nil
   200  }
   201  
   202  // CryptoSetHandlerReply defines message 'crypto_set_handler_reply'.
   203  type CryptoSetHandlerReply struct {
   204  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   205  }
   206  
   207  func (m *CryptoSetHandlerReply) Reset()               { *m = CryptoSetHandlerReply{} }
   208  func (*CryptoSetHandlerReply) GetMessageName() string { return "crypto_set_handler_reply" }
   209  func (*CryptoSetHandlerReply) GetCrcString() string   { return "e8d4e804" }
   210  func (*CryptoSetHandlerReply) GetMessageType() api.MessageType {
   211  	return api.ReplyMessage
   212  }
   213  
   214  func (m *CryptoSetHandlerReply) Size() (size int) {
   215  	if m == nil {
   216  		return 0
   217  	}
   218  	size += 4 // m.Retval
   219  	return size
   220  }
   221  func (m *CryptoSetHandlerReply) Marshal(b []byte) ([]byte, error) {
   222  	if b == nil {
   223  		b = make([]byte, m.Size())
   224  	}
   225  	buf := codec.NewBuffer(b)
   226  	buf.EncodeInt32(m.Retval)
   227  	return buf.Bytes(), nil
   228  }
   229  func (m *CryptoSetHandlerReply) Unmarshal(b []byte) error {
   230  	buf := codec.NewBuffer(b)
   231  	m.Retval = buf.DecodeInt32()
   232  	return nil
   233  }
   234  
   235  func init() { file_crypto_binapi_init() }
   236  func file_crypto_binapi_init() {
   237  	api.RegisterMessage((*CryptoSetAsyncDispatch)(nil), "crypto_set_async_dispatch_5ca4adc0")
   238  	api.RegisterMessage((*CryptoSetAsyncDispatchReply)(nil), "crypto_set_async_dispatch_reply_e8d4e804")
   239  	api.RegisterMessage((*CryptoSetHandler)(nil), "crypto_set_handler_ce9ad00d")
   240  	api.RegisterMessage((*CryptoSetHandlerReply)(nil), "crypto_set_handler_reply_e8d4e804")
   241  }
   242  
   243  // Messages returns list of all messages in this module.
   244  func AllMessages() []api.Message {
   245  	return []api.Message{
   246  		(*CryptoSetAsyncDispatch)(nil),
   247  		(*CryptoSetAsyncDispatchReply)(nil),
   248  		(*CryptoSetHandler)(nil),
   249  		(*CryptoSetHandlerReply)(nil),
   250  	}
   251  }