Address family is an int

Reference: "man 2 socket".
This commit is contained in:
Marcelo Roberto Jimenez 2012-03-13 11:23:49 -03:00
parent ad7272d2b5
commit a692e591de
6 changed files with 41 additions and 36 deletions

View File

@ -2,6 +2,12 @@
Version 1.6.16 Version 1.6.16
******************************************************************************* *******************************************************************************
2012-03-13 Marcelo Roberto Jimenez <mroberto(at)users.sourceforge.net>
Address family is an int
Reference: "man 2 socket".
2012-03-11 Fabrice Fontaine <fabrice.fontaine(at)orange.com> 2012-03-11 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
Remove more implicit casts in upnp part Remove more implicit casts in upnp part

View File

@ -1213,7 +1213,7 @@ EXPORT_SPEC int UpnpRegisterRootDevice3(
UpnpDevice_Handle *Hnd, UpnpDevice_Handle *Hnd,
/*! [in] Address family of this device. Can be AF_INET for an IPv4 device, or /*! [in] Address family of this device. Can be AF_INET for an IPv4 device, or
* AF_INET6 for an IPv6 device. Defaults to AF_INET. */ * AF_INET6 for an IPv6 device. Defaults to AF_INET. */
const int AddressFamily); int AddressFamily);
/*! /*!
* \brief Registers a device application for a specific address family with * \brief Registers a device application for a specific address family with
@ -1263,7 +1263,7 @@ EXPORT_SPEC int UpnpRegisterRootDevice4(
UpnpDevice_Handle *Hnd, UpnpDevice_Handle *Hnd,
/*! [in] Address family of this device. Can be AF_INET for an IPv4 device, or /*! [in] Address family of this device. Can be AF_INET for an IPv4 device, or
* AF_INET6 for an IPv6 device. Defaults to AF_INET. */ * AF_INET6 for an IPv6 device. Defaults to AF_INET. */
const int AddressFamily, int AddressFamily,
/*! [in] Pointer to a string containing the description URL to be returned for /*! [in] Pointer to a string containing the description URL to be returned for
* legacy CPs for this root device instance. */ * legacy CPs for this root device instance. */
const char *LowerDescUrl); const char *LowerDescUrl);

View File

@ -1056,7 +1056,7 @@ int UpnpRegisterRootDevice3(
Upnp_FunPtr Fun, Upnp_FunPtr Fun,
const void *Cookie, const void *Cookie,
UpnpDevice_Handle *Hnd, UpnpDevice_Handle *Hnd,
const int AddressFamily) int AddressFamily)
{ {
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
"Inside UpnpRegisterRootDevice3\n"); "Inside UpnpRegisterRootDevice3\n");
@ -1072,7 +1072,7 @@ int UpnpRegisterRootDevice4(
Upnp_FunPtr Fun, Upnp_FunPtr Fun,
const void *Cookie, const void *Cookie,
UpnpDevice_Handle *Hnd, UpnpDevice_Handle *Hnd,
const int AddressFamily, int AddressFamily,
const char *LowerDescUrl) const char *LowerDescUrl)
{ {
struct Handle_Info *HInfo; struct Handle_Info *HInfo;
@ -1206,11 +1206,10 @@ int UpnpRegisterRootDevice4(
} }
#endif /* EXCLUDE_GENA */ #endif /* EXCLUDE_GENA */
if (AddressFamily == AF_INET) { if (AddressFamily == AF_INET)
UpnpSdkDeviceRegisteredV4 = 1; UpnpSdkDeviceRegisteredV4 = 1;
} else { else
UpnpSdkDeviceregisteredV6 = 1; UpnpSdkDeviceregisteredV6 = 1;
}
retVal = UPNP_E_SUCCESS; retVal = UPNP_E_SUCCESS;
@ -3606,13 +3605,13 @@ Upnp_Handle_Type GetClientHandleInfo(
Upnp_Handle_Type GetDeviceHandleInfo( Upnp_Handle_Type GetDeviceHandleInfo(
const unsigned short AddressFamily, int AddressFamily,
UpnpDevice_Handle *device_handle_out, UpnpDevice_Handle *device_handle_out,
struct Handle_Info **HndInfo) struct Handle_Info **HndInfo)
{ {
/* Check if we've got a registered device of the address family specified. */ /* Check if we've got a registered device of the address family specified. */
if ((AddressFamily == (unsigned short)AF_INET && UpnpSdkDeviceRegisteredV4 == 0) || if ((AddressFamily == AF_INET && UpnpSdkDeviceRegisteredV4 == 0) ||
(AddressFamily == (unsigned short)AF_INET6 && UpnpSdkDeviceregisteredV6 == 0)) { (AddressFamily == AF_INET6 && UpnpSdkDeviceregisteredV6 == 0)) {
*device_handle_out = -1; *device_handle_out = -1;
return HND_INVALID; return HND_INVALID;
} }

View File

@ -354,7 +354,7 @@ int DeviceAdvertisement(
/* [in] Service duration in sec. */ /* [in] Service duration in sec. */
int Duration, int Duration,
/* [in] Device address family. */ /* [in] Device address family. */
unsigned short AddressFamily, int AddressFamily,
/* [in] PowerState as defined by UPnP Low Power. */ /* [in] PowerState as defined by UPnP Low Power. */
int PowerState, int PowerState,
/* [in] SleepPeriod as defined by UPnP Low Power. */ /* [in] SleepPeriod as defined by UPnP Low Power. */
@ -432,7 +432,7 @@ int ServiceAdvertisement(
/* [in] Life time of this device. */ /* [in] Life time of this device. */
int Duration, int Duration,
/* [in] Device address family. */ /* [in] Device address family. */
unsigned short AddressFamily, int AddressFamily,
/* [in] PowerState as defined by UPnP Low Power. */ /* [in] PowerState as defined by UPnP Low Power. */
int PowerState, int PowerState,
/* [in] SleepPeriod as defined by UPnP Low Power. */ /* [in] SleepPeriod as defined by UPnP Low Power. */
@ -480,7 +480,7 @@ int ServiceShutdown(
/* [in] Service duration in sec. */ /* [in] Service duration in sec. */
int Duration, int Duration,
/* [in] Device address family. */ /* [in] Device address family. */
unsigned short AddressFamily, int AddressFamily,
/* [in] PowerState as defined by UPnP Low Power. */ /* [in] PowerState as defined by UPnP Low Power. */
int PowerState, int PowerState,
/* [in] SleepPeriod as defined by UPnP Low Power. */ /* [in] SleepPeriod as defined by UPnP Low Power. */
@ -508,7 +508,7 @@ int DeviceShutdown(
/* [in] Device duration in sec. */ /* [in] Device duration in sec. */
int Duration, int Duration,
/* [in] Device address family. */ /* [in] Device address family. */
unsigned short AddressFamily, int AddressFamily,
/* [in] PowerState as defined by UPnP Low Power. */ /* [in] PowerState as defined by UPnP Low Power. */
int PowerState, int PowerState,
/* [in] SleepPeriod as defined by UPnP Low Power. */ /* [in] SleepPeriod as defined by UPnP Low Power. */

View File

@ -107,7 +107,7 @@ struct Handle_Info
/*! . */ /*! . */
int MaxSubscriptionTimeOut; int MaxSubscriptionTimeOut;
/*! Address family: AF_INET or AF_INET6. */ /*! Address family: AF_INET or AF_INET6. */
unsigned short DeviceAf; int DeviceAf;
#endif #endif
/* Client only */ /* Client only */
@ -174,7 +174,7 @@ Upnp_Handle_Type GetClientHandleInfo(
*/ */
Upnp_Handle_Type GetDeviceHandleInfo( Upnp_Handle_Type GetDeviceHandleInfo(
/*! [in] Address family. */ /*! [in] Address family. */
const unsigned short AddressFamily, int AddressFamily,
/*! [out] Device handle pointer. */ /*! [out] Device handle pointer. */
int *device_handle_out, int *device_handle_out,
/*! [out] Device handle structure passed by this function. */ /*! [out] Device handle structure passed by this function. */

View File

@ -320,7 +320,7 @@ static void CreateServicePacket(
/*! [out] Output buffer filled with HTTP statement. */ /*! [out] Output buffer filled with HTTP statement. */
char **packet, char **packet,
/*! [in] Address family of the HTTP request. */ /*! [in] Address family of the HTTP request. */
unsigned short AddressFamily, int AddressFamily,
/*! [in] PowerState as defined by UPnP Low Power. */ /*! [in] PowerState as defined by UPnP Low Power. */
int PowerState, int PowerState,
/*! [in] SleepPeriod as defined by UPnP Low Power. */ /*! [in] SleepPeriod as defined by UPnP Low Power. */
@ -380,7 +380,7 @@ static void CreateServicePacket(
nts = "ssdp:byebye"; nts = "ssdp:byebye";
/* NOTE: The CACHE-CONTROL and LOCATION headers are not present in /* NOTE: The CACHE-CONTROL and LOCATION headers are not present in
* a shutdown msg, but are present here for MS WinMe interop. */ * a shutdown msg, but are present here for MS WinMe interop. */
if (AddressFamily == (unsigned short)AF_INET) if (AddressFamily == AF_INET)
host = SSDP_IP; host = SSDP_IP;
else { else {
if (isUrlV6UlaGua(location)) if (isUrlV6UlaGua(location))
@ -430,7 +430,7 @@ static void CreateServicePacket(
} }
int DeviceAdvertisement(char *DevType, int RootDev, char *Udn, char *Location, int DeviceAdvertisement(char *DevType, int RootDev, char *Udn, char *Location,
int Duration, unsigned short AddressFamily, int PowerState, int Duration, int AddressFamily, int PowerState,
int SleepPeriod, int RegistrationState) int SleepPeriod, int RegistrationState)
{ {
struct sockaddr_storage __ss; struct sockaddr_storage __ss;
@ -445,11 +445,11 @@ int DeviceAdvertisement(char *DevType, int RootDev, char *Udn, char *Location,
UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__, UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__,
"In function DeviceAdvertisement\n"); "In function DeviceAdvertisement\n");
memset(&__ss, 0, sizeof(__ss)); memset(&__ss, 0, sizeof(__ss));
if (AddressFamily == (unsigned short)AF_INET) { if (AddressFamily == AF_INET) {
DestAddr4->sin_family = (unsigned short)AF_INET; DestAddr4->sin_family = (unsigned short)AF_INET;
inet_pton(AF_INET, SSDP_IP, &DestAddr4->sin_addr); inet_pton(AF_INET, SSDP_IP, &DestAddr4->sin_addr);
DestAddr4->sin_port = htons(SSDP_PORT); DestAddr4->sin_port = htons(SSDP_PORT);
} else if (AddressFamily == (unsigned short)AF_INET6) { } else if (AddressFamily == AF_INET6) {
DestAddr6->sin6_family = (unsigned short)AF_INET6; DestAddr6->sin6_family = (unsigned short)AF_INET6;
inet_pton(AF_INET6, inet_pton(AF_INET6,
(isUrlV6UlaGua(Location)) ? SSDP_IPV6_SITELOCAL : (isUrlV6UlaGua(Location)) ? SSDP_IPV6_SITELOCAL :
@ -638,7 +638,7 @@ error_handler:
} }
int ServiceAdvertisement(char *Udn, char *ServType, char *Location, int ServiceAdvertisement(char *Udn, char *ServType, char *Location,
int Duration, unsigned short AddressFamily, int Duration, int AddressFamily,
int PowerState, int SleepPeriod, int RegistrationState) int PowerState, int SleepPeriod, int RegistrationState)
{ {
char Mil_Usn[LINE_SIZE]; char Mil_Usn[LINE_SIZE];
@ -651,12 +651,12 @@ int ServiceAdvertisement(char *Udn, char *ServType, char *Location,
memset(&__ss, 0, sizeof(__ss)); memset(&__ss, 0, sizeof(__ss));
szReq[0] = NULL; szReq[0] = NULL;
if (AddressFamily == (unsigned short)AF_INET) { if (AddressFamily == AF_INET) {
DestAddr4->sin_family = AddressFamily; DestAddr4->sin_family = (sa_family_t)AddressFamily;
inet_pton(AF_INET, SSDP_IP, &DestAddr4->sin_addr); inet_pton(AF_INET, SSDP_IP, &DestAddr4->sin_addr);
DestAddr4->sin_port = htons(SSDP_PORT); DestAddr4->sin_port = htons(SSDP_PORT);
} else if (AddressFamily == (unsigned short)AF_INET6) { } else if (AddressFamily == AF_INET6) {
DestAddr6->sin6_family = AddressFamily; DestAddr6->sin6_family = (sa_family_t)AddressFamily;
inet_pton(AF_INET6, inet_pton(AF_INET6,
(isUrlV6UlaGua(Location)) ? SSDP_IPV6_SITELOCAL : (isUrlV6UlaGua(Location)) ? SSDP_IPV6_SITELOCAL :
SSDP_IPV6_LINKLOCAL, &DestAddr6->sin6_addr); SSDP_IPV6_LINKLOCAL, &DestAddr6->sin6_addr);
@ -712,7 +712,7 @@ error_handler:
} }
int ServiceShutdown(char *Udn, char *ServType, char *Location, int Duration, int ServiceShutdown(char *Udn, char *ServType, char *Location, int Duration,
unsigned short AddressFamily, int PowerState, int AddressFamily, int PowerState,
int SleepPeriod, int RegistrationState) int SleepPeriod, int RegistrationState)
{ {
char Mil_Usn[LINE_SIZE]; char Mil_Usn[LINE_SIZE];
@ -725,12 +725,12 @@ int ServiceShutdown(char *Udn, char *ServType, char *Location, int Duration,
memset(&__ss, 0, sizeof(__ss)); memset(&__ss, 0, sizeof(__ss));
szReq[0] = NULL; szReq[0] = NULL;
if (AddressFamily == (unsigned short)AF_INET) { if (AddressFamily == AF_INET) {
DestAddr4->sin_family = AddressFamily; DestAddr4->sin_family = (sa_family_t)AddressFamily;
inet_pton(AF_INET, SSDP_IP, &DestAddr4->sin_addr); inet_pton(AF_INET, SSDP_IP, &DestAddr4->sin_addr);
DestAddr4->sin_port = htons(SSDP_PORT); DestAddr4->sin_port = htons(SSDP_PORT);
} else if (AddressFamily == (unsigned short)AF_INET6) { } else if (AddressFamily == AF_INET6) {
DestAddr6->sin6_family = AddressFamily; DestAddr6->sin6_family = (sa_family_t)AddressFamily;
inet_pton(AF_INET6, inet_pton(AF_INET6,
(isUrlV6UlaGua(Location)) ? SSDP_IPV6_SITELOCAL : (isUrlV6UlaGua(Location)) ? SSDP_IPV6_SITELOCAL :
SSDP_IPV6_LINKLOCAL, &DestAddr6->sin6_addr); SSDP_IPV6_LINKLOCAL, &DestAddr6->sin6_addr);
@ -760,7 +760,7 @@ error_handler:
} }
int DeviceShutdown(char *DevType, int RootDev, char *Udn, char *_Server, int DeviceShutdown(char *DevType, int RootDev, char *Udn, char *_Server,
char *Location, int Duration, unsigned short AddressFamily, char *Location, int Duration, int AddressFamily,
int PowerState, int SleepPeriod, int RegistrationState) int PowerState, int SleepPeriod, int RegistrationState)
{ {
struct sockaddr_storage __ss; struct sockaddr_storage __ss;
@ -775,12 +775,12 @@ int DeviceShutdown(char *DevType, int RootDev, char *Udn, char *_Server,
msgs[1] = NULL; msgs[1] = NULL;
msgs[2] = NULL; msgs[2] = NULL;
memset(&__ss, 0, sizeof(__ss)); memset(&__ss, 0, sizeof(__ss));
if (AddressFamily == (unsigned short)AF_INET) { if (AddressFamily == AF_INET) {
DestAddr4->sin_family = AddressFamily; DestAddr4->sin_family = (sa_family_t)AddressFamily;
inet_pton(AF_INET, SSDP_IP, &DestAddr4->sin_addr); inet_pton(AF_INET, SSDP_IP, &DestAddr4->sin_addr);
DestAddr4->sin_port = htons(SSDP_PORT); DestAddr4->sin_port = htons(SSDP_PORT);
} else if (AddressFamily == (unsigned short)AF_INET6) { } else if (AddressFamily == AF_INET6) {
DestAddr6->sin6_family = AddressFamily; DestAddr6->sin6_family = (sa_family_t)AddressFamily;
inet_pton(AF_INET6, inet_pton(AF_INET6,
(isUrlV6UlaGua(Location)) ? SSDP_IPV6_SITELOCAL : (isUrlV6UlaGua(Location)) ? SSDP_IPV6_SITELOCAL :
SSDP_IPV6_LINKLOCAL, &DestAddr6->sin6_addr); SSDP_IPV6_LINKLOCAL, &DestAddr6->sin6_addr);