[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4205 - in GNUnet: contrib m4 src/applications/gap src/incl
From: |
grothoff |
Subject: |
[GNUnet-SVN] r4205 - in GNUnet: contrib m4 src/applications/gap src/include src/util/network_client |
Date: |
Fri, 5 Jan 2007 22:09:04 -0800 (PST) |
Author: grothoff
Date: 2007-01-05 22:08:59 -0800 (Fri, 05 Jan 2007)
New Revision: 4205
Modified:
GNUnet/contrib/config-client.scm
GNUnet/m4/Makefile.in
GNUnet/src/applications/gap/gaptest.c
GNUnet/src/include/gnunet_util_getopt.h
GNUnet/src/util/network_client/tcpio.c
GNUnet/src/util/network_client/tcpiotest.c
Log:
fixing Mantis 1169
Modified: GNUnet/contrib/config-client.scm
===================================================================
--- GNUnet/contrib/config-client.scm 2007-01-05 22:09:57 UTC (rev 4204)
+++ GNUnet/contrib/config-client.scm 2007-01-06 06:08:59 UTC (rev 4205)
@@ -182,27 +182,15 @@
;; general options
-(define (network-port builder)
- (builder
- "NETWORK"
- "PORT"
- (_ "Client/Server Port")
- (_ "Which is the client-server port that is used between gnunetd and the
clients (TCP only). You may firewall this port for non-local machines (but you
do not have to since GNUnet will perform access control and only allow
connections from machines that are listed under TRUSTED).")
- '()
- #t
- 2087
- (cons 1 65535)
- 'advanced) )
-
(define (network-host builder)
(builder
"NETWORK"
"HOST"
- (_ "On which machine runs gnunetd (for clients)")
- (_ "This is equivalent to the -H option.")
+ (_ "On which machine and port is gnunetd running (for clients)?")
+ (_ "This is equivalent to the -H option. The format is IP:PORT.")
'()
#t
- "localhost"
+ "localhost:2087"
'()
'advanced) )
@@ -227,7 +215,6 @@
(nohelp)
(list
(daemon-config builder)
- (network-port builder)
(network-host builder)
)
#t
Modified: GNUnet/m4/Makefile.in
===================================================================
--- GNUnet/m4/Makefile.in 2007-01-05 22:09:57 UTC (rev 4204)
+++ GNUnet/m4/Makefile.in 2007-01-06 06:08:59 UTC (rev 4205)
@@ -241,6 +241,7 @@
lib-ld.m4\
lib-link.m4\
lib-prefix.m4\
+libxml2.m4\
longdouble.m4\
longlong.m4\
nls.m4\
Modified: GNUnet/src/applications/gap/gaptest.c
===================================================================
--- GNUnet/src/applications/gap/gaptest.c 2007-01-05 22:09:57 UTC (rev
4204)
+++ GNUnet/src/applications/gap/gaptest.c 2007-01-06 06:08:59 UTC (rev
4205)
@@ -340,18 +340,18 @@
uri = uploadFile(12345);
CHECK(NULL != uri);
CHECK(OK == searchFile(&uri));
- GC_set_configuration_value_number(cfg,
+ GC_set_configuration_value_string(cfg,
ectx,
"NETWORK",
- "PORT",
- 12087);
+ "HOSTNAME",
+ "localhost:12087");
CHECK(OK == downloadFile(12345, uri));
ECRS_freeUri(uri);
- GC_set_configuration_value_number(cfg,
+ GC_set_configuration_value_string(cfg,
ectx,
"NETWORK",
- "PORT",
- 2087);
+ "HOSTNAME",
+ "localhost:2087");
CHECK(OK == unindexFile(12345));
FAILURE:
Modified: GNUnet/src/include/gnunet_util_getopt.h
===================================================================
--- GNUnet/src/include/gnunet_util_getopt.h 2007-01-05 22:09:57 UTC (rev
4204)
+++ GNUnet/src/include/gnunet_util_getopt.h 2007-01-06 06:08:59 UTC (rev
4205)
@@ -180,7 +180,7 @@
* Set the configuration option for the configuration file.
*/
#define COMMAND_LINE_OPTION_HOSTNAME \
- { 'H', "host", "HOSTNAME", gettext_noop("specify host on which gnunetd is
running"), 1, &gnunet_getopt_configure_set_option, "GNUNET:HOSTNAME" }
+ { 'H', "host", "HOSTNAME", gettext_noop("specify host on which gnunetd is
running"), 1, &gnunet_getopt_configure_set_option, "NETWORK:HOST" }
/**
* Marker to end the list of options.
Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c 2007-01-05 22:09:57 UTC (rev
4204)
+++ GNUnet/src/util/network_client/tcpio.c 2007-01-06 06:08:59 UTC (rev
4205)
@@ -79,21 +79,34 @@
*/
static unsigned short getGNUnetPort(struct GE_Context * ectx,
struct GC_Configuration * cfg) {
- unsigned long long port;
-
- port = 2087;
- if (-1 == GC_get_configuration_value_number(cfg,
+ char * res;
+ char * pos;
+ unsigned int port;
+
+ res = NULL;
+ if (-1 == GC_get_configuration_value_string(cfg,
"NETWORK",
- "PORT",
- 1,
- 65535,
- 2087,
- &port)) {
+ "HOST",
+ "localhost:2087",
+ &res)) {
GE_LOG(ectx,
GE_ERROR | GE_USER | GE_BULK,
- _("Could not find valid value for PORT in section NETWORK."));
- return 0;
+ _("Could not find valid value for HOST in section NETWORK."));
+ return 2087;
}
+ pos = strstr(res, ":");
+ if (pos == NULL)
+ return 2087;
+ pos++;
+ if (1 != SSCANF(pos, "%u", &port)) {
+ GE_LOG(ectx,
+ GE_ERROR | GE_USER | GE_BULK,
+ _("Syntax error in configuration entry HOST in section NETWORK:
`%s'"),
+ pos);
+ FREE(pos);
+ return 2087;
+ }
+ FREE(pos);
return (unsigned short) port;
}
@@ -103,21 +116,26 @@
*
* @return the name of the host, NULL on error
*/
-static char * getGNUnetdHost(struct GE_Context * ectx,
- struct GC_Configuration * cfg) {
+static char *
+getGNUnetdHost(struct GE_Context * ectx,
+ struct GC_Configuration * cfg) {
char * res;
-
+ char * pos;
+
res = NULL;
if (-1 == GC_get_configuration_value_string(cfg,
"NETWORK",
"HOST",
- "localhost",
+ "localhost:2087",
&res)) {
GE_LOG(ectx,
GE_ERROR | GE_USER | GE_BULK,
_("Could not find valid value for HOST in section NETWORK."));
return NULL;
}
+ pos = strstr(res, ":");
+ if (pos != NULL)
+ *pos = '\0';
return res;
}
Modified: GNUnet/src/util/network_client/tcpiotest.c
===================================================================
--- GNUnet/src/util/network_client/tcpiotest.c 2007-01-05 22:09:57 UTC (rev
4204)
+++ GNUnet/src/util/network_client/tcpiotest.c 2007-01-06 06:08:59 UTC (rev
4205)
@@ -29,23 +29,8 @@
static struct GC_Configuration * cfg;
-/**
- * Get the GNUnet UDP port from the configuration,
- * or from /etc/services if it is not specified in
- * the config file.
- */
static unsigned short getGNUnetPort() {
- unsigned long long port;
-
- if (-1 == GC_get_configuration_value_number(cfg,
- "TCP",
- "PORT",
- 1,
- 65535,
- 2087,
- &port))
- port = 0;
- return (unsigned short) port;
+ return 2087;
}
static int openServerSocket() {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4205 - in GNUnet: contrib m4 src/applications/gap src/include src/util/network_client,
grothoff <=