assh/assh_alloc.h header reference
Description [link]
This header file contains some default memory allocator functions which can be registered for use by the library.It also provide allocator functions wrappers for use inside the library and modules.
See also coremod.
Header inclusion [link]
Members [link]
Type [link]
- enum assh_alloc_type_e
Functions [link]
- assh_allocator_t * assh_default_alloc(void )
- assh_status_t assh_alloc(struct assh_context_s *c, size_t size, enum assh_alloc_type_e type, void **result)
- void assh_free(struct assh_context_s *c, void *ptr)
- assh_status_t assh_realloc(struct assh_context_s *c, void **ptr, size_t size, enum assh_alloc_type_e type)
Macros [link]
Members detail [link]
assh_allocator_t * assh_default_alloc(void ) [link]
This function is declared in assh/assh_alloc.h source file, line 117.
This function returns the default allocator function. This depends on the platform and build configuration. This may return NULL.
#define ASSH_SCRATCH_ALLOC(context, type, name, size, sv, lbl) [link]
This macro is for internal use only.
This macro is declared in assh/assh_alloc.h source file, line 89.
Alternate declarations with same identifier: [1], [2].
Preprocessor condition: defined( CONFIG_ASSH_ALLOCA )
This macro allocates memory not used after current function return.
Depending on the value of CONFIG_ASSH_ALLOCA, this macro either relies on the alloca function or calls the assh_alloc function using the ASSH_ALLOC_SCRATCH type..
This macro expands to:
size_t name##_size_ = (size) * sizeof(type);
type *name = (type*)alloca(name##_size_);
if (0) goto lbl;
See also ASSH_SCRATCH_FREE.
#define ASSH_SCRATCH_ALLOC(context, type, name, size, sv, lbl) [link]
This macro is for internal use only.
This macro is declared in assh/assh_alloc.h source file, line 102.
Alternate declarations with same identifier: [1], [2].
Preprocessor condition: not defined( CONFIG_ASSH_ALLOCA )
Documentation from alternate declaration:
This macro allocates memory not used after current function return.
Depending on the value of CONFIG_ASSH_ALLOCA, this macro either relies on the alloca function or calls the assh_alloc function using the ASSH_ALLOC_SCRATCH type..
This macro expands to:
type *name;
ASSH_JMP_ON_ERR(assh_alloc(context, (size) * sizeof(type),
ASSH_ALLOC_SCRATCH, (void**)&name) | sv, lbl);
See also ASSH_SCRATCH_FREE.
#define ASSH_SCRATCH_FREE(context, name) [link]
This macro is for internal use only.
This macro is declared in assh/assh_alloc.h source file, line 96.
Alternate declarations with same identifier: [1], [2].
Preprocessor condition: defined( CONFIG_ASSH_ALLOCA )
This macro releases memory allocated by ASSH_SCRATCH_ALLOC.
This macro expands to:
do { assh_clear(name, name##_size_); } while (0)
#define ASSH_SCRATCH_FREE(context, name) [link]
This macro is for internal use only.
This macro is declared in assh/assh_alloc.h source file, line 108.
Alternate declarations with same identifier: [1], [2].
Preprocessor condition: not defined( CONFIG_ASSH_ALLOCA )
Documentation from alternate declaration:
This macro releases memory allocated by ASSH_SCRATCH_ALLOC.
This macro expands to:
do { assh_free(context, name); } while (0)
assh_status_t assh_alloc(struct assh_context_s *c, size_t size, enum assh_alloc_type_e type, void **result) [link]
This function is for internal use only.
This function is declared in assh/assh_alloc.h source file, line 66.
This function allocates memory.
enum assh_alloc_type_e [link]
This enum is for internal use only.
This enum is declared in assh/assh_alloc.h source file, line 49.
This enum specifies the type of data to be stored in the allocated memory.
Identifier | Value | Description |
---|---|---|
ASSH_ALLOC_NONE | 0 | |
ASSH_ALLOC_INTERNAL | 1 | General purpose allocation in non-secur memory. |
ASSH_ALLOC_SCRATCH | 2 | Buffer allocation in secur memory which don't last longer than a function call. |
ASSH_ALLOC_SECUR | 3 | Cryptographic allocation in secur memory. |
ASSH_ALLOC_PACKET | 4 | SSH packet allocation. Used to store enciphered and clear text packets. |
void assh_free(struct assh_context_s *c, void *ptr) [link]
This function is for internal use only.
This function is declared in assh/assh_alloc.h source file, line 75.
This function releases memory.
assh_status_t assh_realloc(struct assh_context_s *c, void **ptr, size_t size, enum assh_alloc_type_e type) [link]
This function is for internal use only.
This function is declared in assh/assh_alloc.h source file, line 71.
This function reallocates memory.