lib570.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                  _   _ ____  _
00003  *  Project                     ___| | | |  _ \| |
00004  *                             / __| | | | |_) | |
00005  *                            | (__| |_| |  _ <| |___
00006  *                             \___|\___/|_| \_\_____|
00007  *
00008  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
00009  *
00010  * This software is licensed as described in the file COPYING, which
00011  * you should have received as part of this distribution. The terms
00012  * are also available at https://curl.haxx.se/docs/copyright.html.
00013  *
00014  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00015  * copies of the Software, and permit persons to whom the Software is
00016  * furnished to do so, under the terms of the COPYING file.
00017  *
00018  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00019  * KIND, either express or implied.
00020  *
00021  ***************************************************************************/
00022 #include "test.h"
00023 #include "memdebug.h"
00024 
00025 /* build request url */
00026 static char *suburl(const char *base, int i)
00027 {
00028   return curl_maprintf("%s%.4d", base, i);
00029 }
00030 
00031 int test(char *URL)
00032 {
00033   int res;
00034   CURL *curl;
00035   int request=1;
00036   char *stream_uri = NULL;
00037 
00038   if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
00039     fprintf(stderr, "curl_global_init() failed\n");
00040     return TEST_ERR_MAJOR_BAD;
00041   }
00042 
00043   curl = curl_easy_init();
00044   if(!curl) {
00045     fprintf(stderr, "curl_easy_init() failed\n");
00046     curl_global_cleanup();
00047     return TEST_ERR_MAJOR_BAD;
00048   }
00049 
00050   test_setopt(curl, CURLOPT_HEADERDATA, stdout);
00051   test_setopt(curl, CURLOPT_WRITEDATA, stdout);
00052   test_setopt(curl, CURLOPT_VERBOSE, 1L);
00053 
00054   test_setopt(curl, CURLOPT_URL, URL);
00055 
00056   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
00057 
00058   stream_uri = suburl(URL, request++);
00059   if(!stream_uri) {
00060     res = TEST_ERR_MAJOR_BAD;
00061     goto test_cleanup;
00062   }
00063   test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
00064   free(stream_uri);
00065   stream_uri = NULL;
00066 
00067   res = curl_easy_perform(curl);
00068   if(res != (int)CURLE_RTSP_CSEQ_ERROR) {
00069     fprintf(stderr, "Failed to detect CSeq mismatch");
00070     res = TEST_ERR_MAJOR_BAD;
00071     goto test_cleanup;
00072   }
00073 
00074   test_setopt(curl, CURLOPT_RTSP_CLIENT_CSEQ, 999L);
00075   test_setopt(curl, CURLOPT_RTSP_TRANSPORT,
00076                     "RAW/RAW/UDP;unicast;client_port=3056-3057");
00077   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
00078 
00079   stream_uri = suburl(URL, request++);
00080   if(!stream_uri) {
00081     res = TEST_ERR_MAJOR_BAD;
00082     goto test_cleanup;
00083   }
00084   test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
00085   free(stream_uri);
00086   stream_uri = NULL;
00087 
00088   res = curl_easy_perform(curl);
00089   if(res)
00090     goto test_cleanup;
00091 
00092   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY);
00093 
00094   stream_uri = suburl(URL, request++);
00095   if(!stream_uri) {
00096     res = TEST_ERR_MAJOR_BAD;
00097     goto test_cleanup;
00098   }
00099   test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
00100   free(stream_uri);
00101   stream_uri = NULL;
00102 
00103   res = curl_easy_perform(curl);
00104   if(res != CURLE_RTSP_SESSION_ERROR) {
00105     fprintf(stderr, "Failed to detect a Session ID mismatch");
00106   }
00107 
00108 test_cleanup:
00109   free(stream_uri);
00110 
00111   curl_easy_cleanup(curl);
00112   curl_global_cleanup();
00113 
00114   return res;
00115 }
00116 


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:05