1 /* 2 * GstCurlHttpSrc 3 * Copyright 2017 British Broadcasting Corporation - Research and Development 4 * 5 * Author: Sam Hurst <samuelh@rd.bbc.co.uk> 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * and/or sell copies of the Software, and to permit persons to whom the 12 * Software is furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in 15 * all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 * DEALINGS IN THE SOFTWARE. 24 * 25 * Alternatively, the contents of this file may be used under the 26 * GNU Lesser General Public License Version 2.1 (the "LGPL"), in 27 * which case the following provisions apply instead of the ones 28 * mentioned above: 29 * 30 * This library is free software; you can redistribute it and/or 31 * modify it under the terms of the GNU Library General Public 32 * License as published by the Free Software Foundation; either 33 * version 2 of the License, or (at your option) any later version. 34 * 35 * This library is distributed in the hope that it will be useful, 36 * but WITHOUT ANY WARRANTY; without even the implied warranty of 37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 38 * Library General Public License for more details. 39 * 40 * You should have received a copy of the GNU Library General Public 41 * License along with this library; if not, write to the 42 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 43 * Boston, MA 02111-1307, USA. 44 */ 45 46 #ifndef GSTCURLDEFAULTS_H_ 47 #define GSTCURLDEFAULTS_H_ 48 49 /* 50 * This file contains a list of all the default values used. These are used to 51 * initialise an object in its init call. 52 * 53 * Must all conform to GSTCURL_HANDLE_DEFAULT_##type for macro sillyness in 54 * curltask.h, where "type" is the CURLOPT_<something> string. 55 */ 56 /* Defaults from http://curl.haxx.se/libcurl/c/curl_easy_setopt.html */ 57 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_URL ((void *)0) 58 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_USERNAME ((void *)0) 59 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_PASSWORD ((void *)0) 60 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_PROXY ((void *)0) 61 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_PROXYUSERNAME ((void *)0) 62 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_PROXYPASSWORD ((void *)0) 63 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_USERAGENT "GStreamer curlhttpsrc libcurl" 64 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_ACCEPT_ENCODING FALSE 65 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_FOLLOWLOCATION 1L 66 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_MAXREDIRS -1 67 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_TCP_KEEPALIVE 1L 68 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_TIMEOUT 0 69 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_SSL_VERIFYPEER 1 70 #define GSTCURL_HANDLE_DEFAULT_CURLOPT_CAINFO ((void *)0) 71 72 73 /* Defaults from http://curl.haxx.se/libcurl/c/curl_multi_setopt.html */ 74 #define GSTCURL_HANDLE_DEFAULT_CURLMOPT_PIPELINING 1L 75 #define GSTCURL_HANDLE_DEFAULT_CURLMOPT_MAXCONNECTS 255L 76 #define GSTCURL_HANDLE_DEFAULT_CURLMOPT_MAX_HOST_CONNECTIONS 0L 77 #define GSTCURL_HANDLE_DEFAULT_CURLMOPT_MAX_PIPELINE_LENGTH 5L 78 #define GSTCURL_HANDLE_DEFAULT_CURLMOPT_MAX_TOTAL_CONNECTIONS 255L 79 80 /* Not a CURLOPT, is something I've implemented which curl doesn't */ 81 #define GSTCURL_HANDLE_DEFAULT_RETRIES -1 82 83 /* 84 * Now set acceptable ranges. Defaults can lie outside the range, in which case 85 * it is expected that the programmer will use the gst_curl_setopt and not the 86 * gst_curl_setopt_default macro, as if the value supplied lies outside of the 87 * default range, it won't bother to set it. If the _default macro is used, 88 * then the offending value is replaced by the default type above. 89 */ 90 #define GSTCURL_HANDLE_MIN_CURLOPT_FOLLOWLOCATION 0L 91 #define GSTCURL_HANDLE_MAX_CURLOPT_FOLLOWLOCATION 1L 92 #define GSTCURL_HANDLE_MIN_CURLOPT_MAXREDIRS -1 93 #define GSTCURL_HANDLE_MAX_CURLOPT_MAXREDIRS 255 94 #define GSTCURL_HANDLE_MIN_CURLOPT_TCP_KEEPALIVE 0L 95 #define GSTCURL_HANDLE_MAX_CURLOPT_TCP_KEEPALIVE 1L 96 #define GSTCURL_HANDLE_MIN_CURLOPT_TIMEOUT 0 97 #define GSTCURL_HANDLE_MAX_CURLOPT_TIMEOUT 3600 98 #define GSTCURL_HANDLE_MIN_CURLOPT_SSL_VERIFYPEER 0 99 #define GSTCURL_HANDLE_MAX_CURLOPT_SSL_VERIFYPEER 1 100 #define GSTCURL_HANDLE_MIN_CURLOPT_HTTP_VERSION CURL_HTTP_VERSION_1_0 101 #ifdef CURL_VERSION_HTTP2 102 #define GSTCURL_HANDLE_MAX_CURLOPT_HTTP_VERSION CURL_HTTP_VERSION_2_0 103 #else 104 #define GSTCURL_HANDLE_MAX_CURLOPT_HTTP_VERSION CURL_HTTP_VERSION_1_1 105 #endif 106 107 #define GSTCURL_HANDLE_MIN_CURLMOPT_PIPELINING 0L 108 #define GSTCURL_HANDLE_MAX_CURLMOPT_PIPELINING 1L 109 #define GSTCURL_HANDLE_MIN_CURLMOPT_MAXCONNECTS 32L 110 #define GSTCURL_HANDLE_MAX_CURLMOPT_MAXCONNECTS 255L 111 #define GSTCURL_HANDLE_MIN_CURLMOPT_MAX_HOST_CONNECTIONS 1L 112 #define GSTCURL_HANDLE_MAX_CURLMOPT_MAX_HOST_CONNECTIONS 127L 113 #define GSTCURL_HANDLE_MIN_CURLMOPT_MAX_PIPELINE_LENGTH 1L 114 #define GSTCURL_HANDLE_MAX_CURLMOPT_MAX_PIPELINE_LENGTH 200L 115 #define GSTCURL_HANDLE_MIN_CURLMOPT_MAX_TOTAL_CONNECTIONS 32L 116 #define GSTCURL_HANDLE_MAX_CURLMOPT_MAX_TOTAL_CONNECTIONS 255L 117 118 #define GSTCURL_HANDLE_MIN_RETRIES -1 119 #define GSTCURL_HANDLE_MAX_RETRIES 9999 120 121 /* Because g_param_spec_int requires min/max bounding... */ 122 #define GSTCURL_MIN_REDIRECTIONS -1 123 #define GSTCURL_MAX_REDIRECTIONS 255 124 #define GSTCURL_MIN_CONNECTION_TIME 2 125 #define GSTCURL_MAX_CONNECTION_TIME 60 126 #define GSTCURL_MIN_CONNECTIONS_SERVER 1 127 #define GSTCURL_MAX_CONNECTIONS_SERVER 60 128 #define GSTCURL_MIN_CONNECTIONS_PROXY 1 129 #define GSTCURL_MAX_CONNECTIONS_PROXY 60 130 #define GSTCURL_MIN_CONNECTIONS_GLOBAL 1 131 #define GSTCURL_MAX_CONNECTIONS_GLOBAL 255 132 #define GSTCURL_DEFAULT_CONNECTION_TIME 30 133 #define GSTCURL_DEFAULT_CONNECTIONS_SERVER 5 134 #define GSTCURL_DEFAULT_CONNECTIONS_PROXY 30 135 #define GSTCURL_DEFAULT_CONNECTIONS_GLOBAL 255 136 #define GSTCURL_INFO_RESPONSE(x) ((x >= 100) && (x <= 199)) 137 #define GSTCURL_SUCCESS_RESPONSE(x) ((x >= 200) && (x <=299)) 138 #define GSTCURL_REDIRECT_RESPONSE(x) ((x >= 300) && (x <= 399)) 139 #define GSTCURL_CLIENT_ERR_RESPONSE(x) ((x >= 400) && (x <= 499)) 140 #define GSTCURL_SERVER_ERR_RESPONSE(x) ((x >= 500) && (x <= 599)) 141 #define GSTCURL_FUNCTIONTRACE 0 142 143 #endif /* GSTCURLDEFAULTS_H_ */ 144