Add --disable-optssdp option

Modify configure.ac to add --disable-optssdp option. This option will
remove OPT, 01-NLS and X_USER_AGENT headers from SSDP messages as those
headers are optional. If --disable-gena and disable-optssdp are both
used, uuid part will not be compiled anymore.
(cherry picked from commit 731512b0e5)
This commit is contained in:
Fabrice Fontaine 2012-03-15 13:43:04 +01:00 committed by Marcelo Roberto Jimenez
parent fec6069a21
commit b53d552d3f
8 changed files with 89 additions and 0 deletions

View File

@ -318,6 +318,15 @@ Version 1.8.0
Version 1.6.16
*******************************************************************************
2012-03-15 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
Add --disable-optssdp option
Modify configure.ac to add --disable-optssdp option. This option will
remove OPT, 01-NLS and X_USER_AGENT headers from SSDP messages as those
headers are optional. If --disable-gena and disable-optssdp are both
used, uuid part will not be compiled anymore.
2012-03-15 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
Bug fix in ixmlNode_allowChildren

View File

@ -153,6 +153,9 @@
/* see upnpconfig.h */
#define UPNP_HAVE_SSDP 1
/* see upnpconfig.h */
#define UPNP_HAVE_OPTSSDP 1
/* see upnpconfig.h */
#define UPNP_HAVE_TOOLS 1

View File

@ -105,6 +105,11 @@
#define UPNP_HAVE_SSDP 1
/** Defined to 1 if the library has been compiled with optional SSDP headers
* support (i.e. configure --enable-optssdp) */
#define UPNP_HAVE_OPTSSDP 1
/** Defined to 1 if the library has been compiled with the SOAP part enabled
* (i.e. configure --enable-soap) */
#define UPNP_HAVE_SOAP 1

View File

@ -403,6 +403,12 @@ if test "x$enable_ssdp" = xyes ; then
AC_DEFINE(UPNP_HAVE_SSDP, 1, [see upnpconfig.h])
fi
RT_BOOL_ARG_ENABLE([optssdp], [yes], [optionnal SSDP headers support)])
if test "x$enable_optssdp" = xyes ; then
AC_DEFINE(UPNP_HAVE_OPTSSDP, 1, [see upnpconfig.h])
enable_uuid=yes
fi
RT_BOOL_ARG_ENABLE([soap], [yes], [SOAP part])
if test "x$enable_soap" = xyes ; then
AC_DEFINE(UPNP_HAVE_SOAP, 1, [see upnpconfig.h])
@ -411,8 +417,11 @@ fi
RT_BOOL_ARG_ENABLE([gena], [yes], [GENA part])
if test "x$enable_gena" = xyes ; then
AC_DEFINE(UPNP_HAVE_GENA, 1, [see upnpconfig.h])
enable_uuid=yes
fi
AM_CONDITIONAL(ENABLE_UUID, test x"$enable_uuid" = xyes)
RT_BOOL_ARG_ENABLE([tools], [yes], [helper APIs in upnptools.h])
if test "x$enable_tools" = xyes ; then
AC_DEFINE(UPNP_HAVE_TOOLS, 1, [see upnpconfig.h])

View File

@ -162,10 +162,12 @@ endif
# uuid
if ENABLE_UUID
libupnp_la_SOURCES += \
src/uuid/md5.c \
src/uuid/sysdep.c \
src/uuid/uuid.c
endif
# urlconfig

View File

@ -104,6 +104,11 @@
#undef UPNP_HAVE_SSDP
/** Defined to 1 if the library has been compiled with optional SSDP headers
* support (i.e. configure --enable-optssdp) */
#undef UPNP_HAVE_OPTSSDP
/** Defined to 1 if the library has been compiled with the SOAP part enabled
* (i.e. configure --enable-soap) */
#undef UPNP_HAVE_SOAP

View File

@ -179,8 +179,10 @@ int UpnpSdkDeviceRegisteredV4 = 0;
* == 0 if unregistered, == 1 if registered. */
int UpnpSdkDeviceregisteredV6 = 0;
#ifdef HAVE_UPNP_OPTSSDP
/*! Global variable used in discovery notifications. */
Upnp_SID gUpnpSdkNLSuuid;
#endif /* HAVE_UPNP_OPTSSDP */
/*! Global variable used as to store the OpenSSL context object
* to be used for all SSL/TLS connections
@ -320,7 +322,9 @@ static int UpnpInitPreamble(void)
{
int retVal = UPNP_E_SUCCESS;
int i;
#ifdef UPNP_HAVE_OPTSSDP
uuid_upnp nls_uuid;
#endif /* UPNP_HAVE_OPTSSDP */
retVal = WinsockInit();
if (retVal != UPNP_E_SUCCESS) {
@ -345,9 +349,11 @@ static int UpnpInitPreamble(void)
return retVal;
}
#ifdef UPNP_HAVE_OPTSSDP
/* Create the NLS uuid. */
uuid_create(&nls_uuid);
uuid_unpack(&nls_uuid, gUpnpSdkNLSuuid);
#endif /* UPNP_HAVE_OPTSSDP */
/* Initializes the handle list. */
HandleLock();

View File

@ -343,6 +343,7 @@ static void CreateServicePacket(
*packet = NULL;
if (msg_type == MSGTYPE_REPLY) {
if (PowerState > 0) {
#ifdef UPNP_HAVE_OPTSSDP
ret_code = http_MakeMessage(&buf, 1, 1,
"R" "sdc" "D" "sc" "ssc" "ssc" "ssc"
"S" "Xc" "ssc" "ssc"
@ -357,7 +358,21 @@ static void CreateServicePacket(
"SleepPeriod: ", SleepPeriod,
"RegistrationState: ",
RegistrationState);
#else
ret_code = http_MakeMessage(&buf, 1, 1,
"R" "sdc" "D" "sc" "ssc"
"S" "ssc" "ssc"
"sdc" "sdc" "sdcc", HTTP_OK,
"CACHE-CONTROL: max-age=", duration,
"EXT:", "LOCATION: ", location,
"ST: ", nt, "USN: ",
usn, "Powerstate: ", PowerState,
"SleepPeriod: ", SleepPeriod,
"RegistrationState: ",
RegistrationState);
#endif /* UPNP_HAVE_OPTSSDP */
} else {
#ifdef UPNP_HAVE_OPTSSDP
ret_code = http_MakeMessage(&buf, 1, 1,
"R" "sdc" "D" "sc" "ssc" "ssc" "ssc"
"S" "Xc" "ssc" "sscc", HTTP_OK,
@ -368,6 +383,14 @@ static void CreateServicePacket(
"01-NLS: ", gUpnpSdkNLSuuid,
X_USER_AGENT, "ST: ", nt, "USN: ",
usn);
#else
ret_code = http_MakeMessage(&buf, 1, 1,
"R" "sdc" "D" "sc" "ssc"
"S" "ssc" "sscc", HTTP_OK,
"CACHE-CONTROL: max-age=", duration,
"EXT:", "LOCATION: ", location,
"ST: ", nt, "USN: ", usn);
#endif /* UPNP_HAVE_OPTSSDP */
}
if (ret_code != 0) {
return;
@ -394,6 +417,7 @@ static void CreateServicePacket(
host = "[" SSDP_IPV6_LINKLOCAL "]";
}
if (PowerState > 0) {
#ifdef UPNP_HAVE_OPTSSDP
ret_code = http_MakeMessage(&buf, 1, 1,
"Q" "sssdc" "sdc" "ssc" "ssc" "ssc"
"ssc" "ssc" "S" "Xc" "ssc"
@ -409,7 +433,23 @@ static void CreateServicePacket(
PowerState, "SleepPeriod: ",
SleepPeriod, "RegistrationState: ",
RegistrationState);
#else
ret_code = http_MakeMessage(&buf, 1, 1,
"Q" "sssdc" "sdc" "ssc"
"ssc" "ssc" "S" "ssc"
"sdc" "sdc" "sdcc",
HTTPMETHOD_NOTIFY, "*", (size_t) 1,
"HOST: ", host, ":", SSDP_PORT,
"CACHE-CONTROL: max-age=", duration,
"LOCATION: ", location, "NT: ", nt,
"NTS: ", nts,
"USN: ", usn, "Powerstate: ",
PowerState, "SleepPeriod: ",
SleepPeriod, "RegistrationState: ",
RegistrationState);
#endif /* UPNP_HAVE_OPTSSDP */
} else {
#ifdef UPNP_HAVE_OPTSSDP
ret_code = http_MakeMessage(&buf, 1, 1,
"Q" "sssdc" "sdc" "ssc" "ssc" "ssc"
"ssc" "ssc" "S" "Xc" "sscc",
@ -421,6 +461,16 @@ static void CreateServicePacket(
"01-NLS: ", gUpnpSdkNLSuuid, "NT: ",
nt, "NTS: ", nts, X_USER_AGENT,
"USN: ", usn);
#else
ret_code = http_MakeMessage(&buf, 1, 1,
"Q" "sssdc" "sdc" "ssc"
"ssc" "ssc" "S" "sscc",
HTTPMETHOD_NOTIFY, "*", (size_t) 1,
"HOST: ", host, ":", SSDP_PORT,
"CACHE-CONTROL: max-age=", duration,
"LOCATION: ", location, "NT: ", nt,
"NTS: ", nts, "USN: ", usn);
#endif /* UPNP_HAVE_OPTSSDP */
}
if (ret_code)
return;