1 /* $NetBSD: saslc.h,v 1.6 2025/12/16 12:03:39 nia Exp $ */ 2 3 /* Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to The NetBSD Foundation 7 * by Mateusz Kocielski. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. Neither the name of The NetBSD Foundation nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #ifndef _SASLC_H_ 35 #define _SASLC_H_ 36 37 #include <sys/types.h> 38 39 /* properties */ 40 #define SASLC_PROP_AUTHCID "AUTHCID" 41 #define SASLC_PROP_AUTHZID "AUTHZID" 42 #define SASLC_PROP_BASE64IO "BASE64IO" 43 #define SASLC_PROP_CIPHERMASK "CIPHERMASK" 44 #define SASLC_PROP_DEBUG "DEBUG" 45 #define SASLC_PROP_HOSTNAME "HOSTNAME" 46 #define SASLC_PROP_MAXBUF "MAXBUF" 47 #define SASLC_PROP_PASSWD "PASSWD" 48 #define SASLC_PROP_QOPMASK "QOPMASK" 49 #define SASLC_PROP_REALM "REALM" 50 #define SASLC_PROP_SECURITY "SECURITY" 51 #define SASLC_PROP_SERVICE "SERVICE" 52 #define SASLC_PROP_SERVNAME "SERVNAME" 53 54 /* environment variables */ 55 #define SASLC_ENV_CONFIG "SASLC_CONFIG" 56 #define SASLC_ENV_DEBUG "SASLC_DEBUG" 57 58 /* opaque types */ 59 typedef struct saslc_t saslc_t; 60 typedef struct saslc_sess_t saslc_sess_t; 61 62 /* begin and end */ 63 saslc_t *saslc_alloc(void); 64 int saslc_init(saslc_t *, const char *, const char *); 65 int saslc_end(saslc_t *); 66 67 /* error */ 68 const char *saslc_strerror(saslc_t *); 69 const char *saslc_sess_strerror(saslc_sess_t *); 70 71 /* session begin and end */ 72 saslc_sess_t *saslc_sess_init(saslc_t *, const char *, const char *); 73 void saslc_sess_end(saslc_sess_t *); 74 75 /* session properties */ 76 int saslc_sess_setprop(saslc_sess_t *, const char *, const char *); 77 const char *saslc_sess_getprop(saslc_sess_t *, const char *); 78 const char *saslc_sess_getmech(saslc_sess_t *); 79 80 /* session management */ 81 int saslc_sess_cont(saslc_sess_t *, const void *, size_t, void **, size_t *); 82 ssize_t saslc_sess_encode(saslc_sess_t *, const void *, size_t, void **, 83 size_t *); 84 ssize_t saslc_sess_decode(saslc_sess_t *, const void *, size_t, void **, 85 size_t *); 86 87 #endif /* ! _SASLC_H_ */ 88