Chris Conroy's RTSP followup fixes
[platform/upstream/curl.git] / lib / rtsp.h
1 #ifndef __RTSP_H_
2 #define __RTSP_H_
3
4 /***************************************************************************
5  *                                  _   _ ____  _
6  *  Project                     ___| | | |  _ \| |
7  *                             / __| | | | |_) | |
8  *                            | (__| |_| |  _ <| |___
9  *                             \___|\___/|_| \_\_____|
10  *
11  * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
12  *
13  * This software is licensed as described in the file COPYING, which
14  * you should have received as part of this distribution. The terms
15  * are also available at http://curl.haxx.se/docs/copyright.html.
16  *
17  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
18  * copies of the Software, and permit persons to whom the Software is
19  * furnished to do so, under the terms of the COPYING file.
20  *
21  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22  * KIND, either express or implied.
23  *
24  * $Id$
25  ***************************************************************************/
26 #ifndef CURL_DISABLE_RTSP
27
28 extern const struct Curl_handler Curl_handler_rtsp;
29
30 /*
31  * Parse and write out any available RTP data.
32  *
33  * nread: amount of data left after k->str. will be modified if RTP
34  *        data is parsed and k->str is moved up
35  * readmore: whether or not the RTP parser needs more data right away
36  */
37 CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data,
38                                  struct connectdata *conn,
39                                  ssize_t *nread,
40                                  bool *readmore);
41
42
43 /* protocol-specific functions set up to be called by the main engine */
44 CURLcode Curl_rtsp(struct connectdata *conn, bool *done);
45 CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature);
46 CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done);
47 CURLcode Curl_rtsp_disconnect(struct connectdata *conn);
48
49 CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header);
50
51 #endif /* CURL_DISABLE_RTSP */
52
53 /*
54  * RTSP Connection data
55  *
56  * Currently, only used for tracking incomplete RTP data reads
57  */
58 struct rtsp_conn {
59   char *rtp_buf;
60   ssize_t rtp_bufsize;
61   int rtp_channel;
62 };
63
64 /****************************************************************************
65  * RTSP unique setup
66  ***************************************************************************/
67 struct RTSP {
68   /*
69    * http_wrapper MUST be the first element of this structure for the wrap
70    * logic to work. In this way, we get a cheap polymorphism because
71    * &(data->state.proto.rtsp) == &(data->state.proto.http) per the C spec
72    *
73    * HTTP functions can safely treat this as an HTTP struct, but RTSP aware
74    * functions can also index into the later elements.
75    */
76   struct HTTP http_wrapper; /*wrap HTTP to do the heavy lifting */
77
78   long CSeq_sent; /* CSeq of this request */
79   long CSeq_recv; /* CSeq received */
80 };
81
82
83 #endif /* __RTSP_H_ */