From bc4582b68a673d3b0f5a2e7d971605de2c8b3730 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 21 Jan 2010 13:58:30 +0000 Subject: Chris Conroy brought support for RTSP transfers, and with it comes 8(!) new libcurl options for controlling what to get and how to receive posssibly interleaved RTP data. Initial commit. --- lib/rtsp.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 lib/rtsp.h (limited to 'lib/rtsp.h') diff --git a/lib/rtsp.h b/lib/rtsp.h new file mode 100644 index 000000000..dcc8d392e --- /dev/null +++ b/lib/rtsp.h @@ -0,0 +1,77 @@ +#ifndef __RTSP_H_ +#define __RTSP_H_ + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ +#ifndef CURL_DISABLE_RTSP + + +extern const struct Curl_handler Curl_handler_rtsp; + +/* + * RTSP Connection data + * + * Currently, only used for tracking incomplete RTP data reads + */ +struct rtsp_conn { + char *rtp_buf; + ssize_t rtp_bufsize; + int rtp_channel; +}; + +/**************************************************************************** + * RTSP unique setup + ***************************************************************************/ +struct RTSP { + /* + * http_wrapper MUST be the first element of this structure for the wrap + * logic to work. In this way, we get a cheap polymorphism because + * &(data->state.proto.rtsp) == &(data->state.proto.http) per the C spec + * + * HTTP functions can safely treat this as an HTTP struct, but RTSP aware + * functions can also index into the later elements. + */ + struct HTTP http_wrapper; /*wrap HTTP to do the heavy lifting */ + + long CSeq_sent; /* CSeq of this request */ + long CSeq_recv; /* CSeq received */ +}; + + +CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data, + struct connectdata *conn, + ssize_t *nread, + bool *readmore, + bool *done); + + +/* protocol-specific functions set up to be called by the main engine */ +CURLcode Curl_rtsp(struct connectdata *conn, bool *done); +CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature); +CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done); +CURLcode Curl_rtsp_disconnect(struct connectdata *conn); + +CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); + +#endif /* CURL_DISABLE_RTSP */ +#endif /* __RTSP_H_ */ -- cgit v1.2.1 From 0032ce762eed505905d7e5ef766134ffa6d69b5c Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 22 Jan 2010 14:20:56 +0000 Subject: fix compilation when http is disabled --- lib/rtsp.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'lib/rtsp.h') diff --git a/lib/rtsp.h b/lib/rtsp.h index dcc8d392e..dcb50d3b0 100644 --- a/lib/rtsp.h +++ b/lib/rtsp.h @@ -25,9 +25,25 @@ ***************************************************************************/ #ifndef CURL_DISABLE_RTSP - extern const struct Curl_handler Curl_handler_rtsp; +CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data, + struct connectdata *conn, + ssize_t *nread, + bool *readmore, + bool *done); + + +/* protocol-specific functions set up to be called by the main engine */ +CURLcode Curl_rtsp(struct connectdata *conn, bool *done); +CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature); +CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done); +CURLcode Curl_rtsp_disconnect(struct connectdata *conn); + +CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); + +#endif /* CURL_DISABLE_RTSP */ + /* * RTSP Connection data * @@ -58,20 +74,4 @@ struct RTSP { }; -CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data, - struct connectdata *conn, - ssize_t *nread, - bool *readmore, - bool *done); - - -/* protocol-specific functions set up to be called by the main engine */ -CURLcode Curl_rtsp(struct connectdata *conn, bool *done); -CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature); -CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done); -CURLcode Curl_rtsp_disconnect(struct connectdata *conn); - -CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); - -#endif /* CURL_DISABLE_RTSP */ #endif /* __RTSP_H_ */ -- cgit v1.2.1 From 2f3bce11939bbd4457d25292e29ffd4b5f891ed9 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 28 Jan 2010 01:39:16 +0000 Subject: Chris Conroy's RTSP followup fixes --- lib/rtsp.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/rtsp.h') diff --git a/lib/rtsp.h b/lib/rtsp.h index dcb50d3b0..52ad7dbd6 100644 --- a/lib/rtsp.h +++ b/lib/rtsp.h @@ -27,11 +27,17 @@ extern const struct Curl_handler Curl_handler_rtsp; +/* + * Parse and write out any available RTP data. + * + * nread: amount of data left after k->str. will be modified if RTP + * data is parsed and k->str is moved up + * readmore: whether or not the RTP parser needs more data right away + */ CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data, struct connectdata *conn, ssize_t *nread, - bool *readmore, - bool *done); + bool *readmore); /* protocol-specific functions set up to be called by the main engine */ -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/rtsp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/rtsp.h') diff --git a/lib/rtsp.h b/lib/rtsp.h index 52ad7dbd6..c3f8bd749 100644 --- a/lib/rtsp.h +++ b/lib/rtsp.h @@ -21,7 +21,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ #ifndef CURL_DISABLE_RTSP -- cgit v1.2.1 From 5c7c9a768d009319520142fcaee1dea33625060f Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Fri, 19 Nov 2010 13:43:20 +0100 Subject: url: provide dead_connection flag in Curl_handler::disconnect It helps to prevent a hangup with some FTP servers in case idle session timeout has exceeded. But it may be useful also for other protocols that send any quit message on disconnect. Currently used by FTP, POP3, IMAP and SMTP. --- lib/rtsp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/rtsp.h') diff --git a/lib/rtsp.h b/lib/rtsp.h index c3f8bd749..82e07068d 100644 --- a/lib/rtsp.h +++ b/lib/rtsp.h @@ -43,7 +43,7 @@ CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data, CURLcode Curl_rtsp(struct connectdata *conn, bool *done); CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature); CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done); -CURLcode Curl_rtsp_disconnect(struct connectdata *conn); +CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection); CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); -- cgit v1.2.1 From cc9e4321d38f26fec59789a7b3a3bf6a0bf27ce4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 23 Mar 2011 17:27:58 +0100 Subject: rtsp: move protocol code to dedicated file The RTSP-specific function for checking for "dead" connection is better located in rtsp.c. The code using this is now written without #ifdefs as the function call is instead turned into a macro (in rtsp.h) when RTSP is disabled. --- lib/rtsp.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/rtsp.h') diff --git a/lib/rtsp.h b/lib/rtsp.h index 82e07068d..2e2074edc 100644 --- a/lib/rtsp.h +++ b/lib/rtsp.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -46,6 +46,11 @@ CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done); CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection); CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); +bool Curl_rtsp_connisdead(struct connectdata *check); + +#else +/* disabled */ +#define Curl_rtsp_connisdead(x) TRUE #endif /* CURL_DISABLE_RTSP */ -- cgit v1.2.1 From f0612f166a5fa51d09498baa19a327c5cf36941f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 5 May 2011 16:27:03 +0200 Subject: RTSP: convert protocol-specific checks to generic Add a 'readwrite' function to the protocol handler struct and use that for the extra readwrite functionality RTSP needs. --- lib/rtsp.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'lib/rtsp.h') diff --git a/lib/rtsp.h b/lib/rtsp.h index 2e2074edc..93016be7a 100644 --- a/lib/rtsp.h +++ b/lib/rtsp.h @@ -26,19 +26,6 @@ extern const struct Curl_handler Curl_handler_rtsp; -/* - * Parse and write out any available RTP data. - * - * nread: amount of data left after k->str. will be modified if RTP - * data is parsed and k->str is moved up - * readmore: whether or not the RTP parser needs more data right away - */ -CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data, - struct connectdata *conn, - ssize_t *nread, - bool *readmore); - - /* protocol-specific functions set up to be called by the main engine */ CURLcode Curl_rtsp(struct connectdata *conn, bool *done); CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature); -- cgit v1.2.1 From 9c629e534866169b1445bd6614233ded73ff0460 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 5 May 2011 16:53:05 +0200 Subject: RTSP: cleanups Made several functions static Made one function defined to nothing when RTSP is disabled to avoid the #ifdefs in code. Removed explicit rtsp.h includes --- lib/rtsp.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib/rtsp.h') diff --git a/lib/rtsp.h b/lib/rtsp.h index 93016be7a..08b8b5cbf 100644 --- a/lib/rtsp.h +++ b/lib/rtsp.h @@ -26,17 +26,12 @@ extern const struct Curl_handler Curl_handler_rtsp; -/* protocol-specific functions set up to be called by the main engine */ -CURLcode Curl_rtsp(struct connectdata *conn, bool *done); -CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature); -CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done); -CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection); - -CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); bool Curl_rtsp_connisdead(struct connectdata *check); +CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); #else /* disabled */ +#define Curl_rtsp_parseheader(x,y) CURLE_NOT_BUILT_IN #define Curl_rtsp_connisdead(x) TRUE #endif /* CURL_DISABLE_RTSP */ -- cgit v1.2.1