## Libdmapsharing Client Internals

Libdmapsharing Client Internals — Description of libdmapsharing's internal client code

## Libdmapsharing Client Internals

The DMAPMdnsBrowser class allows for asynchronous interaction with a DMAP server using mDNS.

The DmapConnection class's dmap_connection_start sets up a connection to a DMAP server using libsoup, stores the application-provided callback, sets the connection state to DMAP_GET_INFO, adds dmap_connection_do_something as a GLib loop idle function, and connects the function _connected_cb to the "operation-done" signal. The connection state progresses from DMAP_GET_INFO to DMAP_GET_PASSWORD then DMAP_LOGIN then DMAP_GET_REVISION_NUMBER then DMAP_GET_DB_INFO then DMAP_GET_MEDIA then DMAP_GET_PLAYLISTS then (possibly) DMAP_GET_PLAYLIST_ENTRIES. Each time the state changes, dmap_connection_do_something executes as an idle function. By the time these state transitions are complete, DMAPConnection has populated the media database. The _connected_cb function, in turn, executes the application-provided callback.