📄 upnp.h
字号:
* callbacks. Once this call returns, the SDK will no longer
* generate callbacks to the application.
*
* @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_HANDLE}: The handle is not a valid
* device handle.
* \end{itemize}
*/
EXPORT_SPEC int UpnpUnRegisterRootDevice(
IN UpnpDevice_Handle /** The handle of the root device instance to
unregister. */
);
/** Sets the size of the receive buffer for incoming SOAP requests. This API
* allows devices that have memory constraints to exhibit consistent
* behaviour if the size of the incoming SOAP request exceeds the memory
* that device can allocate for incoming SOAP messages. The default
* value set by the SDK for the buffer is 16K bytes. Trying to set a value
* greater than 32K will result in an error.
*
* @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_HANDLE}: The handle is not a valid
* device handle.
* \item {\tt UPNP_E_LARGE_BUFFER_SIZE}: The buffer size requested was
* too large.
* \end{itemize}
*/
EXPORT_SPEC int UpnpSetContentLength(
IN UpnpClient_Handle Hnd, /** The handle of the device instance
for which the coincoming content length
needs to be set. */
IN int contentLength /** The maximum permissible content length
for incoming SOAP actions. */
);
//@} // Initialization and Registration
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// //
// D I S C O V E R Y //
// //
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
///@name Discovery
//@{
/** {\bf UpnpSearchAsync} searches for devices matching the given
* search target. The function returns immediately and the SDK
* calls the default callback function, registered during the
* {\bf UpnpRegisterClient} call, for each matching root device,
* device, or service. The application specifies the search type by the
* {\bf Target} parameter.
*
* Note that there is no way for the SDK to distinguish which client
* instance issued a particular search. Therefore, the client can get
* search callbacks that do not match the original criteria of the search.
* Also, the application will receive multiple callbacks for each search.
*
* @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_HANDLE}: The handle is not a valid control
* point handle.
* \item {\tt UPNP_E_INVALID_PARAM}: {\bf Target} is {\tt NULL}.
* \end{itemize} */
EXPORT_SPEC int UpnpSearchAsync(
IN UpnpClient_Handle Hnd, /** The handle of the client performing
the search. */
IN int Mx, /** The time, in seconds, to wait for
responses. If the time is greater
than {\tt MAX_SEARCH_TIME} then the time is
set to {\tt MAX_SEARCH_TIME}. If the time is
less than {\tt MIN_SEARCH_TIME} then the
time is set to {\tt MIN_SEARCH_TIME}. */
IN const char *Target, /** The search target as defined in the UPnP
Device Architecture v1.0 specification. */
IN const void *Cookie /** The user data to pass when the callback
function is invoked. */
);
/** {\bf UpnpSendAdvertisement} sends out the discovery announcements for
* all devices and services for a device. Each announcement is made with
* the same expiration time.
*
* {\bf UpnpSendAdvertisement} is a synchronous call.
*
* @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_HANDLE}: The handle is not a valid
* device handle.
* \item {\tt UPNP_E_OUTOF_MEMORY}: There are insufficient resources to
* send future advertisements.
* \end{itemize}
*/
EXPORT_SPEC int UpnpSendAdvertisement(
IN UpnpDevice_Handle Hnd, /** The device handle for which to send out the
announcements. */
IN int Exp /** The expiration age, in seconds, of
the announcements. */
);
//@} // Discovery
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// //
// C O N T R O L //
// //
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
///@name Control
//@{
/** {\bf UpnpGetServiceVarStatus} queries the state of a state
* variable of a service on another device. This is a synchronous call.
* A positive return value indicates a SOAP error code, whereas a negative
* return code indicates an SDK error code. {\bf Note that the use of this
* function is deprecated by the UPnP Forum}.
*
* @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_HANDLE}: The handle is not a valid control
* point handle.
* \item {\tt UPNP_E_INVALID_URL}: {\bf ActionUrl} is not a valid URL.
* \item {\tt UPNP_E_INVALID_DESC}: The XML document was not
* found or it does not contain a valid XML description.
* \item {\tt UPNP_E_INVALID_PARAM}: {\bf StVarVal} is not a valid
* pointer or {\bf VarName} or {\bf ActionUrl} is {\tt NULL}.
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
* complete this operation.
* \item {\tt UPNP_SOAP_E_INVALID_VAR}: The given variable is invalid
* according to the device.
* \end{itemize}
*/
EXPORT_SPEC int UpnpGetServiceVarStatus(
IN UpnpClient_Handle Hnd, /** The handle of the control point. */
IN const char *ActionURL, /** The URL of the service. */
IN const char *VarName, /** The name of the variable to query. */
OUT DOMString *StVarVal /** The pointer to store the value
for {\bf VarName}. The SDK
allocates this string and the caller
needs to free it using
{\bf ixmlFreeDOMString}. */
);
/** {\bf UpnpGetServiceVarStatusAsync} queries the state of a variable of a
* service, generating a callback when the operation is complete. {\bf Note
* that the use of this function is deprecated by the UPnP Forum}.
*
* @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_HANDLE}: The handle is not a valid control
* point handle.
* \item {\tt UPNP_E_INVALID_URL}: The {\bf ActionUrl} is not a valid URL.
* \item {\tt UPNP_E_INVALID_PARAM}: {\bf VarName}, {\bf Fun} or
* {\bf ActionUrl} is not a valid pointer.
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
* complete this operation.
* \end{itemize}
*/
EXPORT_SPEC int UpnpGetServiceVarStatusAsync(
IN UpnpClient_Handle Hnd, /** The handle of the control point. */
IN const char *ActionURL, /** The URL of the service. */
IN const char *VarName, /** The name of the variable to query. */
IN Upnp_FunPtr Fun, /** Pointer to a callback function to
be invoked when the operation is complete. */
IN const void *Cookie /** Pointer to user data to pass to the
callback function when invoked. */
);
/** {\bf UpnpSendAction} sends a message to change a state variable
* in a service. This is a synchronous call that does not return until the
* action is complete.
*
* Note that a positive return value indicates a SOAP-protocol error code.
* In this case, the error description can be retrieved from {\bf RespNode}.
* A negative return value indicates an SDK error.
*
* @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_HANDLE}: The handle is not a valid control
* point handle.
* \item {\tt UPNP_E_INVALID_URL}: {\bf ActionUrl} is not a valid URL.
* \item {\tt UPNP_E_INVALID_ACTION}: This action is not valid.
* \item {\tt UPNP_E_INVALID_DEVICE}: {\bf DevUDN} is not a
* valid device.
* \item {\tt UPNP_E_INVALID_PARAM}: {\bf ServiceType}, {\bf Action},
* {\bf ActionUrl}, or
* {\bf RespNode} is not a valid pointer.
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
* complete this operation.
* \end{itemize}
*/
EXPORT_SPEC int UpnpSendAction(
IN UpnpClient_Handle Hnd, /** The handle of the control point
sending the action. */
IN const char *ActionURL, /** The action URL of the service. */
IN const char *ServiceType, /** The type of the service. */
IN const char *DevUDN, /** This parameter is ignored and must be
{\tt NULL}. */
IN IXML_Document *Action, /** The DOM document for the action. */
OUT IXML_Document **RespNode /** The DOM document for the response
to the action. The SDK allocates
this document and the caller needs to free
it. */
);
/** {\bf UpnpSendActionEx} sends a message to change a state variable
* in a service. This is a synchronous call that does not return until the
* action is complete.
*
* Note that a positive return value indicates a SOAP-protocol error code.
* In this case, the error description can be retrieved from {\bf RespNode}.
* A negative return value indicates an SDK error.
*
* @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_HANDLE}: The handle is not a valid control
* point handle.
* \item {\tt UPNP_E_INVALID_URL}: {\bf ActionUrl} is not a valid URL.
* \item {\tt UPNP_E_INVALID_ACTION}: This action is not valid.
* \item {\tt UPNP_E_INVALID_DEVICE}: {\bf DevUDN} is not a
* valid device.
* \item {\tt UPNP_E_INVALID_PARAM}: {\bf ServiceType}, {\bf Action},
* {\bf ActionUrl}, or
* {\bf RespNode} is not a valid pointer.
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
* complete this operation.
* \end{itemize}
*/
EXPORT_SPEC int UpnpSendActionEx(
IN UpnpClient_Handle Hnd, /** The handle of the control point
sending the action. */
IN const char *ActionURL, /** The action URL of the service. */
IN const char *ServiceType, /** The type of the service. */
IN const char *DevUDN, /** This parameter is ignored and must be
{\tt NULL}. */
IN IXML_Document *Header, /** The DOM document for the SOAP header.
This may be {\tt NULL} if the header is
not required. */
IN IXML_Document *Action, /** The DOM document for the action. */
OUT IXML_Document **RespNode /** The DOM document for the response
to the action. The SDK allocates
this document and the caller needs to free
it. */
);
/** {\bf UpnpSendActionAsync} sends a message to change a state variable
* in a service, generating a callback when the operation is complete.
* See {\bf UpnpSendAction} for comments on positive return values. These
* positive return values are sent in the event struct associated with the
* {\tt UPNP_CONTROL_ACTION_COMPLETE} event.
*
* @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_HANDLE}: The handle is not a valid control
* point handle.
* \item {\tt UPNP_E_INVALID_URL}: {\bf ActionUrl} is an invalid URL.
* \item {\tt UPNP_E_INVALID_DEVICE}: {\bf DevUDN} is an invalid device.
* \item {\tt UPNP_E_INVALID_PARAM}: Either {\bf Fun} is not a valid
* callback function or {\bf ServiceType}, {\bf Act}, or
* {\bf ActionUrl} is {\tt NULL}.
* \item {\tt UPNP_E_INVALID_ACTION}: This action is not valid.
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
* complete this operation.
* \end{itemize}
*/
EXPORT_SPEC int UpnpSendActionAsync(
IN UpnpClient_Handle Hnd, /** The handle of the control point
sending the action. */
IN const char *ActionURL, /** The action URL of the service. */
IN const char *ServiceType, /** The type of the service. */
IN const char *DevUDN, /** This parameter is ignored and must be
{\tt NULL}. */
IN IXML_Document *Action, /** The DOM document for the action to
perform on this device. */
IN Upnp_FunPtr Fun, /** Pointer to a callback function to
be invoked when the operation
completes. */
IN const void *Cookie /** Pointer to user data that to be
passed to the callback when invoked. */
);
/** {\bf UpnpSendActionExAsync} sends a message to change a state variable
* in a service, generating a callback when the operation is complete.
* See {\bf UpnpSendAction} for comments on positive return values. These
* positive return values are sent in the event struct associated with the
* {\tt UPNP_CONTROL_ACTION_COMPLETE} event.
*
* @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_HANDLE}: The handle is not a valid control
* point handle.
* \item {\tt UPNP_E_INVALID_URL}: {\bf ActionUrl} is an invalid URL.
* \item {\tt UPNP_E_INVALID_DEVICE}: {\bf DevUDN} is an invalid device.
* \item {\tt UPNP_E_INVALID_PARAM}: Either {\bf Fun} is not a valid
* callback function or {\bf ServiceType}, {\bf Act}, or
* {\bf ActionUrl} is {\tt NULL}.
* \item {\tt UPNP_E_INVALID_ACTION}: This action is not valid.
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
* complete this operation.
* \end{itemize}
*/
EXPORT_SPEC int UpnpSendActionExAsync(
IN UpnpClient_Handle Hnd, /** The handle of the control point
sending the action. */
IN const char *ActionURL, /** The action URL of the service
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -