]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/lib/protos.h
Add RunBeforeJob and RunAfterJob -- kes18Jul02
[bacula/bacula] / bacula / src / lib / protos.h
1 /*
2  * Prototypes for lib directory of Bacula
3  *
4  *   Version $Id$
5  */
6 /*
7    Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
8
9    This program is free software; you can redistribute it and/or
10    modify it under the terms of the GNU General Public License as
11    published by the Free Software Foundation; either version 2 of
12    the License, or (at your option) any later version.
13
14    This program 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 GNU
17    General Public License for more details.
18
19    You should have received a copy of the GNU General Public
20    License along with this program; if not, write to the Free
21    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22    MA 02111-1307, USA.
23
24  */
25
26 /* base64.c */
27 void      base64_init            (void);
28 int       to_base64              (intmax_t value, char *where);
29 int       from_base64            (intmax_t *value, char *where);
30 void      encode_stat            (char *buf, struct stat *statp);
31 void      decode_stat            (char *buf, struct stat *statp);
32 int       bin_to_base64          (char *buf, char *bin, int len);
33
34 /* bmisc.c */
35 void     *b_malloc               (char *file, int line, size_t size);
36 #ifndef DEBUG
37 void     *bmalloc                (size_t size);
38 #endif
39 void     *brealloc               (void *buf, size_t size);
40 void     *bcalloc                (size_t size1, size_t size2);
41 int       bsnprintf              (char *str, size_t size, const  char  *format, ...);
42 int       bvsnprintf             (char *str, size_t size, const char  *format, va_list ap);
43 int       pool_sprintf           (char *pool_buf, char *fmt, ...);
44 void      create_pid_file        (char *dir, char *progname, int port);
45 int       delete_pid_file        (char *dir, char *progname, int port);
46 #ifndef HAVE_STRERROR_R
47 int       strerror_r             (int errnum, char *buf, size_t bufsiz);
48 #endif
49
50
51 /* bnet.c */
52 int32_t    bnet_recv             (BSOCK *bsock);
53 int        bnet_send             (BSOCK *bsock);
54 int        bnet_fsend              (BSOCK *bs, char *fmt, ...);
55 int        bnet_set_buffer_size    (BSOCK *bs, uint32_t size, int rw);
56 int        bnet_sig                (BSOCK *bs, int sig);
57 BSOCK *    bnet_connect            (void *jcr, int retry_interval,
58                int max_retry_time, char *name, char *host, char *service, 
59                int port, int verbose);
60 int        bnet_wait_data         (BSOCK *bsock, int sec);
61 void       bnet_close            (BSOCK *bsock);
62 BSOCK *    init_bsock            (int sockfd, char *who, char *ip, int port);
63 BSOCK *    dup_bsock             (BSOCK *bsock);
64 void       term_bsock            (BSOCK *bsock);
65 char *     bnet_strerror         (BSOCK *bsock);
66 char *     bnet_sig_to_ascii     (BSOCK *bsock);
67 int        bnet_wait_data        (BSOCK *bsock, int sec);
68
69
70 /* cram-md5.c */
71 int cram_md5_get_auth(BSOCK *bs, char *password);
72 int cram_md5_auth(BSOCK *bs, char *password);
73 void hmac_md5(uint8_t* text, int text_len, uint8_t*  key,
74               int key_len, uint8_t *hmac);
75
76 /* create_file.c */
77 int create_file(void *jcr, char *fname, char *ofile, char *lname,
78                        int type, struct stat *statp, int *ofd);
79 int set_statp(void *jcr, char *fname, char *ofile, char *lname, int type, 
80                        struct stat *statp);
81
82
83 /* crc32.c */
84 uint32_t bcrc32(uint8_t *buf, int len);
85
86 /* daemon.c */
87 void     daemon_start            ();
88
89 /* lex.c */
90 LEX *     lex_close_file         (LEX *lf);
91 LEX *     lex_open_file          (LEX *lf, char *fname, LEX_ERROR_HANDLER *scan_error);
92 int       lex_get_char           (LEX *lf);
93 void      lex_unget_char         (LEX *lf);
94 char *    lex_tok_to_str         (int token);
95 int       lex_get_token          (LEX *lf, int expect);
96
97 /* makepath.c */
98 int make_path(
99            void *jcr,
100            const char *argpath,
101            int mode,
102            int parent_mode,
103            uid_t owner,
104            gid_t group,
105            int preserve_existing,
106            char *verbose_fmt_string);
107
108
109 /* message.c */
110 void       my_name_is            (int argc, char *argv[], char *name);
111 void       init_msg              (void *jcr, MSGS *msg);
112 void       term_msg              (void);
113 void       close_msg             (void *jcr);
114 void       add_msg_dest          (MSGS *msg, int dest, int type, char *where, char *dest_code);
115 void       rem_msg_dest          (MSGS *msg, int dest, int type, char *where);
116 void       Jmsg                  (void *jcr, int type, int level, char *fmt, ...);
117 void       dispatch_message      (void *jcr, int type, int level, char *buf);
118 void       init_console_msg      (char *wd);
119 void       free_msgs_res         (MSGS *msgs);
120
121
122 /* bnet_server.c */
123 void       bnet_thread_server(int port, int max_clients, workq_t *client_wq, 
124                    void handle_client_request(void *bsock));
125 void             bnet_server             (int port, void handle_client_request(BSOCK *bsock));
126 int              net_connect             (int port);
127 BSOCK *          bnet_bind               (int port);
128 BSOCK *          bnet_accept             (BSOCK *bsock, char *who);
129
130 /* signal.c */
131 void             init_signals             (void terminate(int sig));
132 void             init_stack_dump          (void);
133
134 /* util.c */
135 void             lcase                   (char *str);
136 void             bash_spaces             (char *str);
137 void             unbash_spaces           (char *str);
138 void             strip_trailing_junk     (char *str);
139 void             strip_trailing_slashes  (char *dir);
140 int              skip_spaces             (char **msg);
141 int              skip_nonspaces          (char **msg);
142 int              fstrsch                 (char *a, char *b);
143 char *           encode_time             (time_t time, char *buf);
144 char *           encode_mode             (mode_t mode, char *buf);
145 char *           edit_uint64_with_commas   (uint64_t val, char *buf);
146 char *           add_commas              (char *val, char *buf);
147 char *           edit_uint64             (uint64_t val, char *buf);
148 int              do_shell_expansion      (char *name);
149 int              is_a_number             (const char *num);
150 int              string_to_btime         (char *str, btime_t *value);
151 char             *edit_btime             (btime_t val, char *buf);
152 void             jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
153 void             add_str_to_pool_mem     (POOLMEM **base, char **msg, char *str);
154 int              run_program             (char *prog, int wait, POOLMEM *results);
155 char *           job_type_to_str         (int type);
156 char *           job_status_to_str       (int stat);
157 char *           job_level_to_str        (int level);
158
159
160 /*
161  *void           print_ls_output         (char *fname, char *lname, int type, struct stat *statp);
162  */
163
164 /* watchdog.c */
165 int start_watchdog(void);
166 int stop_watchdog(void);