Diffusion C API 6.12.0
Loading...
Searching...
No Matches
security.h File Reference

Functions handling authorisation, security and user credentials. More...

Functions

CREDENTIALS_Tcredentials_create_none (void)
 Create an empty set of credentials.
CREDENTIALS_Tcredentials_create_password (const char *password)
 Create credentials for a given password.
CREDENTIALS_Tcredentials_create_custom (const char *data, const unsigned long len)
 Create custom credentials, where the caller provides an opaque set of bytes.
void credentials_free (CREDENTIALS_T *creds)
 Free a credentials structure.
char * buf_read_credentials (const char *data, CREDENTIALS_T **credentials)
 Deserialise credentials from a stream of wire format data.
CREDENTIALS_Tcredentials_unmarshal (const BUF_T *buf)
 Deserialise a credentials structure from a wire format BUF_T.
BUF_T * credentials_marshal (const CREDENTIALS_T *credentials)
 Serialise a credentials structure to wire format.

Detailed Description

Functions handling authorisation, security and user credentials.

Function Documentation

◆ buf_read_credentials()

char * buf_read_credentials ( const char * data,
CREDENTIALS_T ** credentials )

Deserialise credentials from a stream of wire format data.

Parameters
dataPointer the the start of a serialised credentials structure in a char array.
credentialsA created credentials structure.
Returns
A pointer to the position in the char array after the credentials structure.

◆ credentials_create_custom()

CREDENTIALS_T * credentials_create_custom ( const char * data,
const unsigned long len )

Create custom credentials, where the caller provides an opaque set of bytes.

credentials_free should be called on the pointer when no longer needed.

Parameters
dataAn array of bytes representing the credentials.
lenThe length of the array.
Return values
CREDENTIALS_T *Credentials with a type of "CUSTOM".
NULLIf an error occurs.

◆ credentials_create_none()

CREDENTIALS_T * credentials_create_none ( void )

Create an empty set of credentials.

credentials_free should be called on the pointer when no longer needed.

Return values
CREDENTIALS_T *Credentials with a type of "NONE".
NULLIf an error occurs.

◆ credentials_create_password()

CREDENTIALS_T * credentials_create_password ( const char * password)

Create credentials for a given password.

credentials_free should be called on the pointer when no longer needed.

Parameters
passwordThe password to encode into the credentials.
Return values
CREDENTIALS_T *Credentials with a type of "PLAIN_PASSWORD".
NULLIf an error occurs.

◆ credentials_free()

void credentials_free ( CREDENTIALS_T * creds)

Free a credentials structure.

It is the responsibility of the caller to free any memory associated with the credentials data (either a password or custom data).

Parameters
credsA set of credentials.

◆ credentials_marshal()

BUF_T * credentials_marshal ( const CREDENTIALS_T * credentials)

Serialise a credentials structure to wire format.

Parameters
credentialsA credentials structure to be serialised.
Return values
BUF_T *A buffer with the credentials in wire format.
NULLIf an error occurs.

◆ credentials_unmarshal()

CREDENTIALS_T * credentials_unmarshal ( const BUF_T * buf)

Deserialise a credentials structure from a wire format BUF_T.

Parameters
bufThe buffer containing the serialised credentials.
Return values
CREDENTIALS_T *A credentials structure.
NULLIf an error occurs.