/*
 * Copyright (c) 2004-2006 Sendmail, Inc. and its suppliers.
 *	All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at the top level of
 * the sendmail distribution.
 *
 * $Id: sscnf.h,v 1.44 2007/09/29 02:53:39 ca Exp $
 */

#ifndef SSCNF_H
#define SSCNF_H 1

#include "sm/generic.h"
#include "sm/types.h"
#include "sm/time.h"
#include "sm/io.h"
#include "sm/sm-conf.h"
#include "sm/ssdef.h"
#include "sm/logcnfdef.h"
#include "sm/mcpcnfs.h"
#include "sm/tlscnfs.h"
#include "sm/tlscnf.h"

#ifndef SS_LOGDIR
#define SS_LOGDIR	0
#endif

/* Max number of listening sockets ("hardware virtual servers") */
#define SS_MAX_BIND_ADDRS 16


/* server features (per session) */
struct ss_se_feat_S
{
	char		*sssf_name;
	uint32_t	 sssf_flags;
	uchar		 sssf_name_isset;
};
typedef struct ss_se_feat_S ss_se_feat_T, *ss_se_feat_P;

/* server feature declarations */
struct ss_se_feats_S
{
	ss_se_feat_T	*sssfs_feat;
	uint		 sssfs_n;
};
typedef struct ss_se_feats_S ss_se_feats_T, *ss_se_feats_P;

/* SMTPS configuration context */
typedef struct ss_cnf_S		ss_cnf_T, *ss_cnf_P;
struct ss_cnf_S
{
	sm_magic_T	 sm_magic;
	sm_conf_T	*ss_cnf_smc;		/* parsed configuration */
	char		*ss_cnf_conffile;	/* name of configuration file */
	char		*ss_cnf_section;	/* name of section to use */
	char		*ss_cnf_smtpssock;	/* SMTP Server/QMGR socket */
	const char	*ss_cnf_smtpssock_abs;
	char		*ss_cnf_smtpssock_alloc;
	char		*ss_cnf_smarsock;	/* SMAR socket */
	const char	*ss_cnf_smarsock_abs;
	char		*ss_cnf_smarsock_alloc;
	char		*ss_cnf_cdb_base;	/* Base name for CDB */
	char		*ss_cnf_fd_socket; /* socket over which fd is passed */
	char		*ss_cnf_hostname;

	char		*ss_cnf_relay_to;
	char		*ss_cnf_relay_from;

#if SS_LOGDIR
	char		*ss_cnf_logdir;
#endif
	uint		 ss_cnf_loglevel;
	sm_logspec_T	 ss_cnf_log;

	gid_t		 ss_cnf_cdb_gid;
	sm_intvl_T	 ss_cnf_timeout;	/* timeout for SMTP I/O */
	uint		 ss_cnf_wait4srv;
	uint32_t	 ss_cnf_mod_tmo; /* timeout for module communication */

	uint		 ss_cnf_w4a2s;	/* wait for reply from smar */

	int			 ss_cnf_listenq_size;
	uint		 ss_cnf_maxhops;
	uint		 ss_cnf_debug;

	uint		 ss_cnf_max_msg_sz_kb;

	int			 ss_cnf_id_base; /* smtps base id (before fork() */

	/* limits (global, could be set per session or maybe transaction) */
	uint		 ss_cnf_t_tot_lim; /* number of transaction total */
	uint		 ss_cnf_r_tot_lim; /* number of recipients total */
	uint		 ss_cnf_r_ta_lim; /* number of recipients per TA */
#if 0
	/* not yet checked nor counted */
	uint		 ss_cnf_r_fail_lim; /* number of failed recipients */
	uint		 ss_cnf_r_ok_lim;	/* number of recipients ok */
#endif

	/* max number of bad commands per session */
	uint		 ss_cnf_sess_max_badcmds;
	uint		 ss_cnf_sess_max_nopcmds;
	uint		 ss_cnf_sess_max_invldaddr;
	uint		 ss_cnf_ta_max_badcmds;
	uint		 ss_cnf_ta_max_nopcmds;
	uint		 ss_cnf_ta_max_invldaddr;

	uint32_t	 ss_cnf_cflags;

#if 0
	int		 ss_cnf_port;
#endif
	int		 ss_cnf_vp_count; /* Number of server processes (VPs) */

	/*
	**  Thread throttling parameters (all numbers are per listening socket).
	**  Zero values mean use default.
	*/

	uint		 ss_cnf_max_threads;

	/* Max number of "spare" threads */
	uint		 ss_cnf_max_wait_threads;

	/* Min number of "spare" threads */
	uint		 ss_cnf_min_wait_threads;

	int		 ss_cnf_sk_count;
	char		*ss_cnf_sck_addr[SS_MAX_BIND_ADDRS];

#if MTA_USE_TLS
	TLS_STRUCTS(ss)
	tls_cnf_T	 ss_cnf_tls;
	uint		 ss_cnf_tlsreqfail;
#endif

#if MTA_USE_SASL
	uint32_t	 ss_cnf_auth_flags;
	char		*ss_cnf_trusted_mechs;
#endif
#if MTA_USE_PMILTER
	sockspec_T	 ss_cnf_miltsockspec;
	uint32_t	 ss_cnf_mflags;	/* flags */
	uint		 ss_cnf_w4m2s;
	/* options?? timeout, error behavior, list of macros, others? */
#endif

	ss_se_feats_T	 ss_cnf_se_feats;
#if SS_TEST
	uint32_t	 ss_cnf_tests;
#endif

	MCP_STRUCTS(ss_cnf_T, ss_cnf)
};

void ss_prt_cnf(ss_cnf_P ss_cnf, sm_file_T *fp, bool _all);

#endif /* SSCNF_H */


syntax highlighted by Code2HTML, v. 0.9.1