home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / tcpiptk / hps / cliserv.h next >
C/C++ Source or Header  |  1999-05-11  |  1KB  |  53 lines

  1. /* Common includes and defines for UDP, TCP, and T/TCP
  2.  * clients and servers */
  3.  
  4. #include <os2.h>
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include <string.h>
  8. #include <types.h>
  9. #include <sys/sysctl.h>
  10. #include <sys/socket.h>
  11. #include <sys/ioctl.h>
  12.  
  13. #include <net/route.h>
  14. #include <net/if.h>
  15. //#include <net/if_dl.h>
  16. //#include <net/if_types.h>
  17. #include <netinet/in.h>
  18. #include <arpa/inet.h>
  19. #include <unistd.h>
  20. #include <sys/uio.h>
  21. #include <netdb.h>
  22.  
  23. #define REQUEST 400                             /* max size of request, in bytes */
  24. #define REPLY   400                             /* max size of reply, in bytes */
  25.  
  26. #define UDP_SERV_PORT   7777    /* UDP server's well-known port */
  27. #define TCP_SERV_PORT   8888    /* TCP server's well-known port */
  28. #define TTCP_SERV_PORT  9999    /* T/TCP server's well-known port */
  29.  
  30. /* Added ... */
  31. #define NUMHPSBLOCKS 15
  32. #define HPSBLOCKSIZE 4096
  33. #define ITERATIONS   1024
  34. #define SERV_CHAR    'a'
  35. #define CLI_CHAR     'A'
  36. #define BUFCNT        4
  37.  
  38. /* Following shortens all the type casts of pointer arguments */
  39. #define SA      struct sockaddr *
  40.  
  41. void    err_quit(const char *, ...);
  42. void    err_sys(const char *, ...);
  43. int     read_stream(int, char *, int);
  44.  
  45. /* following for timing versions of client-server */
  46. void    start_timer(void);
  47. double  print_timer(void);
  48. void    sleep_us(unsigned int);
  49.  
  50. #define min(a,b)        ((a) < (b) ? (a) : (b))
  51.  
  52. #define close(x) soclose(x)
  53.