1/** 2 * @file io.h Common NDO I/O functions 3 */ 4/* 5 * Copyright 2009-2014 Nagios Core Development Team and Community Contributors 6 * Copyright 2005-2009 Ethan Galstad 7 * 8 * This file is part of NDOUtils. 9 * 10 * NDOUtils is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License version 2 as 12 * published by the Free Software Foundation. 13 * 14 * NDOUtils is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with NDOUtils. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23#ifndef NDO_IO_H_INCLUDED 24#define NDO_IO_H_INCLUDED 25 26#include "config.h" 27 28 29#define NDO_SINK_FILE 0 30#define NDO_SINK_FD 1 31#define NDO_SINK_UNIXSOCKET 2 32#define NDO_SINK_TCPSOCKET 3 33 34#define NDO_DEFAULT_TCP_PORT @ndo2db_port@ /* default port to use */ 35 36 37/* MMAPFILE structure - used for reading files via mmap() */ 38typedef struct ndo_mmapfile_struct{ 39 char *path; 40 int mode; 41 int fd; 42 unsigned long file_size; 43 unsigned long current_position; 44 unsigned long current_line; 45 void *mmap_buf; 46 }ndo_mmapfile; 47 48 49ndo_mmapfile *ndo_mmap_fopen(char *); 50int ndo_mmap_fclose(ndo_mmapfile *); 51char *ndo_mmap_fgets(ndo_mmapfile *); 52 53int ndo_sink_open(char *,int,int,int,int,int *); 54int ndo_sink_write(int,char *,int); 55int ndo_sink_write_newline(int); 56int ndo_sink_flush(int); 57int ndo_sink_close(int); 58int ndo_inet_aton(register const char *,struct in_addr *); 59 60void ndo_strip_buffer(char *); 61char *ndo_escape_buffer(char *); 62char *ndo_unescape_buffer(char *); 63 64#endif 65