diff options
Diffstat (limited to 'src/wydawca.h')
-rw-r--r-- | src/wydawca.h | 83 |
1 files changed, 59 insertions, 24 deletions
diff --git a/src/wydawca.h b/src/wydawca.h index 3f28919..8a716e4 100644 --- a/src/wydawca.h +++ b/src/wydawca.h @@ -32,7 +32,14 @@ #include <limits.h> #include <dirent.h> #include <sys/stat.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <sys/un.h> +#include <sys/wait.h> +#include <netdb.h> +#include <arpa/inet.h> #include <fcntl.h> +#include <time.h> #include <mailutils/types.h> #include <mailutils/url.h> @@ -47,6 +54,7 @@ #include "backupfile.h" #include "inttostr.h" #include "gconf.h" +#include "gl_list.h" #include "argcv.h" #define gettext(s) s @@ -156,7 +164,7 @@ struct file_triplet char *name; /* Triplet base name */ gid_t gid; /* Owner GID */ struct file_info file[FILE_TYPE_COUNT]; /* Components */ - struct spool *spool; /* Owning spool */ + const struct spool *spool; /* Owning spool */ char **directive; /* Decoded directive pairs (key: value\0) */ char *blurb; /* Block of directives: directive[i] points here */ char *tmp; /* Temporary storage */ @@ -179,20 +187,20 @@ struct virt_tab { int (*test_url) (mu_url_t url, gconf_locus_t *loc); int (*move_file) (struct file_triplet *trp, - struct spool *spool, + const struct spool *spool, enum file_type file_id, const char *reldir); int (*archive_file) (struct file_triplet *trp, - struct spool *spool, + const struct spool *spool, const char *reldir, const char *file_name); int (*symlink_file) (struct file_triplet *trp, - struct spool *spool, + const struct spool *spool, const char *reldir, const char *wanted_src, const char *wanted_dst); int (*rmsymlink_file)(struct file_triplet *trp, - struct spool *spool, + const struct spool *spool, const char *reldir, const char *file_name); }; @@ -201,6 +209,8 @@ struct virt_tab files from source to destination */ struct spool { + char *tag; + gl_list_t aliases; char *url; /* Download URL */ char *source_dir; /* Source directory */ mu_url_t dest_url; /* Destination URL */ @@ -306,6 +316,15 @@ extern int archive_signatures; extern char *admin_stat_message; +extern char *pidfile; +extern int force_startup; + +extern int daemon_mode; +extern time_t wakeup_interval; +extern int foreground; +extern int single_process; +extern struct gconf_sockaddr listen_sockaddr; + #define UPDATE_STATS(what) \ do \ { \ @@ -341,10 +360,13 @@ enum exec_result wydawca_exec (int argc, const char **argv, int *retcode); /* Directory scanning and registering */ -void scan_directories (void); +void scan_spool (const struct spool *spool, int uc, uid_t *uv); +void scan_directories (int, uid_t *); + void register_spool (struct spool *spool); +struct spool *wydawca_find_spool (const char *name); void register_file (struct file_info *finfo); -void enumerate_triplets (struct spool *); +void enumerate_triplets (const struct spool *); size_t count_collected_triplets (void); char *triplet_expand_param (const char *tmpl, struct file_triplet *trp); @@ -369,12 +391,12 @@ unsigned method_num_cols (struct access_method *method); /* Verification functions */ int verify_directive_file (struct file_triplet *trp, - struct spool *spool); + const struct spool *spool); int verify_directive_signature (struct file_triplet *trp, - struct spool *spool, + const struct spool *spool, const char *pubkey); int verify_detached_signature (struct file_triplet *trp, - struct spool *spool); + const struct spool *spool); int fill_project_name (struct file_triplet *trp); /* Directive file support */ @@ -390,9 +412,8 @@ int directive_first (struct file_triplet *trp, int directive_next (struct file_triplet *trp, int n, const char **pkey, const char **pval); int process_directives (struct file_triplet *trp, - struct spool *spool); + const struct spool *spool); -int match_uid_p (uid_t uid); int enabled_spool_p (const struct spool *spool); int wydawca_uid (uid_t uid); @@ -410,42 +431,42 @@ void config_help (void); int url_to_vtab (mu_url_t url, struct virt_tab *vtab); int -move_file (struct file_triplet *trp, struct spool *spool, +move_file (struct file_triplet *trp, const struct spool *spool, enum file_type file_id, const char *reldir); int -archive_file (struct file_triplet *trp, struct spool *spool, +archive_file (struct file_triplet *trp, const struct spool *spool, const char *reldir, const char *file_name); int -symlink_file (struct file_triplet *trp, struct spool *spool, +symlink_file (struct file_triplet *trp, const struct spool *spool, const char *reldir, const char *wanted_src, const char *wanted_dst); int -rmsymlink_file (struct file_triplet *trp, struct spool *spool, +rmsymlink_file (struct file_triplet *trp, const struct spool *spool, const char *reldir, const char *file_name); /* diskio.c */ int dir_test_url (mu_url_t url, gconf_locus_t *locus); -int dir_move_file (struct file_triplet *trp, struct spool *spool, +int dir_move_file (struct file_triplet *trp, const struct spool *spool, enum file_type file_id, const char *reldir); -int dir_archive_file (struct file_triplet *trp, struct spool *spool, +int dir_archive_file (struct file_triplet *trp, const struct spool *spool, const char *file_name, const char *reldir); -int dir_symlink_file (struct file_triplet *trp, struct spool *spool, +int dir_symlink_file (struct file_triplet *trp, const struct spool *spool, const char *reldir, const char *wanted_src, const char *wanted_dst); -int dir_rmsymlink_file (struct file_triplet *trp, struct spool *spool, +int dir_rmsymlink_file (struct file_triplet *trp, const struct spool *spool, const char *reldir, const char *file_name); /* null.c */ -int null_move_file (struct file_triplet *trp, struct spool *spool, +int null_move_file (struct file_triplet *trp, const struct spool *spool, enum file_type file_id, const char *reldir); -int null_archive_file (struct file_triplet *trp, struct spool *spool, +int null_archive_file (struct file_triplet *trp, const struct spool *spool, const char *file_name, const char *reldir); -int null_symlink_file (struct file_triplet *trp, struct spool *spool, +int null_symlink_file (struct file_triplet *trp, const struct spool *spool, const char *reldir, const char *wanted_src, const char *wanted_dst); -int null_rmsymlink_file (struct file_triplet *trp, struct spool *spool, +int null_rmsymlink_file (struct file_triplet *trp, const struct spool *spool, const char *reldir, const char *file_name); @@ -469,3 +490,17 @@ void report_init (void); void report_add (const char *fmt, ...); void report_finish (void); extern char *report_string; + + +/* job.c */ +int schedule_job (const struct spool *spool, uid_t uid); +void job_init (void); +void job_queue_runner (void); + + +/* profile.c */ +void check_pidfile (void); + + +/* net.c */ +void wydawca_listener (void); |