http.h revision a018f30f22605aaa1f809d77716cbb148a732a32
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/* $Id$ */
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/** @file
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * IPRT - Simple HTTP Communication API.
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync */
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/*
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * Copyright (C) 2012-2013 Oracle Corporation
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync *
3f1f30f349c6d9ef74ba8d16ff0c5b0ac47def6cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3f1f30f349c6d9ef74ba8d16ff0c5b0ac47def6cvboxsync * available from http://www.virtualbox.org. This file is free software;
3f1f30f349c6d9ef74ba8d16ff0c5b0ac47def6cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
3f1f30f349c6d9ef74ba8d16ff0c5b0ac47def6cvboxsync * General Public License (GPL) as published by the Free Software
3f1f30f349c6d9ef74ba8d16ff0c5b0ac47def6cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3f1f30f349c6d9ef74ba8d16ff0c5b0ac47def6cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3f1f30f349c6d9ef74ba8d16ff0c5b0ac47def6cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync *
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * The contents of this file may alternatively be used under the terms
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * of the Common Development and Distribution License Version 1.0
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * VirtualBox OSE distribution, in which case the provisions of the
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * CDDL are applicable instead of those of the GPL.
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync *
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * You may elect to license modified versions of this file under the
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * terms and conditions of either the GPL or the CDDL or both.
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync */
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync#ifndef ___iprt_http_h
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync#define ___iprt_http_h
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync#include <iprt/types.h>
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsyncRT_C_DECLS_BEGIN
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/** @defgroup grp_rt_http RTHttp - Simple HTTP API
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * @ingroup grp_rt
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * @{
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync */
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/** @todo the following three definitions may move the iprt/types.h later. */
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/** RTHTTP interface handle. */
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsynctypedef R3PTRTYPE(struct RTHTTPINTERNAL *) RTHTTP;
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/** Pointer to a RTHTTP interface handle. */
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsynctypedef RTHTTP *PRTHTTP;
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/** Nil RTHTTP interface handle. */
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync#define NIL_RTHTTP ((RTHTTP)0)
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync/**
9de2fa82343af2df7df171b18afbe32b6f37ed84vboxsync * Creates a HTTP interface handle.
*
* @returns iprt status code.
*
* @param phHttp Where to store the HTTP handle.
*/
RTR3DECL(int) RTHttpCreate(PRTHTTP phHttp);
/**
* Destroys a HTTP interface handle.
*
* @param hHttp Handle to the HTTP interface.
*/
RTR3DECL(void) RTHttpDestroy(RTHTTP hHttp);
/**
* Perform a simple blocking HTTP request.
*
* @returns iprt status code.
*
* @param hHttp HTTP interface handle.
* @param pcszUrl URL.
* @param ppszResponse HTTP response.
*/
RTR3DECL(int) RTHttpGet(RTHTTP hHttp, const char *pcszUrl, char **ppszResponse);
/**
* Specify proxy settings.
*
* @returns iprt status code.
*
* @param hHttp HTTP interface handle.
* @param pcszProxy URL of the proxy
* @param uPort port number of the proxy, use 0 for not specifying a port.
* @param pcszUser username, pass NULL for no authentication
* @param pcszPwd password, pass NULL for no authentication
*/
RTR3DECL(int) RTHttpSetProxy(RTHTTP hHttp, const char *pcszProxyUrl, uint32_t uPort,
const char *pcszProxyUser, const char *pcszProxyPwd);
/**
* Set custom headers.
*
* @returns iprt status code.
*
* @param hHttp HTTP interface handle.
* @param cHeaders number of custom headers.
* @param pcszHeaders array of headers in form "foo: bar".
*/
RTR3DECL(int) RTHttpSetHeaders(RTHTTP hHttp, uint32_t cHeaders, const char *pcszHeaders[]);
/**
* Set a custom certification authority file, containing root certificates.
*
* @returns iprt status code.
*
* @param hHttp HTTP interface handle.
* @param pcszCAFile File name containing root certificates.
*/
RTR3DECL(int) RTHttpSetCAFile(RTHTTP hHttp, const char *pcszCAFile);
/** @} */
RT_C_DECLS_END
#endif