/usr/include/osipparser2/osip_port.h is in libosip2-dev 4.1.0-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | /*
The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _OSIP_PORT_H_
#define _OSIP_PORT_H_
#include <stdio.h>
/* on android, va_list is only defined if stdarg.h is included before */
/* on other platform, it doesn't harm to have it */
#if defined(HAVE_STDARG_H)
#include <stdarg.h>
#else
#if defined(HAVE_VARARGS_H)
#include <varargs.h>
#else
#include <stdarg.h>
#endif
#endif
#if defined(__VXWORKS_OS__)
/* VxWorks lacks support for snprintf */
int osip_vsnprintf (char *buf, int max, const char *fmt, va_list ap);
int osip_snprintf (char *buf, int max, const char *fmt, ...);
#define snprintf osip_snprintf
#define vsnprintf osip_vsnprintf
#endif
#include <osipparser2/osip_const.h>
#include <osipparser2/osip_list.h>
#define SIP_SYNTAX_ERROR (-1)
#define SIP_NETWORK_ERROR (-2)
#define SIP_ECONNREFUSED (-3)
#define SIP_RESSOURCE_ERROR (-4)
#define SIP_GLOBAL_ERROR (-5)
#ifdef __cplusplus
extern "C" {
#endif
/**************************/
/* MALLOC redirections */
/**************************/
#if !defined(WIN32) && !defined(_WIN32_WCE)
#ifndef MINISIZE
typedef void *osip_malloc_func_t (size_t size);
typedef void osip_free_func_t (void *ptr);
typedef void *osip_realloc_func_t (void *ptr, size_t size);
extern osip_malloc_func_t *osip_malloc_func;
extern osip_realloc_func_t *osip_realloc_func;
extern osip_free_func_t *osip_free_func;
void osip_set_allocators (osip_malloc_func_t * malloc_func, osip_realloc_func_t * realloc_func, osip_free_func_t * free_func);
#endif
#ifdef DEBUG_MEM
void *_osip_malloc (size_t size, char *file, unsigned short line);
void _osip_free (void *ptr);
void *_osip_realloc (void *ptr, size_t size, char *file, unsigned short line);
#ifndef osip_malloc
#define osip_malloc(S) _osip_malloc(S,__FILE__,__LINE__)
#endif
#ifndef osip_realloc
#define osip_realloc(P,S) _osip_realloc(P,S,__FILE__,__LINE__)
#endif
#ifndef osip_free
#define osip_free(P) { if (P!=NULL) { _osip_free(P); } }
#endif
#else
#ifndef MINISIZE
#ifndef osip_malloc
#define osip_malloc(S) (osip_malloc_func?osip_malloc_func(S):malloc(S))
#endif
#ifndef osip_realloc
#define osip_realloc(P,S) (osip_realloc_func?osip_realloc_func(P,S):realloc(P,S))
#endif
#ifndef osip_free
#define osip_free(P) { if (P!=NULL) { if (osip_free_func) osip_free_func(P); else free(P);} }
#endif
#else
/* MINISIZE code */
#ifndef osip_malloc
#define osip_malloc(S) malloc(S)
#endif
#ifndef osip_realloc
#define osip_realloc(P,S) realloc(P,S)
#endif
#ifndef osip_free
#define osip_free(P) { if (P!=NULL) { free(P);} }
#endif
#endif
#endif
#else
#if 0 /* for windows test purpose */
#ifndef osip_malloc
#define osip_malloc(S) _osip_malloc(S,__FILE__,__LINE__)
#endif
#ifndef osip_realloc
#define osip_realloc(P,S) _osip_realloc(P,S,__FILE__,__LINE__)
#endif
#ifndef osip_free
#define osip_free(P) { if (P!=NULL) { _osip_free(P); } }
#endif
void *_osip_malloc (size_t size, char *file, unsigned short line);
void _osip_free (void *ptr);
void *_osip_realloc (void *ptr, size_t size, char *file, unsigned short line);
#else
void *osip_malloc (size_t size);
void *osip_realloc (void *, size_t size);
void osip_free (void *);
#endif
#endif
#ifdef WIN32
#define alloca _alloca
#endif
/**************************/
/* RANDOM number support */
/**************************/
unsigned int osip_build_random_number (void);
/**************************/
/* TIMER support */
/**************************/
#define SP " \0"
void osip_usleep (int useconds);
#ifndef MINISIZE
int osip_atoi (const char *number);
int osip_strcasecmp (const char *s1, const char *s2);
int osip_strncasecmp (const char *s1, const char *s2, size_t len);
char *osip_strcasestr (const char *haystack, const char *needle);
#else
#define osip_atoi atoi
#define osip_strcasecmp strcasecmp
#define osip_strncasecmp strncasecmp
#define osip_strcasestr strcasestr
#endif
/**************************/
/* STRING support */
/**************************/
char *osip_strncpy (char *dest, const char *src, size_t length);
char *osip_strdup (const char *ch);
char *osip_strdup_without_quote (const char *ch);
int osip_tolower (char *word);
int osip_clrspace (char *word);
int __osip_set_next_token (char **dest, char *buf, int end_separator, char **next);
/* find the next unescaped quote and return its index. */
char *__osip_quote_find (const char *qstring);
char *osip_enquote (const char *s);
void osip_dequote (char *s);
unsigned long osip_hash (const char *str);
char *osip_str_append (char *dst, const char *src);
char *osip_strn_append (char *dst, const char *src, size_t len);
char *osip_clrncpy (char *dst, const char *src, size_t len);
/**************************/
/* LOG&DEBUG support */
/**************************/
#define LOG_TRUE 1
#define LOG_FALSE 0
/* levels */
typedef enum _trace_level {
TRACE_LEVEL0 = 0,
#define OSIP_FATAL TRACE_LEVEL0
TRACE_LEVEL1 = 1,
#define OSIP_BUG TRACE_LEVEL1
TRACE_LEVEL2 = 2,
#define OSIP_ERROR TRACE_LEVEL2
TRACE_LEVEL3 = 3,
#define OSIP_WARNING TRACE_LEVEL3
TRACE_LEVEL4 = 4,
#define OSIP_INFO1 TRACE_LEVEL4
TRACE_LEVEL5 = 5,
#define OSIP_INFO2 TRACE_LEVEL5
TRACE_LEVEL6 = 6,
#define OSIP_INFO3 TRACE_LEVEL6
TRACE_LEVEL7 = 7,
#define OSIP_INFO4 TRACE_LEVEL7
END_TRACE_LEVEL = 8
} osip_trace_level_t;
typedef void osip_trace_func_t (char *fi, int li, osip_trace_level_t level, char *chfr, va_list ap);
/* these are defined in all cases, but are empty when oSIP is compiled
without trace */
void osip_trace_initialize_func (osip_trace_level_t level, osip_trace_func_t * func);
void osip_trace_initialize_syslog (osip_trace_level_t level, char *ident);
int osip_trace_initialize (osip_trace_level_t level, FILE * file);
void osip_trace_enable_until_level (osip_trace_level_t level);
void osip_trace_enable_level (osip_trace_level_t level);
void osip_trace_disable_level (osip_trace_level_t level);
int osip_is_trace_level_activate (osip_trace_level_t level);
#ifndef ENABLE_TRACE
#define TRACE_INITIALIZE(level, file) do { } while (0)
#define TRACE_ENABLE_LEVEL(level) do { } while (0)
#define TRACE_DISABLE_LEVEL(level) do { } while (0)
#define IS_TRACE_LEVEL_ACTIVATE(level) (-1)
#else
#define TRACE_INITIALIZE(level, file) osip_trace_initialize(level, file)
#define TRACE_ENABLE_LEVEL(level) osip_trace_enable_level ( level )
#define TRACE_DISABLE_LEVEL(level) osip_trace_disable_level ( level )
#define IS_TRACE_LEVEL_ACTIVATE(level) osip_is_trace_level_activate( level )
#endif
/* log facility. */
/* if f is NULL, current default log file is used. */
/* INPUT: level | level of the trace */
/* INPUT: f | use f instead of default log file */
/* INPUT: chfr | format string for next args */
int osip_trace (char *fi, int li, osip_trace_level_t level, FILE * f, char *chfr, ...);
#ifdef ENABLE_TRACE
#define OSIP_TRACE(P) P
#else
#define OSIP_TRACE(P) do {} while (0)
#endif
#define REMOVE_ELEMENT(first_element, element) \
if (element->parent==NULL) \
{ first_element = element->next; \
if (first_element!=NULL) \
first_element->parent = NULL; } \
else \
{ element->parent->next = element->next; \
if (element->next!=NULL) \
element->next->parent = element->parent; \
element->next = NULL; \
element->parent = NULL; }
#define ADD_ELEMENT(first_element, element) \
if (first_element==NULL) \
{ \
first_element = element; \
element->next = NULL; \
element->parent = NULL; \
} \
else \
{ \
element->next = first_element; \
element->parent = NULL; \
element->next->parent = element; \
first_element = element; \
}
#define APPEND_ELEMENT(type_of_element_t, first_element, element) \
if (first_element==NULL) \
{ first_element = element; \
element->next = NULL; /* useless */ \
element->parent = NULL; /* useless */ } \
else \
{ type_of_element_t *f; \
for (f=first_element; f->next!=NULL; f=f->next) \
{ } \
f->next = element; \
element->parent = f; \
element->next = NULL; \
}
const char *osip_strerror (int err);
#ifdef __cplusplus
}
#endif
#define OSIP_SUCCESS 0
#define OSIP_UNDEFINED_ERROR -1
#define OSIP_BADPARAMETER -2
#define OSIP_WRONG_STATE -3
#define OSIP_NOMEM -4
#define OSIP_SYNTAXERROR -5
#define OSIP_NOTFOUND -6
#define OSIP_API_NOT_INITIALIZED -7
#define OSIP_NO_NETWORK -10
#define OSIP_PORT_BUSY -11
#define OSIP_UNKNOWN_HOST -12
#define OSIP_DISK_FULL -30
#define OSIP_NO_RIGHTS -31
#define OSIP_FILE_NOT_EXIST -32
#define OSIP_TIMEOUT -50
#define OSIP_TOOMUCHCALL -51
#define OSIP_WRONG_FORMAT -52
#define OSIP_NOCOMMONCODEC -53
#endif /* _PORT_H_ */
|