httpreadwrite.h
来自「原来由英特尔制定的UPnP SDK的」· C头文件 代码 · 共 606 行 · 第 1/2 页
H
606 行
************************************************************************/int http_OpenHttpPost(IN const char *url_str, IN OUT void **Handle, IN const char *contentType, IN int contentLength, IN int timeout);/************************************************************************ * Function: http_ReadHttpGet * * Parameters: * IN void *Handle; Handle to the HTTP get object * IN OUT char *buf; Buffer to get the read and parsed data * IN OUT unsigned int *size; Size of the buffer passed * IN int timeout; time out value * * Description: * Parses already existing data, then gets new data. * Parses and extracts information from the new data. * * Return: int * UPNP_E_SUCCESS - On Sucess * UPNP_E_INVALID_PARAM - Invalid Parameter * UPNP_E_BAD_RESPONSE * UPNP_E_BAD_HTTPMSG * UPNP_E_CANCELED ************************************************************************/int http_ReadHttpGet( IN void *Handle, IN OUT char *buf, IN OUT unsigned int *size, IN int timeout);/************************************************************************ * Function: http_HttpGetProgress * * Parameters: * IN void *Handle; Handle to the HTTP get object * OUT unsigned int *length; Buffer to get the read and parsed data * OUT unsigned int *total; Size of tge buffer passed * * Description: * Extracts information from the Handle to the HTTP get object. * * Return: int * UPNP_E_SUCCESS - On Sucess * UPNP_E_INVALID_PARAM - Invalid Parameter ************************************************************************/int http_HttpGetProgress( IN void *Handle, OUT unsigned int *length, OUT unsigned int *total );/************************************************************************ * Function: http_CloseHttpGet * * Parameters: * IN void *Handle; Handle to HTTP get object * * Description: * Clears the handle allocated for the HTTP GET operation * Clears socket states and memory allocated for socket operations. * * Return: int * UPNP_E_SUCCESS - On Success * UPNP_E_INVALID_PARAM - Invalid Parameter ************************************************************************/int http_CloseHttpGet(IN void *Handle);/************************************************************************ * Function: http_OpenHttpGet * * Parameters: * IN const char *url_str: String as a URL * IN OUT void **Handle: Pointer to buffer to store HTTP * post handle * IN OUT char **contentType: Type of content * OUT int *contentLength: length of content * OUT int *httpStatus: HTTP status returned on receiving a * response message * IN int timeout: time out value * * Description: * Makes the HTTP GET message, connects to the peer, * sends the HTTP GET request, gets the response and parses the * response. * * Return: int * UPNP_E_SUCCESS - On Success * UPNP_E_INVALID_PARAM - Invalid Paramters * UPNP_E_OUTOF_MEMORY * UPNP_E_SOCKET_ERROR * UPNP_E_BAD_RESPONSE ************************************************************************/int http_OpenHttpGet( IN const char *url_str, IN OUT void **Handle, IN OUT char **contentType, OUT int *contentLength, OUT int *httpStatus, IN int timeout);/************************************************************************ * Function: http_OpenHttpGetProxy * * Parameters: * IN const char *url_str; String as a URL * IN const char *proxy_str; String as a URL * IN OUT void **Handle; Pointer to buffer to store HTTP * post handle * IN OUT char **contentType; Type of content * OUT int *contentLength; length of content * OUT int *httpStatus; HTTP status returned on receiving a * response message * IN int timeout: time out value * * Description: * Makes the HTTP GET message, connects to the peer, * sends the HTTP GET request, gets the response and parses the response. * If a proxy URL is defined then the connection is made there. * * Return: int * UPNP_E_SUCCESS - On Success * UPNP_E_INVALID_PARAM - Invalid Paramters * UPNP_E_OUTOF_MEMORY * UPNP_E_SOCKET_ERROR * UPNP_E_BAD_RESPONSE ************************************************************************/int http_OpenHttpGetProxy(IN const char *url_str, IN const char *proxy_str, IN OUT void **Handle, IN OUT char **contentType, OUT int *contentLength, OUT int *httpStatus, IN int timeout);/************************************************************************ * Function: http_SendStatusResponse * * Parameters: * IN SOCKINFO *info; Socket information object * IN int http_status_code; error code returned while making * or sending the response message * IN int request_major_version; request major version * IN int request_minor_version; request minor version * * Description: * Generate a response message for the status query and send the * status response. * * Return: int * 0 -- success * UPNP_E_OUTOF_MEMORY * UPNP_E_SOCKET_WRITE * UPNP_E_TIMEDOUT ************************************************************************/int http_SendStatusResponse( IN SOCKINFO *info, IN int http_status_code, IN int request_major_version, IN int request_minor_version );/************************************************************************ * Function: http_MakeMessage * * Parameters: * INOUT membuffer* buf; buffer with the contents of the * message * IN int http_major_version; HTTP major version * IN int http_minor_version; HTTP minor version * IN const char* fmt; Pattern format * ...; * * Description: * Generate an HTTP message based on the format that is specified * in the input parameters. * * fmt types: * 'B': arg = int status_code * appends content-length, content-type and HTML body * for given code * 'b': arg1 = const char* buf; * arg2 = size_t buf_length memory ptr * 'C': (no args) appends a HTTP CONNECTION: close header * depending on major,minor version * 'c': (no args) appends CRLF "\r\n" * 'D': (no args) appends HTTP DATE: header * 'd': arg = int number // appends decimal number * 'G': arg = range information // add range header * 'h': arg = off_t number // appends off_t number * 'K': (no args) // add chunky header * 'N': arg1 = off_t content_length // content-length header * 'q': arg1 = http_method_t // request start line and HOST header * arg2 = (uri_type *) * 'Q': arg1 = http_method_t; // start line of request * arg2 = char* url; * arg3 = size_t url_length * 'R': arg = int status_code // adds a response start line * 'S': (no args) appends HTTP SERVER: header * 's': arg = const char* C_string * 'T': arg = char * content_type; format * e.g: "text/html"; content-type header * 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt * 'U': (no args) appends HTTP USER-AGENT: header * 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent * * Return: int * 0 - On Success * UPNP_E_OUTOF_MEMORY * UPNP_E_INVALID_URL ************************************************************************/int http_MakeMessage( INOUT membuffer* buf, IN int http_major_version, IN int http_minor_version, IN const char* fmt, ... );/************************************************************************ * Function: http_CalcResponseVersion * * Parameters: * IN int request_major_vers; Request major version * IN int request_minor_vers; Request minor version * OUT int* response_major_vers; Response mojor version * OUT int* response_minor_vers; Response minor version * * Description: * Calculate HTTP response versions based on the request versions. * * Return: void ************************************************************************/void http_CalcResponseVersion( IN int request_major_vers, IN int request_minor_vers, OUT int* response_major_vers, OUT int* response_minor_vers );/************************************************************************ * Function: http_OpenHttpGetEx * * Parameters: * IN const char *url_str; String as a URL * IN OUT void **Handle; Pointer to buffer to store HTTP * post handle * IN OUT char **contentType; Type of content * OUT int *contentLength; length of content * OUT int *httpStatus; HTTP status returned on receiving a * response message * IN int timeout; time out value * * Description: * Makes the HTTP GET message, connects to the peer, * sends the HTTP GET request, gets the response and parses the * response. * * Return: int * UPNP_E_SUCCESS - On Success * UPNP_E_INVALID_PARAM - Invalid Paramters * UPNP_E_OUTOF_MEMORY * UPNP_E_SOCKET_ERROR * UPNP_E_BAD_RESPONSE ************************************************************************/int http_OpenHttpGetEx(IN const char *url_str, IN OUT void **Handle, IN OUT char **contentType, OUT int *contentLength, OUT int *httpStatus, IN int lowRange, IN int highRange, IN int timeout);/************************************************************************ * Function: get_sdk_info * * Parameters: * OUT char *info; buffer to store the operating system information * * Description: * Returns the server information for the operating system * * Return: * UPNP_INLINE void ************************************************************************/void get_sdk_info( OUT char *info );#ifdef __cplusplus} // #extern "C"#endif#endif // GENLIB_NET_HTTP_HTTPREADWRITE_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?