diff options
Diffstat (limited to 'include/wydawca/wydawca.h')
-rw-r--r-- | include/wydawca/wydawca.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/include/wydawca/wydawca.h b/include/wydawca/wydawca.h new file mode 100644 index 0000000..9b5c7df --- /dev/null +++ b/include/wydawca/wydawca.h @@ -0,0 +1,92 @@ +/* wydawca - automatic release submission daemon + Copyright (C) 2007-2013 Sergey Poznyakoff + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#define wy_s_cat2(a,b) a ## b +#define wy_s_cat3(a,b,c) a ## b ## c + +#define WY_EXPORT(module,name) wy_s_cat3(module,_LTX_,name) +#define wy_notify WY_EXPORT(WY_MODULE,notify) +#define wy_help WY_EXPORT(WY_MODULE,help) +#define wy_open WY_EXPORT(WY_MODULE,open) +#define wy_config WY_EXPORT(WY_MODULE,config) +#define wy_flush WY_EXPORT(WY_MODULE,flush) + +/* Global variables */ + +extern int wy_dry_run; /* Dry run indicator */ +extern int wy_debug_level; /* Debugging level */ +extern char *wy_gpg_homedir; +extern const char *wy_version; +extern int wy_log_to_stderr; /* Log to stderr instead of the syslog */ +extern int wy_log_facility; /* Syslog facility to use if !wy_log_to_stderr */ +extern char *wy_syslog_tag; /* Syslog tag */ + +/* Logging and debugging */ +#ifndef WY_PRINTFLIKE +# define WY_PRINTFLIKE(fmt,narg) __attribute__ ((__format__ (__printf__, fmt, narg))) +#endif + +void wy_log(int prio, char *fmt, ...) WY_PRINTFLIKE(2, 3); +void wy_dbg(char *fmt, ...) WY_PRINTFLIKE(1, 2); +#define wy_debug(l,c) do { \ + if (wy_debug_level >= (l)) \ + wy_dbg c; \ + } while(0) + +/* Wydawca events */ +enum wy_event { + wy_ev_success, + wy_ev_bad_ownership, + wy_ev_bad_directive_signature, + wy_ev_bad_detached_signature, + wy_ev_check_fail, + wy_ev_statistics, + WY_N_EVENT +}; + +const char *wy_event_str(enum wy_event evt); + + +struct wy_user { + struct wy_user *next; + char *name; + char *realname; + char *email; + char *gpg_key; + char *fpr; +}; + +typedef struct wy_triplet *wy_triplet_t; + +const char *wy_triplet_project(wy_triplet_t trp); +struct wy_user *wy_triplet_get_uploaders(wy_triplet_t trp); +struct wy_user *wy_triplet_get_admins(wy_triplet_t trp); +struct wy_user *wy_triplet_get_uploader(wy_triplet_t trp); + +struct wy_metadef { + char *kw; + char *value; + const char *(*expand) (struct wy_metadef *, void *); + char *storage; + void *data; +}; + +char *wy_expand_stats(const char *tmpl); +char *wy_triplet_expand_param(const char *tmpl, struct wy_triplet const *trp, + struct wy_metadef *xmeta); + +int wy_stat_mask_p(unsigned long mask); + |