Template object for StateVarRequest.
This commit is contained in:
parent
942e0ec809
commit
c90d6492e8
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef STATEVARREQUEST_H
|
#ifndef STATEVARREQUEST_H
|
||||||
#define STATEVARREQUEST_H
|
#define STATEVARREQUEST_H
|
||||||
|
|
||||||
@ -9,82 +8,27 @@
|
|||||||
*
|
*
|
||||||
* \brief UpnpStateVarRequest object declararion.
|
* \brief UpnpStateVarRequest object declararion.
|
||||||
*
|
*
|
||||||
|
* Represents the request for current value of a state variable in a service
|
||||||
|
* state table.
|
||||||
|
*
|
||||||
* \author Marcelo Roberto Jimenez
|
* \author Marcelo Roberto Jimenez
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "UpnpInet.h" /* for struct sockaddr_storage */
|
||||||
|
|
||||||
/*! Represents the request for current value of a state variable in a service
|
#define CLASS UpnpStateVarRequest
|
||||||
* state table. */
|
|
||||||
typedef struct s_UpnpStateVarRequest UpnpStateVarRequest;
|
|
||||||
|
|
||||||
|
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||||
|
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
|
||||||
|
EXPAND_CLASS_MEMBER_INT(CLASS, Socket, int) \
|
||||||
|
EXPAND_CLASS_MEMBER_STRING(CLASS, ErrStr) \
|
||||||
|
EXPAND_CLASS_MEMBER_STRING(CLASS, DevUDN) \
|
||||||
|
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceID) \
|
||||||
|
EXPAND_CLASS_MEMBER_STRING(CLASS, StateVarName) \
|
||||||
|
EXPAND_CLASS_MEMBER_BUFFER(CLASS, CtrlPtIPAddr, struct sockaddr_storage) \
|
||||||
|
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, CurrentVal) \
|
||||||
|
|
||||||
#include "ixml.h" /* for DOMString */
|
#include "TemplateInclude.h"
|
||||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
|
||||||
#include "UpnpInet.h" /* for sockaddr, sockaddr_storage */
|
|
||||||
#include "UpnpString.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
/*! Constructor */
|
|
||||||
EXPORT_SPEC UpnpStateVarRequest *UpnpStateVarRequest_new();
|
|
||||||
|
|
||||||
/*! Destructor */
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_delete(UpnpStateVarRequest *p);
|
|
||||||
|
|
||||||
/*! Copy Constructor */
|
|
||||||
EXPORT_SPEC UpnpStateVarRequest *UpnpStateVarRequest_dup(const UpnpStateVarRequest *p);
|
|
||||||
|
|
||||||
/*! Assignment operator */
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_assign(UpnpStateVarRequest *p, const UpnpStateVarRequest *q);
|
|
||||||
|
|
||||||
/*! The result of the operation */
|
|
||||||
EXPORT_SPEC int UpnpStateVarRequest_get_ErrCode(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_set_ErrCode(UpnpStateVarRequest *p, int n);
|
|
||||||
|
|
||||||
/*! The socket number of the connection to the requestor */
|
|
||||||
EXPORT_SPEC int UpnpStateVarRequest_get_Socket(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_set_Socket(UpnpStateVarRequest *p, int n);
|
|
||||||
|
|
||||||
/*! The error string in case of error */
|
|
||||||
EXPORT_SPEC const UpnpString *UpnpStateVarRequest_get_ErrStr(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_ErrStr_cstr(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_set_ErrStr(UpnpStateVarRequest *p, const UpnpString *s);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_strcpy_ErrStr(UpnpStateVarRequest *p, const char *s);
|
|
||||||
|
|
||||||
/*! The unique device ID */
|
|
||||||
EXPORT_SPEC const UpnpString *UpnpStateVarRequest_get_DevUDN(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_DevUDN_cstr(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_set_DevUDN(UpnpStateVarRequest *p, const UpnpString *s);
|
|
||||||
|
|
||||||
/*! The service ID */
|
|
||||||
EXPORT_SPEC const UpnpString *UpnpStateVarRequest_get_ServiceID(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_ServiceID_cstr(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_set_ServiceID(UpnpStateVarRequest *p, const UpnpString *s);
|
|
||||||
|
|
||||||
/*! The name of the variable. */
|
|
||||||
EXPORT_SPEC const UpnpString *UpnpStateVarRequest_get_StateVarName(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_StateVarName_cstr(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_set_StateVarName(UpnpStateVarRequest *p, const UpnpString *s);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_strcpy_StateVarName(UpnpStateVarRequest *p, const char *s);
|
|
||||||
|
|
||||||
/*! IP address of sender requesting the state variable. */
|
|
||||||
EXPORT_SPEC const struct sockaddr *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, const struct sockaddr *sa);
|
|
||||||
|
|
||||||
/*! The current value of the variable. This needs to be allocated by
|
|
||||||
* the caller. When finished with it, the SDK frees this \b DOMString. */
|
|
||||||
EXPORT_SPEC const DOMString UpnpStateVarRequest_get_CurrentVal(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_CurrentVal_cstr(const UpnpStateVarRequest *p);
|
|
||||||
EXPORT_SPEC void UpnpStateVarRequest_set_CurrentVal(UpnpStateVarRequest *p, const DOMString s);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* STATEVARREQUEST_H */
|
#endif /* STATEVARREQUEST_H */
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \file
|
* \file
|
||||||
*
|
*
|
||||||
@ -8,247 +7,8 @@
|
|||||||
* \author Marcelo Roberto Jimenez
|
* \author Marcelo Roberto Jimenez
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#define TEMPLATE_GENERATE_SOURCE
|
||||||
#include "StateVarRequest.h"
|
#include "StateVarRequest.h"
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h> /* for calloc(), free() */
|
|
||||||
#include <string.h> /* for memset(), strlen(), strdup() */
|
|
||||||
|
|
||||||
|
|
||||||
struct SUpnpStateVarRequest
|
|
||||||
{
|
|
||||||
int m_errCode;
|
|
||||||
int m_socket;
|
|
||||||
UpnpString *m_errStr;
|
|
||||||
UpnpString *m_devUDN;
|
|
||||||
UpnpString *m_serviceID;
|
|
||||||
UpnpString *m_stateVarName;
|
|
||||||
/* Variables should be declared with struct sockaddr_storage,
|
|
||||||
* but users must only see a struct sockaddr pointer */
|
|
||||||
struct sockaddr_storage m_ctrlPtIPAddr;
|
|
||||||
DOMString m_currentVal;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
UpnpStateVarRequest *UpnpStateVarRequest_new()
|
|
||||||
{
|
|
||||||
struct SUpnpStateVarRequest *p = calloc(1, sizeof (struct SUpnpStateVarRequest));
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
p->m_errCode = 0;
|
|
||||||
p->m_socket = 0;
|
|
||||||
#endif
|
|
||||||
p->m_errStr = UpnpString_new();
|
|
||||||
p->m_devUDN = UpnpString_new();
|
|
||||||
p->m_serviceID = UpnpString_new();
|
|
||||||
p->m_stateVarName = UpnpString_new();
|
|
||||||
#if 0
|
|
||||||
memset(&q->m_ctrlPtIPAddr, 0, sizeof (struct sockaddr_storage));
|
|
||||||
p->m_currentVal = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (UpnpStateVarRequest *)p;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_delete(UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
struct SUpnpStateVarRequest *q = (struct SUpnpStateVarRequest *)p;
|
|
||||||
|
|
||||||
if (!q) return;
|
|
||||||
|
|
||||||
q->m_errCode = 0;
|
|
||||||
|
|
||||||
q->m_socket = 0;
|
|
||||||
|
|
||||||
UpnpString_delete(q->m_errStr);
|
|
||||||
q->m_errStr = NULL;
|
|
||||||
|
|
||||||
UpnpString_delete(q->m_devUDN);
|
|
||||||
q->m_devUDN = NULL;
|
|
||||||
|
|
||||||
UpnpString_delete(q->m_serviceID);
|
|
||||||
q->m_serviceID = NULL;
|
|
||||||
|
|
||||||
UpnpString_delete(q->m_stateVarName);
|
|
||||||
q->m_stateVarName = NULL;
|
|
||||||
|
|
||||||
memset(&q->m_ctrlPtIPAddr, 0, sizeof (struct sockaddr_storage));
|
|
||||||
|
|
||||||
ixmlFreeDOMString(q->m_currentVal);
|
|
||||||
q->m_currentVal = NULL;
|
|
||||||
|
|
||||||
free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
UpnpStateVarRequest *UpnpStateVarRequest_dup(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
UpnpStateVarRequest *q = UpnpStateVarRequest_new();
|
|
||||||
|
|
||||||
UpnpStateVarRequest_assign(q, p);
|
|
||||||
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_assign(UpnpStateVarRequest *p, const UpnpStateVarRequest *q)
|
|
||||||
{
|
|
||||||
if (p != q) {
|
|
||||||
UpnpStateVarRequest_set_ErrCode(p, UpnpStateVarRequest_get_ErrCode(q));
|
|
||||||
UpnpStateVarRequest_set_Socket(p, UpnpStateVarRequest_get_Socket(q));
|
|
||||||
UpnpStateVarRequest_set_ErrStr(p, UpnpStateVarRequest_get_ErrStr(q));
|
|
||||||
UpnpStateVarRequest_set_StateVarName(p, UpnpStateVarRequest_get_StateVarName(q));
|
|
||||||
UpnpStateVarRequest_set_DevUDN(p, UpnpStateVarRequest_get_DevUDN(q));
|
|
||||||
UpnpStateVarRequest_set_ServiceID(p, UpnpStateVarRequest_get_ServiceID(q));
|
|
||||||
UpnpStateVarRequest_set_CtrlPtIPAddr(p, UpnpStateVarRequest_get_CtrlPtIPAddr(q));
|
|
||||||
UpnpStateVarRequest_set_CurrentVal(p, UpnpStateVarRequest_get_CurrentVal(q));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int UpnpStateVarRequest_get_ErrCode(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpStateVarRequest *)p)->m_errCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_set_ErrCode(UpnpStateVarRequest *p, int n)
|
|
||||||
{
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_errCode = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int UpnpStateVarRequest_get_Socket(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpStateVarRequest *)p)->m_socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_set_Socket(UpnpStateVarRequest *p, int n)
|
|
||||||
{
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_socket = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpStateVarRequest_get_ErrStr(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpStateVarRequest *)p)->m_errStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpStateVarRequest_get_ErrStr_cstr(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpStateVarRequest_get_ErrStr(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_set_ErrStr(UpnpStateVarRequest *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_errStr);
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_errStr = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_strcpy_ErrStr(UpnpStateVarRequest *p, const char *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_errStr);
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_errStr = UpnpString_new();
|
|
||||||
UpnpString_set_String(((struct SUpnpStateVarRequest *)p)->m_errStr, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpStateVarRequest_get_DevUDN(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpStateVarRequest *)p)->m_devUDN;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpStateVarRequest_get_DevUDN_cstr(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpStateVarRequest_get_DevUDN(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_set_DevUDN(UpnpStateVarRequest *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_devUDN);
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_devUDN = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpStateVarRequest_get_ServiceID(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpStateVarRequest *)p)->m_serviceID;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpStateVarRequest_get_ServiceID_cstr(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpStateVarRequest_get_ServiceID(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_set_ServiceID(UpnpStateVarRequest *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_serviceID);
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_serviceID = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpStateVarRequest_get_StateVarName(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpStateVarRequest *)p)->m_stateVarName;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpStateVarRequest_get_StateVarName_cstr(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_set_StateVarName(UpnpStateVarRequest *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_stateVarName);
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_stateVarName = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_strcpy_StateVarName(UpnpStateVarRequest *p, const char *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_errStr);
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_errStr = UpnpString_new();
|
|
||||||
UpnpString_set_String(((struct SUpnpStateVarRequest *)p)->m_errStr, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const struct sockaddr *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return (struct sockaddr *)&((struct SUpnpStateVarRequest *)p)->m_ctrlPtIPAddr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, const struct sockaddr *sa)
|
|
||||||
{
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_ctrlPtIPAddr = *(struct sockaddr_storage *)sa;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const DOMString UpnpStateVarRequest_get_CurrentVal(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return ((struct SUpnpStateVarRequest *)p)->m_currentVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpStateVarRequest_get_CurrentVal_cstr(const UpnpStateVarRequest *p)
|
|
||||||
{
|
|
||||||
return (const char *)UpnpStateVarRequest_get_CurrentVal(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpStateVarRequest_set_CurrentVal(UpnpStateVarRequest *p, const DOMString s)
|
|
||||||
{
|
|
||||||
ixmlFreeDOMString(((struct SUpnpStateVarRequest *)p)->m_currentVal);
|
|
||||||
((struct SUpnpStateVarRequest *)p)->m_currentVal = ixmlCloneDOMString(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -859,67 +859,67 @@ error_handler:
|
|||||||
static UPNP_INLINE void handle_query_variable(
|
static UPNP_INLINE void handle_query_variable(
|
||||||
IN SOCKINFO *info,
|
IN SOCKINFO *info,
|
||||||
IN http_message_t *request,
|
IN http_message_t *request,
|
||||||
IN IXML_Document *xml_doc )
|
IN IXML_Document *xml_doc)
|
||||||
{
|
{
|
||||||
UpnpStateVarRequest *variable = UpnpStateVarRequest_new();
|
UpnpStateVarRequest *variable = UpnpStateVarRequest_new();
|
||||||
Upnp_FunPtr soap_event_callback;
|
Upnp_FunPtr soap_event_callback;
|
||||||
void *cookie;
|
void *cookie;
|
||||||
char var_name[LINE_SIZE];
|
char var_name[LINE_SIZE];
|
||||||
const char *err_str;
|
const char *err_str;
|
||||||
int err_code;
|
int err_code;
|
||||||
|
|
||||||
// get var name
|
if (get_var_name(xml_doc, var_name) != 0) {
|
||||||
if( get_var_name( xml_doc, var_name ) != 0 ) {
|
send_error_response(info, SOAP_INVALID_VAR, Soap_Invalid_Var, request);
|
||||||
send_error_response( info, SOAP_INVALID_VAR,
|
|
||||||
Soap_Invalid_Var, request );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// get info for event
|
|
||||||
err_code = get_device_info(
|
|
||||||
request, 1, xml_doc,
|
|
||||||
info->foreign_sockaddr.ss_family,
|
|
||||||
(UpnpString *)UpnpStateVarRequest_get_DevUDN(variable),
|
|
||||||
(UpnpString *)UpnpStateVarRequest_get_ServiceID(variable),
|
|
||||||
&soap_event_callback,
|
|
||||||
&cookie);
|
|
||||||
if( err_code != 0 ) {
|
|
||||||
send_error_response( info, SOAP_INVALID_VAR,
|
|
||||||
Soap_Invalid_Var, request );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpnpStateVarRequest_set_ErrCode(variable, UPNP_E_SUCCESS);
|
return;
|
||||||
UpnpStateVarRequest_strcpy_StateVarName(variable, var_name);
|
}
|
||||||
UpnpStateVarRequest_set_CtrlPtIPAddr(variable, (struct sockaddr *)&info->foreign_sockaddr);
|
/* get info for event */
|
||||||
|
err_code = get_device_info(
|
||||||
|
request, 1, xml_doc,
|
||||||
|
info->foreign_sockaddr.ss_family,
|
||||||
|
(UpnpString *)UpnpStateVarRequest_get_DevUDN(variable),
|
||||||
|
(UpnpString *)UpnpStateVarRequest_get_ServiceID(variable),
|
||||||
|
&soap_event_callback,
|
||||||
|
&cookie);
|
||||||
|
if (err_code != 0) {
|
||||||
|
send_error_response(info, SOAP_INVALID_VAR, Soap_Invalid_Var, request);
|
||||||
|
|
||||||
// send event
|
return;
|
||||||
soap_event_callback( UPNP_CONTROL_GET_VAR_REQUEST, variable, cookie );
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
UpnpStateVarRequest_set_ErrCode(variable, UPNP_E_SUCCESS);
|
||||||
"Return from callback for var request\n" );
|
UpnpStateVarRequest_strcpy_StateVarName(variable, var_name);
|
||||||
|
UpnpStateVarRequest_set_CtrlPtIPAddr(variable, &info->foreign_sockaddr);
|
||||||
|
|
||||||
// validate, and handle result
|
/* send event */
|
||||||
if( UpnpStateVarRequest_get_CurrentVal(variable) == NULL ) {
|
soap_event_callback(UPNP_CONTROL_GET_VAR_REQUEST, variable, cookie);
|
||||||
err_code = SOAP_ACTION_FAILED;
|
|
||||||
err_str = Soap_Action_Failed;
|
|
||||||
send_error_response( info, SOAP_INVALID_VAR, Soap_Invalid_Var, request );
|
|
||||||
|
|
||||||
return;
|
UpnpPrintf(UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
}
|
"Return from callback for var request\n");
|
||||||
if( UpnpStateVarRequest_get_ErrCode(variable) != UPNP_E_SUCCESS ) {
|
|
||||||
if( UpnpString_get_Length(UpnpStateVarRequest_get_ErrStr(variable)) > 0 ) {
|
/* validate, and handle result */
|
||||||
err_code = SOAP_INVALID_VAR;
|
if (UpnpStateVarRequest_get_CurrentVal(variable) == NULL) {
|
||||||
err_str = Soap_Invalid_Var;
|
err_code = SOAP_ACTION_FAILED;
|
||||||
} else {
|
err_str = Soap_Action_Failed;
|
||||||
err_code = UpnpStateVarRequest_get_ErrCode(variable);
|
send_error_response(info, SOAP_INVALID_VAR, Soap_Invalid_Var, request);
|
||||||
err_str = UpnpStateVarRequest_get_ErrStr_cstr(variable);
|
|
||||||
}
|
return;
|
||||||
send_error_response( info, err_code, err_str, request );
|
}
|
||||||
return;
|
if (UpnpStateVarRequest_get_ErrCode(variable) != UPNP_E_SUCCESS) {
|
||||||
}
|
if (UpnpString_get_Length(UpnpStateVarRequest_get_ErrStr(variable)) > 0) {
|
||||||
// send response
|
err_code = SOAP_INVALID_VAR;
|
||||||
send_var_query_response( info, UpnpStateVarRequest_get_CurrentVal(variable), request );
|
err_str = Soap_Invalid_Var;
|
||||||
UpnpStateVarRequest_delete(variable);
|
} else {
|
||||||
|
err_code = UpnpStateVarRequest_get_ErrCode(variable);
|
||||||
|
err_str = UpnpStateVarRequest_get_ErrStr_cstr(variable);
|
||||||
|
}
|
||||||
|
send_error_response(info, err_code, err_str, request);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* send response */
|
||||||
|
send_var_query_response(info, UpnpStateVarRequest_get_CurrentVal(variable), request);
|
||||||
|
UpnpStateVarRequest_delete(variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user