Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

util.h

Go to the documentation of this file.
00001 
00002 /*
00003 ** Copyright (C) 2005 Russell Leighton
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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;             /* how big? */
00049 
00050   u_int32_t max_cache_size;       /* how many objects is max in cache...0 means unlimited */
00051 
00052   u_int32_t cache_list_len;       /* how many objects in cache */
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
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)