2004-01-28 20:02:12 -05:00
|
|
|
/* Icecast
|
|
|
|
*
|
|
|
|
* This program is distributed under the GNU General Public License, version 2.
|
|
|
|
* A copy of this license is included with this source.
|
|
|
|
*
|
|
|
|
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
|
|
|
* Michael Smith <msmith@xiph.org>,
|
|
|
|
* oddsock <oddsock@xiph.org>,
|
|
|
|
* Karl Heyes <karl@xiph.org>
|
|
|
|
* and others (see AUTHORS for details).
|
|
|
|
*/
|
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
#ifndef __UTIL_H__
|
|
|
|
#define __UTIL_H__
|
|
|
|
|
2002-08-09 02:52:07 -04:00
|
|
|
#define XSLT_CONTENT 1
|
|
|
|
#define HTML_CONTENT 2
|
|
|
|
|
2004-11-11 10:47:33 -05:00
|
|
|
#define READ_ENTIRE_HEADER 1
|
|
|
|
#define READ_LINE 0
|
|
|
|
|
2002-07-24 10:52:28 -04:00
|
|
|
int util_timed_wait_for_fd(int fd, int timeout);
|
2004-11-11 10:47:33 -05:00
|
|
|
int util_read_header(int sock, char *buff, unsigned long len, int entire);
|
2007-08-16 18:49:13 -04:00
|
|
|
int util_check_valid_extension(const char *uri);
|
2005-05-09 20:28:37 -04:00
|
|
|
char *util_get_extension(const char *path);
|
2002-08-11 10:00:56 -04:00
|
|
|
char *util_get_path_from_uri(char *uri);
|
2005-05-09 20:28:37 -04:00
|
|
|
char *util_get_path_from_normalised_uri(const char *uri);
|
2007-08-16 18:49:13 -04:00
|
|
|
char *util_normalise_uri(const char *uri);
|
|
|
|
char *util_base64_encode(const char *data);
|
|
|
|
char *util_base64_decode(const char *input);
|
2004-01-14 20:01:09 -05:00
|
|
|
char *util_bin_to_hex(unsigned char *data, int len);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2007-08-16 18:49:13 -04:00
|
|
|
char *util_url_unescape(const char *src);
|
|
|
|
char *util_url_escape(const char *src);
|
2002-12-31 01:28:39 -05:00
|
|
|
|
2003-02-26 18:52:23 -05:00
|
|
|
/* String dictionary type, without support for NULL keys, or multiple
|
|
|
|
* instances of the same key */
|
|
|
|
typedef struct _util_dict {
|
|
|
|
char *key;
|
|
|
|
char *val;
|
|
|
|
struct _util_dict *next;
|
|
|
|
} util_dict;
|
|
|
|
|
|
|
|
util_dict *util_dict_new(void);
|
|
|
|
void util_dict_free(util_dict *dict);
|
|
|
|
/* dict, key must not be NULL. */
|
|
|
|
int util_dict_set(util_dict *dict, const char *key, const char *val);
|
|
|
|
const char *util_dict_get(util_dict *dict, const char *key);
|
|
|
|
char *util_dict_urlencode(util_dict *dict, char delim);
|
2004-01-26 16:49:07 -05:00
|
|
|
|
|
|
|
#ifndef HAVE_LOCALTIME_R
|
|
|
|
struct tm *localtime_r (const time_t *timep, struct tm *result);
|
|
|
|
#endif
|
2007-08-30 19:36:19 -04:00
|
|
|
char *util_conv_string (const char *string, const char *in_charset, const char *out_charset);
|
2004-01-26 16:49:07 -05:00
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
#endif /* __UTIL_H__ */
|