Client object 3 milter managerライブラリ
Client object The client object to implement a milter.

## Functions

GQuark | milter_client_error_quark ()
GPid | (*MilterClientCustomForkFunc) ()
MilterClient * | milter_client_new ()
gchar * | milter_client_get_default_connection_spec ()
const gchar * | milter_client_get_connection_spec ()
gboolean | milter_client_set_connection_spec ()
GIOChannel * | milter_client_get_listen_channel ()
void | milter_client_set_listen_channel ()
void | milter_client_set_listen_backlog ()
gboolean | milter_client_listen ()
gboolean | milter_client_is_remove_unix_socket_on_create ()
void | milter_client_set_remove_unix_socket_on_create ()
void | milter_client_set_timeout ()
guint | milter_client_get_unix_socket_mode ()
void | milter_client_set_unix_socket_mode ()
guint | milter_client_get_default_unix_socket_mode ()
void | milter_client_set_default_unix_socket_mode ()
const gchar * | milter_client_get_unix_socket_group ()
void | milter_client_set_unix_socket_group ()
const gchar * | milter_client_get_default_unix_socket_group ()
void | milter_client_set_default_unix_socket_group ()
gboolean | milter_client_is_remove_unix_socket_on_close ()
gboolean | milter_client_get_default_remove_unix_socket_on_close ()
void | milter_client_set_default_remove_unix_socket_on_close ()
guint | milter_client_get_suspend_time_on_unacceptable ()
void | milter_client_set_suspend_time_on_unacceptable ()
guint | milter_client_get_max_connections ()
void | milter_client_set_max_connections ()
const gchar * | milter_client_get_effective_user ()
void | milter_client_set_effective_user ()
const gchar * | milter_client_get_effective_group ()
void | milter_client_set_effective_group ()
guint | milter_client_get_maintenance_interval ()
void | milter_client_set_maintenance_interval ()
void | milter_client_set_default_packet_buffer_size ()
guint | milter_client_get_default_packet_buffer_size ()
MilterClientContext * | milter_client_create_context ()
MilterEventLoop * | milter_client_create_event_loop ()
gboolean | milter_client_run ()
gboolean | milter_client_main ()
void | milter_client_shutdown ()
void | (*MilterClientContextFunc) ()
void | milter_client_processing_context_foreach ()
gboolean | milter_client_drop_privilege ()
gboolean | milter_client_daemonize ()
void | milter_client_session_started ()
void | milter_client_session_finished ()
guint | milter_client_get_n_processing_sessions ()
gboolean | milter_client_is_processing ()
const gchar * | milter_client_get_syslog_facility ()
void | milter_client_set_syslog_identify ()
const gchar * | milter_client_get_syslog_identify ()
void | milter_client_set_syslog_facility ()
void | milter_client_start_syslog ()
void | milter_client_stop_syslog ()
gboolean | milter_client_get_syslog_enabled ()
MilterEventLoop * | milter_client_get_event_loop ()
void | milter_client_set_event_loop ()
MilterClientEventLoopBackend | milter_client_get_event_loop_backend ()
void | milter_client_set_event_loop_backend ()
guint | milter_client_get_n_workers ()
void | milter_client_set_n_workers ()
GPid | milter_client_fork ()
GPid | milter_client_fork_without_custom ()
void | milter_client_set_custom_fork_func ()
MilterClientCustomForkFunc | milter_client_get_custom_fork_func ()
guint | milter_client_get_worker_id ()
const gchar * | milter_client_get_pid_file ()
void | milter_client_set_pid_file ()
gboolean | milter_client_is_remove_pid_file_on_exit ()
void | milter_client_set_remove_pid_file_on_exit ()
gboolean | milter_client_is_run_as_daemon ()
void | milter_client_set_run_as_daemon ()
guint | milter_client_get_max_pending_finished_sessions ()
void | milter_client_set_max_pending_finished_sessions ()
GArray * | milter_client_get_worker_pids ()

## プロパティ

char * | connection-spec | Read
gpointer | custom-fork | Read / Write
guint | default-packet-buffer-size | Read / Write
MilterEventLoop * | event-loop | Read / Write
MilterClientEventLoopBackend | event-loop-backend | Read / Write
guint | maintenance-interval | Read / Write
guint | max-pending-finished-sessions | Read / Write
guint | n-workers | Read / Write
char * | pid-file | Read / Write
gboolean | remove-pid-file-on-exit | Read / Write
char * | run-as-daemon | Read / Write
gboolean | start-syslog | Write
char * | syslog-facility | Read / Write
char * | syslog-identify | Read / Write
guint | worker-id | Read

## シグナル

void | connection-established | Run Last
void | event-loop-created | Run Last
void | listen-started | Run Last
void | maintain | Run Last
void | sessions-finished | Run Last
void | worker-created | Run Last
void | workers-created | Run Last

## Types and Values

#define | MILTER_CLIENT_DEFAULT_SUSPEND_TIME_ON_UNACCEPTABLE
#define | MILTER_CLIENT_DEFAULT_MAX_CONNECTIONS
#define | MILTER_CLIENT_MAX_N_WORKERS
#define | MILTER_CLIENT_ERROR
enum | MilterClientEventLoopBackend
enum | MilterClientError
#define | MILTER_TYPE_CLIENT
struct | MilterClientClass
| MilterClient

## オブジェクト階層

    GObject
        ╰── MilterClient
            ╰── MilterManager

## 実装されたインターフェイス

MilterClient implements

## 説明

`MilterClient` implements a milter client object that provides listening socket, accepting connections, changing effective user/group and so on. Each milter session is processed by `MilterClientContext` that is created by `MilterClient`.

## Functions

### milter_client_error_quark ()

    GQuark
    milter_client_error_quark (void);

milter_client_error_quark

### MilterClientCustomForkFunc ()

    GPid
    (*MilterClientCustomForkFunc) (MilterClient *client);

MilterClientCustomForkFunc

### milter_client_new ()

    MilterClient *
    milter_client_new (void);

新しいクライアントを生成します。

#### Returns

新しい`MilterClient`オブジェクト。

milter_client_new

### milter_client_get_default_connection_spec ()

    gchar *
    milter_client_get_default_connection_spec
                                   (MilterClient *client);

既定の接続指定を取得します。必要がなくなったら、既定の接続指定を開放してください。

#### Parameters

client | `MilterClient`。 |

#### Returns

既定の接続指定のコピー。

milter_client_get_default_connection_spec

### milter_client_get_connection_spec ()

    const gchar *
    milter_client_get_connection_spec (MilterClient *client);

Gets the connection specification. The connection specification should not be freed.

#### Parameters

client | `MilterClient`。 |

#### Returns

the connection specification.

milter_client_get_connection_spec

### milter_client_set_connection_spec ()

    gboolean
    milter_client_set_connection_spec (MilterClient *client,
                                       const gchar *spec,
                                       GError **error);

Sets a connection specification. If spec is invalid format and error is not `NULL`, error detail is stored into error .

#### Parameters

client | `MilterClient`。 |
spec | inet:10025のような接続指定。 |
error | エラーを受け取る場所のアドレス、または`NULL`。 |

#### Returns

成功時は`TRUE`。

milter_client_set_connection_spec

### milter_client_get_listen_channel ()

    GIOChannel *
    milter_client_get_listen_channel (MilterClient *client);

接続待ち用のチャンネルを取得します。

#### Parameters

client | `MilterClient`。 |

#### Returns

接続待ち用チャンネル。

milter_client_get_listen_channel

### milter_client_set_listen_channel ()

    void
    milter_client_set_listen_channel (MilterClient *client,
                                      GIOChannel *channel);

接続待ち用チャンネルを設定します。

#### Parameters

client | `MilterClient`。 |
channel | 接続待ち用のチャンネル。 |

milter_client_set_listen_channel

### milter_client_set_listen_backlog ()

    void
    milter_client_set_listen_backlog (MilterClient *client,
                                      gint backlog);

listen(2)用のバックログを設定します。

#### Parameters

client | `MilterClient`。 |
backlog | listen(2)用のバックログ。 |

milter_client_set_listen_backlog

### milter_client_listen ()

    gboolean
    milter_client_listen (MilterClient *client,
                          GError **error);

Listens with configured parameters: connection spec and backlog.

#### Parameters

client | `MilterClient`。 |
error | エラーを受け取る場所のアドレス、または`NULL`。 |

#### Returns

`TRUE` if listen successfully.

milter_client_listen

### milter_client_is_remove_unix_socket_on_create ()

    gboolean
    milter_client_is_remove_unix_socket_on_create
                                   (MilterClient *client);

新しいUNIXドメインソケットを作成する前に既存のUNIXドメインソケットを削除するかどうかを取得します。

#### Parameters

client | `MilterClient`。 |

#### Returns

作成時に既存のUNIXドメインソケットを削除する場合は`TRUE`、そうでない場合は`FALSE`。

milter_client_is_remove_unix_socket_on_create

### milter_client_set_remove_unix_socket_on_create ()

    void
    milter_client_set_remove_unix_socket_on_create
                                   (MilterClient *client,
                                    gboolean remove);

新しいUNIXドメインソケットを作成する前に既存のUNIXドメインソケットを削除するかどうかを設定します。

#### Parameters

client | `MilterClient`。 |
remove | 新しいUNIXドメインソケットを作成する前に既存のUNIXドメインソケットを削除するなら`TRUE`。 |

milter_client_set_remove_unix_socket_on_create

### milter_client_set_timeout ()

    void
    milter_client_set_timeout (MilterClient *client,
                               guint timeout);

接続が確立した`MilterClientContext`に設定するタイムアウト値を設定します。

#### Parameters

client | `MilterClient`。 |
timeout | 秒単位でのタイムアウト。 |

milter_client_set_timeout

### milter_client_get_unix_socket_mode ()

    guint
    milter_client_get_unix_socket_mode (MilterClient *client);

UNIXドメインソケットのモードを取得します。

#### Parameters

client | `MilterClient`。 |

#### Returns

UNIXドメインソケットのモード。

milter_client_get_unix_socket_mode

### milter_client_set_unix_socket_mode ()

    void
    milter_client_set_unix_socket_mode (MilterClient *client,
                                        guint mode);

Sets the UNIX domain socket mode. mode == '0' means that the default UNIX domain socket mode will be used.

#### Parameters

client | `MilterClient`。 |
mode | UNIXドメインソケットのモード。 |

milter_client_set_unix_socket_mode

### milter_client_get_default_unix_socket_mode ()

    guint
    milter_client_get_default_unix_socket_mode
                                   (MilterClient *client);

既定のUNIXドメインソケットのモードを取得します。

#### Parameters

client | `MilterClient`。 |

#### Returns

既定のUNIXドメインソケットのモード。

milter_client_get_default_unix_socket_mode

### milter_client_set_default_unix_socket_mode ()

    void
    milter_client_set_default_unix_socket_mode
                                   (MilterClient *client,
                                    guint mode);

既定のUNIXドメインソケットモードを設定します。

#### Parameters

client | `MilterClient`。 |
mode | UNIXドメインソケットのモード。 |

milter_client_set_default_unix_socket_mode

### milter_client_get_unix_socket_group ()

    const gchar *
    milter_client_get_unix_socket_group (MilterClient *client);

UNIXドメインソケットのグループを設定します。

#### Parameters

client | `MilterClient`。 |

#### Returns

UNIXドメインソケットのグループ名。

milter_client_get_unix_socket_group

### milter_client_set_unix_socket_group ()

    void
    milter_client_set_unix_socket_group (MilterClient *client,
                                         const gchar *group);

Sets the group of UNIX domain socket.

#### Parameters

client | a MilterClient. |
group | the UNIX domain socket group. | [nullable]

milter_client_set_unix_socket_group

### milter_client_get_default_unix_socket_group ()

    const gchar *
    milter_client_get_default_unix_socket_group
                                   (MilterClient *client);

既定のUNIXドメインソケットグループを取得します。

#### Parameters

client | `MilterClient`。 |

#### Returns

既定のUNIXドメインソケットグループ名。

milter_client_get_default_unix_socket_group

### milter_client_set_default_unix_socket_group ()

    void
    milter_client_set_default_unix_socket_group
                                   (MilterClient *client,
                                    const gchar *group);

既定のUNIXドメインソケットグループを設定します。

#### Parameters

client | `MilterClient`。 |
group | グループ名。 |

milter_client_set_default_unix_socket_group

### milter_client_is_remove_unix_socket_on_close ()

    gboolean
    milter_client_is_remove_unix_socket_on_close
                                   (MilterClient *client);

UNIXドメインソケットを閉じた後に削除するかどうかを取得します。

#### Parameters

client | `MilterClient`。 |

#### Returns

UNIXドメインソケットを閉じたときに削除するなら`TRUE`、そうでなければ`FALSE`。

milter_client_is_remove_unix_socket_on_close

### milter_client_get_default_remove_unix_socket_on_close ()

    gboolean
    milter_client_get_default_remove_unix_socket_on_close
                                   (MilterClient *client);

ソケットを閉じた後にUNIXドメインソケットを削除するかどうかの既定の値を取得します。

#### Parameters

client | `MilterClient`。 |

#### Returns

UNIXドメインソケットを閉じたときに削除するなら`TRUE`、そうでなければ`FALSE`。

milter_client_get_default_remove_unix_socket_on_close

### milter_client_set_default_remove_unix_socket_on_close ()

    void
    milter_client_set_default_remove_unix_socket_on_close
                                   (MilterClient *client,
                                    gboolean remove);

ソケットを閉じた後にUNIXドメインソケットを削除するかどうかの既定の値を取得します。

#### Parameters

client | `MilterClient`。 |
remove | ソケットを閉じた後にUNIXドメインソケットを削除するなら`TRUE`。 |

milter_client_set_default_remove_unix_socket_on_close

### milter_client_get_suspend_time_on_unacceptable ()

    guint
    milter_client_get_suspend_time_on_unacceptable
                                   (MilterClient *client);

Gets suspend time on unacceptable situation. The situation is occurred when many SMTP clients connect to SMTP server. The situation means that your mail system is overflowed. You need to take some measures. e.g. Reducing number of milters, running milters on other machines, upgrade machine spec, growing number of max file descriptors and so on.

#### Parameters

client | `MilterClient`。 |

#### Returns

suspend time in seconds.

milter_client_get_suspend_time_on_unacceptable

### milter_client_set_suspend_time_on_unacceptable ()

    void
    milter_client_set_suspend_time_on_unacceptable
                                   (MilterClient *client,
                                    guint suspend_time);

Sets suspend time on unacceptable situation. See `milter_client_get_suspend_time_on_unacceptable()` for more details of the situation.

#### Parameters

client | `MilterClient`。 |
suspend_time | suspend time in seconds. |

milter_client_set_suspend_time_on_unacceptable

### milter_client_get_max_connections ()

    guint
    milter_client_get_max_connections (MilterClient *client);

Gets the maximum number of connections. If the current processing connections are over the max connections, accepting a new connection is suspend in `milter_client_get_suspend_time_on_unacceptable()` seconds.

0 means 'no limit'.

#### Parameters

client | `MilterClient`。 |

#### Returns

the maximum number of connections.

milter_client_get_max_connections

### milter_client_set_max_connections ()

    void
    milter_client_set_max_connections (MilterClient *client,
                                       guint max_connections);

Sets the maximum number of connections. 0 means 'no limit'. See `milter_client_get_max_connections()` for more details.

#### Parameters

client | `MilterClient`。 |
max_connections | the maximum number of connections. |

milter_client_set_max_connections

### milter_client_get_effective_user ()

    const gchar *
    milter_client_get_effective_user (MilterClient *client);

Gets the effective user.

#### Parameters

client | `MilterClient`。 |

#### Returns

the effective user.

milter_client_get_effective_user

### milter_client_set_effective_user ()

    void
    milter_client_set_effective_user (MilterClient *client,
                                      const gchar *effective_user);

Sets the effective user of this process.

#### Parameters

client | `MilterClient`。 |
effective_user | the effective user. |

milter_client_set_effective_user

### milter_client_get_effective_group ()

    const gchar *
    milter_client_get_effective_group (MilterClient *client);

Gets the effective group.

#### Parameters

client | `MilterClient`。 |

#### Returns

the effective group.

milter_client_get_effective_group

### milter_client_set_effective_group ()

    void
    milter_client_set_effective_group (MilterClient *client,
                                       const gchar *effective_group);

Sets the effective group of this process.

#### Parameters

client | `MilterClient`。 |
effective_group | the effective group. |

milter_client_set_effective_group

### milter_client_get_maintenance_interval ()

    guint
    milter_client_get_maintenance_interval
                                   (MilterClient *client);

Gets the maintenance interval. “maintain” signal is emitted each 'maintenance interval' sessions finished.

0 means 'maintain signal isn't needed'.

#### Parameters

client | `MilterClient`。 |

#### Returns

the maintenance interval.

milter_client_get_maintenance_interval

### milter_client_set_maintenance_interval ()

    void
    milter_client_set_maintenance_interval
                                   (MilterClient *client,
                                    guint maintenance_interval);

Sets the maintenance interval. 0 means 'maintain signal isn't needed'. See `milter_client_get_maintenance_interval()` for more details.

#### Parameters

client | `MilterClient`。 |
maintenance_interval | the maintenance interval. |

milter_client_set_maintenance_interval

### milter_client_set_default_packet_buffer_size ()

    void
    milter_client_set_default_packet_buffer_size
                                   (MilterClient *client,
                                    guint size);

Sets the default packet buffer size for each client context created by the client. See `milter_client_contexdt_set_packet_buffer_size()` for more packet buffer size information.

#### Parameters

client | `MilterClient`。 |
size | a packet buffer size in bytes. (deafult is `MILTER_CLIENT_CONTEXT_DEFAULT_PACKET_BUFFER_SIZE`.) |

milter_client_set_default_packet_buffer_size

### milter_client_get_default_packet_buffer_size ()

    guint
    milter_client_get_default_packet_buffer_size
                                   (MilterClient *client);

Gets the default packet buffer size for each client context created by the client.

#### Parameters

client | `MilterClient`。 |

#### Returns

the defalt packet buffer size for each client context created by the context.

milter_client_get_default_packet_buffer_size

### milter_client_create_context ()

    MilterClientContext *
    milter_client_create_context (MilterClient *client);

Creates a new `MilterClientContext` that is initialized with the client configuration.

#### Parameters

client | `MilterClient`。 |

#### Returns

a newly allocated `MilterClientContext`. It should be unref-ed when no longer needed.

[transfer full]

milter_client_create_context

### milter_client_create_event_loop ()

    MilterEventLoop *
    milter_client_create_event_loop (MilterClient *client,
                                     gboolean use_default_context);

Creates a new `MilterEventLoop` that is initialized with the client configuration.

#### Parameters

client | `MilterClient`。 |
use_default_context | whther to use default context or not. |

#### Returns

a newly allocated `MilterEventLoop`. It should be unref-ed when no longer needed.

[transfer full]

milter_client_create_event_loop

### milter_client_run ()

    gboolean
    milter_client_run (MilterClient *client,
                       GError **error);

Runs main loop. If the main loop isn't quitted successfully and error is not `NULL`, error detail is stored into error .

#### Parameters

client | `MilterClient`。 |
error | エラーを受け取る場所のアドレス、または`NULL`。 |

#### Returns

`TRUE` if main loop is quitted successfully, `FALSE` otherwise.

milter_client_run

### milter_client_main ()

    gboolean
    milter_client_main (MilterClient *client);

`milter_client_main` has been deprecated since version 1.6.2 and should not be used in newly-written code.

Use `milter_client_run()` instead.

メインループを実行します。

#### Parameters

client | `MilterClient`。 |

#### Returns

`TRUE` if main loop is quitted successfully, `FALSE` otherwise.

milter_client_main

### milter_client_shutdown ()

    void
    milter_client_shutdown (MilterClient *client);

メインループを終了します。

#### Parameters

client | `MilterClient`。 |

milter_client_shutdown

### MilterClientContextFunc ()

    void
    (*MilterClientContextFunc) (MilterClientContext *context,
                                gpointer user_data);

It is called with each processing MilterClientContext, together with the user_data parameter which is passed to `milter_client_processing_context_foreach()`.

#### Parameters

context | A MilterClientContext. |
user_data | User data passed to `milter_client_processing_context_foreach()`. |

MilterClientContextFunc

### milter_client_processing_context_foreach ()

    void
    milter_client_processing_context_foreach
                                   (MilterClient *client,
                                    MilterClientContextFunc func,
                                    gpointer user_data);

Calls a function for each processing MilterClientContext.

#### Parameters

client | A MilterClient. |
func | The function to call with each processing MilterClientContext. | [scope call]
user_data | User data to pass to the function. |

milter_client_processing_context_foreach

### milter_client_drop_privilege ()

    gboolean
    milter_client_drop_privilege (MilterClient *client,
                                  GError **error);

Drops privilege of this process.

#### Parameters

client | `MilterClient`。 |
error | エラーを受け取る場所のアドレス、または`NULL`。 |

#### Returns

`TRUE` if drop privilege successfully.

milter_client_drop_privilege

### milter_client_daemonize ()

    gboolean
    milter_client_daemonize (MilterClient *client,
                             GError **error);

Daemonizes this process.

#### Parameters

client | `MilterClient`。 |
error | エラーを受け取る場所のアドレス、または`NULL`。 |

#### Returns

`TRUE` if daemonize successfully.

milter_client_daemonize

### milter_client_session_started ()

    void
    milter_client_session_started (MilterClient *client);

Calls this function when the client starts a session.

#### Parameters

client | `MilterClient`。 |

milter_client_session_started

### milter_client_session_finished ()

    void
    milter_client_session_finished (MilterClient *client);

Calls this function when the client finished a session.

#### Parameters

client | `MilterClient`。 |

milter_client_session_finished

### milter_client_get_n_processing_sessions ()

    guint
    milter_client_get_n_processing_sessions
                                   (MilterClient *client);

Returns number of the current processing sessions.

#### Parameters

client | `MilterClient`。 |

#### Returns

number of the current processing sessions.

milter_client_get_n_processing_sessions

### milter_client_is_processing ()

    gboolean
    milter_client_is_processing (MilterClient *client);

Returns whether client has one or more processing sessions or not.

#### Parameters

client | `MilterClient`。 |

#### Returns

`TRUE` if client has one or more processsing sessions, `FALSE` otherwise.

milter_client_is_processing

### milter_client_get_syslog_facility ()

    const gchar *
    milter_client_get_syslog_facility (MilterClient *client);

Gets the syslog facility name of the client .

#### Parameters

client | `MilterClient`。 |

#### Returns

syslog facility name.

milter_client_get_syslog_facility

### milter_client_set_syslog_identify ()

    void
    milter_client_set_syslog_identify (MilterClient *client,
                                       const gchar *identify);

Sets the syslog identify of the client .

#### Parameters

client | `MilterClient`。 |
identify | the identify in syslog. |

milter_client_set_syslog_identify

### milter_client_get_syslog_identify ()

    const gchar *
    milter_client_get_syslog_identify (MilterClient *client);

Gets the syslog identify name of the client .

#### Parameters

client | `MilterClient`。 |

#### Returns

syslog identify name.

milter_client_get_syslog_identify

### milter_client_set_syslog_facility ()

    void
    milter_client_set_syslog_facility (MilterClient *client,
                                       const gchar *facility);

Sets the syslog facility name of the client .

#### Parameters

client | `MilterClient`。 |

milter_client_set_syslog_facility

### milter_client_start_syslog ()

    void
    milter_client_start_syslog (MilterClient *client);

Starts logging by syslog with identify name.

#### Parameters

client | `MilterClient`。 |

milter_client_start_syslog

### milter_client_stop_syslog ()

    void
    milter_client_stop_syslog (MilterClient *client);

Stops logging by syslog.

#### Parameters

client | `MilterClient`。 |

milter_client_stop_syslog

### milter_client_get_syslog_enabled ()

    gboolean
    milter_client_get_syslog_enabled (MilterClient *client);

Gets whether syslog is enabled.

#### Parameters

client | `MilterClient`。 |

#### Returns

`TRUE` if syslog is enabled, `FALSE` otherwise.

milter_client_get_syslog_enabled

### milter_client_get_event_loop ()

    MilterEventLoop *
    milter_client_get_event_loop (MilterClient *client);

Gets the `MilterEventLoop` for processing requests.

#### Parameters

client | `MilterClient`。 |

#### Returns

the `MilterEventLoop` for processing requests.

[transfer none][nullable]

milter_client_get_event_loop

### milter_client_set_event_loop ()

    void
    milter_client_set_event_loop (MilterClient *client,
                                  MilterEventLoop *event_loop);

milter_client_set_event_loop

### milter_client_get_event_loop_backend ()

    MilterClientEventLoopBackend
    milter_client_get_event_loop_backend (MilterClient *client);

Gets the `MilterClientEventLoopBackend` of client .

#### Parameters

client | `MilterClient`。 |

#### Returns

the `MilterClientEventLoopBackend` of client .

milter_client_get_event_loop_backend

### milter_client_set_event_loop_backend ()

    void
    milter_client_set_event_loop_backend (MilterClient *client,
                                          MilterClientEventLoopBackend backend);

Sets the `MilterClientEventLoopBackend` of client .

#### Parameters

client | `MilterClient`。 |
backend | a `MilterClinetEventLoopBackend` |

milter_client_set_event_loop_backend

### milter_client_get_n_workers ()

    guint
    milter_client_get_n_workers (MilterClient *client);

Gets the number of worker processes of client .

#### Parameters

client | `MilterClient`。 |

#### Returns

the number of worker processes of client .

milter_client_get_n_workers

### milter_client_set_n_workers ()

    void
    milter_client_set_n_workers (MilterClient *client,
                                 guint n_workers);

Sets the number of worker processes of client .

#### Parameters

client | `MilterClient`。 |
n_workers | the number of worker processes. |

milter_client_set_n_workers

### milter_client_fork ()

    GPid
    milter_client_fork (MilterClient *client);

Forks new process. If custom fork is set by `milter_client_set_custom_fork_func()`, it will be called.

#### Parameters

client | `MilterClient`。 |

#### Returns

child process PID for parent process, 0 for child process or -1 on error.

milter_client_fork

### milter_client_fork_without_custom ()

    GPid
    milter_client_fork_without_custom (MilterClient *client);

Forks new process. The custom fork for the client never called even if the custom fork is set by `milter_client_set_custom_fork()`. This function will be called in custom fork.

#### Parameters

client | `MilterClient`。 |

#### Returns

child process PID for parent process, 0 for child process or -1 on error.

milter_client_fork_without_custom

### milter_client_set_custom_fork_func ()

    void
    milter_client_set_custom_fork_func (MilterClient *client,
                                        MilterClientCustomForkFunc custom_fork);

Sets custom fork function for the client. It will be called in `milter_client_fork()`. If custom_fork is `NULL`, the system fork(2) will be called.

[skip]

#### Parameters

client | a MilterClient. |
custom_fork | a `MilterClientCustomForkFunc`. |

milter_client_set_custom_fork_func

### milter_client_get_custom_fork_func ()

    MilterClientCustomForkFunc
    milter_client_get_custom_fork_func (MilterClient *client);

Gets the custom fork function for the client.

[skip]

#### Parameters

client | a MilterClient. |

#### Returns

the custom fork function for the client.

milter_client_get_custom_fork_func

### milter_client_get_worker_id ()

    guint
    milter_client_get_worker_id (MilterClient *client);

milter_client_get_worker_id

### milter_client_get_pid_file ()

    const gchar *
    milter_client_get_pid_file (MilterClient *client);

Gets the PID file of client .

#### Parameters

client | `MilterClient`。 |

#### Returns

the PID file of client .

milter_client_get_pid_file

### milter_client_set_pid_file ()

    void
    milter_client_set_pid_file (MilterClient *client,
                                const gchar *pid_file);

Sets the PID file of client .

#### Parameters

client | a MilterClient. |
pid_file | the PID file of client . | [nullable]

milter_client_set_pid_file

### milter_client_is_remove_pid_file_on_exit ()

    gboolean
    milter_client_is_remove_pid_file_on_exit
                                   (MilterClient *client);

Gets whether removing PID file after main loop is quitted.

#### Parameters

client | `MilterClient`。 |

#### Returns

`TRUE` if removing PID file on exit, `FALSE` otherwise.

milter_client_is_remove_pid_file_on_exit

### milter_client_set_remove_pid_file_on_exit ()

    void
    milter_client_set_remove_pid_file_on_exit
                                   (MilterClient *client,
                                    gboolean remove);

Sets whether removing PID file after main loop is quitted.

#### Parameters

client | `MilterClient`。 |
remove | `TRUE` if removing PID file on exit. |

milter_client_set_remove_pid_file_on_exit

### milter_client_is_run_as_daemon ()

    gboolean
    milter_client_is_run_as_daemon (MilterClient *client);

Gets whether running as a daemon or not.

#### Parameters

client | `MilterClient`。 |

#### Returns

`TRUE` if running as a daemon, `FALSE` otherwise.

milter_client_is_run_as_daemon

### milter_client_set_run_as_daemon ()

    void
    milter_client_set_run_as_daemon (MilterClient *client,
                                     gboolean daemon);

Sets whether running as a daemon.

#### Parameters

client | `MilterClient`。 |
daemon | `TRUE` if runnning as a daemon. |

milter_client_set_run_as_daemon

### milter_client_get_max_pending_finished_sessions ()

    guint
    milter_client_get_max_pending_finished_sessions
                                   (MilterClient *client);

Gets the maximum number of pending finished sessions of client .

#### Parameters

client | `MilterClient`。 |

#### Returns

the maximum number of pending finished sessions of client .

milter_client_get_max_pending_finished_sessions

### milter_client_set_max_pending_finished_sessions ()

    void
    milter_client_set_max_pending_finished_sessions
                                   (MilterClient *client,
                                    guint n_sessions);

Sets the maximum number of pending finished sessions of client . If the number of finished sessions that are not freed is larger than n_sessions , all those finished sessions are freed immediately.

0 means that this cheack is disabled.

#### Parameters

client | `MilterClient`。 |
n_sessions | the maximum number of pending finished sessions. |

milter_client_set_max_pending_finished_sessions

### milter_client_get_worker_pids ()

    GArray *
    milter_client_get_worker_pids (MilterClient *client);

Gets the pids for each worker of client .

#### Parameters

client | a MilterClient. |

#### Returns

the pids for each worker of client .

[transfer none][element-type GPid]

milter_client_get_worker_pids

## Types and Values

### MILTER_CLIENT_DEFAULT_SUSPEND_TIME_ON_UNACCEPTABLE

    #define MILTER_CLIENT_DEFAULT_SUSPEND_TIME_ON_UNACCEPTABLE 5

The suspend time on unacceptable situation. See `milter_client_get_suspend_time_on_unacceptable()` for more details of the situation.

MILTER_CLIENT_DEFAULT_SUSPEND_TIME_ON_UNACCEPTABLE

### MILTER_CLIENT_DEFAULT_MAX_CONNECTIONS

    #define MILTER_CLIENT_DEFAULT_MAX_CONNECTIONS 0

The default max connections. See `milter_client_get_max_connections()` for more details of the situation.

No limit by default.

MILTER_CLIENT_DEFAULT_MAX_CONNECTIONS

### MILTER_CLIENT_MAX_N_WORKERS

    #define MILTER_CLIENT_MAX_N_WORKERS 1000

The maximum number of worker processes.

MILTER_CLIENT_MAX_N_WORKERS

### MILTER_CLIENT_ERROR

    #define MILTER_CLIENT_ERROR (milter_client_error_quark())

MilterClientのエラー用のGErrorクォークを取得するために使われます。

MILTER_CLIENT_ERROR

### enum MilterClientEventLoopBackend

#### Members

MILTER_CLIENT_EVENT_LOOP_BACKEND_DEFAULT |  |
MILTER_CLIENT_EVENT_LOOP_BACKEND_GLIB | Let main loop use GLib. |
MILTER_CLIENT_EVENT_LOOP_BACKEND_LIBEV | Let main loop use libev. |

MilterClientEventLoopBackend

### enum MilterClientError

`MilterClient`の関数呼び出し中に発生するエラーを識別します。

#### Members

MILTER_CLIENT_ERROR_RUNNING | メインループがすでに回っていることを示します。 |
MILTER_CLIENT_ERROR_UNIX_SOCKET | UNIXドメインソケット関連のエラーであることを示します。 |
MILTER_CLIENT_ERROR_IO_ERROR | IO関連のエラーであることを示します。 |
MILTER_CLIENT_ERROR_THREAD |  |
MILTER_CLIENT_ERROR_PASSWORD_ENTRY |  |
MILTER_CLIENT_ERROR_GROUP_ENTRY |  |
MILTER_CLIENT_ERROR_DROP_PRIVILEGE |  |
MILTER_CLIENT_ERROR_DETACH_IO |  |
MILTER_CLIENT_ERROR_DAEMONIZE |  |
MILTER_CLIENT_ERROR_NOT_LISTENED_YET |  |
MILTER_CLIENT_ERROR_PROCESS |  |
MILTER_CLIENT_ERROR_PID_FILE |  |

MilterClientError

### MILTER_TYPE_CLIENT

    #define MILTER_TYPE_CLIENT (milter_client_get_type())

MILTER_TYPE_CLIENT

### struct MilterClientClass

    struct MilterClientClass {
        GObjectClass parent_class;

        void   (*connection_established)      (MilterClient *client,
                                               MilterClientContext *context);
        void   (*listen_started)              (MilterClient *client,
                                               struct sockaddr *address,
                                               socklen_t        address_size);
        const gchar *(*get_connection_spec)   (MilterClient *client);
        gboolean (*set_connection_spec)       (MilterClient *client,
                                               const gchar  *spec,
                                               GError      **error);
        guint  (*get_unix_socket_mode)        (MilterClient *client);
        void   (*set_unix_socket_mode)        (MilterClient *client,
                                               guint         mode);
        const gchar *(*get_unix_socket_group) (MilterClient *client);
        void   (*set_unix_socket_group)       (MilterClient *client,
                                               const gchar  *group);
        gboolean (*is_remove_unix_socket_on_close)
                                              (MilterClient *client);
        guint  (*get_suspend_time_on_unacceptable)
                                              (MilterClient *client);
        void   (*set_suspend_time_on_unacceptable)
                                              (MilterClient *client,
                                               guint         suspend_time);
        guint  (*get_max_connections)         (MilterClient *client);
        void   (*set_max_connections)         (MilterClient *client,
                                               guint         max_connections);
        const gchar *(*get_effective_user)    (MilterClient *client);
        void   (*set_effective_user)          (MilterClient *client,
                                               const gchar  *effective_user);
        const gchar *(*get_effective_group)   (MilterClient *client);
        void   (*set_effective_group)         (MilterClient *client,
                                               const gchar  *effective_group);
        guint  (*get_maintenance_interval)    (MilterClient *client);
        void   (*set_maintenance_interval)    (MilterClient *client,
                                               guint         maintenance_interval);
        void   (*maintain)                    (MilterClient *client);
        void   (*sessions_finished)           (MilterClient *client,
                                               guint         n_finished_sessions);
        void   (*event_loop_created)          (MilterClient *client,
                                               MilterEventLoop *loop);
        MilterClientEventLoopBackend
               (*get_event_loop_backend)      (MilterClient *client);
        void   (*set_event_loop_backend)      (MilterClient *client,
                                               MilterClientEventLoopBackend backend);
        guint  (*get_n_workers)               (MilterClient *client);
        void   (*set_n_workers)               (MilterClient *client,
                                               guint         n_workers);
        guint  (*get_default_packet_buffer_size)
                                              (MilterClient *client);
        void   (*set_default_packet_buffer_size)
                                              (MilterClient *client,
                                               guint         size);
        GPid   (*fork)                        (MilterClient *client);
        const gchar *(*get_pid_file)          (MilterClient *client);
        void   (*set_pid_file)                (MilterClient *client,
                                               const gchar  *pid_file);
        gboolean (*is_remove_pid_file_on_exit)(MilterClient *client);
        void   (*set_remove_pid_file_on_exit) (MilterClient *client,
                                               gboolean      remove);
        gboolean (*is_run_as_daemon)          (MilterClient *client);
        void   (*set_run_as_daemon)           (MilterClient *client,
                                               gboolean      daemon);
        guint  (*get_max_pending_finished_sessions)
                                              (MilterClient *client);
        void   (*set_max_pending_finished_sessions)
                                              (MilterClient *client,
                                               guint         n_sessions);
        void   (*workers_created)             (MilterClient *client,
                                               guint         n_workers);
        void   (*worker_created)              (MilterClient *client);
        GArray *(*get_worker_pids)            (MilterClient *client);
    };

MilterClientClass

### MilterClient

    typedef struct _MilterClient MilterClient;

`MilterClient`は前面にでるオブジェクトです。このオブジェクトがMTAからの接続を受け付けて、各コンテキストに割り振ります。

MilterClient

## プロパティ詳細

### The `“connection-spec”` property

    “connection-spec”          char *

クライアントの接続指定。

Owner: MilterClient

Flags: Read

デフォルト値: NULL

MilterClient:connection-spec

### The `“custom-fork”` property

    “custom-fork”              gpointer

The custom fork.

Owner: MilterClient

Flags: Read / Write

MilterClient:custom-fork

### The `“default-packet-buffer-size”` property

    “default-packet-buffer-size” guint

The default packet buffer size of each client context of the client.

Owner: MilterClient

Flags: Read / Write

デフォルト値: 0

MilterClient:default-packet-buffer-size

### The `“event-loop”` property

    “event-loop”               MilterEventLoop *

クライアントのイベントループ。

Owner: MilterClient

Flags: Read / Write

MilterClient:event-loop

### The `“event-loop-backend”` property

    “event-loop-backend”       MilterClientEventLoopBackend

クライアントのイベントループバックエンド。

Owner: MilterClient

Flags: Read / Write

Default value: MILTER_CLIENT_EVENT_LOOP_BACKEND_DEFAULT

MilterClient:event-loop-backend

### The `“maintenance-interval”` property

    “maintenance-interval”     guint

Maintenance interval of the client. each 'maintenance-interval' sessions finished 'maintenance' signal is emitted. 0 means 'disabled'.

Owner: MilterClient

Flags: Read / Write

デフォルト値: 0

MilterClient:maintenance-interval

### The `“max-pending-finished-sessions”` property

    “max-pending-finished-sessions” guint

The maximum number of pending finished sessions of the client.

Owner: MilterClient

Flags: Read / Write

デフォルト値: 0

MilterClient:max-pending-finished-sessions

### The `“n-workers”` property

    “n-workers”                guint

The Number of worker processes of the client.

Owner: MilterClient

Flags: Read / Write

Allowed values: <= 1000

デフォルト値: 0

MilterClient:n-workers

### The `“pid-file”` property

    “pid-file”                 char *

クライアントのPIDファイル。

Owner: MilterClient

Flags: Read / Write

デフォルト値: NULL

MilterClient:pid-file

### The `“remove-pid-file-on-exit”` property

    “remove-pid-file-on-exit”  gboolean

Whether removing PID file of the client on exist.

Owner: MilterClient

Flags: Read / Write

デフォルト値: TRUE

MilterClient:remove-pid-file-on-exit

### The `“run-as-daemon”` property

    “run-as-daemon”            char *

Whether running the client as a daemon or not.

Owner: MilterClient

Flags: Read / Write

デフォルト値: NULL

MilterClient:run-as-daemon

### The `“start-syslog”` property

    “start-syslog”             gboolean

Start syslog for the client.

Owner: MilterClient

Flags: Write

Default value: FALSE

MilterClient:start-syslog

### The `“syslog-facility”` property

    “syslog-facility”          char *

クライアントのsyslogファシリティ名。

Owner: MilterClient

Flags: Read / Write

デフォルト値: NULL

MilterClient:syslog-facility

### The `“syslog-identify”` property

    “syslog-identify”          char *

Syslog identify of the client.

Owner: MilterClient

Flags: Read / Write

デフォルト値: NULL

MilterClient:syslog-identify

### The `“worker-id”` property

    “worker-id”                guint

クライアントのワーカープロセスID。

Owner: MilterClient

Flags: Read

Allowed values: <= 1000

デフォルト値: 0

MilterClient:worker-id

## シグナル詳細

### The `“connection-established”` signal

    void
    user_function (MilterClient        *milterclient,
                   MilterClientContext *arg1,
                   gpointer             user_data)

Flags: Run Last

MilterClient::connection-established

### The `“event-loop-created”` signal

    void
    user_function (MilterClient    *milterclient,
                   MilterEventLoop *arg1,
                   gpointer         user_data)

Flags: Run Last

MilterClient::event-loop-created

### The `“listen-started”` signal

    void
    user_function (MilterClient *milterclient,
                   gpointer      arg1,
                   guint         arg2,
                   gpointer      user_data)

Flags: Run Last

MilterClient::listen-started

### The `“maintain”` signal

    void
    user_function (MilterClient *milterclient,
                   gpointer      user_data)

Flags: Run Last

MilterClient::maintain

### The `“sessions-finished”` signal

    void
    user_function (MilterClient *milterclient,
                   guint         arg1,
                   gpointer      user_data)

Flags: Run Last

MilterClient::sessions-finished

### The `“worker-created”` signal

    void
    user_function (MilterClient *milterclient,
                   gpointer      user_data)

Flags: Run Last

MilterClient::worker-created

### The `“workers-created”` signal

    void
    user_function (MilterClient *milterclient,
                   guint         arg1,
                   gpointer      user_data)

Flags: Run Last

MilterClient::workers-created