1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.haxx.se/docs/copyright.html.
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ***************************************************************************/
25 /* build request url */
26 static char *suburl(const char *base, int i)
28 return curl_maprintf("%s%.4d", base, i);
36 char *stream_uri = NULL;
38 if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
39 fprintf(stderr, "curl_global_init() failed\n");
40 return TEST_ERR_MAJOR_BAD;
43 curl = curl_easy_init();
45 fprintf(stderr, "curl_easy_init() failed\n");
46 curl_global_cleanup();
47 return TEST_ERR_MAJOR_BAD;
50 test_setopt(curl, CURLOPT_HEADERDATA, stdout);
51 test_setopt(curl, CURLOPT_WRITEDATA, stdout);
52 test_setopt(curl, CURLOPT_VERBOSE, 1L);
54 test_setopt(curl, CURLOPT_URL, URL);
56 test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
58 stream_uri = suburl(URL, request++);
60 res = TEST_ERR_MAJOR_BAD;
63 test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
67 res = curl_easy_perform(curl);
68 if(res != (int)CURLE_RTSP_CSEQ_ERROR) {
69 fprintf(stderr, "Failed to detect CSeq mismatch");
70 res = TEST_ERR_MAJOR_BAD;
74 test_setopt(curl, CURLOPT_RTSP_CLIENT_CSEQ, 999L);
75 test_setopt(curl, CURLOPT_RTSP_TRANSPORT,
76 "RAW/RAW/UDP;unicast;client_port=3056-3057");
77 test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
79 stream_uri = suburl(URL, request++);
81 res = TEST_ERR_MAJOR_BAD;
84 test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
88 res = curl_easy_perform(curl);
92 test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY);
94 stream_uri = suburl(URL, request++);
96 res = TEST_ERR_MAJOR_BAD;
99 test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
103 res = curl_easy_perform(curl);
104 if(res != CURLE_RTSP_SESSION_ERROR) {
105 fprintf(stderr, "Failed to detect a Session ID mismatch");
111 curl_easy_cleanup(curl);
112 curl_global_cleanup();