diff options
author | t3sserakt <t3ss@posteo.de> | 2021-09-20 09:00:09 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-09-20 09:00:09 +0200 |
commit | d5df403e64bbde52c5436165eee5231a1b2f876b (patch) | |
tree | 3a4efc07dc5d2576a9f6656de58764aa9840d856 /src/testing/testing.c | |
parent | 9bdaa1f9b21b324963fe0f41311ae6d9c0948946 (diff) | |
download | gnunet-d5df403e64bbde52c5436165eee5231a1b2f876b.tar.gz gnunet-d5df403e64bbde52c5436165eee5231a1b2f876b.zip |
- added new udp backchannel testcase, changed netjail script to have port forwarding into subnets, master loop is no configured completely by topology config file, connect cmd reads topology file to connect to configured nodes
Diffstat (limited to 'src/testing/testing.c')
-rw-r--r-- | src/testing/testing.c | 229 |
1 files changed, 179 insertions, 50 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c index fcde39901..a11d404a5 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -1789,7 +1789,7 @@ get_first_value (char *line) | |||
1789 | token = strtok_r (copy, ":", &rest); | 1789 | token = strtok_r (copy, ":", &rest); |
1790 | token = strtok_r (NULL, ":", &rest); | 1790 | token = strtok_r (NULL, ":", &rest); |
1791 | sscanf (token, "%u", &ret); | 1791 | sscanf (token, "%u", &ret); |
1792 | free (copy); | 1792 | GNUNET_free (copy); |
1793 | return ret; | 1793 | return ret; |
1794 | } | 1794 | } |
1795 | 1795 | ||
@@ -1809,7 +1809,7 @@ get_key (char *line) | |||
1809 | token = strtok_r (copy, ":", &rest); | 1809 | token = strtok_r (copy, ":", &rest); |
1810 | ret = malloc (2); | 1810 | ret = malloc (2); |
1811 | memcpy (ret, token, 2); | 1811 | memcpy (ret, token, 2); |
1812 | free (copy); | 1812 | GNUNET_free (copy); |
1813 | return ret; | 1813 | return ret; |
1814 | } | 1814 | } |
1815 | 1815 | ||
@@ -1828,13 +1828,13 @@ get_first_string_value (char *line) | |||
1828 | memcpy (copy, line, slen); | 1828 | memcpy (copy, line, slen); |
1829 | token = strtok_r (copy, ":", &rest); | 1829 | token = strtok_r (copy, ":", &rest); |
1830 | token = strtok_r (NULL, ":", &rest); | 1830 | token = strtok_r (NULL, ":", &rest); |
1831 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1831 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1832 | "first token %s\n", | 1832 | "first token %s\n", |
1833 | token); | 1833 | token); |
1834 | slen_token = strlen (token); | 1834 | slen_token = strlen (token); |
1835 | ret = malloc (slen_token + 1); | 1835 | ret = malloc (slen_token + 1); |
1836 | memcpy (ret, token, slen_token + 1); | 1836 | memcpy (ret, token, slen_token + 1); |
1837 | free (copy); | 1837 | GNUNET_free (copy); |
1838 | return ret; | 1838 | return ret; |
1839 | } | 1839 | } |
1840 | 1840 | ||
@@ -1855,7 +1855,7 @@ get_second_value (char *line) | |||
1855 | token = strtok_r (NULL, ":", &rest); | 1855 | token = strtok_r (NULL, ":", &rest); |
1856 | token = strtok_r (NULL, ":", &rest); | 1856 | token = strtok_r (NULL, ":", &rest); |
1857 | sscanf (token, "%u", &ret); | 1857 | sscanf (token, "%u", &ret); |
1858 | free (copy); | 1858 | GNUNET_free (copy); |
1859 | return ret; | 1859 | return ret; |
1860 | } | 1860 | } |
1861 | 1861 | ||
@@ -1883,11 +1883,129 @@ get_value (char *key, char *line) | |||
1883 | slen_token = strlen (token2); | 1883 | slen_token = strlen (token2); |
1884 | ret = malloc (slen_token + 1); | 1884 | ret = malloc (slen_token + 1); |
1885 | memcpy (ret, token2, slen_token + 1); | 1885 | memcpy (ret, token2, slen_token + 1); |
1886 | free (copy); | 1886 | GNUNET_free (copy); |
1887 | return ret; | 1887 | return ret; |
1888 | } | 1888 | } |
1889 | 1889 | ||
1890 | 1890 | ||
1891 | static struct GNUNET_TESTING_NodeConnection * | ||
1892 | get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node) | ||
1893 | { | ||
1894 | struct GNUNET_TESTING_NodeConnection *node_connection; | ||
1895 | char *copy; | ||
1896 | size_t slen; | ||
1897 | char *token; | ||
1898 | char *token2; | ||
1899 | unsigned int node_n; | ||
1900 | unsigned int namespace_n; | ||
1901 | char *rest = NULL; | ||
1902 | char *rest2 = NULL; | ||
1903 | struct GNUNET_TESTING_ADDRESS_PREFIX *prefix; | ||
1904 | |||
1905 | node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection); | ||
1906 | node_connection->node = node; | ||
1907 | |||
1908 | slen = strlen (line) + 1; | ||
1909 | copy = malloc (slen); | ||
1910 | memcpy (copy, line, slen); | ||
1911 | token = strtok_r (copy, ":", &rest); | ||
1912 | if (0 == strcmp ("{K", token)) | ||
1913 | { | ||
1914 | node_connection->node_type = GNUNET_TESTING_GLOBAL_NODE; | ||
1915 | token = strtok_r (NULL, ":", &rest); | ||
1916 | sscanf (token, "%u", &node_n); | ||
1917 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1918 | "node_n %u\n", | ||
1919 | node_n); | ||
1920 | node_connection->node_n = node_n; | ||
1921 | node_connection->namespace_n = 0; | ||
1922 | } | ||
1923 | else if (0 == strcmp ("{P", token)) | ||
1924 | { | ||
1925 | node_connection->node_type = GNUNET_TESTING_SUBNET_NODE; | ||
1926 | token = strtok_r (NULL, ":", &rest); | ||
1927 | sscanf (token, "%u", &node_n); | ||
1928 | node_connection->node_n = node_n; | ||
1929 | token = strtok_r (NULL, ":", &rest); | ||
1930 | sscanf (token, "%u", &namespace_n); | ||
1931 | node_connection->namespace_n = namespace_n; | ||
1932 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1933 | "node_n %u namespace_n %u\n", | ||
1934 | node_n, | ||
1935 | namespace_n); | ||
1936 | } | ||
1937 | while (NULL != (token = strtok_r (NULL, ":", &rest))) | ||
1938 | { | ||
1939 | prefix = GNUNET_new (struct GNUNET_TESTING_ADDRESS_PREFIX); | ||
1940 | token2 = strtok_r (token, "}", &rest2); | ||
1941 | if (NULL != token2) | ||
1942 | { | ||
1943 | slen = strlen (token2) + 1; | ||
1944 | prefix->address_prefix = malloc (slen); | ||
1945 | memcpy (prefix->address_prefix, token2, slen); | ||
1946 | } | ||
1947 | else | ||
1948 | { | ||
1949 | slen = strlen (token) + 1; | ||
1950 | prefix->address_prefix = malloc (slen); | ||
1951 | memcpy (prefix->address_prefix, token, slen); | ||
1952 | } | ||
1953 | |||
1954 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1955 | "address_prefix %s\n", | ||
1956 | prefix->address_prefix); | ||
1957 | |||
1958 | GNUNET_CONTAINER_DLL_insert (node_connection->address_prefixes_head, | ||
1959 | node_connection->address_prefixes_tail, | ||
1960 | prefix); | ||
1961 | } | ||
1962 | |||
1963 | GNUNET_free (copy); | ||
1964 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1965 | "address_prefix %s\n", | ||
1966 | prefix->address_prefix); | ||
1967 | |||
1968 | return node_connection; | ||
1969 | } | ||
1970 | |||
1971 | |||
1972 | static void | ||
1973 | node_connections (char *line, struct GNUNET_TESTING_NetjailNode *node) | ||
1974 | { | ||
1975 | char *value, *value2; | ||
1976 | char *temp; | ||
1977 | char *copy; | ||
1978 | size_t slen; | ||
1979 | char *rest = NULL; | ||
1980 | char *rest2 = NULL; | ||
1981 | struct GNUNET_TESTING_NodeConnection *node_connection; | ||
1982 | |||
1983 | |||
1984 | temp = strstr (line, "connect"); | ||
1985 | if (NULL != temp) | ||
1986 | { | ||
1987 | slen = strlen (temp) + 1; | ||
1988 | copy = malloc (slen); | ||
1989 | memcpy (copy, temp, slen); | ||
1990 | strtok_r (copy, ":", &rest); | ||
1991 | value = strtok_r (rest, "|", &rest2); | ||
1992 | |||
1993 | while (NULL != value) | ||
1994 | { | ||
1995 | node_connection = get_connect_value (value, node); | ||
1996 | GNUNET_CONTAINER_DLL_insert (node->node_connections_head, | ||
1997 | node->node_connections_tail, | ||
1998 | node_connection); | ||
1999 | value2 = strstr (value, "}}"); | ||
2000 | if (NULL != value2) | ||
2001 | break; | ||
2002 | value = strtok_r (NULL, "|", &rest2); | ||
2003 | |||
2004 | } | ||
2005 | } | ||
2006 | } | ||
2007 | |||
2008 | |||
1891 | /** | 2009 | /** |
1892 | * Getting the topology from file. | 2010 | * Getting the topology from file. |
1893 | * | 2011 | * |
@@ -1912,6 +2030,7 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
1912 | struct GNUNET_TESTING_NetjailNamespace *namespace; | 2030 | struct GNUNET_TESTING_NetjailNamespace *namespace; |
1913 | struct GNUNET_ShortHashCode *hkey; | 2031 | struct GNUNET_ShortHashCode *hkey; |
1914 | struct GNUNET_HashCode hc; | 2032 | struct GNUNET_HashCode hc; |
2033 | |||
1915 | topo->map_namespaces = | 2034 | topo->map_namespaces = |
1916 | GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | 2035 | GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); |
1917 | topo->map_globals = | 2036 | topo->map_globals = |
@@ -1942,7 +2061,7 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
1942 | return NULL; | 2061 | return NULL; |
1943 | } | 2062 | } |
1944 | 2063 | ||
1945 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2064 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1946 | "data: %s\n", | 2065 | "data: %s\n", |
1947 | data); | 2066 | data); |
1948 | 2067 | ||
@@ -1951,46 +2070,46 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
1951 | while (NULL != token) | 2070 | while (NULL != token) |
1952 | { | 2071 | { |
1953 | key = get_key (token); | 2072 | key = get_key (token); |
1954 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2073 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1955 | "In the loop with token: %s beginning with %s\n", | 2074 | "In the loop with token: %s beginning with %s\n", |
1956 | token, | 2075 | token, |
1957 | key); | 2076 | key); |
1958 | if (0 == strcmp (key, "M")) | 2077 | if (0 == strcmp (key, "M")) |
1959 | { | 2078 | { |
1960 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2079 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1961 | "Get first Value for M.\n"); | 2080 | "Get first Value for M.\n"); |
1962 | out = get_first_value (token); | 2081 | out = get_first_value (token); |
1963 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2082 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1964 | "M: %u\n", | 2083 | "M: %u\n", |
1965 | out); | 2084 | out); |
1966 | topo->nodes_m = out; | 2085 | topo->nodes_m = out; |
1967 | } | 2086 | } |
1968 | else if (0 == strcmp (key, "N")) | 2087 | else if (0 == strcmp (key, "N")) |
1969 | { | 2088 | { |
1970 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2089 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1971 | "Get first Value for N.\n"); | 2090 | "Get first Value for N.\n"); |
1972 | out = get_first_value (token); | 2091 | out = get_first_value (token); |
1973 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2092 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1974 | "N: %u\n", | 2093 | "N: %u\n", |
1975 | out); | 2094 | out); |
1976 | topo->namespaces_n = out; | 2095 | topo->namespaces_n = out; |
1977 | } | 2096 | } |
1978 | else if (0 == strcmp (key, "X")) | 2097 | else if (0 == strcmp (key, "X")) |
1979 | { | 2098 | { |
1980 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2099 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1981 | "Get first Value for X.\n"); | 2100 | "Get first Value for X.\n"); |
1982 | out = get_first_value (token); | 2101 | out = get_first_value (token); |
1983 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2102 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1984 | "X: %u\n", | 2103 | "X: %u\n", |
1985 | out); | 2104 | out); |
1986 | topo->nodes_x = out; | 2105 | topo->nodes_x = out; |
1987 | } | 2106 | } |
1988 | else if (0 == strcmp (key, "T")) | 2107 | else if (0 == strcmp (key, "T")) |
1989 | { | 2108 | { |
1990 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2109 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1991 | "Get first string value for T.\n"); | 2110 | "Get first string value for T.\n"); |
1992 | value = get_first_string_value (token); | 2111 | value = get_first_string_value (token); |
1993 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2112 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1994 | "value: %s\n", | 2113 | "value: %s\n", |
1995 | value); | 2114 | value); |
1996 | topo->plugin = value; | 2115 | topo->plugin = value; |
@@ -2000,10 +2119,10 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2000 | hkey = GNUNET_new (struct GNUNET_ShortHashCode); | 2119 | hkey = GNUNET_new (struct GNUNET_ShortHashCode); |
2001 | node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); | 2120 | node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); |
2002 | 2121 | ||
2003 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2122 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2004 | "Get first Value for K.\n"); | 2123 | "Get first Value for K.\n"); |
2005 | out = get_first_value (token); | 2124 | out = get_first_value (token); |
2006 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2125 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2007 | "K: %u\n", | 2126 | "K: %u\n", |
2008 | out); | 2127 | out); |
2009 | node->node_n = out; | 2128 | node->node_n = out; |
@@ -2012,20 +2131,24 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2012 | &hc, | 2131 | &hc, |
2013 | sizeof (*hkey)); | 2132 | sizeof (*hkey)); |
2014 | node->is_global = GNUNET_YES; | 2133 | node->is_global = GNUNET_YES; |
2015 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2134 | |
2016 | "Get value for key value on K.\n"); | 2135 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( |
2017 | value = get_value ("plugin", token); | 2136 | topo->map_globals, |
2018 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2137 | hkey)) |
2019 | "value: %s\n", | ||
2020 | value); | ||
2021 | if (0 == GNUNET_CONTAINER_multishortmap_contains (topo->map_globals, | ||
2022 | hkey)) | ||
2023 | GNUNET_break (0); | 2138 | GNUNET_break (0); |
2024 | else | 2139 | else |
2025 | GNUNET_CONTAINER_multishortmap_put (topo->map_globals, | 2140 | GNUNET_CONTAINER_multishortmap_put (topo->map_globals, |
2026 | hkey, | 2141 | hkey, |
2027 | node, | 2142 | node, |
2028 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 2143 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
2144 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
2145 | "Get value for key value on K.\n"); | ||
2146 | value = get_value ("plugin", token); | ||
2147 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
2148 | "value: %s\n", | ||
2149 | value); | ||
2150 | node->plugin = value; | ||
2151 | node_connections (token, node); | ||
2029 | } | 2152 | } |
2030 | else if (0 == strcmp (key, "R")) | 2153 | else if (0 == strcmp (key, "R")) |
2031 | { | 2154 | { |
@@ -2033,10 +2156,10 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2033 | router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter); | 2156 | router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter); |
2034 | node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); | 2157 | node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); |
2035 | 2158 | ||
2036 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2159 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2037 | "Get first Value for R.\n"); | 2160 | "Get first Value for R.\n"); |
2038 | out = get_first_value (token); | 2161 | out = get_first_value (token); |
2039 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2162 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2040 | "R: %u\n", | 2163 | "R: %u\n", |
2041 | out); | 2164 | out); |
2042 | node->node_n = out; | 2165 | node->node_n = out; |
@@ -2044,27 +2167,28 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2044 | memcpy (hkey, | 2167 | memcpy (hkey, |
2045 | &hc, | 2168 | &hc, |
2046 | sizeof (*hkey)); | 2169 | sizeof (*hkey)); |
2047 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2170 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2048 | "Get value for key tcp_port on R.\n"); | 2171 | "Get value for key tcp_port on R.\n"); |
2049 | value = get_value ("tcp_port", token); | 2172 | value = get_value ("tcp_port", token); |
2050 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2173 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2051 | "tcp_port: %s\n", | 2174 | "tcp_port: %s\n", |
2052 | value); | 2175 | value); |
2053 | ret = sscanf (value, "%u", &(router->tcp_port)); | 2176 | ret = sscanf (value, "%u", &(router->tcp_port)); |
2054 | 2177 | ||
2055 | GNUNET_break (0 == ret || 1 < router->tcp_port); | 2178 | GNUNET_break (0 != ret && 1 >= router->tcp_port); |
2056 | 2179 | ||
2057 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2180 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2058 | "Get value for key udp_port on R.\n"); | 2181 | "Get value for key udp_port on R.\n"); |
2059 | value = get_value ("udp_port", token); | 2182 | value = get_value ("udp_port", token); |
2060 | ret = sscanf (value, "%u", &(router->udp_port)); | 2183 | ret = sscanf (value, "%u", &(router->udp_port)); |
2061 | GNUNET_break (0 == ret || 1 < router->udp_port); | 2184 | GNUNET_break (0 != ret && 1 >= router->udp_port); |
2062 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2185 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2063 | "udp_port: %s\n", | 2186 | "udp_port: %s\n", |
2064 | value); | 2187 | value); |
2065 | 2188 | ||
2066 | if (0 == GNUNET_CONTAINER_multishortmap_contains (topo->map_namespaces, | 2189 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( |
2067 | hkey)) | 2190 | topo->map_namespaces, |
2191 | hkey)) | ||
2068 | { | 2192 | { |
2069 | namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces, | 2193 | namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces, |
2070 | hkey); | 2194 | hkey); |
@@ -2073,6 +2197,7 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2073 | { | 2197 | { |
2074 | namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace); | 2198 | namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace); |
2075 | namespace->namespace_n = out; | 2199 | namespace->namespace_n = out; |
2200 | namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
2076 | GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces, | 2201 | GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces, |
2077 | hkey, | 2202 | hkey, |
2078 | namespace, | 2203 | namespace, |
@@ -2086,10 +2211,10 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2086 | hkey = GNUNET_new (struct GNUNET_ShortHashCode); | 2211 | hkey = GNUNET_new (struct GNUNET_ShortHashCode); |
2087 | node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); | 2212 | node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); |
2088 | 2213 | ||
2089 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2214 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2090 | "Get first Value for P.\n"); | 2215 | "Get first Value for P.\n"); |
2091 | out = get_first_value (token); | 2216 | out = get_first_value (token); |
2092 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2217 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2093 | "P: %u\n", | 2218 | "P: %u\n", |
2094 | out); | 2219 | out); |
2095 | GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); | 2220 | GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); |
@@ -2097,14 +2222,9 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2097 | &hc, | 2222 | &hc, |
2098 | sizeof (*hkey)); | 2223 | sizeof (*hkey)); |
2099 | 2224 | ||
2100 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2225 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( |
2101 | "Get value for key plugin on P.\n"); | 2226 | topo->map_namespaces, |
2102 | value = get_value ("plugin", token); | 2227 | hkey)) |
2103 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2104 | "plugin: %s\n", | ||
2105 | value); | ||
2106 | if (0 == GNUNET_CONTAINER_multishortmap_contains (topo->map_namespaces, | ||
2107 | hkey)) | ||
2108 | { | 2228 | { |
2109 | namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces, | 2229 | namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces, |
2110 | hkey); | 2230 | hkey); |
@@ -2112,24 +2232,26 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2112 | else | 2232 | else |
2113 | { | 2233 | { |
2114 | namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace); | 2234 | namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace); |
2235 | namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
2115 | namespace->namespace_n = out; | 2236 | namespace->namespace_n = out; |
2116 | GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces, | 2237 | GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces, |
2117 | hkey, | 2238 | hkey, |
2118 | namespace, | 2239 | namespace, |
2119 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 2240 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
2120 | } | 2241 | } |
2121 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2242 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2122 | "Get second Value for P.\n"); | 2243 | "Get second Value for P.\n"); |
2123 | out = get_second_value (token); | 2244 | out = get_second_value (token); |
2124 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2245 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2125 | "P: %u\n", | 2246 | "P: %u\n", |
2126 | out); | 2247 | out); |
2127 | GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); | 2248 | GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); |
2128 | memcpy (hkey, | 2249 | memcpy (hkey, |
2129 | &hc, | 2250 | &hc, |
2130 | sizeof (*hkey)); | 2251 | sizeof (*hkey)); |
2131 | if (0 == GNUNET_CONTAINER_multishortmap_contains (namespace->nodes, | 2252 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( |
2132 | hkey)) | 2253 | namespace->nodes, |
2254 | hkey)) | ||
2133 | { | 2255 | { |
2134 | GNUNET_break (0); | 2256 | GNUNET_break (0); |
2135 | } | 2257 | } |
@@ -2140,10 +2262,17 @@ GNUNET_TESTING_get_topo_from_file (const char *filename) | |||
2140 | hkey, | 2262 | hkey, |
2141 | node, | 2263 | node, |
2142 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 2264 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
2265 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
2266 | "Get value for key plugin on P.\n"); | ||
2267 | value = get_value ("plugin", token); | ||
2268 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
2269 | "plugin: %s\n", | ||
2270 | value); | ||
2143 | node->plugin = value; | 2271 | node->plugin = value; |
2144 | node->node_n = out; | 2272 | node->node_n = out; |
2145 | node->namespace_n = namespace->namespace_n; | 2273 | node->namespace_n = namespace->namespace_n; |
2146 | } | 2274 | } |
2275 | node_connections (token, node); | ||
2147 | } | 2276 | } |
2148 | token = strtok_r (NULL, "\n", &rest); | 2277 | token = strtok_r (NULL, "\n", &rest); |
2149 | } | 2278 | } |