├── CentOS ├── rpi │ ├── CInterfaceUrls.cpp │ ├── CInterfaceUrls.h │ ├── HttpRequestTool.h │ ├── cJSON.cpp │ ├── cJSON.h │ ├── main.cpp │ ├── makefile │ ├── param.ini │ └── rpi-demo ├── starrtc │ ├── include │ │ ├── CChatroomManager.h │ │ ├── CLiveParam.h │ │ ├── CLogin.h │ │ ├── CSrcManager.h │ │ ├── CUserManager.h │ │ ├── ChatroomInfo.h │ │ ├── IChatroomGetListListener.h │ │ ├── ISrcListener.h │ │ ├── IStarIMChatroomListener.h │ │ ├── StarRtcCore.h │ │ ├── XHChatroomType.h │ │ └── XHLiveManager.h │ └── lib │ │ ├── libstarRTC.so │ │ └── libstarRTCCore.so └── third │ └── curl │ ├── include │ └── curl │ │ ├── curl.h │ │ ├── curlver.h │ │ ├── easy.h │ │ ├── mprintf.h │ │ ├── multi.h │ │ ├── stdcheaders.h │ │ ├── system.h │ │ ├── typecheck-gcc.h │ │ └── urlapi.h │ └── lib │ ├── libcurl.a │ ├── libcurl.la │ ├── libcurl.so │ ├── libcurl.so.4 │ ├── libcurl.so.4.6.0 │ └── pkgconfig │ └── libcurl.pc └── README.md /CentOS/rpi/CInterfaceUrls.cpp: -------------------------------------------------------------------------------- 1 | #include "CInterfaceUrls.h" 2 | #include "HttpRequestTool.h" 3 | #include "cJSON.h" 4 | #include 5 | CInterfaceUrls::CInterfaceUrls() 6 | { 7 | } 8 | 9 | 10 | CInterfaceUrls::~CInterfaceUrls() 11 | { 12 | } 13 | 14 | unsigned char CInterfaceUrls::ToHex(unsigned char x) 15 | { 16 | return x > 9 ? x + 55 : x + 48; 17 | } 18 | 19 | unsigned char CInterfaceUrls::FromHex(unsigned char x) 20 | { 21 | unsigned char y; 22 | if (x >= 'A' && x <= 'Z') y = x - 'A' + 10; 23 | else if (x >= 'a' && x <= 'z') y = x - 'a' + 10; 24 | else if (x >= '0' && x <= '9') y = x - '0'; 25 | else 26 | { 27 | } 28 | return y; 29 | } 30 | 31 | std::string CInterfaceUrls::UrlEncode(const std::string& str) 32 | { 33 | std::string strTemp = ""; 34 | size_t length = str.length(); 35 | for (size_t i = 0; i < length; i++) 36 | { 37 | if (isalnum((unsigned char)str[i]) || 38 | (str[i] == '-') || 39 | (str[i] == '_') || 40 | (str[i] == '.') || 41 | (str[i] == '~')) 42 | strTemp += str[i]; 43 | else if (str[i] == ' ') 44 | strTemp += "+"; 45 | else 46 | { 47 | strTemp += '%'; 48 | strTemp += ToHex((unsigned char)str[i] >> 4); 49 | strTemp += ToHex((unsigned char)str[i] % 16); 50 | } 51 | } 52 | return strTemp; 53 | } 54 | 55 | std::string CInterfaceUrls::UrlDecode(const std::string& str) 56 | { 57 | std::string strTemp = ""; 58 | size_t length = str.length(); 59 | for (size_t i = 0; i < length; i++) 60 | { 61 | if (str[i] == '+') strTemp += ' '; 62 | else if (str[i] == '%') 63 | { 64 | unsigned char high = FromHex((unsigned char)str[++i]); 65 | unsigned char low = FromHex((unsigned char)str[++i]); 66 | strTemp += high * 16 + low; 67 | } 68 | else strTemp += str[i]; 69 | } 70 | return strTemp; 71 | } 72 | 73 | void CInterfaceUrls::demoSaveToList(string userId, int listType, string id, string data) 74 | { 75 | string url = "http://www.starrtc.com/aec/list/save.php"; 76 | url = url + "?userId=" + userId + "&listType="; 77 | char buf[256] = { 0 }; 78 | sprintf(buf, "%d", listType); 79 | url = url + buf; 80 | url = url + "&roomId=" + id; 81 | 82 | data = CInterfaceUrls::UrlEncode(data); 83 | 84 | url = url + "&data=" + data; 85 | 86 | string strData = ""; 87 | std::string strVal = ""; 88 | std::string strErrInfo = ""; 89 | 90 | int ret = libcurl_post(url.c_str(), strData.c_str(), strVal, strErrInfo); 91 | } 92 | 93 | void CInterfaceUrls::demoDeleteFromList(string userId, int listType, string id) 94 | { 95 | string url = "http://www.starrtc.com/aec/list/del.php"; 96 | url = url + "?userId=" + userId + "&listType="; 97 | char buf[256] = { 0 }; 98 | sprintf(buf, "%d", listType); 99 | url = url + buf; 100 | url = url + "&roomId=" + id; 101 | 102 | string strData = ""; 103 | std::string strVal = ""; 104 | std::string strErrInfo = ""; 105 | 106 | int ret = libcurl_post(url.c_str(), strData.c_str(), strVal, strErrInfo); 107 | } 108 | 109 | void CInterfaceUrls::demoQueryList(string listType, list& listData) 110 | { 111 | string url = "http://www.starrtc.com/aec/list/query.php"; 112 | 113 | string strData = "listTypes="; 114 | strData = strData + listType; 115 | 116 | std::string strVal = ""; 117 | std::string strErrInfo = ""; 118 | 119 | int ret = libcurl_post(url.c_str(), strData.c_str(), strVal, strErrInfo); 120 | 121 | cJSON* root = cJSON_Parse(strVal.c_str()); 122 | if (!root) 123 | { 124 | printf("Error before: [%s]\n",cJSON_GetErrorPtr()); 125 | return ; 126 | } 127 | cJSON *itemStatus = cJSON_GetObjectItem(root, "status"); 128 | 129 | if(itemStatus == NULL) 130 | { 131 | printf("get status err: [%s]\n",cJSON_GetErrorPtr()); 132 | return ; 133 | } 134 | if(itemStatus->valueint != 1) 135 | { 136 | printf("status is 0 failed\n"); 137 | return ; 138 | } 139 | 140 | cJSON *itemData = cJSON_GetObjectItem(root, "data"); 141 | 142 | int arraysize = cJSON_GetArraySize(itemData); 143 | 144 | cJSON *objread = NULL; 145 | for(int i = 0; ivaluestring; 154 | strData = CInterfaceUrls::UrlDecode(strData); 155 | cJSON* root1 = cJSON_Parse(strData.c_str()); 156 | if(root1 != NULL) 157 | { 158 | ChatroomInfo chatroomInfo; 159 | cJSON *itemId = cJSON_GetObjectItem(root1, "id"); 160 | if(itemId != NULL) 161 | { 162 | chatroomInfo.m_strRoomId = itemId->valuestring; 163 | } 164 | 165 | cJSON *itemName = cJSON_GetObjectItem(root1, "name"); 166 | if(itemName != NULL) 167 | { 168 | chatroomInfo.m_strName = itemName->valuestring; 169 | } 170 | 171 | cJSON *itemCreator = cJSON_GetObjectItem(root1, "creator"); 172 | if(itemCreator != NULL) 173 | { 174 | chatroomInfo.m_strCreaterId = itemCreator->valuestring; 175 | } 176 | listData.push_back(chatroomInfo); 177 | } 178 | 179 | } 180 | } 181 | } 182 | } 183 | 184 | 185 | -------------------------------------------------------------------------------- /CentOS/rpi/CInterfaceUrls.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | using namespace std; 5 | #include "ChatroomInfo.h" 6 | 7 | using namespace std; 8 | class CInterfaceUrls 9 | { 10 | public: 11 | CInterfaceUrls(); 12 | virtual ~CInterfaceUrls(); 13 | static unsigned char ToHex(unsigned char x); 14 | static unsigned char FromHex(unsigned char x); 15 | static std::string UrlEncode(const std::string& str); 16 | static std::string UrlDecode(const std::string& str); 17 | 18 | static void demoSaveToList(string userId, int listType, string id, string data); 19 | 20 | static void demoDeleteFromList(string userId, int listType, string id); 21 | 22 | static void demoQueryList(string listType, list& listData); 23 | }; 24 | -------------------------------------------------------------------------------- /CentOS/rpi/HttpRequestTool.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBCURL_H__ 2 | #define __LIBCURL_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "curl/curl.h" 8 | 9 | 10 | static char error_buffer[CURL_ERROR_SIZE]; 11 | static int writer(char*, size_t, size_t, std::string*); 12 | static bool init(CURL*&, const char*, std::string*); 13 | 14 | 15 | static bool init(CURL*& conn, const char* url, std::string* p_buffer) 16 | { 17 | CURLcode code; 18 | 19 | conn = curl_easy_init(); 20 | if (NULL == conn) 21 | { 22 | //std::cout << stderr << " Failed to create CURL connection" << std::endl; 23 | exit(EXIT_FAILURE); 24 | } 25 | 26 | code = curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, error_buffer); 27 | if (code != CURLE_OK) 28 | { 29 | //std::cout << stderr << " Failed to set error buffer " << code << std::endl; 30 | return false; 31 | } 32 | 33 | code = curl_easy_setopt(conn, CURLOPT_URL, url); 34 | if (code != CURLE_OK) 35 | { 36 | //std::cout << stderr << " Failed to set URL " << error_buffer << std::endl; 37 | return false; 38 | } 39 | 40 | code = curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER ,false); 41 | if (code != CURLE_OK) 42 | { 43 | //std::cout << stderr << " Failed to set CURLOPT_SSL_VERIFYPEER " << error_buffer << std::endl; 44 | return false; 45 | } 46 | 47 | code = curl_easy_setopt(conn, CURLOPT_FOLLOWLOCATION, 1); 48 | if (code != CURLE_OK) 49 | { 50 | //std::cout << stderr << " Failed to set redirect option " << error_buffer << std::endl; 51 | return false; 52 | } 53 | 54 | code = curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, writer); 55 | if (code != CURLE_OK) 56 | { 57 | //std::cout << stderr << " Failed to set writer " << error_buffer << std::endl; 58 | return false; 59 | } 60 | 61 | code = curl_easy_setopt(conn, CURLOPT_WRITEDATA, p_buffer); 62 | if (code != CURLE_OK) 63 | { 64 | //std::cout << stderr << " Failed to set write data " << error_buffer << std::endl; 65 | return false; 66 | } 67 | 68 | return true; 69 | } 70 | 71 | static int writer(char* data, size_t size, size_t nmemb, std::string* writer_data) 72 | { 73 | unsigned long sizes = size * nmemb; 74 | 75 | if (NULL == writer_data) 76 | { 77 | return 0; 78 | } 79 | 80 | writer_data->append(data, sizes); 81 | 82 | return sizes; 83 | } 84 | 85 | 86 | 87 | int libcurl_get(const char* url, std::string& buffer, std::string& errinfo) 88 | { 89 | 90 | CURL *conn = NULL; 91 | CURLcode code; 92 | 93 | curl_global_init(CURL_GLOBAL_DEFAULT); 94 | 95 | if (!init(conn, url, &buffer)) 96 | { 97 | //std::cout << stderr << " Connection initializion failed" << std::endl; 98 | errinfo = "Connection initializion failed\n"; 99 | 100 | return -1; 101 | } 102 | 103 | code = curl_easy_perform(conn); 104 | 105 | if (code != CURLE_OK) 106 | { 107 | //std::cout << stderr << " Failed to get" << url << error_buffer << std::endl; 108 | 109 | errinfo.append("Failed to get "); 110 | errinfo.append(url); 111 | 112 | return -2; 113 | } 114 | 115 | curl_easy_cleanup(conn); 116 | 117 | return 1; 118 | } 119 | 120 | 121 | 122 | int libcurl_post(const char* url, const char* data, std::string& buffer, std::string& errinfo) 123 | { 124 | CURL *conn = NULL; 125 | CURLcode code; 126 | 127 | curl_global_init(CURL_GLOBAL_DEFAULT); 128 | 129 | if (!init(conn, url, &buffer)) 130 | { 131 | //std::cout << stderr << " Connection initializion failed" << std::endl; 132 | 133 | errinfo = "Connection initializion failed\n"; 134 | 135 | return -1; 136 | } 137 | 138 | code = curl_easy_setopt(conn, CURLOPT_POST, true); 139 | 140 | if (code != CURLE_OK) 141 | { 142 | //std::cout << stderr << " Failed to set CURLOPT_POST " << error_buffer << std::endl; 143 | return -1; 144 | } 145 | 146 | code = curl_easy_setopt(conn, CURLOPT_POSTFIELDS, data); 147 | if (code != CURLE_OK) 148 | { 149 | //std::cout << stderr << " Failed to set CURLOPT_POSTFIELDS " << error_buffer << std::endl; 150 | return -1; 151 | } 152 | 153 | code = curl_easy_perform(conn); 154 | 155 | if (code != CURLE_OK) 156 | { 157 | //std::cout << stderr << " Failed to post " << url << error_buffer << std::endl; 158 | 159 | errinfo.append("Failed to post "); 160 | errinfo.append(url); 161 | 162 | return -2; 163 | } 164 | 165 | curl_easy_cleanup(conn); 166 | 167 | return 1; 168 | } 169 | 170 | #endif 171 | -------------------------------------------------------------------------------- /CentOS/rpi/cJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009-2017 Dave Gamble and cJSON contributors 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #ifndef cJSON__h 24 | #define cJSON__h 25 | 26 | #ifdef __cplusplus 27 | extern "C" 28 | { 29 | #endif 30 | 31 | #if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) 32 | #define __WINDOWS__ 33 | #endif 34 | 35 | #ifdef __WINDOWS__ 36 | 37 | /* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options: 38 | 39 | CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols 40 | CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) 41 | CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol 42 | 43 | For *nix builds that support visibility attribute, you can define similar behavior by 44 | 45 | setting default visibility to hidden by adding 46 | -fvisibility=hidden (for gcc) 47 | or 48 | -xldscope=hidden (for sun cc) 49 | to CFLAGS 50 | 51 | then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does 52 | 53 | */ 54 | 55 | #define CJSON_CDECL __cdecl 56 | #define CJSON_STDCALL __stdcall 57 | 58 | /* export symbols by default, this is necessary for copy pasting the C and header file */ 59 | #if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS) 60 | #define CJSON_EXPORT_SYMBOLS 61 | #endif 62 | 63 | #if defined(CJSON_HIDE_SYMBOLS) 64 | #define CJSON_PUBLIC(type) type CJSON_STDCALL 65 | #elif defined(CJSON_EXPORT_SYMBOLS) 66 | #define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL 67 | #elif defined(CJSON_IMPORT_SYMBOLS) 68 | #define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL 69 | #endif 70 | #else /* !__WINDOWS__ */ 71 | #define CJSON_CDECL 72 | #define CJSON_STDCALL 73 | 74 | #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) 75 | #define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type 76 | #else 77 | #define CJSON_PUBLIC(type) type 78 | #endif 79 | #endif 80 | 81 | /* project version */ 82 | #define CJSON_VERSION_MAJOR 1 83 | #define CJSON_VERSION_MINOR 7 84 | #define CJSON_VERSION_PATCH 8 85 | 86 | #include 87 | 88 | /* cJSON Types: */ 89 | #define cJSON_Invalid (0) 90 | #define cJSON_False (1 << 0) 91 | #define cJSON_True (1 << 1) 92 | #define cJSON_NULL (1 << 2) 93 | #define cJSON_Number (1 << 3) 94 | #define cJSON_String (1 << 4) 95 | #define cJSON_Array (1 << 5) 96 | #define cJSON_Object (1 << 6) 97 | #define cJSON_Raw (1 << 7) /* raw json */ 98 | 99 | #define cJSON_IsReference 256 100 | #define cJSON_StringIsConst 512 101 | 102 | /* The cJSON structure: */ 103 | typedef struct cJSON 104 | { 105 | /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ 106 | struct cJSON *next; 107 | struct cJSON *prev; 108 | /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */ 109 | struct cJSON *child; 110 | 111 | /* The type of the item, as above. */ 112 | int type; 113 | 114 | /* The item's string, if type==cJSON_String and type == cJSON_Raw */ 115 | char *valuestring; 116 | /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */ 117 | int valueint; 118 | /* The item's number, if type==cJSON_Number */ 119 | double valuedouble; 120 | 121 | /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ 122 | char *string; 123 | } cJSON; 124 | 125 | typedef struct cJSON_Hooks 126 | { 127 | /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */ 128 | void *(CJSON_CDECL *malloc_fn)(size_t sz); 129 | void (CJSON_CDECL *free_fn)(void *ptr); 130 | } cJSON_Hooks; 131 | 132 | typedef int cJSON_bool; 133 | 134 | /* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them. 135 | * This is to prevent stack overflows. */ 136 | #ifndef CJSON_NESTING_LIMIT 137 | #define CJSON_NESTING_LIMIT 1000 138 | #endif 139 | 140 | /* returns the version of cJSON as a string */ 141 | CJSON_PUBLIC(const char*) cJSON_Version(void); 142 | 143 | /* Supply malloc, realloc and free functions to cJSON */ 144 | CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks); 145 | 146 | /* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ 147 | /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ 148 | CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value); 149 | /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ 150 | /* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ 151 | CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); 152 | 153 | /* Render a cJSON entity to text for transfer/storage. */ 154 | CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item); 155 | /* Render a cJSON entity to text for transfer/storage without any formatting. */ 156 | CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item); 157 | /* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ 158 | CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); 159 | /* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ 160 | /* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ 161 | CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); 162 | /* Delete a cJSON entity and all subentities. */ 163 | CJSON_PUBLIC(void) cJSON_Delete(cJSON *c); 164 | 165 | /* Returns the number of items in an array (or object). */ 166 | CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array); 167 | /* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ 168 | CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index); 169 | /* Get item "string" from object. Case insensitive. */ 170 | CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string); 171 | CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string); 172 | CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string); 173 | /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ 174 | CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void); 175 | 176 | /* Check if the item is a string and return its valuestring */ 177 | CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item); 178 | 179 | /* These functions check the type of an item */ 180 | CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item); 181 | CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item); 182 | CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item); 183 | CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item); 184 | CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item); 185 | CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item); 186 | CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item); 187 | CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item); 188 | CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item); 189 | CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item); 190 | 191 | /* These calls create a cJSON item of the appropriate type. */ 192 | CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void); 193 | CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void); 194 | CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void); 195 | CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean); 196 | CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num); 197 | CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string); 198 | /* raw json */ 199 | CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw); 200 | CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void); 201 | CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void); 202 | 203 | /* Create a string where valuestring references a string so 204 | * it will not be freed by cJSON_Delete */ 205 | CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string); 206 | /* Create an object/arrray that only references it's elements so 207 | * they will not be freed by cJSON_Delete */ 208 | CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child); 209 | CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child); 210 | 211 | /* These utilities create an Array of count items. */ 212 | CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count); 213 | CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count); 214 | CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count); 215 | CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count); 216 | 217 | /* Append item to the specified array/object. */ 218 | CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item); 219 | CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); 220 | /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. 221 | * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before 222 | * writing to `item->string` */ 223 | CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); 224 | /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ 225 | CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); 226 | CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); 227 | 228 | /* Remove/Detatch items from Arrays/Objects. */ 229 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); 230 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which); 231 | CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which); 232 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string); 233 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); 234 | CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string); 235 | CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); 236 | 237 | /* Update array items. */ 238 | CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ 239 | CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement); 240 | CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); 241 | CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem); 242 | CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem); 243 | 244 | /* Duplicate a cJSON item */ 245 | CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); 246 | /* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will 247 | need to be released. With recurse!=0, it will duplicate any children connected to the item. 248 | The item->next and ->prev pointers are always zero on return from Duplicate. */ 249 | /* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. 250 | * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ 251 | CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive); 252 | 253 | 254 | CJSON_PUBLIC(void) cJSON_Minify(char *json); 255 | 256 | /* Helper functions for creating and adding items to an object at the same time. 257 | * They return the added item or NULL on failure. */ 258 | CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name); 259 | CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name); 260 | CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name); 261 | CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean); 262 | CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number); 263 | CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string); 264 | CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw); 265 | CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name); 266 | CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name); 267 | 268 | /* When assigning an integer value, it needs to be propagated to valuedouble too. */ 269 | #define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) 270 | /* helper for the cJSON_SetNumberValue macro */ 271 | CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number); 272 | #define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) 273 | 274 | /* Macro for iterating over an array or object */ 275 | #define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) 276 | 277 | /* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ 278 | CJSON_PUBLIC(void *) cJSON_malloc(size_t size); 279 | CJSON_PUBLIC(void) cJSON_free(void *object); 280 | 281 | #ifdef __cplusplus 282 | } 283 | #endif 284 | 285 | #endif 286 | -------------------------------------------------------------------------------- /CentOS/rpi/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "XHLiveManager.h" 6 | #include "CLogin.h" 7 | #include "XHChatroomType.h" 8 | #include "CInterfaceUrls.h" 9 | 10 | XHLiveManager* g_pXHLiveManager = NULL; 11 | 12 | int main( int argc, char **argv ) 13 | { 14 | 15 | CUserManager* pUserManager = new CUserManager(); 16 | CLogin login(pUserManager); 17 | 18 | bool bRet = login.logIn(); 19 | 20 | while(bRet == false) 21 | { 22 | usleep( 1000 ); 23 | bRet = login.logIn(); 24 | } 25 | string strName = "rpiLive" + pUserManager->m_ServiceParam.m_strUserId; 26 | XH_CHATROOM_TYPE chatRoomType = XH_CHATROOM_TYPE_GLOBAL_PUBLIC; 27 | XH_LIVE_TYPE channelType = XH_LIVE_TYPE_GLOBAL_PUBLIC; 28 | g_pXHLiveManager = new XHLiveManager(pUserManager); 29 | 30 | list listData; 31 | string strLiveId = ""; 32 | 33 | char strListType[10] = { 0 }; 34 | sprintf(strListType, "%d,%d", CHATROOM_LIST_TYPE_LIVE, CHATROOM_LIST_TYPE_LIVE_PUSH); 35 | 36 | if(pUserManager->m_bAEventCenterEnable) 37 | { 38 | CInterfaceUrls::demoQueryList(strListType, listData); 39 | } 40 | else 41 | { 42 | XHLiveManager::getLiveList(pUserManager, "", strListType, listData); 43 | } 44 | list::iterator iter = listData.begin(); 45 | 46 | for (; iter != listData.end(); iter++) 47 | { 48 | if(iter->m_strCreaterId == pUserManager->m_ServiceParam.m_strUserId && strName == iter->m_strName) 49 | { 50 | strLiveId = iter->m_strRoomId; 51 | break; 52 | } 53 | } 54 | if(strLiveId == "") 55 | { 56 | strLiveId = g_pXHLiveManager->createLive(strName, chatRoomType, channelType); 57 | if(strLiveId != "") 58 | { 59 | string strInfo = "{\"id\":\""; 60 | strInfo += strLiveId; 61 | strInfo += "\",\"creator\":\""; 62 | strInfo += pUserManager->m_ServiceParam.m_strUserId; 63 | strInfo += "\",\"name\":\""; 64 | strInfo += strName; 65 | strInfo += "\"}"; 66 | if(pUserManager->m_bAEventCenterEnable) 67 | { 68 | printf("%s\n", (char*)strInfo.c_str()); 69 | CInterfaceUrls::demoSaveToList(pUserManager->m_ServiceParam.m_strUserId, CHATROOM_LIST_TYPE_LIVE, strLiveId, strInfo); 70 | } 71 | else 72 | { 73 | g_pXHLiveManager->saveToList(pUserManager->m_ServiceParam.m_strUserId, CHATROOM_LIST_TYPE_LIVE, strLiveId, strInfo); 74 | } 75 | } 76 | } 77 | 78 | if(strLiveId != "") 79 | { 80 | g_pXHLiveManager->m_Param.videoParam.w = 640; 81 | g_pXHLiveManager->m_Param.videoParam.h = 480; 82 | g_pXHLiveManager->m_Param.videoParam.fps = 15; 83 | g_pXHLiveManager->m_Param.videoParam.bitrate = 1024; 84 | bRet = g_pXHLiveManager->startLive(strLiveId, true); 85 | if(bRet) 86 | { 87 | while (true) 88 | { 89 | usleep( 800 ); 90 | } 91 | } 92 | else 93 | { 94 | printf("startLive failed \n"); 95 | } 96 | } 97 | else 98 | { 99 | printf("createLive failed \n"); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /CentOS/rpi/makefile: -------------------------------------------------------------------------------- 1 | CPP=gcc 2 | CFLAG=-fPIC -g -finline-functions -Wall -W -pipe \ 3 | -Wreturn-type -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith \ 4 | -D_GNU_SOURCE -Wno-deprecated -fpermissive -lpthread -lstarRTC -lstarRTCCore -lcurl -lstdc++ 5 | 6 | INCLUDE=/root/rpi-demo/temp/rpi-demo/starrtc/include 7 | LIB=/root/rpi-demo/temp/rpi-demo/starrtc/lib 8 | DIR=./ 9 | 10 | CUTL_PATH=/usr/local/curl 11 | 12 | INCLUDE_PATH=-I$(INCLUDE)/ -I$(CUTL_PATH)/include 13 | LIB_PATH=-L$(LIB)/ 14 | 15 | CUTL_LIB_PATH=-L$(CUTL_PATH)/lib 16 | THIRD=/opt/vc/lib 17 | 18 | THIRD_PATH=-L$(THIRD) 19 | SRC=$(wildcard *.cpp) 20 | OBJS=$(patsubst %.cpp, %.o, $(SRC)) 21 | 22 | PROC=rpi-demo 23 | 24 | $(PROC): $(OBJS) 25 | $(CPP) $(CFLAG) $(OBJS) -o $(PROC) $(INCLUDE_PATH) $(LIB_PATH) $(CUTL_LIB_PATH) $(THIRD_PATH) 26 | 27 | $(DIR)/%.o: %.cpp 28 | $(CPP) $(CFLAG) -c $(INCLUDE_PATH) $< -o $@ 29 | 30 | clean: 31 | rm -f $(PROC) $(OBJS) 32 | -------------------------------------------------------------------------------- /CentOS/rpi/param.ini: -------------------------------------------------------------------------------- 1 | AEventCenterEnable=0 2 | AudioEncType=1 3 | ChatRoomServerIP=demo.starrtc.com 4 | ChatRoomServerPort=19906 5 | IMServerIP=demo.starrtc.com 6 | IMServerPort=19903 7 | RcMode=0 8 | SDI_Input=1 9 | SaveMode=1 10 | UploadServerIP=demo.starrtc.com 11 | UploadServerPort=19931 12 | ViMode=1 13 | VideoBitRate=1024 14 | VideoEncType=0 15 | VideoFrameRate=20 16 | VideoType=4 17 | appId=APPID-FREE 18 | deviceName=/dev/video0 19 | userId= 20 | -------------------------------------------------------------------------------- /CentOS/rpi/rpi-demo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starrtc/starrtc-linux-demo/67f3d2b1a456240cad9be5309b3f42a915a3eeaa/CentOS/rpi/rpi-demo -------------------------------------------------------------------------------- /CentOS/starrtc/include/CChatroomManager.h: -------------------------------------------------------------------------------- 1 | #ifndef __CHATROOM_MANAGER__ 2 | #define __CHATROOM_MANAGER__ 3 | #include "CUserManager.h" 4 | #include "IStarIMChatroomListener.h" 5 | #include "IChatroomGetListListener.h" 6 | #include 7 | using namespace std; 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | class CChatroomManager : public IStarIMChatroomListener 15 | { 16 | public: 17 | /* 18 | * 构造方法 19 | */ 20 | CChatroomManager(CUserManager* pUserManager); 21 | /* 22 | * 析构方法 23 | */ 24 | ~CChatroomManager(); 25 | public: 26 | 27 | /* 28 | * 添加获取列表后回调函数指针 29 | * @param pChatroomGetListListener 回调函数指针 30 | */ 31 | static void addChatroomGetListListener(IChatroomGetListListener* pChatroomGetListListener); 32 | 33 | /* 34 | * 获取聊天室列表 35 | * @param pUserManager 用户信息 36 | * @param listType 类型 37 | */ 38 | static void getChatroomList(CUserManager* pUserManager, string strUserId, string listType); 39 | 40 | /* 41 | * 创建ChatRoom 42 | */ 43 | bool createChatRoom(string strName, int chatroomType); 44 | 45 | /* 46 | * 加入ChatRoom 47 | */ 48 | bool joinChatRoom(string strChatroomId); 49 | 50 | /** 51 | * 退出聊天室 52 | */ 53 | bool exitChatroom(); 54 | 55 | /* 56 | * 删除聊天室 57 | */ 58 | bool deleteChatRoom(string strRoomId, int listType); 59 | 60 | /* 61 | * 创建后上报创建的聊天室信息 62 | */ 63 | bool reportChatroom(string strRoomId, int listType, string data); 64 | 65 | string getChatroomId(); 66 | public: 67 | //聊天室创建成功 68 | void chatroomCreateOK(string roomId, int maxContentLen); 69 | //聊天室加入成功 70 | void chatroomJoinOK(string roomId, int maxContentLen); 71 | //聊天室创建失败 72 | void chatroomCreateFailed(string errString); 73 | //聊天室加入失败 74 | void chatroomJoinFailed(string roomId, string errString); 75 | //聊天室报错 76 | void chatRoomErr(string errString); 77 | //聊天室关闭成功 78 | void chatroomStopOK(); 79 | //聊天室删除成功 80 | void chatroomDeleteOK(string roomId); 81 | //聊天室删除失败 82 | void chatroomDeleteFailed(string roomId, string errString); 83 | private: 84 | void resetReturnVal(); 85 | /** 86 | * 成功 87 | * @param data 88 | */ 89 | void success(); 90 | /** 91 | * 失败 92 | * @param errMsg 93 | */ 94 | void failed(string errMsg); 95 | private: 96 | //用户信息 97 | CUserManager* m_pUserManager; 98 | bool m_bJoinChatRoom; 99 | bool m_bReturn; 100 | bool m_bSuccess; 101 | string m_strErrInfo; 102 | string m_ChatRoomId; 103 | }; 104 | 105 | #ifdef __cplusplus 106 | } 107 | #endif 108 | #endif 109 | 110 | 111 | -------------------------------------------------------------------------------- /CentOS/starrtc/include/CLiveParam.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIVE_PARAM__ 2 | #define __LIVE_PARAM__ 3 | #include 4 | using namespace std; 5 | 6 | #ifdef __cplusplus 7 | extern "C" 8 | { 9 | #endif 10 | 11 | class CAudioParamInfo 12 | { 13 | public: 14 | CAudioParamInfo(); 15 | ~CAudioParamInfo(); 16 | public: 17 | int audioSampleRateInHz; 18 | int audioChannels; 19 | int audioBitRate; 20 | }; 21 | class CVideoParam 22 | { 23 | public: 24 | CVideoParam(); 25 | ~CVideoParam(); 26 | 27 | void setPPSData(unsigned char* data, int dataLen); 28 | 29 | void setSPSData(unsigned char* data, int dataLen); 30 | public: 31 | int w; 32 | int h; 33 | int fps; 34 | int bitrate; 35 | unsigned char* ppsData; 36 | int ppsDataLen; 37 | unsigned char* spsData; 38 | int spsDataLen; 39 | }; 40 | 41 | 42 | class CLiveParam 43 | { 44 | public: 45 | CLiveParam(); 46 | ~CLiveParam(); 47 | public: 48 | CAudioParamInfo audioParam; 49 | CVideoParam videoParam; 50 | }; 51 | 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | #endif 57 | 58 | 59 | -------------------------------------------------------------------------------- /CentOS/starrtc/include/CLogin.h: -------------------------------------------------------------------------------- 1 | #ifndef __LOGIN__ 2 | #define __LOGIN__ 3 | #include "CUserManager.h" 4 | #include 5 | using namespace std; 6 | 7 | #ifdef __cplusplus 8 | extern "C" 9 | { 10 | #endif 11 | 12 | class CLogin 13 | { 14 | public: 15 | /* 16 | * 构造方法 17 | */ 18 | CLogin(CUserManager* pUserManager); 19 | /* 20 | * 析构方法 21 | */ 22 | ~CLogin(); 23 | 24 | /* 25 | * 登录 26 | */ 27 | bool logIn(); 28 | 29 | /* 30 | * 开启IM服务 31 | */ 32 | bool startIMServer(string strIP, int nPort, string userId, string agentId, string strToken); 33 | 34 | /* 35 | * 开启IM服务 36 | */ 37 | bool stopIMServer(); 38 | }; 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | #endif 44 | 45 | 46 | -------------------------------------------------------------------------------- /CentOS/starrtc/include/CSrcManager.h: -------------------------------------------------------------------------------- 1 | #ifndef __SRC_MANAGER__ 2 | #define __SRC_MANAGER__ 3 | #include "CUserManager.h" 4 | #include "ISrcListener.h" 5 | #include 6 | using namespace std; 7 | 8 | #ifdef __cplusplus 9 | extern "C" 10 | { 11 | #endif 12 | #define STREAM_CONFIG_MAX_SIZE 7 13 | class CSrcManager : public ISrcListener 14 | { 15 | public: 16 | /* 17 | * 构造方法 18 | */ 19 | CSrcManager(CUserManager* pUserManager); 20 | /* 21 | * 析构方法 22 | */ 23 | ~CSrcManager(); 24 | public: 25 | /* 26 | * 创建Channel 27 | */ 28 | bool createChannel(string strName, string strChatroomId); 29 | 30 | /* 31 | * 全局参数设置 32 | */ 33 | void globalSetting(int w, int h, int fps, int bitrate); 34 | 35 | /* 36 | * 开启直播编码器 37 | */ 38 | bool startEncoder(int audioSampleRateInHz, int audioChannels, int audioBitRate, unsigned char* ppsData,int ppsDataLen, unsigned char* spsData,int spsDataLen); 39 | /* 40 | * 设置设备名称 41 | */ 42 | void setDeviceName(char* strDeviceName); 43 | /* 44 | * Channel 申请上传 45 | */ 46 | bool applyUpload(string channelId); 47 | 48 | //videoData的释放由此函数负责 49 | void insertVideoRaw(unsigned char* videoData, int dataLen, int isBig); 50 | 51 | /* 52 | * Channel 停止上传 53 | */ 54 | bool stopUpload(); 55 | 56 | /* 57 | * 停止直播编码器 58 | */ 59 | bool stopEncoder(); 60 | public: 61 | virtual int createChannelOK(char* channelId); 62 | virtual int createChannelFailed(char* errString); 63 | 64 | virtual int applyUploadChannelOK(char* channelId); 65 | virtual int applyUploadChannelFailed(char* errString, char* channelId); 66 | 67 | virtual int deleteChannelOK(char* channelId); 68 | virtual int deleteChannelFailed(char* errString, char* channelId); 69 | 70 | virtual int setPeerStreamDownloadConfigOK(char* channelId); 71 | virtual int setPeerStreamDownloadConfigFailed(char* channelId); 72 | 73 | virtual int stopOK(); 74 | 75 | virtual int srcError(char* errString); 76 | private: 77 | void resetReturnVal(); 78 | 79 | /** 80 | * 成功 81 | * @param data 82 | */ 83 | virtual void success(); 84 | 85 | /** 86 | * 失败 87 | * @param errMsg 88 | */ 89 | virtual void failed(string errMsg); 90 | public: 91 | string m_ChannelId; 92 | private: 93 | CUserManager* m_pUserManager; 94 | 95 | bool m_bReturn; 96 | bool m_bSuccess; 97 | string m_strErrInfo; 98 | int m_configArr[STREAM_CONFIG_MAX_SIZE]; 99 | }; 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | #endif 105 | 106 | 107 | -------------------------------------------------------------------------------- /CentOS/starrtc/include/CUserManager.h: -------------------------------------------------------------------------------- 1 | #ifndef __USER_MANAGER__ 2 | #define __USER_MANAGER__ 3 | #include 4 | using namespace std; 5 | 6 | #ifdef __cplusplus 7 | extern "C" 8 | { 9 | #endif 10 | 11 | #define AUDIO_SAMPLE_RATE 16000 12 | #define AUDIO_CHANNELS 1 13 | #define AUDIO_BIT_RATE 32 14 | class CAudioParam 15 | { 16 | public: 17 | int m_nSampleRateInHz; 18 | int m_nChannels; 19 | int m_nBitRate; 20 | }; 21 | 22 | class CServiceParam 23 | { 24 | 25 | public: 26 | string m_strUserId; 27 | string m_strAgentId; 28 | 29 | string m_strLoginServiceIP; 30 | int m_nLoginServicePort; 31 | string m_strMessageServiceIP; 32 | int m_nMessageServicePort; 33 | string m_strChatServiceIP; 34 | int m_nChatServicePort; 35 | string m_strUploadServiceIP; 36 | int m_nUploadServicePort; 37 | string m_strDownloadServiceIP; 38 | int m_nDownloadServicePort; 39 | string m_strVOIPServiceIP; 40 | int m_nVOIPServicePort; 41 | 42 | string m_strRequestListAddr; 43 | 44 | public: 45 | int m_CropType; 46 | int m_FrameRate; 47 | }; 48 | 49 | class CUserManager 50 | { 51 | public: 52 | /* 53 | * 构造方法 54 | */ 55 | CUserManager(); 56 | /* 57 | * 析构方法 58 | */ 59 | ~CUserManager(); 60 | 61 | bool readConfig(); 62 | bool writeConfig(); 63 | public: 64 | string m_strAuthKey; 65 | string m_strTokenId; 66 | 67 | string m_strIMServerIp; 68 | int m_nIMServerPort; 69 | int m_nDeployType; 70 | bool m_bVoipP2P; 71 | bool m_bAEventCenterEnable; 72 | CServiceParam m_ServiceParam; 73 | CAudioParam m_AudioParam; 74 | 75 | string m_strDeviceName; 76 | }; 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | #endif 82 | 83 | 84 | -------------------------------------------------------------------------------- /CentOS/starrtc/include/ChatroomInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | using namespace std; 4 | 5 | #ifdef __cplusplus 6 | extern "C" 7 | { 8 | #endif 9 | 10 | class ChatroomInfo 11 | { 12 | public: 13 | string m_strName; 14 | string m_strCreaterId; 15 | string m_strRoomId; 16 | bool m_bLive; 17 | }; 18 | #ifdef __cplusplus 19 | } 20 | #endif -------------------------------------------------------------------------------- /CentOS/starrtc/include/IChatroomGetListListener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "ChatroomInfo.h" 4 | 5 | #ifdef __cplusplus 6 | extern "C" 7 | { 8 | #endif 9 | 10 | class IChatroomGetListListener 11 | { 12 | public: 13 | /** 14 | * 查询聊天室列表回调 15 | */ 16 | virtual int chatroomQueryAllListOK(list& listData) = 0; 17 | }; 18 | 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif -------------------------------------------------------------------------------- /CentOS/starrtc/include/ISrcListener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifdef __cplusplus 3 | extern "C" 4 | { 5 | #endif 6 | class ISrcListener 7 | { 8 | public: 9 | virtual int createChannelOK(char* channelId) = 0; 10 | virtual int createChannelFailed(char* errString) = 0; 11 | 12 | virtual int applyUploadChannelOK(char* channelId) = 0; 13 | virtual int applyUploadChannelFailed(char* errString, char* channelId) = 0; 14 | 15 | virtual int deleteChannelOK(char* channelId) = 0; 16 | virtual int deleteChannelFailed(char* errString, char* channelId) = 0; 17 | 18 | virtual int setPeerStreamDownloadConfigOK(char* channelId) = 0; 19 | virtual int setPeerStreamDownloadConfigFailed(char* channelId) = 0; 20 | 21 | virtual int stopOK() = 0; 22 | 23 | virtual int srcError(char* errString) = 0; 24 | }; 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif -------------------------------------------------------------------------------- /CentOS/starrtc/include/IStarIMChatroomListener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | using namespace std; 5 | #ifdef __cplusplus 6 | extern "C" 7 | { 8 | #endif 9 | 10 | class IStarIMChatroomListener 11 | { 12 | public: 13 | //聊天室创建成功 14 | virtual void chatroomCreateOK(string roomId, int maxContentLen) = 0; 15 | //聊天室加入成功 16 | virtual void chatroomJoinOK(string roomId, int maxContentLen) = 0; 17 | //聊天室创建失败 18 | virtual void chatroomCreateFailed(string errString) = 0; 19 | //聊天室加入失败 20 | virtual void chatroomJoinFailed(string roomId, string errString) = 0; 21 | //聊天室报错 22 | virtual void chatRoomErr(string errString) = 0; 23 | //聊天室关闭成功 24 | virtual void chatroomStopOK() = 0; 25 | //聊天室删除成功 26 | virtual void chatroomDeleteOK(string roomId) = 0; 27 | //聊天室删除失败 28 | virtual void chatroomDeleteFailed(string roomId, string errString) = 0; 29 | }; 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /CentOS/starrtc/include/StarRtcCore.h: -------------------------------------------------------------------------------- 1 | #ifndef __STARRTC_CORE__ 2 | #define __STARRTC_CORE__ 3 | #include "CUserManager.h" 4 | #include "ISrcListener.h" 5 | #include "IStarIMChatroomListener.h" 6 | #include "IChatroomGetListListener.h" 7 | #include 8 | using namespace std; 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | /* 15 | * StarRtc接口类 16 | */ 17 | class StarRtcCore 18 | { 19 | private: 20 | /* 21 | * 构造函数 22 | * @param pUserManager 用户配置信息 23 | */ 24 | StarRtcCore(); 25 | 26 | public: 27 | 28 | /* 29 | * 获取StarRtc接口对象 30 | * @param pUserManager 用户配置信息 31 | */ 32 | static StarRtcCore* getStarRtcCoreInstance(); 33 | 34 | /* 35 | * 析构函数 36 | */ 37 | ~StarRtcCore(); 38 | 39 | /* 40 | * 注册回调函数 41 | */ 42 | void registerCallback(); 43 | 44 | /** 45 | * 添加StarIMChatroom消息监听 46 | * @param listener 47 | */ 48 | void addStarIMChatroomListener(IStarIMChatroomListener* listener); 49 | 50 | /** 51 | * 添加Src消息监听 52 | * @param listener 53 | */ 54 | void addSrcListener(ISrcListener* pSrcListener); 55 | 56 | /** 57 | * 添加获取列表监听 58 | * @param listener 59 | */ 60 | void addGetListListener(IChatroomGetListListener* listener); 61 | 62 | int queryAllChatRoomList(char* servAddr, int servPort, char* userId, char* listType); 63 | 64 | void setGlobalSetting(int videoEnable, int audioEnable, 65 | int videoBigIsHw, 66 | int videoBigWidth, int videoBigHeight, int videoBigFps, int videoBigBitrate, 67 | int videoSmallWidth, int videoSmallHeight, int videoSmallFps, int videoSmallBitrate, 68 | int openGLESEnable, int dynamicBitrateAndFpsEnable, int voipP2PEnable); 69 | 70 | /** 71 | * 启动IM服务 72 | */ 73 | bool startIMServer(char* servIP, int servPort, char* agentId, char* userId, char* starToken); 74 | 75 | /** 76 | * 停止IM服务 77 | */ 78 | bool stopIMServer(); 79 | /* 80 | * 创建ChatRoom 81 | */ 82 | bool createChatRoom(string serverIp, int serverPort, string strName, int chatroomType, string strAgentId, string strUserId, string strTokenId); 83 | 84 | /* 85 | * 加入ChatRoom 86 | */ 87 | bool joinChatRoom(string serverIp, int serverPort, string strChatroomId, string strAgentId, string strUserId, string strTokenId); 88 | 89 | /* 90 | * 与ChatRoom断开连接 91 | */ 92 | bool stopChatRoomConnect(); 93 | 94 | 95 | /* 96 | * 设置数据流配置 97 | */ 98 | bool setStreamConfigSrc(int* sendBuf, int length); 99 | 100 | /* 101 | * 创建Channel 102 | */ 103 | bool createPublicChannel(string strServerIp, int port, string strName, int channelType, string strChatroomId, string strAgentId, string strUserId, string strTokenId); 104 | 105 | int startLiveSrcEncoder(int audioSampleRateInHz, int audioChannels, int audioBitRate, int rotation, unsigned char* pPPSData, int nPPSDataLen, unsigned char* pSPSData, int nSPSDataLen); 106 | void setDeviceName(char* strDeviceName); 107 | int startUploadSrcServer(char* servAddr, int servPort, char* agentId, char* userId, char* starToken, char* channelId/* ,int maxAudioPacketNum,int maxVideoPacketNum */); 108 | 109 | int stopUploadSrcServer(); 110 | int stopLiveSrcCodec(); 111 | 112 | //videoData的释放由此函数负责 113 | void insertVideoNalu(unsigned char* videoData, int dataLen); 114 | 115 | int saveToChatRoomList(char* servAddr, int servPort, char* userId, int listType, char* roomId, char* data); 116 | 117 | int delFromChatRoomList(char* servAddr, int servPort, char* userId, int listType, char* roomId); 118 | 119 | 120 | //========================================================================= 121 | //=========================== live chatroom回调 =========================== 122 | //========================================================================= 123 | 124 | static int chatroomQueryAllListOK(char* listData, void* userData); 125 | 126 | static int createChatroomOK(char* roomId, int maxContentLen, void* userData); 127 | 128 | static int createChatroomFailed(void* userData, char* errString); 129 | 130 | static int joinChatroomOK(char* roomId, int maxContentLen, void* userData); 131 | 132 | static int joinChatroomFailed(char* roomId, char* errString, void* userData); 133 | 134 | static int chatroomError(char* errString, void* userData); 135 | 136 | static int chatroomStop(void* userData); 137 | 138 | 139 | static int deleteChatroomOK(char* roomId, void* userData); 140 | static int deleteChatroomFailed(char* roomId, char* errString, void* userData); 141 | 142 | 143 | //========================================================================= 144 | //=========================== liveSrc回调 =========================== 145 | //========================================================================= 146 | static int createChannelOK(char* channelId, void* userData); 147 | static int createChannelFailed(char* errString, void* userData); 148 | 149 | static int applyUploadChannelOK(char* channelId, void* userData); 150 | static int applyUploadChannelFailed(char* errString, char* channelId, void* userData); 151 | 152 | static int deleteChannelOK(char* channelId, void* userData); 153 | static int deleteChannelFailed(char* errString, char* channelId, void* userData); 154 | 155 | static int setPeerStreamDownloadConfigOK(char* channelId, void* userData); 156 | static int setPeerStreamDownloadConfigFailed(char* channelId, void* userData); 157 | 158 | static int stopOK(void* userData); 159 | static int srcError(char* errString, void* userData); 160 | private: 161 | IStarIMChatroomListener *m_pStarIMChatroomListener; 162 | ISrcListener* m_pSrcListener; 163 | IChatroomGetListListener* m_pGetListListener; 164 | 165 | }; 166 | 167 | #ifdef __cplusplus 168 | } 169 | #endif 170 | #endif 171 | 172 | 173 | -------------------------------------------------------------------------------- /CentOS/starrtc/include/XHChatroomType.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATROOM_TYPE_H 2 | #define CHATROOM_TYPE_H 3 | 4 | enum XH_CHATROOM_TYPE 5 | { 6 | XH_CHATROOM_TYPE_UNABLE, // 占位 7 | XH_CHATROOM_TYPE_GLOBAL_PUBLIC, // 无需登录和验证 8 | XH_CHATROOM_TYPE_LOGIN_PUBLIC // 需要登录,无需验证 9 | }; 10 | 11 | /** 12 | * 直播类型 13 | */ 14 | enum XH_LIVE_TYPE 15 | { 16 | XH_LIVE_TYPE_GLOBAL_PUBLIC, //无需登录和验证 17 | XH_LIVE_TYPE_LOGIN_PUBLIC, //需要登录,无需验证 18 | XH_LIVE_TYPE_LOGIN_SPECIFY //需要登录和验证 19 | }; 20 | 21 | /** 22 | * 会议类型 23 | */ 24 | enum XH_MEETING_TYPE 25 | { 26 | XH_MEETING_TYPE_GLOBAL_PUBLIC, //无需登录和验证 27 | XH_MEETING_TYPE_LOGIN_PUBLIC, //需要登录,无需验证 28 | XH_MEETING_TYPE_LOGIN_SPECIFY //需要登录和验证 29 | }; 30 | 31 | enum XH_SUPER_ROOM_TYPE 32 | { 33 | XH_SUPER_ROOM_TYPE_GLOBAL_PUBLIC, //无需登录和验证 34 | XH_SUPER_ROOM_TYPE_LOGIN_PUBLIC, //需要登录,无需验证 35 | XH_SUPER_ROOM_TYPE_LOGIN_SPECIFY //需要登录和验证 36 | }; 37 | 38 | enum CHATROOM_LIST_TYPE 39 | { 40 | CHATROOM_LIST_TYPE_CHATROOM, 41 | CHATROOM_LIST_TYPE_LIVE, 42 | CHATROOM_LIST_TYPE_LIVE_PUSH, 43 | CHATROOM_LIST_TYPE_MEETING, 44 | CHATROOM_LIST_TYPE_MEETING_PUSH, 45 | CHATROOM_LIST_TYPE_CLASS, 46 | CHATROOM_LIST_TYPE_CLASS_PUSH, 47 | CHATROOM_LIST_TYPE_AUDIO_LIVE, 48 | CHATROOM_LIST_TYPE_AUDIO_LIVE_PUSH, 49 | CHATROOM_LIST_TYPE_SUPER_ROOM, 50 | CHATROOM_LIST_TYPE_SUPER_ROOM_PUSH 51 | }; 52 | 53 | #endif -------------------------------------------------------------------------------- /CentOS/starrtc/include/XHLiveManager.h: -------------------------------------------------------------------------------- 1 | #ifndef __XH_LIVE_MANAGER__ 2 | #define __XH_LIVE_MANAGER__ 3 | #include "CChatroomManager.h" 4 | #include "CSrcManager.h" 5 | #include "CUserManager.h" 6 | #include "CLiveParam.h" 7 | #include "IChatroomGetListListener.h" 8 | #include "ChatroomInfo.h" 9 | #include 10 | #include 11 | using namespace std; 12 | 13 | #ifdef __cplusplus 14 | extern "C" 15 | { 16 | #endif 17 | 18 | class XHLiveManager : public IChatroomGetListListener 19 | { 20 | public: 21 | /* 22 | * 构造方法 23 | */ 24 | XHLiveManager(CUserManager* pUserManager); 25 | /* 26 | * 析构方法 27 | */ 28 | ~XHLiveManager(); 29 | 30 | static void getLiveList(CUserManager* pUserManager, string strUserId, string listType, list& listData); 31 | /** 32 | * 创建直播 33 | */ 34 | string createLive(string strName, int chatroomType, int channelType); 35 | 36 | /** 37 | * 开始直播 38 | * @param strLiveID ID 39 | */ 40 | bool startLive(string strLiveID, bool bGetData); 41 | 42 | /* 43 | * 全局参数设置 44 | */ 45 | void globalSetting(int w, int h, int fps, int bitrate); 46 | 47 | /* 48 | * 开启直播编码器 49 | */ 50 | bool startEncoder(int audioSampleRateInHz, int audioChannels, int audioBitRate, unsigned char* ppsData,int ppsDataLen, unsigned char* spsData,int spsDataLen); 51 | 52 | /** 53 | * 保存到列表 54 | * @param userId 55 | * @param type 56 | * @param liveId 57 | * @param data 58 | */ 59 | bool saveToList(string userId, int type, string liveId, string data); 60 | 61 | /** 62 | * 从列表删除 63 | * @param userId 用户ID 64 | * @param type 类型 65 | * @param liveId liveID 66 | */ 67 | void deleteFromList(string userId, int type, string liveId); 68 | 69 | void insertVideoRaw(unsigned char* videoData, int dataLen, int isBig); 70 | 71 | /** 72 | * 查询聊天室列表回调 73 | */ 74 | virtual int chatroomQueryAllListOK(list& chatRoomInfoList); 75 | public: 76 | CLiveParam m_Param; 77 | private: 78 | CUserManager* m_pUserManager; 79 | CChatroomManager* m_pChatroomManager; 80 | CSrcManager* m_pSrcManager; 81 | static bool m_bGetListReturn; 82 | }; 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | #endif 88 | 89 | 90 | -------------------------------------------------------------------------------- /CentOS/starrtc/lib/libstarRTC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starrtc/starrtc-linux-demo/67f3d2b1a456240cad9be5309b3f42a915a3eeaa/CentOS/starrtc/lib/libstarRTC.so -------------------------------------------------------------------------------- /CentOS/starrtc/lib/libstarRTCCore.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starrtc/starrtc-linux-demo/67f3d2b1a456240cad9be5309b3f42a915a3eeaa/CentOS/starrtc/lib/libstarRTCCore.so -------------------------------------------------------------------------------- /CentOS/third/curl/include/curl/curlver.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURLVER_H 2 | #define __CURL_CURLVER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* This header file contains nothing but libcurl version info, generated by 26 | a script at release-time. This was made its own header file in 7.11.2 */ 27 | 28 | /* This is the global package copyright */ 29 | #define LIBCURL_COPYRIGHT "1996 - 2019 Daniel Stenberg, ." 30 | 31 | /* This is the version number of the libcurl package from which this header 32 | file origins: */ 33 | #define LIBCURL_VERSION "7.66.0-DEV" 34 | 35 | /* The numeric version number is also available "in parts" by using these 36 | defines: */ 37 | #define LIBCURL_VERSION_MAJOR 7 38 | #define LIBCURL_VERSION_MINOR 66 39 | #define LIBCURL_VERSION_PATCH 0 40 | 41 | /* This is the numeric version of the libcurl version number, meant for easier 42 | parsing and comparions by programs. The LIBCURL_VERSION_NUM define will 43 | always follow this syntax: 44 | 45 | 0xXXYYZZ 46 | 47 | Where XX, YY and ZZ are the main version, release and patch numbers in 48 | hexadecimal (using 8 bits each). All three numbers are always represented 49 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7 50 | appears as "0x090b07". 51 | 52 | This 6-digit (24 bits) hexadecimal number does not show pre-release number, 53 | and it is always a greater number in a more recent release. It makes 54 | comparisons with greater than and less than work. 55 | 56 | Note: This define is the full hex number and _does not_ use the 57 | CURL_VERSION_BITS() macro since curl's own configure script greps for it 58 | and needs it to contain the full number. 59 | */ 60 | #define LIBCURL_VERSION_NUM 0x074200 61 | 62 | /* 63 | * This is the date and time when the full source package was created. The 64 | * timestamp is not stored in git, as the timestamp is properly set in the 65 | * tarballs by the maketgz script. 66 | * 67 | * The format of the date follows this template: 68 | * 69 | * "2007-11-23" 70 | */ 71 | #define LIBCURL_TIMESTAMP "[unreleased]" 72 | 73 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) 74 | #define CURL_AT_LEAST_VERSION(x,y,z) \ 75 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) 76 | 77 | #endif /* __CURL_CURLVER_H */ 78 | -------------------------------------------------------------------------------- /CentOS/third/curl/include/curl/easy.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_EASY_H 2 | #define __CURL_EASY_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | CURL_EXTERN CURL *curl_easy_init(void); 29 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 30 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 31 | CURL_EXTERN void curl_easy_cleanup(CURL *curl); 32 | 33 | /* 34 | * NAME curl_easy_getinfo() 35 | * 36 | * DESCRIPTION 37 | * 38 | * Request internal information from the curl session with this function. The 39 | * third argument MUST be a pointer to a long, a pointer to a char * or a 40 | * pointer to a double (as the documentation describes elsewhere). The data 41 | * pointed to will be filled in accordingly and can be relied upon only if the 42 | * function returns CURLE_OK. This function is intended to get used *AFTER* a 43 | * performed transfer, all results from this function are undefined until the 44 | * transfer is completed. 45 | */ 46 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 47 | 48 | 49 | /* 50 | * NAME curl_easy_duphandle() 51 | * 52 | * DESCRIPTION 53 | * 54 | * Creates a new curl session handle with the same options set for the handle 55 | * passed in. Duplicating a handle could only be a matter of cloning data and 56 | * options, internal state info and things like persistent connections cannot 57 | * be transferred. It is useful in multithreaded applications when you can run 58 | * curl_easy_duphandle() for each new thread to avoid a series of identical 59 | * curl_easy_setopt() invokes in every thread. 60 | */ 61 | CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); 62 | 63 | /* 64 | * NAME curl_easy_reset() 65 | * 66 | * DESCRIPTION 67 | * 68 | * Re-initializes a CURL handle to the default values. This puts back the 69 | * handle to the same state as it was in when it was just created. 70 | * 71 | * It does keep: live connections, the Session ID cache, the DNS cache and the 72 | * cookies. 73 | */ 74 | CURL_EXTERN void curl_easy_reset(CURL *curl); 75 | 76 | /* 77 | * NAME curl_easy_recv() 78 | * 79 | * DESCRIPTION 80 | * 81 | * Receives data from the connected socket. Use after successful 82 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 83 | */ 84 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 85 | size_t *n); 86 | 87 | /* 88 | * NAME curl_easy_send() 89 | * 90 | * DESCRIPTION 91 | * 92 | * Sends data over the connected socket. Use after successful 93 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 94 | */ 95 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 96 | size_t buflen, size_t *n); 97 | 98 | 99 | /* 100 | * NAME curl_easy_upkeep() 101 | * 102 | * DESCRIPTION 103 | * 104 | * Performs connection upkeep for the given session handle. 105 | */ 106 | CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /CentOS/third/curl/include/curl/mprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_MPRINTF_H 2 | #define __CURL_MPRINTF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | #include /* needed for FILE */ 27 | #include "curl.h" /* for CURL_EXTERN */ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | CURL_EXTERN int curl_mprintf(const char *format, ...); 34 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); 35 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); 36 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, 37 | const char *format, ...); 38 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args); 39 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); 40 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); 41 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, 42 | const char *format, va_list args); 43 | CURL_EXTERN char *curl_maprintf(const char *format, ...); 44 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif /* __CURL_MPRINTF_H */ 51 | -------------------------------------------------------------------------------- /CentOS/third/curl/include/curl/multi.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_MULTI_H 2 | #define __CURL_MULTI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | /* 25 | This is an "external" header file. Don't give away any internals here! 26 | 27 | GOALS 28 | 29 | o Enable a "pull" interface. The application that uses libcurl decides where 30 | and when to ask libcurl to get/send data. 31 | 32 | o Enable multiple simultaneous transfers in the same thread without making it 33 | complicated for the application. 34 | 35 | o Enable the application to select() on its own file descriptors and curl's 36 | file descriptors simultaneous easily. 37 | 38 | */ 39 | 40 | /* 41 | * This header file should not really need to include "curl.h" since curl.h 42 | * itself includes this file and we expect user applications to do #include 43 | * without the need for especially including multi.h. 44 | * 45 | * For some reason we added this include here at one point, and rather than to 46 | * break existing (wrongly written) libcurl applications, we leave it as-is 47 | * but with this warning attached. 48 | */ 49 | #include "curl.h" 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) 56 | typedef struct Curl_multi CURLM; 57 | #else 58 | typedef void CURLM; 59 | #endif 60 | 61 | typedef enum { 62 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or 63 | curl_multi_socket*() soon */ 64 | CURLM_OK, 65 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ 66 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ 67 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ 68 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ 69 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ 70 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ 71 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was 72 | attempted to get added - again */ 73 | CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a 74 | callback */ 75 | CURLM_LAST 76 | } CURLMcode; 77 | 78 | /* just to make code nicer when using curl_multi_socket() you can now check 79 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for 80 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ 81 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM 82 | 83 | /* bitmask bits for CURLMOPT_PIPELINING */ 84 | #define CURLPIPE_NOTHING 0L 85 | #define CURLPIPE_HTTP1 1L 86 | #define CURLPIPE_MULTIPLEX 2L 87 | 88 | typedef enum { 89 | CURLMSG_NONE, /* first, not used */ 90 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains 91 | the CURLcode of the transfer */ 92 | CURLMSG_LAST /* last, not used */ 93 | } CURLMSG; 94 | 95 | struct CURLMsg { 96 | CURLMSG msg; /* what this message means */ 97 | CURL *easy_handle; /* the handle it concerns */ 98 | union { 99 | void *whatever; /* message-specific data */ 100 | CURLcode result; /* return code for transfer */ 101 | } data; 102 | }; 103 | typedef struct CURLMsg CURLMsg; 104 | 105 | /* Based on poll(2) structure and values. 106 | * We don't use pollfd and POLL* constants explicitly 107 | * to cover platforms without poll(). */ 108 | #define CURL_WAIT_POLLIN 0x0001 109 | #define CURL_WAIT_POLLPRI 0x0002 110 | #define CURL_WAIT_POLLOUT 0x0004 111 | 112 | struct curl_waitfd { 113 | curl_socket_t fd; 114 | short events; 115 | short revents; /* not supported yet */ 116 | }; 117 | 118 | /* 119 | * Name: curl_multi_init() 120 | * 121 | * Desc: inititalize multi-style curl usage 122 | * 123 | * Returns: a new CURLM handle to use in all 'curl_multi' functions. 124 | */ 125 | CURL_EXTERN CURLM *curl_multi_init(void); 126 | 127 | /* 128 | * Name: curl_multi_add_handle() 129 | * 130 | * Desc: add a standard curl handle to the multi stack 131 | * 132 | * Returns: CURLMcode type, general multi error code. 133 | */ 134 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, 135 | CURL *curl_handle); 136 | 137 | /* 138 | * Name: curl_multi_remove_handle() 139 | * 140 | * Desc: removes a curl handle from the multi stack again 141 | * 142 | * Returns: CURLMcode type, general multi error code. 143 | */ 144 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, 145 | CURL *curl_handle); 146 | 147 | /* 148 | * Name: curl_multi_fdset() 149 | * 150 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or 151 | * poll() on. We want curl_multi_perform() called as soon as one of 152 | * them are ready. 153 | * 154 | * Returns: CURLMcode type, general multi error code. 155 | */ 156 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, 157 | fd_set *read_fd_set, 158 | fd_set *write_fd_set, 159 | fd_set *exc_fd_set, 160 | int *max_fd); 161 | 162 | /* 163 | * Name: curl_multi_wait() 164 | * 165 | * Desc: Poll on all fds within a CURLM set as well as any 166 | * additional fds passed to the function. 167 | * 168 | * Returns: CURLMcode type, general multi error code. 169 | */ 170 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, 171 | struct curl_waitfd extra_fds[], 172 | unsigned int extra_nfds, 173 | int timeout_ms, 174 | int *ret); 175 | 176 | /* 177 | * Name: curl_multi_poll() 178 | * 179 | * Desc: Poll on all fds within a CURLM set as well as any 180 | * additional fds passed to the function. 181 | * 182 | * Returns: CURLMcode type, general multi error code. 183 | */ 184 | CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle, 185 | struct curl_waitfd extra_fds[], 186 | unsigned int extra_nfds, 187 | int timeout_ms, 188 | int *ret); 189 | 190 | /* 191 | * Name: curl_multi_perform() 192 | * 193 | * Desc: When the app thinks there's data available for curl it calls this 194 | * function to read/write whatever there is right now. This returns 195 | * as soon as the reads and writes are done. This function does not 196 | * require that there actually is data available for reading or that 197 | * data can be written, it can be called just in case. It returns 198 | * the number of handles that still transfer data in the second 199 | * argument's integer-pointer. 200 | * 201 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only 202 | * returns errors etc regarding the whole multi stack. There might 203 | * still have occurred problems on individual transfers even when 204 | * this returns OK. 205 | */ 206 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, 207 | int *running_handles); 208 | 209 | /* 210 | * Name: curl_multi_cleanup() 211 | * 212 | * Desc: Cleans up and removes a whole multi stack. It does not free or 213 | * touch any individual easy handles in any way. We need to define 214 | * in what state those handles will be if this function is called 215 | * in the middle of a transfer. 216 | * 217 | * Returns: CURLMcode type, general multi error code. 218 | */ 219 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); 220 | 221 | /* 222 | * Name: curl_multi_info_read() 223 | * 224 | * Desc: Ask the multi handle if there's any messages/informationals from 225 | * the individual transfers. Messages include informationals such as 226 | * error code from the transfer or just the fact that a transfer is 227 | * completed. More details on these should be written down as well. 228 | * 229 | * Repeated calls to this function will return a new struct each 230 | * time, until a special "end of msgs" struct is returned as a signal 231 | * that there is no more to get at this point. 232 | * 233 | * The data the returned pointer points to will not survive calling 234 | * curl_multi_cleanup(). 235 | * 236 | * The 'CURLMsg' struct is meant to be very simple and only contain 237 | * very basic information. If more involved information is wanted, 238 | * we will provide the particular "transfer handle" in that struct 239 | * and that should/could/would be used in subsequent 240 | * curl_easy_getinfo() calls (or similar). The point being that we 241 | * must never expose complex structs to applications, as then we'll 242 | * undoubtably get backwards compatibility problems in the future. 243 | * 244 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out 245 | * of structs. It also writes the number of messages left in the 246 | * queue (after this read) in the integer the second argument points 247 | * to. 248 | */ 249 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, 250 | int *msgs_in_queue); 251 | 252 | /* 253 | * Name: curl_multi_strerror() 254 | * 255 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode 256 | * value into the equivalent human readable error string. This is 257 | * useful for printing meaningful error messages. 258 | * 259 | * Returns: A pointer to a zero-terminated error message. 260 | */ 261 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode); 262 | 263 | /* 264 | * Name: curl_multi_socket() and 265 | * curl_multi_socket_all() 266 | * 267 | * Desc: An alternative version of curl_multi_perform() that allows the 268 | * application to pass in one of the file descriptors that have been 269 | * detected to have "action" on them and let libcurl perform. 270 | * See man page for details. 271 | */ 272 | #define CURL_POLL_NONE 0 273 | #define CURL_POLL_IN 1 274 | #define CURL_POLL_OUT 2 275 | #define CURL_POLL_INOUT 3 276 | #define CURL_POLL_REMOVE 4 277 | 278 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD 279 | 280 | #define CURL_CSELECT_IN 0x01 281 | #define CURL_CSELECT_OUT 0x02 282 | #define CURL_CSELECT_ERR 0x04 283 | 284 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ 285 | curl_socket_t s, /* socket */ 286 | int what, /* see above */ 287 | void *userp, /* private callback 288 | pointer */ 289 | void *socketp); /* private socket 290 | pointer */ 291 | /* 292 | * Name: curl_multi_timer_callback 293 | * 294 | * Desc: Called by libcurl whenever the library detects a change in the 295 | * maximum number of milliseconds the app is allowed to wait before 296 | * curl_multi_socket() or curl_multi_perform() must be called 297 | * (to allow libcurl's timed events to take place). 298 | * 299 | * Returns: The callback should return zero. 300 | */ 301 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ 302 | long timeout_ms, /* see above */ 303 | void *userp); /* private callback 304 | pointer */ 305 | 306 | CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, 307 | int *running_handles); 308 | 309 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, 310 | curl_socket_t s, 311 | int ev_bitmask, 312 | int *running_handles); 313 | 314 | CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, 315 | int *running_handles); 316 | 317 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET 318 | /* This macro below was added in 7.16.3 to push users who recompile to use 319 | the new curl_multi_socket_action() instead of the old curl_multi_socket() 320 | */ 321 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) 322 | #endif 323 | 324 | /* 325 | * Name: curl_multi_timeout() 326 | * 327 | * Desc: Returns the maximum number of milliseconds the app is allowed to 328 | * wait before curl_multi_socket() or curl_multi_perform() must be 329 | * called (to allow libcurl's timed events to take place). 330 | * 331 | * Returns: CURLM error code. 332 | */ 333 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, 334 | long *milliseconds); 335 | 336 | #undef CINIT /* re-using the same name as in curl.h */ 337 | 338 | #ifdef CURL_ISOCPP 339 | #define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num 340 | #else 341 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ 342 | #define LONG CURLOPTTYPE_LONG 343 | #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT 344 | #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT 345 | #define OFF_T CURLOPTTYPE_OFF_T 346 | #define CINIT(name,type,number) CURLMOPT_/**/name = type + number 347 | #endif 348 | 349 | typedef enum { 350 | /* This is the socket callback function pointer */ 351 | CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), 352 | 353 | /* This is the argument passed to the socket callback */ 354 | CINIT(SOCKETDATA, OBJECTPOINT, 2), 355 | 356 | /* set to 1 to enable pipelining for this multi handle */ 357 | CINIT(PIPELINING, LONG, 3), 358 | 359 | /* This is the timer callback function pointer */ 360 | CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), 361 | 362 | /* This is the argument passed to the timer callback */ 363 | CINIT(TIMERDATA, OBJECTPOINT, 5), 364 | 365 | /* maximum number of entries in the connection cache */ 366 | CINIT(MAXCONNECTS, LONG, 6), 367 | 368 | /* maximum number of (pipelining) connections to one host */ 369 | CINIT(MAX_HOST_CONNECTIONS, LONG, 7), 370 | 371 | /* maximum number of requests in a pipeline */ 372 | CINIT(MAX_PIPELINE_LENGTH, LONG, 8), 373 | 374 | /* a connection with a content-length longer than this 375 | will not be considered for pipelining */ 376 | CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9), 377 | 378 | /* a connection with a chunk length longer than this 379 | will not be considered for pipelining */ 380 | CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10), 381 | 382 | /* a list of site names(+port) that are blacklisted from 383 | pipelining */ 384 | CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11), 385 | 386 | /* a list of server types that are blacklisted from 387 | pipelining */ 388 | CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12), 389 | 390 | /* maximum number of open connections in total */ 391 | CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13), 392 | 393 | /* This is the server push callback function pointer */ 394 | CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14), 395 | 396 | /* This is the argument passed to the server push callback */ 397 | CINIT(PUSHDATA, OBJECTPOINT, 15), 398 | 399 | CURLMOPT_LASTENTRY /* the last unused */ 400 | } CURLMoption; 401 | 402 | 403 | /* 404 | * Name: curl_multi_setopt() 405 | * 406 | * Desc: Sets options for the multi handle. 407 | * 408 | * Returns: CURLM error code. 409 | */ 410 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, 411 | CURLMoption option, ...); 412 | 413 | 414 | /* 415 | * Name: curl_multi_assign() 416 | * 417 | * Desc: This function sets an association in the multi handle between the 418 | * given socket and a private pointer of the application. This is 419 | * (only) useful for curl_multi_socket uses. 420 | * 421 | * Returns: CURLM error code. 422 | */ 423 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, 424 | curl_socket_t sockfd, void *sockp); 425 | 426 | 427 | /* 428 | * Name: curl_push_callback 429 | * 430 | * Desc: This callback gets called when a new stream is being pushed by the 431 | * server. It approves or denies the new stream. 432 | * 433 | * Returns: CURL_PUSH_OK or CURL_PUSH_DENY. 434 | */ 435 | #define CURL_PUSH_OK 0 436 | #define CURL_PUSH_DENY 1 437 | 438 | struct curl_pushheaders; /* forward declaration only */ 439 | 440 | CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h, 441 | size_t num); 442 | CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h, 443 | const char *name); 444 | 445 | typedef int (*curl_push_callback)(CURL *parent, 446 | CURL *easy, 447 | size_t num_headers, 448 | struct curl_pushheaders *headers, 449 | void *userp); 450 | 451 | #ifdef __cplusplus 452 | } /* end of extern "C" */ 453 | #endif 454 | 455 | #endif 456 | -------------------------------------------------------------------------------- /CentOS/third/curl/include/curl/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDC_HEADERS_H 2 | #define __STDC_HEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | 27 | size_t fread(void *, size_t, size_t, FILE *); 28 | size_t fwrite(const void *, size_t, size_t, FILE *); 29 | 30 | int strcasecmp(const char *, const char *); 31 | int strncasecmp(const char *, const char *, size_t); 32 | 33 | #endif /* __STDC_HEADERS_H */ 34 | -------------------------------------------------------------------------------- /CentOS/third/curl/include/curl/system.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_SYSTEM_H 2 | #define __CURL_SYSTEM_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* 26 | * Try to keep one section per platform, compiler and architecture, otherwise, 27 | * if an existing section is reused for a different one and later on the 28 | * original is adjusted, probably the piggybacking one can be adversely 29 | * changed. 30 | * 31 | * In order to differentiate between platforms/compilers/architectures use 32 | * only compiler built in predefined preprocessor symbols. 33 | * 34 | * curl_off_t 35 | * ---------- 36 | * 37 | * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit 38 | * wide signed integral data type. The width of this data type must remain 39 | * constant and independent of any possible large file support settings. 40 | * 41 | * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit 42 | * wide signed integral data type if there is no 64-bit type. 43 | * 44 | * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall 45 | * only be violated if off_t is the only 64-bit data type available and the 46 | * size of off_t is independent of large file support settings. Keep your 47 | * build on the safe side avoiding an off_t gating. If you have a 64-bit 48 | * off_t then take for sure that another 64-bit data type exists, dig deeper 49 | * and you will find it. 50 | * 51 | */ 52 | 53 | #if defined(__DJGPP__) || defined(__GO32__) 54 | # if defined(__DJGPP__) && (__DJGPP__ > 1) 55 | # define CURL_TYPEOF_CURL_OFF_T long long 56 | # define CURL_FORMAT_CURL_OFF_T "lld" 57 | # define CURL_FORMAT_CURL_OFF_TU "llu" 58 | # define CURL_SUFFIX_CURL_OFF_T LL 59 | # define CURL_SUFFIX_CURL_OFF_TU ULL 60 | # else 61 | # define CURL_TYPEOF_CURL_OFF_T long 62 | # define CURL_FORMAT_CURL_OFF_T "ld" 63 | # define CURL_FORMAT_CURL_OFF_TU "lu" 64 | # define CURL_SUFFIX_CURL_OFF_T L 65 | # define CURL_SUFFIX_CURL_OFF_TU UL 66 | # endif 67 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 68 | 69 | #elif defined(__SALFORDC__) 70 | # define CURL_TYPEOF_CURL_OFF_T long 71 | # define CURL_FORMAT_CURL_OFF_T "ld" 72 | # define CURL_FORMAT_CURL_OFF_TU "lu" 73 | # define CURL_SUFFIX_CURL_OFF_T L 74 | # define CURL_SUFFIX_CURL_OFF_TU UL 75 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 76 | 77 | #elif defined(__BORLANDC__) 78 | # if (__BORLANDC__ < 0x520) 79 | # define CURL_TYPEOF_CURL_OFF_T long 80 | # define CURL_FORMAT_CURL_OFF_T "ld" 81 | # define CURL_FORMAT_CURL_OFF_TU "lu" 82 | # define CURL_SUFFIX_CURL_OFF_T L 83 | # define CURL_SUFFIX_CURL_OFF_TU UL 84 | # else 85 | # define CURL_TYPEOF_CURL_OFF_T __int64 86 | # define CURL_FORMAT_CURL_OFF_T "I64d" 87 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 88 | # define CURL_SUFFIX_CURL_OFF_T i64 89 | # define CURL_SUFFIX_CURL_OFF_TU ui64 90 | # endif 91 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 92 | 93 | #elif defined(__TURBOC__) 94 | # define CURL_TYPEOF_CURL_OFF_T long 95 | # define CURL_FORMAT_CURL_OFF_T "ld" 96 | # define CURL_FORMAT_CURL_OFF_TU "lu" 97 | # define CURL_SUFFIX_CURL_OFF_T L 98 | # define CURL_SUFFIX_CURL_OFF_TU UL 99 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 100 | 101 | #elif defined(__WATCOMC__) 102 | # if defined(__386__) 103 | # define CURL_TYPEOF_CURL_OFF_T __int64 104 | # define CURL_FORMAT_CURL_OFF_T "I64d" 105 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 106 | # define CURL_SUFFIX_CURL_OFF_T i64 107 | # define CURL_SUFFIX_CURL_OFF_TU ui64 108 | # else 109 | # define CURL_TYPEOF_CURL_OFF_T long 110 | # define CURL_FORMAT_CURL_OFF_T "ld" 111 | # define CURL_FORMAT_CURL_OFF_TU "lu" 112 | # define CURL_SUFFIX_CURL_OFF_T L 113 | # define CURL_SUFFIX_CURL_OFF_TU UL 114 | # endif 115 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 116 | 117 | #elif defined(__POCC__) 118 | # if (__POCC__ < 280) 119 | # define CURL_TYPEOF_CURL_OFF_T long 120 | # define CURL_FORMAT_CURL_OFF_T "ld" 121 | # define CURL_FORMAT_CURL_OFF_TU "lu" 122 | # define CURL_SUFFIX_CURL_OFF_T L 123 | # define CURL_SUFFIX_CURL_OFF_TU UL 124 | # elif defined(_MSC_VER) 125 | # define CURL_TYPEOF_CURL_OFF_T __int64 126 | # define CURL_FORMAT_CURL_OFF_T "I64d" 127 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 128 | # define CURL_SUFFIX_CURL_OFF_T i64 129 | # define CURL_SUFFIX_CURL_OFF_TU ui64 130 | # else 131 | # define CURL_TYPEOF_CURL_OFF_T long long 132 | # define CURL_FORMAT_CURL_OFF_T "lld" 133 | # define CURL_FORMAT_CURL_OFF_TU "llu" 134 | # define CURL_SUFFIX_CURL_OFF_T LL 135 | # define CURL_SUFFIX_CURL_OFF_TU ULL 136 | # endif 137 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 138 | 139 | #elif defined(__LCC__) 140 | # define CURL_TYPEOF_CURL_OFF_T long 141 | # define CURL_FORMAT_CURL_OFF_T "ld" 142 | # define CURL_FORMAT_CURL_OFF_TU "lu" 143 | # define CURL_SUFFIX_CURL_OFF_T L 144 | # define CURL_SUFFIX_CURL_OFF_TU UL 145 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 146 | 147 | #elif defined(__SYMBIAN32__) 148 | # if defined(__EABI__) /* Treat all ARM compilers equally */ 149 | # define CURL_TYPEOF_CURL_OFF_T long long 150 | # define CURL_FORMAT_CURL_OFF_T "lld" 151 | # define CURL_FORMAT_CURL_OFF_TU "llu" 152 | # define CURL_SUFFIX_CURL_OFF_T LL 153 | # define CURL_SUFFIX_CURL_OFF_TU ULL 154 | # elif defined(__CW32__) 155 | # pragma longlong on 156 | # define CURL_TYPEOF_CURL_OFF_T long long 157 | # define CURL_FORMAT_CURL_OFF_T "lld" 158 | # define CURL_FORMAT_CURL_OFF_TU "llu" 159 | # define CURL_SUFFIX_CURL_OFF_T LL 160 | # define CURL_SUFFIX_CURL_OFF_TU ULL 161 | # elif defined(__VC32__) 162 | # define CURL_TYPEOF_CURL_OFF_T __int64 163 | # define CURL_FORMAT_CURL_OFF_T "lld" 164 | # define CURL_FORMAT_CURL_OFF_TU "llu" 165 | # define CURL_SUFFIX_CURL_OFF_T LL 166 | # define CURL_SUFFIX_CURL_OFF_TU ULL 167 | # endif 168 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 169 | 170 | #elif defined(__MWERKS__) 171 | # define CURL_TYPEOF_CURL_OFF_T long long 172 | # define CURL_FORMAT_CURL_OFF_T "lld" 173 | # define CURL_FORMAT_CURL_OFF_TU "llu" 174 | # define CURL_SUFFIX_CURL_OFF_T LL 175 | # define CURL_SUFFIX_CURL_OFF_TU ULL 176 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 177 | 178 | #elif defined(_WIN32_WCE) 179 | # define CURL_TYPEOF_CURL_OFF_T __int64 180 | # define CURL_FORMAT_CURL_OFF_T "I64d" 181 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 182 | # define CURL_SUFFIX_CURL_OFF_T i64 183 | # define CURL_SUFFIX_CURL_OFF_TU ui64 184 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 185 | 186 | #elif defined(__MINGW32__) 187 | # define CURL_TYPEOF_CURL_OFF_T long long 188 | # define CURL_FORMAT_CURL_OFF_T "I64d" 189 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 190 | # define CURL_SUFFIX_CURL_OFF_T LL 191 | # define CURL_SUFFIX_CURL_OFF_TU ULL 192 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 193 | # define CURL_PULL_SYS_TYPES_H 1 194 | # define CURL_PULL_WS2TCPIP_H 1 195 | 196 | #elif defined(__VMS) 197 | # if defined(__VAX) 198 | # define CURL_TYPEOF_CURL_OFF_T long 199 | # define CURL_FORMAT_CURL_OFF_T "ld" 200 | # define CURL_FORMAT_CURL_OFF_TU "lu" 201 | # define CURL_SUFFIX_CURL_OFF_T L 202 | # define CURL_SUFFIX_CURL_OFF_TU UL 203 | # else 204 | # define CURL_TYPEOF_CURL_OFF_T long long 205 | # define CURL_FORMAT_CURL_OFF_T "lld" 206 | # define CURL_FORMAT_CURL_OFF_TU "llu" 207 | # define CURL_SUFFIX_CURL_OFF_T LL 208 | # define CURL_SUFFIX_CURL_OFF_TU ULL 209 | # endif 210 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int 211 | 212 | #elif defined(__OS400__) 213 | # if defined(__ILEC400__) 214 | # define CURL_TYPEOF_CURL_OFF_T long long 215 | # define CURL_FORMAT_CURL_OFF_T "lld" 216 | # define CURL_FORMAT_CURL_OFF_TU "llu" 217 | # define CURL_SUFFIX_CURL_OFF_T LL 218 | # define CURL_SUFFIX_CURL_OFF_TU ULL 219 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 220 | # define CURL_PULL_SYS_TYPES_H 1 221 | # define CURL_PULL_SYS_SOCKET_H 1 222 | # endif 223 | 224 | #elif defined(__MVS__) 225 | # if defined(__IBMC__) || defined(__IBMCPP__) 226 | # if defined(_ILP32) 227 | # elif defined(_LP64) 228 | # endif 229 | # if defined(_LONG_LONG) 230 | # define CURL_TYPEOF_CURL_OFF_T long long 231 | # define CURL_FORMAT_CURL_OFF_T "lld" 232 | # define CURL_FORMAT_CURL_OFF_TU "llu" 233 | # define CURL_SUFFIX_CURL_OFF_T LL 234 | # define CURL_SUFFIX_CURL_OFF_TU ULL 235 | # elif defined(_LP64) 236 | # define CURL_TYPEOF_CURL_OFF_T long 237 | # define CURL_FORMAT_CURL_OFF_T "ld" 238 | # define CURL_FORMAT_CURL_OFF_TU "lu" 239 | # define CURL_SUFFIX_CURL_OFF_T L 240 | # define CURL_SUFFIX_CURL_OFF_TU UL 241 | # else 242 | # define CURL_TYPEOF_CURL_OFF_T long 243 | # define CURL_FORMAT_CURL_OFF_T "ld" 244 | # define CURL_FORMAT_CURL_OFF_TU "lu" 245 | # define CURL_SUFFIX_CURL_OFF_T L 246 | # define CURL_SUFFIX_CURL_OFF_TU UL 247 | # endif 248 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 249 | # define CURL_PULL_SYS_TYPES_H 1 250 | # define CURL_PULL_SYS_SOCKET_H 1 251 | # endif 252 | 253 | #elif defined(__370__) 254 | # if defined(__IBMC__) || defined(__IBMCPP__) 255 | # if defined(_ILP32) 256 | # elif defined(_LP64) 257 | # endif 258 | # if defined(_LONG_LONG) 259 | # define CURL_TYPEOF_CURL_OFF_T long long 260 | # define CURL_FORMAT_CURL_OFF_T "lld" 261 | # define CURL_FORMAT_CURL_OFF_TU "llu" 262 | # define CURL_SUFFIX_CURL_OFF_T LL 263 | # define CURL_SUFFIX_CURL_OFF_TU ULL 264 | # elif defined(_LP64) 265 | # define CURL_TYPEOF_CURL_OFF_T long 266 | # define CURL_FORMAT_CURL_OFF_T "ld" 267 | # define CURL_FORMAT_CURL_OFF_TU "lu" 268 | # define CURL_SUFFIX_CURL_OFF_T L 269 | # define CURL_SUFFIX_CURL_OFF_TU UL 270 | # else 271 | # define CURL_TYPEOF_CURL_OFF_T long 272 | # define CURL_FORMAT_CURL_OFF_T "ld" 273 | # define CURL_FORMAT_CURL_OFF_TU "lu" 274 | # define CURL_SUFFIX_CURL_OFF_T L 275 | # define CURL_SUFFIX_CURL_OFF_TU UL 276 | # endif 277 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 278 | # define CURL_PULL_SYS_TYPES_H 1 279 | # define CURL_PULL_SYS_SOCKET_H 1 280 | # endif 281 | 282 | #elif defined(TPF) 283 | # define CURL_TYPEOF_CURL_OFF_T long 284 | # define CURL_FORMAT_CURL_OFF_T "ld" 285 | # define CURL_FORMAT_CURL_OFF_TU "lu" 286 | # define CURL_SUFFIX_CURL_OFF_T L 287 | # define CURL_SUFFIX_CURL_OFF_TU UL 288 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 289 | 290 | #elif defined(__TINYC__) /* also known as tcc */ 291 | 292 | # define CURL_TYPEOF_CURL_OFF_T long long 293 | # define CURL_FORMAT_CURL_OFF_T "lld" 294 | # define CURL_FORMAT_CURL_OFF_TU "llu" 295 | # define CURL_SUFFIX_CURL_OFF_T LL 296 | # define CURL_SUFFIX_CURL_OFF_TU ULL 297 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 298 | # define CURL_PULL_SYS_TYPES_H 1 299 | # define CURL_PULL_SYS_SOCKET_H 1 300 | 301 | #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */ 302 | # if !defined(__LP64) && (defined(__ILP32) || \ 303 | defined(__i386) || \ 304 | defined(__sparcv8) || \ 305 | defined(__sparcv8plus)) 306 | # define CURL_TYPEOF_CURL_OFF_T long long 307 | # define CURL_FORMAT_CURL_OFF_T "lld" 308 | # define CURL_FORMAT_CURL_OFF_TU "llu" 309 | # define CURL_SUFFIX_CURL_OFF_T LL 310 | # define CURL_SUFFIX_CURL_OFF_TU ULL 311 | # elif defined(__LP64) || \ 312 | defined(__amd64) || defined(__sparcv9) 313 | # define CURL_TYPEOF_CURL_OFF_T long 314 | # define CURL_FORMAT_CURL_OFF_T "ld" 315 | # define CURL_FORMAT_CURL_OFF_TU "lu" 316 | # define CURL_SUFFIX_CURL_OFF_T L 317 | # define CURL_SUFFIX_CURL_OFF_TU UL 318 | # endif 319 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 320 | # define CURL_PULL_SYS_TYPES_H 1 321 | # define CURL_PULL_SYS_SOCKET_H 1 322 | 323 | #elif defined(__xlc__) /* IBM xlc compiler */ 324 | # if !defined(_LP64) 325 | # define CURL_TYPEOF_CURL_OFF_T long long 326 | # define CURL_FORMAT_CURL_OFF_T "lld" 327 | # define CURL_FORMAT_CURL_OFF_TU "llu" 328 | # define CURL_SUFFIX_CURL_OFF_T LL 329 | # define CURL_SUFFIX_CURL_OFF_TU ULL 330 | # else 331 | # define CURL_TYPEOF_CURL_OFF_T long 332 | # define CURL_FORMAT_CURL_OFF_T "ld" 333 | # define CURL_FORMAT_CURL_OFF_TU "lu" 334 | # define CURL_SUFFIX_CURL_OFF_T L 335 | # define CURL_SUFFIX_CURL_OFF_TU UL 336 | # endif 337 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 338 | # define CURL_PULL_SYS_TYPES_H 1 339 | # define CURL_PULL_SYS_SOCKET_H 1 340 | 341 | /* ===================================== */ 342 | /* KEEP MSVC THE PENULTIMATE ENTRY */ 343 | /* ===================================== */ 344 | 345 | #elif defined(_MSC_VER) 346 | # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) 347 | # define CURL_TYPEOF_CURL_OFF_T __int64 348 | # define CURL_FORMAT_CURL_OFF_T "I64d" 349 | # define CURL_FORMAT_CURL_OFF_TU "I64u" 350 | # define CURL_SUFFIX_CURL_OFF_T i64 351 | # define CURL_SUFFIX_CURL_OFF_TU ui64 352 | # else 353 | # define CURL_TYPEOF_CURL_OFF_T long 354 | # define CURL_FORMAT_CURL_OFF_T "ld" 355 | # define CURL_FORMAT_CURL_OFF_TU "lu" 356 | # define CURL_SUFFIX_CURL_OFF_T L 357 | # define CURL_SUFFIX_CURL_OFF_TU UL 358 | # endif 359 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 360 | 361 | /* ===================================== */ 362 | /* KEEP GENERIC GCC THE LAST ENTRY */ 363 | /* ===================================== */ 364 | 365 | #elif defined(__GNUC__) && !defined(_SCO_DS) 366 | # if !defined(__LP64__) && \ 367 | (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \ 368 | defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \ 369 | defined(__sparc__) || defined(__mips__) || defined(__sh__) || \ 370 | defined(__XTENSA__) || \ 371 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \ 372 | (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L)) 373 | # define CURL_TYPEOF_CURL_OFF_T long long 374 | # define CURL_FORMAT_CURL_OFF_T "lld" 375 | # define CURL_FORMAT_CURL_OFF_TU "llu" 376 | # define CURL_SUFFIX_CURL_OFF_T LL 377 | # define CURL_SUFFIX_CURL_OFF_TU ULL 378 | # elif defined(__LP64__) || \ 379 | defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ 380 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \ 381 | (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L) 382 | # define CURL_TYPEOF_CURL_OFF_T long 383 | # define CURL_FORMAT_CURL_OFF_T "ld" 384 | # define CURL_FORMAT_CURL_OFF_TU "lu" 385 | # define CURL_SUFFIX_CURL_OFF_T L 386 | # define CURL_SUFFIX_CURL_OFF_TU UL 387 | # endif 388 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t 389 | # define CURL_PULL_SYS_TYPES_H 1 390 | # define CURL_PULL_SYS_SOCKET_H 1 391 | 392 | #else 393 | /* generic "safe guess" on old 32 bit style */ 394 | # define CURL_TYPEOF_CURL_OFF_T long 395 | # define CURL_FORMAT_CURL_OFF_T "ld" 396 | # define CURL_FORMAT_CURL_OFF_TU "lu" 397 | # define CURL_SUFFIX_CURL_OFF_T L 398 | # define CURL_SUFFIX_CURL_OFF_TU UL 399 | # define CURL_TYPEOF_CURL_SOCKLEN_T int 400 | #endif 401 | 402 | #ifdef _AIX 403 | /* AIX needs */ 404 | #define CURL_PULL_SYS_POLL_H 405 | #endif 406 | 407 | 408 | /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */ 409 | /* ws2tcpip.h is required here to properly make type definitions below. */ 410 | #ifdef CURL_PULL_WS2TCPIP_H 411 | # include 412 | # include 413 | # include 414 | #endif 415 | 416 | /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */ 417 | /* sys/types.h is required here to properly make type definitions below. */ 418 | #ifdef CURL_PULL_SYS_TYPES_H 419 | # include 420 | #endif 421 | 422 | /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ 423 | /* sys/socket.h is required here to properly make type definitions below. */ 424 | #ifdef CURL_PULL_SYS_SOCKET_H 425 | # include 426 | #endif 427 | 428 | /* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */ 429 | /* sys/poll.h is required here to properly make type definitions below. */ 430 | #ifdef CURL_PULL_SYS_POLL_H 431 | # include 432 | #endif 433 | 434 | /* Data type definition of curl_socklen_t. */ 435 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T 436 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; 437 | #endif 438 | 439 | /* Data type definition of curl_off_t. */ 440 | 441 | #ifdef CURL_TYPEOF_CURL_OFF_T 442 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; 443 | #endif 444 | 445 | /* 446 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow 447 | * these to be visible and exported by the external libcurl interface API, 448 | * while also making them visible to the library internals, simply including 449 | * curl_setup.h, without actually needing to include curl.h internally. 450 | * If some day this section would grow big enough, all this should be moved 451 | * to its own header file. 452 | */ 453 | 454 | /* 455 | * Figure out if we can use the ## preprocessor operator, which is supported 456 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ 457 | * or __cplusplus so we need to carefully check for them too. 458 | */ 459 | 460 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ 461 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ 462 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ 463 | defined(__ILEC400__) 464 | /* This compiler is believed to have an ISO compatible preprocessor */ 465 | #define CURL_ISOCPP 466 | #else 467 | /* This compiler is believed NOT to have an ISO compatible preprocessor */ 468 | #undef CURL_ISOCPP 469 | #endif 470 | 471 | /* 472 | * Macros for minimum-width signed and unsigned curl_off_t integer constants. 473 | */ 474 | 475 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) 476 | # define __CURL_OFF_T_C_HLPR2(x) x 477 | # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) 478 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ 479 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) 480 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ 481 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) 482 | #else 483 | # ifdef CURL_ISOCPP 484 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix 485 | # else 486 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix 487 | # endif 488 | # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) 489 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) 490 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) 491 | #endif 492 | 493 | #endif /* __CURL_SYSTEM_H */ 494 | -------------------------------------------------------------------------------- /CentOS/third/curl/include/curl/typecheck-gcc.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_TYPECHECK_GCC_H 2 | #define __CURL_TYPECHECK_GCC_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* wraps curl_easy_setopt() with typechecking */ 26 | 27 | /* To add a new kind of warning, add an 28 | * if(_curl_is_sometype_option(_curl_opt)) 29 | * if(!_curl_is_sometype(value)) 30 | * _curl_easy_setopt_err_sometype(); 31 | * block and define _curl_is_sometype_option, _curl_is_sometype and 32 | * _curl_easy_setopt_err_sometype below 33 | * 34 | * NOTE: We use two nested 'if' statements here instead of the && operator, in 35 | * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x 36 | * when compiling with -Wlogical-op. 37 | * 38 | * To add an option that uses the same type as an existing option, you'll just 39 | * need to extend the appropriate _curl_*_option macro 40 | */ 41 | #define curl_easy_setopt(handle, option, value) \ 42 | __extension__ ({ \ 43 | __typeof__(option) _curl_opt = option; \ 44 | if(__builtin_constant_p(_curl_opt)) { \ 45 | if(_curl_is_long_option(_curl_opt)) \ 46 | if(!_curl_is_long(value)) \ 47 | _curl_easy_setopt_err_long(); \ 48 | if(_curl_is_off_t_option(_curl_opt)) \ 49 | if(!_curl_is_off_t(value)) \ 50 | _curl_easy_setopt_err_curl_off_t(); \ 51 | if(_curl_is_string_option(_curl_opt)) \ 52 | if(!_curl_is_string(value)) \ 53 | _curl_easy_setopt_err_string(); \ 54 | if(_curl_is_write_cb_option(_curl_opt)) \ 55 | if(!_curl_is_write_cb(value)) \ 56 | _curl_easy_setopt_err_write_callback(); \ 57 | if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \ 58 | if(!_curl_is_resolver_start_callback(value)) \ 59 | _curl_easy_setopt_err_resolver_start_callback(); \ 60 | if((_curl_opt) == CURLOPT_READFUNCTION) \ 61 | if(!_curl_is_read_cb(value)) \ 62 | _curl_easy_setopt_err_read_cb(); \ 63 | if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ 64 | if(!_curl_is_ioctl_cb(value)) \ 65 | _curl_easy_setopt_err_ioctl_cb(); \ 66 | if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ 67 | if(!_curl_is_sockopt_cb(value)) \ 68 | _curl_easy_setopt_err_sockopt_cb(); \ 69 | if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ 70 | if(!_curl_is_opensocket_cb(value)) \ 71 | _curl_easy_setopt_err_opensocket_cb(); \ 72 | if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ 73 | if(!_curl_is_progress_cb(value)) \ 74 | _curl_easy_setopt_err_progress_cb(); \ 75 | if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ 76 | if(!_curl_is_debug_cb(value)) \ 77 | _curl_easy_setopt_err_debug_cb(); \ 78 | if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ 79 | if(!_curl_is_ssl_ctx_cb(value)) \ 80 | _curl_easy_setopt_err_ssl_ctx_cb(); \ 81 | if(_curl_is_conv_cb_option(_curl_opt)) \ 82 | if(!_curl_is_conv_cb(value)) \ 83 | _curl_easy_setopt_err_conv_cb(); \ 84 | if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ 85 | if(!_curl_is_seek_cb(value)) \ 86 | _curl_easy_setopt_err_seek_cb(); \ 87 | if(_curl_is_cb_data_option(_curl_opt)) \ 88 | if(!_curl_is_cb_data(value)) \ 89 | _curl_easy_setopt_err_cb_data(); \ 90 | if((_curl_opt) == CURLOPT_ERRORBUFFER) \ 91 | if(!_curl_is_error_buffer(value)) \ 92 | _curl_easy_setopt_err_error_buffer(); \ 93 | if((_curl_opt) == CURLOPT_STDERR) \ 94 | if(!_curl_is_FILE(value)) \ 95 | _curl_easy_setopt_err_FILE(); \ 96 | if(_curl_is_postfields_option(_curl_opt)) \ 97 | if(!_curl_is_postfields(value)) \ 98 | _curl_easy_setopt_err_postfields(); \ 99 | if((_curl_opt) == CURLOPT_HTTPPOST) \ 100 | if(!_curl_is_arr((value), struct curl_httppost)) \ 101 | _curl_easy_setopt_err_curl_httpost(); \ 102 | if((_curl_opt) == CURLOPT_MIMEPOST) \ 103 | if(!_curl_is_ptr((value), curl_mime)) \ 104 | _curl_easy_setopt_err_curl_mimepost(); \ 105 | if(_curl_is_slist_option(_curl_opt)) \ 106 | if(!_curl_is_arr((value), struct curl_slist)) \ 107 | _curl_easy_setopt_err_curl_slist(); \ 108 | if((_curl_opt) == CURLOPT_SHARE) \ 109 | if(!_curl_is_ptr((value), CURLSH)) \ 110 | _curl_easy_setopt_err_CURLSH(); \ 111 | } \ 112 | curl_easy_setopt(handle, _curl_opt, value); \ 113 | }) 114 | 115 | /* wraps curl_easy_getinfo() with typechecking */ 116 | #define curl_easy_getinfo(handle, info, arg) \ 117 | __extension__ ({ \ 118 | __typeof__(info) _curl_info = info; \ 119 | if(__builtin_constant_p(_curl_info)) { \ 120 | if(_curl_is_string_info(_curl_info)) \ 121 | if(!_curl_is_arr((arg), char *)) \ 122 | _curl_easy_getinfo_err_string(); \ 123 | if(_curl_is_long_info(_curl_info)) \ 124 | if(!_curl_is_arr((arg), long)) \ 125 | _curl_easy_getinfo_err_long(); \ 126 | if(_curl_is_double_info(_curl_info)) \ 127 | if(!_curl_is_arr((arg), double)) \ 128 | _curl_easy_getinfo_err_double(); \ 129 | if(_curl_is_slist_info(_curl_info)) \ 130 | if(!_curl_is_arr((arg), struct curl_slist *)) \ 131 | _curl_easy_getinfo_err_curl_slist(); \ 132 | if(_curl_is_tlssessioninfo_info(_curl_info)) \ 133 | if(!_curl_is_arr((arg), struct curl_tlssessioninfo *)) \ 134 | _curl_easy_getinfo_err_curl_tlssesssioninfo(); \ 135 | if(_curl_is_certinfo_info(_curl_info)) \ 136 | if(!_curl_is_arr((arg), struct curl_certinfo *)) \ 137 | _curl_easy_getinfo_err_curl_certinfo(); \ 138 | if(_curl_is_socket_info(_curl_info)) \ 139 | if(!_curl_is_arr((arg), curl_socket_t)) \ 140 | _curl_easy_getinfo_err_curl_socket(); \ 141 | if(_curl_is_off_t_info(_curl_info)) \ 142 | if(!_curl_is_arr((arg), curl_off_t)) \ 143 | _curl_easy_getinfo_err_curl_off_t(); \ 144 | } \ 145 | curl_easy_getinfo(handle, _curl_info, arg); \ 146 | }) 147 | 148 | /* 149 | * For now, just make sure that the functions are called with three arguments 150 | */ 151 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) 152 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) 153 | 154 | 155 | /* the actual warnings, triggered by calling the _curl_easy_setopt_err* 156 | * functions */ 157 | 158 | /* To define a new warning, use _CURL_WARNING(identifier, "message") */ 159 | #define _CURL_WARNING(id, message) \ 160 | static void __attribute__((__warning__(message))) \ 161 | __attribute__((__unused__)) __attribute__((__noinline__)) \ 162 | id(void) { __asm__(""); } 163 | 164 | _CURL_WARNING(_curl_easy_setopt_err_long, 165 | "curl_easy_setopt expects a long argument for this option") 166 | _CURL_WARNING(_curl_easy_setopt_err_curl_off_t, 167 | "curl_easy_setopt expects a curl_off_t argument for this option") 168 | _CURL_WARNING(_curl_easy_setopt_err_string, 169 | "curl_easy_setopt expects a " 170 | "string ('char *' or char[]) argument for this option" 171 | ) 172 | _CURL_WARNING(_curl_easy_setopt_err_write_callback, 173 | "curl_easy_setopt expects a curl_write_callback argument for this option") 174 | _CURL_WARNING(_curl_easy_setopt_err_resolver_start_callback, 175 | "curl_easy_setopt expects a " 176 | "curl_resolver_start_callback argument for this option" 177 | ) 178 | _CURL_WARNING(_curl_easy_setopt_err_read_cb, 179 | "curl_easy_setopt expects a curl_read_callback argument for this option") 180 | _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb, 181 | "curl_easy_setopt expects a curl_ioctl_callback argument for this option") 182 | _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb, 183 | "curl_easy_setopt expects a curl_sockopt_callback argument for this option") 184 | _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb, 185 | "curl_easy_setopt expects a " 186 | "curl_opensocket_callback argument for this option" 187 | ) 188 | _CURL_WARNING(_curl_easy_setopt_err_progress_cb, 189 | "curl_easy_setopt expects a curl_progress_callback argument for this option") 190 | _CURL_WARNING(_curl_easy_setopt_err_debug_cb, 191 | "curl_easy_setopt expects a curl_debug_callback argument for this option") 192 | _CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb, 193 | "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") 194 | _CURL_WARNING(_curl_easy_setopt_err_conv_cb, 195 | "curl_easy_setopt expects a curl_conv_callback argument for this option") 196 | _CURL_WARNING(_curl_easy_setopt_err_seek_cb, 197 | "curl_easy_setopt expects a curl_seek_callback argument for this option") 198 | _CURL_WARNING(_curl_easy_setopt_err_cb_data, 199 | "curl_easy_setopt expects a " 200 | "private data pointer as argument for this option") 201 | _CURL_WARNING(_curl_easy_setopt_err_error_buffer, 202 | "curl_easy_setopt expects a " 203 | "char buffer of CURL_ERROR_SIZE as argument for this option") 204 | _CURL_WARNING(_curl_easy_setopt_err_FILE, 205 | "curl_easy_setopt expects a 'FILE *' argument for this option") 206 | _CURL_WARNING(_curl_easy_setopt_err_postfields, 207 | "curl_easy_setopt expects a 'void *' or 'char *' argument for this option") 208 | _CURL_WARNING(_curl_easy_setopt_err_curl_httpost, 209 | "curl_easy_setopt expects a 'struct curl_httppost *' " 210 | "argument for this option") 211 | _CURL_WARNING(_curl_easy_setopt_err_curl_mimepost, 212 | "curl_easy_setopt expects a 'curl_mime *' " 213 | "argument for this option") 214 | _CURL_WARNING(_curl_easy_setopt_err_curl_slist, 215 | "curl_easy_setopt expects a 'struct curl_slist *' argument for this option") 216 | _CURL_WARNING(_curl_easy_setopt_err_CURLSH, 217 | "curl_easy_setopt expects a CURLSH* argument for this option") 218 | 219 | _CURL_WARNING(_curl_easy_getinfo_err_string, 220 | "curl_easy_getinfo expects a pointer to 'char *' for this info") 221 | _CURL_WARNING(_curl_easy_getinfo_err_long, 222 | "curl_easy_getinfo expects a pointer to long for this info") 223 | _CURL_WARNING(_curl_easy_getinfo_err_double, 224 | "curl_easy_getinfo expects a pointer to double for this info") 225 | _CURL_WARNING(_curl_easy_getinfo_err_curl_slist, 226 | "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info") 227 | _CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo, 228 | "curl_easy_getinfo expects a pointer to " 229 | "'struct curl_tlssessioninfo *' for this info") 230 | _CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo, 231 | "curl_easy_getinfo expects a pointer to " 232 | "'struct curl_certinfo *' for this info") 233 | _CURL_WARNING(_curl_easy_getinfo_err_curl_socket, 234 | "curl_easy_getinfo expects a pointer to curl_socket_t for this info") 235 | _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t, 236 | "curl_easy_getinfo expects a pointer to curl_off_t for this info") 237 | 238 | /* groups of curl_easy_setops options that take the same type of argument */ 239 | 240 | /* To add a new option to one of the groups, just add 241 | * (option) == CURLOPT_SOMETHING 242 | * to the or-expression. If the option takes a long or curl_off_t, you don't 243 | * have to do anything 244 | */ 245 | 246 | /* evaluates to true if option takes a long argument */ 247 | #define _curl_is_long_option(option) \ 248 | (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) 249 | 250 | #define _curl_is_off_t_option(option) \ 251 | ((option) > CURLOPTTYPE_OFF_T) 252 | 253 | /* evaluates to true if option takes a char* argument */ 254 | #define _curl_is_string_option(option) \ 255 | ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \ 256 | (option) == CURLOPT_ACCEPT_ENCODING || \ 257 | (option) == CURLOPT_ALTSVC || \ 258 | (option) == CURLOPT_CAINFO || \ 259 | (option) == CURLOPT_CAPATH || \ 260 | (option) == CURLOPT_COOKIE || \ 261 | (option) == CURLOPT_COOKIEFILE || \ 262 | (option) == CURLOPT_COOKIEJAR || \ 263 | (option) == CURLOPT_COOKIELIST || \ 264 | (option) == CURLOPT_CRLFILE || \ 265 | (option) == CURLOPT_CUSTOMREQUEST || \ 266 | (option) == CURLOPT_DEFAULT_PROTOCOL || \ 267 | (option) == CURLOPT_DNS_INTERFACE || \ 268 | (option) == CURLOPT_DNS_LOCAL_IP4 || \ 269 | (option) == CURLOPT_DNS_LOCAL_IP6 || \ 270 | (option) == CURLOPT_DNS_SERVERS || \ 271 | (option) == CURLOPT_DOH_URL || \ 272 | (option) == CURLOPT_EGDSOCKET || \ 273 | (option) == CURLOPT_FTPPORT || \ 274 | (option) == CURLOPT_FTP_ACCOUNT || \ 275 | (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ 276 | (option) == CURLOPT_INTERFACE || \ 277 | (option) == CURLOPT_ISSUERCERT || \ 278 | (option) == CURLOPT_KEYPASSWD || \ 279 | (option) == CURLOPT_KRBLEVEL || \ 280 | (option) == CURLOPT_LOGIN_OPTIONS || \ 281 | (option) == CURLOPT_MAIL_AUTH || \ 282 | (option) == CURLOPT_MAIL_FROM || \ 283 | (option) == CURLOPT_NETRC_FILE || \ 284 | (option) == CURLOPT_NOPROXY || \ 285 | (option) == CURLOPT_PASSWORD || \ 286 | (option) == CURLOPT_PINNEDPUBLICKEY || \ 287 | (option) == CURLOPT_PRE_PROXY || \ 288 | (option) == CURLOPT_PROXY || \ 289 | (option) == CURLOPT_PROXYPASSWORD || \ 290 | (option) == CURLOPT_PROXYUSERNAME || \ 291 | (option) == CURLOPT_PROXYUSERPWD || \ 292 | (option) == CURLOPT_PROXY_CAINFO || \ 293 | (option) == CURLOPT_PROXY_CAPATH || \ 294 | (option) == CURLOPT_PROXY_CRLFILE || \ 295 | (option) == CURLOPT_PROXY_KEYPASSWD || \ 296 | (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \ 297 | (option) == CURLOPT_PROXY_SERVICE_NAME || \ 298 | (option) == CURLOPT_PROXY_SSLCERT || \ 299 | (option) == CURLOPT_PROXY_SSLCERTTYPE || \ 300 | (option) == CURLOPT_PROXY_SSLKEY || \ 301 | (option) == CURLOPT_PROXY_SSLKEYTYPE || \ 302 | (option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \ 303 | (option) == CURLOPT_PROXY_TLS13_CIPHERS || \ 304 | (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \ 305 | (option) == CURLOPT_PROXY_TLSAUTH_TYPE || \ 306 | (option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \ 307 | (option) == CURLOPT_RANDOM_FILE || \ 308 | (option) == CURLOPT_RANGE || \ 309 | (option) == CURLOPT_REFERER || \ 310 | (option) == CURLOPT_REQUEST_TARGET || \ 311 | (option) == CURLOPT_RTSP_SESSION_ID || \ 312 | (option) == CURLOPT_RTSP_STREAM_URI || \ 313 | (option) == CURLOPT_RTSP_TRANSPORT || \ 314 | (option) == CURLOPT_SASL_AUTHZID || \ 315 | (option) == CURLOPT_SERVICE_NAME || \ 316 | (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ 317 | (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ 318 | (option) == CURLOPT_SSH_KNOWNHOSTS || \ 319 | (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ 320 | (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ 321 | (option) == CURLOPT_SSLCERT || \ 322 | (option) == CURLOPT_SSLCERTTYPE || \ 323 | (option) == CURLOPT_SSLENGINE || \ 324 | (option) == CURLOPT_SSLKEY || \ 325 | (option) == CURLOPT_SSLKEYTYPE || \ 326 | (option) == CURLOPT_SSL_CIPHER_LIST || \ 327 | (option) == CURLOPT_TLS13_CIPHERS || \ 328 | (option) == CURLOPT_TLSAUTH_PASSWORD || \ 329 | (option) == CURLOPT_TLSAUTH_TYPE || \ 330 | (option) == CURLOPT_TLSAUTH_USERNAME || \ 331 | (option) == CURLOPT_UNIX_SOCKET_PATH || \ 332 | (option) == CURLOPT_URL || \ 333 | (option) == CURLOPT_USERAGENT || \ 334 | (option) == CURLOPT_USERNAME || \ 335 | (option) == CURLOPT_USERPWD || \ 336 | (option) == CURLOPT_XOAUTH2_BEARER || \ 337 | 0) 338 | 339 | /* evaluates to true if option takes a curl_write_callback argument */ 340 | #define _curl_is_write_cb_option(option) \ 341 | ((option) == CURLOPT_HEADERFUNCTION || \ 342 | (option) == CURLOPT_WRITEFUNCTION) 343 | 344 | /* evaluates to true if option takes a curl_conv_callback argument */ 345 | #define _curl_is_conv_cb_option(option) \ 346 | ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ 347 | (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ 348 | (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) 349 | 350 | /* evaluates to true if option takes a data argument to pass to a callback */ 351 | #define _curl_is_cb_data_option(option) \ 352 | ((option) == CURLOPT_CHUNK_DATA || \ 353 | (option) == CURLOPT_CLOSESOCKETDATA || \ 354 | (option) == CURLOPT_DEBUGDATA || \ 355 | (option) == CURLOPT_FNMATCH_DATA || \ 356 | (option) == CURLOPT_HEADERDATA || \ 357 | (option) == CURLOPT_INTERLEAVEDATA || \ 358 | (option) == CURLOPT_IOCTLDATA || \ 359 | (option) == CURLOPT_OPENSOCKETDATA || \ 360 | (option) == CURLOPT_PRIVATE || \ 361 | (option) == CURLOPT_PROGRESSDATA || \ 362 | (option) == CURLOPT_READDATA || \ 363 | (option) == CURLOPT_SEEKDATA || \ 364 | (option) == CURLOPT_SOCKOPTDATA || \ 365 | (option) == CURLOPT_SSH_KEYDATA || \ 366 | (option) == CURLOPT_SSL_CTX_DATA || \ 367 | (option) == CURLOPT_WRITEDATA || \ 368 | (option) == CURLOPT_RESOLVER_START_DATA || \ 369 | (option) == CURLOPT_TRAILERDATA || \ 370 | 0) 371 | 372 | /* evaluates to true if option takes a POST data argument (void* or char*) */ 373 | #define _curl_is_postfields_option(option) \ 374 | ((option) == CURLOPT_POSTFIELDS || \ 375 | (option) == CURLOPT_COPYPOSTFIELDS || \ 376 | 0) 377 | 378 | /* evaluates to true if option takes a struct curl_slist * argument */ 379 | #define _curl_is_slist_option(option) \ 380 | ((option) == CURLOPT_HTTP200ALIASES || \ 381 | (option) == CURLOPT_HTTPHEADER || \ 382 | (option) == CURLOPT_MAIL_RCPT || \ 383 | (option) == CURLOPT_POSTQUOTE || \ 384 | (option) == CURLOPT_PREQUOTE || \ 385 | (option) == CURLOPT_PROXYHEADER || \ 386 | (option) == CURLOPT_QUOTE || \ 387 | (option) == CURLOPT_RESOLVE || \ 388 | (option) == CURLOPT_TELNETOPTIONS || \ 389 | (option) == CURLOPT_CONNECT_TO || \ 390 | 0) 391 | 392 | /* groups of curl_easy_getinfo infos that take the same type of argument */ 393 | 394 | /* evaluates to true if info expects a pointer to char * argument */ 395 | #define _curl_is_string_info(info) \ 396 | (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG) 397 | 398 | /* evaluates to true if info expects a pointer to long argument */ 399 | #define _curl_is_long_info(info) \ 400 | (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) 401 | 402 | /* evaluates to true if info expects a pointer to double argument */ 403 | #define _curl_is_double_info(info) \ 404 | (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) 405 | 406 | /* true if info expects a pointer to struct curl_slist * argument */ 407 | #define _curl_is_slist_info(info) \ 408 | (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST)) 409 | 410 | /* true if info expects a pointer to struct curl_tlssessioninfo * argument */ 411 | #define _curl_is_tlssessioninfo_info(info) \ 412 | (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION)) 413 | 414 | /* true if info expects a pointer to struct curl_certinfo * argument */ 415 | #define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO) 416 | 417 | /* true if info expects a pointer to struct curl_socket_t argument */ 418 | #define _curl_is_socket_info(info) \ 419 | (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T) 420 | 421 | /* true if info expects a pointer to curl_off_t argument */ 422 | #define _curl_is_off_t_info(info) \ 423 | (CURLINFO_OFF_T < (info)) 424 | 425 | 426 | /* typecheck helpers -- check whether given expression has requested type*/ 427 | 428 | /* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros, 429 | * otherwise define a new macro. Search for __builtin_types_compatible_p 430 | * in the GCC manual. 431 | * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is 432 | * the actual expression passed to the curl_easy_setopt macro. This 433 | * means that you can only apply the sizeof and __typeof__ operators, no 434 | * == or whatsoever. 435 | */ 436 | 437 | /* XXX: should evaluate to true if expr is a pointer */ 438 | #define _curl_is_any_ptr(expr) \ 439 | (sizeof(expr) == sizeof(void *)) 440 | 441 | /* evaluates to true if expr is NULL */ 442 | /* XXX: must not evaluate expr, so this check is not accurate */ 443 | #define _curl_is_NULL(expr) \ 444 | (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) 445 | 446 | /* evaluates to true if expr is type*, const type* or NULL */ 447 | #define _curl_is_ptr(expr, type) \ 448 | (_curl_is_NULL(expr) || \ 449 | __builtin_types_compatible_p(__typeof__(expr), type *) || \ 450 | __builtin_types_compatible_p(__typeof__(expr), const type *)) 451 | 452 | /* evaluates to true if expr is one of type[], type*, NULL or const type* */ 453 | #define _curl_is_arr(expr, type) \ 454 | (_curl_is_ptr((expr), type) || \ 455 | __builtin_types_compatible_p(__typeof__(expr), type [])) 456 | 457 | /* evaluates to true if expr is a string */ 458 | #define _curl_is_string(expr) \ 459 | (_curl_is_arr((expr), char) || \ 460 | _curl_is_arr((expr), signed char) || \ 461 | _curl_is_arr((expr), unsigned char)) 462 | 463 | /* evaluates to true if expr is a long (no matter the signedness) 464 | * XXX: for now, int is also accepted (and therefore short and char, which 465 | * are promoted to int when passed to a variadic function) */ 466 | #define _curl_is_long(expr) \ 467 | (__builtin_types_compatible_p(__typeof__(expr), long) || \ 468 | __builtin_types_compatible_p(__typeof__(expr), signed long) || \ 469 | __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ 470 | __builtin_types_compatible_p(__typeof__(expr), int) || \ 471 | __builtin_types_compatible_p(__typeof__(expr), signed int) || \ 472 | __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \ 473 | __builtin_types_compatible_p(__typeof__(expr), short) || \ 474 | __builtin_types_compatible_p(__typeof__(expr), signed short) || \ 475 | __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \ 476 | __builtin_types_compatible_p(__typeof__(expr), char) || \ 477 | __builtin_types_compatible_p(__typeof__(expr), signed char) || \ 478 | __builtin_types_compatible_p(__typeof__(expr), unsigned char)) 479 | 480 | /* evaluates to true if expr is of type curl_off_t */ 481 | #define _curl_is_off_t(expr) \ 482 | (__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) 483 | 484 | /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ 485 | /* XXX: also check size of an char[] array? */ 486 | #define _curl_is_error_buffer(expr) \ 487 | (_curl_is_NULL(expr) || \ 488 | __builtin_types_compatible_p(__typeof__(expr), char *) || \ 489 | __builtin_types_compatible_p(__typeof__(expr), char[])) 490 | 491 | /* evaluates to true if expr is of type (const) void* or (const) FILE* */ 492 | #if 0 493 | #define _curl_is_cb_data(expr) \ 494 | (_curl_is_ptr((expr), void) || \ 495 | _curl_is_ptr((expr), FILE)) 496 | #else /* be less strict */ 497 | #define _curl_is_cb_data(expr) \ 498 | _curl_is_any_ptr(expr) 499 | #endif 500 | 501 | /* evaluates to true if expr is of type FILE* */ 502 | #define _curl_is_FILE(expr) \ 503 | (_curl_is_NULL(expr) || \ 504 | (__builtin_types_compatible_p(__typeof__(expr), FILE *))) 505 | 506 | /* evaluates to true if expr can be passed as POST data (void* or char*) */ 507 | #define _curl_is_postfields(expr) \ 508 | (_curl_is_ptr((expr), void) || \ 509 | _curl_is_arr((expr), char) || \ 510 | _curl_is_arr((expr), unsigned char)) 511 | 512 | /* helper: __builtin_types_compatible_p distinguishes between functions and 513 | * function pointers, hide it */ 514 | #define _curl_callback_compatible(func, type) \ 515 | (__builtin_types_compatible_p(__typeof__(func), type) || \ 516 | __builtin_types_compatible_p(__typeof__(func) *, type)) 517 | 518 | /* evaluates to true if expr is of type curl_resolver_start_callback */ 519 | #define _curl_is_resolver_start_callback(expr) \ 520 | (_curl_is_NULL(expr) || \ 521 | _curl_callback_compatible((expr), curl_resolver_start_callback)) 522 | 523 | /* evaluates to true if expr is of type curl_read_callback or "similar" */ 524 | #define _curl_is_read_cb(expr) \ 525 | (_curl_is_NULL(expr) || \ 526 | _curl_callback_compatible((expr), __typeof__(fread) *) || \ 527 | _curl_callback_compatible((expr), curl_read_callback) || \ 528 | _curl_callback_compatible((expr), _curl_read_callback1) || \ 529 | _curl_callback_compatible((expr), _curl_read_callback2) || \ 530 | _curl_callback_compatible((expr), _curl_read_callback3) || \ 531 | _curl_callback_compatible((expr), _curl_read_callback4) || \ 532 | _curl_callback_compatible((expr), _curl_read_callback5) || \ 533 | _curl_callback_compatible((expr), _curl_read_callback6)) 534 | typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *); 535 | typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *); 536 | typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *); 537 | typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *); 538 | typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *); 539 | typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *); 540 | 541 | /* evaluates to true if expr is of type curl_write_callback or "similar" */ 542 | #define _curl_is_write_cb(expr) \ 543 | (_curl_is_read_cb(expr) || \ 544 | _curl_callback_compatible((expr), __typeof__(fwrite) *) || \ 545 | _curl_callback_compatible((expr), curl_write_callback) || \ 546 | _curl_callback_compatible((expr), _curl_write_callback1) || \ 547 | _curl_callback_compatible((expr), _curl_write_callback2) || \ 548 | _curl_callback_compatible((expr), _curl_write_callback3) || \ 549 | _curl_callback_compatible((expr), _curl_write_callback4) || \ 550 | _curl_callback_compatible((expr), _curl_write_callback5) || \ 551 | _curl_callback_compatible((expr), _curl_write_callback6)) 552 | typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *); 553 | typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t, 554 | const void *); 555 | typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *); 556 | typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *); 557 | typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t, 558 | const void *); 559 | typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *); 560 | 561 | /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ 562 | #define _curl_is_ioctl_cb(expr) \ 563 | (_curl_is_NULL(expr) || \ 564 | _curl_callback_compatible((expr), curl_ioctl_callback) || \ 565 | _curl_callback_compatible((expr), _curl_ioctl_callback1) || \ 566 | _curl_callback_compatible((expr), _curl_ioctl_callback2) || \ 567 | _curl_callback_compatible((expr), _curl_ioctl_callback3) || \ 568 | _curl_callback_compatible((expr), _curl_ioctl_callback4)) 569 | typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *); 570 | typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *); 571 | typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *); 572 | typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *); 573 | 574 | /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ 575 | #define _curl_is_sockopt_cb(expr) \ 576 | (_curl_is_NULL(expr) || \ 577 | _curl_callback_compatible((expr), curl_sockopt_callback) || \ 578 | _curl_callback_compatible((expr), _curl_sockopt_callback1) || \ 579 | _curl_callback_compatible((expr), _curl_sockopt_callback2)) 580 | typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); 581 | typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t, 582 | curlsocktype); 583 | 584 | /* evaluates to true if expr is of type curl_opensocket_callback or 585 | "similar" */ 586 | #define _curl_is_opensocket_cb(expr) \ 587 | (_curl_is_NULL(expr) || \ 588 | _curl_callback_compatible((expr), curl_opensocket_callback) || \ 589 | _curl_callback_compatible((expr), _curl_opensocket_callback1) || \ 590 | _curl_callback_compatible((expr), _curl_opensocket_callback2) || \ 591 | _curl_callback_compatible((expr), _curl_opensocket_callback3) || \ 592 | _curl_callback_compatible((expr), _curl_opensocket_callback4)) 593 | typedef curl_socket_t (*_curl_opensocket_callback1) 594 | (void *, curlsocktype, struct curl_sockaddr *); 595 | typedef curl_socket_t (*_curl_opensocket_callback2) 596 | (void *, curlsocktype, const struct curl_sockaddr *); 597 | typedef curl_socket_t (*_curl_opensocket_callback3) 598 | (const void *, curlsocktype, struct curl_sockaddr *); 599 | typedef curl_socket_t (*_curl_opensocket_callback4) 600 | (const void *, curlsocktype, const struct curl_sockaddr *); 601 | 602 | /* evaluates to true if expr is of type curl_progress_callback or "similar" */ 603 | #define _curl_is_progress_cb(expr) \ 604 | (_curl_is_NULL(expr) || \ 605 | _curl_callback_compatible((expr), curl_progress_callback) || \ 606 | _curl_callback_compatible((expr), _curl_progress_callback1) || \ 607 | _curl_callback_compatible((expr), _curl_progress_callback2)) 608 | typedef int (*_curl_progress_callback1)(void *, 609 | double, double, double, double); 610 | typedef int (*_curl_progress_callback2)(const void *, 611 | double, double, double, double); 612 | 613 | /* evaluates to true if expr is of type curl_debug_callback or "similar" */ 614 | #define _curl_is_debug_cb(expr) \ 615 | (_curl_is_NULL(expr) || \ 616 | _curl_callback_compatible((expr), curl_debug_callback) || \ 617 | _curl_callback_compatible((expr), _curl_debug_callback1) || \ 618 | _curl_callback_compatible((expr), _curl_debug_callback2) || \ 619 | _curl_callback_compatible((expr), _curl_debug_callback3) || \ 620 | _curl_callback_compatible((expr), _curl_debug_callback4) || \ 621 | _curl_callback_compatible((expr), _curl_debug_callback5) || \ 622 | _curl_callback_compatible((expr), _curl_debug_callback6) || \ 623 | _curl_callback_compatible((expr), _curl_debug_callback7) || \ 624 | _curl_callback_compatible((expr), _curl_debug_callback8)) 625 | typedef int (*_curl_debug_callback1) (CURL *, 626 | curl_infotype, char *, size_t, void *); 627 | typedef int (*_curl_debug_callback2) (CURL *, 628 | curl_infotype, char *, size_t, const void *); 629 | typedef int (*_curl_debug_callback3) (CURL *, 630 | curl_infotype, const char *, size_t, void *); 631 | typedef int (*_curl_debug_callback4) (CURL *, 632 | curl_infotype, const char *, size_t, const void *); 633 | typedef int (*_curl_debug_callback5) (CURL *, 634 | curl_infotype, unsigned char *, size_t, void *); 635 | typedef int (*_curl_debug_callback6) (CURL *, 636 | curl_infotype, unsigned char *, size_t, const void *); 637 | typedef int (*_curl_debug_callback7) (CURL *, 638 | curl_infotype, const unsigned char *, size_t, void *); 639 | typedef int (*_curl_debug_callback8) (CURL *, 640 | curl_infotype, const unsigned char *, size_t, const void *); 641 | 642 | /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ 643 | /* this is getting even messier... */ 644 | #define _curl_is_ssl_ctx_cb(expr) \ 645 | (_curl_is_NULL(expr) || \ 646 | _curl_callback_compatible((expr), curl_ssl_ctx_callback) || \ 647 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \ 648 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \ 649 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \ 650 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \ 651 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \ 652 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \ 653 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \ 654 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback8)) 655 | typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *); 656 | typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *); 657 | typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *); 658 | typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *, 659 | const void *); 660 | #ifdef HEADER_SSL_H 661 | /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX 662 | * this will of course break if we're included before OpenSSL headers... 663 | */ 664 | typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); 665 | typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); 666 | typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); 667 | typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, 668 | const void *); 669 | #else 670 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; 671 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; 672 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7; 673 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8; 674 | #endif 675 | 676 | /* evaluates to true if expr is of type curl_conv_callback or "similar" */ 677 | #define _curl_is_conv_cb(expr) \ 678 | (_curl_is_NULL(expr) || \ 679 | _curl_callback_compatible((expr), curl_conv_callback) || \ 680 | _curl_callback_compatible((expr), _curl_conv_callback1) || \ 681 | _curl_callback_compatible((expr), _curl_conv_callback2) || \ 682 | _curl_callback_compatible((expr), _curl_conv_callback3) || \ 683 | _curl_callback_compatible((expr), _curl_conv_callback4)) 684 | typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); 685 | typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); 686 | typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); 687 | typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); 688 | 689 | /* evaluates to true if expr is of type curl_seek_callback or "similar" */ 690 | #define _curl_is_seek_cb(expr) \ 691 | (_curl_is_NULL(expr) || \ 692 | _curl_callback_compatible((expr), curl_seek_callback) || \ 693 | _curl_callback_compatible((expr), _curl_seek_callback1) || \ 694 | _curl_callback_compatible((expr), _curl_seek_callback2)) 695 | typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); 696 | typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); 697 | 698 | 699 | #endif /* __CURL_TYPECHECK_GCC_H */ 700 | -------------------------------------------------------------------------------- /CentOS/third/curl/include/curl/urlapi.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_URLAPI_H 2 | #define __CURL_URLAPI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2019, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include "curl.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* the error codes for the URL API */ 32 | typedef enum { 33 | CURLUE_OK, 34 | CURLUE_BAD_HANDLE, /* 1 */ 35 | CURLUE_BAD_PARTPOINTER, /* 2 */ 36 | CURLUE_MALFORMED_INPUT, /* 3 */ 37 | CURLUE_BAD_PORT_NUMBER, /* 4 */ 38 | CURLUE_UNSUPPORTED_SCHEME, /* 5 */ 39 | CURLUE_URLDECODE, /* 6 */ 40 | CURLUE_OUT_OF_MEMORY, /* 7 */ 41 | CURLUE_USER_NOT_ALLOWED, /* 8 */ 42 | CURLUE_UNKNOWN_PART, /* 9 */ 43 | CURLUE_NO_SCHEME, /* 10 */ 44 | CURLUE_NO_USER, /* 11 */ 45 | CURLUE_NO_PASSWORD, /* 12 */ 46 | CURLUE_NO_OPTIONS, /* 13 */ 47 | CURLUE_NO_HOST, /* 14 */ 48 | CURLUE_NO_PORT, /* 15 */ 49 | CURLUE_NO_QUERY, /* 16 */ 50 | CURLUE_NO_FRAGMENT /* 17 */ 51 | } CURLUcode; 52 | 53 | typedef enum { 54 | CURLUPART_URL, 55 | CURLUPART_SCHEME, 56 | CURLUPART_USER, 57 | CURLUPART_PASSWORD, 58 | CURLUPART_OPTIONS, 59 | CURLUPART_HOST, 60 | CURLUPART_PORT, 61 | CURLUPART_PATH, 62 | CURLUPART_QUERY, 63 | CURLUPART_FRAGMENT, 64 | CURLUPART_ZONEID /* added in 7.65.0 */ 65 | } CURLUPart; 66 | 67 | #define CURLU_DEFAULT_PORT (1<<0) /* return default port number */ 68 | #define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set, 69 | if the port number matches the 70 | default for the scheme */ 71 | #define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if 72 | missing */ 73 | #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */ 74 | #define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */ 75 | #define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */ 76 | #define CURLU_URLDECODE (1<<6) /* URL decode on get */ 77 | #define CURLU_URLENCODE (1<<7) /* URL encode on set */ 78 | #define CURLU_APPENDQUERY (1<<8) /* append a form style part */ 79 | #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */ 80 | 81 | typedef struct Curl_URL CURLU; 82 | 83 | /* 84 | * curl_url() creates a new CURLU handle and returns a pointer to it. 85 | * Must be freed with curl_url_cleanup(). 86 | */ 87 | CURL_EXTERN CURLU *curl_url(void); 88 | 89 | /* 90 | * curl_url_cleanup() frees the CURLU handle and related resources used for 91 | * the URL parsing. It will not free strings previously returned with the URL 92 | * API. 93 | */ 94 | CURL_EXTERN void curl_url_cleanup(CURLU *handle); 95 | 96 | /* 97 | * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new 98 | * handle must also be freed with curl_url_cleanup(). 99 | */ 100 | CURL_EXTERN CURLU *curl_url_dup(CURLU *in); 101 | 102 | /* 103 | * curl_url_get() extracts a specific part of the URL from a CURLU 104 | * handle. Returns error code. The returned pointer MUST be freed with 105 | * curl_free() afterwards. 106 | */ 107 | CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what, 108 | char **part, unsigned int flags); 109 | 110 | /* 111 | * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns 112 | * error code. The passed in string will be copied. Passing a NULL instead of 113 | * a part string, clears that part. 114 | */ 115 | CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, 116 | const char *part, unsigned int flags); 117 | 118 | 119 | #ifdef __cplusplus 120 | } /* end of extern "C" */ 121 | #endif 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /CentOS/third/curl/lib/libcurl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starrtc/starrtc-linux-demo/67f3d2b1a456240cad9be5309b3f42a915a3eeaa/CentOS/third/curl/lib/libcurl.a -------------------------------------------------------------------------------- /CentOS/third/curl/lib/libcurl.la: -------------------------------------------------------------------------------- 1 | # libcurl.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libcurl.so.4' 9 | 10 | # Names of this library. 11 | library_names='libcurl.so.4.6.0 libcurl.so.4 libcurl.so' 12 | 13 | # The name of the static archive. 14 | old_library='libcurl.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags=' -pthread' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L/usr/local/ssl/lib -lssl -lz -lcrypto -ldl' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libcurl. 26 | current=10 27 | age=6 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib' 42 | -------------------------------------------------------------------------------- /CentOS/third/curl/lib/libcurl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starrtc/starrtc-linux-demo/67f3d2b1a456240cad9be5309b3f42a915a3eeaa/CentOS/third/curl/lib/libcurl.so -------------------------------------------------------------------------------- /CentOS/third/curl/lib/libcurl.so.4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starrtc/starrtc-linux-demo/67f3d2b1a456240cad9be5309b3f42a915a3eeaa/CentOS/third/curl/lib/libcurl.so.4 -------------------------------------------------------------------------------- /CentOS/third/curl/lib/libcurl.so.4.6.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/starrtc/starrtc-linux-demo/67f3d2b1a456240cad9be5309b3f42a915a3eeaa/CentOS/third/curl/lib/libcurl.so.4.6.0 -------------------------------------------------------------------------------- /CentOS/third/curl/lib/pkgconfig/libcurl.pc: -------------------------------------------------------------------------------- 1 | #*************************************************************************** 2 | # _ _ ____ _ 3 | # Project ___| | | | _ \| | 4 | # / __| | | | |_) | | 5 | # | (__| |_| | _ <| |___ 6 | # \___|\___/|_| \_\_____| 7 | # 8 | # Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. 9 | # 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. 13 | # 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. 17 | # 18 | # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 | # KIND, either express or implied. 20 | # 21 | ########################################################################### 22 | 23 | # This should most probably benefit from getting a "Requires:" field added 24 | # dynamically by configure. 25 | # 26 | prefix=/usr/local 27 | exec_prefix=${prefix} 28 | libdir=${exec_prefix}/lib 29 | includedir=${prefix}/include 30 | supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP" 31 | supported_features="SSL IPv6 UnixSockets libz AsynchDNS NTLM NTLM_WB TLS-SRP HTTPS-proxy" 32 | 33 | Name: libcurl 34 | URL: https://curl.haxx.se/ 35 | Description: Library to transfer files with ftp, http, etc. 36 | Version: 7.66.0-DEV 37 | Libs: -L${libdir} -lcurl 38 | Libs.private: -lssl -lz -lcrypto -ldl 39 | Cflags: -I${includedir} 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # starrtc-linux-demo 2 | CentOS 3 | --- 4 | 基于CentOS 7的直播 5 | 6 | 进入rpi目录。运行make编译出程序rpi-demo,然后运行即可 7 | 8 | 然后下载其它[客户端示例程序](https://docs.starrtc.com/en/download/),进入互动直播,即可观看直播。 9 | 10 | Contact 11 | ===== 12 | QQ : 2162498688 13 | 14 | 邮箱:support@starRTC.com 15 | 16 | 手机: 186-1294-6552 17 | 18 | 微信:starRTC 19 | 20 | QQ群:807242783 --------------------------------------------------------------------------------