public static extern CURLE curl_easy_getinfo_ptr(IntPtr easyPtr, CURLINFO info, ref double arg);
public static extern CURLcode EasyGetInfoPointer(IntPtr handle, CURLINFO info, out IntPtr value);
/// <summary> /// Extract <c>DateTime</c> information from an <c>Easy</c> object. /// </summary> /// <param name="info">One of the values in the /// <see cref="CURLINFO"/> enumeration. In this case, it must /// specifically be <see cref="CURLINFO.CURLINFO_FILETIME"/>. /// </param> /// <param name="dt">Reference to a <c>DateTime</c> value.</param> /// <returns>The <see cref="CURLcode"/> obtained from the internal /// call to <c>curl_easy_getinfo()</c>. /// </returns> /// <exception cref="System.NullReferenceException">This is thrown if /// the native <c>CURL*</c> handle wasn't created successfully.</exception> public CURLcode GetInfo(CURLINFO info, ref DateTime dt) { EnsureHandle(); CURLcode retCode = CURLcode.CURLE_OK; IntPtr ptr = IntPtr.Zero; if (info != CURLINFO.CURLINFO_FILETIME) return CURLcode.CURLE_BAD_FUNCTION_ARGUMENT; retCode = External.curl_easy_getinfo(m_pCURL, info, ref ptr); if (retCode == CURLcode.CURLE_OK) { if ((int)ptr < 0) dt = new DateTime(0); else { int yy = 0, mm = 0, dd = 0, hh = 0, mn = 0, ss = 0; External.curl_shim_get_file_time((int)ptr, ref yy, ref mm, ref dd, ref hh, ref mn, ref ss); dt = new DateTime(yy, mm, dd, hh, mn, ss); } } return retCode; }
public CURLE GetInfo(CURLINFO info, out double value) { value = 0; return(Lib.curl_easy_getinfo_ptr(easyPtr, info, ref value)); }
internal static extern CURLcode curl_easy_getinfo_time(IntPtr pCurl, CURLINFO info, ref int yy, ref int mm, ref int dd, ref int hh, ref int mn, ref int ss);
/// <summary> /// Extract <c>int</c> information from an <c>Easy</c> object. /// </summary> /// <param name="info">One of the values in the /// <see cref="CURLINFO"/> enumeration. In this case, it must /// specifically be one of the members that obtains an <c>int</c>. /// </param> /// <param name="intVal">Reference to an <c>int</c> value.</param> /// <returns>The <see cref="CURLcode"/> obtained from the internal /// call to <c>curl_easy_getinfo()</c>. /// </returns> /// <exception cref="System.NullReferenceException">This is thrown if /// the native <c>CURL*</c> handle wasn't created successfully.</exception> public CURLcode GetInfo(CURLINFO info, ref int intVal) { EnsureHandle(); CURLcode retCode = CURLcode.CURLE_OK; IntPtr ptr = IntPtr.Zero; // ensure it's an integral type if ((int)info < CURLINFO_LONG || (int)info >= CURLINFO_DOUBLE) return CURLcode.CURLE_BAD_FUNCTION_ARGUMENT; retCode = External.curl_easy_getinfo(m_pCURL, info, ref ptr); if (retCode == CURLcode.CURLE_OK) intVal = (int)ptr; return retCode; }
/// <summary> /// Extract <c>Slist</c> information from an <c>Easy</c> object. /// </summary> /// <param name="info">One of the values in the /// <see cref="CURLINFO"/> enumeration. In this case, it must /// specifically be one of the members that obtains an <c>Slist</c>. /// </param> /// <param name="slist">Reference to an <c>Slist</c> value.</param> /// <returns>The <see cref="CURLcode"/> obtained from the internal /// call to <c>curl_easy_getinfo()</c>. /// </returns> /// <exception cref="System.NullReferenceException">This is thrown if /// the native <c>CURL*</c> handle wasn't created successfully.</exception> public CURLcode GetInfo(CURLINFO info, ref Slist slist) { EnsureHandle(); CURLcode retCode = CURLcode.CURLE_OK; IntPtr ptr = IntPtr.Zero, ptrs = IntPtr.Zero; if ((int)info < CURLINFO_SLIST) return CURLcode.CURLE_BAD_FUNCTION_ARGUMENT; retCode = External.curl_easy_getinfo(m_pCURL, info, ref ptr); if (retCode != CURLcode.CURLE_OK) return retCode; slist = new Slist(); while (ptr != IntPtr.Zero) { ptr = External.curl_shim_get_string_from_slist( ptr, ref ptrs); slist.Append(Marshal.PtrToStringAnsi(ptrs)); } return retCode; }
public static extern CURLcode EasyGetInfoLong(SafeCurlHandle handle, CURLINFO info, out long value);
internal static extern CURLcode curl_easy_getinfo_64(IntPtr pCurl, CURLINFO info, ref double dblVal);
/// <summary> /// Extract information from a cURL handle. /// </summary> /// <param name="info">One of the values in the /// <see cref="CURLINFO"/> enumeration.</param> /// <param name="objInfo">Reference to an object into which the /// value specified by <c>info</c> is written.</param> /// <returns>The <see cref="CURLcode"/> obtained from the internal /// call to <c>curl_easy_getinfo()</c>. /// </returns> /// <exception cref="System.NullReferenceException">This is thrown if /// the native <c>CURL*</c> handle wasn't created successfully.</exception> public CURLcode GetInfo(CURLINFO info, ref Object objInfo) { EnsureHandle(); CURLcode retCode = CURLcode.CURLE_OK; IntPtr ptr = IntPtr.Zero; if ((int)info < CURLINFO_STRING) return CURLcode.CURLE_BAD_FUNCTION_ARGUMENT; // trickery for filetime if (info == CURLINFO.CURLINFO_FILETIME) return CURLcode.CURLE_BAD_FUNCTION_ARGUMENT; // private data if (info == CURLINFO.CURLINFO_PRIVATE) { objInfo = m_privateData; return retCode; } // string case if ((int)info < CURLINFO_LONG) { retCode = External.curl_easy_getinfo(m_pCURL, info, ref ptr); if (retCode == CURLcode.CURLE_OK) objInfo = (Object)Marshal.PtrToStringAnsi(ptr); return retCode; } // int or double: return problem return CURLcode.CURLE_BAD_FUNCTION_ARGUMENT; }
internal static extern CURLcode curl_easy_getinfo(IntPtr pCurl, CURLINFO info, ref IntPtr pInfo);
internal static extern CURLcode curl_easy_getinfo(IntPtr pCurl, CURLINFO info, out IntPtr pInfo);
/// <summary> /// Extract <c>string</c> information from an <c>Easy</c> object. /// </summary> /// <param name="info">One of the values in the /// <see cref="CURLINFO"/> enumeration. In this case, it must /// specifically be one of the members that obtains a <c>string</c>. /// </param> /// <param name="strVal">Reference to an <c>string</c> value.</param> /// <returns>The <see cref="CURLcode"/> obtained from the internal /// call to <c>curl_easy_getinfo()</c>. /// </returns> /// <exception cref="System.NullReferenceException">This is thrown if /// the native <c>CURL*</c> handle wasn't created successfully.</exception> public CURLcode GetInfo(CURLINFO info, ref string strVal) { EnsureHandle(); CURLcode retCode = CURLcode.CURLE_OK; IntPtr ptr = IntPtr.Zero; if ((int)info < CURLINFO_STRING || (int)info >= CURLINFO_LONG) return CURLcode.CURLE_BAD_FUNCTION_ARGUMENT; retCode = External.curl_easy_getinfo(m_pCURL, info, ref ptr); if (retCode == CURLcode.CURLE_OK) strVal = Marshal.PtrToStringAnsi(ptr); return retCode; }
/// <summary> /// Extract <c>int</c> information from an <c>Easy</c> object. /// </summary> /// <param name="info">One of the values in the /// <see cref="CURLINFO"/> enumeration. In this case, it must /// specifically be one of the members that obtains a <c>double</c>. /// </param> /// <param name="dblVal">Reference to an <c>double</c> value.</param> /// <returns>The <see cref="CURLcode"/> obtained from the internal /// call to <c>curl_easy_getinfo()</c>. /// </returns> /// <exception cref="System.NullReferenceException">This is thrown if /// the native <c>CURL*</c> handle wasn't created successfully.</exception> public CURLcode GetInfo(CURLINFO info, ref double dblVal) { EnsureHandle(); // ensure it's an integral type if ((int)info < CURLINFO_DOUBLE) return CURLcode.CURLE_BAD_FUNCTION_ARGUMENT; return External.curl_easy_getinfo_64(m_pCURL, info, ref dblVal); }
public static extern CURLcode GetInfo(SafeEasyHandle handle, CURLINFO option, out int value);
internal static extern CURLcode curl_easy_getinfo_double(IntPtr pCurl, CURLINFO info, ref double pInfo);