Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2019-03-20 21:56:42 -0400
committerEugene Tarassov2019-03-20 21:56:42 -0400
commitdad3a6f5683ff63614f33e9c421e4eceb255a4b0 (patch)
tree748f40678561873179f188dd2769ba1e28404c9d
parent57eabcf238179cda86194cf9a37d391e11c80914 (diff)
downloadorg.eclipse.tcf.agent-dad3a6f5683ff63614f33e9c421e4eceb255a4b0.tar.gz
org.eclipse.tcf.agent-dad3a6f5683ff63614f33e9c421e4eceb255a4b0.tar.xz
org.eclipse.tcf.agent-dad3a6f5683ff63614f33e9c421e4eceb255a4b0.zip
TCF Agent: new server option: Hidden - disable discovery of the server
For example: -s "TCP::1534;Hidden=1"
-rw-r--r--agent/tcf/framework/channel.c10
-rw-r--r--agent/tcf/framework/channel_lws.c4
-rw-r--r--agent/tcf/framework/channel_pipe.c4
-rw-r--r--agent/tcf/framework/channel_tcp.c6
-rw-r--r--agent/tcf/http/http-tcf.c2
5 files changed, 15 insertions, 11 deletions
diff --git a/agent/tcf/framework/channel.c b/agent/tcf/framework/channel.c
index 58ac920a..8caab4f3 100644
--- a/agent/tcf/framework/channel.c
+++ b/agent/tcf/framework/channel.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007-2019 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -453,7 +453,7 @@ PeerServer * channel_peer_from_url(const char * url) {
value = loc_strndup(url, s - url);
peer_server_addprop(ps, name, value);
}
- if (*s != '\0') {
+ if (*s) {
peer_server_free(ps);
return NULL;
}
@@ -475,7 +475,7 @@ char * channel_peer_to_json(PeerServer * ps) {
json_write_string(out, ps->list[i].value);
}
write_stream(out, '}');
- write_stream(out, '\0');
+ write_stream(out, 0);
get_byte_array_output_stream_data(&buf, &rval, NULL);
return rval;
}
@@ -485,12 +485,16 @@ char * channel_peer_to_json(PeerServer * ps) {
*/
ChannelServer * channel_server(PeerServer * ps) {
const char * transportname = peer_server_getprop(ps, "TransportName", NULL);
+ const char * hidden = peer_server_getprop(ps, "Hidden", NULL);
if (transportname == NULL) {
transportname = "TCP";
peer_server_addprop(ps, loc_strdup("TransportName"), loc_strdup(transportname));
}
+ ps->flags |= PS_FLAG_LOCAL;
+ if (hidden == NULL || atoi(hidden) == 0) ps->flags |= PS_FLAG_DISCOVERABLE;
+
if (strcmp(transportname, "TCP") == 0 || strcmp(transportname, "SSL") == 0) {
return channel_tcp_server(ps);
}
diff --git a/agent/tcf/framework/channel_lws.c b/agent/tcf/framework/channel_lws.c
index d9352f31..850cdbfd 100644
--- a/agent/tcf/framework/channel_lws.c
+++ b/agent/tcf/framework/channel_lws.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016-2018 Wind River Systems, Inc. and others.
+ * Copyright (c) 2016-2019 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -1169,7 +1169,7 @@ static void refresh_peer_server(int sock, PeerServer * ps) {
PeerServer * ps2;
src_addr.s_addr = ifclist[ifcind].addr;
ps2 = peer_server_alloc();
- ps2->flags = ps->flags | PS_FLAG_LOCAL | PS_FLAG_DISCOVERABLE;
+ ps2->flags = ps->flags;
for (i = 0; i < ps->ind; i++) {
peer_server_addprop(ps2, loc_strdup(ps->list[i].name),
loc_strdup(ps->list[i].value));
diff --git a/agent/tcf/framework/channel_pipe.c b/agent/tcf/framework/channel_pipe.c
index c0f28883..efbde723 100644
--- a/agent/tcf/framework/channel_pipe.c
+++ b/agent/tcf/framework/channel_pipe.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010-2018 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010-2019 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -675,7 +675,7 @@ static void register_server(ServerPIPE * s) {
const char * path = peer_server_getprop(ps, attr_pipe_name, def_pipe_name);
char id[256];
- ps2->flags = ps->flags | PS_FLAG_LOCAL | PS_FLAG_DISCOVERABLE;
+ ps2->flags = ps->flags;
for (i = 0; i < ps->ind; i++) {
peer_server_addprop(ps2, loc_strdup(ps->list[i].name), loc_strdup(ps->list[i].value));
}
diff --git a/agent/tcf/framework/channel_tcp.c b/agent/tcf/framework/channel_tcp.c
index c8b4b37f..a5d0d0c3 100644
--- a/agent/tcf/framework/channel_tcp.c
+++ b/agent/tcf/framework/channel_tcp.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2018 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007-2019 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -1072,7 +1072,7 @@ static void refresh_peer_server(int sock, PeerServer * ps) {
if (strcmp(transport, "UNIX") == 0) {
PeerServer * ps2 = peer_server_alloc();
char * str_id = loc_printf("%s:%s", transport, peer_server_getprop(ps, "Host", ""));
- ps2->flags = ps->flags | PS_FLAG_LOCAL | PS_FLAG_DISCOVERABLE;
+ ps2->flags = ps->flags;
for (i = 0; i < ps->ind; i++) {
peer_server_addprop(ps2, loc_strdup(ps->list[i].name), loc_strdup(ps->list[i].value));
}
@@ -1110,7 +1110,7 @@ static void refresh_peer_server(int sock, PeerServer * ps) {
}
src_addr.s_addr = ifclist[ifcind].addr;
ps2 = peer_server_alloc();
- ps2->flags = ps->flags | PS_FLAG_LOCAL | PS_FLAG_DISCOVERABLE;
+ ps2->flags = ps->flags;
for (i = 0; i < ps->ind; i++) {
peer_server_addprop(ps2, loc_strdup(ps->list[i].name), loc_strdup(ps->list[i].value));
}
diff --git a/agent/tcf/http/http-tcf.c b/agent/tcf/http/http-tcf.c
index 9fedfc6e..e97efa14 100644
--- a/agent/tcf/http/http-tcf.c
+++ b/agent/tcf/http/http-tcf.c
@@ -418,7 +418,7 @@ static void refresh_server_info(int sock, PeerServer * ps) {
}
src_addr.s_addr = if_list[if_cnt].addr;
ps2 = peer_server_alloc();
- ps2->flags = ps->flags | PS_FLAG_LOCAL | PS_FLAG_DISCOVERABLE;
+ ps2->flags = ps->flags;
for (i = 0; i < ps->ind; i++) {
peer_server_addprop(ps2, loc_strdup(ps->list[i].name), loc_strdup(ps->list[i].value));
}

Back to the top