Some rework of http_SendMessage(), no change in functionality. Mostly white spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@246 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
f42bbb6dc2
commit
851cfbc4db
File diff suppressed because it is too large
Load Diff
@ -50,73 +50,78 @@ int
|
|||||||
http_CancelHttpGet( IN void *Handle );
|
http_CancelHttpGet( IN void *Handle );
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: http_FixUrl
|
* Function: http_FixUrl
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN uri_type* url ; URL to be validated and fixed
|
* IN uri_type* url; URL to be validated and fixed
|
||||||
* OUT uri_type* fixed_url ; URL after being fixed.
|
* OUT uri_type* fixed_url; URL after being fixed.
|
||||||
*
|
*
|
||||||
* Description: Validates URL
|
* Description:
|
||||||
*
|
* Validates URL
|
||||||
* Returns:
|
*
|
||||||
* UPNP_E_INVALID_URL
|
* Returns:
|
||||||
* UPNP_E_SUCCESS
|
* UPNP_E_INVALID_URL
|
||||||
************************************************************************/
|
* UPNP_E_SUCCESS
|
||||||
|
************************************************************************/
|
||||||
int http_FixUrl( IN uri_type* url, OUT uri_type* fixed_url );
|
int http_FixUrl( IN uri_type* url, OUT uri_type* fixed_url );
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: http_FixStrUrl
|
* Function: http_FixStrUrl
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char* urlstr ; Character string as a URL
|
* IN char* urlstr ; Character string as a URL
|
||||||
* IN int urlstrlen ; Length of the character string
|
* IN int urlstrlen ; Length of the character string
|
||||||
* OUT uri_type* fixed_url ; Fixed and corrected URL
|
* OUT uri_type* fixed_url ; Fixed and corrected URL
|
||||||
*
|
*
|
||||||
* Description: Parses URL and then validates URL
|
* Description:
|
||||||
*
|
* Parses URL and then validates URL
|
||||||
* Returns:
|
*
|
||||||
* UPNP_E_INVALID_URL
|
* Returns:
|
||||||
* UPNP_E_SUCCESS
|
* UPNP_E_INVALID_URL
|
||||||
************************************************************************/
|
* UPNP_E_SUCCESS
|
||||||
|
************************************************************************/
|
||||||
int http_FixStrUrl( IN char* urlstr, IN int urlstrlen, OUT uri_type* fixed_url );
|
int http_FixStrUrl( IN char* urlstr, IN int urlstrlen, OUT uri_type* fixed_url );
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: http_Connect
|
* Function: http_Connect
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN uri_type* destination_url ; URL containing destination information
|
* IN uri_type* destination_url; URL containing destination information
|
||||||
* OUT uri_type *url ; Fixed and corrected URL
|
* OUT uri_type *url; Fixed and corrected URL
|
||||||
*
|
*
|
||||||
* Description: Gets destination address from URL and then connects to the
|
* Description:
|
||||||
* remote end
|
* Gets destination address from URL and then connects to the remote end
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* socket descriptor on sucess
|
* socket descriptor on sucess
|
||||||
* UPNP_E_OUTOF_SOCKET
|
* UPNP_E_OUTOF_SOCKET
|
||||||
* UPNP_E_SOCKET_CONNECT on error
|
* UPNP_E_SOCKET_CONNECT on error
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int http_Connect( IN uri_type* destination_url, OUT uri_type *url );
|
int http_Connect( IN uri_type* destination_url, OUT uri_type *url );
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: http_RecvMessage
|
* Function: http_RecvMessage
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN SOCKINFO *info ; Socket information object
|
* IN SOCKINFO *info; Socket information object
|
||||||
* OUT http_parser_t* parser, HTTP parser object
|
* OUT http_parser_t* parser; HTTP parser object
|
||||||
* IN http_method_t request_method ; HTTP request method
|
* IN http_method_t request_method; HTTP request method
|
||||||
* IN OUT int* timeout_secs ; time out
|
* IN OUT int* timeout_secs; time out
|
||||||
* OUT int* http_error_code ; HTTP error code returned
|
* OUT int* http_error_code; HTTP error code returned
|
||||||
*
|
*
|
||||||
* Description: Get the data on the socket and take actions based on the
|
* Description:
|
||||||
* read data to modify the parser objects buffer. If an error is reported
|
* Get the data on the socket and take actions based on the read data
|
||||||
* while parsing the data, the error code is passed in the http_errr_code
|
* to modify the parser objects buffer. If an error is reported while
|
||||||
* parameter
|
* parsing the data, the error code is passed in the http_errr_code
|
||||||
*
|
* parameter
|
||||||
* Returns:
|
*
|
||||||
* UPNP_E_BAD_HTTPMSG
|
* Returns:
|
||||||
* UPNP_E_SUCCESS
|
* UPNP_E_BAD_HTTPMSG
|
||||||
************************************************************************/
|
* UPNP_E_SUCCESS
|
||||||
|
************************************************************************/
|
||||||
int http_RecvMessage( IN SOCKINFO *info, OUT http_parser_t* parser,
|
int http_RecvMessage( IN SOCKINFO *info, OUT http_parser_t* parser,
|
||||||
IN http_method_t request_method,
|
IN http_method_t request_method,
|
||||||
IN OUT int* timeout_secs,
|
IN OUT int* timeout_secs,
|
||||||
@ -124,302 +129,311 @@ int http_RecvMessage( IN SOCKINFO *info, OUT http_parser_t* parser,
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: http_SendMessage
|
* Function: http_SendMessage
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN SOCKINFO *info ; Socket information object
|
* IN SOCKINFO *info ; Socket information object
|
||||||
* IN OUT int * TimeOut ; time out value
|
* IN OUT int * TimeOut ; time out value
|
||||||
* IN const char* fmt, ... Pattern format to take actions upon
|
* IN const char* fmt, ... Pattern format to take actions upon
|
||||||
*
|
*
|
||||||
* Description: Sends a message to the destination based on the
|
* Description:
|
||||||
* IN const char* fmt parameter
|
* Sends a message to the destination based on the
|
||||||
* fmt types:
|
* IN const char* fmt parameter
|
||||||
* 'f': arg = const char * file name
|
* fmt types:
|
||||||
* 'm': arg1 = const char * mem_buffer; arg2= size_t buf_length
|
* 'f': arg = const char * file name
|
||||||
* E.g.:
|
* 'm': arg1 = const char * mem_buffer; arg2= size_t buf_length
|
||||||
* char *buf = "POST /xyz.cgi http/1.1\r\n\r\n";
|
* E.g.:
|
||||||
* char *filename = "foo.dat";
|
* char *buf = "POST /xyz.cgi http/1.1\r\n\r\n";
|
||||||
* int status = http_SendMessage( tcpsock, "mf",
|
* char *filename = "foo.dat";
|
||||||
* buf, strlen(buf), // args for memory buffer
|
* int status = http_SendMessage( tcpsock, "mf",
|
||||||
* filename ); // arg for file
|
* buf, strlen(buf), // args for memory buffer
|
||||||
*
|
* filename ); // arg for file
|
||||||
* Returns:
|
*
|
||||||
* UPNP_E_OUTOF_MEMORY
|
* Returns:
|
||||||
* UPNP_E_FILE_READ_ERROR
|
* UPNP_E_OUTOF_MEMORY
|
||||||
* UPNP_E_SUCCESS
|
* UPNP_E_FILE_READ_ERROR
|
||||||
************************************************************************/
|
* UPNP_E_SUCCESS
|
||||||
int http_SendMessage( IN SOCKINFO *info, IN OUT int* timeout_secs,
|
************************************************************************/
|
||||||
|
int http_SendMessage(
|
||||||
|
IN SOCKINFO *info,
|
||||||
|
IN OUT int* timeout_secs,
|
||||||
IN const char* fmt, ... );
|
IN const char* fmt, ... );
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: http_RequestAndResponse
|
* Function: http_RequestAndResponse
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN uri_type* destination ; Destination URI object which contains
|
* IN uri_type* destination; Destination URI object which contains
|
||||||
* remote IP address among other elements
|
* remote IP address among other elements
|
||||||
* IN const char* request ; Request to be sent
|
* IN const char* request; Request to be sent
|
||||||
* IN size_t request_length ; Length of the request
|
* IN size_t request_length; Length of the request
|
||||||
* IN http_method_t req_method ; HTTP Request method
|
* IN http_method_t req_method; HTTP Request method
|
||||||
* IN int timeout_secs ; time out value
|
* IN int timeout_secs; time out value
|
||||||
* OUT http_parser_t* response ; Parser object to receive the repsonse
|
* OUT http_parser_t* response; Parser object to receive the repsonse
|
||||||
*
|
*
|
||||||
* Description: Initiates socket, connects to the destination, sends a
|
* Description:
|
||||||
* request and waits for the response from the remote end
|
* Initiates socket, connects to the destination, sends a
|
||||||
*
|
* request and waits for the response from the remote end
|
||||||
* Returns:
|
*
|
||||||
* UPNP_E_SOCKET_ERROR
|
* Returns:
|
||||||
* UPNP_E_SOCKET_CONNECT
|
* UPNP_E_SOCKET_ERROR
|
||||||
* Error Codes returned by http_SendMessage
|
* UPNP_E_SOCKET_CONNECT
|
||||||
* Error Codes returned by http_RecvMessage
|
* Error Codes returned by http_SendMessage
|
||||||
************************************************************************/
|
* Error Codes returned by http_RecvMessage
|
||||||
int http_RequestAndResponse( IN uri_type* destination,
|
************************************************************************/
|
||||||
IN const char* request, IN size_t request_length,
|
int http_RequestAndResponse(
|
||||||
|
IN uri_type* destination,
|
||||||
|
IN const char* request,
|
||||||
|
IN size_t request_length,
|
||||||
IN http_method_t req_method,
|
IN http_method_t req_method,
|
||||||
IN int timeout_secs,
|
IN int timeout_secs,
|
||||||
OUT http_parser_t* response );
|
OUT http_parser_t* response );
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* return codes:
|
|
||||||
* 0 -- success
|
|
||||||
* UPNP_E_OUTOF_MEMORY
|
|
||||||
* UPNP_E_TIMEDOUT
|
|
||||||
* UPNP_E_BAD_REQUEST
|
|
||||||
* UPNP_E_BAD_RESPONSE
|
|
||||||
* UPNP_E_INVALID_URL
|
|
||||||
* UPNP_E_SOCKET_READ
|
|
||||||
* UPNP_E_SOCKET_WRITE
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_Download
|
* return codes:
|
||||||
*
|
* 0 -- success
|
||||||
* Parameters :
|
* UPNP_E_OUTOF_MEMORY
|
||||||
* IN const char* url_str : String as a URL
|
* UPNP_E_TIMEDOUT
|
||||||
* IN int timeout_secs : time out value
|
* UPNP_E_BAD_REQUEST
|
||||||
* OUT char** document : buffer to store the document extracted
|
* UPNP_E_BAD_RESPONSE
|
||||||
* from the donloaded message.
|
* UPNP_E_INVALID_URL
|
||||||
* OUT int* doc_length : length of the extracted document
|
* UPNP_E_SOCKET_READ
|
||||||
* OUT char* content_type : Type of content
|
* UPNP_E_SOCKET_WRITE
|
||||||
*
|
************************************************************************/
|
||||||
* Description : Download the document message and extract the document
|
|
||||||
* from the message.
|
|
||||||
*
|
/************************************************************************
|
||||||
* Return : int;
|
* Function: http_Download
|
||||||
* UPNP_E_SUCCESS;
|
*
|
||||||
* UPNP_E_INVALID_URL;
|
* Parameters:
|
||||||
*
|
* IN const char* url_str; String as a URL
|
||||||
*
|
* IN int timeout_secs; time out value
|
||||||
* Note :
|
* OUT char** document; buffer to store the document extracted
|
||||||
************************************************************************/
|
* from the donloaded message.
|
||||||
int http_Download( IN const char* url,
|
* OUT int* doc_length; length of the extracted document
|
||||||
|
* OUT char* content_type; Type of content
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Download the document message and extract the document
|
||||||
|
* from the message.
|
||||||
|
*
|
||||||
|
* Return: int
|
||||||
|
* UPNP_E_SUCCESS
|
||||||
|
* UPNP_E_INVALID_URL
|
||||||
|
************************************************************************/
|
||||||
|
int http_Download(
|
||||||
|
IN const char* url,
|
||||||
IN int timeout_secs,
|
IN int timeout_secs,
|
||||||
OUT char** document, OUT int* doc_length,
|
OUT char** document,
|
||||||
|
OUT int* doc_length,
|
||||||
OUT char* content_type );
|
OUT char* content_type );
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_WriteHttpPost
|
* Function: http_WriteHttpPost
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN void *Handle : Handle to the http post object
|
* IN void *Handle: Handle to the http post object
|
||||||
* IN char *buf : Buffer to send to peer, if format used
|
* IN char *buf: Buffer to send to peer, if format used
|
||||||
* is not UPNP_USING_CHUNKED,
|
* is not UPNP_USING_CHUNKED,
|
||||||
* IN unsigned int *size : Size of the data to be sent.
|
* IN unsigned int *size: Size of the data to be sent.
|
||||||
* IN int timeout : time out value
|
* IN int timeout: time out value
|
||||||
*
|
*
|
||||||
* Description : Formats data if format used is UPNP_USING_CHUNKED.
|
* Description:
|
||||||
* Writes data on the socket connected to the peer.
|
* Formats data if format used is UPNP_USING_CHUNKED.
|
||||||
*
|
* Writes data on the socket connected to the peer.
|
||||||
* Return : int ;
|
*
|
||||||
* UPNP_E_SUCCESS - On Success
|
* Return: int
|
||||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
* UPNP_E_SUCCESS - On Success
|
||||||
* -1 - On Socket Error.
|
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||||
*
|
* -1 - On Socket Error.
|
||||||
* Note :
|
************************************************************************/
|
||||||
************************************************************************/
|
|
||||||
int http_WriteHttpPost(IN void *Handle,
|
int http_WriteHttpPost(IN void *Handle,
|
||||||
IN char *buf,
|
IN char *buf,
|
||||||
IN unsigned int *size,
|
IN unsigned int *size,
|
||||||
IN int timeout);
|
IN int timeout);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_CloseHttpPost
|
* Function: http_CloseHttpPost
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN void *Handle : Handle to the http post object
|
* IN void *Handle; Handle to the http post object
|
||||||
* IN OUT int *httpStatus : HTTP status returned on receiving a
|
* IN OUT int *httpStatus; HTTP status returned on receiving a
|
||||||
* response message
|
* response message
|
||||||
* IN int timeout : time out value
|
* IN int timeout; time out value
|
||||||
*
|
*
|
||||||
* Description : Sends remaining data if using UPNP_USING_CHUNKED
|
* Description:
|
||||||
* format. Receives any more messages. Destroys socket and any socket
|
* Sends remaining data if using UPNP_USING_CHUNKED
|
||||||
* associated memory. Frees handle associated with the HTTP POST msg.
|
* format. Receives any more messages. Destroys socket and any socket
|
||||||
*
|
* associated memory. Frees handle associated with the HTTP POST msg.
|
||||||
* Return : int ;
|
*
|
||||||
* UPNP_E_SUCCESS - On Sucess ;
|
* Return: int
|
||||||
* UPNP_E_INVALID_PARAM - Invalid Parameter;
|
* UPNP_E_SUCCESS - On Sucess
|
||||||
*
|
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||||
* Note :
|
************************************************************************/
|
||||||
************************************************************************/
|
|
||||||
int http_CloseHttpPost(IN void *Handle,
|
int http_CloseHttpPost(IN void *Handle,
|
||||||
IN OUT int *httpStatus,
|
IN OUT int *httpStatus,
|
||||||
IN int timeout);
|
IN int timeout);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_OpenHttpPost
|
* Function: http_OpenHttpPost
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN const char *url_str : String as a URL
|
* IN const char *url_str; String as a URL
|
||||||
* IN OUT void **Handle : Pointer to buffer to store HTTP
|
* IN OUT void **Handle; Pointer to buffer to store HTTP
|
||||||
* post handle
|
* post handle
|
||||||
* IN const char *contentType : Type of content
|
* IN const char *contentType; Type of content
|
||||||
* IN int contentLength : length of content
|
* IN int contentLength; length of content
|
||||||
* IN int timeout : time out value
|
* IN int timeout; time out value
|
||||||
*
|
*
|
||||||
* Description : Makes the HTTP POST message, connects to the peer,
|
* Description:
|
||||||
* sends the HTTP POST request. Adds the post handle to buffer of
|
* Makes the HTTP POST message, connects to the peer,
|
||||||
* such handles
|
* sends the HTTP POST request. Adds the post handle to buffer of
|
||||||
*
|
* such handles
|
||||||
* Return : int;
|
*
|
||||||
* UPNP_E_SUCCESS - On Sucess ;
|
* Return : int;
|
||||||
* UPNP_E_INVALID_PARAM - Invalid Paramter ;
|
* UPNP_E_SUCCESS - On Sucess
|
||||||
* UPNP_E_OUTOF_MEMORY ;
|
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||||
* UPNP_E_SOCKET_ERROR ;
|
* UPNP_E_OUTOF_MEMORY
|
||||||
* UPNP_E_SOCKET_CONNECT ;
|
* UPNP_E_SOCKET_ERROR
|
||||||
*
|
* UPNP_E_SOCKET_CONNECT
|
||||||
* Note :
|
************************************************************************/
|
||||||
************************************************************************/
|
|
||||||
int http_OpenHttpPost(IN const char *url_str,
|
int http_OpenHttpPost(IN const char *url_str,
|
||||||
IN OUT void **Handle,
|
IN OUT void **Handle,
|
||||||
IN const char *contentType,
|
IN const char *contentType,
|
||||||
IN int contentLength,
|
IN int contentLength,
|
||||||
IN int timeout);
|
IN int timeout);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_ReadHttpGet
|
* Function: http_ReadHttpGet
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN void *Handle : Handle to the HTTP get object
|
* IN void *Handle; Handle to the HTTP get object
|
||||||
* IN OUT char *buf : Buffer to get the read and parsed data
|
* IN OUT char *buf; Buffer to get the read and parsed data
|
||||||
* IN OUT unsigned int *size : Size of tge buffer passed
|
* IN OUT unsigned int *size; Size of the buffer passed
|
||||||
* IN int timeout : time out value
|
* IN int timeout; time out value
|
||||||
*
|
*
|
||||||
* Description : Parses already existing data, then gets new data.
|
* Description:
|
||||||
* Parses and extracts information from the new data.
|
* Parses already existing data, then gets new data.
|
||||||
*
|
* Parses and extracts information from the new data.
|
||||||
* Return : int ;
|
*
|
||||||
* UPNP_E_SUCCESS - On Sucess ;
|
* Return: int
|
||||||
* UPNP_E_INVALID_PARAM - Invalid Parameter;
|
* UPNP_E_SUCCESS - On Sucess
|
||||||
* UPNP_E_BAD_RESPONSE ;
|
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||||
* UPNP_E_BAD_HTTPMSG ;
|
* UPNP_E_BAD_RESPONSE
|
||||||
*
|
* UPNP_E_BAD_HTTPMSG
|
||||||
* Note :
|
* UPNP_E_CANCELED
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int http_ReadHttpGet(IN void *Handle,
|
int http_ReadHttpGet(
|
||||||
|
IN void *Handle,
|
||||||
IN OUT char *buf,
|
IN OUT char *buf,
|
||||||
IN OUT unsigned int *size,
|
IN OUT unsigned int *size,
|
||||||
IN int timeout);
|
IN int timeout);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_HttpGetProgress
|
* Function: http_HttpGetProgress
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN void *Handle : Handle to the HTTP get object
|
* IN void *Handle; Handle to the HTTP get object
|
||||||
* OUT unsigned int *length : Buffer to get the read and parsed data
|
* OUT unsigned int *length; Buffer to get the read and parsed data
|
||||||
* OUT unsigned int *total : Size of tge buffer passed
|
* OUT unsigned int *total; Size of tge buffer passed
|
||||||
*
|
*
|
||||||
* Description : Extracts information from the Handle to the HTTP get
|
* Description:
|
||||||
* object.
|
* Extracts information from the Handle to the HTTP get object.
|
||||||
*
|
*
|
||||||
* Return : int ;
|
* Return: int
|
||||||
* UPNP_E_SUCCESS - On Sucess ;
|
* UPNP_E_SUCCESS - On Sucess
|
||||||
* UPNP_E_INVALID_PARAM - Invalid Parameter;
|
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||||
*
|
************************************************************************/
|
||||||
* Note :
|
int http_HttpGetProgress(
|
||||||
************************************************************************/
|
IN void *Handle,
|
||||||
int http_HttpGetProgress(IN void *Handle,
|
|
||||||
OUT unsigned int *length,
|
OUT unsigned int *length,
|
||||||
OUT unsigned int *total );
|
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
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
int http_CloseHttpGet(IN void *Handle);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_OpenHttpGet
|
* Function: http_CloseHttpGet
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN const char *url_str : String as a URL
|
* IN void *Handle; Handle to HTTP get object
|
||||||
* IN OUT void **Handle : Pointer to buffer to store HTTP
|
*
|
||||||
* post handle
|
* Description:
|
||||||
* IN OUT char **contentType : Type of content
|
* Clears the handle allocated for the HTTP GET operation
|
||||||
* OUT int *contentLength : length of content
|
* Clears socket states and memory allocated for socket operations.
|
||||||
* OUT int *httpStatus : HTTP status returned on receiving a
|
*
|
||||||
* response message
|
* Return: int
|
||||||
* IN int timeout : time out value
|
* UPNP_E_SUCCESS - On Success
|
||||||
*
|
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||||
* Description : Makes the HTTP GET message, connects to the peer,
|
************************************************************************/
|
||||||
* sends the HTTP GET request, gets the response and parses the
|
int http_CloseHttpGet(IN void *Handle);
|
||||||
* response.
|
|
||||||
*
|
|
||||||
* Return : int;
|
/************************************************************************
|
||||||
* UPNP_E_SUCCESS - On Success ;
|
* Function: http_OpenHttpGet
|
||||||
* UPNP_E_INVALID_PARAM - Invalid Paramters ;
|
*
|
||||||
* UPNP_E_OUTOF_MEMORY ;
|
* Parameters:
|
||||||
* UPNP_E_SOCKET_ERROR ;
|
* IN const char *url_str: String as a URL
|
||||||
* UPNP_E_BAD_RESPONSE ;
|
* IN OUT void **Handle: Pointer to buffer to store HTTP
|
||||||
*
|
* post handle
|
||||||
* Note :
|
* IN OUT char **contentType: Type of content
|
||||||
*
|
* OUT int *contentLength: length of content
|
||||||
************************************************************************/
|
* OUT int *httpStatus: HTTP status returned on receiving a
|
||||||
int http_OpenHttpGet(IN const char *url_str,
|
* 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 void **Handle,
|
||||||
IN OUT char **contentType,
|
IN OUT char **contentType,
|
||||||
OUT int *contentLength,
|
OUT int *contentLength,
|
||||||
OUT int *httpStatus,
|
OUT int *httpStatus,
|
||||||
IN int timeout);
|
IN int timeout);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_OpenHttpGetProxy
|
* Function: http_OpenHttpGetProxy
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN const char *url_str : String as a URL
|
* IN const char *url_str; String as a URL
|
||||||
* IN const char *proxy_str : String as a URL to the proxy
|
* IN const char *proxy_str; String as a URL
|
||||||
* IN OUT void **Handle : Pointer to buffer to store HTTP
|
* IN OUT void **Handle; Pointer to buffer to store HTTP
|
||||||
* post handle
|
* post handle
|
||||||
* IN OUT char **contentType : Type of content
|
* IN OUT char **contentType; Type of content
|
||||||
* OUT int *contentLength : length of content
|
* OUT int *contentLength; length of content
|
||||||
* OUT int *httpStatus : HTTP status returned on receiving a
|
* OUT int *httpStatus; HTTP status returned on receiving a
|
||||||
* response message
|
* response message
|
||||||
* IN int timeout : time out value
|
* IN int timeout: time out value
|
||||||
*
|
*
|
||||||
* Description : Makes the HTTP GET message, connects to the peer,
|
* Description:
|
||||||
* sends the HTTP GET request, gets the response and parses the
|
* Makes the HTTP GET message, connects to the peer,
|
||||||
* response.
|
* 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 ;
|
* Return: int
|
||||||
* UPNP_E_INVALID_PARAM - Invalid Paramters ;
|
* UPNP_E_SUCCESS - On Success
|
||||||
* UPNP_E_OUTOF_MEMORY ;
|
* UPNP_E_INVALID_PARAM - Invalid Paramters
|
||||||
* UPNP_E_SOCKET_ERROR ;
|
* UPNP_E_OUTOF_MEMORY
|
||||||
* UPNP_E_BAD_RESPONSE ;
|
* UPNP_E_SOCKET_ERROR
|
||||||
*
|
* UPNP_E_BAD_RESPONSE
|
||||||
* Note :
|
************************************************************************/
|
||||||
*
|
|
||||||
************************************************************************/
|
|
||||||
int http_OpenHttpGetProxy(IN const char *url_str,
|
int http_OpenHttpGetProxy(IN const char *url_str,
|
||||||
IN const char *proxy_str,
|
IN const char *proxy_str,
|
||||||
IN OUT void **Handle,
|
IN OUT void **Handle,
|
||||||
@ -430,126 +444,134 @@ int http_OpenHttpGetProxy(IN const char *url_str,
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_SendStatusResponse
|
* Function: http_SendStatusResponse
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN SOCKINFO *info : Socket information object
|
* IN SOCKINFO *info; Socket information object
|
||||||
* IN int http_status_code : error code returned while making
|
* IN int http_status_code; error code returned while making
|
||||||
* or sending the response message
|
* or sending the response message
|
||||||
* IN int request_major_version : request major version
|
* IN int request_major_version; request major version
|
||||||
* IN int request_minor_version : request minor version
|
* IN int request_minor_version; request minor version
|
||||||
*
|
*
|
||||||
* Description : Generate a response message for the status query and
|
* Description:
|
||||||
* send the status response.
|
* Generate a response message for the status query and send the
|
||||||
*
|
* status response.
|
||||||
* Return : int;
|
*
|
||||||
* 0 -- success
|
* Return: int
|
||||||
* UPNP_E_OUTOF_MEMORY
|
* 0 -- success
|
||||||
* UPNP_E_SOCKET_WRITE
|
* UPNP_E_OUTOF_MEMORY
|
||||||
* UPNP_E_TIMEDOUT
|
* UPNP_E_SOCKET_WRITE
|
||||||
*
|
* UPNP_E_TIMEDOUT
|
||||||
* Note :
|
************************************************************************/
|
||||||
************************************************************************/
|
int http_SendStatusResponse(
|
||||||
int http_SendStatusResponse( IN SOCKINFO *info, IN int http_status_code,
|
IN SOCKINFO *info,
|
||||||
|
IN int http_status_code,
|
||||||
IN int request_major_version,
|
IN int request_major_version,
|
||||||
IN int request_minor_version );
|
IN int request_minor_version );
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : http_MakeMessage
|
* Function: http_MakeMessage
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* INOUT membuffer* buf : buffer with the contents of the
|
* INOUT membuffer* buf; buffer with the contents of the
|
||||||
* message
|
* message
|
||||||
* IN int http_major_version : HTTP major version
|
* IN int http_major_version; HTTP major version
|
||||||
* IN int http_minor_version : HTTP minor version
|
* IN int http_minor_version; HTTP minor version
|
||||||
* IN const char* fmt : Pattern format
|
* IN const char* fmt; Pattern format
|
||||||
* ... :
|
* ...;
|
||||||
*
|
*
|
||||||
* Description : Generate an HTTP message based on the format that is
|
* Description:
|
||||||
* specified in the input parameters.
|
* Generate an HTTP message based on the format that is specified
|
||||||
*
|
* in the input parameters.
|
||||||
* fmt types:
|
*
|
||||||
* 's': arg = const char* C_string
|
* fmt types:
|
||||||
* 'b': arg1 = const char* buf; arg2 = size_t buf_length
|
* 'B': arg = int status_code
|
||||||
* memory ptr
|
* appends content-length, content-type and HTML body
|
||||||
* 'c': (no args) appends CRLF "\r\n"
|
* for given code
|
||||||
* 'd': arg = int number // appends decimal number
|
* 'b': arg1 = const char* buf;
|
||||||
* 'h': arg = off_t number // appends off_t number
|
* arg2 = size_t buf_length memory ptr
|
||||||
* 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt
|
* 'C': (no args) appends a HTTP CONNECTION: close header
|
||||||
* 'D': (no args) appends HTTP DATE: header
|
* depending on major,minor version
|
||||||
* 'S': (no args) appends HTTP SERVER: header
|
* 'c': (no args) appends CRLF "\r\n"
|
||||||
* 'U': (no args) appends HTTP USER-AGENT: header
|
* 'D': (no args) appends HTTP DATE: header
|
||||||
* 'C': (no args) appends a HTTP CONNECTION: close header
|
* 'd': arg = int number // appends decimal number
|
||||||
* depending on major,minor version
|
* 'G': arg = range information // add range header
|
||||||
* 'N': arg1 = int content_length // content-length header
|
* 'h': arg = off_t number // appends off_t number
|
||||||
* 'Q': arg1 = http_method_t; arg2 = char* url;
|
* 'K': (no args) // add chunky header
|
||||||
* arg3 = int url_length // start line of request
|
* 'N': arg1 = off_t content_length // content-length header
|
||||||
* 'R': arg = int status_code // adds a response start line
|
* 'q': arg1 = http_method_t // request start line and HOST header
|
||||||
* 'B': arg = int status_code
|
* arg2 = (uri_type *)
|
||||||
* appends content-length, content-type and HTML body for given code
|
* 'Q': arg1 = http_method_t; // start line of request
|
||||||
* 'T': arg = char * content_type; format e.g: "text/html";
|
* arg2 = char* url;
|
||||||
* content-type header
|
* arg3 = size_t url_length
|
||||||
*
|
* 'R': arg = int status_code // adds a response start line
|
||||||
* Return : int;
|
* 'S': (no args) appends HTTP SERVER: header
|
||||||
* 0 - On Success
|
* 's': arg = const char* C_string
|
||||||
* UPNP_E_OUTOF_MEMORY
|
* 'T': arg = char * content_type; format
|
||||||
* UPNP_E_INVALID_URL;
|
* e.g: "text/html"; content-type header
|
||||||
*
|
* 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt
|
||||||
* Note :
|
* 'U': (no args) appends HTTP USER-AGENT: header
|
||||||
************************************************************************/
|
* 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent
|
||||||
int http_MakeMessage( INOUT membuffer* buf,
|
*
|
||||||
|
* 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_major_version,
|
||||||
IN int http_minor_version,
|
IN int http_minor_version,
|
||||||
IN const char* fmt, ... );
|
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
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
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
|
* Function: http_CalcResponseVersion
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* IN const char *url_str : String as a URL
|
* IN int request_major_vers; Request major version
|
||||||
* IN OUT void **Handle : Pointer to buffer to store HTTP
|
* IN int request_minor_vers; Request minor version
|
||||||
* post handle
|
* OUT int* response_major_vers; Response mojor version
|
||||||
* IN OUT char **contentType : Type of content
|
* OUT int* response_minor_vers; Response minor version
|
||||||
* OUT int *contentLength : length of content
|
*
|
||||||
* OUT int *httpStatus : HTTP status returned on receiving a
|
* Description:
|
||||||
* response message
|
* Calculate HTTP response versions based on the request versions.
|
||||||
* IN int timeout : time out value
|
*
|
||||||
*
|
* Return: void
|
||||||
* Description : Makes the HTTP GET message, connects to the peer,
|
************************************************************************/
|
||||||
* sends the HTTP GET request, gets the response and parses the
|
void http_CalcResponseVersion(
|
||||||
* response.
|
IN int request_major_vers,
|
||||||
*
|
IN int request_minor_vers,
|
||||||
* Return : int;
|
OUT int* response_major_vers,
|
||||||
* UPNP_E_SUCCESS - On Success ;
|
OUT int* response_minor_vers );
|
||||||
* UPNP_E_INVALID_PARAM - Invalid Paramters ;
|
|
||||||
* UPNP_E_OUTOF_MEMORY ;
|
|
||||||
* UPNP_E_SOCKET_ERROR ;
|
/************************************************************************
|
||||||
* UPNP_E_BAD_RESPONSE ;
|
* Function: http_OpenHttpGetEx
|
||||||
*
|
*
|
||||||
* Note :
|
* 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,
|
int http_OpenHttpGetEx(IN const char *url_str,
|
||||||
IN OUT void **Handle,
|
IN OUT void **Handle,
|
||||||
IN OUT char **contentType,
|
IN OUT char **contentType,
|
||||||
@ -559,19 +581,19 @@ int http_OpenHttpGetEx(IN const char *url_str,
|
|||||||
IN int highRange,
|
IN int highRange,
|
||||||
IN int timeout);
|
IN int timeout);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : get_sdk_info
|
* Function: get_sdk_info
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters:
|
||||||
* OUT char *info ;
|
* OUT char *info; buffer to store the operating system information
|
||||||
*
|
*
|
||||||
* Description : Returns the server information for the operating
|
* Description:
|
||||||
* system
|
* Returns the server information for the operating system
|
||||||
*
|
*
|
||||||
* Return : void ;
|
* Return:
|
||||||
*
|
* UPNP_INLINE void
|
||||||
* Note :
|
************************************************************************/
|
||||||
************************************************************************/
|
|
||||||
void get_sdk_info( OUT char *info );
|
void get_sdk_info( OUT char *info );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -580,3 +602,4 @@ void get_sdk_info( OUT char *info );
|
|||||||
|
|
||||||
|
|
||||||
#endif // GENLIB_NET_HTTP_HTTPREADWRITE_H
|
#endif // GENLIB_NET_HTTP_HTTPREADWRITE_H
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user