/***************************************************************************
 *
 * Copyright (c) 2000, 2001 BalaBit IT Ltd, Budapest, Hungary
 *
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: zorp.h,v 1.14.4.3 2001/09/19 19:22:17 bazsi Exp $
 *
 ***************************************************************************/

#ifndef ZORP_H_INCLUDED
#define ZORP_H_INCLUDED

#include <zorpconfig.h>
#include <glib.h>
#include <zorp/misc.h>

#if ENABLE_MEM_TRACE
#include <zorp/memtrace.h>
#endif

/* return values of callbacks are composed as follows:
 *
 * 0. byte: Error condition
 * 1. byte: action to take
 * 2. byte: undefined
 * 3. byte: undefined
 */
 
/* macros to expand status fields */
#define ST_ERROR(r)  ((r) & 0x000000FFL)
#define ST_ACTION(r) ((r) & 0x0000FF00L)

#define ST_FAILED(r) ((ST_ERROR(r) != ST_OK) && (ST_ERROR(r) != ST_AGAIN) && \
                      (ST_ACTION(r) != ST_GOON))

/* error conditions */
#define ST_OK		0x00000000
#define ST_ERR		0x00000001
#define ST_AGAIN	0x00000002
#define ST_EOF          0x00000004

/* actions to take */
#define ST_GOON		0x00000000
#define ST_CLOSE	0x00000100
#define ST_QUIT		0x00000200

#define ZORP_LICENSE_FILE       ZORP_SYSCONFDIR "/license.txt"
#define ZORP_POLICY_FILE	ZORP_SYSCONFDIR "/policy.py"
#define ZORP_POLICY_BOOT_FILE	ZORP_DATADIR "/policy.boot"
#define ZORP_AUTH_CERT_FILE	ZORP_SYSCONFDIR "/zorp.crt"
#define ZORP_AUTH_KEY_FILE	ZORP_SYSCONFDIR "/zorp.key"
#define ZORP_PID_FILE_DIR       "/var/run"

extern GMainLoop *main_loop;
extern gint exit_code;

void z_main_quit(int exit_code);

#define CORE_DEBUG      "core.debug"
#define CORE_ERROR      "core.error"
#define CORE_POLICY     "core.policy"
#define CORE_LICENSE    "core.license"
#define CORE_TRACE      "core.trace"
#define CORE_ACCOUNTING "core.accounting"
#define CORE_INFO       "core.info"
#define CORE_STDERR     "core.stderr"
#define CORE_AUTH       "core.auth"

#endif
