]>
Commit | Line | Data |
---|---|---|
64b56afd AC |
1 | /* |
2 | * Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org>. | |
3 | * | |
4 | * Permission to use, copy, modify, and/or distribute this software for any | |
5 | * purpose with or without fee is hereby granted, provided that the above | |
6 | * copyright notice and this permission notice is present in all copies. | |
7 | * | |
8 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
9 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
10 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
11 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
12 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
13 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
14 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
15 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
16 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
17 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
18 | * POSSIBILITY OF SUCH DAMAGE. | |
19 | */ | |
20 | ||
21 | #ifndef __CAPABILITY_H__ | |
22 | #define __CAPABILITY_H__ | |
23 | ||
ba832267 AC |
24 | struct CapabilityIndex { |
25 | const char *name; | |
26 | struct Dictionary *cap_dict; | |
27 | unsigned int highest_bit; | |
28 | rb_dlink_node node; | |
29 | }; | |
30 | ||
31 | #define CAP_ORPHANED 0x1 | |
32 | #define CAP_REQUIRED 0x2 | |
33 | ||
34 | struct CapabilityEntry { | |
35 | const char *cap; | |
36 | unsigned int value; | |
37 | unsigned int flags; | |
38 | void *ownerdata; | |
39 | }; | |
64b56afd | 40 | |
32df5e96 | 41 | extern struct CapabilityEntry *capability_find(struct CapabilityIndex *idx, const char *cap); |
63b9db96 AC |
42 | extern unsigned int capability_get(struct CapabilityIndex *idx, const char *cap, void **ownerdata); |
43 | extern unsigned int capability_put(struct CapabilityIndex *idx, const char *cap, void *ownerdata); | |
22cae20f | 44 | extern unsigned int capability_put_anonymous(struct CapabilityIndex *idx); |
bde42c60 JT |
45 | extern void capability_orphan(struct CapabilityIndex *idx, const char *cap); |
46 | extern void capability_require(struct CapabilityIndex *idx, const char *cap); | |
64b56afd | 47 | |
885cd603 | 48 | extern struct CapabilityIndex *capability_index_create(const char *name); |
64b56afd | 49 | extern void capability_index_destroy(struct CapabilityIndex *); |
5e773521 | 50 | extern const char *capability_index_list(struct CapabilityIndex *, unsigned int capability_mask); |
ec3a9055 | 51 | extern unsigned int capability_index_mask(struct CapabilityIndex *); |
f01f67f0 | 52 | extern unsigned int capability_index_get_required(struct CapabilityIndex *); |
a16910aa | 53 | extern void capability_index_stats(void (*cb)(const char *line, void *privdata), void *privdata); |
5e773521 | 54 | |
64b56afd | 55 | #endif |