2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1999 University of Maryland at College Park
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of U.M. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. U.M. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Authors: the Amanda Development Team. Its members are listed in a
24 * file named AUTHORS, in the root directory of this distribution.
27 * $Id: util.h,v 1.17 2006/07/26 15:17:36 martinea Exp $
35 #define BIGINT INT_MAX
37 #define BSTRNCMP(a,b) strncmp(a, b, strlen(b))
39 /* internal types and variables */
42 ssize_t fullread(int, void *, size_t);
43 ssize_t fullwrite(int, const void *, size_t);
45 int connect_portrange(struct sockaddr_storage *, in_port_t, in_port_t, char *,
46 struct sockaddr_storage *, int);
47 int bind_portrange(int, struct sockaddr_storage *, in_port_t, in_port_t,
50 char * construct_datestamp(time_t *t);
51 char * construct_timestamp(time_t *t);
53 /*@only@*//*@null@*/char *quote_string(const char *str);
54 /*@only@*//*@null@*/char *unquote_string(const char *str);
55 int needs_quotes(const char * str);
57 char * sanitize_string(const char *str);
58 char * strquotedstr(void);
59 ssize_t hexdump(const char *buffer, size_t bytes);
60 void dump_sockaddr(struct sockaddr_storage * sa);
61 char * str_sockaddr(struct sockaddr_storage *sa);
62 /* Compare two sockaddr_storage objects, optionally comparing
63 * only the address (and thus ignoring port, flow info, etc.).
64 * @returns: -1, 0, or 1 for <, ==, >, respectively
66 int cmp_sockaddr(struct sockaddr_storage *ss1,
67 struct sockaddr_storage *ss2,
69 int copy_file(char *dst, char *src, char **errmsg);
72 * validate_email return 0 if the following characters are present
73 * * ( ) < > [ ] , ; : ! $ \ / "
76 int validate_mailto(const char *mailto);
78 char *taperalgo2str(int taperalgo);