00001 /* 00002 * $Id: iniparser.h 4585 2008-08-06 08:20:30Z klaus_darilion $ 00003 * 00004 * Kamailio LDAP Module 00005 * 00006 * Copyright (C) 2007 University of North Carolina 00007 * 00008 * Original author: Christian Schlatter, cs@unc.edu 00009 * 00010 * 00011 * This file is part of Kamailio, a free SIP server. 00012 * 00013 * Kamailio is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation; either version 2 of the License, or 00016 * (at your option) any later version 00017 * 00018 * Kamailio is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program; if not, write to the Free Software 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 * 00027 * History: 00028 * -------- 00029 * 2007-02-18: Initial version 00030 */ 00031 00032 00033 /* 00034 Based upon libiniparser, by Nicolas Devillard 00035 Hacked into 1 file (m-iniparser) by Freek/2005 00036 Original terms following: 00037 00038 -- - 00039 00040 Copyright (c) 2000 by Nicolas Devillard (ndevilla AT free DOT fr). 00041 00042 Written by Nicolas Devillard. Not derived from licensed software. 00043 00044 Permission is granted to anyone to use this software for any 00045 purpose on any computer system, and to redistribute it freely, 00046 subject to the following restrictions: 00047 00048 1. The author is not responsible for the consequences of use of 00049 this software, no matter how awful, even if they arise 00050 from defects in it. 00051 00052 2. The origin of this software must not be misrepresented, either 00053 by explicit claim or by omission. 00054 00055 3. Altered versions must be plainly marked as such, and must not 00056 be misrepresented as being the original software. 00057 00058 4. This notice may not be removed or altered. 00059 00060 */ 00061 00062 00063 #ifndef _INIPARSER_H_ 00064 #define _INIPARSER_H_ 00065 #include <stdio.h> 00066 #include <stdlib.h> 00067 #include <string.h> 00068 #include <unistd.h> 00069 #include <ctype.h> 00070 00071 #ifdef __cplusplus 00072 extern "C" { 00073 #endif 00074 00075 00076 typedef struct _dictionary_ { 00077 /** Number of entries in dictionary */ 00078 int n; 00079 /** Storage size */ 00080 int size; 00081 /** List of string values */ 00082 char **val; 00083 /** List of string keys */ 00084 char **key ; 00085 /** List of hash values for keys */ 00086 unsigned *hash; 00087 } dictionary ; 00088 00089 00090 /* generated by genproto */ 00091 00092 dictionary * iniparser_new(char *ininame); 00093 void iniparser_free(dictionary * d); 00094 00095 int iniparser_getnsec(dictionary * d); 00096 char * iniparser_getsecname(dictionary * d, int n); 00097 void iniparser_dump(dictionary * d, FILE * f); 00098 void iniparser_dump_ini(dictionary * d, FILE * f); 00099 char * iniparser_getkey(dictionary *d, char *section, char *key); 00100 char * iniparser_getstr(dictionary * d, char * key); 00101 char * iniparser_getstring(dictionary * d, char * key, char * def); 00102 int iniparser_getint(dictionary * d, char * key, int notfound); 00103 double iniparser_getdouble(dictionary * d, char * key, double notfound); 00104 int iniparser_getboolean(dictionary * d, char * key, int notfound); 00105 int iniparser_find_entry(dictionary * ini, char * entry); 00106 int iniparser_setstr(dictionary * ini, char * entry, char * val); 00107 void iniparser_unset(dictionary * ini, char * entry); 00108 00109 #ifdef __cplusplus 00110 } 00111 #endif 00112 00113 #endif 00114
1.5.6