include/shared.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  * SHARED.H - Include file for shared functions and structs
00004  *
00005  * Copyright (c) 2010-2011 Nagios Core Development Team and Community Contributors
00006  * Copyright (c) 2010-2011 Icinga Development Team (http://www.icinga.org)
00007  *
00008  * License:
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License version 2 as
00012  * published by the Free Software Foundation.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00022  *
00023  *****************************************************************************/
00024 
00025 
00026 #ifndef INCLUDE__shared_h__
00027 #define INCLUDE__shared_h__
00028 
00029 #include <time.h>
00030 /* mmapfile structure - used for reading files via mmap() */
00031 typedef struct mmapfile_struct {
00032         char *path;
00033         int mode;
00034         int fd;
00035         unsigned long file_size;
00036         unsigned long current_position;
00037         unsigned long current_line;
00038         void *mmap_buf;
00039 } mmapfile;
00040 
00041 /* only usable on compile-time initialized arrays, for obvious reasons */
00042 #define ARRAY_SIZE(ary) (sizeof(ary) / sizeof(ary[0]))
00043 
00044 extern char *my_strtok(char *buffer, char *tokens);
00045 extern char *my_strsep(char **stringp, const char *delim);
00046 extern mmapfile *mmap_fopen(char *filename);
00047 extern int mmap_fclose(mmapfile *temp_mmapfile);
00048 extern char *mmap_fgets(mmapfile *temp_mmapfile);
00049 extern char *mmap_fgets_multiline(mmapfile * temp_mmapfile);
00050 extern void strip(char *buffer);
00051 extern int hashfunc(const char *name1, const char *name2, int hashslots);
00052 extern int compare_hashdata(const char *val1a, const char *val1b, const char *val2a,
00053                             const char *val2b);
00054 extern void get_datetime_string(time_t *raw_time, char *buffer,
00055                                 int buffer_length, int type);
00056 extern void get_time_breakdown(unsigned long raw_time, int *days, int *hours,
00057                                    int *minutes, int *seconds);
00058 #endif
00059 

Generated on Wed Mar 30 17:22:22 2011 for icinga-core by  doxygen 1.4.7