diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-05 21:33:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-05 21:33:37 +0000 |
commit | 4ce2d673d41ad8a8b9e5389b5b97ecb5e77f190d (patch) | |
tree | 4121ea931c40568a7624413cf2b19c707572876f /src/exit | |
parent | 8411c737ab7cf78a37d841f75cf1a0298c3cd26d (diff) | |
download | gnunet-4ce2d673d41ad8a8b9e5389b5b97ecb5e77f190d.tar.gz gnunet-4ce2d673d41ad8a8b9e5389b5b97ecb5e77f190d.zip |
-moving to regex
Diffstat (limited to 'src/exit')
-rw-r--r-- | src/exit/Makefile.am | 4 | ||||
-rw-r--r-- | src/exit/gnunet-daemon-exit.c | 60 |
2 files changed, 52 insertions, 12 deletions
diff --git a/src/exit/Makefile.am b/src/exit/Makefile.am index d350d86e2..93a26801f 100644 --- a/src/exit/Makefile.am +++ b/src/exit/Makefile.am | |||
@@ -34,7 +34,7 @@ libexec_PROGRAMS = \ | |||
34 | if MINGW | 34 | if MINGW |
35 | gnunet_helper_exit_LDFLAGS = \ | 35 | gnunet_helper_exit_LDFLAGS = \ |
36 | -no-undefined -Wl,--export-all-symbols | 36 | -no-undefined -Wl,--export-all-symbols |
37 | 37 | ||
38 | gnunet_helper_exit_LDADD = \ | 38 | gnunet_helper_exit_LDADD = \ |
39 | -lsetupapi -lnewdev -lshell32 -liconv -lstdc++ \ | 39 | -lsetupapi -lnewdev -lshell32 -liconv -lstdc++ \ |
40 | -lcomdlg32 -lgdi32 -liphlpapi | 40 | -lcomdlg32 -lgdi32 -liphlpapi |
@@ -54,5 +54,5 @@ gnunet_daemon_exit_LDADD = \ | |||
54 | $(top_builddir)/src/tun/libgnunettun.la \ | 54 | $(top_builddir)/src/tun/libgnunettun.la \ |
55 | $(top_builddir)/src/util/libgnunetutil.la \ | 55 | $(top_builddir)/src/util/libgnunetutil.la \ |
56 | $(top_builddir)/src/mesh/libgnunetmesh.la \ | 56 | $(top_builddir)/src/mesh/libgnunetmesh.la \ |
57 | $(top_builddir)/src/regex/libgnunetregex.la \ | 57 | $(top_builddir)/src/regex/libgnunetregexnew.la \ |
58 | $(GN_LIBINTL) | 58 | $(GN_LIBINTL) |
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index fbf173086..d7da94756 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "gnunet_statistics_service.h" | 44 | #include "gnunet_statistics_service.h" |
45 | #include "gnunet_constants.h" | 45 | #include "gnunet_constants.h" |
46 | #include "gnunet_tun_lib.h" | 46 | #include "gnunet_tun_lib.h" |
47 | #include "gnunet_regex_lib.h" | 47 | #include "gnunet_regex_service.h" |
48 | #include "exit.h" | 48 | #include "exit.h" |
49 | 49 | ||
50 | /** | 50 | /** |
@@ -59,6 +59,10 @@ | |||
59 | */ | 59 | */ |
60 | #define REGEX_MAX_PATH_LEN_IPV6 8 | 60 | #define REGEX_MAX_PATH_LEN_IPV6 8 |
61 | 61 | ||
62 | /** | ||
63 | * How frequently do we re-announce the regex for the exit? | ||
64 | */ | ||
65 | #define REGEX_REFRESH_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30) | ||
62 | 66 | ||
63 | /** | 67 | /** |
64 | * Generic logging shorthand | 68 | * Generic logging shorthand |
@@ -67,7 +71,6 @@ | |||
67 | GNUNET_log_from (kind, "exit", __VA_ARGS__); | 71 | GNUNET_log_from (kind, "exit", __VA_ARGS__); |
68 | 72 | ||
69 | 73 | ||
70 | |||
71 | /** | 74 | /** |
72 | * Information about an address. | 75 | * Information about an address. |
73 | */ | 76 | */ |
@@ -295,6 +298,16 @@ struct TunnelState | |||
295 | static int global_ret; | 298 | static int global_ret; |
296 | 299 | ||
297 | /** | 300 | /** |
301 | * Handle to our regex announcement for IPv4. | ||
302 | */ | ||
303 | static struct GNUNET_REGEX_Announcement *regex4; | ||
304 | |||
305 | /** | ||
306 | * Handle to our regex announcement for IPv4. | ||
307 | */ | ||
308 | static struct GNUNET_REGEX_Announcement *regex6; | ||
309 | |||
310 | /** | ||
298 | * The handle to the configuration used throughout the process | 311 | * The handle to the configuration used throughout the process |
299 | */ | 312 | */ |
300 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 313 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -376,6 +389,11 @@ static struct TunnelState *tunnels[UINT16_MAX + 1]; | |||
376 | static struct GNUNET_DNSSTUB_Context *dnsstub; | 389 | static struct GNUNET_DNSSTUB_Context *dnsstub; |
377 | 390 | ||
378 | /** | 391 | /** |
392 | * Identity of this peer. | ||
393 | */ | ||
394 | static struct GNUNET_PeerIdentity my_identity; | ||
395 | |||
396 | /** | ||
379 | * Are we an IPv4-exit? | 397 | * Are we an IPv4-exit? |
380 | */ | 398 | */ |
381 | static int ipv4_exit; | 399 | static int ipv4_exit; |
@@ -3072,12 +3090,22 @@ cleanup (void *cls GNUNET_UNUSED, | |||
3072 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3090 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3073 | "Exit service is shutting down now\n"); | 3091 | "Exit service is shutting down now\n"); |
3074 | 3092 | ||
3075 | if (helper_handle != NULL) | 3093 | if (NULL != helper_handle) |
3076 | { | 3094 | { |
3077 | GNUNET_HELPER_stop (helper_handle, GNUNET_NO); | 3095 | GNUNET_HELPER_stop (helper_handle, GNUNET_NO); |
3078 | helper_handle = NULL; | 3096 | helper_handle = NULL; |
3079 | } | 3097 | } |
3080 | if (mesh_handle != NULL) | 3098 | if (NULL != regex4) |
3099 | { | ||
3100 | GNUNET_REGEX_announce_cancel (regex4); | ||
3101 | regex4 = NULL; | ||
3102 | } | ||
3103 | if (NULL != regex6) | ||
3104 | { | ||
3105 | GNUNET_REGEX_announce_cancel (regex6); | ||
3106 | regex6 = NULL; | ||
3107 | } | ||
3108 | if (NULL != mesh_handle) | ||
3081 | { | 3109 | { |
3082 | GNUNET_MESH_disconnect (mesh_handle); | 3110 | GNUNET_MESH_disconnect (mesh_handle); |
3083 | mesh_handle = NULL; | 3111 | mesh_handle = NULL; |
@@ -3541,6 +3569,14 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
3541 | 3569 | ||
3542 | connections_map = GNUNET_CONTAINER_multihashmap_create (65536, GNUNET_NO); | 3570 | connections_map = GNUNET_CONTAINER_multihashmap_create (65536, GNUNET_NO); |
3543 | connections_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 3571 | connections_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
3572 | if (GNUNET_OK != | ||
3573 | GNUNET_CRYPTO_get_host_identity (cfg, | ||
3574 | &my_identity)) | ||
3575 | { | ||
3576 | GNUNET_break (0); | ||
3577 | GNUNET_SCHEDULER_shutdown (); | ||
3578 | return; | ||
3579 | } | ||
3544 | mesh_handle | 3580 | mesh_handle |
3545 | = GNUNET_MESH_connect (cfg, NULL, | 3581 | = GNUNET_MESH_connect (cfg, NULL, |
3546 | &new_tunnel, | 3582 | &new_tunnel, |
@@ -3564,9 +3600,11 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
3564 | (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", | 3600 | (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", |
3565 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | 3601 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, |
3566 | "4", regex); | 3602 | "4", regex); |
3567 | GNUNET_MESH_announce_regex (mesh_handle, | 3603 | regex4 = GNUNET_REGEX_announce (cfg, |
3568 | prefixed_regex, | 3604 | &my_identity, |
3569 | REGEX_MAX_PATH_LEN_IPV4); | 3605 | prefixed_regex, |
3606 | REGEX_REFRESH_FREQUENCY, | ||
3607 | REGEX_MAX_PATH_LEN_IPV4); | ||
3570 | GNUNET_free (regex); | 3608 | GNUNET_free (regex); |
3571 | GNUNET_free (prefixed_regex); | 3609 | GNUNET_free (prefixed_regex); |
3572 | } | 3610 | } |
@@ -3582,9 +3620,11 @@ run (void *cls, char *const *args GNUNET_UNUSED, | |||
3582 | (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", | 3620 | (void) GNUNET_asprintf (&prefixed_regex, "%s%s%s", |
3583 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | 3621 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, |
3584 | "6", regex); | 3622 | "6", regex); |
3585 | GNUNET_MESH_announce_regex (mesh_handle, | 3623 | regex6 = GNUNET_REGEX_announce (cfg, |
3586 | prefixed_regex, | 3624 | &my_identity, |
3587 | REGEX_MAX_PATH_LEN_IPV6); | 3625 | prefixed_regex, |
3626 | REGEX_REFRESH_FREQUENCY, | ||
3627 | REGEX_MAX_PATH_LEN_IPV6); | ||
3588 | GNUNET_free (regex); | 3628 | GNUNET_free (regex); |
3589 | GNUNET_free (prefixed_regex); | 3629 | GNUNET_free (prefixed_regex); |
3590 | } | 3630 | } |