UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
Control Point http API
enum  Upnp_HttpMethod {
  UPNP_HTTPMETHOD_PUT , UPNP_HTTPMETHOD_DELETE , UPNP_HTTPMETHOD_GET , UPNP_HTTPMETHOD_HEAD ,
  UPNP_HTTPMETHOD_POST
}
 Different HTTP methods. More...
 
PUPNP_Api int UpnpDownloadUrlItem (const char *url, char **outBuf, char *contentType)
 Downloads a file specified in a URL.
 
PUPNP_Api int UpnpOpenHttpGet (const char *url, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
 Gets a file specified in a URL.
 
PUPNP_Api int UpnpOpenHttpGetProxy (const char *url, const char *proxy_str, void **handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
 Gets a file specified in a URL through the specified proxy.
 
PUPNP_Api int UpnpOpenHttpGetEx (const char *url_str, void **Handle, char **contentType, int *contentLength, int *httpStatus, int lowRange, int highRange, int timeout)
 Gets specified number of bytes from a file specified in the URL.
 
PUPNP_Api int UpnpReadHttpGet (void *Handle, char *buf, size_t *size, int timeout)
 Gets specified number of bytes from a file specified in a URL.
 
PUPNP_Api int UpnpHttpGetProgress (void *Handle, size_t *length, size_t *total)
 Retrieve progress information of a http-get transfer.
 
PUPNP_Api int UpnpCancelHttpGet (void *Handle)
 Set the cancel flag of the handle parameter.
 
PUPNP_Api int UpnpCloseHttpGet (void *Handle)
 Closes the connection and frees memory that was allocated for the handle parameter.
 
PUPNP_Api int UpnpOpenHttpPost (const char *url, void **handle, const char *contentType, int contentLength, int timeout)
 Makes an HTTP POST request message, opens a connection to the server and sends the POST request to the server if the connection to the server succeeds.
 
PUPNP_Api int UpnpWriteHttpPost (void *handle, char *buf, size_t *size, int timeout)
 Sends a request to a server to copy the contents of a buffer to the URI specified in the UpnpOpenHttpPost() call.
 
PUPNP_Api int UpnpCloseHttpPost (void *handle, int *httpStatus, int timeout)
 Sends and receives any pending data, closes the connection with the server, and frees memory allocated during the UpnpOpenHttpPost() call.
 
PUPNP_Api int UpnpOpenHttpConnection (const char *url, void **handle, int timeout)
 Opens a connection to the server.
 
PUPNP_Api int UpnpMakeHttpRequest (Upnp_HttpMethod method, const char *url, void *handle, UpnpString *headers, const char *contentType, int contentLength, int timeout)
 Makes a HTTP request using a connection previously created by UpnpOpenHttpConnection().
 
PUPNP_Api int UpnpWriteHttpRequest (void *handle, char *buf, size_t *size, int timeout)
 Writes the content of a HTTP request initiated by a UpnpMakeHttpRequest() call. The end of the content should be indicated by a call to UpnpEndHttpRequest().
 
PUPNP_Api int UpnpEndHttpRequest (void *handle, int timeout)
 Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest().
 
PUPNP_Api int UpnpGetHttpResponse (void *handle, UpnpString *headers, char **contentType, int *contentLength, int *httpStatus, int timeout)
 Gets the response from the server using a connection previously created by UpnpOpenHttpConnection().
 
PUPNP_Api int UpnpReadHttpResponse (void *handle, char *buf, size_t *size, int timeout)
 Reads the content of a response using a connection previously created by UpnpOpenHttpConnection().
 
PUPNP_Api int UpnpCloseHttpConnection (void *handle)
 Closes the connection created with UpnpOpenHttpConnection() and frees any memory associated with the connection.
 
PUPNP_Api int UpnpDownloadXmlDoc (const char *url, IXML_Document **xmlDoc)
 Downloads an XML document specified in a URL.
 

Detailed Description

Enumeration Type Documentation

◆ Upnp_HttpMethod

Different HTTP methods.

Enumerator
UPNP_HTTPMETHOD_PUT 

PUT.

UPNP_HTTPMETHOD_DELETE 

DELETE.

UPNP_HTTPMETHOD_GET 

GET.

UPNP_HTTPMETHOD_HEAD 

HEAD.

UPNP_HTTPMETHOD_POST 

POST.

Definition at line 1945 of file API.hpp.

Function Documentation

◆ UpnpDownloadUrlItem()

PUPNP_Api int UpnpDownloadUrlItem ( const char *  url,
char **  outBuf,
char *  contentType 
)

Downloads a file specified in a URL.

The SDK allocates the memory for outBuf and the application is responsible for freeing this memory. Note that the item is passed as a single buffer. Large items should not be transferred using this function.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either url, outBuf or contentType is not a valid pointer.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_NETWORK_ERROR: A network error occurred.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_READ: An error or timeout occurred reading from a socket.
  • UPNP_E_SOCKET_BIND: An error occurred binding a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]urlURL of an item to download.
[out]outBufBuffer to store the downloaded item.
[out]contentTypeHTTP header value content type if present. It should be at least LINE_SIZE bytes in size.

Definition at line 3058 of file upnpapi.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpnpOpenHttpGet()

PUPNP_Api int UpnpOpenHttpGet ( const char *  url,
void **  handle,
char **  contentType,
int *  contentLength,
int *  httpStatus,
int  timeout 
)

Gets a file specified in a URL.

The SDK allocates the memory for handle and contentType, the application is responsible for freeing this memory.

Note
Memory for contentType is freed when freeing the memory for handle.
Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either url, handle, is not a valid pointer.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_NETWORK_ERROR: A network error occurred.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_READ: An error or timeout occurred reading from a socket.
  • UPNP_E_SOCKET_BIND: An error occurred binding a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
  • UPNP_E_BAD_RESPONSE: A bad response was received from the remote server.
Parameters
[in]urlThe URL of an item to get.
[in,out]handleA pointer to store the handle for this connection.
[in,out]contentTypeA buffer to store the media type of the item.
[in,out]contentLengthA pointer to store the length of the item.
[in,out]httpStatusThe status returned on receiving a response message.
[in]timeoutThe time out value sent with the request during which a response is expected from the server, failing which, an error is reported back to the user. If value is negative, timeout is infinite.

Definition at line 2969 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpOpenHttpGetProxy()

PUPNP_Api int UpnpOpenHttpGetProxy ( const char *  url,
const char *  proxy_str,
void **  handle,
char **  contentType,
int *  contentLength,
int *  httpStatus,
int  timeout 
)

Gets a file specified in a URL through the specified proxy.

The SDK allocates the memory for handle and contentType, the application is responsible for freeing this memory.

Note
Memory for contentType is freed when freeing the memory for handle.
Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either url, handle, is not a valid pointer.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_NETWORK_ERROR: A network error occurred.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_READ: An error or timeout occurred reading from a socket.
  • UPNP_E_SOCKET_BIND: An error occurred binding a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
  • UPNP_E_BAD_RESPONSE: A bad response was received from the remote server.
Parameters
[in]urlThe URL of an item to get.
[in]proxy_strThe URL of the proxy.
[in,out]handleA pointer to store the handle for this connection.
[in,out]contentTypeA buffer to store the media type of the item.
[in,out]contentLengthA pointer to store the length of the item.
[in,out]httpStatusThe status returned on receiving a response message.
[in]timeoutThe time out value sent with the request during which a response is expected from the server, failing which, an error is reported back to the user. If value is negative, timeout is infinite.

Definition at line 2986 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpOpenHttpGetEx()

PUPNP_Api int UpnpOpenHttpGetEx ( const char *  url_str,
void **  Handle,
char **  contentType,
int *  contentLength,
int *  httpStatus,
int  lowRange,
int  highRange,
int  timeout 
)

Gets specified number of bytes from a file specified in the URL.

The number of bytes is specified through a low count and a high count which are passed as a range of bytes for the request. The SDK allocates the memory for handle and contentType, the application is responsible for freeing this memory.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either url, handle, contentType, contentLength or httpStatus is not a valid pointer.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_NETWORK_ERROR: A network error occurred.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_READ: An error or timeout occurred reading from a socket.
  • UPNP_E_SOCKET_BIND: An error occurred binding a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
  • UPNP_E_BAD_RESPONSE: A bad response was received from the remote server.
Parameters
[in]url_strThe URL of the item to get.
[in,out]HandleA pointer to store the handle for this connection.
[in,out]contentTypeA buffer to store the media type of the item.
[in,out]contentLengthA buffer to store the length of the item.
[in,out]httpStatusThe status returned on receiving a response message from the remote server.
[in]lowRangeAn integer value representing the low end of a range to retrieve.
[in]highRangeAn integer value representing the high end of a range to retrieve.
[in]timeoutA time out value sent with the request during which a response is expected from the server, failing which, an error is reported back to the user. If value is negative, timeout is infinite.

Definition at line 3004 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpReadHttpGet()

PUPNP_Api int UpnpReadHttpGet ( void *  Handle,
char *  buf,
size_t *  size,
int  timeout 
)

Gets specified number of bytes from a file specified in a URL.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either handle, buf or size is not a valid pointer.
  • UPNP_E_BAD_RESPONSE: A bad response was received from the remote server.
  • UPNP_E_BAD_HTTPMSG: Either the request or response was in the incorrect format.
  • UPNP_E_CANCELED: another thread called UpnpCancelHttpGet.
Note: In case of return values, the status code parameter of the passed in handle value may provide additional information on the return value.
Parameters
[in]HandleThe token created by the call to UpnpOpenHttpGet.
[in,out]bufThe buffer to store the read item.
[in,out]sizeThe size of the buffer to be read.
[in]timeoutThe time out value sent with the request during which a response is expected from the server, failing which, an error is reported back to the user. If value is negative, timeout is infinite.

Definition at line 3015 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpHttpGetProgress()

PUPNP_Api int UpnpHttpGetProgress ( void *  Handle,
size_t *  length,
size_t *  total 
)

Retrieve progress information of a http-get transfer.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either handle, length or total is not a valid pointer.
Parameters
[in]HandleThe token created by the call to UpnpOpenHttpGet.
[out]lengthThe number of bytes received.
[out]totalThe content length.

Definition at line 3019 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpCancelHttpGet()

PUPNP_Api int UpnpCancelHttpGet ( void *  Handle)

Set the cancel flag of the handle parameter.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: handle is not a valid pointer.
Parameters
[in]HandleThe handle of the connection created by the call to UpnpOpenHttpGet.

Definition at line 3011 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpCloseHttpGet()

PUPNP_Api int UpnpCloseHttpGet ( void *  Handle)

Closes the connection and frees memory that was allocated for the handle parameter.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: handle is not a valid pointer.
Parameters
[in]HandleThe handle of the connection created by the call to UpnpOpenHttpGet.

Definition at line 3013 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpOpenHttpPost()

PUPNP_Api int UpnpOpenHttpPost ( const char *  url,
void **  handle,
const char *  contentType,
int  contentLength,
int  timeout 
)

Makes an HTTP POST request message, opens a connection to the server and sends the POST request to the server if the connection to the server succeeds.

The SDK allocates the memory for handle, the application is responsible for freeing this memory.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either url, handle or contentType is not a valid pointer.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_SOCKET_ERROR: Error occured allocating a socket and resources or an error occurred binding a socket.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]urlThe URL in which to send the POST request.
[in,out]handleA pointer in which to store the handle for this connection. This handle is required for futher operations over this connection.
[in]contentTypeA buffer to store the media type of content being sent. Can be NULL.
[in]contentLengthThe length of the content, in bytes, being posted.
[in]timeoutThe time out value sent with the request during which a response is expected from the receiver, failing which, an error is reported. If value is negative, timeout is infinite.

Definition at line 2945 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpWriteHttpPost()

PUPNP_Api int UpnpWriteHttpPost ( void *  handle,
char *  buf,
size_t *  size,
int  timeout 
)

Sends a request to a server to copy the contents of a buffer to the URI specified in the UpnpOpenHttpPost() call.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either handle, buf or size is not a valid pointer.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]handleThe handle of the connection created by the call to UpnpOpenHttpPost().
[in]bufThe buffer to be posted.
[in]sizeThe size, in bytes of buf.
[in]timeoutA timeout value sent with the request during which a response is expected from the server, failing which, an error is reported. If value is negative, timeout is infinite.

Definition at line 2955 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpCloseHttpPost()

PUPNP_Api int UpnpCloseHttpPost ( void *  handle,
int *  httpStatus,
int  timeout 
)

Sends and receives any pending data, closes the connection with the server, and frees memory allocated during the UpnpOpenHttpPost() call.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either handle, or httpStatus is not a valid pointer.
  • UPNP_E_SOCKET_READ: An error or timeout occurred reading from a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]handleThe handle of the connection to close, created by the call to UpnpOpenHttpPost().
[in,out]httpStatusA pointer to a buffer to store the final status of the connection.
[in]timeoutA time out value sent with the request during which a response is expected from the server, failing which, an error is reported. If value is negative, timeout is infinite.

Definition at line 2959 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpOpenHttpConnection()

PUPNP_Api int UpnpOpenHttpConnection ( const char *  url,
void **  handle,
int  timeout 
)

Opens a connection to the server.

The SDK allocates the memory for handle, the application is responsible for freeing this memory.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either url, or handle is not a valid pointer.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_SOCKET_ERROR: Error occured allocating a socket and resources or an error occurred binding a socket.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]urlThe URL which contains the host, and the scheme to make the connection.
[in,out]handleA pointer in which to store the handle for this connection. This handle is required for futher operations over this connection.
[in]timeoutThe time out value sent with the request during which a response is expected from the receiver, failing which, an error is reported. If value is negative, timeout is infinite.

Definition at line 3023 of file upnpapi.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpnpMakeHttpRequest()

PUPNP_Api int UpnpMakeHttpRequest ( Upnp_HttpMethod  method,
const char *  url,
void *  handle,
UpnpString headers,
const char *  contentType,
int  contentLength,
int  timeout 
)

Makes a HTTP request using a connection previously created by UpnpOpenHttpConnection().

Note
Trying to make another request while a request is already being processed results in undefined behavior. It's up to the user to end a previous request by calling UpnpEndHttpRequest().
Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either url, handle or contentType is not a valid pointer.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_SOCKET_ERROR: Error occured allocating a socket and resources or an error occurred binding a socket.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]methodThe method to use to make the request.
[in]urlThe URL to use to make the request. The URL should use the same scheme used to create the connection, but the host can be different if the request is being proxied.
[in]handleThe handle to the connection.
[in]headersHeaders to be used for the request. Each header should be terminated by a CRLF as specified in the HTTP specification. If NULL then the default headers will be used.
[in]contentTypeThe media type of content being sent. Can be NULL.
[in]contentLengthThe length of the content being sent, in bytes. Set to UPNP_USING_CHUNKED to use chunked encoding, or UPNP_UNTIL_CLOSE to avoid specifying the content length to the server. In this case the request is considered unfinished until the connection is closed.
[in]timeoutThe time out value sent with the request during which a response is expected from the receiver, failing which, an error is reported. If value is negative, timeout is infinite.

Definition at line 3027 of file upnpapi.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpnpWriteHttpRequest()

PUPNP_Api int UpnpWriteHttpRequest ( void *  handle,
char *  buf,
size_t *  size,
int  timeout 
)

Writes the content of a HTTP request initiated by a UpnpMakeHttpRequest() call. The end of the content should be indicated by a call to UpnpEndHttpRequest().

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either handle, buf or size is not a valid pointer.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]handleThe handle of the connection created by the call to UpnpOpenHttpConnection().
[in]bufThe buffer containing date to be written.
[in]sizeThe size, in bytes of buf.
[in]timeoutA timeout value sent with the request during which a response is expected from the server, failing which, an error is reported. If value is negative, timeout is infinite.

Definition at line 3034 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpEndHttpRequest()

PUPNP_Api int UpnpEndHttpRequest ( void *  handle,
int  timeout 
)

Indicates the end of a HTTP request previously made by UpnpMakeHttpRequest().

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: handle is not a valid pointer.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_SOCKET_ERROR: Error occured allocating a socket and resources or an error occurred binding a socket.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]handleThe handle to the connection.
[in]timeoutThe time out value sent with the request during which a response is expected from the receiver, failing which, an error is reported. If value is negative, timeout is infinite.

Definition at line 3038 of file upnpapi.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpnpGetHttpResponse()

PUPNP_Api int UpnpGetHttpResponse ( void *  handle,
UpnpString headers,
char **  contentType,
int *  contentLength,
int *  httpStatus,
int  timeout 
)

Gets the response from the server using a connection previously created by UpnpOpenHttpConnection().

Note
Memory for contentType is only valid until the next call to the HTTP API for the same connection.
Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either handle, is not a valid pointer.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: Insufficient resources exist to download this file.
  • UPNP_E_NETWORK_ERROR: A network error occurred.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_READ: An error or timeout occurred reading from a socket.
  • UPNP_E_SOCKET_BIND: An error occurred binding a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
  • UPNP_E_BAD_RESPONSE: A bad response was received from the remote server.
Parameters
[in]handleThe handle of the connection created by the call to UpnpOpenHttpConnection().
[in]headersHeaders sent by the server for the response. If NULL then the headers are not copied.
[out]contentTypeA buffer to store the media type of the item.
[out]contentLengthA pointer to store the length of the item.
[out]httpStatusThe status returned on receiving a response message.
[in]timeoutThe time out value sent with the request during which a response is expected from the server, failing which, an error is reported back to the user. If value is negative, timeout is infinite.

Definition at line 3042 of file upnpapi.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpnpReadHttpResponse()

PUPNP_Api int UpnpReadHttpResponse ( void *  handle,
char *  buf,
size_t *  size,
int  timeout 
)

Reads the content of a response using a connection previously created by UpnpOpenHttpConnection().

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either handle, buf or size is not a valid pointer.
  • UPNP_E_BAD_RESPONSE: A bad response was received from the remote server.
  • UPNP_E_BAD_HTTPMSG: Either the request or response was in the incorrect format.
  • UPNP_E_CANCELED: another thread called UpnpCancelHttpGet.
Note: In case of return values, the status code parameter of the passed in handle value may provide additional information on the return value.
Parameters
[in]handleThe handle of the connection created by the call to UpnpOpenHttpConnection().
[in,out]bufThe buffer to store the read item.
[in,out]sizeThe size of the buffer to be read.
[in]timeoutThe time out value sent with the request during which a response is expected from the server, failing which, an error is reported back to the user. If value is negative, timeout is infinite.

Definition at line 3048 of file upnpapi.cpp.

+ Here is the call graph for this function:

◆ UpnpCloseHttpConnection()

PUPNP_Api int UpnpCloseHttpConnection ( void *  handle)

Closes the connection created with UpnpOpenHttpConnection() and frees any memory associated with the connection.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: handle, or is not a valid pointer.
  • UPNP_E_SOCKET_READ: An error or timeout occurred reading from a socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]handleThe handle of the connection to close, created by the call to UpnpOpenHttpPost().

Definition at line 3052 of file upnpapi.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpnpDownloadXmlDoc()

PUPNP_Api int UpnpDownloadXmlDoc ( const char *  url,
IXML_Document **  xmlDoc 
)

Downloads an XML document specified in a URL.

The SDK parses the document and returns it in the form of a DOM document. The application is responsible for freeing the DOM document.

Returns
An integer representing one of the following:
  • UPNP_E_SUCCESS: The operation completed successfully.
  • UPNP_E_INVALID_PARAM: Either url or xmlDoc is not a valid pointer.
  • UPNP_E_INVALID_DESC: The XML document was not found or it does not contain a valid XML description.
  • UPNP_E_INVALID_URL: The url is not a valid URL.
  • UPNP_E_OUTOF_MEMORY: There are insufficient resources to download the XML document.
  • UPNP_E_NETWORK_ERROR: A network error occurred.
  • UPNP_E_SOCKET_WRITE: An error or timeout occurred writing to a socket.
  • UPNP_E_SOCKET_READ: An error or timeout occurred reading from a socket.
  • UPNP_E_SOCKET_BIND: An error occurred binding a socket.
  • UPNP_E_SOCKET_CONNECT: An error occurred connecting the socket.
  • UPNP_E_OUTOF_SOCKET: Too many sockets are currently allocated.
Parameters
[in]urlURL of the XML document.
[out]xmlDocA pointer to a variable in which to store the pointer to the XML document.

Definition at line 3080 of file upnpapi.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: