utils.h

Go to the documentation of this file.
00001 /* * 
00002  * This file is part of libnemesi
00003  *
00004  * Copyright (C) 2007 by LScube team <team@streaming.polito.it>
00005  * See AUTHORS for more details
00006  * 
00007  * libnemesi is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * libnemesi is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with libnemesi; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  *  
00021  * */
00022 
00029 #ifndef NEMESI_UTILS_H
00030 #define NEMESI_UTILS_H
00031 
00032 #ifdef HAVE_CONFIG_H
00033 #include <config.h>
00034 #endif
00035 
00036 #include <stdio.h>
00037 #include <stdlib.h>
00038 #include <string.h>
00039 #include <errno.h>
00040 #include <ctype.h>
00041 #include <inttypes.h>
00042 #include <stdint.h>
00043 
00044 #include <pthread.h>
00045 
00046 #ifndef WIN32
00047 #       include <sys/types.h>
00048 #       include <sys/time.h>
00049 #       define min(x,y) ((x) < (y) ? (x) : (y))
00050 #       define max(x,y) ((x) > (y) ? (x) : (y))
00051 #else
00052 #       include <winsock2.h>
00053 char * strtok_r(char * str, const char *delim, char **saveptr);
00054 #endif
00055 
00056 #include "comm.h"
00057 
00058 int urltokenize(char *, char **, char **, char **);
00059 
00060 char *strstrcase(char *, const char *);
00061 
00062 uint32_t random32(int);
00063 
00064 int thread_isvalid(pthread_t p);
00065 void thread_invalidate(pthread_t * p);
00066 int thread_getuid(pthread_t p);
00067 
00073 int nms_timeval_subtract(struct timeval *, const struct timeval *,
00074              const struct timeval *);
00075 int nms_timeval_add(struct timeval *, const struct timeval *, const struct timeval *);
00076 void f2time(double, struct timeval *);
00081 #endif /* NEMESI_UTILS_H */

Generated on Tue Feb 3 03:10:02 2009 for libnemesi by  doxygen 1.5.4