164 lines
5.1 KiB
C
164 lines
5.1 KiB
C
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike_http_fetcher.h,v $ $Revision: 1.2 $
|
|
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike_http_fetcher.h,v $
|
|
* $Author: edahlber $ $Date: 2010-12-20 05:34:01 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Erik Dahlberg <erik.dahlberg@windriver.com>
|
|
******************************************************************************
|
|
*/
|
|
|
|
|
|
#ifndef IPIKE_HTTP_FETCHER_H
|
|
#define IPIKE_HTTP_FETCHER_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* Module for fetching data via HTTP (1.1) */
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include <ipike.h>
|
|
#include <ipcom_type.h>
|
|
#include <ipcom_sock2.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipike_http_fetcher_callback
|
|
*===========================================================================
|
|
* Description: User callback which is called when an HTTP response has been
|
|
* received.
|
|
*
|
|
* Parameters: status - IPIKE_SUCCESS or IPIKE_FAILED.
|
|
* data - HTTP content data.
|
|
* data_len - Length of HTTP content data.
|
|
* callback_ctx - User callback context.
|
|
*
|
|
* Returns:
|
|
*
|
|
*/
|
|
typedef void
|
|
(*Ipike_http_fetcher_callback) (Ipike_error status,
|
|
const char *data,
|
|
Ip_size_t data_len,
|
|
void *callback_ctx);
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_http_fetcher_get
|
|
*===========================================================================
|
|
* Description: Sends a HTTP GET request for the given URL, repsonse data
|
|
* is returned to the registered callback.
|
|
*
|
|
* Parameters: url - URL pointing out the resource
|
|
* callback - Response callback
|
|
* callback_ctx - Callback context
|
|
*
|
|
* Returns: IPIKE_SUCCESS
|
|
* IPIKE_FAILURE
|
|
*
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike_http_fetcher_get(
|
|
const char *url,
|
|
Ipike_http_fetcher_callback callback,
|
|
void *callback_ctx);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_http_fetcher_add_fds
|
|
*===========================================================================
|
|
* Description: Adds any open internal file descriptors into the fd set.
|
|
* is returned to the registered callback.
|
|
*
|
|
* Parameters: read_fds - Read file descriptor set
|
|
*
|
|
* Returns: The largest file descriptor, or
|
|
* -1 if no file descriptor was added.
|
|
*
|
|
*/
|
|
IP_GLOBAL int
|
|
ipike_http_fetcher_add_fds(Ip_fd_set *read_fds, Ip_fd_set *write_fds);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_http_fetcher_process
|
|
*===========================================================================
|
|
* Description: Checks if there is any repsonses to processes on any internal
|
|
* file descriptor.
|
|
*
|
|
* Parameters: read_fds - Read file descriptor set.
|
|
*
|
|
* Returns: The number of processed file descriptors.
|
|
*
|
|
*/
|
|
IP_GLOBAL int
|
|
ipike_http_fetcher_process(Ip_fd_set *fd_set, Ip_fd_set *write_fds);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_http_fetcher_cleanup
|
|
*===========================================================================
|
|
* Description: Closes all open sockets and releases memory for all pending
|
|
* http requests. All pending request will be notfied of
|
|
* failure through the registered callback.
|
|
*
|
|
* Parameters: -
|
|
*
|
|
* Returns: -
|
|
*
|
|
*/
|
|
IP_GLOBAL void
|
|
ipike_http_fetcher_cleanup(void);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|