2000-01-22 12:49:49 +00:00
|
|
|
/* GSWUtil.h - GSWeb: Adaptors: Util
|
2003-02-28 18:37:43 +00:00
|
|
|
Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
Written by: Manuel Guesdon <mguesdon@sbuilders.com>
|
2003-02-28 18:37:43 +00:00
|
|
|
Date: July 1999
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GSWUtil_h__
|
|
|
|
#define _GSWUtil_h__
|
|
|
|
|
|
|
|
#ifndef BOOL
|
|
|
|
typedef int BOOL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
|
|
|
#define TRUE (!FALSE)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(Apache)
|
|
|
|
#include "httpd.h"
|
2000-03-16 16:16:49 +00:00
|
|
|
#include "http_log.h"
|
|
|
|
//#define APLOG_EMERG LOG_EMERG /* system is unusable */
|
|
|
|
//#define APLOG_ALERT LOG_ALERT /* action must be taken immediately */
|
|
|
|
#define GSW_CRITICAL APLOG_CRIT /* critical conditions */
|
|
|
|
#define GSW_ERROR APLOG_ERR /* error conditions */
|
|
|
|
#define GSW_WARNING APLOG_WARNING /* warning conditions */
|
|
|
|
//#define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */
|
|
|
|
#define GSW_INFO APLOG_INFO /* informational */
|
|
|
|
#define GSW_DEBUG APLOG_DEBUG /* debug-level messages */
|
|
|
|
#else
|
|
|
|
#define GSW_DEBUG 0
|
|
|
|
#define GSW_INFO 1
|
|
|
|
#define GSW_WARNING 2
|
|
|
|
#define GSW_ERROR 3
|
|
|
|
#define GSW_CRITICAL 4
|
2000-01-22 12:49:49 +00:00
|
|
|
#endif
|
|
|
|
|
2000-03-16 16:16:49 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
|
|
#define min(x, y) ((x) < (y) ? (x) : (y))
|
2000-03-16 16:16:49 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
void GSWLog(int p_iLevel,
|
|
|
|
#if defined(Apache)
|
2003-02-28 18:37:43 +00:00
|
|
|
server_rec *p_pLogServerData,
|
2000-01-22 12:49:49 +00:00
|
|
|
#else
|
2003-02-28 18:37:43 +00:00
|
|
|
void *p_pLogServerData,
|
2000-01-22 12:49:49 +00:00
|
|
|
#endif
|
2003-02-28 18:37:43 +00:00
|
|
|
CONST char *p_pszFormat, ...);
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2000-03-16 16:16:49 +00:00
|
|
|
void GSWLogSized(int p_iLevel,
|
|
|
|
#if defined(Apache)
|
2003-02-28 18:37:43 +00:00
|
|
|
server_rec *p_pLogServerData,
|
2000-03-16 16:16:49 +00:00
|
|
|
#else
|
2003-02-28 18:37:43 +00:00
|
|
|
void *p_pLogServerData,
|
2000-03-16 16:16:49 +00:00
|
|
|
#endif
|
|
|
|
int p_iBufferSize,
|
|
|
|
CONST char *p_pszFormat, ...);
|
|
|
|
|
2003-02-28 18:37:43 +00:00
|
|
|
void GSWLogIntern(char *file,
|
|
|
|
int line,
|
|
|
|
char *fn,
|
|
|
|
int p_iLevel,
|
2000-01-22 12:49:49 +00:00
|
|
|
#if defined(Apache)
|
2003-02-28 18:37:43 +00:00
|
|
|
server_rec *p_pLogServerData,
|
2000-01-22 12:49:49 +00:00
|
|
|
#else
|
2003-02-28 18:37:43 +00:00
|
|
|
void *p_pLogServerData,
|
2000-01-22 12:49:49 +00:00
|
|
|
#endif
|
2003-02-28 18:37:43 +00:00
|
|
|
CONST char *p_pszFormat, ...);
|
2000-03-16 16:16:49 +00:00
|
|
|
|
|
|
|
|
2003-02-28 18:37:43 +00:00
|
|
|
void GSWLogSizedIntern(char *file,
|
|
|
|
int line,
|
|
|
|
char *fn,
|
|
|
|
int p_iLevel,
|
2000-03-16 16:16:49 +00:00
|
|
|
#if defined(Apache)
|
2003-02-28 18:37:43 +00:00
|
|
|
server_rec *p_pLogServerData,
|
2000-03-16 16:16:49 +00:00
|
|
|
#else
|
2003-02-28 18:37:43 +00:00
|
|
|
void *p_pLogServerData,
|
2000-03-16 16:16:49 +00:00
|
|
|
#endif
|
2003-02-28 18:37:43 +00:00
|
|
|
int p_iBufferSize,
|
|
|
|
CONST char *p_pszFormat, ...);
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
// return new len
|
2003-02-28 18:37:43 +00:00
|
|
|
int DeleteTrailingCRNL(char *p_pszString);
|
|
|
|
int DeleteTrailingSlash(char *p_pszString);
|
|
|
|
int DeleteTrailingSpaces(char *p_pszString);
|
2000-03-16 16:16:49 +00:00
|
|
|
|
2003-02-28 18:37:43 +00:00
|
|
|
int SafeStrlen(CONST char *p_pszString);
|
|
|
|
char *SafeStrdup(CONST char *p_pszString);
|
|
|
|
char *strcasestr(CONST char *p_pszString, CONST char *p_pszSearchedString);
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
//#include <netdb.h>
|
2003-02-28 18:37:43 +00:00
|
|
|
typedef struct hostent *PSTHostent;
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-02-28 18:37:43 +00:00
|
|
|
PSTHostent GSWUtil_HostLookup(CONST char *p_pszHost, void *p_pLogServerData);
|
2000-01-22 12:49:49 +00:00
|
|
|
void GSWUtil_ClearHostCache();
|
2003-02-28 18:37:43 +00:00
|
|
|
PSTHostent GSWUtil_FindHost(CONST char *p_pszHost, void *p_pLogServerData);
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
#include "GSWDict.h"
|
|
|
|
|
2003-02-28 18:37:43 +00:00
|
|
|
void GSWLog_Init(GSWDict *p_pDict, int p_iLevel);
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-04-09 17:12:00 +00:00
|
|
|
char* RevisionStringToRevisionValue(char* buffer,const char* revisionString);
|
|
|
|
|
2003-04-05 15:16:56 +00:00
|
|
|
#ifdef Apache2
|
|
|
|
void FormatAPRTime(char *date_str, apr_time_t t); // 2003/04/05 10:12:25.123
|
|
|
|
#endif
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
|
|
|
#endif // _GSWUtil_h__
|