1 /* gsasl-mech.h --- Header file for mechanism handling in GNU SASL Library.
2 * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
4 * This file is part of GNU SASL Library.
6 * GNU SASL Library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public License
8 * as published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * GNU SASL Library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License License along with GNU SASL Library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
26 /* Mechanism function prototypes. */
27 typedef int (*Gsasl_init_function
) (Gsasl
* ctx
);
28 typedef void (*Gsasl_done_function
) (Gsasl
* ctx
);
29 typedef int (*Gsasl_start_function
) (Gsasl_session
* sctx
, void **mech_data
);
30 typedef int (*Gsasl_step_function
) (Gsasl_session
* sctx
, void *mech_data
,
31 const char *input
, size_t input_len
,
32 char **output
, size_t * output_len
);
33 typedef void (*Gsasl_finish_function
) (Gsasl_session
* sctx
, void *mech_data
);
34 typedef int (*Gsasl_code_function
) (Gsasl_session
* sctx
, void *mech_data
,
35 const char *input
, size_t input_len
,
36 char **output
, size_t * output_len
);
38 /* Collection of mechanism functions for either client or server. */
39 struct Gsasl_mechanism_functions
41 Gsasl_init_function init
;
42 Gsasl_done_function done
;
43 Gsasl_start_function start
;
44 Gsasl_step_function step
;
45 Gsasl_finish_function finish
;
46 Gsasl_code_function encode
;
47 Gsasl_code_function decode
;
49 typedef struct Gsasl_mechanism_functions Gsasl_mechanism_functions
;
51 /* Information about a mechanism. */
52 struct Gsasl_mechanism
56 struct Gsasl_mechanism_functions client
;
57 struct Gsasl_mechanism_functions server
;
59 typedef struct Gsasl_mechanism Gsasl_mechanism
;
61 /* Register new mechanism: register.c. */
62 extern GSASL_API
int gsasl_register (Gsasl
* ctx
,
63 const Gsasl_mechanism
* mech
);
65 #endif /* GSASL_MECH_H */