![]() |
![]() |
![]() |
milter manager Reference Manual | ![]() |
---|---|---|---|---|
#define SMFI_VERSION #define SM_LM_VRS_MAJOR (version) #define SM_LM_VRS_MINOR (version) #define SM_LM_VRS_PLVL (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 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); int smfi_opensocket (bool remove_socket); int smfi_register (struct smfiDesc description); int smfi_main (void); int smfi_setbacklog (int backlog); int smfi_setdbg (int level); int smfi_settimeout (int timeout); int smfi_setconn (char *connection_spec); int smfi_stop (void); int smfi_version (unsigned int *major, unsigned int *minor, unsigned int *patch_level); #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 char* smfi_getsymval (SMFICTX *context, char *name); int smfi_setreply (SMFICTX *context, char *return_code, char *extended_code, char *message); int smfi_setmlreply (SMFICTX *context, const char *return_code, const char *extended_code, ...); int smfi_addheader (SMFICTX *context, char *name, char *value); int smfi_chgheader (SMFICTX *context, char *name, int index, char *value); int smfi_insheader (SMFICTX *context, int index, char *name, char *value); int smfi_chgfrom (SMFICTX *context, char *mail, char *arguments); int smfi_addrcpt (SMFICTX *context, char *recipient); int smfi_addrcpt_par (SMFICTX *context, char *recipient, char *arguments); int smfi_delrcpt (SMFICTX *context, char *recipient); int smfi_progress (SMFICTX *context); int smfi_replacebody (SMFICTX *context, unsigned char *new_body, int new_body_size); int smfi_quarantine (SMFICTX *context, char *reason); int smfi_setpriv (SMFICTX *context, void *data); void* smfi_getpriv (SMFICTX *context); int smfi_setsymlist (SMFICTX *context, int state, char *macros);
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.
#define SM_LM_VRS_MAJOR(version) (((version) & 0x7f000000) >> 24)
Extracts major version number from version
.
|
the version number. |
#define SM_LM_VRS_MINOR(version) (((version) & 0x007fff00) >> 8)
Extracts minor version number from version
.
|
the version number. |
#define SM_LM_VRS_PLVL(version) ((version) & 0x0000007f)
Extracts patch level from version
.
|
the version number. |
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.
typedef struct smfiDesc smfiDesc_str;
Holds information for the milter. smfiDesc_str
is
used by smfi_register()
.
typedef int sfsistat;
Indicates response status returned by callback.
Available response status is one of the followings:
sfsistat xxfi_connect (SMFICTX *context, char *host_name, _SOCK_ADDR *address);
This callback is called at the start of each milter session.
All available response statuses are the followings:
Continues processing the current connection. |
|
Rejects the current connection. |
|
Accepts the current connection without further more processing. |
|
Rejects the current connection with a temporary failure. (i.e. 4xx status code in SMTP) |
|
Doesn't send a reply back to MTA. The milter
must set |
See also xxfi_connect on milter.org.
|
the context for the current milter session. |
|
the host name of the SMTP client. |
|
the address of the SMTP client. |
Returns : |
response status. |
sfsistat xxfi_helo (SMFICTX *context, char *fqdn);
This callback is called on SMTP's "HELO"/"EHLO" command.
All available response statuses are the followings:
Continues processing the current connection. |
|
Rejects the current connection. |
|
Accepts the current connection without further more processing. |
|
Rejects the current connection with a temporary failure. (i.e. 4xx status code in SMTP) |
|
Doesn't send a reply back to MTA. The milter
must set |
See also xxfi_helo on milter.org.
|
the context for the current milter session. |
|
the FQDN in SMTP's "HELO"/"EHLO" command. |
Returns : |
response status. |
sfsistat xxfi_envfrom (SMFICTX *context, char **arguments);
This callback is called on SMTP's "MAIL FROM" command.
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current envelope from address and message. A new envelope from may be specified. |
|
Accepts the current message and discards it silently. |
|
Accepts the current message without further more processing. |
|
Rejects the current envelope from address and message with temporary failure. (i.e. 4xx status code in SMTP) A new envelope from address may be specified. |
|
Doesn't send a reply back to MTA. The milter
must set |
See also xxfi_envfrom on milter.org.
|
the context for the current milter session. |
|
the SMTP's "MAIL FROM" command
arguments. The first element is sender
address. NULL -terminated.
|
Returns : |
response status. |
sfsistat xxfi_envrcpt (SMFICTX *context, char **arguments);
This callback is called on SMTP's "RCPT TO" command.
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current envelope recipient address. Processing the current messages is continued. |
|
Accepts the current message and discards it silently. |
|
Accepts the current envelope recipient. |
|
Rejects the current envelope recipient address with temporary failure. (i.e. 4xx status code in SMTP) Processing the current message is continued. |
|
Doesn't send a reply back to MTA. The milter
must set |
See also xxfi_envrcpt on milter.org.
|
the context for the current milter session. |
|
the SMTP's "RCPT TO" command
arguments. The first element is recipient
address. NULL -terminated.
|
Returns : |
response status. |
sfsistat xxfi_header (SMFICTX *context, char *name, char *value);
This callback is called on each header. If
SMFIP_HDR_LEADSPC
flag is set to
smfiDesc
::xxfi_flags, value
have spaces after
header name and value separator ":".
Example:
From: from <from@example.com> To: recipient <recipient@example.com> Subject:a subject
With SMFIP_HDR_LEADSPC
:
"From", " from <from@example.com>" "To", " recipient <recipient@example.com>" "Subject", "a subject"
Without SMFIP_HDR_LEADSPC
:
"From", "from <from@example.com>" "To", "recipient <recipient@example.com>" "Subject", "a subject"
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current message. |
|
Accepts the current message and discards it silently. |
|
Accepts the current message without further more processing. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) |
|
Doesn't send a reply back to MTA. The milter
must set |
See also xxfi_header on milter.org.
|
the context for the current milter session. |
|
the header name. |
|
the header value. value may include folded
white space.
|
Returns : |
response status. |
sfsistat xxfi_eoh (SMFICTX *context);
This callback is called on all headers are processed.
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current message. |
|
Accepts the current message and discards it silently. |
|
Accepts the current message without further more processing. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) |
|
Doesn't send a reply back to MTA. The milter
must set |
See also xxfi_eof on milter.org.
|
the context for the current milter session. |
Returns : |
response status. |
sfsistat xxfi_body (SMFICTX *context, unsigned char *data, size_t data_size);
This callback is called on body data is received. This
callback is called zero or more times between
xxfi_eoh()
and xxfi_eom()
.
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current message. |
|
Accepts the current message and discards it silently. |
|
Accepts the current message without further more processing. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) |
|
Skips further body
processing. |
|
Doesn't send a reply back to MTA. The milter
must set |
See also xxfi_body on milter.org.
|
the context for the current milter session. |
|
the body chunk. |
|
the size of data .
|
Returns : |
response status. |
sfsistat xxfi_eom (SMFICTX *context);
This callback is called after all xxfi_body()
are
called. All message modifications can be done only in
this callback. The modifications can be done with
smfi_addheader()
, smfi_chgfrom()
and so on.
All available response statuses are the followings:
Continues processing the current message. |
|
Accepts the current message and discards it silently. |
|
Accepts the current message without further more processing. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) |
See also xxfi_eom on milter.org.
|
the context for the current milter session. |
Returns : |
response status. |
sfsistat xxfi_abort (SMFICTX *context);
This callback may be called at any time between
xxfi_envfrom()
and xxfi_eom()
. This callback is only
called if the milter causes an internal error and the
message processing isn't completed. For example, if
the milter has already returned SMFIS_ACCEPT
,
SMFIS_REJECT
, SMFIS_DISCARD
and SMFIS_TEMPFAIL
,
this callback will not be called.
If the milter has any resources allocated for the
message between xxfi_envfrom()
and xxfi_eom()
, should
be freed in this callback. But any resources
allocated for the connection should not be freed in
this callback. It should be freed in xxfi_close()
.
All available response statuses are the followings:
Continues processing the current message. |
|
Accepts the current message and discards it silently. |
|
Accepts the current message without further more processing. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) |
See also xxfi_abort on milter.org.
|
the context for the current milter session. |
Returns : |
response status. |
sfsistat xxfi_close (SMFICTX *context);
This callback is called at the end of each miler session. If the milter has any resources allocated for the session free, should be freed in this callback.
All response statuses are ignored. Use SMFIS_CONTINUE
.
See also xxfi_close on milter.org.
|
the context for the current milter session. |
Returns : |
response status. |
sfsistat xxfi_unknown (SMFICTX *context, const char *command);
This callback is called on unknown or unimplemented SMTP command is sent.
All available response statuses are the followings:
Rejects the current message. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) |
|
Doesn't send a reply back to MTA. The milter
must set |
Note that the unknown or unimplemented SMTP command will always be rejected by MTA.
See also xxfi_unknown on milter.org.
|
the context for the current milter session. |
|
the unknown SMTP command. |
Returns : |
response status. |
sfsistat xxfi_data (SMFICTX *context);
This callback is called on SMTP's "DATA" command.
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current message. |
|
Accepts the current message and discards it silently. |
|
Accepts the current envelope recipient. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) |
|
Doesn't send a reply back to MTA. The milter
must set |
See also xxfi_data on milter.org.
|
the context for the current milter session. |
Returns : |
response status. |
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);
This callback is called on negotiate request from
MTA. If you want to change received actions
and
steps
from MTA, you set actions_output
and
steps_output
and returns SMFIS_CONTINUE
. If you
don't need to change actions
and steps
, you can
just return SMFIS_ALL_OPTS
.
All available response statuses are the followings:
Enables all available actions and steps. |
|
Rejects the current session. |
|
Continues processing the current session with
|
See also xxfi_negotiate on milter.org.
|
the context for the current milter session. |
|
the actions received from MTA. |
|
the milter protocol steps offered from MTA. |
|
unused. |
|
unused. |
|
the actions requested to MTA. |
|
the milter protocol steps requested to MTA. |
|
unused. |
|
unused. |
Returns : |
response status. |
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.
|
Whether or not trying to remove existing UNIX domain socket before creating a new socket. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
The milter description. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
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.
|
The maximum length of the pending connections queue. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
The log level. |
Returns : |
always MI_SUCCESS .
|
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.
|
The timeout value in seconds. |
Returns : |
always MI_SUCCESS .
|
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.
|
The connection spec for communicating MTA. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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 .
|
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.
|
return location for major version. |
|
return location for minor version. |
|
return location for patch level. |
Returns : |
always MI_SUCCESS .
|
#define SMFIF_ADDHDRS 0x00000001L
The milter may call smfi_addheader()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#define SMFIF_CHGBODY 0x00000002L
The milter may call smfi_chgbody()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#define SMFIF_ADDRCPT 0x00000004L
The milter may call smfi_addrcpt()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#define SMFIF_DELRCPT 0x00000008L
The milter may call smfi_delrcpt()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#define SMFIF_CHGHDRS 0x00000010L
The milter may call smfi_chgheader()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#define SMFIF_QUARANTINE 0x00000020L
The milter may call smfi_quarantine()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#define SMFIF_CHGFROM 0x00000040L
The milter may call smfi_chgfrom()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#define SMFIF_ADDRCPT_PAR 0x00000080L
The milter may call smfi_addrcpt_par()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#define SMFIF_SETSYMLIST 0x00000100L
The milter may call smfi_setsymlist()
.
See also smfiDesc
, xxfi_negotiate()
and
smfi_register on milter.org.
#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.
#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.
#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.
#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.
#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.
#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.
#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.
#define SMFIS_ALL_OPTS 10
Uses the all negotiate options received from the
MTA. This can be used only in xxfi_negotiate()
.
#define SMFIM_CONNECT 0
Indicates the protocol stage for xxfi_connect()
.
See smfi_setsymlist()
.
#define SMFIM_HELO 1
Indicates the protocol stage for xxfi_helo()
.
See smfi_setsymlist()
.
#define SMFIM_ENVFROM 2
Indicates the protocol stage for xxfi_envfrom()
.
See smfi_setsymlist()
.
#define SMFIM_ENVRCPT 3
Indicates the protocol stage for xxfi_envrcpt()
.
See smfi_setsymlist()
.
#define SMFIM_DATA 4
Indicates the protocol stage for xxfi_data()
.
See smfi_setsymlist()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
#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()
.
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.
|
the context for the current milter session. |
|
the name of a macro. |
Returns : |
a value of the macro named name if it exists,
NULL otherwise.
|
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.
|
the context for the current milter session. |
|
the three-digit SMTP error reply code. (RFC 2821) Only 4xx and 5xx are accepted. |
|
the extended reply code (RFC 1893/2034),
or NULL . Only 4.x.x and 5.x.x are
available.
|
|
the text part of the SMTP reply, or NULL .
|
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the three-digit SMTP error reply code. (RFC 2821) Only 4xx and 5xx are accepted. |
|
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.
|
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.
|
the context for the current milter session. |
|
the header name. |
|
the header value. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the header name. |
|
the index of headers that all of them are named
name . (1-based)
|
|
the header value. Use NULL to delete the target
header.
|
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the index of inserted header. 0 means that the header is prepended. |
|
the header name. |
|
the header value. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the new sender address. |
|
the extra arguments for ESMTP. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the new recipient address. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the recipient address. |
|
the extra arguments for ESMTP. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the recipient address. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the new body data. |
|
the size of new_body .
|
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the quarantine reason. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
|
the private data. |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|
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.
|
the context for the current milter session. |
Returns : |
the private data set by smfi_setpriv() or NULL .
|
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.
|
the context for the current milter session. |
|
the state defined as SMFIM_XXX like SMFIM_CONNECT .
|
|
the space separated macro names like "{rcpt_mailer} {rcpt_host}". |
Returns : |
MI_SUCCESS if success, MI_FAILURE otherwise.
|