diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/nat/test_nat_mini.c | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/nat/test_nat_mini.c')
-rw-r--r-- | src/nat/test_nat_mini.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/nat/test_nat_mini.c b/src/nat/test_nat_mini.c index 09231d8ec..49c801571 100644 --- a/src/nat/test_nat_mini.c +++ b/src/nat/test_nat_mini.c | |||
@@ -35,31 +35,31 @@ | |||
35 | #include "gnunet_nat_lib.h" | 35 | #include "gnunet_nat_lib.h" |
36 | 36 | ||
37 | /* Time to wait before stopping NAT, in seconds */ | 37 | /* Time to wait before stopping NAT, in seconds */ |
38 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5) | 38 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Function called on each address that the NAT service | 41 | * Function called on each address that the NAT service |
42 | * believes to be valid for the transport. | 42 | * believes to be valid for the transport. |
43 | */ | 43 | */ |
44 | static void | 44 | static void |
45 | addr_callback(void *cls, int add_remove, | 45 | addr_callback (void *cls, int add_remove, |
46 | const struct sockaddr *addr, | 46 | const struct sockaddr *addr, |
47 | socklen_t addrlen, | 47 | socklen_t addrlen, |
48 | enum GNUNET_NAT_StatusCode ret) | 48 | enum GNUNET_NAT_StatusCode ret) |
49 | { | 49 | { |
50 | if (GNUNET_NAT_ERROR_SUCCESS == ret) | 50 | if (GNUNET_NAT_ERROR_SUCCESS == ret) |
51 | { | 51 | { |
52 | fprintf(stderr, | 52 | fprintf (stderr, |
53 | "Address changed: %s `%s' (%u bytes)\n", | 53 | "Address changed: %s `%s' (%u bytes)\n", |
54 | add_remove == GNUNET_YES | 54 | add_remove == GNUNET_YES |
55 | ? "added" : "removed", | 55 | ? "added" : "removed", |
56 | GNUNET_a2s(addr, | 56 | GNUNET_a2s (addr, |
57 | addrlen), | 57 | addrlen), |
58 | (unsigned int)addrlen); | 58 | (unsigned int) addrlen); |
59 | } | 59 | } |
60 | else | 60 | else |
61 | ; | 61 | ; |
62 | //TODO: proper error handling! | 62 | // TODO: proper error handling! |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
@@ -67,12 +67,12 @@ addr_callback(void *cls, int add_remove, | |||
67 | * Function that terminates the test. | 67 | * Function that terminates the test. |
68 | */ | 68 | */ |
69 | static void | 69 | static void |
70 | stop(void *cls) | 70 | stop (void *cls) |
71 | { | 71 | { |
72 | struct GNUNET_NAT_MiniHandle *mini = cls; | 72 | struct GNUNET_NAT_MiniHandle *mini = cls; |
73 | 73 | ||
74 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Stopping NAT and quitting...\n"); | 74 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stopping NAT and quitting...\n"); |
75 | GNUNET_NAT_mini_map_stop(mini); | 75 | GNUNET_NAT_mini_map_stop (mini); |
76 | } | 76 | } |
77 | 77 | ||
78 | #define PORT 10000 | 78 | #define PORT 10000 |
@@ -81,27 +81,27 @@ stop(void *cls) | |||
81 | * Main function run with scheduler. | 81 | * Main function run with scheduler. |
82 | */ | 82 | */ |
83 | static void | 83 | static void |
84 | run(void *cls, char *const *args, const char *cfgfile, | 84 | run (void *cls, char *const *args, const char *cfgfile, |
85 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 85 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
86 | { | 86 | { |
87 | struct GNUNET_NAT_MiniHandle *mini; | 87 | struct GNUNET_NAT_MiniHandle *mini; |
88 | 88 | ||
89 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 89 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
90 | "Requesting NAT redirection for port %u...\n", | 90 | "Requesting NAT redirection for port %u...\n", |
91 | PORT); | 91 | PORT); |
92 | mini = GNUNET_NAT_mini_map_start(PORT, GNUNET_YES /* tcp */, | 92 | mini = GNUNET_NAT_mini_map_start (PORT, GNUNET_YES /* tcp */, |
93 | &addr_callback, NULL); | 93 | &addr_callback, NULL); |
94 | if (NULL == mini) | 94 | if (NULL == mini) |
95 | { | 95 | { |
96 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Could not start UPnP interaction\n"); | 96 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Could not start UPnP interaction\n"); |
97 | return; | 97 | return; |
98 | } | 98 | } |
99 | GNUNET_SCHEDULER_add_delayed(TIMEOUT, &stop, mini); | 99 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &stop, mini); |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | int | 103 | int |
104 | main(int argc, char *const argv[]) | 104 | main (int argc, char *const argv[]) |
105 | { | 105 | { |
106 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 106 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
107 | GNUNET_GETOPT_OPTION_END | 107 | GNUNET_GETOPT_OPTION_END |
@@ -116,16 +116,16 @@ main(int argc, char *const argv[]) | |||
116 | NULL | 116 | NULL |
117 | }; | 117 | }; |
118 | 118 | ||
119 | GNUNET_log_setup("test-nat-mini", | 119 | GNUNET_log_setup ("test-nat-mini", |
120 | "WARNING", | 120 | "WARNING", |
121 | NULL); | 121 | NULL); |
122 | 122 | ||
123 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 123 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
124 | "UPnP test for NAT library, timeout set to %s\n", | 124 | "UPnP test for NAT library, timeout set to %s\n", |
125 | GNUNET_STRINGS_relative_time_to_string(TIMEOUT, | 125 | GNUNET_STRINGS_relative_time_to_string (TIMEOUT, |
126 | GNUNET_YES)); | 126 | GNUNET_YES)); |
127 | GNUNET_PROGRAM_run(5, argv_prog, "test-nat-mini", "nohelp", options, &run, | 127 | GNUNET_PROGRAM_run (5, argv_prog, "test-nat-mini", "nohelp", options, &run, |
128 | NULL); | 128 | NULL); |
129 | return 0; | 129 | return 0; |
130 | } | 130 | } |
131 | 131 | ||