1 /*
2  * (c) Copyright 1992 by Panagiotis Tsirigotis
3  * (c) Sections Copyright 1998-2001 by Rob Braun
4  * All rights reserved.  The file named COPYRIGHT specifies the terms
5  * and conditions for redistribution.
6  */
7 
8 #ifndef ACCESS_H
9 #define ACCESS_H
10 
11 /*
12  * $Id: access.h,v 1.2 2004-01-02 21:07:42 steveg Exp $
13  */
14 
15 
16 #include "util.h"	/* for nv_get_name() */
17 #include "defs.h"	/* bool_int */
18 #include "connection.h"
19 
20 
21 /*
22  * These flags are used to form a mask for access_control.
23  * The mask determines which checks will be performed.
24  */
25 #define CF_ADDRESS            1
26 #define CF_TIME               2
27 #define CF_SERVICE_LIMIT      3
28 
29 typedef enum
30    {
31       AC_OK,               /* ok to start a server                         */
32       AC_FORK,             /* tried to start a server but fork failed      */
33       AC_ADDRESS,          /* we do not accept requests from that address  */
34       AC_TIME,             /* we do not accept requests at this time       */
35       AC_SERVICE_LIMIT,    /* server limit would be exceeded for this      */
36                            /* service                                      */
37       AC_PER_SOURCE_LIMIT, /* server limit would be exceeded for this      */
38                            /* service and source address                   */
39       AC_PROCESS_LIMIT,    /* total process limit would be exceeded        */
40       AC_LIBWRAP,
41       AC_LOAD,
42       AC_CPS
43    } access_e ;
44 
45 
46 #define ACCESS_EXPLAIN( code )   nv_get_name( access_code_names, (int) (code) )
47 
48 
49 extern const struct name_value access_code_names[];
50 void cps_service_stop(struct service *sp, const char *reason);
51 access_e access_control(struct service *sp,
52 	const connection_s *cp,const mask_t *check_mask);
53 access_e parent_access_control(struct service *sp,const connection_s *cp);
54 
55 
56 #endif   /* ACCESS_H */
57 
58