## DmapConnection

DmapConnection — An abstract parent to the various connection classes.

## Functions

void | (*DmapConnectionFunc) ()
gboolean | dmap_connection_is_connected ()
void | dmap_connection_start ()
void | dmap_connection_stop ()
SoupMessageHeaders * | dmap_connection_get_headers ()
GSList * | dmap_connection_get_playlists ()
void | dmap_connection_authenticate_message ()
void | dmap_connection_emit_error ()

## Properties

GUri * | base-uri | Read / Write
int | database-id | Read / Write
DmapDb * | db | Read / Write / Construct Only
double | dmap-version | Read / Write
DmapRecordFactory * | factory | Read / Write / Construct Only
char * | host | Read / Write / Construct Only
char * | name | Read / Write / Construct Only
char * | password | Write
guint | port | Read / Write / Construct Only
int | revision-number | Read / Write
int | session-id | Read / Write
char * | username | Read / Write / Construct Only

## Signals

void | authenticate | Run Last
void | connected | Run Last
void | connecting | Run Last
void | disconnected | Run Last
void | error | Run First
void | operation-done | Run First

## Types and Values

| DmapPlaylist
enum | DmapConnectionState

## Object Hierarchy

        GEnum
        ╰── DmapConnectionState
        GObject
        ╰── DmapConnection
            ├── DmapAvConnection
            ├── DmapControlConnection
            ╰── DmapImageConnection

## Description

DmapConnection provides an abstract parent to the DmapAvConnection, DmapControlConnection, and DmapImageConnection classes.

## Functions

### DmapConnectionFunc ()

    void
    (*DmapConnectionFunc) (DmapConnection *connection,
                           gboolean result,
                           const char *reason,
                           gpointer user_data);

### dmap_connection_is_connected ()

    gboolean
    dmap_connection_is_connected (DmapConnection *connection);

Returns TRUE if the connection is presently connected.

#### Parameters

connection | The connection. |

### dmap_connection_start ()

    void
    dmap_connection_start (DmapConnection *connection,
                           DmapConnectionFunc callback,
                           gpointer user_data);

Connect to the remote DMAP share.

#### Parameters

connection | The connection. |
callback | The function to call once the connection is complete. | [scope async]
user_data | The data to pass to the callback. |

### dmap_connection_stop ()

    void
    dmap_connection_stop (DmapConnection *connection,
                          DmapConnectionFunc callback,
                          gpointer user_data);

Disconnect from the remote DMAP share.

#### Parameters

connection | The connection. |
callback | The function to call once the connection is complete. | [scope async]
user_data | The data to pass to the callback. |

### dmap_connection_get_headers ()

    SoupMessageHeaders *
    dmap_connection_get_headers (DmapConnection *connection,
                                 const char *uri);

### dmap_connection_get_playlists ()

    GSList *
    dmap_connection_get_playlists (DmapConnection *connection);

Get the playlists associated with a DmapConnection instance.

#### Parameters

connection | A DmapConnection |

#### Returns

pointer to a list of playlists.

[element-type DmapPlaylist][transfer none]

### dmap_connection_authenticate_message ()

    void
    dmap_connection_authenticate_message (DmapConnection *connection,
                                          SoupSession *session,
                                          SoupMessage *message,
                                          SoupAuth *auth,
                                          const char *password);

Attach an authentication credential to a request. This method should be called by a function that is connected to the “authenticate” signal. The signal will provide the connection, session, message and auth to that function. That function should obtain a password and provide it to this method.

#### Parameters

connection | A DmapConnection |
session | A SoupSession |
message | A SoupMessage |
auth | A SoupAuth |
password | A password |

### dmap_connection_emit_error ()

    void
    dmap_connection_emit_error (DmapConnection *connection,
                                gint code,
                                const gchar *format,
                                ...);

#### Parameters

connection | a DmapConnection instance. |
code | error code. |
format | printf()-style format for error message |
... | parameters for message format |

## Types and Values

### DmapPlaylist

    typedef struct {
    	char *name;
    	int id;
    	GList *uris;
    } DmapPlaylist;

### enum DmapConnectionState

Enumeration of connection states.

#### Members

DMAP_GET_INFO | getting DMAP server information |
DMAP_LOGIN | logging in to DMAP server |
DMAP_GET_REVISION_NUMBER | getting server's database revision number |
DMAP_GET_DB_INFO | getting DMAP database information |
DMAP_GET_MEDIA | getting DMAP media listing |
DMAP_GET_PLAYLISTS | getting DMAP playlists |
DMAP_GET_PLAYLIST_ENTRIES | getting entries in playlist |
DMAP_LOGOUT | logging out of DMAP server |
DMAP_DONE | done |

## Property Details

### The `“base-uri”` property

      “base-uri”                 GUri *

base URI.

Owner: DmapConnection

Flags: Read / Write

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

      “database-id”              int

database ID.

Owner: DmapConnection

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“db”` property

      “db”                       DmapDb *

DmapDb object.

Owner: DmapConnection

Flags: Read / Write / Construct Only

### The `“dmap-version”` property

      “dmap-version”             double

DMAP version.

Owner: DmapConnection

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“factory”` property

      “factory”                  DmapRecordFactory *

record factory.

Owner: DmapConnection

Flags: Read / Write / Construct Only

### The `“host”` property

      “host”                     char *

host.

Owner: DmapConnection

Flags: Read / Write / Construct Only

Default value: NULL

### The `“name”` property

      “name”                     char *

connection name.

Owner: DmapConnection

Flags: Read / Write / Construct Only

Default value: NULL

### The `“password”` property

      “password”                 char *

connection password.

Owner: DmapConnection

Flags: Write

Default value: NULL

### The `“port”` property

      “port”                     guint

port.

Owner: DmapConnection

Flags: Read / Write / Construct Only

Allowed values: <= G_MAXINT

Default value: 0

### The `“revision-number”` property

      “revision-number”          int

revision number.

Owner: DmapConnection

Flags: Read / Write

Allowed values: >= 0

Default value: 0

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

      “session-id”               int

session ID.

Owner: DmapConnection

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“username”` property

      “username”                 char *

connection username.

Owner: DmapConnection

Flags: Read / Write / Construct Only

Default value: "libdmapsharing"

## Signal Details

### The `“authenticate”` signal

    void
    user_function (DmapConnection *dmapconnection,
                   char           *arg1,
                   SoupSession    *arg2,
                   SoupMessage    *arg3,
                   SoupAuth       *arg4,
                   gboolean        arg5,
                   gpointer        user_data)

Flags: Run Last

### The `“connected”` signal

    void
    user_function (DmapConnection *dmapconnection,
                   gpointer        user_data)

Flags: Run Last

### The `“connecting”` signal

    void
    user_function (DmapConnection *dmapconnection,
                   gulong          arg1,
                   float           arg2,
                   gpointer        user_data)

Flags: Run Last

### The `“disconnected”` signal

    void
    user_function (DmapConnection *dmapconnection,
                   gpointer        user_data)

Flags: Run Last

### The `“error”` signal

    void
    user_function (DmapConnection *dmapconnection,
                   gpointer        arg1,
                   gpointer        user_data)

Flags: Run First

### The `“operation-done”` signal

    void
    user_function (DmapConnection *dmapconnection,
                   gpointer        user_data)

Flags: Run First