github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/crypto/crypto.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  // versions:
     3  //  binapi-generator: v0.10.0-dev
     4  //  VPP:              23.10-rc0~170-g6f1548434
     5  // source: 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  package crypto
    13  
    14  import (
    15  	"strconv"
    16  
    17  	api "go.fd.io/govpp/api"
    18  	codec "go.fd.io/govpp/codec"
    19  )
    20  
    21  // This is a compile-time assertion to ensure that this generated file
    22  // is compatible with the GoVPP api package it is being compiled against.
    23  // A compilation error at this line likely means your copy of the
    24  // GoVPP api package needs to be updated.
    25  const _ = api.GoVppAPIPackageIsVersion2
    26  
    27  const (
    28  	APIFile    = "crypto"
    29  	APIVersion = "1.0.1"
    30  	VersionCrc = 0x22355ec6
    31  )
    32  
    33  // CryptoDispatchMode defines enum 'crypto_dispatch_mode'.
    34  type CryptoDispatchMode uint8
    35  
    36  const (
    37  	CRYPTO_ASYNC_DISPATCH_POLLING   CryptoDispatchMode = 0
    38  	CRYPTO_ASYNC_DISPATCH_INTERRUPT CryptoDispatchMode = 1
    39  )
    40  
    41  var (
    42  	CryptoDispatchMode_name = map[uint8]string{
    43  		0: "CRYPTO_ASYNC_DISPATCH_POLLING",
    44  		1: "CRYPTO_ASYNC_DISPATCH_INTERRUPT",
    45  	}
    46  	CryptoDispatchMode_value = map[string]uint8{
    47  		"CRYPTO_ASYNC_DISPATCH_POLLING":   0,
    48  		"CRYPTO_ASYNC_DISPATCH_INTERRUPT": 1,
    49  	}
    50  )
    51  
    52  func (x CryptoDispatchMode) String() string {
    53  	s, ok := CryptoDispatchMode_name[uint8(x)]
    54  	if ok {
    55  		return s
    56  	}
    57  	return "CryptoDispatchMode(" + strconv.Itoa(int(x)) + ")"
    58  }
    59  
    60  // CryptoOpClassType defines enum 'crypto_op_class_type'.
    61  type CryptoOpClassType uint8
    62  
    63  const (
    64  	CRYPTO_API_OP_SIMPLE  CryptoOpClassType = 0
    65  	CRYPTO_API_OP_CHAINED CryptoOpClassType = 1
    66  	CRYPTO_API_OP_BOTH    CryptoOpClassType = 2
    67  )
    68  
    69  var (
    70  	CryptoOpClassType_name = map[uint8]string{
    71  		0: "CRYPTO_API_OP_SIMPLE",
    72  		1: "CRYPTO_API_OP_CHAINED",
    73  		2: "CRYPTO_API_OP_BOTH",
    74  	}
    75  	CryptoOpClassType_value = map[string]uint8{
    76  		"CRYPTO_API_OP_SIMPLE":  0,
    77  		"CRYPTO_API_OP_CHAINED": 1,
    78  		"CRYPTO_API_OP_BOTH":    2,
    79  	}
    80  )
    81  
    82  func (x CryptoOpClassType) String() string {
    83  	s, ok := CryptoOpClassType_name[uint8(x)]
    84  	if ok {
    85  		return s
    86  	}
    87  	return "CryptoOpClassType(" + strconv.Itoa(int(x)) + ")"
    88  }
    89  
    90  // crypto: use polling or interrupt dispatch
    91  //   - mode - dispatch mode
    92  //
    93  // CryptoSetAsyncDispatch defines message 'crypto_set_async_dispatch'.
    94  // Deprecated: the message will be removed in the future versions
    95  type CryptoSetAsyncDispatch struct {
    96  	Mode CryptoDispatchMode `binapi:"crypto_dispatch_mode,name=mode" json:"mode,omitempty"`
    97  }
    98  
    99  func (m *CryptoSetAsyncDispatch) Reset()               { *m = CryptoSetAsyncDispatch{} }
   100  func (*CryptoSetAsyncDispatch) GetMessageName() string { return "crypto_set_async_dispatch" }
   101  func (*CryptoSetAsyncDispatch) GetCrcString() string   { return "5ca4adc0" }
   102  func (*CryptoSetAsyncDispatch) GetMessageType() api.MessageType {
   103  	return api.RequestMessage
   104  }
   105  
   106  func (m *CryptoSetAsyncDispatch) Size() (size int) {
   107  	if m == nil {
   108  		return 0
   109  	}
   110  	size += 1 // m.Mode
   111  	return size
   112  }
   113  func (m *CryptoSetAsyncDispatch) Marshal(b []byte) ([]byte, error) {
   114  	if b == nil {
   115  		b = make([]byte, m.Size())
   116  	}
   117  	buf := codec.NewBuffer(b)
   118  	buf.EncodeUint8(uint8(m.Mode))
   119  	return buf.Bytes(), nil
   120  }
   121  func (m *CryptoSetAsyncDispatch) Unmarshal(b []byte) error {
   122  	buf := codec.NewBuffer(b)
   123  	m.Mode = CryptoDispatchMode(buf.DecodeUint8())
   124  	return nil
   125  }
   126  
   127  // CryptoSetAsyncDispatchReply defines message 'crypto_set_async_dispatch_reply'.
   128  // Deprecated: the message will be removed in the future versions
   129  type CryptoSetAsyncDispatchReply struct {
   130  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   131  }
   132  
   133  func (m *CryptoSetAsyncDispatchReply) Reset()               { *m = CryptoSetAsyncDispatchReply{} }
   134  func (*CryptoSetAsyncDispatchReply) GetMessageName() string { return "crypto_set_async_dispatch_reply" }
   135  func (*CryptoSetAsyncDispatchReply) GetCrcString() string   { return "e8d4e804" }
   136  func (*CryptoSetAsyncDispatchReply) GetMessageType() api.MessageType {
   137  	return api.ReplyMessage
   138  }
   139  
   140  func (m *CryptoSetAsyncDispatchReply) Size() (size int) {
   141  	if m == nil {
   142  		return 0
   143  	}
   144  	size += 4 // m.Retval
   145  	return size
   146  }
   147  func (m *CryptoSetAsyncDispatchReply) Marshal(b []byte) ([]byte, error) {
   148  	if b == nil {
   149  		b = make([]byte, m.Size())
   150  	}
   151  	buf := codec.NewBuffer(b)
   152  	buf.EncodeInt32(m.Retval)
   153  	return buf.Bytes(), nil
   154  }
   155  func (m *CryptoSetAsyncDispatchReply) Unmarshal(b []byte) error {
   156  	buf := codec.NewBuffer(b)
   157  	m.Retval = buf.DecodeInt32()
   158  	return nil
   159  }
   160  
   161  // crypto: set crypto handler
   162  //   - alg_name - Name of the algorithm to add
   163  //   - engine - Name of the engine to add
   164  //   - oct - Operation class type (simple, chained, both)
   165  //   - is_async - Asynchronous or not
   166  //
   167  // CryptoSetHandler defines message 'crypto_set_handler'.
   168  type CryptoSetHandler struct {
   169  	AlgName string            `binapi:"string[32],name=alg_name" json:"alg_name,omitempty"`
   170  	Engine  string            `binapi:"string[16],name=engine" json:"engine,omitempty"`
   171  	Oct     CryptoOpClassType `binapi:"crypto_op_class_type,name=oct" json:"oct,omitempty"`
   172  	IsAsync uint8             `binapi:"u8,name=is_async" json:"is_async,omitempty"`
   173  }
   174  
   175  func (m *CryptoSetHandler) Reset()               { *m = CryptoSetHandler{} }
   176  func (*CryptoSetHandler) GetMessageName() string { return "crypto_set_handler" }
   177  func (*CryptoSetHandler) GetCrcString() string   { return "ce9ad00d" }
   178  func (*CryptoSetHandler) GetMessageType() api.MessageType {
   179  	return api.RequestMessage
   180  }
   181  
   182  func (m *CryptoSetHandler) Size() (size int) {
   183  	if m == nil {
   184  		return 0
   185  	}
   186  	size += 32 // m.AlgName
   187  	size += 16 // m.Engine
   188  	size += 1  // m.Oct
   189  	size += 1  // m.IsAsync
   190  	return size
   191  }
   192  func (m *CryptoSetHandler) Marshal(b []byte) ([]byte, error) {
   193  	if b == nil {
   194  		b = make([]byte, m.Size())
   195  	}
   196  	buf := codec.NewBuffer(b)
   197  	buf.EncodeString(m.AlgName, 32)
   198  	buf.EncodeString(m.Engine, 16)
   199  	buf.EncodeUint8(uint8(m.Oct))
   200  	buf.EncodeUint8(m.IsAsync)
   201  	return buf.Bytes(), nil
   202  }
   203  func (m *CryptoSetHandler) Unmarshal(b []byte) error {
   204  	buf := codec.NewBuffer(b)
   205  	m.AlgName = buf.DecodeString(32)
   206  	m.Engine = buf.DecodeString(16)
   207  	m.Oct = CryptoOpClassType(buf.DecodeUint8())
   208  	m.IsAsync = buf.DecodeUint8()
   209  	return nil
   210  }
   211  
   212  // CryptoSetHandlerReply defines message 'crypto_set_handler_reply'.
   213  type CryptoSetHandlerReply struct {
   214  	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
   215  }
   216  
   217  func (m *CryptoSetHandlerReply) Reset()               { *m = CryptoSetHandlerReply{} }
   218  func (*CryptoSetHandlerReply) GetMessageName() string { return "crypto_set_handler_reply" }
   219  func (*CryptoSetHandlerReply) GetCrcString() string   { return "e8d4e804" }
   220  func (*CryptoSetHandlerReply) GetMessageType() api.MessageType {
   221  	return api.ReplyMessage
   222  }
   223  
   224  func (m *CryptoSetHandlerReply) Size() (size int) {
   225  	if m == nil {
   226  		return 0
   227  	}
   228  	size += 4 // m.Retval
   229  	return size
   230  }
   231  func (m *CryptoSetHandlerReply) Marshal(b []byte) ([]byte, error) {
   232  	if b == nil {
   233  		b = make([]byte, m.Size())
   234  	}
   235  	buf := codec.NewBuffer(b)
   236  	buf.EncodeInt32(m.Retval)
   237  	return buf.Bytes(), nil
   238  }
   239  func (m *CryptoSetHandlerReply) Unmarshal(b []byte) error {
   240  	buf := codec.NewBuffer(b)
   241  	m.Retval = buf.DecodeInt32()
   242  	return nil
   243  }
   244  
   245  func init() { file_crypto_binapi_init() }
   246  func file_crypto_binapi_init() {
   247  	api.RegisterMessage((*CryptoSetAsyncDispatch)(nil), "crypto_set_async_dispatch_5ca4adc0")
   248  	api.RegisterMessage((*CryptoSetAsyncDispatchReply)(nil), "crypto_set_async_dispatch_reply_e8d4e804")
   249  	api.RegisterMessage((*CryptoSetHandler)(nil), "crypto_set_handler_ce9ad00d")
   250  	api.RegisterMessage((*CryptoSetHandlerReply)(nil), "crypto_set_handler_reply_e8d4e804")
   251  }
   252  
   253  // Messages returns list of all messages in this module.
   254  func AllMessages() []api.Message {
   255  	return []api.Message{
   256  		(*CryptoSetAsyncDispatch)(nil),
   257  		(*CryptoSetAsyncDispatchReply)(nil),
   258  		(*CryptoSetHandler)(nil),
   259  		(*CryptoSetHandlerReply)(nil),
   260  	}
   261  }