#ifndef _NFSLOGD_H
#define _NFSLOGD_H
#ifdef __cplusplus
extern "C" {
#endif
#include <tzfile.h>
#include <sys/types.h>
#include <nfs/nfs_log.h>
#include "../lib/nfslog_config.h"
#include "buffer_list.h"
#define NFSLOGD_PIDFILE "/var/run/nfslogd.pid"
#define NFSLOG_OPTIONS_FILE "/etc/default/nfslogd"
#define MIN_PROCESSING_SIZE 512*1024
#define IDLE_TIME 300
#define MAX_LOGS_PRESERVE 10
#define MAPPING_UPDATE_INTERVAL (SECSPERDAY)
#define CYCLE_FREQUENCY 24
#define PRUNE_TIMEOUT (SECSPERHOUR * 168)
#define NFSLOG_UMASK 0137
struct nfsl_proc_disp {
void (*nfsl_dis_args)();
void (*nfsl_dis_res)();
char *procname;
};
struct nfsl_vers_disp {
int nfsl_dis_nprocs;
struct nfsl_proc_disp *nfsl_dis_proc_table;
};
struct nfsl_prog_disp {
rpcprog_t nfsl_dis_prog;
rpcvers_t nfsl_dis_versmin;
int nfsl_dis_nvers;
struct nfsl_vers_disp *nfsl_dis_vers_table;
char *progname;
};
struct nfsl_log_file {
char *path;
FILE *fp;
char *buf;
int bufoffset;
struct nfsl_log_file *next;
struct nfsl_log_file *prev;
};
struct valid_rpcs {
rpcprog_t prog;
rpcvers_t versmin;
rpcvers_t versmax;
};
struct processed_records {
struct processed_records *next;
struct processed_records *prev;
u_offset_t start_offset;
unsigned int len;
unsigned int num_recs;
};
struct nfslog_buf {
struct nfslog_buf *next;
struct nfslog_buf *prev;
char *bufpath;
int fd;
flock_t fl;
u_offset_t filesize;
intptr_t mmap_addr;
u_offset_t next_rec;
unsigned int last_rec_id;
nfslog_buffer_header bh;
struct nfslog_lr *bh_lrp;
int num_lrps;
struct nfslog_lr *lrps;
u_offset_t last_record_offset;
struct processed_records *prp;
int num_pr_queued;
};
struct nfslog_lr {
struct nfslog_lr *next;
struct nfslog_lr *prev;
u_offset_t f_offset;
intptr_t record;
unsigned int recsize;
caddr_t buffer;
XDR xdrs;
nfslog_request_record log_record;
bool_t (*xdrargs)();
bool_t (*xdrres)();
struct nfslog_buf *lbp;
};
#define TRANSTOLOG_OPER_READ 0x00000001
#define TRANSTOLOG_OPER_WRITE 0x00000002
#define TRANSTOLOG_OPER_SETATTR 0x00000004
#define TRANSTOLOG_OPER_REMOVE 0x00000008
#define TRANSTOLOG_OPER_MKDIR 0x00000010
#define TRANSTOLOG_OPER_CREATE 0x00000020
#define TRANSTOLOG_OPER_RMDIR 0x00000040
#define TRANSTOLOG_OPER_RENAME 0x00000080
#define TRANSTOLOG_OPER_MKNOD 0x00000100
#define TRANSTOLOG_OPER_LINK 0x00000200
#define TRANSTOLOG_OPER_SYMLINK 0x00000400
#define TRANSTOLOG_OPER_READWRITE \
(TRANSTOLOG_OPER_READ | TRANSTOLOG_OPER_WRITE)
#define TRANSTOLOG_ALL ((uint32_t)~0)
extern int debug;
extern boolean_t test;
extern int max_logs_preserve;
extern uint_t idle_time;
extern boolean_t keep_running;
extern boolean_t quick_cleaning;
extern int cycle_log(char *, int);
extern int prune_dbs(char *);
extern int process_buffer(
struct buffer_ent *, nfsl_config_t **, int, int, int *);
extern struct nfslog_buf *nfslog_open_buf(char *, int *);
extern void nfslog_close_buf(struct nfslog_buf *, int);
extern struct nfslog_lr *nfslog_get_logrecord(struct nfslog_buf *);
extern void nfslog_free_logrecord(struct nfslog_lr *, bool_t);
extern int nfslog_process_fh_rec(struct nfslog_lr *,
char *, char **, char **, bool_t);
extern void *nfslog_open_elf_file(char *, nfslog_buffer_header *, int *);
extern void nfslog_close_elf_file(void **);
extern int nfslog_process_elf_rec(void *, nfslog_request_record *,
char *, char *);
struct nfslog_trans_file;
extern void *nfslog_open_trans_file(char *, uint32_t, uint32_t, int *);
extern void nfslog_process_trans_timeout(struct nfslog_trans_file *,
uint32_t);
extern int nfslog_process_trans_rec(void *,
nfslog_request_record *, char *, char *, char *);
extern void nfslog_close_transactions(void **);
extern void nfslog_opaque_print_buf(void *, int, char *, int *, int);
#ifdef __cplusplus
}
#endif
#endif