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