## AgsServer

AgsServer — remote control server

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_SERVER_GET_OBJ_MUTEX()
gboolean | ags_server_test_flags ()
void | ags_server_set_flags ()
void | ags_server_unset_flags ()
AgsServerInfo * | ags_server_info_alloc ()
void | ags_server_add_controller ()
void | ags_server_remove_controller ()
void | ags_server_start ()
void | ags_server_stop ()
gboolean | ags_server_listen ()
AgsServer * | ags_server_new ()

## Properties

gpointer | controller | Read / Write
char * | domain | Read / Write
AgsFrontController * | front-controller | Read / Write
char * | ip4 | Read / Write
char * | ip6 | Read / Write
char * | path | Read / Write
char * | realm | Read / Write
guint | server-port | Read / Write

## Signals

gboolean | listen | Run Last
void | start | Run Last
void | stop | Run Last

## Types and Values

#define | AGS_SERVER_DEFAULT_SERVER_PORT
#define | AGS_SERVER_DEFAULT_DOMAIN
#define | AGS_SERVER_DEFAULT_INET4_ADDRESS
#define | AGS_SERVER_DEFAULT_INET6_ADDRESS
#define | AGS_SERVER_DEFAULT_AUTH_MODULE
#define | AGS_SERVER_DEFAULT_BACKLOG
enum | AgsServerFlags
struct | AgsServerInfo

## Object Hierarchy

        GFlags
        ╰── AgsServerFlags
        GObject
        ╰── AgsServer

## Includes

    #include <ags/server/ags_server.h>

## Description

The AgsServer is a XML-RPC server supporting authentication. See AgsXmlPasswordStore for a built-in authentication module using XML password files.

## Functions

### AGS_SERVER_GET_OBJ_MUTEX()

    #define AGS_SERVER_GET_OBJ_MUTEX(obj) (&(((AgsServer *) obj)->obj_mutex))

### ags_server_test_flags ()

    gboolean
    ags_server_test_flags (AgsServer *server,
                           AgsServerFlags flags);

Test `flags` to be set on `server` .

#### Parameters

server | the AgsServer |
flags | the flags |

#### Returns

`TRUE` if flags are set, else `FALSE`

Since: 3.0.0

### ags_server_set_flags ()

    void
    ags_server_set_flags (AgsServer *server,
                          AgsServerFlags flags);

Enable a feature of `server` .

#### Parameters

server | the AgsServer |
flags | see AgsServerFlags |

Since: 3.0.0

### ags_server_unset_flags ()

    void
    ags_server_unset_flags (AgsServer *server,
                            AgsServerFlags flags);

Disable a feature of `server` .

#### Parameters

server | the AgsServer |
flags | see AgsServerFlags |

Since: 3.0.0

### ags_server_info_alloc ()

    AgsServerInfo *
    ags_server_info_alloc (gchar *server_name,
                           gchar *uuid);

Allocate server info.

#### Parameters

server_name | the server name |
uuid | the uuid |

#### Returns

the allocated AgsServerInfo

Since: 3.0.0

### ags_server_add_controller ()

    void
    ags_server_add_controller (AgsServer *server,
                               GObject *controller);

Add `controller` to `server` .

#### Parameters

server | the AgsServer |
controller | the AgsController |

Since: 3.0.0

### ags_server_remove_controller ()

    void
    ags_server_remove_controller (AgsServer *server,
                                  GObject *controller);

Remove `controller` from `server` .

#### Parameters

server | the AgsServer |
controller | the AgsController |

Since: 3.0.0

### ags_server_start ()

    void
    ags_server_start (AgsServer *server);

Start the XMLRPC-C abyss server.

#### Parameters

server | the AgsServer |

Since: 3.0.0

### ags_server_stop ()

    void
    ags_server_stop (AgsServer *server);

Stop the XMLRPC-C abyss server.

#### Parameters

server | the AgsServer |

Since: 3.0.0

### ags_server_listen ()

    gboolean
    ags_server_listen (AgsServer *server);

Listen as server.

#### Parameters

server | the AgsServer |

#### Returns

`TRUE` as a new connection was initiated, otherwise `FALSE`

Since: 3.0.0

### ags_server_new ()

    AgsServer *
    ags_server_new ();

Instantiate AgsServer.

#### Returns

a new AgsServer

Since: 3.0.0

## Types and Values

### AGS_SERVER_DEFAULT_SERVER_PORT

    #define AGS_SERVER_DEFAULT_SERVER_PORT (8080)

### AGS_SERVER_DEFAULT_DOMAIN

    #define AGS_SERVER_DEFAULT_DOMAIN "localhost"

### AGS_SERVER_DEFAULT_INET4_ADDRESS

    #define AGS_SERVER_DEFAULT_INET4_ADDRESS "127.0.0.1"

### AGS_SERVER_DEFAULT_INET6_ADDRESS

    #define AGS_SERVER_DEFAULT_INET6_ADDRESS "::1"

### AGS_SERVER_DEFAULT_AUTH_MODULE

    #define AGS_SERVER_DEFAULT_AUTH_MODULE "ags-xml-authentication"

### AGS_SERVER_DEFAULT_BACKLOG

    #define AGS_SERVER_DEFAULT_BACKLOG (512)

### enum AgsServerFlags

Enum values to control the behavior or indicate internal state of AgsServer by enable/disable as flags.

#### Members

AGS_SERVER_STARTED | the server was started |
AGS_SERVER_RUNNING | the server is up and running |
AGS_SERVER_TERMINATING | the server is closing connections and terminating |
AGS_SERVER_INET4 | use IPv4 |
AGS_SERVER_INET6 | use IPv6 |
AGS_SERVER_ANY_ADDRESS | listen on any address |
AGS_SERVER_AUTO_START | start the server |

### struct AgsServerInfo

    struct AgsServerInfo {
      gchar *uuid;
      gchar *server_name;
    };

AgsServerInfo does identify the server and provides some basic information about it.

#### Members

gchar *`uuid`; | the assigned uuid |
gchar *`server_name`; | the server's name |

## Property Details

### The `“controller”` property

      “controller”               gpointer

The assigned AgsController providing default settings.

[transfer full]

Owner: AgsServer

Flags: Read / Write

Since: 3.0.0

### The `“domain”` property

      “domain”                   char *

The domain to use.

Owner: AgsServer

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“front-controller”` property

      “front-controller”         AgsFrontController *

The assigned AgsFrontController.

Owner: AgsServer

Flags: Read / Write

Since: 3.0.0

### The `“ip4”` property

      “ip4”                      char *

The IPv4 address as string of the server.

Owner: AgsServer

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“ip6”` property

      “ip6”                      char *

The IPv6 address as string of the server.

Owner: AgsServer

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“path”` property

      “path”                     char *

The path to use.

Owner: AgsServer

Flags: Read / Write

Default value: NULL

Since: 4.0.0

### The `“realm”` property

      “realm”                    char *

The realm to use.

Owner: AgsServer

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“server-port”` property

      “server-port”              guint

The server port to use.

Owner: AgsServer

Flags: Read / Write

Default value: 8080

Since: 3.0.0

## Signal Details

### The `“listen”` signal

    gboolean
    user_function (AgsServer *server,
                   gpointer   user_data)

The ::listen signal is emited during listen of server.

#### Parameters

server | the AgsServer |
user_data | user data set when the signal handler was connected. |

#### Returns

`TRUE` as a new connection was initiated, otherwise `FALSE`

Flags: Run Last

Since: 3.0.0

### The `“start”` signal

    void
    user_function (AgsServer *server,
                   gpointer   user_data)

The ::start signal is emitted as the server starts.

#### Parameters

server | the AgsServer |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0

### The `“stop”` signal

    void
    user_function (AgsServer *server,
                   gpointer   user_data)

The ::stop signal is emitted as the server stops.

#### Parameters

server | the AgsServer |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0.0