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