[c5c522c] | 1 | /* $Id: pref.h,v 1.20 2011/06/28 00:13:48 sbajic Exp $ */ |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | DSPAM |
---|
| 5 | COPYRIGHT (C) 2002-2012 DSPAM PROJECT |
---|
| 6 | |
---|
| 7 | This program is free software: you can redistribute it and/or modify |
---|
| 8 | it under the terms of the GNU Affero General Public License as |
---|
| 9 | published by the Free Software Foundation, either version 3 of the |
---|
| 10 | License, or (at your option) any later version. |
---|
| 11 | |
---|
| 12 | This program is distributed in the hope that it will be useful, |
---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | GNU Affero General Public License for more details. |
---|
| 16 | |
---|
| 17 | You should have received a copy of the GNU Affero General Public License |
---|
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
| 19 | |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #ifndef _PREF_H |
---|
| 23 | # define _PREF_H |
---|
| 24 | |
---|
| 25 | #include <sys/types.h> |
---|
| 26 | #ifndef _WIN32 |
---|
| 27 | #include <pwd.h> |
---|
| 28 | #endif |
---|
| 29 | |
---|
| 30 | #ifdef HAVE_CONFIG_H |
---|
| 31 | #include <auto-config.h> |
---|
| 32 | #endif |
---|
| 33 | |
---|
| 34 | #include "config_shared.h" |
---|
| 35 | |
---|
| 36 | #define PREF_MAX 32 |
---|
| 37 | |
---|
| 38 | /* a single preference attribute */ |
---|
| 39 | |
---|
| 40 | typedef struct _ds_agent_attribute { |
---|
| 41 | char *attribute; |
---|
| 42 | char *value; |
---|
| 43 | } *agent_attrib_t; |
---|
| 44 | |
---|
| 45 | typedef agent_attrib_t *agent_pref_t; |
---|
| 46 | |
---|
| 47 | /* preference utilities */ |
---|
| 48 | |
---|
| 49 | const char * _ds_pref_val (agent_pref_t PTX, const char *attrib); |
---|
| 50 | int _ds_pref_free (agent_pref_t PTX); |
---|
| 51 | agent_pref_t _ds_pref_aggregate (agent_pref_t, agent_pref_t); |
---|
| 52 | agent_attrib_t _ds_pref_new (const char *attribute, const char *value); |
---|
| 53 | |
---|
| 54 | agent_pref_t _ds_ff_pref_load( |
---|
| 55 | config_t config, |
---|
| 56 | const char *user, |
---|
| 57 | const char *home, |
---|
| 58 | void *ignore); |
---|
| 59 | int _ds_ff_pref_set( |
---|
| 60 | config_t config, |
---|
| 61 | const char *user, |
---|
| 62 | const char *home, |
---|
| 63 | const char *preference, |
---|
| 64 | const char *value, |
---|
| 65 | void *ignore); |
---|
| 66 | int _ds_ff_pref_del( |
---|
| 67 | config_t config, |
---|
| 68 | const char *user, |
---|
| 69 | const char *home, |
---|
| 70 | const char *preference, |
---|
| 71 | void *ignore); |
---|
| 72 | FILE *_ds_ff_pref_prepare_file( |
---|
| 73 | const char *filename, |
---|
| 74 | const char *omission, |
---|
| 75 | int *nlines); |
---|
| 76 | int _ds_ff_pref_commit ( |
---|
| 77 | const char *filename, |
---|
| 78 | FILE *out_file); |
---|
| 79 | |
---|
| 80 | #endif /* _PREF_H */ |
---|