Top | ![]() |
![]() |
![]() |
![]() |
MilterClient * | client | Read / Write / Construct Only |
MilterMessageResult * | message-result | Read / Write |
MilterOption * | option | Read / Write |
guint | packet-buffer-size | Read / Write |
char * | quarantine-reason | Read / Write |
MilterClientContextState | state | Read / Write |
MilterStatus | status | Read / Write |
gboolean | use-bytes | Read / Write |
MilterStatus | abort | Run Last |
void | abort-response | Run Last |
MilterStatus | body | Run Last |
MilterStatus | body-bytes | Run Last |
void | body-response | Run Last |
MilterStatus | connect | Run Last |
void | connect-response | Run Last |
MilterStatus | data | Run Last |
void | data-response | Run Last |
void | define-macro | Run Last |
MilterStatus | end-of-header | Run Last |
void | end-of-header-response | Run Last |
MilterStatus | end-of-message | Run Last |
MilterStatus | end-of-message-bytes | Run Last |
void | end-of-message-response | Run Last |
MilterStatus | envelope-from | Run Last |
void | envelope-from-response | Run Last |
MilterStatus | envelope-recipient | Run Last |
void | envelope-recipient-response | Run Last |
MilterStatus | header | Run Last |
void | header-response | Run Last |
MilterStatus | helo | Run Last |
void | helo-response | Run Last |
void | message-processed | Run Last |
MilterStatus | negotiate | Run Last |
void | negotiate-response | Run Last |
void | timeout | Run Last |
MilterStatus | unknown | Run Last |
void | unknown-response | Run Last |
#define | MILTER_CLIENT_CONTEXT_ERROR |
enum | MilterClientContextError |
enum | MilterClientContextState |
#define | MILTER_TYPE_CLIENT_CONTEXT |
struct | MilterClientContextClass |
MilterClientContext |
The MilterClientContext
processes one milter protocol
session. It means MilterClientContext
instance is
created for each milter protocol session.
To process each milter protocol command, you need to
connect signals of
MilterClientContext
. MilterClientContext
has signals
that correspond to milter protocol events:
NOTE: You will need to check whether the current state is
message processing or not. You can use
MILTER_CLIENT_CONTEXT_STATE_IN_MESSAGE_PROCESSING
for it.
Here is an example to connect signals. It connects all signals and each connected signal handler prints its event name:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
static MilterStatus cb_negotiate (MilterClientContext *context, MilterOption *option, gpointer user_data) { g_print("negotiate\n"); return MILTER_STATUS_ALL_OPTIONS; } static MilterStatus cb_connect (MilterClientContext *context, const gchar *host_name, const struct sockaddr *address, socklen_t address_length, gpointer user_data) { g_print("connect\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_helo (MilterClientContext *context, const gchar *fqdn, gpointer user_data) { g_print("helo\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_envelope_from (MilterClientContext *context, const gchar *from, gpointer user_data) { g_print("envelope-from\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_envelope_recipient (MilterClientContext *context, const gchar *to, gpointer user_data) { g_print("envelope-recipient\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_data (MilterClientContext *context, gpointer user_data) { g_print("data\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_header (MilterClientContext *context, const gchar *name, const gchar *value, gpointer user_data) { g_print("header\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_end_of_header (MilterClientContext *context, gpointer user_data) { g_print("end-of-header\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_body (MilterClientContext *context, const gchar *chunk, gsize length, gpointer user_data) { g_print("body\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_end_of_message (MilterClientContext *context, const gchar *chunk, gsize length, gpointer user_data) { g_print("end-of-message\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_abort (MilterClientContext *context, MilterClientContextState state, gpointer user_data) { g_print("abort\n"); return MILTER_STATUS_CONTINUE; } static MilterStatus cb_unknown (MilterClientContext *context, const gchar *command, gpointer user_data) { g_print("unknown\n"); return MILTER_STATUS_CONTINUE; } static void setup_context_signals (MilterClientContext *context) { #define CONNECT(name) \ g_signal_connect(context, #name, G_CALLBACK(cb_ ## name), NULL) CONNECT(negotiate); CONNECT(connect); CONNECT(helo); CONNECT(envelope_from); CONNECT(envelope_recipient); CONNECT(data); CONNECT(header); CONNECT(end_of_header); CONNECT(body); CONNECT(end_of_message); CONNECT(abort); CONNECT(unknown); #undef CONNECT } |
#define MILTER_CLIENT_CONTEXT_STATE_IN_MESSAGE_PROCESSING(state)
MilterClientContext *
milter_client_context_new (MilterClient *client
);
Creates a new context object. Normally, context object is
created by MilterClient
and passed by
“connection-established” signal.
gboolean milter_client_context_feed (MilterClientContext *context
,const gchar *chunk
,gsize size
,GError **error
);
Feeds a chunk to the context
. You can use it for testing
or debugging.
context |
||
chunk |
The string to be fed
to |
[array length=size][element-type guint8] |
size |
The size of |
|
error |
Return location for an error, or |
[nullable] |
gpointer
milter_client_context_get_private_data
(MilterClientContext *context
);
Gets the private data of the context
.
void milter_client_context_set_private_data (MilterClientContext *context
,gpointer data
,GDestroyNotify destroy
);
Sets the private data of the context
. data
is
destroyed by destroy
when data
is unset. data
is unset
when new private data is set or context
is destroyed.
gboolean milter_client_context_set_reply (MilterClientContext *context
,guint code
,const gchar *extended_code
,const gchar *message
,GError **error
);
Sets the error reply code. 4xx code
is used on
MILTER_REPLY_TEMPORARY_FAILURE
. 5xx code
is used on
MILTER_REPLY_REJECT
.
See also smfi_setreply on milter.org.
gchar *
milter_client_context_format_reply (MilterClientContext *context
);
Formats the current error reply code specified by
milter_client_context_set_reply()
. If error reply code
isn't set, this function returns NULL
.
gboolean milter_client_context_add_header (MilterClientContext *context
,const gchar *name
,const gchar *value
,GError **error
);
Adds a header to the current message's header list. This function can be called in “end-of-message” signal.
See also smfi_addheader on milter.org.
FIXME: write about MILTER_ACTION_ADD_HEADERS
.
gboolean milter_client_context_insert_header (MilterClientContext *context
,guint32 index
,const gchar *name
,const gchar *value
,GError **error
);
Inserts a header into the current message's header lists
at index
. This function can be called in
“end-of-message” signal. See also
smfi_insheader on milter.org.
FIXME: write about MILTER_ACTION_ADD_HEADERS.
gboolean milter_client_context_change_header (MilterClientContext *context
,const gchar *name
,guint32 index
,const gchar *value
,GError **error
);
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. This function can be
called in “end-of-message” signal.
See also smfi_chgheader on milter.org.
FIXME: write about MILTER_ACTION_CHANGE_HEADERS.
gboolean milter_client_context_delete_header (MilterClientContext *context
,const gchar *name
,guint32 index
,GError **error
);
Deletes a header that is located at index
in headers
that all of them are named name
. This function can be
called in “end-of-message” signal.
This function works same as
milter_client_context_change_header()
with NULL
as
value
.
FIXME: write about MILTER_ACTION_CHANGE_HEADERS.
gboolean milter_client_context_change_from (MilterClientContext *context
,const gchar *from
,const gchar *parameters
,GError **error
);
Changes the envelope from address of the current message.
ESMTP's 'MAIL FROM' parameter can be set by
parameters
. parameters
may be NULL
. This function can be
called in “end-of-message” signal.
See also smfi_chgfrom
on milter.org.
FIXME: write about MILTER_ACTION_CHANGE_FROM.
gboolean milter_client_context_add_recipient (MilterClientContext *context
,const gchar *recipient
,const gchar *parameters
,GError **error
);
Adds a new envelope recipient address to the current
message. ESMTP's 'RCPT TO' parameter can be set by
parameters
. parameters
may be NULL
. This function can
be called in “end-of-message”
signal. See also smfi_addrcpt
and smfi_addrcpt_par
on milter.org.
FIXME: write about MILTER_ACTION_ADD_RECIPIENT and MILTER_ACTION_ADD_ENVELOPE_RECIPIENT_WITH_PARAMETERS.
gboolean milter_client_context_delete_recipient (MilterClientContext *context
,const gchar *recipient
,GError **error
);
Removes a envelope recipient that named recipient
. This
function can be called in
“end-of-message” signal. See also
smfi_delrcpt
on milter.org.
FIXME: write about MILTER_ACTION_DELETE_RECIPIENT.
gboolean milter_client_context_replace_body (MilterClientContext *context
,const gchar *body
,gsize body_size
,GError **error
);
This is a const gchar *
version of
milter_client_context_replace_body_bytes()
.
[skip]
context |
||
body |
the new body. |
[array length=body_size][element-type guint8] |
body_size |
The size of |
|
error |
Return location for an error, or |
gboolean milter_client_context_replace_body_bytes (MilterClientContext *context
,GBytes *body
,GError **error
);
Replaces the body of the current message with body
. This
function can be called in
“end-of-message” signal. See also
smfi_replacebody
on milter.org.
FIXME: write about MILTER_ACTION_CHANGE_BODY.
[rename-to milter_client_context_replace_body]
Since: 2.1.6
gboolean
milter_client_context_progress (MilterClientContext *context
);
Notifies the MTA that this milter is still in progress. This function can be called in “end-of-message” signal. See also smfi_progress on milter.org.
gboolean milter_client_context_quarantine (MilterClientContext *context
,const gchar *reason
);
Quarantines the current message with reason
. This
function can be called in
“end-of-message” signal. See also
smfi_quarantine
on milter.org.
FIXME: write about MILTER_ACTION_QUARANTINE.
void milter_client_context_set_timeout (MilterClientContext *context
,guint timeout
);
Sets the timeout by seconds. If MTA doesn't responses in
timeout
seconds, “timeout”
signal is emitted. See also
smfi_settimeout
on milter.org.
guint
milter_client_context_get_timeout (MilterClientContext *context
);
Gets the timeout by seconds.
void milter_client_context_set_state (MilterClientContext *context
,MilterClientContextState state
);
Sets the current state.
MilterClientContextState
milter_client_context_get_state (MilterClientContext *context
);
Gets the current state.
void milter_client_context_set_quarantine_reason (MilterClientContext *context
,const gchar *reason
);
Sets the quarantine reason.
const gchar *
milter_client_context_get_quarantine_reason
(MilterClientContext *context
);
Gets the quarantine reason.
MilterClientContextState
milter_client_context_get_last_state (MilterClientContext *context
);
Gets the last state. It's one of start, negotiate, connect, helo, envelope-from, envelope-recipient, data, unknown, header, end-of-header, body and end-of-message.
void milter_client_context_set_status (MilterClientContext *context
,MilterStatus status
);
Sets the current status.
MilterStatus
milter_client_context_get_status (MilterClientContext *context
);
Gets the current status.
void milter_client_context_set_option (MilterClientContext *context
,MilterOption *option
);
Sets the option for the context.
MilterOption *
milter_client_context_get_option (MilterClientContext *context
);
Gets the option for the context.
void milter_client_context_set_socket_address (MilterClientContext *context
,MilterGenericSocketAddress *address
);
Sets the socket address of connected server for the context.
MilterGenericSocketAddress *
milter_client_context_get_socket_address
(MilterClientContext *context
);
Gets the socket address of connected server for the context.
MilterMessageResult *
milter_client_context_get_message_result
(MilterClientContext *context
);
Gets the message result of context
.
void milter_client_context_set_message_result (MilterClientContext *context
,MilterMessageResult *result
);
Sets the message result of context
.
void
milter_client_context_reset_message_related_data
(MilterClientContext *context
);
Resets message related data of context
.
Normally, you don't need to call this function.
guint
milter_client_context_get_n_processing_sessions
(MilterClientContext *context
);
Returns number of the current processing sessions.
void milter_client_context_set_packet_buffer_size (MilterClientContext *context
,guint size
);
Sets the packet buffer size for the context. Packets on end-of-message are buffered until the buffer size is full. Packet buffering is for performance.
guint
milter_client_context_get_packet_buffer_size
(MilterClientContext *context
);
Gets the packet buffer size for the context.
void milter_client_context_set_use_bytes (MilterClientContext *context
,gboolean use
);
context |
||
use |
Whether “body-bytes” and “end-of-message-bytes” are used instead of “body” and “end-of-message”. |
Since: 2.1.6
gboolean
milter_client_context_get_use_bytes (MilterClientContext *context
);
Whether “body-bytes” and “end-of-message-bytes” are used instead of “body” and “end-of-message”.
Since: 2.1.6
void milter_client_context_set_mail_transaction_shelf_value (MilterClientContext *context
,const gchar *key
,const gchar *value
);
Sets the string for the mail_transaction_shelf.
const gchar * milter_client_context_get_mail_transaction_shelf_value (MilterClientContext *context
,const gchar *key
);
Gets the string for the mail_transaction_shelf.
GHashTable *
milter_client_context_get_mail_transaction_shelf
(MilterClientContext *context
);
Gets the mail_transaction_shelf. This is a mail-transaction scope storage.
void
milter_client_context_clear_mail_transaction_shelf
(MilterClientContext *context
);
Remove all keys and values from mail_transaction_shelf.
void (*MilterClientMailTransactionShelfFunc) (const gchar *key
,const gchar *value
,gpointer user_data
);
It is called with each metadata associated with a mail transaction,
together with the user_data
parameter which is passed to
milter_client_context_mail_transaction_shelf_foreach()
.
key |
A key. |
|
value |
A value. |
|
user_data |
User data passed to
|
void milter_client_context_mail_transaction_shelf_foreach (MilterClientContext *context
,MilterClientMailTransactionShelfFunc func
,gpointer user_data
);
A wrapper for g_hash_table_foreach()
.
context |
||
func |
the function to call for each key/value pair. |
[scope call] |
user_data |
user data to pass to the function |
#define MILTER_CLIENT_CONTEXT_ERROR (milter_client_context_error_quark())
Used to get the GError quark for MilterClientContext errors.
These identify the variable errors that can occur while
calling MilterClientContext
functions.
Indicates a
status code specified by
|
||
Indicates an IO error causing on writing/reading milter protocol data. |
||
Indicates unexpected
|
||
Indicates
unexpected operation is requested on the current
|
||
Indicates
unexpected operation is requested on the context's
|
||
Indicates unexpected empty value is passed. |
These identify the state of MilterClientContext
.
Invalid state. |
||
Just started. |
||
Starting negotiation. |
||
Received negotiation response. |
||
Sent connection information. |
||
Received connection information response. |
||
Starting HELO. |
||
Received HELO response. |
||
Starting MAIL FROM command. |
||
Receive MAIL FROM response. |
||
Starting RCPT TO command. |
||
Receive RCPT TO response. |
||
Starting DATA command. |
||
Receive DATA response. |
||
Receiving unknown SMTP command. |
||
Receive unknown SMTP command response. |
||
Sent a header. |
||
Receive header response. |
||
All headers are sent. |
||
Receive end-of-header response. |
||
Sending body chunks. |
||
Received body response. |
||
All body chunks are sent. |
||
Receive end-of-message response. |
||
Starting quitting. |
||
Receive quit response. |
||
Starting aborting. |
||
Receive abort response. |
||
Finished. |
struct MilterClientContextClass { MilterProtocolAgentClass parent_class; MilterStatus (*negotiate) (MilterClientContext *context, MilterOption *option, MilterMacrosRequests *macros_requests); void (*negotiate_response) (MilterClientContext *context, MilterOption *option, MilterMacrosRequests *macros_requests, MilterStatus status); void (*define_macro) (MilterClientContext *context, MilterCommand command, GHashTable *macros); MilterStatus (*connect) (MilterClientContext *context, const gchar *host_name, struct sockaddr *address, socklen_t address_length); void (*connect_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*helo) (MilterClientContext *context, const gchar *fqdn); void (*helo_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*envelope_from) (MilterClientContext *context, const gchar *from); void (*envelope_from_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*envelope_recipient) (MilterClientContext *context, const gchar *recipient); void (*envelope_recipient_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*data) (MilterClientContext *context); void (*data_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*unknown) (MilterClientContext *context, const gchar *command); void (*unknown_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*header) (MilterClientContext *context, const gchar *name, const gchar *value); void (*header_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*end_of_header) (MilterClientContext *context); void (*end_of_header_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*body) (MilterClientContext *context, const gchar *chunk, gsize size); MilterStatus (*body_bytes) (MilterClientContext *context, GBytes *chunk); void (*body_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*end_of_message) (MilterClientContext *context, const gchar *chunk, gsize size); MilterStatus (*end_of_message_bytes) (MilterClientContext *context, GBytes *chunk); void (*end_of_message_response) (MilterClientContext *context, MilterStatus status); MilterStatus (*abort) (MilterClientContext *context, MilterClientContextState state); void (*abort_response) (MilterClientContext *context, MilterStatus status); void (*timeout) (MilterClientContext *context); void (*message_processed) (MilterClientContext *context, MilterMessageResult *result); };
“client”
property “client” MilterClient *
The client of the context.
Owner: MilterClientContext
Flags: Read / Write / Construct Only
“message-result”
property “message-result” MilterMessageResult *
The message result of client context.
Owner: MilterClientContext
Flags: Read / Write
“option”
property “option” MilterOption *
The option of client context.
Owner: MilterClientContext
Flags: Read / Write
“packet-buffer-size”
property “packet-buffer-size” guint
The packet buffer size of the client context.
Owner: MilterClientContext
Flags: Read / Write
Default value: 0
“quarantine-reason”
property “quarantine-reason” char *
The quarantine reason of client context.
Owner: MilterClientContext
Flags: Read / Write
Default value: NULL
“state”
property“state” MilterClientContextState
The state of client context.
Owner: MilterClientContext
Flags: Read / Write
Default value: MILTER_CLIENT_CONTEXT_STATE_INVALID
“status”
property“status” MilterStatus
The status of client context.
Owner: MilterClientContext
Flags: Read / Write
Default value: MILTER_STATUS_DEFAULT
“abort”
signalMilterStatus user_function (MilterClientContext *context, MilterClientContextState state, gpointer user_data)
This signal may be emitted at any time between
“envelope-from” and
“end-of-message”. This signal is
only emitted if the milter causes an internal error
and the message processing isn't completed. For
example, if the milter has already returned
MILTER_STATUS_ACCEPT
, MILTER_STATUS_REJECT
,
MILTER_STATUS_DISCARD
and
MILTER_STATUS_TEMPORARY_FAILURE
, this signal will
not emitted.
If the milter has any resources allocated for the message between “envelope-from” and “end-of-message”, should be freed in this signal. But any resources allocated for the connection should not be freed in this signal. It should be freed in “finished”.
All available response statuses are the followings:
Continues processing the current message. |
|
Accepts the current message and discards it silently. “abort” is not emitted. |
|
Accepts the current message without further more processing. “abort” is not emitted. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) “abort” is not emitted. |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“end-of-message-response”
signal by yourself with one of the above
|
See also xxfi_abort on milter.org.
context |
The context that received the signal. |
|
state |
The state aborted on. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“abort-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“abort” returns a status except
MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“abort”, you need to emit this
signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“body”
signalMilterStatus user_function (MilterClientContext *context, char *chunk, guint64 size, gpointer user_data)
This signal is emitted on body data is received. This signal is emitted zero or more times between “end-of-header” and “end-of-message”.
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current message. “abort” is not emitted. |
|
Accepts the current message and discards it silently. “abort” is not emitted. |
|
Accepts the current message without further more processing. “abort” is not emitted. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) “abort” is not emitted. |
|
Skips further body processing. “end-of-message” is emitted. |
|
Doesn't send a reply back to MTA.
The milter must set |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“body-response”
signal by yourself with one of the above
|
See also xxfi_body on milter.org.
context |
The context that received the signal. |
|
chunk |
The body chunk. |
|
size |
The size of |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“body-bytes”
signalMilterStatus user_function (MilterClientContext *context, GBytes *chunk, gpointer user_data)
You can use this signal instead of
“body-bytes” by calling
milter_client_context_use_bytes(TRUE)
.
context |
The context that received the signal. |
|
chunk |
The body chunk. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 2.1.6.
“body-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“body” returns a status except
MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“body”, you need to emit this
signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“connect”
signalMilterStatus user_function (MilterClientContext *context, char *host_name, gpointer address, guint address_size, gpointer user_data)
This signal is emitted on SMTP client is connected to MTA.
All available response statuses are the followings:
Continues processing the current connection. |
|
Rejects the current connection. “finished” will be emitted. |
|
Accepts the current connection without further more processing. “finished” will be emitted. |
|
Rejects the current connection with a temporary failure. (i.e. 4xx status code in SMTP) “finished” will be emitted. |
|
Doesn't send a reply back to MTA.
The milter must set |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“connect-response” signal by
yourself with one of the above
|
See also xxfi_connect on milter.org.
context |
the context that received the signal. |
|
host_name |
the host name of connected SMTP client. |
|
address |
the address of connected SMTP client. (struct sockaddr) |
|
address_size |
the size of |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“connect-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“connect” returns a status except
MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“connect”, you need to emit this
signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“data”
signalMilterStatus user_function (MilterClientContext *context, gpointer user_data)
This signal is emitted on SMTP's "DATA" command.
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current message. “abort” is not emitted. |
|
Accepts the current message and discards it silently. “abort” is not emitted. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) “abort” is not emitted. |
|
Doesn't send a reply back to MTA.
The milter must set |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“data-response”
signal by yourself with one of the above
|
See also xxfi_data on milter.org.
context |
the context that received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“data-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“data” returns a status except
MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“data”, you need to emit this
signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“define-macro”
signalvoid user_function (MilterClientContext *context, MilterCommand command, gpointer macros, gpointer user_data)
This signal is emitted when macro definition is received. Normally, this signal isn't needed to be connected.
context |
the context that received the signal. |
|
command |
the command to be defined macros. |
|
macros |
the macro definitions. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“end-of-header”
signalMilterStatus user_function (MilterClientContext *context, gpointer user_data)
This signal is emitted on all headers are processed.
All available response statuses are the followings:
Continues processing the current message. |
|
Rejects the current message. “abort” is not emitted. |
|
Accepts the current message and discards it silently. “abort” is not emitted. |
|
Accepts the current message without further more processing. “abort” is not emitted. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) “abort” is not emitted. |
|
Doesn't send a reply back to MTA.
The milter must set
|
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“end-of-header-response”
signal by yourself with one of the above
|
See also xxfi_eof on milter.org.
context |
the context that received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“end-of-header-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“end-of-header” returns a status
except MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“end-of-header”, you need to emit
this signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“end-of-message”
signalMilterStatus user_function (MilterClientContext *context, char *chunk, guint64 size, gpointer user_data)
This signal is emitted after all
“body” are emitted. All message
modifications can be done only in this signal
handler. The modifications can be done with
milter_client_context_add_header()
,
milter_client_context_change_from()
and so on.
All available response statuses are the followings:
Continues processing the current message. |
|
Accepts the current message and discards it silently. “abort” is not emitted. |
|
Accepts the current message without further more processing. “abort” is not emitted. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) “abort” is not emitted. |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“end-of-message-response”
signal by yourself with one of the above
|
See also xxfi_eom on milter.org.
context |
The context that received the signal. |
|
chunk |
The last chunk of the current email. |
[nullable] |
size |
The size of the |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“end-of-message-bytes”
signalMilterStatus user_function (MilterClientContext *context, GBytes *chunk, gpointer user_data)
You can use this signal instead of
“end-of-message-bytes” by calling
milter_client_context_use_bytes(TRUE)
.
context |
The context that received the signal. |
|
chunk |
The last chunk of the current email. |
[nullable] |
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 2.1.6.
“end-of-message-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“end-of-message” returns a status
except MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“end-of-message”, you need to
emit this signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“envelope-from”
signalMilterStatus user_function (MilterClientContext *context, char *from, gpointer user_data)
This signal is emitted 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. “abort” is not emitted. |
|
Accepts the current message and discards it silently. “abort” is not emitted. |
|
Accepts the current message without further more processing. “abort” is not emitted. |
|
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. “abort” is not emitted. |
|
Doesn't send a reply back to MTA.
The milter must set
|
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“envelope-from-response”
signal by yourself with one of the above
|
See also xxfi_envfrom on milter.org.
context |
the context that received the signal. |
|
from |
the envelope from address in SMTP's "MAIL FROM" command. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“envelope-from-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“envelope-from” returns a status
except MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“envelope-from”, you need to emit
this signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“envelope-recipient”
signalMilterStatus user_function (MilterClientContext *context, char *recipient, gpointer user_data)
This signal is emitted 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. “abort” is not emitted. |
|
Accepts the current message and discards it silently. “abort” is not emitted. |
|
Accepts the current envelope recipient. “abort” is not emitted. |
|
Rejects the current envelope recipient address with temporary failure. (i.e. 4xx status code in SMTP) Processing the current message is continued. “abort” is not emitted. |
|
Doesn't send a reply back to MTA.
The milter must set
|
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“envelope-recipient-response”
signal by yourself with one of the above
|
See also xxfi_envrcpt on milter.org.
context |
the context that received the signal. |
|
recipient |
the envelope recipient address in SMTP's "RCPT TO" command. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“envelope-recipient-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“envelope-recipient” returns a
status except MILTER_STATUS_PROGRESS
. This signal's
default handler replies a response to MTA. You don't
need to connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“envelope-recipient”, you need to
emit this signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“header”
signalMilterStatus user_function (MilterClientContext *context, char *name, char *value, gpointer user_data)
This signal is emitted on each header. If
MILTER_STEP_HEADER_LEADING_SPACE
is set in
“negotiate”, value
have spaces
after header name and value separator ":".
Example:
1 2 3 |
From: from <from@example.com> To: recipient <recipient@example.com> Subject:a subject |
With MILTER_STEP_HEADER_VALUE_WITH_LEADING_SPACE
:
1 2 3 |
"From", " from <from@example.com>" "To", " recipient <recipient@example.com>" "Subject", "a subject" |
Without MILTER_STEP_HEADER_VALUE_WITH_LEADING_SPACE
:
1 2 3 |
"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. “abort” is not emitted. |
|
Accepts the current message and discards it silently. “abort” is not emitted. |
|
Accepts the current message without further more processing. “abort” is not emitted. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) “abort” is not emitted. |
|
Doesn't send a reply back to MTA.
The milter must set |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“header-response”
signal by yourself with one of the above
|
See also xxfi_header on milter.org.
context |
the context that received the signal. |
|
name |
the header name. |
|
value |
the header value. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“header-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“header” returns a status except
MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“header”, you need to emit this
signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“helo”
signalMilterStatus user_function (MilterClientContext *context, char *fqdn, gpointer user_data)
This signal is emitted on SMTP's "HELO"/"EHLO" command.
All available response statuses are the followings:
Continues processing the current connection. |
|
Rejects the current connection. “finished” will be emitted. |
|
Accepts the current connection without further more processing. “finished” will be emitted. |
|
Rejects the current connection with a temporary failure. (i.e. 4xx status code in SMTP) “finished” will be emitted. |
|
Doesn't send a reply back to MTA.
The milter must set |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“helo-response” signal by
yourself with one of the above
|
See also xxfi_helo on milter.org.
context |
the context that received the signal. |
|
fqdn |
the FQDN in SMTP's "HELO"/"EHLO" command. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“helo-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“helo” returns a status except
MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“helo”, you need to emit this
signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“message-processed”
signalvoid user_function (MilterClientContext *milterclientcontext, MilterMessageResult *arg1, gpointer user_data)
Flags: Run Last
“negotiate”
signalMilterStatus user_function (MilterClientContext *context, MilterOption *option, MilterMacrosRequests *macros_requests, gpointer user_data)
This signal is emitted on negotiate request from MTA.
If you want to modify actions (MilterActionFlags
)
and steps (MilterStepFlags
), you modify option
. If
you want to add macros that you want to receive, you
modify macros_requests
.
All available response statuses are the followings:
Enables all available actions and steps. |
|
Rejects the current session. |
|
Continues processing the current session with
actions, steps and macros requests that are
specified by |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“negotiate-response” signal by
yourself with one of the above
|
See also xxfi_negotiate on milter.org.
context |
the context that received the signal. |
|
option |
the negotiate option from MTA. |
|
macros_requests |
the macros requests. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“negotiate-response”
signalvoid user_function (MilterClientContext *context, MilterOption *option, MilterMacrosRequests *macros_requests, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“negotiate” returns a status
except MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“negotiate” handler, you need to
emit this signal to context
by yourself.
context |
the context that received the signal. |
|
option |
the negotiate option from MTA. |
|
macros_requests |
the macros requests. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“timeout”
signalvoid user_function (MilterClientContext *context, gpointer user_data)
This signal is emitted if MTA doesn't return the next
command within milter_client_context_get_timeout()
seconds. If “timeout” is emitted,
the current connection is aborted and
“finished” are emitted.
“abort” may be emitted before
“finished” if the milter
is processing a message.
context |
the context that received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“unknown”
signalMilterStatus user_function (MilterClientContext *context, char *command, gpointer user_data)
This signal is emitted on unknown or unimplemented SMTP command is sent.
All available response statuses are the followings:
Rejects the current message. “abort” is not emitted. |
|
Rejects the current message with temporary failure. (i.e. 4xx status code in SMTP) “abort” is not emitted. |
|
Doesn't send a reply back to MTA.
The milter must set |
|
It means that the processing in callback is in
progress and returning response status is
pending. The main loop for the milter is
continued.
If you returns this status, you need to emit
“unknown-response”
signal by yourself with one of the above
|
Note that the unknown or unimplemented SMTP command will always be rejected by MTA.
See also xxfi_unknown on milter.org.
context |
the context that received the signal. |
|
command |
the unknown SMTP command. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“unknown-response”
signalvoid user_function (MilterClientContext *context, MilterStatus status, gpointer user_data)
This signal is emitted implicitly after
“unknown” returns a status except
MILTER_STATUS_PROGRESS
. This signal's default
handler replies a response to MTA. You don't need to
connect this signal.
If you returns MILTER_STATUS_PROGRESS
in
“unknown”, you need to emit this
signal to context
by yourself.
context |
the context that received the signal. |
|
status |
the response status. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last