xref: /netbsd-src/crypto/external/bsd/libsaslc/dist/include/saslc.h (revision acb231545cd20720fb19dbeb268d083f219c60a0)
1*acb23154Schristos /*	$NetBSD: saslc.h,v 1.5 2011/02/16 02:14:22 christos Exp $	*/
2231558cbSagc 
3231558cbSagc /* Copyright (c) 2010 The NetBSD Foundation, Inc.
4231558cbSagc  * All rights reserved.
5231558cbSagc  *
6231558cbSagc  * This code is derived from software contributed to The NetBSD Foundation
7231558cbSagc  * by Mateusz Kocielski.
8231558cbSagc  *
9231558cbSagc  * Redistribution and use in source and binary forms, with or without
10231558cbSagc  * modification, are permitted provided that the following conditions
11231558cbSagc  * are met:
12231558cbSagc  * 1. Redistributions of source code must retain the above copyright
13231558cbSagc  *	  notice, this list of conditions and the following disclaimer.
14231558cbSagc  * 2. Redistributions in binary form must reproduce the above copyright
15231558cbSagc  *	  notice, this list of conditions and the following disclaimer in the
16231558cbSagc  *	  documentation and/or other materials provided with the distribution.
17231558cbSagc  * 3. All advertising materials mentioning features or use of this software
18231558cbSagc  *	  must display the following acknowledgement:
19231558cbSagc  *		  This product includes software developed by the NetBSD
20231558cbSagc  *		  Foundation, Inc. and its contributors.
21231558cbSagc  * 4. Neither the name of The NetBSD Foundation nor the names of its
22231558cbSagc  *	  contributors may be used to endorse or promote products derived
23231558cbSagc  *	  from this software without specific prior written permission.
24231558cbSagc  *
25231558cbSagc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26231558cbSagc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27231558cbSagc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28231558cbSagc  * PURPOSE ARE DISCLAIMED.	IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29231558cbSagc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30231558cbSagc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31231558cbSagc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32231558cbSagc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33231558cbSagc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34231558cbSagc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35231558cbSagc  * POSSIBILITY OF SUCH DAMAGE.
36231558cbSagc  */
37231558cbSagc 
38231558cbSagc #ifndef _SASLC_H_
39231558cbSagc #define _SASLC_H_
40231558cbSagc 
41e43cceb2Schristos #include <sys/types.h>
42231558cbSagc 
4319c14409Schristos /* properties */
4419c14409Schristos #define	SASLC_PROP_AUTHCID	"AUTHCID"
4519c14409Schristos #define SASLC_PROP_AUTHZID	"AUTHZID"
4619c14409Schristos #define SASLC_PROP_BASE64IO	"BASE64IO"
4719c14409Schristos #define SASLC_PROP_CIPHERMASK	"CIPHERMASK"
4819c14409Schristos #define SASLC_PROP_DEBUG	"DEBUG"
4919c14409Schristos #define SASLC_PROP_HOSTNAME	"HOSTNAME"
5019c14409Schristos #define SASLC_PROP_MAXBUF	"MAXBUF"
5119c14409Schristos #define SASLC_PROP_PASSWD	"PASSWD"
5219c14409Schristos #define SASLC_PROP_QOPMASK	"QOPMASK"
5319c14409Schristos #define SASLC_PROP_REALM	"REALM"
5419c14409Schristos #define SASLC_PROP_SECURITY	"SECURITY"
5519c14409Schristos #define SASLC_PROP_SERVICE	"SERVICE"
56*acb23154Schristos #define SASLC_PROP_SERVNAME	"SERVNAME"
5719c14409Schristos 
5819c14409Schristos /* environment variables */
5919c14409Schristos #define SASLC_ENV_CONFIG	"SASLC_CONFIG"
6019c14409Schristos #define SASLC_ENV_DEBUG		"SASLC_DEBUG"
6119c14409Schristos 
6219c14409Schristos /* opaque types */
63231558cbSagc typedef struct saslc_t saslc_t;
64231558cbSagc typedef struct saslc_sess_t saslc_sess_t;
65231558cbSagc 
66231558cbSagc /* begin and end */
67231558cbSagc saslc_t *saslc_alloc(void);
6819c14409Schristos int saslc_init(saslc_t *, const char *, const char *);
6919c14409Schristos int saslc_end(saslc_t *);
70231558cbSagc 
71231558cbSagc /* error */
72231558cbSagc const char *saslc_strerror(saslc_t *);
73231558cbSagc const char *saslc_sess_strerror(saslc_sess_t *);
74231558cbSagc 
75231558cbSagc /* session begin and end */
7619c14409Schristos saslc_sess_t *saslc_sess_init(saslc_t *, const char *, const char *);
77231558cbSagc void saslc_sess_end(saslc_sess_t *);
78231558cbSagc 
79231558cbSagc /* session properties */
80231558cbSagc int saslc_sess_setprop(saslc_sess_t *, const char *, const char *);
81231558cbSagc const char *saslc_sess_getprop(saslc_sess_t *, const char *);
8219c14409Schristos const char *saslc_sess_getmech(saslc_sess_t *);
83231558cbSagc 
84231558cbSagc /* session management */
85231558cbSagc int saslc_sess_cont(saslc_sess_t *, const void *, size_t, void **, size_t *);
8619c14409Schristos ssize_t saslc_sess_encode(saslc_sess_t *, const void *, size_t, void **,
87231558cbSagc     size_t *);
8819c14409Schristos ssize_t saslc_sess_decode(saslc_sess_t *, const void *, size_t, void **,
89231558cbSagc     size_t *);
90231558cbSagc 
91231558cbSagc #endif /* ! _SASLC_H_ */
92