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, const char *src, int maxlen);
34 char *bstrncat (char *dest, const char *src, int maxlen);
35 void *b_malloc (char *file, int line, size_t size);
37 void *bmalloc (size_t size);
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 void drop (char *uid, char *gid);
50 int32_t bnet_recv (BSOCK *bsock);
51 int bnet_send (BSOCK *bsock);
52 int bnet_fsend (BSOCK *bs, char *fmt, ...);
53 int bnet_set_buffer_size (BSOCK *bs, uint32_t size, int rw);
54 int bnet_sig (BSOCK *bs, int sig);
55 BSOCK * bnet_connect (void *jcr, int retry_interval,
56 int max_retry_time, char *name, char *host, char *service,
57 int port, int verbose);
58 int bnet_wait_data (BSOCK *bsock, int sec);
59 void bnet_close (BSOCK *bsock);
60 BSOCK * init_bsock (void *jcr, int sockfd, char *who, char *ip, int port);
61 BSOCK * dup_bsock (BSOCK *bsock);
62 void term_bsock (BSOCK *bsock);
63 char * bnet_strerror (BSOCK *bsock);
64 char * bnet_sig_to_ascii (BSOCK *bsock);
65 int bnet_wait_data (BSOCK *bsock, int sec);
66 int bnet_despool (BSOCK *bsock);
67 int is_bnet_stop (BSOCK *bsock);
68 int is_bnet_error (BSOCK *bsock);
69 void bnet_suppress_error_messages(BSOCK *bsock, int flag);
73 int cram_md5_get_auth(BSOCK *bs, char *password);
74 int cram_md5_auth(BSOCK *bs, char *password);
75 void hmac_md5(uint8_t* text, int text_len, uint8_t* key,
76 int key_len, uint8_t *hmac);
79 uint32_t bcrc32(uint8_t *buf, int len);
85 uint64_t str_to_uint64(char *str);
86 int64_t str_to_int64(char *str);
87 char * edit_uint64_with_commas (uint64_t val, char *buf);
88 char * add_commas (char *val, char *buf);
89 char * edit_uint64 (uint64_t val, char *buf);
90 int duration_to_utime (char *str, utime_t *value);
91 int size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
92 char *edit_utime (utime_t val, char *buf);
93 int is_a_number (const char *num);
94 int is_an_integer (const char *n);
97 LEX * lex_close_file (LEX *lf);
98 LEX * lex_open_file (LEX *lf, char *fname, LEX_ERROR_HANDLER *scan_error);
99 int lex_get_char (LEX *lf);
100 void lex_unget_char (LEX *lf);
101 char * lex_tok_to_str (int token);
102 int lex_get_token (LEX *lf, int expect);
105 void my_name_is (int argc, char *argv[], char *name);
106 void init_msg (void *jcr, MSGS *msg);
107 void term_msg (void);
108 void close_msg (void *jcr);
109 void add_msg_dest (MSGS *msg, int dest, int type, char *where, char *dest_code);
110 void rem_msg_dest (MSGS *msg, int dest, int type, char *where);
111 void Jmsg (void *jcr, int type, int level, char *fmt, ...);
112 void dispatch_message (void *jcr, int type, int level, char *buf);
113 void init_console_msg (char *wd);
114 void free_msgs_res (MSGS *msgs);
115 int open_spool_file (void *jcr, BSOCK *bs);
116 int close_spool_file (void *vjcr, BSOCK *bs);
120 void bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq,
121 void *handle_client_request(void *bsock));
122 void bnet_server (int port, void handle_client_request(BSOCK *bsock));
123 int net_connect (int port);
124 BSOCK * bnet_bind (int port);
125 BSOCK * bnet_accept (BSOCK *bsock, char *who);
128 void init_signals (void terminate(int sig));
129 void init_stack_dump (void);
132 void lcase (char *str);
133 void bash_spaces (char *str);
134 void unbash_spaces (char *str);
135 void strip_trailing_junk (char *str);
136 void strip_trailing_slashes (char *dir);
137 int skip_spaces (char **msg);
138 int skip_nonspaces (char **msg);
139 int fstrsch (char *a, char *b);
140 char * encode_time (time_t time, char *buf);
141 char * encode_mode (mode_t mode, char *buf);
142 int do_shell_expansion (char *name);
143 int is_buf_zero (char *buf, int len);
144 void jobstatus_to_ascii (int JobStatus, char *msg, int maxlen);
145 void pm_strcat (POOLMEM **pm, char *str);
146 void pm_strcpy (POOLMEM **pm, char *str);
147 int run_program (char *prog, int wait, POOLMEM *results);
148 char * job_type_to_str (int type);
149 char * job_status_to_str (int stat);
150 char * job_level_to_str (int level);
151 void makeSessionKey (char *key, char *seed, int mode);
152 BPIPE * open_bpipe(char *prog, int wait, char *mode);
153 int close_wpipe(BPIPE *bpipe);
154 int close_bpipe(BPIPE *bpipe);
155 POOLMEM *edit_job_codes(void *jcr, char *omsg, char *imsg, char *to);
156 void parse_command_args(POOLMEM *cmd, POOLMEM *args, int *argc,
157 char **argk, char **argv);
158 char *next_arg(char **s);
162 int start_watchdog(void);
163 int stop_watchdog(void);
164 btimer_t *start_child_timer(pid_t pid, uint32_t wait);
165 void stop_child_timer(btimer_id wid);
166 btimer_id start_thread_timer(pthread_t tid, uint32_t wait);
167 void stop_thread_timer(btimer_id wid);