00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <osipparser2/osip_port.h>
00022
00023 #ifndef _INTERNAL_H_
00024 #define _INTERNAL_H_
00025
00026 #ifdef __BORLANDC__
00027 #define _timeb timeb
00028 #define _ftime ftime
00029 #endif
00030
00031 #ifndef DOXYGEN
00032
00033 #if !( defined(__rtems__) || defined(__PALMOS__) || defined(HAVE_STRUCT_TIMEVAL) )
00034
00035 struct timeval
00036 {
00037 long tv_sec;
00038 long tv_usec;
00039 };
00040 #endif
00041
00047 typedef struct __payload __payload_t;
00048
00049 struct __payload
00050 {
00051 char *payload;
00052
00053 char *number_of_port;
00054 char *proto;
00055 char *c_nettype;
00056 char *c_addrtype;
00057 char *c_addr;
00058 char *c_addr_multicast_ttl;
00059 char *c_addr_multicast_int;
00060
00061 char *a_rtpmap;
00062 };
00063
00064
00069 int __payload_init (__payload_t ** payload);
00070
00075 void __payload_free (__payload_t * payload);
00076
00077
00078 #ifdef OSIP_MT
00079
00080
00081 #if defined(__rtems__)
00082 #include <rtems.h>
00083 #else
00084
00085
00086
00087 #if !defined(__VXWORKS_OS__) && !defined(__PSOS__) && \
00088 !defined(WIN32) && !defined(_WIN32_WCE) && !defined(HAVE_PTHREAD_WIN32) && \
00089 !defined(HAVE_PTHREAD) && !defined(HAVE_PTHREAD_H) && !defined(HAVE_PTH_PTHREAD_H)
00090 #error No thread implementation found!
00091 #endif
00092
00093
00094
00095
00096 #if defined(HAVE_PTHREAD) || defined(HAVE_PTHREAD_H) || defined(HAVE_PTH_PTHREAD_H) || \
00097 defined(HAVE_PTHREAD_WIN32)
00098 #if defined(__arc__)
00099 #include <ucos_ii_api.h>
00100 #endif
00101
00102
00103 #include <pthread.h>
00104 typedef pthread_t osip_thread_t;
00105 #endif
00106
00107
00108 #if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(HAVE_PTHREAD_WIN32)
00109
00110 #define _WINSOCKAPI_
00111 #include <windows.h>
00112 #undef _WINSOCKAPI_
00113 typedef struct
00114 {
00115 HANDLE h;
00116 unsigned id;
00117 }
00118 osip_thread_t;
00119 #endif
00120
00121 #ifdef __VXWORKS_OS__
00122 #include <taskLib.h>
00123 typedef struct
00124 {
00125 int id;
00126 }
00127 osip_thread_t;
00128 #endif
00129
00130 #ifdef __PSOS__
00131 #include <psos.h>
00132 typedef struct
00133 {
00134 unsigned long tid;
00135 }
00136 osip_thread_t;
00137 #endif
00138
00139
00140
00141
00142
00143 #if !defined(HAVE_SEMAPHORE_H) && !defined(HAVE_SYS_SEM_H) && \
00144 !defined(WIN32) && !defined(_WIN32_WCE) && !defined(HAVE_PTHREAD_WIN32) && \
00145 !defined(__PSOS__) && !defined(__VXWORKS_OS__) && !defined(__arc__)
00146 #error No semaphore implementation found
00147 #endif
00148
00149
00150 #if defined(HAVE_PTHREAD) || defined(HAVE_PTHREAD_H) || defined(HAVE_PTH_PTHREAD_H) || \
00151 defined(HAVE_PTHREAD_WIN32)
00152 typedef pthread_mutex_t osip_mutex_t;
00153 #endif
00154
00155 #ifdef __sun__
00156 #include <semaphore.h>
00157 #undef getdate
00158 #include <synch.h>
00159 #endif
00160
00161 #if defined(__arc__)
00162
00163 typedef struct
00164 {
00165 int _sem_counter;
00166 struct osip_mutex *_sem_mutex;
00167 } sem_t;
00168
00169 typedef sem_t osip_sem_t;
00170
00171 #elif (defined(HAVE_SEMAPHORE_H) && !defined(__APPLE_CC__)) || defined(HAVE_PTHREAD_WIN32)
00172 #include <semaphore.h>
00173 #ifdef __sun__
00174 #undef getdate
00175 #include <synch.h>
00176 #endif
00177
00181 typedef sem_t osip_sem_t;
00182
00183 #elif defined(HAVE_SYS_SEM_H)
00184 #include <sys/types.h>
00185 #include <sys/ipc.h>
00186 #include <sys/sem.h>
00187 typedef struct
00188 {
00189 int semid;
00190 }
00191 osip_sem_t;
00192 #endif
00193
00194
00195 #if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(HAVE_PTHREAD_WIN32)
00196
00197 #define _WINSOCKAPI_
00198 #include <windows.h>
00199 #undef _WINSOCKAPI_
00200
00201 #if (_WIN32_WINNT >= 0x0500)
00202
00203 #define OSIP_CRITICALSECTION_SPIN 4000
00204 typedef struct
00205 {
00206 CRITICAL_SECTION h;
00207 }
00208 osip_mutex_t;
00209 #else
00210
00211 typedef struct
00212 {
00213 HANDLE h;
00214 }
00215 osip_mutex_t;
00216 #endif
00217
00218 typedef struct
00219 {
00220 HANDLE h;
00221 }
00222 osip_sem_t;
00223 #endif
00224
00225 #ifdef __VXWORKS_OS__
00226 #include <semaphore.h>
00227 #include <semLib.h>
00228 typedef struct semaphore osip_mutex_t;
00229 typedef sem_t osip_sem_t;
00230 #endif
00231
00232 #ifdef __PSOS__
00233 #include <Types.h>
00234 #include <os.h>
00235 typedef struct
00236 {
00237 UInt32 id;
00238 }
00239 osip_mutex_t;
00240 typedef struct
00241 {
00242 UInt32 id;
00243 }
00244 osip_sem_t;
00245 #endif
00246
00247
00248
00249
00254 #if defined(HAVE_PTHREAD) || defined(HAVE_PTH_PTHREAD_H) || defined(HAVE_PTHREAD_WIN32)
00255 typedef struct osip_cond
00256 {
00257 pthread_cond_t cv;
00258 } osip_cond_t;
00259 #endif
00260
00261 #if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(HAVE_PTHREAD_WIN32)
00262 typedef struct osip_cond
00263 {
00264 struct osip_mutex *mut;
00265 struct osip_sem *sem;
00266 } osip_cond_t;
00267 #endif
00268
00269 #if defined(__PSOS__) || defined(__VXWORKS_OS__)
00270 typedef struct osip_cond
00271 {
00272 struct osip_sem *sem;
00273 } osip_cond_t;
00274 #endif
00275
00276 #endif
00277
00278 #if defined(__rtems__)
00279 typedef struct
00280 {
00281 rtems_id tid;
00282 } osip_thread_t;
00283
00284 typedef struct
00285 {
00286 rtems_id id;
00287 } osip_sem_t;
00288
00289 typedef struct
00290 {
00291 rtems_id id;
00292 } osip_mutex_t ;
00293 #endif
00294
00295
00296 #endif
00297
00298 #endif
00299
00300 #endif