Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/MbsAPI/f_stccomm.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 #include "typedefs.h"
00017 /*************************************************************************/
00018 /* F_STCCOMM.H                                                           */
00019 /* 18.7.95, H.G.: add message no. STC__ECONNREF                          */
00020 /*************************************************************************/
00021 
00022 #ifndef F_STCCOMM
00023 #define F_STCCOMM
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 <sys/socket.h>
00175 #include <signal.h>
00176 #include <netinet/in.h>
00177 #include <netdb.h>
00178 #include <arpa/inet.h>
00179 #include <sys/uio.h>
00180 #endif
00181 
00182 
00183 #ifdef _AIX
00184 #include <time.h>
00185 #include <errno.h>
00186 #include <sys/types.h>
00187 #include <stdio.h>
00188 #include <sys/socket.h>
00189 #include <signal.h>
00190 #include <netinet/in.h>
00191 #include <netdb.h>
00192 #include <arpa/inet.h>
00193 #include <sys/uio.h>
00194 #define _ALL_SOURCE                     /* for types.h typedef u_char...  */
00195 #define _POSIX_SOURCE                   /*   any include is done          */
00196 
00197 /*
00198  * The maximum number of file descriptors is now a configurable option
00199  * (max_nofile variable in /sys/conf/{mips|vax}/param.c).
00200  * The getdtablesize(2) system call should be used to obtain the
00201  * current limit. The value returned by getdtablesize() must be greater
00202  * than 64, and less than or equal to MAX_NOFILE in types.h . The
00203  * MAX_NOFILE define is needed for backward compatability with broken
00204  * programs that need a static sized array for selecting. These programs
00205  * should be modified to use the getdtablesize() interface for sizing.
00206  */
00207 #define MAX_NOFILE   4096   /* This should not exist ! */
00208 #define   NBBY   8      /* number of bits in a byte */
00209 /*
00210  * Select uses bit masks of file descriptors in longs.
00211  * These macros manipulate such bit fields (the filesystem macros use chars).
00212  * FD_SETSIZE may be defined by the user, but the default here
00213  * should be >= NOFILE (param.h).
00214  */
00215 #ifndef   FD_SETSIZE
00216 #define   FD_SETSIZE   MAX_NOFILE
00217 #endif   /* FD_SETSIZE */
00218 
00219 /* How many things we'll allow select to use. 0 if unlimited */
00220 
00221 #define MAXSELFD   MAX_NOFILE
00222 typedef INTS4   fd_mask;
00223 #define NFDBITS   (sizeof(fd_mask) * NBBY)   /* bits per mask (power of 2!)*/
00224 #define NFDSHIFT 5            /* Shift based on above */
00225 #ifndef howmany
00226 #define   howmany(x, y)   (((x)+((y)-1))/(y))
00227 #endif /* howmany */
00228 /* fd_set and FD_x are defined in time.h
00229 typedef   struct fd_set {
00230    fd_mask   fds_bits[howmany(FD_SETSIZE, NFDBITS)];
00231 } fd_set;
00232 
00233 #define bzero(a,n) memset(a,0,n)
00234 #define   FD_SET(n, p)   ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
00235 #define   FD_CLR(n, p)   ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
00236 #define   FD_ISSET(n, p)   ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
00237 #define FD_ZERO(p)   bzero((INTS1 *)(p), sizeof(*(p)))
00238 */
00239 #endif /* AIX */
00240 
00241 #ifdef unix   /* DEC OSF/1 */
00242 #include <time.h>
00243 #include <errno.h>
00244 #include <sys/types.h>
00245 #include <stdio.h>
00246 #include <stdlib.h>
00247 #include <sys/socket.h>
00248 #include <signal.h>
00249 #include <netinet/in.h>
00250 #include <netdb.h>
00251 #include <arpa/inet.h>
00252 #include <sys/uio.h>
00253 #define _ALL_SOURCE                     /* for types.h typedef u_char...  */
00254 #define _POSIX_SOURCE                   /*   any include is done          */
00255 
00256 /*
00257  * The maximum number of file descriptors is now a configurable option
00258  * (max_nofile variable in /sys/conf/{mips|vax}/param.c).
00259  * The getdtablesize(2) system call should be used to obtain the
00260  * current limit. The value returned by getdtablesize() must be greater
00261  * than 64, and less than or equal to MAX_NOFILE in types.h . The
00262  * MAX_NOFILE define is needed for backward compatability with broken
00263  * programs that need a static sized array for selecting. These programs
00264  * should be modified to use the getdtablesize() interface for sizing.
00265  */
00266 #define MAX_NOFILE   4096   /* This should not exist ! */
00267 #define   NBBY   8      /* number of bits in a byte */
00268 /*
00269  * Select uses bit masks of file descriptors in longs.
00270  * These macros manipulate such bit fields (the filesystem macros use chars).
00271  * FD_SETSIZE may be defined by the user, but the default here
00272  * should be >= NOFILE (param.h).
00273  */
00274 #ifndef   FD_SETSIZE
00275 #define   FD_SETSIZE   MAX_NOFILE
00276 #endif   /* FD_SETSIZE */
00277 
00278 /* How many things we'll allow select to use. 0 if unlimited */
00279 
00280 #define MAXSELFD   MAX_NOFILE
00281 /*typedef INTS4   fd_mask;*/
00282 #define NFDBITS   (sizeof(fd_mask) * NBBY)   /* bits per mask (power of 2!)*/
00283 #define NFDSHIFT 5            /* Shift based on above */
00284 #ifndef howmany
00285 #define   howmany(x, y)   (((x)+((y)-1))/(y))
00286 #endif /* howmany */
00287 
00288 /*typedef   struct fd_set {
00289    fd_mask   fds_bits[howmany(FD_SETSIZE, NFDBITS)];
00290 } fd_set;*/
00291 
00292 /*#define bzero(a,n) memset(a,0,n)*/
00293 #define   FD_SET(n, p)   ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
00294 #define   FD_CLR(n, p)   ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
00295 #define   FD_ISSET(n, p)   ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
00296 /*#define FD_ZERO(p)   bzero((INTS1 *)(p), sizeof(*(p)))*/
00297 
00298 #endif /* unix */
00299 
00300 
00301 struct s_tcpcomm {
00302         INTS4                socket  , sock_rw , namelength ;
00303         INTS4                i_signals;
00304         struct sockaddr_in sock , sock_name;
00305         struct hostent     hostentstruct;
00306         struct hostent     *hostentptr;
00307         INTS1              hostname[256] ;
00308         } ;
00309 
00310 #ifdef vms
00311 #define PORTSERV_DATA   "portserv.dat;1"
00312 #else
00313 #define PORTSERV_DATA   "portserv.dat"
00314 #endif
00315 
00316 #define MAXSERVER                    50
00317 #define PORTSERVER_PORT              1000
00318 #define PORTSERVER_M_DEF             "VSBP"
00319 #define PORTSERVER_S_DEF             "DSAG"
00320 
00321 struct s_comm_message {
00322         INTS1 c_message[128];
00323         INTS1 c_status[12];
00324         };
00325 
00326 struct s_comm_portserv {
00327         INTS1    c_command[32];
00328         INTS1    c_serv_node[32];
00329         INTS1    c_serv_name[32];
00330         INTS1    c_date[32];
00331         INTS1    c_data[128];
00332         INTS1    c_port[8];
00333         } ;
00334 
00335 
00336 #ifdef vms
00337 #include <lnmdef.h>
00338 #include <descrip.h>
00339 #include <errno.h>
00340 #include <socket.h>
00341 #include <types.h>
00342 #include <inet.h>
00343 #include <time.h>
00344 #include <ucx$inetdef.h>
00345 #include <ssdef.h>
00346 #include <iodef.h>
00347 #define $DSC_FXDLEN(name,string) name.dsc$w_length = strlen(string); \
00348                                  strcpy(name.dsc$a_pointer,string);
00349 #endif /* VMS */
00350 
00351 
00352 #define FALSE                    0
00353 #define TRUE                     1
00354 #define f_stc_nosig( ps_server ) (ps_server)->i_signals = 100;
00355 
00356 /* ********************************************************************** */
00357 /*                   error messages                                       */
00358 /* ********************************************************************** */
00359 
00360 #define STC__FAILURE     0
00361 #define STC__SUCCESS     1
00362 #define STC__INVSOCK     2
00363 #define STC__INVBUF      3
00364 #define STC__NGBUFSIZE   4
00365 #define STC__INVTIME     5
00366 #define STC__TIMEOUT     6
00367 #define STC__NOTSOCK     7
00368 #define STC__INVADDR     8
00369 #define STC__INVADDRF    9
00370 #define STC__SOCKNSUP   10
00371 #define STC__INVPROTO   11
00372 #define STC__SOCKTABF   12
00373 #define STC__SOCKSPAF   13
00374 #define STC__SOCKISC    14
00375 #define STC__CONNTOUT   15
00376 #define STC__NETUNREA   16
00377 #define STC__PORTINUS   17
00378 #define STC__SOCKISP    18
00379 #define TPS__ECPORTS    19
00380 #define TPS__EREGSERV   20
00381 #define TPS__EWTOPORTS  21
00382 #define TPS__ERMFRPORTS 22
00383 #define TPS__EGSERVICE  23
00384 #define STC__BROPIPE    24
00385 #define STC__NODATA     25
00386 #define STC__ECONNREF   26
00387 #define STC__EINTR      27
00388 #define STC__ECONNRES   28
00389 
00390 #define TCPCOMM_INCLUDE   1
00391 
00392 #endif
00393 
00394 
00395 
00396 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:08 2005 for Go4-v2.10-5 by doxygen1.2.15