Home | History | Annotate | Line # | Download | only in bounce
      1 /*	$NetBSD: bounce_service.h,v 1.4 2025/02/25 19:15:43 christos Exp $	*/
      2 
      3 /*++
      4 /* NAME
      5 /*	bounce_service 3h
      6 /* SUMMARY
      7 /*	bounce message service
      8 /* SYNOPSIS
      9 /*	#include <bounce_service.h>
     10 /* DESCRIPTION
     11 /* .nf
     12 
     13  /*
     14   * Utility library.
     15   */
     16 #include <vstring.h>
     17 
     18  /*
     19   * Global library.
     20   */
     21 #include <bounce_log.h>
     22 
     23  /*
     24   * Application-specific.
     25   */
     26 #include <bounce_template.h>
     27 
     28  /*
     29   * bounce_service.c
     30   */
     31 extern int bounce_hfrom_format;
     32 
     33  /*
     34   * bounce_append_service.c
     35   */
     36 extern int bounce_append_service(int, char *, char *, RECIPIENT *, DSN *);
     37 
     38  /*
     39   * bounce_notify_service.c
     40   */
     41 extern int bounce_notify_service(int, char *, char *, char *, char *, int, char *, char *, int, BOUNCE_TEMPLATES *);
     42 
     43  /*
     44   * bounce_warn_service.c
     45   */
     46 extern int bounce_warn_service(int, char *, char *, char *, char *, int, char *, char *, int, BOUNCE_TEMPLATES *);
     47 
     48  /*
     49   * bounce_trace_service.c
     50   */
     51 extern int bounce_trace_service(int, char *, char *, char *, char *, int, char *, char *, int, BOUNCE_TEMPLATES *);
     52 
     53  /*
     54   * bounce_notify_verp.c
     55   */
     56 extern int bounce_notify_verp(int, char *, char *, char *, char *, int, char *, char *, int, char *, BOUNCE_TEMPLATES *);
     57 
     58  /*
     59   * bounce_one_service.c
     60   */
     61 extern int bounce_one_service(int, char *, char *, char *, int, char *, char *, int, RCPT_BUF *, DSN_BUF *, BOUNCE_TEMPLATES *);
     62 
     63  /*
     64   * bounce_cleanup.c
     65   */
     66 extern VSTRING *bounce_cleanup_path;
     67 extern void bounce_cleanup_register(char *, char *);
     68 extern void bounce_cleanup_log(void);
     69 extern void bounce_cleanup_unregister(void);
     70 
     71 #define bounce_cleanup_registered() (bounce_cleanup_path != 0)
     72 
     73  /*
     74   * bounce_notify_util.c
     75   */
     76 typedef struct {
     77     const char *service;		/* bounce or defer */
     78     const char *queue_name;		/* incoming, etc. */
     79     const char *queue_id;		/* base name */
     80     const char *mime_encoding;		/* null or encoding */
     81     const char *dsn_envid;		/* DSN envelope ID */
     82     const char *mime_boundary;		/* for MIME */
     83     BOUNCE_TEMPLATE *template;		/* bounce message template */
     84     VSTRING *buf;			/* scratch pad */
     85     VSTRING *sender;			/* envelope sender */
     86     VSTREAM *orig_fp;			/* open queue file */
     87     long    orig_offs;			/* start of content */
     88     time_t  arrival_time;		/* time of arrival */
     89     long    message_size;		/* size of content */
     90     VSTRING *orig_msgid;		/* original message-id */
     91     RCPT_BUF *rcpt_buf;			/* recipient info */
     92     DSN_BUF *dsn_buf;			/* delivery status info */
     93     BOUNCE_LOG *log_handle;		/* open logfile */
     94     char   *mail_name;			/* $mail_name, cooked */
     95     int     sendopts;			/* smtputf8, requiretls, etc. */
     96 } BOUNCE_INFO;
     97 
     98  /* */
     99 
    100 extern BOUNCE_INFO *bounce_mail_init(const char *, const char *, const char *, const char *, int, const char *, BOUNCE_TEMPLATE *);
    101 extern BOUNCE_INFO *bounce_mail_one_init(const char *, const char *, const char *, int, const char *, RCPT_BUF *, DSN_BUF *, BOUNCE_TEMPLATE *);
    102 extern void bounce_mail_free(BOUNCE_INFO *);
    103 extern int bounce_header(VSTREAM *, BOUNCE_INFO *, const char *, int);
    104 extern int bounce_boilerplate(VSTREAM *, BOUNCE_INFO *);
    105 extern int bounce_recipient_log(VSTREAM *, BOUNCE_INFO *);
    106 extern int bounce_diagnostic_log(VSTREAM *, BOUNCE_INFO *, int);
    107 extern int bounce_header_dsn(VSTREAM *, BOUNCE_INFO *);
    108 extern int bounce_recipient_dsn(VSTREAM *, BOUNCE_INFO *);
    109 extern int bounce_diagnostic_dsn(VSTREAM *, BOUNCE_INFO *, int);
    110 extern int bounce_original(VSTREAM *, BOUNCE_INFO *, int);
    111 extern void bounce_delrcpt(BOUNCE_INFO *);
    112 extern void bounce_delrcpt_one(BOUNCE_INFO *);
    113 
    114 /* LICENSE
    115 /* .ad
    116 /* .fi
    117 /*	The Secure Mailer license must be distributed with this software.
    118 /* AUTHOR(S)
    119 /*	Wietse Venema
    120 /*	IBM T.J. Watson Research
    121 /*	P.O. Box 704
    122 /*	Yorktown Heights, NY 10598, USA
    123 /*--*/
    124