gsasl  2.2.1
Data Structures | Typedefs | Functions
gsasl-mech.h File Reference

Go to the source code of this file.

Data Structures

struct  Gsasl_mechanism_functions
 
struct  Gsasl_mechanism
 

Typedefs

typedef int(* Gsasl_init_function) (Gsasl *ctx)
 
typedef void(* Gsasl_done_function) (Gsasl *ctx)
 
typedef int(* Gsasl_start_function) (Gsasl_session *sctx, void **mech_data)
 
typedef int(* Gsasl_step_function) (Gsasl_session *sctx, void *mech_data, const char *input, size_t input_len, char **output, size_t *output_len)
 
typedef void(* Gsasl_finish_function) (Gsasl_session *sctx, void *mech_data)
 
typedef int(* Gsasl_code_function) (Gsasl_session *sctx, void *mech_data, const char *input, size_t input_len, char **output, size_t *output_len)
 
typedef struct Gsasl_mechanism_functions Gsasl_mechanism_functions
 
typedef struct Gsasl_mechanism Gsasl_mechanism
 

Functions

_GSASL_API int gsasl_register (Gsasl *ctx, const Gsasl_mechanism *mech)
 

Typedef Documentation

◆ Gsasl_code_function

typedef int(* Gsasl_code_function) (Gsasl_session *sctx, void *mech_data, const char *input, size_t input_len, char **output, size_t *output_len)

Gsasl_code_function:

Parameters
sctxa Gsasl_session session handle.
mech_datapointer to void* with mechanism-specific data.
inputinput byte array.
input_lensize of input byte array.
outputnewly allocated output byte array.
output_lenpointer to output variable with size of output byte array.

The implementation of this function should perform data encoding or decoding for the mechanism, after authentication has completed. This might mean that data is integrity or privacy protected.

The @output buffer is allocated by this function, and it is the responsibility of caller to deallocate it by calling gsasl_free(@output).

Return value: Returns GSASL_OK if encoding was successful, otherwise an error code.

Definition at line 134 of file gsasl-mech.h.

◆ Gsasl_done_function

typedef void(* Gsasl_done_function) (Gsasl *ctx)

Gsasl_done_function:

Parameters
ctxa Gsasl libgsasl handle.

The implementation of this function pointer deallocate all resources associated with the mechanism.

Definition at line 58 of file gsasl-mech.h.

◆ Gsasl_finish_function

typedef void(* Gsasl_finish_function) (Gsasl_session *sctx, void *mech_data)

Gsasl_finish_function:

Parameters
sctxa Gsasl_session session handle.
mech_datapointer to void* with mechanism-specific data.

The implementation of this function should release all resources associated with the particular authentication process.

Definition at line 112 of file gsasl-mech.h.

◆ Gsasl_init_function

typedef int(* Gsasl_init_function) (Gsasl *ctx)

SECTION:gsasl-mech

Parameters
titlegsasl-mech.h
short_descriptionregister new application-defined mechanism

The builtin mechanisms should suffice for most applications. Applications can register a new mechanism in the library using application-supplied functions. The mechanism will operate as the builtin mechanisms, and the supplied functions will be invoked when necessary. The application uses the normal logic, e.g., calls gsasl_client_start() followed by a sequence of calls to gsasl_step() and finally gsasl_finish(). Gsasl_init_function:

Parameters
ctxa Gsasl libgsasl handle.

The implementation of this function pointer should fail if the mechanism for some reason is not available for further use.

Return value: Returns GSASL_OK iff successful.

Definition at line 49 of file gsasl-mech.h.

◆ Gsasl_mechanism

Definition at line 134 of file gsasl-mech.h.

◆ Gsasl_mechanism_functions

Definition at line 134 of file gsasl-mech.h.

◆ Gsasl_start_function

typedef int(* Gsasl_start_function) (Gsasl_session *sctx, void **mech_data)

Gsasl_start_function:

Parameters
sctxa Gsasl_session session handle.
mech_datapointer to void* with mechanism-specific data.

The implementation of this function should start a new authentication process.

Return value: Returns GSASL_OK iff successful.

Definition at line 70 of file gsasl-mech.h.

◆ Gsasl_step_function

typedef int(* Gsasl_step_function) (Gsasl_session *sctx, void *mech_data, const char *input, size_t input_len, char **output, size_t *output_len)

Gsasl_step_function:

Parameters
sctxa Gsasl_session session handle.
mech_datapointer to void* with mechanism-specific data.
inputinput byte array.
input_lensize of input byte array.
outputnewly allocated output byte array.
output_lenpointer to output variable with size of output byte array.

The implementation of this function should perform one step of the authentication process.

This reads data from the other end (from @input and @input_len), processes it (potentially invoking callbacks to the application), and writes data to server (into newly allocated variable @output and @output_len that indicate the length of @output).

The contents of the @output buffer is unspecified if this functions returns anything other than GSASL_OK or GSASL_NEEDS_MORE. If this function return GSASL_OK or GSASL_NEEDS_MORE, however, the @output buffer is allocated by this function, and it is the responsibility of caller to deallocate it by calling gsasl_free(@output).

Return value: Returns GSASL_OK if authenticated terminated successfully, GSASL_NEEDS_MORE if more data is needed, or error code.

Definition at line 100 of file gsasl-mech.h.

Function Documentation

◆ gsasl_register()

_GSASL_API int gsasl_register ( Gsasl ctx,
const Gsasl_mechanism mech 
)

gsasl_register:

Parameters
ctxpointer to libgsasl handle.
mechplugin structure with information about plugin.

This function initialize given mechanism, and if successful, add it to the list of plugins that is used by the library.

Return value: GSASL_OK iff successful, otherwise GSASL_MALLOC_ERROR.

Since: 0.2.0

Definition at line 39 of file register.c.