## CamelNetworkService

CamelNetworkService

## Synopsis

                        CamelNetworkService;
    guint16             camel_network_service_get_default_port
                                                            (CamelNetworkService *service,
                                                             CamelNetworkSecurityMethod method);
    const gchar *       camel_network_service_get_service_name
                                                            (CamelNetworkService *service,
                                                             CamelNetworkSecurityMethod method);
    CamelStream *       camel_network_service_connect_sync  (CamelNetworkService *service,
                                                             GCancellable *cancellable,
                                                             GError **error);

## Object Hierarchy

      GInterface
       +----CamelNetworkService

## Prerequisites

CamelNetworkService requires CamelService.

## Known Implementations

CamelNetworkService is implemented by CamelIMAPXStore.

## Description

## Details

### CamelNetworkService

    typedef struct _CamelNetworkService CamelNetworkService;

Since 3.2

### camel_network_service_get_default_port ()

    guint16             camel_network_service_get_default_port
                                                            (CamelNetworkService *service,
                                                             CamelNetworkSecurityMethod method);

Returns the default network port number for `service` and the security method `method`, as defined in /etc/services. For example, the default port for unencrypted IMAP or encrypted IMAP using STARTTLS is 143, but the default port for IMAP over SSL is 993.

`service` : | a CamelNetworkService
`method` : | a CamelNetworkSecurityMethod
Returns : | the default port number for `service` and `method`

Since 3.2

### camel_network_service_get_service_name ()

    const gchar *       camel_network_service_get_service_name
                                                            (CamelNetworkService *service,
                                                             CamelNetworkSecurityMethod method);

Returns the standard network service name for `service` and the security method `method`, as defined in /etc/services. For example, the service name for unencrypted IMAP or encrypted IMAP using STARTTLS is "imap", but the service name for IMAP over SSL is "imaps".

`service` : | a CamelNetworkService
`method` : | a CamelNetworkSecurityMethod
Returns : | the network service name for `service` and `method`, or `NULL`

Since 3.2

### camel_network_service_connect_sync ()

    CamelStream *       camel_network_service_connect_sync  (CamelNetworkService *service,
                                                             GCancellable *cancellable,
                                                             GError **error);

Attempts to establish a network connection to the server described by `service`, using the preferred "security-method" to secure the connection. If a connection cannot be established, or the connection attempt is cancelled, the function sets `error` and returns `NULL`.

`service` : | a CamelNetworkService
`cancellable` : | optional GCancellable object, or `NULL`
`error` : | return location for a GError, or `NULL`
Returns : | a CamelStream, or `NULL`

Since 3.2