libUPnP
1.6.20
|
#include "config.h"
#include "httpparser.h"
#include "httpreadwrite.h"
#include "parsetools.h"
#include "soaplib.h"
#include "ssdplib.h"
#include "statcodes.h"
#include "unixutil.h"
#include "upnpapi.h"
#include <assert.h>
#include <string.h>
Data Structures | |
struct | soap_devserv_t |
Macros | |
#define | SOAP_TIMEOUT UPNP_TIMEOUT |
#define | SREQ_HDR_NOT_FOUND -1 |
#define | SREQ_BAD_HDR_FORMAT -2 |
#define | SREQ_NOT_EXTENDED -3 |
#define | SOAP_INVALID_ACTION 401 |
#define | SOAP_INVALID_ARGS 402 |
#define | SOAP_OUT_OF_SYNC 403 |
#define | SOAP_INVALID_VAR 404 |
#define | SOAP_ACTION_FAILED 501 |
#define | SOAP_MEMORY_OUT 603 |
Typedefs | |
typedef struct soap_devserv_t | soap_devserv_t |
Functions | |
static void | send_error_response (IN SOCKINFO *info, IN int error_code, IN const char *err_msg, IN http_message_t *hmsg) |
Sends SOAP error response. More... | |
static UPNP_INLINE void | send_var_query_response (SOCKINFO *info, const char *var_value, http_message_t *hmsg) |
Sends response of get var status. More... | |
static UPNP_INLINE void | send_action_response (SOCKINFO *info, IXML_Document *action_resp, http_message_t *request) |
Sends the SOAP action response. More... | |
static UPNP_INLINE void | handle_query_variable (SOCKINFO *info, http_message_t *request, soap_devserv_t *soap_info, IXML_Node *req_node) |
Handles the SOAP requests to querry the state variables. This functionality has been deprecated in the UPnP V1.0 architecture. More... | |
static void | handle_invoke_action (SOCKINFO *info, http_message_t *request, soap_devserv_t *soap_info, IXML_Node *req_node) |
Handles the SOAP action request. More... | |
static int | get_dev_service (http_message_t *request, int AddressFamily, soap_devserv_t *soap_info) |
Retrieve SOAP device/service information associated with request-URI, which includes the callback function to hand-over the request to the device application. More... | |
static int | get_mpost_acton_hdrval (http_message_t *request, memptr *val) |
Get the SOAPACTION header value for M-POST request. More... | |
static int | check_soapaction_hdr (http_message_t *request, soap_devserv_t *soap_info) |
Check the header validity, and get the action name and the version of the service that the CP wants to use. More... | |
static int | check_soap_request (soap_devserv_t *soap_info, IN IXML_Document *xml_doc, IXML_Node **req_node) |
Check validity of the SOAP request per UPnP specification. More... | |
void | soap_device_callback (http_parser_t *parser, http_message_t *request, SOCKINFO *info) |
This is a callback called by minisever after receiving the request from the control point. After HTTP processing, it calls handle_soap_request to start SOAP processing. More... | |
#define SOAP_TIMEOUT UPNP_TIMEOUT |
timeout duration in secs for transmission/reception
Referenced by send_action_response(), and send_var_query_response().
|
static |
Check validity of the SOAP request per UPnP specification.
[in] | soap_info | SOAP device/service information. |
[in] | xml_doc | Document containing the SOAP action request. |
[out] | req_node | Node containing the SOAP action request/variable name. |
|
static |
Check the header validity, and get the action name and the version of the service that the CP wants to use.
[in] | request | HTTP request. |
[in,out] | soap_info | SOAP device/service information. |
Referenced by soap_device_callback().
|
static |
Retrieve SOAP device/service information associated with request-URI, which includes the callback function to hand-over the request to the device application.
[in] | request | HTTP request. |
[in] | AddressFamily | Address family: AF_INET or AF_INET6. |
[out] | soap_info | SOAP device/service information. |
References http_message_t::uri.
Referenced by soap_device_callback().
|
static |
Get the SOAPACTION header value for M-POST request.
[in] | request | HTTP request. |
[out] | val | Buffer to get the header value |
|
static |
Handles the SOAP action request.
[in] | info | Socket info. |
[in] | request | HTTP Request. |
[in] | soap_info | SOAP device/service information. |
[in] | req_node | Node containing the SOAP action request. |
References Upnp_Action_Request::ActionResult, memptr::buf, DOMString, ixmlPrintNode(), and memptr::length.
|
static |
Handles the SOAP requests to querry the state variables. This functionality has been deprecated in the UPnP V1.0 architecture.
[in] | info | Socket info. |
[in] | request | HTTP Request. |
[in] | soap_info | SOAP device/service information. |
[in] | req_node | Node containing variable name. |
References Upnp_State_Var_Request::CtrlPtIPAddr, Upnp_State_Var_Request::CurrentVal, Upnp_State_Var_Request::DevUDN, DOMString, Upnp_State_Var_Request::ErrCode, Upnp_State_Var_Request::ErrStr, SOCKINFO::foreign_sockaddr, ixmlNode_getNodeValue(), linecopy(), namecopy(), Upnp_State_Var_Request::ServiceID, Upnp_State_Var_Request::StateVarName, UPNP_CONTROL_GET_VAR_REQUEST, UPNP_E_SUCCESS, and UpnpPrintf().
|
static |
Sends the SOAP action response.
[in] | info | Socket info. |
[in] | action_resp | The response document. |
[in] | request | Action request document. |
References SOAP_TIMEOUT.
|
static |
Sends SOAP error response.
[in] | info | Socket info. |
[in] | error_code | Error code. |
[in] | err_msg | Error message. |
[in] | hmsg | HTTP request. |
|
static |
Sends response of get var status.
[in] | info | Socket info. |
[in] | var_value | Value of the state variable. |
[in] | hmsg | HTTP request. |
References SOAP_TIMEOUT.
void soap_device_callback | ( | http_parser_t * | parser, |
http_message_t * | request, | ||
SOCKINFO * | info | ||
) |
This is a callback called by minisever after receiving the request from the control point. After HTTP processing, it calls handle_soap_request to start SOAP processing.
This is a callback called by minisever after receiving the request from the control point. This function will start processing the request. It calls handle_invoke_action to handle the SOAP action.
[in] | parser | Parsed request received by the device. |
[in] | request | HTTP request. |
[in,out] | info | Socket info. |
References check_soapaction_hdr(), SOCKINFO::foreign_sockaddr, get_dev_service(), has_xml_content_type(), and UPNP_E_SUCCESS.