/*
 * (C) Copyright Fuji Xerox Co., Ltd. All rights are reserved.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * 2017/12/15	nobuo.iwata@fujixerox.co.jp
 */

#ifndef __FXLSM_EVENT_H
#define __FXLSM_EVENT_H

extern const char *fxlsm_e_start;
extern const char *fxlsm_e_stop;
extern const char *fxlsm_e_enabled;
extern const char *fxlsm_e_through;
extern const char *fxlsm_e_read;
extern const char *fxlsm_e_write;
extern const char *fxlsm_e_exec;
extern const char *fxlsm_e_creat;
extern const char *fxlsm_e_creatx;
extern const char *fxlsm_e_delete;
extern const char *fxlsm_e_chmod;
extern const char *fxlsm_e_chmodx;
extern const char *fxlsm_e_chown;
extern const char *fxlsm_e_chroot;
extern const char *fxlsm_e_truncate;
extern const char *fxlsm_e_bind;
extern const char *fxlsm_e_connect;
extern const char *fxlsm_e_listen;
extern const char *fxlsm_e_accept;
extern const char *fxlsm_e_sendmsg;
extern const char *fxlsm_e_recvmsg;
extern const char *fxlsm_e_graft;
extern const char *fxlsm_e_unknown;

int fxlsm_get_max_events(void);
void fxlsm_set_max_events(int max);
int fxlsm_get_lost_events(void);

void fxlsm_notify(const char *event, const char *comm, const char *path,
		int plen, const char *src);

static inline void fxlsm_notify_files(const char *event, const char *comm,
		const char *path, int plen)
{
	fxlsm_notify(event, comm, path, plen, "FILES");
}
static inline void fxlsm_notify_comms(const char *event, const char *comm,
		const char *path, int plen)
{
	fxlsm_notify(event, comm, path, plen, "COMMS");
}
static inline void fxlsm_notify_lds(const char *event, const char *comm,
		const char *path, int plen)
{
	fxlsm_notify(event, comm, path, plen, "LDS");
}
static inline void fxlsm_notify_crmx(const char *event, const char *comm,
		const char *path, int plen)
{
	fxlsm_notify(event, comm, path, plen, "CRMX");
}
static inline void fxlsm_notify_net(const char *event, const char *comm,
		const char *path)
{
	fxlsm_notify(event, comm, path, 0, "NET");
}
static inline void fxlsm_notify_none(const char *event, const char *comm,
		const char *path)
{
	fxlsm_notify(event, comm, path, 0, "NONE");
}

void fxlsm_notify_started(void);
void fxlsm_notify_stopped(void);
void fxlsm_notify_enabled(int prev, int val);
void fxlsm_notify_through(int prev, int val);
int fxlsm_event_init(void);
void fxlsm_event_exit(void);

#endif /* !__FXLSM_EVENT_H */
