1 /* libcmis 2 * Version: MPL 1.1 / GPLv2+ / LGPLv2+ 3 * 4 * The contents of this file are subject to the Mozilla Public License Version 5 * 1.1 (the "License"); you may not use this file except in compliance with 6 * the License or as specified alternatively below. You may obtain a copy of 7 * the License at http://www.mozilla.org/MPL/ 8 * 9 * Software distributed under the License is distributed on an "AS IS" basis, 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 * for the specific language governing rights and limitations under the 12 * License. 13 * 14 * Major Contributor(s): 15 * Copyright (C) 2011 SUSE <cbosdonnat@suse.com> 16 * 17 * 18 * All Rights Reserved. 19 * 20 * For minor contributions see the git repository. 21 * 22 * Alternatively, the contents of this file may be used under the terms of 23 * either the GNU General Public License Version 2 or later (the "GPLv2+"), or 24 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), 25 * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable 26 * instead of those above. 27 */ 28 #ifndef _MOCKUP_CURL_CURL_H_ 29 #define _MOCKUP_CURL_CURL_H_ 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 /* Curl used symbols to mockup */ 36 37 typedef void CURL; 38 39 typedef enum 40 { 41 CURLIOE_OK, /* I/O operation successful */ 42 CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ 43 CURLIOE_FAILRESTART, /* failed to restart the read */ 44 CURLIOE_LAST /* never use */ 45 } curlioerr; 46 47 #define CURL_GLOBAL_SSL (1<<0) 48 #define CURL_GLOBAL_WIN32 (1<<1) 49 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) 50 51 #define CURLOPTTYPE_LONG 0 52 #define CURLOPTTYPE_OBJECTPOINT 10000 53 #define CURLOPTTYPE_FUNCTIONPOINT 20000 54 #define CURLOPTTYPE_OFF_T 30000 55 56 typedef enum 57 { 58 CURLOPT_WRITEFUNCTION = CURLOPTTYPE_FUNCTIONPOINT + 11, 59 CURLOPT_READFUNCTION = CURLOPTTYPE_FUNCTIONPOINT + 12, 60 CURLOPT_WRITEDATA = CURLOPTTYPE_OBJECTPOINT + 1, 61 CURLOPT_HEADERFUNCTION = CURLOPTTYPE_FUNCTIONPOINT + 79, 62 CURLOPT_WRITEHEADER = CURLOPTTYPE_OBJECTPOINT + 29, 63 CURLOPT_FOLLOWLOCATION = CURLOPTTYPE_LONG + 52, 64 CURLOPT_MAXREDIRS = CURLOPTTYPE_LONG + 68, 65 CURLOPT_INFILESIZE = CURLOPTTYPE_LONG + 14, 66 CURLOPT_READDATA = CURLOPTTYPE_OBJECTPOINT + 9, 67 CURLOPT_UPLOAD = CURLOPTTYPE_LONG + 46, 68 CURLOPT_IOCTLFUNCTION = CURLOPTTYPE_FUNCTIONPOINT + 130, 69 CURLOPT_IOCTLDATA = CURLOPTTYPE_OBJECTPOINT + 131, 70 CURLOPT_HTTPHEADER = CURLOPTTYPE_OBJECTPOINT + 23, 71 CURLOPT_POSTFIELDSIZE = CURLOPTTYPE_LONG + 60, 72 CURLOPT_POST = CURLOPTTYPE_LONG + 47, 73 CURLOPT_CUSTOMREQUEST = CURLOPTTYPE_OBJECTPOINT + 36, 74 CURLOPT_URL = CURLOPTTYPE_OBJECTPOINT + 2, 75 CURLOPT_HTTPAUTH = CURLOPTTYPE_LONG + 107, 76 CURLOPT_USERNAME = CURLOPTTYPE_OBJECTPOINT + 173, 77 CURLOPT_PASSWORD = CURLOPTTYPE_OBJECTPOINT + 174, 78 CURLOPT_USERPWD = CURLOPTTYPE_OBJECTPOINT + 5, 79 CURLOPT_ERRORBUFFER = CURLOPTTYPE_OBJECTPOINT + 10, 80 CURLOPT_FAILONERROR = CURLOPTTYPE_LONG + 45, 81 CURLOPT_VERBOSE = CURLOPTTYPE_LONG + 41, 82 CURLOPT_PROXY = CURLOPTTYPE_OBJECTPOINT + 4, 83 CURLOPT_PROXYUSERPWD = CURLOPTTYPE_OBJECTPOINT + 6, 84 CURLOPT_PROXYAUTH = CURLOPTTYPE_LONG + 111, 85 CURLOPT_PROXYUSERNAME = CURLOPTTYPE_OBJECTPOINT + 175, 86 CURLOPT_PROXYPASSWORD = CURLOPTTYPE_OBJECTPOINT + 176, 87 CURLOPT_NOPROXY = CURLOPTTYPE_OBJECTPOINT + 177, 88 CURLOPT_SSL_VERIFYPEER = CURLOPTTYPE_LONG + 64, 89 CURLOPT_SSL_VERIFYHOST = CURLOPTTYPE_LONG + 81, 90 CURLOPT_CERTINFO = CURLOPTTYPE_LONG + 172 91 } CURLoption; 92 93 #define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) 94 #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) 95 96 typedef enum 97 { 98 CURLE_OK = 0, 99 CURLE_HTTP_RETURNED_ERROR = 22, 100 CURLE_SSL_CACERT = 60, 101 /* TODO Add some more error codes from curl? */ 102 CURL_LAST 103 } CURLcode; 104 105 struct curl_slist 106 { 107 char *data; 108 struct curl_slist *next; 109 }; 110 111 struct curl_slist *curl_slist_append( struct curl_slist *, const char * ); 112 void curl_slist_free_all( struct curl_slist * ); 113 114 void curl_free( void *p ); 115 CURLcode curl_global_init( long flags ); 116 117 CURL *curl_easy_init( void ); 118 void curl_easy_cleanup( CURL *curl ); 119 CURLcode curl_easy_setopt( CURL *curl, long option, ... ); 120 char *curl_easy_escape( CURL *handle, const char *string, int length ); 121 char *curl_unescape( const char *string, int length ); 122 char *curl_easy_unescape( CURL *handle, const char *string, int length, int *outlength ); 123 CURLcode curl_easy_perform( CURL *curl ); 124 void curl_easy_reset( CURL *curl ); 125 126 struct curl_certinfo 127 { 128 int num_of_certs; 129 struct curl_slist **certinfo; 130 }; 131 132 #define CURLINFO_LONG 0x200000 133 #define CURLINFO_SLIST 0x400000 134 135 typedef enum 136 { 137 CURLINFO_NONE, 138 CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, 139 CURLINFO_CERTINFO = CURLINFO_SLIST + 34, 140 CURLINFO_LASTONE = 42 141 } CURLINFO; 142 143 CURLcode curl_easy_getinfo( CURL *curl, long info, ... ); 144 145 #define LIBCURL_VERSION_MAJOR 7 146 #define LIBCURL_VERSION_MINOR 26 147 #define LIBCURL_VERSION_PATCH 0 148 149 #ifdef __cplusplus 150 } 151 #endif 152 153 #endif 154