Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/cmd/upas/send/send.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
 * these limits are intended to stay within those imposed by SMTP
 * and avoid tickling bugs in other mail systems.
 * they both pertain to attempts to group recipients for the same
 * destination together in a single copy of a message.
 */
#define MAXSAME 32	/* max recipients; was 16 */
#define MAXSAMECHAR 1024 /* max chars in the list of recipients */

/* status of a destination*/
typedef enum {
	d_undefined,	/* address has not been matched*/
	d_pipe,		/* repl1|repl2 == delivery command, rep*/
	d_cat,		/* repl1 == mail file */
	d_translate,	/* repl1 == translation command*/
	d_alias,	/* repl1 == translation*/
	d_auth,		/* repl1 == command to authorize*/
	d_syntax,	/* addr contains illegal characters*/
	d_unknown,	/* addr does not match a rewrite rule*/
	d_loop,		/* addressing loop*/
	d_eloop,	/* external addressing loop*/
	d_noforward,	/* forwarding not allowed*/
	d_badmbox,	/* mailbox badly formatted*/
	d_resource,	/* ran out of something we needed*/
	d_pipeto,	/* pipe to from a mailbox*/
} d_status;

/* a destination*/
typedef struct dest dest;
struct dest {
	dest	*next;		/* for chaining*/
	dest	*same;		/* dests with same cmd*/
	dest	*parent;	/* destination we're a translation of*/
	String	*addr;		/* destination address*/
	String	*repl1;		/* substitution field 1*/
	String	*repl2;		/* substitution field 2*/
	int	pstat;		/* process status*/
	d_status status;	/* delivery status*/
	int	authorized;	/* non-zero if we have been authorized*/
	int	nsame;		/* number of same dests chained to this entry*/
	int	nchar;		/* number of characters in the command*/
};

typedef struct message message;
struct message {
	String	*sender;
	String	*replyaddr;
	String	*date;
	String	*body;
	String	*tmp;		/* name of temp file */
	String	*to;
	int	size;
	int	fd;		/* if >= 0, the file the message is stored in*/
	char	haveto;
	String	*havefrom;
	String	*havesender;
	String	*havereplyto;
	char	havedate;
	char	havemime;
	String	*havesubject;
	char	bulk;		/* if Precedence: Bulk in header */
	char	rfc822headers;
	int	received;	/* number of received lines */
	char	*boundary;	/* bondary marker for attachments */
};

/*
 *  exported variables
 */
extern int rmail;
extern int onatty;
extern char *thissys, *altthissys;
extern int xflg;
extern int nflg;
extern int tflg;
extern int debug;
extern int nosummary;

/*
 *  exported procedures
 */
extern void	authorize(dest*);
extern int	cat_mail(dest*, message*);
extern dest	*up_bind(dest*, message*, int);
extern int	ok_to_forward(char*);
extern int	lookup(char*, char*, Biobuf**, char*, Biobuf**);
extern dest	*d_new(String*);
extern void	d_free(dest*);
extern dest	*d_rm(dest**);
extern void	d_insert(dest**, dest*);
extern dest	*d_rm_same(dest**);
extern void	d_same_insert(dest**, dest*);
extern String	*d_to(dest*);
extern dest	*s_to_dest(String*, dest*);
extern void	gateway(message*);
extern dest	*expand_local(dest*);
extern void	logdelivery(dest*, char*, message*);
extern void	loglist(dest*, message*, char*);
extern void	logrefusal(dest*, message*, char*);
extern int	default_from(message*);
extern message	*m_new(void);
extern void	m_free(message*);
extern message	*m_read(Biobuf*, int, int);
extern int	m_get(message*, long, char**);
extern int	m_print(message*, Biobuf*, char*, int);
extern int	m_bprint(message*, Biobuf*);
extern String	*rule_parse(String*, char*, int*);
extern int	getrules(void);
extern int	rewrite(dest*, message*);
extern void	dumprules(void);
extern void	regerror(char*);
extern dest	*translate(dest*);
extern char*	skipequiv(char*);
extern int	refuse(dest*, message*, char*, int, int);

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].