diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-17 18:13:55 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-17 18:13:55 +0100 |
commit | 17d34d5e094c2f8a90717b07e3a711d6e2c15903 (patch) | |
tree | 777b5323145a5f4d1f044da29a682799008a11d4 /src/transport/tcp_service_legacy.c | |
parent | 3391977e3f92a2ebcafc14ea6374aecd580df873 (diff) | |
download | gnunet-17d34d5e094c2f8a90717b07e3a711d6e2c15903.tar.gz gnunet-17d34d5e094c2f8a90717b07e3a711d6e2c15903.zip |
more renamings relating to 'new' service now just being the 'normal' service
Diffstat (limited to 'src/transport/tcp_service_legacy.c')
-rw-r--r-- | src/transport/tcp_service_legacy.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/transport/tcp_service_legacy.c b/src/transport/tcp_service_legacy.c index 050a38acc..7c2d3e55a 100644 --- a/src/transport/tcp_service_legacy.c +++ b/src/transport/tcp_service_legacy.c | |||
@@ -105,7 +105,7 @@ NEXT: | |||
105 | /** | 105 | /** |
106 | * Context for "service_task". | 106 | * Context for "service_task". |
107 | */ | 107 | */ |
108 | struct GNUNET_SERVICE_Context | 108 | struct LEGACY_SERVICE_Context |
109 | { | 109 | { |
110 | /** | 110 | /** |
111 | * Our configuration. | 111 | * Our configuration. |
@@ -131,7 +131,7 @@ struct GNUNET_SERVICE_Context | |||
131 | /** | 131 | /** |
132 | * Main service-specific task to run. | 132 | * Main service-specific task to run. |
133 | */ | 133 | */ |
134 | GNUNET_SERVICE_Main task; | 134 | LEGACY_SERVICE_Main task; |
135 | 135 | ||
136 | /** | 136 | /** |
137 | * Closure for @e task. | 137 | * Closure for @e task. |
@@ -223,7 +223,7 @@ struct GNUNET_SERVICE_Context | |||
223 | /** | 223 | /** |
224 | * Our options. | 224 | * Our options. |
225 | */ | 225 | */ |
226 | enum GNUNET_SERVICE_Options options; | 226 | enum LEGACY_SERVICE_Options options; |
227 | 227 | ||
228 | }; | 228 | }; |
229 | 229 | ||
@@ -307,7 +307,7 @@ static int | |||
307 | check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc, | 307 | check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc, |
308 | const struct sockaddr *addr, socklen_t addrlen) | 308 | const struct sockaddr *addr, socklen_t addrlen) |
309 | { | 309 | { |
310 | struct GNUNET_SERVICE_Context *sctx = cls; | 310 | struct LEGACY_SERVICE_Context *sctx = cls; |
311 | const struct sockaddr_in *i4; | 311 | const struct sockaddr_in *i4; |
312 | const struct sockaddr_in6 *i6; | 312 | const struct sockaddr_in6 *i6; |
313 | int ret; | 313 | int ret; |
@@ -359,7 +359,7 @@ check_access (void *cls, const struct GNUNET_CONNECTION_Credentials *uc, | |||
359 | * @return name of the file for the process ID | 359 | * @return name of the file for the process ID |
360 | */ | 360 | */ |
361 | static char * | 361 | static char * |
362 | get_pid_file_name (struct GNUNET_SERVICE_Context *sctx) | 362 | get_pid_file_name (struct LEGACY_SERVICE_Context *sctx) |
363 | { | 363 | { |
364 | char *pif; | 364 | char *pif; |
365 | 365 | ||
@@ -382,7 +382,7 @@ get_pid_file_name (struct GNUNET_SERVICE_Context *sctx) | |||
382 | */ | 382 | */ |
383 | static int | 383 | static int |
384 | process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret, | 384 | process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret, |
385 | struct GNUNET_SERVICE_Context *sctx, | 385 | struct LEGACY_SERVICE_Context *sctx, |
386 | const char *option) | 386 | const char *option) |
387 | { | 387 | { |
388 | char *opt; | 388 | char *opt; |
@@ -420,7 +420,7 @@ process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret, | |||
420 | */ | 420 | */ |
421 | static int | 421 | static int |
422 | process_acl6 (struct GNUNET_STRINGS_IPv6NetworkPolicy **ret, | 422 | process_acl6 (struct GNUNET_STRINGS_IPv6NetworkPolicy **ret, |
423 | struct GNUNET_SERVICE_Context *sctx, | 423 | struct LEGACY_SERVICE_Context *sctx, |
424 | const char *option) | 424 | const char *option) |
425 | { | 425 | { |
426 | char *opt; | 426 | char *opt; |
@@ -507,7 +507,7 @@ add_unixpath (struct sockaddr **saddrs, | |||
507 | * set to NULL). | 507 | * set to NULL). |
508 | */ | 508 | */ |
509 | int | 509 | int |
510 | GNUNET_SERVICE_get_server_addresses (const char *service_name, | 510 | LEGACY_SERVICE_get_server_addresses (const char *service_name, |
511 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 511 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
512 | struct sockaddr ***addrs, | 512 | struct sockaddr ***addrs, |
513 | socklen_t ** addr_lens) | 513 | socklen_t ** addr_lens) |
@@ -838,7 +838,7 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name, | |||
838 | * and #GNUNET_SYSERR on error. | 838 | * and #GNUNET_SYSERR on error. |
839 | */ | 839 | */ |
840 | static int | 840 | static int |
841 | receive_sockets_from_parent (struct GNUNET_SERVICE_Context *sctx) | 841 | receive_sockets_from_parent (struct LEGACY_SERVICE_Context *sctx) |
842 | { | 842 | { |
843 | const char *env_buf; | 843 | const char *env_buf; |
844 | int fail; | 844 | int fail; |
@@ -932,7 +932,7 @@ receive_sockets_from_parent (struct GNUNET_SERVICE_Context *sctx) | |||
932 | * @return #GNUNET_OK if configuration succeeded | 932 | * @return #GNUNET_OK if configuration succeeded |
933 | */ | 933 | */ |
934 | static int | 934 | static int |
935 | setup_service (struct GNUNET_SERVICE_Context *sctx) | 935 | setup_service (struct LEGACY_SERVICE_Context *sctx) |
936 | { | 936 | { |
937 | struct GNUNET_TIME_Relative idleout; | 937 | struct GNUNET_TIME_Relative idleout; |
938 | int tolerant; | 938 | int tolerant; |
@@ -1015,7 +1015,7 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
1015 | 1015 | ||
1016 | if ((NULL == sctx->lsocks) && | 1016 | if ((NULL == sctx->lsocks) && |
1017 | (GNUNET_SYSERR == | 1017 | (GNUNET_SYSERR == |
1018 | GNUNET_SERVICE_get_server_addresses (sctx->service_name, sctx->cfg, | 1018 | LEGACY_SERVICE_get_server_addresses (sctx->service_name, sctx->cfg, |
1019 | &sctx->addrs, &sctx->addrlens))) | 1019 | &sctx->addrs, &sctx->addrlens))) |
1020 | return GNUNET_SYSERR; | 1020 | return GNUNET_SYSERR; |
1021 | sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES; | 1021 | sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES; |
@@ -1042,7 +1042,7 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
1042 | * @return value of the 'USERNAME' option | 1042 | * @return value of the 'USERNAME' option |
1043 | */ | 1043 | */ |
1044 | static char * | 1044 | static char * |
1045 | get_user_name (struct GNUNET_SERVICE_Context *sctx) | 1045 | get_user_name (struct LEGACY_SERVICE_Context *sctx) |
1046 | { | 1046 | { |
1047 | char *un; | 1047 | char *un; |
1048 | 1048 | ||
@@ -1062,7 +1062,7 @@ get_user_name (struct GNUNET_SERVICE_Context *sctx) | |||
1062 | * @return #GNUNET_OK on success (including no work to be done) | 1062 | * @return #GNUNET_OK on success (including no work to be done) |
1063 | */ | 1063 | */ |
1064 | static int | 1064 | static int |
1065 | write_pid_file (struct GNUNET_SERVICE_Context *sctx, pid_t pid) | 1065 | write_pid_file (struct LEGACY_SERVICE_Context *sctx, pid_t pid) |
1066 | { | 1066 | { |
1067 | FILE *pidfd; | 1067 | FILE *pidfd; |
1068 | char *pif; | 1068 | char *pif; |
@@ -1117,16 +1117,16 @@ write_pid_file (struct GNUNET_SERVICE_Context *sctx, pid_t pid) | |||
1117 | /** | 1117 | /** |
1118 | * Task run during shutdown. Stops the server/service. | 1118 | * Task run during shutdown. Stops the server/service. |
1119 | * | 1119 | * |
1120 | * @param cls the `struct GNUNET_SERVICE_Context` | 1120 | * @param cls the `struct LEGACY_SERVICE_Context` |
1121 | */ | 1121 | */ |
1122 | static void | 1122 | static void |
1123 | shutdown_task (void *cls) | 1123 | shutdown_task (void *cls) |
1124 | { | 1124 | { |
1125 | struct GNUNET_SERVICE_Context *service = cls; | 1125 | struct LEGACY_SERVICE_Context *service = cls; |
1126 | struct GNUNET_SERVER_Handle *server = service->server; | 1126 | struct GNUNET_SERVER_Handle *server = service->server; |
1127 | 1127 | ||
1128 | service->shutdown_task = NULL; | 1128 | service->shutdown_task = NULL; |
1129 | if (0 != (service->options & GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN)) | 1129 | if (0 != (service->options & LEGACY_SERVICE_OPTION_SOFT_SHUTDOWN)) |
1130 | GNUNET_SERVER_stop_listening (server); | 1130 | GNUNET_SERVER_stop_listening (server); |
1131 | else | 1131 | else |
1132 | GNUNET_SERVER_destroy (server); | 1132 | GNUNET_SERVER_destroy (server); |
@@ -1141,7 +1141,7 @@ shutdown_task (void *cls) | |||
1141 | static void | 1141 | static void |
1142 | service_task (void *cls) | 1142 | service_task (void *cls) |
1143 | { | 1143 | { |
1144 | struct GNUNET_SERVICE_Context *sctx = cls; | 1144 | struct LEGACY_SERVICE_Context *sctx = cls; |
1145 | unsigned int i; | 1145 | unsigned int i; |
1146 | 1146 | ||
1147 | GNUNET_RESOLVER_connect (sctx->cfg); | 1147 | GNUNET_RESOLVER_connect (sctx->cfg); |
@@ -1174,7 +1174,7 @@ service_task (void *cls) | |||
1174 | #endif | 1174 | #endif |
1175 | 1175 | ||
1176 | 1176 | ||
1177 | if (0 == (sctx->options & GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN)) | 1177 | if (0 == (sctx->options & LEGACY_SERVICE_OPTION_MANUAL_SHUTDOWN)) |
1178 | { | 1178 | { |
1179 | /* install a task that will kill the server | 1179 | /* install a task that will kill the server |
1180 | * process if the scheduler ever gets a shutdown signal */ | 1180 | * process if the scheduler ever gets a shutdown signal */ |
@@ -1215,7 +1215,7 @@ service_task (void *cls) | |||
1215 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 1215 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
1216 | */ | 1216 | */ |
1217 | static int | 1217 | static int |
1218 | detach_terminal (struct GNUNET_SERVICE_Context *sctx) | 1218 | detach_terminal (struct LEGACY_SERVICE_Context *sctx) |
1219 | { | 1219 | { |
1220 | #ifndef MINGW | 1220 | #ifndef MINGW |
1221 | pid_t pid; | 1221 | pid_t pid; |
@@ -1296,7 +1296,7 @@ detach_terminal (struct GNUNET_SERVICE_Context *sctx) | |||
1296 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 1296 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
1297 | */ | 1297 | */ |
1298 | static int | 1298 | static int |
1299 | set_user_id (struct GNUNET_SERVICE_Context *sctx) | 1299 | set_user_id (struct LEGACY_SERVICE_Context *sctx) |
1300 | { | 1300 | { |
1301 | char *user; | 1301 | char *user; |
1302 | 1302 | ||
@@ -1342,7 +1342,7 @@ set_user_id (struct GNUNET_SERVICE_Context *sctx) | |||
1342 | * @param sctx service context | 1342 | * @param sctx service context |
1343 | */ | 1343 | */ |
1344 | static void | 1344 | static void |
1345 | pid_file_delete (struct GNUNET_SERVICE_Context *sctx) | 1345 | pid_file_delete (struct LEGACY_SERVICE_Context *sctx) |
1346 | { | 1346 | { |
1347 | char *pif = get_pid_file_name (sctx); | 1347 | char *pif = get_pid_file_name (sctx); |
1348 | 1348 | ||
@@ -1368,10 +1368,10 @@ pid_file_delete (struct GNUNET_SERVICE_Context *sctx) | |||
1368 | * if we shutdown nicely | 1368 | * if we shutdown nicely |
1369 | */ | 1369 | */ |
1370 | int | 1370 | int |
1371 | GNUNET_SERVICE_run (int argc, char *const *argv, | 1371 | LEGACY_SERVICE_run (int argc, char *const *argv, |
1372 | const char *service_name, | 1372 | const char *service_name, |
1373 | enum GNUNET_SERVICE_Options options, | 1373 | enum LEGACY_SERVICE_Options options, |
1374 | GNUNET_SERVICE_Main task, | 1374 | LEGACY_SERVICE_Main task, |
1375 | void *task_cls) | 1375 | void *task_cls) |
1376 | { | 1376 | { |
1377 | #define HANDLE_ERROR do { GNUNET_break (0); goto shutdown; } while (0) | 1377 | #define HANDLE_ERROR do { GNUNET_break (0); goto shutdown; } while (0) |
@@ -1387,7 +1387,7 @@ GNUNET_SERVICE_run (int argc, char *const *argv, | |||
1387 | unsigned long long skew_offset; | 1387 | unsigned long long skew_offset; |
1388 | unsigned long long skew_variance; | 1388 | unsigned long long skew_variance; |
1389 | long long clock_offset; | 1389 | long long clock_offset; |
1390 | struct GNUNET_SERVICE_Context sctx; | 1390 | struct LEGACY_SERVICE_Context sctx; |
1391 | struct GNUNET_CONFIGURATION_Handle *cfg; | 1391 | struct GNUNET_CONFIGURATION_Handle *cfg; |
1392 | const char *xdg; | 1392 | const char *xdg; |
1393 | 1393 | ||
@@ -1548,15 +1548,15 @@ shutdown: | |||
1548 | * @param options service options | 1548 | * @param options service options |
1549 | * @return NULL on error, service handle | 1549 | * @return NULL on error, service handle |
1550 | */ | 1550 | */ |
1551 | struct GNUNET_SERVICE_Context * | 1551 | struct LEGACY_SERVICE_Context * |
1552 | GNUNET_SERVICE_start (const char *service_name, | 1552 | LEGACY_SERVICE_start (const char *service_name, |
1553 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 1553 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
1554 | enum GNUNET_SERVICE_Options options) | 1554 | enum LEGACY_SERVICE_Options options) |
1555 | { | 1555 | { |
1556 | int i; | 1556 | int i; |
1557 | struct GNUNET_SERVICE_Context *sctx; | 1557 | struct LEGACY_SERVICE_Context *sctx; |
1558 | 1558 | ||
1559 | sctx = GNUNET_new (struct GNUNET_SERVICE_Context); | 1559 | sctx = GNUNET_new (struct LEGACY_SERVICE_Context); |
1560 | sctx->ready_confirm_fd = -1; /* no daemonizing */ | 1560 | sctx->ready_confirm_fd = -1; /* no daemonizing */ |
1561 | sctx->ret = GNUNET_OK; | 1561 | sctx->ret = GNUNET_OK; |
1562 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1562 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -1567,7 +1567,7 @@ GNUNET_SERVICE_start (const char *service_name, | |||
1567 | /* setup subsystems */ | 1567 | /* setup subsystems */ |
1568 | if (GNUNET_OK != setup_service (sctx)) | 1568 | if (GNUNET_OK != setup_service (sctx)) |
1569 | { | 1569 | { |
1570 | GNUNET_SERVICE_stop (sctx); | 1570 | LEGACY_SERVICE_stop (sctx); |
1571 | return NULL; | 1571 | return NULL; |
1572 | } | 1572 | } |
1573 | if (NULL != sctx->lsocks) | 1573 | if (NULL != sctx->lsocks) |
@@ -1581,7 +1581,7 @@ GNUNET_SERVICE_start (const char *service_name, | |||
1581 | 1581 | ||
1582 | if (NULL == sctx->server) | 1582 | if (NULL == sctx->server) |
1583 | { | 1583 | { |
1584 | GNUNET_SERVICE_stop (sctx); | 1584 | LEGACY_SERVICE_stop (sctx); |
1585 | return NULL; | 1585 | return NULL; |
1586 | } | 1586 | } |
1587 | #ifndef WINDOWS | 1587 | #ifndef WINDOWS |
@@ -1611,7 +1611,7 @@ GNUNET_SERVICE_start (const char *service_name, | |||
1611 | * @return handle to the server for this service, NULL if there is none | 1611 | * @return handle to the server for this service, NULL if there is none |
1612 | */ | 1612 | */ |
1613 | struct GNUNET_SERVER_Handle * | 1613 | struct GNUNET_SERVER_Handle * |
1614 | GNUNET_SERVICE_get_server (struct GNUNET_SERVICE_Context *ctx) | 1614 | LEGACY_SERVICE_get_server (struct LEGACY_SERVICE_Context *ctx) |
1615 | { | 1615 | { |
1616 | return ctx->server; | 1616 | return ctx->server; |
1617 | } | 1617 | } |
@@ -1625,19 +1625,19 @@ GNUNET_SERVICE_get_server (struct GNUNET_SERVICE_Context *ctx) | |||
1625 | * array of listen sockets. | 1625 | * array of listen sockets. |
1626 | */ | 1626 | */ |
1627 | struct GNUNET_NETWORK_Handle *const* | 1627 | struct GNUNET_NETWORK_Handle *const* |
1628 | GNUNET_SERVICE_get_listen_sockets (struct GNUNET_SERVICE_Context *ctx) | 1628 | LEGACY_SERVICE_get_listen_sockets (struct LEGACY_SERVICE_Context *ctx) |
1629 | { | 1629 | { |
1630 | return ctx->lsocks; | 1630 | return ctx->lsocks; |
1631 | } | 1631 | } |
1632 | 1632 | ||
1633 | 1633 | ||
1634 | /** | 1634 | /** |
1635 | * Stop a service that was started with "GNUNET_SERVICE_start". | 1635 | * Stop a service that was started with "LEGACY_SERVICE_start". |
1636 | * | 1636 | * |
1637 | * @param sctx the service context returned from the start function | 1637 | * @param sctx the service context returned from the start function |
1638 | */ | 1638 | */ |
1639 | void | 1639 | void |
1640 | GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx) | 1640 | LEGACY_SERVICE_stop (struct LEGACY_SERVICE_Context *sctx) |
1641 | { | 1641 | { |
1642 | unsigned int i; | 1642 | unsigned int i; |
1643 | 1643 | ||