ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libspf/docs/API/doxygen/html/util_8h-source.html
Revision: 1.1
Committed: Tue Nov 13 00:51:32 2007 UTC (18 years, 10 months ago) by root
Content type: text/html
Branch: MAIN
CVS Tags: HEAD
Log Message:
initial import of libspf-1.0.0-p5 from freebsd ports

File Contents

# Content
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>libSPF v1.0: util.h Source File</title>
4 <link href="doxygen.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.3.8 -->
7 <div class="qindex"> <form class="search" action="search.php" method="get">
8 <a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
9 <h1>util.h</h1><a href="util_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* libspf - Sender Policy Framework library</span>
10 00002 <span class="comment">*</span>
11 00003 <span class="comment">* ANSI C implementation of spf-draft-200405.txt</span>
12 00004 <span class="comment">*</span>
13 00005 <span class="comment">* Author: James Couzens &lt;jcouzens@codeshare.ca&gt;</span>
14 00006 <span class="comment">* Author: Sean Comeau &lt;scomeau@obscurity.org&gt;</span>
15 00007 <span class="comment">*</span>
16 00008 <span class="comment">* File: util.h</span>
17 00009 <span class="comment">* Desc: Utility function header file</span>
18 00010 <span class="comment">*</span>
19 00011 <span class="comment">* License:</span>
20 00012 <span class="comment">*</span>
21 00013 <span class="comment">* The libspf Software License, Version 1.0</span>
22 00014 <span class="comment">*</span>
23 00015 <span class="comment">* Copyright (c) 2004 James Couzens &amp; Sean Comeau All rights</span>
24 00016 <span class="comment">* reserved.</span>
25 00017 <span class="comment">*</span>
26 00018 <span class="comment">* Redistribution and use in source and binary forms, with or without</span>
27 00019 <span class="comment">* modification, are permitted provided that the following conditions</span>
28 00020 <span class="comment">* are met:</span>
29 00021 <span class="comment">*</span>
30 00022 <span class="comment">* 1. Redistributions of source code must retain the above copyright</span>
31 00023 <span class="comment">* notice, this list of conditions and the following disclaimer.</span>
32 00024 <span class="comment">*</span>
33 00025 <span class="comment">* 2. Redistributions in binary form must reproduce the above copyright</span>
34 00026 <span class="comment">* notice, this list of conditions and the following disclaimer in</span>
35 00027 <span class="comment">* the documentation and/or other materials provided with the</span>
36 00028 <span class="comment">* distribution.</span>
37 00029 <span class="comment">*</span>
38 00030 <span class="comment">* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</span>
39 00031 <span class="comment">* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</span>
40 00032 <span class="comment">* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</span>
41 00033 <span class="comment">* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS MAKING USE OF THIS LICESEN</span>
42 00034 <span class="comment">* OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
43 00035 <span class="comment">* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span>
44 00036 <span class="comment">* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</span>
45 00037 <span class="comment">* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span>
46 00038 <span class="comment">* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</span>
47 00039 <span class="comment">* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</span>
48 00040 <span class="comment">* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
49 00041 <span class="comment">* SUCH DAMAGE.</span>
50 00042 <span class="comment">*</span>
51 00043 <span class="comment">*/</span>
52 00044
53 00045
54 00046 <span class="preprocessor">#ifndef _UTIL_H</span>
55 <a name="l00047"></a><a class="code" href="util_8h.html#a0">00047</a> <span class="preprocessor"></span><span class="preprocessor">#define _UTIL_H 1</span>
56 00048 <span class="preprocessor"></span>
57 00049 <span class="preprocessor">#include "../../config.h"</span> <span class="comment">/* autoconf */</span>
58 00050 <span class="preprocessor">#include &lt;stdio.h&gt;</span> <span class="comment">/* stdin / stdout */</span>
59 00051 <span class="preprocessor">#include &lt;stdlib.h&gt;</span> <span class="comment">/* malloc / free */</span>
60 00052 <span class="preprocessor">#include &lt;stdarg.h&gt;</span> <span class="comment">/* va_sprintf */</span>
61 00053 <span class="preprocessor">#include &lt;string.h&gt;</span> <span class="comment">/* strstr / strdup */</span>
62 00054 <span class="preprocessor">#include &lt;strings.h&gt;</span> <span class="comment">/* strcasecmp */</span>
63 00055 <span class="preprocessor">#include &lt;unistd.h&gt;</span> <span class="comment">/* ? exit? */</span>
64 00056 <span class="preprocessor">#include &lt;sys/socket.h&gt;</span> <span class="comment">/* inet_ functions / structs */</span>
65 00057 <span class="preprocessor">#include &lt;netinet/in.h&gt;</span> <span class="comment">/* inet_ functions / structs */</span>
66 00058 <span class="preprocessor">#include &lt;time.h&gt;</span> <span class="comment">/* time_t */</span>
67 00059 <span class="preprocessor">#include &lt;ctype.h&gt;</span> <span class="comment">/* isdigit .. */</span>
68 00060
69 00061 <span class="preprocessor">#ifdef _WITH_SOLARIS</span>
70 00062 <span class="preprocessor"></span><span class="preprocessor">#include &lt;link.h&gt;</span> <span class="comment">/* uintptr_t */</span>
71 00063 <span class="preprocessor">#elif defined(__FreeBSD__)</span>
72 00064 <span class="preprocessor"></span><span class="preprocessor">#include &lt;inttypes.h&gt;</span> <span class="comment">/* uintptr_t */</span>
73 00065 <span class="preprocessor">#else</span>
74 00066 <span class="preprocessor"></span><span class="preprocessor">#include &lt;stdint.h&gt;</span> <span class="comment">/* uintptr_t */</span>
75 00067 <span class="preprocessor">#endif </span><span class="comment">/* _WITH_SOLARIS */</span>
76 00068
77 00069 <span class="preprocessor">#ifdef _HAVE_INTTYPES_H</span>
78 00070 <span class="preprocessor"></span><span class="preprocessor">#include &lt;inttypes.h&gt;</span>
79 00071 <span class="preprocessor">#endif </span><span class="comment">/* HAVE_INTTYPES_H */</span>
80 00072
81 00073 <span class="preprocessor">#include "<a class="code" href="main_8h.html">main.h</a>"</span> <span class="comment">/* for the flags man */</span>
82 00074
83 00075 <span class="preprocessor">#ifdef _WITH_PTHREADS</span>
84 00076 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="dns_8h.html">dns.h</a>"</span> <span class="comment">/* xgethostbyname */</span>
85 00077 <span class="preprocessor">#endif </span><span class="comment">/* _WITH_PTHREADS */</span>
86 00078
87 00079 <span class="preprocessor">#ifdef HAVE__BEGIN_DECLS</span>
88 00080 <span class="preprocessor"></span>__BEGIN_DECLS
89 00081 <span class="preprocessor">#else</span>
90 00082 <span class="preprocessor"></span><span class="preprocessor"># ifdef __cplusplus</span>
91 00083 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
92 00084 <span class="preprocessor"># endif </span><span class="comment">/* __cplusplus */</span>
93 00085 <span class="preprocessor">#endif </span><span class="comment">/* HAVE__BEGIN_DECLS */</span>
94 00086
95 00087
96 00088
97 00089 <span class="comment">/*</span>
98 00090 <span class="comment"> * define declarations</span>
99 00091 <span class="comment"> *</span>
100 00092 <span class="comment">*/</span>
101 00093
102 00094 <span class="comment">/* maximum size of buffer for date time stamp */</span>
103 <a name="l00095"></a><a class="code" href="util_8h.html#a1">00095</a> <span class="preprocessor">#define SPF_MAX_DATETIME 26</span>
104 00096 <span class="preprocessor"></span>
105 00097 <span class="comment">/* max size of gethostbyname_r data buffer */</span>
106 <a name="l00098"></a><a class="code" href="util_8h.html#a2">00098</a> <span class="preprocessor">#define SPF_MAX_GHBNR_DBUF 2048</span>
107 00099 <span class="preprocessor"></span>
108 00100
109 00101 <span class="comment">/*</span>
110 00102 <span class="comment"> * In ANSI C, and indeed any rational implementation, size_t is also the</span>
111 00103 <span class="comment"> * type returned by sizeof(). However, it seems there are some irrational</span>
112 00104 <span class="comment"> * implementations out there, in which sizeof() returns an int even though</span>
113 00105 <span class="comment"> * size_t is defined as long or unsigned long. To ensure consistent results</span>
114 00106 <span class="comment"> * we always use this SIZEOF() macro in place of using sizeof() directly.</span>
115 00107 <span class="comment">*/</span>
116 <a name="l00108"></a><a class="code" href="util_8h.html#a3">00108</a> <span class="preprocessor">#define SIZEOF(object) ((size_t) sizeof(object))</span>
117 00109 <span class="preprocessor"></span>
118 00110
119 00111 <span class="preprocessor">#ifndef HAVE___FUNCTION__</span>
120 00112 <span class="preprocessor"></span><span class="preprocessor"># ifdef HAVE___FUNC__</span>
121 00113 <span class="preprocessor"></span><span class="preprocessor"># define __FUNCTION__ __func__</span>
122 00114 <span class="preprocessor"></span><span class="preprocessor"># else</span>
123 00115 <span class="preprocessor"></span><span class="preprocessor"># define __FUNCTION__ "?"</span>
124 00116 <span class="preprocessor"></span><span class="preprocessor"># endif </span><span class="comment">/* HAVE___FUNC__ */</span>
125 00117 <span class="preprocessor">#endif </span><span class="comment">/* HAVE___FUNCTION__ */</span>
126 00118
127 00119
128 00120 <span class="comment">/*</span>
129 00121 <span class="comment"> * memory allocation and string handling wrapper macros</span>
130 00122 <span class="comment"> *</span>
131 00123 <span class="comment">*/</span>
132 00124
133 <a name="l00125"></a><a class="code" href="util_8h.html#a4">00125</a> <span class="preprocessor">#define xmalloc(n) UTIL_malloc(n, __FILE__, __LINE__, __FUNCTION__)</span>
134 <a name="l00126"></a><a class="code" href="util_8h.html#a5">00126</a> <span class="preprocessor"></span><span class="preprocessor">#define xrealloc(m, n) UTIL_realloc(m, n, __FILE__, __LINE__, __FUNCTION__)</span>
135 <a name="l00127"></a><a class="code" href="util_8h.html#a6">00127</a> <span class="preprocessor"></span><span class="preprocessor">#define xfree(m) UTIL_free(m, __FILE__, __LINE__, __FUNCTION__)</span>
136 <a name="l00128"></a><a class="code" href="util_8h.html#a7">00128</a> <span class="preprocessor"></span><span class="preprocessor">#define xstrdup(m) UTIL_strdup(m)</span>
137 <a name="l00129"></a><a class="code" href="util_8h.html#a8">00129</a> <span class="preprocessor"></span><span class="preprocessor">#define xstrndup(m, n) UTIL_strndup(m, n)</span>
138 00130 <span class="preprocessor"></span>
139 00131
140 00132 <span class="comment">/*</span>
141 00133 <span class="comment"> * printf wrapper macros</span>
142 00134 <span class="comment"> *</span>
143 00135 <span class="comment">*/</span>
144 00136
145 00137 <span class="comment">/* printf with variadic macros */</span>
146 <a name="l00138"></a><a class="code" href="util_8h.html#a9">00138</a> <span class="preprocessor">#define xprintf(format,...) \</span>
147 00139 <span class="preprocessor"> dbg_printf(FL_A, __FUNCTION__, __FILE__, __LINE__, format, __VA_ARGS__)</span>
148 00140 <span class="preprocessor"></span>
149 00141 <span class="comment">/* more verbose printf with variadic macros */</span>
150 <a name="l00142"></a><a class="code" href="util_8h.html#a10">00142</a> <span class="preprocessor">#define xvprintf(format,...) \</span>
151 00143 <span class="preprocessor"> dbg_printf(FL_B, __FUNCTION__, __FILE__, __LINE__, format, __VA_ARGS__)</span>
152 00144 <span class="preprocessor"></span>
153 00145 <span class="comment">/* printf without variadic macros (passing only a single string) */</span>
154 <a name="l00146"></a><a class="code" href="util_8h.html#a11">00146</a> <span class="preprocessor">#define xpprintf(s) \</span>
155 00147 <span class="preprocessor"> dbg_pprintf(FL_D, __FUNCTION__, __FILE__, __LINE__, s) </span>
156 00148 <span class="preprocessor"></span>
157 00149 <span class="comment">/* error printf with variadic macros */</span>
158 <a name="l00150"></a><a class="code" href="util_8h.html#a12">00150</a> <span class="preprocessor">#define xeprintf(format,...) \</span>
159 00151 <span class="preprocessor"> dbg_printf(FL_E, __FUNCTION__, __FILE__, __LINE__, format, __VA_ARGS__)</span>
160 00152 <span class="preprocessor"></span>
161 00153 <span class="comment">/* error printf without variadic macros */</span>
162 <a name="l00154"></a><a class="code" href="util_8h.html#a13">00154</a> <span class="preprocessor">#define xepprintf(s) \</span>
163 00155 <span class="preprocessor"> dbg_pprintf(FL_F, __FUNCTION__, __FILE__, __LINE__, s)</span>
164 00156 <span class="preprocessor"></span>
165 00157
166 00158 <span class="comment">/*</span>
167 00159 <span class="comment"> * threading wrapper macros</span>
168 00160 <span class="comment"> *</span>
169 00161 <span class="comment">*/</span>
170 00162
171 <a name="l00163"></a><a class="code" href="util_8h.html#a14">00163</a> <span class="preprocessor">#define xpthread_mutex_lock(m) _UTIL_pthread_mutex(m, SPF_TRUE)</span>
172 <a name="l00164"></a><a class="code" href="util_8h.html#a15">00164</a> <span class="preprocessor"></span><span class="preprocessor">#define xpthread_mutex_unlock(m) _UTIL_pthread_mutex(m, SPF_FALSE)</span>
173 00165 <span class="preprocessor"></span>
174 00166
175 00167 <span class="comment">/* for handing debug modes */</span>
176 <a name="l00168"></a><a class="code" href="util_8h.html#a16">00168</a> <span class="preprocessor">#define f_bit_set(fl_bit_vector, bit) ((int)((fl_bit_vector)&amp;(bit)))</span>
177 00169 <span class="preprocessor"></span>
178 00170 <span class="comment">/* this table and macro came from wget more or less */</span>
179 <a name="l00171"></a><a class="code" href="util_8h.html#a17">00171</a> <span class="preprocessor">#define urlchr_test(c) (urlchr_table[(unsigned char)(c)] &amp; 1)</span>
180 <a name="l00172"></a><a class="code" href="util_8h.html#a22">00172</a> <span class="preprocessor"></span><span class="keyword">static</span> <span class="keyword">const</span> u_char <a class="code" href="util_8h.html#a22">urlchr_table</a>[256] =
181 00173 {
182 00174 1, 1, 1, 1, 1, 1, 1, 1, <span class="comment">/* NUL SOH STX ETX EOT ENQ ACK BEL */</span>
183 00175 1, 1, 1, 1, 1, 1, 1, 1, <span class="comment">/* BS HT LF VT FF CR SO SI */</span>
184 00176 1, 1, 1, 1, 1, 1, 1, 1, <span class="comment">/* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */</span>
185 00177 1, 1, 1, 1, 1, 1, 1, 1, <span class="comment">/* CAN EM SUB ESC FS GS RS US */</span>
186 00178 1, 0, 1, 1, 0, 1, 1, 0, <span class="comment">/* SP ! " # $ % &amp; ' */</span>
187 00179 0, 0, 0, 1, 0, 0, 0, 1, <span class="comment">/* ( ) * + , - . / */</span>
188 00180 0, 0, 0, 0, 0, 0, 0, 0, <span class="comment">/* 0 1 2 3 4 5 6 7 */</span>
189 00181 0, 0, 1, 1, 1, 1, 1, 1, <span class="comment">/* 8 9 : ; &lt; = &gt; ? */</span>
190 00182 1, 0, 0, 0, 0, 0, 0, 0, <span class="comment">/* @ A B C D E F G */</span>
191 00183 0, 0, 0, 0, 0, 0, 0, 0, <span class="comment">/* H I J K L M N O */</span>
192 00184 0, 0, 0, 0, 0, 0, 0, 0, <span class="comment">/* P Q R S T U V W */</span>
193 00185 0, 0, 0, 1, 1, 1, 1, 0, <span class="comment">/* X Y Z [ \ ] ^ _ */</span>
194 00186 1, 0, 0, 0, 0, 0, 0, 0, <span class="comment">/* ` a b c d e f g */</span>
195 00187 0, 0, 0, 0, 0, 0, 0, 0, <span class="comment">/* h i j k l m n o */</span>
196 00188 0, 0, 0, 0, 0, 0, 0, 0, <span class="comment">/* p q r s t u v w */</span>
197 00189 0, 0, 0, 1, 1, 1, 1, 1, <span class="comment">/* x y z { | } ~ DEL */</span>
198 00190
199 00191 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
200 00192 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
201 00193 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
202 00194 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
203 00195
204 00196 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
205 00197 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
206 00198 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
207 00199 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208 00200 };
209 00201
210 00202
211 00203
212 00204 <span class="comment">/*</span>
213 00205 <span class="comment"> * Debug logging / Debug dummy wrappers </span>
214 00206 <span class="comment"> *</span>
215 00207 <span class="comment">*/</span>
216 00208
217 00209 <span class="comment">/* output file for debugging */</span>
218 <a name="l00210"></a><a class="code" href="util_8h.html#a18">00210</a> <span class="preprocessor">#define DEBUG_LOG_FILE "/var/log/spf.log"</span>
219 00211 <span class="preprocessor"></span>
220 00212 <span class="comment">/* output file for transaction logging */</span>
221 <a name="l00213"></a><a class="code" href="util_8h.html#a19">00213</a> <span class="preprocessor">#define OUTPUT_LOG_FILE "/var/log/spflog.txt"</span>
222 00214 <span class="preprocessor"></span>
223 00215 <span class="preprocessor">#if defined _SPF_DEBUG</span>
224 00216 <span class="preprocessor"></span><span class="preprocessor">#define dbg_printf _printf_dbg</span>
225 00217 <span class="preprocessor"></span><span class="preprocessor">#define dbg_pprintf _pprintf_dbg</span>
226 00218 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
227 00219 <span class="preprocessor"></span>
228 00220 <span class="preprocessor">#ifndef _SPF_DEBUG</span>
229 <a name="l00221"></a><a class="code" href="util_8h.html#a20">00221</a> <span class="preprocessor"></span><span class="preprocessor">#define dbg_printf _dummy_debug</span>
230 <a name="l00222"></a><a class="code" href="util_8h.html#a21">00222</a> <span class="preprocessor"></span><span class="preprocessor">#define dbg_pprintf _dummy_pdebug</span>
231 00223 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
232 00224 <span class="preprocessor"></span>
233 00225
234 00226
235 00227 <span class="comment">/*</span>
236 00228 <span class="comment"> * function declarations</span>
237 00229 <span class="comment"> *</span>
238 00230 <span class="comment">*/</span>
239 00231
240 00232
241 00233 <span class="comment">/*</span>
242 00234 <span class="comment"> * Debugging</span>
243 00235 <span class="comment"> *</span>
244 00236 <span class="comment">*/</span>
245 00237 <span class="keywordtype">void</span> <a class="code" href="util_8h.html#a24">_printf_dbg</a>(<span class="keyword">const</span> u_int8_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> size_t,
246 00238 <span class="keyword">const</span> <span class="keywordtype">char</span> *, ...);
247 00239
248 00240 <span class="keywordtype">void</span> <a class="code" href="util_8h.html#a25">_pprintf_dbg</a>(<span class="keyword">const</span> u_int8_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> size_t,
249 00241 <span class="keyword">const</span> <span class="keywordtype">char</span> *);
250 00242
251 00243 <span class="keywordtype">void</span> <a class="code" href="util_8h.html#a26">_dummy_debug</a>(<span class="keyword">const</span> u_int8_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> size_t,
252 00244 <span class="keyword">const</span> <span class="keywordtype">char</span> *, ...);
253 00245
254 00246 <span class="keywordtype">void</span> <a class="code" href="util_8h.html#a27">_dummy_pdebug</a>(<span class="keyword">const</span> u_int8_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> size_t,
255 00247 <span class="keyword">const</span> <span class="keywordtype">char</span> *);
256 00248
257 00249
258 00250 <span class="comment">/*</span>
259 00251 <span class="comment"> * Memory allocation / deallocation</span>
260 00252 <span class="comment"> *</span>
261 00253 <span class="comment">*/</span>
262 00254
263 00255 <span class="keywordtype">void</span> *<a class="code" href="util_8h.html#a28">UTIL_malloc</a>(<span class="keyword">const</span> int32_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> int32_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
264 00256 <span class="keywordtype">void</span> *<a class="code" href="util_8h.html#a29">UTIL_realloc</a>(<span class="keywordtype">void</span> *, <span class="keyword">const</span> int32_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> int32_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
265 00257 <span class="keywordtype">void</span> <a class="code" href="util_8h.html#a30">UTIL_free</a>(<span class="keywordtype">void</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> int32_t, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
266 00258
267 00259
268 00260 <span class="comment">/*</span>
269 00261 <span class="comment"> * String handling / SPF query handling (string related)</span>
270 00262 <span class="comment"> *</span>
271 00263 <span class="comment">*/</span>
272 00264
273 00265 <span class="keywordtype">void</span> <a class="code" href="util_8h.html#a31">UTIL_log_result</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *);
274 00266 <span class="keywordtype">char</span> *<a class="code" href="util_8c.html#a6">UTIL_get_date</a>(<span class="keywordtype">void</span>);
275 00267 <span class="keywordtype">char</span> *<a class="code" href="util_8h.html#a33">UTIL_strndup</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> size_t);
276 00268 <span class="keywordtype">char</span> *<a class="code" href="util_8h.html#a34">UTIL_strdup</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
277 00269 int16_t <a class="code" href="util_8h.html#a35">UTIL_index</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span>);
278 00270 <span class="keywordtype">char</span> *<a class="code" href="util_8h.html#a36">UTIL_split_str</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span>, <span class="keyword">const</span> u_int8_t);
279 00271 <span class="keywordtype">char</span> *<a class="code" href="util_8h.html#a37">UTIL_split_strr</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span>, <span class="keyword">const</span> u_int8_t);
280 00272 u_int8_t <a class="code" href="util_8h.html#a38">UTIL_count_delim</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span>);
281 00273 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a39">UTIL_is_spf_delim</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>);
282 00274 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a40">UTIL_is_spf_result</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>);
283 00275 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a41">UTIL_is_macro</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
284 00276
285 00277
286 00278 <span class="comment">/*</span>
287 00279 <span class="comment"> * SPF Mechanism parsing</span>
288 00280 <span class="comment"> *</span>
289 00281 <span class="comment">*/</span>
290 00282
291 00283 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a42">UTIL_mx_cmp</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> int8_t);
292 00284 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a43">UTIL_a_cmp</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> int8_t);
293 00285 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a44">UTIL_ptr_cmp</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
294 00286
295 00287
296 00288 <span class="comment">/*</span>
297 00289 <span class="comment"> * General utility</span>
298 00290 <span class="comment"> *</span>
299 00291 <span class="comment">*/</span>
300 00292
301 00293 <a class="code" href="spf_8h.html#a38">SPF_MECHANISM</a> <a class="code" href="util_8h.html#a45">UTIL_get_policy_mech</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
302 00294 <a class="code" href="spf_8h.html#a36">SPF_RESULT</a> <a class="code" href="util_8h.html#a46">UTIL_get_mech_prefix</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
303 00295 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a47">UTIL_assoc_prefix</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *, <a class="code" href="spf_8h.html#a36">SPF_RESULT</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
304 00296 <a class="code" href="structpolicy__addr__s.html">policy_addr_t</a> *<a class="code" href="util_8h.html#a48">UTIL_expand_ip</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
305 00297 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a39">UTIL_is_spf_delim</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> );
306 00298 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a49">UTIL_is_ip</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
307 00299
308 00300
309 00301 <span class="comment">/*</span>
310 00302 <span class="comment"> * DNS related parsing </span>
311 00303 <span class="comment"> *</span>
312 00304 <span class="comment">*/</span>
313 00305
314 00306 <span class="keywordtype">char</span> *<a class="code" href="util_8h.html#a50">UTIL_rev_addr</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
315 00307 <span class="keywordtype">char</span> *<a class="code" href="util_8h.html#a51">UTIL_get_dname</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
316 00308 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a52">UTIL_cidr_cmp</a>(<span class="keyword">const</span> <a class="code" href="structpolicy__addr__s.html">policy_addr_t</a> *, <span class="keyword">const</span> <span class="keyword">struct</span> in_addr *);
317 00309 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a53">UTIL_validate_ptr</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *);
318 00310 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a54">UTIL_validate_hostname</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> int8_t);
319 00311 <span class="keywordtype">char</span> *<a class="code" href="util_8h.html#a55">UTIL_url_encode</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *);
320 00312 <span class="keywordtype">char</span> *<a class="code" href="util_8h.html#a56">UTIL_reverse</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span>);
321 00313 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="util_8h.html#a57">UTIL_addnode</a>(<a class="code" href="structsplit__str__s.html">split_str_t</a> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <a class="code" href="spf_8h.html#a35">SPF_BOOL</a>);
322 00314
323 00315
324 00316 <span class="comment">/*</span>
325 00317 <span class="comment"> * Threading (linux pthreads)</span>
326 00318 <span class="comment"> *</span>
327 00319 <span class="comment">*/</span>
328 00320
329 00321 <span class="keywordtype">void</span> <a class="code" href="util_8h.html#a58">_UTIL_pthread_mutex</a>(<span class="keywordtype">void</span> *, <a class="code" href="spf_8h.html#a35">SPF_BOOL</a>);
330 00322
331 00323
332 00324 <span class="preprocessor">#ifdef _WITH_PTHREADS</span>
333 00325 <span class="preprocessor"></span>
334 00326 <span class="comment">/* pthreads utility mutex (used by debugging and date/time) */</span>
335 00327 <span class="keyword">extern</span> pthread_mutex_t <a class="code" href="util_8c.html#a0">util_mutex</a>;
336 00328
337 00329 <span class="preprocessor">#else</span>
338 00330 <span class="preprocessor"></span>
339 00331 <span class="comment">/* pthreads utility mutex dummy wrapper */</span>
340 00332 <span class="keyword">extern</span> <span class="keywordtype">void</span> *<a class="code" href="util_8c.html#a0">util_mutex</a>;
341 00333
342 00334 <span class="preprocessor">#endif </span><span class="comment">/* _WITH_PTHREADS */</span>
343 00335
344 00336
345 00337 <span class="preprocessor">#ifdef HAVE__BEGIN_DECLS</span>
346 00338 <span class="preprocessor"></span>__END_DECLS <span class="comment">/* _UTIL_H */</span>
347 00339 <span class="preprocessor">#else</span>
348 00340 <span class="preprocessor"></span><span class="preprocessor"># ifdef __cplusplus</span>
349 00341 <span class="preprocessor"></span>}
350 00342 <span class="preprocessor"># endif </span><span class="comment">/* __cplusplus */</span>
351 00343 <span class="preprocessor">#endif </span><span class="comment">/* HAVE__BEGIN_DECLS */</span>
352 00344
353 00345 <span class="preprocessor">#endif </span><span class="comment">/* _UTIL_H */</span>
354 00346
355 00347 <span class="comment">/* end util.h */</span>
356 </div></pre><hr size="1"><address style="align: right;"><small>Generated on Thu Sep 16 18:10:47 2004 for libSPF v1.0 by
357 <a href="http://www.doxygen.org/index.html">
358 <img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
359 </body>
360 </html>