]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Solanum: a slightly advanced ircd | |
3 | * privilege.h: Dynamic privileges API. | |
4 | * | |
5 | * Copyright (c) 2008 William Pitcock <nenolod@dereferenced.org> | |
6 | * | |
7 | * Permission to use, copy, modify, and/or distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice is present in all copies. | |
10 | * | |
11 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
12 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
13 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
14 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
15 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
16 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
18 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
19 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
20 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
21 | * POSSIBILITY OF SUCH DAMAGE. | |
22 | */ | |
23 | ||
24 | #ifndef __SOLANUM_PRIVILEGE_H | |
25 | #define __SOLANUM_PRIVILEGE_H | |
26 | ||
27 | #include "stdinc.h" | |
28 | ||
29 | enum { | |
30 | PRIV_NEEDOPER = 1 | |
31 | }; | |
32 | typedef unsigned int PrivilegeFlags; | |
33 | ||
34 | struct PrivilegeSet { | |
35 | unsigned int status; /* If CONF_ILLEGAL, delete when no refs */ | |
36 | int refs; | |
37 | char *name; | |
38 | char *privs; | |
39 | PrivilegeFlags flags; | |
40 | rb_dlink_node node; | |
41 | }; | |
42 | ||
43 | int privilegeset_in_set(struct PrivilegeSet *set, const char *priv); | |
44 | struct PrivilegeSet *privilegeset_set_new(const char *name, const char *privs, PrivilegeFlags flags); | |
45 | struct PrivilegeSet *privilegeset_extend(struct PrivilegeSet *parent, const char *name, const char *privs, PrivilegeFlags flags); | |
46 | struct PrivilegeSet *privilegeset_get(const char *name); | |
47 | struct PrivilegeSet *privilegeset_ref(struct PrivilegeSet *set); | |
48 | void privilegeset_unref(struct PrivilegeSet *set); | |
49 | void privilegeset_mark_all_illegal(void); | |
50 | void privilegeset_delete_all_illegal(void); | |
51 | void privilegeset_report(struct Client *source_p); | |
52 | ||
53 | #endif |