InfdXmppServer: libinfinity-0.7 Reference Manual

## InfdXmppServer InfdXmppServer |

## Functions

InfdXmppServer * | infd_xmpp_server_new ()
void | infd_xmpp_server_set_security_policy ()
InfXmppConnectionSecurityPolicy | infd_xmpp_server_get_security_policy ()

## Properties

InfCertificateCredentials * | credentials | Read / Write / Construct
gchar * | local-hostname | Read / Write / Construct Only
InfSaslContext * | sasl-context | Read / Write / Construct
gchar * | sasl-mechanisms | Read / Write / Construct
InfXmppConnectionSecurityPolicy | security-policy | Read / Write / Construct
InfdTcpServer * | tcp-server | Read / Write / Construct Only

## Signals

void | error | Run Last

## Types and Values

struct | InfdXmppServer
struct | InfdXmppServerClass

## Object Hierarchy

        GObject
        ╰── InfdXmppServer

## Implemented Interfaces

InfdXmppServer implements InfdXmlServer.

## Description

## Functions

### infd_xmpp_server_new ()

    InfdXmppServer *
    infd_xmpp_server_new (InfdTcpServer *tcp,
                          InfXmppConnectionSecurityPolicy policy,
                          InfCertificateCredentials *creds,
                          InfSaslContext *sasl_context,
                          const gchar *sasl_mechanisms);

Creates a new InfdXmppServer with `tcp` as underlaying TCP server object. No attempt is being made to open `tcp` , if it is not already open. When a new connection comes in, the XMPP server creates a XMPP connection that may be used to communicate with the client. Note however that the resulting connection will be in status OPENING until authentication has completed.

If `policy` is `INF_XMPP_CONNECTION_SECURITY_ONLY_UNSECURED`, then `creds` may be `NULL`. If `creds` is non-`NULL` nevertheless, then it is possible to change the security policy later using `infd_xmpp_server_set_security_policy()`. `creds` can also be changed later while the server is running. So just set valid credentials before changing `policy` to allow TLS.

If `sasl_context` is `NULL`, the server uses a built-in context that only supports ANONYMOUS authentication. If `sasl_context` is not `NULL`, then `sasl_mechanisms` specifies the mechanisms offered to clients. If `sasl_mechanisms` is `NULL`, then all available mechanims will be offered. If `sasl_context` is `NULL`, then this parameter is ignored.

[constructor]

#### Parameters

tcp | A InfdTcpServer. |
policy | The initial security policy. |
creds | Certificate credentials used to secure any communication. |
sasl_context | A SASL context used for authentication. |
sasl_mechanisms | A whitespace-sparated list of SASL mechanisms. |

#### Returns

A new InfdXmppServer.

[transfer full]

### infd_xmpp_server_set_security_policy ()

    void
    infd_xmpp_server_set_security_policy (InfdXmppServer *server,
                                          InfXmppConnectionSecurityPolicy policy);

Sets the security policy for newly accepted InfXmppConnections. Does not already established connections.

#### Parameters

server | A InfdXmppServer. |
policy | The new security policy. |

### infd_xmpp_server_get_security_policy ()

    InfXmppConnectionSecurityPolicy
    infd_xmpp_server_get_security_policy (InfdXmppServer *server);

Returns the current security policy for newly accepted InfXmppConnections.

#### Parameters

server | A InfdXmppServer. |

#### Returns

The current security policy.

## Types and Values

### struct InfdXmppServer

    struct InfdXmppServer;

### struct InfdXmppServerClass

    struct InfdXmppServerClass {
      GObjectClass parent_class;

      /* Signals */
      void (*error)(InfdXmppServer* server,
                    GError* error);
    };

## Property Details

### The `“credentials”` property

      “credentials”              InfCertificateCredentials *

The certificate credentials for GnuTLS.

Flags: Read / Write / Construct

### The `“local-hostname”` property

      “local-hostname”           gchar *

Hostname of the server.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“sasl-context”` property

      “sasl-context”             InfSaslContext *

The SASL context used for authentaction.

Flags: Read / Write / Construct

### The `“sasl-mechanisms”` property

      “sasl-mechanisms”          gchar *

The SASL mechanisms offered to the client for authentication.

Flags: Read / Write / Construct

Default value: NULL

### The `“security-policy”` property

      “security-policy”          InfXmppConnectionSecurityPolicy

Whether to offer or require TLS.

Flags: Read / Write / Construct

Default value: INF_XMPP_CONNECTION_SECURITY_ONLY_UNSECURED

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

      “tcp-server”               InfdTcpServer *

Underlaying TCP server.

Flags: Read / Write / Construct Only

## Signal Details

### The `“error”` signal

    void
    user_function (InfdXmppServer *infdxmppserver,
                   GError         *arg1,
                   gpointer        user_data)

#### Parameters

infdxmppserver | the object which received the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last