Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

utils.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- A telephony toolkit for Linux.
00003  *
00004  * Utility functions
00005  *
00006  * Copyright (C) 2004, Digium
00007  *
00008  * This program is free software, distributed under the terms of
00009  * the GNU General Public License
00010  */
00011 
00012 #ifndef _ASTERISK_UTIL_H
00013 #define _ASTERISK_UTIL_H
00014 
00015 #include <netinet/in.h>
00016 #include <netdb.h>
00017 #include <pthread.h>
00018 
00019 static inline int ast_strlen_zero(const char *s)
00020 {
00021    return (*s == '\0');
00022 }
00023 
00024 struct ast_hostent {
00025    struct hostent hp;
00026    char buf[1024];
00027 };
00028 
00029 extern struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp);
00030 extern int ast_base64encode(char *dst, unsigned char *src, int srclen, int max);
00031 extern int ast_base64decode(unsigned char *dst, char *src, int max);
00032 
00033 extern int test_for_thread_safety(void);
00034 extern const char *ast_inet_ntoa(char *buf, int bufsiz, struct in_addr ia);
00035 extern int ast_utils_init(void);
00036 
00037 #ifdef inet_ntoa
00038 #undef inet_ntoa
00039 #endif
00040 #define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
00041 
00042 #ifdef LINUX
00043 #define ast_pthread_create pthread_create
00044 #define ast_strcasestr strcasestr
00045 #else
00046 /* Linux threads have a default 2MB stack size. */
00047 #ifndef PTHREAD_ATTR_STACKSIZE
00048 #define  PTHREAD_ATTR_STACKSIZE     2097152
00049 #endif /* PTHREAD_ATTR_STACKSIZE */
00050 extern int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data);
00051 extern char *ast_strcasestr(const char *, const char *);
00052 #endif /* LINUX */
00053 
00054 
00055 #endif

Generated on Wed Mar 16 20:08:36 2005 for Asterisk by  doxygen 1.4.0