25 #ifndef CURL_DISABLE_RTSP 55 #define RTP_PKT_CHANNEL(p) ((int)((unsigned char)((p)[1]))) 57 #define RTP_PKT_LENGTH(p) ((((int)((unsigned char)((p)[2]))) << 8) | \ 58 ((int)((unsigned char)((p)[3])))) 86 unsigned int checks_to_perform);
176 unsigned int checks_to_perform)
236 "The CSeq of this request %ld did not match the response %ld",
237 CSeq_sent, CSeq_recv);
242 infof(data,
"Got an RTP Receive with a CSeq of %ld\n", CSeq_recv);
261 const char *p_request = NULL;
262 const char *p_session_id = NULL;
264 const char *p_accept_encoding = NULL;
265 const char *p_range = NULL;
266 const char *p_referrer = NULL;
267 const char *p_stream_uri = NULL;
268 const char *p_transport = NULL;
269 const char *p_uagent = NULL;
270 const char *p_proxyuserpwd = NULL;
271 const char *p_userpwd = NULL;
289 failf(data,
"Got invalid RTSP request");
292 p_request =
"OPTIONS";
295 p_request =
"DESCRIBE";
299 p_request =
"ANNOUNCE";
311 p_request =
"TEARDOWN";
315 p_request =
"GET_PARAMETER";
319 p_request =
"SET_PARAMETER";
322 p_request =
"RECORD";
330 failf(data,
"Got invalid RTSP request: RTSPREQ_LAST");
344 failf(data,
"Refusing to issue an RTSP request [%s] without a session ID.",
374 "Refusing to issue an RTSP SETUP without a Transport: header.");
385 NULL:
"Accept: application/sdp\r\n";
452 failf(data,
"CSeq cannot be set as a custom header.");
456 failf(data,
"Session ID cannot be set as a custom header.");
470 p_request, p_stream_uri, rtsp->
CSeq_sent);
497 p_transport ? p_transport :
"",
498 p_accept ? p_accept :
"",
499 p_accept_encoding ? p_accept_encoding :
"",
500 p_range ? p_range :
"",
501 p_referrer ? p_referrer :
"",
502 p_uagent ? p_uagent :
"",
503 p_proxyuserpwd ? p_proxyuserpwd :
"",
504 p_userpwd ? p_userpwd :
"");
542 if(putsize > 0 || postsize > 0) {
548 (data->
set.
upload ? putsize : postsize));
557 "Content-Type: text/parameters\r\n");
566 "Content-Type: application/sdp\r\n");
599 failf(data,
"Failed sending RTSP request");
652 rtp_dataleft = *nread;
655 while((rtp_dataleft > 0) &&
657 if(rtp_dataleft > 4) {
667 if(rtp_dataleft < rtp_length + 4) {
674 DEBUGF(
infof(data,
"RTP write channel %d rtp_length %d\n",
678 failf(data,
"Got an error writing an RTP packet");
687 rtp_dataleft -= rtp_length + 4;
688 rtp += rtp_length + 4;
704 if(rtp_dataleft != 0 && rtp[0] ==
'$') {
705 DEBUGF(
infof(data,
"RTP Rewinding %zd %s\n", rtp_dataleft,
706 *readmore ?
"(READMORE)" :
""));
709 scratch =
malloc(rtp_dataleft);
716 memcpy(scratch, rtp, rtp_dataleft);
726 k->
str += *nread - rtp_dataleft;
736 *nread = rtp_dataleft;
755 failf(data,
"Cannot write a 0 size RTP packet.");
773 wrote =
writeit(ptr, 1, len, user_ptr);
776 failf(data,
"Cannot pause RTP");
781 failf(data,
"Failed writing RTP data");
796 int nc = sscanf(&header[4],
": %ld", &CSeq);
803 failf(data,
"Unable to read the CSeq header: [%s]", header);
812 while(*start &&
ISSPACE(*start))
816 failf(data,
"Got a blank Session ID");
822 failf(data,
"Got RTSP Session ID Line [%s], but wanted ID [%s]",
836 while(*end && *end !=
';' && !
ISSPACE(*end))
curl_write_callback fwrite_rtp
static CURLcode rtsp_do(struct connectdata *conn, bool *done)
void Curl_pgrsSetUploadCounter(struct Curl_easy *data, curl_off_t size)
static CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len)
#define CURL_WRITEFUNC_PAUSE
static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data, struct connectdata *conn, ssize_t *nread, bool *readmore)
long rtsp_next_client_CSeq
CURLcode Curl_add_timecondition(struct Curl_easy *data, Curl_send_buffer *req_buffer)
CURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size)
UNITTEST_START char * ptr
static int writeit(struct testcase *test, struct tftphdr *volatile *dpp, int ct, int convert)
#define RTP_PKT_LENGTH(p)
static CURLcode rtsp_setup_connection(struct connectdata *conn)
bool rtsp_connisdead(struct connectdata *check)
CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
UNITTEST_START int result
static CURLcode rtsp_done(struct connectdata *conn, CURLcode, bool premature)
struct DynamicStatic change
int Curl_pgrsUpdate(struct connectdata *conn)
curl_off_t writebytecount
memcpy(filename, filename1, strlen(filename1))
const struct Curl_handler Curl_handler_rtsp
void Curl_setup_transfer(struct connectdata *conn, int sockindex, curl_off_t size, bool getheader, curl_off_t *bytecountp, int writesockindex, curl_off_t *writecountp)
static CURLcode rtsp_connect(struct connectdata *conn, bool *done)
static unsigned int rtsp_conncheck(struct connectdata *check, unsigned int checks_to_perform)
#define SOCKET_READABLE(x, z)
void * Curl_saferealloc(void *ptr, size_t size)
#define RTP_PKT_CHANNEL(p)
CURL_TYPEOF_CURL_OFF_T curl_off_t
CURLcode Curl_add_buffer_send(Curl_send_buffer *in, struct connectdata *conn, long *bytes_written, size_t included_body_bytes, int socketindex)
#define GETSOCK_WRITESOCK(x)
#define Curl_safefree(ptr)
bool Curl_connalive(struct connectdata *conn)
curl_write_callback fwrite_func
size_t(* curl_write_callback)(char *buffer, size_t size, size_t nitems, void *outstream)
char * Curl_checkheaders(const struct connectdata *conn, const char *thisheader)
CURLcode Curl_http_output_auth(struct connectdata *conn, const char *request, const char *path, bool proxytunnel)
Curl_http_output_auth() setups the authentication headers for the host/proxy and the correct authenti...
static int rtsp_getsock_do(struct connectdata *conn, curl_socket_t *socks, int numsocks)
CURLcode Curl_add_bufferf(Curl_send_buffer *in, const char *fmt,...)
CURLcode Curl_http_done(struct connectdata *conn, CURLcode status, bool premature)
CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header)
static CURLcode rtsp_disconnect(struct connectdata *conn, bool dead)
Curl_send_buffer * Curl_add_buffer_init(void)
#define checkprefix(a, b)
union connectdata::@34 proto
long rtsp_next_server_CSeq
struct connectdata::dynamically_allocated_data allocptr
CURLcode Curl_add_custom_headers(struct connectdata *conn, bool is_connect, Curl_send_buffer *req_buffer)
#define calloc(nbelem, size)
#define CURL_FORMAT_CURL_OFF_T