Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

internal.h

00001 /*
00002   The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
00003   Copyright (C) 2001,2002,2003,2004  Aymeric MOIZARD jack@atosc.org
00004   
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009   
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014   
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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(WIN32) || defined(_WIN32_WCE)
00034 /* Struct timeval */
00035 struct timeval {
00036         long    tv_sec;         /* seconds */
00037         long    tv_usec;        /* and microseconds */
00038 };
00039 #endif
00040 
00046 typedef struct __payload __payload_t;
00047 
00048 struct __payload
00049 {
00050   char *payload;
00051   /*  char *port; this must be assigned by the application dynamicly */
00052   char *number_of_port;
00053   char *proto;
00054   char *c_nettype;
00055   char *c_addrtype;
00056   char *c_addr;
00057   char *c_addr_multicast_ttl;
00058   char *c_addr_multicast_int;
00059   /* rtpmap (rcvonly and other attributes are added dynamicly) */
00060   char *a_rtpmap;
00061 };
00062 
00063 
00068 int __payload_init (__payload_t ** payload);
00073 void __payload_free (__payload_t * payload);
00074 
00075 
00076 #ifdef OSIP_MT
00077 
00078 /* Thread abstraction layer definition */
00079 
00080 /* Is there any thread implementation available? */
00081 /* HAVE_PTHREAD_H is not used any more! I keep it for a while... */
00082 #if !defined(__VXWORKS_OS__) && !defined(__PSOS__) && \
00083         !defined(WIN32) && !defined(_WIN32_WCE) && !defined(HAVE_PTHREAD_WIN32) && \
00084     !defined(HAVE_PTHREAD) && !defined(HAVE_PTHREAD_H) && !defined(HAVE_PTH_PTHREAD_H)
00085 #error No thread implementation found!
00086 #endif
00087 
00088 /* Pthreads support: */
00089 /* - Unix: native Pthreads. */
00090 /* - Win32: Pthreads for Win32 (http://sources.redhat.com/pthreads-win32). */
00091 #if defined(HAVE_PTHREAD) || defined(HAVE_PTHREAD_H) || defined(HAVE_PTH_PTHREAD_H) || \
00092         defined(HAVE_PTHREAD_WIN32)
00093 #include <pthread.h>
00094 typedef pthread_t osip_thread_t;
00095 #endif
00096 
00097 /* Windows without Pthreads for Win32 */
00098 #if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(HAVE_PTHREAD_WIN32)
00099 /* Prevent the inclusion of winsock.h */
00100 #define _WINSOCKAPI_
00101 #include <windows.h>
00102 #undef _WINSOCKAPI_
00103 typedef struct
00104 {
00105   HANDLE h;
00106   unsigned id;
00107 }
00108 osip_thread_t;
00109 #endif
00110 
00111 #ifdef __VXWORKS_OS__
00112 #include <taskLib.h>
00113 typedef struct
00114 {
00115   int id;
00116 }
00117 osip_thread_t;
00118 #endif
00119 
00120 #ifdef __PSOS__
00121 #include <psos.h>
00122 typedef struct
00123 {
00124   unsigned long tid;
00125 }
00126 osip_thread_t;
00127 #endif
00128 
00129 
00130 /* Semaphore and Mutex abstraction layer definition */
00131 
00132 /* Is there any semaphore implementation available? */
00133 #if !defined(HAVE_SEMAPHORE_H) && !defined(HAVE_SYS_SEM_H) && \
00134     !defined(WIN32) && !defined(_WIN32_WCE) && !defined(HAVE_PTHREAD_WIN32) && \
00135     !defined(__PSOS__) && !defined(__VXWORKS_OS__)
00136 #error No semaphore implementation found
00137 #endif
00138 
00139 /* Pthreads */
00140 #if defined(HAVE_PTHREAD) || defined(HAVE_PTHREAD_H) || defined(HAVE_PTH_PTHREAD_H) || \
00141         defined(HAVE_PTHREAD_WIN32)
00142 typedef pthread_mutex_t osip_mutex_t;
00143 #endif
00144 
00145 #ifdef __sun__
00146 #include <semaphore.h>
00147 #undef getdate
00148 #include <synch.h>
00149 #endif
00150 
00151 #if (defined(HAVE_SEMAPHORE_H) && !defined(__APPLE_CC__)) || defined(HAVE_PTHREAD_WIN32)
00152 #include <semaphore.h>
00153 #ifdef __sun__
00154 #undef getdate
00155 #include <synch.h>
00156 #endif
00157 
00161 typedef sem_t osip_sem_t;
00162 
00163 #elif defined(HAVE_SYS_SEM_H)
00164 #include <sys/types.h>
00165 #include <sys/ipc.h>
00166 #include <sys/sem.h>
00167 typedef struct
00168 {
00169   int semid;
00170 }
00171 osip_sem_t;
00172 #endif
00173 
00174 /* Windows without Pthreads for Win32 */
00175 #if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(HAVE_PTHREAD_WIN32)
00176 /* Prevent the inclusion of winsock.h */
00177 #define _WINSOCKAPI_
00178 #include <windows.h>
00179 #undef _WINSOCKAPI_
00180 typedef struct
00181 {
00182   HANDLE h;
00183 }
00184 osip_mutex_t;
00185 typedef struct
00186 {
00187   HANDLE h;
00188 }
00189 osip_sem_t;
00190 #endif
00191 
00192 #ifdef __VXWORKS_OS__
00193 #include <semaphore.h>
00194 #include <semLib.h>
00195 typedef struct semaphore osip_mutex_t;
00196 typedef sem_t osip_sem_t;
00197 #endif
00198 
00199 #ifdef __PSOS__
00200 #include <Types.h>
00201 #include <os.h>
00202 typedef struct
00203 {
00204   UInt32 id;
00205 }
00206 osip_mutex_t;
00207 typedef struct
00208 {
00209   UInt32 id;
00210 }
00211 osip_sem_t;
00212 #endif
00213 
00214 
00215 /* Condition variable abstraction layer definition */
00216 
00221 #if defined(HAVE_PTHREAD) || defined(HAVE_PTH_PTHREAD_H) || defined(HAVE_PTHREAD_WIN32)
00222 typedef struct osip_cond
00223 {
00224   pthread_cond_t cv;
00225 } osip_cond_t;
00226 #endif
00227 
00228 #if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(HAVE_PTHREAD_WIN32)
00229 typedef struct osip_cond
00230 {
00231   struct osip_mutex *mut;
00232   struct osip_sem *sem;
00233 } osip_cond_t;
00234 #endif
00235 
00236 #if defined(__PSOS__) || defined(__VXWORKS_OS__)
00237 typedef struct osip_cond
00238 {
00239   struct osip_sem *sem;
00240 } osip_cond_t;
00241 #endif
00242 
00243 #endif /* #ifdef OSIP_MT */
00244 
00245 #endif /* #ifndef DOXYGEN */
00246 
00247 #endif /* #ifndef _INTERNAL_H_ */

Generated on Tue Feb 22 00:59:46 2005 for libosip by  doxygen 1.4.1