DMAPConnection

## DMAPConnection DMAPConnection |

## Synopsis

                        DMAPPlaylist;
    #define             TYPE_DMAP_CONNECTION
    #define             DMAP_CONNECTION                     (o)
    #define             DMAP_CONNECTION_CLASS               (k)
    #define             IS_DMAP_CONNECTION                  (o)
    #define             IS_DMAP_CONNECTION_CLASS            (k)
    #define             DMAP_CONNECTION_GET_CLASS           (o)
    typedef             DMAPConnectionPrivate;
    enum                DMAPConnectionState;
                        DMAPConnection;
                        DMAPConnectionClass;
    gboolean            (*DMAPConnectionCallback)           (DMAPConnection *connection,
                                                             gboolean result,
                                                             const char *reason,
                                                             gpointer user_data);
    void                (*DMAPResponseHandler)              (DMAPConnection *connection,
                                                             guint status,
                                                             GNode *structure,
                                                             gpointer user_data);
    GType               dmap_connection_get_type            (void);
    DMAPConnection *    dmap_connection_new                 (const char *name,
                                                             const char *host,
                                                             int port,
                                                             gboolean password_protected,
                                                             DMAPDb *db,
                                                             DMAPRecordFactory *factory);
    gboolean            dmap_connection_is_connected        (DMAPConnection *connection);
    void                dmap_connection_setup               (DMAPConnection *connection);
    void                dmap_connection_connect             (DMAPConnection *connection,
                                                             DMAPConnectionCallback callback,
                                                             gpointer user_data);
    void                dmap_connection_disconnect          (DMAPConnection *connection,
                                                             DMAPConnectionCallback callback,
                                                             gpointer user_data);
    SoupMessageHeaders * dmap_connection_get_headers        (DMAPConnection *connection,
                                                             const char *uri);
    GSList *            dmap_connection_get_playlists       (DMAPConnection *connection);
    SoupMessage *       dmap_connection_build_message       (DMAPConnection *connection,
                                                             const gchar *path,
                                                             gboolean need_hash,
                                                             gdouble version,
                                                             gint req_id,
                                                             gboolean send_close);
    gboolean            dmap_connection_get                 (DMAPConnection *self,
                                                             const gchar *path,
                                                             gboolean need_hash,
                                                             DMAPResponseHandler handler,
                                                             gpointer user_data);

## Object Hierarchy

      GObject
       +----DMAPConnection

## Properties

      "base-uri"                 gpointer              : Read / Write
      "database-id"              gint                  : Read / Write
      "db"                       gpointer              : Read / Write / Construct Only
      "dmap-version"             gdouble               : Read / Write
      "factory"                  gpointer              : Read / Write / Construct Only
      "host"                     gchar*                : Read / Write / Construct Only
      "name"                     gchar*                : Read / Write / Construct Only
      "password-protected"       gboolean              : Read / Write / Construct Only
      "port"                     guint                 : Read / Write / Construct Only
      "revision-number"          gint                  : Read / Write
      "session-id"               gint                  : Read / Write

## Signals

      "authenticate"                                   : Run Last
      "connected"                                      : Run Last
      "connecting"                                     : Run Last
      "disconnected"                                   : Run Last
      "operation-done"                                 : Run First

## Description

## Details

### DMAPPlaylist

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

### TYPE_DMAP_CONNECTION

    #define TYPE_DMAP_CONNECTION		(dmap_connection_get_type ())

The type for DMAPConnection.

### DMAP_CONNECTION()

    #define DMAP_CONNECTION(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DMAP_CONNECTION, DMAPConnection))

Casts a DMAPConnection or derived pointer into a (DMAPConnection *) pointer. Depending on the current debugging level, this function may invoke certain runtime checks to identify invalid casts.

`o` : | Object which is subject to casting.

### DMAP_CONNECTION_CLASS()

    #define DMAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TYPE_DMAP_CONNECTION, DMAPConnectionClass))

Casts a derived DMAPConnectionClass structure into a DMAPConnectionClass structure.

`k` : | a valid DMAPConnectionClass

### IS_DMAP_CONNECTION()

    #define IS_DMAP_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DMAP_CONNECTION))

Checks whether a valid GTypeInstance pointer is of type `TYPE_DMAP_CONNECTION`.

`o` : | Instance to check for being a `TYPE_DMAP_CONNECTION`.

### IS_DMAP_CONNECTION_CLASS()

    #define IS_DMAP_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DMAP_CONNECTION))

Checks whether `k` "is a" valid DMAPConnectionClass structure of type `DMAP_CONNECTION` or derived.

`k` : | a DMAPConnectionClass

### DMAP_CONNECTION_GET_CLASS()

    #define DMAP_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DMAP_CONNECTION, DMAPConnectionClass))

Get the class structure associated to a DMAPConnection instance.

`o` : | a DMAPConnection instance.
Returns : | pointer to object class structure.

### DMAPConnectionPrivate

    typedef struct DMAPConnectionPrivate DMAPConnectionPrivate;

### enum DMAPConnectionState

    typedef enum {
    	DMAP_GET_INFO = 0,
    	DMAP_GET_PASSWORD,
    	DMAP_LOGIN,
    	DMAP_GET_REVISION_NUMBER,
    	DMAP_GET_DB_INFO,
    	DMAP_GET_SONGS,
    	DMAP_GET_PLAYLISTS,
    	DMAP_GET_PLAYLIST_ENTRIES,
    	DMAP_LOGOUT,
    	DMAP_DONE
    } DMAPConnectionState;

### DMAPConnection

    typedef struct _DMAPConnection DMAPConnection;

### DMAPConnectionClass

    typedef struct {
    	GObjectClass parent;

    	SoupMessage * (*build_message)
    				  (DMAPConnection     *connection,
    				   const gchar        *path,
    				   gboolean            need_hash,
    				   gdouble             version,
    				   gint                req_id,
    				   gboolean            send_close);
    	void   (* connected)      (DMAPConnection     *connection);
    	void   (* disconnected)   (DMAPConnection     *connection);

    	char * (* authenticate)   (DMAPConnection     *connection,
    				   const char           *name);
    	void   (* connecting)     (DMAPConnection     *connection,
    				   DMAPConnectionState state,
    				   float		 progress);

    	void   (* operation_done) (DMAPConnection     *connection);
    } DMAPConnectionClass;

### DMAPConnectionCallback ()

    gboolean            (*DMAPConnectionCallback)           (DMAPConnection *connection,
                                                             gboolean result,
                                                             const char *reason,
                                                             gpointer user_data);

`connection` : |
`result` : |
`reason` : |
`user_data` : |
Returns : |

### DMAPResponseHandler ()

    void                (*DMAPResponseHandler)              (DMAPConnection *connection,
                                                             guint status,
                                                             GNode *structure,
                                                             gpointer user_data);

`connection` : |
`status` : |
`structure` : |
`user_data` : |

### dmap_connection_get_type ()

    GType               dmap_connection_get_type            (void);

Returns : |

### dmap_connection_new ()

    DMAPConnection *    dmap_connection_new                 (const char *name,
                                                             const char *host,
                                                             int port,
                                                             gboolean password_protected,
                                                             DMAPDb *db,
                                                             DMAPRecordFactory *factory);

`name` : |
`host` : |
`port` : |
`password_protected` : |
`db` : |
`factory` : |
Returns : |

### dmap_connection_is_connected ()

    gboolean            dmap_connection_is_connected        (DMAPConnection *connection);

`connection` : |
Returns : |

### dmap_connection_setup ()

    void                dmap_connection_setup               (DMAPConnection *connection);

`connection` : |

### dmap_connection_connect ()

    void                dmap_connection_connect             (DMAPConnection *connection,
                                                             DMAPConnectionCallback callback,
                                                             gpointer user_data);

`connection` : |
`callback` : |
`user_data` : |

### dmap_connection_disconnect ()

    void                dmap_connection_disconnect          (DMAPConnection *connection,
                                                             DMAPConnectionCallback callback,
                                                             gpointer user_data);

`connection` : |
`callback` : |
`user_data` : |

### dmap_connection_get_headers ()

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

`connection` : |
`uri` : |
Returns : |

### dmap_connection_get_playlists ()

    GSList *            dmap_connection_get_playlists       (DMAPConnection *connection);

`connection` : |
Returns : |

### dmap_connection_build_message ()

    SoupMessage *       dmap_connection_build_message       (DMAPConnection *connection,
                                                             const gchar *path,
                                                             gboolean need_hash,
                                                             gdouble version,
                                                             gint req_id,
                                                             gboolean send_close);

`connection` : |
`path` : |
`need_hash` : |
`version` : |
`req_id` : |
`send_close` : |
Returns : |

### dmap_connection_get ()

    gboolean            dmap_connection_get                 (DMAPConnection *self,
                                                             const gchar *path,
                                                             gboolean need_hash,
                                                             DMAPResponseHandler handler,
                                                             gpointer user_data);

`self` : |
`path` : |
`need_hash` : |
`handler` : |
`user_data` : |
Returns : |

## Property Details

### The `"base-uri"` property

      "base-uri"                 gpointer              : Read / Write

base URI.

### The `"database-id"` property

      "database-id"              gint                  : Read / Write

database ID.

Allowed values: >= 0

Default value: 0

### The `"db"` property

      "db"                       gpointer              : Read / Write / Construct Only

DMAPDb object.

### The `"dmap-version"` property

      "dmap-version"             gdouble               : Read / Write

DMAP version.

Allowed values: >= 0

Default value: 0

### The `"factory"` property

      "factory"                  gpointer              : Read / Write / Construct Only

record factory.

### The `"host"` property

      "host"                     gchar*                : Read / Write / Construct Only

host.

Default value: NULL

### The `"name"` property

      "name"                     gchar*                : Read / Write / Construct Only

connection name.

Default value: NULL

### The `"password-protected"` property

      "password-protected"       gboolean              : Read / Write / Construct Only

connection is password protected.

Default value: FALSE

### The `"port"` property

      "port"                     guint                 : Read / Write / Construct Only

port.

Allowed values: <= G_MAXINT

Default value: 0

### The `"revision-number"` property

      "revision-number"          gint                  : Read / Write

revision number.

Allowed values: >= 0

Default value: 0

### The `"session-id"` property

      "session-id"               gint                  : Read / Write

session ID.

Allowed values: >= 0

Default value: 0

## Signal Details

### The `"authenticate"` signal

    gchar*              user_function                      (DMAPConnection *dmapconnection,
                                                            gchar          *arg1,
                                                            gpointer        user_data)           : Run Last

`dmapconnection` : | the object which received the signal.
`arg1` : |
`user_data` : | user data set when the signal handler was connected.
Returns : |

### The `"connected"` signal

    void                user_function                      (DMAPConnection *dmapconnection,
                                                            gpointer        user_data)           : Run Last

`dmapconnection` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"connecting"` signal

    void                user_function                      (DMAPConnection *dmapconnection,
                                                            gulong          arg1,
                                                            gfloat          arg2,
                                                            gpointer        user_data)           : Run Last

`dmapconnection` : | the object which received the signal.
`arg1` : |
`arg2` : |
`user_data` : | user data set when the signal handler was connected.

### The `"disconnected"` signal

    void                user_function                      (DMAPConnection *dmapconnection,
                                                            gpointer        user_data)           : Run Last

`dmapconnection` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"operation-done"` signal

    void                user_function                      (DMAPConnection *dmapconnection,
                                                            gpointer        user_data)           : Run First

`dmapconnection` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.