Automatically remove trailing whitespace
This commit is contained in:
@@ -49,23 +49,23 @@ dtm_ ::
|
||||
@echo Either set up the ARCH environment or specify a machine type
|
||||
@echo " ex: make sun"
|
||||
|
||||
solaris :
|
||||
solaris :
|
||||
make internal "CC=$(CC)" "CFLAGS = -DSUN -DSOLARIS" \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = /bin/true libdtm.a"
|
||||
|
||||
solarisx86 :
|
||||
solarisx86 :
|
||||
make internal "CC=$(CC)" "CFLAGS = -DSUN -DSOLARIS" \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = /bin/true libdtm.a"
|
||||
|
||||
alpha :
|
||||
alpha :
|
||||
make internal "CFLAGS = -DOSF1 -target $(TARGET_ARCH:-%=%)" \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
|
||||
linux :
|
||||
make internal "CFLAGS = -DLINUX" \
|
||||
@@ -74,7 +74,7 @@ linux :
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
|
||||
sun4 : sun
|
||||
sun :
|
||||
sun :
|
||||
make internal "CFLAGS = -DSUN -target $(TARGET_ARCH:-%=%)" \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
@@ -84,7 +84,7 @@ sun :
|
||||
"OBJECTS = $(OBJ_SPEC) convert$(ARCH).o mdd$(ARCH).o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ranlib libdtm$(ARCH).a"
|
||||
next :
|
||||
next :
|
||||
make internal "CFLAGS = -DNEXT " \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
@@ -105,19 +105,19 @@ indy: $(OBJ) convert.o
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = "
|
||||
|
||||
cray :
|
||||
cray :
|
||||
make internal "CFLAGS = -DCRAY" "CFT = cft77" \
|
||||
"OBJECTS = $(OBJ) craycvt.o crayrtns.o" \
|
||||
"ARCHIVE = bld q" \
|
||||
"RANLIB_CMD = "
|
||||
make libdtmf77.a "CFLAGS = -DCRAY" "CFT = cft77" \
|
||||
"OBJECTS = $(OBJ) craycvt.o crayrtns.o sdsF.o" \
|
||||
"ARCHIVE = bld q"
|
||||
convex :
|
||||
"ARCHIVE = bld q"
|
||||
convex :
|
||||
make internal "CFLAGS = -DCONVEX -fi" \
|
||||
"OBJECTS = $(OBJ) mdd.o convert.o" "ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
ibm :
|
||||
ibm :
|
||||
make internal "CFLAGS = -DRS6000" "OBJECTS = $(OBJ) mdd.o convert.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
@@ -125,11 +125,11 @@ hp :
|
||||
make internal "CFLAGS = -Aa -D_HPUX_SOURCE" "OBJECTS = $(OBJ) mdd.o convert.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = "
|
||||
dec :
|
||||
dec :
|
||||
make internal "CFLAGS = -DDEC" "OBJECTS = $(OBJ) mdd.o deccvt.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ar ts libdtm.a"
|
||||
vax :
|
||||
vax :
|
||||
make internal "CFLAGS = -DVAX" "OBJECTS = $(OBJ) mdd.o vaxcvt.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = "
|
||||
@@ -160,12 +160,12 @@ clean::
|
||||
|
||||
install::
|
||||
-mv $(DIR)/lib/libdtm.a $(DIR)/lib/libdtm.bak
|
||||
cp *.a $(DIR)/lib
|
||||
cp *.a $(DIR)/lib
|
||||
-ranlib $(DIR)/lib/libdtm.a
|
||||
-rm -f $(DIR)/include/dtm.h $(DIR)/include/sds.h
|
||||
-rm -f $(DIR)/include/ris.h $(DIR)/include/db.h
|
||||
-rm -f $(DIR)/include/mdd.h $(DIR)/include/sdl.h
|
||||
-rm -f $(DIR)/include/debug.h $(DIR)/include/arch.h
|
||||
cp dtm.h debug.h sds.h ris.h db.h mdd.h sdl.h arch.h $(DIR)/include
|
||||
cp dtm.h debug.h sds.h ris.h db.h mdd.h sdl.h arch.h $(DIR)/include
|
||||
|
||||
include $(DEPENDS)
|
||||
include $(DEPENDS)
|
||||
|
@@ -49,23 +49,23 @@ dtm_ ::
|
||||
@echo Either set up the ARCH environment or specify a machine type
|
||||
@echo " ex: make sun"
|
||||
|
||||
solaris :
|
||||
solaris :
|
||||
make internal "CC=$(CC)" "CFLAGS = -DSUN -DSOLARIS" \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = /bin/true libdtm.a"
|
||||
|
||||
solarisx86 :
|
||||
solarisx86 :
|
||||
make internal "CC=$(CC)" "CFLAGS = -DSUN -DSOLARIS" \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = /bin/true libdtm.a"
|
||||
|
||||
alpha :
|
||||
alpha :
|
||||
make internal "CFLAGS = -DOSF1 -target $(TARGET_ARCH:-%=%)" \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
|
||||
linux :
|
||||
make internal "CFLAGS = -DLINUX" \
|
||||
@@ -74,7 +74,7 @@ linux :
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
|
||||
sun4 : sun
|
||||
sun :
|
||||
sun :
|
||||
make internal "CFLAGS = -DSUN -target $(TARGET_ARCH:-%=%)" \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
@@ -84,7 +84,7 @@ sun :
|
||||
"OBJECTS = $(OBJ_SPEC) convert$(ARCH).o mdd$(ARCH).o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ranlib libdtm$(ARCH).a"
|
||||
next :
|
||||
next :
|
||||
make internal "CFLAGS = -DNEXT " \
|
||||
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
@@ -105,19 +105,19 @@ indy: $(OBJ) convert.o
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = "
|
||||
|
||||
cray :
|
||||
cray :
|
||||
make internal "CFLAGS = -DCRAY" "CFT = cft77" \
|
||||
"OBJECTS = $(OBJ) craycvt.o crayrtns.o" \
|
||||
"ARCHIVE = bld q" \
|
||||
"RANLIB_CMD = "
|
||||
make libdtmf77.a "CFLAGS = -DCRAY" "CFT = cft77" \
|
||||
"OBJECTS = $(OBJ) craycvt.o crayrtns.o sdsF.o" \
|
||||
"ARCHIVE = bld q"
|
||||
convex :
|
||||
"ARCHIVE = bld q"
|
||||
convex :
|
||||
make internal "CFLAGS = -DCONVEX -fi" \
|
||||
"OBJECTS = $(OBJ) mdd.o convert.o" "ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
ibm :
|
||||
ibm :
|
||||
make internal "CFLAGS = -DRS6000" "OBJECTS = $(OBJ) mdd.o convert.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ranlib libdtm.a"
|
||||
@@ -125,11 +125,11 @@ hp :
|
||||
make internal "CFLAGS = -Aa -D_HPUX_SOURCE" "OBJECTS = $(OBJ) mdd.o convert.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = "
|
||||
dec :
|
||||
dec :
|
||||
make internal "CFLAGS = -DDEC" "OBJECTS = $(OBJ) mdd.o deccvt.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = ar ts libdtm.a"
|
||||
vax :
|
||||
vax :
|
||||
make internal "CFLAGS = -DVAX" "OBJECTS = $(OBJ) mdd.o vaxcvt.o" \
|
||||
"ARCHIVE = ar rv" \
|
||||
"RANLIB_CMD = "
|
||||
@@ -160,12 +160,12 @@ clean::
|
||||
|
||||
install::
|
||||
-mv $(DIR)/lib/libdtm.a $(DIR)/lib/libdtm.bak
|
||||
cp *.a $(DIR)/lib
|
||||
cp *.a $(DIR)/lib
|
||||
-ranlib $(DIR)/lib/libdtm.a
|
||||
-rm -f $(DIR)/include/dtm.h $(DIR)/include/sds.h
|
||||
-rm -f $(DIR)/include/ris.h $(DIR)/include/db.h
|
||||
-rm -f $(DIR)/include/mdd.h $(DIR)/include/sdl.h
|
||||
-rm -f $(DIR)/include/debug.h $(DIR)/include/arch.h
|
||||
cp dtm.h debug.h sds.h ris.h db.h mdd.h sdl.h arch.h $(DIR)/include
|
||||
cp dtm.h debug.h sds.h ris.h db.h mdd.h sdl.h arch.h $(DIR)/include
|
||||
|
||||
include $(DEPENDS)
|
||||
include $(DEPENDS)
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
/*********************************************************************
|
||||
**
|
||||
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/arch.h,v 1.5 1996/06/06 19:47:12 spowers Exp $
|
||||
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/arch.h,v 1.5 1996/06/06 19:47:12 spowers Exp $
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
*
|
||||
* Revision 1.7 92/04/30 20:27:05 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
*
|
||||
* Revision 1.6 1992/04/14 22:59:57 jefft
|
||||
* included sys/limits.h instead of sys/limit.h
|
||||
*
|
||||
@@ -56,7 +56,7 @@
|
||||
* Revision 1.4 92/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 1992/03/10 16:52:43 jefft
|
||||
* modified convex define to __convex__
|
||||
*
|
||||
@@ -70,8 +70,8 @@
|
||||
|
||||
/*
|
||||
The intent of this file is to provide a standard set of
|
||||
architecturally descriptive preprocessor definitions by
|
||||
examining the preprocessor identifiers that are defined
|
||||
architecturally descriptive preprocessor definitions by
|
||||
examining the preprocessor identifiers that are defined
|
||||
in the native compiler running in the default mode.
|
||||
|
||||
Please feel free to add to or correct this file.
|
||||
@@ -87,21 +87,21 @@
|
||||
SUN - generally any machine by Sun Microsystems
|
||||
SGI - Silicon Graphics
|
||||
CRAY - Cray Research
|
||||
CONVEX - Convex
|
||||
CONVEX - Convex
|
||||
CM - Connection Machine
|
||||
IBM
|
||||
APPLE
|
||||
HP
|
||||
IBM
|
||||
APPLE
|
||||
HP
|
||||
DEC
|
||||
COMMODORE
|
||||
General OS
|
||||
DOS
|
||||
General OS
|
||||
DOS
|
||||
UNIX
|
||||
MACOS
|
||||
AMIGA
|
||||
VMS
|
||||
AMIGA
|
||||
VMS
|
||||
OS2
|
||||
General Processor
|
||||
General Processor
|
||||
SPARC
|
||||
MIPS
|
||||
68000
|
||||
@@ -110,8 +110,8 @@
|
||||
80386
|
||||
VAX
|
||||
PA - HP Percision Architecture
|
||||
RS6000
|
||||
Specific Interesting Qualities
|
||||
RS6000
|
||||
Specific Interesting Qualities
|
||||
BIG_ENDIAN
|
||||
LITTLE_ENDIAN
|
||||
WORD_SIZE - values include 16, 32, 64 (bits)
|
||||
@@ -121,12 +121,12 @@
|
||||
|
||||
( possible interesting definitions )
|
||||
mc68k unix unixpc (hp 68k ?)
|
||||
mc68000
|
||||
mc68000
|
||||
_I386 i386 AIX _AIX (PS2 running AIX)
|
||||
alliant (68000 unix)
|
||||
vax mc68k32 PORTAR (altos? 30068)
|
||||
vax mc68k32 PORTAR (altos? 30068)
|
||||
apollo aegis unix (??) (apollo)
|
||||
i80386 (compac?) BSD
|
||||
i80386 (compac?) BSD
|
||||
convex unix (32 bit)
|
||||
__convex_c1__
|
||||
__convex_c2__
|
||||
@@ -196,7 +196,7 @@
|
||||
# else
|
||||
/* assume */
|
||||
# define _ARCH_BIG_ENDIAN
|
||||
# define _ARCH_68000
|
||||
# define _ARCH_68000
|
||||
# endif
|
||||
#elif defined( NEXT )
|
||||
# define _ARCH_NEXT
|
||||
@@ -209,7 +209,7 @@
|
||||
# define _ARCH_CRAY
|
||||
# define _ARCH_UNIX
|
||||
# define _ARCH_SYSV /* A rough approximation */
|
||||
# define _ARCH_BIG_ENDIAN /* ?? */
|
||||
# define _ARCH_BIG_ENDIAN /* ?? */
|
||||
# define _ARCH_WORD_SIZE 64
|
||||
#elif defined(vax)
|
||||
# define _ARCH_DEC
|
||||
@@ -230,7 +230,7 @@
|
||||
#define _ARCH_WORD_SIZE 32
|
||||
#define _ARCH_LITTLE_ENDIAN
|
||||
#define _ARCH_PROTO
|
||||
#elif defined( _IBMR2 )
|
||||
#elif defined( _IBMR2 )
|
||||
#define _ARCH_IBM
|
||||
#define _ARCH_RS6000
|
||||
#elif defined( AMIGA )
|
||||
@@ -238,7 +238,7 @@
|
||||
# define _ARCH_COMMODORE
|
||||
# define _ARCH_AMIGA
|
||||
# define _ARCH_BIG_ENDIAN
|
||||
# define _ARCH_68000
|
||||
# define _ARCH_68000
|
||||
# define _ARCH_WORD_SIZE 32
|
||||
#elif defined ( MS_DOS ) || defined(__TURBOC__)
|
||||
# define _ARCH_MSDOS
|
||||
@@ -256,14 +256,14 @@
|
||||
#elif defined ( THINK_C ) || defined( applec )
|
||||
# define _ARCH_APPLE
|
||||
# define _ARCH_MACOS
|
||||
# define _ARCH_68000
|
||||
# define _ARCH_68000
|
||||
# define _ARCH_BIG_ENDIAN
|
||||
# define _ARCH_WORD_SIZE 32
|
||||
# define _ARCH_PROTO
|
||||
#elif defined( alliant )
|
||||
/* ?? */
|
||||
# define _ARCH_UNIX
|
||||
# define _ARCH_68000
|
||||
# define _ARCH_68000
|
||||
# define _ARCH_BIG_ENDIAN
|
||||
# define _ARCH_WORD_SIZE 32
|
||||
#elif defined( __convex__ ) || defined( __convex_c1__ ) || defined( __convex_c2__ )
|
||||
@@ -278,13 +278,13 @@
|
||||
*/
|
||||
#if !defined( _ARCH_UNIX ) && !defined( _ARCH_MSDOS ) && !defined( _ARCH_VMS ) \
|
||||
&& !defined( _ARCH_MACOS ) && !defined( _ARCH_AMIGA ) && !defined( _ARCH_OS2)
|
||||
# if defined( unix )
|
||||
# if defined( unix )
|
||||
# define _ARCH_UNIX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined( _ARCH_BSD ) && !defined( _ARCH_SYSV ) && defined( _ARCH_UNIX )
|
||||
# if defined( USG )
|
||||
# if defined( USG )
|
||||
# define _ARCH_SYSV
|
||||
# endif
|
||||
#endif
|
||||
@@ -294,7 +294,7 @@
|
||||
|| defined( mc68020 ) || defined( mc68010 )
|
||||
# define _ARCH_68000
|
||||
# if !defined( _ARCH_BIG_ENDIAN )
|
||||
# define _ARCH_BIG_ENDIAN
|
||||
# define _ARCH_BIG_ENDIAN
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
@@ -51,7 +51,7 @@ static void DTMsigioHandler( sig, code, scp, addr )
|
||||
char *addr;
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
/*
|
||||
Unfortunately, not one of the parameters listed above
|
||||
provides even the slightest help in determinine WHICH
|
||||
port is now ready for input, and any system calls
|
||||
@@ -68,7 +68,7 @@ static void DTMsigioHandler( sig, code, scp, addr )
|
||||
if ( !DTMpt[i]->callback ) continue;
|
||||
port = i;
|
||||
dtm_map_port_external(&port);
|
||||
#if 0
|
||||
#if 0
|
||||
if ((ready = DTMavailRead( port ))== DTMERROR) continue;
|
||||
if ( ready == DTM_PORT_READY ) {
|
||||
DBGMSG( "DTMsigioHandler calling user routine\n" );
|
||||
@@ -99,7 +99,7 @@ int dtm_sigio( fd )
|
||||
#endif
|
||||
DTMerrno = DTMSOCK;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
#ifdef __hpux
|
||||
if (flags = ioctl( fd, FIOSSAIOSTAT, &sigio_on ) == -1 ) {
|
||||
#else
|
||||
@@ -107,7 +107,7 @@ int dtm_sigio( fd )
|
||||
#endif
|
||||
DTMerrno = DTMSOCK;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
return DTM_OK;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ int DTMreadReady( int port, void (*pfn)() )
|
||||
int DTMreadReady( port, pfn )
|
||||
int32 port;
|
||||
void (*pfn)();
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
DTMPORT * pp;
|
||||
|
||||
@@ -136,14 +136,14 @@ int DTMreadReady( port, pfn )
|
||||
if ( pp->porttype != INPORTTYPE ) {
|
||||
DTMerrno = DTMBADPORT;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
DBGMSG1( "DTMreadReady port has sockfd %d\n", pp->sockfd );
|
||||
#ifndef _ARCH_MSDOS
|
||||
if ( (int)signal( SIGIO, DTMsigioHandler) == -1 ) {
|
||||
DBGMSG( "DTMreadReady signal failed\n" );
|
||||
DTMerrno = DTMSOCK;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
pp->callback = pfn;
|
||||
{
|
||||
@@ -151,12 +151,12 @@ int DTMreadReady( port, pfn )
|
||||
if( dtm_sigio( pp->sockfd )== DTMERROR) {
|
||||
DTMerrno = DTMSOCK;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
FOR_EACH_IN_PORT( inp, pp ) {
|
||||
if (dtm_sigio( inp->fd )== DTMERROR) {
|
||||
DTMerrno = DTMSOCK;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DTM_OK;
|
||||
|
@@ -48,7 +48,7 @@
|
||||
*
|
||||
* Revision 1.3 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.2 1991/06/11 15:21:13 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
|
@@ -45,7 +45,7 @@
|
||||
*
|
||||
* Revision 1.4 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 1991/06/11 15:21:41 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
@@ -55,7 +55,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:29:13 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -38,7 +38,7 @@ c Plugging DTM in...
|
||||
c
|
||||
c Revision 1.3 91/06/13 21:23:57 jefft
|
||||
c added type of function to prevent returning of a float
|
||||
c
|
||||
c
|
||||
c Revision 1.2 1991/06/11 15:21:54 sreedhar
|
||||
c disclaimer added
|
||||
c
|
||||
|
@@ -38,7 +38,7 @@ c Plugging DTM in...
|
||||
c
|
||||
c Revision 1.4 91/06/11 15:21:47 sreedhar
|
||||
c disclaimer added
|
||||
c
|
||||
c
|
||||
c Revision 1.3 1991/05/16 04:40:13 jefft
|
||||
c Fixed bugs in TRIPLET conversion
|
||||
c
|
||||
@@ -47,7 +47,7 @@ c Fixed bug in Cray floating point conversion routines.
|
||||
c
|
||||
c Revision 1.1 90/11/08 16:30:17 jefft
|
||||
c Initial revision
|
||||
c
|
||||
c
|
||||
|
||||
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
*
|
||||
* Revision 1.8 92/04/30 20:27:05 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
*
|
||||
* Revision 1.7 1991/11/15 19:42:34 jplevyak
|
||||
* Removed dependancy on dtmint.h
|
||||
*
|
||||
@@ -52,10 +52,10 @@
|
||||
*
|
||||
* Revision 1.4 91/09/26 20:13:12 jplevyak
|
||||
* Changed to allow setting of debug flags at run time.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 91/08/15 19:10:25 sreedhar
|
||||
* Changes for logical portname version
|
||||
*
|
||||
*
|
||||
* Revision 1.2 1991/06/11 15:22:30 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
@@ -65,7 +65,7 @@
|
||||
*/
|
||||
|
||||
#ifndef DEBUG_INC
|
||||
#define DEBUG_INC
|
||||
#define DEBUG_INC
|
||||
|
||||
#define DBGFLOW(s) if (uDTMdbg & DTM_DBG_MSG) fprintf(stderr, s)
|
||||
|
||||
|
@@ -45,7 +45,7 @@
|
||||
*
|
||||
* Revision 1.4 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 1992/04/03 18:25:50 jplevyak
|
||||
* Fixed indice computation problem.
|
||||
*
|
||||
@@ -61,7 +61,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:40:06 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
|
||||
#endif
|
||||
|
||||
@@ -92,14 +92,14 @@ static int dtm_short(mode, buf, size)
|
||||
{
|
||||
int nShorts, i;
|
||||
DBGFLOW("# dtm_short called.\n");
|
||||
|
||||
|
||||
nShorts = (mode == DTMLOCAL) ? (size / 2) : size;
|
||||
if (buf)
|
||||
for ( i = 0; i < nShorts ; i++ ) {
|
||||
swap(*buf, *(buf+1));
|
||||
buf += 2;
|
||||
buf += 2;
|
||||
}
|
||||
|
||||
|
||||
return ((mode == DTMLOCAL) ? (size / 2) : (size * 2));
|
||||
}
|
||||
|
||||
|
282
libdtm/dtm.c
282
libdtm/dtm.c
@@ -64,7 +64,7 @@
|
||||
*
|
||||
* Revision 1.46 92/05/05 22:27:50 jplevyak
|
||||
* Corrected X interface code.
|
||||
*
|
||||
*
|
||||
* Revision 1.45 1992/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
@@ -81,7 +81,7 @@
|
||||
*
|
||||
* Revision 1.41 92/03/18 22:25:44 jplevyak
|
||||
* Fix DTMEOF bug with absolute addressed.
|
||||
*
|
||||
*
|
||||
* Revision 1.40 1992/03/16 20:38:36 creiman
|
||||
* Added #include "arch.h"
|
||||
*
|
||||
@@ -119,7 +119,7 @@
|
||||
*
|
||||
* Revision 1.29 92/01/25 14:44:04 jplevyak
|
||||
* Fixed minor bug with DTM_ASYNC and another in AvailWrite
|
||||
*
|
||||
*
|
||||
* Revision 1.28 1992/01/14 19:40:09 creiman
|
||||
* #ifndef macintosh for accept_read_connections call to dtm_sigio
|
||||
*
|
||||
@@ -170,7 +170,7 @@
|
||||
*
|
||||
* Revision 1.13 91/10/14 16:46:18 jplevyak
|
||||
* Added loop for detecting dropped connections during beginRead.
|
||||
*
|
||||
*
|
||||
* Revision 1.12 1991/10/11 20:21:50 jplevyak
|
||||
* Fixed bug with multiple senders one receiver.
|
||||
* Added function DTMcheckRoute.
|
||||
@@ -182,7 +182,7 @@
|
||||
* Revision 1.10 91/09/26 20:22:43 jplevyak
|
||||
* First stage of reorganization. Use external/internal port mapping.
|
||||
* Use repackaged dtm_get_nlist and select_one. Fix bugs with availWrite.
|
||||
*
|
||||
*
|
||||
* Revision 1.9 1991/09/13 17:34:10 sreedhar
|
||||
* changes for DTMSYNC, DTMNOSYNC quality of service
|
||||
*
|
||||
@@ -204,7 +204,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:12:20 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -216,33 +216,33 @@
|
||||
|
||||
3. Sender awaits "ack from seq start" from the receiver.
|
||||
Receipt of ack by sender guarantees the sender that
|
||||
receiver will definitely accept at least the first user message
|
||||
receiver will definitely accept at least the first user message
|
||||
sent by the sender. Sender can then send as many user messages
|
||||
as it wants to ( they would be accepted by receiver ).
|
||||
|
||||
4. Sender sends the user's header message and user data messages.
|
||||
4. Sender sends the user's header message and user data messages.
|
||||
|
||||
3. Receiver will keep accepting user messages on current
|
||||
3. Receiver will keep accepting user messages on current
|
||||
connection unless a new connection request is received, which
|
||||
would be accepted after bumping the current connection.
|
||||
|
||||
4. Sender would send "Messages over" message after it sends all user
|
||||
messages. Receiver would accept same.
|
||||
|
||||
Graphic picture
|
||||
Graphic picture
|
||||
|
||||
Sender Receiver
|
||||
|
||||
Connect request
|
||||
-------------->
|
||||
Connect request
|
||||
-------------->
|
||||
|
||||
Sequence starts |
|
||||
--------------> |
|
||||
|
|
||||
Ack for seq start |
|
||||
<---------------- |
|
||||
|
|
||||
User header |
|
||||
|
|
||||
User header |
|
||||
--------------> |
|
||||
| --> a sequence of
|
||||
| BEGINWRITE,
|
||||
@@ -263,13 +263,13 @@
|
||||
...............
|
||||
|
||||
|
||||
A "sequence starts" message can be sent in availWrite or
|
||||
beginWrite.
|
||||
A "sequence starts" message can be sent in availWrite or
|
||||
beginWrite.
|
||||
|
||||
When no "Ack for header" is received or a write fails.
|
||||
|
||||
Note that the "ack for header", "message over" and "sequence starts"
|
||||
messages are called called "ack" in DTM terminology ( send_ack,
|
||||
messages are called called "ack" in DTM terminology ( send_ack,
|
||||
recv_ack calls used for all these ).
|
||||
*/
|
||||
|
||||
@@ -438,12 +438,12 @@ static int make_out_connections( pp )
|
||||
|
||||
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||
if( pcur->connfd == DTM_NO_CONNECTION) {
|
||||
if( dtm_connect( &pcur->sockaddr, &pcur->connfd )
|
||||
if( dtm_connect( &pcur->sockaddr, &pcur->connfd )
|
||||
== DTMERROR ) {
|
||||
DBGFLOW( "make_out_connections: dtm_connect fails \n" );
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DTM_OK;
|
||||
}
|
||||
@@ -457,7 +457,7 @@ static int clear_write_flags(DTMPORT *pp )
|
||||
#else
|
||||
static int clear_write_flags( pp )
|
||||
DTMPORT *pp;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
Outport * pcur;
|
||||
|
||||
@@ -471,7 +471,7 @@ static int clear_write_flags( pp )
|
||||
/*
|
||||
verify_out_connections()
|
||||
Ensure that their is a connection on each out port.
|
||||
*/
|
||||
*/
|
||||
#ifdef DTM_PROTOTYPES
|
||||
static int verify_out_connections(DTMPORT *pp )
|
||||
#else
|
||||
@@ -485,7 +485,7 @@ static int verify_out_connections( pp )
|
||||
if( pcur->connfd == DTM_NO_CONNECTION) {
|
||||
DTMerrno = DTMPORTINIT;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return DTM_OK;
|
||||
}
|
||||
@@ -510,7 +510,7 @@ static int check_header_write_ack( pp )
|
||||
if ( pcur->connfd == DTM_NO_CONNECTION ) continue;
|
||||
if( !( pcur->availwrite ) ) {
|
||||
int32 tmp;
|
||||
if( (pp->qservice == DTM_SYNC) || ((pp->qservice == DTM_ASYNC) &&
|
||||
if( (pp->qservice == DTM_SYNC) || ((pp->qservice == DTM_ASYNC) &&
|
||||
(dtm_select( pcur->connfd, &tmp, 0 ) == TRUE && tmp >= 4))) {
|
||||
do {
|
||||
int temp;
|
||||
@@ -524,7 +524,7 @@ static int check_header_write_ack( pp )
|
||||
*/
|
||||
}
|
||||
} while ( dtm_select( pcur->connfd, &tmp, 0 ) == TRUE &&
|
||||
tmp >= 4);
|
||||
tmp >= 4);
|
||||
pcur->availwrite = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -546,7 +546,7 @@ static int check_header_write_ack( pp )
|
||||
static void make_write_iov(IOV_BUF *iov,int fStartSeq,int fEndSeq,char *hdr,
|
||||
int hdrsize,VOIDPTR data,int datasize )
|
||||
#else
|
||||
static void make_write_iov( iov, fStartSeq, fEndSeq, hdr, hdrsize,
|
||||
static void make_write_iov( iov, fStartSeq, fEndSeq, hdr, hdrsize,
|
||||
data, datasize )
|
||||
IOV_BUF *iov;
|
||||
int fStartSeq;
|
||||
@@ -567,7 +567,7 @@ static void make_write_iov( iov, fStartSeq, fEndSeq, hdr, hdrsize,
|
||||
|
||||
if ( fStartSeq ) {
|
||||
DBGMSG( "make_write_iov: making start seq\n" );
|
||||
iov->rts_data = DTM_RTS;
|
||||
iov->rts_data = DTM_RTS;
|
||||
STDINT( iov->rts_data );
|
||||
iov->iovec[ i ].iov_base = (char *)&iov->rts_data ;
|
||||
#define SEQ_START_LEN 4
|
||||
@@ -581,7 +581,7 @@ static void make_write_iov( iov, fStartSeq, fEndSeq, hdr, hdrsize,
|
||||
if ( hdrsize != 0 ) {
|
||||
DBGMSG( "make_write_iov: making header\n" );
|
||||
iov->hdr_size = hdrsize ;
|
||||
STDINT( iov->hdr_size );
|
||||
STDINT( iov->hdr_size );
|
||||
iov->iovec[ i ].iov_base = (char *)&iov->hdr_size ;
|
||||
iov->iovec[ i ].iov_len = 4 ;
|
||||
i += 1 ;
|
||||
@@ -612,8 +612,8 @@ static void make_write_iov( iov, fStartSeq, fEndSeq, hdr, hdrsize,
|
||||
DBGMSG( "make_write_iov: making endseq\n" );
|
||||
iov->end_data = DTM_EOT ;
|
||||
STDINT( iov->end_data );
|
||||
iov->iovec[ i ].iov_base = (char *)&iov->end_data ;
|
||||
iov->iovec[ i ].iov_len = 4 ;
|
||||
iov->iovec[ i ].iov_base = (char *)&iov->end_data ;
|
||||
iov->iovec[ i ].iov_len = 4 ;
|
||||
i += 1 ;
|
||||
iov->iovsize += 4;
|
||||
}
|
||||
@@ -646,27 +646,27 @@ static int writev_buffer( pp, iov_buf, fStartSeq )
|
||||
|
||||
if ( fStartSeq ) {
|
||||
if (pcur->availwrite || pcur->seqstart ) {
|
||||
DBGMSG1( "writev: dropping start seq = %x\n",
|
||||
DBGMSG1( "writev: dropping start seq = %x\n",
|
||||
(pcur->availwrite?1:0) | (pcur->seqstart?10:0));
|
||||
/* we have already sent the sequence start, skip it */
|
||||
iov++;
|
||||
iovsize -= SEQ_START_LEN;
|
||||
iovlen -= 1;
|
||||
}
|
||||
pcur->seqstart = TRUE;
|
||||
}
|
||||
pcur->seqstart = TRUE;
|
||||
}
|
||||
DBGMSG1( "writev_buffer: iovlen = %d\n", iovlen );
|
||||
DBGMSG1( "writev_buffer: iovsize = %d\n", iovsize );
|
||||
DBGMSG1( "writev_buffer: ptr iov = %X\n", iov );
|
||||
DBGMSG1( "writev_buffer: first ptr word = %X\n", iov[0].iov_base );
|
||||
DBGMSG1( "writev_buffer: first word = %d\n",
|
||||
DBGMSG1( "writev_buffer: first word = %d\n",
|
||||
*(int *)((iov[0]).iov_base));
|
||||
status = dtm_writev_buffer( pcur->connfd, iov, iovlen, iovsize,
|
||||
NULL, 0);
|
||||
|
||||
DBGINT( "writev_buffer - status = %d\n", status);
|
||||
DBGINT( "writev_buffer - status = %d\n", status);
|
||||
|
||||
if( status < 0 ) {
|
||||
if( status < 0 ) {
|
||||
DBGINT( "dtm_writev_buffer - errno = %d\n", errno );
|
||||
if( DTMerrno == DTMEOF ) {
|
||||
CHECK_ERR( destroy_out_port( pp, &pcur ));
|
||||
@@ -702,16 +702,16 @@ static int32 select_one( connfd )
|
||||
FD_SET( connfd, &readmask );
|
||||
|
||||
#ifdef __hpux
|
||||
ret = select( FD_SETSIZE, (int *)&readmask, (int *)0, (int *)0,
|
||||
ret = select( FD_SETSIZE, (int *)&readmask, (int *)0, (int *)0,
|
||||
#else
|
||||
ret = select( FD_SETSIZE, &readmask, (fd_set *)0, (fd_set *)0,
|
||||
ret = select( FD_SETSIZE, &readmask, (fd_set *)0, (fd_set *)0,
|
||||
#endif
|
||||
&timeout );
|
||||
&timeout );
|
||||
if ( ret > 0 ) {
|
||||
int32 count;
|
||||
ioctl( connfd, FIONREAD, &count );
|
||||
DBGMSG1( "select_one: got count = %d\n", count );
|
||||
ret = count;
|
||||
ret = count;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -735,11 +735,11 @@ static int select_one_connection( connfd )
|
||||
FD_SET( connfd, &readmask );
|
||||
|
||||
#ifdef __hpux
|
||||
return select( FD_SETSIZE, (int *)&readmask, (int *)0, (int *)0,
|
||||
return select( FD_SETSIZE, (int *)&readmask, (int *)0, (int *)0,
|
||||
#else
|
||||
return select( FD_SETSIZE, &readmask, (fd_set *)0, (fd_set *)0,
|
||||
return select( FD_SETSIZE, &readmask, (fd_set *)0, (fd_set *)0,
|
||||
#endif
|
||||
&timeout );
|
||||
&timeout );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -749,15 +749,15 @@ static int select_one_connection( connfd )
|
||||
#ifdef DTM_PROTOTYPES
|
||||
static Inport * new_in_port(DTMPORT *pp,int fd )
|
||||
#else
|
||||
static Inport * new_in_port( pp, fd )
|
||||
static Inport * new_in_port( pp, fd )
|
||||
DTMPORT * pp;
|
||||
int fd;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
Inport * inp;
|
||||
|
||||
if ( (inp = (Inport *) malloc( sizeof(Inport) )) == NULL ) {
|
||||
DTMerrno = DTMMEM;
|
||||
DTMerrno = DTMMEM;
|
||||
return (Inport *) DTMERROR;
|
||||
}
|
||||
memset(inp,0,sizeof(Inport));
|
||||
@@ -775,14 +775,14 @@ static Inport * new_in_port( pp, fd )
|
||||
#ifdef PUT_NEW_IN_PORTS_AT_END
|
||||
{
|
||||
Inport * endp;
|
||||
endp = pp->in;
|
||||
if ( endp == NULL )
|
||||
endp = pp->in;
|
||||
if ( endp == NULL )
|
||||
pp->in = inp;
|
||||
else {
|
||||
while ( endp->next != NULL ) endp = endp->next;
|
||||
endp->next = inp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
inp->next = pp->in;
|
||||
pp->in = inp;
|
||||
@@ -794,8 +794,8 @@ static Inport * new_in_port( pp, fd )
|
||||
void dtm_handle_in( caddr_t client_data, int * fd, void * id)
|
||||
#else
|
||||
void dtm_handle_in( client_data, fd, id )
|
||||
caddr_t client_data;
|
||||
int * fd;
|
||||
caddr_t client_data;
|
||||
int * fd;
|
||||
void * id;
|
||||
#endif
|
||||
{
|
||||
@@ -812,10 +812,10 @@ void dtm_handle_in( client_data, fd, id )
|
||||
dtm_set_Xcallback
|
||||
|
||||
This function may seem a little strange, after all why have a variable
|
||||
(pp->XaddInput) which has only one valid value (XtAddInput).
|
||||
The problem is that we don't want to include the X libraries
|
||||
unless we have to. By using this variable which is only set
|
||||
if the function that will cause this function to get called
|
||||
(pp->XaddInput) which has only one valid value (XtAddInput).
|
||||
The problem is that we don't want to include the X libraries
|
||||
unless we have to. By using this variable which is only set
|
||||
if the function that will cause this function to get called
|
||||
is included... which causes the inclusion of the X libraries, we
|
||||
avoid the undefined external error.
|
||||
*/
|
||||
@@ -835,7 +835,7 @@ void dtm_set_Xcallback( pp, inp )
|
||||
/* you didn't see this */
|
||||
int p; for ( p = 0; p < DTMptCount ; p++ ) if ( pp == DTMpt[p] ) break;
|
||||
if ( pp->porttype == INPORTTYPE && pp->XaddInput ) {
|
||||
inp->XinputId = pp->XaddInput( inp->fd, XtInputReadMask,
|
||||
inp->XinputId = pp->XaddInput( inp->fd, XtInputReadMask,
|
||||
dtm_handle_in, (caddr_t) p);
|
||||
}
|
||||
}
|
||||
@@ -855,7 +855,7 @@ int dtm_accept_read_connections(DTMPORT *pp,int fWait )
|
||||
#else
|
||||
int dtm_accept_read_connections( pp, fWait )
|
||||
DTMPORT * pp;
|
||||
int fWait;
|
||||
int fWait;
|
||||
#endif
|
||||
{
|
||||
struct timeval timeout ;
|
||||
@@ -878,16 +878,16 @@ int dtm_accept_read_connections( pp, fWait )
|
||||
|
||||
/* No connection yet, await one and accept */
|
||||
|
||||
DBGINT( "dtm_accept_read_connection: pp -> sockfd = %d\n",
|
||||
DBGINT( "dtm_accept_read_connection: pp -> sockfd = %d\n",
|
||||
pp -> sockfd );
|
||||
if( (fd = dtm_accept( pp->sockfd, &pp->sockaddr, fWait ? &timeout : 0))
|
||||
if( (fd = dtm_accept( pp->sockfd, &pp->sockaddr, fWait ? &timeout : 0))
|
||||
== DTMERROR ) {
|
||||
if ( !fWait ) return DTM_OK;
|
||||
DTMerrno = DTMTIMEOUT ;
|
||||
return DTMERROR;
|
||||
}
|
||||
DBGINT( "dtm_accept_read_connection: got fd = %d\n", fd );
|
||||
CHECK_ERR( inp = new_in_port( pp, fd ));
|
||||
CHECK_ERR( inp = new_in_port( pp, fd ));
|
||||
#ifndef _ARCH_MACOS
|
||||
if ( pp->callback ) dtm_sigio( fd );
|
||||
if ( pp->Xcallback ) dtm_set_Xcallback( pp, inp );
|
||||
@@ -904,13 +904,13 @@ int dtm_accept_read_connections( pp, fWait )
|
||||
|
||||
/*
|
||||
DTMselectRead()
|
||||
Function to test
|
||||
a) for existence of a new connection or a new
|
||||
Function to test
|
||||
a) for existence of a new connection or a new
|
||||
message header to be read on a set of DTM ports OR
|
||||
b) for whether data is available to be read on a
|
||||
b) for whether data is available to be read on a
|
||||
set of sockets.
|
||||
|
||||
Return values :
|
||||
Return values :
|
||||
DTM_PORT_READY if at least a DTM port or
|
||||
socket has something to be
|
||||
read.
|
||||
@@ -920,7 +920,7 @@ int dtm_accept_read_connections( pp, fWait )
|
||||
error.
|
||||
|
||||
Each port has status field. Possible values
|
||||
for status field are -
|
||||
for status field are -
|
||||
|
||||
DTM_PORT_READY something available to be read.
|
||||
DTM_PORT_NOT_READY nothing available to be read.
|
||||
@@ -963,14 +963,14 @@ int DTMselectRead( dtmset, dtmnum, sockset, socknum, period )
|
||||
/* Set up DTM ports to be selected on */
|
||||
|
||||
for( p1 = dtmset, index = 0 ; index < dtmnum ; index++, p1++ ) {
|
||||
reg DTMPORT *pp ;
|
||||
int port_internal;
|
||||
reg DTMPORT *pp ;
|
||||
int port_internal;
|
||||
reg Inport *inp;
|
||||
|
||||
/* Select status is error if port entry is
|
||||
not initialised.
|
||||
/* Select status is error if port entry is
|
||||
not initialised.
|
||||
*/
|
||||
if( (port_internal = dtm_map_port_internal( p1->port ))
|
||||
if( (port_internal = dtm_map_port_internal( p1->port ))
|
||||
== DTMERROR ) {
|
||||
p1->status = DTMERROR ;
|
||||
continue ;
|
||||
@@ -981,11 +981,11 @@ int DTMselectRead( dtmset, dtmnum, sockset, socknum, period )
|
||||
|
||||
/* look for new connection request */
|
||||
|
||||
FD_SET( pp -> sockfd, fchk );
|
||||
FD_SET( pp -> sockfd, fchk );
|
||||
|
||||
/* look for data in existing connection (if it exists) */
|
||||
FOR_EACH_IN_PORT( inp, pp ) {
|
||||
FD_SET( inp->fd, fchk );
|
||||
FD_SET( inp->fd, fchk );
|
||||
}
|
||||
p1->status = DTM_PORT_NOT_READY ;
|
||||
}
|
||||
@@ -994,21 +994,21 @@ int DTMselectRead( dtmset, dtmnum, sockset, socknum, period )
|
||||
|
||||
for( p2 = sockset, index = 0 ; index < socknum ; index++, p2++ ) {
|
||||
FD_SET( p2 -> sockfd, fchk );
|
||||
p2 -> status = DTM_PORT_NOT_READY ;
|
||||
}
|
||||
p2 -> status = DTM_PORT_NOT_READY ;
|
||||
}
|
||||
#ifdef __hpux
|
||||
nf = select( FD_SETSIZE, (int *)fchk, (int *)0, (int *)0,
|
||||
nf = select( FD_SETSIZE, (int *)fchk, (int *)0, (int *)0,
|
||||
#else
|
||||
nf = select( FD_SETSIZE, fchk, (fd_set *)0, (fd_set *)0,
|
||||
nf = select( FD_SETSIZE, fchk, (fd_set *)0, (fd_set *)0,
|
||||
#endif
|
||||
period < 0 ? NULL : &timeout );
|
||||
|
||||
/* Select returns error */
|
||||
/* Select returns error */
|
||||
|
||||
if( nf < 0 ) {
|
||||
DBGINT( "DTMselectRead: select error %d \n", errno );
|
||||
DTMerrno = DTMSELECT ;
|
||||
return DTMERROR ;
|
||||
if( nf < 0 ) {
|
||||
DBGINT( "DTMselectRead: select error %d \n", errno );
|
||||
DTMerrno = DTMSELECT ;
|
||||
return DTMERROR ;
|
||||
}
|
||||
|
||||
/* None of the DTM ports or sockets have anything to be read */
|
||||
@@ -1016,7 +1016,7 @@ int DTMselectRead( dtmset, dtmnum, sockset, socknum, period )
|
||||
if( nf == 0 ) {
|
||||
DBGFLOW( "DTMselectRead: Nothing to read\n" );
|
||||
return DTM_PORT_NOT_READY ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check whether any DTM port has something to be read */
|
||||
|
||||
@@ -1027,14 +1027,14 @@ int DTMselectRead( dtmset, dtmnum, sockset, socknum, period )
|
||||
|
||||
if ((port_internal= dtm_map_port_internal( p1->port )) == DTMERROR)
|
||||
continue;
|
||||
|
||||
|
||||
pp = DTMpt[ port_internal ];
|
||||
if (pp->porttype == INPORTTYPE) {
|
||||
fNewConnections = fNewConnections ||
|
||||
(select_one_connection( pp->sockfd ) > 0);
|
||||
p1->status = DTM_PORT_NOT_READY;
|
||||
} else {
|
||||
if (select_one_connection( pp->sockfd ) > 0)
|
||||
if (select_one_connection( pp->sockfd ) > 0)
|
||||
fReady = p1->status = DTM_PORT_READY;
|
||||
else p1->status = DTM_PORT_NOT_READY;
|
||||
continue;
|
||||
@@ -1049,7 +1049,7 @@ int DTMselectRead( dtmset, dtmnum, sockset, socknum, period )
|
||||
continue;
|
||||
}
|
||||
p1->status = DTM_PORT_READY;
|
||||
}
|
||||
}
|
||||
inp = inp->next;
|
||||
}
|
||||
if ( p1->status == DTM_PORT_READY ) fReady = DTM_PORT_READY;
|
||||
@@ -1058,14 +1058,14 @@ int DTMselectRead( dtmset, dtmnum, sockset, socknum, period )
|
||||
/* Check whether any socket has something to be read */
|
||||
|
||||
for( p2 = sockset, index = 0 ; index < socknum ; index++, p2++ ) {
|
||||
p2 -> status = FD_ISSET( p2 -> sockfd, fchk ) ?
|
||||
p2 -> status = FD_ISSET( p2 -> sockfd, fchk ) ?
|
||||
DTM_PORT_READY : DTM_PORT_NOT_READY ;
|
||||
if ( p2->status == DTM_PORT_READY ) fReady = DTM_PORT_READY;
|
||||
}
|
||||
|
||||
DBGFLOW( "DTMselectRead done loop\n" );
|
||||
|
||||
} while (!fReady && (fNewConnections || fFalsePositive));
|
||||
} while (!fReady && (fNewConnections || fFalsePositive));
|
||||
|
||||
return fReady ;
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ static Inport * inc_in_port(DTMPORT *pp,Inport *inp )
|
||||
static Inport * inc_in_port( pp, inp )
|
||||
DTMPORT * pp;
|
||||
Inport * inp;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
if ( inp == NULL || inp->next == NULL )
|
||||
return pp->in;
|
||||
@@ -1089,7 +1089,7 @@ static void inc_nextToRead(DTMPORT *pp )
|
||||
static void inc_nextToRead( pp )
|
||||
DTMPORT * pp;
|
||||
#endif
|
||||
{
|
||||
{
|
||||
pp->nextToRead = inc_in_port( pp, pp->nextToRead );
|
||||
}
|
||||
|
||||
@@ -1106,7 +1106,7 @@ int dtm_destroy_in_port( inp, pp )
|
||||
if ( pp->Xcallback ) pp->XremoveInput( inp->XinputId );
|
||||
|
||||
close( inp->fd );
|
||||
|
||||
|
||||
if ( pp->nextToRead == inp )
|
||||
inc_nextToRead( pp );
|
||||
if ( pp->nextToRead == inp )
|
||||
@@ -1136,7 +1136,7 @@ int dtm_destroy_in_port( inp, pp )
|
||||
return DTM_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
send_cts()
|
||||
@@ -1148,7 +1148,7 @@ static int send_cts(DTMPORT *pp,int fWait )
|
||||
static int send_cts( pp, fWait )
|
||||
DTMPORT * pp;
|
||||
int fWait;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
Inport * inp = pp->nextToRead;
|
||||
Inport * endp;
|
||||
@@ -1157,7 +1157,7 @@ static int send_cts( pp, fWait )
|
||||
DBGMSG( "send_cts: <[\n" );
|
||||
|
||||
/*
|
||||
If we have no ports return OK
|
||||
If we have no ports return OK
|
||||
*/
|
||||
if ( inp == NULL ) inp = pp->in;
|
||||
if ( inp == NULL ) return DTM_OK;
|
||||
@@ -1171,7 +1171,7 @@ static int send_cts( pp, fWait )
|
||||
if ( inp == endp ) {
|
||||
if ( !fWait ) return DTM_OK;
|
||||
else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pp->nextToRead = inp;
|
||||
|
||||
@@ -1186,7 +1186,7 @@ static int send_cts( pp, fWait )
|
||||
if ( !inp->fCTSsent && ((fWait && (iSent == 1 )) ||
|
||||
(dtm_select( inp->fd, &tmp, 0 ) == TRUE && tmp >= 4))) {
|
||||
if ( dtm_send_ack( inp->fd, DTM_CTS ) == DTMERROR) {
|
||||
CHECK_ERR( dtm_destroy_in_port( inp, pp ));
|
||||
CHECK_ERR( dtm_destroy_in_port( inp, pp ));
|
||||
/*
|
||||
Never hurts to start at the top.
|
||||
*/
|
||||
@@ -1202,9 +1202,9 @@ static int send_cts( pp, fWait )
|
||||
iSent = 0;
|
||||
continue;
|
||||
}
|
||||
inp->fCTSsent = TRUE;
|
||||
inp->fCTSsent = TRUE;
|
||||
inp->blocklen = DTM_NEW_DATASET;
|
||||
}
|
||||
}
|
||||
inp = inc_in_port( pp, inp );
|
||||
}
|
||||
DBGMSG( "send_cts: ]>\n" );
|
||||
@@ -1216,7 +1216,7 @@ static int accept_one_header(DTMPORT *pp,void *header,int size )
|
||||
#else
|
||||
static int accept_one_header( pp, header, size )
|
||||
DTMPORT * pp;
|
||||
void * header;
|
||||
void * header;
|
||||
int size;
|
||||
#endif
|
||||
{
|
||||
@@ -1227,23 +1227,23 @@ static int accept_one_header( pp, header, size )
|
||||
if ( inp == NULL || !inp->fCTSsent || inp->fGotHeader ) {
|
||||
DTMerrno = DTMCALL;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
|
||||
DBGMSG1( "Accepting RTS on %d\n", inp->fd );
|
||||
if (dtm_recv_ack( inp->fd, &ack ) == DTMERROR ) {
|
||||
dtm_destroy_in_port( inp, pp );
|
||||
dtm_destroy_in_port( inp, pp );
|
||||
return DTMERROR;
|
||||
}
|
||||
if( ack != DTM_RTS ) {
|
||||
DTMerrno = DTMBADACK;
|
||||
DBGMSG1( "Something other than RTS received %d\n", ack );
|
||||
dtm_destroy_in_port( inp, pp );
|
||||
dtm_destroy_in_port( inp, pp );
|
||||
return DTMERROR;
|
||||
}
|
||||
#if 0
|
||||
/* There are no header ack */
|
||||
if ( dtm_send_ack( inp->fd, DTM_CTS ) == DTMERROR) {
|
||||
dtm_destroy_in_port( inp, pp );
|
||||
dtm_destroy_in_port( inp, pp );
|
||||
return DTMERROR;
|
||||
}
|
||||
#endif
|
||||
@@ -1262,7 +1262,7 @@ static int accept_one_header( pp, header, size )
|
||||
/*
|
||||
DTMcheckRoute()
|
||||
Check whether new routing information has come in.
|
||||
Returns:
|
||||
Returns:
|
||||
*/
|
||||
#ifdef DTM_PROTOTYPES
|
||||
int DTMcheckRoute(int port )
|
||||
@@ -1289,16 +1289,16 @@ int DTMcheckRoute( port )
|
||||
Function to test for existence of a new connection or
|
||||
a new message header to be read on a given DTM port.
|
||||
|
||||
Return values : TRUE if either new connection
|
||||
request or something new
|
||||
Return values : TRUE if either new connection
|
||||
request or something new
|
||||
to be read is available on
|
||||
given port.
|
||||
DTMERROR on select error.
|
||||
DTMERROR on select error.
|
||||
FALSE otherwise.
|
||||
|
||||
Notes :
|
||||
|
||||
DTMavailRead is basically call to DTMselectRead for
|
||||
DTMavailRead is basically call to DTMselectRead for
|
||||
given port with 0 timeout.
|
||||
*/
|
||||
#ifdef DTM_PROTOTYPES
|
||||
@@ -1318,7 +1318,7 @@ int DTMavailRead( p )
|
||||
DTMerrno = DTMNOERR;
|
||||
|
||||
/* Note: the port here is an external port since that
|
||||
is what selectRead expects
|
||||
is what selectRead expects
|
||||
*/
|
||||
dtmnum = 1 ;
|
||||
dtmset.port = p ;
|
||||
@@ -1331,7 +1331,7 @@ int DTMavailRead( p )
|
||||
DBGMSG1( "DTMavailRead send_cts returned error %d\n", DTMerrno );
|
||||
if ( DTMerrno == DTMEOF ) fAnyReady = FALSE ;
|
||||
else return DTMERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
DBGMSG( "DTMavailRead done\n" );
|
||||
return fAnyReady;
|
||||
@@ -1386,7 +1386,7 @@ int DTMgetConnectionCount(port, n_connections)
|
||||
message is read.
|
||||
|
||||
Return values : >= 0 on success.
|
||||
DTMERROR on some error.
|
||||
DTMERROR on some error.
|
||||
*/
|
||||
#ifdef DTM_PROTOTYPES
|
||||
int DTMbeginRead(int p,VOIDPTR header,int size )
|
||||
@@ -1406,8 +1406,8 @@ int DTMbeginRead( p, header, size )
|
||||
|
||||
CHECK_ERR( p = dtm_map_port_internal( p ));
|
||||
pp = DTMpt[p];
|
||||
|
||||
while ( TRUE ) {
|
||||
|
||||
while ( TRUE ) {
|
||||
CHECK_ERR( dtm_accept_read_connections( pp, DTM_WAIT));
|
||||
if ( send_cts( pp, DTM_WAIT ) == DTMERROR) {
|
||||
if ( DTMerrno == DTMEOF ) continue;
|
||||
@@ -1415,8 +1415,8 @@ int DTMbeginRead( p, header, size )
|
||||
}
|
||||
if ( pp->nextToRead == NULL ) continue;
|
||||
DBGFLOW( "DTMbeginRead before accept_one_header.\n" );
|
||||
if (( count = accept_one_header( pp, header, size )) == DTMERROR ) {
|
||||
if ( DTMerrno == DTMEOF ) continue;
|
||||
if (( count = accept_one_header( pp, header, size )) == DTMERROR ) {
|
||||
if ( DTMerrno == DTMEOF ) continue;
|
||||
return DTMERROR;
|
||||
}
|
||||
break;
|
||||
@@ -1428,7 +1428,7 @@ int DTMbeginRead( p, header, size )
|
||||
|
||||
/*
|
||||
DTMreadDataset()
|
||||
Function to read user messages.
|
||||
Function to read user messages.
|
||||
|
||||
Return values : number of bytes read, on success
|
||||
DTMERROR on error
|
||||
@@ -1466,7 +1466,7 @@ int DTMreadDataset(p, ds, size, type)
|
||||
/* fill buffer from network */
|
||||
|
||||
/*
|
||||
Assume that the caller has checked for EOT
|
||||
Assume that the caller has checked for EOT
|
||||
*/
|
||||
CHECK_ERR( size = dtm_read_buffer( inp->fd, &inp->blocklen, ds, size));
|
||||
|
||||
@@ -1512,22 +1512,22 @@ int DTMendRead( p )
|
||||
dtm_discard, DISCARDSIZE) > 0 );
|
||||
inp->fCTSsent = FALSE;
|
||||
inp->fGotHeader = FALSE;
|
||||
return DTM_OK ;
|
||||
return DTM_OK ;
|
||||
}
|
||||
|
||||
/*
|
||||
Function to combine reading of header/data.
|
||||
|
||||
|
||||
Return values : number of bytes read, on success
|
||||
DTMERROR on error
|
||||
DTMERROR on error
|
||||
|
||||
Notes : This function is really there for completeness
|
||||
sake ( it complements DTMwriteMsg ). It is not
|
||||
very clear how a user can use it effectively
|
||||
( since he has to know data size beforehand,
|
||||
in which case he need not have a header ).
|
||||
|
||||
Hence, implementation of this function is to
|
||||
|
||||
Hence, implementation of this function is to
|
||||
just call beginRead, readDataset and endRead
|
||||
in that order.
|
||||
*/
|
||||
@@ -1565,7 +1565,7 @@ int DTMreadMsg( p, hdr, hdrsize, data, datasize, datatype )
|
||||
|
||||
Return values : TRUE if subsequent write will
|
||||
succeed.
|
||||
FALSE subsequent write will wait/fail.
|
||||
FALSE subsequent write will wait/fail.
|
||||
DTMERROR if port is not initialised or
|
||||
server ( UDP/TCP ) port not
|
||||
yet acquired etc.
|
||||
@@ -1603,12 +1603,12 @@ int DTMavailWrite( port )
|
||||
err_count = 0 ;
|
||||
rstatus = DTM_PORT_READY ;
|
||||
|
||||
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||
|
||||
/* Connect to all new active sockets */
|
||||
|
||||
if( pcur->connfd == DTM_NO_CONNECTION ) {
|
||||
if( dtm_quick_connect( &pcur->sockaddr, &pcur->connfd )
|
||||
if( dtm_quick_connect( &pcur->sockaddr, &pcur->connfd )
|
||||
== DTMERROR ) {
|
||||
++err_count ;
|
||||
continue ;
|
||||
@@ -1628,14 +1628,14 @@ int DTMavailWrite( port )
|
||||
/* send RTS to new sockets */
|
||||
|
||||
if( dtm_send_ack( pcur->connfd, DTM_RTS ) == DTMERROR ) {
|
||||
if( DTMerrno == DTMEOF )
|
||||
if( DTMerrno == DTMEOF )
|
||||
CHECK_ERR( destroy_out_port( pp, &pcur ));
|
||||
++err_count ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
pcur->seqstart = TRUE ;
|
||||
}
|
||||
|
||||
|
||||
nf = select_one( pcur->connfd );
|
||||
|
||||
if( nf < 0 ) {
|
||||
@@ -1648,10 +1648,10 @@ int DTMavailWrite( port )
|
||||
/* No ack yet */
|
||||
|
||||
if( nf == 0 ) {
|
||||
if( pp->qservice == DTM_SYNC )
|
||||
if( pp->qservice == DTM_SYNC )
|
||||
rstatus = DTM_PORT_NOT_READY ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Receive ack */
|
||||
|
||||
@@ -1661,7 +1661,7 @@ int DTMavailWrite( port )
|
||||
CHECK_ERR( destroy_out_port( pp, &pcur ));
|
||||
++err_count ;
|
||||
continue ;
|
||||
}
|
||||
}
|
||||
|
||||
/* port is available for write */
|
||||
|
||||
@@ -1674,7 +1674,7 @@ int DTMavailWrite( port )
|
||||
At some future point we may want to send the status
|
||||
of err_count to the server.
|
||||
*/
|
||||
pp->fLastWasSuccessfulAvailWrite = ( err_count == 0 )
|
||||
pp->fLastWasSuccessfulAvailWrite = ( err_count == 0 )
|
||||
&& ( rstatus == DTM_PORT_READY );
|
||||
return ( err_count != 0 ) ? DTM_PORT_NOT_READY : rstatus ;
|
||||
}
|
||||
@@ -1688,7 +1688,7 @@ int DTMavailWrite( port )
|
||||
int DTMbeginWrite(int port,VOIDPTR header,int size )
|
||||
#else
|
||||
int DTMbeginWrite( port, header, size )
|
||||
int port ;
|
||||
int port ;
|
||||
VOIDPTR header;
|
||||
int size ;
|
||||
#endif
|
||||
@@ -1702,8 +1702,8 @@ int DTMbeginWrite( port, header, size )
|
||||
if ( pp->fDiscard ) {
|
||||
CHECK_ERR( dtm_check_server( pp, DTM_DONT_WAIT ));
|
||||
if ( pp->fDiscard ) return DTM_OK;
|
||||
}
|
||||
if ( !pp->fLastWasSuccessfulAvailWrite )
|
||||
}
|
||||
if ( !pp->fLastWasSuccessfulAvailWrite )
|
||||
CHECK_ERR( dtm_check_server( pp, DTM_WAIT ));
|
||||
CHECK_ERR( make_out_connections( pp ));
|
||||
make_write_iov( &iov_buf, START_SEQ, NO_END_SEQ, header, size, NULL, 0 );
|
||||
@@ -1734,7 +1734,7 @@ int DTMwriteDataset(p, ds, size, type)
|
||||
IOV_BUF iov_buf;
|
||||
|
||||
CHECK_ERR( p = dtm_map_port_internal( p ));
|
||||
pp = DTMpt[p];
|
||||
pp = DTMpt[p];
|
||||
if ( pp->fDiscard ) return DTM_OK;
|
||||
CHECK_ERR( verify_out_connections( pp ));
|
||||
size = (*DTMconvertRtns[(int)type]) ( DTMSTD, ds, size );
|
||||
@@ -1760,12 +1760,12 @@ int DTMendWrite( port )
|
||||
reg Outport * pcur ;
|
||||
|
||||
CHECK_ERR( port = dtm_map_port_internal( port ));
|
||||
pp = DTMpt[port];
|
||||
pp = DTMpt[port];
|
||||
/*
|
||||
Check for endWrite before begin
|
||||
*/
|
||||
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||
if( pcur->connfd == DTM_NO_CONNECTION ) continue;
|
||||
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||
if( pcur->connfd == DTM_NO_CONNECTION ) continue;
|
||||
if ((pp->qservice == DTM_SYNC && !pcur->availwrite) ||
|
||||
!pcur->seqstart ) {
|
||||
DTMerrno = DTMCALL;
|
||||
@@ -1774,7 +1774,7 @@ int DTMendWrite( port )
|
||||
}
|
||||
if ( pp->fDiscard ) return DTM_OK;
|
||||
CHECK_ERR( verify_out_connections( pp ));
|
||||
make_write_iov( &iov_buf, NO_START_SEQ, END_SEQ, NULL, 0, NULL, 0 );
|
||||
make_write_iov( &iov_buf, NO_START_SEQ, END_SEQ, NULL, 0, NULL, 0 );
|
||||
CHECK_ERR( writev_buffer( pp, &iov_buf, NO_START_SEQ ));
|
||||
CHECK_ERR( clear_write_flags( pp ));
|
||||
return DTM_OK;
|
||||
@@ -1820,8 +1820,8 @@ int DTMwriteMsg( p, hdr, hdrsize, data, datasize, datatype )
|
||||
if ( pp->fDiscard ) {
|
||||
CHECK_ERR( dtm_check_server( pp, DTM_DONT_WAIT ));
|
||||
if ( pp->fDiscard ) return DTM_OK;
|
||||
}
|
||||
if ( !pp->fLastWasSuccessfulAvailWrite )
|
||||
}
|
||||
if ( !pp->fLastWasSuccessfulAvailWrite )
|
||||
CHECK_ERR( dtm_check_server( pp, DTM_WAIT ));
|
||||
CHECK_ERR( make_out_connections( pp ));
|
||||
CHECK_ERR( verify_out_connections( pp ));
|
||||
|
38
libdtm/dtm.h
38
libdtm/dtm.h
@@ -21,7 +21,7 @@
|
||||
|
||||
/*************************************************************************
|
||||
**
|
||||
** dtm.h -
|
||||
** dtm.h -
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
*
|
||||
* Revision 1.32 92/05/06 16:40:17 jefft
|
||||
* Modified prototype on DTMaddInput
|
||||
*
|
||||
*
|
||||
* Revision 1.31 1992/04/30 20:27:05 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
@@ -50,7 +50,7 @@
|
||||
*
|
||||
* Revision 1.29 92/03/20 21:14:40 jplevyak
|
||||
* Add DTMgetPortAddr and remove DTMgetPortName
|
||||
*
|
||||
*
|
||||
* Revision 1.28 1992/03/13 18:20:31 jefft
|
||||
* dtm.h depended on TRUE being defined before it was included. This word
|
||||
* TRUE was changed to 1 and FALSE to 0
|
||||
@@ -63,23 +63,23 @@
|
||||
*
|
||||
* Revision 1.25 92/02/18 14:02:36 jplevyak
|
||||
* Added prototype for DTMaddInPortSocket.
|
||||
*
|
||||
*
|
||||
* Revision 1.24 92/01/30 19:28:24 jplevyak
|
||||
* add prototypes
|
||||
*
|
||||
*
|
||||
* Revision 1.23 1992/01/02 16:31:56 dweber
|
||||
* Reorganized the DTM class and MSG class
|
||||
*
|
||||
* Revision 1.22 91/12/13 22:34:48 jefft
|
||||
* Removed DTMtitle and DTMtype constants. Added dtm_(sg)et_address macros.
|
||||
* Added MSG(sg)etString macros.
|
||||
*
|
||||
*
|
||||
* Revision 1.21 91/12/13 15:37:55 dweber
|
||||
* Fixed DTMHL bugs and re-ordered some macros for clarification
|
||||
*
|
||||
*
|
||||
* Revision 1.20 91/12/12 22:55:27 jefft
|
||||
* Add numbers to the comments beside the DTM errors
|
||||
*
|
||||
*
|
||||
* Revision 1.19 1991/12/10 22:15:56 jefft
|
||||
* fixed DTMgetAddress macro (it was calling dtm_set_char).
|
||||
*
|
||||
@@ -96,7 +96,7 @@
|
||||
* Revision 1.15 91/10/11 20:23:31 jplevyak
|
||||
* Added prototype for DTMcheckRoute,
|
||||
* Changed DTMSYNC, DTMNOSYNC to DTM_SYNC, DTM_ASYNC.
|
||||
*
|
||||
*
|
||||
* Revision 1.14 1991/10/10 14:23:43 jplevyak
|
||||
* All prototypes are now included and tested.
|
||||
*
|
||||
@@ -105,10 +105,10 @@
|
||||
*
|
||||
* Revision 1.12 91/09/18 15:27:54 jplevyak
|
||||
* Added extern definition for DTMinit()
|
||||
*
|
||||
*
|
||||
* Revision 1.11 91/09/13 17:36:05 sreedhar
|
||||
* DTMSYNC, DTMNOSYNC added
|
||||
*
|
||||
*
|
||||
* Revision 1.10 1991/09/13 15:31:45 jefft
|
||||
* fixed DTMHL macro, it should not have taken an arguement.
|
||||
*
|
||||
@@ -136,7 +136,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:31:19 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
#define DTM_PROTOTYPES
|
||||
#define DTM_PROTO(x) x
|
||||
#else
|
||||
#define DTM_PROTO(x) ()
|
||||
#define DTM_PROTO(x) ()
|
||||
#endif
|
||||
|
||||
/* DTM constants */
|
||||
@@ -220,7 +220,7 @@ typedef enum {
|
||||
NOTE: the strings that describe the errors in DTMerr
|
||||
are located in fatal.c. Any changes to this list
|
||||
must be accompanied by a corresponding change there.
|
||||
*/
|
||||
*/
|
||||
#define DTMERROR -1
|
||||
#define DTM_OK DTMNOERR
|
||||
|
||||
@@ -282,21 +282,21 @@ extern int DTMreadDataset DTM_PROTO(( int p, VOIDPTR ds, int size, DTMTYPE type)
|
||||
extern int DTMwriteDataset DTM_PROTO(( int p, VOIDPTR ds, int size, DTMTYPE type));
|
||||
extern int DTMendRead DTM_PROTO(( int port ));
|
||||
extern int DTMendWrite DTM_PROTO(( int port ));
|
||||
extern int DTMreadMsg DTM_PROTO(( int p, char *hdr, int hdrsize,
|
||||
extern int DTMreadMsg DTM_PROTO(( int p, char *hdr, int hdrsize,
|
||||
VOIDPTR data, int datasize, int datatype ));
|
||||
extern int DTMdestroyPort DTM_PROTO(( int port));
|
||||
extern char *DTMerrmsg();
|
||||
extern int DTMgetPortAddr DTM_PROTO(( int port, char * addr, int length ));
|
||||
extern int DTMgetReturnPortName DTM_PROTO(( int port, char *** addrs,
|
||||
int * n_addrs));
|
||||
extern int DTMselectRead DTM_PROTO(( Dtm_set *dtmset, int dtmnum,
|
||||
extern int DTMselectRead DTM_PROTO(( Dtm_set *dtmset, int dtmnum,
|
||||
Sock_set *sockset, int socknum, int period ));
|
||||
extern void DTMsetGroup DTM_PROTO(( char * header, DTMCMD cmd, char * parent,
|
||||
extern void DTMsetGroup DTM_PROTO(( char * header, DTMCMD cmd, char * parent,
|
||||
char * self ));
|
||||
extern int DTMgetGroup DTM_PROTO(( char * header, DTMCMD cmd, char * parent,
|
||||
extern int DTMgetGroup DTM_PROTO(( char * header, DTMCMD cmd, char * parent,
|
||||
char * self ));
|
||||
extern int DTMsendRoute DTM_PROTO(( int fd, char * sendto_addr, int addcount,
|
||||
char **add_addresses, int delcount,
|
||||
char **add_addresses, int delcount,
|
||||
char **del_addresses ));
|
||||
extern int DTMcheckRoute DTM_PROTO(( int port ));
|
||||
/* Not implemented Yet */
|
||||
|
@@ -39,7 +39,7 @@
|
||||
*
|
||||
* Revision 1.7 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.6 1992/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
@@ -58,7 +58,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:31:46 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
|
||||
#endif
|
||||
|
||||
@@ -112,7 +112,7 @@ int DTMGPA(p, s, len)
|
||||
int *p, *len;
|
||||
_fcd s;
|
||||
#endif
|
||||
{
|
||||
{
|
||||
char portaddr[128];
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ int DTMGPA(p, s, len)
|
||||
return DTMERROR;
|
||||
|
||||
if (strlen(portaddr) > *len) {
|
||||
strncpy(_fcdtocp(s), portaddr, *len);
|
||||
strncpy(_fcdtocp(s), portaddr, *len);
|
||||
return DTMERROR;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ int DTMBW(p, header, size)
|
||||
len = _fcdlen(header);
|
||||
strncpy(buffer, _fcdtocp(header), len);
|
||||
buffer[len] = '\0';
|
||||
|
||||
|
||||
return DTMbeginWrite(*p, buffer, len+1);
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@
|
||||
*
|
||||
* Revision 1.33 92/05/05 22:27:50 jplevyak
|
||||
* Corrected X interface code.
|
||||
*
|
||||
*
|
||||
* Revision 1.32 1992/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
@@ -71,7 +71,7 @@
|
||||
*
|
||||
* Revision 1.29 92/03/20 21:14:40 jplevyak
|
||||
* Remove comments about DTMgetPortName
|
||||
*
|
||||
*
|
||||
* Revision 1.28 1992/03/16 20:38:36 creiman
|
||||
* Added #include "arch.h"
|
||||
*
|
||||
@@ -99,7 +99,7 @@
|
||||
*
|
||||
* Revision 1.20 91/11/22 21:31:00 jplevyak
|
||||
* Added initialization for fDiscard (fGotList and fLastWasSuccessfull...)
|
||||
*
|
||||
*
|
||||
* Revision 1.19 1991/10/29 22:05:53 sreedhar
|
||||
* <sys/malloc.h> for CONVEX
|
||||
*
|
||||
@@ -120,17 +120,17 @@
|
||||
* Major reorganization. Dynamically allocate port table. Encode a
|
||||
* key in the external ports to detect stale ports. Rename and
|
||||
* comment functions.
|
||||
*
|
||||
*
|
||||
* Revision 1.13 91/09/18 15:28:11 jplevyak
|
||||
* Added some external definitions for shared functions.
|
||||
*
|
||||
*
|
||||
* Revision 1.12 91/09/16 11:25:37 jplevyak
|
||||
* Fix bug, use of uninitialized register variable in function
|
||||
* DTMdestroyPort
|
||||
*
|
||||
*
|
||||
* Revision 1.11 91/09/13 20:09:31 sreedhar
|
||||
* supporting :9900, absence of env variable
|
||||
*
|
||||
*
|
||||
* Revision 1.10 1991/09/13 18:57:13 sreedhar
|
||||
* removed DTMinit() fn., added qservice in some places
|
||||
*
|
||||
@@ -151,13 +151,13 @@
|
||||
*
|
||||
* Revision 1.3 91/01/09 14:10:04 jefft
|
||||
* Now ignoring SIGPIPE signals.
|
||||
*
|
||||
*
|
||||
* Revision 1.2 90/11/21 10:53:08 jefft
|
||||
* Modified DTMgetPortAddr to return IP address instead of hostname.
|
||||
*
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:21:54 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "arch.h"
|
||||
@@ -185,11 +185,11 @@
|
||||
/*
|
||||
CONTENTS
|
||||
|
||||
STATIC
|
||||
STATIC
|
||||
|
||||
init_port() - initialize DTM port.
|
||||
grow_ports() - enlarge the DTM port table
|
||||
initialize() - initialize DTM library
|
||||
initialize() - initialize DTM library
|
||||
get_init_port() - find a new port and initialize it
|
||||
set_out_port_address() - set a physical out port adress
|
||||
free_port() - free the internal port structure
|
||||
@@ -205,7 +205,7 @@
|
||||
DTMmakeInPort() - make a DTM input port
|
||||
DTMmakeOutPort() - make a DTM output port
|
||||
DTMdestroyPort() - close and free a DTM port
|
||||
DTMgetPortAddr() - returns the main port address
|
||||
DTMgetPortAddr() - returns the main port address
|
||||
|
||||
END CONTENTS */
|
||||
|
||||
@@ -273,7 +273,7 @@ static int init_port( port, porttype, qservice )
|
||||
|
||||
/* Output port data init */
|
||||
|
||||
pp->out = NULL ;
|
||||
pp->out = NULL ;
|
||||
pp->fLastWasSuccessfulAvailWrite = FALSE;
|
||||
pp->fGotList = FALSE;
|
||||
pp->fDiscard = FALSE;
|
||||
@@ -287,7 +287,7 @@ static int init_port( port, porttype, qservice )
|
||||
*/
|
||||
static int grow_ports( VOID )
|
||||
{
|
||||
if ( ( DTMpt = (DTMPORT **) realloc( (void *) DTMpt, (DTMptCount +
|
||||
if ( ( DTMpt = (DTMPORT **) realloc( (void *) DTMpt, (DTMptCount +
|
||||
DTM_PORTS_GROW) * sizeof(DTMPORT))) == NULL ) {
|
||||
DTMerrno = DTMMEM;
|
||||
DTMERR("initialize: insufficient memory for port table.");
|
||||
@@ -310,7 +310,7 @@ static int grow_ports( VOID )
|
||||
Initailized DTM by allocating memory for dtm_discard
|
||||
and DTMpt ( the port table ).
|
||||
*/
|
||||
static int initialize( VOID )
|
||||
static int initialize( VOID )
|
||||
{
|
||||
/* get the debug option flag */
|
||||
if ( getenv( "DTMDEBUG" ) ) uDTMdbg = -1;
|
||||
@@ -358,7 +358,7 @@ static int get_init_port( portname, porttype, qservice )
|
||||
|
||||
/* check for library initialization */
|
||||
if( !DTM_INITIALIZED ) CHECK_ERR( initialize());
|
||||
|
||||
|
||||
/* find first open DTM port */
|
||||
while ( tries-- ) {
|
||||
for (port=0; port < DTMptCount; port+=1) {
|
||||
@@ -366,7 +366,7 @@ static int get_init_port( portname, porttype, qservice )
|
||||
CHECK_ERR(init_port( port, porttype, qservice ));
|
||||
strncpy( DTMpt[port]->portname, portname, (PNAMELEN - 1) );
|
||||
DTMpt[ port ]->portname[ PNAMELEN - 1 ] = '\0' ;
|
||||
DTMpt[ port ]->key = DTMportSequenceNumber++;
|
||||
DTMpt[ port ]->key = DTMportSequenceNumber++;
|
||||
return port;
|
||||
}
|
||||
}
|
||||
@@ -394,18 +394,18 @@ static int set_out_port_address( port, addr )
|
||||
Port aPort ;
|
||||
Outport *outp ;
|
||||
|
||||
DBGINT( "set_out_port_address: Physical TCP portname - %x ",
|
||||
DBGINT( "set_out_port_address: Physical TCP portname - %x ",
|
||||
ntohl( addr.sin_addr.s_addr ));
|
||||
DBGINT( "%d\n", ntohs( addr.sin_port ));
|
||||
|
||||
aPort.portid = addr.sin_port ;
|
||||
aPort.nethostid = addr.sin_addr.s_addr ;
|
||||
aPort.nethostid = addr.sin_addr.s_addr ;
|
||||
CHECK_ERR( outp = dtm_new_out_port( &aPort ));
|
||||
|
||||
DTMpt[port]->out = outp ;
|
||||
DTMpt[port]->out = outp ;
|
||||
|
||||
return DTM_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DTM_PROTOTYPES
|
||||
static int free_port(int port )
|
||||
@@ -414,15 +414,15 @@ static int free_port( port )
|
||||
int port;
|
||||
#endif
|
||||
{
|
||||
Outport * outport = DTMpt[ port ]->out;
|
||||
Outport * outport = DTMpt[ port ]->out;
|
||||
Outport * tempPort;
|
||||
int returnValue = DTM_OK;
|
||||
int returnValue = DTM_OK;
|
||||
|
||||
while ( outport != NULL ) {
|
||||
tempPort = outport->next;
|
||||
#ifdef FREE_RETURNS_INT
|
||||
if ( free( outport ) != 0 ) {
|
||||
DTMerrno = DTMCORPT;
|
||||
DTMerrno = DTMCORPT;
|
||||
returnValue = DTMERROR;
|
||||
break;
|
||||
}
|
||||
@@ -430,10 +430,10 @@ static int free_port( port )
|
||||
free( outport );
|
||||
#endif
|
||||
outport = tempPort;
|
||||
}
|
||||
}
|
||||
#ifdef FREE_RETURNS_INT
|
||||
if ( free( DTMpt[ port ] ) != 0 ) {
|
||||
DTMerrno = DTMCORPT;
|
||||
DTMerrno = DTMCORPT;
|
||||
returnValue = DTMERROR;
|
||||
}
|
||||
#else
|
||||
@@ -455,14 +455,14 @@ static int register_port(int port )
|
||||
#else
|
||||
static int register_port( port )
|
||||
int port;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
int fd ;
|
||||
S_ADDR addr ;
|
||||
char *naddr ;
|
||||
|
||||
CHECK_ERR( naddr = dtm_get_naddr( &addr, &fd ));
|
||||
if(dtm_nsend_sockaddr(fd, naddr, dtm_get_refname(), DTMpt[port]->portname,
|
||||
if(dtm_nsend_sockaddr(fd, naddr, dtm_get_refname(), DTMpt[port]->portname,
|
||||
&DTMpt[ port ]->sockaddr ) < 0 ) {
|
||||
DTMdestroyPort( DTMpt[port]->sockfd ) ;
|
||||
DTMerrno = DTMTIMEOUT;
|
||||
@@ -495,15 +495,15 @@ int dtm_map_port_internal( port )
|
||||
|
||||
if ( ( thePort ) >= DTMptCount ) {
|
||||
DTMerrno = DTMBADPORT;
|
||||
return DTMERROR;
|
||||
return DTMERROR;
|
||||
}
|
||||
if ( DTMpt[ thePort ] == NULL ) {
|
||||
DTMerrno = DTMBADPORT;
|
||||
return DTMERROR;
|
||||
return DTMERROR;
|
||||
}
|
||||
if ( ( port >> DTM_PORT_KEY_SHIFT ) != DTMpt[ thePort ]->key ) {
|
||||
DTMerrno = DTMBADPORT;
|
||||
return DTMERROR;
|
||||
return DTMERROR;
|
||||
}
|
||||
return thePort;
|
||||
}
|
||||
@@ -515,7 +515,7 @@ void dtm_map_port_external( port )
|
||||
int32 *port;
|
||||
#endif
|
||||
{
|
||||
*port = *port | (DTMpt[ *port ]->key << DTM_PORT_KEY_SHIFT);
|
||||
*port = *port | (DTMpt[ *port ]->key << DTM_PORT_KEY_SHIFT);
|
||||
}
|
||||
|
||||
|
||||
@@ -544,11 +544,11 @@ int DTMmakeInPort(portname, qservice )
|
||||
|
||||
CHECK_ERR(port = get_init_port(portname, INPORTTYPE, qservice ));
|
||||
DBGMSG2("DTMmakeInPort port %d addr %X\n", port, DTMpt[port] );
|
||||
CHECK_ERR(dtm_init_sockaddr( &DTMpt[ port ]->sockaddr,
|
||||
CHECK_ERR(dtm_init_sockaddr( &DTMpt[ port ]->sockaddr,
|
||||
DTMpt[ port ]->portname, &fLogicalName ));
|
||||
DTMpt[port]->fLogical = fLogicalName;
|
||||
|
||||
if ((DTMpt[port]->sockfd = dtm_socket_init( &DTMpt[port]->sockaddr,
|
||||
if ((DTMpt[port]->sockfd = dtm_socket_init( &DTMpt[port]->sockaddr,
|
||||
INPORTTYPE, fLogicalName )) == DTMERROR ) {
|
||||
free_port(port);
|
||||
return DTMERROR ;
|
||||
@@ -564,7 +564,7 @@ int DTMmakeInPort(portname, qservice )
|
||||
|
||||
|
||||
/*
|
||||
DTMmakeOutPort()
|
||||
DTMmakeOutPort()
|
||||
Create and initialze a new port.
|
||||
portname may be a logical or a physical port.
|
||||
qservice is reserved for future use.
|
||||
@@ -576,7 +576,7 @@ int DTMmakeOutPort(char *portname,int qservice )
|
||||
int DTMmakeOutPort(portname, qservice )
|
||||
char *portname;
|
||||
int qservice ;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
int port;
|
||||
int fLogicalName = TRUE;
|
||||
@@ -585,10 +585,10 @@ int DTMmakeOutPort(portname, qservice )
|
||||
DBGFLOW("DTMmakeOutPort called.\n");
|
||||
|
||||
CHECK_ERR( (port = get_init_port( portname, OUTPORTTYPE, qservice)));
|
||||
CHECK_ERR((dtm_init_sockaddr(&addr, DTMpt[port]->portname,&fLogicalName)));
|
||||
CHECK_ERR((dtm_init_sockaddr(&addr, DTMpt[port]->portname,&fLogicalName)));
|
||||
DTMpt[port]->fLogical = fLogicalName;
|
||||
|
||||
if( !fLogicalName ) CHECK_ERR( set_out_port_address( port, addr ));
|
||||
if( !fLogicalName ) CHECK_ERR( set_out_port_address( port, addr ));
|
||||
|
||||
if( (DTMpt[port] -> sockfd = dtm_socket_init( &DTMpt[port] -> sockaddr,
|
||||
OUTPORTTYPE, fLogicalName )) == DTMERROR ) {
|
||||
@@ -614,7 +614,7 @@ int DTMdestroyPort(int port)
|
||||
#else
|
||||
int DTMdestroyPort(port)
|
||||
int port;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
reg DTMPORT *pp ;
|
||||
|
||||
@@ -634,7 +634,7 @@ int DTMdestroyPort(port)
|
||||
|
||||
if( pp -> porttype == INPORTTYPE ) {
|
||||
register Inport *pcur ;
|
||||
FOR_EACH_IN_PORT( pcur, pp ) {
|
||||
FOR_EACH_IN_PORT( pcur, pp ) {
|
||||
if( pcur->fd != DTM_NO_CONNECTION ) {
|
||||
if ( pp->Xcallback ) pp->XremoveInput( pcur->XinputId );
|
||||
close( pcur->fd ) ;
|
||||
@@ -643,11 +643,11 @@ int DTMdestroyPort(port)
|
||||
} else {
|
||||
register Outport *pcur ;
|
||||
|
||||
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||
if( pcur->connfd != DTM_NO_CONNECTION ) close( pcur->connfd ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* free space allocated for port */
|
||||
|
||||
free_port( port );
|
||||
@@ -686,7 +686,7 @@ int DTMgetPortAddr(port, addr, length)
|
||||
sprintf(pnum, ":%d", ntohs( DTMpt[port]->sockaddr.sin_port ) );
|
||||
if ( strlen( pnum ) + strlen( addr ) + 1 > length ) {
|
||||
DTMerrno = DTMBUFOVR;
|
||||
return DTMERROR;
|
||||
return DTMERROR;
|
||||
}
|
||||
strcat(addr, pnum);
|
||||
|
||||
@@ -704,7 +704,7 @@ static char * dtm_addr_to_a( addr )
|
||||
uint32 hnum = addr.sin_addr.s_addr;
|
||||
unsigned char * p_hnum = (unsigned char *) &hnum;
|
||||
|
||||
sprintf(addr_buf, "%d.%d.%d.%d:%d",
|
||||
sprintf(addr_buf, "%d.%d.%d.%d:%d",
|
||||
p_hnum[0], p_hnum[1], p_hnum[2], p_hnum[3], ntohs( addr.sin_port ));
|
||||
return addr_buf;
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@
|
||||
*
|
||||
* Revision 1.28 92/05/05 22:27:50 jplevyak
|
||||
* Corrected X interface code.
|
||||
*
|
||||
*
|
||||
* Revision 1.27 1992/04/30 20:27:05 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
@@ -62,13 +62,13 @@
|
||||
*
|
||||
* Revision 1.20 92/02/27 23:59:56 jplevyak
|
||||
* Fixup prototype problems.
|
||||
*
|
||||
*
|
||||
* Revision 1.19 1992/01/30 19:28:50 jplevyak
|
||||
* Add support for c++ type external definitions.
|
||||
*
|
||||
* Revision 1.18 92/01/24 18:45:50 jefft
|
||||
* Removed prototypes for dtm_set_<type> and dtm_get_<type>, added them to dtm.h
|
||||
*
|
||||
*
|
||||
* Revision 1.17 1991/12/16 19:44:04 jefft
|
||||
* Fixed bug with defining of NULL macro
|
||||
*
|
||||
@@ -97,13 +97,13 @@
|
||||
* Major reorganization. Made this file compatible with dtm.h. Moved
|
||||
* redundant out. Added several configuration parameters, added
|
||||
* prototypes for internally global functions.
|
||||
*
|
||||
*
|
||||
* Revision 1.9 91/09/18 15:28:50 jplevyak
|
||||
* Added some external definitions for shared functions.
|
||||
*
|
||||
*
|
||||
* Revision 1.8 91/09/13 17:37:37 sreedhar
|
||||
* MAX132 instead of MAXBUFSIZE
|
||||
*
|
||||
*
|
||||
* Revision 1.7 1991/08/15 19:10:53 sreedhar
|
||||
* Changes for logical portname version
|
||||
*
|
||||
@@ -121,10 +121,10 @@
|
||||
*
|
||||
* Revision 1.2 90/11/21 12:35:44 jefft
|
||||
* Removed trailing comma from DTM error enum type.
|
||||
*
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:32:03 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
#endif
|
||||
|
||||
/* Added to shut up the SGI compiler which quotes ANSI regulations at
|
||||
you.
|
||||
you.
|
||||
*/
|
||||
#ifdef DTM_PROTOTYPES
|
||||
struct sockaddr;
|
||||
@@ -163,7 +163,7 @@ struct iovec;
|
||||
#define INIT(x)
|
||||
#endif
|
||||
|
||||
#define reg register
|
||||
#define reg register
|
||||
|
||||
|
||||
/*
|
||||
@@ -261,7 +261,7 @@ struct iovec;
|
||||
*/
|
||||
#define MAX132 132 /* max space of 132 */
|
||||
#define SEP " " /* blank as separator */
|
||||
#define COLON ":" /* colon as separator */
|
||||
#define COLON ":" /* colon as separator */
|
||||
|
||||
#ifndef NULL
|
||||
# if defined( _STDC_ ) || defined( __STDC__ )
|
||||
@@ -272,33 +272,33 @@ struct iovec;
|
||||
#endif
|
||||
|
||||
#define FOR_EACH_OUT_PORT( pcur, pp ) \
|
||||
for ( pcur = pp->out; pcur != NULL ; pcur = pcur->next )
|
||||
for ( pcur = pp->out; pcur != NULL ; pcur = pcur->next )
|
||||
#define FOR_EACH_IN_PORT( inp, pp ) \
|
||||
for ( inp = pp->in; inp != NULL ; inp = inp->next )
|
||||
|
||||
|
||||
/*
|
||||
PORT STRUCTURES
|
||||
/*
|
||||
PORT STRUCTURES
|
||||
*/
|
||||
|
||||
typedef struct sockaddr_in S_ADDR;
|
||||
|
||||
typedef struct Port
|
||||
typedef struct Port
|
||||
{
|
||||
uint32 nethostid ;
|
||||
uint16 portid ;
|
||||
} Port ;
|
||||
|
||||
typedef struct Outport
|
||||
typedef struct Outport
|
||||
{
|
||||
S_ADDR sockaddr ; /* Socket family, netid/hostid, portid */
|
||||
int32 connfd ; /* connection fd */
|
||||
int availwrite ; /* port availability for write */
|
||||
int seqstart ; /* "Sequence start" message sent or not */
|
||||
struct Outport * next; /* link to next outport */
|
||||
int32 connfd ; /* connection fd */
|
||||
int availwrite ; /* port availability for write */
|
||||
int seqstart ; /* "Sequence start" message sent or not */
|
||||
struct Outport * next; /* link to next outport */
|
||||
} Outport ;
|
||||
|
||||
#define DTM_NEW_DATASET -1
|
||||
#define DTM_NEW_DATASET -1
|
||||
typedef struct Inport {
|
||||
int32 fd; /* connection fds */
|
||||
int32 blocklen; /* records no. of bytes read */
|
||||
@@ -315,27 +315,27 @@ typedef struct Inport {
|
||||
to restore the assertion
|
||||
#endif
|
||||
#endif
|
||||
XtInputId XinputId;
|
||||
XtInputId XinputId;
|
||||
#else
|
||||
int XinputId;
|
||||
#endif
|
||||
struct Inport * next;
|
||||
} Inport;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
S_ADDR sockaddr ;
|
||||
S_ADDR sockaddr ;
|
||||
/* Socket family, netid/hostid, portid */
|
||||
int32 sockfd ; /* Main socket of port
|
||||
int32 sockfd ; /* Main socket of port
|
||||
Outport - UDP socket
|
||||
Inport - TCP socket
|
||||
*/
|
||||
#ifdef _XtIntrinsic_h
|
||||
XtInputId XinputId;
|
||||
XtInputId XinputId;
|
||||
#else
|
||||
int XinputId;
|
||||
#endif
|
||||
|
||||
|
||||
int fLogical;
|
||||
char portname[ PNAMELEN ] ; /* Logical portname */
|
||||
|
||||
@@ -375,11 +375,11 @@ typedef struct
|
||||
GLOBAL VARIABLES
|
||||
*/
|
||||
|
||||
#define DTM_INITIALIZED (DTMpt != NULL)
|
||||
#define DTM_INITIALIZED (DTMpt != NULL)
|
||||
#define DTM_PORTS_INITIAL 20
|
||||
#define DTM_PORTS_GROW 20
|
||||
global DTMPORT **DTMpt INIT( NULL );
|
||||
global int32 DTMptCount INIT( 0 );
|
||||
global int32 DTMptCount INIT( 0 );
|
||||
global int32 DTMportSequenceNumber INIT( 1 );
|
||||
|
||||
#ifdef _ARCH_MSDOS
|
||||
@@ -420,7 +420,7 @@ extern int dtm_nsend_sockaddr DTM_PROTO(( int fd, char * sendto_addr,
|
||||
char * refname, char * portname, S_ADDR * sockaddr ));
|
||||
extern Outport * dtm_new_out_port DTM_PROTO(( Port * port ));
|
||||
#define DTM_PORT_MASK 0xFFFF
|
||||
#define DTM_PORT_KEY_SHIFT 16
|
||||
#define DTM_PORT_KEY_SHIFT 16
|
||||
extern int dtm_map_port_internal DTM_PROTO(( int32 port ));
|
||||
extern void dtm_map_port_external DTM_PROTO(( int32 * port ));
|
||||
#define DTM_WAIT TRUE
|
||||
@@ -433,26 +433,26 @@ extern int dtm_destroy_in_port DTM_PROTO(( Inport * inp, DTMPORT * pp ));
|
||||
extern int dtm_writev_buffer DTM_PROTO(( int fd, struct iovec *iov,
|
||||
int32 iovlen, int32 iovsize,
|
||||
struct sockaddr * addr, int addrlen ));
|
||||
extern int dtm_read_buffer DTM_PROTO(( int d, int32 * blocklen,
|
||||
extern int dtm_read_buffer DTM_PROTO(( int d, int32 * blocklen,
|
||||
void * buffer, int length ));
|
||||
extern int dtm_recv_header DTM_PROTO((int fd , void * header,
|
||||
extern int dtm_recv_header DTM_PROTO((int fd , void * header,
|
||||
int length));
|
||||
extern int dtm_read_header DTM_PROTO((int fd , void * header,
|
||||
int length));
|
||||
extern int dtm_parse_ipaddr DTM_PROTO(( char * source,
|
||||
extern int dtm_parse_ipaddr DTM_PROTO(( char * source,
|
||||
unsigned long * dest ));
|
||||
extern int dtm_quick_select DTM_PROTO(( int socket, int32 * count ));
|
||||
extern int dtm_select DTM_PROTO(( int fd, int32 * count,
|
||||
extern int dtm_select DTM_PROTO(( int fd, int32 * count,
|
||||
int32 time ));
|
||||
extern int dtm_accept DTM_PROTO(( int fd, S_ADDR * sn,
|
||||
extern int dtm_accept DTM_PROTO(( int fd, S_ADDR * sn,
|
||||
struct timeval * timeout ));
|
||||
extern int dtm_connect DTM_PROTO(( S_ADDR * sn, int * sockret ));
|
||||
extern int dtm_quick_connect DTM_PROTO(( S_ADDR * sn, int * sockret ));
|
||||
extern int dmt_end_connect DTM_PROTO(( int32 socket ));
|
||||
extern int dmt_end_connect DTM_PROTO(( int32 socket ));
|
||||
extern unsigned long dtm_get_ipaddr DTM_PROTO(( char * ipaddrstr ));
|
||||
extern int dtm_socket_init DTM_PROTO(( S_ADDR * sockaddr, int porttype,
|
||||
extern int dtm_socket_init DTM_PROTO(( S_ADDR * sockaddr, int porttype,
|
||||
int fLogicalName ));
|
||||
extern int dtm_init_sockaddr DTM_PROTO(( S_ADDR * sockaddr,
|
||||
extern int dtm_init_sockaddr DTM_PROTO(( S_ADDR * sockaddr,
|
||||
char * portname,
|
||||
int * pfLogicalName ));
|
||||
extern int dtm_ninit DTM_PROTO(( void ));
|
||||
@@ -463,13 +463,13 @@ extern char * dtm_find_tag DTM_PROTO(( char *, char *));
|
||||
extern int dtm_accept_read_connections DTM_PROTO(( DTMPORT *pp,int fWait ));
|
||||
extern void dtm_set_Xcallback DTM_PROTO(( DTMPORT *pp, Inport * inp ));
|
||||
#ifdef _XtIntrinsic_h
|
||||
extern void dtm_handle_in DTM_PROTO(( caddr_t client_data,
|
||||
extern void dtm_handle_in DTM_PROTO(( caddr_t client_data,
|
||||
int * fd, XtInputId * in ));
|
||||
#else
|
||||
extern void dtm_handle_in DTM_PROTO(( caddr_t client_data,
|
||||
extern void dtm_handle_in DTM_PROTO(( caddr_t client_data,
|
||||
int * fd, void * in ));
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
@@ -48,7 +48,7 @@
|
||||
*
|
||||
* Revision 1.8 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.7 1992/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
@@ -58,7 +58,7 @@
|
||||
*
|
||||
* Revision 1.5 91/09/26 20:24:21 jplevyak
|
||||
* Added debug.h as include file.
|
||||
*
|
||||
*
|
||||
* Revision 1.4 1991/06/11 15:19:36 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
@@ -70,7 +70,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:32:18 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
|
||||
#endif
|
||||
*/
|
||||
@@ -341,7 +341,7 @@ int DTMgetGroup(h, cmd, parent, self)
|
||||
}
|
||||
else
|
||||
*parent = '\0';
|
||||
|
||||
|
||||
h = strchr(h, ' ')+1;
|
||||
|
||||
/* get self name */
|
||||
|
@@ -53,7 +53,7 @@
|
||||
*
|
||||
* Revision 1.19 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
|
||||
#endif
|
||||
*/
|
||||
@@ -76,7 +76,7 @@
|
||||
#endif
|
||||
|
||||
#if !defined _ARCH_MACOS & !defined NEXT
|
||||
# ifdef CONVEX
|
||||
# ifdef CONVEX
|
||||
# include <sys/malloc.h>
|
||||
# else
|
||||
# include <malloc.h>
|
||||
@@ -96,7 +96,7 @@ static void del_nlist DTM_PROTO(( DTMPORT *pp, int count ));
|
||||
static void add_nlist DTM_PROTO(( DTMPORT *pp, int count ));
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
Function to initialise self's reference name from environment
|
||||
variable passed by nameserver.
|
||||
|
||||
@@ -105,7 +105,7 @@ static void add_nlist DTM_PROTO(( DTMPORT *pp, int count ));
|
||||
|
||||
Notes : Environment variable - DTM_REFNAME
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DTM_PROTOTYPES
|
||||
static int init_refname(char *refname,int len )
|
||||
#else
|
||||
@@ -163,11 +163,11 @@ void dtm_display_buf( outp, portname )
|
||||
DBGINT( "dtm_display_buf: Logical port %s\n", portname );
|
||||
while ( outp != NULL );
|
||||
{
|
||||
DBGINT( "dtm_display_buf: Nethostid = %x\n",
|
||||
DBGINT( "dtm_display_buf: Nethostid = %x\n",
|
||||
ntohl( outp -> sockaddr.sin_addr.s_addr) );
|
||||
DBGINT( "dtm_display_buf: Portid = %d\n",
|
||||
DBGINT( "dtm_display_buf: Portid = %d\n",
|
||||
ntohs( outp -> sockaddr.sin_port) );
|
||||
outp = outp->next;
|
||||
outp = outp->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ Outport * dtm_new_out_port(Port *port )
|
||||
Outport * dtm_new_out_port( port )
|
||||
Port * port;
|
||||
#endif
|
||||
{
|
||||
{
|
||||
Outport * p;
|
||||
|
||||
if ( (p = (Outport *) malloc( sizeof( Outport ))) == NULL ) {
|
||||
@@ -226,8 +226,8 @@ static void del_nlist( pp, count )
|
||||
outpLast = NULL;
|
||||
for ( outp = pp->out ; outp != NULL ; outp = outpNext ) {
|
||||
outpNext = outp->next;
|
||||
if ((outp->sockaddr.sin_port == port.portid ) &&
|
||||
(outp-> sockaddr.sin_addr.s_addr == port.nethostid)) {
|
||||
if ((outp->sockaddr.sin_port == port.portid ) &&
|
||||
(outp-> sockaddr.sin_addr.s_addr == port.nethostid)) {
|
||||
if ( outpLast==NULL ) pp->out = outp->next;
|
||||
else outpLast->next = outp->next;
|
||||
free( outp );
|
||||
@@ -276,9 +276,9 @@ int dtm_check_server( pp, fWait )
|
||||
int addcount;
|
||||
|
||||
/* If it is not a logical port is is not listed with the server */
|
||||
|
||||
|
||||
if ( !pp->fLogical ) return DTM_OK;
|
||||
|
||||
|
||||
/* Check for new or first routing list */
|
||||
|
||||
fWait = fWait && (pp->out == NULL);
|
||||
@@ -301,11 +301,11 @@ int dtm_check_server( pp, fWait )
|
||||
|
||||
/* Ack the route message */
|
||||
#if 0
|
||||
CHECK_ERR( dtm_nsend_ackroute( portname ));
|
||||
CHECK_ERR( dtm_nsend_ackroute( portname ));
|
||||
#endif
|
||||
|
||||
/* Process the routing message */
|
||||
|
||||
|
||||
{
|
||||
char * msg_type = strtok( mbuf, SEP );
|
||||
if (!strcmp( msg_type, MROUTEID)) {
|
||||
@@ -318,7 +318,7 @@ int dtm_check_server( pp, fWait )
|
||||
return addcount;
|
||||
} else if ( !strcmp( msg_type, MDISCARD ) ) {
|
||||
pp->fDiscard = atoi( strtok( NULL, SEP));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@@ -34,17 +34,17 @@
|
||||
*
|
||||
* Revision 1.5 92/04/30 20:27:05 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Purpose : Header file for name server interaction
|
||||
Purpose : Header file for name server interaction
|
||||
Notes :
|
||||
|
||||
Message format:
|
||||
Message format:
|
||||
|
||||
Portid - nethostid:portid
|
||||
Portid - nethostid:portid
|
||||
Header - opcode
|
||||
|
||||
DTM to nameserver
|
||||
@@ -52,7 +52,7 @@
|
||||
Send message length.
|
||||
|
||||
Mreg - Header refname portname Portid
|
||||
Mackroute - Header refname portname
|
||||
Mackroute - Header refname portname
|
||||
|
||||
Nameserver to DTM
|
||||
|
||||
@@ -65,11 +65,11 @@
|
||||
Nethostid is in dotted decimal notation of internet.
|
||||
*/
|
||||
|
||||
#define MREGID "REGISTER"
|
||||
#define MREGID "REGISTER"
|
||||
#define MREG "%s %s %s %s:%d"
|
||||
#define MROUTEID "ROUTE"
|
||||
#define MROUTEID "ROUTE"
|
||||
#define MROUTE "%s %d %d" /* %s:%d %s:%d .... */
|
||||
#define MACKROUTEID "ROUTE_ACK"
|
||||
#define MACKROUTE "%s %s %s"
|
||||
#define MACKROUTEID "ROUTE_ACK"
|
||||
#define MACKROUTE "%s %s %s"
|
||||
#define MDISCARDID "DISCARD"
|
||||
#define MDISCARD "%s %d"
|
||||
|
@@ -48,7 +48,7 @@
|
||||
*
|
||||
* Revision 1.8 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.7 1992/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
@@ -64,10 +64,10 @@
|
||||
* Added several new errors, changed the DTMerrmsg function to detect
|
||||
* and return 'unknown error:' errors. Generally encorporated the
|
||||
* good features of sherr (from the libtest directory).
|
||||
*
|
||||
*
|
||||
* Revision 1.3 91/06/25 20:13:28 creiman
|
||||
* Removed varargs and dtm_fatal.
|
||||
*
|
||||
*
|
||||
* Revision 1.2 1991/06/11 15:19:57 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
@@ -133,11 +133,11 @@ char *DTMerrmsg(quiet)
|
||||
int quiet;
|
||||
#endif
|
||||
{
|
||||
char * strUnknown = "unknown error: %d";
|
||||
char * strUnknown = "unknown error: %d";
|
||||
char strOut[60];
|
||||
char * strErr;
|
||||
|
||||
if ( DTMerrno < (sizeof(err_msg)/sizeof(char *)))
|
||||
if ( DTMerrno < (sizeof(err_msg)/sizeof(char *)))
|
||||
strErr = err_msg[(int)DTMerrno];
|
||||
else {
|
||||
sprintf( strOut, strUnknown, DTMerrno);
|
||||
@@ -145,7 +145,7 @@ char *DTMerrmsg(quiet)
|
||||
}
|
||||
|
||||
if (!quiet)
|
||||
fprintf(stderr, "\nDTMerrno = %d: %s\n", DTMerrno,
|
||||
fprintf(stderr, "\nDTMerrno = %d: %s\n", DTMerrno,
|
||||
strErr);
|
||||
return strErr;
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
/************************************************************************
|
||||
**
|
||||
** mdd.c - Multi-Dimensional Data set routines
|
||||
**
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
@@ -53,7 +53,7 @@
|
||||
*
|
||||
* Revision 1.5 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.4 1992/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
@@ -185,7 +185,7 @@ int MDDgetMinMax(h, min, max)
|
||||
|
||||
h = strchr(h, ' ') + 1;
|
||||
*max = (float)atof(h);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@
|
||||
*
|
||||
* Revision 1.4 92/04/30 20:27:05 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
*
|
||||
* Revision 1.3 1992/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
|
@@ -47,14 +47,14 @@
|
||||
*
|
||||
* Revision 1.7 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
|
||||
#endif
|
||||
*/
|
||||
/*
|
||||
|
||||
Purpose : Functions to initialise name server address, fd and to
|
||||
to return it.
|
||||
to return it.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -74,10 +74,10 @@
|
||||
|
||||
static struct sockaddr_in nsaddr ; /* name server's address */
|
||||
static int nssockfd = -1 ; /* name server's socket */
|
||||
static char nameserver[ MAX132 ] ;
|
||||
/*
|
||||
static char nameserver[ MAX132 ] ;
|
||||
/*
|
||||
name server address -
|
||||
dotted decimal: port number
|
||||
dotted decimal: port number
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -87,10 +87,10 @@ static char nameserver[ MAX132 ] ;
|
||||
Return values : DTMERROR on error.
|
||||
DTM_OK on success.
|
||||
Notes :
|
||||
Environment variable format :
|
||||
|
||||
Environment variable format :
|
||||
|
||||
DTM_NAMESERVER=nethostid:portid
|
||||
|
||||
|
||||
e.g. DTM_NAMESERVER=141.142.221.66:9900
|
||||
*/
|
||||
#ifdef DTM_PROTOTYPES
|
||||
@@ -107,10 +107,10 @@ int dtm_ninit()
|
||||
DTMERR( "dtm_ninit: Env not setup" );
|
||||
return DTMERROR ;
|
||||
}
|
||||
|
||||
|
||||
/* Initialise name server's address, used in send() */
|
||||
|
||||
strncpy( nameserver, p, MAX132 );
|
||||
strncpy( nameserver, p, MAX132 );
|
||||
|
||||
DBGINT( "dtm_ninit: Nameserver is %s\n", nameserver );
|
||||
|
||||
@@ -126,11 +126,11 @@ int dtm_ninit()
|
||||
|
||||
*portstr++ = '\0';
|
||||
|
||||
nsaddr.sin_addr.s_addr = inet_addr( p ) ;
|
||||
nsaddr.sin_addr.s_addr = inet_addr( p ) ;
|
||||
nsaddr.sin_port = (unsigned short)atol( portstr ) ;
|
||||
|
||||
DBGMSG1("dtm_ninit: Nethostid = %x\n", ntohl( nsaddr.sin_addr.s_addr) );
|
||||
DBGMSG1("dtm_ninit: Portid = %d\n", ntohs( nsaddr.sin_port) );
|
||||
DBGMSG1("dtm_ninit: Portid = %d\n", ntohs( nsaddr.sin_port) );
|
||||
}
|
||||
|
||||
/* Acquire socket to be used for sending to name server */
|
||||
|
@@ -53,7 +53,7 @@
|
||||
*
|
||||
* Revision 1.15 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
|
||||
#endif
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ static int dtm_send_control( fd, msg, msize, sendto_addr )
|
||||
sendaddr[ MAX132 - 1 ] = '\0' ;
|
||||
|
||||
sockaddr.sin_family = AF_INET ;
|
||||
CHECK_ERR( dtm_init_sockaddr( &sockaddr, sendaddr, &fLogical));
|
||||
CHECK_ERR( dtm_init_sockaddr( &sockaddr, sendaddr, &fLogical));
|
||||
|
||||
/* Prepare iovec and send message length */
|
||||
|
||||
@@ -138,10 +138,10 @@ static int dtm_send_control( fd, msg, msize, sendto_addr )
|
||||
{
|
||||
DBGFLOW( "dtm_send_control: message length send error\n" );
|
||||
return status ;
|
||||
}
|
||||
}
|
||||
|
||||
/* Prepare iovec and send message */
|
||||
|
||||
|
||||
iov[ 0 ].iov_base = msg ;
|
||||
iov[ 0 ].iov_len = msize ;
|
||||
|
||||
@@ -168,10 +168,10 @@ int DTMsendDiscard( fd, sendto_addr, set_or_clear )
|
||||
|
||||
sprintf( mbuf, MDISCARD, MROUTEID, set_or_clear );
|
||||
|
||||
DBGFLOW( "DTMsendDiscard: Message:- " );
|
||||
DBGFLOW( "DTMsendDiscard: Message:- " );
|
||||
DBGFLOW( mbuf ); DBGFLOW( "\n" );
|
||||
|
||||
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -193,8 +193,8 @@ int DTMsendDiscard( fd, sendto_addr, set_or_clear )
|
||||
int DTMsendRoute(int fd,char *sendto_addr,int addcount,char **add_addresses,
|
||||
int delcount, char **del_addresses )
|
||||
#else
|
||||
int DTMsendRoute( fd, sendto_addr, addcount, add_addresses,
|
||||
delcount, del_addresses )
|
||||
int DTMsendRoute( fd, sendto_addr, addcount, add_addresses,
|
||||
delcount, del_addresses )
|
||||
int fd; /* output socket */
|
||||
char *sendto_addr; /* destination address addr:port number */
|
||||
int addcount; /* number of addresses to connect to */
|
||||
@@ -212,18 +212,18 @@ int DTMsendRoute( fd, sendto_addr, addcount, add_addresses,
|
||||
sprintf( mbuf, MROUTE, MROUTEID, delcount, addcount ) ;
|
||||
while( delcount-- ) {
|
||||
strncat( mbuf, " ", (MAX132-1));
|
||||
strncat( mbuf, del_addresses[ delcount ], (MAX132 - 1));
|
||||
strncat( mbuf, del_addresses[ delcount ], (MAX132 - 1));
|
||||
}
|
||||
while( addcount-- ) {
|
||||
strncat( mbuf, " ", (MAX132-1));
|
||||
strncat( mbuf, add_addresses[ addcount ], (MAX132 - 1));
|
||||
strncat( mbuf, add_addresses[ addcount ], (MAX132 - 1));
|
||||
}
|
||||
mbuf[ MAX132 - 1 ] = '\0' ;
|
||||
mbuf[ MAX132 - 1 ] = '\0' ;
|
||||
|
||||
DBGFLOW( "DTMsendRoute: Message:- " );
|
||||
DBGFLOW( "DTMsendRoute: Message:- " );
|
||||
DBGFLOW( mbuf ); DBGFLOW( "\n" );
|
||||
|
||||
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -254,10 +254,10 @@ int dtm_nsend_ackroute( portname )
|
||||
sprintf( mbuf, MACKROUTE, MACKROUTEID, refname, portname );
|
||||
mbuf[ MAX132 - 1 ] = '\0' ;
|
||||
|
||||
DBGFLOW( "dtm_nsend_ackroute: Message:- " );
|
||||
DBGFLOW( "dtm_nsend_ackroute: Message:- " );
|
||||
DBGFLOW( mbuf ); DBGFLOW( "\n" );
|
||||
|
||||
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -326,7 +326,7 @@ int DTMrecvRegistration(fd, buffer, len)
|
||||
messages and sending routing messages.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DTM_PROTOTYPES
|
||||
int DTMmakeNameServerPort(char *portid)
|
||||
#else
|
||||
@@ -335,7 +335,7 @@ int DTMmakeNameServerPort(portid)
|
||||
#endif
|
||||
{
|
||||
struct sockaddr_in saddr;
|
||||
|
||||
|
||||
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_addr.s_addr = htonl(0);
|
||||
|
@@ -47,7 +47,7 @@
|
||||
*
|
||||
* Revision 1.9 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.8 1992/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
@@ -57,13 +57,13 @@
|
||||
*
|
||||
* Revision 1.6 92/01/24 19:12:55 dweber
|
||||
* *** empty log message ***
|
||||
*
|
||||
*
|
||||
* Revision 1.5 91/11/04 12:57:55 dweber
|
||||
* Deleted (via comments) superfluous functions. Later to be removed.
|
||||
*
|
||||
*
|
||||
* Revision 1.4 91/09/26 20:26:11 jplevyak
|
||||
* Use dtminit.h for access to internally global functions.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 1991/06/11 15:21:05 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
|
16
libdtm/ris.h
16
libdtm/ris.h
@@ -34,29 +34,29 @@
|
||||
*
|
||||
* Revision 1.11 92/04/30 20:27:05 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
*
|
||||
* Revision 1.10 1992/02/21 13:48:04 dweber
|
||||
* Fixed prototyping problem in RISgetType.
|
||||
*
|
||||
* Revision 1.9 92/02/18 16:22:04 dweber
|
||||
* Added functions for setting/getting associated palette names.
|
||||
* (RISsetPaletteName and RISgetPaletteName)
|
||||
*
|
||||
*
|
||||
* Revision 1.8 92/01/24 19:12:55 dweber
|
||||
* *** empty log message ***
|
||||
*
|
||||
*
|
||||
* Revision 1.7 91/11/18 11:48:57 dweber
|
||||
* Returned the RISsize definition and changed PALsize to PALelements for same reason
|
||||
*
|
||||
*
|
||||
* Revision 1.6 91/11/04 15:06:08 dweber
|
||||
* Added PAL size commands
|
||||
*
|
||||
*
|
||||
* Revision 1.5 91/11/04 12:58:36 dweber
|
||||
* Added RIS types and removed 8/24 bit distinction from class level.
|
||||
*
|
||||
*
|
||||
* Revision 1.4 91/09/10 15:07:32 jefft
|
||||
* cleaned-up message class macros.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 1991/06/11 15:23:04 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
@@ -65,7 +65,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:38:04 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -69,7 +69,7 @@
|
||||
*
|
||||
* Revision 1.19 92/05/14 19:27:48 jefft
|
||||
* modified dtm_recv_reliable
|
||||
*
|
||||
*
|
||||
* Revision 1.18 1992/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
@@ -82,7 +82,7 @@
|
||||
* Revision 1.15 92/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
*
|
||||
*
|
||||
* Revision 1.14 1992/03/02 18:29:41 jplevyak
|
||||
* Fixed bug in EAGAIN handling.
|
||||
*
|
||||
@@ -103,7 +103,7 @@
|
||||
*
|
||||
* Revision 1.7 91/08/20 15:56:06 sreedhar
|
||||
* Removed unused functions - dtm_write_buffer, dtm_send, dtm_recv
|
||||
*
|
||||
*
|
||||
* Revision 1.6 1991/08/15 18:56:52 sreedhar
|
||||
* Changes for logical portname version
|
||||
*
|
||||
@@ -159,8 +159,8 @@
|
||||
CONTENTS
|
||||
|
||||
|
||||
dtm_read_buffer() - attempts to fill the next dtm buffer.
|
||||
dtm_recv_header() - Function to read header and return size.
|
||||
dtm_read_buffer() - attempts to fill the next dtm buffer.
|
||||
dtm_recv_header() - Function to read header and return size.
|
||||
dtm_recv_ack() - receive message ackowledgement
|
||||
tm_send_ack() - send message acknowledgement
|
||||
dtm_writev_buffer() - sends the buffers to receiving process.
|
||||
@@ -200,7 +200,7 @@ static int ready_bytes( d, length )
|
||||
fd_set mask;
|
||||
struct timeval timeout ;
|
||||
|
||||
|
||||
|
||||
/* set the select timeout value */
|
||||
timeout.tv_sec = 2;
|
||||
timeout.tv_usec = 0;
|
||||
@@ -235,7 +235,7 @@ static int ready_bytes( d, length )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Reliably read from a port in the face of signals and other
|
||||
@@ -288,7 +288,7 @@ int dtm_recv_reliable( d, buffer, length )
|
||||
}
|
||||
|
||||
/*
|
||||
* dtm_read_buffer() - attempts to fill the next dtm buffer. The
|
||||
* dtm_read_buffer() - attempts to fill the next dtm buffer. The
|
||||
* blocklen variable must be set to DTM_NEW_DATASET after each dataset
|
||||
* to force recv_buffer to move the next dataset.
|
||||
*/
|
||||
@@ -307,8 +307,8 @@ int dtm_read_buffer(d, blocklen, buffer, length)
|
||||
DBGMSG1("dtm_recv_buffer: attempting to read %d bytes.\n", length);
|
||||
DBGMSG1("dtm_recv_buffer: initial blocklen = %d\n", *blocklen);
|
||||
|
||||
/* if block length is DTM_NEW_DATASET this is a new dataset
|
||||
* get initial block count
|
||||
/* if block length is DTM_NEW_DATASET this is a new dataset
|
||||
* get initial block count
|
||||
*/
|
||||
if (*blocklen == DTM_NEW_DATASET) {
|
||||
CHECK_ERR(dtm_recv_reliable(d, (char *)blocklen, 4));
|
||||
@@ -320,8 +320,8 @@ int dtm_read_buffer(d, blocklen, buffer, length)
|
||||
while (TRUE) {
|
||||
|
||||
/* if block length is 0, because last call to fill_buffer hit
|
||||
* the EOS or because this dataset is zero length, return 0
|
||||
* to indicate the end of dataset.
|
||||
* the EOS or because this dataset is zero length, return 0
|
||||
* to indicate the end of dataset.
|
||||
*/
|
||||
if (*blocklen == 0)
|
||||
return 0;
|
||||
@@ -335,7 +335,7 @@ int dtm_read_buffer(d, blocklen, buffer, length)
|
||||
|
||||
/* decrement block length, if 0 get next block length */
|
||||
*blocklen -= (length - count);
|
||||
if (*blocklen == 0)
|
||||
if (*blocklen == 0)
|
||||
*blocklen = DTM_NEW_DATASET;
|
||||
|
||||
/* if block length is 0 now, the EOS will be returned on */
|
||||
@@ -362,7 +362,7 @@ int dtm_read_buffer(d, blocklen, buffer, length)
|
||||
DBGINT("blocklen = %d\n", *blocklen);
|
||||
|
||||
/* if block length is 0 now, the correct count will be */
|
||||
/* returned now, and EOS on the next call to fill_buffer */
|
||||
/* returned now, and EOS on the next call to fill_buffer */
|
||||
if (*blocklen == 0)
|
||||
return count;
|
||||
|
||||
@@ -411,9 +411,9 @@ int dtm_read_header( fd, buf, buflen )
|
||||
|
||||
/*
|
||||
dtm_recv_header()
|
||||
Function to read header and return size.
|
||||
Function to read header and return size.
|
||||
|
||||
Notes : If buffer is too small, dump remainder of header
|
||||
Notes : If buffer is too small, dump remainder of header
|
||||
and return error.
|
||||
Actually, this is function to read length of data and
|
||||
then to receive that much data - the data is called header
|
||||
@@ -437,7 +437,7 @@ int dtm_recv_header( d, header, length )
|
||||
DBGMSG1("dtm_recv_header: buf length = %d.\n", length);
|
||||
|
||||
/* get header length */
|
||||
|
||||
|
||||
if( (readcnt = recvfrom(d, (char *)&headerlen, 4, 0, ( struct sockaddr *)&from,
|
||||
( int *)&fromlen)) != 4) {
|
||||
/* somehow hit EOF, return DTMEOF instead */
|
||||
@@ -460,19 +460,19 @@ int dtm_recv_header( d, header, length )
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOCALINT(headerlen);
|
||||
DBGMSG("dtm_recv_header: got length.\n");
|
||||
|
||||
/* read the header */
|
||||
/* read the header */
|
||||
|
||||
readcnt = (length > headerlen) ? headerlen : length ;
|
||||
header = (void *) (((char *) header) + readcnt);
|
||||
|
||||
while(readcnt) {
|
||||
if( (tmp = recvfrom(d, ((char *)header) - readcnt, readcnt, 0,
|
||||
( struct sockaddr *)&from, ( int *)&fromlen)) > 0)
|
||||
if( (tmp = recvfrom(d, ((char *)header) - readcnt, readcnt, 0,
|
||||
( struct sockaddr *)&from, ( int *)&fromlen)) > 0)
|
||||
readcnt -= tmp;
|
||||
else {
|
||||
DTMerrno = DTMREAD;
|
||||
@@ -480,24 +480,24 @@ int dtm_recv_header( d, header, length )
|
||||
}
|
||||
}
|
||||
|
||||
/* check for header greater than buffer size provided */
|
||||
/* check for header greater than buffer size provided */
|
||||
|
||||
if( length >= headerlen )
|
||||
if( length >= headerlen )
|
||||
return headerlen;
|
||||
else {
|
||||
/* discard remaining header */
|
||||
|
||||
readcnt = headerlen - length;
|
||||
while (readcnt) {
|
||||
if ((tmp = recvfrom(d, dtm_discard, readcnt, 0,
|
||||
(struct sockaddr *)&from, (int *)&fromlen)) > 0)
|
||||
if ((tmp = recvfrom(d, dtm_discard, readcnt, 0,
|
||||
(struct sockaddr *)&from, (int *)&fromlen)) > 0)
|
||||
readcnt -= tmp;
|
||||
else {
|
||||
DTMerrno = DTMREAD;
|
||||
return DTMERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DTMerrno = DTMHEADER;
|
||||
return DTMERROR;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ int dtm_recv_header( d, header, length )
|
||||
|
||||
Notes : Berkeley implementation returns 0 from recv
|
||||
if socket connection breaks while waiting in
|
||||
recv system call. System V returns -1 and
|
||||
recv system call. System V returns -1 and
|
||||
ECONNRESET in errno for same error.
|
||||
|
||||
For historical reasons, DTMEOF is returned when
|
||||
@@ -532,16 +532,16 @@ int dtm_recv_ack( d, ack )
|
||||
|
||||
if( (tmp = recv( d, (char *)ack, 4, 0 )) != 4 ) {
|
||||
DBGINT( "Recv_ack errno = %d\n", errno ) ;
|
||||
if( tmp == 0 )
|
||||
if( tmp == 0 )
|
||||
/* Courtesy Berkeley */
|
||||
|
||||
DTMerrno = DTMEOF ;
|
||||
else {
|
||||
if( errno == ECONNRESET )
|
||||
if( errno == ECONNRESET )
|
||||
/* Courtesy system V */
|
||||
|
||||
DTMerrno = DTMEOF;
|
||||
else
|
||||
else
|
||||
DTMerrno = DTMREAD;
|
||||
}
|
||||
return DTMERROR;
|
||||
@@ -636,7 +636,7 @@ int dtm_writev_failed( fd, msgbuf, tmp )
|
||||
for ( i = 0; i < msgbuf->msg_iovlen; i++ ) {
|
||||
done -= iov[i].iov_len;
|
||||
if ( done > 0 ) continue;
|
||||
if ( dtm_send_some( fd, iov[i].iov_base + done + iov[i].iov_len,
|
||||
if ( dtm_send_some( fd, iov[i].iov_base + done + iov[i].iov_len,
|
||||
(- done )) == DTMERROR )
|
||||
return DTMERROR;
|
||||
done = 0;
|
||||
@@ -664,17 +664,17 @@ int dtm_writev_buffer( fd, iov, iovlen, iovsize, addr, addrlen )
|
||||
int todo;
|
||||
|
||||
DBGINT("# dtm_writev_buffer called, fd %d.\n", fd );
|
||||
|
||||
msgbuf.msg_name = (caddr_t)addr ;
|
||||
|
||||
msgbuf.msg_name = (caddr_t)addr ;
|
||||
msgbuf.msg_namelen = addrlen ;
|
||||
msgbuf.msg_iov = iov ;
|
||||
msgbuf.msg_iovlen = iovlen ;
|
||||
msgbuf.msg_accrights = 0 ;
|
||||
|
||||
if( (tmp = sendmsg( fd, &msgbuf, 0 )) != iovsize )
|
||||
if( (tmp = sendmsg( fd, &msgbuf, 0 )) != iovsize )
|
||||
return dtm_writev_failed( fd, &msgbuf, tmp );
|
||||
|
||||
DBGINT( "dtm_writev_buffer tmp = %d\n", tmp );
|
||||
|
||||
|
||||
return DTM_OK ;
|
||||
}
|
||||
|
12
libdtm/sdl.c
12
libdtm/sdl.c
@@ -22,7 +22,7 @@
|
||||
/************************************************************************
|
||||
**
|
||||
** sdl.c - Surface Description Language
|
||||
**
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
/*
|
||||
@@ -43,20 +43,20 @@
|
||||
*
|
||||
* Revision 1.9 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.8 1992/04/06 15:58:56 jplevyak
|
||||
* Fixed levels of indirection on some arguments for non-prototype
|
||||
* machines.
|
||||
*
|
||||
* Revision 1.7 92/04/03 12:39:33 dweber
|
||||
* Fixed SDLbounds bug.
|
||||
*
|
||||
*
|
||||
* Revision 1.6 92/04/03 12:33:10 dweber
|
||||
* Added bounding box functions.
|
||||
*
|
||||
*
|
||||
* Revision 1.5 91/09/10 15:09:00 jefft
|
||||
* I removed all functionality from this file, HA!
|
||||
*
|
||||
*
|
||||
* Revision 1.4 1991/07/18 16:29:15 jefft
|
||||
* corrected the spelling of "primitive"
|
||||
*
|
||||
@@ -68,7 +68,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:38:33 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
12
libdtm/sdl.h
12
libdtm/sdl.h
@@ -22,7 +22,7 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Surface Description Language include file - contains constants used
|
||||
** with the SDL header type.
|
||||
** with the SDL header type.
|
||||
**
|
||||
**
|
||||
**
|
||||
@@ -46,13 +46,13 @@
|
||||
*
|
||||
* Revision 1.13 92/04/30 20:27:05 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
*
|
||||
* Revision 1.12 1992/04/03 12:39:42 dweber
|
||||
* Fixed SDLbounds bug.
|
||||
*
|
||||
* Revision 1.11 92/04/03 12:33:23 dweber
|
||||
* Added bounding box functions.
|
||||
*
|
||||
*
|
||||
* Revision 1.10 1992/02/25 20:36:35 dweber
|
||||
* Fixed another prototyping clash, SDLgetPrimitive.
|
||||
*
|
||||
@@ -64,10 +64,10 @@
|
||||
*
|
||||
* Revision 1.7 91/11/01 10:10:28 dweber
|
||||
* Added SDLtristrip
|
||||
*
|
||||
*
|
||||
* Revision 1.6 91/09/10 15:07:55 jefft
|
||||
* cleaned-up message class macros.
|
||||
*
|
||||
*
|
||||
* Revision 1.5 1991/07/25 22:22:27 jefft
|
||||
* Added transformation triplet enum types
|
||||
*
|
||||
@@ -83,7 +83,7 @@
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:38:51 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SDL_INC
|
||||
|
16
libdtm/sds.c
16
libdtm/sds.c
@@ -22,7 +22,7 @@
|
||||
/************************************************************************
|
||||
**
|
||||
** sds.c - Scientific Data Set utility routines.
|
||||
**
|
||||
**
|
||||
*************************************************************************/
|
||||
/*
|
||||
#ifdef RCSLOG
|
||||
@@ -47,7 +47,7 @@
|
||||
*
|
||||
* Revision 1.12 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.11 1992/03/16 20:39:10 creiman
|
||||
* Changed declaration of SDSgetMinMax to match prototype. (Changed doubles
|
||||
* to floats)
|
||||
@@ -67,22 +67,22 @@
|
||||
*
|
||||
* Revision 1.7 91/12/18 02:42:41 dweber
|
||||
* Oops. Guess I forgot to change getRanks name.
|
||||
*
|
||||
*
|
||||
* Revision 1.6 1991/12/18 02:41:53 dweber
|
||||
* Added SDSgetRank
|
||||
*
|
||||
* Revision 1.5 91/12/09 12:12:27 dweber
|
||||
* Deleted the function SDSconvert
|
||||
*
|
||||
*
|
||||
* Revision 1.4 91/09/26 20:20:52 jplevyak
|
||||
* Minor header file reorganization.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 91/09/13 18:01:21 jplevyak
|
||||
* Fixed minor bug w/extra argument in call.
|
||||
*
|
||||
*
|
||||
* Revision 1.2 91/06/11 15:20:50 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
*
|
||||
* Revision 1.1 1990/11/08 16:39:09 jefft
|
||||
* Initial revision
|
||||
*
|
||||
@@ -213,7 +213,7 @@ int SDSgetMinMax(h, min, max)
|
||||
|
||||
h = strchr(h, ' ') + 1;
|
||||
*max = (float)atof(h);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@
|
||||
*
|
||||
* Revision 1.8 92/04/30 20:27:37 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
*
|
||||
* Revision 1.7 1992/03/16 21:03:18 creiman
|
||||
* Changed SDSsetMinMax prototype to use floats. NOT related to the change in
|
||||
* sds.c for SDSgetMinMax. This is getting confusing...
|
||||
@@ -55,10 +55,10 @@
|
||||
*
|
||||
* Revision 1.4 92/01/24 19:13:51 dweber
|
||||
* Added header lenght macros
|
||||
*
|
||||
*
|
||||
* Revision 1.3 91/09/10 15:07:10 jefft
|
||||
* cleaned-up message class macros.
|
||||
*
|
||||
*
|
||||
* Revision 1.2 1991/06/11 15:22:52 sreedhar
|
||||
* disclaimer added
|
||||
*
|
||||
@@ -97,7 +97,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
extern void SDSsetDimensions DTM_PROTO(( char* h, int rank, int *dims ));
|
||||
extern int SDSgetDimensions DTM_PROTO(( char* h, int * rank, int* dims,
|
||||
extern int SDSgetDimensions DTM_PROTO(( char* h, int * rank, int* dims,
|
||||
int len ));
|
||||
extern int SDSgetRank DTM_PROTO(( char* h, int * rank ));
|
||||
extern int SDSnumElements DTM_PROTO(( int rank, int *dims ));
|
||||
|
@@ -44,7 +44,7 @@
|
||||
*
|
||||
* Revision 1.5 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -52,14 +52,14 @@
|
||||
*
|
||||
* Revision 1.28 92/04/30 20:25:27 jplevyak
|
||||
* Changed Version to 2.3.
|
||||
*
|
||||
*
|
||||
* Revision 1.27 1992/04/06 15:58:49 jplevyak
|
||||
* Fixed minor problems for machines little Endian machines.
|
||||
*
|
||||
* Revision 1.26 92/03/10 22:07:10 jplevyak
|
||||
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||
* with modification.
|
||||
*
|
||||
*
|
||||
* Revision 1.25 1992/02/28 03:40:24 jplevyak
|
||||
* int/long confict fix (no diff on workstations)
|
||||
* ,
|
||||
@@ -100,13 +100,13 @@
|
||||
*
|
||||
* Revision 1.14 91/09/26 20:21:55 jplevyak
|
||||
* Cosmetics
|
||||
*
|
||||
*
|
||||
* Revision 1.13 91/09/18 15:33:08 jplevyak
|
||||
* Added additional parameter to dtm_socket_init
|
||||
*
|
||||
*
|
||||
* Revision 1.12 91/09/13 20:28:52 sreedhar
|
||||
* accept :9900 change
|
||||
*
|
||||
*
|
||||
* Revision 1.11 1991/09/13 20:13:35 sreedhar
|
||||
* take current host as default
|
||||
*
|
||||
@@ -131,14 +131,14 @@
|
||||
*
|
||||
* Revision 1.3 90/11/21 12:43:15 jefft
|
||||
* Fixed portibility problem with dtm_get_ipaddr.
|
||||
*
|
||||
*
|
||||
* Revision 1.2 90/11/21 10:54:18 jefft
|
||||
* Added new routine, dtm_get_ipaddr. It returns an ascii string of the
|
||||
* current hosts IP address.
|
||||
*
|
||||
*
|
||||
* Revision 1.1 90/11/08 16:39:40 jefft
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -197,7 +197,7 @@ static int buf_size = DTM_BUFF_SIZE;
|
||||
/*
|
||||
dtm_parse_ipaddr()
|
||||
Check whetherer given address string is in dotted
|
||||
decimal notation and if so, to return the address in network byte
|
||||
decimal notation and if so, to return the address in network byte
|
||||
order.
|
||||
|
||||
Return values : TRUE, if in dotted decimal notation.
|
||||
@@ -282,9 +282,9 @@ int dtm_select( s, count, time )
|
||||
FD_SET( s, &filedes );
|
||||
|
||||
#ifdef __hpux
|
||||
if( (*count = select( 32, (int *)&filedes, (int *)NULL, (int *)NULL,
|
||||
if( (*count = select( 32, (int *)&filedes, (int *)NULL, (int *)NULL,
|
||||
#else
|
||||
if( (*count = select( 32, &filedes, (fd_set *)NULL, (fd_set *)NULL,
|
||||
if( (*count = select( 32, &filedes, (fd_set *)NULL, (fd_set *)NULL,
|
||||
#endif
|
||||
&timeout ) )) {
|
||||
ioctl( s, FIONREAD, count );
|
||||
@@ -312,8 +312,8 @@ int dtm_accept( s, sn, timeout )
|
||||
DBGFLOW( "dtm_accept called.\n");
|
||||
DBGMSG1( "dtm_accept: sockfd = %d\n", s );
|
||||
|
||||
/*
|
||||
Await connect for specified time period only.
|
||||
/*
|
||||
Await connect for specified time period only.
|
||||
|
||||
if timeout == NULL, it means just goahead and accept,
|
||||
else wait for specified period and accept only if
|
||||
@@ -321,12 +321,12 @@ int dtm_accept( s, sn, timeout )
|
||||
*/
|
||||
|
||||
if ( timeout ) {
|
||||
fd_set readmask ;
|
||||
fd_set readmask ;
|
||||
fd_set *fchk = &readmask ;
|
||||
int nf ;
|
||||
|
||||
FD_ZERO( fchk );
|
||||
FD_SET( s, fchk );
|
||||
FD_SET( s, fchk );
|
||||
|
||||
#ifdef __hpux
|
||||
nf = select( FD_SETSIZE, (int *)fchk, (int *)0, (int *)0, timeout );
|
||||
@@ -337,7 +337,7 @@ int dtm_accept( s, sn, timeout )
|
||||
DBGINT( "dtm_accept: select errno %d\n", errno );
|
||||
DTMerrno = DTMSELECT ;
|
||||
return DTMERROR ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( nf == 0 ) {
|
||||
/* No connect request in specified time */
|
||||
@@ -376,9 +376,9 @@ int dtm_connect(sn, s)
|
||||
int refusedcount = 0;
|
||||
|
||||
DBGFLOW("dtm_connect called.\n");
|
||||
DBGINT( "dtm_connect: s_addr = %x\n",
|
||||
DBGINT( "dtm_connect: s_addr = %x\n",
|
||||
ntohl( sn -> sin_addr.s_addr ) );
|
||||
DBGINT( "dtm_connect: sin_port = %d\n",
|
||||
DBGINT( "dtm_connect: sin_port = %d\n",
|
||||
ntohs( sn -> sin_port ));
|
||||
|
||||
while (TRUE) {
|
||||
@@ -411,7 +411,7 @@ int dtm_connect(sn, s)
|
||||
/* connect complete, set working socket to original socket */
|
||||
*s = d;
|
||||
setsockopt(*s, IPPROTO_TCP, TCP_NODELAY, (char *)&d, sizeof d);
|
||||
setsockopt(*s, SOL_SOCKET, SO_SNDBUF, (char *)&buf_size,
|
||||
setsockopt(*s, SOL_SOCKET, SO_SNDBUF, (char *)&buf_size,
|
||||
sizeof(int));
|
||||
return DTM_OK;
|
||||
}
|
||||
@@ -492,11 +492,11 @@ int dtm_end_connect(s)
|
||||
|
||||
|
||||
/*
|
||||
Return values :
|
||||
Return values :
|
||||
On success,
|
||||
Direct - host address in network byte order.
|
||||
Indirect - *ipaddr has host address in dotted
|
||||
decimal notation.
|
||||
Indirect - *ipaddr has host address in dotted
|
||||
decimal notation.
|
||||
|
||||
On error, 0.
|
||||
Notes:
|
||||
@@ -553,7 +553,7 @@ unsigned long dtm_get_ipaddr( ipaddrstr )
|
||||
}
|
||||
|
||||
DBGINT( "dtm_get_ipaddr: dotted decimal address = '%s'\n", ipaddrstr );
|
||||
return inet_addr( ipaddrstr ) ;
|
||||
return inet_addr( ipaddrstr ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -576,17 +576,17 @@ int dtm_socket_init( sockaddr, porttype, fLogicalName )
|
||||
int sockaddrsize = sizeof (struct sockaddr_in);
|
||||
char buf[128];
|
||||
|
||||
DBGMSG1( "dtm_socket_init: sockaddr -> s_addr = %x\n",
|
||||
DBGMSG1( "dtm_socket_init: sockaddr -> s_addr = %x\n",
|
||||
ntohl( sockaddr -> sin_addr.s_addr) );
|
||||
DBGMSG1( "dtm_socket_init: sockaddr -> sin_port = %d\n",
|
||||
DBGMSG1( "dtm_socket_init: sockaddr -> sin_port = %d\n",
|
||||
ntohs( sockaddr -> sin_port) );
|
||||
|
||||
sockaddr -> sin_family = AF_INET ;
|
||||
sockaddr -> sin_family = AF_INET ;
|
||||
if ( fLogicalName ) {
|
||||
/*
|
||||
Logical name had been supplied for makeport.
|
||||
/*
|
||||
Logical name had been supplied for makeport.
|
||||
Assign port from system ( sin_port = 0 ), and accept
|
||||
from all network interfaces for multi-homed host
|
||||
from all network interfaces for multi-homed host
|
||||
( INADDR_ANY ).
|
||||
*/
|
||||
sockaddr -> sin_addr.s_addr = htonl( INADDR_ANY );
|
||||
@@ -606,7 +606,7 @@ int dtm_socket_init( sockaddr, porttype, fLogicalName )
|
||||
}
|
||||
|
||||
if( (sockfd = socket( sockaddr -> sin_family, type, protocol )) < 0 ) {
|
||||
DTMerrno = DTMSOCK ;
|
||||
DTMerrno = DTMSOCK ;
|
||||
DBGINT( "dtm_socket_init: socket create error %d", errno );
|
||||
return DTMERROR ;
|
||||
}
|
||||
@@ -623,27 +623,27 @@ int dtm_socket_init( sockaddr, porttype, fLogicalName )
|
||||
|
||||
DBGFLOW( "dtm_socket_init: Before bind\n" );
|
||||
DBGINT( "dtm_socket_init: sockfd = %d\n", sockfd );
|
||||
DBGINT( "dtm_socket_init: sockaddr -> family = %d\n",
|
||||
DBGINT( "dtm_socket_init: sockaddr -> family = %d\n",
|
||||
sockaddr -> sin_family );
|
||||
DBGINT( "dtm_socket_init: sockaddr -> s_addr = %x\n",
|
||||
DBGINT( "dtm_socket_init: sockaddr -> s_addr = %x\n",
|
||||
ntohl( sockaddr -> sin_addr.s_addr) );
|
||||
DBGINT( "dtm_socket_init: sockaddr -> sin_port = %d\n",
|
||||
DBGINT( "dtm_socket_init: sockaddr -> sin_port = %d\n",
|
||||
ntohs( sockaddr -> sin_port) );
|
||||
|
||||
if( bind( sockfd, (struct sockaddr *)sockaddr,
|
||||
if( bind( sockfd, (struct sockaddr *)sockaddr,
|
||||
sizeof( struct sockaddr_in ) ) < 0 ) {
|
||||
DTMerrno = DTMSOCK ;
|
||||
DBGMSG1( "dtm_socket_init: could not bind to sockaddr, errno = %d\n",
|
||||
DBGMSG1( "dtm_socket_init: could not bind to sockaddr, errno = %d\n",
|
||||
errno );
|
||||
return DTMERROR;
|
||||
}
|
||||
|
||||
/* Listen at socket for TCP port, buffer for 5 pending connections */
|
||||
|
||||
if( porttype == INPORTTYPE )
|
||||
if( porttype == INPORTTYPE )
|
||||
listen( sockfd, 5 );
|
||||
|
||||
/*
|
||||
/*
|
||||
Get the actual assigned (port) address ( netid/hostid/portid )
|
||||
- netid/hostid from dtm_get_ipaddr(),portid from getsockname().
|
||||
|
||||
@@ -667,9 +667,9 @@ int dtm_socket_init( sockaddr, porttype, fLogicalName )
|
||||
}
|
||||
|
||||
DBGFLOW( "dtm_socket_init: Verify nethostid/portid\n" );
|
||||
DBGINT( "dtm_socket_init: Nethostid = %x\n",
|
||||
ntohl( sockaddr -> sin_addr.s_addr ) );
|
||||
DBGINT( "dtm_socket_init: Portid = %d \n",
|
||||
DBGINT( "dtm_socket_init: Nethostid = %x\n",
|
||||
ntohl( sockaddr -> sin_addr.s_addr ) );
|
||||
DBGINT( "dtm_socket_init: Portid = %d \n",
|
||||
ntohs( sockaddr -> sin_port ) );
|
||||
|
||||
DBGINT( "dtm_socket_init: exit sockfd = %d\n", sockfd );
|
||||
@@ -719,7 +719,7 @@ int dtm_init_sockaddr( sockaddr, portname, pfLogicalName )
|
||||
DBGFLOW( "dtm_init_sockaddr called\n" );
|
||||
|
||||
if( lportname[0] == ':' ) {
|
||||
host = NULL ;
|
||||
host = NULL ;
|
||||
port = lportname + 1;
|
||||
} else {
|
||||
if( (port = strchr( lportname, ':' )) == NULL ) {
|
||||
@@ -728,7 +728,7 @@ int dtm_init_sockaddr( sockaddr, portname, pfLogicalName )
|
||||
sockaddr -> sin_port = htons( 0 );
|
||||
sockaddr -> sin_addr.s_addr = htonl(0);
|
||||
*pfLogicalName = TRUE;
|
||||
DBGINT( "dtm_init_sockaddr: sin_port = %d\n",
|
||||
DBGINT( "dtm_init_sockaddr: sin_port = %d\n",
|
||||
ntohs( sockaddr->sin_port ));
|
||||
return DTM_OK;
|
||||
}
|
||||
@@ -737,15 +737,15 @@ int dtm_init_sockaddr( sockaddr, portname, pfLogicalName )
|
||||
}
|
||||
*pfLogicalName = FALSE;
|
||||
|
||||
/*
|
||||
Physical format - hostname is either in dotted decimal
|
||||
/*
|
||||
Physical format - hostname is either in dotted decimal
|
||||
notation ( call ipaddr() ) or direct or missing.
|
||||
*/
|
||||
|
||||
if( host == NULL ) {
|
||||
gethostname( hostname, sizeof hostname );
|
||||
host = hostname ;
|
||||
}
|
||||
}
|
||||
DBGINT( "dtm_init_sockaddr: host %s\n", host );
|
||||
DBGINT( "dtm_init_sockaddr: port %s\n", port );
|
||||
|
||||
@@ -768,7 +768,7 @@ int dtm_init_sockaddr( sockaddr, portname, pfLogicalName )
|
||||
/* Fill in port id */
|
||||
sockaddr -> sin_port = htons((unsigned short)atol( port ));
|
||||
|
||||
DBGINT( "dtm_init_sockaddr: nethostid = %x\n",
|
||||
DBGINT( "dtm_init_sockaddr: nethostid = %x\n",
|
||||
ntohl( sockaddr -> sin_addr.s_addr ));
|
||||
DBGINT( "dtm_init_sockaddr: portid = %d\n", ntohs( sockaddr -> sin_port) );
|
||||
|
||||
|
@@ -17,11 +17,11 @@
|
||||
#define SRV_FUNC_LOCK_REQUEST 7
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
*
|
||||
* for a connect message:
|
||||
* SRVclass SRVid SRV_FUNC_CONNECT SRVInPort SRVVString SRVnumber
|
||||
* for a disconnect message:
|
||||
* SRVclass SRVid SRV_FUNC_DISCONNECT SRVInPort
|
||||
* SRVclass SRVid SRV_FUNC_DISCONNECT SRVInPort
|
||||
* for a lock:
|
||||
* SRVclass SRVid SRV_FUNC_LOCK SRVLock
|
||||
* for a lock:
|
||||
@@ -31,7 +31,7 @@
|
||||
* for a user leaving:
|
||||
* SRVclass SRVid SRV_FUNC_REMOVE_USER SRVInPort
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* SRVsetClass(char *header,char *title) */
|
||||
/* SRVcompareClass(char *header,char *title, int maxTitleLength) */
|
||||
|
@@ -47,7 +47,7 @@
|
||||
/* TXTsetReplaceAll(char *header) */
|
||||
/* Boolean TXTshouldReplaceAll(char *header,int garbage) */
|
||||
#define TXTsetReplaceAll(h) dtm_set_int(h,TXTra,1)
|
||||
#define TXTshouldReplaceAll(h,i) (dtm_get_int(h,TXTra,&(i)) == -1)?0:1
|
||||
#define TXTshouldReplaceAll(h,i) (dtm_get_int(h,TXTra,&(i)) == -1)?0:1
|
||||
|
||||
/* TXTsetDimension(char *header,int numBytes) */
|
||||
/* TXTgetDimension(char *header,int &numBytes) */
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
/*********************************************************************
|
||||
**
|
||||
* $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/uio.h,v 1.3 1995/01/12 02:33:40 spowers Exp $
|
||||
* $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/uio.h,v 1.3 1995/01/12 02:33:40 spowers Exp $
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
*
|
||||
* Revision 1.2 92/04/30 20:27:37 jplevyak
|
||||
* Changed Version to 2.3
|
||||
*
|
||||
*
|
||||
* Revision 1.1 1992/03/06 22:51:22 jplevyak
|
||||
* Initial revision
|
||||
*
|
||||
|
@@ -298,7 +298,7 @@ int size;
|
||||
}
|
||||
else if (c1 & 0x60) { /* denormalized value */
|
||||
register int shft;
|
||||
|
||||
|
||||
shft = (c1 & 0x40) ? 1 : 2; /* shift needed to normalize */
|
||||
/* shift mantissa */
|
||||
/* note last bit of exp set to 1 implicitly */
|
||||
@@ -533,7 +533,7 @@ int size;
|
||||
}
|
||||
else if (c1 & 0x0c) { /* denormalized value */
|
||||
register int shft;
|
||||
|
||||
|
||||
shft = (c1 & 0x08) ? 1 : 2; /* shift needed to normalize */
|
||||
/* shift mantissa */
|
||||
/* note last bit of exp set to 1 implicitly */
|
||||
|
12
libdtm/x.c
12
libdtm/x.c
@@ -43,7 +43,7 @@
|
||||
*
|
||||
* Revision 1.4 92/05/05 22:27:50 jplevyak
|
||||
* Corrected X interface code.
|
||||
*
|
||||
*
|
||||
* Revision 1.3 1992/05/04 22:05:55 jplevyak
|
||||
* Declare DTMaddInput external
|
||||
*
|
||||
@@ -121,12 +121,12 @@ void dtm_handle_new_out( client_data, fd, id )
|
||||
automatically handled.
|
||||
*/
|
||||
#ifdef DTM_PROTOTYPES
|
||||
int DTMaddInput( int p_ext, caddr_t condition,
|
||||
int DTMaddInput( int p_ext, caddr_t condition,
|
||||
XtInputCallbackProc proc, caddr_t client_data )
|
||||
#else
|
||||
int DTMaddInput( p_ext, condition, proc, client_data )
|
||||
int p_ext;
|
||||
caddr_t condition;
|
||||
caddr_t condition;
|
||||
XtInputCallbackProc proc;
|
||||
caddr_t client_data;
|
||||
#endif
|
||||
@@ -148,14 +148,14 @@ int DTMaddInput( p_ext, condition, proc, client_data )
|
||||
/*
|
||||
Set up callback for new connections
|
||||
*/
|
||||
XtAddInput( pp->sockfd, XtInputReadMask, dtm_handle_new_in,
|
||||
XtAddInput( pp->sockfd, XtInputReadMask, dtm_handle_new_in,
|
||||
(caddr_t) p );
|
||||
FOR_EACH_IN_PORT( inp, pp ) {
|
||||
inp->XinputId = XtAddInput( inp->fd, XtInputReadMask,
|
||||
inp->XinputId = XtAddInput( inp->fd, XtInputReadMask,
|
||||
dtm_handle_in, (caddr_t) p );
|
||||
}
|
||||
} else {
|
||||
XtAddInput( pp->sockfd, XtInputReadMask, dtm_handle_new_out,
|
||||
XtAddInput( pp->sockfd, XtInputReadMask, dtm_handle_new_out,
|
||||
(caddr_t) p );
|
||||
}
|
||||
return DTM_OK;
|
||||
|
Reference in New Issue
Block a user