|
gsasl
1.8.0
|
00001 /* gsasl-mech.h --- Header file for mechanism handling in GNU SASL Library. 00002 * Copyright (C) 2002-2012 Simon Josefsson 00003 * 00004 * This file is part of GNU SASL Library. 00005 * 00006 * GNU SASL Library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * as published by the Free Software Foundation; either version 2.1 of 00009 * the License, or (at your option) any later version. 00010 * 00011 * GNU SASL Library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License License along with GNU SASL Library; if not, write to the 00018 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 */ 00022 00023 #ifndef GSASL_MECH_H 00024 #define GSASL_MECH_H 00025 00026 /* Mechanism function prototypes. */ 00027 typedef int (*Gsasl_init_function) (Gsasl * ctx); 00028 typedef void (*Gsasl_done_function) (Gsasl * ctx); 00029 typedef int (*Gsasl_start_function) (Gsasl_session * sctx, void **mech_data); 00030 typedef int (*Gsasl_step_function) (Gsasl_session * sctx, void *mech_data, 00031 const char *input, size_t input_len, 00032 char **output, size_t * output_len); 00033 typedef void (*Gsasl_finish_function) (Gsasl_session * sctx, void *mech_data); 00034 typedef int (*Gsasl_code_function) (Gsasl_session * sctx, void *mech_data, 00035 const char *input, size_t input_len, 00036 char **output, size_t * output_len); 00037 00038 /* Collection of mechanism functions for either client or server. */ 00039 struct Gsasl_mechanism_functions 00040 { 00041 Gsasl_init_function init; 00042 Gsasl_done_function done; 00043 Gsasl_start_function start; 00044 Gsasl_step_function step; 00045 Gsasl_finish_function finish; 00046 Gsasl_code_function encode; 00047 Gsasl_code_function decode; 00048 }; 00049 typedef struct Gsasl_mechanism_functions Gsasl_mechanism_functions; 00050 00051 /* Information about a mechanism. */ 00052 struct Gsasl_mechanism 00053 { 00054 const char *name; 00055 00056 struct Gsasl_mechanism_functions client; 00057 struct Gsasl_mechanism_functions server; 00058 }; 00059 typedef struct Gsasl_mechanism Gsasl_mechanism; 00060 00061 /* Register new mechanism: register.c. */ 00062 extern GSASL_API int gsasl_register (Gsasl * ctx, 00063 const Gsasl_mechanism * mech); 00064 00065 #endif /* GSASL_MECH_H */
1.7.6.1