00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __AWUTIL__
00024 #define __AWUTIL__
00025
00026 #include "sys.h"
00027 #include "sysnet.h"
00028
00046 typedef struct {
00047
00048 size_t object_size;
00049
00050 u_int32_t max_cache_size;
00051
00052 u_int32_t cache_list_len;
00053
00054 void * cache_list;
00055
00056 } aw_cache_allocator_t;
00057
00062 int32_t aw_get_major_version(void);
00063
00068 int32_t aw_get_minor_version(void);
00069
00074 int32_t aw_get_patchlevel(void);
00075
00080 const byte_t *aw_get_version_string(void);
00081
00088 int32_t aw_nanosleep(const struct timespec *sleep);
00089
00098 ssize_t aw_write_resume(int fd, const void *buf, size_t count);
00099
00108 ssize_t aw_read_resume(int fd, void *buf, size_t count);
00109
00118 off_t aw_lseek_resume(int fildes, off_t offset, int whence);
00119
00127 byte_t *aw_strstrcase(const byte_t *haystack, const byte_t *needle);
00128
00136 byte_t *aw_strcatdup(const byte_t *s1, const byte_t *s2);
00137
00144 byte_t *aw_strtrim(byte_t *s);
00145
00152 in_addr_t aw_getifip(const byte_t *ifname);
00153
00162 int32_t aw_cache_alloc_init(aw_cache_allocator_t *allocator, size_t object_size, u_int32_t max_cache_size);
00163
00164
00171 int32_t aw_cache_alloc_clear(aw_cache_allocator_t *allocator);
00172
00179 void * aw_cache_alloc_malloc(aw_cache_allocator_t *allocator);
00180
00188 int32_t aw_cache_alloc_free(aw_cache_allocator_t *allocator, void *object);
00189
00196 void *aw_malloc(size_t size);
00197
00204 void *aw_zalloc(size_t size);
00205
00211 void aw_free(void *p);
00212
00219 int32_t aw_close_tcpsocket(int32_t s);
00220
00225 void aw_close_all_fds(void);
00226
00227
00233 byte_t *aw_find_in_path(const byte_t *filename, const byte_t *pathvar);
00234
00235 #endif