Some fixes on the use of struct sockaddr_storage and struct sockaddr.
This patch does not change any behaviour. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@385 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
35db3e9bba
commit
2e85c471ca
@ -20,7 +20,7 @@ typedef struct s_UpnpActionRequest UpnpActionRequest;
|
||||
#ifdef WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <netinet/in.h> /* for sockaddr_storage */
|
||||
#include <netinet/in.h> /* for sockaddr, sockaddr_storage */
|
||||
#endif
|
||||
|
||||
|
||||
@ -70,14 +70,14 @@ void UpnpActionRequest_set_ActionRequest(UpnpActionRequest *p, IXML_Document *d)
|
||||
IXML_Document *UpnpActionRequest_get_ActionResult(const UpnpActionRequest *p);
|
||||
void UpnpActionRequest_set_ActionResult(UpnpActionRequest *p, IXML_Document *d);
|
||||
|
||||
/** IP address of the control point requesting this action */
|
||||
struct sockaddr_storage *UpnpActionRequest_get_CtrlPtIPAddr(const UpnpActionRequest *p);
|
||||
void UpnpActionRequest_set_CtrlPtIPAddr(UpnpActionRequest *p, struct sockaddr_storage *ia);
|
||||
|
||||
/** The DOM document containing the information from the SOAP header */
|
||||
IXML_Document *UpnpActionRequest_get_SoapHeader(const UpnpActionRequest *p);
|
||||
void UpnpActionRequest_set_SoapHeader(UpnpActionRequest *p, IXML_Document *d);
|
||||
|
||||
/** IP address of the control point requesting this action */
|
||||
struct sockaddr *UpnpActionRequest_get_CtrlPtIPAddr(const UpnpActionRequest *p);
|
||||
void UpnpActionRequest_set_CtrlPtIPAddr(UpnpActionRequest *p, struct sockaddr *sa);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ typedef struct s_UpnpDiscovery UpnpDiscovery;
|
||||
#ifdef WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <netinet/in.h> /* for sockaddr_storage */
|
||||
#include <netinet/in.h> /* for sockaddr, sockaddr_storage */
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ typedef struct s_UpnpStateVarRequest UpnpStateVarRequest;
|
||||
#ifdef WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <netinet/in.h> /* for sockaddr_storage */
|
||||
#include <netinet/in.h> /* for sockaddr, sockaddr_storage */
|
||||
#endif
|
||||
|
||||
|
||||
@ -66,8 +66,8 @@ void UpnpStateVarRequest_set_StateVarName(UpnpStateVarRequest *p, const UpnpStri
|
||||
void UpnpStateVarRequest_strcpy_StateVarName(UpnpStateVarRequest *p, const char *s);
|
||||
|
||||
/** IP address of sender requesting the state variable. */
|
||||
struct sockaddr_storage *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p);
|
||||
void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, struct sockaddr_storage *ia);
|
||||
struct sockaddr *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p);
|
||||
void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, 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 {\bf DOMString}. */
|
||||
|
@ -21,6 +21,8 @@ struct SUpnpActionRequest
|
||||
IXML_Document *m_actionRequest;
|
||||
IXML_Document *m_actionResult;
|
||||
IXML_Document *m_soapHeader;
|
||||
/* Variables should be declared with struct sockaddr_storage,
|
||||
* but users must only see a struct sockaddr pointer */
|
||||
struct sockaddr_storage m_ctrlPtIPAddr;
|
||||
};
|
||||
|
||||
@ -224,15 +226,15 @@ void UpnpActionRequest_set_ActionResult(UpnpActionRequest *p, IXML_Document *d)
|
||||
}
|
||||
|
||||
|
||||
struct sockaddr_storage *UpnpActionRequest_get_CtrlPtIPAddr(const UpnpActionRequest *p)
|
||||
struct sockaddr *UpnpActionRequest_get_CtrlPtIPAddr(const UpnpActionRequest *p)
|
||||
{
|
||||
return &((struct SUpnpActionRequest *)p)->m_ctrlPtIPAddr;
|
||||
return (struct sockaddr *)&((struct SUpnpActionRequest *)p)->m_ctrlPtIPAddr;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_CtrlPtIPAddr(UpnpActionRequest *p, struct sockaddr_storage *ia)
|
||||
void UpnpActionRequest_set_CtrlPtIPAddr(UpnpActionRequest *p, struct sockaddr *ia)
|
||||
{
|
||||
((struct SUpnpActionRequest *)p)->m_ctrlPtIPAddr = *ia;
|
||||
((struct SUpnpActionRequest *)p)->m_ctrlPtIPAddr = *(struct sockaddr_storage *)ia;
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,6 +22,8 @@ struct SUpnpDiscovery
|
||||
UpnpString *m_os;
|
||||
UpnpString *m_date;
|
||||
UpnpString *m_ext;
|
||||
/* Variables should be declared with struct sockaddr_storage,
|
||||
* but users must only see a struct sockaddr pointer */
|
||||
struct sockaddr_storage m_destAddr;
|
||||
};
|
||||
|
||||
@ -338,6 +340,6 @@ struct sockaddr *UpnpDiscovery_get_DestAddr(const UpnpDiscovery *p)
|
||||
|
||||
void UpnpDiscovery_set_DestAddr(UpnpDiscovery *p, struct sockaddr *sa)
|
||||
{
|
||||
memcpy( &((struct SUpnpDiscovery *)p)->m_destAddr, sa, sizeof(struct sockaddr_storage) );
|
||||
((struct SUpnpDiscovery *)p)->m_destAddr = *(struct sockaddr_storage *)sa;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ struct SUpnpStateVarRequest
|
||||
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;
|
||||
};
|
||||
@ -190,15 +192,15 @@ void UpnpStateVarRequest_strcpy_StateVarName(UpnpStateVarRequest *p, const char
|
||||
}
|
||||
|
||||
|
||||
struct sockaddr_storage *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p)
|
||||
struct sockaddr *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return &((struct SUpnpStateVarRequest *)p)->m_ctrlPtIPAddr;
|
||||
return (struct sockaddr *)&((struct SUpnpStateVarRequest *)p)->m_ctrlPtIPAddr;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, struct sockaddr_storage *ia)
|
||||
void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, struct sockaddr *sa)
|
||||
{
|
||||
((struct SUpnpStateVarRequest *)p)->m_ctrlPtIPAddr = *ia;
|
||||
((struct SUpnpStateVarRequest *)p)->m_ctrlPtIPAddr = *(struct sockaddr_storage *)sa;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user