59fe406dfb40ec5a01a62fd2d17e46e42f402c31
[become] / src / rule.h
1 /* -*-c-*-
2 *
3 * $Id: rule.h,v 1.4 1997/09/17 10:27:17 mdw Exp $
4 *
5 * Managing rule sets
6 *
7 * (c) 1997 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.4 1997/09/17 10:27:17 mdw
33 * Use rewritten class handler.
34 *
35 * Revision 1.3 1997/08/20 16:22:49 mdw
36 * Rename `rule_reinit' to `rule_end' for more sensible restart.
37 *
38 * Revision 1.2 1997/08/04 10:24:25 mdw
39 * Sources placed under CVS control.
40 *
41 * Revision 1.1 1997/07/21 13:47:45 mdw
42 * Initial revision
43 *
44 */
45
46 #ifndef RULE_H
47 #define RULE_H
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 /*----- Required headers --------------------------------------------------*/
54
55 #include <sys/types.h>
56 #include <sys/socket.h>
57 #include <netinet/in.h>
58 #include <arpa/inet.h>
59
60 #ifndef BECOME_H
61 # include "become.h"
62 #endif
63
64 #ifndef CLASS_H
65 # include "class.h"
66 #endif
67
68 /*----- Functions provided ------------------------------------------------*/
69
70 /* --- @rule_init@ --- *
71 *
72 * Arguments: ---
73 *
74 * Returns: ---
75 *
76 * Use: Intialises the rule database.
77 */
78
79 extern void rule_init(void);
80
81 /* --- @rule_end@ --- *
82 *
83 * Arguments: ---
84 *
85 * Returns: ---
86 *
87 * Use: Empties the rule database.
88 */
89
90 extern void rule_end(void);
91
92 /* --- @rule_add@ --- *
93 *
94 * Arguments: @class_node *host@ = class of hosts this rule applies to
95 * @class_node *from@ = class of users allowed to change
96 * @class_node *to@ = class of users allowed to be changed to
97 * @class_node *cmd@ = class of commands allowed
98 *
99 * Returns: ---
100 *
101 * Use: Registers another rule.
102 */
103
104 extern void rule_add(class_node */*host*/, class_node */*from*/,
105 class_node */*to*/, class_node */*cmd*/);
106
107 /* --- @rule_check@ --- *
108 *
109 * Arguments: @request *r@ = pointer to a request block
110 *
111 * Returns: Zero if disallowed, nonzero if allowed.
112 *
113 * Use: Checks a request to see if it's allowed.
114 */
115
116 extern int rule_check(request */*r*/);
117
118 /* --- @rule_dump@ --- *
119 *
120 * Arguments: ---
121 *
122 * Returns: ---
123 *
124 * Use: Dumps a map of the current ruleset to the trace output.
125 */
126
127 extern void rule_dump(void);
128
129 /*----- That's all, folks -------------------------------------------------*/
130
131 #ifdef __cplusplus
132 }
133 #endif
134
135 #endif