aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wydawca.h')
-rw-r--r--src/wydawca.h83
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 @@
32#include <limits.h> 32#include <limits.h>
33#include <dirent.h> 33#include <dirent.h>
34#include <sys/stat.h> 34#include <sys/stat.h>
35#include <sys/socket.h>
36#include <netinet/in.h>
37#include <sys/un.h>
38#include <sys/wait.h>
39#include <netdb.h>
40#include <arpa/inet.h>
35#include <fcntl.h> 41#include <fcntl.h>
42#include <time.h>
36 43
37#include <mailutils/types.h> 44#include <mailutils/types.h>
38#include <mailutils/url.h> 45#include <mailutils/url.h>
@@ -47,6 +54,7 @@
47#include "backupfile.h" 54#include "backupfile.h"
48#include "inttostr.h" 55#include "inttostr.h"
49#include "gconf.h" 56#include "gconf.h"
57#include "gl_list.h"
50#include "argcv.h" 58#include "argcv.h"
51 59
52#define gettext(s) s 60#define gettext(s) s
@@ -156,7 +164,7 @@ struct file_triplet
156 char *name; /* Triplet base name */ 164 char *name; /* Triplet base name */
157 gid_t gid; /* Owner GID */ 165 gid_t gid; /* Owner GID */
158 struct file_info file[FILE_TYPE_COUNT]; /* Components */ 166 struct file_info file[FILE_TYPE_COUNT]; /* Components */
159 struct spool *spool; /* Owning spool */ 167 const struct spool *spool; /* Owning spool */
160 char **directive; /* Decoded directive pairs (key: value\0) */ 168 char **directive; /* Decoded directive pairs (key: value\0) */
161 char *blurb; /* Block of directives: directive[i] points here */ 169 char *blurb; /* Block of directives: directive[i] points here */
162 char *tmp; /* Temporary storage */ 170 char *tmp; /* Temporary storage */
@@ -179,20 +187,20 @@ struct virt_tab
179{ 187{
180 int (*test_url) (mu_url_t url, gconf_locus_t *loc); 188 int (*test_url) (mu_url_t url, gconf_locus_t *loc);
181 int (*move_file) (struct file_triplet *trp, 189 int (*move_file) (struct file_triplet *trp,
182 struct spool *spool, 190 const struct spool *spool,
183 enum file_type file_id, 191 enum file_type file_id,
184 const char *reldir); 192 const char *reldir);
185 int (*archive_file) (struct file_triplet *trp, 193 int (*archive_file) (struct file_triplet *trp,
186 struct spool *spool, 194 const struct spool *spool,
187 const char *reldir, 195 const char *reldir,
188 const char *file_name); 196 const char *file_name);
189 int (*symlink_file) (struct file_triplet *trp, 197 int (*symlink_file) (struct file_triplet *trp,
190 struct spool *spool, 198 const struct spool *spool,
191 const char *reldir, 199 const char *reldir,
192 const char *wanted_src, 200 const char *wanted_src,
193 const char *wanted_dst); 201 const char *wanted_dst);
194 int (*rmsymlink_file)(struct file_triplet *trp, 202 int (*rmsymlink_file)(struct file_triplet *trp,
195 struct spool *spool, 203 const struct spool *spool,
196 const char *reldir, 204 const char *reldir,
197 const char *file_name); 205 const char *file_name);
198}; 206};
@@ -201,6 +209,8 @@ struct virt_tab
201 files from source to destination */ 209 files from source to destination */
202struct spool 210struct spool
203{ 211{
212 char *tag;
213 gl_list_t aliases;
204 char *url; /* Download URL */ 214 char *url; /* Download URL */
205 char *source_dir; /* Source directory */ 215 char *source_dir; /* Source directory */
206 mu_url_t dest_url; /* Destination URL */ 216 mu_url_t dest_url; /* Destination URL */
@@ -306,6 +316,15 @@ extern int archive_signatures;
306 316
307extern char *admin_stat_message; 317extern char *admin_stat_message;
308 318
319extern char *pidfile;
320extern int force_startup;
321
322extern int daemon_mode;
323extern time_t wakeup_interval;
324extern int foreground;
325extern int single_process;
326extern struct gconf_sockaddr listen_sockaddr;
327
309#define UPDATE_STATS(what) \ 328#define UPDATE_STATS(what) \
310 do \ 329 do \
311 { \ 330 { \
@@ -341,10 +360,13 @@ enum exec_result wydawca_exec (int argc, const char **argv, int *retcode);
341 360
342 361
343/* Directory scanning and registering */ 362/* Directory scanning and registering */
344void scan_directories (void); 363void scan_spool (const struct spool *spool, int uc, uid_t *uv);
364void scan_directories (int, uid_t *);
365
345void register_spool (struct spool *spool); 366void register_spool (struct spool *spool);
367struct spool *wydawca_find_spool (const char *name);
346void register_file (struct file_info *finfo); 368void register_file (struct file_info *finfo);
347void enumerate_triplets (struct spool *); 369void enumerate_triplets (const struct spool *);
348size_t count_collected_triplets (void); 370size_t count_collected_triplets (void);
349char *triplet_expand_param (const char *tmpl, struct file_triplet *trp); 371char *triplet_expand_param (const char *tmpl, struct file_triplet *trp);
350 372
@@ -369,12 +391,12 @@ unsigned method_num_cols (struct access_method *method);
369 391
370/* Verification functions */ 392/* Verification functions */
371int verify_directive_file (struct file_triplet *trp, 393int verify_directive_file (struct file_triplet *trp,
372 struct spool *spool); 394 const struct spool *spool);
373int verify_directive_signature (struct file_triplet *trp, 395int verify_directive_signature (struct file_triplet *trp,
374 struct spool *spool, 396 const struct spool *spool,
375 const char *pubkey); 397 const char *pubkey);
376int verify_detached_signature (struct file_triplet *trp, 398int verify_detached_signature (struct file_triplet *trp,
377 struct spool *spool); 399 const struct spool *spool);
378int fill_project_name (struct file_triplet *trp); 400int fill_project_name (struct file_triplet *trp);
379 401
380/* Directive file support */ 402/* Directive file support */
@@ -390,9 +412,8 @@ int directive_first (struct file_triplet *trp,
390int directive_next (struct file_triplet *trp, int n, 412int directive_next (struct file_triplet *trp, int n,
391 const char **pkey, const char **pval); 413 const char **pkey, const char **pval);
392int process_directives (struct file_triplet *trp, 414int process_directives (struct file_triplet *trp,
393 struct spool *spool); 415 const struct spool *spool);
394 416
395int match_uid_p (uid_t uid);
396int enabled_spool_p (const struct spool *spool); 417int enabled_spool_p (const struct spool *spool);
397 418
398int wydawca_uid (uid_t uid); 419int wydawca_uid (uid_t uid);
@@ -410,42 +431,42 @@ void config_help (void);
410int url_to_vtab (mu_url_t url, struct virt_tab *vtab); 431int url_to_vtab (mu_url_t url, struct virt_tab *vtab);
411 432
412int 433int
413move_file (struct file_triplet *trp, struct spool *spool, 434move_file (struct file_triplet *trp, const struct spool *spool,
414 enum file_type file_id, const char *reldir); 435 enum file_type file_id, const char *reldir);
415int 436int
416archive_file (struct file_triplet *trp, struct spool *spool, 437archive_file (struct file_triplet *trp, const struct spool *spool,
417 const char *reldir, const char *file_name); 438 const char *reldir, const char *file_name);
418int 439int
419symlink_file (struct file_triplet *trp, struct spool *spool, 440symlink_file (struct file_triplet *trp, const struct spool *spool,
420 const char *reldir, 441 const char *reldir,
421 const char *wanted_src, const char *wanted_dst); 442 const char *wanted_src, const char *wanted_dst);
422int 443int
423rmsymlink_file (struct file_triplet *trp, struct spool *spool, 444rmsymlink_file (struct file_triplet *trp, const struct spool *spool,
424 const char *reldir, const char *file_name); 445 const char *reldir, const char *file_name);
425 446
426 447
427/* diskio.c */ 448/* diskio.c */
428 449
429int dir_test_url (mu_url_t url, gconf_locus_t *locus); 450int dir_test_url (mu_url_t url, gconf_locus_t *locus);
430int dir_move_file (struct file_triplet *trp, struct spool *spool, 451int dir_move_file (struct file_triplet *trp, const struct spool *spool,
431 enum file_type file_id, const char *reldir); 452 enum file_type file_id, const char *reldir);
432int dir_archive_file (struct file_triplet *trp, struct spool *spool, 453int dir_archive_file (struct file_triplet *trp, const struct spool *spool,
433 const char *file_name, const char *reldir); 454 const char *file_name, const char *reldir);
434int dir_symlink_file (struct file_triplet *trp, struct spool *spool, 455int dir_symlink_file (struct file_triplet *trp, const struct spool *spool,
435 const char *reldir, 456 const char *reldir,
436 const char *wanted_src, const char *wanted_dst); 457 const char *wanted_src, const char *wanted_dst);
437int dir_rmsymlink_file (struct file_triplet *trp, struct spool *spool, 458int dir_rmsymlink_file (struct file_triplet *trp, const struct spool *spool,
438 const char *reldir, const char *file_name); 459 const char *reldir, const char *file_name);
439 460
440/* null.c */ 461/* null.c */
441int null_move_file (struct file_triplet *trp, struct spool *spool, 462int null_move_file (struct file_triplet *trp, const struct spool *spool,
442 enum file_type file_id, const char *reldir); 463 enum file_type file_id, const char *reldir);
443int null_archive_file (struct file_triplet *trp, struct spool *spool, 464int null_archive_file (struct file_triplet *trp, const struct spool *spool,
444 const char *file_name, const char *reldir); 465 const char *file_name, const char *reldir);
445int null_symlink_file (struct file_triplet *trp, struct spool *spool, 466int null_symlink_file (struct file_triplet *trp, const struct spool *spool,
446 const char *reldir, 467 const char *reldir,
447 const char *wanted_src, const char *wanted_dst); 468 const char *wanted_src, const char *wanted_dst);
448int null_rmsymlink_file (struct file_triplet *trp, struct spool *spool, 469int null_rmsymlink_file (struct file_triplet *trp, const struct spool *spool,
449 const char *reldir, const char *file_name); 470 const char *reldir, const char *file_name);
450 471
451 472
@@ -469,3 +490,17 @@ void report_init (void);
469void report_add (const char *fmt, ...); 490void report_add (const char *fmt, ...);
470void report_finish (void); 491void report_finish (void);
471extern char *report_string; 492extern char *report_string;
493
494
495/* job.c */
496int schedule_job (const struct spool *spool, uid_t uid);
497void job_init (void);
498void job_queue_runner (void);
499
500
501/* profile.c */
502<