2004-05-03 04:31:11 +00:00
|
|
|
/*
|
|
|
|
|
* Asterisk -- A telephony toolkit for Linux.
|
|
|
|
|
*
|
|
|
|
|
* Utility functions
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2004, Digium
|
|
|
|
|
*
|
|
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
|
* the GNU General Public License
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _ASTERISK_UTIL_H
|
|
|
|
|
#define _ASTERISK_UTIL_H
|
|
|
|
|
|
2004-08-08 17:15:02 +00:00
|
|
|
#include <netinet/in.h>
|
2004-05-09 08:22:15 +00:00
|
|
|
#include <netdb.h>
|
2004-08-08 17:15:02 +00:00
|
|
|
#include <pthread.h>
|
2004-05-09 08:22:15 +00:00
|
|
|
|
2004-05-03 04:31:11 +00:00
|
|
|
static inline int ast_strlen_zero(const char *s)
|
|
|
|
|
{
|
|
|
|
|
return (*s == '\0');
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-09 08:22:15 +00:00
|
|
|
struct ast_hostent {
|
|
|
|
|
struct hostent hp;
|
|
|
|
|
char buf[1024];
|
|
|
|
|
};
|
|
|
|
|
|
2004-10-05 06:46:11 +00:00
|
|
|
|
|
|
|
|
extern char *ast_strip(char *buf);
|
2004-05-09 08:22:15 +00:00
|
|
|
extern struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp);
|
2004-06-25 03:59:07 +00:00
|
|
|
extern int ast_base64encode(char *dst, unsigned char *src, int srclen, int max);
|
|
|
|
|
extern int ast_base64decode(unsigned char *dst, char *src, int max);
|
2004-05-09 08:22:15 +00:00
|
|
|
|
2004-06-22 17:42:14 +00:00
|
|
|
extern int test_for_thread_safety(void);
|
2004-06-29 12:56:46 +00:00
|
|
|
extern const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia);
|
2004-06-25 03:59:07 +00:00
|
|
|
extern int ast_utils_init(void);
|
2004-06-22 17:42:14 +00:00
|
|
|
|
2004-06-29 17:54:25 +00:00
|
|
|
#ifdef inet_ntoa
|
|
|
|
|
#undef inet_ntoa
|
|
|
|
|
#endif
|
2004-06-29 12:56:46 +00:00
|
|
|
#define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
|
|
|
|
|
|
2004-08-08 17:15:02 +00:00
|
|
|
#ifdef LINUX
|
|
|
|
|
#define ast_pthread_create pthread_create
|
2004-08-27 04:21:09 +00:00
|
|
|
#define ast_strcasestr strcasestr
|
2004-08-08 17:15:02 +00:00
|
|
|
#else
|
|
|
|
|
/* Linux threads have a default 2MB stack size. */
|
|
|
|
|
#ifndef PTHREAD_ATTR_STACKSIZE
|
|
|
|
|
#define PTHREAD_ATTR_STACKSIZE 2097152
|
|
|
|
|
#endif /* PTHREAD_ATTR_STACKSIZE */
|
|
|
|
|
extern int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data);
|
|
|
|
|
#endif /* LINUX */
|
|
|
|
|
|
2004-08-27 04:21:09 +00:00
|
|
|
extern char *ast_strcasestr(const char *, const char *);
|
|
|
|
|
|
2004-05-03 04:31:11 +00:00
|
|
|
#endif
|