GSS_S_PROMPTING_NEEDED is a bit
[cyrus-sasl.git] / saslauthd / utils.h
1 /*******************************************************************************
2  * *****************************************************************************
3  * *
4  * * utils.h
5  * *
6  * * Description:  Header file for utils.c
7  * *               
8  * *
9  * * Copyright (c) 1997-2000 Messaging Direct Ltd.
10  * * All rights reserved.
11  * *
12  * * Portions Copyright (c) 2003 Jeremy Rumpf
13  * * jrumpf@heavyload.net
14  * *
15  * * Redistribution and use in source and binary forms, with or without
16  * * modification, are permitted provided that the following conditions
17  * * are met:
18  * *
19  * * 1. Redistributions of source code must retain the above copyright
20  * *    notice, this list of conditions and the following disclaimer.
21  * *
22  * * 2. Redistributions in binary form must reproduce the above copyright
23  * *    notice, this list of conditions and the following disclaimer in the
24  * *    documentation and/or other materials provided with the distribution.
25  * *
26  * * THIS SOFTWARE IS PROVIDED ``AS IS''. ANY EXPRESS OR IMPLIED WARRANTIES,
27  * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28  * * IN NO EVENT SHALL JEREMY RUMPF OR ANY CONTRIBUTER TO THIS SOFTWARE BE
29  * * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
31  * * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32  * * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33  * * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34  * * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
35  * * THE POSSIBILITY OF SUCH DAMAGE
36  * *
37  * * HISTORY
38  * * 
39  * *
40  * * This source file created using 8 space tabs.
41  * *
42  * ******************************************************************************
43  ********************************************************************************/
44
45 #ifndef _UTILS_H
46 #define _UTILS_H
47
48
49 #include <syslog.h>
50 #include <sys/types.h>
51 #include <sys/uio.h>
52 #include "saslauthd.h"
53
54
55 /* log prioities */
56 #define L_ERR                   LOG_ERR
57 #define L_INFO                  LOG_INFO
58 #define L_DEBUG                 LOG_DEBUG
59
60
61 /* some magic to grab function names */
62 #ifdef HAVE_FUNC
63 # define L_FUNC __func__
64 # define HAVE_L_FUNC 1
65 #elif defined(HAVE_PRETTY_FUNCTION)
66 # define L_FUNC __PRETTY_FUNCTION__
67 # define HAVE_L_FUNC 1
68 #elif defined(HAVE_FUNCTION)
69 # define L_FUNC __FUNCTION__
70 # define HAVE_L_FUNC 1
71 #else
72 # define L_FUNC ""
73 # undef HAVE_L_FUNC
74 #endif
75
76 #ifdef HAVE_L_FUNC
77 # define L_STDERR_FORMAT        "saslauthd[%d] :%-16s: %s\n"
78 #else
79 # define L_STDERR_FORMAT        "saslauthd[%d] :%s%s\n"
80 #endif 
81
82
83 /* utils.c */
84 extern void     logger(int, const char *, const char *, ...);
85 extern ssize_t  tx_rec(int filefd, void *, size_t);
86 extern ssize_t  rx_rec(int , void *, size_t);
87 extern int      retry_writev(int, struct iovec *, int);
88
89
90 #endif  /* _UTILS_H */