Expunge revision histories in files.
[become] / src / rule.h
CommitLineData
c4f2d992 1/* -*-c-*-
2 *
af4f4d6a 3 * $Id: rule.h,v 1.7 2004/04/08 01:36:20 mdw Exp $
c4f2d992 4 *
5 * Managing rule sets
6 *
c758e654 7 * (c) 1998 EBI
c4f2d992 8 */
9
03f996bd 10/*----- Licensing notice --------------------------------------------------*
c4f2d992 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
03f996bd 25 * along with `become'; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
c4f2d992 27 */
28
c4f2d992 29#ifndef RULE_H
30#define RULE_H
31
32#ifdef __cplusplus
33 extern "C" {
34#endif
35
36/*----- Required headers --------------------------------------------------*/
37
38#include <sys/types.h>
39#include <sys/socket.h>
40#include <netinet/in.h>
41#include <arpa/inet.h>
42
43#ifndef BECOME_H
44# include "become.h"
45#endif
46
47#ifndef CLASS_H
48# include "class.h"
49#endif
50
b40be44e 51/*----- Type definitions --------------------------------------------------*/
52
53/* --- Rule block --- */
54
55typedef struct rule {
56 struct rule *next; /* Next rule in the list */
57 class_node *host; /* Hosts this rule applies to */
58 class_node *from; /* From users in this class */
59 class_node *to; /* To users in this class */
60 class_node *cmd; /* To run commands in this class */
61} rule;
62
c4f2d992 63/*----- Functions provided ------------------------------------------------*/
64
65/* --- @rule_init@ --- *
66 *
67 * Arguments: ---
68 *
69 * Returns: ---
70 *
71 * Use: Intialises the rule database.
72 */
73
74extern void rule_init(void);
75
063606f7 76/* --- @rule_end@ --- *
c4f2d992 77 *
78 * Arguments: ---
79 *
80 * Returns: ---
81 *
063606f7 82 * Use: Empties the rule database.
c4f2d992 83 */
84
063606f7 85extern void rule_end(void);
c4f2d992 86
b40be44e 87/* --- @rule_list@ --- *
88 *
89 * Arguments: ---
90 *
91 * Returns: The list of rules.
92 *
93 * Use: Returns the address of the first node in the rule list.
94 */
95
96extern rule *rule_list(void);
97
c4f2d992 98/* --- @rule_add@ --- *
99 *
30868bd5 100 * Arguments: @class_node *host@ = class of hosts this rule applies to
101 * @class_node *from@ = class of users allowed to change
102 * @class_node *to@ = class of users allowed to be changed to
103 * @class_node *cmd@ = class of commands allowed
c4f2d992 104 *
105 * Returns: ---
106 *
107 * Use: Registers another rule.
108 */
109
30868bd5 110extern void rule_add(class_node */*host*/, class_node */*from*/,
111 class_node */*to*/, class_node */*cmd*/);
c4f2d992 112
113/* --- @rule_check@ --- *
114 *
115 * Arguments: @request *r@ = pointer to a request block
116 *
117 * Returns: Zero if disallowed, nonzero if allowed.
118 *
119 * Use: Checks a request to see if it's allowed.
120 */
121
122extern int rule_check(request */*r*/);
123
03f996bd 124/* --- @rule_dump@ --- *
125 *
126 * Arguments: ---
127 *
128 * Returns: ---
129 *
130 * Use: Dumps a map of the current ruleset to the trace output.
131 */
132
133extern void rule_dump(void);
134
c4f2d992 135/*----- That's all, folks -------------------------------------------------*/
136
137#ifdef __cplusplus
138 }
139#endif
140
141#endif