diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-24 16:23:24 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-24 16:23:24 +0000 |
commit | 6b26c6b0babd2b0964875cad68c866639ea94936 (patch) | |
tree | 9595ee9346126752e3a40d19b247f05663ece102 /src | |
parent | b83e6007892be9c41d0752211ac79fe2c69ea3b7 (diff) | |
download | gnunet-6b26c6b0babd2b0964875cad68c866639ea94936.tar.gz gnunet-6b26c6b0babd2b0964875cad68c866639ea94936.zip |
API change for Safey/ARM
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_service_lib.h | 28 | ||||
-rw-r--r-- | src/util/service.c | 283 |
2 files changed, 193 insertions, 118 deletions
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h index 66e4f0cd9..c17af065f 100644 --- a/src/include/gnunet_service_lib.h +++ b/src/include/gnunet_service_lib.h | |||
@@ -38,6 +38,34 @@ extern "C" | |||
38 | #include "gnunet_configuration_lib.h" | 38 | #include "gnunet_configuration_lib.h" |
39 | #include "gnunet_server_lib.h" | 39 | #include "gnunet_server_lib.h" |
40 | 40 | ||
41 | |||
42 | /** | ||
43 | * Get the list of addresses that a server for the given service | ||
44 | * should bind to. | ||
45 | * | ||
46 | * @param serviceName name of the service | ||
47 | * @param cfg configuration (which specifies the addresses) | ||
48 | * @param addrs set (call by reference) to an array of pointers to the | ||
49 | * addresses the server should bind to and listen on; the | ||
50 | * array will be NULL-terminated (on success) | ||
51 | * @param addr_lens set (call by reference) to an array of the lengths | ||
52 | * of the respective 'struct sockaddr' struct in the 'addrs' | ||
53 | * array (on success) | ||
54 | * @return number of addresses found on success, | ||
55 | * GNUNET_SYSERR if the configuration | ||
56 | * did not specify reasonable finding information or | ||
57 | * if it specified a hostname that could not be resolved; | ||
58 | * GNUNET_NO if the number of addresses configured is | ||
59 | * zero (in this case, '*addrs' and '*addr_lens' will be | ||
60 | * set to NULL). | ||
61 | */ | ||
62 | int | ||
63 | GNUNET_SERVICE_get_server_addresses (const char *serviceName, | ||
64 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
65 | struct sockaddr ***addrs, | ||
66 | socklen_t **addr_lens); | ||
67 | |||
68 | |||
41 | /** | 69 | /** |
42 | * Function called by the service's run | 70 | * Function called by the service's run |
43 | * method to run service-specific setup code. | 71 | * method to run service-specific setup code. |
diff --git a/src/util/service.c b/src/util/service.c index 494384b20..b4e4a5528 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -740,87 +740,59 @@ process_acl6 (struct IPv6NetworkSet **ret, | |||
740 | 740 | ||
741 | 741 | ||
742 | /** | 742 | /** |
743 | * Setup addr, addrlen, maxbuf, idle_timeout | 743 | * Get the list of addresses that a server for the given service |
744 | * based on configuration! | 744 | * should bind to. |
745 | * | ||
746 | * Configuration must specify a "PORT". It may | ||
747 | * specify: | ||
748 | * - TIMEOUT (after how many ms does an inactive service timeout); | ||
749 | * - MAXBUF (maximum incoming message size supported) | ||
750 | * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) | ||
751 | * - ALLOW_SHUTDOWN (allow clients to shutdown this service) | ||
752 | * - BINDTO (hostname or IP address to bind to, otherwise we take everything) | ||
753 | * - ACCEPT_FROM (only allow connections from specified IPv4 subnets) | ||
754 | * - ACCEPT_FROM6 (only allow connections from specified IPv6 subnets) | ||
755 | * - REJECT_FROM (disallow allow connections from specified IPv4 subnets) | ||
756 | * - REJECT_FROM6 (disallow allow connections from specified IPv6 subnets) | ||
757 | * | 745 | * |
758 | * @return GNUNET_OK if configuration succeeded | 746 | * @param serviceName name of the service |
747 | * @param cfg configuration (which specifies the addresses) | ||
748 | * @param addrs set (call by reference) to an array of pointers to the | ||
749 | * addresses the server should bind to and listen on; the | ||
750 | * array will be NULL-terminated (on success) | ||
751 | * @param addr_lens set (call by reference) to an array of the lengths | ||
752 | * of the respective 'struct sockaddr' struct in the 'addrs' | ||
753 | * array (on success) | ||
754 | * @return number of addresses found on success, | ||
755 | * GNUNET_SYSERR if the configuration | ||
756 | * did not specify reasonable finding information or | ||
757 | * if it specified a hostname that could not be resolved; | ||
758 | * GNUNET_NO if the number of addresses configured is | ||
759 | * zero (in this case, '*addrs' and '*addr_lens' will be | ||
760 | * set to NULL). | ||
759 | */ | 761 | */ |
760 | static int | 762 | int |
761 | setup_service (struct GNUNET_SERVICE_Context *sctx) | 763 | GNUNET_SERVICE_get_server_addresses (const char *serviceName, |
764 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
765 | struct sockaddr ***addrs, | ||
766 | socklen_t **addr_lens) | ||
762 | { | 767 | { |
763 | unsigned long long maxbuf; | ||
764 | struct GNUNET_TIME_Relative idleout; | ||
765 | char *hostname; | ||
766 | unsigned long long port; | ||
767 | int disablev6; | 768 | int disablev6; |
769 | struct GNUNET_NETWORK_Handle *desc; | ||
770 | unsigned long long port; | ||
768 | struct addrinfo hints; | 771 | struct addrinfo hints; |
769 | struct addrinfo *res; | 772 | struct addrinfo *res; |
770 | struct addrinfo *pos; | 773 | struct addrinfo *pos; |
771 | struct addrinfo *next; | 774 | struct addrinfo *next; |
772 | int ret; | ||
773 | int tolerant; | ||
774 | unsigned int i; | 775 | unsigned int i; |
775 | struct GNUNET_NETWORK_Handle *desc; | 776 | int resi; |
776 | 777 | int ret; | |
777 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | 778 | struct sockaddr **saddrs; |
778 | sctx->serviceName, "TIMEOUT")) | 779 | socklen_t *saddrlens; |
779 | { | 780 | char *hostname; |
780 | if (GNUNET_OK != | ||
781 | GNUNET_CONFIGURATION_get_value_time (sctx->cfg, | ||
782 | sctx->serviceName, | ||
783 | "TIMEOUT", &idleout)) | ||
784 | return GNUNET_SYSERR; | ||
785 | 781 | ||
786 | sctx->timeout = idleout; | 782 | *addrs = NULL; |
787 | } | 783 | *addr_lens = NULL; |
788 | else | 784 | resi = 0; |
789 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 785 | if (GNUNET_CONFIGURATION_have_value (cfg, |
790 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | 786 | serviceName, "DISABLEV6")) |
791 | sctx->serviceName, "MAXBUF")) | ||
792 | { | ||
793 | if (GNUNET_OK != | ||
794 | GNUNET_CONFIGURATION_get_value_number (sctx->cfg, | ||
795 | sctx->serviceName, | ||
796 | "MAXBUF", &maxbuf)) | ||
797 | return GNUNET_SYSERR; | ||
798 | } | ||
799 | else | ||
800 | maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE; | ||
801 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
802 | sctx->serviceName, "DISABLEV6")) | ||
803 | { | 787 | { |
804 | if (GNUNET_SYSERR == | 788 | if (GNUNET_SYSERR == |
805 | (disablev6 = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, | 789 | (disablev6 = GNUNET_CONFIGURATION_get_value_yesno (cfg, |
806 | sctx-> | 790 | serviceName, |
807 | serviceName, | ||
808 | "DISABLEV6"))) | 791 | "DISABLEV6"))) |
809 | return GNUNET_SYSERR; | 792 | return GNUNET_SYSERR; |
810 | } | 793 | } |
811 | else | 794 | else |
812 | disablev6 = GNUNET_NO; | 795 | disablev6 = GNUNET_NO; |
813 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
814 | sctx->serviceName, "ALLOW_SHUTDOWN")) | ||
815 | { | ||
816 | if (GNUNET_SYSERR == | ||
817 | (sctx->allow_shutdown = | ||
818 | GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, sctx->serviceName, | ||
819 | "ALLOW_SHUTDOWN"))) | ||
820 | return GNUNET_SYSERR; | ||
821 | } | ||
822 | else | ||
823 | sctx->allow_shutdown = GNUNET_NO; | ||
824 | 796 | ||
825 | if (!disablev6) | 797 | if (!disablev6) |
826 | { | 798 | { |
@@ -837,7 +809,7 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
837 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 809 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
838 | _ | 810 | _ |
839 | ("Disabling IPv6 support for service `%s', failed to create IPv6 socket: %s\n"), | 811 | ("Disabling IPv6 support for service `%s', failed to create IPv6 socket: %s\n"), |
840 | sctx->serviceName, STRERROR (errno)); | 812 | serviceName, STRERROR (errno)); |
841 | disablev6 = GNUNET_YES; | 813 | disablev6 = GNUNET_YES; |
842 | } | 814 | } |
843 | else | 815 | else |
@@ -847,39 +819,24 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
847 | } | 819 | } |
848 | 820 | ||
849 | 821 | ||
850 | |||
851 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
852 | sctx->serviceName, "TOLERANT")) | ||
853 | { | ||
854 | if (GNUNET_SYSERR == | ||
855 | (tolerant = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, | ||
856 | sctx->serviceName, | ||
857 | "TOLERANT"))) | ||
858 | return GNUNET_SYSERR; | ||
859 | } | ||
860 | else | ||
861 | tolerant = GNUNET_NO; | ||
862 | sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES; | ||
863 | |||
864 | |||
865 | if ((GNUNET_OK != | 822 | if ((GNUNET_OK != |
866 | GNUNET_CONFIGURATION_get_value_number (sctx->cfg, | 823 | GNUNET_CONFIGURATION_get_value_number (cfg, |
867 | sctx->serviceName, | 824 | serviceName, |
868 | "PORT", | 825 | "PORT", |
869 | &port)) || (port > 65535)) | 826 | &port)) || (port > 65535)) |
870 | { | 827 | { |
871 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 828 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
872 | _ | 829 | _ |
873 | ("Require valid port number for service `%s' in configuration!\n"), | 830 | ("Require valid port number for service `%s' in configuration!\n"), |
874 | sctx->serviceName); | 831 | serviceName); |
875 | return GNUNET_SYSERR; | 832 | return GNUNET_SYSERR; |
876 | } | 833 | } |
877 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | 834 | if (GNUNET_CONFIGURATION_have_value (cfg, |
878 | sctx->serviceName, "BINDTO")) | 835 | serviceName, "BINDTO")) |
879 | { | 836 | { |
880 | GNUNET_break (GNUNET_OK == | 837 | GNUNET_break (GNUNET_OK == |
881 | GNUNET_CONFIGURATION_get_value_string (sctx->cfg, | 838 | GNUNET_CONFIGURATION_get_value_string (cfg, |
882 | sctx->serviceName, | 839 | serviceName, |
883 | "BINDTO", | 840 | "BINDTO", |
884 | &hostname)); | 841 | &hostname)); |
885 | } | 842 | } |
@@ -892,7 +849,7 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
892 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 849 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
893 | "Resolving `%s' since that is where `%s' will bind to.\n", | 850 | "Resolving `%s' since that is where `%s' will bind to.\n", |
894 | hostname, | 851 | hostname, |
895 | sctx->serviceName); | 852 | serviceName); |
896 | #endif | 853 | #endif |
897 | memset (&hints, 0, sizeof (struct addrinfo)); | 854 | memset (&hints, 0, sizeof (struct addrinfo)); |
898 | if (disablev6) | 855 | if (disablev6) |
@@ -924,8 +881,9 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
924 | GNUNET_free (hostname); | 881 | GNUNET_free (hostname); |
925 | return GNUNET_SYSERR; | 882 | return GNUNET_SYSERR; |
926 | } | 883 | } |
927 | sctx->addrs = GNUNET_malloc ((i+1) * sizeof(struct sockaddr*)); | 884 | resi = i; |
928 | sctx->addrlens = GNUNET_malloc ((i+1) * sizeof (socklen_t)); | 885 | saddrs = GNUNET_malloc ((i+1) * sizeof(struct sockaddr*)); |
886 | saddrlens = GNUNET_malloc ((i+1) * sizeof (socklen_t)); | ||
929 | i = 0; | 887 | i = 0; |
930 | next = res; | 888 | next = res; |
931 | while (NULL != (pos = next)) | 889 | while (NULL != (pos = next)) |
@@ -936,26 +894,26 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
936 | #if DEBUG_SERVICE | 894 | #if DEBUG_SERVICE |
937 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 895 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
938 | "Service `%s' will bind to `%s'\n", | 896 | "Service `%s' will bind to `%s'\n", |
939 | sctx->serviceName, | 897 | serviceName, |
940 | GNUNET_a2s (pos->ai_addr, | 898 | GNUNET_a2s (pos->ai_addr, |
941 | pos->ai_addrlen)); | 899 | pos->ai_addrlen)); |
942 | #endif | 900 | #endif |
943 | if (pos->ai_family == AF_INET) | 901 | if (pos->ai_family == AF_INET) |
944 | { | 902 | { |
945 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); | 903 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); |
946 | sctx->addrlens[i] = pos->ai_addrlen; | 904 | saddrlens[i] = pos->ai_addrlen; |
947 | sctx->addrs[i] = GNUNET_malloc (sctx->addrlens[i]); | 905 | saddrs[i] = GNUNET_malloc (saddrlens[i]); |
948 | memcpy (sctx->addrs[i], pos->ai_addr, sctx->addrlens[i]); | 906 | memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); |
949 | ((struct sockaddr_in *) sctx->addrs[i])->sin_port = htons (port); | 907 | ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port); |
950 | } | 908 | } |
951 | else | 909 | else |
952 | { | 910 | { |
953 | GNUNET_assert (pos->ai_family == AF_INET6); | 911 | GNUNET_assert (pos->ai_family == AF_INET6); |
954 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in6)); | 912 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in6)); |
955 | sctx->addrlens[i] = pos->ai_addrlen; | 913 | saddrlens[i] = pos->ai_addrlen; |
956 | sctx->addrs[i] = GNUNET_malloc (sctx->addrlens[i]); | 914 | saddrs[i] = GNUNET_malloc (saddrlens[i]); |
957 | memcpy (sctx->addrs[i], pos->ai_addr, sctx->addrlens[i]); | 915 | memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); |
958 | ((struct sockaddr_in6 *) sctx->addrs[i])->sin6_port = htons (port); | 916 | ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port); |
959 | } | 917 | } |
960 | i++; | 918 | i++; |
961 | } | 919 | } |
@@ -968,40 +926,129 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
968 | if (disablev6) | 926 | if (disablev6) |
969 | { | 927 | { |
970 | /* V4-only */ | 928 | /* V4-only */ |
971 | sctx->addrs = GNUNET_malloc (2 * sizeof(struct sockaddr*)); | 929 | resi = 1; |
972 | sctx->addrlens = GNUNET_malloc (2 * sizeof (socklen_t)); | 930 | saddrs = GNUNET_malloc (2 * sizeof(struct sockaddr*)); |
973 | sctx->addrlens[0] = sizeof (struct sockaddr_in); | 931 | saddrlens = GNUNET_malloc (2 * sizeof (socklen_t)); |
974 | sctx->addrs[0] = GNUNET_malloc (sctx->addrlens[0]); | 932 | saddrlens[0] = sizeof (struct sockaddr_in); |
933 | saddrs[0] = GNUNET_malloc (saddrlens[0]); | ||
975 | #if HAVE_SOCKADDR_IN_SIN_LEN | 934 | #if HAVE_SOCKADDR_IN_SIN_LEN |
976 | ((struct sockaddr_in *) sctx->addrs[0])->sin_len = sctx->addrlens[0]; | 935 | ((struct sockaddr_in *) saddrs[0])->sin_len = saddrlens[0]; |
977 | #endif | 936 | #endif |
978 | ((struct sockaddr_in *) sctx->addrs[0])->sin_family = AF_INET; | 937 | ((struct sockaddr_in *) saddrs[0])->sin_family = AF_INET; |
979 | ((struct sockaddr_in *) sctx->addrs[0])->sin_port = htons (port); | 938 | ((struct sockaddr_in *) saddrs[0])->sin_port = htons (port); |
980 | } | 939 | } |
981 | else | 940 | else |
982 | { | 941 | { |
983 | /* dual stack */ | 942 | /* dual stack */ |
984 | sctx->addrs = GNUNET_malloc (3 * sizeof(struct sockaddr*)); | 943 | resi = 2; |
985 | sctx->addrlens = GNUNET_malloc (3 * sizeof (socklen_t)); | 944 | saddrs = GNUNET_malloc (3 * sizeof(struct sockaddr*)); |
945 | saddrlens = GNUNET_malloc (3 * sizeof (socklen_t)); | ||
986 | 946 | ||
987 | sctx->addrlens[0] = sizeof (struct sockaddr_in6); | 947 | saddrlens[0] = sizeof (struct sockaddr_in6); |
988 | sctx->addrs[0] = GNUNET_malloc (sctx->addrlens[0]); | 948 | saddrs[0] = GNUNET_malloc (saddrlens[0]); |
989 | #if HAVE_SOCKADDR_IN_SIN_LEN | 949 | #if HAVE_SOCKADDR_IN_SIN_LEN |
990 | ((struct sockaddr_in6 *) sctx->addrs[0])->sin6_len = sctx->addrlens[0]; | 950 | ((struct sockaddr_in6 *) saddrs[0])->sin6_len = saddrlens[0]; |
991 | #endif | 951 | #endif |
992 | ((struct sockaddr_in6 *) sctx->addrs[0])->sin6_family = AF_INET6; | 952 | ((struct sockaddr_in6 *) saddrs[0])->sin6_family = AF_INET6; |
993 | ((struct sockaddr_in6 *) sctx->addrs[0])->sin6_port = htons (port); | 953 | ((struct sockaddr_in6 *) saddrs[0])->sin6_port = htons (port); |
994 | 954 | ||
995 | sctx->addrlens[1] = sizeof (struct sockaddr_in); | 955 | saddrlens[1] = sizeof (struct sockaddr_in); |
996 | sctx->addrs[1] = GNUNET_malloc (sctx->addrlens[1]); | 956 | saddrs[1] = GNUNET_malloc (saddrlens[1]); |
997 | #if HAVE_SOCKADDR_IN_SIN_LEN | 957 | #if HAVE_SOCKADDR_IN_SIN_LEN |
998 | ((struct sockaddr_in *) sctx->addrs[1])->sin_len = sctx->addrlens[1]; | 958 | ((struct sockaddr_in *) saddrs[1])->sin_len = saddrlens[1]; |
999 | #endif | 959 | #endif |
1000 | ((struct sockaddr_in *) sctx->addrs[1])->sin_family = AF_INET; | 960 | ((struct sockaddr_in *) saddrs[1])->sin_family = AF_INET; |
1001 | ((struct sockaddr_in *) sctx->addrs[1])->sin_port = htons (port); | 961 | ((struct sockaddr_in *) saddrs[1])->sin_port = htons (port); |
1002 | 962 | ||
1003 | } | 963 | } |
1004 | } | 964 | } |
965 | *addrs = saddrs; | ||
966 | *addr_lens = saddrlens; | ||
967 | return resi; | ||
968 | } | ||
969 | |||
970 | |||
971 | /** | ||
972 | * Setup addr, addrlen, maxbuf, idle_timeout | ||
973 | * based on configuration! | ||
974 | * | ||
975 | * Configuration must specify a "PORT". It may | ||
976 | * specify: | ||
977 | * - TIMEOUT (after how many ms does an inactive service timeout); | ||
978 | * - MAXBUF (maximum incoming message size supported) | ||
979 | * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) | ||
980 | * - ALLOW_SHUTDOWN (allow clients to shutdown this service) | ||
981 | * - BINDTO (hostname or IP address to bind to, otherwise we take everything) | ||
982 | * - ACCEPT_FROM (only allow connections from specified IPv4 subnets) | ||
983 | * - ACCEPT_FROM6 (only allow connections from specified IPv6 subnets) | ||
984 | * - REJECT_FROM (disallow allow connections from specified IPv4 subnets) | ||
985 | * - REJECT_FROM6 (disallow allow connections from specified IPv6 subnets) | ||
986 | * | ||
987 | * @return GNUNET_OK if configuration succeeded | ||
988 | */ | ||
989 | static int | ||
990 | setup_service (struct GNUNET_SERVICE_Context *sctx) | ||
991 | { | ||
992 | unsigned long long maxbuf; | ||
993 | struct GNUNET_TIME_Relative idleout; | ||
994 | int tolerant; | ||
995 | |||
996 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
997 | sctx->serviceName, "TIMEOUT")) | ||
998 | { | ||
999 | if (GNUNET_OK != | ||
1000 | GNUNET_CONFIGURATION_get_value_time (sctx->cfg, | ||
1001 | sctx->serviceName, | ||
1002 | "TIMEOUT", &idleout)) | ||
1003 | return GNUNET_SYSERR; | ||
1004 | |||
1005 | sctx->timeout = idleout; | ||
1006 | } | ||
1007 | else | ||
1008 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | ||
1009 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
1010 | sctx->serviceName, "MAXBUF")) | ||
1011 | { | ||
1012 | if (GNUNET_OK != | ||
1013 | GNUNET_CONFIGURATION_get_value_number (sctx->cfg, | ||
1014 | sctx->serviceName, | ||
1015 | "MAXBUF", &maxbuf)) | ||
1016 | return GNUNET_SYSERR; | ||
1017 | } | ||
1018 | else | ||
1019 | maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE; | ||
1020 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
1021 | sctx->serviceName, "ALLOW_SHUTDOWN")) | ||
1022 | { | ||
1023 | if (GNUNET_SYSERR == | ||
1024 | (sctx->allow_shutdown = | ||
1025 | GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, sctx->serviceName, | ||
1026 | "ALLOW_SHUTDOWN"))) | ||
1027 | return GNUNET_SYSERR; | ||
1028 | } | ||
1029 | else | ||
1030 | sctx->allow_shutdown = GNUNET_NO; | ||
1031 | |||
1032 | |||
1033 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
1034 | sctx->serviceName, "TOLERANT")) | ||
1035 | { | ||
1036 | if (GNUNET_SYSERR == | ||
1037 | (tolerant = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, | ||
1038 | sctx->serviceName, | ||
1039 | "TOLERANT"))) | ||
1040 | return GNUNET_SYSERR; | ||
1041 | } | ||
1042 | else | ||
1043 | tolerant = GNUNET_NO; | ||
1044 | |||
1045 | if (GNUNET_SYSERR == | ||
1046 | GNUNET_SERVICE_get_server_addresses (sctx->serviceName, | ||
1047 | sctx->cfg, | ||
1048 | &sctx->addrs, | ||
1049 | &sctx->addrlens)) | ||
1050 | return GNUNET_SYSERR; | ||
1051 | sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES; | ||
1005 | sctx->maxbuf = (size_t) maxbuf; | 1052 | sctx->maxbuf = (size_t) maxbuf; |
1006 | if (sctx->maxbuf != maxbuf) | 1053 | if (sctx->maxbuf != maxbuf) |
1007 | { | 1054 | { |