2 * Prototypes for lib directory of Bacula
7 Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
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.
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.
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,
27 void base64_init (void);
28 int to_base64 (intmax_t value, char *where);
29 int from_base64 (intmax_t *value, char *where);
30 int bin_to_base64 (char *buf, char *bin, int len);
33 char *bstrncpy (char *dest, char *src, int maxlen);
34 void *b_malloc (char *file, int line, size_t size);
36 void *bmalloc (size_t size);
38 void *brealloc (void *buf, size_t size);
39 void *bcalloc (size_t size1, size_t size2);
40 int bsnprintf (char *str, size_t size, const char *format, ...);
41 int bvsnprintf (char *str, size_t size, const char *format, va_list ap);
42 int pool_sprintf (char *pool_buf, char *fmt, ...);
43 void create_pid_file (char *dir, char *progname, int port);
44 int delete_pid_file (char *dir, char *progname, int port);
48 int32_t bnet_recv (BSOCK *bsock);
49 int bnet_send (BSOCK *bsock);
50 int bnet_fsend (BSOCK *bs, char *fmt, ...);
51 int bnet_set_buffer_size (BSOCK *bs, uint32_t size, int rw);
52 int bnet_sig (BSOCK *bs, int sig);
53 BSOCK * bnet_connect (void *jcr, int retry_interval,
54 int max_retry_time, char *name, char *host, char *service,
55 int port, int verbose);
56 int bnet_wait_data (BSOCK *bsock, int sec);
57 void bnet_close (BSOCK *bsock);
58 BSOCK * init_bsock (void *jcr, int sockfd, char *who, char *ip, int port);
59 BSOCK * dup_bsock (BSOCK *bsock);
60 void term_bsock (BSOCK *bsock);
61 char * bnet_strerror (BSOCK *bsock);
62 char * bnet_sig_to_ascii (BSOCK *bsock);
63 int bnet_wait_data (BSOCK *bsock, int sec);
64 int bnet_despool (BSOCK *bsock);
68 int cram_md5_get_auth(BSOCK *bs, char *password);
69 int cram_md5_auth(BSOCK *bs, char *password);
70 void hmac_md5(uint8_t* text, int text_len, uint8_t* key,
71 int key_len, uint8_t *hmac);
74 uint32_t bcrc32(uint8_t *buf, int len);
80 LEX * lex_close_file (LEX *lf);
81 LEX * lex_open_file (LEX *lf, char *fname, LEX_ERROR_HANDLER *scan_error);
82 int lex_get_char (LEX *lf);
83 void lex_unget_char (LEX *lf);
84 char * lex_tok_to_str (int token);
85 int lex_get_token (LEX *lf, int expect);
88 void my_name_is (int argc, char *argv[], char *name);
89 void init_msg (void *jcr, MSGS *msg);
91 void close_msg (void *jcr);
92 void add_msg_dest (MSGS *msg, int dest, int type, char *where, char *dest_code);
93 void rem_msg_dest (MSGS *msg, int dest, int type, char *where);
94 void Jmsg (void *jcr, int type, int level, char *fmt, ...);
95 void dispatch_message (void *jcr, int type, int level, char *buf);
96 void init_console_msg (char *wd);
97 void free_msgs_res (MSGS *msgs);
98 int open_spool_file (void *jcr, BSOCK *bs);
99 int close_spool_file (void *vjcr, BSOCK *bs);
103 void bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq,
104 void handle_client_request(void *bsock));
105 void bnet_server (int port, void handle_client_request(BSOCK *bsock));
106 int net_connect (int port);
107 BSOCK * bnet_bind (int port);
108 BSOCK * bnet_accept (BSOCK *bsock, char *who);
111 void init_signals (void terminate(int sig));
112 void init_stack_dump (void);
115 void lcase (char *str);
116 void bash_spaces (char *str);
117 void unbash_spaces (char *str);
118 void strip_trailing_junk (char *str);
119 void strip_trailing_slashes (char *dir);
120 int skip_spaces (char **msg);
121 int skip_nonspaces (char **msg);
122 int fstrsch (char *a, char *b);
123 char * encode_time (time_t time, char *buf);
124 char * encode_mode (mode_t mode, char *buf);
125 char * edit_uint64_with_commas (uint64_t val, char *buf);
126 char * add_commas (char *val, char *buf);
127 char * edit_uint64 (uint64_t val, char *buf);
128 int do_shell_expansion (char *name);
129 int is_a_number (const char *num);
130 int is_buf_zero (char *buf, int len);
131 int string_to_btime (char *str, btime_t *value);
132 char *edit_btime (btime_t val, char *buf);
133 void jobstatus_to_ascii (int JobStatus, char *msg, int maxlen);
134 void pm_strcat (POOLMEM **pm, char *str);
135 void pm_strcpy (POOLMEM **pm, char *str);
136 int run_program (char *prog, int wait, POOLMEM *results);
137 char * job_type_to_str (int type);
138 char * job_status_to_str (int stat);
139 char * job_level_to_str (int level);
140 void makeSessionKey (char *key, char *seed, int mode);
145 int start_watchdog(void);
146 int stop_watchdog(void);