1 | //acl.h: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012 |
---|
5 | * |
---|
6 | * This file is part of RoarAudio, |
---|
7 | * a cross-platform sound system for both, home and professional use. |
---|
8 | * See README for details. |
---|
9 | * |
---|
10 | * This file is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU Lesser General Public License version 3 |
---|
12 | * as published by the Free Software Foundation. |
---|
13 | * |
---|
14 | * RoarAudio is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU Lesser General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU Lesser General Public License |
---|
20 | * along with this software; see the file COPYING. If not, write to |
---|
21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
22 | * Boston, MA 02110-1301, USA. |
---|
23 | * |
---|
24 | * NOTE: Even though this file is LGPLed it (may) include GPLed files |
---|
25 | * so the license of this file is/may therefore downgraded to GPL. |
---|
26 | * See HACKING for details. |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _ROARAUDIO_ACL_H_ |
---|
30 | #define _ROARAUDIO_ACL_H_ |
---|
31 | |
---|
32 | // basic rule constants |
---|
33 | #define ROAR_ACL_DENY 0 |
---|
34 | #define ROAR_ACL_REJECT ROAR_ACL_DENY |
---|
35 | #define ROAR_ACL_ALLOW 1 |
---|
36 | #define ROAR_ACL_ALLOW_OWN 2 |
---|
37 | |
---|
38 | struct roar_acl_target { |
---|
39 | int connect; |
---|
40 | int stream; |
---|
41 | int connect_to; |
---|
42 | int exit; |
---|
43 | int standby; |
---|
44 | int kick; |
---|
45 | int list; |
---|
46 | int meta; |
---|
47 | int volume; |
---|
48 | int get_client; |
---|
49 | int get_stream; |
---|
50 | int beep; |
---|
51 | }; |
---|
52 | |
---|
53 | #define ROAR_ACL_CHK(r,w,o) (( ((r)->w) == ROAR_ACL_ALLOW || (((r)->w) == ROAR_ACL_ALLOW_OWN && (o)) ) ? 1 : 0) |
---|
54 | |
---|
55 | #define ROAR_ACL_CMP_NOT 0x10 |
---|
56 | #define ROAR_ACL_CMP_EQ 0x01 |
---|
57 | |
---|
58 | #define ROAR_ACL_TYPE_ID 1 |
---|
59 | #define ROAR_ACL_TYPE_INT 1 |
---|
60 | #define ROAR_ACL_TYPE_VOID 1 |
---|
61 | |
---|
62 | struct roar_acl_cmp { |
---|
63 | int op; |
---|
64 | int type; |
---|
65 | union { |
---|
66 | id_t id; |
---|
67 | int i; |
---|
68 | void * p; |
---|
69 | } data; |
---|
70 | int datalen; |
---|
71 | }; |
---|
72 | |
---|
73 | // A rule. |
---|
74 | // All entrys may be NULL to indicate not to compare them. |
---|
75 | // The only option is addr_use_inet_port which is used to disable checking of |
---|
76 | // the remote IP. |
---|
77 | struct roar_acl_rule { |
---|
78 | pid_t * pid; |
---|
79 | uid_t * uid; |
---|
80 | gid_t * gid; |
---|
81 | char * username; |
---|
82 | int * cookie; |
---|
83 | struct sockaddr * addr; |
---|
84 | socklen_t addrlen; |
---|
85 | int addr_use_inet_port; |
---|
86 | }; |
---|
87 | |
---|
88 | #endif |
---|
89 | |
---|
90 | //ll |
---|