/* * Definitions for TCP and UDP client/server programs. */ #include <sys/types.h> #include <sys/stat.h> #include <sys/errno.h> #include <stdio.h> #include <pwd.h> #include <fcntl.h> #include <signal.h> #include <netdb.h> #include <sys/socket.h> #include <netinet/in.h> #ifdef linux #include <sys/time.h> #endif /* linux */ #ifdef NEED_INET_H #include <sys/inet.h> #endif /* Was needed for a 3b2 running System V.3.2 */ #ifdef NEED_SELECT_H #include <sys/select.h> #endif /* Was needed for an AIX system */ /* The structure passwed back and forth between negotiate() and the calling function; contains the received buffer, and it's length */ struct Buf_Len { char buffer[BUFSIZ]; int len; }; extern int netdebug; /* flag: do network debugging? */ /* library function declarations */ extern unsigned long inet_addr(); extern char *inet_ntoa(); /* Local function declarations */ extern void d_zero(), d_copy(); extern void init_telnet(); struct Buf_Len *negotiate(); /* Definitions: */ #ifndef DEV_TCP #define DEV_UDP "/dev/udp" /* WIN/TCP names */ #define DEV_TCP "/dev/tcp" /* WIN/TCP names */ #endif #define MAXLINE 255 extern char *pname; /* System configuration definitions */ #ifdef HAVE_ARPA_TELNET #define TELNET /* Define this if you have /usr/include/arpa/telnet.h */ #else static char *telopts[] = { "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS", "TIMING MARK", "RCTE" }; #endif #ifndef SIGCLD /* For BSD systems */ #define SIGCLD SIGCHLD #endif