annotate src/daap/xmms2-daap/cc_handlers.c @ 2202:f76e846d53d9

updating TLEN frame returned
author Eugene Zagidullin <e.asphyx@gmail.com>
date Mon, 03 Dec 2007 01:26:57 +0300
parents 776dd8fc2b38
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1407
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
1 /** @file cc_handlers.c
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
2 * Functions for parsing DAAP content code data.
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
3 *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
4 * Copyright (C) 2006-2007 XMMS2 Team
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
5 *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
8 * as published by the Free Software Foundation; either version 2
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
9 * of the License, or (at your option) any later version.
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
10 *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
14 * GNU General Public License for more details.
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
15 */
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
16
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
17 #define _GNU_SOURCE
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
18 #include <string.h>
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
19
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
20 #include <stdlib.h>
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
21
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
22 #include <glib.h>
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
23 #include <glib/gprintf.h>
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
24
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
25 #include "cc_handlers.h"
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
26 #include "daap_conn.h"
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
27
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
28 #define DMAP_BYTES_REMAINING ((gint) (data_end - current_data))
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
29
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
30 static void
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
31 endian_swap_int16 (gint16 *i)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
32 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
33 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
34 gint16 tmp;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
35 tmp = (gint16) (((*i >> 8) & 0x00FF) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
36 ((*i << 8) & 0xFF00));
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
37 *i = tmp;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
38 #endif
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
39 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
40
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
41 static void
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
42 endian_swap_int32 (gint32 *i)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
43 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
44 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
45 gint32 tmp;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
46 tmp = (gint32) (((*i >> 24) & 0x000000FF) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
47 ((*i >> 8) & 0x0000FF00) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
48 ((*i << 8) & 0x00FF0000) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
49 ((*i << 24) & 0xFF000000));
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
50 *i = tmp;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
51 #endif
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
52 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
53
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
54 static void
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
55 endian_swap_int64 (gint64 *i)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
56 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
57 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
58 gint64 tmp;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
59 tmp = (gint64) ( ((*i >> 40) & 0x00000000000000FF) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
60 ((*i >> 32) & 0x000000000000FF00) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
61 ((*i >> 24) & 0x0000000000FF0000) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
62 ((*i >> 8) & 0x00000000FF000000) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
63 G_GINT64_CONSTANT ((*i << 8) & 0x000000FF00000000) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
64 G_GINT64_CONSTANT ((*i << 24) & 0x0000FF0000000000) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
65 G_GINT64_CONSTANT ((*i << 32) & 0x00FF000000000000) |
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
66 G_GINT64_CONSTANT ((*i << 40) & 0xFF00000000000000));
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
67 *i = tmp;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
68 #endif
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
69 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
70
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
71 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
72 grab_data_string (gchar **container, gchar *data, gint str_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
73 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
74 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
75
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
76 if (0 != str_len) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
77 *container = (gchar *) malloc (sizeof (gchar) * (str_len+1));
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
78
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
79 memcpy (*container, data + DMAP_CC_SZ + DMAP_INT_SZ, str_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
80 (*container)[str_len] = '\0';
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
81
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
82 offset += str_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
83 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
84
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
85 return offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
86 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
87
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
88 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
89 grab_data_version (gint16 *cont_upper, gint16 *cont_lower, gchar *data)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
90 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
91 gint offset = DMAP_CC_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
92
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
93 memcpy (cont_lower, data + offset, DMAP_INT_SZ);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
94 endian_swap_int16 (cont_lower);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
95 offset += DMAP_INT_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
96
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
97 memcpy (cont_upper, data + offset, DMAP_INT_SZ);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
98 endian_swap_int16 (cont_upper);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
99 offset += DMAP_INT_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
100
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
101 return offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
102 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
103
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
104 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
105 grab_data (void *container, gchar *data, content_type ct)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
106 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
107 gint offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
108 gint data_size;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
109
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
110 offset = DMAP_CC_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
111 memcpy (&data_size, data + offset, DMAP_INT_SZ);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
112 endian_swap_int32 ((gint32 *)&data_size);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
113 offset += DMAP_INT_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
114
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
115 switch (ct) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
116 case DMAP_CTYPE_BYTE:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
117 case DMAP_CTYPE_UNSIGNEDBYTE:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
118 memcpy (container, data + offset, DMAP_BYTE_SZ);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
119 offset += DMAP_BYTE_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
120 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
121 case DMAP_CTYPE_SHORT:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
122 case DMAP_CTYPE_UNSIGNEDSHORT:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
123 memcpy (container, data + offset, DMAP_SHORT_SZ);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
124 endian_swap_int16 (container);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
125 offset += DMAP_SHORT_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
126 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
127 case DMAP_CTYPE_INT:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
128 case DMAP_CTYPE_UNSIGNEDINT:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
129 memcpy (container, data + offset, DMAP_INT_SZ);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
130 endian_swap_int32 (container);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
131 offset += DMAP_INT_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
132 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
133 case DMAP_CTYPE_LONG:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
134 case DMAP_CTYPE_UNSIGNEDLONG:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
135 memcpy (container, data + offset, DMAP_LONG_SZ);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
136 endian_swap_int64 (container);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
137 offset += DMAP_LONG_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
138 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
139 case DMAP_CTYPE_STRING:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
140 offset += grab_data_string ((gchar **) container, data, data_size);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
141 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
142 case DMAP_CTYPE_DATE:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
143 memcpy (container, data + offset, DMAP_INT_SZ);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
144 endian_swap_int32 (container);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
145 offset += DMAP_INT_SZ;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
146 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
147 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
148 g_print ("Warning: Unrecognized content type (%d).\n", ct);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
149 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
150 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
151
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
152 return offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
153 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
154
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
155 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
156 cc_handler_mtco (cc_data_t *fields, gchar *current_data)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
157 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
158 gint offset = grab_data (&(fields->n_rec_matches), current_data, DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
159 return offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
160 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
161
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
162 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
163 cc_handler_mrco (cc_data_t *fields, gchar *current_data)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
164 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
165 gint offset = grab_data (&(fields->n_ret_items), current_data, DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
166 return offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
167 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
168
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
169 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
170 cc_handler_muty (cc_data_t *fields, gchar *current_data)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
171 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
172 gint offset = grab_data (&(fields->updt_type), current_data, DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
173 return offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
174 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
175
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
176 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
177 cc_handler_mstt (cc_data_t *fields, gchar *current_data)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
178 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
179 gint offset = grab_data (&(fields->status), current_data, DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
180 return offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
181 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
182
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
183 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
184 cc_handler_mlit (cc_data_t *fields, gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
185 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
186 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
187 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
188 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
189 cc_item_record_t *item_fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
190
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
191 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
192 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
193
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
194 item_fields = g_malloc0 (sizeof (cc_item_record_t));
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
195
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
196 while (current_data < data_end && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
197 switch (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
198 current_data[2], current_data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
199 case CC_TO_INT ('m','i','i','d'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
200 offset += grab_data (&(item_fields->dbid), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
201 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
202 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
203 case CC_TO_INT ('m','p','e','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
204 offset += grab_data (&(item_fields->persistent_id), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
205 DMAP_CTYPE_LONG);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
206 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
207 case CC_TO_INT ('m','i','n','m'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
208 offset += grab_data (&(item_fields->iname), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
209 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
210 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
211
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
212 /* song list specific */
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
213 case CC_TO_INT ('m','i','k','d'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
214 offset += grab_data (&(item_fields->item_kind), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
215 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
216 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
217 case CC_TO_INT ('a','s','d','k'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
218 offset += grab_data (&(item_fields->song_data_kind), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
219 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
220 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
221 case CC_TO_INT ('a','s','u','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
222 offset += grab_data (&(item_fields->song_data_url), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
223 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
224 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
225 case CC_TO_INT ('a','s','a','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
226 offset += grab_data (&(item_fields->song_data_album),
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
227 current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
228 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
229 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
230 case CC_TO_INT ('a','s','a','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
231 offset += grab_data (&(item_fields->song_data_artist),
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
232 current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
233 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
234 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
235 case CC_TO_INT ('a','s','b','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
236 offset += grab_data (&(item_fields->song_bitrate), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
237 DMAP_CTYPE_SHORT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
238 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
239 case CC_TO_INT ('a','s','c','m'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
240 offset += grab_data (&(item_fields->song_comment), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
241 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
242 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
243 case CC_TO_INT ('a','s','d','a'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
244 offset += grab_data (&(item_fields->song_date), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
245 DMAP_CTYPE_DATE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
246 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
247 case CC_TO_INT ('a','s','d','m'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
248 offset += grab_data (&(item_fields->song_date_mod), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
249 DMAP_CTYPE_DATE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
250 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
251 case CC_TO_INT ('a','s','g','n'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
252 offset += grab_data (&(item_fields->song_genre), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
253 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
254 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
255 case CC_TO_INT ('a','s','f','m'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
256 offset += grab_data (&(item_fields->song_format), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
257 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
258 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
259 case CC_TO_INT ('a','s','d','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
260 offset += grab_data (&(item_fields->song_description), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
261 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
262 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
263 case CC_TO_INT ('a','s','s','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
264 offset += grab_data (&(item_fields->sample_rate), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
265 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
266 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
267 case CC_TO_INT ('a','s','s','z'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
268 offset += grab_data (&(item_fields->song_size), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
269 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
270 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
271 case CC_TO_INT ('a','s','s','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
272 offset += grab_data (&(item_fields->song_start_time), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
273 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
274 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
275 case CC_TO_INT ('a','s','s','p'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
276 offset += grab_data (&(item_fields->song_stop_time), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
277 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
278 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
279 case CC_TO_INT ('a','s','t','m'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
280 offset += grab_data (&(item_fields->song_total_time), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
281 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
282 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
283 case CC_TO_INT ('a','s','y','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
284 offset += grab_data (&(item_fields->song_year), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
285 DMAP_CTYPE_SHORT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
286 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
287 case CC_TO_INT ('a','s','t','n'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
288 offset += grab_data (&(item_fields->song_track_no), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
289 DMAP_CTYPE_SHORT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
290 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
291 case CC_TO_INT ('a','s','c','p'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
292 offset += grab_data (&(item_fields->song_composer), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
293 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
294 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
295 case CC_TO_INT ('a','s','t','c'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
296 offset += grab_data (&(item_fields->song_track_count), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
297 DMAP_CTYPE_SHORT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
298 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
299 case CC_TO_INT ('a','s','d','c'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
300 offset += grab_data (&(item_fields->song_disc_count), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
301 DMAP_CTYPE_SHORT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
302 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
303 case CC_TO_INT ('a','s','d','n'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
304 offset += grab_data (&(item_fields->song_disc_no), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
305 DMAP_CTYPE_SHORT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
306 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
307 case CC_TO_INT ('a','s','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
308 offset += grab_data (&(item_fields->song_compilation), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
309 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
310 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
311 case CC_TO_INT ('a','s','b','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
312 offset += grab_data (&(item_fields->song_bpm), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
313 DMAP_CTYPE_SHORT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
314 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
315 case CC_TO_INT ('a','g','r','p'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
316 offset += grab_data (&(item_fields->song_grouping), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
317 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
318 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
319 case CC_TO_INT ('m','c','t','i'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
320 offset += grab_data (&(item_fields->container_id), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
321 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
322 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
323 case CC_TO_INT ('m','u','d','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
324 offset += grab_data (&(item_fields->deleted_id), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
325 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
326 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
327
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
328 /* db list specific */
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
329 case CC_TO_INT ('m','i','m','c'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
330 offset += grab_data (&(item_fields->db_n_items), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
331 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
332 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
333 case CC_TO_INT ('m','c','t','c'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
334 offset += grab_data (&(item_fields->db_n_playlist), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
335 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
336 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
337 case CC_TO_INT ('a','e','S','P'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
338 offset += grab_data (&(item_fields->is_smart_pl), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
339 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
340 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
341 case CC_TO_INT ('a','b','p','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
342 offset += grab_data (&(item_fields->is_base_pl), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
343 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
344 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
345
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
346 /* exit conditions */
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
347 case CC_TO_INT ('m','l','i','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
348 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
349 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
350 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
351 g_print ("Warning: Unrecognized content code "
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
352 "or end of data: %s\n", current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
353 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
354 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
355 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
356
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
357 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
358 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
359 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
360
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
361 fields->record_list = g_slist_prepend (fields->record_list, item_fields);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
362
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
363 return (gint) (current_data - data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
364 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
365
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
366 static gint
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
367 cc_handler_mlcl (cc_data_t *fields, gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
368 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
369 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
370 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
371 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
372 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
373 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
374
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
375 while (current_data < data_end && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
376 if (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
377 current_data[2], current_data[3]) ==
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
378 CC_TO_INT ('m','l','i','t')) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
379
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
380 offset += cc_handler_mlit (fields, current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
381 DMAP_BYTES_REMAINING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
382 } else {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
383 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
384 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
385
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
386 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
387 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
388 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
389
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
390 return (gint)(current_data - data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
391 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
392
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
393 static cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
394 cc_handler_adbs (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
395 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
396 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
397 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
398 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
399 cc_data_t *fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
400
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
401 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
402 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
403
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
404 fields = cc_data_new ();
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
405
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
406 while ((current_data < data_end) && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
407 switch (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
408 current_data[2], current_data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
409 case CC_TO_INT ('m','s','t','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
410 offset += cc_handler_mstt (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
411 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
412 case CC_TO_INT ('m','u','t','y'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
413 offset += cc_handler_muty (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
414 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
415 case CC_TO_INT ('m','t','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
416 offset += cc_handler_mtco (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
417 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
418 case CC_TO_INT ('m','r','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
419 offset += cc_handler_mrco (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
420 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
421 case CC_TO_INT ('m','l','c','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
422 offset += cc_handler_mlcl (fields, current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
423 DMAP_BYTES_REMAINING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
424 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
425 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
426 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
427 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
428 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
429
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
430 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
431 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
432 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
433
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
434 return fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
435 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
436
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
437 static cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
438 cc_handler_msrv (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
439 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
440 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
441 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
442 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
443 cc_data_t *fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
444 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
445 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
446
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
447 fields = cc_data_new ();
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
448
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
449 while ((current_data < data_end) && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
450 switch (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
451 current_data[2], current_data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
452 case CC_TO_INT ('m','s','t','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
453 offset += cc_handler_mstt (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
454 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
455 case CC_TO_INT ('a','p','r','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
456 offset += grab_data_version (&(fields->daap_proto_major),
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
457 &(fields->daap_proto_minor),
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
458 current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
459 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
460 case CC_TO_INT ('m','p','r','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
461 offset += grab_data_version (&(fields->dmap_proto_major),
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
462 &(fields->dmap_proto_minor),
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
463 current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
464 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
465 case CC_TO_INT ('m','s','t','m'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
466 offset += grab_data (&(fields->timeout_interval), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
467 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
468 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
469 case CC_TO_INT ('m','s','i','x'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
470 offset += grab_data (&(fields->has_indexing), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
471 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
472 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
473 case CC_TO_INT ('m','s','e','x'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
474 offset += grab_data (&(fields->has_extensions), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
475 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
476 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
477 case CC_TO_INT ('m','s','u','p'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
478 offset += grab_data (&(fields->has_update), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
479 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
480 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
481 case CC_TO_INT ('m','s','a','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
482 offset += grab_data (&(fields->has_autologout), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
483 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
484 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
485 case CC_TO_INT ('m','s','l','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
486 offset += grab_data (&(fields->login_required), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
487 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
488 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
489 case CC_TO_INT ('m','s','q','y'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
490 offset += grab_data (&(fields->has_queries), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
491 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
492 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
493 case CC_TO_INT ('m','s','r','s'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
494 offset += grab_data (&(fields->has_resolve), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
495 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
496 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
497 case CC_TO_INT ('m','s','b','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
498 offset += grab_data (&(fields->has_browsing), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
499 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
500 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
501 case CC_TO_INT ('m','s','p','i'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
502 offset += grab_data (&(fields->has_persistent), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
503 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
504 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
505 case CC_TO_INT ('m','s','a','s'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
506 offset += grab_data (&(fields->auth_type), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
507 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
508 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
509 case CC_TO_INT ('m','s','a','u'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
510 offset += grab_data (&(fields->auth_method), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
511 DMAP_CTYPE_BYTE);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
512 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
513 case CC_TO_INT ('a','e','S','V'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
514 offset += grab_data (&(fields->sharing_version), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
515 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
516 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
517 case CC_TO_INT ('m','s','d','c'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
518 offset += grab_data (&(fields->db_count), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
519 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
520 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
521 case CC_TO_INT ('m','i','n','m'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
522 offset += grab_data (&(fields->server_name), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
523 DMAP_CTYPE_STRING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
524 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
525 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
526 g_print ("Warning: Unrecognized content code "
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
527 "or end of data: %s\n",
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
528 current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
529 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
530 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
531 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
532
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
533 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
534 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
535 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
536
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
537 return fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
538 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
539
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
540 static cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
541 cc_handler_mccr (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
542 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
543 /* not implemented */
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
544 return NULL;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
545 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
546
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
547 static cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
548 cc_handler_mlog (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
549 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
550 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
551 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
552 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
553 cc_data_t *fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
554
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
555 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
556 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
557
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
558 fields = cc_data_new ();
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
559
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
560 while ((current_data < data_end) && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
561 switch (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
562 current_data[2], current_data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
563 case CC_TO_INT ('m','s','t','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
564 offset += cc_handler_mstt (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
565 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
566 case CC_TO_INT ('m','l','i','d'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
567 offset += grab_data (&(fields->session_id), current_data, DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
568 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
569 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
570 g_print ("Unrecognized content code or end of data: %s\n",
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
571 current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
572 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
573 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
574 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
575
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
576 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
577 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
578 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
579
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
580 return fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
581 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
582
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
583 static cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
584 cc_handler_mupd (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
585 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
586 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
587 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
588 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
589 cc_data_t *fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
590
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
591 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
592 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
593
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
594 fields = cc_data_new ();
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
595
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
596 while ((current_data < data_end) && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
597 switch (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
598 current_data[2], current_data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
599 case CC_TO_INT ('m','u','s','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
600 offset += grab_data (&(fields->revision_id), current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
601 DMAP_CTYPE_INT);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
602 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
603 case CC_TO_INT ('m','s','t','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
604 offset += cc_handler_mstt (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
605 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
606 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
607 g_print ("Unrecognized content code or end of data: %s\n",
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
608 current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
609 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
610 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
611 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
612
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
613 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
614 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
615 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
616
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
617 return fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
618 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
619
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
620 static cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
621 cc_handler_avdb (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
622 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
623 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
624 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
625 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
626 cc_data_t *fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
627
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
628 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
629 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
630
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
631 fields = cc_data_new ();
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
632
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
633 while ((current_data < data_end) && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
634 switch (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
635 current_data[2], current_data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
636 case CC_TO_INT ('m','s','t','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
637 offset += cc_handler_mstt (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
638 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
639 case CC_TO_INT ('m','u','t','y'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
640 offset += cc_handler_muty (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
641 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
642 case CC_TO_INT ('m','t','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
643 offset += cc_handler_mtco (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
644 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
645 case CC_TO_INT ('m','r','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
646 offset += cc_handler_mrco (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
647 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
648 case CC_TO_INT ('m','l','c','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
649 offset += cc_handler_mlcl (fields, current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
650 DMAP_BYTES_REMAINING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
651 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
652 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
653 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
654 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
655 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
656
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
657 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
658 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
659 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
660
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
661 return fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
662 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
663
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
664 static cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
665 cc_handler_apso (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
666 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
667 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
668 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
669 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
670 cc_data_t *fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
671
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
672 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
673 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
674
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
675 fields = cc_data_new ();
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
676
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
677 while ((current_data < data_end) && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
678 switch (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
679 current_data[2], current_data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
680 case CC_TO_INT ('m','s','t','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
681 offset += cc_handler_mstt (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
682 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
683 case CC_TO_INT ('m','u','t','y'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
684 offset += cc_handler_muty (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
685 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
686 case CC_TO_INT ('m','t','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
687 offset += cc_handler_mtco (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
688 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
689 case CC_TO_INT ('m','r','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
690 offset += cc_handler_mrco (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
691 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
692 case CC_TO_INT ('m','l','c','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
693 offset += cc_handler_mlcl (fields, current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
694 DMAP_BYTES_REMAINING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
695 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
696 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
697 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
698 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
699 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
700
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
701 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
702 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
703 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
704
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
705 return fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
706 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
707
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
708 static cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
709 cc_handler_aply (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
710 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
711 gint offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
712 gboolean do_break = FALSE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
713 gchar *current_data, *data_end;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
714 cc_data_t *fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
715
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
716 current_data = data + 8;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
717 data_end = data + data_len;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
718
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
719 fields = cc_data_new ();
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
720
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
721 while ((current_data < data_end) && !do_break) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
722 switch (CC_TO_INT (current_data[0], current_data[1],
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
723 current_data[2], current_data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
724 case CC_TO_INT ('m','s','t','t'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
725 offset += cc_handler_mstt (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
726 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
727 case CC_TO_INT ('m','u','t','y'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
728 offset += cc_handler_muty (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
729 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
730 case CC_TO_INT ('m','t','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
731 offset += cc_handler_mtco (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
732 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
733 case CC_TO_INT ('m','r','c','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
734 offset += cc_handler_mrco (fields, current_data);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
735 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
736 case CC_TO_INT ('m','l','c','l'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
737 offset += cc_handler_mlcl (fields, current_data,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
738 DMAP_BYTES_REMAINING);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
739 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
740 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
741 do_break = TRUE;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
742 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
743 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
744
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
745 current_data += offset;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
746 offset = 0;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
747 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
748
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
749 return fields;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
750 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
751
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
752 cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
753 cc_data_new ()
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
754 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
755 cc_data_t *retval;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
756
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
757 retval = g_malloc0 (sizeof (cc_data_t));
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
758 retval->record_list = NULL;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
759
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
760 return retval;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
761 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
762
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
763 void
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
764 cc_data_free (cc_data_t *fields)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
765 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
766 if (NULL != fields->server_name) g_free (fields->server_name);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
767
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
768 g_slist_foreach (fields->record_list,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
769 (GFunc) cc_item_record_free,
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
770 NULL);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
771 g_slist_free (fields->record_list);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
772
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
773 g_free (fields);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
774 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
775
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
776 void
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
777 cc_item_record_free (cc_item_record_t *item)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
778 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
779 if (NULL != item->iname) g_free (item->iname);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
780 if (NULL != item->song_data_url) g_free (item->song_data_url);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
781 if (NULL != item->song_data_album) g_free (item->song_data_album);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
782 if (NULL != item->song_data_artist) g_free (item->song_data_artist);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
783 if (NULL != item->song_comment) g_free (item->song_comment);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
784 if (NULL != item->song_description) g_free (item->song_description);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
785 if (NULL != item->song_genre) g_free (item->song_genre);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
786 if (NULL != item->song_format) g_free (item->song_format);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
787 if (NULL != item->song_composer) g_free (item->song_composer);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
788 if (NULL != item->song_grouping) g_free (item->song_grouping);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
789
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
790 g_free (item);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
791 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
792
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
793 GSList *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
794 cc_record_list_deep_copy (GSList *record_list) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
795 GSList *retval = NULL;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
796 cc_item_record_t *record, *data;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
797
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
798 for (; record_list; record_list = g_slist_next (record_list)) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
799 data = record_list->data;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
800 record = g_malloc0 (sizeof (cc_item_record_t));
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
801 if (!record) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
802 g_print ("memory allocation failed for cc_record_list_deep_copy\n");
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
803 return NULL;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
804 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
805
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
806 record->item_kind = data->item_kind;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
807 record->song_data_kind = data->song_data_kind;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
808 record->song_compilation = data->song_compilation;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
809 record->is_smart_pl = data->is_smart_pl;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
810 record->is_base_pl = data->is_base_pl;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
811
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
812 record->song_bitrate = data->song_bitrate;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
813 record->song_year = data->song_year;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
814 record->song_track_no = data->song_track_no;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
815 record->song_track_count = data->song_track_count;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
816 record->song_disc_count = data->song_disc_count;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
817 record->song_disc_no = data->song_disc_no;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
818 record->song_bpm = data->song_bpm;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
819
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
820 record->dbid = data->dbid;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
821 record->sample_rate = data->sample_rate;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
822 record->song_size = data->song_size;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
823 record->song_start_time = data->song_start_time;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
824 record->song_stop_time = data->song_stop_time;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
825 record->song_total_time = data->song_total_time;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
826 record->song_date = data->song_date;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
827 record->song_date_mod = data->song_date_mod;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
828 record->container_id = data->container_id;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
829
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
830 record->deleted_id = data->deleted_id;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
831
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
832 record->persistent_id = data->persistent_id;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
833
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
834 record->iname = g_strdup (data->iname);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
835 record->song_data_url = g_strdup (data->song_data_url);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
836 record->song_data_album = g_strdup (data->song_data_album);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
837 record->song_data_artist = g_strdup (data->song_data_artist);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
838 record->song_comment = g_strdup (data->song_comment);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
839 record->song_description = g_strdup (data->song_description);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
840 record->song_genre = g_strdup (data->song_genre);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
841 record->song_format = g_strdup (data->song_format);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
842 record->song_composer = g_strdup (data->song_composer);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
843 record->song_grouping = g_strdup (data->song_grouping);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
844
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
845 /* db list specific */
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
846 record->db_n_items = data->db_n_items;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
847 record->db_n_playlist = data->db_n_playlist;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
848
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
849 retval = g_slist_prepend (retval, record);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
850 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
851
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
852 return retval;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
853 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
854
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
855 cc_data_t *
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
856 cc_handler (gchar *data, gint data_len)
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
857 {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
858 cc_data_t *retval;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
859
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
860 switch (CC_TO_INT (data[0],data[1],data[2],data[3])) {
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
861 case CC_TO_INT ('a','d','b','s'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
862 retval = cc_handler_adbs (data, data_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
863 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
864 case CC_TO_INT ('m','s','r','v'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
865 retval = cc_handler_msrv (data, data_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
866 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
867 case CC_TO_INT ('m','c','c','r'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
868 retval = cc_handler_mccr (data, data_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
869 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
870 case CC_TO_INT ('m','l','o','g'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
871 retval = cc_handler_mlog (data, data_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
872 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
873 case CC_TO_INT ('m','u','p','d'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
874 retval = cc_handler_mupd (data, data_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
875 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
876 case CC_TO_INT ('a','v','d','b'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
877 retval = cc_handler_avdb (data, data_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
878 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
879 case CC_TO_INT ('a','p','s','o'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
880 retval = cc_handler_apso (data, data_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
881 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
882 case CC_TO_INT ('a','p','l','y'):
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
883 retval = cc_handler_aply (data, data_len);
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
884 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
885 default:
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
886 retval = NULL;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
887 break;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
888 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
889
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
890 return retval;
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
891 }
776dd8fc2b38 DAAP plugin (work in progress)
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
892