1 /* 2 * (c) Copyright 1992 by Panagiotis Tsirigotis 3 * (c) Sections Copyright 1998-2001 by Rob Braun 4 * All rights reserved. The file named COPYRIGHT specifies the terms 5 * and conditions for redistribution. 6 */ 7 8 #ifndef LOG_H 9 #define LOG_H 10 11 #include <sys/socket.h> 12 13 #include "defs.h" 14 #include "access.h" 15 16 /* 17 * $Id: log.h,v 1.2 2003-05-08 14:52:24 steveg Exp $ 18 */ 19 20 /* 21 * Meaning of logtype flags: 22 * 23 * L_NONE: no logging 24 * L_FILE: log output goes to a file 25 * L_SYSLOG: log output goes to syslog(3) 26 * L_COMMON_FILE: log output goes to the file specified in defaults 27 */ 28 typedef enum { L_NONE = 0, L_FILE, L_SYSLOG, L_COMMON_FILE } logtype_e ; 29 30 struct filelog 31 { 32 char *fl_filename ; /* always malloc'ed */ 33 unsigned fl_soft_limit ; 34 unsigned fl_hard_limit ; 35 } ; 36 37 #define FILELOG_SIZE_CONTROL( flp ) ( flp->fl_soft_limit != 0 ) 38 39 40 struct syslog 41 { 42 int sl_facility ; 43 int sl_level ; 44 } ; 45 46 struct log 47 { 48 logtype_e l_type ; 49 struct filelog l_fl ; 50 struct syslog l_sl ; 51 } ; 52 53 #define LOG_GET_TYPE( lp ) (lp)->l_type 54 #define LOG_SET_TYPE( lp, type ) (lp)->l_type = (type) 55 56 #define LOG_GET_FILELOG( lp ) (&(lp)->l_fl) 57 #define LOG_GET_SYSLOG( lp ) (&(lp)->l_sl) 58 59 const char *xaddrname(const union xsockaddr *inaddr); 60 uint16_t xaddrport(const union xsockaddr *inaddr); 61 void svc_log_success(struct service *sp, const connection_s *cp,pid_t pid); 62 void svc_log_failure(struct service *sp, const connection_s *cp,access_e access_failure); 63 void svc_log_exit(struct service *sp,const struct server *serp); 64 void svc_logprint(struct service *sp,const char *line_id,const char *fmt,...) 65 #ifdef __GNUC__ 66 __attribute__ ((format (printf, 3, 4))); 67 #else 68 ; 69 #endif 70 #endif /* LOG_H */ 71 72