## libmilter/mfapi.h libmilter/mfapi.h — libmilter compatible API. |

## Functions

#define | SM_LM_VRS_MAJOR()
#define | SM_LM_VRS_MINOR()
#define | SM_LM_VRS_PLVL()
int | smfi_opensocket ()
int | smfi_register ()
int | smfi_main ()
int | smfi_setbacklog ()
int | smfi_setdbg ()
int | smfi_settimeout ()
int | smfi_setconn ()
int | smfi_stop ()
int | smfi_version ()
char * | smfi_getsymval ()
int | smfi_setreply ()
int | smfi_setmlreply ()
int | smfi_addheader ()
int | smfi_chgheader ()
int | smfi_insheader ()
int | smfi_chgfrom ()
int | smfi_addrcpt ()
int | smfi_addrcpt_par ()
int | smfi_delrcpt ()
int | smfi_progress ()
int | smfi_replacebody ()
int | smfi_quarantine ()
int | smfi_setpriv ()
void * | smfi_getpriv ()
int | smfi_setsymlist ()

## Types and Values

#define | SMFI_VERSION
#define | MI_SUCCESS
#define | MI_FAILURE
typedef | SMFICTX
typedef | SMFICTX_PTR
typedef | smfiDesc_str
typedef | smfiDesc_ptr
typedef | sfsistat
#define | bool
#define | true
#define | false
struct | smfiDesc
#define | SMFIF_ADDHDRS
#define | SMFIF_CHGBODY
#define | SMFIF_MODBODY
#define | SMFIF_ADDRCPT
#define | SMFIF_DELRCPT
#define | SMFIF_CHGHDRS
#define | SMFIF_QUARANTINE
#define | SMFIF_CHGFROM
#define | SMFIF_ADDRCPT_PAR
#define | SMFIF_SETSYMLIST
#define | SMFIS_CONTINUE
#define | SMFIS_REJECT
#define | SMFIS_DISCARD
#define | SMFIS_ACCEPT
#define | SMFIS_TEMPFAIL
#define | SMFIS_NOREPLY
#define | SMFIS_SKIP
#define | SMFIS_ALL_OPTS
#define | SMFIM_CONNECT
#define | SMFIM_HELO
#define | SMFIM_ENVFROM
#define | SMFIM_ENVRCPT
#define | SMFIM_DATA
#define | SMFIM_EOM
#define | SMFIM_EOH
#define | SMFIP_NOCONNECT
#define | SMFIP_NOHELO
#define | SMFIP_NOMAIL
#define | SMFIP_NORCPT
#define | SMFIP_NOBODY
#define | SMFIP_NOHDRS
#define | SMFIP_NOEOH
#define | SMFIP_NR_HDR
#define | SMFIP_NOHREPL
#define | SMFIP_NOUNKNOWN
#define | SMFIP_NODATA
#define | SMFIP_SKIP
#define | SMFIP_RCPT_REJ
#define | SMFIP_NR_CONN
#define | SMFIP_NR_HELO
#define | SMFIP_NR_MAIL
#define | SMFIP_NR_RCPT
#define | SMFIP_NR_DATA
#define | SMFIP_NR_UNKN
#define | SMFIP_NR_EOH
#define | SMFIP_NR_BODY
#define | SMFIP_HDR_LEADSPC

## Description

libmilter/mfapi.h provides Sendmail's libmilter compatible API. You can use this library instead of Sendmail's libmilter. See also API Documentation on milter.org.

## Functions

### SM_LM_VRS_MAJOR()

    #define SM_LM_VRS_MAJOR(version) (((version) & 0x7f000000) >> 24)

Extracts major version number from `version` .

#### Parameters

version | the version number. |

#### Returns

major version number.

### SM_LM_VRS_MINOR()

    #define SM_LM_VRS_MINOR(version) (((version) & 0x007fff00) >> 8)

Extracts minor version number from `version` .

#### Parameters

version | the version number. |

#### Returns

minor version number.

### SM_LM_VRS_PLVL()

    #define SM_LM_VRS_PLVL(version)		((version) & 0x0000007f)

Extracts patch level from `version` .

#### Parameters

version | the version number. |

#### Returns

patch level.

### smfi_opensocket ()

    int
    smfi_opensocket (bool remove_socket);

Creates the socket that is used to connect from MTA.

Normally, `smfi_opensocket()` isn't needed to call explicitly. The socket is created in `smfi_main()` implicitly.

Here are the fail conditions:

- smfi_register() hasn't called successfully.

- smfi_setconn() hasn't called successfully.

- smfi_opensocket() fails to remove existing UNIX domain socket if connection spec is for UNIX domain socket and `remove_socket` is true.

- smfi_opensocket() fails to create the new socket.

See also smfi_opensocket on milter.org.

#### Parameters

remove_socket | Whether or not trying to remove existing UNIX domain socket before creating a new socket. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_register ()

    int
    smfi_register (struct smfiDesc description);

Registers the milter implementation as callbacks.

Here are the fail conditions:

- incompatible xxfi_version.

- illegal xxfi_flags value.

See also smfi_register on milter.org.

#### Parameters

description | The milter description. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_main ()

    int
    smfi_main (void);

Enters event loop. The milter should be initialized with `smfi_register()`, `smfi_setconn()` and so on before `smfi_main()` is called.

Here are the fail conditions:

- failed to create the socket.

See also smfi_main on milter.org.

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_setbacklog ()

    int
    smfi_setbacklog (int backlog);

Sets the milters' backlog value that is used for listen(2).

Here are the fail conditions:

- `backlog` <= 0.

See also smfi_setbacklog on milter.org.

#### Parameters

backlog | The maximum length of the pending connections queue. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_setdbg ()

    int
    smfi_setdbg (int level);

Sets the log level. If `level` is 0, turns off any log message. The greater value is specified, more log messages are output.

See also smfi_setdbg on milter.org.

#### Parameters

level | The log level. |

#### Returns

always `MI_SUCCESS`.

### smfi_settimeout ()

    int
    smfi_settimeout (int timeout);

Sets the I/O timeout value in seconds. The default value is 7210 seconds. `timeout` == 0 means no wait, not "wait forever".

See also smfi_settimeout on milter.org.

#### Parameters

timeout | The timeout value in seconds. |

#### Returns

always `MI_SUCCESS`.

### smfi_setconn ()

    int
    smfi_setconn (char *connection_spec);

Sets the connection spec.

`connection_spec` format is one of them:

- "unix:/PATH/TO/SOCKET": UNIX domain socket.

- "inet:PORT", "inet:PORT@HOST_NAME" or "inet:PORT@IP_ADDRESS": IPv4.

- "inet6:PORT", "inet6:PORT@HOST_NAME" or "inet6:PORT@IP_ADDRESS": IPv6.

Here are the fail conditions:

- invalid format.

- `connection_spec` is `NULL`.

See also smfi_setconn on milter.org.

#### Parameters

connection_spec | The connection spec for communicating MTA. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_stop ()

    int
    smfi_stop (void);

Stops the milter. No more connections are accepted but processing connections are continued until they are finished.

See also smfi_stop on milter.org.

#### Returns

always `MI_SUCCESS`.

### smfi_version ()

    int
    smfi_version (unsigned int *major,
                  unsigned int *minor,
                  unsigned int *patch_level);

Gets the libmilter version. The version is for using libmilter not built libmilter.

See also smfi_version on milter.org.

#### Parameters

major | return location for major version. |
minor | return location for minor version. |
patch_level | return location for patch level. |

#### Returns

always `MI_SUCCESS`.

### smfi_getsymval ()

    char *
    smfi_getsymval (SMFICTX *context,
                    char *name);

Gets a value of the macro named `name` in the current milter session context. `smfi_getsymval()` can be called in xxfi_XXX callbacks. (e.g. `xxfi_connect()`, `xxfi_helo()`, ...)

`name` should be enclosed in braces ("{" and "}") like "{if_name}" except `name` contains a character like "i".

See also smfi_getsymval on milter.org. Sendmail's default macros are also shown in the page.

#### Parameters

context | the context for the current milter session. |
name | the name of a macro. |

#### Returns

a value of the macro named `name` if it exists, `NULL` otherwise.

### smfi_setreply ()

    int
    smfi_setreply (SMFICTX *context,
                   char *return_code,
                   char *extended_code,
                   char *message);

Sets the error reply code. 4xx `return_code` is used on `SMFIS_TEMPFAIL`. 5xx `return_code` is used on `SMFIS_REJECT`.

Here are the fail conditions:

- `return_code` is neither 4xx nor 5xx.

- `extended_code` is neither 4.x.x nor 5.x.x.

See also smfi_setreply on milter.org.

#### Parameters

context | the context for the current milter session. |
return_code | the three-digit SMTP error reply code. (RFC 2821) Only 4xx and 5xx are accepted. |
extended_code | the extended reply code (RFC 1893/2034), or `NULL`. Only 4.x.x and 5.x.x are available. |
message | the text part of the SMTP reply, or `NULL`. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_setmlreply ()

    int
    smfi_setmlreply (SMFICTX *context,
                     const char *return_code,
                     const char *extended_code,
                     ...);

Sets the error reply code. 4xx `return_code` is used on `SMFIS_TEMPFAIL`. 5xx `return_code` is used on `SMFIS_REJECT`.

Here are the fail conditions:

- `return_code` is neither 4xx nor 5xx.

- `extended_code` is neither 4.x.x nor 5.x.x.

See also smfi_setmlreply on milter.org.

#### Parameters

context | the context for the current milter session. |
return_code | the three-digit SMTP error reply code. (RFC 2821) Only 4xx and 5xx are accepted. |
extended_code | the extended reply code (RFC 1893/2034), or `NULL`. Only 4.x.x and 5.x.x are available. |
... | the single lines of text part of the SMTP reply, terminated by `NULL`. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_addheader ()

    int
    smfi_addheader (SMFICTX *context,
                    char *name,
                    char *value);

Adds a header to the current message's header list. `smfi_addheader()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `name` is `NULL`.

- `value` is `NULL`.

- called in except `xxfi_eom()`.

- `SMFIF_ADDHDRS` flag isn't set in `smfi_register()` or `xxfi_negotiate()`.

- network error is occurred.

See also smfi_addheader on milter.org.

#### Parameters

context | the context for the current milter session. |
name | the header name. |
value | the header value. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_chgheader ()

    int
    smfi_chgheader (SMFICTX *context,
                    char *name,
                    int index,
                    char *value);

Changes a header that is located at `index` in headers that all of them are named `name` . If `value` is `NULL`, the header is deleted. `smfi_chgheader()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `name` is `NULL`.

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- `SMFIF_CHGHDRS` flag isn't set in `smfi_register()` or `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_chgheader on milter.org.

#### Parameters

context | the context for the current milter session. |
name | the header name. |
index | the index of headers that all of them are named `name` . (1-based) |
value | the header value. Use `NULL` to delete the target header. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_insheader ()

    int
    smfi_insheader (SMFICTX *context,
                    int index,
                    char *name,
                    char *value);

Inserts a header to `index` in headers. `smfi_insheader()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `name` is `NULL`.

- `value` is `NULL`. FIXME: not-implemented yet.

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- `SMFIF_ADDHDRS` flag isn't set in `smfi_register()` or `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_insheader on milter.org.

#### Parameters

context | the context for the current milter session. |
index | the index of inserted header. 0 means that the header is prepended. |
name | the header name. |
value | the header value. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_chgfrom ()

    int
    smfi_chgfrom (SMFICTX *context,
                  char *mail,
                  char *arguments);

Changes a sender address. `smfi_chgfrom()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `mail` is `NULL`. FIXME: not-implemented yet.

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- `SMFIF_CHGFROM` flag isn't set in `smfi_register()` or `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_chgfrom on milter.org.

#### Parameters

context | the context for the current milter session. |
mail | the new sender address. |
arguments | the extra arguments for ESMTP. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_addrcpt ()

    int
    smfi_addrcpt (SMFICTX *context,
                  char *recipient);

Adds a recipient address. `smfi_addrcpt()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `recipient` is `NULL`. FIXME: not-implemented yet.

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- `SMFIF_ADDRCPT` flag isn't set in `smfi_register()` or `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_addrcpt on milter.org.

#### Parameters

context | the context for the current milter session. |
recipient | the new recipient address. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_addrcpt_par ()

    int
    smfi_addrcpt_par (SMFICTX *context,
                      char *recipient,
                      char *arguments);

Adds a recipient address with extra ESMTP arguments. `smfi_addrcpt_par()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `recipient` is `NULL`. FIXME: not-implemented yet.

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- `SMFIF_ADDRCPT_PAR` flag isn't set in `smfi_register()` or `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_addrcpt_par on milter.org.

#### Parameters

context | the context for the current milter session. |
recipient | the recipient address. |
arguments | the extra arguments for ESMTP. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_delrcpt ()

    int
    smfi_delrcpt (SMFICTX *context,
                  char *recipient);

Deletes a recipient address. `smfi_delrcpt()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `recipient` is `NULL`. FIXME: not-implemented yet.

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- `SMFIF_DELRCPT` flag isn't set in `smfi_register()` or `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_delrcpt on milter.org.

#### Parameters

context | the context for the current milter session. |
recipient | the recipient address. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_progress ()

    int
    smfi_progress (SMFICTX *context);

Keeps the current connection. `smfi_progress()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_progress on milter.org.

#### Parameters

context | the context for the current milter session. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_replacebody ()

    int
    smfi_replacebody (SMFICTX *context,
                      unsigned char *new_body,
                      int new_body_size);

Replaces the current body data with `new_body` . `smfi_replacebody()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `new_body` == `NULL` and `new_body_size` > 0. FIXME: not-implemented yet.

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- `SMFIF_CHGBODY` flag isn't set in `smfi_register()` or `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_replacebody on milter.org.

#### Parameters

context | the context for the current milter session. |
new_body | the new body data. |
new_body_size | the size of `new_body` . |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_quarantine ()

    int
    smfi_quarantine (SMFICTX *context,
                     char *reason);

Quarantines the current message with `reason` . `smfi_quarantine()` can be called in `xxfi_eom()`.

Here are the fail conditions:

- `reason` is `NULL` or empty. FIXME: not-implemented yet.

- called in except `xxfi_eom()`. FIXME: not-implemented yet.

- `SMFIF_QUARANTINE` flag isn't set in `smfi_register()` or `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_quarantine on milter.org.

#### Parameters

context | the context for the current milter session. |
reason | the quarantine reason. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_setpriv ()

    int
    smfi_setpriv (SMFICTX *context,
                  void *data);

Sets the private data.

Here are the fail conditions:

- `context` is invalid. FIXME: not-implemented yet.

See also smfi_setpriv on milter.org.

#### Parameters

context | the context for the current milter session. |
data | the private data. |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

### smfi_getpriv ()

    void *
    smfi_getpriv (SMFICTX *context);

Gets the private data.

Here are the fail conditions:

- `context` is invalid. FIXME: not-implemented yet.

See also smfi_getpriv on milter.org.

#### Parameters

context | the context for the current milter session. |

#### Returns

the private data set by `smfi_setpriv()` or `NULL`.

### smfi_setsymlist ()

    int
    smfi_setsymlist (SMFICTX *context,
                     int state,
                     char *macros);

Sets the list of requested macros. `smfi_setsymlist()` can be called in `xxfi_negotiate()`.

Here are the fail conditions:

- `state` is not a valid value. FIXME: not-implemented yet.

- `macros` is `NULL` or empty. FIXME: not-implemented yet.

- the macro list for `state` has been set before. FIXME: not-implemented yet.

- called in except `xxfi_negotiate()`. FIXME: not-implemented yet.

- network error is occurred.

See also smfi_setsymlist on milter.org.

#### Parameters

context | the context for the current milter session. |
state | the state defined as SMFIM_XXX like `SMFIM_CONNECT`. |
macros | the space separated macro names like "{rcpt_mailer} {rcpt_host}". |

#### Returns

`MI_SUCCESS` if success, `MI_FAILURE` otherwise.

## Types and Values

### SMFI_VERSION

    #  define SMFI_VERSION 0x01000001

libmilter version number.

### MI_SUCCESS

    #define MI_SUCCESS 0

Indicates an operation is done successfully.

### MI_FAILURE

    #define MI_FAILURE (-1)

Indicates an operation is failed.

### SMFICTX

    typedef struct smfi_str  SMFICTX;

Holds information for a milter session. `SMFICTX` is created for each milter session. `SMFICTX` is the most important object in libmilter API.

### SMFICTX_PTR

    typedef struct smfi_str *SMFICTX_PTR;

The pointer type of `SMFICTX`.

### smfiDesc_str

    typedef struct smfiDesc smfiDesc_str;

Holds information for the milter. `smfiDesc_str` is used by `smfi_register()`.

### smfiDesc_ptr

    typedef struct smfiDesc *smfiDesc_ptr;

The pointer type of `smfiDesc_str`.

### sfsistat

    typedef int sfsistat;

Indicates response status returned by callback.

Available response status is one of the followings:

- `SMFIS_CONTINUE`

- `SMFIS_REJECT`

- `SMFIS_DISCARD`

- `SMFIS_ACCEPT`

- `SMFIS_TEMPFAIL`

- `SMFIS_NOREPLY`

- `SMFIS_SKIP`

- `SMFIS_ALL_OPTS`

### bool

    #      define bool int

The boolean type.

### true

    #      define true 1

The true value.

### false

    #      define false 0

The false value.

### struct smfiDesc

    struct smfiDesc {
        char          *xxfi_name;
        int            xxfi_version;
        unsigned long  xxfi_flags;

        sfsistat (*xxfi_connect)   (SMFICTX     *context,
                                       char        *host_name,
                                       _SOCK_ADDR  *address);
        sfsistat (*xxfi_helo)      (SMFICTX    *context,
                                       char       *fqdn);
        sfsistat (*xxfi_envfrom)   (SMFICTX    *context,
                                       char      **arguments);
        sfsistat (*xxfi_envrcpt)   (SMFICTX    *context,
                                       char      **arguments);
        sfsistat (*xxfi_header)    (SMFICTX    *context,
                                       char       *name,
                                       char       *value);
        sfsistat (*xxfi_eoh)       (SMFICTX    *context);
        sfsistat (*xxfi_body)      (SMFICTX    *context,
                                       unsigned char *data,
                                       size_t     data_size);
        sfsistat (*xxfi_eom)       (SMFICTX    *context);
        sfsistat (*xxfi_abort)     (SMFICTX    *context);
        sfsistat (*xxfi_close)     (SMFICTX    *context);
        sfsistat (*xxfi_unknown)   (SMFICTX    *context,
                                       const char *command);
        sfsistat (*xxfi_data)      (SMFICTX    *context);
        sfsistat (*xxfi_negotiate) (SMFICTX    *context,
                                       unsigned long  actions,
                                       unsigned long  steps,
                                       unsigned long  unused0,
                                       unsigned long  unused1,
                                       unsigned long *actions_output,
                                       unsigned long *steps_output,
                                       unsigned long *unused0_output,
                                       unsigned long *unused1_output);
    };

`smfiDesc` is used by `smfi_register()` to register a milter.

If `xxfi_name` is `NULL`, "Unknown" is used as default milter name.

`xxfi_version` must be specified `SMFI_VERSION`.

Here are the available `xxfi_flags` values:

- `SMFIF_ADDHDRS`: The milter may call `smfi_addheader()`.

- `SMFIF_CHGHDRS`: The milter may call `smfi_chgheader()`.

- `SMFIF_CHGBODY`: The milter may call `smfi_chgbody()`.

- `SMFIF_ADDRCPT`: The milter may call `smfi_addrcpt()`.

- `SMFIF_ADDRCPT_PAR`: The milter may call `smfi_addrcpt_par()`.

- `SMFIF_DELRCPT`: The milter may call `smfi_delrcpt()`.

- `SMFIF_QUARANTINE`: The milter may call `smfi_quarantine()`.

- `SMFIF_CHGFROM`: The milter may call `smfi_chgfrom()`.

- `SMFIF_SETSMLIST`: The milter may call `smfi_setsymlist()`.

They can be used together by bitwise OR.

All callbacks (e.g. `xxfi_helo()`, `xxfi_envfrom()` and so on) may be `NULL`. If a callback is `NULL`, the event is just ignored the milter.

#### Members

char *`xxfi_name`; | The name of the milter. |
int `xxfi_version`; | The version code of the milter. |
unsigned long `xxfi_flags`; | The flags of the milter. Available values are SMFIF_*. |
`xxfi_connect` () | See `xxfi_connect()`. |
`xxfi_helo` () | See `xxfi_helo()`. |
`xxfi_envfrom` () | See `xxfi_envfrom()`. |
`xxfi_envrcpt` () | See `xxfi_envrcpt()`. |
`xxfi_header` () | See `xxfi_header()`. |
`xxfi_eoh` () | See `xxfi_eoh()`. |
`xxfi_body` () | See `xxfi_body()`. |
`xxfi_eom` () | See `xxfi_eom()`. |
`xxfi_abort` () | See `xxfi_abort()`. |
`xxfi_close` () | See `xxfi_close()`. |
`xxfi_unknown` () | See `xxfi_unknown()`. |
`xxfi_data` () | See `xxfi_data()`. |
`xxfi_negotiate` () | See `xxfi_negotiate()`. |

### SMFIF_ADDHDRS

    #define SMFIF_ADDHDRS     0x00000001L

The milter may call `smfi_addheader()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIF_CHGBODY

    #define SMFIF_CHGBODY     0x00000002L

The milter may call `smfi_chgbody()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIF_MODBODY

    #define SMFIF_MODBODY     SMFIF_CHGBODY

Same as `SMFIF_CHGBODY`.

### SMFIF_ADDRCPT

    #define SMFIF_ADDRCPT     0x00000004L

The milter may call `smfi_addrcpt()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIF_DELRCPT

    #define SMFIF_DELRCPT     0x00000008L

The milter may call `smfi_delrcpt()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIF_CHGHDRS

    #define SMFIF_CHGHDRS     0x00000010L

The milter may call `smfi_chgheader()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIF_QUARANTINE

    #define SMFIF_QUARANTINE  0x00000020L

The milter may call `smfi_quarantine()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIF_CHGFROM

    #define SMFIF_CHGFROM     0x00000040L

The milter may call `smfi_chgfrom()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIF_ADDRCPT_PAR

    #define SMFIF_ADDRCPT_PAR 0x00000080L

The milter may call `smfi_addrcpt_par()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIF_SETSYMLIST

    #define SMFIF_SETSYMLIST  0x00000100L

The milter may call `smfi_setsymlist()`.

See also `smfiDesc`, `xxfi_negotiate()` and smfi_register on milter.org.

### SMFIS_CONTINUE

    #define SMFIS_CONTINUE    0

Continues the current process.

See each callback (`xxfi_connect()`, `xxfi_helo()` and so on) and callback return status description on milter.org.

### SMFIS_REJECT

    #define SMFIS_REJECT      1

Rejects the current processing target.

See each callback (`xxfi_connect()`, `xxfi_helo()` and so on) and callback return status description on milter.org.

### SMFIS_DISCARD

    #define SMFIS_DISCARD     2

Accepts the current processing target and discards it silently.

See each callback (`xxfi_envfrom()`, `xxfi_envrcpt()` and so on) and callback return status description on milter.org.

### SMFIS_ACCEPT

    #define SMFIS_ACCEPT      3

Accepts the current processing target.

See each callback (`xxfi_connect()`, `xxfi_helo()` and so on) and callback return status description on milter.org.

### SMFIS_TEMPFAIL

    #define SMFIS_TEMPFAIL    4

Replies a temporary failure status for the current processing target.

See each callback (`xxfi_connect()`, `xxfi_helo()` and so on) and callback return status description on milter.org.

### SMFIS_NOREPLY

    #define SMFIS_NOREPLY     7

Doesn't reply to the MTA.

See each callback (`xxfi_connect()`, `xxfi_helo()` and so on) and callback return status description on milter.org.

### SMFIS_SKIP

    #define SMFIS_SKIP        8

Skips the rest body chunks. This can be used only in `xxfi_body()`.

See also callback return status description on milter.org.

### SMFIS_ALL_OPTS

    #define SMFIS_ALL_OPTS    10

Uses the all negotiate options received from the MTA. This can be used only in `xxfi_negotiate()`.

### SMFIM_CONNECT

    #define SMFIM_CONNECT	  0

Indicates the protocol stage for `xxfi_connect()`.

See `smfi_setsymlist()`.

### SMFIM_HELO

    #define SMFIM_HELO	  1

Indicates the protocol stage for `xxfi_helo()`.

See `smfi_setsymlist()`.

### SMFIM_ENVFROM

    #define SMFIM_ENVFROM	  2

Indicates the protocol stage for `xxfi_envfrom()`.

See `smfi_setsymlist()`.

### SMFIM_ENVRCPT

    #define SMFIM_ENVRCPT	  3

Indicates the protocol stage for `xxfi_envrcpt()`.

See `smfi_setsymlist()`.

### SMFIM_DATA

    #define SMFIM_DATA	  4

Indicates the protocol stage for `xxfi_data()`.

See `smfi_setsymlist()`.

### SMFIM_EOM

    #define SMFIM_EOM	  5

Indicates the protocol stage for `xxfi_eom()`.

See `smfi_setsymlist()`.

### SMFIM_EOH

    #define SMFIM_EOH	  6

Indicates the protocol stage for `xxfi_eoh()`.

See `smfi_setsymlist()`.

### SMFIP_NOCONNECT

    #define SMFIP_NOCONNECT       0x00000001L

Indicates that the MTA should not send information for `xxfi_connect()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NOHELO

    #define SMFIP_NOHELO          0x00000002L

Indicates that the MTA should not send information for `xxfi_helo()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NOMAIL

    #define SMFIP_NOMAIL          0x00000004L

Indicates that the MTA should not send information for `xxfi_mail()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NORCPT

    #define SMFIP_NORCPT          0x00000008L

Indicates that the MTA should not send information for `xxfi_rcpt()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NOBODY

    #define SMFIP_NOBODY          0x00000010L

### SMFIP_NOHDRS

    #define SMFIP_NOHDRS          0x00000020L

Indicates that the MTA should not send information for `xxfi_header()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NOEOH

    #define SMFIP_NOEOH           0x00000040L

Indicates that the MTA should not send information for `xxfi_eoh()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_HDR

    #define SMFIP_NR_HDR          0x00000080L

Indicates that the milter don't reply on `xxfi_header()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NOHREPL

    #define SMFIP_NOHREPL         SMFIP_NR_HDR

Same as `SMFIP_NR_HDR`.

### SMFIP_NOUNKNOWN

    #define SMFIP_NOUNKNOWN       0x00000100L

Indicates that the MTA should not send information for `xxfi_unknown()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NODATA

    #define SMFIP_NODATA          0x00000200L

Indicates that the MTA should not send information for `xxfi_data()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_SKIP

    #define SMFIP_SKIP            0x00000400L

Indicates that the MTA supports `SMFIS_SKIP` in `xxfi_body()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_RCPT_REJ

    #define SMFIP_RCPT_REJ        0x00000800L

Indicates that the MTA should send rejected envelope recipients and `xxfi_envrcpt()` is called for them.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_CONN

    #define SMFIP_NR_CONN         0x00001000L

Indicates that the milter don't reply on `xxfi_connect()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_HELO

    #define SMFIP_NR_HELO         0x00002000L

Indicates that the milter don't reply on `xxfi_helo()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_MAIL

    #define SMFIP_NR_MAIL         0x00004000L

Indicates that the milter don't reply on `xxfi_envfrom()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_RCPT

    #define SMFIP_NR_RCPT         0x00008000L

Indicates that the milter don't reply on `xxfi_envrcpt()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_DATA

    #define SMFIP_NR_DATA         0x00010000L

Indicates that the milter don't reply on `xxfi_data()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_UNKN

    #define SMFIP_NR_UNKN         0x00020000L

Indicates that the milter don't reply on `xxfi_unknown()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_EOH

    #define SMFIP_NR_EOH          0x00040000L

Indicates that the milter don't reply on `xxfi_eoh()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_NR_BODY

    #define SMFIP_NR_BODY         0x00080000L

Indicates that the milter don't reply on `xxfi_body()`.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.

### SMFIP_HDR_LEADSPC

    #define SMFIP_HDR_LEADSPC     0x00100000L

Indicates that `xxfi_header()` callback is received a header value including spaces after ':'. See `xxfi_header()` for examples.

This flag can be got/set to `steps_output` of `xxfi_negotiate()`.