service.h (xinetd-2.3.15) | : | service.h (xinetd-2.3.15.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
#include "config.h" | #include "config.h" | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <netinet/in.h> | #include <netinet/in.h> | |||
#include <time.h> | #include <time.h> | |||
#include "defs.h" | #include "defs.h" | |||
#include "pset.h" | #include "pset.h" | |||
#include "xlog.h" | #include "xlog.h" | |||
#include "server.h" | #include "server.h" | |||
#ifdef HAVE_POLL | ||||
#include "xpoll.h" | ||||
#endif | ||||
/* | /* | |||
* $Id: service.h,v 1.6 2012-05-09 15:40:29 bbraun Exp $ | * $Id$ | |||
*/ | */ | |||
/* | /* | |||
* NOTE: A service can be disabled but not deleted if it has any servers | * NOTE: A service can be disabled but not deleted if it has any servers | |||
* running | * running | |||
*/ | */ | |||
typedef enum /* service states */ | typedef enum /* service states */ | |||
{ | { | |||
SVC_NOT_STARTED = 0, /* no attempt to start it yet */ | SVC_NOT_STARTED = 0, /* no attempt to start it yet */ | |||
SVC_ACTIVE, /* service is available */ | SVC_ACTIVE, /* service is available */ | |||
skipping to change at line 44 | skipping to change at line 47 | |||
SVC_DISABLED /* service disabled */ | SVC_DISABLED /* service disabled */ | |||
} state_e ; | } state_e ; | |||
/* | /* | |||
* NOTE: Clearing the structure will give all its fields their default values | * NOTE: Clearing the structure will give all its fields their default values | |||
*/ | */ | |||
struct service | struct service | |||
{ | { | |||
state_e svc_state ; | state_e svc_state ; | |||
int svc_ref_count ; /* # of pters to this struct */ | int svc_ref_count ; /* # of pters to this struct */ | |||
int svc_pfd_index; /* index of pfd in pfd_array */ | ||||
struct service_config *svc_conf ; /* service configuration */ | struct service_config *svc_conf ; /* service configuration */ | |||
#ifdef HAVE_POLL | ||||
struct pollfd *svc_pfd ; /* pointer to the pollfd */ | ||||
#else | ||||
int svc_fd ; /* The Listening FD for the service */ | int svc_fd ; /* The Listening FD for the service */ | |||
#endif /* HAVE_POLL */ | ||||
unsigned svc_running_servers ; | unsigned svc_running_servers ; | |||
unsigned svc_retry_servers ; | unsigned svc_retry_servers ; | |||
unsigned svc_attempts ; /* # of attempts to start server */ | unsigned svc_attempts ; /* # of attempts to start server */ | |||
int svc_not_generic ; /* 1 spec_service, 0 generic */ | int svc_not_generic ; /* 1 spec_service, 0 generic */ | |||
/* | /* | |||
* These fields are used to avoid generating too many messages when | * These fields are used to avoid generating too many messages when | |||
* receiving datagrams from a bad address. | * receiving datagrams from a bad address. | |||
*/ | */ | |||
union xsockaddr *svc_last_dgram_addr ; | union xsockaddr *svc_last_dgram_addr ; | |||
skipping to change at line 68 | skipping to change at line 78 | |||
} ; | } ; | |||
#define SP( p ) ( (struct service *) (p) ) | #define SP( p ) ( (struct service *) (p) ) | |||
#define SUSPEND( sp ) (sp)->svc_state = SVC_SUSPENDED | #define SUSPEND( sp ) (sp)->svc_state = SVC_SUSPENDED | |||
#define RESUME( sp ) (sp)->svc_state = SVC_ACTIVE | #define RESUME( sp ) (sp)->svc_state = SVC_ACTIVE | |||
/* | /* | |||
* Field access macros | * Field access macros | |||
*/ | */ | |||
#define SVC_CONF( sp ) ( (sp)->svc_conf ) | #define SVC_CONF( sp ) ( (sp)->svc_conf ) | |||
#ifdef HAVE_POLL | ||||
#define SVC_POLLFD( sp ) ( (sp)->svc_pfd ) | ||||
#define SVC_POLLFD_OFF( sp ) ( SVC_POLLFD( sp )-ps.rws.pfd_array ) | ||||
#define SVC_EVENTS( sp ) ( POLLFD_EVENTS( SVC_POLLFD( sp ) ) ) | ||||
#define SVC_REVENTS( sp ) ( POLLFD_REVENTS( SVC_POLLFD( sp ) ) ) | ||||
#define SVC_FD( sp ) ( POLLFD_FD( SVC_POLLFD( sp ) ) ) | ||||
#else | ||||
#define SVC_FD( sp ) ( (sp)->svc_fd ) | #define SVC_FD( sp ) ( (sp)->svc_fd ) | |||
#endif /* HAVE_POLL */ | ||||
#define SVC_RUNNING_SERVERS( sp ) (sp)->svc_running_servers | #define SVC_RUNNING_SERVERS( sp ) (sp)->svc_running_servers | |||
#define SVC_RETRIES( sp ) (sp)->svc_retry_servers | #define SVC_RETRIES( sp ) (sp)->svc_retry_servers | |||
#define SVC_LOG( sp ) (sp)->svc_log | #define SVC_LOG( sp ) (sp)->svc_log | |||
#define SVC_REFCOUNT( sp ) (sp)->svc_ref_count | #define SVC_REFCOUNT( sp ) (sp)->svc_ref_count | |||
#define SVC_ID( sp ) SC_ID( SVC_CONF( sp ) ) | #define SVC_ID( sp ) SC_ID( SVC_CONF( sp ) ) | |||
#define SVC_SOCKET_TYPE( sp ) SC_SOCKET_TYPE( SVC_CONF( sp ) ) | #define SVC_SOCKET_TYPE( sp ) SC_SOCKET_TYPE( SVC_CONF( sp ) ) | |||
#define SVC_STATE( sp ) (sp)->svc_state | #define SVC_STATE( sp ) (sp)->svc_state | |||
#define SVC_ATTEMPTS( sp ) (sp)->svc_attempts | #define SVC_ATTEMPTS( sp ) (sp)->svc_attempts | |||
#define SVC_LAST_DGRAM_ADDR( sp ) (sp)->svc_last_dgram_addr | #define SVC_LAST_DGRAM_ADDR( sp ) (sp)->svc_last_dgram_addr | |||
#define SVC_LAST_DGRAM_TIME( sp ) (sp)->svc_last_dgram_time | #define SVC_LAST_DGRAM_TIME( sp ) (sp)->svc_last_dgram_time | |||
End of changes. 7 change blocks. | ||||
1 lines changed or deleted | 21 lines changed or added |