Client object
3
milter managerライブラリ

# Client object

The client object to implement a milter.

## Functions

GPid | (*MilterClientCustomForkFunc) ()
GQuark | milter_client_error_quark ()
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 | 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 ()

## プロパティ

gchar * | 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
gchar * | pid-file | Read / Write
gboolean | remove-pid-file-on-exit | Read / Write
gchar * | run-as-daemon | Read / Write
gboolean | start-syslog | Write
gchar * | syslog-facility | Read / Write
gchar * | 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
| MilterClient

## オブジェクト階層

        GEnum
        ├── MilterClientError
        ╰── MilterClientEventLoopBackend
        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

### MilterClientCustomForkFunc ()

    GPid
    (*MilterClientCustomForkFunc) (MilterClient *client);

### milter_client_error_quark ()

    GQuark
    milter_client_error_quark (void);

### milter_client_new ()

    MilterClient *
    milter_client_new (void);

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

#### Returns

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

### milter_client_get_default_connection_spec ()

    gchar *
    milter_client_get_default_connection_spec
                                   (MilterClient *client);

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

#### Parameters

client | `MilterClient`。 |

#### Returns

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

### 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_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_get_listen_channel ()

    GIOChannel *
    milter_client_get_listen_channel (MilterClient *client);

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

#### Parameters

client | `MilterClient`。 |

#### Returns

接続待ち用チャンネル。

### milter_client_set_listen_channel ()

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

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

#### Parameters

client | `MilterClient`。 |
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_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_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_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_timeout ()

    void
    milter_client_set_timeout (MilterClient *client,
                               guint timeout);

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

#### Parameters

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

### milter_client_get_unix_socket_mode ()

    guint
    milter_client_get_unix_socket_mode (MilterClient *client);

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

#### Parameters

client | `MilterClient`。 |

#### Returns

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

### 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_get_default_unix_socket_mode ()

    guint
    milter_client_get_default_unix_socket_mode
                                   (MilterClient *client);

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

#### Parameters

client | `MilterClient`。 |

#### Returns

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

### 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_get_unix_socket_group ()

    const gchar *
    milter_client_get_unix_socket_group (MilterClient *client);

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

#### Parameters

client | `MilterClient`。 |

#### Returns

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

### 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 | `MilterClient`。 |
group | the UNIX domain 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_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_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_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_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_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_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_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_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_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_set_effective_user ()

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

Sets the effective user of this process.

#### Parameters

client | `MilterClient`。 |
effective_user | the 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_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_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_set_maintenance_interval ()

    void
    milter_client_set_maintenance_interval
                                   (MilterClient *client,
                                    guint n_sessions);

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_default_packet_buffer_size ()

    void
    milter_client_set_default_packet_buffer_size
                                   (MilterClient *context,
                                    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_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_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.

### 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.

### 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_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_shutdown ()

    void
    milter_client_shutdown (MilterClient *client);

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

#### Parameters

client | `MilterClient`。 |

### milter_client_processing_context_foreach ()

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

Calls a function for each processing `MilterClientContext`.

#### Parameters

client | `MilterClient`。 |
func | the function to call with each processing `MilterClientContext`. |
user_data | user data to pass to the function. |

### 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_daemonize ()

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

Daemonizes this process.

#### Parameters

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

#### Returns

`TRUE` if daemonize successfully.

### 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_finished ()

    void
    milter_client_session_finished (MilterClient *client);

Calls this function when the `client` finished a session.

#### Parameters

client | `MilterClient`。 |

### 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_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_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_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_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_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_start_syslog ()

    void
    milter_client_start_syslog (MilterClient *client);

Starts logging by syslog with `identify` name.

#### Parameters

client | `MilterClient`。 |

### milter_client_stop_syslog ()

    void
    milter_client_stop_syslog (MilterClient *client);

Stops logging by syslog.

#### Parameters

client | `MilterClient`。 |

### 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_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.

### milter_client_set_event_loop ()

    void
    milter_client_set_event_loop (MilterClient *client,
                                  MilterEventLoop *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_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_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_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_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_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_set_custom_fork_func ()

    void
    milter_client_set_custom_fork_func (MilterClient *client,
                                        MilterClientCustomForkFunc custom_fork);

Gets the custom fork function for the client.

#### Parameters

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

#### Returns

the custom fork function for the client.

### milter_client_get_custom_fork_func ()

    MilterClientCustomForkFunc
    milter_client_get_custom_fork_func (MilterClient *client);

### milter_client_get_worker_id ()

    guint
    milter_client_get_worker_id (MilterClient *client);

### 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_set_pid_file ()

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

Sets the PID file of `client` .

#### Parameters

client | `MilterClient`。 |
pid_file | the PID file of `client` . |

### 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_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_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_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_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_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_get_worker_pids ()

    GArray *
    milter_client_get_worker_pids (MilterClient *client);

## 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_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_MAX_N_WORKERS

    #define MILTER_CLIENT_MAX_N_WORKERS 1000

The maximum number of worker processes.

### MILTER_CLIENT_ERROR

    #define MILTER_CLIENT_ERROR           (milter_client_error_quark())

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

### 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. |

### 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 |  |

### MilterClient

    typedef struct _MilterClient MilterClient;

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

## プロパティ詳細

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

      “connection-spec”          gchar *

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

Flags: Read

デフォルト値: NULL

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

      “custom-fork”              gpointer

The custom fork.

Flags: Read / Write

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

      “default-packet-buffer-size” guint

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

Flags: Read / Write

デフォルト値: 0

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

      “event-loop”               MilterEventLoop *

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

Flags: Read / Write

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

      “event-loop-backend”       MilterClientEventLoopBackend

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

Flags: Read / Write

Default value: MILTER_CLIENT_EVENT_LOOP_BACKEND_DEFAULT

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

      “maintenance-interval”     guint

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

Flags: Read / Write

デフォルト値: 0

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

      “max-pending-finished-sessions” guint

The maximum number of pending finished sessions of the client.

Flags: Read / Write

デフォルト値: 0

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

      “n-workers”                guint

The Number of worker processes of the client.

Flags: Read / Write

Allowed values: <= 1000

デフォルト値: 0

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

      “pid-file”                 gchar *

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

Flags: Read / Write

デフォルト値: NULL

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

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

Whether removing PID file of the client on exist.

Flags: Read / Write

デフォルト値: TRUE

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

      “run-as-daemon”            gchar *

Whether running the client as a daemon or not.

Flags: Read / Write

デフォルト値: NULL

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

      “start-syslog”             gboolean

Start syslog for the client.

Flags: Write

Default value: FALSE

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

      “syslog-facility”          gchar *

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

Flags: Read / Write

デフォルト値: NULL

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

      “syslog-identify”          gchar *

Syslog identify of the client.

Flags: Read / Write

デフォルト値: NULL

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

      “worker-id”                guint

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

Flags: Read

Allowed values: <= 1000

デフォルト値: 0

## シグナル詳細

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

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

Flags: Run Last

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

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

Flags: Run Last

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

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

Flags: Run Last

### The `“maintain”` signal

    void
    user_function (MilterClient *milterclient,
                   gpointer      user_data)

Flags: Run Last

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

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

Flags: Run Last

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

    void
    user_function (MilterClient *milterclient,
                   gpointer      user_data)

Flags: Run Last

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

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

Flags: Run Last