Merged Charles Nepveu's IPv6 work. libupnp now is IPv6 enabled.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@358 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2008-05-02 17:04:22 +00:00
parent 4f2075b7c9
commit 2e4a96f034
30 changed files with 2457 additions and 981 deletions

View File

@@ -69,8 +69,8 @@ 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 in_addr *UpnpActionRequest_get_CtrlPtIPAddr(const UpnpActionRequest *p);
void UpnpActionRequest_set_CtrlPtIPAddr(UpnpActionRequest *p, struct in_addr *ia);
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);

View File

@@ -83,8 +83,8 @@ void UpnpDiscovery_strcpy_Ext(UpnpDiscovery *p, const char *s);
void UpnpDiscovery_strncpy_Ext(UpnpDiscovery *p, const char *s, int n);
/** The host address of the device responding to the search. */
struct sockaddr_in *UpnpDiscovery_get_DestAddr(const UpnpDiscovery *p);
void UpnpDiscovery_set_DestAddr(UpnpDiscovery *p, struct sockaddr_in *sa);
struct sockaddr *UpnpDiscovery_get_DestAddr(const UpnpDiscovery *p);
void UpnpDiscovery_set_DestAddr(UpnpDiscovery *p, struct sockaddr *sa);
#ifdef __cplusplus

View File

@@ -62,8 +62,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 in_addr *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p);
void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, struct in_addr *ia);
struct sockaddr_storage *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p);
void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, struct sockaddr_storage *ia);
/** The current value of the variable. This needs to be allocated by
* the caller. When finished with it, the SDK frees this {\bf DOMString}. */

View File

@@ -106,13 +106,15 @@
#endif
#ifndef WIN32
#define SOCKET int
#define INVALID_SOCKET (SOCKET)(~0)
#endif
#ifndef WIN32
#include <netinet/in.h>
#else
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <iphlpapi.h>
#include <time.h>
#endif
@@ -296,6 +298,15 @@
#define UPNP_E_ALREADY_REGISTERED -120
/*! @} */
/** @name UPNP_E_INVALID_INTERFACE [-121]
* {\tt UPNP_E_INVALID_INTERFACE} signifies that the interface provided to
* {\bf UpnpInit2} is unknown or does not have a valid IPv4 or IPv6
* address configured.
*/
/*! @{ */
#define UPNP_E_INVALID_INTERFACE -121
/*! @} */
/** @name UPNP_E_NETWORK_ERROR [-200]
* {\tt UPNP_E_NETWORK_ERROR} signifies that a network error occurred. It
* is the generic error code for network problems that are not covered under
@@ -930,6 +941,51 @@ EXPORT_SPEC int UpnpInit(
will pick an arbitrary free port. */
);
/*! @name Initialization and Registration */
/*! @{ */
/** Initializes the Linux SDK for UPnP Devices. This function must be called
* before any other API function can be called. It should be called
* only once. Subsequent calls to this API return a {\tt UPNP_E_INIT}
* error code.
*
* Optionally, the application can specify an interface name (in the
* case of a multi-homed configuration) and a port number to use for
* all UPnP operations. Since a port number can be used only by one
* process, multiple processes using the SDK must specify
* different port numbers.
*
* If unspecified, the SDK will use the first suitable interface and an
* arbitrary port.
*
* This call is synchronous.
*
* @return [int] An integer representing one of the following:
* \begin{itemize}
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist
* to initialize the SDK.
* \item {\tt UPNP_E_INIT}: The SDK is already initialized.
* \item {\tt UPNP_E_INIT_FAILED}: The SDK initialization
* failed for an unknown reason.
* \item {\tt UPNP_E_SOCKET_BIND}: An error occurred binding a socket.
* \item {\tt UPNP_E_LISTEN}: An error occurred listening to a socket.
* \item {\tt UPNP_E_OUTOF_SOCKET}: An error ocurred creating a socket.
* \item {\tt UPNP_E_INTERNAL_ERROR}: An internal error ocurred.
* \item {\tt UPNP_E_INVALID_INTERFACE}: IfName is invalid or doees not
* have a valid IPv4 or IPv6 addresss configured.
* \end{itemize} */
EXPORT_SPEC int UpnpInit2(
IN const char *IfName, /** The interface name to use by the UPnP SDK
operations. Examples: "eth0", "xl0",
"Local Area Connection", {\tt NULL} to
use the first suitable interface. */
IN unsigned short DestPort /** The destination port number to use. 0
will pick an arbitrary free port. */
);
/** Terminates the Linux SDK for UPnP Devices. This function must be the last
* API function called. It should be called only once. Subsequent calls to
* this API return a {\tt UPNP_E_FINISH} error code.
@@ -949,20 +1005,40 @@ EXPORT_SPEC int UpnpFinish();
* returned.
*
* @return [unsigned short] The port on which an internal server is
* listening for UPnP related requests.
* listening for IPv4 UPnP related requests.
*/
EXPORT_SPEC unsigned short UpnpGetServerPort(void);
/** If {\tt NULL} is used as the IP address in {\bf UpnpInit}, then this
/** If '0' is used as the port number in {\bf UpnpInit}, then this
* function can be used to retrieve the actual port allocated to
* the SDK. If {\bf UpnpInit} has not succeeded then 0 is
* returned.
*
* @return [unsigned short] The port on which an internal server is
* listening for IPv6 UPnP related requests.
*/
EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
/** If {\tt NULL} is used as the IPv4 address in {\bf UpnpInit}, then this
* function can be used to retrieve the actual interface address
* on which device is running. If {\bf UpnpInit} has not succeeded
* then {\tt NULL} is returned.
*
* @return [char*] The IP address on which an internal server is listening
* @return [char*] The IPv4 address on which an internal server is listening
* for UPnP related requests.
*/
EXPORT_SPEC char * UpnpGetServerIpAddress(void);
/** If {\tt NULL} is used as the IPv6 address in {\bf UpnpInit}, then this
* function can be used to retrieve the actual interface address
* on which device is running. If {\bf UpnpInit} has not succeeded
* then {\tt NULL} is returned.
*
* @return [char*] The IPv6 address on which an internal server is listening
* for UPnP related requests.
*/
EXPORT_SPEC char * UpnpGetServerIp6Address(void);
/** {\bf UpnpRegisterClient} registers a control point application with the
* SDK. A control point application cannot make any other API calls
* until it registers using this function.
@@ -1129,6 +1205,58 @@ EXPORT_SPEC int UpnpRegisterRootDevice2(
the new device handle. */
);
/** {\bf UpnpRegisterRootDevice3} registers a device application for a
* specific address family with the SDK. A device application cannot
* make any other API calls until it registers using this function.
* Device applications can also register as control points (see
* {\bf UpnpRegisterClient} to get a control point handle to perform
* control point functionality).
*
* {\bf UpnpRegisterRootDevice} is synchronous and does not generate
* any callbacks. Callbacks can occur as soon as this function returns.
*
* @return [int] An integer representing one of the following:
* \begin{itemize}
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
* \item {\tt UPNP_E_FINISH}: The SDK is already terminated or
* is not initialized.
* \item {\tt UPNP_E_INVALID_DESC}: The description document was not
* a valid device description.
* \item {\tt UPNP_E_INVALID_URL}: The URL for the description document
* is not valid.
* \item {\tt UPNP_E_INVALID_PARAM}: Either {\bf Callback} or {\bf Hnd}
* is not a valid pointer or {\bf DescURL} is {\tt NULL}.
* \item {\tt UPNP_E_NETWORK_ERROR}: A network error occurred.
* \item {\tt UPNP_E_SOCKET_WRITE}: An error or timeout occurred writing
* to a socket.
* \item {\tt UPNP_E_SOCKET_READ}: An error or timeout occurred reading
* from a socket.
* \item {\tt UPNP_E_SOCKET_BIND}: An error occurred binding a socket.
* \item {\tt UPNP_E_SOCKET_CONNECT}: An error occurred connecting the
* socket.
* \item {\tt UPNP_E_OUTOF_SOCKET}: Too many sockets are currently
* allocated.
* \item {\tt UPNP_E_OUTOF_MEMORY}: There are insufficient resources to
* register this root device.
* \end{itemize} */
EXPORT_SPEC int UpnpRegisterRootDevice3(
IN const char *DescUrl, /** Pointer to a string containing the
description URL for this root device
instance. */
IN Upnp_FunPtr Callback, /** Pointer to the callback function for
receiving asynchronous events. */
IN const void *Cookie, /** Pointer to user data returned with the
callback function when invoked. */
OUT UpnpDevice_Handle *Hnd,/** Pointer to a variable to store the
new device handle. */
IN const int AddressFamily /** Address family of this device. Can be
AF_INET for an IPv4 device, or AF_INET6
for an IPv6 device. Defaults to AF_INET. */
);
/** {\bf UpnpUnRegisterClient} unregisters a control point application,
* unsubscribing all active subscriptions. After this call, the
* {\bf UpnpClient_Handle} is no longer valid.