comparison src/daap/xmms2-daap/daap_conn.h @ 1407:776dd8fc2b38

DAAP plugin (work in progress)
author Cristi Magherusan <majeru@atheme-project.org>
date Sun, 05 Aug 2007 00:26:21 +0300
parents
children 7b3290336f3b
comparison
equal deleted inserted replaced
1400:fe0a9cf95642 1407:776dd8fc2b38
1 /** @file daap_conn.h
2 *
3 * Copyright (C) 2006-2007 XMMS2 Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16 #ifndef DAAP_CONN_H
17 #define DAAP_CONN_H
18
19 #define MAX_REQUEST_LENGTH 1024
20 #define MAX_HEADER_LENGTH (1024 * 16)
21
22 #define BAD_CONTENT_LENGTH -1
23
24 #define DAAP_VERSION 3
25
26 #define HTTP_OK 200
27 #define HTTP_NO_CONTENT 204
28 #define HTTP_BAD_REQUEST 400
29 #define HTTP_FORBIDDEN 403
30 #define HTTP_NOT_FOUND 404
31 #define UNKNOWN_SERVER_STATUS -1
32
33 #define DAAP_URL_PREFIX "daap://"
34 #define HTTP_VER_STRING "HTTP/1.1"
35 #define CONTENT_LENGTH "Content-Length: "
36 #define CONTENT_TYPE "Content-Type: "
37 /* TODO does this work ok? */
38 #define USER_AGENT VERSION
39 /*#define USER_AGENT "iTunes/4.6 (Windows; N)"*/
40
41 GIOChannel *
42 daap_open_connection (gchar *host, gint port);
43
44 gchar *
45 daap_generate_request (const gchar *path, gchar *host, gint request_id);
46
47 void
48 daap_send_request (GIOChannel *sock_chan, gchar *request);
49
50 void
51 daap_receive_header (GIOChannel *sock_chan, gchar **header);
52
53 cc_data_t *
54 daap_handle_data (GIOChannel *sock_chan, gchar *header);
55
56 void
57 daap_stream_data (GIOChannel *input, GIOChannel *output, gchar *header);
58
59 gint
60 get_data_length (gchar *header);
61
62 gint
63 get_server_status (gchar *header);
64
65 #endif