home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / xinetd / xinetd.2.0.6 / server.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-22  |  1.9 KB  |  74 lines

  1. /*
  2.  * (c) Copyright 1992 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7. #ifndef SERVER_H
  8. #define SERVER_H
  9.  
  10. /*
  11.  * $Id: server.h,v 5.1 1992/10/31 23:59:07 panos Exp $
  12.  */
  13.  
  14. #include <sys/types.h>
  15. #include <sys/wait.h>
  16. #include <netinet/in.h>            /* for sockaddr_in */
  17.  
  18. #include "defs.h"
  19. #include "service.h"
  20. #include "connection.h"
  21.  
  22. /*
  23.  * This struct describes running servers
  24.  */
  25. struct server
  26. {
  27.     pid_t pid ;
  28.     time_t start_time ;
  29.     connection_s *cp ;
  30.     struct service *sp ;                /* service that owns this server             */
  31.     int fork_failures ;                /* number of fork(2) failures                    */
  32.     int exit_status ;
  33.     bool_int log_remote_user ;
  34.     bool_int writes_to_log ;        /* needed because a service may be            */
  35.                                             /* reconfigured between server forking        */
  36.                                             /* and exit                                            */
  37. } ;
  38.  
  39. #define SERP( p )                ((struct server *)(p))
  40.  
  41. #define SERVER_SERVICE( serp )    (serp)->sp
  42. #define SERVER_CONNECTION(serp)    (serp)->cp
  43. #define SERVER_FD( serp )            conn_descriptor( (serp)->cp )
  44.  
  45. status_e server_init() ;
  46. struct server *server_alloc() ;
  47. void server_release() ;
  48. status_e server_run() ;
  49. status_e server_start() ;
  50. void server_cleanup() ;
  51. void server_dump() ;
  52. void server_postmortem() ;
  53.  
  54.  
  55. /*
  56.  * Macros for compatibility
  57.  */
  58. #ifndef OLD_WAIT
  59. #define PROC_EXITED( s )         WIFEXITED( s )
  60. #define PROC_SIGNALED( s )       WIFSIGNALED( s )
  61. #define PROC_STOPPED( s )        WIFSTOPPED( s )
  62. #define PROC_EXITSTATUS( s )     WEXITSTATUS( s )
  63. #define PROC_TERMSIG( s )        WTERMSIG( s )
  64. #else
  65. #define PROC_EXITED( s )         WIFEXITED( *(union wait *)&(s) )
  66. #define PROC_SIGNALED( s )       WIFSIGNALED( *(union wait *)&(s) )
  67. #define PROC_STOPPED( s )        WIFSTOPPED( *(union wait *)&(s) )
  68. #define PROC_EXITSTATUS( s )     (((union wait *)&(s))->w_T.w_Retcode)
  69. #define PROC_TERMSIG( s )        (((union wait *)&(s))->w_T.w_Termsig)
  70. #endif   /* OLD_WAIT */
  71.  
  72. #endif    /* SERVER_H */
  73.  
  74.