1/*	$NetBSD$	*/
2
3#ifndef _HBC_H_INCLUDED_
4#define _HBC_H_INCLUDED_
5
6/*++
7/* NAME
8/*	header_body_checks 3h
9/* SUMMARY
10/*	delivery agent header/body checks
11/* SYNOPSIS
12/*	#include <header_body_checks.h>
13/* DESCRIPTION
14/* .nf
15
16 /*
17  * Global library.
18  */
19#include <mime_state.h>
20#include <maps.h>
21
22 /*
23  * Postfix < 2.5 compatibility.
24  */
25#ifndef MIME_HDR_FIRST
26#define MIME_HDR_FIRST		(1)
27#define MIME_HDR_LAST		(3)
28#endif
29
30 /*
31  * External interface.
32  */
33typedef struct {
34    const char *map_class;		/* parameter name */
35    MAPS   *maps;			/* map handle */
36} HBC_MAP_INFO;
37
38typedef struct {
39    void    (*logger) (void *, const char *, const char *, const char *, const char *);
40    void    (*prepend) (void *, int, const char *, ssize_t, off_t);
41    char   *(*extend) (void *, const char *, int, const char *, const char *, const char *, ssize_t, off_t);
42} HBC_CALL_BACKS;
43
44typedef struct {
45    HBC_CALL_BACKS *call_backs;
46    HBC_MAP_INFO map_info[1];		/* actually, a bunch */
47} HBC_CHECKS;
48
49#define HBC_CHECKS_STAT_IGNORE	((char *) 0)
50#define HBC_CHECKS_STAT_UNKNOWN	(&hbc_checks_unknown)
51
52extern HBC_CHECKS *hbc_header_checks_create(const char *, const char *,
53					         const char *, const char *,
54					         const char *, const char *,
55					            HBC_CALL_BACKS *);
56extern HBC_CHECKS *hbc_body_checks_create(const char *, const char *,
57					          HBC_CALL_BACKS *);
58extern char *hbc_header_checks(void *, HBC_CHECKS *, int, const HEADER_OPTS *,
59			               VSTRING *, off_t);
60extern char *hbc_body_checks(void *, HBC_CHECKS *, const char *, ssize_t, off_t);
61
62#define hbc_header_checks_free(hbc) _hbc_checks_free((hbc), HBC_HEADER_SIZE)
63#define hbc_body_checks_free(hbc) _hbc_checks_free((hbc), 1)
64
65 /*
66  * The following are NOT part of the external API.
67  */
68#define HBC_HEADER_SIZE	(MIME_HDR_LAST - MIME_HDR_FIRST + 1)
69extern void _hbc_checks_free(HBC_CHECKS *, ssize_t);
70extern const char hbc_checks_unknown;
71
72/* LICENSE
73/* .ad
74/* .fi
75/*	The Secure Mailer license must be distributed with this software.
76/* AUTHOR(S)
77/*	Wietse Venema
78/*	IBM T.J. Watson Research
79/*	P.O. Box 704
80/*	Yorktown Heights, NY 10598, USA
81/*--*/
82
83#endif
84