/*
 * @(#)smtprelay.h--Standard includes and definitions
 * @(#)STS/KBS 14feb2001
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/times.h>
#include <sys/wait.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>

#include "log.h"

#define	DEFAULTDEBUGLEVEL	DEBUG_NONE
#define	SELECT_TIMEOUT	300	/* server/net timeout (seconds) */

#define	TRUE		1
#define	FALSE		0

#define	MAXMESSAGE	8000000

extern	char	*iam;
extern	char	msgbuf[];

/*
 * inet.c
 */
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 200
#endif

#define	NEWS_CON_OK	200
#define	NEWS_CON_CLOSE	205
#define	NEWS_DUP	435
#define	NEWS_XFER	335
#define	NEWS_XFER_OK	235
#define	NEWS_ERROR	500
#define	NEWSPUTS_CRLF	0	/* Append CRLF to outgoing message */
#define	NEWSPUTS_NONE	1	/* Send outgoing message as is */
#define	NEWSGETS_LINE	0	/* Get string */
#define	NEWSGETS_ARTICLE	1	/* Get whole article */
#define	NI_BLOCK	0	/* Initialize blocking connection */
#define	NI_NONBLOCK	1	/* Initialize non-blocking connection */
typedef	struct {
	int	fd;		/* socket descriptor */
	char	nsb[1024*100];	/* socket read buffer */
	char	*nsbp;		/* current pointer in socket buf */
	int	nsbs;		/* current size of data in socket buf */
} NEWS;
#define	NewsPutMessage(x,y)	NewsPuts((x),(y),sizeof(y)-1,NEWSPUTS_NONE)
extern	char	hostName[];	/* Our host name */
NEWS	*NewsOpen(char *,int);
NEWS	*NewsInit(int,int);
void	NewsClose(NEWS *);
int	NewsCommand(NEWS *,char *,char **);
int	NewsGets(NEWS *,char *,int, int *, int);
int	NewsPuts(NEWS *, char *, int, int);
void	HostName(void);

