Botan 2.19.2
Crypto and TLS for C&
Classes | Namespaces | Macros | Functions
ffi_util.h File Reference
#include <cstdint>
#include <memory>
#include <stdexcept>
#include <functional>
#include <botan/exceptn.h>
#include <botan/mem_ops.h>

Go to the source code of this file.

Classes

struct  Botan_FFI::botan_struct< T, MAGIC >
 
class  Botan_FFI::FFI_Error
 

Namespaces

namespace  Botan_FFI
 

Macros

#define BOTAN_FFI_CHECKED_DELETE(o)   ffi_delete_object(o, __func__)
 
#define BOTAN_FFI_DECLARE_STRUCT(NAME, TYPE, MAGIC)    struct NAME final : public Botan_FFI::botan_struct<TYPE, MAGIC> { explicit NAME(TYPE* x) : botan_struct(x) {} }
 
#define BOTAN_FFI_DO(T, obj, param, block)
 
#define BOTAN_FFI_RETURNING(T, obj, param, block)
 

Functions

template<typename T , uint32_t M, typename F >
int Botan_FFI::apply_fn (botan_struct< T, M > *o, const char *func_name, F func)
 
template<typename T , uint32_t M>
int Botan_FFI::ffi_delete_object (botan_struct< T, M > *obj, const char *func_name)
 
int Botan_FFI::ffi_error_exception_thrown (const char *func_name, const char *exn, int rc)
 
int Botan_FFI::ffi_guard_thunk (const char *func_name, std::function< int()> thunk)
 
template<typename T , uint32_t M>
TBotan_FFI::safe_get (botan_struct< T, M > *p)
 
int Botan_FFI::write_output (uint8_t out[], size_t *out_len, const uint8_t buf[], size_t buf_len)
 
int Botan_FFI::write_str_output (char out[], size_t *out_len, const std::string &str)
 
int Botan_FFI::write_str_output (char out[], size_t *out_len, const std::vector< uint8_t > &str_vec)
 
int Botan_FFI::write_str_output (uint8_t out[], size_t *out_len, const std::string &str)
 
template<typename Alloc >
int Botan_FFI::write_vec_output (uint8_t out[], size_t *out_len, const std::vector< uint8_t, Alloc > &buf)
 

Macro Definition Documentation

◆ BOTAN_FFI_CHECKED_DELETE

#define BOTAN_FFI_CHECKED_DELETE (   o)    ffi_delete_object(o, __func__)

Definition at line 129 of file ffi_util.h.

◆ BOTAN_FFI_DECLARE_STRUCT

#define BOTAN_FFI_DECLARE_STRUCT (   NAME,
  TYPE,
  MAGIC 
)     struct NAME final : public Botan_FFI::botan_struct<TYPE, MAGIC> { explicit NAME(TYPE* x) : botan_struct(x) {} }

Definition at line 53 of file ffi_util.h.

◆ BOTAN_FFI_DO

#define BOTAN_FFI_DO (   T,
  obj,
  param,
  block 
)
Value:
apply_fn(obj, __func__, \
[=](T& param) -> int { do { block } while(0); return BOTAN_FFI_SUCCESS; })
@ BOTAN_FFI_SUCCESS
Definition: ffi.h:63
fe T
Definition: ge.cpp:37
int apply_fn(botan_struct< T, M > *o, const char *func_name, F func)
Definition: ffi_util.h:77

Definition at line 92 of file ffi_util.h.

◆ BOTAN_FFI_RETURNING

#define BOTAN_FFI_RETURNING (   T,
  obj,
  param,
  block 
)
Value:
apply_fn(obj, __func__, \
[=](T& param) -> int { do { block } while(0); })

Definition at line 101 of file ffi_util.h.