chiark / gitweb /
fb6f816df8d16546bcf0c4dee8ae80877639b570
[become] / src / rule.h
1 /* -*-c-*-
2  *
3  * $Id: rule.h,v 1.5 1998/01/12 16:46:26 mdw Exp $
4  *
5  * Managing rule sets
6  *
7  * (c) 1998 EBI
8  */
9
10 /*----- Licensing notice --------------------------------------------------*
11  *
12  * This file is part of `become'
13  *
14  * `Become' is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * `Become' is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with `become'; if not, write to the Free Software Foundation,
26  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27  */
28
29 /*----- Revision history --------------------------------------------------*
30  *
31  * $Log: rule.h,v $
32  * Revision 1.5  1998/01/12 16:46:26  mdw
33  * Fix copyright date.
34  *
35  * Revision 1.4  1997/09/17  10:27:17  mdw
36  * Use rewritten class handler.
37  *
38  * Revision 1.3  1997/08/20  16:22:49  mdw
39  * Rename `rule_reinit' to `rule_end' for more sensible restart.
40  *
41  * Revision 1.2  1997/08/04 10:24:25  mdw
42  * Sources placed under CVS control.
43  *
44  * Revision 1.1  1997/07/21  13:47:45  mdw
45  * Initial revision
46  *
47  */
48
49 #ifndef RULE_H
50 #define RULE_H
51
52 #ifdef __cplusplus
53   extern "C" {
54 #endif
55
56 /*----- Required headers --------------------------------------------------*/
57
58 #include <sys/types.h>
59 #include <sys/socket.h>
60 #include <netinet/in.h>
61 #include <arpa/inet.h>
62
63 #ifndef BECOME_H
64 #  include "become.h"
65 #endif
66
67 #ifndef CLASS_H
68 #  include "class.h"
69 #endif
70
71 /*----- Functions provided ------------------------------------------------*/
72
73 /* --- @rule_init@ --- *
74  *
75  * Arguments:   ---
76  *
77  * Returns:     ---
78  *
79  * Use:         Intialises the rule database.
80  */
81
82 extern void rule_init(void);
83
84 /* --- @rule_end@ --- *
85  *
86  * Arguments:   ---
87  *
88  * Returns:     ---
89  *
90  * Use:         Empties the rule database.
91  */
92
93 extern void rule_end(void);
94
95 /* --- @rule_add@ --- *
96  *
97  * Arguments:   @class_node *host@ = class of hosts this rule applies to
98  *              @class_node *from@ = class of users allowed to change
99  *              @class_node *to@ = class of users allowed to be changed to
100  *              @class_node *cmd@ = class of commands allowed
101  *
102  * Returns:     ---
103  *
104  * Use:         Registers another rule.
105  */
106
107 extern void rule_add(class_node */*host*/, class_node */*from*/,
108                      class_node */*to*/, class_node */*cmd*/);
109
110 /* --- @rule_check@ --- *
111  *
112  * Arguments:   @request *r@ = pointer to a request block
113  *
114  * Returns:     Zero if disallowed, nonzero if allowed.
115  *
116  * Use:         Checks a request to see if it's allowed.
117  */
118
119 extern int rule_check(request */*r*/);
120
121 /* --- @rule_dump@ --- *
122  *
123  * Arguments:   ---
124  *
125  * Returns:     ---
126  *
127  * Use:         Dumps a map of the current ruleset to the trace output.
128  */
129
130 extern void rule_dump(void);
131
132 /*----- That's all, folks -------------------------------------------------*/
133
134 #ifdef __cplusplus
135   }
136 #endif
137
138 #endif