Initial release, version 0.0.0.
[gsasl.git] / lib / internal.h
blob4b418be1749068fe9180b4b4959382f3466f0bf1
1 /* internal.h internal header file for libgsasl
2 * Copyright (C) 2002 Simon Josefsson
4 * This file is part of libgsasl.
6 * Libgsasl is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * Libgsasl 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 along with libgsasl; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef _INTERNAL_H
23 #define _INTERNAL_H
25 #include <stdlib.h>
26 #include <ctype.h>
27 #include <string.h>
29 #include "config.h"
30 #include "gsasl.h"
31 #include "gettext.h"
33 #ifdef ENABLE_NLS
34 extern char *_gsasl_gettext (const char *str);
35 #define _(String) _gsasl_gettext (String)
36 #define gettext_noop(String) String
37 #define N_(String) gettext_noop (String)
38 #endif
40 #define HEXCHAR(c) ((c & 0x0F) > 9 ? 'a' + (c & 0x0F) - 10 : '0' + (c & 0x0F))
41 #define MIN(a,b) ((a) < (b) ? (a) : (b))
43 struct _Gsasl_mechanism_functions {
44 int (*init) (Gsasl_ctx *ctx);
45 void (*done) (Gsasl_ctx *ctx);
46 int (*start) (Gsasl_session_ctx *cctx,
47 void **mech_data);
48 int (*step) (Gsasl_session_ctx *cctx,
49 void *mech_data,
50 const char *input,
51 size_t input_len,
52 char *output,
53 size_t *output_len);
54 int (*finish) (Gsasl_session_ctx *cctx,
55 void *mech_data);
58 struct _Gsasl_mechanism {
59 char *name;
61 struct _Gsasl_mechanism_functions client;
62 struct _Gsasl_mechanism_functions server;
64 typedef struct _Gsasl_mechanism _Gsasl_mechanism;
66 extern _Gsasl_mechanism _gsasl_all_mechanisms[];
68 struct Gsasl_ctx {
69 size_t n_client_mechs;
70 _Gsasl_mechanism *client_mechs;
71 size_t n_server_mechs;
72 _Gsasl_mechanism *server_mechs;
73 void *application_data;
74 Gsasl_client_callback_authorization_id cbc_authorization_id;
75 Gsasl_client_callback_authentication_id cbc_authentication_id;
76 Gsasl_client_callback_password cbc_password;
77 Gsasl_client_callback_passcode cbc_passcode;
78 Gsasl_client_callback_pin cbc_pin;
79 Gsasl_client_callback_anonymous cbc_anonymous;
80 Gsasl_client_callback_qop cbc_qop;
81 Gsasl_client_callback_maxbuf cbc_maxbuf;
82 Gsasl_client_callback_service cbc_service;
83 Gsasl_server_callback_validate cbs_validate;
84 Gsasl_server_callback_securid cbs_securid;
85 Gsasl_server_callback_retrieve cbs_retrieve;
86 Gsasl_server_callback_cram_md5 cbs_cram_md5;
87 Gsasl_server_callback_digest_md5 cbs_digest_md5;
88 Gsasl_server_callback_external cbs_external;
89 Gsasl_server_callback_anonymous cbs_anonymous;
90 Gsasl_server_callback_realm cbs_realm;
91 Gsasl_server_callback_qop cbs_qop;
92 Gsasl_server_callback_maxbuf cbs_maxbuf;
93 Gsasl_server_callback_cipher cbs_cipher;
94 Gsasl_server_callback_service cbs_service;
95 Gsasl_server_callback_gssapi cbs_gssapi;
98 struct Gsasl_session_ctx {
99 Gsasl_ctx *ctx;
100 _Gsasl_mechanism *mech;
101 void *application_data;
102 void *mech_data;
105 #endif /* _INTERNAL_H */