## EpcProtocol

EpcProtocol — transport protocols

## Stability Level

Unstable, unless otherwise indicated

## Functions

EpcProtocol | epc_protocol_from_name ()
gchar * | epc_protocol_build_uri ()
const gchar * | epc_protocol_get_service_type ()
const gchar * | epc_protocol_get_uri_scheme ()
GEnumClass * | epc_protocol_get_class ()
const gchar * | epc_protocol_to_string ()

## Types and Values

enum | EpcProtocol

## Object Hierarchy

        GEnum
        ╰── EpcProtocol

## Includes

    #include <libepc/protcol.h>

## Description

Since the Easy Publish and Consume library hides the details of the transport mechanism used, it is possible to support different mechanisms. Currently there is support for HTTP and HTTPS.

The EpcProtocol enumeration is the maximum of information libepc wants to expose regarding its transport mechanisms.

## Functions

### epc_protocol_from_name ()

    EpcProtocol
    epc_protocol_from_name (const gchar *name,
                            EpcProtocol fallback);

Parses the protocol `name` . Case of the name doesn't matter. Returns the matching EpcProtocol, when the name was recognized, and the value of `fallback` otherwise.

#### Parameters

name | a protocol name |
fallback | the EpcProtocol to use on errors |

#### Returns

The EpcProtocol matching `name` , or `fallback` on error.

### epc_protocol_build_uri ()

    gchar *
    epc_protocol_build_uri (EpcProtocol protocol,
                            const gchar *hostname,
                            guint16 port,
                            const gchar *path);

Builds the Unified Resource Identifier (URI) for a service. The returned string should be released when no longer needed.

#### Parameters

protocol | a EpcProtocol |
hostname | the host to contact |
port | the service port |
path | the service path, or `NULL` |

#### Returns

A newly allocated string with the URI for the service, or `NULL` on error.

### epc_protocol_get_service_type ()

    const gchar *
    epc_protocol_get_service_type (EpcProtocol protocol);

Queries the DNS-SD service type associated with a EpcProtocol. See EPC_SERVICE_TYPE_HTTP, EPC_SERVICE_TYPE_HTTPS.

#### Parameters

protocol | a EpcProtocol |

#### Returns

Returns the DNS-SD service type associated with `protocol` , or `NULL` on unknown protocols.

### epc_protocol_get_uri_scheme ()

    const gchar *
    epc_protocol_get_uri_scheme (EpcProtocol protocol);

Queries the URI scheme associated with a EpcProtocol. See `epc_service_type_build_uri()`.

#### Parameters

protocol | a EpcProtocol |

#### Returns

Returns the URI scheme associated with `protocol` , or `NULL` on unknown protocols.

### epc_protocol_get_class ()

    GEnumClass *
    epc_protocol_get_class (void);

Retrieves the GEnumClass describing the EpcProtocol enum.

#### Returns

The GEnumClass describing EpcProtocol.

### epc_protocol_to_string ()

    const gchar *
    epc_protocol_to_string (EpcProtocol value);

Retrieves the name of a EpcProtocol `value` , or `NULL` when `value` is invalid.

#### Parameters

value | a EpcProtocol value |

#### Returns

The string representation of `value` , or `NULL`.

## Types and Values

### enum EpcProtocol

The transport protocols supported by libepc.

#### Members

EPC_PROTOCOL_UNKNOWN | Used when the transport protocol is not known yet. |
EPC_PROTOCOL_HTTP | Plain HTTP. Passwords are protected using HTTP digest authentication, remaining data is transfered without any encryption. |
EPC_PROTOCOL_HTTPS | Encrypted HTTP. Attempts are made to use this transport method when ever possible. |

## See Also

epc_service_type_new()