Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/syslogd/syslogd.h
| Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
| * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
| * SUCH DAMAGE. | * SUCH DAMAGE. | ||||
| */ | */ | ||||
| #ifndef _SYSLOGD_H_ | #ifndef _SYSLOGD_H_ | ||||
| #define _SYSLOGD_H_ | #define _SYSLOGD_H_ | ||||
| #include <sys/param.h> | #include <sys/param.h> | ||||
| #include <sys/nv.h> | |||||
| #include <sys/queue.h> | #include <sys/queue.h> | ||||
| #include <sys/time.h> | #include <sys/time.h> | ||||
| #define SYSLOG_NAMES | #define SYSLOG_NAMES | ||||
| #include <sys/syslog.h> | #include <sys/syslog.h> | ||||
| #include <regex.h> | #include <regex.h> | ||||
| #include <stdbool.h> | |||||
| #include <stdio.h> | |||||
| #define MAXLINE 8192 /* maximum line length */ | #define MAXLINE 8192 /* maximum line length */ | ||||
| #define MAXSVLINE MAXLINE /* maximum saved line length */ | #define MAXSVLINE MAXLINE /* maximum saved line length */ | ||||
| #define MAXUNAMES 20 /* maximum number of user names */ | #define MAXUNAMES 20 /* maximum number of user names */ | ||||
| /* Timestamps of log entries. */ | /* Timestamps of log entries. */ | ||||
| struct logtime { | struct logtime { | ||||
| struct tm tm; | struct tm tm; | ||||
| Show All 20 Lines | |||||
| struct prop_filter { | struct prop_filter { | ||||
| enum filt_proptype prop_type; | enum filt_proptype prop_type; | ||||
| enum filt_cmptype cmp_type; | enum filt_cmptype cmp_type; | ||||
| uint8_t cmp_flags; | uint8_t cmp_flags; | ||||
| #define FILT_FLAG_EXCLUDE (1 << 0) | #define FILT_FLAG_EXCLUDE (1 << 0) | ||||
| #define FILT_FLAG_EXTENDED (1 << 1) | #define FILT_FLAG_EXTENDED (1 << 1) | ||||
| #define FILT_FLAG_ICASE (1 << 2) | #define FILT_FLAG_ICASE (1 << 2) | ||||
| char *pflt_strval; | char *pflt_strval; | ||||
| size_t pflt_strlen; | |||||
| regex_t *pflt_re; | regex_t *pflt_re; | ||||
| }; | }; | ||||
| enum f_type { | enum f_type { | ||||
| F_UNUSED, /* unused entry */ | F_UNUSED, /* unused entry */ | ||||
| F_FILE, /* regular file */ | F_FILE, /* regular file */ | ||||
| F_TTY, /* terminal */ | F_TTY, /* terminal */ | ||||
| F_CONSOLE, /* console terminal */ | F_CONSOLE, /* console terminal */ | ||||
| F_FORW, /* remote machine */ | F_FORW, /* remote machine */ | ||||
| F_USERS, /* list of users */ | F_USERS, /* list of users */ | ||||
| F_WALL, /* everyone logged on */ | F_WALL, /* everyone logged on */ | ||||
| F_PIPE, /* pipe to program */ | F_PIPE, /* pipe to program */ | ||||
| }; | }; | ||||
| /* | /* | ||||
| * This structure represents the files that will have log | * This structure represents the files that will have log | ||||
| * copies printed. | * copies printed. | ||||
| * We require f_file to be valid if f_type is F_FILE, F_CONSOLE, F_TTY | * We require f_file to be valid if f_type is F_FILE, F_CONSOLE, F_TTY | ||||
| * or if f_type is F_PIPE and f_pid > 0. | * or if f_type is F_PIPE and f_pid > 0. | ||||
| */ | */ | ||||
| struct filed { | struct filed { | ||||
| enum f_type f_type; | enum f_type f_type; | ||||
| /* Used for filtering. */ | /* Used for filtering. */ | ||||
| char *f_host; /* host from which to recd. */ | char f_host[MAXHOSTNAMELEN]; /* host from which to recd. */ | ||||
| char *f_program; /* program this applies to */ | char f_program[MAXPATHLEN]; /* program this applies to */ | ||||
| struct prop_filter *f_prop_filter; /* property-based filter */ | struct prop_filter *f_prop_filter; /* property-based filter */ | ||||
| u_char f_pmask[LOG_NFACILITIES+1]; /* priority mask */ | u_char f_pmask[LOG_NFACILITIES+1]; /* priority mask */ | ||||
| u_char f_pcmp[LOG_NFACILITIES+1]; /* compare priority */ | u_char f_pcmp[LOG_NFACILITIES+1]; /* compare priority */ | ||||
| #define PRI_LT 0x1 | #define PRI_LT 0x1 | ||||
| #define PRI_EQ 0x2 | #define PRI_EQ 0x2 | ||||
| #define PRI_GT 0x4 | #define PRI_GT 0x4 | ||||
| /* Logging destinations. */ | /* Logging destinations. */ | ||||
| Show All 19 Lines | #define FFLAG_NEEDSYNC 0x02 | ||||
| time_t f_time; /* time this was last written */ | time_t f_time; /* time this was last written */ | ||||
| struct logtime f_lasttime; /* time of last occurrence */ | struct logtime f_lasttime; /* time of last occurrence */ | ||||
| int f_prevpri; /* pri of f_prevline */ | int f_prevpri; /* pri of f_prevline */ | ||||
| size_t f_prevlen; /* length of f_prevline */ | size_t f_prevlen; /* length of f_prevline */ | ||||
| int f_prevcount; /* repetition cnt of prevline */ | int f_prevcount; /* repetition cnt of prevline */ | ||||
| u_int f_repeatcount; /* number of "repeated" msgs */ | u_int f_repeatcount; /* number of "repeated" msgs */ | ||||
| STAILQ_ENTRY(filed) next; /* next in linked list */ | STAILQ_ENTRY(filed) next; /* next in linked list */ | ||||
| }; | }; | ||||
| extern const char *ConfFile; | |||||
| extern char LocalHostName[MAXHOSTNAMELEN]; | |||||
| void closelogfiles(void); | |||||
| void logerror(const char *); | |||||
| nvlist_t *readconfigfile(const char *); | |||||
| #endif /* !_SYSLOGD_H_ */ | #endif /* !_SYSLOGD_H_ */ | ||||