Blame include/util.h

Packit 762fc5
/* aide, Advanced Intrusion Detection Environment
Packit 762fc5
 *
Packit 762fc5
 * Copyright (C) 1999-2002,2006,2013 Rami Lehti, Pablo Virolainen, Richard
Packit 762fc5
 * van den Berg, Hannes von Haugwitz
Packit 762fc5
 * $Header$
Packit 762fc5
 *
Packit 762fc5
 * This program is free software; you can redistribute it and/or
Packit 762fc5
 * modify it under the terms of the GNU General Public License as
Packit 762fc5
 * published by the Free Software Foundation; either version 2 of the
Packit 762fc5
 * License, or (at your option) any later version.
Packit 762fc5
 *
Packit 762fc5
 * This program is distributed in the hope that it will be useful, but
Packit 762fc5
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 762fc5
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit 762fc5
 * General Public License for more details.
Packit 762fc5
 *
Packit 762fc5
 * You should have received a copy of the GNU General Public License
Packit 762fc5
 * along with this program; if not, write to the Free Software
Packit 762fc5
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Packit 762fc5
 */
Packit 762fc5
Packit 762fc5
#ifndef _UTIL_H_INCLUDED
Packit 762fc5
#define _UTIL_H_INCLUDED
Packit 762fc5
#include <string.h>
Packit 762fc5
#include <sys/types.h>
Packit 762fc5
#include "db_config.h"
Packit 762fc5
Packit 762fc5
#define HEXD2ASC(x) (((x) < 10) ? ((x) + '0') : ((x) - 10 + 'A'))
Packit 762fc5
Packit 762fc5
#define ASC2HEXD(x) (((x) >= '0' && (x) <= '9') ?               \
Packit 762fc5
                     ((x) - '0') : (toupper(x) - 'A' + 10))
Packit 762fc5
Packit 762fc5
#define ISXDIGIT(x) isxdigit ((unsigned char)(x))
Packit 762fc5
Packit 762fc5
#define CLEANDUP(x) (contains_unsafe (x) ? encode_string (x) : strdup (x))
Packit 762fc5
Packit 762fc5
#ifndef HAVE_STRICMP
Packit 762fc5
#  define stricmp(a,b)   strcasecmp( (a), (b) )
Packit 762fc5
#endif
Packit 762fc5
Packit 762fc5
int cmpurl(url_t*, url_t*);
Packit 762fc5
Packit 762fc5
url_t* parse_url(char*);
Packit 762fc5
Packit 762fc5
int contains_unsafe(const char*);
Packit 762fc5
Packit 762fc5
void decode_string(char*);
Packit 762fc5
Packit 762fc5
char* encode_string(const char*);
Packit 762fc5
Packit 762fc5
char* perm_to_char(mode_t perm);
Packit 762fc5
Packit 762fc5
void sig_handler(int signal);
Packit 762fc5
Packit 762fc5
void init_sighandler(void);
Packit 762fc5
Packit 762fc5
char *expand_tilde(char * path);
Packit 762fc5
Packit 762fc5
#ifndef HAVE_STRNSTR
Packit 762fc5
char* strnstr(char* haystack,char* needle,int n);
Packit 762fc5
#endif
Packit 762fc5
Packit 762fc5
#ifndef HAVE_STRNLEN
Packit 762fc5
size_t strnlen(const char *s, size_t maxlen);
Packit 762fc5
#endif
Packit 762fc5
Packit 762fc5
int syslog_facility_lookup(char *);
Packit 762fc5
Packit 762fc5
#endif