<commit_before>DMAP Parser
===========

A parser in C for the Digital Media Access Protocol (DMAP) and Digital Media Control Protocol (DMCP) used by iTunes. These are also referred to as the Digital Audio Access Protocol (DAAP) and Digital Audio Control Protocol (DACP).

Usage
-----

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.

Forward Compatibility
---------------------

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.

dmapprint
---------

The dmapprint utility accepts DMAP input from stdin or a file and outputs a human readable representation of the message. For example:

	> curl -s -H "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
	    ...<commit_msg>Note DPAP support in readme<commit_after>DMAP Parser
===========

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)

Usage
-----

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.

Forward Compatibility
---------------------

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.

dmapprint
---------

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
	    ...
{'fraction_non_alphanumeric': 0.0764391318024536, 'fraction_numerical': 0.010066058508965083, 'mean_word_length': 3.7041420118343193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6128671', 'n_tokens_mistral': 897, 'n_tokens_neox': 829, 'n_words': 405}