]> git.sesse.net Git - vlc/blob - modules/access/mms/mmsh.h
* all: moved Get(D/Q)WLE and Get(D/Q)WBE to include/vlc_common.h.
[vlc] / modules / access / mms / mmsh.h
1 /*****************************************************************************
2  * mmsh.h:
3  *****************************************************************************
4  * Copyright (C) 2001, 2002 VideoLAN
5  * $Id: mmsh.h,v 1.3 2003/08/17 23:02:51 fenrir Exp $
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 typedef struct
25 {
26     uint16_t i_type;
27     uint16_t i_size;
28
29     uint32_t i_sequence;
30     uint16_t i_unknown;
31
32     uint16_t i_size2;
33
34     int      i_data;
35     uint8_t  *p_data;
36
37 } chunk_t;
38
39 static int chunk_parse( chunk_t *, uint8_t *, int );
40
41 #define BUFFER_SIZE 150000
42 struct access_sys_t
43 {
44     int             i_proto;
45
46     input_socket_t  *p_socket;
47     url_t           *p_url;
48
49     int             i_request_context;
50
51     int             i_buffer;
52     int             i_buffer_pos;
53     uint8_t         buffer[BUFFER_SIZE + 1];
54
55     vlc_bool_t      b_broadcast;
56
57     uint8_t         *p_header;
58     int             i_header;
59
60     uint8_t         *p_packet;
61     uint32_t        i_packet_sequence;
62     unsigned int    i_packet_used;
63     unsigned int    i_packet_length;
64
65     off_t           i_pos;
66
67     asf_header_t    asfh;
68     guid_t          guid;
69 };
70
71 static input_socket_t * NetOpenTCP  ( input_thread_t *, url_t * );
72 static ssize_t          NetRead     ( input_thread_t *, input_socket_t *, byte_t *, size_t );
73 static ssize_t          NetWrite    ( input_thread_t *, input_socket_t *, byte_t *, size_t );
74 static void             NetClose    ( input_thread_t *, input_socket_t * );
75
76
77 static ssize_t NetFill( input_thread_t *, access_sys_t *, int );
78
79 typedef struct http_field_s
80 {
81     char *psz_name;
82     char *psz_value;
83
84     struct http_field_s *p_next;
85
86 } http_field_t;
87
88 typedef struct
89 {
90     int     i_version;
91     int     i_error;
92     char    *psz_answer;
93
94     http_field_t *p_fields;
95
96     uint8_t *p_body;
97     int     i_body;
98
99 } http_answer_t;
100
101 static http_answer_t    *http_answer_parse  ( uint8_t *, int );
102 static void              http_answer_free   ( http_answer_t * );
103 /* static char             *http_field_get_value   ( http_answer_t *, char * ); */
104 static http_field_t     *http_field_find    ( http_field_t *, char * );
105
106 static int  mmsh_start( input_thread_t *, access_sys_t *, off_t );
107 static void mmsh_stop ( input_thread_t *, access_sys_t * );