* Handler for TEST message.
*
* @param cls closure (refers to service)
- * @param server the server handling the message
* @param client identification of the client
* @param message the actual message
*/
static void
handle_test (void *cls,
- struct GNUNET_SERVER_Handle *server,
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
* Handler for SHUTDOWN message.
*
* @param cls closure (refers to service)
- * @param server the server handling the message
* @param client identification of the client
* @param message the actual message
*/
static void
handle_shutdown (void *cls,
- struct GNUNET_SERVER_Handle *server,
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct sockaddr_in *i4;
const struct sockaddr_in6 *i6;
int ret;
- char buf[INET6_ADDRSTRLEN];
- uint16_t port;
switch (addr->sa_family)
{
case AF_INET:
GNUNET_assert (addrlen == sizeof (struct sockaddr_in));
i4 = (const struct sockaddr_in *) addr;
- port = ntohs (i4->sin_port);
ret = ((sctx->v4_allowed == NULL) ||
(check_ipv4_listed (sctx->v4_allowed,
&i4->sin_addr)))
&& ((sctx->v4_denied == NULL) ||
(!check_ipv4_listed (sctx->v4_denied, &i4->sin_addr)));
- if (ret != GNUNET_OK)
- inet_ntop (AF_INET, &i4->sin_addr, buf, sizeof (buf));
break;
case AF_INET6:
GNUNET_assert (addrlen == sizeof (struct sockaddr_in6));
i6 = (const struct sockaddr_in6 *) addr;
- port = ntohs (i6->sin6_port);
ret = ((sctx->v6_allowed == NULL) ||
(check_ipv6_listed (sctx->v6_allowed,
&i6->sin6_addr)))
&& ((sctx->v6_denied == NULL) ||
(!check_ipv6_listed (sctx->v6_denied, &i6->sin6_addr)));
- if (ret != GNUNET_OK)
- inet_ntop (AF_INET6, &i6->sin6_addr, buf, sizeof (buf));
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
if (ret != GNUNET_OK)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Access from `%s:%u' denied to service `%s'\n"),
- buf, port, sctx->serviceName);
+ _("Access from `%s' denied to service `%s'\n"),
+ GNUNET_a2s(addr, addrlen), sctx->serviceName);
}
return ret;
}
setup_service (struct GNUNET_SERVICE_Context *sctx)
{
unsigned long long maxbuf;
- unsigned long long idleout;
+ struct GNUNET_TIME_Relative idleout;
char *hostname;
unsigned long long port;
int disablev6;
sctx->serviceName, "TIMEOUT"))
{
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (sctx->cfg,
- sctx->serviceName,
- "TIMEOUT", &idleout))
+ GNUNET_CONFIGURATION_get_value_time (sctx->cfg,
+ sctx->serviceName,
+ "TIMEOUT", &idleout))
return GNUNET_SYSERR;
- sctx->timeout.value = idleout;
+ sctx->timeout = idleout;
}
else
sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
{
if (GNUNET_SYSERR ==
(disablev6 = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg,
- sctx->
- serviceName,
+ sctx->serviceName,
"DISABLEV6")))
return GNUNET_SYSERR;
}