All checks were successful
Build / Build project (push) Successful in 50s
158 lines
5.8 KiB
Diff
158 lines
5.8 KiB
Diff
Subject: https://github.com/openslp-org/openslp/compare/1bc8dadd446ffca391422da6e924f1395c7008bc...forssea-robotics:openslp:667b30026d90e0e9e87763663b18bfa75c72e1e3?diff=unified&w
|
|
diff --git a/libslp/libslp_dereg.c b/libslp/libslp_dereg.c
|
|
index 1eb7c03..e764224 100644
|
|
--- a/libslp/libslp_dereg.c
|
|
+++ b/libslp/libslp_dereg.c
|
|
@@ -212,6 +212,7 @@ static SLPError AsyncProcessSrvDeReg(SLPHandleInfo * handle)
|
|
SLPError SLPAPI SLPDereg(
|
|
SLPHandle hSLP,
|
|
const char * srvUrl,
|
|
+ const char * pcScopeList,
|
|
SLPRegReport callback,
|
|
void * cookie)
|
|
{
|
|
@@ -244,8 +245,11 @@ SLPError SLPAPI SLPDereg(
|
|
if (inuse)
|
|
return SLP_HANDLE_IN_USE;
|
|
|
|
+ if (!pcScopeList || *pcScopeList == 0)
|
|
+ pcScopeList = SLPPropertyGet("net.slp.useScopes", 0, 0);
|
|
+
|
|
/* Set the handle up to reference parameters. */
|
|
- handle->params.dereg.scopelist = SLPPropertyGet("net.slp.useScopes", 0, 0);
|
|
+ handle->params.dereg.scopelist = pcScopeList;
|
|
handle->params.dereg.scopelistlen = strlen(handle->params.dereg.scopelist);
|
|
handle->params.dereg.urllen = strlen(srvUrl);
|
|
handle->params.dereg.url = srvUrl;
|
|
diff --git a/libslp/libslp_reg.c b/libslp/libslp_reg.c
|
|
index dffc8b9..3894aef 100644
|
|
--- a/libslp/libslp_reg.c
|
|
+++ b/libslp/libslp_reg.c
|
|
@@ -315,6 +315,7 @@ SLPEXP SLPError SLPAPI SLPReg(
|
|
unsigned short lifetime,
|
|
const char * srvType,
|
|
const char * attrList,
|
|
+ const char * pcScopeList,
|
|
SLPBoolean fresh,
|
|
SLPRegReport callback,
|
|
void * cookie)
|
|
@@ -363,6 +364,9 @@ SLPEXP SLPError SLPAPI SLPReg(
|
|
return serr == SLP_PARSE_ERROR? SLP_INVALID_REGISTRATION: serr;
|
|
}
|
|
|
|
+ if (!pcScopeList || *pcScopeList == 0)
|
|
+ pcScopeList = SLPPropertyGet("net.slp.useScopes", 0, 0);
|
|
+
|
|
/* Set the handle up to reference parameters. */
|
|
handle->params.reg.fresh = fresh;
|
|
handle->params.reg.lifetime = lifetime;
|
|
@@ -370,7 +374,7 @@ SLPEXP SLPError SLPAPI SLPReg(
|
|
handle->params.reg.url = srvUrl;
|
|
handle->params.reg.srvtype = parsedurl->s_pcSrvType;
|
|
handle->params.reg.srvtypelen = strlen(handle->params.reg.srvtype);
|
|
- handle->params.reg.scopelist = SLPPropertyGet("net.slp.useScopes", 0, 0);
|
|
+ handle->params.reg.scopelist = pcScopeList;
|
|
handle->params.reg.scopelistlen = strlen(handle->params.reg.scopelist);
|
|
handle->params.reg.attrlistlen = strlen(attrList);
|
|
handle->params.reg.attrlist = attrList;
|
|
diff --git a/libslp/slp.h b/libslp/slp.h
|
|
index 4568fb6..0aaa202 100644
|
|
--- a/libslp/slp.h
|
|
+++ b/libslp/slp.h
|
|
@@ -251,7 +251,7 @@ typedef enum {
|
|
*
|
|
* The SLPBoolean enum is used as a boolean flag.
|
|
*/
|
|
-typedef enum {
|
|
+typedef enum SLPBoolean {
|
|
SLP_FALSE = 0,
|
|
SLP_TRUE = 1
|
|
} SLPBoolean;
|
|
@@ -470,6 +470,7 @@ SLPEXP SLPError SLPAPI SLPReg(
|
|
unsigned short usLifetime,
|
|
const char * pcSrvType,
|
|
const char * pcAttrs,
|
|
+ const char * pcScopeList,
|
|
SLPBoolean fresh,
|
|
SLPRegReport callback,
|
|
void * pvCookie);
|
|
@@ -480,6 +481,7 @@ SLPEXP SLPError SLPAPI SLPReg(
|
|
SLPEXP SLPError SLPAPI SLPDereg(
|
|
SLPHandle hSLP,
|
|
const char * pcSrvURL,
|
|
+ const char * pcScopeList,
|
|
SLPRegReport callback,
|
|
void * pvCookie);
|
|
|
|
diff --git a/slpd/slpd_main.c b/slpd/slpd_main.c
|
|
index 130497e..d7fa705 100644
|
|
--- a/slpd/slpd_main.c
|
|
+++ b/slpd/slpd_main.c
|
|
@@ -653,7 +653,14 @@ int main(int argc, char * argv[])
|
|
|| SLPDOutgoingInit()
|
|
|| SLPDKnownDAInit())
|
|
SLPDFatal("slpd initialization failed\n");
|
|
- SLPDLog("Agent Interfaces = %s\n", G_SlpdProperty.interfaces);
|
|
+
|
|
+ /* Stop slpd until interfaces is null (unknown) */
|
|
+ if (G_SlpdProperty.interfaces == NULL) {
|
|
+ SLPDFatal("No agent interfaces found\n");
|
|
+ } else {
|
|
+ SLPDLog("Agent Interfaces = %s\n", G_SlpdProperty.interfaces);
|
|
+ }
|
|
+
|
|
if (G_SlpdProperty.port != SLP_RESERVED_PORT)
|
|
SLPDLog("Using port %d instead of default %d\n", G_SlpdProperty.port, SLP_RESERVED_PORT);
|
|
|
|
diff --git a/slptool/slptool.c b/slptool/slptool.c
|
|
index 6fe9329..81572e2 100644
|
|
--- a/slptool/slptool.c
|
|
+++ b/slptool/slptool.c
|
|
@@ -261,6 +261,7 @@ void Register(SLPToolCommandLine * cmdline)
|
|
char srvtype[80] = "", * s;
|
|
size_t len = 0;
|
|
unsigned int lt = 0;
|
|
+ const char *scopes;
|
|
|
|
if (cmdline->time) {
|
|
lt = atoi(cmdline->time);
|
|
@@ -283,16 +284,18 @@ void Register(SLPToolCommandLine * cmdline)
|
|
SLPSetProperty("net.slp.watchRegistrationPID", 0);
|
|
|
|
if ((cmdline->scopes != 0) && (*cmdline->scopes != 0))
|
|
- SLPSetProperty("net.slp.useScopes", cmdline->scopes);
|
|
+ scopes = cmdline->scopes;
|
|
+ else
|
|
+ scopes = "DEFAULT";
|
|
|
|
if (SLPOpen(cmdline->lang, SLP_FALSE, &hslp) == SLP_OK)
|
|
{
|
|
if (!lt || lt > SLP_LIFETIME_MAXIMUM)
|
|
result = SLPReg(hslp, cmdline->cmdparam1, SLP_LIFETIME_MAXIMUM, srvtype,
|
|
- cmdline->cmdparam2, SLP_TRUE, mySLPRegReport, 0);
|
|
+ cmdline->cmdparam2, scopes, SLP_TRUE, mySLPRegReport, 0);
|
|
else
|
|
result = SLPReg(hslp, cmdline->cmdparam1, (unsigned short)lt, srvtype,
|
|
- cmdline->cmdparam2, SLP_TRUE, mySLPRegReport, 0);
|
|
+ cmdline->cmdparam2, scopes, SLP_TRUE, mySLPRegReport, 0);
|
|
if (result != SLP_OK)
|
|
printf("errorcode: %i\n", result);
|
|
SLPClose(hslp);
|
|
@@ -303,10 +306,16 @@ void Deregister(SLPToolCommandLine * cmdline)
|
|
{
|
|
SLPError result;
|
|
SLPHandle hslp;
|
|
+ const char *scopes;
|
|
+
|
|
+ if ((cmdline->scopes != 0) && (*cmdline->scopes != 0))
|
|
+ scopes = cmdline->scopes;
|
|
+ else
|
|
+ scopes = "DEFAULT";
|
|
|
|
if (SLPOpen(cmdline->lang, SLP_FALSE, &hslp) == SLP_OK)
|
|
{
|
|
- result = SLPDereg(hslp, cmdline->cmdparam1, mySLPRegReport, 0);
|
|
+ result = SLPDereg(hslp, cmdline->cmdparam1, scopes, mySLPRegReport, 0);
|
|
if (result != SLP_OK)
|
|
printf("errorcode: %i\n", result);
|
|
SLPClose(hslp);
|