1 | //auth.h: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2012 |
---|
5 | * |
---|
6 | * This file is part of roard a 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 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 General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU 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 | */ |
---|
25 | |
---|
26 | #ifndef _AUTH_H_ |
---|
27 | #define _AUTH_H_ |
---|
28 | |
---|
29 | #include <roaraudio.h> |
---|
30 | |
---|
31 | #define AT_TRUST_MAX_ENTRYS 8 |
---|
32 | #define AUTH_KEYRING_LEN 8 |
---|
33 | |
---|
34 | struct at_none { |
---|
35 | char dummy; |
---|
36 | }; |
---|
37 | |
---|
38 | struct at_cookie { |
---|
39 | char * cookie; |
---|
40 | size_t len; |
---|
41 | }; |
---|
42 | |
---|
43 | struct at_trust { |
---|
44 | pid_t pids[AT_TRUST_MAX_ENTRYS]; |
---|
45 | uid_t uids[AT_TRUST_MAX_ENTRYS]; |
---|
46 | gid_t gids[AT_TRUST_MAX_ENTRYS]; |
---|
47 | size_t pids_len, uids_len, gids_len; |
---|
48 | }; |
---|
49 | |
---|
50 | struct at_password { |
---|
51 | const char * password; |
---|
52 | }; |
---|
53 | |
---|
54 | union auth_typeunion { |
---|
55 | struct at_none none; |
---|
56 | struct at_cookie cookie; |
---|
57 | struct at_trust trust; |
---|
58 | struct at_password password; |
---|
59 | }; |
---|
60 | |
---|
61 | struct auth_key { |
---|
62 | int type; |
---|
63 | enum roard_client_acclev acclev; |
---|
64 | union auth_typeunion at_data; |
---|
65 | }; |
---|
66 | |
---|
67 | extern struct auth_key g_auth_keyring[AUTH_KEYRING_LEN]; |
---|
68 | |
---|
69 | int auth_init (void); |
---|
70 | int auth_free (void); |
---|
71 | |
---|
72 | union auth_typeunion * auth_regkey_simple(int type, enum roard_client_acclev acclev); |
---|
73 | |
---|
74 | int auth_client_ckeck(struct roar_client_server * cs, struct roar_auth_message * authmes, int * next); |
---|
75 | |
---|
76 | int auth_addkey_anonymous(enum roard_client_acclev acclev); |
---|
77 | int auth_addkey_password(enum roard_client_acclev acclev, const char * password); |
---|
78 | int auth_addkey_cookie(enum roard_client_acclev acclev, const void * cookie, const size_t len); |
---|
79 | int auth_addkey_trust(enum roard_client_acclev acclev, ...); |
---|
80 | |
---|
81 | #endif |
---|
82 | |
---|
83 | //ll |
---|