A parser in C for the Digital Media Access Protocol and its derivatives as used by iTunes and iPhoto. This includes support for the following protocols:
- Digital Media Access Protocol (DMAP)
- Digital Audio Access Protocol (DAAP)
- Digital Photo Access Protocol (DPAP)
- Digital Media Control Protocol (DMCP)
- Digital Audio Control Protocol (DACP)
Populate a dmap_settings
structure with the callbacks you're interested in and call dmap_parse
. The parser maintains no state and expects to receive a complete message. Each callback returns both the four character code included in the message and a more human readable name for fields the parser is aware of.
The DMAP protocol does not encode any type information, requiring clients to know what type is used for each field ID and to skip unknown fields. However, through examination of the field data the parser is able to make a reasonable guess at the type. This is useful when examining new fields or messages.
The dmapprint utility accepts DMAP input from stdin or a file and outputs a human readable representation of the message. For example:
> curl --silent --header "Viewer-Only-Client: 1" http://127.0.0.1:3689/content-codes | dmapprint
dmap.contentcodesresponse:
dmap.status: 200
dmap.dictionary:
dmap.contentcodesnumber: miid
dmap.contentcodesname: dmap.itemid
dmap.contentcodestype: 5
dmap.dictionary:
dmap.contentcodesnumber: minm
dmap.contentcodesname: dmap.itemname
dmap.contentcodestype: 9
...