Page 1 of 1

Daap with an itunes Server

Posted: Sat Sep 30, 2006 1:06 pm
by Todd_Z
So I'm trying to write a program that will scan the computers on my network for the song databases, and run some sort of statistical analysis, just for fun i guess - partially to learn the DAAP protocol. However, I think i'm missing something:

http://daap.sourceforge.net/docs/index.html

It seems as if when you send a /login request, you should get a session id that you then append to the next request, such as daap://server/databases?session-id=<sid> to be "authenticated".

However, this is the response I get from a /login:

Code: Select all

mlog^@^@^@^Xmstt^@^@^@^D^@^@^@M-Hmlid^@^@^@^D^\qKM-^I
The mlid information stores the session id, however I can't see how. Any ideas?

Posted: Sat Sep 30, 2006 5:32 pm
by Weirdan
I bet it's in binary. Could you post a hex dump of the info you're getting from the /login request?

Posted: Sat Sep 30, 2006 6:28 pm
by Todd_Z
6d6c6f67000000186d73747400000004000000c86d6c69640000000400007335

bin2hex( $response )

Posted: Sat Sep 30, 2006 6:43 pm
by Weirdan
ok, let's split that out:

Code: Select all

0x6d6c6f67 => mlog
0x00000018 => length of the response (24 bytes)

    0x6d737474 => mstt
    0x00000004 => length of the mstt chunk (4 bytes)
       0x000000c8 => mstt content (status, 200 in decimal, means 'OK')

    0x6d6c6964 => mlid
    0x00000004 => length of the mlid chunk (4 bytes)
       0x00007335 => mlid content ( big-endian, 29493 in decimal)
The docs you're linked to does not say how you pass the session id back to server, but if you're sure it should be passed as get param session-id then try:
daap://server/databases?session-id=29493

Posted: Sat Sep 30, 2006 6:46 pm
by Todd_Z
How does one properly parse out that session id then? I'm guessing a substr() wont cut it.

Posted: Sat Sep 30, 2006 7:09 pm
by Weirdan