Doxygen.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@399 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
1401fce206
commit
1175a0cadb
2
Doxyfile
2
Doxyfile
@ -1029,7 +1029,7 @@ INCLUDE_FILE_PATTERNS =
|
|||||||
# undefined via #undef or recursively expanded use the := operator
|
# undefined via #undef or recursively expanded use the := operator
|
||||||
# instead of the = operator.
|
# instead of the = operator.
|
||||||
|
|
||||||
PREDEFINED = DEBUG INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS EXCLUDE_GENA=0
|
PREDEFINED = DEBUG INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS EXCLUDE_GENA=0 EXCLUDE_DOM=0
|
||||||
|
|
||||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||||
# this tag can be used to specify a list of macro names that should be expanded.
|
# this tag can be used to specify a list of macro names that should be expanded.
|
||||||
|
320
upnp/inc/upnp.h
320
upnp/inc/upnp.h
@ -784,10 +784,10 @@ extern "C" {
|
|||||||
EXPORT_SPEC int UpnpInit(
|
EXPORT_SPEC int UpnpInit(
|
||||||
/*! The host local IP address to use, in string format, for example
|
/*! The host local IP address to use, in string format, for example
|
||||||
* "192.168.0.1", or \c NULL to use the first adapter's IP address. */
|
* "192.168.0.1", or \c NULL to use the first adapter's IP address. */
|
||||||
IN const char *HostIP,
|
const char *HostIP,
|
||||||
/*! Local Port to listen for incoming connections
|
/*! Local Port to listen for incoming connections
|
||||||
* \c NULL will pick an arbitrary free port. */
|
* \c NULL will pick an arbitrary free port. */
|
||||||
IN unsigned short DestPort);
|
unsigned short DestPort);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -826,10 +826,10 @@ EXPORT_SPEC int UpnpInit2(
|
|||||||
/*! The interface name to use by the UPnP SDK operations.
|
/*! The interface name to use by the UPnP SDK operations.
|
||||||
* Examples: "eth0", "xl0", "Local Area Connection", \c NULL to
|
* Examples: "eth0", "xl0", "Local Area Connection", \c NULL to
|
||||||
* use the first suitable interface. */
|
* use the first suitable interface. */
|
||||||
IN const char *IfName,
|
const char *IfName,
|
||||||
/*! Local Port to listen for incoming connections.
|
/*! Local Port to listen for incoming connections.
|
||||||
* \c NULL will pick an arbitrary free port. */
|
* \c NULL will pick an arbitrary free port. */
|
||||||
IN unsigned short DestPort);
|
unsigned short DestPort);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -946,15 +946,15 @@ EXPORT_SPEC char *UpnpGetServerIp6Address();
|
|||||||
* register this root device.
|
* register this root device.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpRegisterRootDevice(
|
EXPORT_SPEC int UpnpRegisterRootDevice(
|
||||||
/*! Pointer to a string containing the description URL for this root device
|
/*! [in] Pointer to a string containing the description URL for this root device
|
||||||
* instance. */
|
* instance. */
|
||||||
IN const char *DescUrl,
|
const char *DescUrl,
|
||||||
/*! Pointer to the callback function for receiving asynchronous events. */
|
/*! [in] Pointer to the callback function for receiving asynchronous events. */
|
||||||
IN Upnp_FunPtr Callback,
|
Upnp_FunPtr Callback,
|
||||||
/*! Pointer to user data returned with the callback function when invoked. */
|
/*! [in] Pointer to user data returned with the callback function when invoked. */
|
||||||
IN const void *Cookie,
|
const void *Cookie,
|
||||||
/*! Pointer to a variable to store the new device handle. */
|
/*! [out] Pointer to a variable to store the new device handle. */
|
||||||
OUT UpnpDevice_Handle *Hnd);
|
UpnpDevice_Handle *Hnd);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Registers a device application with the UPnP Library. Similar to
|
* \brief Registers a device application with the UPnP Library. Similar to
|
||||||
@ -1025,24 +1025,24 @@ EXPORT_SPEC int UpnpRegisterRootDevice(
|
|||||||
* description document.
|
* description document.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpRegisterRootDevice2(
|
EXPORT_SPEC int UpnpRegisterRootDevice2(
|
||||||
/*! The type of the description document. */
|
/*! [in] The type of the description document. */
|
||||||
IN Upnp_DescType descriptionType,
|
Upnp_DescType descriptionType,
|
||||||
/*! Treated as a URL, file name or memory buffer depending on
|
/*! [in] Treated as a URL, file name or memory buffer depending on
|
||||||
* description type. */
|
* description type. */
|
||||||
IN const char* description,
|
const char* description,
|
||||||
/*! The length of memory buffer if passing a description in a buffer,
|
/*! [in] The length of memory buffer if passing a description in a buffer,
|
||||||
* otherwise it is ignored. */
|
* otherwise it is ignored. */
|
||||||
IN size_t bufferLen,
|
size_t bufferLen,
|
||||||
/*! If nonzero, \c URLBase of description document is configured and
|
/*! [in] If nonzero, \c URLBase of description document is configured and
|
||||||
* the description is served using the internal web server. */
|
* the description is served using the internal web server. */
|
||||||
IN int config_baseURL,
|
int config_baseURL,
|
||||||
/*! Pointer to the callback function for receiving asynchronous events. */
|
/*! [in] Pointer to the callback function for receiving asynchronous events. */
|
||||||
IN Upnp_FunPtr Fun,
|
IN Upnp_FunPtr Fun,
|
||||||
/*! Pointer to user data returned with the callback function when
|
/*! [in] Pointer to user data returned with the callback function when
|
||||||
* invoked. */
|
* invoked. */
|
||||||
IN const void* Cookie,
|
const void* Cookie,
|
||||||
/*! Pointer to a variable to store the new device handle. */
|
/*! [out] Pointer to a variable to store the new device handle. */
|
||||||
OUT UpnpDevice_Handle* Hnd);
|
UpnpDevice_Handle* Hnd);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1081,19 +1081,18 @@ EXPORT_SPEC int UpnpRegisterRootDevice2(
|
|||||||
* register this root device.
|
* register this root device.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpRegisterRootDevice3(
|
EXPORT_SPEC int UpnpRegisterRootDevice3(
|
||||||
/*! Pointer to a string containing the description URL for this root
|
/*! [in] Pointer to a string containing the description URL for this root
|
||||||
* device instance. */
|
* device instance. */
|
||||||
IN const char *DescUrl,
|
const char *DescUrl,
|
||||||
/*! Pointer to the callback function for receiving asynchronous events. */
|
/*! [in] Pointer to the callback function for receiving asynchronous events. */
|
||||||
IN Upnp_FunPtr Callback,
|
Upnp_FunPtr Callback,
|
||||||
/*! Pointer to user data returned with the callback function when
|
/*! [in] Pointer to user data returned with the callback function when invoked. */
|
||||||
* invoked. */
|
const void *Cookie,
|
||||||
IN const void *Cookie,
|
/*! [out] Pointer to a variable to store the new device handle. */
|
||||||
/*! Pointer to a variable to store the new device handle. */
|
UpnpDevice_Handle *Hnd,
|
||||||
OUT UpnpDevice_Handle *Hnd,
|
/*! [in] Address family of this device. Can be AF_INET for an IPv4 device, or
|
||||||
/*! Address family of this device. Can be AF_INET for an IPv4 device, or
|
|
||||||
* AF_INET6 for an IPv6 device. Defaults to AF_INET. */
|
* AF_INET6 for an IPv6 device. Defaults to AF_INET. */
|
||||||
IN const int AddressFamily);
|
const int AddressFamily);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1112,8 +1111,8 @@ EXPORT_SPEC int UpnpRegisterRootDevice3(
|
|||||||
* \li \c UPNP_E_INVALID_HANDLE: The handle is not a valid device handle.
|
* \li \c UPNP_E_INVALID_HANDLE: The handle is not a valid device handle.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpUnRegisterRootDevice(
|
EXPORT_SPEC int UpnpUnRegisterRootDevice(
|
||||||
/*! The handle of the root device instance to unregister. */
|
/*! [in] The handle of the root device instance to unregister. */
|
||||||
IN UpnpDevice_Handle);
|
UpnpDevice_Handle);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1135,12 +1134,12 @@ EXPORT_SPEC int UpnpUnRegisterRootDevice(
|
|||||||
* register this control point.
|
* register this control point.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpRegisterClient(
|
EXPORT_SPEC int UpnpRegisterClient(
|
||||||
/*! Pointer to a function for receiving asynchronous events. */
|
/*! [in] Pointer to a function for receiving asynchronous events. */
|
||||||
IN Upnp_FunPtr Callback,
|
Upnp_FunPtr Callback,
|
||||||
/*! Pointer to user data returned with the callback function when invoked. */
|
/*! [in] Pointer to user data returned with the callback function when invoked. */
|
||||||
IN const void *Cookie,
|
const void *Cookie,
|
||||||
/*! Pointer to a variable to store the new control point handle. */
|
/*! [out] Pointer to a variable to store the new control point handle. */
|
||||||
OUT UpnpClient_Handle *Hnd);
|
UpnpClient_Handle *Hnd);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1160,8 +1159,8 @@ EXPORT_SPEC int UpnpRegisterClient(
|
|||||||
* \li \c UPNP_E_INVALID_HANDLE: The handle is not a valid control point handle.
|
* \li \c UPNP_E_INVALID_HANDLE: The handle is not a valid control point handle.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpUnRegisterClient(
|
EXPORT_SPEC int UpnpUnRegisterClient(
|
||||||
/*! The handle of the control point instance to unregister. */
|
/*! [in] The handle of the control point instance to unregister. */
|
||||||
IN UpnpClient_Handle Hnd);
|
UpnpClient_Handle Hnd);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1171,11 +1170,11 @@ EXPORT_SPEC int UpnpUnRegisterClient(
|
|||||||
* of this function is global to the SDK (= same as \b UpnpSetMaxContentLength).
|
* of this function is global to the SDK (= same as \b UpnpSetMaxContentLength).
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpSetContentLength(
|
EXPORT_SPEC int UpnpSetContentLength(
|
||||||
/*! The handle of the device instance for which the coincoming content
|
/*! [in] The handle of the device instance for which the coincoming content
|
||||||
* length needs to be set. */
|
* length needs to be set. */
|
||||||
IN UpnpClient_Handle Hnd,
|
UpnpClient_Handle Hnd,
|
||||||
/*! Permissible content length */
|
/*! [in] Permissible content length */
|
||||||
IN int contentLength);
|
int contentLength);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1193,9 +1192,9 @@ EXPORT_SPEC int UpnpSetContentLength(
|
|||||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpSetMaxContentLength(
|
EXPORT_SPEC int UpnpSetMaxContentLength(
|
||||||
/*! The maximum permissible content length for incoming SOAP actions,
|
/*! [in] The maximum permissible content length for incoming SOAP actions,
|
||||||
* in bytes. */
|
* in bytes. */
|
||||||
IN size_t contentLength);
|
size_t contentLength);
|
||||||
|
|
||||||
|
|
||||||
/* @} Initialization and Registration */
|
/* @} Initialization and Registration */
|
||||||
@ -2075,13 +2074,13 @@ EXPORT_SPEC int UpnpUnSubscribeAsync(
|
|||||||
* allocated.
|
* allocated.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpDownloadUrlItem(
|
EXPORT_SPEC int UpnpDownloadUrlItem(
|
||||||
/*! URL of an item to download. */
|
/*! [in] URL of an item to download. */
|
||||||
IN const char *url,
|
const char *url,
|
||||||
/*! Buffer to store the downloaded item. */
|
/*! [out] Buffer to store the downloaded item. */
|
||||||
OUT char **outBuf,
|
char **outBuf,
|
||||||
/*! HTTP header value content type if present. It should be at least
|
/*! [out] HTTP header value content type if present. It should be at least
|
||||||
* \c LINE_SIZE bytes in size. */
|
* \c LINE_SIZE bytes in size. */
|
||||||
OUT char *contentType);
|
char *contentType);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2113,20 +2112,20 @@ EXPORT_SPEC int UpnpDownloadUrlItem(
|
|||||||
* remote server.
|
* remote server.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpOpenHttpGet(
|
EXPORT_SPEC int UpnpOpenHttpGet(
|
||||||
/*! The URL of an item to get. */
|
/*! [in] The URL of an item to get. */
|
||||||
IN const char *url,
|
const char *url,
|
||||||
/*! A pointer to store the handle for this connection. */
|
/*! [in,out] A pointer to store the handle for this connection. */
|
||||||
IN OUT void **handle,
|
void **handle,
|
||||||
/*! A buffer to store the media type of the item. */
|
/*! [in,out] A buffer to store the media type of the item. */
|
||||||
IN OUT char **contentType,
|
char **contentType,
|
||||||
/*! A pointer to store the length of the item. */
|
/*! [in,out] A pointer to store the length of the item. */
|
||||||
IN OUT int *contentLength,
|
int *contentLength,
|
||||||
/*! The status returned on receiving a response message. */
|
/*! [in,out] The status returned on receiving a response message. */
|
||||||
IN OUT int *httpStatus,
|
int *httpStatus,
|
||||||
/*! The time out value sent with the request during which a response
|
/*! [in] The time out value sent with the request during which a response
|
||||||
* is expected from the server, failing which, an error is reported
|
* is expected from the server, failing which, an error is reported
|
||||||
* back to the user. */
|
* back to the user. */
|
||||||
IN int timeout);
|
int timeout);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2158,22 +2157,22 @@ EXPORT_SPEC int UpnpOpenHttpGet(
|
|||||||
* remote server.
|
* remote server.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpOpenHttpGetProxy(
|
EXPORT_SPEC int UpnpOpenHttpGetProxy(
|
||||||
/*! The URL of an item to get. */
|
/*! [in] The URL of an item to get. */
|
||||||
IN const char *url,
|
const char *url,
|
||||||
/*! The URL of the proxy. */
|
/*! [in] The URL of the proxy. */
|
||||||
IN const char *proxy_str,
|
const char *proxy_str,
|
||||||
/*! A pointer to store the handle for this connection. */
|
/*! [in,out] A pointer to store the handle for this connection. */
|
||||||
IN OUT void **handle,
|
void **handle,
|
||||||
/*! A buffer to store the media type of the item. */
|
/*! [in,out] A buffer to store the media type of the item. */
|
||||||
IN OUT char **contentType,
|
char **contentType,
|
||||||
/*! A pointer to store the length of the item. */
|
/*! [in,out] A pointer to store the length of the item. */
|
||||||
IN OUT int *contentLength,
|
int *contentLength,
|
||||||
/*! The status returned on receiving a response message. */
|
/*! [in,out] The status returned on receiving a response message. */
|
||||||
IN OUT int *httpStatus,
|
int *httpStatus,
|
||||||
/*! The time out value sent with the request during which a response
|
/*! [in] The time out value sent with the request during which a response
|
||||||
* is expected from the server, failing which, an error is reported
|
* is expected from the server, failing which, an error is reported
|
||||||
* back to the user. */
|
* back to the user. */
|
||||||
IN int timeout);
|
int timeout);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2207,24 +2206,24 @@ EXPORT_SPEC int UpnpOpenHttpGetProxy(
|
|||||||
* remote server.
|
* remote server.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpOpenHttpGetEx(
|
EXPORT_SPEC int UpnpOpenHttpGetEx(
|
||||||
/*! The URL of the item to get. */
|
/*! [in] The URL of the item to get. */
|
||||||
IN const char *url,
|
const char *url,
|
||||||
/*! A pointer to store the handle for this connection. */
|
/*! [in,out] A pointer to store the handle for this connection. */
|
||||||
IN OUT void **handle,
|
void **handle,
|
||||||
/*! A buffer to store the media type of the item. */
|
/*! [in,out] A buffer to store the media type of the item. */
|
||||||
IN OUT char **contentType,
|
char **contentType,
|
||||||
/*! A buffer to store the length of the item. */
|
/*! [in,out] A buffer to store the length of the item. */
|
||||||
IN OUT int *contentLength,
|
int *contentLength,
|
||||||
/*! The status returned on receiving a response message from the remote server. */
|
/*! [in,out] The status returned on receiving a response message from the remote server. */
|
||||||
IN OUT int *httpStatus,
|
int *httpStatus,
|
||||||
/*! An integer value representing the low end of a range to retrieve. */
|
/*! [in] An integer value representing the low end of a range to retrieve. */
|
||||||
IN int lowRange,
|
int lowRange,
|
||||||
/*! An integer value representing the high end of a range to retrieve. */
|
/*! [in] An integer value representing the high end of a range to retrieve. */
|
||||||
IN int highRange,
|
int highRange,
|
||||||
/*! A time out value sent with the request during which a response is
|
/*! [in] A time out value sent with the request during which a response is
|
||||||
* expected from the server, failing which, an error is reported back
|
* expected from the server, failing which, an error is reported back
|
||||||
* to the user. */
|
* to the user. */
|
||||||
IN int timeout);
|
int timeout);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2245,16 +2244,16 @@ EXPORT_SPEC int UpnpOpenHttpGetEx(
|
|||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpReadHttpGet(
|
EXPORT_SPEC int UpnpReadHttpGet(
|
||||||
/*! The token created by the call to \b UpnpOpenHttpGet. */
|
/*! [in] The token created by the call to \b UpnpOpenHttpGet. */
|
||||||
IN void *handle,
|
void *handle,
|
||||||
/*! The buffer to store the read item. */
|
/*! [in,out] The buffer to store the read item. */
|
||||||
IN OUT char *buf,
|
char *buf,
|
||||||
/*! The size of the buffer to be read. */
|
/*! [in,out] The size of the buffer to be read. */
|
||||||
IN OUT unsigned int *size,
|
unsigned int *size,
|
||||||
/*! The time out value sent with the request during which a response is
|
/*! [in] The time out value sent with the request during which a response is
|
||||||
* expected from the server, failing which, an error is reported back to
|
* expected from the server, failing which, an error is reported back to
|
||||||
* the user. */
|
* the user. */
|
||||||
IN int timeout);
|
int timeout);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2266,12 +2265,12 @@ EXPORT_SPEC int UpnpReadHttpGet(
|
|||||||
* or \b total is not a valid pointer.
|
* or \b total is not a valid pointer.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpHttpGetProgress(
|
EXPORT_SPEC int UpnpHttpGetProgress(
|
||||||
/*! The token created by the call to \b UpnpOpenHttpGet. */
|
/*! [in] The token created by the call to \b UpnpOpenHttpGet. */
|
||||||
IN void *handle,
|
void *handle,
|
||||||
/*! The number of bytes received. */
|
/*! [out] The number of bytes received. */
|
||||||
OUT unsigned int *length,
|
unsigned int *length,
|
||||||
/*! The content length. */
|
/*! [out] The content length. */
|
||||||
OUT unsigned int *total);
|
unsigned int *total);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2281,7 +2280,10 @@ EXPORT_SPEC int UpnpHttpGetProgress(
|
|||||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||||
* \li \c UPNP_E_INVALID_PARAM: \b handle is not a valid pointer.
|
* \li \c UPNP_E_INVALID_PARAM: \b handle is not a valid pointer.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpCancelHttpGet(IN void *handle);
|
EXPORT_SPEC int UpnpCancelHttpGet(
|
||||||
|
/*! [in] The handle of the connection created by the call to
|
||||||
|
* \b UpnpOpenHttpPost. */
|
||||||
|
void *handle);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Closes the connection and frees memory that was allocated for the
|
* \brief Closes the connection and frees memory that was allocated for the
|
||||||
@ -2291,7 +2293,10 @@ EXPORT_SPEC int UpnpCancelHttpGet(IN void *handle);
|
|||||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||||
* \li \c UPNP_E_INVALID_PARAM: \b handle is not a valid pointer.
|
* \li \c UPNP_E_INVALID_PARAM: \b handle is not a valid pointer.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpCloseHttpGet(IN void *handle);
|
EXPORT_SPEC int UpnpCloseHttpGet(
|
||||||
|
/*! [in] The handle of the connection created by the call to
|
||||||
|
* \b UpnpOpenHttpPost. */
|
||||||
|
void *handle);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2320,18 +2325,18 @@ EXPORT_SPEC int UpnpCloseHttpGet(IN void *handle);
|
|||||||
* allocated.
|
* allocated.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpOpenHttpPost(
|
EXPORT_SPEC int UpnpOpenHttpPost(
|
||||||
/*! The URL in which to send the POST request. */
|
/*! [in] The URL in which to send the POST request. */
|
||||||
IN const char *url,
|
const char *url,
|
||||||
/*! A pointer in which to store the handle for this connection. This
|
/*! [in,out] A pointer in which to store the handle for this connection. This
|
||||||
* handle is required for futher operations over this connection. */
|
* handle is required for futher operations over this connection. */
|
||||||
IN OUT void **handle,
|
void **handle,
|
||||||
/*! A buffer to store the media type of content being sent. */
|
/*! [in] A buffer to store the media type of content being sent. */
|
||||||
IN const char *contentType,
|
const char *contentType,
|
||||||
/*! The length of the content, in bytes, being posted. */
|
/*! [in] The length of the content, in bytes, being posted. */
|
||||||
IN int contentLength,
|
int contentLength,
|
||||||
/*! The time out value sent with the request during which a response
|
/*! [in] The time out value sent with the request during which a response
|
||||||
* is expected from the receiver, failing which, an error is reported. */
|
* is expected from the receiver, failing which, an error is reported. */
|
||||||
IN int timeout);
|
int timeout);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2348,16 +2353,16 @@ EXPORT_SPEC int UpnpOpenHttpPost(
|
|||||||
* allocated.
|
* allocated.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpWriteHttpPost(
|
EXPORT_SPEC int UpnpWriteHttpPost(
|
||||||
/*! The handle of the connection created by the call to
|
/*! [in] The handle of the connection created by the call to
|
||||||
* \b UpnpOpenHttpPost. */
|
* \b UpnpOpenHttpPost. */
|
||||||
IN void *handle,
|
void *handle,
|
||||||
/*! The buffer to be posted. */
|
/*! [in] The buffer to be posted. */
|
||||||
IN char *buf,
|
char *buf,
|
||||||
/*! The size, in bytes of \b buf. */
|
/*! [in] The size, in bytes of \b buf. */
|
||||||
IN unsigned int *size,
|
unsigned int *size,
|
||||||
/*! A timeout value sent with the request during which a response is
|
/*! [in] A timeout value sent with the request during which a response is
|
||||||
* expected from the server, failing which, an error is reported. */
|
* expected from the server, failing which, an error is reported. */
|
||||||
IN int timeout);
|
int timeout);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2374,14 +2379,14 @@ EXPORT_SPEC int UpnpWriteHttpPost(
|
|||||||
* allocated.
|
* allocated.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpCloseHttpPost(
|
EXPORT_SPEC int UpnpCloseHttpPost(
|
||||||
/*! The handle of the connection to close, created by the call to
|
/*! [in] The handle of the connection to close, created by the call to
|
||||||
* \b UpnpOpenHttpPost. */
|
* \b UpnpOpenHttpPost. */
|
||||||
IN void *handle,
|
void *handle,
|
||||||
/*! A pointer to a buffer to store the final status of the connection. */
|
/*! [in,out] A pointer to a buffer to store the final status of the connection. */
|
||||||
IN OUT int *httpStatus,
|
int *httpStatus,
|
||||||
/*! A time out value sent with the request during which a response is
|
/*! [in] A time out value sent with the request during which a response is
|
||||||
* expected from the server, failing which, an error is reported. */
|
* expected from the server, failing which, an error is reported. */
|
||||||
IN int timeout);
|
int timeout);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2412,10 +2417,10 @@ EXPORT_SPEC int UpnpCloseHttpPost(
|
|||||||
* allocated.
|
* allocated.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpDownloadXmlDoc(
|
EXPORT_SPEC int UpnpDownloadXmlDoc(
|
||||||
/*! URL of the XML document. */
|
/*! [in] URL of the XML document. */
|
||||||
IN const char *url,
|
const char *url,
|
||||||
/*! A pointer in which to store the XML document. */
|
/*! [out] A pointer in which to store the XML document. */
|
||||||
OUT IXML_Document **xmlDoc);
|
IXML_Document **xmlDoc);
|
||||||
|
|
||||||
|
|
||||||
/*! @} Control Point HTTP API */
|
/*! @} Control Point HTTP API */
|
||||||
@ -2443,16 +2448,16 @@ EXPORT_SPEC int UpnpDownloadXmlDoc(
|
|||||||
* web server, pass \c NULL for \b rootDir; to activate, pass a valid directory
|
* web server, pass \c NULL for \b rootDir; to activate, pass a valid directory
|
||||||
* string.
|
* string.
|
||||||
*
|
*
|
||||||
* Note that this function is not available when the web server is not compiled
|
* \note This function is not available when the web server is not compiled
|
||||||
* into the SDK.
|
* into the UPnP Library.
|
||||||
*
|
*
|
||||||
* \return An integer representing one of the following:
|
* \return An integer representing one of the following:
|
||||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||||
* \li \c UPNP_E_INVALID_ARGUMENT: \b rootDir is an invalid directory.
|
* \li \c UPNP_E_INVALID_ARGUMENT: \b rootDir is an invalid directory.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpSetWebServerRootDir(
|
EXPORT_SPEC int UpnpSetWebServerRootDir(
|
||||||
/*! Path of the root directory of the web server. */
|
/*! [in] Path of the root directory of the web server. */
|
||||||
IN const char *rootDir);
|
const char *rootDir);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2604,8 +2609,8 @@ EXPORT_SPEC int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback);
|
|||||||
* \li \c UPNP_E_INVALID_ARGUMENT: \b enable is not valid.
|
* \li \c UPNP_E_INVALID_ARGUMENT: \b enable is not valid.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpEnableWebserver(
|
EXPORT_SPEC int UpnpEnableWebserver(
|
||||||
/*! \c TRUE to enable, \c FALSE to disable. */
|
/*! [in] \c TRUE to enable, \c FALSE to disable. */
|
||||||
IN int enable);
|
int enable);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2625,13 +2630,16 @@ EXPORT_SPEC int UpnpIsWebserverEnabled();
|
|||||||
* functions contained in a \b VirtualDirCallbacks structure registered
|
* functions contained in a \b VirtualDirCallbacks structure registered
|
||||||
* via \b UpnpSetVirtualDirCallbacks.
|
* via \b UpnpSetVirtualDirCallbacks.
|
||||||
*
|
*
|
||||||
|
* \note This function is not available when the web server is not
|
||||||
|
* compiled into the UPnP Library.
|
||||||
|
*
|
||||||
* \return An integer representing one of the following:
|
* \return An integer representing one of the following:
|
||||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||||
* \li \c UPNP_E_INVALID_ARGUMENT: \b dirName is not valid.
|
* \li \c UPNP_E_INVALID_ARGUMENT: \b dirName is not valid.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpAddVirtualDir(
|
EXPORT_SPEC int UpnpAddVirtualDir(
|
||||||
/*! The name of the new directory mapping to add. */
|
/*! [in] The name of the new directory mapping to add. */
|
||||||
IN const char *dirName);
|
const char *dirName);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -2642,8 +2650,8 @@ EXPORT_SPEC int UpnpAddVirtualDir(
|
|||||||
* \li \c UPNP_E_INVALID_ARGUMENT: \b dirName is not valid.
|
* \li \c UPNP_E_INVALID_ARGUMENT: \b dirName is not valid.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC int UpnpRemoveVirtualDir(
|
EXPORT_SPEC int UpnpRemoveVirtualDir(
|
||||||
/*! The name of the virtual directory mapping to remove. */
|
/*! [in] The name of the virtual directory mapping to remove. */
|
||||||
IN const char *dirName);
|
const char *dirName);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -29,201 +29,235 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/** @name Optional Tool APIs
|
|
||||||
* The Linux SDK for UPnP Devices contains some additional, optional
|
|
||||||
* utility APIs that can be helpful in writing applications using the
|
|
||||||
* SDK. These additional APIs can be compiled out in order to save code
|
|
||||||
* size in the SDK. Refer to the README for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! @{ */
|
|
||||||
|
|
||||||
#ifndef UPNP_TOOLS_H
|
#ifndef UPNP_TOOLS_H
|
||||||
#define UPNP_TOOLS_H
|
#define UPNP_TOOLS_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*
|
||||||
|
* \defgroup UPnPTools Optional Tool APIs
|
||||||
|
*
|
||||||
|
* The Linux SDK for UPnP Devices contains some additional, optional
|
||||||
|
* utility APIs that can be helpful in writing applications using the
|
||||||
|
* SDK. These additional APIs can be compiled out in order to save code
|
||||||
|
* size in the SDK. Refer to the README for details.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
|
|
||||||
/* Function declarations only if tools compiled into the library */
|
/* Function declarations only if tools compiled into the library */
|
||||||
#if UPNP_HAVE_TOOLS
|
#if UPNP_HAVE_TOOLS
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** {\bf UpnpResolveURL} combines a base URL and a relative URL into
|
|
||||||
* a single absolute URL. The memory for {\bf AbsURL} needs to be
|
/*!
|
||||||
* allocated by the caller and must be large enough to hold the
|
* \brief Converts an SDK error code into a string error message suitable for
|
||||||
* {\bf BaseURL} and {\bf RelURL} combined.
|
* display. The memory returned from this function should NOT be freed.
|
||||||
*
|
*
|
||||||
* @return [int] An integer representing one of the following:
|
* \return An ASCII text string representation of the error message associated
|
||||||
* \begin{itemize}
|
* with the error code or the string "Unknown error code"
|
||||||
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
|
*/
|
||||||
* \item {\tt UPNP_E_INVALID_PARAM}: {\bf RelURL} is {\tt NULL}.
|
EXPORT_SPEC const char *UpnpGetErrorMessage(
|
||||||
* \item {\tt UPNP_E_INVALID_URL}: The {\bf BaseURL} / {\bf RelURL}
|
/*! [in] The SDK error code to convert. */
|
||||||
|
int errorcode);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Combines a base URL and a relative URL into a single absolute URL.
|
||||||
|
*
|
||||||
|
* The memory for \b AbsURL needs to be allocated by the caller and must
|
||||||
|
* be large enough to hold the \b BaseURL and \b RelURL combined.
|
||||||
|
*
|
||||||
|
* \return An integer representing one of the following:
|
||||||
|
* \li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully.
|
||||||
|
* \li <tt>UPNP_E_INVALID_PARAM</tt>: \b RelURL is <tt>NULL</tt>.
|
||||||
|
* \li <tt>UPNP_E_INVALID_URL</tt>: The \b BaseURL / \b RelURL
|
||||||
* combination does not form a valid URL.
|
* combination does not form a valid URL.
|
||||||
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
|
* \li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to
|
||||||
* complete this operation.
|
* complete this operation.
|
||||||
* \end{itemize}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORT_SPEC int UpnpResolveURL(
|
EXPORT_SPEC int UpnpResolveURL(
|
||||||
IN const char * BaseURL, /** The base URL to combine. */
|
/*! [in] The base URL to combine. */
|
||||||
IN const char * RelURL, /** The relative URL to {\bf BaseURL}. */
|
const char *BaseURL,
|
||||||
OUT char * AbsURL /** A pointer to a buffer to store the
|
/*! [in] The relative URL to \b BaseURL. */
|
||||||
absolute URL. */
|
const char *RelURL,
|
||||||
);
|
/*! [out] A pointer to a buffer to store the absolute URL. */
|
||||||
|
char *AbsURL);
|
||||||
|
|
||||||
/** {\bf UpnpMakeAction} creates an action request packet based on its input
|
|
||||||
* parameters (status variable name and value pair). Any number of input
|
|
||||||
* parameters can be passed to this function but every input variable name
|
|
||||||
* should have a matching value argument.
|
|
||||||
*
|
|
||||||
* @return [IXML_Document*] The action node of {\bf Upnp_Document} type or
|
|
||||||
* {\tt NULL} if the operation failed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPORT_SPEC IXML_Document* UpnpMakeAction(
|
/*!
|
||||||
IN const char * ActionName, /** The action name. */
|
* \brief Creates an action request packet based on its input parameters
|
||||||
IN const char * ServType, /** The service type. */
|
* (status variable name and value pair).
|
||||||
IN int NumArg, /** Number of argument pairs to be passed. */
|
|
||||||
IN const char * Arg, /** Status variable name and value pair. */
|
|
||||||
IN ... /* Other status variable name and value pairs. */
|
|
||||||
);
|
|
||||||
|
|
||||||
/** {\bf UpnpAddToAction} creates an action request packet based on its input
|
|
||||||
* parameters (status variable name and value pair). This API is specially
|
|
||||||
* suitable inside a loop to add any number input parameters into an existing
|
|
||||||
* action. If no action document exists in the beginning then a
|
|
||||||
* {\bf Upnp_Document} variable initialized with {\tt NULL} should be passed
|
|
||||||
* as a parameter.
|
|
||||||
*
|
*
|
||||||
* @return [int] An integer representing one of the following:
|
* Any number of input parameters can be passed to this function but every
|
||||||
* \begin{itemize}
|
* input variable name should have a matching value argument.
|
||||||
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
|
*
|
||||||
* \item {\tt UPNP_E_INVALID_PARAM}: One or more of the parameters
|
* It is a wrapper function that calls makeAction() function to create the
|
||||||
* are invalid.
|
* action request.
|
||||||
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
|
*
|
||||||
* complete this operation.
|
* \return The action node of \b Upnp_Document type or <tt>NULL</tt> if the
|
||||||
* \end{itemize}
|
* operation failed.
|
||||||
*/
|
*/
|
||||||
|
EXPORT_SPEC IXML_Document *UpnpMakeAction(
|
||||||
|
/*! [in] Name of the action request or response. */
|
||||||
|
const char *ActionName,
|
||||||
|
/*! [in] The service type. */
|
||||||
|
const char *ServType,
|
||||||
|
/*! [in] Number of argument pairs to be passed. */
|
||||||
|
int NumArg,
|
||||||
|
/*! [in] pointer to the first argument. */
|
||||||
|
const char *Arg,
|
||||||
|
/*! [in] Argument list. */
|
||||||
|
...);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Ceates an action response packet based on its output parameters
|
||||||
|
* (status variable name and value pair).
|
||||||
|
*
|
||||||
|
* Any number of input parameters can be passed to this function but every
|
||||||
|
* output variable name should have a matching value argument.
|
||||||
|
*
|
||||||
|
* It is a wrapper function that calls makeAction() function to create the
|
||||||
|
* action request.
|
||||||
|
*
|
||||||
|
* \return The action node of \b Upnp_Document type or <tt>NULL</tt> if the
|
||||||
|
* operation failed.
|
||||||
|
*/
|
||||||
|
EXPORT_SPEC IXML_Document *UpnpMakeActionResponse(
|
||||||
|
/*! [in] The action name. */
|
||||||
|
const char *ActionName,
|
||||||
|
/*! [in] The service type.. */
|
||||||
|
const char *ServType,
|
||||||
|
/*! [in] The number of argument pairs passed. */
|
||||||
|
int NumArg,
|
||||||
|
/*! [in] The status variable name and value pair. */
|
||||||
|
const char *Arg,
|
||||||
|
/*! [in] Other status variable name and value pairs. */
|
||||||
|
...);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Adds the argument in the action request.
|
||||||
|
*
|
||||||
|
* This API is specially suitable inside a loop to add any number input
|
||||||
|
* parameters into an existing action. If no action document exists in the
|
||||||
|
* beginning then a <b>Upnp_Document variable initialized with <tt>NULL</tt></b>
|
||||||
|
* should be passed as a parameter.
|
||||||
|
*
|
||||||
|
* It is a wrapper function that calls addToAction() function to add the
|
||||||
|
* argument in the action request.
|
||||||
|
*
|
||||||
|
* \return An integer representing one of the following:
|
||||||
|
* \li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully.
|
||||||
|
* \li <tt>UPNP_E_INVALID_PARAM</tt>: One or more of the parameters are invalid.
|
||||||
|
* \li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to
|
||||||
|
* complete this operation.
|
||||||
|
*/
|
||||||
EXPORT_SPEC int UpnpAddToAction(
|
EXPORT_SPEC int UpnpAddToAction(
|
||||||
IN OUT IXML_Document ** ActionDoc,
|
/*! [in,out] A pointer to store the action document node. */
|
||||||
/** A pointer to store the action
|
IXML_Document **ActionDoc,
|
||||||
document node. */
|
/*! [in] The action name. */
|
||||||
IN const char * ActionName, /** The action name. */
|
const char *ActionName,
|
||||||
IN const char * ServType, /** The service type. */
|
/*! [in] The service type. */
|
||||||
IN const char * ArgName, /** The status variable name. */
|
const char *ServType,
|
||||||
IN const char * ArgVal /** The status variable value. */
|
/*! [in] The status variable name. */
|
||||||
);
|
const char *ArgName,
|
||||||
|
/*! [in] The status variable value. */
|
||||||
|
const char *ArgVal);
|
||||||
|
|
||||||
/** {\bf UpnpMakeActionResponse} creates an action response packet based
|
|
||||||
* on its output parameters (status variable name and value pair). Any
|
|
||||||
* number of input parameters can be passed to this function but every output
|
|
||||||
* variable name should have a matching value argument.
|
|
||||||
*
|
|
||||||
* @return [IXML_Document*] The action node of {\bf Upnp_Document} type or
|
|
||||||
* {\tt NULL} if the operation failed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPORT_SPEC IXML_Document* UpnpMakeActionResponse(
|
/*!
|
||||||
IN const char * ActionName, /** The action name. */
|
* \brief Creates an action response packet based on its output parameters
|
||||||
IN const char * ServType, /** The service type. */
|
* (status variable name and value pair).
|
||||||
IN int NumArg, /** The number of argument pairs passed. */
|
|
||||||
IN const char * Arg, /** The status variable name and value pair. */
|
|
||||||
IN ... /* Other status variable name and value pairs. */
|
|
||||||
);
|
|
||||||
|
|
||||||
/** {\bf UpnpAddToActionResponse} creates an action response
|
|
||||||
* packet based on its output parameters (status variable name
|
|
||||||
* and value pair). This API is especially suitable inside
|
|
||||||
* a loop to add any number of input parameters into an existing action
|
|
||||||
* response. If no action document exists in the beginning, a
|
|
||||||
* {\bf Upnp_Document} variable initialized with {\tt NULL} should be passed
|
|
||||||
* as a parameter.
|
|
||||||
*
|
*
|
||||||
* @return [int] An integer representing one of the following:
|
* This API is especially suitable inside a loop to add any number of input
|
||||||
* \begin{itemize}
|
* parameters into an existing action response. If no action document exists
|
||||||
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
|
* in the beginning, a \b Upnp_Document variable initialized with <tt>NULL</tt>
|
||||||
* \item {\tt UPNP_E_INVALID_PARAM}: One or more of the parameters
|
* should be passed as a parameter.
|
||||||
* are invalid.
|
*
|
||||||
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
|
* It is a wrapper function that calls addToAction() function to add the
|
||||||
* complete this operation.
|
* argument in the action request.
|
||||||
* \end{itemize}
|
*
|
||||||
|
* \return An integer representing one of the following:
|
||||||
|
* \li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully.
|
||||||
|
* \li <tt>UPNP_E_INVALID_PARAM</tt>: One or more of the parameters are invalid.
|
||||||
|
* \li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to
|
||||||
|
* complete this operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORT_SPEC int UpnpAddToActionResponse(
|
EXPORT_SPEC int UpnpAddToActionResponse(
|
||||||
IN OUT IXML_Document ** ActionResponse,
|
/*! [in,out] Pointer to a document to store the action document node. */
|
||||||
/** Pointer to a document to
|
IXML_Document **ActionResponse,
|
||||||
store the action document
|
/*! [in] The action name. */
|
||||||
node. */
|
const char *ActionName,
|
||||||
IN const char * ActionName, /** The action name. */
|
/*! [in] The service type. */
|
||||||
IN const char * ServType, /** The service type. */
|
const char *ServType,
|
||||||
IN const char * ArgName, /** The status variable name. */
|
/*! [in] The status variable name. */
|
||||||
IN const char * ArgVal /** The status variable value. */
|
const char *ArgName,
|
||||||
);
|
/*! [in] The status variable value. */
|
||||||
|
const char *ArgVal);
|
||||||
|
|
||||||
/** {\bf UpnpAddToPropertySet} can be used when an application needs to
|
|
||||||
* transfer the status of many variables at once. It can be used
|
/*!
|
||||||
* (inside a loop) to add some extra status variables into an existing
|
* \brief Creates a property set message packet.
|
||||||
* property set. If the application does not already have a property
|
|
||||||
* set document, the application should create a variable initialized
|
|
||||||
* with {\tt NULL} and pass that as the first parameter.
|
|
||||||
*
|
|
||||||
* @return [int] An integer representing one of the following:
|
|
||||||
* \begin{itemize}
|
|
||||||
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
|
|
||||||
* \item {\tt UPNP_E_INVALID_PARAM}: One or more of the parameters
|
|
||||||
* are invalid.
|
|
||||||
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
|
|
||||||
* complete this operation.
|
|
||||||
* \end{itemize}
|
|
||||||
*
|
*
|
||||||
|
* Any number of input parameters can be passed to this function but every
|
||||||
|
* input variable name should have a matching value input argument.
|
||||||
|
*
|
||||||
|
* \return <tt>NULL</tt> on failure, or the property-set document node.
|
||||||
*/
|
*/
|
||||||
|
EXPORT_SPEC IXML_Document *UpnpCreatePropertySet(
|
||||||
|
/*! [in] The number of argument pairs passed. */
|
||||||
|
int NumArg,
|
||||||
|
/*! [in] The status variable name and value pair. */
|
||||||
|
const char *Arg,
|
||||||
|
/*! [in] Variable sized list with the rest of the parameters. */
|
||||||
|
...);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Can be used when an application needs to transfer the status of many
|
||||||
|
* variables at once.
|
||||||
|
*
|
||||||
|
* It can be used (inside a loop) to add some extra status variables into an
|
||||||
|
* existing property set. If the application does not already have a property
|
||||||
|
* set document, the application should create a variable initialized with
|
||||||
|
* <tt>NULL</tt> and pass that as the first parameter.
|
||||||
|
*
|
||||||
|
* \return An integer representing one of the following:
|
||||||
|
* \li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully.
|
||||||
|
* \li <tt>UPNP_E_INVALID_PARAM</tt>: One or more of the parameters are invalid.
|
||||||
|
* \li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to
|
||||||
|
* complete this operation.
|
||||||
|
*/
|
||||||
EXPORT_SPEC int UpnpAddToPropertySet(
|
EXPORT_SPEC int UpnpAddToPropertySet(
|
||||||
IN OUT IXML_Document **PropSet,
|
/*! [in,out] A pointer to the document containing the property set document node. */
|
||||||
/** A pointer to the document containing
|
IXML_Document **PropSet,
|
||||||
the property set document node. */
|
/*! [in] The status variable name. */
|
||||||
IN const char * ArgName, /** The status variable name. */
|
const char *ArgName,
|
||||||
IN const char * ArgVal /** The status variable value. */
|
/*! [in] The status variable value. */
|
||||||
);
|
const char *ArgVal);
|
||||||
|
|
||||||
/** {\bf UpnpCreatePropertySet} creates a property set
|
|
||||||
* message packet. Any number of input parameters can be passed
|
|
||||||
* to this function but every input variable name should have
|
|
||||||
* a matching value input argument.
|
|
||||||
*
|
|
||||||
* @return [IXML_Document*] {\tt NULL} on failure, or the property-set
|
|
||||||
* document node.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPORT_SPEC IXML_Document* UpnpCreatePropertySet(
|
|
||||||
IN int NumArg, /** The number of argument pairs passed. */
|
|
||||||
IN const char* Arg, /** The status variable name and value pair. */
|
|
||||||
IN ...
|
|
||||||
);
|
|
||||||
|
|
||||||
/** {\bf UpnpGetErrorMessage} converts an SDK error code into a
|
|
||||||
* string error message suitable for display. The memory returned
|
|
||||||
* from this function should NOT be freed.
|
|
||||||
*
|
|
||||||
* @return [char*] An ASCII text string representation of the error message
|
|
||||||
* associated with the error code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPORT_SPEC const char * UpnpGetErrorMessage(
|
|
||||||
int errorcode /** The SDK error code to convert. */
|
|
||||||
);
|
|
||||||
|
|
||||||
/*! @} */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*! @} */
|
||||||
|
|
||||||
|
|
||||||
#endif /* UPNP_HAVE_TOOLS */
|
#endif /* UPNP_HAVE_TOOLS */
|
||||||
|
|
||||||
|
|
||||||
#endif /* UPNP_TOOLS_H */
|
#endif /* UPNP_TOOLS_H */
|
||||||
|
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
|
||||||
@ -168,17 +173,17 @@ Upnp_SID gUpnpSdkNLSuuid;
|
|||||||
|
|
||||||
|
|
||||||
// FIXME Put this declaration in the proper header file
|
// FIXME Put this declaration in the proper header file
|
||||||
static int
|
static int GetDescDocumentAndURL(
|
||||||
GetDescDocumentAndURL( IN Upnp_DescType descriptionType,
|
IN Upnp_DescType descriptionType,
|
||||||
IN char *description,
|
IN char *description,
|
||||||
IN unsigned int bufferLen,
|
IN unsigned int bufferLen,
|
||||||
IN int config_baseURL,
|
IN int config_baseURL,
|
||||||
IN int AddressFamily,
|
IN int AddressFamily,
|
||||||
OUT IXML_Document ** xmlDoc,
|
OUT IXML_Document ** xmlDoc,
|
||||||
OUT char descURL[LINE_SIZE] );
|
OUT char descURL[LINE_SIZE] );
|
||||||
|
|
||||||
|
|
||||||
int UpnpInit(IN const char *HostIP, IN unsigned short DestPort)
|
int UpnpInit(const char *HostIP, unsigned short DestPort)
|
||||||
{
|
{
|
||||||
int retVal;
|
int retVal;
|
||||||
|
|
||||||
@ -231,7 +236,7 @@ int UpnpInit(IN const char *HostIP, IN unsigned short DestPort)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UpnpInit2(IN const char *IfName, IN unsigned short DestPort)
|
int UpnpInit2(const char *IfName, unsigned short DestPort)
|
||||||
{
|
{
|
||||||
int retVal;
|
int retVal;
|
||||||
|
|
||||||
@ -406,10 +411,10 @@ char *UpnpGetServerIp6Address()
|
|||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
int UpnpRegisterRootDevice(
|
int UpnpRegisterRootDevice(
|
||||||
IN const char *DescUrl,
|
const char *DescUrl,
|
||||||
IN Upnp_FunPtr Fun,
|
Upnp_FunPtr Fun,
|
||||||
IN const void *Cookie,
|
const void *Cookie,
|
||||||
OUT UpnpDevice_Handle *Hnd)
|
UpnpDevice_Handle *Hnd)
|
||||||
{
|
{
|
||||||
struct Handle_Info *HInfo = NULL;
|
struct Handle_Info *HInfo = NULL;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
@ -537,13 +542,13 @@ exit_function:
|
|||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
int UpnpRegisterRootDevice2(
|
int UpnpRegisterRootDevice2(
|
||||||
IN Upnp_DescType descriptionType,
|
Upnp_DescType descriptionType,
|
||||||
IN const char *description_const,
|
const char *description_const,
|
||||||
IN size_t bufferLen, // ignored unless descType == UPNPREG_BUF_DESC
|
size_t bufferLen, // ignored unless descType == UPNPREG_BUF_DESC
|
||||||
IN int config_baseURL,
|
int config_baseURL,
|
||||||
IN Upnp_FunPtr Fun,
|
Upnp_FunPtr Fun,
|
||||||
IN const void *Cookie,
|
const void *Cookie,
|
||||||
OUT UpnpDevice_Handle *Hnd)
|
UpnpDevice_Handle *Hnd)
|
||||||
{
|
{
|
||||||
struct Handle_Info *HInfo = NULL;
|
struct Handle_Info *HInfo = NULL;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
@ -667,11 +672,11 @@ exit_function:
|
|||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
int UpnpRegisterRootDevice3(
|
int UpnpRegisterRootDevice3(
|
||||||
IN const char *DescUrl,
|
const char *DescUrl,
|
||||||
IN Upnp_FunPtr Fun,
|
Upnp_FunPtr Fun,
|
||||||
IN const void *Cookie,
|
const void *Cookie,
|
||||||
OUT UpnpDevice_Handle * Hnd,
|
UpnpDevice_Handle *Hnd,
|
||||||
IN const int AddressFamily )
|
const int AddressFamily)
|
||||||
{
|
{
|
||||||
struct Handle_Info *HInfo;
|
struct Handle_Info *HInfo;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
@ -800,7 +805,7 @@ exit_function:
|
|||||||
|
|
||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
int UpnpUnRegisterRootDevice(IN UpnpDevice_Handle Hnd)
|
int UpnpUnRegisterRootDevice(UpnpDevice_Handle Hnd)
|
||||||
{
|
{
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
struct Handle_Info *HInfo = NULL;
|
struct Handle_Info *HInfo = NULL;
|
||||||
@ -826,9 +831,9 @@ int UpnpUnRegisterRootDevice(IN UpnpDevice_Handle Hnd)
|
|||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
|
|
||||||
#if EXCLUDE_SSDP == 0
|
#if EXCLUDE_SSDP == 0
|
||||||
retVal = AdvertiseAndReply( -1, Hnd, 0, ( struct sockaddr * )NULL,
|
retVal = AdvertiseAndReply(-1, Hnd, 0, (struct sockaddr *)NULL,
|
||||||
( char * )NULL, ( char * )NULL,
|
(char *)NULL, (char *)NULL,
|
||||||
( char * )NULL, HInfo->MaxAge );
|
(char *)NULL, HInfo->MaxAge);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HandleLock();
|
HandleLock();
|
||||||
@ -867,12 +872,11 @@ int UpnpUnRegisterRootDevice(IN UpnpDevice_Handle Hnd)
|
|||||||
#endif // INCLUDE_DEVICE_APIS
|
#endif // INCLUDE_DEVICE_APIS
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
int UpnpRegisterClient(
|
int UpnpRegisterClient(
|
||||||
IN Upnp_FunPtr Fun,
|
Upnp_FunPtr Fun,
|
||||||
IN const void *Cookie,
|
const void *Cookie,
|
||||||
OUT UpnpClient_Handle *Hnd)
|
UpnpClient_Handle *Hnd)
|
||||||
{
|
{
|
||||||
struct Handle_Info *HInfo;
|
struct Handle_Info *HInfo;
|
||||||
|
|
||||||
@ -925,9 +929,8 @@ int UpnpRegisterClient(
|
|||||||
#endif // INCLUDE_CLIENT_APIS
|
#endif // INCLUDE_CLIENT_APIS
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
int UpnpUnRegisterClient(IN UpnpClient_Handle Hnd)
|
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
|
||||||
{
|
{
|
||||||
struct Handle_Info *HInfo;
|
struct Handle_Info *HInfo;
|
||||||
ListNode *node = NULL;
|
ListNode *node = NULL;
|
||||||
@ -979,10 +982,8 @@ int UpnpUnRegisterClient(IN UpnpClient_Handle Hnd)
|
|||||||
#endif // INCLUDE_CLIENT_APIS
|
#endif // INCLUDE_CLIENT_APIS
|
||||||
|
|
||||||
|
|
||||||
// *************************************************************
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
#ifdef INTERNAL_WEB_SERVER
|
#ifdef INTERNAL_WEB_SERVER
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Function: GetNameForAlias
|
* Function: GetNameForAlias
|
||||||
*
|
*
|
||||||
@ -2932,141 +2933,85 @@ UpnpGetServiceVarStatus( IN UpnpClient_Handle Hnd,
|
|||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
||||||
} /****************** End of UpnpGetServiceVarStatus *********************/
|
}
|
||||||
#endif // INCLUDE_CLIENT_APIS
|
#endif // INCLUDE_CLIENT_APIS
|
||||||
#endif // EXCLUDE_SOAP
|
#endif // EXCLUDE_SOAP
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Client API's
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**************************************************************************
|
/******************************************************************************
|
||||||
* Function: UpnpOpenHttpPost
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Client API's
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
*
|
||||||
* Return Values: int
|
*****************************************************************************/
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
int
|
|
||||||
UpnpOpenHttpPost( IN const char *url,
|
int UpnpOpenHttpPost(
|
||||||
IN OUT void **handle,
|
const char *url,
|
||||||
IN const char *contentType,
|
void **handle,
|
||||||
IN int contentLength,
|
const char *contentType,
|
||||||
IN int timeout )
|
int contentLength,
|
||||||
|
int timeout)
|
||||||
{
|
{
|
||||||
return http_OpenHttpPost( url, handle, contentType, contentLength,
|
return http_OpenHttpPost( url, handle, contentType, contentLength,
|
||||||
timeout );
|
timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpWriteHttpPost
|
int UpnpWriteHttpPost(
|
||||||
*
|
void *handle,
|
||||||
* Parameters:
|
char *buf,
|
||||||
*
|
unsigned int *size,
|
||||||
* Description:
|
int timeout)
|
||||||
*
|
|
||||||
* Return Values: int
|
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpWriteHttpPost( IN void *handle,
|
|
||||||
IN char *buf,
|
|
||||||
IN unsigned int *size,
|
|
||||||
IN int timeout )
|
|
||||||
{
|
{
|
||||||
return http_WriteHttpPost( handle, buf, size, timeout );
|
return http_WriteHttpPost( handle, buf, size, timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpCloseHttpPost
|
int UpnpCloseHttpPost(
|
||||||
*
|
void *handle,
|
||||||
* Parameters:
|
int *httpStatus,
|
||||||
*
|
int timeout)
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return Values: int
|
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpCloseHttpPost( IN void *handle,
|
|
||||||
IN OUT int *httpStatus,
|
|
||||||
int timeout )
|
|
||||||
{
|
{
|
||||||
return http_CloseHttpPost( handle, httpStatus, timeout );
|
return http_CloseHttpPost( handle, httpStatus, timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpOpenHttpGet
|
int UpnpOpenHttpGet(
|
||||||
*
|
const char *url_str,
|
||||||
* Parameters:
|
void **Handle,
|
||||||
*
|
char **contentType,
|
||||||
* Description:
|
int *contentLength,
|
||||||
*
|
int *httpStatus,
|
||||||
* Return Values: int
|
int timeout)
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpOpenHttpGet( IN const char *url_str,
|
|
||||||
IN OUT void **Handle,
|
|
||||||
IN OUT char **contentType,
|
|
||||||
OUT int *contentLength,
|
|
||||||
OUT int *httpStatus,
|
|
||||||
IN int timeout )
|
|
||||||
{
|
{
|
||||||
return http_OpenHttpGet( url_str, Handle, contentType, contentLength,
|
return http_OpenHttpGet( url_str, Handle, contentType, contentLength,
|
||||||
httpStatus, timeout );
|
httpStatus, timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UpnpOpenHttpGetProxy(
|
||||||
/**************************************************************************
|
const char *url_str,
|
||||||
* Function: UpnpOpenHttpGetProxy
|
const char *proxy_str,
|
||||||
*
|
void **Handle,
|
||||||
* Parameters:
|
char **contentType,
|
||||||
*
|
int *contentLength,
|
||||||
* Description:
|
int *httpStatus,
|
||||||
*
|
int timeout)
|
||||||
* Return Values: int
|
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpOpenHttpGetProxy( 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 )
|
|
||||||
{
|
{
|
||||||
return http_OpenHttpGetProxy( url_str, proxy_str, Handle, contentType, contentLength,
|
return http_OpenHttpGetProxy( url_str, proxy_str, Handle, contentType, contentLength,
|
||||||
httpStatus, timeout );
|
httpStatus, timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpOpenHttpGetEx
|
int UpnpOpenHttpGetEx(
|
||||||
*
|
const char *url_str,
|
||||||
* Parameters:
|
void **Handle,
|
||||||
*
|
char **contentType,
|
||||||
* Description:
|
int *contentLength,
|
||||||
*
|
int *httpStatus,
|
||||||
* Return Values: int
|
int lowRange,
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
int highRange,
|
||||||
***************************************************************************/
|
int timeout)
|
||||||
int
|
|
||||||
UpnpOpenHttpGetEx( 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 )
|
|
||||||
{
|
{
|
||||||
return http_OpenHttpGetEx( url_str,
|
return http_OpenHttpGetEx( url_str,
|
||||||
Handle,
|
Handle,
|
||||||
@ -3076,93 +3021,31 @@ UpnpOpenHttpGetEx( IN const char *url_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UpnpCancelHttpGet(void *Handle)
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpCancelHttpGet
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return Values: int
|
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpCancelHttpGet( IN void *Handle )
|
|
||||||
{
|
{
|
||||||
return http_CancelHttpGet( Handle );
|
return http_CancelHttpGet(Handle);
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpCloseHttpGet
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return Values: int
|
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpCloseHttpGet( IN void *Handle )
|
|
||||||
{
|
|
||||||
return http_CloseHttpGet( Handle );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpReadHttpGet
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return Values: int
|
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpReadHttpGet( IN void *Handle,
|
|
||||||
IN OUT char *buf,
|
|
||||||
IN OUT unsigned int *size,
|
|
||||||
IN int timeout )
|
|
||||||
{
|
|
||||||
return http_ReadHttpGet( Handle, buf, size, timeout );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UpnpCloseHttpGet(void *Handle)
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpHttpGetProgress
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return Values: int
|
|
||||||
* UPNP_E_SUCCESS if successful.
|
|
||||||
* UPNP_E_INVALID_PARAM if the provided pointers were invalid.
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpHttpGetProgress( IN void *Handle,
|
|
||||||
OUT unsigned int *length,
|
|
||||||
OUT unsigned int *total )
|
|
||||||
{
|
{
|
||||||
return http_HttpGetProgress(Handle, length, total);
|
return http_CloseHttpGet(Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpDownloadUrlItem
|
int UpnpReadHttpGet(void *Handle, char *buf, unsigned int *size, int timeout)
|
||||||
*
|
{
|
||||||
* Parameters:
|
return http_ReadHttpGet(Handle, buf, size, timeout);
|
||||||
*
|
}
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return Values: int
|
int UpnpHttpGetProgress(void *Handle, unsigned int *length, unsigned int *total)
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
{
|
||||||
***************************************************************************/
|
return http_HttpGetProgress(Handle, length, total);
|
||||||
int
|
}
|
||||||
UpnpDownloadUrlItem( const char *url,
|
|
||||||
char **outBuf,
|
|
||||||
char *contentType )
|
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
|
||||||
{
|
{
|
||||||
int ret_code;
|
int ret_code;
|
||||||
int dummy;
|
int dummy;
|
||||||
@ -3181,16 +3064,12 @@ UpnpDownloadUrlItem( const char *url,
|
|||||||
return ret_code;
|
return ret_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Function: UpnpDownloadXmlDoc
|
/*!
|
||||||
|
* \brief UpnpDownloadXmlDoc
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return UPNP_E_SUCCESS if successful otherwise the appropriate error code.
|
||||||
*
|
*/
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Return Values: int
|
|
||||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
|
||||||
***************************************************************************/
|
|
||||||
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
|
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
|
||||||
{
|
{
|
||||||
int ret_code;
|
int ret_code;
|
||||||
@ -3418,7 +3297,7 @@ ExitFunction:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UpnpInitStartServers(IN unsigned short DestPort)
|
int UpnpInitStartServers(unsigned short DestPort)
|
||||||
{
|
{
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
|
|
||||||
@ -3921,8 +3800,8 @@ int GetFreeHandle()
|
|||||||
|
|
||||||
/* Assumes at most one client */
|
/* Assumes at most one client */
|
||||||
Upnp_Handle_Type GetClientHandleInfo(
|
Upnp_Handle_Type GetClientHandleInfo(
|
||||||
IN UpnpClient_Handle *client_handle_out,
|
UpnpClient_Handle *client_handle_out,
|
||||||
OUT struct Handle_Info **HndInfo)
|
struct Handle_Info **HndInfo)
|
||||||
{
|
{
|
||||||
Upnp_Handle_Type ret = HND_CLIENT;
|
Upnp_Handle_Type ret = HND_CLIENT;
|
||||||
UpnpClient_Handle client;
|
UpnpClient_Handle client;
|
||||||
@ -4022,14 +3901,7 @@ int FreeHandle(int Upnp_Handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
int PrintHandleInfo(UpnpClient_Handle Hnd)
|
||||||
* \brief Print handle info.
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS if successful, otherwise returns appropriate error.
|
|
||||||
*/
|
|
||||||
int PrintHandleInfo(
|
|
||||||
/*! [in] Handle index. */
|
|
||||||
IN UpnpClient_Handle Hnd)
|
|
||||||
{
|
{
|
||||||
struct Handle_Info * HndInfo;
|
struct Handle_Info * HndInfo;
|
||||||
if (HandleTable[Hnd] != NULL) {
|
if (HandleTable[Hnd] != NULL) {
|
||||||
@ -4051,7 +3923,7 @@ int PrintHandleInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void printNodes( IXML_Node * tmpRoot, int depth )
|
void printNodes(IXML_Node *tmpRoot, int depth)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
IXML_NodeList *NodeList1;
|
IXML_NodeList *NodeList1;
|
||||||
@ -4078,7 +3950,7 @@ void printNodes( IXML_Node * tmpRoot, int depth )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getlocalhostname(OUT char *out, IN const int out_len)
|
int getlocalhostname(char *out, const int out_len)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
struct hostent *h=NULL;
|
struct hostent *h=NULL;
|
||||||
@ -4218,24 +4090,7 @@ void AutoAdvertise(void *input)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef INTERNAL_WEB_SERVER
|
#ifdef INTERNAL_WEB_SERVER
|
||||||
|
int UpnpSetWebServerRootDir(const char *rootDir)
|
||||||
/*!
|
|
||||||
* \brief Sets the document root directory for the internal web server.
|
|
||||||
*
|
|
||||||
* This directory is considered the root directory (i.e. "/") of the web server.
|
|
||||||
* This function also activates or deactivates the web server.
|
|
||||||
*
|
|
||||||
* To disable the web server, pass NULL for rootDir, to activate pass a valid
|
|
||||||
* directory string.
|
|
||||||
*
|
|
||||||
* \note This function is not available when the web server is not compiled
|
|
||||||
* into the UPnP Library.
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS if successful else returns appropriate error.
|
|
||||||
*/
|
|
||||||
int UpnpSetWebServerRootDir(
|
|
||||||
/* [in] Path of the root directory of the web server. */
|
|
||||||
IN const char *rootDir)
|
|
||||||
{
|
{
|
||||||
if( UpnpSdkInit == 0 )
|
if( UpnpSdkInit == 0 )
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
@ -4245,26 +4100,12 @@ int UpnpSetWebServerRootDir(
|
|||||||
|
|
||||||
membuffer_destroy( &gDocumentRootDir );
|
membuffer_destroy( &gDocumentRootDir );
|
||||||
|
|
||||||
return ( web_server_set_root_dir( rootDir ) );
|
return web_server_set_root_dir(rootDir);
|
||||||
}
|
}
|
||||||
#endif // INTERNAL_WEB_SERVER
|
#endif // INTERNAL_WEB_SERVER
|
||||||
|
|
||||||
|
|
||||||
/*!
|
int UpnpAddVirtualDir(const char *newDirName)
|
||||||
* \brief Adds a virtual directory mapping.
|
|
||||||
*
|
|
||||||
* All webserver requests containing the given directory are read using
|
|
||||||
* functions contained in a VirtualDirCallbacks structure registered
|
|
||||||
* via UpnpSetVirtualDirCallbacks.
|
|
||||||
*
|
|
||||||
* \note This function is not available when the web server is not
|
|
||||||
* compiled into the UPnP Library.
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS if successful else returns appropriate error.
|
|
||||||
*/
|
|
||||||
int UpnpAddVirtualDir(
|
|
||||||
/* [in] The name of the new directory mapping to add. */
|
|
||||||
IN const char *newDirName)
|
|
||||||
{
|
{
|
||||||
virtualDirList *pNewVirtualDir;
|
virtualDirList *pNewVirtualDir;
|
||||||
virtualDirList *pLast;
|
virtualDirList *pLast;
|
||||||
@ -4320,14 +4161,7 @@ int UpnpAddVirtualDir(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
int UpnpRemoveVirtualDir(const char *dirName)
|
||||||
* \brief Removes a virtual directory mapping.
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS if successful else returns appropriate error.
|
|
||||||
*/
|
|
||||||
int UpnpRemoveVirtualDir(
|
|
||||||
/* [in] The name of the directory mapping to remove. */
|
|
||||||
IN const char *dirName)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
virtualDirList *pPrev;
|
virtualDirList *pPrev;
|
||||||
@ -4380,9 +4214,6 @@ int UpnpRemoveVirtualDir(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Removes all the virtual directory mappings.
|
|
||||||
*/
|
|
||||||
void UpnpRemoveAllVirtualDirs()
|
void UpnpRemoveAllVirtualDirs()
|
||||||
{
|
{
|
||||||
virtualDirList *pCur;
|
virtualDirList *pCur;
|
||||||
@ -4406,15 +4237,7 @@ void UpnpRemoveAllVirtualDirs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
int UpnpEnableWebserver(int enable)
|
||||||
* \brief Enables or disables the webserver. A value of TRUE enables the
|
|
||||||
* webserver, FALSE disables it.
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS if successful else returns appropriate error.
|
|
||||||
*/
|
|
||||||
int UpnpEnableWebserver(
|
|
||||||
/* [in] TRUE to enable, FALSE to disable. */
|
|
||||||
IN int enable)
|
|
||||||
{
|
{
|
||||||
int retVal;
|
int retVal;
|
||||||
|
|
||||||
@ -4539,16 +4362,9 @@ int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*
|
|
||||||
* \deprecated Use UpnpSetMaxContentLength() instead.
|
|
||||||
*/
|
|
||||||
int UpnpSetContentLength(
|
int UpnpSetContentLength(
|
||||||
/* [in] . */
|
UpnpClient_Handle Hnd,
|
||||||
IN UpnpClient_Handle Hnd,
|
int contentLength)
|
||||||
/* [in] . */
|
|
||||||
IN int contentLength)
|
|
||||||
{
|
{
|
||||||
int errCode = UPNP_E_SUCCESS;
|
int errCode = UPNP_E_SUCCESS;
|
||||||
struct Handle_Info *HInfo = NULL;
|
struct Handle_Info *HInfo = NULL;
|
||||||
@ -4581,23 +4397,7 @@ int UpnpSetContentLength(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
int UpnpSetMaxContentLength(size_t contentLength)
|
||||||
* \brief Sets the maximum content-length that the SDK will process on an
|
|
||||||
* incoming SOAP requests or responses.
|
|
||||||
*
|
|
||||||
* This API allows devices that have memory constraints to exhibit consistent
|
|
||||||
* behaviour if the size of the incoming SOAP message exceeds the memory that
|
|
||||||
* device can allocate.
|
|
||||||
*
|
|
||||||
* The default maximum content-length is {\tt DEFAULT_SOAP_CONTENT_LENGTH}
|
|
||||||
* == 16K bytes.
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS if the operation completed successfully.
|
|
||||||
*/
|
|
||||||
int UpnpSetMaxContentLength(
|
|
||||||
/*! Permissible content length, in bytes. The maximum size to be set. */
|
|
||||||
IN size_t contentLength
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int errCode = UPNP_E_SUCCESS;
|
int errCode = UPNP_E_SUCCESS;
|
||||||
|
|
||||||
|
@ -31,557 +31,428 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#if EXCLUDE_DOM == 0
|
#if EXCLUDE_DOM == 0
|
||||||
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
|
||||||
#include "upnptools.h"
|
#include "upnptools.h"
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
|
|
||||||
|
|
||||||
#define HEADER_LENGTH 2000
|
#define HEADER_LENGTH 2000
|
||||||
|
|
||||||
/* Structure to maintain a error code and string associated with the
|
|
||||||
* error code
|
/*!
|
||||||
|
* \brief Structure to maintain a error code and string associated with the
|
||||||
|
* error code.
|
||||||
*/
|
*/
|
||||||
struct ErrorString {
|
struct ErrorString {
|
||||||
int rc; /* error code */
|
/*! Error code. */
|
||||||
const char *rcError; /* error description */
|
int rc;
|
||||||
|
/*! Error description. */
|
||||||
|
const char *rcError;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Initializing the array of error structures. */
|
|
||||||
struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
|
/*!
|
||||||
{UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"},
|
* \brief Array of error structures.
|
||||||
{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"},
|
*/
|
||||||
{UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"},
|
struct ErrorString ErrorMessages[] = {
|
||||||
{UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"},
|
{UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
|
||||||
{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMOR"},
|
{UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"},
|
||||||
{UPNP_E_INIT, "UPNP_E_INIT"},
|
{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"},
|
||||||
{UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"},
|
{UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"},
|
||||||
{UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"},
|
{UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"},
|
||||||
{UPNP_E_INVALID_URL, "UPNP_E_INVALID_URL"},
|
{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMOR"},
|
||||||
{UPNP_E_INVALID_SID, "UPNP_E_INVALID_SID"},
|
{UPNP_E_INIT, "UPNP_E_INIT"},
|
||||||
{UPNP_E_INVALID_DEVICE, "UPNP_E_INVALID_DEVICE"},
|
{UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"},
|
||||||
{UPNP_E_INVALID_SERVICE, "UPNP_E_INVALID_SERVICE"},
|
{UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"},
|
||||||
{UPNP_E_BAD_RESPONSE, "UPNP_E_BAD_RESPONSE"},
|
{UPNP_E_INVALID_URL, "UPNP_E_INVALID_URL"},
|
||||||
{UPNP_E_BAD_REQUEST, "UPNP_E_BAD_REQUEST"},
|
{UPNP_E_INVALID_SID, "UPNP_E_INVALID_SID"},
|
||||||
{UPNP_E_INVALID_ACTION, "UPNP_E_INVALID_ACTION"},
|
{UPNP_E_INVALID_DEVICE, "UPNP_E_INVALID_DEVICE"},
|
||||||
{UPNP_E_FINISH, "UPNP_E_FINISH"},
|
{UPNP_E_INVALID_SERVICE, "UPNP_E_INVALID_SERVICE"},
|
||||||
{UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"},
|
{UPNP_E_BAD_RESPONSE, "UPNP_E_BAD_RESPONSE"},
|
||||||
{UPNP_E_BAD_HTTPMSG, "UPNP_E_BAD_HTTPMSG"},
|
{UPNP_E_BAD_REQUEST, "UPNP_E_BAD_REQUEST"},
|
||||||
{UPNP_E_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"},
|
{UPNP_E_INVALID_ACTION, "UPNP_E_INVALID_ACTION"},
|
||||||
{UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"},
|
{UPNP_E_FINISH, "UPNP_E_FINISH"},
|
||||||
{UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"},
|
{UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"},
|
||||||
{UPNP_E_SOCKET_BIND, "UPNP_E_SOCKET_BIND"},
|
{UPNP_E_BAD_HTTPMSG, "UPNP_E_BAD_HTTPMSG"},
|
||||||
{UPNP_E_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"},
|
{UPNP_E_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"},
|
||||||
{UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"},
|
{UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"},
|
||||||
{UPNP_E_LISTEN, "UPNP_E_LISTEN"},
|
{UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"},
|
||||||
{UPNP_E_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"},
|
{UPNP_E_SOCKET_BIND, "UPNP_E_SOCKET_BIND"},
|
||||||
{UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"},
|
{UPNP_E_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"},
|
||||||
{UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"},
|
{UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"},
|
||||||
{UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_UNACCEPTED"},
|
{UPNP_E_LISTEN, "UPNP_E_LISTEN"},
|
||||||
{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"},
|
{UPNP_E_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"},
|
||||||
{UPNP_E_INVALID_ARGUMENT, "UPNP_E_INVALID_ARGUMENT"},
|
{UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"},
|
||||||
{UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"}
|
{UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"},
|
||||||
|
{UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_UNACCEPTED"},
|
||||||
|
{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"},
|
||||||
|
{UPNP_E_INVALID_ARGUMENT, "UPNP_E_INVALID_ARGUMENT"},
|
||||||
|
{UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"},
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpGetErrorMessage
|
const char *UpnpGetErrorMessage(int rc)
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN int rc: error code
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This functions returns the error string mapped to the error code
|
|
||||||
* Returns: const char *
|
|
||||||
* return either the right string or "Unknown Error"
|
|
||||||
***************************************************************************/
|
|
||||||
const char *
|
|
||||||
UpnpGetErrorMessage( IN int rc )
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < sizeof( ErrorMessages ) / sizeof( ErrorMessages[0] );
|
for (i = 0; i < sizeof (ErrorMessages) / sizeof (ErrorMessages[0]); ++i) {
|
||||||
i++ ) {
|
if (rc == ErrorMessages[i].rc) {
|
||||||
if( rc == ErrorMessages[i].rc )
|
return ErrorMessages[i].rcError;
|
||||||
return ErrorMessages[i].rcError;
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return "Unknown Error";
|
|
||||||
|
|
||||||
|
return "Unknown error code";
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpResolveURL
|
/*!
|
||||||
*
|
* \todo There is some unnecessary allocation and deallocation going on here
|
||||||
* Parameters:
|
* because of the way resolve_rel_url() was originally written and used. In the
|
||||||
* IN char * BaseURL: Base URL string
|
* future it would be nice to clean this up.
|
||||||
* IN char * RelURL: relative URL string
|
*/
|
||||||
* OUT char * AbsURL: Absolute URL string
|
int UpnpResolveURL(
|
||||||
* Description:
|
const char *BaseURL,
|
||||||
* This functions concatinates the base URL and relative URL to generate
|
const char *RelURL,
|
||||||
* the absolute URL
|
char *AbsURL)
|
||||||
* Returns: int
|
|
||||||
* return either UPNP_E_SUCCESS or appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpResolveURL( IN const char *BaseURL,
|
|
||||||
IN const char *RelURL,
|
|
||||||
OUT char *AbsURL )
|
|
||||||
{
|
{
|
||||||
// There is some unnecessary allocation and
|
int ret = UPNP_E_SUCCESS;
|
||||||
// deallocation going on here because of the way
|
char *tempRel = NULL;
|
||||||
// resolve_rel_url was originally written and used
|
|
||||||
// in the future it would be nice to clean this up
|
|
||||||
|
|
||||||
char *tempRel;
|
if (RelURL == NULL) {
|
||||||
|
ret = UPNP_E_INVALID_PARAM;
|
||||||
|
goto ExitFunction;
|
||||||
|
}
|
||||||
|
|
||||||
if( RelURL == NULL )
|
tempRel = resolve_rel_url((char *)BaseURL, (char *)RelURL);
|
||||||
return UPNP_E_INVALID_PARAM;
|
if (tempRel) {
|
||||||
|
strcpy(AbsURL, tempRel);
|
||||||
tempRel = NULL;
|
free(tempRel);
|
||||||
|
} else {
|
||||||
tempRel = resolve_rel_url((char*) BaseURL, (char*) RelURL );
|
ret = UPNP_E_INVALID_URL;
|
||||||
|
}
|
||||||
if( tempRel ) {
|
|
||||||
strcpy( AbsURL, tempRel );
|
|
||||||
free( tempRel );
|
|
||||||
} else {
|
|
||||||
return UPNP_E_INVALID_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
|
||||||
|
|
||||||
|
ExitFunction:
|
||||||
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : addToAction
|
/*!
|
||||||
*
|
* \brief Adds the argument in the action request or response.
|
||||||
* Parameters:
|
*
|
||||||
* IN int response: flag to tell if the ActionDoc is for response
|
* This function creates the action request or response if it is a first
|
||||||
* or request
|
* argument, otherwise it will add the argument in the document.
|
||||||
* INOUT IXML_Document **ActionDoc: request or response document
|
*
|
||||||
* IN char *ActionName: Name of the action request or response
|
* \returns UPNP_E_SUCCESS if successful, otherwise the appropriate error.
|
||||||
* IN char *ServType: Service type
|
*/
|
||||||
* IN char * ArgName: Name of the argument
|
static int addToAction(
|
||||||
* IN char * ArgValue: Value of the argument
|
/*! [in] flag to tell if the ActionDoc is for response or request. */
|
||||||
*
|
int response,
|
||||||
* Description:
|
/*! [in,out] Request or response document. */
|
||||||
* This function adds the argument in the action request or response.
|
IXML_Document **ActionDoc,
|
||||||
* This function creates the action request or response if it is a first
|
/*! [in] Name of the action request or response. */
|
||||||
* argument else it will add the argument in the document
|
const char *ActionName,
|
||||||
*
|
/*! [in] Service type. */
|
||||||
* Returns: int
|
const char *ServType,
|
||||||
* returns UPNP_E_SUCCESS if successful else returns appropriate error
|
/*! [in] Name of the argument. */
|
||||||
***************************************************************************/
|
const char *ArgName,
|
||||||
static int
|
/*! [in] Value of the argument. */
|
||||||
addToAction( IN int response,
|
const char *ArgValue)
|
||||||
INOUT IXML_Document ** ActionDoc,
|
|
||||||
IN const char *ActionName,
|
|
||||||
IN const char *ServType,
|
|
||||||
IN const char *ArgName,
|
|
||||||
IN const char *ArgValue )
|
|
||||||
{
|
{
|
||||||
char *ActBuff = NULL;
|
char *ActBuff = NULL;
|
||||||
IXML_Node *node = NULL;
|
IXML_Node *node = NULL;
|
||||||
IXML_Element *Ele = NULL;
|
IXML_Element *Ele = NULL;
|
||||||
IXML_Node *Txt = NULL;
|
IXML_Node *Txt = NULL;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if( ActionName == NULL || ServType == NULL ) {
|
if (ActionName == NULL || ServType == NULL) {
|
||||||
return UPNP_E_INVALID_PARAM;
|
return UPNP_E_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *ActionDoc == NULL ) {
|
if (*ActionDoc == NULL) {
|
||||||
ActBuff = ( char * )malloc( HEADER_LENGTH );
|
ActBuff = (char *)malloc(HEADER_LENGTH);
|
||||||
if( ActBuff == NULL ) {
|
if (ActBuff == NULL) {
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( response ) {
|
if (response) {
|
||||||
sprintf( ActBuff,
|
sprintf(ActBuff,
|
||||||
"<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>",
|
"<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>",
|
||||||
ActionName, ServType, ActionName );
|
ActionName, ServType, ActionName);
|
||||||
} else {
|
} else {
|
||||||
sprintf( ActBuff,
|
sprintf(ActBuff,
|
||||||
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
||||||
ActionName, ServType, ActionName );
|
ActionName, ServType, ActionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ixmlParseBufferEx( ActBuff, ActionDoc );
|
rc = ixmlParseBufferEx(ActBuff, ActionDoc);
|
||||||
free( ActBuff );
|
free(ActBuff);
|
||||||
if( rc != IXML_SUCCESS ) {
|
if (rc != IXML_SUCCESS) {
|
||||||
if( rc == IXML_INSUFFICIENT_MEMORY ) {
|
if (rc == IXML_INSUFFICIENT_MEMORY) {
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
} else {
|
} else {
|
||||||
return UPNP_E_INVALID_DESC;
|
return UPNP_E_INVALID_DESC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ArgName != NULL /*&& ArgValue != NULL */ ) {
|
if (ArgName != NULL /*&& ArgValue != NULL */) {
|
||||||
node = ixmlNode_getFirstChild( ( IXML_Node * ) * ActionDoc );
|
node = ixmlNode_getFirstChild((IXML_Node *)*ActionDoc);
|
||||||
Ele = ixmlDocument_createElement( *ActionDoc, ArgName );
|
Ele = ixmlDocument_createElement(*ActionDoc, ArgName);
|
||||||
if( ArgValue ) {
|
if(ArgValue) {
|
||||||
Txt = ixmlDocument_createTextNode( *ActionDoc, ArgValue );
|
Txt = ixmlDocument_createTextNode(*ActionDoc, ArgValue);
|
||||||
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||||
}
|
}
|
||||||
|
ixmlNode_appendChild(node, (IXML_Node *)Ele);
|
||||||
|
}
|
||||||
|
|
||||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
return UPNP_E_SUCCESS;
|
||||||
}
|
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : makeAction
|
/*!
|
||||||
*
|
* \brief Creates the action request or response from the argument list.
|
||||||
* Parameters:
|
*
|
||||||
* IN int response: flag to tell if the ActionDoc is for response
|
* \return Action request or response document if successful, otherwise
|
||||||
* or request
|
* returns NULL
|
||||||
* IN char * ActionName: Name of the action request or response
|
*/
|
||||||
* IN char * ServType: Service type
|
static IXML_Document *makeAction(
|
||||||
* IN int NumArg :Number of arguments in the action request or response
|
/*! [in] flag to tell if the ActionDoc is for response or request. */
|
||||||
* IN char * Arg : pointer to the first argument
|
int response,
|
||||||
* IN va_list ArgList: Argument list
|
/*! [in] Name of the action request or response. */
|
||||||
*
|
const char *ActionName,
|
||||||
* Description:
|
/*! [in] Service type. */
|
||||||
* This function creates the action request or response from the argument
|
const char *ServType,
|
||||||
* list.
|
/*! [in] Number of arguments in the action request or response. */
|
||||||
* Returns: IXML_Document *
|
int NumArg,
|
||||||
* returns action request or response document if successful
|
/*! [in] pointer to the first argument. */
|
||||||
* else returns NULL
|
const char *Arg,
|
||||||
***************************************************************************/
|
/*! [in] Argument list. */
|
||||||
static IXML_Document *
|
va_list ArgList)
|
||||||
makeAction( IN int response,
|
|
||||||
IN const char *ActionName,
|
|
||||||
IN const char *ServType,
|
|
||||||
IN int NumArg,
|
|
||||||
IN const char *Arg,
|
|
||||||
IN va_list ArgList )
|
|
||||||
{
|
{
|
||||||
const char *ArgName;
|
const char *ArgName;
|
||||||
const char *ArgValue;
|
const char *ArgValue;
|
||||||
char *ActBuff;
|
char *ActBuff;
|
||||||
int Idx = 0;
|
int Idx = 0;
|
||||||
IXML_Document *ActionDoc;
|
IXML_Document *ActionDoc;
|
||||||
IXML_Node *node;
|
IXML_Node *node;
|
||||||
IXML_Element *Ele;
|
IXML_Element *Ele;
|
||||||
IXML_Node *Txt = NULL;
|
IXML_Node *Txt = NULL;
|
||||||
|
|
||||||
if( ActionName == NULL || ServType == NULL ) {
|
if (ActionName == NULL || ServType == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActBuff = ( char * )malloc( HEADER_LENGTH );
|
ActBuff = (char *)malloc(HEADER_LENGTH);
|
||||||
if( ActBuff == NULL ) {
|
if (ActBuff == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( response ) {
|
if (response) {
|
||||||
sprintf( ActBuff,
|
sprintf(ActBuff,
|
||||||
"<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>",
|
"<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>",
|
||||||
ActionName, ServType, ActionName );
|
ActionName, ServType, ActionName);
|
||||||
} else {
|
} else {
|
||||||
sprintf( ActBuff,
|
sprintf(ActBuff,
|
||||||
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
||||||
ActionName, ServType, ActionName );
|
ActionName, ServType, ActionName);
|
||||||
}
|
}
|
||||||
|
if (ixmlParseBufferEx(ActBuff, &ActionDoc) != IXML_SUCCESS) {
|
||||||
|
free(ActBuff);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if( ixmlParseBufferEx( ActBuff, &ActionDoc ) != IXML_SUCCESS ) {
|
free(ActBuff);
|
||||||
free( ActBuff );
|
if(ActionDoc == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free( ActBuff );
|
if (NumArg > 0) {
|
||||||
|
//va_start(ArgList, Arg);
|
||||||
|
ArgName = Arg;
|
||||||
|
for ( ; ; ) {
|
||||||
|
ArgValue = va_arg(ArgList, const char *);
|
||||||
|
if (ArgName != NULL) {
|
||||||
|
node = ixmlNode_getFirstChild((IXML_Node *)ActionDoc);
|
||||||
|
Ele = ixmlDocument_createElement(ActionDoc, ArgName);
|
||||||
|
if (ArgValue) {
|
||||||
|
Txt = ixmlDocument_createTextNode(ActionDoc, ArgValue);
|
||||||
|
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||||
|
}
|
||||||
|
ixmlNode_appendChild(node, (IXML_Node *)Ele);
|
||||||
|
}
|
||||||
|
if (++Idx < NumArg) {
|
||||||
|
ArgName = va_arg(ArgList, const char *);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//va_end(ArgList);
|
||||||
|
}
|
||||||
|
|
||||||
if( ActionDoc == NULL ) {
|
return ActionDoc;
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( NumArg > 0 ) {
|
|
||||||
//va_start(ArgList, Arg);
|
|
||||||
ArgName = Arg;
|
|
||||||
for ( ; ; ) {
|
|
||||||
ArgValue = va_arg( ArgList, const char * );
|
|
||||||
|
|
||||||
if( ArgName != NULL ) {
|
|
||||||
node = ixmlNode_getFirstChild( ( IXML_Node * ) ActionDoc );
|
|
||||||
Ele = ixmlDocument_createElement( ActionDoc, ArgName );
|
|
||||||
if( ArgValue ) {
|
|
||||||
Txt =
|
|
||||||
ixmlDocument_createTextNode( ActionDoc, ArgValue );
|
|
||||||
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
|
||||||
}
|
|
||||||
|
|
||||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (++Idx < NumArg) {
|
|
||||||
ArgName = va_arg( ArgList, const char * );
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//va_end(ArgList);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ActionDoc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpMakeAction
|
IXML_Document *UpnpMakeAction(
|
||||||
*
|
const char *ActionName,
|
||||||
* Parameters:
|
const char *ServType,
|
||||||
* IN char * ActionName: Name of the action request or response
|
int NumArg,
|
||||||
* IN char * ServType: Service type
|
const char *Arg,
|
||||||
* IN int NumArg :Number of arguments in the action request or response
|
...)
|
||||||
* IN char * Arg : pointer to the first argument
|
|
||||||
* IN ... : variable argument list
|
|
||||||
* IN va_list ArgList: Argument list
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function creates the action request from the argument
|
|
||||||
* list. Its a wrapper function that calls makeAction function to create
|
|
||||||
* the action request.
|
|
||||||
*
|
|
||||||
* Returns: IXML_Document *
|
|
||||||
* returns action request document if successful
|
|
||||||
* else returns NULL
|
|
||||||
***************************************************************************/
|
|
||||||
IXML_Document *
|
|
||||||
UpnpMakeAction( const char *ActionName,
|
|
||||||
const char *ServType,
|
|
||||||
int NumArg,
|
|
||||||
const char *Arg,
|
|
||||||
... )
|
|
||||||
{
|
{
|
||||||
va_list ArgList;
|
va_list ArgList;
|
||||||
IXML_Document *out = NULL;
|
IXML_Document *out = NULL;
|
||||||
|
|
||||||
va_start( ArgList, Arg );
|
va_start(ArgList, Arg);
|
||||||
out = makeAction( 0, ActionName, ServType, NumArg, Arg, ArgList );
|
out = makeAction(0, ActionName, ServType, NumArg, Arg, ArgList);
|
||||||
va_end( ArgList );
|
va_end(ArgList);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpMakeActionResponse
|
IXML_Document *UpnpMakeActionResponse(
|
||||||
*
|
const char *ActionName,
|
||||||
* Parameters:
|
const char *ServType,
|
||||||
* IN char * ActionName: Name of the action request or response
|
int NumArg,
|
||||||
* IN char * ServType: Service type
|
const char *Arg,
|
||||||
* IN int NumArg :Number of arguments in the action request or response
|
...)
|
||||||
* IN char * Arg : pointer to the first argument
|
|
||||||
* IN ... : variable argument list
|
|
||||||
* IN va_list ArgList: Argument list
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function creates the action response from the argument
|
|
||||||
* list. Its a wrapper function that calls makeAction function to create
|
|
||||||
* the action response.
|
|
||||||
*
|
|
||||||
* Returns: IXML_Document *
|
|
||||||
* returns action response document if successful
|
|
||||||
* else returns NULL
|
|
||||||
***************************************************************************/
|
|
||||||
IXML_Document *
|
|
||||||
UpnpMakeActionResponse( const char *ActionName,
|
|
||||||
const char *ServType,
|
|
||||||
int NumArg,
|
|
||||||
const char *Arg,
|
|
||||||
... )
|
|
||||||
{
|
{
|
||||||
va_list ArgList;
|
va_list ArgList;
|
||||||
IXML_Document *out = NULL;
|
IXML_Document *out = NULL;
|
||||||
|
|
||||||
va_start( ArgList, Arg );
|
va_start(ArgList, Arg);
|
||||||
out = makeAction( 1, ActionName, ServType, NumArg, Arg, ArgList );
|
out = makeAction(1, ActionName, ServType, NumArg, Arg, ArgList);
|
||||||
va_end( ArgList );
|
va_end(ArgList);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpAddToActionResponse
|
int UpnpAddToAction(
|
||||||
*
|
IXML_Document **ActionDoc,
|
||||||
* Parameters:
|
const char *ActionName,
|
||||||
* INOUT IXML_Document **ActionResponse: action response document
|
const char *ServType,
|
||||||
* IN char * ActionName: Name of the action request or response
|
const char *ArgName,
|
||||||
* IN char * ServType: Service type
|
const char *ArgValue)
|
||||||
* IN int ArgName :Name of argument to be added in the action response
|
|
||||||
* IN char * ArgValue : value of the argument
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function adds the argument in the action response. Its a wrapper
|
|
||||||
* function that calls addToAction function to add the argument in the
|
|
||||||
* action response.
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
* returns UPNP_E_SUCCESS if successful
|
|
||||||
* else returns appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpAddToActionResponse( INOUT IXML_Document ** ActionResponse,
|
|
||||||
IN const char *ActionName,
|
|
||||||
IN const char *ServType,
|
|
||||||
IN const char *ArgName,
|
|
||||||
IN const char *ArgValue )
|
|
||||||
{
|
{
|
||||||
return addToAction( 1, ActionResponse, ActionName, ServType, ArgName,
|
return addToAction(0, ActionDoc, ActionName, ServType, ArgName, ArgValue);
|
||||||
ArgValue );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpAddToAction
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* INOUT IXML_Document **ActionDoc: action request document
|
|
||||||
* IN char * ActionName: Name of the action request or response
|
|
||||||
* IN char * ServType: Service type
|
|
||||||
* IN int ArgName :Name of argument to be added in the action response
|
|
||||||
* IN char * ArgValue : value of the argument
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function adds the argument in the action request. Its a wrapper
|
|
||||||
* function that calls addToAction function to add the argument in the
|
|
||||||
* action request.
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
* returns UPNP_E_SUCCESS if successful
|
|
||||||
* else returns appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpAddToAction( IXML_Document ** ActionDoc,
|
|
||||||
const char *ActionName,
|
|
||||||
const char *ServType,
|
|
||||||
const char *ArgName,
|
|
||||||
const char *ArgValue )
|
|
||||||
{
|
|
||||||
|
|
||||||
return addToAction( 0, ActionDoc, ActionName, ServType, ArgName,
|
int UpnpAddToActionResponse(
|
||||||
ArgValue );
|
IXML_Document **ActionResponse,
|
||||||
|
const char *ActionName,
|
||||||
|
const char *ServType,
|
||||||
|
const char *ArgName,
|
||||||
|
const char *ArgValue)
|
||||||
|
{
|
||||||
|
return addToAction(1, ActionResponse, ActionName, ServType, ArgName, ArgValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpAddToPropertySet
|
IXML_Document *UpnpCreatePropertySet(
|
||||||
*
|
int NumArg,
|
||||||
* Parameters:
|
const char *Arg,
|
||||||
* INOUT IXML_Document **PropSet: propertyset document
|
...)
|
||||||
* IN char *ArgName: Name of the argument
|
|
||||||
* IN char *ArgValue: value of the argument
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function adds the argument in the propertyset node
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
* returns UPNP_E_SUCCESS if successful else returns appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpAddToPropertySet( INOUT IXML_Document ** PropSet,
|
|
||||||
IN const char *ArgName,
|
|
||||||
IN const char *ArgValue )
|
|
||||||
{
|
{
|
||||||
|
va_list ArgList;
|
||||||
|
int Idx = 0;
|
||||||
|
char BlankDoc[] =
|
||||||
|
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"
|
||||||
|
"</e:propertyset>";
|
||||||
|
const char *ArgName,
|
||||||
|
*ArgValue;
|
||||||
|
IXML_Node *node;
|
||||||
|
IXML_Element *Ele;
|
||||||
|
IXML_Element *Ele1;
|
||||||
|
IXML_Node *Txt;
|
||||||
|
IXML_Document *PropSet;
|
||||||
|
|
||||||
char BlankDoc[] = "<e:propertyset xmlns:e=\"urn:schemas"
|
if(ixmlParseBufferEx(BlankDoc, &PropSet) != IXML_SUCCESS) {
|
||||||
"-upnp-org:event-1-0\"></e:propertyset>";
|
return NULL;
|
||||||
IXML_Node *node;
|
}
|
||||||
IXML_Element *Ele;
|
|
||||||
IXML_Element *Ele1;
|
|
||||||
IXML_Node *Txt;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
if( ArgName == NULL ) {
|
if (NumArg < 1) {
|
||||||
return UPNP_E_INVALID_PARAM;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *PropSet == NULL ) {
|
va_start(ArgList, Arg);
|
||||||
rc = ixmlParseBufferEx( BlankDoc, PropSet );
|
ArgName = Arg;
|
||||||
if( rc != IXML_SUCCESS ) {
|
while (Idx++ != NumArg) {
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
ArgValue = va_arg(ArgList, const char *);
|
||||||
}
|
if (ArgName != NULL /*&& ArgValue != NULL */) {
|
||||||
}
|
node = ixmlNode_getFirstChild((IXML_Node *)PropSet);
|
||||||
|
Ele1 = ixmlDocument_createElement(PropSet, "e:property");
|
||||||
|
Ele = ixmlDocument_createElement(PropSet, ArgName);
|
||||||
|
if (ArgValue) {
|
||||||
|
Txt = ixmlDocument_createTextNode(PropSet, ArgValue);
|
||||||
|
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||||
|
}
|
||||||
|
ixmlNode_appendChild((IXML_Node *)Ele1, (IXML_Node *)Ele);
|
||||||
|
ixmlNode_appendChild( node, (IXML_Node *)Ele1);
|
||||||
|
}
|
||||||
|
ArgName = va_arg(ArgList, const char *);
|
||||||
|
}
|
||||||
|
va_end(ArgList);
|
||||||
|
|
||||||
node = ixmlNode_getFirstChild( ( IXML_Node * ) * PropSet );
|
return PropSet;
|
||||||
|
|
||||||
Ele1 = ixmlDocument_createElement( *PropSet, "e:property" );
|
|
||||||
Ele = ixmlDocument_createElement( *PropSet, ArgName );
|
|
||||||
|
|
||||||
if( ArgValue ) {
|
|
||||||
Txt = ixmlDocument_createTextNode( *PropSet, ArgValue );
|
|
||||||
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
|
||||||
}
|
|
||||||
|
|
||||||
ixmlNode_appendChild( ( IXML_Node * ) Ele1, ( IXML_Node * ) Ele );
|
|
||||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele1 );
|
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpCreatePropertySet
|
int UpnpAddToPropertySet(
|
||||||
*
|
IXML_Document **PropSet,
|
||||||
* Parameters:
|
const char *ArgName,
|
||||||
* IN int NumArg: Number of argument that will go in the propertyset node
|
const char *ArgValue)
|
||||||
* IN char * Args: argument strings
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function creates a propertyset node and put all the input
|
|
||||||
* parameters in the node as elements
|
|
||||||
*
|
|
||||||
* Returns: IXML_Document *
|
|
||||||
* returns the document containing propertyset node.
|
|
||||||
***************************************************************************/
|
|
||||||
IXML_Document *
|
|
||||||
UpnpCreatePropertySet( IN int NumArg,
|
|
||||||
IN const char *Arg,
|
|
||||||
... )
|
|
||||||
{
|
{
|
||||||
va_list ArgList;
|
char BlankDoc[] =
|
||||||
int Idx = 0;
|
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"
|
||||||
char BlankDoc[] = "<e:propertyset xmlns:e=\"urn:schemas-"
|
"</e:propertyset>";
|
||||||
"upnp-org:event-1-0\"></e:propertyset>";
|
IXML_Node *node;
|
||||||
const char *ArgName,
|
IXML_Element *Ele;
|
||||||
*ArgValue;
|
IXML_Element *Ele1;
|
||||||
IXML_Node *node;
|
IXML_Node *Txt;
|
||||||
IXML_Element *Ele;
|
int rc;
|
||||||
IXML_Element *Ele1;
|
|
||||||
IXML_Node *Txt;
|
|
||||||
IXML_Document *PropSet;
|
|
||||||
|
|
||||||
if( ixmlParseBufferEx( BlankDoc, &PropSet ) != IXML_SUCCESS ) {
|
if (ArgName == NULL) {
|
||||||
return NULL;
|
return UPNP_E_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NumArg < 1 ) {
|
if (*PropSet == NULL) {
|
||||||
return NULL;
|
rc = ixmlParseBufferEx(BlankDoc, PropSet);
|
||||||
}
|
if (rc != IXML_SUCCESS) {
|
||||||
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
va_start( ArgList, Arg );
|
node = ixmlNode_getFirstChild((IXML_Node *)*PropSet);
|
||||||
ArgName = Arg;
|
|
||||||
|
|
||||||
while( Idx++ != NumArg ) {
|
Ele1 = ixmlDocument_createElement(*PropSet, "e:property");
|
||||||
ArgValue = va_arg( ArgList, const char * );
|
Ele = ixmlDocument_createElement(*PropSet, ArgName);
|
||||||
|
|
||||||
if( ArgName != NULL /*&& ArgValue != NULL */ ) {
|
if (ArgValue) {
|
||||||
node = ixmlNode_getFirstChild( ( IXML_Node * ) PropSet );
|
Txt = ixmlDocument_createTextNode(*PropSet, ArgValue);
|
||||||
Ele1 = ixmlDocument_createElement( PropSet, "e:property" );
|
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||||
Ele = ixmlDocument_createElement( PropSet, ArgName );
|
}
|
||||||
if( ArgValue ) {
|
|
||||||
Txt = ixmlDocument_createTextNode( PropSet, ArgValue );
|
|
||||||
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
|
||||||
}
|
|
||||||
|
|
||||||
ixmlNode_appendChild( ( IXML_Node * ) Ele1,
|
ixmlNode_appendChild((IXML_Node *)Ele1, (IXML_Node *)Ele);
|
||||||
( IXML_Node * ) Ele );
|
ixmlNode_appendChild(node, (IXML_Node *)Ele1);
|
||||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
ArgName = va_arg( ArgList, const char * );
|
return UPNP_E_SUCCESS;
|
||||||
|
|
||||||
}
|
|
||||||
va_end( ArgList );
|
|
||||||
return PropSet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* EXCLUDE_DOM == 0 */
|
#endif /* EXCLUDE_DOM == 0 */
|
||||||
|
|
||||||
|
@ -34,6 +34,11 @@
|
|||||||
#define UPNPAPI_H
|
#define UPNPAPI_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "client_table.h"
|
#include "client_table.h"
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "VirtualDir.h" /* for struct VirtualDirCallbacks */
|
#include "VirtualDir.h" /* for struct VirtualDirCallbacks */
|
||||||
@ -369,6 +374,16 @@ int getlocalhostname(
|
|||||||
const int out_len);
|
const int out_len);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Print handle info.
|
||||||
|
*
|
||||||
|
* \return UPNP_E_SUCCESS if successful, otherwise returns appropriate error.
|
||||||
|
*/
|
||||||
|
int PrintHandleInfo(
|
||||||
|
/*! [in] Handle index. */
|
||||||
|
UpnpClient_Handle Hnd);
|
||||||
|
|
||||||
|
|
||||||
extern WebServerState bWebServerState;
|
extern WebServerState bWebServerState;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user