summaryrefslogtreecommitdiff
path: root/lib/rtsp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-05-05 16:27:03 +0200
committerDaniel Stenberg <daniel@haxx.se>2011-05-05 16:27:03 +0200
commitf0612f166a5fa51d09498baa19a327c5cf36941f (patch)
tree29c442a7c9de7d9b7075ea73456daef845bfbf91 /lib/rtsp.c
parente34131db783336aa17fa0aa664635867459b2a85 (diff)
downloadcurl-f0612f166a5fa51d09498baa19a327c5cf36941f.tar.gz
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.
Diffstat (limited to 'lib/rtsp.c')
-rw-r--r--lib/rtsp.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/rtsp.c b/lib/rtsp.c
index a408476f4..9e55f30c7 100644
--- a/lib/rtsp.c
+++ b/lib/rtsp.c
@@ -63,6 +63,19 @@ static int rtsp_getsock_do(struct connectdata *conn,
curl_socket_t *socks,
int numsocks);
+/*
+ * 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
+ */
+static CURLcode rtsp_rtp_readwrite(struct SessionHandle *data,
+ struct connectdata *conn,
+ ssize_t *nread,
+ bool *readmore);
+
+
/* this returns the socket to wait for in the DO and DOING state for the multi
interface and then we're always _sending_ a request and thus we wait for
the single socket to become writable only */
@@ -96,6 +109,7 @@ const struct Curl_handler Curl_handler_rtsp = {
rtsp_getsock_do, /* doing_getsock */
ZERO_NULL, /* perform_getsock */
Curl_rtsp_disconnect, /* disconnect */
+ rtsp_rtp_readwrite, /* readwrite */
PORT_RTSP, /* defport */
CURLPROTO_RTSP, /* protocol */
PROTOPT_NONE /* flags */
@@ -560,10 +574,11 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done)
return result;
}
-CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data,
- struct connectdata *conn,
- ssize_t *nread,
- bool *readmore) {
+
+static CURLcode rtsp_rtp_readwrite(struct SessionHandle *data,
+ struct connectdata *conn,
+ ssize_t *nread,
+ bool *readmore) {
struct SingleRequest *k = &data->req;
struct rtsp_conn *rtspc = &(conn->proto.rtspc);