Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

f_stccomm.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 /*************************************************************************/
00017 /* F_STCCOMM.H                                                           */
00018 /* 18.7.95, H.G.: add message no. STC__ECONNREF                          */
00019 /*************************************************************************/
00020 
00021 #ifndef F_STCCOMM
00022 #define F_STCCOMM
00023 
00024 #include "typedefs.h" /* typedef INTS1, INTS2, ... */
00025 
00026 #ifndef OSK
00027 INTS4 f_stc_connectserver ();
00028 INTS4 f_stc_createserver  ();
00029 INTS4 f_stc_listenserver  ();
00030 INTS4 f_stc_acceptclient  ();
00031 INTS4 f_stc_disperror     ();
00032 INTS4 f_stc_read          ();
00033 INTS4 f_stc_write         ();
00034 INTS4 f_stc_close         ();
00035 INTS4 f_stc_discclient    ();
00036 
00037 void  f_stc_swap4  (INTS4 *);
00038 
00039 #endif
00040 
00041 #ifdef GSI__WINNT
00042 
00043 #include <stdio.h>
00044 #include <io.h>
00045 #include <sys/types.h>
00046 #include <string.h>
00047 #include <stdlib.h>
00048 #include <winsock.h>
00049 #include <errno.h>
00050 #define bzero(a,n) memset(a,0,n)
00051 
00052 #endif
00053 /* **************** WINDOWS_NT ********************************/
00054 
00055 
00056 #ifdef VMS
00057 INTS4 SYS$TRNLNM();
00058 #endif
00059 
00060 #ifdef _HPUX_SOURCE
00061 #include <time.h>
00062 #include </usr/include/sys/errno.h>
00063 #include <sys/types.h>
00064 #include <stdio.h>
00065 #include <sys/socket.h>
00066 #include <netinet/in.h>
00067 #include <netdb.h>
00068 #include <signal.h>
00069 #include <arpa/inet.h>
00070 #include <sys/uio.h>
00071 #endif
00072 
00073 #ifdef VMS
00074 #include <stdio.h>
00075 #include <netdb.h>
00076 #include <in.h>
00077 #include <time.h>
00078 #include <unixio.h>
00079 #include <string.h>
00080 #include <signal.h>
00081 #include <math.h>
00082 #include <ctype.h>
00083 #include <stdlib.h>
00084 #include <errno.h>
00085 /*
00086  * The maximum number of file descriptors is now a configurable option
00087  * (max_nofile variable in /sys/conf/{mips|vax}/param.c).
00088  * The getdtablesize(2) system call should be used to obtain the
00089  * current limit. The value returned by getdtablesize() must be greater
00090  * than 64, and less than or equal to MAX_NOFILE in types.h . The
00091  * MAX_NOFILE define is needed for backward compatability with broken
00092  * programs that need a static sized array for selecting. These programs
00093  * should be modified to use the getdtablesize() interface for sizing.
00094  */
00095 #define MAX_NOFILE   4096   /* This should not exist ! */
00096 #define   NBBY   8      /* number of bits in a byte */
00097 /*
00098  * Select uses bit masks of file descriptors in longs.
00099  * These macros manipulate such bit fields (the filesystem macros use chars).
00100  * FD_SETSIZE may be defined by the user, but the default here
00101  * should be >= NOFILE (param.h).
00102  */
00103 #ifndef   FD_SETSIZE
00104 #define   FD_SETSIZE   MAX_NOFILE
00105 #endif   /* FD_SETSIZE */
00106 
00107 /* How many things we'll allow select to use. 0 if unlimited */
00108 
00109 #define MAXSELFD   MAX_NOFILE
00110 /*typedef INTS4   fd_mask;*/
00111 #define NFDBITS   (sizeof(fd_mask) * NBBY)   /* bits per mask (power of 2!)*/
00112 #define NFDSHIFT 5            /* Shift based on above */
00113 #ifndef howmany
00114 #define   howmany(x, y)   (((x)+((y)-1))/(y))
00115 #endif /* howmany */
00116 
00117 #define bzero(a,n) memset(a,0,n)
00118 #define   FD_SET(n, p)   ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
00119 #define   FD_CLR(n, p)   ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
00120 #define   FD_ISSET(n, p)   ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
00121 #define FD_ZERO(p)   bzero((INTS1 *)(p), sizeof(*(p)))
00122 
00123 #endif /* VMS */
00124 
00125 #ifdef OSK
00126 #include <time.h>
00127 #include <errno.h>
00128 #include <types.h>
00129 #include <stdio.h>
00130 #include <socket.h>
00131 #include <signal.h>
00132 #include <in.h>
00133 #include <netdb.h>
00134 
00135 struct timeval {
00136     INTS4 tv_sec;
00137     INTS4 tv_usec;
00138 };
00139 
00140 #endif /* OSK */
00141 
00142 #ifdef ultrix
00143 #include <time.h>
00144 #include <errno.h>
00145 #include <sys/types.h>
00146 #include <stdio.h>
00147 #include <sys/socket.h>
00148 #include <netinet/in.h>
00149 #include <netdb.h>
00150 #include <signal.h>
00151 #include <arpa/inet.h>
00152 #include <sys/uio.h>
00153 #endif
00154 
00155 #ifdef Lynx
00156 #include <time.h>
00157 #include <errno.h>
00158 #include <sys/types.h>
00159 #include <stdio.h>
00160 #include <socket.h>
00161 #include <signal.h>
00162 #include <netinet/in.h>
00163 #include <netdb.h>
00164 #include <arpa/inet.h>
00165 #include <uio.h>
00166 #endif
00167 
00168 #ifdef GSI__LINUX
00169 #undef unix
00170 #include <time.h>
00171 #include <errno.h>
00172 #include <sys/types.h>
00173 #include <stdio.h>
00174 #include <unistd.h>
00175 #include <string.h>
00176 #include <strings.h>
00177 #include <sys/socket.h>
00178 #include <signal.h>
00179 #include <netinet/in.h>
00180 #include <netdb.h>
00181 #include <arpa/inet.h>
00182 #include <sys/uio.h>
00183 #endif
00184 
00185 #ifdef GSI__SOLARIS
00186 #undef unix
00187 #include <time.h>
00188 #include <errno.h>
00189 #include <sys/types.h>
00190 #include <stdio.h>
00191 #include <unistd.h>
00192 #include <string.h>
00193 #include <strings.h>
00194 #include <sys/socket.h>
00195 #include <signal.h>
00196 #include <netinet/in.h>
00197 #include <netdb.h>
00198 #include <arpa/inet.h>
00199 #include <sys/uio.h>
00200 #endif
00201 
00202 
00203 #ifdef _AIX
00204 #include <time.h>
00205 #include <errno.h>
00206 #include <sys/types.h>
00207 #include <stdio.h>
00208 #include <sys/socket.h>
00209 #include <signal.h>
00210 #include <netinet/in.h>
00211 #include <netdb.h>
00212 #include <arpa/inet.h>
00213 #include <sys/uio.h>
00214 #define _ALL_SOURCE                     /* for types.h typedef u_char...  */
00215 #define _POSIX_SOURCE                   /*   any include is done          */
00216 
00217 /*
00218  * The maximum number of file descriptors is now a configurable option
00219  * (max_nofile variable in /sys/conf/{mips|vax}/param.c).
00220  * The getdtablesize(2) system call should be used to obtain the
00221  * current limit. The value returned by getdtablesize() must be greater
00222  * than 64, and less than or equal to MAX_NOFILE in types.h . The
00223  * MAX_NOFILE define is needed for backward compatability with broken
00224  * programs that need a static sized array for selecting. These programs
00225  * should be modified to use the getdtablesize() interface for sizing.
00226  */
00227 #define MAX_NOFILE   4096   /* This should not exist ! */
00228 #define   NBBY   8      /* number of bits in a byte */
00229 /*
00230  * Select uses bit masks of file descriptors in longs.
00231  * These macros manipulate such bit fields (the filesystem macros use chars).
00232  * FD_SETSIZE may be defined by the user, but the default here
00233  * should be >= NOFILE (param.h).
00234  */
00235 #ifndef   FD_SETSIZE
00236 #define   FD_SETSIZE   MAX_NOFILE
00237 #endif   /* FD_SETSIZE */
00238 
00239 /* How many things we'll allow select to use. 0 if unlimited */
00240 
00241 #define MAXSELFD   MAX_NOFILE
00242 typedef INTS4   fd_mask;
00243 #define NFDBITS   (sizeof(fd_mask) * NBBY)   /* bits per mask (power of 2!)*/
00244 #define NFDSHIFT 5            /* Shift based on above */
00245 #ifndef howmany
00246 #define   howmany(x, y)   (((x)+((y)-1))/(y))
00247 #endif /* howmany */
00248 /* fd_set and FD_x are defined in time.h
00249 typedef   struct fd_set {
00250    fd_mask   fds_bits[howmany(FD_SETSIZE, NFDBITS)];
00251 } fd_set;
00252 
00253 #define bzero(a,n) memset(a,0,n)
00254 #define   FD_SET(n, p)   ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
00255 #define   FD_CLR(n, p)   ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
00256 #define   FD_ISSET(n, p)   ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
00257 #define FD_ZERO(p)   bzero((INTS1 *)(p), sizeof(*(p)))
00258 */
00259 #endif /* AIX */
00260 
00261 #ifdef unix   /* DEC OSF/1 */
00262 #include <time.h>
00263 #include <errno.h>
00264 #include <sys/types.h>
00265 #include <stdio.h>
00266 #include <stdlib.h>
00267 #include <sys/socket.h>
00268 #include <signal.h>
00269 #include <netinet/in.h>
00270 #include <netdb.h>
00271 #include <arpa/inet.h>
00272 #include <sys/uio.h>
00273 #define _ALL_SOURCE                     /* for types.h typedef u_char...  */
00274 #define _POSIX_SOURCE                   /*   any include is done          */
00275 
00276 /*
00277  * The maximum number of file descriptors is now a configurable option
00278  * (max_nofile variable in /sys/conf/{mips|vax}/param.c).
00279  * The getdtablesize(2) system call should be used to obtain the
00280  * current limit. The value returned by getdtablesize() must be greater
00281  * than 64, and less than or equal to MAX_NOFILE in types.h . The
00282  * MAX_NOFILE define is needed for backward compatability with broken
00283  * programs that need a static sized array for selecting. These programs
00284  * should be modified to use the getdtablesize() interface for sizing.
00285  */
00286 #define MAX_NOFILE   4096   /* This should not exist ! */
00287 #define   NBBY   8      /* number of bits in a byte */
00288 /*
00289  * Select uses bit masks of file descriptors in longs.
00290  * These macros manipulate such bit fields (the filesystem macros use chars).
00291  * FD_SETSIZE may be defined by the user, but the default here
00292  * should be >= NOFILE (param.h).
00293  */
00294 #ifndef   FD_SETSIZE
00295 #define   FD_SETSIZE   MAX_NOFILE
00296 #endif   /* FD_SETSIZE */
00297 
00298 /* How many things we'll allow select to use. 0 if unlimited */
00299 
00300 #define MAXSELFD   MAX_NOFILE
00301 /*typedef INTS4   fd_mask;*/
00302 #define NFDBITS   (sizeof(fd_mask) * NBBY)   /* bits per mask (power of 2!)*/
00303 #define NFDSHIFT 5            /* Shift based on above */
00304 #ifndef howmany
00305 #define   howmany(x, y)   (((x)+((y)-1))/(y))
00306 #endif /* howmany */
00307 
00308 /*typedef   struct fd_set {
00309    fd_mask   fds_bits[howmany(FD_SETSIZE, NFDBITS)];
00310 } fd_set;*/
00311 
00312 /*#define bzero(a,n) memset(a,0,n)*/
00313 #define   FD_SET(n, p)   ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
00314 #define   FD_CLR(n, p)   ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
00315 #define   FD_ISSET(n, p)   ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
00316 /*#define FD_ZERO(p)   bzero((INTS1 *)(p), sizeof(*(p)))*/
00317 
00318 #endif /* unix */
00319 
00320 
00321 struct s_tcpcomm {
00322         INTS4                socket  , sock_rw , namelength ;
00323         INTS4                i_signals;
00324         struct sockaddr_in sock , sock_name;
00325         struct hostent     hostentstruct;
00326         struct hostent     *hostentptr;
00327         INTS1              hostname[256] ;
00328         } ;
00329 
00330 #ifdef vms
00331 #define PORTSERV_DATA   "portserv.dat;1"
00332 #else
00333 #define PORTSERV_DATA   "portserv.dat"
00334 #endif
00335 
00336 #define MAXSERVER                    50
00337 #define PORTSERVER_PORT              1000
00338 #define PORTSERVER_M_DEF             "VSBP"
00339 #define PORTSERVER_S_DEF             "DSAG"
00340 
00341 struct s_comm_message {
00342         INTS1 c_message[128];
00343         INTS1 c_status[12];
00344         };
00345 
00346 struct s_comm_portserv {
00347         INTS1    c_command[32];
00348         INTS1    c_serv_node[32];
00349         INTS1    c_serv_name[32];
00350         INTS1    c_date[32];
00351         INTS1    c_data[128];
00352         INTS1    c_port[8];
00353         } ;
00354 
00355 
00356 #ifdef vms
00357 #include <lnmdef.h>
00358 #include <descrip.h>
00359 #include <errno.h>
00360 #include <socket.h>
00361 #include <types.h>
00362 #include <inet.h>
00363 #include <time.h>
00364 #include <ucx$inetdef.h>
00365 #include <ssdef.h>
00366 #include <iodef.h>
00367 #define $DSC_FXDLEN(name,string) name.dsc$w_length = strlen(string); \
00368                                  strcpy(name.dsc$a_pointer,string);
00369 #endif /* VMS */
00370 
00371 
00372 #define FALSE                    0
00373 #define TRUE                     1
00374 #define f_stc_nosig( ps_server ) (ps_server)->i_signals = 100;
00375 
00376 /* ********************************************************************** */
00377 /*                   error messages                                       */
00378 /* ********************************************************************** */
00379 
00380 #define STC__FAILURE     0
00381 #define STC__SUCCESS     1
00382 #define STC__INVSOCK     2
00383 #define STC__INVBUF      3
00384 #define STC__NGBUFSIZE   4
00385 #define STC__INVTIME     5
00386 #define STC__TIMEOUT     6
00387 #define STC__NOTSOCK     7
00388 #define STC__INVADDR     8
00389 #define STC__INVADDRF    9
00390 #define STC__SOCKNSUP   10
00391 #define STC__INVPROTO   11
00392 #define STC__SOCKTABF   12
00393 #define STC__SOCKSPAF   13
00394 #define STC__SOCKISC    14
00395 #define STC__CONNTOUT   15
00396 #define STC__NETUNREA   16
00397 #define STC__PORTINUS   17
00398 #define STC__SOCKISP    18
00399 #define TPS__ECPORTS    19
00400 #define TPS__EREGSERV   20
00401 #define TPS__EWTOPORTS  21
00402 #define TPS__ERMFRPORTS 22
00403 #define TPS__EGSERVICE  23
00404 #define STC__BROPIPE    24
00405 #define STC__NODATA     25
00406 #define STC__ECONNREF   26
00407 #define STC__EINTR      27
00408 #define STC__ECONNRES   28
00409 
00410 #define TCPCOMM_INCLUDE   1
00411 
00412 #endif
00413 
00414 
00415 
00416 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:33 2008 for Go4-v3.04-1 by  doxygen 1.4.2