home *** CD-ROM | disk | FTP | other *** search
/ Informática Multimedia: Special Games (Alt) / INFESPGAMES.iso / os2 / backgam / source / socket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-02  |  2.7 KB  |  63 lines

  1. /*************************************************************
  2.  *    ______                                                 *
  3.  *   /     /\  TinyFugue was derived from a client initially *
  4.  *  /   __/  \ written by Anton Rang (Tarrant) and later     *
  5.  *  |  / /\  | modified by Leo Plotkin (Grod).  The early    *
  6.  *  |  |/    | versions of TinyFugue written by Greg Hudson  *
  7.  *  |  X__/  | (Explorer_Bob).  The current version is       *
  8.  *  \ /      / written and maintained by Ken Keys (Hawkeye), *
  9.  *   \______/  who can be reached at kkeys@ucsd.edu.         *
  10.  *                                                           *
  11.  *             No copyright 1992, no rights reserved.        *
  12.  *             Fugue is in the public domain.                *
  13.  *************************************************************/
  14.  
  15. /* For BSD 4.2 systems. */
  16. #ifndef FD_ZERO
  17. #define fd_set int
  18. #define FD_SET(n, p) (*p |= (1<<(n)))
  19. #define FD_CLR(n, p) (*p &= ~(1<<(n)))
  20. #define FD_ISSET(n, p) (*p & (1<<(n)))
  21. #define FD_ZERO(p) (*p = 0)
  22. #endif
  23. /* End of BSD 4.2 systems. */
  24.  
  25. #define SOCKDEAD     001       /* connection dead */
  26. #define SOCKPENDING  002       /* connection not yet established */
  27. #define SOCKLOGIN    004       /* autologin */
  28. #define SOCKACTIVE   010       /* text has arrived but not been displayed */
  29.  
  30. typedef struct Sock {          /* an open connection to a world */
  31.     int fd;                    /* socket to connector OR to remote */
  32.     FILE *fp;                  /* pipe to connector */
  33.     short flags;
  34.     short quiet;               /* # of lines to suppress after connecting */
  35.     struct World *world;       /* world to which socket is connected */
  36.     struct Sock *next, *prev;
  37.     Stringp current_output;
  38. } Sock;
  39.  
  40.  
  41. extern void FDECL(main_loop,(struct World *initial_world, int autologin));
  42. extern int  FDECL(is_active,(int fd));
  43. extern void FDECL(readers_clear,(int fd));
  44. extern void FDECL(readers_set,(int fd));
  45. extern void NDECL(background_on);
  46. extern void FDECL(mapsock,(void FDECL((*func),(struct World *world))));
  47. extern struct World *NDECL(fworld);
  48. extern struct World *NDECL(xworld);
  49. extern void FDECL(background_hook,(char *line));
  50. extern int  FDECL(connect_to,(struct World *w, int autologin));
  51. extern void FDECL(disconnect,(char *args));
  52. extern void FDECL(movesock,(int dir));
  53. extern void NDECL(disconnect_all);
  54. extern void NDECL(listsockets);
  55. extern void FDECL(world_output,(struct World *w, char *str, int attrs));
  56. extern void FDECL(do_send,(char *args));
  57. extern void FDECL(check_command,(int keyboard, Stringp str));
  58. extern void FDECL(transmit,(char *s, int l));
  59. extern void NDECL(clear_refresh_pending);
  60. extern void NDECL(set_refresh_pending);
  61. extern int  NDECL(is_refresh_pending);
  62. extern void NDECL(set_done);
  63.