UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
soap_ctrlpt.cpp File Reference

Items for control points to manage UPnP Control. More...

#include <soap_common.hpp>
#include <soap_ctrlpt.hpp>
#include <httpreadwrite.hpp>
#include <parsetools.hpp>
#include <statcodes.hpp>
#include <upnpapi.hpp>
+ Include dependency graph for soap_ctrlpt.cpp:

Go to the source code of this file.

Functions

int SoapSendAction (char *action_url, char *service_type, IXML_Document *action_node, IXML_Document **response_node)
 This function is called by UPnP API to send the SOAP action request.
 
int SoapSendActionEx (char *action_url, char *service_type, IXML_Document *header, IXML_Document *action_node, IXML_Document **response_node)
 This extended function is called by UPnP API to send the SOAP action request.
 
int SoapGetServiceVarStatus (char *action_url, DOMString var_name, DOMString *var_value)
 This function creates a status variable query message send it to the specified URL. It also collect the response.
 
Functions scope restricted to file
int anonymous_namespace{soap_ctrlpt.cpp}::dom_cmp_name (const char *name, IXML_Node *node)
 Compares 'name' and node's name.
 
int anonymous_namespace{soap_ctrlpt.cpp}::dom_find_node (const char *node_name, IXML_Node *start_node, IXML_Node **matching_node)
 Goes thru each child of 'start_node' looking for a node having the name 'node_name'.
 
int anonymous_namespace{soap_ctrlpt.cpp}::dom_find_deep_node (const char *names[], int num_names, IXML_Node *start_node, IXML_Node **matching_node)
 Searches for the node specifed by the last name in the 'name' array.
 
const DOMString anonymous_namespace{soap_ctrlpt.cpp}::get_node_value (IXML_Node *node)
 This function returns the value of the text node.
 
int anonymous_namespace{soap_ctrlpt.cpp}::get_host_and_path (char *ctrl_url, const memptr *host, const memptr *path, uri_type *url)
 This function retrives the host and path from the control URL.
 
int anonymous_namespace{soap_ctrlpt.cpp}::get_action_name (char *action, memptr *name)
 This function retrives the action name in the buffer.
 
int anonymous_namespace{soap_ctrlpt.cpp}::add_man_header (membuffer *headers)
 Adds "MAN" field in the HTTP header.
 
int anonymous_namespace{soap_ctrlpt.cpp}::soap_request_and_response (membuffer *request, uri_type *destination_url, http_parser_t *response)
 This function sends the control point's request to the device and receives a response from it.
 
int anonymous_namespace{soap_ctrlpt.cpp}::get_response_value (http_message_t *hmsg, int code, char *name, int *upnp_error_code, IXML_Node **action_value, DOMString *str_value)
 This function handles the response coming back from the device.
 

Variables

Variable scope restricted to file
constexpr int anonymous_namespace{soap_ctrlpt.cpp}::SOAP_ACTION_RESP {1}
 Control point SOAP status.
 
constexpr int anonymous_namespace{soap_ctrlpt.cpp}::SOAP_VAR_RESP {2}
 Control point SOAP status.
 
constexpr int anonymous_namespace{soap_ctrlpt.cpp}::SOAP_ACTION_RESP_ERROR {3}
 Control point SOAP status.
 
constexpr int anonymous_namespace{soap_ctrlpt.cpp}::SOAP_VAR_RESP_ERROR {4}
 Control point SOAP status.
 

Detailed Description

Items for control points to manage UPnP Control.

This is only available if the option for Clients and the option for SOAP is enabled with compiling the library.

Definition in file soap_ctrlpt.cpp.

Function Documentation

◆ SoapSendAction()

int SoapSendAction ( char *  action_url,
char *  service_type,
IXML_Document action_node,
IXML_Document **  response_node 
)

This function is called by UPnP API to send the SOAP action request.

It waits till it gets the response from the device pass the response to the API layer.

Returns
On success: UPNP_E_SUCCESS
On error:
  • UPNP_E_OUTOF_MEMORY
  • UPNP_E_INVALID_ACTION
  • UPNP_E_INVALID_URL
  • UPNP_E_SOCKET_ERROR
  • UPNP_E_SOCKET_CONNECT
  • UPNP_E_FILE_READ_ERROR
  • UPNP_E_TIMEDOUT
  • UPNP_E_SOCKET_WRITE
  • UPNP_E_BAD_HTTPMSG
  • may have additional error codes
Parameters
[in]action_urldevice contrl URL.
[in]service_typedevice service type.
[in]action_nodeSOAP action node.
[out]response_nodeSOAP response node.

Definition at line 490 of file soap_ctrlpt.cpp.

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

◆ SoapSendActionEx()

int SoapSendActionEx ( char *  action_url,
char *  service_type,
IXML_Document header,
IXML_Document action_node,
IXML_Document **  response_node 
)

This extended function is called by UPnP API to send the SOAP action request.

The function waits till it gets the response from the device pass the response to the API layer. This action is similar to the SoapSendAction() with only difference that it allows users to pass the SOAP header along the SOAP body (soap action request).

Returns
On success: UPNP_E_SUCCESS
On error:
  • UPNP_E_BAD_RESPONSE
  • UPNP_E_OUTOF_MEMORY
  • UPNP_E_INVALID_ACTION
  • UPNP_E_INVALID_URL
  • UPNP_E_SOCKET_ERROR
  • UPNP_E_SOCKET_CONNECT
  • UPNP_E_FILE_READ_ERROR
  • UPNP_E_TIMEDOUT
  • UPNP_E_SOCKET_WRITE
  • UPNP_E_BAD_HTTPMSG
  • SOAP_ACTION_RESP
  • SOAP_VAR_RESP
  • SOAP_VAR_RESP_ERROR
  • SOAP_ACTION_RESP_ERROR
  • HTTP error codes >400
Parameters
[in]action_urldevice contrl URL.
[in]service_typedevice service type.
[in]headerSoap header.
[in]action_nodeSOAP action node (SOAP body).
[out]response_nodeSOAP response node.

Definition at line 605 of file soap_ctrlpt.cpp.

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

◆ SoapGetServiceVarStatus()

int SoapGetServiceVarStatus ( char *  action_url,
DOMString  var_name,
DOMString var_value 
)

This function creates a status variable query message send it to the specified URL. It also collect the response.

Returns
On success: UPNP_E_SUCCESS
On error:
  • UPNP_E_SOCKET_ERROR
  • UPNP_E_SOCKET_CONNECT
  • UPNP_E_OUTOF_MEMORY
  • UPNP_E_FILE_READ_ERROR
  • UPNP_E_TIMEDOUT
  • UPNP_E_SOCKET_WRITE
  • UPNP_E_BAD_HTTPMSG
  • UPNP_E_BAD_RESPONSE
  • SOAP_ACTION_RESP
  • SOAP_VAR_RESP
  • SOAP_VAR_RESP_ERROR
  • SOAP_ACTION_RESP_ERROR
  • HTTP error codes >400
Todo:
Returned error message IDs are ambiguous. Fix it.
Todo:
Verify the bug in the source code of this function with a unit test.
Parameters
[in]action_urlAddress to send this variable query message.
[in]var_nameName of the variable.
[out]var_valueOutput value.

Definition at line 748 of file soap_ctrlpt.cpp.

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