]>
Commit | Line | Data |
---|---|---|
9c3f080b AC |
1 | /* |
2 | * charybdis: an 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 __CHARYBDIS_PRIVILEGE_H | |
25 | #define __CHARYBDIS_PRIVILEGE_H | |
26 | ||
27 | #include "stdinc.h" | |
28 | ||
29 | typedef enum { | |
30 | PRIV_NEEDOPER = 1 | |
31 | } PrivilegeFlags; | |
32 | ||
33 | struct PrivilegeSet { | |
422bb0b5 | 34 | unsigned int status; /* If CONF_ILLEGAL, delete when no refs */ |
9c3f080b AC |
35 | int refs; |
36 | char *name; | |
37 | char *privs; | |
38 | PrivilegeFlags flags; | |
39 | rb_dlink_node node; | |
40 | }; | |
41 | ||
42 | int privilegeset_in_set(struct PrivilegeSet *set, const char *priv); | |
43 | struct PrivilegeSet *privilegeset_set_new(const char *name, const char *privs, PrivilegeFlags flags); | |
353f8625 | 44 | struct PrivilegeSet *privilegeset_extend(struct PrivilegeSet *parent, const char *name, const char *privs, PrivilegeFlags flags); |
9c3f080b | 45 | struct PrivilegeSet *privilegeset_get(const char *name); |
598b4cf1 | 46 | struct PrivilegeSet *privilegeset_ref(struct PrivilegeSet *set); |
9c3f080b | 47 | void privilegeset_unref(struct PrivilegeSet *set); |
422bb0b5 JT |
48 | void privilegeset_mark_all_illegal(void); |
49 | void privilegeset_delete_all_illegal(void); | |
9c3f080b AC |
50 | |
51 | #endif |