28 #if defined(HAVE_STDARG_H)
31 #if defined(HAVE_VARARGS_H)
38 #if defined(__VXWORKS_OS__)
40 int osip_vsnprintf (
char *buf,
int max,
const char *fmt, va_list ap);
41 int osip_snprintf (
char *buf,
int max,
const char *fmt, ...);
43 #define snprintf osip_snprintf
44 #define vsnprintf osip_vsnprintf
51 #define SIP_SYNTAX_ERROR (-1)
52 #define SIP_NETWORK_ERROR (-2)
53 #define SIP_ECONNREFUSED (-3)
54 #define SIP_RESSOURCE_ERROR (-4)
55 #define SIP_GLOBAL_ERROR (-5)
65 #if !defined(WIN32) && !defined(_WIN32_WCE)
81 void *_osip_malloc (
size_t size,
char *file,
unsigned short line);
82 void _osip_free (
void *ptr);
83 void *_osip_realloc (
void *ptr,
size_t size,
char *file,
unsigned short line);
86 #define osip_malloc(S) _osip_malloc(S,__FILE__,__LINE__)
89 #define osip_realloc(P,S) _osip_realloc(P,S,__FILE__,__LINE__)
92 #define osip_free(P) { if (P!=NULL) { _osip_free(P); } }
99 #define osip_malloc(S) (osip_malloc_func?osip_malloc_func(S):malloc(S))
102 #define osip_realloc(P,S) (osip_realloc_func?osip_realloc_func(P,S):realloc(P,S))
105 #define osip_free(P) { if (P!=NULL) { if (osip_free_func) osip_free_func(P); else free(P);} }
111 #define osip_malloc(S) malloc(S)
114 #define osip_realloc(P,S) realloc(P,S)
117 #define osip_free(P) { if (P!=NULL) { free(P);} }
128 #define osip_malloc(S) _osip_malloc(S,__FILE__,__LINE__)
131 #define osip_realloc(P,S) _osip_realloc(P,S,__FILE__,__LINE__)
134 #define osip_free(P) { if (P!=NULL) { _osip_free(P); } }
137 void *_osip_malloc (
size_t size,
char *file,
unsigned short line);
138 void _osip_free (
void *ptr);
139 void *_osip_realloc (
void *ptr,
size_t size,
char *file,
unsigned short line);
149 #define alloca _alloca
172 #define osip_atoi atoi
173 #define osip_strcasecmp strcasecmp
174 #define osip_strncasecmp strncasecmp
183 char *
osip_strncpy (
char *dest,
const char *src,
size_t length);
194 unsigned long osip_hash (
const char *str);
197 char *
osip_clrncpy (
char *dst,
const char *src,
size_t len);
208 #define OSIP_FATAL TRACE_LEVEL0
210 #define OSIP_BUG TRACE_LEVEL1
212 #define OSIP_ERROR TRACE_LEVEL2
214 #define OSIP_WARNING TRACE_LEVEL3
216 #define OSIP_INFO1 TRACE_LEVEL4
218 #define OSIP_INFO2 TRACE_LEVEL5
220 #define OSIP_INFO3 TRACE_LEVEL6
222 #define OSIP_INFO4 TRACE_LEVEL7
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 )
263 #define OSIP_TRACE(P) P
265 #define OSIP_TRACE(P) do {} while (0)
268 #define REMOVE_ELEMENT(first_element, element) \
269 if (element->parent==NULL) \
270 { first_element = element->next; \
271 if (first_element!=NULL) \
272 first_element->parent = NULL; } \
274 { element->parent->next = element->next; \
275 if (element->next!=NULL) \
276 element->next->parent = element->parent; \
277 element->next = NULL; \
278 element->parent = NULL; }
280 #define ADD_ELEMENT(first_element, element) \
281 if (first_element==NULL) \
283 first_element = element; \
284 element->next = NULL; \
285 element->parent = NULL; \
289 element->next = first_element; \
290 element->parent = NULL; \
291 element->next->parent = element; \
292 first_element = element; \
295 #define APPEND_ELEMENT(type_of_element_t, first_element, element) \
296 if (first_element==NULL) \
297 { first_element = element; \
298 element->next = NULL; \
299 element->parent = NULL; } \
301 { type_of_element_t *f; \
302 for (f=first_element; f->next!=NULL; f=f->next) \
305 element->parent = f; \
306 element->next = NULL; \
314 #define OSIP_SUCCESS 0
315 #define OSIP_UNDEFINED_ERROR -1
316 #define OSIP_BADPARAMETER -2
317 #define OSIP_WRONG_STATE -3
318 #define OSIP_NOMEM -4
319 #define OSIP_SYNTAXERROR -5
320 #define OSIP_NOTFOUND -6
321 #define OSIP_API_NOT_INITIALIZED -7
322 #define OSIP_NO_NETWORK -10
323 #define OSIP_PORT_BUSY -11
324 #define OSIP_UNKNOWN_HOST -12
325 #define OSIP_DISK_FULL -30
326 #define OSIP_NO_RIGHTS -31
327 #define OSIP_FILE_NOT_EXIST -32
328 #define OSIP_TIMEOUT -50
329 #define OSIP_TOOMUCHCALL -51
330 #define OSIP_WRONG_FORMAT -52
331 #define OSIP_NOCOMMONCODEC -53
void osip_trace_enable_level(osip_trace_level_t level)
int osip_is_trace_level_activate(osip_trace_level_t level)
char * osip_str_append(char *dst, const char *src)
void osip_usleep(int useconds)
int osip_atoi(const char *number)
unsigned long osip_hash(const char *str)
void osip_trace_initialize_syslog(osip_trace_level_t level, char *ident)
const char * __osip_quote_find(const char *qstring)
void osip_free_func_t(void *ptr)
char * osip_strn_append(char *dst, const char *src, size_t len)
char * osip_strcasestr(const char *haystack, const char *needle)
const char * osip_strerror(int err)
int osip_tolower(char *word)
char * osip_enquote(const char *s)
void osip_trace_disable_level(osip_trace_level_t level)
osip_free_func_t * osip_free_func
enum _trace_level osip_trace_level_t
osip_realloc_func_t * osip_realloc_func
osip_malloc_func_t * osip_malloc_func
void * osip_realloc_func_t(void *ptr, size_t size)
void osip_set_allocators(osip_malloc_func_t *malloc_func, osip_realloc_func_t *realloc_func, osip_free_func_t *free_func)
#define osip_realloc(P, S)
int osip_strncasecmp(const char *s1, const char *s2, size_t len)
void osip_trace_func_t(char *fi, int li, osip_trace_level_t level, char *chfr, va_list ap)
int osip_strcasecmp(const char *s1, const char *s2)
int osip_trace_initialize(osip_trace_level_t level, FILE *file)
void osip_trace_initialize_func(osip_trace_level_t level, osip_trace_func_t *func)
unsigned int osip_build_random_number(void)
int __osip_set_next_token(char **dest, char *buf, int end_separator, char **next)
int osip_trace(char *fi, int li, osip_trace_level_t level, FILE *f, char *chfr,...)
char * osip_strdup_without_quote(const char *ch)
void * osip_malloc_func_t(size_t size)
void osip_dequote(char *s)
char * osip_strdup(const char *ch)
int osip_clrspace(char *word)
char * osip_clrncpy(char *dst, const char *src, size_t len)
char * osip_strncpy(char *dest, const char *src, size_t length)
void osip_trace_enable_until_level(osip_trace_level_t level)