2 The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-)
3 Copyright (C) 2001 Aymeric MOIZARD jack@atosc.org
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 /* Include necessary headers for osip */
29 #define STDC_HEADERS 1
30 #define HAVE_CTYPE_H 1
31 #define HAVE_STRING_H 1
32 #define HAVE_SYS_TYPES_H 1
34 #define HAVE_STDARG_H 1
36 /* use win32 crypto routines for random number generation */
37 /* only use for vs .net (compiler v. 1300) or greater */
39 #define WIN32_USE_CRYPTO 1
42 #elif defined _WIN32_WCE
44 #define STDC_HEADERS 1
45 #define HAVE_CTYPE_H 1
46 #define HAVE_STRING_H 1
48 #define HAVE_STDARG_H 1
50 #define strnicmp _strnicmp
51 #define stricmp _stricmp
61 #define VA_START(a, f) va_start(a, f)
63 #else /* end of __VXWORKS_OS__ */
65 #if defined (HAVE_CONFIG_H)
67 # if defined (HAVE_STRING_H)
71 # endif /* HAVE_STRING_H */
74 #endif /* !HAVE_CONFIG_H */
76 #if defined (HAVE_SYS_TYPES_H)
77 # include <sys/types.h>
82 #endif /* !STDC_HEADERS */
84 #if defined(HAVE_STDARG_H) || defined(WIN32)
86 # define VA_START(a, f) va_start(a, f)
88 # if defined(HAVE_VARARGS_H)
90 # define VA_START(a, f) va_start(a)
93 # define VA_START(a, f) va_start(a, f)
101 #if defined (HAVE_SYS_TIME_H)
102 # include <sys/time.h>
105 #endif /* end of !__VXWORKS_OS__ */
108 #define VA_START(a, f) va_start(a, f)
112 #define VA_START(a, f) va_start(a, f)
116 #define VA_START(a, f) va_start(a, f)
121 # define PARAMS(args) args
126 # define PARAMS(args) ()
129 #include <osipparser2/osip_const.h>
131 #include <osipparser2/osip_list.h>
133 #define SIP_SYNTAX_ERROR (-1)
134 #define SIP_NETWORK_ERROR (-2)
135 #define SIP_ECONNREFUSED (-3)
136 #define SIP_RESSOURCE_ERROR (-4)
137 #define SIP_GLOBAL_ERROR (-5)
144 /**************************/
145 /* MALLOC redirections */
146 /**************************/
151 #define osip_malloc(S) malloc(S)
154 #define osip_free(P) { if (P!=NULL) free(P); }
158 void *osip_malloc(size_t size);
159 void osip_free(void *);
163 #define alloca _alloca
166 /**************************/
167 /* RANDOM number support */
168 /**************************/
170 unsigned int osip_build_random_number (void);
172 /**************************/
174 /**************************/
178 void osip_usleep (int useconds);
180 /**************************/
182 /**************************/
184 int osip_atoi (const char *number);
185 char *osip_strncpy (char *dest, const char *src, size_t length);
186 char *osip_strdup (const char *ch);
187 char *osip_strdup_without_quote (const char *ch);
188 int osip_tolower (char *word);
189 int osip_clrspace (char *word);
190 char *__osip_sdp_append_string (char *string, size_t size,
191 char *cur, char *string_osip_to_append);
192 int __osip_set_next_token (char **dest, char *buf, int end_separator,
194 /* find the next unescaped quote and return its index. */
195 char *__osip_quote_find (const char *qstring);
196 char *osip_enquote (const char *s);
197 void osip_dequote (char *s);
199 int osip_strcasecmp (const char *s1, const char *s2);
200 int osip_strncasecmp (const char *s1, const char *s2, size_t len);
202 /**************************/
203 /* LOG&DEBUG support */
204 /**************************/
209 typedef enum _trace_level
218 #define OSIP_WARNING 3
231 /* these are defined in all cases, but are empty when oSIP is compiled
233 void osip_trace_initialize_syslog (osip_trace_level_t level, char *ident);
234 void osip_trace_initialize (osip_trace_level_t level, FILE * file);
235 void osip_trace_enable_level (osip_trace_level_t level);
236 void osip_trace_disable_level (osip_trace_level_t level);
237 int osip_is_trace_level_activate (osip_trace_level_t level);
241 #define TRACE_INITIALIZE(level, file) do { } while (0)
242 #define TRACE_ENABLE_LEVEL(level) do { } while (0)
243 #define TRACE_DISABLE_LEVEL(level) do { } while (0)
244 #define IS_TRACE_LEVEL_ACTIVATE(level) (-1)
248 #define TRACE_INITIALIZE(level, file) osip_trace_initialize(level, file)
249 #define TRACE_ENABLE_LEVEL(level) osip_trace_enable_level ( level )
250 #define TRACE_DISABLE_LEVEL(level) osip_trace_disable_level ( level )
251 #define IS_TRACE_LEVEL_ACTIVATE(level) osip_is_trace_level_activate( level )
256 /* if f is NULL, current default log file is used. */
257 /* INPUT: level | level of the trace */
258 /* INPUT: f | use f instead of default log file */
259 /* INPUT: chfr | format string for next args */
260 int osip_trace (char *fi, int li, osip_trace_level_t level, FILE * f,
264 #define OSIP_TRACE(P) P
266 #define OSIP_TRACE(P) do {} while (0)
273 #endif /* _PORT_H_ */