diff options
271 files changed, 21023 insertions, 11649 deletions
@@ -36,7 +36,7 @@ Antti Salonen | |||
36 | Blake Matheny <bmatheny@mobocracy.net> | 36 | Blake Matheny <bmatheny@mobocracy.net> |
37 | Bertrand Marc <beberking@gmail.com> | 37 | Bertrand Marc <beberking@gmail.com> |
38 | Clytie Siddall <clytie@riverland.net.au> | 38 | Clytie Siddall <clytie@riverland.net.au> |
39 | Daniel Golle | 39 | Daniel Golle <daniel@makrotopia.org> |
40 | David Brodski | 40 | David Brodski |
41 | David Kuehling <dvdkhlng@gmx.de> | 41 | David Kuehling <dvdkhlng@gmx.de> |
42 | Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> | 42 | Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> |
@@ -110,8 +110,8 @@ new GNU in Net: Nicklas Larsson <whybill@gmail.com> | |||
110 | Maintainers: | 110 | Maintainers: |
111 | FreeBSD : Kirill Ponomarew <ponomarew@oberon.net> | 111 | FreeBSD : Kirill Ponomarew <ponomarew@oberon.net> |
112 | Debian GNU/Linux: Daniel Baumann <daniel.baumann@panthera-systems.net> | 112 | Debian GNU/Linux: Daniel Baumann <daniel.baumann@panthera-systems.net> |
113 | OpenWrt/LEDE : Daniel Golle <daniel@makrotopia.org> | ||
113 | OS X : Jussi Eloranta <eloranta@cc.jyu.fi> | 114 | OS X : Jussi Eloranta <eloranta@cc.jyu.fi> |
114 | Gentoo : N. 'ng0' Gillmann <ngillmann@runbox.com> | ||
115 | 115 | ||
116 | 116 | ||
117 | If you have contributed and are not listed here, please | 117 | If you have contributed and are not listed here, please |
@@ -0,0 +1,3 @@ | |||
1 | Sat Jan 7 16:41:34 CET 2017 | ||
2 | Converting NAT library to new NAT service (and | ||
3 | splitting of nat-auto service for auto-configuration). -CG | ||
@@ -4,13 +4,16 @@ | |||
4 | What is GNUnet? | 4 | What is GNUnet? |
5 | =============== | 5 | =============== |
6 | 6 | ||
7 | GNUnet is peer-to-peer framework focusing on security. The first and | 7 | GNUnet is peer-to-peer framework providing a network abstractions and |
8 | primary application for GNUnet is anonymous file-sharing. GNUnet is | 8 | applications focusing on security and privacy. So far, we have |
9 | currently developed by a worldwide group of independent free software | 9 | created applications for anonymous file-sharing, decentralized naming |
10 | developers. GNUnet is a GNU package (http://www.gnu.org/). | 10 | and identity management, decentralized and confidential telephony and |
11 | tunneling IP traffic over GNUnet. GNUnet is currently developed by a | ||
12 | worldwide group of independent free software developers. GNUnet is a | ||
13 | GNU package (http://www.gnu.org/). | ||
11 | 14 | ||
12 | This is an ALPHA release. There are known and significant bugs as | 15 | This is an ALPHA release. There are known and significant bugs as |
13 | well as many missing features in this release. | 16 | well as many missing features in this release. |
14 | 17 | ||
15 | Additional documentation about GNUnet can be found at | 18 | Additional documentation about GNUnet can be found at |
16 | https://gnunet.org/. | 19 | https://gnunet.org/. |
@@ -80,7 +83,7 @@ actual GNUnet compilation and installation process with: | |||
80 | 83 | ||
81 | $ export GNUNET_PREFIX=/usr/local/lib # or other directory of your choice | 84 | $ export GNUNET_PREFIX=/usr/local/lib # or other directory of your choice |
82 | # addgroup gnunetdns | 85 | # addgroup gnunetdns |
83 | # adduser gnunet gnunet | 86 | # adduser --system --home "/var/lib/gnunet" --group gnunet --shell /bin/sh |
84 | # ./configure --prefix=$GNUNET_PREFIX/.. --with-extractor=$LE_PREFIX | 87 | # ./configure --prefix=$GNUNET_PREFIX/.. --with-extractor=$LE_PREFIX |
85 | $ make | 88 | $ make |
86 | # make install | 89 | # make install |
diff --git a/configure.ac b/configure.ac index 761086e32..924b06849 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1551,6 +1551,7 @@ src/ats/Makefile | |||
1551 | src/ats/ats.conf | 1551 | src/ats/ats.conf |
1552 | src/ats-tool/Makefile | 1552 | src/ats-tool/Makefile |
1553 | src/ats-tests/Makefile | 1553 | src/ats-tests/Makefile |
1554 | src/auction/Makefile | ||
1554 | src/block/Makefile | 1555 | src/block/Makefile |
1555 | src/cadet/Makefile | 1556 | src/cadet/Makefile |
1556 | src/cadet/cadet.conf | 1557 | src/cadet/cadet.conf |
@@ -1598,6 +1599,8 @@ src/namestore/Makefile | |||
1598 | src/namestore/namestore.conf | 1599 | src/namestore/namestore.conf |
1599 | src/nat/Makefile | 1600 | src/nat/Makefile |
1600 | src/nat/nat.conf | 1601 | src/nat/nat.conf |
1602 | src/nat-auto/Makefile | ||
1603 | src/nat-auto/nat-auto.conf | ||
1601 | src/nse/Makefile | 1604 | src/nse/Makefile |
1602 | src/nse/nse.conf | 1605 | src/nse/nse.conf |
1603 | src/peerinfo/Makefile | 1606 | src/peerinfo/Makefile |
@@ -1643,6 +1646,8 @@ src/util/Makefile | |||
1643 | src/util/resolver.conf | 1646 | src/util/resolver.conf |
1644 | src/vpn/Makefile | 1647 | src/vpn/Makefile |
1645 | src/vpn/vpn.conf | 1648 | src/vpn/vpn.conf |
1649 | src/zonemaster/Makefile | ||
1650 | src/zonemaster/zonemaster.conf | ||
1646 | src/rest/Makefile | 1651 | src/rest/Makefile |
1647 | src/identity-provider/Makefile | 1652 | src/identity-provider/Makefile |
1648 | pkgconfig/Makefile | 1653 | pkgconfig/Makefile |
@@ -1727,6 +1732,12 @@ then | |||
1727 | AC_MSG_NOTICE([NOTICE: bluetooth library not found. bluetooth support will not be compiled.]) | 1732 | AC_MSG_NOTICE([NOTICE: bluetooth library not found. bluetooth support will not be compiled.]) |
1728 | fi | 1733 | fi |
1729 | 1734 | ||
1735 | # jansson | ||
1736 | if test "x$jansson" = "x0" | ||
1737 | then | ||
1738 | AC_MSG_NOTICE([NOTICE: jansson library not found. json support will not be compiled.]) | ||
1739 | fi | ||
1740 | |||
1730 | #gnutls | 1741 | #gnutls |
1731 | if test x$gnutls != xtrue | 1742 | if test x$gnutls != xtrue |
1732 | then | 1743 | then |
diff --git a/contrib/.gitignore b/contrib/.gitignore index d8a442c35..50dd6d9fc 100644 --- a/contrib/.gitignore +++ b/contrib/.gitignore | |||
@@ -3,3 +3,5 @@ gnunet_pyexpect.py | |||
3 | pydiffer.py | 3 | pydiffer.py |
4 | terminate.py | 4 | terminate.py |
5 | timeout_watchdog | 5 | timeout_watchdog |
6 | gnunet_pyexpect.py | ||
7 | gnunet_pyexpect.pyc | ||
diff --git a/contrib/no_forcestart.conf b/contrib/no_forcestart.conf index 7de3f1509..e21187ed2 100644 --- a/contrib/no_forcestart.conf +++ b/contrib/no_forcestart.conf | |||
@@ -33,3 +33,6 @@ FORCESTART = NO | |||
33 | 33 | ||
34 | [gns] | 34 | [gns] |
35 | FORCESTART = NO | 35 | FORCESTART = NO |
36 | |||
37 | [zonemaster] | ||
38 | FORCESTART = NO \ No newline at end of file | ||
diff --git a/contrib/ssh-config b/contrib/ssh-config new file mode 100644 index 000000000..857354bf3 --- /dev/null +++ b/contrib/ssh-config | |||
@@ -0,0 +1,33 @@ | |||
1 | # ~/.ssh/config for buildbots | ||
2 | |||
3 | Host *.buildbot.gnunet | ||
4 | User root | ||
5 | |||
6 | Host debian-amd64-grothoff.buildbot.gnunet | ||
7 | Hostname gnunet.org | ||
8 | Port 20004 | ||
9 | |||
10 | Host debian-i686-wachs.buildbot.gnunet | ||
11 | Hostname gnunet.org | ||
12 | Port 20000 | ||
13 | |||
14 | Host ubuntu-amd64-wachs.buildbot.gnunet | ||
15 | Hostname gnunet.org | ||
16 | Port 20003 | ||
17 | |||
18 | Host opensuse-amd64-wachs.buildbot.gnunet | ||
19 | Hostname gnunet.org | ||
20 | Port 20002 | ||
21 | |||
22 | Host freebsd-amd64-wachs.buildbot.gnunet | ||
23 | Hostname gnunet.org | ||
24 | Port 20006 | ||
25 | |||
26 | Host debian-powerpc-wachs.buildbot.gnunet | ||
27 | Hostname powerpcbot.decentralise.rennes.inria.fr | ||
28 | |||
29 | Host debian-armv7l-evans.buildbot.gnunet | ||
30 | Hostname efikamxbot.decentralise.rennes.inria.fr | ||
31 | |||
32 | Host debian-sparc64-wachs.buildbot.gnunet | ||
33 | Hostname sparcbot.decentralise.rennes.inria.fr | ||
diff --git a/contrib/ssh-keys b/contrib/ssh-keys index 6d4ed354e..7c273e688 100644 --- a/contrib/ssh-keys +++ b/contrib/ssh-keys | |||
@@ -16,3 +16,4 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqlkUztOQ65gRvfxI6gwkP+095eEEc5DtHzZd1x9e7 | |||
16 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQ2JbS5dNBxiSRGeNIE+VvvJBUStgndjduH2HmGyy7Z7VGNrykSDgjkcLj1+808zWzkniUZTUKvH5uT4rjSYrc8Au2l65e+J6gYypaOhn7oQKW9KQ3P7K8VpHSc407iQk0fM6bmpRKcd5GK0U6mlpi3nKvPhd9JttwfeNF6HWo4goCuYXdnLmWIimP6BBg6dZRBqO0y00bjSlMJmHnlQXI3YUBvceB3tBe6hOaEx5X3pCpE9CPaAUp6pAohHv97k6Dq7OcXeJulDaHKYvEGTCOq5v3V4zSYH4tJCrAO5OL83fsoAwn70l2qy+BkuThhiud2cff/jL1gB1+oU06s42N bart@voyager | 16 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQ2JbS5dNBxiSRGeNIE+VvvJBUStgndjduH2HmGyy7Z7VGNrykSDgjkcLj1+808zWzkniUZTUKvH5uT4rjSYrc8Au2l65e+J6gYypaOhn7oQKW9KQ3P7K8VpHSc407iQk0fM6bmpRKcd5GK0U6mlpi3nKvPhd9JttwfeNF6HWo4goCuYXdnLmWIimP6BBg6dZRBqO0y00bjSlMJmHnlQXI3YUBvceB3tBe6hOaEx5X3pCpE9CPaAUp6pAohHv97k6Dq7OcXeJulDaHKYvEGTCOq5v3V4zSYH4tJCrAO5OL83fsoAwn70l2qy+BkuThhiud2cff/jL1gB1+oU06s42N bart@voyager |
17 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC4/0jIkaaWtGolhWJPijpaPA1QHeQNlaZTc3wlCr/PGnFxY/TfXMKwEFX+JBvtYAuBsD+NXshKUssFtDSSQ5ljqbjGfA1SFv7ueRcuEVfg8MSTic7crHo23afjYWC9GND0LFDwy8IGrT6QtmbOV1cACTDk3GRcFT3wK2ZsTYAlsq7o+TTfD6A2OncqQGyIrgZl+eNx3je19xQ6OK+RTOXhvsNx77IdOluNkItAS8XEJpqnrYAqrqrtX5eyzHkwmPvu/gxrjO55YuXXXj4yramy5j++SkjH1y1XXMdAl1zNsDwT4U0/bNLm/0vvMQ8qgEVOak6vq+Qw0iyIyJP6RFI/J2S/mISCGyasAWULynhFP0DaCwFkFOnn3tv+A+caoxYKUU3nD+zD2q04FaIaOastTbDfeUSseHeKX08mSHxcPd/alYKcXA+Qm9SWsHGHJ8PAMPJNOcMwtkgGDKKzKJLW6CTUIEgl9BZXs0GXv1erAYu7zqNCRU/PWIKV2J509sk65dkykDRDkHMJ1esG+2Rg094hbNHsB4uoRZjlibS/9WYEOdn1eLt2xAvMXa1Vs8RpysMfv98zJabz8+mADf5u1prLGk9zSQA7akVoFe6OLqnQBVJr1E5simMZaCqZBYbYfgTveo8xtPZw7NDcH6/xrV2j0sN2xGHfkRFpuMpnCQ== burdges@gmail.com | 17 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC4/0jIkaaWtGolhWJPijpaPA1QHeQNlaZTc3wlCr/PGnFxY/TfXMKwEFX+JBvtYAuBsD+NXshKUssFtDSSQ5ljqbjGfA1SFv7ueRcuEVfg8MSTic7crHo23afjYWC9GND0LFDwy8IGrT6QtmbOV1cACTDk3GRcFT3wK2ZsTYAlsq7o+TTfD6A2OncqQGyIrgZl+eNx3je19xQ6OK+RTOXhvsNx77IdOluNkItAS8XEJpqnrYAqrqrtX5eyzHkwmPvu/gxrjO55YuXXXj4yramy5j++SkjH1y1XXMdAl1zNsDwT4U0/bNLm/0vvMQ8qgEVOak6vq+Qw0iyIyJP6RFI/J2S/mISCGyasAWULynhFP0DaCwFkFOnn3tv+A+caoxYKUU3nD+zD2q04FaIaOastTbDfeUSseHeKX08mSHxcPd/alYKcXA+Qm9SWsHGHJ8PAMPJNOcMwtkgGDKKzKJLW6CTUIEgl9BZXs0GXv1erAYu7zqNCRU/PWIKV2J509sk65dkykDRDkHMJ1esG+2Rg094hbNHsB4uoRZjlibS/9WYEOdn1eLt2xAvMXa1Vs8RpysMfv98zJabz8+mADf5u1prLGk9zSQA7akVoFe6OLqnQBVJr1E5simMZaCqZBYbYfgTveo8xtPZw7NDcH6/xrV2j0sN2xGHfkRFpuMpnCQ== burdges@gmail.com |
18 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4UL53uXZCis1C9VNWJjVXTtyRHVmzFmg3vajTXrRF6LBYpEtDRA3OCtzCsj88AlL2VEtIiBWBqZrntE0TKDia1Czru3sM1ieKCra1F1GlSj4Yk+7VaRSS1hGwMBUb0zyaiIHjizGH45+zL5TXeAiGbeiF/iiRJJG/qQ+txTXVg51QLuMv9W5wKs9Dz+o+vbbUwVaauJo/TmhVz1VFjqhQBOt9N/CtaTe84B1716/d/YTZLH1bmjxMja+a6aCyABaPM5JcMNYEZT2UMCP5fTyJRUpfNlimpdRkcxaA5/K8AKTW7R35cQpLrngnnOChUB+KT6683omDr2edXGqkWNsZ grothoff@firefly | 18 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4UL53uXZCis1C9VNWJjVXTtyRHVmzFmg3vajTXrRF6LBYpEtDRA3OCtzCsj88AlL2VEtIiBWBqZrntE0TKDia1Czru3sM1ieKCra1F1GlSj4Yk+7VaRSS1hGwMBUb0zyaiIHjizGH45+zL5TXeAiGbeiF/iiRJJG/qQ+txTXVg51QLuMv9W5wKs9Dz+o+vbbUwVaauJo/TmhVz1VFjqhQBOt9N/CtaTe84B1716/d/YTZLH1bmjxMja+a6aCyABaPM5JcMNYEZT2UMCP5fTyJRUpfNlimpdRkcxaA5/K8AKTW7R35cQpLrngnnOChUB+KT6683omDr2edXGqkWNsZ grothoff@firefly |
19 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCvbeMnZGlujN9IsLxUSTuHBUESoN6ZTXmEFi/GkBKp9RQ7xZAS84JDcV0GFddiCfTHGQL04mkeYXkof5d9NkMWjtTvQ9QFtUgGOqI3PbGCGW83vSwJHsqVbfbv5uqFCODjpTx4/WiJNkEpN/HgE2eIYFcm+Dcpo1vTgC26LjdMfqUaAGv/OTmKWmaMqyOzc4MXuUiBQT83oTfn2zSWDEOJG67yULqg5jMzaXqzPbhsaokBIPehks0bJR/q7OWNwDQJyM1oTKeRIh0ZmC0qYwGu/vlc3rYW4cp//ErAXG5iPfCXXUySUc0DTFHazzkNzUStuUwugznxuUCgbvg2tu5WEnrh/PpzIMuvNaUk2ZSDq00hHDrpVJyKKCih2d1cGV+qs9XFjDoD6Ch2NiSdPnG7fSsTxVw1SB7/APuMqfXWrQDfT5ee5xOKGzKOxQckGihQi39kmqf4WjNESOw4tmhNFZOee9dpC7ESYSpG/3zK8WG6FDln1nU6rHGjVgaSK6HwZUOsneS2fntiQZR2olzEY9+ybL1vh1fk6pkhS78X/PiwS3cSiu4q7JWJ4tUiB0T/cHAFBaODDKHXmEaGefLrPBWLLFRdjbnepWo1d0k1z/NLVovXDCGlF4IOBKqcImIffods/jTpH0hjU/vBjIQHH3Ii0J6vtGJw9whcNAGQfw== t3sserakt@posteo.de | ||
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index ff1e462b7..c40363b59 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am | |||
@@ -25,6 +25,7 @@ man_MANS = \ | |||
25 | gnunet-namestore.1 \ | 25 | gnunet-namestore.1 \ |
26 | gnunet-namestore-fcfsd.1 \ | 26 | gnunet-namestore-fcfsd.1 \ |
27 | gnunet-nat.1 \ | 27 | gnunet-nat.1 \ |
28 | gnunet-nat-auto.1 \ | ||
28 | gnunet-nat-server.1 \ | 29 | gnunet-nat-server.1 \ |
29 | gnunet-peerinfo.1 \ | 30 | gnunet-peerinfo.1 \ |
30 | gnunet-publish.1 \ | 31 | gnunet-publish.1 \ |
diff --git a/doc/man/gnunet-nat-auto.1 b/doc/man/gnunet-nat-auto.1 new file mode 100644 index 000000000..249d54da4 --- /dev/null +++ b/doc/man/gnunet-nat-auto.1 | |||
@@ -0,0 +1,69 @@ | |||
1 | .TH GNUNET\-NAT\-AUTO 1 "6 Jan 2017" "GNUnet" | ||
2 | |||
3 | .SH NAME | ||
4 | gnunet\-nat\-auto \- autoconfigure and test NAT traversal | ||
5 | |||
6 | .SH SYNOPSIS | ||
7 | .B gnunet\-nat\-auto | ||
8 | .RI [ options ] | ||
9 | .br | ||
10 | |||
11 | .SH DESCRIPTION | ||
12 | |||
13 | This tool allows testing various NAT traversal functions, as well | ||
14 | as attempting auto\-configuration. | ||
15 | |||
16 | .SH OPTIONS | ||
17 | .B | ||
18 | .IP "\-a, \-\-auto" | ||
19 | Attempt auto\-configuration for NAT traversal. | ||
20 | |||
21 | .B | ||
22 | .IP "\-c FILENAME, \-\-config=FILENAME" | ||
23 | Use the configuration file FILENAME. | ||
24 | |||
25 | .B | ||
26 | .IP "\-S NAME, \-\-section=NAME" | ||
27 | Name of the configuration section with details about the configuration to test. For example "transport-tcp". | ||
28 | |||
29 | .IP "\-t, \-\-tcp" | ||
30 | Use TCP. | ||
31 | |||
32 | .B | ||
33 | .IP "\-u, \-\-udp" | ||
34 | Use UDP. | ||
35 | |||
36 | .B | ||
37 | .IP "\-w, \-\-write" | ||
38 | Write configuration to configuration file, useful in combination with autoconfiguration (\-a). | ||
39 | |||
40 | .SH EXAMPLES | ||
41 | .PP | ||
42 | |||
43 | \fBAutomatic configuration:\fR | ||
44 | |||
45 | Probe and write result to configuration: | ||
46 | |||
47 | # gnunet\-nat\-auto \-aw | ||
48 | |||
49 | |||
50 | \fBTest configuration:\fR | ||
51 | |||
52 | Test TCP configuration: | ||
53 | |||
54 | # gnunet\-nat\-auto -t \-S transport-tcp | ||
55 | |||
56 | Test HTTP configuration: | ||
57 | |||
58 | # gnunet\-nat\-auto -t \-S transport-http | ||
59 | |||
60 | Test UDP configuration: | ||
61 | |||
62 | # gnunet\-nat\-auto -u \-S transport-udp | ||
63 | |||
64 | |||
65 | .SH BUGS | ||
66 | Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> | ||
67 | |||
68 | .SH SEE ALSO | ||
69 | gnunet\-transport(1) gnunet\-nat(1) | ||
diff --git a/doc/man/gnunet-nat.1 b/doc/man/gnunet-nat.1 index 5bdbb21eb..0a9053444 100644 --- a/doc/man/gnunet-nat.1 +++ b/doc/man/gnunet-nat.1 | |||
@@ -14,9 +14,6 @@ This tool allows testing various NAT traversal functions, as well | |||
14 | as attempting auto\-configuration. | 14 | as attempting auto\-configuration. |
15 | 15 | ||
16 | .SH OPTIONS | 16 | .SH OPTIONS |
17 | .B | ||
18 | .IP "\-a, \-\-auto" | ||
19 | Attempt auto\-configuration for NAT traversal. | ||
20 | 17 | ||
21 | .B | 18 | .B |
22 | .IP "\-b ADDRESS, \-\-bind=ADDRESS" | 19 | .IP "\-b ADDRESS, \-\-bind=ADDRESS" |
@@ -39,8 +36,8 @@ Assuming we are listening at ADDRESS for connection reversal requests. | |||
39 | Ask the peer at ADDRESS for connection reversal, using the local address for the target address of the reversal. | 36 | Ask the peer at ADDRESS for connection reversal, using the local address for the target address of the reversal. |
40 | 37 | ||
41 | .B | 38 | .B |
42 | .IP "\-p ADDRESS, \-\-punch=ADDRESS" | 39 | .IP "\-S NAME, \-\-section=NAME" |
43 | A hole was punched manually through the NAT. We should use ADDRESS as our external hostname and port for advertising for incoming requests. The special hostname 'AUTO' can be used to indicate that GNUnet should determine the external IP address by other means (such as upnpc), and just take the port number from ADDRESS. | 40 | Name of section in configuration file to use for additional options. |
44 | 41 | ||
45 | .B | 42 | .B |
46 | .IP "\-s, \-\-stun" | 43 | .IP "\-s, \-\-stun" |
@@ -55,10 +52,6 @@ Use TCP. | |||
55 | Use UDP. | 52 | Use UDP. |
56 | 53 | ||
57 | .B | 54 | .B |
58 | .IP "\-w, \-\-write" | ||
59 | Write configuration to configuration file, useful in combination with autoconfiguration (\-a). | ||
60 | |||
61 | .B | ||
62 | .IP "\-W, \-\-watch" | 55 | .IP "\-W, \-\-watch" |
63 | Watch for connection reversal requests. | 56 | Watch for connection reversal requests. |
64 | 57 | ||
@@ -81,13 +74,17 @@ We are bound to "127.0.0.1:8080" on UDP and want to obtain all applicable IP add | |||
81 | 74 | ||
82 | \fBICMP-based NAT traversal:\fR | 75 | \fBICMP-based NAT traversal:\fR |
83 | 76 | ||
84 | Watch for connection reversal request: | 77 | Watch for connection reversal request (you must be bound to NAT range or to wildcard, 0.0.0.0), only works for IPv4: |
78 | |||
79 | # gnunet-nat -Wt -i 192.168.178.12:8080 | ||
85 | 80 | ||
86 | # gnunet-nat FIXME | 81 | Initiate connection reversal request from peer at external IPv4 address 1.2.3.4, while we are running ourselves at 2.3.4.5:8080 (must use IPv4 addresses): |
87 | 82 | ||
88 | Initiate connection reversal request: | 83 | # gnunet-nat -t -r 1.2.3.4:8080 -i 2.3.4.5:8080 |
89 | 84 | ||
90 | # gnunet-nat FIXME | 85 | Initiate connection reversal request from peer at external IPv4 address 1.2.3.4, and let the kernel fill in whatever IPv4 address we happen to have: |
86 | |||
87 | # gnunet-nat -t -r 1.2.3.4:8080 -i 0.0.0.0:8080 | ||
91 | 88 | ||
92 | \fBManual hole punching:\fR | 89 | \fBManual hole punching:\fR |
93 | 90 | ||
@@ -101,12 +98,6 @@ XXX: | |||
101 | 98 | ||
102 | # gnunet-nat FIXME -s | 99 | # gnunet-nat FIXME -s |
103 | 100 | ||
104 | \fBAutomatic configuration:\fR | ||
105 | |||
106 | Probe and write result to configuration: | ||
107 | |||
108 | # gnunet-nat -aw | ||
109 | |||
110 | 101 | ||
111 | .SH BUGS | 102 | .SH BUGS |
112 | Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> | 103 | Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> |
diff --git a/doc/man/gnunet-transport.1 b/doc/man/gnunet-transport.1 index 691448157..1680f9cf7 100644 --- a/doc/man/gnunet-transport.1 +++ b/doc/man/gnunet-transport.1 | |||
@@ -48,9 +48,6 @@ monitor session state of transport plugins | |||
48 | \fB\-s\fR, \fB\-\-send\fR | 48 | \fB\-s\fR, \fB\-\-send\fR |
49 | transmit (dummy) traffic as quickly as possible to the peer specified with the \-p option. The rate will still be limited by the quota(s) determined by the peers (ATS subsystem). Will run until CTRL\-C is pressed or until the connection to the other peer is disrupted. | 49 | transmit (dummy) traffic as quickly as possible to the peer specified with the \-p option. The rate will still be limited by the quota(s) determined by the peers (ATS subsystem). Will run until CTRL\-C is pressed or until the connection to the other peer is disrupted. |
50 | .TP | 50 | .TP |
51 | \fB\-t\fR, \fB\-\-test\fR | ||
52 | test transport configuration. With this flag, the tool will check if each of the configured transport plugins has a working address. Plugins that do not have a listen port configured will be ignored. The test is performed with the help of an external server (by default running on gnunet.org) which tries to contact the local machine. The test can only work if the local GNUnet peer is not yet running. | ||
53 | .TP | ||
54 | \fB\-v\fR, \fB\-\-version\fR | 51 | \fB\-v\fR, \fB\-\-version\fR |
55 | print the version number | 52 | print the version number |
56 | .TP | 53 | .TP |
diff --git a/doc/structure.dot b/doc/structure.dot index 2a30c7c17..e244d20b8 100644 --- a/doc/structure.dot +++ b/doc/structure.dot | |||
@@ -41,8 +41,9 @@ splines = true; | |||
41 | dv -> ats; | 41 | dv -> ats; |
42 | dns -> tun; | 42 | dns -> tun; |
43 | dns -> dnsstub; | 43 | dns -> dnsstub; |
44 | gns [shape=house]; | 44 | zonemaster [shape=house]; |
45 | gns -> namestore; | 45 | zonemaster -> namestore; |
46 | zonemaster -> dht; | ||
46 | gns -> dns; | 47 | gns -> dns; |
47 | gns -> dht; | 48 | gns -> dht; |
48 | gns -> block [style=dotted,color=blue]; | 49 | gns -> block [style=dotted,color=blue]; |
diff --git a/po/POTFILES.in b/po/POTFILES.in index b3cc2b3ee..eb78c2ec6 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -28,6 +28,10 @@ src/ats-tests/ats-testing-traffic.c | |||
28 | src/ats-tests/gnunet-ats-sim.c | 28 | src/ats-tests/gnunet-ats-sim.c |
29 | src/ats-tests/gnunet-solver-eval.c | 29 | src/ats-tests/gnunet-solver-eval.c |
30 | src/ats-tool/gnunet-ats.c | 30 | src/ats-tool/gnunet-ats.c |
31 | src/auction/gnunet-auction-create.c | ||
32 | src/auction/gnunet-auction-info.c | ||
33 | src/auction/gnunet-auction-join.c | ||
34 | src/auction/gnunet-service-auction.c | ||
31 | src/block/block.c | 35 | src/block/block.c |
32 | src/block/plugin_block_template.c | 36 | src/block/plugin_block_template.c |
33 | src/block/plugin_block_test.c | 37 | src/block/plugin_block_test.c |
@@ -62,10 +66,8 @@ src/conversation/gnunet-service-conversation.c | |||
62 | src/conversation/microphone.c | 66 | src/conversation/microphone.c |
63 | src/conversation/plugin_gnsrecord_conversation.c | 67 | src/conversation/plugin_gnsrecord_conversation.c |
64 | src/conversation/speaker.c | 68 | src/conversation/speaker.c |
65 | src/core/core_api_2.c | ||
66 | src/core/core_api.c | 69 | src/core/core_api.c |
67 | src/core/core_api_monitor_peers.c | 70 | src/core/core_api_monitor_peers.c |
68 | src/core/core_api_mq.c | ||
69 | src/core/gnunet-core.c | 71 | src/core/gnunet-core.c |
70 | src/core/gnunet-service-core.c | 72 | src/core/gnunet-service-core.c |
71 | src/core/gnunet-service-core_kx.c | 73 | src/core/gnunet-service-core_kx.c |
@@ -241,23 +243,25 @@ src/namestore/plugin_namestore_flat.c | |||
241 | src/namestore/plugin_namestore_postgres.c | 243 | src/namestore/plugin_namestore_postgres.c |
242 | src/namestore/plugin_namestore_sqlite.c | 244 | src/namestore/plugin_namestore_sqlite.c |
243 | src/namestore/plugin_rest_namestore.c | 245 | src/namestore/plugin_rest_namestore.c |
246 | src/nat-auto/gnunet-nat-auto.c | ||
247 | src/nat-auto/gnunet-nat-auto_legacy.c | ||
248 | src/nat-auto/gnunet-nat-server.c | ||
249 | src/nat-auto/gnunet-service-nat-auto.c | ||
250 | src/nat-auto/gnunet-service-nat-auto_legacy.c | ||
251 | src/nat-auto/nat_auto_api.c | ||
252 | src/nat-auto/nat_auto_api_test.c | ||
244 | src/nat/gnunet-helper-nat-client.c | 253 | src/nat/gnunet-helper-nat-client.c |
245 | src/nat/gnunet-helper-nat-client-windows.c | 254 | src/nat/gnunet-helper-nat-client-windows.c |
246 | src/nat/gnunet-helper-nat-server.c | 255 | src/nat/gnunet-helper-nat-server.c |
247 | src/nat/gnunet-helper-nat-server-windows.c | 256 | src/nat/gnunet-helper-nat-server-windows.c |
248 | src/nat/gnunet-nat.c | 257 | src/nat/gnunet-nat.c |
249 | src/nat/gnunet-nat-server.c | ||
250 | src/nat/gnunet-service-nat.c | 258 | src/nat/gnunet-service-nat.c |
259 | src/nat/gnunet-service-nat_externalip.c | ||
251 | src/nat/gnunet-service-nat_helper.c | 260 | src/nat/gnunet-service-nat_helper.c |
261 | src/nat/gnunet-service-nat_mini.c | ||
252 | src/nat/gnunet-service-nat_stun.c | 262 | src/nat/gnunet-service-nat_stun.c |
253 | src/nat/nat_api.c | 263 | src/nat/nat_api.c |
254 | src/nat/nat_api_stun.c | 264 | src/nat/nat_api_stun.c |
255 | src/nat/nat_api_test.c | ||
256 | src/nat/nat_auto.c | ||
257 | src/nat/nat.c | ||
258 | src/nat/nat_mini.c | ||
259 | src/nat/nat_stun.c | ||
260 | src/nat/nat_test.c | ||
261 | src/nse/gnunet-nse.c | 265 | src/nse/gnunet-nse.c |
262 | src/nse/gnunet-nse-profiler.c | 266 | src/nse/gnunet-nse-profiler.c |
263 | src/nse/gnunet-service-nse.c | 267 | src/nse/gnunet-service-nse.c |
@@ -422,7 +426,7 @@ src/tun/regex.c | |||
422 | src/tun/tun.c | 426 | src/tun/tun.c |
423 | src/util/bandwidth.c | 427 | src/util/bandwidth.c |
424 | src/util/bio.c | 428 | src/util/bio.c |
425 | src/util/client_new.c | 429 | src/util/client.c |
426 | src/util/common_allocation.c | 430 | src/util/common_allocation.c |
427 | src/util/common_endian.c | 431 | src/util/common_endian.c |
428 | src/util/common_logging.c | 432 | src/util/common_logging.c |
@@ -493,6 +497,7 @@ src/vpn/gnunet-helper-vpn-windows.c | |||
493 | src/vpn/gnunet-service-vpn.c | 497 | src/vpn/gnunet-service-vpn.c |
494 | src/vpn/gnunet-vpn.c | 498 | src/vpn/gnunet-vpn.c |
495 | src/vpn/vpn_api.c | 499 | src/vpn/vpn_api.c |
500 | src/zonemaster/gnunet-service-zonemaster.c | ||
496 | src/fs/fs_api.h | 501 | src/fs/fs_api.h |
497 | src/include/gnunet_common.h | 502 | src/include/gnunet_common.h |
498 | src/include/gnunet_mq_lib.h | 503 | src/include/gnunet_mq_lib.h |
@@ -10,7 +10,7 @@ msgid "" | |||
10 | msgstr "" | 10 | msgstr "" |
11 | "Project-Id-Version: gnunet 0.10.1\n" | 11 | "Project-Id-Version: gnunet 0.10.1\n" |
12 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 12 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
13 | "POT-Creation-Date: 2016-11-27 09:18+0100\n" | 13 | "POT-Creation-Date: 2017-01-12 17:19+0100\n" |
14 | "PO-Revision-Date: 2015-03-08 16:16+0100\n" | 14 | "PO-Revision-Date: 2015-03-08 16:16+0100\n" |
15 | "Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n" | 15 | "Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n" |
16 | "Language-Team: German <translation-team-de@lists.sourceforge.net>\n" | 16 | "Language-Team: German <translation-team-de@lists.sourceforge.net>\n" |
@@ -252,21 +252,20 @@ msgstr "" | |||
252 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 | 252 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 |
253 | #: src/transport/plugin_transport_tcp.c:652 | 253 | #: src/transport/plugin_transport_tcp.c:652 |
254 | #: src/transport/plugin_transport_tcp.c:658 | 254 | #: src/transport/plugin_transport_tcp.c:658 |
255 | #: src/transport/plugin_transport_tcp.c:3299 src/util/service.c:584 | 255 | #: src/transport/plugin_transport_tcp.c:3309 src/util/service.c:584 |
256 | #: src/util/service.c:590 src/util/service_new.c:637 | 256 | #: src/util/service.c:590 src/util/service_new.c:637 src/util/service_new.c:643 |
257 | #: src/util/service_new.c:643 | ||
258 | #, c-format | 257 | #, c-format |
259 | msgid "Require valid port number for service `%s' in configuration!\n" | 258 | msgid "Require valid port number for service `%s' in configuration!\n" |
260 | msgstr "" | 259 | msgstr "" |
261 | 260 | ||
262 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 | 261 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 |
263 | #: src/util/client_new.c:464 src/util/service.c:621 src/util/service_new.c:682 | 262 | #: src/util/client.c:464 src/util/service.c:621 src/util/service_new.c:682 |
264 | #, c-format | 263 | #, c-format |
265 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 264 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
266 | msgstr "" | 265 | msgstr "" |
267 | 266 | ||
268 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 | 267 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 |
269 | #: src/util/client_new.c:469 src/util/service.c:625 src/util/service_new.c:687 | 268 | #: src/util/client.c:469 src/util/service.c:625 src/util/service_new.c:687 |
270 | #, c-format | 269 | #, c-format |
271 | msgid "Using `%s' instead\n" | 270 | msgid "Using `%s' instead\n" |
272 | msgstr "" | 271 | msgstr "" |
@@ -286,7 +285,7 @@ msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | |||
286 | msgstr "" | 285 | msgstr "" |
287 | 286 | ||
288 | #: src/arm/gnunet-service-arm.c:513 | 287 | #: src/arm/gnunet-service-arm.c:513 |
289 | #: src/transport/plugin_transport_http_server.c:2617 | 288 | #: src/transport/plugin_transport_http_server.c:2620 |
290 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 | 289 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 |
291 | #: src/util/service_new.c:782 | 290 | #: src/util/service_new.c:782 |
292 | #, c-format | 291 | #, c-format |
@@ -294,7 +293,7 @@ msgid "Failed to resolve `%s': %s\n" | |||
294 | msgstr "»%s« konnte nicht aufgelöst werden: %s\n" | 293 | msgstr "»%s« konnte nicht aufgelöst werden: %s\n" |
295 | 294 | ||
296 | #: src/arm/gnunet-service-arm.c:532 | 295 | #: src/arm/gnunet-service-arm.c:532 |
297 | #: src/transport/plugin_transport_http_server.c:2635 | 296 | #: src/transport/plugin_transport_http_server.c:2638 |
298 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 | 297 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 |
299 | #: src/util/service_new.c:802 | 298 | #: src/util/service_new.c:802 |
300 | #, fuzzy, c-format | 299 | #, fuzzy, c-format |
@@ -388,13 +387,11 @@ msgid "" | |||
388 | "%llu\n" | 387 | "%llu\n" |
389 | msgstr "" | 388 | msgstr "" |
390 | 389 | ||
391 | #: src/ats/gnunet-ats-solver-eval.c:3293 | 390 | #: src/ats/gnunet-ats-solver-eval.c:3293 src/ats-tests/gnunet-solver-eval.c:935 |
392 | #: src/ats-tests/gnunet-solver-eval.c:935 | ||
393 | msgid "solver to use" | 391 | msgid "solver to use" |
394 | msgstr "" | 392 | msgstr "" |
395 | 393 | ||
396 | #: src/ats/gnunet-ats-solver-eval.c:3296 | 394 | #: src/ats/gnunet-ats-solver-eval.c:3296 src/ats-tests/gnunet-solver-eval.c:938 |
397 | #: src/ats-tests/gnunet-solver-eval.c:938 | ||
398 | #: src/ats-tests/gnunet-solver-eval.c:941 | 395 | #: src/ats-tests/gnunet-solver-eval.c:941 |
399 | msgid "experiment to use" | 396 | msgid "experiment to use" |
400 | msgstr "" | 397 | msgstr "" |
@@ -499,12 +496,12 @@ msgstr "" | |||
499 | msgid "Invalid %s configuration %f\n" | 496 | msgid "Invalid %s configuration %f\n" |
500 | msgstr " gconfig\tGTK Konfiguration\n" | 497 | msgstr " gconfig\tGTK Konfiguration\n" |
501 | 498 | ||
502 | #: src/ats-tests/ats-testing.c:441 | 499 | #: src/ats-tests/ats-testing.c:422 |
503 | #, c-format | 500 | #, c-format |
504 | msgid "Connected master [%u] with slave [%u]\n" | 501 | msgid "Connected master [%u] with slave [%u]\n" |
505 | msgstr "" | 502 | msgstr "" |
506 | 503 | ||
507 | #: src/ats-tests/ats-testing.c:448 | 504 | #: src/ats-tests/ats-testing.c:429 |
508 | #, fuzzy, c-format | 505 | #, fuzzy, c-format |
509 | msgid "Failed to connect master peer [%u] with slave [%u]\n" | 506 | msgid "Failed to connect master peer [%u] with slave [%u]\n" |
510 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 507 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
@@ -561,7 +558,7 @@ msgid "Quota for network `%11s' (in/out): %10s / %10s\n" | |||
561 | msgstr "" | 558 | msgstr "" |
562 | 559 | ||
563 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 | 560 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 |
564 | #: src/transport/gnunet-transport.c:1476 | 561 | #: src/transport/gnunet-transport.c:1255 |
565 | #, fuzzy, c-format | 562 | #, fuzzy, c-format |
566 | msgid "Failed to parse peer identity `%s'\n" | 563 | msgid "Failed to parse peer identity `%s'\n" |
567 | msgstr "Fehler beim Parsen der Gerätedaten von `%s' bei %s:%d.\n" | 564 | msgstr "Fehler beim Parsen der Gerätedaten von `%s' bei %s:%d.\n" |
@@ -643,6 +640,37 @@ msgstr "" | |||
643 | msgid "Print information about ATS state" | 640 | msgid "Print information about ATS state" |
644 | msgstr "Informationen über andere GNUnet Knoten ausgeben." | 641 | msgstr "Informationen über andere GNUnet Knoten ausgeben." |
645 | 642 | ||
643 | #: src/auction/gnunet-auction-create.c:69 | ||
644 | msgid "description of the item to be sold" | ||
645 | msgstr "" | ||
646 | |||
647 | #: src/auction/gnunet-auction-create.c:72 | ||
648 | msgid "mapping of possible prices" | ||
649 | msgstr "" | ||
650 | |||
651 | #: src/auction/gnunet-auction-create.c:75 | ||
652 | msgid "max duration per round" | ||
653 | msgstr "" | ||
654 | |||
655 | #: src/auction/gnunet-auction-create.c:78 | ||
656 | msgid "duration until auction starts" | ||
657 | msgstr "" | ||
658 | |||
659 | #: src/auction/gnunet-auction-create.c:81 | ||
660 | msgid "number of items to sell, 0 for first price auction" | ||
661 | msgstr "" | ||
662 | |||
663 | #: src/auction/gnunet-auction-create.c:84 | ||
664 | msgid "public auction outcome" | ||
665 | msgstr "" | ||
666 | |||
667 | #: src/auction/gnunet-auction-create.c:94 src/auction/gnunet-auction-info.c:76 | ||
668 | #: src/auction/gnunet-auction-join.c:76 | ||
669 | #: src/conversation/gnunet-conversation-test.c:243 | ||
670 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
671 | msgid "help text" | ||
672 | msgstr "Hilfetext" | ||
673 | |||
646 | #: src/cadet/gnunet-cadet.c:511 | 674 | #: src/cadet/gnunet-cadet.c:511 |
647 | #, fuzzy, c-format | 675 | #, fuzzy, c-format |
648 | msgid "Invalid target `%s'\n" | 676 | msgid "Invalid target `%s'\n" |
@@ -697,7 +725,7 @@ msgstr "" | |||
697 | msgid "provide information about all tunnels" | 725 | msgid "provide information about all tunnels" |
698 | msgstr "Informationen über andere GNUnet Knoten ausgeben." | 726 | msgstr "Informationen über andere GNUnet Knoten ausgeben." |
699 | 727 | ||
700 | #: src/cadet/gnunet-service-cadet_peer.c:681 | 728 | #: src/cadet/gnunet-service-cadet_peer.c:686 |
701 | msgid "Wrong CORE service\n" | 729 | msgid "Wrong CORE service\n" |
702 | msgstr "" | 730 | msgstr "" |
703 | 731 | ||
@@ -1020,11 +1048,6 @@ msgid "" | |||
1020 | "played back to you..." | 1048 | "played back to you..." |
1021 | msgstr "" | 1049 | msgstr "" |
1022 | 1050 | ||
1023 | #: src/conversation/gnunet-conversation-test.c:243 | ||
1024 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
1025 | msgid "help text" | ||
1026 | msgstr "Hilfetext" | ||
1027 | |||
1028 | #: src/conversation/gnunet_gst.c:630 | 1051 | #: src/conversation/gnunet_gst.c:630 |
1029 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 | 1052 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 |
1030 | #, c-format | 1053 | #, c-format |
@@ -1222,7 +1245,7 @@ msgstr "Ungültiges Befehlszeilenargument »%s«\n" | |||
1222 | msgid "Failed to connect to CORE service!\n" | 1245 | msgid "Failed to connect to CORE service!\n" |
1223 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 1246 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
1224 | 1247 | ||
1225 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1677 | 1248 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1456 |
1226 | msgid "provide information about all current connections (continuously)" | 1249 | msgid "provide information about all current connections (continuously)" |
1227 | msgstr "" | 1250 | msgstr "" |
1228 | 1251 | ||
@@ -1493,7 +1516,7 @@ msgstr "" | |||
1493 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 | 1516 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 |
1494 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 | 1517 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 |
1495 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 | 1518 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 |
1496 | #: src/include/gnunet_common.h:681 src/include/gnunet_common.h:690 | 1519 | #: src/include/gnunet_common.h:691 src/include/gnunet_common.h:700 |
1497 | #: src/scalarproduct/scalarproduct.h:35 | 1520 | #: src/scalarproduct/scalarproduct.h:35 |
1498 | #, c-format | 1521 | #, c-format |
1499 | msgid "`%s' failed at %s:%d with error: %s\n" | 1522 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -1893,8 +1916,7 @@ msgstr "" | |||
1893 | msgid "Prints all packets that go through the DHT." | 1916 | msgid "Prints all packets that go through the DHT." |
1894 | msgstr "" | 1917 | msgstr "" |
1895 | 1918 | ||
1896 | #: src/dht/gnunet_dht_profiler.c:1161 | 1919 | #: src/dht/gnunet_dht_profiler.c:1161 src/testbed/gnunet-testbed-profiler.c:255 |
1897 | #: src/testbed/gnunet-testbed-profiler.c:255 | ||
1898 | #, c-format | 1920 | #, c-format |
1899 | msgid "Exiting as the number of peers is %u\n" | 1921 | msgid "Exiting as the number of peers is %u\n" |
1900 | msgstr "" | 1922 | msgstr "" |
@@ -2074,8 +2096,7 @@ msgstr "" | |||
2074 | msgid "# GET requests given to datacache" | 2096 | msgid "# GET requests given to datacache" |
2075 | msgstr "" | 2097 | msgstr "" |
2076 | 2098 | ||
2077 | #: src/dht/gnunet-service-dht_hello.c:84 | 2099 | #: src/dht/gnunet-service-dht_hello.c:84 src/dht/gnunet-service-xdht_hello.c:82 |
2078 | #: src/dht/gnunet-service-xdht_hello.c:82 | ||
2079 | msgid "# HELLOs obtained from peerinfo" | 2100 | msgid "# HELLOs obtained from peerinfo" |
2080 | msgstr "" | 2101 | msgstr "" |
2081 | 2102 | ||
@@ -2147,38 +2168,38 @@ msgstr "# Client Trace-Anfragen empfangen" | |||
2147 | msgid "# P2P PUT bytes received" | 2168 | msgid "# P2P PUT bytes received" |
2148 | msgstr "# Bytes empfangen über TCP" | 2169 | msgstr "# Bytes empfangen über TCP" |
2149 | 2170 | ||
2150 | #: src/dht/gnunet-service-dht_neighbours.c:1854 | 2171 | #: src/dht/gnunet-service-dht_neighbours.c:1858 |
2151 | msgid "# FIND PEER requests ignored due to Bloomfilter" | 2172 | msgid "# FIND PEER requests ignored due to Bloomfilter" |
2152 | msgstr "" | 2173 | msgstr "" |
2153 | 2174 | ||
2154 | #: src/dht/gnunet-service-dht_neighbours.c:1862 | 2175 | #: src/dht/gnunet-service-dht_neighbours.c:1866 |
2155 | msgid "# FIND PEER requests ignored due to lack of HELLO" | 2176 | msgid "# FIND PEER requests ignored due to lack of HELLO" |
2156 | msgstr "" | 2177 | msgstr "" |
2157 | 2178 | ||
2158 | #: src/dht/gnunet-service-dht_neighbours.c:2018 | 2179 | #: src/dht/gnunet-service-dht_neighbours.c:2022 |
2159 | #, fuzzy | 2180 | #, fuzzy |
2160 | msgid "# P2P GET requests received" | 2181 | msgid "# P2P GET requests received" |
2161 | msgstr "# Client Trace-Anfragen empfangen" | 2182 | msgstr "# Client Trace-Anfragen empfangen" |
2162 | 2183 | ||
2163 | #: src/dht/gnunet-service-dht_neighbours.c:2022 | 2184 | #: src/dht/gnunet-service-dht_neighbours.c:2026 |
2164 | #, fuzzy | 2185 | #, fuzzy |
2165 | msgid "# P2P GET bytes received" | 2186 | msgid "# P2P GET bytes received" |
2166 | msgstr "# Bytes empfangen über TCP" | 2187 | msgstr "# Bytes empfangen über TCP" |
2167 | 2188 | ||
2168 | #: src/dht/gnunet-service-dht_neighbours.c:2097 | 2189 | #: src/dht/gnunet-service-dht_neighbours.c:2101 |
2169 | msgid "# P2P FIND PEER requests processed" | 2190 | msgid "# P2P FIND PEER requests processed" |
2170 | msgstr "" | 2191 | msgstr "" |
2171 | 2192 | ||
2172 | #: src/dht/gnunet-service-dht_neighbours.c:2120 | 2193 | #: src/dht/gnunet-service-dht_neighbours.c:2124 |
2173 | #, fuzzy | 2194 | #, fuzzy |
2174 | msgid "# P2P GET requests ONLY routed" | 2195 | msgid "# P2P GET requests ONLY routed" |
2175 | msgstr "# dht Anfragen weitergeleitet" | 2196 | msgstr "# dht Anfragen weitergeleitet" |
2176 | 2197 | ||
2177 | #: src/dht/gnunet-service-dht_neighbours.c:2222 | 2198 | #: src/dht/gnunet-service-dht_neighbours.c:2226 |
2178 | msgid "# P2P RESULTS received" | 2199 | msgid "# P2P RESULTS received" |
2179 | msgstr "" | 2200 | msgstr "" |
2180 | 2201 | ||
2181 | #: src/dht/gnunet-service-dht_neighbours.c:2226 | 2202 | #: src/dht/gnunet-service-dht_neighbours.c:2230 |
2182 | #, fuzzy | 2203 | #, fuzzy |
2183 | msgid "# P2P RESULT bytes received" | 2204 | msgid "# P2P RESULT bytes received" |
2184 | msgstr "# Bytes empfangen über TCP" | 2205 | msgstr "# Bytes empfangen über TCP" |
@@ -2188,35 +2209,35 @@ msgstr "# Bytes empfangen über TCP" | |||
2188 | msgid "# Network size estimates received" | 2209 | msgid "# Network size estimates received" |
2189 | msgstr "# verschlüsselter PING Nachrichten empfangen" | 2210 | msgstr "# verschlüsselter PING Nachrichten empfangen" |
2190 | 2211 | ||
2191 | #: src/dht/gnunet-service-dht_routing.c:218 | 2212 | #: src/dht/gnunet-service-dht_routing.c:220 |
2192 | msgid "# Good REPLIES matched against routing table" | 2213 | msgid "# Good REPLIES matched against routing table" |
2193 | msgstr "" | 2214 | msgstr "" |
2194 | 2215 | ||
2195 | #: src/dht/gnunet-service-dht_routing.c:227 | 2216 | #: src/dht/gnunet-service-dht_routing.c:229 |
2196 | msgid "# Duplicate REPLIES matched against routing table" | 2217 | msgid "# Duplicate REPLIES matched against routing table" |
2197 | msgstr "" | 2218 | msgstr "" |
2198 | 2219 | ||
2199 | #: src/dht/gnunet-service-dht_routing.c:233 | 2220 | #: src/dht/gnunet-service-dht_routing.c:235 |
2200 | msgid "# Invalid REPLIES matched against routing table" | 2221 | msgid "# Invalid REPLIES matched against routing table" |
2201 | msgstr "" | 2222 | msgstr "" |
2202 | 2223 | ||
2203 | #: src/dht/gnunet-service-dht_routing.c:239 | 2224 | #: src/dht/gnunet-service-dht_routing.c:241 |
2204 | msgid "# Irrelevant REPLIES matched against routing table" | 2225 | msgid "# Irrelevant REPLIES matched against routing table" |
2205 | msgstr "" | 2226 | msgstr "" |
2206 | 2227 | ||
2207 | #: src/dht/gnunet-service-dht_routing.c:251 | 2228 | #: src/dht/gnunet-service-dht_routing.c:253 |
2208 | msgid "# Unsupported REPLIES matched against routing table" | 2229 | msgid "# Unsupported REPLIES matched against routing table" |
2209 | msgstr "" | 2230 | msgstr "" |
2210 | 2231 | ||
2211 | #: src/dht/gnunet-service-dht_routing.c:327 | 2232 | #: src/dht/gnunet-service-dht_routing.c:329 |
2212 | msgid "# Entries removed from routing table" | 2233 | msgid "# Entries removed from routing table" |
2213 | msgstr "" | 2234 | msgstr "" |
2214 | 2235 | ||
2215 | #: src/dht/gnunet-service-dht_routing.c:409 | 2236 | #: src/dht/gnunet-service-dht_routing.c:411 |
2216 | msgid "# Entries added to routing table" | 2237 | msgid "# Entries added to routing table" |
2217 | msgstr "" | 2238 | msgstr "" |
2218 | 2239 | ||
2219 | #: src/dht/gnunet-service-dht_routing.c:427 | 2240 | #: src/dht/gnunet-service-dht_routing.c:429 |
2220 | #, fuzzy | 2241 | #, fuzzy |
2221 | msgid "# DHT requests combined" | 2242 | msgid "# DHT requests combined" |
2222 | msgstr "# dht Anfragen weitergeleitet" | 2243 | msgstr "# dht Anfragen weitergeleitet" |
@@ -2330,16 +2351,16 @@ msgid "" | |||
2330 | "SUPU %s, %s, %d, trail->prev_hop = %s" | 2351 | "SUPU %s, %s, %d, trail->prev_hop = %s" |
2331 | msgstr "" | 2352 | msgstr "" |
2332 | 2353 | ||
2333 | #: src/dht/plugin_block_dht.c:142 | 2354 | #: src/dht/plugin_block_dht.c:144 |
2334 | #, fuzzy, c-format | 2355 | #, fuzzy, c-format |
2335 | msgid "Block not of type %u\n" | 2356 | msgid "Block not of type %u\n" |
2336 | msgstr "Kein Transport des Typs %d bekannt.\n" | 2357 | msgstr "Kein Transport des Typs %d bekannt.\n" |
2337 | 2358 | ||
2338 | #: src/dht/plugin_block_dht.c:149 | 2359 | #: src/dht/plugin_block_dht.c:151 |
2339 | msgid "Size mismatch for block\n" | 2360 | msgid "Size mismatch for block\n" |
2340 | msgstr "" | 2361 | msgstr "" |
2341 | 2362 | ||
2342 | #: src/dht/plugin_block_dht.c:159 | 2363 | #: src/dht/plugin_block_dht.c:161 |
2343 | #, c-format | 2364 | #, c-format |
2344 | msgid "Block of type %u is malformed\n" | 2365 | msgid "Block of type %u is malformed\n" |
2345 | msgstr "" | 2366 | msgstr "" |
@@ -3472,7 +3493,7 @@ msgid "Option `%s' is required when using option `%s'.\n" | |||
3472 | msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" | 3493 | msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" |
3473 | 3494 | ||
3474 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 | 3495 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 |
3475 | #: src/transport/gnunet-transport.c:1517 src/transport/gnunet-transport.c:1542 | 3496 | #: src/transport/gnunet-transport.c:1296 src/transport/gnunet-transport.c:1321 |
3476 | #, c-format | 3497 | #, c-format |
3477 | msgid "Option `%s' makes no sense without option `%s'.\n" | 3498 | msgid "Option `%s' makes no sense without option `%s'.\n" |
3478 | msgstr "Die Option »%s« ergibt keinen Sinn ohne die Option »%s«.\n" | 3499 | msgstr "Die Option »%s« ergibt keinen Sinn ohne die Option »%s«.\n" |
@@ -4003,41 +4024,41 @@ msgstr "Beschädigte Antwort auf `%s' von Knoten `%s' empfangen.\n" | |||
4003 | msgid "Received unsupported DNS request from %s\n" | 4024 | msgid "Received unsupported DNS request from %s\n" |
4004 | msgstr "Unbekannte Anfrageart %d empfangen bei %s:%d\n" | 4025 | msgstr "Unbekannte Anfrageart %d empfangen bei %s:%d\n" |
4005 | 4026 | ||
4006 | #: src/gns/gnunet-dns2gns.c:709 | 4027 | #: src/gns/gnunet-dns2gns.c:712 |
4007 | msgid "No ego configured for `dns2gns` subsystem\n" | 4028 | msgid "No ego configured for `dns2gns` subsystem\n" |
4008 | msgstr "" | 4029 | msgstr "" |
4009 | 4030 | ||
4010 | #: src/gns/gnunet-dns2gns.c:737 | 4031 | #: src/gns/gnunet-dns2gns.c:740 |
4011 | #, fuzzy | 4032 | #, fuzzy |
4012 | msgid "No DNS server specified!\n" | 4033 | msgid "No DNS server specified!\n" |
4013 | msgstr "Keine Schlüsselwörter angegeben!\n" | 4034 | msgstr "Keine Schlüsselwörter angegeben!\n" |
4014 | 4035 | ||
4015 | #: src/gns/gnunet-dns2gns.c:758 | 4036 | #: src/gns/gnunet-dns2gns.c:761 |
4016 | #, fuzzy | 4037 | #, fuzzy |
4017 | msgid "No valid GNS zone specified!\n" | 4038 | msgid "No valid GNS zone specified!\n" |
4018 | msgstr "Keine Schlüsselwörter angegeben!\n" | 4039 | msgstr "Keine Schlüsselwörter angegeben!\n" |
4019 | 4040 | ||
4020 | #: src/gns/gnunet-dns2gns.c:779 | 4041 | #: src/gns/gnunet-dns2gns.c:782 |
4021 | msgid "IP of recursive DNS resolver to use (required)" | 4042 | msgid "IP of recursive DNS resolver to use (required)" |
4022 | msgstr "" | 4043 | msgstr "" |
4023 | 4044 | ||
4024 | #: src/gns/gnunet-dns2gns.c:782 | 4045 | #: src/gns/gnunet-dns2gns.c:785 |
4025 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" | 4046 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" |
4026 | msgstr "" | 4047 | msgstr "" |
4027 | 4048 | ||
4028 | #: src/gns/gnunet-dns2gns.c:785 | 4049 | #: src/gns/gnunet-dns2gns.c:788 |
4029 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" | 4050 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" |
4030 | msgstr "" | 4051 | msgstr "" |
4031 | 4052 | ||
4032 | #: src/gns/gnunet-dns2gns.c:788 | 4053 | #: src/gns/gnunet-dns2gns.c:791 |
4033 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4054 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4034 | msgstr "" | 4055 | msgstr "" |
4035 | 4056 | ||
4036 | #: src/gns/gnunet-dns2gns.c:791 | 4057 | #: src/gns/gnunet-dns2gns.c:794 |
4037 | msgid "Public key of the GNS zone to use (overrides default)" | 4058 | msgid "Public key of the GNS zone to use (overrides default)" |
4038 | msgstr "" | 4059 | msgstr "" |
4039 | 4060 | ||
4040 | #: src/gns/gnunet-dns2gns.c:804 | 4061 | #: src/gns/gnunet-dns2gns.c:807 |
4041 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4062 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4042 | msgstr "" | 4063 | msgstr "" |
4043 | 4064 | ||
@@ -4199,83 +4220,85 @@ msgstr "" | |||
4199 | msgid "Unsupported HTTP method `%s'\n" | 4220 | msgid "Unsupported HTTP method `%s'\n" |
4200 | msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" | 4221 | msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" |
4201 | 4222 | ||
4202 | #: src/gns/gnunet-gns-proxy.c:2167 | 4223 | #: src/gns/gnunet-gns-proxy.c:2168 |
4203 | #, fuzzy, c-format | 4224 | #, fuzzy, c-format |
4204 | msgid "Unable to import private key from file `%s'\n" | 4225 | msgid "Unable to import private key from file `%s'\n" |
4205 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" | 4226 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" |
4206 | 4227 | ||
4207 | #: src/gns/gnunet-gns-proxy.c:2197 | 4228 | #: src/gns/gnunet-gns-proxy.c:2198 |
4208 | #, fuzzy, c-format | 4229 | #, fuzzy, c-format |
4209 | msgid "Unable to import certificate %s\n" | 4230 | msgid "Unable to import certificate %s\n" |
4210 | msgstr "SQLite Datenbank konnte nicht initialisiert werden: %s.\n" | 4231 | msgstr "SQLite Datenbank konnte nicht initialisiert werden: %s.\n" |
4211 | 4232 | ||
4212 | #: src/gns/gnunet-gns-proxy.c:2370 | 4233 | #: src/gns/gnunet-gns-proxy.c:2371 |
4213 | #, fuzzy, c-format | 4234 | #, fuzzy, c-format |
4214 | msgid "Failed to start HTTPS server for `%s'\n" | 4235 | msgid "Failed to start HTTPS server for `%s'\n" |
4215 | msgstr "Der Transportdienst auf Port %d konnte nicht gestartet werden.\n" | 4236 | msgstr "Der Transportdienst auf Port %d konnte nicht gestartet werden.\n" |
4216 | 4237 | ||
4217 | #: src/gns/gnunet-gns-proxy.c:2389 src/rest/gnunet-rest-server.c:533 | 4238 | #: src/gns/gnunet-gns-proxy.c:2390 src/rest/gnunet-rest-server.c:533 |
4218 | #, fuzzy | 4239 | #, fuzzy |
4219 | msgid "Failed to pass client to MHD\n" | 4240 | msgid "Failed to pass client to MHD\n" |
4220 | msgstr "Fehler beim Starten der Collection.\n" | 4241 | msgstr "Fehler beim Starten der Collection.\n" |
4221 | 4242 | ||
4222 | #: src/gns/gnunet-gns-proxy.c:2709 | 4243 | #: src/gns/gnunet-gns-proxy.c:2710 |
4223 | #, c-format | 4244 | #, c-format |
4224 | msgid "Unsupported socks version %d\n" | 4245 | msgid "Unsupported socks version %d\n" |
4225 | msgstr "" | 4246 | msgstr "" |
4226 | 4247 | ||
4227 | #: src/gns/gnunet-gns-proxy.c:2738 | 4248 | #: src/gns/gnunet-gns-proxy.c:2739 |
4228 | #, fuzzy, c-format | 4249 | #, fuzzy, c-format |
4229 | msgid "Unsupported socks command %d\n" | 4250 | msgid "Unsupported socks command %d\n" |
4230 | msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" | 4251 | msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" |
4231 | 4252 | ||
4232 | #: src/gns/gnunet-gns-proxy.c:2756 src/gns/gnunet-gns-proxy.c:2785 | 4253 | #: src/gns/gnunet-gns-proxy.c:2757 src/gns/gnunet-gns-proxy.c:2786 |
4233 | msgid "SSL connection to plain IPv4 address requested\n" | 4254 | msgid "SSL connection to plain IPv4 address requested\n" |
4234 | msgstr "" | 4255 | msgstr "" |
4235 | 4256 | ||
4236 | #: src/gns/gnunet-gns-proxy.c:2836 | 4257 | #: src/gns/gnunet-gns-proxy.c:2837 |
4237 | #, c-format | 4258 | #, c-format |
4238 | msgid "Unsupported socks address type %d\n" | 4259 | msgid "Unsupported socks address type %d\n" |
4239 | msgstr "" | 4260 | msgstr "" |
4240 | 4261 | ||
4241 | #: src/gns/gnunet-gns-proxy.c:3171 | 4262 | #: src/gns/gnunet-gns-proxy.c:3172 |
4242 | msgid "No ego configured for `shorten-zone`\n" | 4263 | msgid "No ego configured for `shorten-zone`\n" |
4243 | msgstr "" | 4264 | msgstr "" |
4244 | 4265 | ||
4245 | #: src/gns/gnunet-gns-proxy.c:3211 src/gns/gnunet-service-gns.c:1093 | 4266 | #: src/gns/gnunet-gns-proxy.c:3212 src/gns/gnunet-service-gns.c:493 |
4246 | #: src/gns/gnunet-service-gns.c:1149 | 4267 | #: src/gns/gnunet-service-gns.c:548 |
4247 | #, c-format | 4268 | #, c-format |
4248 | msgid "No ego configured for `%s`\n" | 4269 | msgid "No ego configured for `%s`\n" |
4249 | msgstr "" | 4270 | msgstr "" |
4250 | 4271 | ||
4251 | #: src/gns/gnunet-gns-proxy.c:3273 | 4272 | #: src/gns/gnunet-gns-proxy.c:3274 |
4252 | #, fuzzy, c-format | 4273 | #, fuzzy, c-format |
4253 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" | 4274 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" |
4254 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" | 4275 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" |
4255 | 4276 | ||
4256 | #: src/gns/gnunet-gns-proxy.c:3313 | 4277 | #: src/gns/gnunet-gns-proxy.c:3314 |
4257 | msgid "listen on specified port (default: 7777)" | 4278 | msgid "listen on specified port (default: 7777)" |
4258 | msgstr "" | 4279 | msgstr "" |
4259 | 4280 | ||
4260 | #: src/gns/gnunet-gns-proxy.c:3316 | 4281 | #: src/gns/gnunet-gns-proxy.c:3317 |
4261 | msgid "pem file to use as CA" | 4282 | msgid "pem file to use as CA" |
4262 | msgstr "" | 4283 | msgstr "" |
4263 | 4284 | ||
4264 | #: src/gns/gnunet-gns-proxy.c:3335 | 4285 | #: src/gns/gnunet-gns-proxy.c:3336 |
4265 | msgid "GNUnet GNS proxy" | 4286 | msgid "GNUnet GNS proxy" |
4266 | msgstr "" | 4287 | msgstr "" |
4267 | 4288 | ||
4268 | #: src/gns/gnunet-service-gns.c:1187 | 4289 | #: src/gns/gnunet-service-gns.c:585 |
4290 | #: src/zonemaster/gnunet-service-zonemaster.c:705 | ||
4269 | #, fuzzy | 4291 | #, fuzzy |
4270 | msgid "Failed to connect to the namestore!\n" | 4292 | msgid "Failed to connect to the namestore!\n" |
4271 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 4293 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
4272 | 4294 | ||
4273 | #: src/gns/gnunet-service-gns.c:1195 | 4295 | #: src/gns/gnunet-service-gns.c:593 |
4274 | #, fuzzy | 4296 | #, fuzzy |
4275 | msgid "Failed to connect to the namecache!\n" | 4297 | msgid "Failed to connect to the namecache!\n" |
4276 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 4298 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
4277 | 4299 | ||
4278 | #: src/gns/gnunet-service-gns.c:1228 | 4300 | #: src/gns/gnunet-service-gns.c:612 |
4301 | #: src/zonemaster/gnunet-service-zonemaster.c:740 | ||
4279 | #, fuzzy | 4302 | #, fuzzy |
4280 | msgid "Could not connect to DHT!\n" | 4303 | msgid "Could not connect to DHT!\n" |
4281 | msgstr "Verbindung zu gnunetd konnte nicht hergestellt werden.\n" | 4304 | msgstr "Verbindung zu gnunetd konnte nicht hergestellt werden.\n" |
@@ -5118,8 +5141,7 @@ msgstr "" | |||
5118 | msgid "Invalid public key for reverse lookup `%s'\n" | 5141 | msgid "Invalid public key for reverse lookup `%s'\n" |
5119 | msgstr "" | 5142 | msgstr "" |
5120 | 5143 | ||
5121 | #: src/namestore/gnunet-namestore.c:979 | 5144 | #: src/namestore/gnunet-namestore.c:979 src/peerinfo-tool/gnunet-peerinfo.c:775 |
5122 | #: src/peerinfo-tool/gnunet-peerinfo.c:775 | ||
5123 | #, fuzzy, c-format | 5145 | #, fuzzy, c-format |
5124 | msgid "Invalid URI `%s'\n" | 5146 | msgid "Invalid URI `%s'\n" |
5125 | msgstr "Ungültiger Parameter: `%s'\n" | 5147 | msgstr "Ungültiger Parameter: `%s'\n" |
@@ -5275,221 +5297,296 @@ msgstr "Sqlite-Datenbank läuft\n" | |||
5275 | msgid "Namestore REST API initialized\n" | 5297 | msgid "Namestore REST API initialized\n" |
5276 | msgstr " Verbindung fehlgeschlagen\n" | 5298 | msgstr " Verbindung fehlgeschlagen\n" |
5277 | 5299 | ||
5278 | #: src/nat/gnunet-nat.c:159 | 5300 | #: src/nat-auto/gnunet-nat-auto.c:192 |
5279 | msgid "GNUnet NAT traversal autoconfigure daemon" | 5301 | #, fuzzy |
5302 | msgid "Suggested configuration changes:\n" | ||
5303 | msgstr "" | ||
5304 | "Einen Wert aus der Konfigurationsdatei auf der Standardausgabe ausgeben" | ||
5305 | |||
5306 | #: src/nat-auto/gnunet-nat-auto.c:220 | ||
5307 | #, fuzzy, c-format | ||
5308 | msgid "Failed to write configuration to `%s'\n" | ||
5309 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" | ||
5310 | |||
5311 | #: src/nat-auto/gnunet-nat-auto.c:227 | ||
5312 | #, fuzzy, c-format | ||
5313 | msgid "Wrote updated configuration to `%s'\n" | ||
5314 | msgstr "Konfigurationsdatei `%s' konnte nicht geparst werden.\n" | ||
5315 | |||
5316 | #: src/nat-auto/gnunet-nat-auto.c:345 | ||
5317 | #, fuzzy | ||
5318 | msgid "run autoconfiguration" | ||
5319 | msgstr "# Freunde in Konfiguration" | ||
5320 | |||
5321 | #: src/nat-auto/gnunet-nat-auto.c:348 | ||
5322 | msgid "section name providing the configuration for the adapter" | ||
5323 | msgstr "" | ||
5324 | |||
5325 | #: src/nat-auto/gnunet-nat-auto.c:351 src/nat/gnunet-nat.c:436 | ||
5326 | msgid "use TCP" | ||
5280 | msgstr "" | 5327 | msgstr "" |
5281 | 5328 | ||
5282 | #: src/nat/gnunet-nat-server.c:321 | 5329 | #: src/nat-auto/gnunet-nat-auto.c:354 src/nat/gnunet-nat.c:439 |
5330 | msgid "use UDP" | ||
5331 | msgstr "" | ||
5332 | |||
5333 | #: src/nat-auto/gnunet-nat-auto.c:357 | ||
5334 | msgid "write configuration file (for autoconfiguration)" | ||
5335 | msgstr "" | ||
5336 | |||
5337 | #: src/nat-auto/gnunet-nat-auto.c:369 | ||
5338 | msgid "GNUnet NAT traversal autoconfiguration" | ||
5339 | msgstr "" | ||
5340 | |||
5341 | #: src/nat-auto/gnunet-nat-auto_legacy.c:403 | ||
5342 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:681 | ||
5343 | #: src/nat-auto/nat_auto_api_test.c:405 | ||
5344 | #, fuzzy | ||
5345 | msgid "Failed to connect to `gnunet-nat-server'\n" | ||
5346 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | ||
5347 | |||
5348 | #: src/nat-auto/gnunet-nat-auto_legacy.c:518 | ||
5349 | #: src/nat-auto/nat_auto_api_test.c:520 | ||
5350 | #, c-format | ||
5351 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5352 | msgstr "" | ||
5353 | |||
5354 | #: src/nat-auto/gnunet-nat-auto_legacy.c:568 | ||
5355 | #: src/nat-auto/nat_auto_api_test.c:569 | ||
5356 | #, fuzzy | ||
5357 | msgid "NAT test failed to start NAT library\n" | ||
5358 | msgstr "Fehler beim Senden einer `%s' Anfrage an den SMTP Server.\n" | ||
5359 | |||
5360 | #: src/nat-auto/gnunet-nat-server.c:336 | ||
5283 | #, c-format | 5361 | #, c-format |
5284 | msgid "Please pass valid port number as the first argument! (got `%s')\n" | 5362 | msgid "Please pass valid port number as the first argument! (got `%s')\n" |
5285 | msgstr "" | 5363 | msgstr "" |
5286 | 5364 | ||
5287 | #: src/nat/gnunet-nat-server.c:363 | 5365 | #: src/nat-auto/gnunet-nat-server.c:386 |
5288 | msgid "GNUnet NAT traversal test helper daemon" | 5366 | msgid "GNUnet NAT traversal test helper daemon" |
5289 | msgstr "" | 5367 | msgstr "" |
5290 | 5368 | ||
5291 | #: src/nat/nat_api.c:880 src/nat/nat.c:2010 | 5369 | #: src/nat-auto/gnunet-service-nat-auto.c:342 |
5370 | #, fuzzy | ||
5371 | msgid "UPnP client `upnpc` command not found, disabling UPnP\n" | ||
5372 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | ||
5373 | |||
5374 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:385 | ||
5375 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5376 | msgstr "" | ||
5377 | |||
5378 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:386 | ||
5379 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5380 | msgstr "" | ||
5381 | |||
5382 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:405 | ||
5383 | msgid "Testing connection reversal with ICMP server.\n" | ||
5384 | msgstr "" | ||
5385 | |||
5386 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:437 | ||
5387 | #, fuzzy, c-format | ||
5388 | msgid "Detected external IP `%s'\n" | ||
5389 | msgstr "Ungültiger RPC `%s' empfangen.\n" | ||
5390 | |||
5391 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:572 | ||
5392 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | ||
5393 | msgstr "" | ||
5394 | |||
5395 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:590 | ||
5396 | #, c-format | ||
5397 | msgid "Detected internal network address `%s'.\n" | ||
5398 | msgstr "" | ||
5399 | |||
5400 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:724 | ||
5401 | msgid "upnpc found, enabling its use\n" | ||
5402 | msgstr "" | ||
5403 | |||
5404 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:725 | ||
5405 | #, fuzzy | ||
5406 | msgid "upnpc not found\n" | ||
5407 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | ||
5408 | |||
5409 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:762 | ||
5410 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5411 | msgstr "" | ||
5412 | |||
5413 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:774 | ||
5414 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:834 | ||
5415 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | ||
5416 | msgstr "" | ||
5417 | |||
5418 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:786 | ||
5419 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:846 | ||
5420 | msgid "No working gnunet-helper-nat-server found\n" | ||
5421 | msgstr "" | ||
5422 | |||
5423 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:823 | ||
5424 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | ||
5425 | msgstr "" | ||
5426 | |||
5427 | #: src/nat-auto/nat_auto_api.c:76 | ||
5292 | msgid "Operation Successful" | 5428 | msgid "Operation Successful" |
5293 | msgstr "" | 5429 | msgstr "" |
5294 | 5430 | ||
5295 | #: src/nat/nat_api.c:882 src/nat/nat.c:2012 | 5431 | #: src/nat-auto/nat_auto_api.c:78 |
5296 | msgid "Internal Failure (IPC, ...)" | 5432 | msgid "IPC failure" |
5297 | msgstr "" | 5433 | msgstr "" |
5298 | 5434 | ||
5299 | #: src/nat/nat_api.c:884 src/nat/nat.c:2014 | 5435 | #: src/nat-auto/nat_auto_api.c:80 |
5300 | msgid "Failure in network subsystem, check permissions." | 5436 | msgid "Failure in network subsystem, check permissions." |
5301 | msgstr "" | 5437 | msgstr "" |
5302 | 5438 | ||
5303 | #: src/nat/nat_api.c:886 src/nat/nat.c:2016 | 5439 | #: src/nat-auto/nat_auto_api.c:82 |
5304 | msgid "Encountered timeout while performing operation" | 5440 | msgid "Encountered timeout while performing operation" |
5305 | msgstr "" | 5441 | msgstr "" |
5306 | 5442 | ||
5307 | #: src/nat/nat_api.c:888 src/nat/nat.c:2018 | 5443 | #: src/nat-auto/nat_auto_api.c:84 |
5308 | msgid "detected that we are offline" | 5444 | msgid "detected that we are offline" |
5309 | msgstr "" | 5445 | msgstr "" |
5310 | 5446 | ||
5311 | #: src/nat/nat_api.c:890 src/nat/nat.c:2020 | 5447 | #: src/nat-auto/nat_auto_api.c:86 |
5312 | #, fuzzy | 5448 | #, fuzzy |
5313 | msgid "`upnpc` command not found" | 5449 | msgid "`upnpc` command not found" |
5314 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | 5450 | msgstr "Kommando `%s' wurde nicht gefunden!\n" |
5315 | 5451 | ||
5316 | #: src/nat/nat_api.c:892 src/nat/nat.c:2022 | 5452 | #: src/nat-auto/nat_auto_api.c:88 |
5317 | #, fuzzy | 5453 | #, fuzzy |
5318 | msgid "Failed to run `upnpc` command" | 5454 | msgid "Failed to run `upnpc` command" |
5319 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 5455 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
5320 | 5456 | ||
5321 | #: src/nat/nat_api.c:894 src/nat/nat.c:2024 | 5457 | #: src/nat-auto/nat_auto_api.c:90 |
5322 | msgid "`upnpc' command took too long, process killed" | 5458 | msgid "`upnpc' command took too long, process killed" |
5323 | msgstr "" | 5459 | msgstr "" |
5324 | 5460 | ||
5325 | #: src/nat/nat_api.c:896 src/nat/nat.c:2026 | 5461 | #: src/nat-auto/nat_auto_api.c:92 |
5326 | msgid "`upnpc' command failed to establish port mapping" | 5462 | msgid "`upnpc' command failed to establish port mapping" |
5327 | msgstr "" | 5463 | msgstr "" |
5328 | 5464 | ||
5329 | #: src/nat/nat_api.c:898 src/nat/nat.c:2028 | 5465 | #: src/nat-auto/nat_auto_api.c:94 |
5330 | msgid "`external-ip' command not found" | 5466 | msgid "`external-ip' command not found" |
5331 | msgstr "" | 5467 | msgstr "" |
5332 | 5468 | ||
5333 | #: src/nat/nat_api.c:900 src/nat/nat.c:2030 | 5469 | #: src/nat-auto/nat_auto_api.c:96 |
5334 | #, fuzzy | 5470 | #, fuzzy |
5335 | msgid "Failed to run `external-ip` command" | 5471 | msgid "Failed to run `external-ip` command" |
5336 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 5472 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
5337 | 5473 | ||
5338 | #: src/nat/nat_api.c:902 src/nat/nat.c:2032 | 5474 | #: src/nat-auto/nat_auto_api.c:98 |
5339 | #, fuzzy | 5475 | #, fuzzy |
5340 | msgid "`external-ip' command output invalid" | 5476 | msgid "`external-ip' command output invalid" |
5341 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | 5477 | msgstr "Kommando `%s' wurde nicht gefunden!\n" |
5342 | 5478 | ||
5343 | #: src/nat/nat_api.c:904 src/nat/nat.c:2034 | 5479 | #: src/nat-auto/nat_auto_api.c:100 |
5344 | msgid "no valid address was returned by `external-ip'" | 5480 | msgid "no valid address was returned by `external-ip'" |
5345 | msgstr "" | 5481 | msgstr "" |
5346 | 5482 | ||
5347 | #: src/nat/nat_api.c:906 src/nat/nat.c:2036 | 5483 | #: src/nat-auto/nat_auto_api.c:102 |
5348 | #, fuzzy | 5484 | #, fuzzy |
5349 | msgid "Could not determine interface with internal/local network address" | 5485 | msgid "Could not determine interface with internal/local network address" |
5350 | msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n" | 5486 | msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n" |
5351 | 5487 | ||
5352 | #: src/nat/nat_api.c:908 src/nat/nat.c:2038 | 5488 | #: src/nat-auto/nat_auto_api.c:104 |
5353 | msgid "No functioning gnunet-helper-nat-server installation found" | 5489 | msgid "No functioning gnunet-helper-nat-server installation found" |
5354 | msgstr "" | 5490 | msgstr "" |
5355 | 5491 | ||
5356 | #: src/nat/nat_api.c:910 src/nat/nat.c:2040 | 5492 | #: src/nat-auto/nat_auto_api.c:106 |
5357 | msgid "NAT test could not be initialized" | 5493 | msgid "NAT test could not be initialized" |
5358 | msgstr "" | 5494 | msgstr "" |
5359 | 5495 | ||
5360 | #: src/nat/nat_api.c:912 src/nat/nat.c:2042 | 5496 | #: src/nat-auto/nat_auto_api.c:108 |
5361 | msgid "NAT test timeout reached" | 5497 | msgid "NAT test timeout reached" |
5362 | msgstr "" | 5498 | msgstr "" |
5363 | 5499 | ||
5364 | #: src/nat/nat_api.c:914 src/nat/nat.c:2044 | 5500 | #: src/nat-auto/nat_auto_api.c:110 |
5365 | msgid "could not register NAT" | 5501 | msgid "could not register NAT" |
5366 | msgstr "" | 5502 | msgstr "" |
5367 | 5503 | ||
5368 | #: src/nat/nat_api.c:916 src/nat/nat.c:2046 | 5504 | #: src/nat-auto/nat_auto_api.c:112 |
5369 | msgid "No working gnunet-helper-nat-client installation found" | 5505 | msgid "No working gnunet-helper-nat-client installation found" |
5370 | msgstr "" | 5506 | msgstr "" |
5371 | 5507 | ||
5372 | #: src/nat/nat_auto.c:385 | 5508 | #: src/nat-auto/nat_auto_api_test.c:477 |
5373 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5374 | msgstr "" | ||
5375 | |||
5376 | #: src/nat/nat_auto.c:386 | ||
5377 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5378 | msgstr "" | ||
5379 | |||
5380 | #: src/nat/nat_auto.c:405 | ||
5381 | msgid "Testing connection reversal with ICMP server.\n" | ||
5382 | msgstr "" | ||
5383 | |||
5384 | #: src/nat/nat_auto.c:437 | ||
5385 | #, fuzzy, c-format | 5509 | #, fuzzy, c-format |
5386 | msgid "Detected external IP `%s'\n" | 5510 | msgid "Failed to find valid PORT in section `%s'\n" |
5387 | msgstr "Ungültiger RPC `%s' empfangen.\n" | 5511 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" |
5388 | 5512 | ||
5389 | #: src/nat/nat_auto.c:572 | 5513 | #: src/nat/gnunet-nat.c:424 |
5390 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | 5514 | msgid "which IP and port are we locally using to bind/listen to" |
5391 | msgstr "" | 5515 | msgstr "" |
5392 | 5516 | ||
5393 | #: src/nat/nat_auto.c:590 | 5517 | #: src/nat/gnunet-nat.c:427 |
5394 | #, c-format | 5518 | msgid "which remote IP and port should be asked for connection reversal" |
5395 | msgid "Detected internal network address `%s'.\n" | ||
5396 | msgstr "" | 5519 | msgstr "" |
5397 | 5520 | ||
5398 | #: src/nat/nat_auto.c:681 src/nat/nat_test.c:403 | 5521 | #: src/nat/gnunet-nat.c:430 |
5399 | #, fuzzy | 5522 | msgid "" |
5400 | msgid "Failed to connect to `gnunet-nat-server'\n" | 5523 | "name of configuration section to find additional options, such as manual " |
5401 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 5524 | "host punching data" |
5402 | |||
5403 | #: src/nat/nat_auto.c:724 | ||
5404 | msgid "upnpc found, enabling its use\n" | ||
5405 | msgstr "" | 5525 | msgstr "" |
5406 | 5526 | ||
5407 | #: src/nat/nat_auto.c:725 | 5527 | #: src/nat/gnunet-nat.c:433 |
5408 | #, fuzzy | 5528 | msgid "enable STUN processing" |
5409 | msgid "upnpc not found\n" | ||
5410 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | ||
5411 | |||
5412 | #: src/nat/nat_auto.c:762 | ||
5413 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5414 | msgstr "" | 5529 | msgstr "" |
5415 | 5530 | ||
5416 | #: src/nat/nat_auto.c:774 src/nat/nat_auto.c:834 | 5531 | #: src/nat/gnunet-nat.c:442 |
5417 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | 5532 | msgid "watch for connection reversal requests" |
5418 | msgstr "" | 5533 | msgstr "" |
5419 | 5534 | ||
5420 | #: src/nat/nat_auto.c:786 src/nat/nat_auto.c:846 | 5535 | #: src/nat/gnunet-nat.c:454 |
5421 | msgid "No working gnunet-helper-nat-server found\n" | 5536 | msgid "GNUnet NAT traversal autoconfigure daemon" |
5422 | msgstr "" | 5537 | msgstr "" |
5423 | 5538 | ||
5424 | #: src/nat/nat_auto.c:823 | 5539 | #: src/nat/gnunet-service-nat.c:1313 |
5425 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | 5540 | #, c-format |
5541 | msgid "Malformed punched hole specification `%s' (lacks port)\n" | ||
5426 | msgstr "" | 5542 | msgstr "" |
5427 | 5543 | ||
5428 | #: src/nat/nat.c:1019 | 5544 | #: src/nat/gnunet-service-nat.c:1323 |
5429 | #, c-format | 5545 | #, c-format |
5430 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" | 5546 | msgid "Invalid port number in punched hole specification `%s' (lacks port)\n" |
5431 | msgstr "" | 5547 | msgstr "" |
5432 | 5548 | ||
5433 | #: src/nat/nat.c:1070 | 5549 | #: src/nat/gnunet-service-nat.c:1339 |
5434 | #, fuzzy, c-format | 5550 | #, c-format |
5435 | msgid "Failed to start %s\n" | 5551 | msgid "Malformed punched hole specification `%s' (lacks `]')\n" |
5436 | msgstr "Fehler beim Starten der Collection.\n" | ||
5437 | |||
5438 | #: src/nat/nat.c:1327 | ||
5439 | msgid "Error while running upnp client:\n" | ||
5440 | msgstr "" | 5552 | msgstr "" |
5441 | 5553 | ||
5442 | #: src/nat/nat.c:1402 | 5554 | #: src/nat/gnunet-service-nat.c:1350 |
5443 | #, fuzzy, c-format | 5555 | #, c-format |
5444 | msgid "Failed to run upnp client for port %u\n" | 5556 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
5445 | msgstr "SQLite Datenbank konnte nicht initialisiert werden.\n" | ||
5446 | |||
5447 | #: src/nat/nat.c:1546 | ||
5448 | msgid "malformed" | ||
5449 | msgstr "" | 5557 | msgstr "" |
5450 | 5558 | ||
5451 | #: src/nat/nat.c:1600 | 5559 | #: src/nat/gnunet-service-nat.c:1803 |
5560 | #, fuzzy | ||
5561 | msgid "Connection reversal request failed\n" | ||
5562 | msgstr " Verbindung fehlgeschlagen\n" | ||
5563 | |||
5564 | #: src/nat/gnunet-service-nat.c:1876 | ||
5452 | msgid "" | 5565 | msgid "" |
5453 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 5566 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
5454 | "disabling UPnP \n" | 5567 | "disabling UPnP\n" |
5455 | msgstr "" | 5568 | msgstr "" |
5456 | 5569 | ||
5457 | #: src/nat/nat.c:1726 src/nat/nat.c:1739 | 5570 | #: src/nat/gnunet-service-nat_helper.c:186 |
5458 | #, c-format | 5571 | #, c-format |
5459 | msgid "" | 5572 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" |
5460 | "Configuration requires `%s', but binary is not installed properly (SUID bit " | ||
5461 | "not set). Option disabled.\n" | ||
5462 | msgstr "" | ||
5463 | |||
5464 | #: src/nat/nat.c:1903 | ||
5465 | msgid "Internal IP address not known, cannot use ICMP NAT traversal method\n" | ||
5466 | msgstr "" | 5573 | msgstr "" |
5467 | 5574 | ||
5468 | #: src/nat/nat.c:1919 | 5575 | #: src/nat/gnunet-service-nat_helper.c:260 |
5469 | #, c-format | 5576 | #, fuzzy, c-format |
5470 | msgid "Running gnunet-helper-nat-client %s %s %u\n" | 5577 | msgid "Failed to start %s\n" |
5471 | msgstr "" | 5578 | msgstr "Fehler beim Starten der Collection.\n" |
5472 | 5579 | ||
5473 | #: src/nat/nat_mini.c:205 | 5580 | #: src/nat/gnunet-service-nat_mini.c:196 |
5474 | #, fuzzy | 5581 | #, fuzzy |
5475 | msgid "`external-ip' command not found\n" | 5582 | msgid "`external-ip' command not found\n" |
5476 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | 5583 | msgstr "Kommando `%s' wurde nicht gefunden!\n" |
5477 | 5584 | ||
5478 | #: src/nat/nat_mini.c:611 | 5585 | #: src/nat/gnunet-service-nat_mini.c:654 |
5479 | #, fuzzy | 5586 | #, fuzzy |
5480 | msgid "`upnpc' command not found\n" | 5587 | msgid "`upnpc' command not found\n" |
5481 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | 5588 | msgstr "Kommando `%s' wurde nicht gefunden!\n" |
5482 | 5589 | ||
5483 | #: src/nat/nat_test.c:518 | ||
5484 | #, c-format | ||
5485 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5486 | msgstr "" | ||
5487 | |||
5488 | #: src/nat/nat_test.c:568 | ||
5489 | #, fuzzy | ||
5490 | msgid "NAT test failed to start NAT library\n" | ||
5491 | msgstr "Fehler beim Senden einer `%s' Anfrage an den SMTP Server.\n" | ||
5492 | |||
5493 | #: src/nse/gnunet-nse.c:122 | 5590 | #: src/nse/gnunet-nse.c:122 |
5494 | msgid "Show network size estimates from NSE service." | 5591 | msgid "Show network size estimates from NSE service." |
5495 | msgstr "" | 5592 | msgstr "" |
@@ -7256,175 +7353,152 @@ msgstr "" | |||
7256 | msgid "# validations succeeded" | 7353 | msgid "# validations succeeded" |
7257 | msgstr "" | 7354 | msgstr "" |
7258 | 7355 | ||
7259 | #: src/transport/gnunet-transport.c:486 | 7356 | #: src/transport/gnunet-transport.c:418 |
7260 | #, c-format | 7357 | #, c-format |
7261 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" | 7358 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" |
7262 | msgstr "" | 7359 | msgstr "" |
7263 | 7360 | ||
7264 | #: src/transport/gnunet-transport.c:496 | 7361 | #: src/transport/gnunet-transport.c:428 |
7265 | #, c-format | 7362 | #, c-format |
7266 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" | 7363 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" |
7267 | msgstr "" | 7364 | msgstr "" |
7268 | 7365 | ||
7269 | #: src/transport/gnunet-transport.c:540 | 7366 | #: src/transport/gnunet-transport.c:472 |
7270 | #, fuzzy, c-format | 7367 | #, fuzzy, c-format |
7271 | msgid "Failed to connect to `%s'\n" | 7368 | msgid "Failed to connect to `%s'\n" |
7272 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 7369 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
7273 | 7370 | ||
7274 | #: src/transport/gnunet-transport.c:553 | 7371 | #: src/transport/gnunet-transport.c:485 |
7275 | #, fuzzy, c-format | 7372 | #, fuzzy, c-format |
7276 | msgid "Failed to resolve address for peer `%s'\n" | 7373 | msgid "Failed to resolve address for peer `%s'\n" |
7277 | msgstr "Adresse des Knotens `%s' konnte nicht ermittelt werden.\n" | 7374 | msgstr "Adresse des Knotens `%s' konnte nicht ermittelt werden.\n" |
7278 | 7375 | ||
7279 | #: src/transport/gnunet-transport.c:565 | 7376 | #: src/transport/gnunet-transport.c:499 |
7280 | #, fuzzy | 7377 | #, fuzzy |
7281 | msgid "Failed to list connections, timeout occured\n" | 7378 | msgid "Failed to list connections, timeout occured\n" |
7282 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 7379 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
7283 | 7380 | ||
7284 | #: src/transport/gnunet-transport.c:588 | 7381 | #: src/transport/gnunet-transport.c:532 |
7285 | #, c-format | ||
7286 | msgid "NAT plugin `%s' reports: %s\n" | ||
7287 | msgstr "" | ||
7288 | |||
7289 | #: src/transport/gnunet-transport.c:675 | ||
7290 | msgid "No transport plugins configured, peer will never communicate\n" | ||
7291 | msgstr "" | ||
7292 | |||
7293 | #: src/transport/gnunet-transport.c:689 | ||
7294 | #, c-format | ||
7295 | msgid "No port configured for plugin `%s', cannot test it\n" | ||
7296 | msgstr "" | ||
7297 | |||
7298 | #: src/transport/gnunet-transport.c:714 | ||
7299 | #, fuzzy | ||
7300 | msgid "Failed to start resolver!\n" | ||
7301 | msgstr "Fehler beim Starten der Collection.\n" | ||
7302 | |||
7303 | #: src/transport/gnunet-transport.c:750 | ||
7304 | #, c-format | 7382 | #, c-format |
7305 | msgid "Transmitting %u bytes\n" | 7383 | msgid "Transmitting %u bytes\n" |
7306 | msgstr "" | 7384 | msgstr "" |
7307 | 7385 | ||
7308 | #: src/transport/gnunet-transport.c:784 | 7386 | #: src/transport/gnunet-transport.c:566 |
7309 | #, c-format | 7387 | #, c-format |
7310 | msgid "" | 7388 | msgid "" |
7311 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " | 7389 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " |
7312 | "blocks\n" | 7390 | "blocks\n" |
7313 | msgstr "" | 7391 | msgstr "" |
7314 | 7392 | ||
7315 | #: src/transport/gnunet-transport.c:815 | 7393 | #: src/transport/gnunet-transport.c:597 |
7316 | #, c-format | 7394 | #, c-format |
7317 | msgid "Disconnected from peer `%s' while benchmarking\n" | 7395 | msgid "Disconnected from peer `%s' while benchmarking\n" |
7318 | msgstr "" | 7396 | msgstr "" |
7319 | 7397 | ||
7320 | #: src/transport/gnunet-transport.c:839 src/transport/gnunet-transport.c:868 | 7398 | #: src/transport/gnunet-transport.c:621 src/transport/gnunet-transport.c:650 |
7321 | #, c-format | 7399 | #, c-format |
7322 | msgid "%24s: %-17s %4s (%u connections in total)\n" | 7400 | msgid "%24s: %-17s %4s (%u connections in total)\n" |
7323 | msgstr "%24s: %-17s %4s (%u Verbindungen insgesamt)\n" | 7401 | msgstr "%24s: %-17s %4s (%u Verbindungen insgesamt)\n" |
7324 | 7402 | ||
7325 | #: src/transport/gnunet-transport.c:841 | 7403 | #: src/transport/gnunet-transport.c:623 |
7326 | msgid "Connected to" | 7404 | msgid "Connected to" |
7327 | msgstr "Verbunden mit" | 7405 | msgstr "Verbunden mit" |
7328 | 7406 | ||
7329 | #: src/transport/gnunet-transport.c:870 | 7407 | #: src/transport/gnunet-transport.c:652 |
7330 | msgid "Disconnected from" | 7408 | msgid "Disconnected from" |
7331 | msgstr "" | 7409 | msgstr "" |
7332 | 7410 | ||
7333 | #: src/transport/gnunet-transport.c:905 | 7411 | #: src/transport/gnunet-transport.c:687 |
7334 | #, fuzzy, c-format | 7412 | #, fuzzy, c-format |
7335 | msgid "Received %u bytes\n" | 7413 | msgid "Received %u bytes\n" |
7336 | msgstr "Dateien aus dem GNUnet herunterladen." | 7414 | msgstr "Dateien aus dem GNUnet herunterladen." |
7337 | 7415 | ||
7338 | #: src/transport/gnunet-transport.c:942 | 7416 | #: src/transport/gnunet-transport.c:724 |
7339 | #, c-format | 7417 | #, c-format |
7340 | msgid "Peer `%s': %s %s in state `%s' until %s\n" | 7418 | msgid "Peer `%s': %s %s in state `%s' until %s\n" |
7341 | msgstr "" | 7419 | msgstr "" |
7342 | 7420 | ||
7343 | #: src/transport/gnunet-transport.c:954 | 7421 | #: src/transport/gnunet-transport.c:736 |
7344 | #, c-format | 7422 | #, c-format |
7345 | msgid "Peer `%s': %s %s\n" | 7423 | msgid "Peer `%s': %s %s\n" |
7346 | msgstr "Knoten »%s«: %s %s\n" | 7424 | msgstr "Knoten »%s«: %s %s\n" |
7347 | 7425 | ||
7348 | #: src/transport/gnunet-transport.c:1366 | 7426 | #: src/transport/gnunet-transport.c:1150 |
7349 | #, fuzzy | 7427 | #, fuzzy |
7350 | msgid "Monitor disconnected from transport service. Reconnecting.\n" | 7428 | msgid "Monitor disconnected from transport service. Reconnecting.\n" |
7351 | msgstr "Verbindung zum Transportdienst konnte nicht hergestellt werden\n" | 7429 | msgstr "Verbindung zum Transportdienst konnte nicht hergestellt werden\n" |
7352 | 7430 | ||
7353 | #: src/transport/gnunet-transport.c:1488 | 7431 | #: src/transport/gnunet-transport.c:1267 |
7354 | #, c-format | 7432 | #, c-format |
7355 | msgid "" | 7433 | msgid "" |
7356 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " | 7434 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " |
7357 | "%s, %s %s\n" | 7435 | "%s, %s %s\n" |
7358 | msgstr "" | 7436 | msgstr "" |
7359 | 7437 | ||
7360 | #: src/transport/gnunet-transport.c:1501 | 7438 | #: src/transport/gnunet-transport.c:1280 |
7361 | #, c-format | 7439 | #, c-format |
7362 | msgid "" | 7440 | msgid "" |
7363 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" | 7441 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" |
7364 | msgstr "" | 7442 | msgstr "" |
7365 | 7443 | ||
7366 | #: src/transport/gnunet-transport.c:1529 | 7444 | #: src/transport/gnunet-transport.c:1308 |
7367 | #, fuzzy | 7445 | #, fuzzy |
7368 | msgid "Failed to connect to transport service for disconnection\n" | 7446 | msgid "Failed to connect to transport service for disconnection\n" |
7369 | msgstr "Verbindung zum Transportdienst konnte nicht hergestellt werden\n" | 7447 | msgstr "Verbindung zum Transportdienst konnte nicht hergestellt werden\n" |
7370 | 7448 | ||
7371 | #: src/transport/gnunet-transport.c:1535 | 7449 | #: src/transport/gnunet-transport.c:1314 |
7372 | msgid "Blacklisting request in place, stop with CTRL-C\n" | 7450 | msgid "Blacklisting request in place, stop with CTRL-C\n" |
7373 | msgstr "" | 7451 | msgstr "" |
7374 | 7452 | ||
7375 | #: src/transport/gnunet-transport.c:1558 src/transport/gnunet-transport.c:1588 | 7453 | #: src/transport/gnunet-transport.c:1337 src/transport/gnunet-transport.c:1367 |
7376 | #: src/transport/gnunet-transport.c:1641 | 7454 | #: src/transport/gnunet-transport.c:1420 |
7377 | msgid "Failed to connect to transport service\n" | 7455 | msgid "Failed to connect to transport service\n" |
7378 | msgstr "Verbindung zum Transportdienst konnte nicht hergestellt werden\n" | 7456 | msgstr "Verbindung zum Transportdienst konnte nicht hergestellt werden\n" |
7379 | 7457 | ||
7380 | #: src/transport/gnunet-transport.c:1595 | 7458 | #: src/transport/gnunet-transport.c:1374 |
7381 | msgid "Starting to receive benchmark data\n" | 7459 | msgid "Starting to receive benchmark data\n" |
7382 | msgstr "" | 7460 | msgstr "" |
7383 | 7461 | ||
7384 | #: src/transport/gnunet-transport.c:1665 | 7462 | #: src/transport/gnunet-transport.c:1444 |
7385 | #, fuzzy | 7463 | #, fuzzy |
7386 | msgid "print information for all peers (instead of only connected peers)" | 7464 | msgid "print information for all peers (instead of only connected peers)" |
7387 | msgstr "Informationen über verbundene Knoten ausgeben." | 7465 | msgstr "Informationen über verbundene Knoten ausgeben." |
7388 | 7466 | ||
7389 | #: src/transport/gnunet-transport.c:1668 | 7467 | #: src/transport/gnunet-transport.c:1447 |
7390 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" | 7468 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" |
7391 | msgstr "" | 7469 | msgstr "" |
7392 | 7470 | ||
7393 | #: src/transport/gnunet-transport.c:1671 | 7471 | #: src/transport/gnunet-transport.c:1450 |
7394 | msgid "disconnect from a peer" | 7472 | msgid "disconnect from a peer" |
7395 | msgstr "Verbindung zu einem Knoten trennen" | 7473 | msgstr "Verbindung zu einem Knoten trennen" |
7396 | 7474 | ||
7397 | #: src/transport/gnunet-transport.c:1674 | 7475 | #: src/transport/gnunet-transport.c:1453 |
7398 | msgid "provide information about all current connections (once)" | 7476 | msgid "provide information about all current connections (once)" |
7399 | msgstr "" | 7477 | msgstr "" |
7400 | 7478 | ||
7401 | #: src/transport/gnunet-transport.c:1680 | 7479 | #: src/transport/gnunet-transport.c:1459 |
7402 | msgid "" | 7480 | msgid "" |
7403 | "provide information about all connects and disconnect events (continuously)" | 7481 | "provide information about all connects and disconnect events (continuously)" |
7404 | msgstr "" | 7482 | msgstr "" |
7405 | 7483 | ||
7406 | #: src/transport/gnunet-transport.c:1683 | 7484 | #: src/transport/gnunet-transport.c:1462 |
7407 | msgid "do not resolve hostnames" | 7485 | msgid "do not resolve hostnames" |
7408 | msgstr "Keine Rechnernamen auflösen" | 7486 | msgstr "Keine Rechnernamen auflösen" |
7409 | 7487 | ||
7410 | #: src/transport/gnunet-transport.c:1686 | 7488 | #: src/transport/gnunet-transport.c:1465 |
7411 | #: src/transport/gnunet-transport-profiler.c:631 | 7489 | #: src/transport/gnunet-transport-profiler.c:631 |
7412 | msgid "peer identity" | 7490 | msgid "peer identity" |
7413 | msgstr "" | 7491 | msgstr "" |
7414 | 7492 | ||
7415 | #: src/transport/gnunet-transport.c:1689 | 7493 | #: src/transport/gnunet-transport.c:1468 |
7416 | msgid "monitor plugin sessions" | 7494 | msgid "monitor plugin sessions" |
7417 | msgstr "" | 7495 | msgstr "" |
7418 | 7496 | ||
7419 | #: src/transport/gnunet-transport.c:1692 | 7497 | #: src/transport/gnunet-transport.c:1471 |
7420 | msgid "send data for benchmarking to the other peer (until CTRL-C)" | 7498 | msgid "send data for benchmarking to the other peer (until CTRL-C)" |
7421 | msgstr "" | 7499 | msgstr "" |
7422 | 7500 | ||
7423 | #: src/transport/gnunet-transport.c:1695 | 7501 | #: src/transport/gnunet-transport.c:1482 |
7424 | msgid "test transport configuration (involves external server)" | ||
7425 | msgstr "" | ||
7426 | |||
7427 | #: src/transport/gnunet-transport.c:1706 | ||
7428 | #: src/transport/gnunet-transport-profiler.c:642 | 7502 | #: src/transport/gnunet-transport-profiler.c:642 |
7429 | msgid "Direct access to transport service." | 7503 | msgid "Direct access to transport service." |
7430 | msgstr "Direkter Zugriff auf den Transportdienst" | 7504 | msgstr "Direkter Zugriff auf den Transportdienst" |
@@ -7458,9 +7532,9 @@ msgstr "" | |||
7458 | 7532 | ||
7459 | #: src/transport/plugin_transport_http_client.c:1477 | 7533 | #: src/transport/plugin_transport_http_client.c:1477 |
7460 | #: src/transport/plugin_transport_http_server.c:2248 | 7534 | #: src/transport/plugin_transport_http_server.c:2248 |
7461 | #: src/transport/plugin_transport_http_server.c:3457 | 7535 | #: src/transport/plugin_transport_http_server.c:3462 |
7462 | #: src/transport/plugin_transport_tcp.c:3365 | 7536 | #: src/transport/plugin_transport_tcp.c:3375 |
7463 | #: src/transport/plugin_transport_tcp.c:3372 | 7537 | #: src/transport/plugin_transport_tcp.c:3382 |
7464 | msgid "TCP_STEALTH not supported on this platform.\n" | 7538 | msgid "TCP_STEALTH not supported on this platform.\n" |
7465 | msgstr "" | 7539 | msgstr "" |
7466 | 7540 | ||
@@ -7470,13 +7544,13 @@ msgid "Could not initialize curl multi handle, failed to start %s plugin!\n" | |||
7470 | msgstr "" | 7544 | msgstr "" |
7471 | 7545 | ||
7472 | #: src/transport/plugin_transport_http_client.c:2167 | 7546 | #: src/transport/plugin_transport_http_client.c:2167 |
7473 | #: src/transport/plugin_transport_http_server.c:3172 | 7547 | #: src/transport/plugin_transport_http_server.c:3177 |
7474 | #, fuzzy, c-format | 7548 | #, fuzzy, c-format |
7475 | msgid "Shutting down plugin `%s'\n" | 7549 | msgid "Shutting down plugin `%s'\n" |
7476 | msgstr "Collection `%s' begonnen.\n" | 7550 | msgstr "Collection `%s' begonnen.\n" |
7477 | 7551 | ||
7478 | #: src/transport/plugin_transport_http_client.c:2184 | 7552 | #: src/transport/plugin_transport_http_client.c:2184 |
7479 | #: src/transport/plugin_transport_http_server.c:3242 | 7553 | #: src/transport/plugin_transport_http_server.c:3247 |
7480 | #, fuzzy, c-format | 7554 | #, fuzzy, c-format |
7481 | msgid "Shutdown for plugin `%s' complete\n" | 7555 | msgid "Shutdown for plugin `%s' complete\n" |
7482 | msgstr "GNUnet wurde erfolgreich heruntergefahren.\n" | 7556 | msgstr "GNUnet wurde erfolgreich heruntergefahren.\n" |
@@ -7519,70 +7593,70 @@ msgstr "" | |||
7519 | msgid "Could not load or create server certificate! Loading plugin failed!\n" | 7593 | msgid "Could not load or create server certificate! Loading plugin failed!\n" |
7520 | msgstr "" | 7594 | msgstr "" |
7521 | 7595 | ||
7522 | #: src/transport/plugin_transport_http_server.c:2583 | 7596 | #: src/transport/plugin_transport_http_server.c:2586 |
7523 | msgid "Require valid port number for service in configuration!\n" | 7597 | msgid "Require valid port number for service in configuration!\n" |
7524 | msgstr "" | 7598 | msgstr "" |
7525 | 7599 | ||
7526 | #: src/transport/plugin_transport_http_server.c:2748 | 7600 | #: src/transport/plugin_transport_http_server.c:2751 |
7527 | #, c-format | 7601 | #, c-format |
7528 | msgid "Found %u addresses to report to NAT service\n" | 7602 | msgid "Found %u addresses to report to NAT service\n" |
7529 | msgstr "" | 7603 | msgstr "" |
7530 | 7604 | ||
7531 | #: src/transport/plugin_transport_http_server.c:2832 | 7605 | #: src/transport/plugin_transport_http_server.c:2837 |
7532 | #: src/transport/plugin_transport_udp.c:3600 | 7606 | #: src/transport/plugin_transport_udp.c:3623 |
7533 | msgid "Disabling IPv6 since it is not supported on this system!\n" | 7607 | msgid "Disabling IPv6 since it is not supported on this system!\n" |
7534 | msgstr "" | 7608 | msgstr "" |
7535 | 7609 | ||
7536 | #: src/transport/plugin_transport_http_server.c:2938 | 7610 | #: src/transport/plugin_transport_http_server.c:2943 |
7537 | #, c-format | 7611 | #, c-format |
7538 | msgid "IPv4 support is %s\n" | 7612 | msgid "IPv4 support is %s\n" |
7539 | msgstr "" | 7613 | msgstr "" |
7540 | 7614 | ||
7541 | #: src/transport/plugin_transport_http_server.c:2953 | 7615 | #: src/transport/plugin_transport_http_server.c:2958 |
7542 | #, c-format | 7616 | #, c-format |
7543 | msgid "IPv6 support is %s\n" | 7617 | msgid "IPv6 support is %s\n" |
7544 | msgstr "" | 7618 | msgstr "" |
7545 | 7619 | ||
7546 | #: src/transport/plugin_transport_http_server.c:2959 | 7620 | #: src/transport/plugin_transport_http_server.c:2964 |
7547 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" | 7621 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" |
7548 | msgstr "" | 7622 | msgstr "" |
7549 | "Weder IPv4 noch IPv6 sind aktiviert! Bearbeiten Sie die Konfiguration\n" | 7623 | "Weder IPv4 noch IPv6 sind aktiviert! Bearbeiten Sie die Konfiguration\n" |
7550 | 7624 | ||
7551 | #: src/transport/plugin_transport_http_server.c:2970 | 7625 | #: src/transport/plugin_transport_http_server.c:2975 |
7552 | msgid "Port is required! Fix in configuration\n" | 7626 | msgid "Port is required! Fix in configuration\n" |
7553 | msgstr "Port ist erforderlich! Bearbeiten Sie die Konfiguration\n" | 7627 | msgstr "Port ist erforderlich! Bearbeiten Sie die Konfiguration\n" |
7554 | 7628 | ||
7555 | #: src/transport/plugin_transport_http_server.c:2976 | 7629 | #: src/transport/plugin_transport_http_server.c:2981 |
7556 | #, c-format | 7630 | #, c-format |
7557 | msgid "Using port %u\n" | 7631 | msgid "Using port %u\n" |
7558 | msgstr "Port %u wird verwendet\n" | 7632 | msgstr "Port %u wird verwendet\n" |
7559 | 7633 | ||
7560 | #: src/transport/plugin_transport_http_server.c:2995 | 7634 | #: src/transport/plugin_transport_http_server.c:3000 |
7561 | #, c-format | 7635 | #, c-format |
7562 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" | 7636 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" |
7563 | msgstr "" | 7637 | msgstr "" |
7564 | 7638 | ||
7565 | #: src/transport/plugin_transport_http_server.c:3030 | 7639 | #: src/transport/plugin_transport_http_server.c:3035 |
7566 | #, c-format | 7640 | #, c-format |
7567 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" | 7641 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" |
7568 | msgstr "" | 7642 | msgstr "" |
7569 | 7643 | ||
7570 | #: src/transport/plugin_transport_http_server.c:3105 | 7644 | #: src/transport/plugin_transport_http_server.c:3110 |
7571 | #, c-format | 7645 | #, c-format |
7572 | msgid "Using external hostname `%s'\n" | 7646 | msgid "Using external hostname `%s'\n" |
7573 | msgstr "" | 7647 | msgstr "" |
7574 | 7648 | ||
7575 | #: src/transport/plugin_transport_http_server.c:3126 | 7649 | #: src/transport/plugin_transport_http_server.c:3131 |
7576 | #, fuzzy, c-format | 7650 | #, fuzzy, c-format |
7577 | msgid "Notifying transport only about hostname `%s'\n" | 7651 | msgid "Notifying transport only about hostname `%s'\n" |
7578 | msgstr "Teste Transport(e) %s\n" | 7652 | msgstr "Teste Transport(e) %s\n" |
7579 | 7653 | ||
7580 | #: src/transport/plugin_transport_http_server.c:3143 | 7654 | #: src/transport/plugin_transport_http_server.c:3148 |
7581 | #, c-format | 7655 | #, c-format |
7582 | msgid "Maximum number of connections is %u\n" | 7656 | msgid "Maximum number of connections is %u\n" |
7583 | msgstr "Maximale Anzahl der Verbindungen ist %u\n" | 7657 | msgstr "Maximale Anzahl der Verbindungen ist %u\n" |
7584 | 7658 | ||
7585 | #: src/transport/plugin_transport_http_server.c:3469 | 7659 | #: src/transport/plugin_transport_http_server.c:3474 |
7586 | msgid "Unable to compile URL regex\n" | 7660 | msgid "Unable to compile URL regex\n" |
7587 | msgstr "" | 7661 | msgstr "" |
7588 | 7662 | ||
@@ -7632,160 +7706,160 @@ msgstr "# Bytes gesendet über SMTP" | |||
7632 | msgid "# bytes dropped by SMTP (outgoing)" | 7706 | msgid "# bytes dropped by SMTP (outgoing)" |
7633 | msgstr "# Bytes verworfen von SMTP (ausgehend)" | 7707 | msgstr "# Bytes verworfen von SMTP (ausgehend)" |
7634 | 7708 | ||
7635 | #: src/transport/plugin_transport_tcp.c:1051 | 7709 | #: src/transport/plugin_transport_tcp.c:1060 |
7636 | #: src/transport/plugin_transport_tcp.c:2362 | 7710 | #: src/transport/plugin_transport_tcp.c:2379 |
7637 | #, c-format | 7711 | #, c-format |
7638 | msgid "Unexpected address length: %u bytes\n" | 7712 | msgid "Unexpected address length: %u bytes\n" |
7639 | msgstr "" | 7713 | msgstr "" |
7640 | 7714 | ||
7641 | #: src/transport/plugin_transport_tcp.c:1234 | 7715 | #: src/transport/plugin_transport_tcp.c:1243 |
7642 | #: src/transport/plugin_transport_tcp.c:1458 | 7716 | #: src/transport/plugin_transport_tcp.c:1467 |
7643 | #: src/transport/plugin_transport_tcp.c:2633 | 7717 | #: src/transport/plugin_transport_tcp.c:2643 |
7644 | #: src/transport/plugin_transport_tcp.c:3490 | 7718 | #: src/transport/plugin_transport_tcp.c:3498 |
7645 | msgid "# TCP sessions active" | 7719 | msgid "# TCP sessions active" |
7646 | msgstr "# aktive TCP-Sitzungen" | 7720 | msgstr "# aktive TCP-Sitzungen" |
7647 | 7721 | ||
7648 | #: src/transport/plugin_transport_tcp.c:1276 | 7722 | #: src/transport/plugin_transport_tcp.c:1285 |
7649 | #: src/transport/plugin_transport_tcp.c:1440 | 7723 | #: src/transport/plugin_transport_tcp.c:1449 |
7650 | #: src/transport/plugin_transport_tcp.c:1564 | 7724 | #: src/transport/plugin_transport_tcp.c:1573 |
7651 | #: src/transport/plugin_transport_tcp.c:1637 | 7725 | #: src/transport/plugin_transport_tcp.c:1646 |
7652 | #: src/transport/plugin_transport_tcp.c:1737 | 7726 | #: src/transport/plugin_transport_tcp.c:1746 |
7653 | #: src/transport/plugin_transport_tcp.c:1762 | 7727 | #: src/transport/plugin_transport_tcp.c:1771 |
7654 | msgid "# bytes currently in TCP buffers" | 7728 | msgid "# bytes currently in TCP buffers" |
7655 | msgstr "# Bytes derzeit in TCP-Puffern" | 7729 | msgstr "# Bytes derzeit in TCP-Puffern" |
7656 | 7730 | ||
7657 | #: src/transport/plugin_transport_tcp.c:1279 | 7731 | #: src/transport/plugin_transport_tcp.c:1288 |
7658 | msgid "# bytes discarded by TCP (disconnect)" | 7732 | msgid "# bytes discarded by TCP (disconnect)" |
7659 | msgstr "# Bytes verworfen von TCP (unterbrochen)" | 7733 | msgstr "# Bytes verworfen von TCP (unterbrochen)" |
7660 | 7734 | ||
7661 | #: src/transport/plugin_transport_tcp.c:1567 | 7735 | #: src/transport/plugin_transport_tcp.c:1576 |
7662 | msgid "# bytes discarded by TCP (timeout)" | 7736 | msgid "# bytes discarded by TCP (timeout)" |
7663 | msgstr "# Bytes verworfen von TCP (Zeitüberschreitung)" | 7737 | msgstr "# Bytes verworfen von TCP (Zeitüberschreitung)" |
7664 | 7738 | ||
7665 | #: src/transport/plugin_transport_tcp.c:1641 | 7739 | #: src/transport/plugin_transport_tcp.c:1650 |
7666 | msgid "# bytes transmitted via TCP" | 7740 | msgid "# bytes transmitted via TCP" |
7667 | msgstr "# Bytes über TCP übertragen" | 7741 | msgstr "# Bytes über TCP übertragen" |
7668 | 7742 | ||
7669 | #: src/transport/plugin_transport_tcp.c:2032 | 7743 | #: src/transport/plugin_transport_tcp.c:2041 |
7670 | msgid "# requests to create session with invalid address" | 7744 | msgid "# requests to create session with invalid address" |
7671 | msgstr "" | 7745 | msgstr "" |
7672 | 7746 | ||
7673 | #: src/transport/plugin_transport_tcp.c:2200 | 7747 | #: src/transport/plugin_transport_tcp.c:2217 |
7674 | msgid "# transport-service disconnect requests for TCP" | 7748 | msgid "# transport-service disconnect requests for TCP" |
7675 | msgstr "" | 7749 | msgstr "" |
7676 | 7750 | ||
7677 | #: src/transport/plugin_transport_tcp.c:2692 | 7751 | #: src/transport/plugin_transport_tcp.c:2702 |
7678 | #, fuzzy | 7752 | #, fuzzy |
7679 | msgid "# TCP WELCOME messages received" | 7753 | msgid "# TCP WELCOME messages received" |
7680 | msgstr "# verschlüsselter PONG Nachrichten empfangen" | 7754 | msgstr "# verschlüsselter PONG Nachrichten empfangen" |
7681 | 7755 | ||
7682 | #: src/transport/plugin_transport_tcp.c:2883 | 7756 | #: src/transport/plugin_transport_tcp.c:2893 |
7683 | msgid "# bytes received via TCP" | 7757 | msgid "# bytes received via TCP" |
7684 | msgstr "# Bytes empfangen über TCP" | 7758 | msgstr "# Bytes empfangen über TCP" |
7685 | 7759 | ||
7686 | #: src/transport/plugin_transport_tcp.c:2934 | 7760 | #: src/transport/plugin_transport_tcp.c:2944 |
7687 | #: src/transport/plugin_transport_tcp.c:2992 | 7761 | #: src/transport/plugin_transport_tcp.c:3002 |
7688 | #, fuzzy | 7762 | #, fuzzy |
7689 | msgid "# TCP server connections active" | 7763 | msgid "# TCP server connections active" |
7690 | msgstr " Verbindung fehlgeschlagen\n" | 7764 | msgstr " Verbindung fehlgeschlagen\n" |
7691 | 7765 | ||
7692 | #: src/transport/plugin_transport_tcp.c:2938 | 7766 | #: src/transport/plugin_transport_tcp.c:2948 |
7693 | #, fuzzy | 7767 | #, fuzzy |
7694 | msgid "# TCP server connect events" | 7768 | msgid "# TCP server connect events" |
7695 | msgstr "# verbundener Knoten" | 7769 | msgstr "# verbundener Knoten" |
7696 | 7770 | ||
7697 | #: src/transport/plugin_transport_tcp.c:2944 | 7771 | #: src/transport/plugin_transport_tcp.c:2954 |
7698 | msgid "TCP connection limit reached, suspending server\n" | 7772 | msgid "TCP connection limit reached, suspending server\n" |
7699 | msgstr "" | 7773 | msgstr "" |
7700 | 7774 | ||
7701 | #: src/transport/plugin_transport_tcp.c:2946 | 7775 | #: src/transport/plugin_transport_tcp.c:2956 |
7702 | msgid "# TCP service suspended" | 7776 | msgid "# TCP service suspended" |
7703 | msgstr "" | 7777 | msgstr "" |
7704 | 7778 | ||
7705 | #: src/transport/plugin_transport_tcp.c:2986 | 7779 | #: src/transport/plugin_transport_tcp.c:2996 |
7706 | msgid "# TCP service resumed" | 7780 | msgid "# TCP service resumed" |
7707 | msgstr "" | 7781 | msgstr "" |
7708 | 7782 | ||
7709 | #: src/transport/plugin_transport_tcp.c:2996 | 7783 | #: src/transport/plugin_transport_tcp.c:3006 |
7710 | msgid "# network-level TCP disconnect events" | 7784 | msgid "# network-level TCP disconnect events" |
7711 | msgstr "" | 7785 | msgstr "" |
7712 | 7786 | ||
7713 | #: src/transport/plugin_transport_tcp.c:3315 | 7787 | #: src/transport/plugin_transport_tcp.c:3325 |
7714 | msgid "Failed to start service.\n" | 7788 | msgid "Failed to start service.\n" |
7715 | msgstr "Fehler beim Starten des Dienstes.\n" | 7789 | msgstr "Fehler beim Starten des Dienstes.\n" |
7716 | 7790 | ||
7717 | #: src/transport/plugin_transport_tcp.c:3478 | 7791 | #: src/transport/plugin_transport_tcp.c:3486 |
7718 | #, c-format | 7792 | #, c-format |
7719 | msgid "TCP transport listening on port %llu\n" | 7793 | msgid "TCP transport listening on port %llu\n" |
7720 | msgstr "TCP-Transportdienst wartet auf Port %llu\n" | 7794 | msgstr "TCP-Transportdienst wartet auf Port %llu\n" |
7721 | 7795 | ||
7722 | #: src/transport/plugin_transport_tcp.c:3482 | 7796 | #: src/transport/plugin_transport_tcp.c:3490 |
7723 | msgid "TCP transport not listening on any port (client only)\n" | 7797 | msgid "TCP transport not listening on any port (client only)\n" |
7724 | msgstr "" | 7798 | msgstr "" |
7725 | 7799 | ||
7726 | #: src/transport/plugin_transport_tcp.c:3486 | 7800 | #: src/transport/plugin_transport_tcp.c:3494 |
7727 | #, c-format | 7801 | #, c-format |
7728 | msgid "TCP transport advertises itself as being on port %llu\n" | 7802 | msgid "TCP transport advertises itself as being on port %llu\n" |
7729 | msgstr "" | 7803 | msgstr "" |
7730 | 7804 | ||
7731 | #: src/transport/plugin_transport_udp_broadcasting.c:170 | 7805 | #: src/transport/plugin_transport_udp_broadcasting.c:169 |
7732 | #, fuzzy | 7806 | #, fuzzy |
7733 | msgid "# Multicast HELLO beacons received via UDP" | 7807 | msgid "# Multicast HELLO beacons received via UDP" |
7734 | msgstr "# Bytes empfangen über TCP" | 7808 | msgstr "# Bytes empfangen über TCP" |
7735 | 7809 | ||
7736 | #: src/transport/plugin_transport_udp_broadcasting.c:546 | 7810 | #: src/transport/plugin_transport_udp_broadcasting.c:545 |
7737 | msgid "" | 7811 | msgid "" |
7738 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" | 7812 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" |
7739 | msgstr "" | 7813 | msgstr "" |
7740 | 7814 | ||
7741 | #: src/transport/plugin_transport_udp_broadcasting.c:567 | 7815 | #: src/transport/plugin_transport_udp_broadcasting.c:566 |
7742 | #, fuzzy, c-format | 7816 | #, fuzzy, c-format |
7743 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" | 7817 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" |
7744 | msgstr "Der Transportdienst auf Port %d konnte nicht gestartet werden.\n" | 7818 | msgstr "Der Transportdienst auf Port %d konnte nicht gestartet werden.\n" |
7745 | 7819 | ||
7746 | #: src/transport/plugin_transport_udp.c:3344 | 7820 | #: src/transport/plugin_transport_udp.c:3367 |
7747 | #, c-format | 7821 | #, c-format |
7748 | msgid "" | 7822 | msgid "" |
7749 | "UDP could not transmit message to `%s': Network seems down, please check " | 7823 | "UDP could not transmit message to `%s': Network seems down, please check " |
7750 | "your network configuration\n" | 7824 | "your network configuration\n" |
7751 | msgstr "" | 7825 | msgstr "" |
7752 | 7826 | ||
7753 | #: src/transport/plugin_transport_udp.c:3358 | 7827 | #: src/transport/plugin_transport_udp.c:3381 |
7754 | msgid "" | 7828 | msgid "" |
7755 | "UDP could not transmit IPv6 message! Please check your network configuration " | 7829 | "UDP could not transmit IPv6 message! Please check your network configuration " |
7756 | "and disable IPv6 if your connection does not have a global IPv6 address\n" | 7830 | "and disable IPv6 if your connection does not have a global IPv6 address\n" |
7757 | msgstr "" | 7831 | msgstr "" |
7758 | 7832 | ||
7759 | #: src/transport/plugin_transport_udp.c:3676 | 7833 | #: src/transport/plugin_transport_udp.c:3699 |
7760 | #: src/transport/plugin_transport_udp.c:3775 | 7834 | #: src/transport/plugin_transport_udp.c:3798 |
7761 | #, fuzzy, c-format | 7835 | #, fuzzy, c-format |
7762 | msgid "Failed to bind UDP socket to %s: %s\n" | 7836 | msgid "Failed to bind UDP socket to %s: %s\n" |
7763 | msgstr "UDP-Sockets können nicht geöffnet werden\n" | 7837 | msgstr "UDP-Sockets können nicht geöffnet werden\n" |
7764 | 7838 | ||
7765 | #: src/transport/plugin_transport_udp.c:3694 | 7839 | #: src/transport/plugin_transport_udp.c:3717 |
7766 | msgid "Disabling IPv4 since it is not supported on this system!\n" | 7840 | msgid "Disabling IPv4 since it is not supported on this system!\n" |
7767 | msgstr "" | 7841 | msgstr "" |
7768 | 7842 | ||
7769 | #: src/transport/plugin_transport_udp.c:3785 | 7843 | #: src/transport/plugin_transport_udp.c:3808 |
7770 | msgid "Failed to open UDP sockets\n" | 7844 | msgid "Failed to open UDP sockets\n" |
7771 | msgstr "UDP-Sockets können nicht geöffnet werden\n" | 7845 | msgstr "UDP-Sockets können nicht geöffnet werden\n" |
7772 | 7846 | ||
7773 | #: src/transport/plugin_transport_udp.c:3857 | 7847 | #: src/transport/plugin_transport_udp.c:3879 |
7774 | #: src/transport/plugin_transport_udp.c:3871 | 7848 | #: src/transport/plugin_transport_udp.c:3893 |
7775 | msgid "must be in [0,65535]" | 7849 | msgid "must be in [0,65535]" |
7776 | msgstr "" | 7850 | msgstr "" |
7777 | 7851 | ||
7778 | #: src/transport/plugin_transport_udp.c:3903 | 7852 | #: src/transport/plugin_transport_udp.c:3925 |
7779 | #, fuzzy | 7853 | #, fuzzy |
7780 | msgid "must be valid IPv4 address" | 7854 | msgid "must be valid IPv4 address" |
7781 | msgstr "»%s« ist keine gültige IP-Adresse.\n" | 7855 | msgstr "»%s« ist keine gültige IP-Adresse.\n" |
7782 | 7856 | ||
7783 | #: src/transport/plugin_transport_udp.c:3930 | 7857 | #: src/transport/plugin_transport_udp.c:3952 |
7784 | #, fuzzy | 7858 | #, fuzzy |
7785 | msgid "must be valid IPv6 address" | 7859 | msgid "must be valid IPv6 address" |
7786 | msgstr "»%s« ist keine gültige IP-Adresse.\n" | 7860 | msgstr "»%s« ist keine gültige IP-Adresse.\n" |
7787 | 7861 | ||
7788 | #: src/transport/plugin_transport_udp.c:3996 | 7862 | #: src/transport/plugin_transport_udp.c:4018 |
7789 | #, fuzzy | 7863 | #, fuzzy |
7790 | msgid "Failed to create UDP network sockets\n" | 7864 | msgid "Failed to create UDP network sockets\n" |
7791 | msgstr "UDP-Sockets können nicht geöffnet werden\n" | 7865 | msgstr "UDP-Sockets können nicht geöffnet werden\n" |
@@ -7905,7 +7979,7 @@ msgstr "" | |||
7905 | msgid "Metadata `%s' failed to deserialize" | 7979 | msgid "Metadata `%s' failed to deserialize" |
7906 | msgstr "" | 7980 | msgstr "" |
7907 | 7981 | ||
7908 | #: src/util/client_new.c:864 | 7982 | #: src/util/client.c:864 |
7909 | #, c-format | 7983 | #, c-format |
7910 | msgid "Need a non-empty hostname for service `%s'.\n" | 7984 | msgid "Need a non-empty hostname for service `%s'.\n" |
7911 | msgstr "" | 7985 | msgstr "" |
@@ -8683,42 +8757,42 @@ msgstr "IPv6-Adresse enthält keine gültige Portnummer nach dem letzten »:«\n | |||
8683 | msgid "Invalid IPv6 address `%s': %s\n" | 8757 | msgid "Invalid IPv6 address `%s': %s\n" |
8684 | msgstr "Ungültige Antwort auf `%s' von `%s'\n" | 8758 | msgstr "Ungültige Antwort auf `%s' von `%s'\n" |
8685 | 8759 | ||
8686 | #: src/util/strings.c:1475 src/util/strings.c:1491 | 8760 | #: src/util/strings.c:1541 src/util/strings.c:1557 |
8687 | msgid "Port not in range\n" | 8761 | msgid "Port not in range\n" |
8688 | msgstr "Port außerhalb des Bereichs\n" | 8762 | msgstr "Port außerhalb des Bereichs\n" |
8689 | 8763 | ||
8690 | #: src/util/strings.c:1500 | 8764 | #: src/util/strings.c:1566 |
8691 | #, c-format | 8765 | #, c-format |
8692 | msgid "Malformed port policy `%s'\n" | 8766 | msgid "Malformed port policy `%s'\n" |
8693 | msgstr "" | 8767 | msgstr "" |
8694 | 8768 | ||
8695 | #: src/util/strings.c:1583 src/util/strings.c:1614 src/util/strings.c:1662 | 8769 | #: src/util/strings.c:1649 src/util/strings.c:1680 src/util/strings.c:1728 |
8696 | #: src/util/strings.c:1683 | 8770 | #: src/util/strings.c:1749 |
8697 | #, c-format | 8771 | #, c-format |
8698 | msgid "Invalid format for IP: `%s'\n" | 8772 | msgid "Invalid format for IP: `%s'\n" |
8699 | msgstr "Ungültiges Format für IP: »%s«\n" | 8773 | msgstr "Ungültiges Format für IP: »%s«\n" |
8700 | 8774 | ||
8701 | #: src/util/strings.c:1640 | 8775 | #: src/util/strings.c:1706 |
8702 | #, c-format | 8776 | #, c-format |
8703 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." | 8777 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." |
8704 | msgstr "Ungültige Netzwerk-Notation ('/%d ist nicht gültig in IPv4 CIDR)." | 8778 | msgstr "Ungültige Netzwerk-Notation ('/%d ist nicht gültig in IPv4 CIDR)." |
8705 | 8779 | ||
8706 | #: src/util/strings.c:1692 | 8780 | #: src/util/strings.c:1758 |
8707 | #, fuzzy, c-format | 8781 | #, fuzzy, c-format |
8708 | msgid "Invalid format: `%s'\n" | 8782 | msgid "Invalid format: `%s'\n" |
8709 | msgstr "Ungültiges Format für IP: `%s'\n" | 8783 | msgstr "Ungültiges Format für IP: `%s'\n" |
8710 | 8784 | ||
8711 | #: src/util/strings.c:1744 | 8785 | #: src/util/strings.c:1810 |
8712 | #, c-format | 8786 | #, c-format |
8713 | msgid "Invalid network notation (does not end with ';': `%s')\n" | 8787 | msgid "Invalid network notation (does not end with ';': `%s')\n" |
8714 | msgstr "Ungültige Netzwerk-Notation (endet nicht mit »;«: »%s«)\n" | 8788 | msgstr "Ungültige Netzwerk-Notation (endet nicht mit »;«: »%s«)\n" |
8715 | 8789 | ||
8716 | #: src/util/strings.c:1794 | 8790 | #: src/util/strings.c:1860 |
8717 | #, fuzzy, c-format | 8791 | #, fuzzy, c-format |
8718 | msgid "Wrong format `%s' for netmask\n" | 8792 | msgid "Wrong format `%s' for netmask\n" |
8719 | msgstr "Falsches Format `%s' für Netzmaske: %s\n" | 8793 | msgstr "Falsches Format `%s' für Netzmaske: %s\n" |
8720 | 8794 | ||
8721 | #: src/util/strings.c:1825 | 8795 | #: src/util/strings.c:1891 |
8722 | #, fuzzy, c-format | 8796 | #, fuzzy, c-format |
8723 | msgid "Wrong format `%s' for network\n" | 8797 | msgid "Wrong format `%s' for network\n" |
8724 | msgstr "Falsches Format `%s' für Netzwerk: %s\n" | 8798 | msgstr "Falsches Format `%s' für Netzwerk: %s\n" |
@@ -8902,22 +8976,30 @@ msgid "Setup tunnels via VPN." | |||
8902 | msgstr "Tunnel über VPN einrichten." | 8976 | msgstr "Tunnel über VPN einrichten." |
8903 | 8977 | ||
8904 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 | 8978 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 |
8905 | #: src/include/gnunet_common.h:660 | 8979 | #: src/include/gnunet_common.h:662 src/include/gnunet_common.h:670 |
8906 | #, fuzzy, c-format | 8980 | #, fuzzy, c-format |
8907 | msgid "Assertion failed at %s:%d.\n" | 8981 | msgid "Assertion failed at %s:%d.\n" |
8908 | msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" | 8982 | msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" |
8909 | 8983 | ||
8910 | #: src/include/gnunet_common.h:672 | 8984 | #: src/include/gnunet_common.h:682 |
8911 | #, fuzzy, c-format | 8985 | #, fuzzy, c-format |
8912 | msgid "External protocol violation detected at %s:%d.\n" | 8986 | msgid "External protocol violation detected at %s:%d.\n" |
8913 | msgstr "Protokollverletzung auf Socket. Kommando erwartet.\n" | 8987 | msgstr "Protokollverletzung auf Socket. Kommando erwartet.\n" |
8914 | 8988 | ||
8915 | #: src/include/gnunet_common.h:699 src/include/gnunet_common.h:708 | 8989 | #: src/include/gnunet_common.h:709 src/include/gnunet_common.h:718 |
8916 | #, fuzzy, c-format | 8990 | #, fuzzy, c-format |
8917 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" | 8991 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" |
8918 | msgstr "`%s' schlug bei Datei `%s' fehl. Ort: %s:%d. Fehler: %s\n" | 8992 | msgstr "`%s' schlug bei Datei `%s' fehl. Ort: %s:%d. Fehler: %s\n" |
8919 | 8993 | ||
8920 | #, fuzzy | 8994 | #, fuzzy |
8995 | #~ msgid "Failed to run upnp client for port %u\n" | ||
8996 | #~ msgstr "SQLite Datenbank konnte nicht initialisiert werden.\n" | ||
8997 | |||
8998 | #, fuzzy | ||
8999 | #~ msgid "Failed to start resolver!\n" | ||
9000 | #~ msgstr "Fehler beim Starten der Collection.\n" | ||
9001 | |||
9002 | #, fuzzy | ||
8921 | #~ msgid "Unable to initialize Postgres: %s\n" | 9003 | #~ msgid "Unable to initialize Postgres: %s\n" |
8922 | #~ msgstr "SQLite Datenbank konnte nicht initialisiert werden: %s.\n" | 9004 | #~ msgstr "SQLite Datenbank konnte nicht initialisiert werden: %s.\n" |
8923 | 9005 | ||
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
8 | "Project-Id-Version: gnunet 0.9.5a\n" | 8 | "Project-Id-Version: gnunet 0.9.5a\n" |
9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
10 | "POT-Creation-Date: 2016-11-27 09:18+0100\n" | 10 | "POT-Creation-Date: 2017-01-12 17:19+0100\n" |
11 | "PO-Revision-Date: 2013-02-23 17:50+0100\n" | 11 | "PO-Revision-Date: 2013-02-23 17:50+0100\n" |
12 | "Last-Translator: Miguel Ãngel Arruga Vivas <rosen644835@gmail.com>\n" | 12 | "Last-Translator: Miguel Ãngel Arruga Vivas <rosen644835@gmail.com>\n" |
13 | "Language-Team: Spanish <es@li.org>\n" | 13 | "Language-Team: Spanish <es@li.org>\n" |
@@ -260,9 +260,8 @@ msgstr "" | |||
260 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 | 260 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 |
261 | #: src/transport/plugin_transport_tcp.c:652 | 261 | #: src/transport/plugin_transport_tcp.c:652 |
262 | #: src/transport/plugin_transport_tcp.c:658 | 262 | #: src/transport/plugin_transport_tcp.c:658 |
263 | #: src/transport/plugin_transport_tcp.c:3299 src/util/service.c:584 | 263 | #: src/transport/plugin_transport_tcp.c:3309 src/util/service.c:584 |
264 | #: src/util/service.c:590 src/util/service_new.c:637 | 264 | #: src/util/service.c:590 src/util/service_new.c:637 src/util/service_new.c:643 |
265 | #: src/util/service_new.c:643 | ||
266 | #, c-format | 265 | #, c-format |
267 | msgid "Require valid port number for service `%s' in configuration!\n" | 266 | msgid "Require valid port number for service `%s' in configuration!\n" |
268 | msgstr "" | 267 | msgstr "" |
@@ -270,14 +269,14 @@ msgstr "" | |||
270 | "configuración!\n" | 269 | "configuración!\n" |
271 | 270 | ||
272 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 | 271 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 |
273 | #: src/util/client_new.c:464 src/util/service.c:621 src/util/service_new.c:682 | 272 | #: src/util/client.c:464 src/util/service.c:621 src/util/service_new.c:682 |
274 | #, c-format | 273 | #, c-format |
275 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 274 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
276 | msgstr "" | 275 | msgstr "" |
277 | "La ruta tipo UNIX «%s» es demasiado larga, la longitud máxima es %llu\n" | 276 | "La ruta tipo UNIX «%s» es demasiado larga, la longitud máxima es %llu\n" |
278 | 277 | ||
279 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 | 278 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 |
280 | #: src/util/client_new.c:469 src/util/service.c:625 src/util/service_new.c:687 | 279 | #: src/util/client.c:469 src/util/service.c:625 src/util/service_new.c:687 |
281 | #, c-format | 280 | #, c-format |
282 | msgid "Using `%s' instead\n" | 281 | msgid "Using `%s' instead\n" |
283 | msgstr "Usando «%s» en su defecto\n" | 282 | msgstr "Usando «%s» en su defecto\n" |
@@ -301,7 +300,7 @@ msgstr "" | |||
301 | "uno es necesario\n" | 300 | "uno es necesario\n" |
302 | 301 | ||
303 | #: src/arm/gnunet-service-arm.c:513 | 302 | #: src/arm/gnunet-service-arm.c:513 |
304 | #: src/transport/plugin_transport_http_server.c:2617 | 303 | #: src/transport/plugin_transport_http_server.c:2620 |
305 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 | 304 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 |
306 | #: src/util/service_new.c:782 | 305 | #: src/util/service_new.c:782 |
307 | #, c-format | 306 | #, c-format |
@@ -309,7 +308,7 @@ msgid "Failed to resolve `%s': %s\n" | |||
309 | msgstr "Se produjo un fallo al resolver «%s»: %s\n" | 308 | msgstr "Se produjo un fallo al resolver «%s»: %s\n" |
310 | 309 | ||
311 | #: src/arm/gnunet-service-arm.c:532 | 310 | #: src/arm/gnunet-service-arm.c:532 |
312 | #: src/transport/plugin_transport_http_server.c:2635 | 311 | #: src/transport/plugin_transport_http_server.c:2638 |
313 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 | 312 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 |
314 | #: src/util/service_new.c:802 | 313 | #: src/util/service_new.c:802 |
315 | #, c-format | 314 | #, c-format |
@@ -416,14 +415,12 @@ msgstr "" | |||
416 | "No hay configurada una cuota de salida para la red «%s», asignando el ancho " | 415 | "No hay configurada una cuota de salida para la red «%s», asignando el ancho " |
417 | "de banda predeterminado %llu\n" | 416 | "de banda predeterminado %llu\n" |
418 | 417 | ||
419 | #: src/ats/gnunet-ats-solver-eval.c:3293 | 418 | #: src/ats/gnunet-ats-solver-eval.c:3293 src/ats-tests/gnunet-solver-eval.c:935 |
420 | #: src/ats-tests/gnunet-solver-eval.c:935 | ||
421 | #, fuzzy | 419 | #, fuzzy |
422 | msgid "solver to use" | 420 | msgid "solver to use" |
423 | msgstr "valor a establecer" | 421 | msgstr "valor a establecer" |
424 | 422 | ||
425 | #: src/ats/gnunet-ats-solver-eval.c:3296 | 423 | #: src/ats/gnunet-ats-solver-eval.c:3296 src/ats-tests/gnunet-solver-eval.c:938 |
426 | #: src/ats-tests/gnunet-solver-eval.c:938 | ||
427 | #: src/ats-tests/gnunet-solver-eval.c:941 | 424 | #: src/ats-tests/gnunet-solver-eval.c:941 |
428 | msgid "experiment to use" | 425 | msgid "experiment to use" |
429 | msgstr "" | 426 | msgstr "" |
@@ -540,12 +537,12 @@ msgstr "La cuota de salida configurada para la red «%s» es %llu\n" | |||
540 | msgid "Invalid %s configuration %f\n" | 537 | msgid "Invalid %s configuration %f\n" |
541 | msgstr "Se produjo un fallo al cargar la configuración de %s\n" | 538 | msgstr "Se produjo un fallo al cargar la configuración de %s\n" |
542 | 539 | ||
543 | #: src/ats-tests/ats-testing.c:441 | 540 | #: src/ats-tests/ats-testing.c:422 |
544 | #, c-format | 541 | #, c-format |
545 | msgid "Connected master [%u] with slave [%u]\n" | 542 | msgid "Connected master [%u] with slave [%u]\n" |
546 | msgstr "" | 543 | msgstr "" |
547 | 544 | ||
548 | #: src/ats-tests/ats-testing.c:448 | 545 | #: src/ats-tests/ats-testing.c:429 |
549 | #, fuzzy, c-format | 546 | #, fuzzy, c-format |
550 | msgid "Failed to connect master peer [%u] with slave [%u]\n" | 547 | msgid "Failed to connect master peer [%u] with slave [%u]\n" |
551 | msgstr "Fallo al conectar a gnunetd.\n" | 548 | msgstr "Fallo al conectar a gnunetd.\n" |
@@ -610,7 +607,7 @@ msgid "Quota for network `%11s' (in/out): %10s / %10s\n" | |||
610 | msgstr "Cuota para la red «%11s» (entrada/salida): %10s / %10s\n" | 607 | msgstr "Cuota para la red «%11s» (entrada/salida): %10s / %10s\n" |
611 | 608 | ||
612 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 | 609 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 |
613 | #: src/transport/gnunet-transport.c:1476 | 610 | #: src/transport/gnunet-transport.c:1255 |
614 | #, c-format | 611 | #, c-format |
615 | msgid "Failed to parse peer identity `%s'\n" | 612 | msgid "Failed to parse peer identity `%s'\n" |
616 | msgstr "Se produjo un fallo al procesar la identidad del par «%s»\n" | 613 | msgstr "Se produjo un fallo al procesar la identidad del par «%s»\n" |
@@ -701,6 +698,38 @@ msgstr "salida prolija (incluye las propiedades de direcciones del ATS)" | |||
701 | msgid "Print information about ATS state" | 698 | msgid "Print information about ATS state" |
702 | msgstr "Imprime información acerca del estado del ATS" | 699 | msgstr "Imprime información acerca del estado del ATS" |
703 | 700 | ||
701 | #: src/auction/gnunet-auction-create.c:69 | ||
702 | msgid "description of the item to be sold" | ||
703 | msgstr "" | ||
704 | |||
705 | #: src/auction/gnunet-auction-create.c:72 | ||
706 | msgid "mapping of possible prices" | ||
707 | msgstr "" | ||
708 | |||
709 | #: src/auction/gnunet-auction-create.c:75 | ||
710 | msgid "max duration per round" | ||
711 | msgstr "" | ||
712 | |||
713 | #: src/auction/gnunet-auction-create.c:78 | ||
714 | msgid "duration until auction starts" | ||
715 | msgstr "" | ||
716 | |||
717 | #: src/auction/gnunet-auction-create.c:81 | ||
718 | msgid "number of items to sell, 0 for first price auction" | ||
719 | msgstr "" | ||
720 | |||
721 | #: src/auction/gnunet-auction-create.c:84 | ||
722 | #, fuzzy | ||
723 | msgid "public auction outcome" | ||
724 | msgstr "_Opciones" | ||
725 | |||
726 | #: src/auction/gnunet-auction-create.c:94 src/auction/gnunet-auction-info.c:76 | ||
727 | #: src/auction/gnunet-auction-join.c:76 | ||
728 | #: src/conversation/gnunet-conversation-test.c:243 | ||
729 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
730 | msgid "help text" | ||
731 | msgstr "texto de ayuda" | ||
732 | |||
704 | #: src/cadet/gnunet-cadet.c:511 | 733 | #: src/cadet/gnunet-cadet.c:511 |
705 | #, fuzzy, c-format | 734 | #, fuzzy, c-format |
706 | msgid "Invalid target `%s'\n" | 735 | msgid "Invalid target `%s'\n" |
@@ -756,7 +785,7 @@ msgstr "proveer información acerca de un túnel en particular" | |||
756 | msgid "provide information about all tunnels" | 785 | msgid "provide information about all tunnels" |
757 | msgstr "proveer información acerca de un túnel en particular" | 786 | msgstr "proveer información acerca de un túnel en particular" |
758 | 787 | ||
759 | #: src/cadet/gnunet-service-cadet_peer.c:681 | 788 | #: src/cadet/gnunet-service-cadet_peer.c:686 |
760 | msgid "Wrong CORE service\n" | 789 | msgid "Wrong CORE service\n" |
761 | msgstr "Servicio principal (CORE) erróneo\n" | 790 | msgstr "Servicio principal (CORE) erróneo\n" |
762 | 791 | ||
@@ -1085,11 +1114,6 @@ msgid "" | |||
1085 | "played back to you..." | 1114 | "played back to you..." |
1086 | msgstr "" | 1115 | msgstr "" |
1087 | 1116 | ||
1088 | #: src/conversation/gnunet-conversation-test.c:243 | ||
1089 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
1090 | msgid "help text" | ||
1091 | msgstr "texto de ayuda" | ||
1092 | |||
1093 | #: src/conversation/gnunet_gst.c:630 | 1117 | #: src/conversation/gnunet_gst.c:630 |
1094 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 | 1118 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 |
1095 | #, c-format | 1119 | #, c-format |
@@ -1299,7 +1323,7 @@ msgid "Failed to connect to CORE service!\n" | |||
1299 | msgstr "¡Se produjo un fallo al conectar con el servicio DHT!\n" | 1323 | msgstr "¡Se produjo un fallo al conectar con el servicio DHT!\n" |
1300 | 1324 | ||
1301 | # Miguel: ¿Quizá continuamente fuese mejor? | 1325 | # Miguel: ¿Quizá continuamente fuese mejor? |
1302 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1677 | 1326 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1456 |
1303 | msgid "provide information about all current connections (continuously)" | 1327 | msgid "provide information about all current connections (continuously)" |
1304 | msgstr "" | 1328 | msgstr "" |
1305 | "provee información sobre todas las conexiones actuales (de forma continua)" | 1329 | "provee información sobre todas las conexiones actuales (de forma continua)" |
@@ -1564,7 +1588,7 @@ msgstr "Caché de datos de montÃculo (heap) ejecutándose\n" | |||
1564 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 | 1588 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 |
1565 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 | 1589 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 |
1566 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 | 1590 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 |
1567 | #: src/include/gnunet_common.h:681 src/include/gnunet_common.h:690 | 1591 | #: src/include/gnunet_common.h:691 src/include/gnunet_common.h:700 |
1568 | #: src/scalarproduct/scalarproduct.h:35 | 1592 | #: src/scalarproduct/scalarproduct.h:35 |
1569 | #, c-format | 1593 | #, c-format |
1570 | msgid "`%s' failed at %s:%d with error: %s\n" | 1594 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -1976,8 +2000,7 @@ msgstr "cuanto tiempo debe ejecutarse el comando de monitorización" | |||
1976 | msgid "Prints all packets that go through the DHT." | 2000 | msgid "Prints all packets that go through the DHT." |
1977 | msgstr "Imprime todos los paquetes que pasan por la DHT." | 2001 | msgstr "Imprime todos los paquetes que pasan por la DHT." |
1978 | 2002 | ||
1979 | #: src/dht/gnunet_dht_profiler.c:1161 | 2003 | #: src/dht/gnunet_dht_profiler.c:1161 src/testbed/gnunet-testbed-profiler.c:255 |
1980 | #: src/testbed/gnunet-testbed-profiler.c:255 | ||
1981 | #, fuzzy, c-format | 2004 | #, fuzzy, c-format |
1982 | msgid "Exiting as the number of peers is %u\n" | 2005 | msgid "Exiting as the number of peers is %u\n" |
1983 | msgstr "El número máximo de conexiones es %u\n" | 2006 | msgstr "El número máximo de conexiones es %u\n" |
@@ -2161,8 +2184,7 @@ msgstr "¡Tipo de bloque no soportado (%u) en respuesta local!\n" | |||
2161 | msgid "# GET requests given to datacache" | 2184 | msgid "# GET requests given to datacache" |
2162 | msgstr "# Peticiones «GET» realizadas a la caché de datos" | 2185 | msgstr "# Peticiones «GET» realizadas a la caché de datos" |
2163 | 2186 | ||
2164 | #: src/dht/gnunet-service-dht_hello.c:84 | 2187 | #: src/dht/gnunet-service-dht_hello.c:84 src/dht/gnunet-service-xdht_hello.c:82 |
2165 | #: src/dht/gnunet-service-xdht_hello.c:82 | ||
2166 | msgid "# HELLOs obtained from peerinfo" | 2188 | msgid "# HELLOs obtained from peerinfo" |
2167 | msgstr "# «HELLO» obtenidos de «peerinfo»" | 2189 | msgstr "# «HELLO» obtenidos de «peerinfo»" |
2168 | 2190 | ||
@@ -2229,36 +2251,36 @@ msgstr "# Peticiones «PUT» P2P recibidas" | |||
2229 | msgid "# P2P PUT bytes received" | 2251 | msgid "# P2P PUT bytes received" |
2230 | msgstr "# Peticiones «PUT» P2P recibidas" | 2252 | msgstr "# Peticiones «PUT» P2P recibidas" |
2231 | 2253 | ||
2232 | #: src/dht/gnunet-service-dht_neighbours.c:1854 | 2254 | #: src/dht/gnunet-service-dht_neighbours.c:1858 |
2233 | msgid "# FIND PEER requests ignored due to Bloomfilter" | 2255 | msgid "# FIND PEER requests ignored due to Bloomfilter" |
2234 | msgstr "# Peticiones «FIND PEER» ignoradas debido a «Bloomfilter»" | 2256 | msgstr "# Peticiones «FIND PEER» ignoradas debido a «Bloomfilter»" |
2235 | 2257 | ||
2236 | #: src/dht/gnunet-service-dht_neighbours.c:1862 | 2258 | #: src/dht/gnunet-service-dht_neighbours.c:1866 |
2237 | msgid "# FIND PEER requests ignored due to lack of HELLO" | 2259 | msgid "# FIND PEER requests ignored due to lack of HELLO" |
2238 | msgstr "# Peticiones «FIND PEER» ignoradas debido a falta de «HELLO»" | 2260 | msgstr "# Peticiones «FIND PEER» ignoradas debido a falta de «HELLO»" |
2239 | 2261 | ||
2240 | #: src/dht/gnunet-service-dht_neighbours.c:2018 | 2262 | #: src/dht/gnunet-service-dht_neighbours.c:2022 |
2241 | msgid "# P2P GET requests received" | 2263 | msgid "# P2P GET requests received" |
2242 | msgstr "# Peticiones «GET» P2P recibidas" | 2264 | msgstr "# Peticiones «GET» P2P recibidas" |
2243 | 2265 | ||
2244 | #: src/dht/gnunet-service-dht_neighbours.c:2022 | 2266 | #: src/dht/gnunet-service-dht_neighbours.c:2026 |
2245 | #, fuzzy | 2267 | #, fuzzy |
2246 | msgid "# P2P GET bytes received" | 2268 | msgid "# P2P GET bytes received" |
2247 | msgstr "# Peticiones «GET» P2P recibidas" | 2269 | msgstr "# Peticiones «GET» P2P recibidas" |
2248 | 2270 | ||
2249 | #: src/dht/gnunet-service-dht_neighbours.c:2097 | 2271 | #: src/dht/gnunet-service-dht_neighbours.c:2101 |
2250 | msgid "# P2P FIND PEER requests processed" | 2272 | msgid "# P2P FIND PEER requests processed" |
2251 | msgstr "# Peticiones «FIND PEER» P2P procesadas" | 2273 | msgstr "# Peticiones «FIND PEER» P2P procesadas" |
2252 | 2274 | ||
2253 | #: src/dht/gnunet-service-dht_neighbours.c:2120 | 2275 | #: src/dht/gnunet-service-dht_neighbours.c:2124 |
2254 | msgid "# P2P GET requests ONLY routed" | 2276 | msgid "# P2P GET requests ONLY routed" |
2255 | msgstr "# Peticiones «GET» P2P SOLAMENTE encaminadas" | 2277 | msgstr "# Peticiones «GET» P2P SOLAMENTE encaminadas" |
2256 | 2278 | ||
2257 | #: src/dht/gnunet-service-dht_neighbours.c:2222 | 2279 | #: src/dht/gnunet-service-dht_neighbours.c:2226 |
2258 | msgid "# P2P RESULTS received" | 2280 | msgid "# P2P RESULTS received" |
2259 | msgstr "# Resultados (RESULTS) P2P recibidos" | 2281 | msgstr "# Resultados (RESULTS) P2P recibidos" |
2260 | 2282 | ||
2261 | #: src/dht/gnunet-service-dht_neighbours.c:2226 | 2283 | #: src/dht/gnunet-service-dht_neighbours.c:2230 |
2262 | #, fuzzy | 2284 | #, fuzzy |
2263 | msgid "# P2P RESULT bytes received" | 2285 | msgid "# P2P RESULT bytes received" |
2264 | msgstr "# Resultados (RESULTS) P2P recibidos" | 2286 | msgstr "# Resultados (RESULTS) P2P recibidos" |
@@ -2267,41 +2289,41 @@ msgstr "# Resultados (RESULTS) P2P recibidos" | |||
2267 | msgid "# Network size estimates received" | 2289 | msgid "# Network size estimates received" |
2268 | msgstr "# Estimaciones del tamaño de red recibidas" | 2290 | msgstr "# Estimaciones del tamaño de red recibidas" |
2269 | 2291 | ||
2270 | #: src/dht/gnunet-service-dht_routing.c:218 | 2292 | #: src/dht/gnunet-service-dht_routing.c:220 |
2271 | msgid "# Good REPLIES matched against routing table" | 2293 | msgid "# Good REPLIES matched against routing table" |
2272 | msgstr "" | 2294 | msgstr "" |
2273 | "# Buenas respuestas (REPLIES) encontradas en la tabla de encaminamiento" | 2295 | "# Buenas respuestas (REPLIES) encontradas en la tabla de encaminamiento" |
2274 | 2296 | ||
2275 | #: src/dht/gnunet-service-dht_routing.c:227 | 2297 | #: src/dht/gnunet-service-dht_routing.c:229 |
2276 | msgid "# Duplicate REPLIES matched against routing table" | 2298 | msgid "# Duplicate REPLIES matched against routing table" |
2277 | msgstr "" | 2299 | msgstr "" |
2278 | "# Respuestas (REPLIES) duplicadas encontradas en la tabla de encaminamiento" | 2300 | "# Respuestas (REPLIES) duplicadas encontradas en la tabla de encaminamiento" |
2279 | 2301 | ||
2280 | #: src/dht/gnunet-service-dht_routing.c:233 | 2302 | #: src/dht/gnunet-service-dht_routing.c:235 |
2281 | msgid "# Invalid REPLIES matched against routing table" | 2303 | msgid "# Invalid REPLIES matched against routing table" |
2282 | msgstr "" | 2304 | msgstr "" |
2283 | "# Respuestas (REPLIES) no válidas encontradas en la tabla de encaminamiento" | 2305 | "# Respuestas (REPLIES) no válidas encontradas en la tabla de encaminamiento" |
2284 | 2306 | ||
2285 | #: src/dht/gnunet-service-dht_routing.c:239 | 2307 | #: src/dht/gnunet-service-dht_routing.c:241 |
2286 | msgid "# Irrelevant REPLIES matched against routing table" | 2308 | msgid "# Irrelevant REPLIES matched against routing table" |
2287 | msgstr "" | 2309 | msgstr "" |
2288 | "# Respuestas (REPLIES) irrelevantes encontradas en la tabla de encaminamiento" | 2310 | "# Respuestas (REPLIES) irrelevantes encontradas en la tabla de encaminamiento" |
2289 | 2311 | ||
2290 | #: src/dht/gnunet-service-dht_routing.c:251 | 2312 | #: src/dht/gnunet-service-dht_routing.c:253 |
2291 | msgid "# Unsupported REPLIES matched against routing table" | 2313 | msgid "# Unsupported REPLIES matched against routing table" |
2292 | msgstr "" | 2314 | msgstr "" |
2293 | "# Respuestas (REPLIES) no soportadas encontradas en la tabla de " | 2315 | "# Respuestas (REPLIES) no soportadas encontradas en la tabla de " |
2294 | "encaminamiento" | 2316 | "encaminamiento" |
2295 | 2317 | ||
2296 | #: src/dht/gnunet-service-dht_routing.c:327 | 2318 | #: src/dht/gnunet-service-dht_routing.c:329 |
2297 | msgid "# Entries removed from routing table" | 2319 | msgid "# Entries removed from routing table" |
2298 | msgstr "# Entradas eliminadas de la tabla de encaminamiento" | 2320 | msgstr "# Entradas eliminadas de la tabla de encaminamiento" |
2299 | 2321 | ||
2300 | #: src/dht/gnunet-service-dht_routing.c:409 | 2322 | #: src/dht/gnunet-service-dht_routing.c:411 |
2301 | msgid "# Entries added to routing table" | 2323 | msgid "# Entries added to routing table" |
2302 | msgstr "# Entradas añadidas a la tabla de encaminamiento" | 2324 | msgstr "# Entradas añadidas a la tabla de encaminamiento" |
2303 | 2325 | ||
2304 | #: src/dht/gnunet-service-dht_routing.c:427 | 2326 | #: src/dht/gnunet-service-dht_routing.c:429 |
2305 | msgid "# DHT requests combined" | 2327 | msgid "# DHT requests combined" |
2306 | msgstr "# Peticiones a la DHT combinadas" | 2328 | msgstr "# Peticiones a la DHT combinadas" |
2307 | 2329 | ||
@@ -2414,16 +2436,16 @@ msgid "" | |||
2414 | "SUPU %s, %s, %d, trail->prev_hop = %s" | 2436 | "SUPU %s, %s, %d, trail->prev_hop = %s" |
2415 | msgstr "" | 2437 | msgstr "" |
2416 | 2438 | ||
2417 | #: src/dht/plugin_block_dht.c:142 | 2439 | #: src/dht/plugin_block_dht.c:144 |
2418 | #, c-format | 2440 | #, c-format |
2419 | msgid "Block not of type %u\n" | 2441 | msgid "Block not of type %u\n" |
2420 | msgstr "El bloque no es del tipo %u\n" | 2442 | msgstr "El bloque no es del tipo %u\n" |
2421 | 2443 | ||
2422 | #: src/dht/plugin_block_dht.c:149 | 2444 | #: src/dht/plugin_block_dht.c:151 |
2423 | msgid "Size mismatch for block\n" | 2445 | msgid "Size mismatch for block\n" |
2424 | msgstr "Discrepancias de tamaños para el bloque\n" | 2446 | msgstr "Discrepancias de tamaños para el bloque\n" |
2425 | 2447 | ||
2426 | #: src/dht/plugin_block_dht.c:159 | 2448 | #: src/dht/plugin_block_dht.c:161 |
2427 | #, c-format | 2449 | #, c-format |
2428 | msgid "Block of type %u is malformed\n" | 2450 | msgid "Block of type %u is malformed\n" |
2429 | msgstr "El bloque del tipo %u está mal formado\n" | 2451 | msgstr "El bloque del tipo %u está mal formado\n" |
@@ -3593,7 +3615,7 @@ msgid "Option `%s' is required when using option `%s'.\n" | |||
3593 | msgstr "La opción «%s» es obligatoria cuando se usa la opción «%s».\n" | 3615 | msgstr "La opción «%s» es obligatoria cuando se usa la opción «%s».\n" |
3594 | 3616 | ||
3595 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 | 3617 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 |
3596 | #: src/transport/gnunet-transport.c:1517 src/transport/gnunet-transport.c:1542 | 3618 | #: src/transport/gnunet-transport.c:1296 src/transport/gnunet-transport.c:1321 |
3597 | #, c-format | 3619 | #, c-format |
3598 | msgid "Option `%s' makes no sense without option `%s'.\n" | 3620 | msgid "Option `%s' makes no sense without option `%s'.\n" |
3599 | msgstr "La opción «%s» no tiene sentido sin la opción «%s».\n" | 3621 | msgstr "La opción «%s» no tiene sentido sin la opción «%s».\n" |
@@ -4119,45 +4141,45 @@ msgstr "Recibida petición DNS mal formada de %s\n" | |||
4119 | msgid "Received unsupported DNS request from %s\n" | 4141 | msgid "Received unsupported DNS request from %s\n" |
4120 | msgstr "Recibida petición DNS no soportada de %s\n" | 4142 | msgstr "Recibida petición DNS no soportada de %s\n" |
4121 | 4143 | ||
4122 | #: src/gns/gnunet-dns2gns.c:709 | 4144 | #: src/gns/gnunet-dns2gns.c:712 |
4123 | msgid "No ego configured for `dns2gns` subsystem\n" | 4145 | msgid "No ego configured for `dns2gns` subsystem\n" |
4124 | msgstr "" | 4146 | msgstr "" |
4125 | 4147 | ||
4126 | #: src/gns/gnunet-dns2gns.c:737 | 4148 | #: src/gns/gnunet-dns2gns.c:740 |
4127 | #, fuzzy | 4149 | #, fuzzy |
4128 | msgid "No DNS server specified!\n" | 4150 | msgid "No DNS server specified!\n" |
4129 | msgstr "¡Ninguna palabra clave especificada!\n" | 4151 | msgstr "¡Ninguna palabra clave especificada!\n" |
4130 | 4152 | ||
4131 | #: src/gns/gnunet-dns2gns.c:758 | 4153 | #: src/gns/gnunet-dns2gns.c:761 |
4132 | #, fuzzy | 4154 | #, fuzzy |
4133 | msgid "No valid GNS zone specified!\n" | 4155 | msgid "No valid GNS zone specified!\n" |
4134 | msgstr "¡Ninguna palabra clave especificada!\n" | 4156 | msgstr "¡Ninguna palabra clave especificada!\n" |
4135 | 4157 | ||
4136 | #: src/gns/gnunet-dns2gns.c:779 | 4158 | #: src/gns/gnunet-dns2gns.c:782 |
4137 | msgid "IP of recursive DNS resolver to use (required)" | 4159 | msgid "IP of recursive DNS resolver to use (required)" |
4138 | msgstr "IP del resolvedor recursivo DNS a usar (requerido)" | 4160 | msgstr "IP del resolvedor recursivo DNS a usar (requerido)" |
4139 | 4161 | ||
4140 | #: src/gns/gnunet-dns2gns.c:782 | 4162 | #: src/gns/gnunet-dns2gns.c:785 |
4141 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" | 4163 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" |
4142 | msgstr "" | 4164 | msgstr "" |
4143 | "Sufijo FCFS autoritativo a usar (opcional); predeterminado: fcfs.zkey.eu" | 4165 | "Sufijo FCFS autoritativo a usar (opcional); predeterminado: fcfs.zkey.eu" |
4144 | 4166 | ||
4145 | #: src/gns/gnunet-dns2gns.c:785 | 4167 | #: src/gns/gnunet-dns2gns.c:788 |
4146 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" | 4168 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" |
4147 | msgstr "Sufijo DNS autoritativo a usar (opcional); predeterminado: zkey.eu" | 4169 | msgstr "Sufijo DNS autoritativo a usar (opcional); predeterminado: zkey.eu" |
4148 | 4170 | ||
4149 | #: src/gns/gnunet-dns2gns.c:788 | 4171 | #: src/gns/gnunet-dns2gns.c:791 |
4150 | #, fuzzy | 4172 | #, fuzzy |
4151 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4173 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4152 | msgstr "" | 4174 | msgstr "" |
4153 | "Puerto UDP en el que escuchar para peticiones DNS entrantes; predeterminado: " | 4175 | "Puerto UDP en el que escuchar para peticiones DNS entrantes; predeterminado: " |
4154 | "53" | 4176 | "53" |
4155 | 4177 | ||
4156 | #: src/gns/gnunet-dns2gns.c:791 | 4178 | #: src/gns/gnunet-dns2gns.c:794 |
4157 | msgid "Public key of the GNS zone to use (overrides default)" | 4179 | msgid "Public key of the GNS zone to use (overrides default)" |
4158 | msgstr "" | 4180 | msgstr "" |
4159 | 4181 | ||
4160 | #: src/gns/gnunet-dns2gns.c:804 | 4182 | #: src/gns/gnunet-dns2gns.c:807 |
4161 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4183 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4162 | msgstr "Pasarela GNUnet DNS-a-GNS (un servidor DNS)" | 4184 | msgstr "Pasarela GNUnet DNS-a-GNS (un servidor DNS)" |
4163 | 4185 | ||
@@ -4321,83 +4343,85 @@ msgstr "" | |||
4321 | msgid "Unsupported HTTP method `%s'\n" | 4343 | msgid "Unsupported HTTP method `%s'\n" |
4322 | msgstr "Tipo no soportado «%s»\n" | 4344 | msgstr "Tipo no soportado «%s»\n" |
4323 | 4345 | ||
4324 | #: src/gns/gnunet-gns-proxy.c:2167 | 4346 | #: src/gns/gnunet-gns-proxy.c:2168 |
4325 | #, c-format | 4347 | #, c-format |
4326 | msgid "Unable to import private key from file `%s'\n" | 4348 | msgid "Unable to import private key from file `%s'\n" |
4327 | msgstr "No se pudo importar la clave privada del fichero «%s»\n" | 4349 | msgstr "No se pudo importar la clave privada del fichero «%s»\n" |
4328 | 4350 | ||
4329 | #: src/gns/gnunet-gns-proxy.c:2197 | 4351 | #: src/gns/gnunet-gns-proxy.c:2198 |
4330 | #, c-format | 4352 | #, c-format |
4331 | msgid "Unable to import certificate %s\n" | 4353 | msgid "Unable to import certificate %s\n" |
4332 | msgstr "No se pudo importar el certificado %s\n" | 4354 | msgstr "No se pudo importar el certificado %s\n" |
4333 | 4355 | ||
4334 | #: src/gns/gnunet-gns-proxy.c:2370 | 4356 | #: src/gns/gnunet-gns-proxy.c:2371 |
4335 | #, fuzzy, c-format | 4357 | #, fuzzy, c-format |
4336 | msgid "Failed to start HTTPS server for `%s'\n" | 4358 | msgid "Failed to start HTTPS server for `%s'\n" |
4337 | msgstr "Se produjo un fallo al iniciar el servidor HTTP\n" | 4359 | msgstr "Se produjo un fallo al iniciar el servidor HTTP\n" |
4338 | 4360 | ||
4339 | #: src/gns/gnunet-gns-proxy.c:2389 src/rest/gnunet-rest-server.c:533 | 4361 | #: src/gns/gnunet-gns-proxy.c:2390 src/rest/gnunet-rest-server.c:533 |
4340 | #, fuzzy | 4362 | #, fuzzy |
4341 | msgid "Failed to pass client to MHD\n" | 4363 | msgid "Failed to pass client to MHD\n" |
4342 | msgstr "Se produjo un fallo al conectar con GNS\n" | 4364 | msgstr "Se produjo un fallo al conectar con GNS\n" |
4343 | 4365 | ||
4344 | #: src/gns/gnunet-gns-proxy.c:2709 | 4366 | #: src/gns/gnunet-gns-proxy.c:2710 |
4345 | #, fuzzy, c-format | 4367 | #, fuzzy, c-format |
4346 | msgid "Unsupported socks version %d\n" | 4368 | msgid "Unsupported socks version %d\n" |
4347 | msgstr "Tipo de bloque %u no soportado\n" | 4369 | msgstr "Tipo de bloque %u no soportado\n" |
4348 | 4370 | ||
4349 | #: src/gns/gnunet-gns-proxy.c:2738 | 4371 | #: src/gns/gnunet-gns-proxy.c:2739 |
4350 | #, fuzzy, c-format | 4372 | #, fuzzy, c-format |
4351 | msgid "Unsupported socks command %d\n" | 4373 | msgid "Unsupported socks command %d\n" |
4352 | msgstr "Tipo de bloque %u no soportado\n" | 4374 | msgstr "Tipo de bloque %u no soportado\n" |
4353 | 4375 | ||
4354 | #: src/gns/gnunet-gns-proxy.c:2756 src/gns/gnunet-gns-proxy.c:2785 | 4376 | #: src/gns/gnunet-gns-proxy.c:2757 src/gns/gnunet-gns-proxy.c:2786 |
4355 | msgid "SSL connection to plain IPv4 address requested\n" | 4377 | msgid "SSL connection to plain IPv4 address requested\n" |
4356 | msgstr "" | 4378 | msgstr "" |
4357 | 4379 | ||
4358 | #: src/gns/gnunet-gns-proxy.c:2836 | 4380 | #: src/gns/gnunet-gns-proxy.c:2837 |
4359 | #, fuzzy, c-format | 4381 | #, fuzzy, c-format |
4360 | msgid "Unsupported socks address type %d\n" | 4382 | msgid "Unsupported socks address type %d\n" |
4361 | msgstr "Tipo de bloque %u no soportado\n" | 4383 | msgstr "Tipo de bloque %u no soportado\n" |
4362 | 4384 | ||
4363 | #: src/gns/gnunet-gns-proxy.c:3171 | 4385 | #: src/gns/gnunet-gns-proxy.c:3172 |
4364 | msgid "No ego configured for `shorten-zone`\n" | 4386 | msgid "No ego configured for `shorten-zone`\n" |
4365 | msgstr "" | 4387 | msgstr "" |
4366 | 4388 | ||
4367 | #: src/gns/gnunet-gns-proxy.c:3211 src/gns/gnunet-service-gns.c:1093 | 4389 | #: src/gns/gnunet-gns-proxy.c:3212 src/gns/gnunet-service-gns.c:493 |
4368 | #: src/gns/gnunet-service-gns.c:1149 | 4390 | #: src/gns/gnunet-service-gns.c:548 |
4369 | #, fuzzy, c-format | 4391 | #, fuzzy, c-format |
4370 | msgid "No ego configured for `%s`\n" | 4392 | msgid "No ego configured for `%s`\n" |
4371 | msgstr "" | 4393 | msgstr "" |
4372 | "Ningún puerto fue configurado para el módulo «%s», no se puede probar\n" | 4394 | "Ningún puerto fue configurado para el módulo «%s», no se puede probar\n" |
4373 | 4395 | ||
4374 | #: src/gns/gnunet-gns-proxy.c:3273 | 4396 | #: src/gns/gnunet-gns-proxy.c:3274 |
4375 | #, fuzzy, c-format | 4397 | #, fuzzy, c-format |
4376 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" | 4398 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" |
4377 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" | 4399 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" |
4378 | 4400 | ||
4379 | #: src/gns/gnunet-gns-proxy.c:3313 | 4401 | #: src/gns/gnunet-gns-proxy.c:3314 |
4380 | msgid "listen on specified port (default: 7777)" | 4402 | msgid "listen on specified port (default: 7777)" |
4381 | msgstr "escuchar en el puerto especificado (predeterminado: 7777)" | 4403 | msgstr "escuchar en el puerto especificado (predeterminado: 7777)" |
4382 | 4404 | ||
4383 | #: src/gns/gnunet-gns-proxy.c:3316 | 4405 | #: src/gns/gnunet-gns-proxy.c:3317 |
4384 | msgid "pem file to use as CA" | 4406 | msgid "pem file to use as CA" |
4385 | msgstr "fichero pem para usar como autoridad de certificación (CA)" | 4407 | msgstr "fichero pem para usar como autoridad de certificación (CA)" |
4386 | 4408 | ||
4387 | #: src/gns/gnunet-gns-proxy.c:3335 | 4409 | #: src/gns/gnunet-gns-proxy.c:3336 |
4388 | msgid "GNUnet GNS proxy" | 4410 | msgid "GNUnet GNS proxy" |
4389 | msgstr "Proxy GNUnet GNS" | 4411 | msgstr "Proxy GNUnet GNS" |
4390 | 4412 | ||
4391 | #: src/gns/gnunet-service-gns.c:1187 | 4413 | #: src/gns/gnunet-service-gns.c:585 |
4414 | #: src/zonemaster/gnunet-service-zonemaster.c:705 | ||
4392 | msgid "Failed to connect to the namestore!\n" | 4415 | msgid "Failed to connect to the namestore!\n" |
4393 | msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" | 4416 | msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" |
4394 | 4417 | ||
4395 | #: src/gns/gnunet-service-gns.c:1195 | 4418 | #: src/gns/gnunet-service-gns.c:593 |
4396 | #, fuzzy | 4419 | #, fuzzy |
4397 | msgid "Failed to connect to the namecache!\n" | 4420 | msgid "Failed to connect to the namecache!\n" |
4398 | msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" | 4421 | msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" |
4399 | 4422 | ||
4400 | #: src/gns/gnunet-service-gns.c:1228 | 4423 | #: src/gns/gnunet-service-gns.c:612 |
4424 | #: src/zonemaster/gnunet-service-zonemaster.c:740 | ||
4401 | msgid "Could not connect to DHT!\n" | 4425 | msgid "Could not connect to DHT!\n" |
4402 | msgstr "¡No se pudo conectar a la DHT!\n" | 4426 | msgstr "¡No se pudo conectar a la DHT!\n" |
4403 | 4427 | ||
@@ -5279,8 +5303,7 @@ msgstr "borrar" | |||
5279 | msgid "Invalid public key for reverse lookup `%s'\n" | 5303 | msgid "Invalid public key for reverse lookup `%s'\n" |
5280 | msgstr "Parámetro no válido «%s»\n" | 5304 | msgstr "Parámetro no válido «%s»\n" |
5281 | 5305 | ||
5282 | #: src/namestore/gnunet-namestore.c:979 | 5306 | #: src/namestore/gnunet-namestore.c:979 src/peerinfo-tool/gnunet-peerinfo.c:775 |
5283 | #: src/peerinfo-tool/gnunet-peerinfo.c:775 | ||
5284 | #, c-format | 5307 | #, c-format |
5285 | msgid "Invalid URI `%s'\n" | 5308 | msgid "Invalid URI `%s'\n" |
5286 | msgstr "URI no válida: «%s»\n" | 5309 | msgstr "URI no válida: «%s»\n" |
@@ -5444,232 +5467,306 @@ msgstr "Base de datos de plantilla ejecutándose\n" | |||
5444 | msgid "Namestore REST API initialized\n" | 5467 | msgid "Namestore REST API initialized\n" |
5445 | msgstr "Conexión fallida\n" | 5468 | msgstr "Conexión fallida\n" |
5446 | 5469 | ||
5447 | #: src/nat/gnunet-nat.c:159 | 5470 | #: src/nat-auto/gnunet-nat-auto.c:192 |
5448 | #, fuzzy | 5471 | #, fuzzy |
5449 | msgid "GNUnet NAT traversal autoconfigure daemon" | 5472 | msgid "Suggested configuration changes:\n" |
5473 | msgstr "Configuración de GNUnet" | ||
5474 | |||
5475 | #: src/nat-auto/gnunet-nat-auto.c:220 | ||
5476 | #, fuzzy, c-format | ||
5477 | msgid "Failed to write configuration to `%s'\n" | ||
5478 | msgstr "Se produjo un fallo al guardar la nueva configuración al disco" | ||
5479 | |||
5480 | #: src/nat-auto/gnunet-nat-auto.c:227 | ||
5481 | #, fuzzy, c-format | ||
5482 | msgid "Wrote updated configuration to `%s'\n" | ||
5483 | msgstr "No se pudo acceder al fichero de configuración «%s»\n" | ||
5484 | |||
5485 | #: src/nat-auto/gnunet-nat-auto.c:345 | ||
5486 | #, fuzzy | ||
5487 | msgid "run autoconfiguration" | ||
5488 | msgstr "Configuración de GNUnet" | ||
5489 | |||
5490 | #: src/nat-auto/gnunet-nat-auto.c:348 | ||
5491 | msgid "section name providing the configuration for the adapter" | ||
5492 | msgstr "" | ||
5493 | |||
5494 | #: src/nat-auto/gnunet-nat-auto.c:351 src/nat/gnunet-nat.c:436 | ||
5495 | msgid "use TCP" | ||
5496 | msgstr "" | ||
5497 | |||
5498 | #: src/nat-auto/gnunet-nat-auto.c:354 src/nat/gnunet-nat.c:439 | ||
5499 | msgid "use UDP" | ||
5500 | msgstr "" | ||
5501 | |||
5502 | #: src/nat-auto/gnunet-nat-auto.c:357 | ||
5503 | #, fuzzy | ||
5504 | msgid "write configuration file (for autoconfiguration)" | ||
5505 | msgstr "¡Ninguna aplicación definida en la configuración!\n" | ||
5506 | |||
5507 | #: src/nat-auto/gnunet-nat-auto.c:369 | ||
5508 | #, fuzzy | ||
5509 | msgid "GNUnet NAT traversal autoconfiguration" | ||
5450 | msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet" | 5510 | msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet" |
5451 | 5511 | ||
5452 | #: src/nat/gnunet-nat-server.c:321 | 5512 | #: src/nat-auto/gnunet-nat-auto_legacy.c:403 |
5513 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:681 | ||
5514 | #: src/nat-auto/nat_auto_api_test.c:405 | ||
5515 | msgid "Failed to connect to `gnunet-nat-server'\n" | ||
5516 | msgstr "Se produjo un fallo al conectar con «gnunet-nat-server»\n" | ||
5517 | |||
5518 | #: src/nat-auto/gnunet-nat-auto_legacy.c:518 | ||
5519 | #: src/nat-auto/nat_auto_api_test.c:520 | ||
5520 | #, c-format | ||
5521 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5522 | msgstr "" | ||
5523 | "Se produjo un fallo al crear el «socket» de escucha asociado a «%s» para " | ||
5524 | "pruebas NAT: %s\n" | ||
5525 | |||
5526 | #: src/nat-auto/gnunet-nat-auto_legacy.c:568 | ||
5527 | #: src/nat-auto/nat_auto_api_test.c:569 | ||
5528 | #, fuzzy | ||
5529 | msgid "NAT test failed to start NAT library\n" | ||
5530 | msgstr "El almacén de nombres no pudo añadir el registro\n" | ||
5531 | |||
5532 | #: src/nat-auto/gnunet-nat-server.c:336 | ||
5453 | #, c-format | 5533 | #, c-format |
5454 | msgid "Please pass valid port number as the first argument! (got `%s')\n" | 5534 | msgid "Please pass valid port number as the first argument! (got `%s')\n" |
5455 | msgstr "" | 5535 | msgstr "" |
5456 | "¡Por favor, pase un número de puerto válido como primer parámetro! (se " | 5536 | "¡Por favor, pase un número de puerto válido como primer parámetro! (se " |
5457 | "obtuvo «%s»)\n" | 5537 | "obtuvo «%s»)\n" |
5458 | 5538 | ||
5459 | #: src/nat/gnunet-nat-server.c:363 | 5539 | #: src/nat-auto/gnunet-nat-server.c:386 |
5460 | msgid "GNUnet NAT traversal test helper daemon" | 5540 | msgid "GNUnet NAT traversal test helper daemon" |
5461 | msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet" | 5541 | msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet" |
5462 | 5542 | ||
5463 | #: src/nat/nat_api.c:880 src/nat/nat.c:2010 | 5543 | #: src/nat-auto/gnunet-service-nat-auto.c:342 |
5544 | #, fuzzy | ||
5545 | msgid "UPnP client `upnpc` command not found, disabling UPnP\n" | ||
5546 | msgstr "comando «upnpc» no encontrado\n" | ||
5547 | |||
5548 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:385 | ||
5549 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5550 | msgstr "Recorrido NAT con servidor ICMP satisfactorio.\n" | ||
5551 | |||
5552 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:386 | ||
5553 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5554 | msgstr "Recorrido NAT con servidor ICMP fallido.\n" | ||
5555 | |||
5556 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:405 | ||
5557 | msgid "Testing connection reversal with ICMP server.\n" | ||
5558 | msgstr "Probando conexión inversa con el servidor ICMP.\n" | ||
5559 | |||
5560 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:437 | ||
5561 | #, c-format | ||
5562 | msgid "Detected external IP `%s'\n" | ||
5563 | msgstr "Detectada IP externa «%s»\n" | ||
5564 | |||
5565 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:572 | ||
5566 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | ||
5567 | msgstr "" | ||
5568 | "Este sistema tiene una dirección IPv6 global, fijando IPv6 a habilitado.\n" | ||
5569 | |||
5570 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:590 | ||
5571 | #, c-format | ||
5572 | msgid "Detected internal network address `%s'.\n" | ||
5573 | msgstr "Detectada dirección de la red interna «%s».\n" | ||
5574 | |||
5575 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:724 | ||
5576 | msgid "upnpc found, enabling its use\n" | ||
5577 | msgstr "«upnpc» encontrado, habilitando su uso\n" | ||
5578 | |||
5579 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:725 | ||
5580 | msgid "upnpc not found\n" | ||
5581 | msgstr "«upnpc» no encontrado\n" | ||
5582 | |||
5583 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:762 | ||
5584 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5585 | msgstr "" | ||
5586 | |||
5587 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:774 | ||
5588 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:834 | ||
5589 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | ||
5590 | msgstr "" | ||
5591 | |||
5592 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:786 | ||
5593 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:846 | ||
5594 | msgid "No working gnunet-helper-nat-server found\n" | ||
5595 | msgstr "No se ha encontrado un «gnunet-helper-nat-server» funcional\n" | ||
5596 | |||
5597 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:823 | ||
5598 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | ||
5599 | msgstr "" | ||
5600 | |||
5601 | #: src/nat-auto/nat_auto_api.c:76 | ||
5464 | msgid "Operation Successful" | 5602 | msgid "Operation Successful" |
5465 | msgstr "" | 5603 | msgstr "" |
5466 | 5604 | ||
5467 | #: src/nat/nat_api.c:882 src/nat/nat.c:2012 | 5605 | #: src/nat-auto/nat_auto_api.c:78 |
5468 | msgid "Internal Failure (IPC, ...)" | 5606 | msgid "IPC failure" |
5469 | msgstr "" | 5607 | msgstr "" |
5470 | 5608 | ||
5471 | #: src/nat/nat_api.c:884 src/nat/nat.c:2014 | 5609 | #: src/nat-auto/nat_auto_api.c:80 |
5472 | msgid "Failure in network subsystem, check permissions." | 5610 | msgid "Failure in network subsystem, check permissions." |
5473 | msgstr "" | 5611 | msgstr "" |
5474 | 5612 | ||
5475 | #: src/nat/nat_api.c:886 src/nat/nat.c:2016 | 5613 | #: src/nat-auto/nat_auto_api.c:82 |
5476 | msgid "Encountered timeout while performing operation" | 5614 | msgid "Encountered timeout while performing operation" |
5477 | msgstr "" | 5615 | msgstr "" |
5478 | 5616 | ||
5479 | #: src/nat/nat_api.c:888 src/nat/nat.c:2018 | 5617 | #: src/nat-auto/nat_auto_api.c:84 |
5480 | msgid "detected that we are offline" | 5618 | msgid "detected that we are offline" |
5481 | msgstr "" | 5619 | msgstr "" |
5482 | 5620 | ||
5483 | #: src/nat/nat_api.c:890 src/nat/nat.c:2020 | 5621 | #: src/nat-auto/nat_auto_api.c:86 |
5484 | #, fuzzy | 5622 | #, fuzzy |
5485 | msgid "`upnpc` command not found" | 5623 | msgid "`upnpc` command not found" |
5486 | msgstr "comando «upnpc» no encontrado\n" | 5624 | msgstr "comando «upnpc» no encontrado\n" |
5487 | 5625 | ||
5488 | #: src/nat/nat_api.c:892 src/nat/nat.c:2022 | 5626 | #: src/nat-auto/nat_auto_api.c:88 |
5489 | #, fuzzy | 5627 | #, fuzzy |
5490 | msgid "Failed to run `upnpc` command" | 5628 | msgid "Failed to run `upnpc` command" |
5491 | msgstr "Se produjo un fallo al ejecutar «%s»\n" | 5629 | msgstr "Se produjo un fallo al ejecutar «%s»\n" |
5492 | 5630 | ||
5493 | #: src/nat/nat_api.c:894 src/nat/nat.c:2024 | 5631 | #: src/nat-auto/nat_auto_api.c:90 |
5494 | #, fuzzy | 5632 | #, fuzzy |
5495 | msgid "`upnpc' command took too long, process killed" | 5633 | msgid "`upnpc' command took too long, process killed" |
5496 | msgstr "comando «upnpc» no encontrado\n" | 5634 | msgstr "comando «upnpc» no encontrado\n" |
5497 | 5635 | ||
5498 | #: src/nat/nat_api.c:896 src/nat/nat.c:2026 | 5636 | #: src/nat-auto/nat_auto_api.c:92 |
5499 | msgid "`upnpc' command failed to establish port mapping" | 5637 | msgid "`upnpc' command failed to establish port mapping" |
5500 | msgstr "" | 5638 | msgstr "" |
5501 | 5639 | ||
5502 | #: src/nat/nat_api.c:898 src/nat/nat.c:2028 | 5640 | #: src/nat-auto/nat_auto_api.c:94 |
5503 | #, fuzzy | 5641 | #, fuzzy |
5504 | msgid "`external-ip' command not found" | 5642 | msgid "`external-ip' command not found" |
5505 | msgstr "comando «external-ip» no encontrado\n" | 5643 | msgstr "comando «external-ip» no encontrado\n" |
5506 | 5644 | ||
5507 | #: src/nat/nat_api.c:900 src/nat/nat.c:2030 | 5645 | #: src/nat-auto/nat_auto_api.c:96 |
5508 | #, fuzzy | 5646 | #, fuzzy |
5509 | msgid "Failed to run `external-ip` command" | 5647 | msgid "Failed to run `external-ip` command" |
5510 | msgstr "Se produjo un fallo al ejecutar «%s»\n" | 5648 | msgstr "Se produjo un fallo al ejecutar «%s»\n" |
5511 | 5649 | ||
5512 | #: src/nat/nat_api.c:902 src/nat/nat.c:2032 | 5650 | #: src/nat-auto/nat_auto_api.c:98 |
5513 | #, fuzzy | 5651 | #, fuzzy |
5514 | msgid "`external-ip' command output invalid" | 5652 | msgid "`external-ip' command output invalid" |
5515 | msgstr "comando «external-ip» no encontrado\n" | 5653 | msgstr "comando «external-ip» no encontrado\n" |
5516 | 5654 | ||
5517 | #: src/nat/nat_api.c:904 src/nat/nat.c:2034 | 5655 | #: src/nat-auto/nat_auto_api.c:100 |
5518 | msgid "no valid address was returned by `external-ip'" | 5656 | msgid "no valid address was returned by `external-ip'" |
5519 | msgstr "" | 5657 | msgstr "" |
5520 | 5658 | ||
5521 | #: src/nat/nat_api.c:906 src/nat/nat.c:2036 | 5659 | #: src/nat-auto/nat_auto_api.c:102 |
5522 | #, fuzzy | 5660 | #, fuzzy |
5523 | msgid "Could not determine interface with internal/local network address" | 5661 | msgid "Could not determine interface with internal/local network address" |
5524 | msgstr "No se pudo determinar la ruta de instalación de los módulos.\n" | 5662 | msgstr "No se pudo determinar la ruta de instalación de los módulos.\n" |
5525 | 5663 | ||
5526 | #: src/nat/nat_api.c:908 src/nat/nat.c:2038 | 5664 | #: src/nat-auto/nat_auto_api.c:104 |
5527 | #, fuzzy | 5665 | #, fuzzy |
5528 | msgid "No functioning gnunet-helper-nat-server installation found" | 5666 | msgid "No functioning gnunet-helper-nat-server installation found" |
5529 | msgstr "No se ha encontrado un «gnunet-helper-nat-server» funcional\n" | 5667 | msgstr "No se ha encontrado un «gnunet-helper-nat-server» funcional\n" |
5530 | 5668 | ||
5531 | #: src/nat/nat_api.c:910 src/nat/nat.c:2040 | 5669 | #: src/nat-auto/nat_auto_api.c:106 |
5532 | msgid "NAT test could not be initialized" | 5670 | msgid "NAT test could not be initialized" |
5533 | msgstr "" | 5671 | msgstr "" |
5534 | 5672 | ||
5535 | #: src/nat/nat_api.c:912 src/nat/nat.c:2042 | 5673 | #: src/nat-auto/nat_auto_api.c:108 |
5536 | msgid "NAT test timeout reached" | 5674 | msgid "NAT test timeout reached" |
5537 | msgstr "" | 5675 | msgstr "" |
5538 | 5676 | ||
5539 | #: src/nat/nat_api.c:914 src/nat/nat.c:2044 | 5677 | #: src/nat-auto/nat_auto_api.c:110 |
5540 | msgid "could not register NAT" | 5678 | msgid "could not register NAT" |
5541 | msgstr "" | 5679 | msgstr "" |
5542 | 5680 | ||
5543 | #: src/nat/nat_api.c:916 src/nat/nat.c:2046 | 5681 | #: src/nat-auto/nat_auto_api.c:112 |
5544 | #, fuzzy | 5682 | #, fuzzy |
5545 | msgid "No working gnunet-helper-nat-client installation found" | 5683 | msgid "No working gnunet-helper-nat-client installation found" |
5546 | msgstr "No se ha encontrado un «gnunet-helper-nat-server» funcional\n" | 5684 | msgstr "No se ha encontrado un «gnunet-helper-nat-server» funcional\n" |
5547 | 5685 | ||
5548 | #: src/nat/nat_auto.c:385 | 5686 | #: src/nat-auto/nat_auto_api_test.c:477 |
5549 | msgid "NAT traversal with ICMP Server succeeded.\n" | 5687 | #, fuzzy, c-format |
5550 | msgstr "Recorrido NAT con servidor ICMP satisfactorio.\n" | 5688 | msgid "Failed to find valid PORT in section `%s'\n" |
5551 | 5689 | msgstr "¡Se produjo un fallo al buscar la opción %s en la sección %s!\n" | |
5552 | #: src/nat/nat_auto.c:386 | ||
5553 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5554 | msgstr "Recorrido NAT con servidor ICMP fallido.\n" | ||
5555 | |||
5556 | #: src/nat/nat_auto.c:405 | ||
5557 | msgid "Testing connection reversal with ICMP server.\n" | ||
5558 | msgstr "Probando conexión inversa con el servidor ICMP.\n" | ||
5559 | |||
5560 | #: src/nat/nat_auto.c:437 | ||
5561 | #, c-format | ||
5562 | msgid "Detected external IP `%s'\n" | ||
5563 | msgstr "Detectada IP externa «%s»\n" | ||
5564 | 5690 | ||
5565 | #: src/nat/nat_auto.c:572 | 5691 | #: src/nat/gnunet-nat.c:424 |
5566 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | 5692 | msgid "which IP and port are we locally using to bind/listen to" |
5567 | msgstr "" | 5693 | msgstr "" |
5568 | "Este sistema tiene una dirección IPv6 global, fijando IPv6 a habilitado.\n" | ||
5569 | |||
5570 | #: src/nat/nat_auto.c:590 | ||
5571 | #, c-format | ||
5572 | msgid "Detected internal network address `%s'.\n" | ||
5573 | msgstr "Detectada dirección de la red interna «%s».\n" | ||
5574 | |||
5575 | #: src/nat/nat_auto.c:681 src/nat/nat_test.c:403 | ||
5576 | msgid "Failed to connect to `gnunet-nat-server'\n" | ||
5577 | msgstr "Se produjo un fallo al conectar con «gnunet-nat-server»\n" | ||
5578 | |||
5579 | #: src/nat/nat_auto.c:724 | ||
5580 | msgid "upnpc found, enabling its use\n" | ||
5581 | msgstr "«upnpc» encontrado, habilitando su uso\n" | ||
5582 | 5694 | ||
5583 | #: src/nat/nat_auto.c:725 | 5695 | #: src/nat/gnunet-nat.c:427 |
5584 | msgid "upnpc not found\n" | 5696 | msgid "which remote IP and port should be asked for connection reversal" |
5585 | msgstr "«upnpc» no encontrado\n" | 5697 | msgstr "" |
5586 | 5698 | ||
5587 | #: src/nat/nat_auto.c:762 | 5699 | #: src/nat/gnunet-nat.c:430 |
5588 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | 5700 | msgid "" |
5701 | "name of configuration section to find additional options, such as manual " | ||
5702 | "host punching data" | ||
5589 | msgstr "" | 5703 | msgstr "" |
5590 | 5704 | ||
5591 | #: src/nat/nat_auto.c:774 src/nat/nat_auto.c:834 | 5705 | #: src/nat/gnunet-nat.c:433 |
5592 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | 5706 | msgid "enable STUN processing" |
5593 | msgstr "" | 5707 | msgstr "" |
5594 | 5708 | ||
5595 | #: src/nat/nat_auto.c:786 src/nat/nat_auto.c:846 | 5709 | #: src/nat/gnunet-nat.c:442 |
5596 | msgid "No working gnunet-helper-nat-server found\n" | 5710 | #, fuzzy |
5597 | msgstr "No se ha encontrado un «gnunet-helper-nat-server» funcional\n" | 5711 | msgid "watch for connection reversal requests" |
5712 | msgstr "# pares desconectados debido a petición externa" | ||
5598 | 5713 | ||
5599 | #: src/nat/nat_auto.c:823 | 5714 | #: src/nat/gnunet-nat.c:454 |
5600 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | 5715 | #, fuzzy |
5601 | msgstr "" | 5716 | msgid "GNUnet NAT traversal autoconfigure daemon" |
5717 | msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet" | ||
5602 | 5718 | ||
5603 | #: src/nat/nat.c:1019 | 5719 | #: src/nat/gnunet-service-nat.c:1313 |
5604 | #, c-format | 5720 | #, c-format |
5605 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" | 5721 | msgid "Malformed punched hole specification `%s' (lacks port)\n" |
5606 | msgstr "«gnunet-helper-nat-server» generó la dirección mal formada «%s»\n" | 5722 | msgstr "" |
5607 | 5723 | ||
5608 | #: src/nat/nat.c:1070 | 5724 | #: src/nat/gnunet-service-nat.c:1323 |
5609 | #, c-format | 5725 | #, fuzzy, c-format |
5610 | msgid "Failed to start %s\n" | 5726 | msgid "Invalid port number in punched hole specification `%s' (lacks port)\n" |
5611 | msgstr "Se produjo un fallo al arrancar %s\n" | 5727 | msgstr "" |
5728 | "Puerto inválido \"%s\" en la especificación de la lista local, probando el " | ||
5729 | "puerto %d.\n" | ||
5612 | 5730 | ||
5613 | #: src/nat/nat.c:1327 | 5731 | #: src/nat/gnunet-service-nat.c:1339 |
5614 | msgid "Error while running upnp client:\n" | 5732 | #, c-format |
5733 | msgid "Malformed punched hole specification `%s' (lacks `]')\n" | ||
5615 | msgstr "" | 5734 | msgstr "" |
5616 | 5735 | ||
5617 | #: src/nat/nat.c:1402 | 5736 | #: src/nat/gnunet-service-nat.c:1350 |
5618 | #, fuzzy, c-format | 5737 | #, c-format |
5619 | msgid "Failed to run upnp client for port %u\n" | 5738 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
5620 | msgstr "" | 5739 | msgstr "" |
5621 | "Se produjo un fallo al inicializar la clave de la máquina desde el par %u\n" | ||
5622 | 5740 | ||
5623 | #: src/nat/nat.c:1546 | 5741 | #: src/nat/gnunet-service-nat.c:1803 |
5624 | msgid "malformed" | 5742 | #, fuzzy |
5625 | msgstr "mal formado" | 5743 | msgid "Connection reversal request failed\n" |
5744 | msgstr "Colección detenida.\n" | ||
5626 | 5745 | ||
5627 | #: src/nat/nat.c:1600 | 5746 | #: src/nat/gnunet-service-nat.c:1876 |
5628 | msgid "" | 5747 | msgid "" |
5629 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 5748 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
5630 | "disabling UPnP \n" | 5749 | "disabling UPnP\n" |
5631 | msgstr "" | 5750 | msgstr "" |
5632 | 5751 | ||
5633 | #: src/nat/nat.c:1726 src/nat/nat.c:1739 | 5752 | #: src/nat/gnunet-service-nat_helper.c:186 |
5634 | #, c-format | 5753 | #, c-format |
5635 | msgid "" | 5754 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" |
5636 | "Configuration requires `%s', but binary is not installed properly (SUID bit " | 5755 | msgstr "«gnunet-helper-nat-server» generó la dirección mal formada «%s»\n" |
5637 | "not set). Option disabled.\n" | ||
5638 | msgstr "" | ||
5639 | "La configuración requiere «%s», pero el binario no está instalado de forma " | ||
5640 | "correcta (SUID bit no activado). Opción deshabilitada.\n" | ||
5641 | |||
5642 | #: src/nat/nat.c:1903 | ||
5643 | msgid "Internal IP address not known, cannot use ICMP NAT traversal method\n" | ||
5644 | msgstr "" | ||
5645 | "Direcciones internas IP no conocidas, no se puede usar el método del " | ||
5646 | "recorrido NAT ICMP\n" | ||
5647 | 5756 | ||
5648 | #: src/nat/nat.c:1919 | 5757 | #: src/nat/gnunet-service-nat_helper.c:260 |
5649 | #, c-format | 5758 | #, c-format |
5650 | msgid "Running gnunet-helper-nat-client %s %s %u\n" | 5759 | msgid "Failed to start %s\n" |
5651 | msgstr "Ejecutando gnunet-helper-nat-client %s %s %u\n" | 5760 | msgstr "Se produjo un fallo al arrancar %s\n" |
5652 | 5761 | ||
5653 | #: src/nat/nat_mini.c:205 | 5762 | #: src/nat/gnunet-service-nat_mini.c:196 |
5654 | msgid "`external-ip' command not found\n" | 5763 | msgid "`external-ip' command not found\n" |
5655 | msgstr "comando «external-ip» no encontrado\n" | 5764 | msgstr "comando «external-ip» no encontrado\n" |
5656 | 5765 | ||
5657 | #: src/nat/nat_mini.c:611 | 5766 | #: src/nat/gnunet-service-nat_mini.c:654 |
5658 | msgid "`upnpc' command not found\n" | 5767 | msgid "`upnpc' command not found\n" |
5659 | msgstr "comando «upnpc» no encontrado\n" | 5768 | msgstr "comando «upnpc» no encontrado\n" |
5660 | 5769 | ||
5661 | #: src/nat/nat_test.c:518 | ||
5662 | #, c-format | ||
5663 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5664 | msgstr "" | ||
5665 | "Se produjo un fallo al crear el «socket» de escucha asociado a «%s» para " | ||
5666 | "pruebas NAT: %s\n" | ||
5667 | |||
5668 | #: src/nat/nat_test.c:568 | ||
5669 | #, fuzzy | ||
5670 | msgid "NAT test failed to start NAT library\n" | ||
5671 | msgstr "El almacén de nombres no pudo añadir el registro\n" | ||
5672 | |||
5673 | #: src/nse/gnunet-nse.c:122 | 5770 | #: src/nse/gnunet-nse.c:122 |
5674 | #, fuzzy | 5771 | #, fuzzy |
5675 | msgid "Show network size estimates from NSE service." | 5772 | msgid "Show network size estimates from NSE service." |
@@ -7504,59 +7601,38 @@ msgstr "# Mensajes PONG omitidos, firma expirada" | |||
7504 | msgid "# validations succeeded" | 7601 | msgid "# validations succeeded" |
7505 | msgstr "# revalidaciones de direcciones iniciadas" | 7602 | msgstr "# revalidaciones de direcciones iniciadas" |
7506 | 7603 | ||
7507 | #: src/transport/gnunet-transport.c:486 | 7604 | #: src/transport/gnunet-transport.c:418 |
7508 | #, c-format | 7605 | #, c-format |
7509 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" | 7606 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" |
7510 | msgstr "Transmitidos %llu bytes/s (%llu bytes en %s)\n" | 7607 | msgstr "Transmitidos %llu bytes/s (%llu bytes en %s)\n" |
7511 | 7608 | ||
7512 | #: src/transport/gnunet-transport.c:496 | 7609 | #: src/transport/gnunet-transport.c:428 |
7513 | #, c-format | 7610 | #, c-format |
7514 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" | 7611 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" |
7515 | msgstr "Recibidos %llu bytes/s (%llu bytes en %s)\n" | 7612 | msgstr "Recibidos %llu bytes/s (%llu bytes en %s)\n" |
7516 | 7613 | ||
7517 | #: src/transport/gnunet-transport.c:540 | 7614 | #: src/transport/gnunet-transport.c:472 |
7518 | #, c-format | 7615 | #, c-format |
7519 | msgid "Failed to connect to `%s'\n" | 7616 | msgid "Failed to connect to `%s'\n" |
7520 | msgstr "Se produjo un fallo al conectar con «%s»\n" | 7617 | msgstr "Se produjo un fallo al conectar con «%s»\n" |
7521 | 7618 | ||
7522 | #: src/transport/gnunet-transport.c:553 | 7619 | #: src/transport/gnunet-transport.c:485 |
7523 | #, c-format | 7620 | #, c-format |
7524 | msgid "Failed to resolve address for peer `%s'\n" | 7621 | msgid "Failed to resolve address for peer `%s'\n" |
7525 | msgstr "Se produjo un fallo al resolver la dirección para el par «%s»\n" | 7622 | msgstr "Se produjo un fallo al resolver la dirección para el par «%s»\n" |
7526 | 7623 | ||
7527 | # Miguel: La traducción no es literal, pero me parece más correcta | 7624 | # Miguel: La traducción no es literal, pero me parece más correcta |
7528 | # en castellano. | 7625 | # en castellano. |
7529 | #: src/transport/gnunet-transport.c:565 | 7626 | #: src/transport/gnunet-transport.c:499 |
7530 | msgid "Failed to list connections, timeout occured\n" | 7627 | msgid "Failed to list connections, timeout occured\n" |
7531 | msgstr "No se pudieron listar las conexiones, expiró el plazo\n" | 7628 | msgstr "No se pudieron listar las conexiones, expiró el plazo\n" |
7532 | 7629 | ||
7533 | #: src/transport/gnunet-transport.c:588 | 7630 | #: src/transport/gnunet-transport.c:532 |
7534 | #, fuzzy, c-format | ||
7535 | msgid "NAT plugin `%s' reports: %s\n" | ||
7536 | msgstr "Módulo de transporte: «%s» puerto %llu\n" | ||
7537 | |||
7538 | #: src/transport/gnunet-transport.c:675 | ||
7539 | msgid "No transport plugins configured, peer will never communicate\n" | ||
7540 | msgstr "" | ||
7541 | "No hay módulos de transporte configurados, el par nunca se comunicará\n" | ||
7542 | |||
7543 | #: src/transport/gnunet-transport.c:689 | ||
7544 | #, c-format | ||
7545 | msgid "No port configured for plugin `%s', cannot test it\n" | ||
7546 | msgstr "" | ||
7547 | "Ningún puerto fue configurado para el módulo «%s», no se puede probar\n" | ||
7548 | |||
7549 | #: src/transport/gnunet-transport.c:714 | ||
7550 | #, fuzzy | ||
7551 | msgid "Failed to start resolver!\n" | ||
7552 | msgstr "Se produjo un fallo al arrancar %s\n" | ||
7553 | |||
7554 | #: src/transport/gnunet-transport.c:750 | ||
7555 | #, fuzzy, c-format | 7631 | #, fuzzy, c-format |
7556 | msgid "Transmitting %u bytes\n" | 7632 | msgid "Transmitting %u bytes\n" |
7557 | msgstr "Transmitiendo %u bytes a %s\n" | 7633 | msgstr "Transmitiendo %u bytes a %s\n" |
7558 | 7634 | ||
7559 | #: src/transport/gnunet-transport.c:784 | 7635 | #: src/transport/gnunet-transport.c:566 |
7560 | #, c-format | 7636 | #, c-format |
7561 | msgid "" | 7637 | msgid "" |
7562 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " | 7638 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " |
@@ -7565,46 +7641,46 @@ msgstr "" | |||
7565 | "Conectado satisfactoriamente a «%s», empezando a mandar datos de prueba en " | 7641 | "Conectado satisfactoriamente a «%s», empezando a mandar datos de prueba en " |
7566 | "bloques de %u Kb\n" | 7642 | "bloques de %u Kb\n" |
7567 | 7643 | ||
7568 | #: src/transport/gnunet-transport.c:815 | 7644 | #: src/transport/gnunet-transport.c:597 |
7569 | #, c-format | 7645 | #, c-format |
7570 | msgid "Disconnected from peer `%s' while benchmarking\n" | 7646 | msgid "Disconnected from peer `%s' while benchmarking\n" |
7571 | msgstr "Desconectado del par «%s» mientras probaba\n" | 7647 | msgstr "Desconectado del par «%s» mientras probaba\n" |
7572 | 7648 | ||
7573 | #: src/transport/gnunet-transport.c:839 src/transport/gnunet-transport.c:868 | 7649 | #: src/transport/gnunet-transport.c:621 src/transport/gnunet-transport.c:650 |
7574 | #, c-format | 7650 | #, c-format |
7575 | msgid "%24s: %-17s %4s (%u connections in total)\n" | 7651 | msgid "%24s: %-17s %4s (%u connections in total)\n" |
7576 | msgstr "%24s: %-17s %4s (%u conexiones en total)\n" | 7652 | msgstr "%24s: %-17s %4s (%u conexiones en total)\n" |
7577 | 7653 | ||
7578 | #: src/transport/gnunet-transport.c:841 | 7654 | #: src/transport/gnunet-transport.c:623 |
7579 | msgid "Connected to" | 7655 | msgid "Connected to" |
7580 | msgstr "Conectado a" | 7656 | msgstr "Conectado a" |
7581 | 7657 | ||
7582 | #: src/transport/gnunet-transport.c:870 | 7658 | #: src/transport/gnunet-transport.c:652 |
7583 | msgid "Disconnected from" | 7659 | msgid "Disconnected from" |
7584 | msgstr "Desconectado de" | 7660 | msgstr "Desconectado de" |
7585 | 7661 | ||
7586 | #: src/transport/gnunet-transport.c:905 | 7662 | #: src/transport/gnunet-transport.c:687 |
7587 | #, fuzzy, c-format | 7663 | #, fuzzy, c-format |
7588 | msgid "Received %u bytes\n" | 7664 | msgid "Received %u bytes\n" |
7589 | msgstr "Recibidos %u bytes de %s\n" | 7665 | msgstr "Recibidos %u bytes de %s\n" |
7590 | 7666 | ||
7591 | #: src/transport/gnunet-transport.c:942 | 7667 | #: src/transport/gnunet-transport.c:724 |
7592 | #, c-format | 7668 | #, c-format |
7593 | msgid "Peer `%s': %s %s in state `%s' until %s\n" | 7669 | msgid "Peer `%s': %s %s in state `%s' until %s\n" |
7594 | msgstr "" | 7670 | msgstr "" |
7595 | 7671 | ||
7596 | #: src/transport/gnunet-transport.c:954 | 7672 | #: src/transport/gnunet-transport.c:736 |
7597 | #, c-format | 7673 | #, c-format |
7598 | msgid "Peer `%s': %s %s\n" | 7674 | msgid "Peer `%s': %s %s\n" |
7599 | msgstr "Par «%s»: %s %s\n" | 7675 | msgstr "Par «%s»: %s %s\n" |
7600 | 7676 | ||
7601 | #: src/transport/gnunet-transport.c:1366 | 7677 | #: src/transport/gnunet-transport.c:1150 |
7602 | #, fuzzy | 7678 | #, fuzzy |
7603 | msgid "Monitor disconnected from transport service. Reconnecting.\n" | 7679 | msgid "Monitor disconnected from transport service. Reconnecting.\n" |
7604 | msgstr "" | 7680 | msgstr "" |
7605 | "El cliente se desconectó del servicio principal, tratando de reconectar.\n" | 7681 | "El cliente se desconectó del servicio principal, tratando de reconectar.\n" |
7606 | 7682 | ||
7607 | #: src/transport/gnunet-transport.c:1488 | 7683 | #: src/transport/gnunet-transport.c:1267 |
7608 | #, fuzzy, c-format | 7684 | #, fuzzy, c-format |
7609 | msgid "" | 7685 | msgid "" |
7610 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " | 7686 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " |
@@ -7613,7 +7689,7 @@ msgstr "" | |||
7613 | "Múltiples operaciones introducidas. Por favor, seleccione únicamente una " | 7689 | "Múltiples operaciones introducidas. Por favor, seleccione únicamente una " |
7614 | "operación: %s, %s, %s, %s, %s, %s\n" | 7690 | "operación: %s, %s, %s, %s, %s, %s\n" |
7615 | 7691 | ||
7616 | #: src/transport/gnunet-transport.c:1501 | 7692 | #: src/transport/gnunet-transport.c:1280 |
7617 | #, fuzzy, c-format | 7693 | #, fuzzy, c-format |
7618 | msgid "" | 7694 | msgid "" |
7619 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" | 7695 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" |
@@ -7621,72 +7697,68 @@ msgstr "" | |||
7621 | "Ninguna operación introducida. Por favor, seleccione alguna operación: %s, " | 7697 | "Ninguna operación introducida. Por favor, seleccione alguna operación: %s, " |
7622 | "%s, %s, %s, %s, %s\n" | 7698 | "%s, %s, %s, %s, %s\n" |
7623 | 7699 | ||
7624 | #: src/transport/gnunet-transport.c:1529 | 7700 | #: src/transport/gnunet-transport.c:1308 |
7625 | #, fuzzy | 7701 | #, fuzzy |
7626 | msgid "Failed to connect to transport service for disconnection\n" | 7702 | msgid "Failed to connect to transport service for disconnection\n" |
7627 | msgstr "Se produjo un fallo al conectar con el servicio de transporte\n" | 7703 | msgstr "Se produjo un fallo al conectar con el servicio de transporte\n" |
7628 | 7704 | ||
7629 | #: src/transport/gnunet-transport.c:1535 | 7705 | #: src/transport/gnunet-transport.c:1314 |
7630 | msgid "Blacklisting request in place, stop with CTRL-C\n" | 7706 | msgid "Blacklisting request in place, stop with CTRL-C\n" |
7631 | msgstr "" | 7707 | msgstr "" |
7632 | 7708 | ||
7633 | #: src/transport/gnunet-transport.c:1558 src/transport/gnunet-transport.c:1588 | 7709 | #: src/transport/gnunet-transport.c:1337 src/transport/gnunet-transport.c:1367 |
7634 | #: src/transport/gnunet-transport.c:1641 | 7710 | #: src/transport/gnunet-transport.c:1420 |
7635 | msgid "Failed to connect to transport service\n" | 7711 | msgid "Failed to connect to transport service\n" |
7636 | msgstr "Se produjo un fallo al conectar con el servicio de transporte\n" | 7712 | msgstr "Se produjo un fallo al conectar con el servicio de transporte\n" |
7637 | 7713 | ||
7638 | #: src/transport/gnunet-transport.c:1595 | 7714 | #: src/transport/gnunet-transport.c:1374 |
7639 | msgid "Starting to receive benchmark data\n" | 7715 | msgid "Starting to receive benchmark data\n" |
7640 | msgstr "Empezando a recibir datos de prueba\n" | 7716 | msgstr "Empezando a recibir datos de prueba\n" |
7641 | 7717 | ||
7642 | #: src/transport/gnunet-transport.c:1665 | 7718 | #: src/transport/gnunet-transport.c:1444 |
7643 | #, fuzzy | 7719 | #, fuzzy |
7644 | msgid "print information for all peers (instead of only connected peers)" | 7720 | msgid "print information for all peers (instead of only connected peers)" |
7645 | msgstr "Imprime información sobre los pares conectados." | 7721 | msgstr "Imprime información sobre los pares conectados." |
7646 | 7722 | ||
7647 | #: src/transport/gnunet-transport.c:1668 | 7723 | #: src/transport/gnunet-transport.c:1447 |
7648 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" | 7724 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" |
7649 | msgstr "medir cómo de rápido recibimos datos de todos los pares (hasta CTRL-C)" | 7725 | msgstr "medir cómo de rápido recibimos datos de todos los pares (hasta CTRL-C)" |
7650 | 7726 | ||
7651 | #: src/transport/gnunet-transport.c:1671 | 7727 | #: src/transport/gnunet-transport.c:1450 |
7652 | #, fuzzy | 7728 | #, fuzzy |
7653 | msgid "disconnect from a peer" | 7729 | msgid "disconnect from a peer" |
7654 | msgstr "conectar a un par" | 7730 | msgstr "conectar a un par" |
7655 | 7731 | ||
7656 | #: src/transport/gnunet-transport.c:1674 | 7732 | #: src/transport/gnunet-transport.c:1453 |
7657 | msgid "provide information about all current connections (once)" | 7733 | msgid "provide information about all current connections (once)" |
7658 | msgstr "provee información sobre todas las conexiones actuales (una vez)" | 7734 | msgstr "provee información sobre todas las conexiones actuales (una vez)" |
7659 | 7735 | ||
7660 | #: src/transport/gnunet-transport.c:1680 | 7736 | #: src/transport/gnunet-transport.c:1459 |
7661 | msgid "" | 7737 | msgid "" |
7662 | "provide information about all connects and disconnect events (continuously)" | 7738 | "provide information about all connects and disconnect events (continuously)" |
7663 | msgstr "" | 7739 | msgstr "" |
7664 | "provee información sobre todas los eventos de conexión y desconexión " | 7740 | "provee información sobre todas los eventos de conexión y desconexión " |
7665 | "(continuamente)" | 7741 | "(continuamente)" |
7666 | 7742 | ||
7667 | #: src/transport/gnunet-transport.c:1683 | 7743 | #: src/transport/gnunet-transport.c:1462 |
7668 | msgid "do not resolve hostnames" | 7744 | msgid "do not resolve hostnames" |
7669 | msgstr "no resolver nombres de máquinas" | 7745 | msgstr "no resolver nombres de máquinas" |
7670 | 7746 | ||
7671 | #: src/transport/gnunet-transport.c:1686 | 7747 | #: src/transport/gnunet-transport.c:1465 |
7672 | #: src/transport/gnunet-transport-profiler.c:631 | 7748 | #: src/transport/gnunet-transport-profiler.c:631 |
7673 | msgid "peer identity" | 7749 | msgid "peer identity" |
7674 | msgstr "identidad del par" | 7750 | msgstr "identidad del par" |
7675 | 7751 | ||
7676 | #: src/transport/gnunet-transport.c:1689 | 7752 | #: src/transport/gnunet-transport.c:1468 |
7677 | #, fuzzy | 7753 | #, fuzzy |
7678 | msgid "monitor plugin sessions" | 7754 | msgid "monitor plugin sessions" |
7679 | msgstr "# sesiones wlan pendientes" | 7755 | msgstr "# sesiones wlan pendientes" |
7680 | 7756 | ||
7681 | #: src/transport/gnunet-transport.c:1692 | 7757 | #: src/transport/gnunet-transport.c:1471 |
7682 | msgid "send data for benchmarking to the other peer (until CTRL-C)" | 7758 | msgid "send data for benchmarking to the other peer (until CTRL-C)" |
7683 | msgstr "enviar data para prueba a otro par (hasta CTRL-C)" | 7759 | msgstr "enviar data para prueba a otro par (hasta CTRL-C)" |
7684 | 7760 | ||
7685 | #: src/transport/gnunet-transport.c:1695 | 7761 | #: src/transport/gnunet-transport.c:1482 |
7686 | msgid "test transport configuration (involves external server)" | ||
7687 | msgstr "probar configuración de transporte (requiere un servidor externo)" | ||
7688 | |||
7689 | #: src/transport/gnunet-transport.c:1706 | ||
7690 | #: src/transport/gnunet-transport-profiler.c:642 | 7762 | #: src/transport/gnunet-transport-profiler.c:642 |
7691 | msgid "Direct access to transport service." | 7763 | msgid "Direct access to transport service." |
7692 | msgstr "Acceso directo al servicio de transporte." | 7764 | msgstr "Acceso directo al servicio de transporte." |
@@ -7722,9 +7794,9 @@ msgstr "tamaño del mensaje" | |||
7722 | 7794 | ||
7723 | #: src/transport/plugin_transport_http_client.c:1477 | 7795 | #: src/transport/plugin_transport_http_client.c:1477 |
7724 | #: src/transport/plugin_transport_http_server.c:2248 | 7796 | #: src/transport/plugin_transport_http_server.c:2248 |
7725 | #: src/transport/plugin_transport_http_server.c:3457 | 7797 | #: src/transport/plugin_transport_http_server.c:3462 |
7726 | #: src/transport/plugin_transport_tcp.c:3365 | 7798 | #: src/transport/plugin_transport_tcp.c:3375 |
7727 | #: src/transport/plugin_transport_tcp.c:3372 | 7799 | #: src/transport/plugin_transport_tcp.c:3382 |
7728 | msgid "TCP_STEALTH not supported on this platform.\n" | 7800 | msgid "TCP_STEALTH not supported on this platform.\n" |
7729 | msgstr "" | 7801 | msgstr "" |
7730 | 7802 | ||
@@ -7736,13 +7808,13 @@ msgstr "" | |||
7736 | "módulo %s!\n" | 7808 | "módulo %s!\n" |
7737 | 7809 | ||
7738 | #: src/transport/plugin_transport_http_client.c:2167 | 7810 | #: src/transport/plugin_transport_http_client.c:2167 |
7739 | #: src/transport/plugin_transport_http_server.c:3172 | 7811 | #: src/transport/plugin_transport_http_server.c:3177 |
7740 | #, c-format | 7812 | #, c-format |
7741 | msgid "Shutting down plugin `%s'\n" | 7813 | msgid "Shutting down plugin `%s'\n" |
7742 | msgstr "Finalizando el módulo «%s»\n" | 7814 | msgstr "Finalizando el módulo «%s»\n" |
7743 | 7815 | ||
7744 | #: src/transport/plugin_transport_http_client.c:2184 | 7816 | #: src/transport/plugin_transport_http_client.c:2184 |
7745 | #: src/transport/plugin_transport_http_server.c:3242 | 7817 | #: src/transport/plugin_transport_http_server.c:3247 |
7746 | #, c-format | 7818 | #, c-format |
7747 | msgid "Shutdown for plugin `%s' complete\n" | 7819 | msgid "Shutdown for plugin `%s' complete\n" |
7748 | msgstr "Finalización del módulo «%s» completa\n" | 7820 | msgstr "Finalización del módulo «%s» completa\n" |
@@ -7793,73 +7865,73 @@ msgstr "" | |||
7793 | msgid "Could not load or create server certificate! Loading plugin failed!\n" | 7865 | msgid "Could not load or create server certificate! Loading plugin failed!\n" |
7794 | msgstr "" | 7866 | msgstr "" |
7795 | 7867 | ||
7796 | #: src/transport/plugin_transport_http_server.c:2583 | 7868 | #: src/transport/plugin_transport_http_server.c:2586 |
7797 | msgid "Require valid port number for service in configuration!\n" | 7869 | msgid "Require valid port number for service in configuration!\n" |
7798 | msgstr "¡Se necesita un puerto válido para el servicio en la configuración!\n" | 7870 | msgstr "¡Se necesita un puerto válido para el servicio en la configuración!\n" |
7799 | 7871 | ||
7800 | #: src/transport/plugin_transport_http_server.c:2748 | 7872 | #: src/transport/plugin_transport_http_server.c:2751 |
7801 | #, c-format | 7873 | #, c-format |
7802 | msgid "Found %u addresses to report to NAT service\n" | 7874 | msgid "Found %u addresses to report to NAT service\n" |
7803 | msgstr "Encontradas %u direcciones para comunicar al servicio NAT\n" | 7875 | msgstr "Encontradas %u direcciones para comunicar al servicio NAT\n" |
7804 | 7876 | ||
7805 | #: src/transport/plugin_transport_http_server.c:2832 | 7877 | #: src/transport/plugin_transport_http_server.c:2837 |
7806 | #: src/transport/plugin_transport_udp.c:3600 | 7878 | #: src/transport/plugin_transport_udp.c:3623 |
7807 | msgid "Disabling IPv6 since it is not supported on this system!\n" | 7879 | msgid "Disabling IPv6 since it is not supported on this system!\n" |
7808 | msgstr "¡Deshabilitando IPv6 ya que no está soportado en este sistema!\n" | 7880 | msgstr "¡Deshabilitando IPv6 ya que no está soportado en este sistema!\n" |
7809 | 7881 | ||
7810 | #: src/transport/plugin_transport_http_server.c:2938 | 7882 | #: src/transport/plugin_transport_http_server.c:2943 |
7811 | #, c-format | 7883 | #, c-format |
7812 | msgid "IPv4 support is %s\n" | 7884 | msgid "IPv4 support is %s\n" |
7813 | msgstr "El soporte IPv4 es %s\n" | 7885 | msgstr "El soporte IPv4 es %s\n" |
7814 | 7886 | ||
7815 | #: src/transport/plugin_transport_http_server.c:2953 | 7887 | #: src/transport/plugin_transport_http_server.c:2958 |
7816 | #, c-format | 7888 | #, c-format |
7817 | msgid "IPv6 support is %s\n" | 7889 | msgid "IPv6 support is %s\n" |
7818 | msgstr "El soporte IPv6 es %s\n" | 7890 | msgstr "El soporte IPv6 es %s\n" |
7819 | 7891 | ||
7820 | #: src/transport/plugin_transport_http_server.c:2959 | 7892 | #: src/transport/plugin_transport_http_server.c:2964 |
7821 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" | 7893 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" |
7822 | msgstr "¡Ni IPv4 ni IPv6 están habilitadas! Corrija la configuración\n" | 7894 | msgstr "¡Ni IPv4 ni IPv6 están habilitadas! Corrija la configuración\n" |
7823 | 7895 | ||
7824 | #: src/transport/plugin_transport_http_server.c:2970 | 7896 | #: src/transport/plugin_transport_http_server.c:2975 |
7825 | msgid "Port is required! Fix in configuration\n" | 7897 | msgid "Port is required! Fix in configuration\n" |
7826 | msgstr "¡El puerto es necesario! Corrija la configuración\n" | 7898 | msgstr "¡El puerto es necesario! Corrija la configuración\n" |
7827 | 7899 | ||
7828 | #: src/transport/plugin_transport_http_server.c:2976 | 7900 | #: src/transport/plugin_transport_http_server.c:2981 |
7829 | #, c-format | 7901 | #, c-format |
7830 | msgid "Using port %u\n" | 7902 | msgid "Using port %u\n" |
7831 | msgstr "Usando puerto %u\n" | 7903 | msgstr "Usando puerto %u\n" |
7832 | 7904 | ||
7833 | #: src/transport/plugin_transport_http_server.c:2995 | 7905 | #: src/transport/plugin_transport_http_server.c:3000 |
7834 | #, c-format | 7906 | #, c-format |
7835 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" | 7907 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" |
7836 | msgstr "" | 7908 | msgstr "" |
7837 | "¡La dirección IPv4 «%s» especificada en el fichero de configuración no es " | 7909 | "¡La dirección IPv4 «%s» especificada en el fichero de configuración no es " |
7838 | "válida!\n" | 7910 | "válida!\n" |
7839 | 7911 | ||
7840 | #: src/transport/plugin_transport_http_server.c:3030 | 7912 | #: src/transport/plugin_transport_http_server.c:3035 |
7841 | #, c-format | 7913 | #, c-format |
7842 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" | 7914 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" |
7843 | msgstr "" | 7915 | msgstr "" |
7844 | "¡La dirección IPv6 «%s» especificada en el fichero de configuración no es " | 7916 | "¡La dirección IPv6 «%s» especificada en el fichero de configuración no es " |
7845 | "válida!\n" | 7917 | "válida!\n" |
7846 | 7918 | ||
7847 | #: src/transport/plugin_transport_http_server.c:3105 | 7919 | #: src/transport/plugin_transport_http_server.c:3110 |
7848 | #, c-format | 7920 | #, c-format |
7849 | msgid "Using external hostname `%s'\n" | 7921 | msgid "Using external hostname `%s'\n" |
7850 | msgstr "Usando nombre de máquina externo «%s»\n" | 7922 | msgstr "Usando nombre de máquina externo «%s»\n" |
7851 | 7923 | ||
7852 | #: src/transport/plugin_transport_http_server.c:3126 | 7924 | #: src/transport/plugin_transport_http_server.c:3131 |
7853 | #, c-format | 7925 | #, c-format |
7854 | msgid "Notifying transport only about hostname `%s'\n" | 7926 | msgid "Notifying transport only about hostname `%s'\n" |
7855 | msgstr "Notificando al transporte sólo el nombre de máquina «%s»\n" | 7927 | msgstr "Notificando al transporte sólo el nombre de máquina «%s»\n" |
7856 | 7928 | ||
7857 | #: src/transport/plugin_transport_http_server.c:3143 | 7929 | #: src/transport/plugin_transport_http_server.c:3148 |
7858 | #, c-format | 7930 | #, c-format |
7859 | msgid "Maximum number of connections is %u\n" | 7931 | msgid "Maximum number of connections is %u\n" |
7860 | msgstr "El número máximo de conexiones es %u\n" | 7932 | msgstr "El número máximo de conexiones es %u\n" |
7861 | 7933 | ||
7862 | #: src/transport/plugin_transport_http_server.c:3469 | 7934 | #: src/transport/plugin_transport_http_server.c:3474 |
7863 | #, fuzzy | 7935 | #, fuzzy |
7864 | msgid "Unable to compile URL regex\n" | 7936 | msgid "Unable to compile URL regex\n" |
7865 | msgstr "¡Imposible obtener «HELLO» del par!\n" | 7937 | msgstr "¡Imposible obtener «HELLO» del par!\n" |
@@ -7909,119 +7981,119 @@ msgstr "# bytes enviados vÃa SMTP" | |||
7909 | msgid "# bytes dropped by SMTP (outgoing)" | 7981 | msgid "# bytes dropped by SMTP (outgoing)" |
7910 | msgstr "# bytes omitidos por SMTP (salientes)" | 7982 | msgstr "# bytes omitidos por SMTP (salientes)" |
7911 | 7983 | ||
7912 | #: src/transport/plugin_transport_tcp.c:1051 | 7984 | #: src/transport/plugin_transport_tcp.c:1060 |
7913 | #: src/transport/plugin_transport_tcp.c:2362 | 7985 | #: src/transport/plugin_transport_tcp.c:2379 |
7914 | #, c-format | 7986 | #, c-format |
7915 | msgid "Unexpected address length: %u bytes\n" | 7987 | msgid "Unexpected address length: %u bytes\n" |
7916 | msgstr "Longitud de dirección inesperada: %u bytes\n" | 7988 | msgstr "Longitud de dirección inesperada: %u bytes\n" |
7917 | 7989 | ||
7918 | #: src/transport/plugin_transport_tcp.c:1234 | 7990 | #: src/transport/plugin_transport_tcp.c:1243 |
7919 | #: src/transport/plugin_transport_tcp.c:1458 | 7991 | #: src/transport/plugin_transport_tcp.c:1467 |
7920 | #: src/transport/plugin_transport_tcp.c:2633 | 7992 | #: src/transport/plugin_transport_tcp.c:2643 |
7921 | #: src/transport/plugin_transport_tcp.c:3490 | 7993 | #: src/transport/plugin_transport_tcp.c:3498 |
7922 | msgid "# TCP sessions active" | 7994 | msgid "# TCP sessions active" |
7923 | msgstr "# Sesiones TCP activas" | 7995 | msgstr "# Sesiones TCP activas" |
7924 | 7996 | ||
7925 | #: src/transport/plugin_transport_tcp.c:1276 | 7997 | #: src/transport/plugin_transport_tcp.c:1285 |
7926 | #: src/transport/plugin_transport_tcp.c:1440 | 7998 | #: src/transport/plugin_transport_tcp.c:1449 |
7927 | #: src/transport/plugin_transport_tcp.c:1564 | 7999 | #: src/transport/plugin_transport_tcp.c:1573 |
7928 | #: src/transport/plugin_transport_tcp.c:1637 | 8000 | #: src/transport/plugin_transport_tcp.c:1646 |
7929 | #: src/transport/plugin_transport_tcp.c:1737 | 8001 | #: src/transport/plugin_transport_tcp.c:1746 |
7930 | #: src/transport/plugin_transport_tcp.c:1762 | 8002 | #: src/transport/plugin_transport_tcp.c:1771 |
7931 | msgid "# bytes currently in TCP buffers" | 8003 | msgid "# bytes currently in TCP buffers" |
7932 | msgstr "# bytes actualmente en los buffer TCP" | 8004 | msgstr "# bytes actualmente en los buffer TCP" |
7933 | 8005 | ||
7934 | #: src/transport/plugin_transport_tcp.c:1279 | 8006 | #: src/transport/plugin_transport_tcp.c:1288 |
7935 | msgid "# bytes discarded by TCP (disconnect)" | 8007 | msgid "# bytes discarded by TCP (disconnect)" |
7936 | msgstr "# bytes descartados por TCP (desconectado)" | 8008 | msgstr "# bytes descartados por TCP (desconectado)" |
7937 | 8009 | ||
7938 | #: src/transport/plugin_transport_tcp.c:1567 | 8010 | #: src/transport/plugin_transport_tcp.c:1576 |
7939 | msgid "# bytes discarded by TCP (timeout)" | 8011 | msgid "# bytes discarded by TCP (timeout)" |
7940 | msgstr "# bytes omitidos por TCP (expirados)" | 8012 | msgstr "# bytes omitidos por TCP (expirados)" |
7941 | 8013 | ||
7942 | #: src/transport/plugin_transport_tcp.c:1641 | 8014 | #: src/transport/plugin_transport_tcp.c:1650 |
7943 | msgid "# bytes transmitted via TCP" | 8015 | msgid "# bytes transmitted via TCP" |
7944 | msgstr "# bytes recibidos vÃa TCP" | 8016 | msgstr "# bytes recibidos vÃa TCP" |
7945 | 8017 | ||
7946 | #: src/transport/plugin_transport_tcp.c:2032 | 8018 | #: src/transport/plugin_transport_tcp.c:2041 |
7947 | msgid "# requests to create session with invalid address" | 8019 | msgid "# requests to create session with invalid address" |
7948 | msgstr "" | 8020 | msgstr "" |
7949 | 8021 | ||
7950 | #: src/transport/plugin_transport_tcp.c:2200 | 8022 | #: src/transport/plugin_transport_tcp.c:2217 |
7951 | msgid "# transport-service disconnect requests for TCP" | 8023 | msgid "# transport-service disconnect requests for TCP" |
7952 | msgstr "# peticiones de desconexión del servicio de transporte por TCP" | 8024 | msgstr "# peticiones de desconexión del servicio de transporte por TCP" |
7953 | 8025 | ||
7954 | #: src/transport/plugin_transport_tcp.c:2692 | 8026 | #: src/transport/plugin_transport_tcp.c:2702 |
7955 | msgid "# TCP WELCOME messages received" | 8027 | msgid "# TCP WELCOME messages received" |
7956 | msgstr "# Mensajes «WELCOME» TCP recibidos" | 8028 | msgstr "# Mensajes «WELCOME» TCP recibidos" |
7957 | 8029 | ||
7958 | #: src/transport/plugin_transport_tcp.c:2883 | 8030 | #: src/transport/plugin_transport_tcp.c:2893 |
7959 | msgid "# bytes received via TCP" | 8031 | msgid "# bytes received via TCP" |
7960 | msgstr "# bytes recibidos vÃa TCP" | 8032 | msgstr "# bytes recibidos vÃa TCP" |
7961 | 8033 | ||
7962 | #: src/transport/plugin_transport_tcp.c:2934 | 8034 | #: src/transport/plugin_transport_tcp.c:2944 |
7963 | #: src/transport/plugin_transport_tcp.c:2992 | 8035 | #: src/transport/plugin_transport_tcp.c:3002 |
7964 | #, fuzzy | 8036 | #, fuzzy |
7965 | msgid "# TCP server connections active" | 8037 | msgid "# TCP server connections active" |
7966 | msgstr "# conexiones «stream» activas" | 8038 | msgstr "# conexiones «stream» activas" |
7967 | 8039 | ||
7968 | #: src/transport/plugin_transport_tcp.c:2938 | 8040 | #: src/transport/plugin_transport_tcp.c:2948 |
7969 | #, fuzzy | 8041 | #, fuzzy |
7970 | msgid "# TCP server connect events" | 8042 | msgid "# TCP server connect events" |
7971 | msgstr "# Pares conectados" | 8043 | msgstr "# Pares conectados" |
7972 | 8044 | ||
7973 | #: src/transport/plugin_transport_tcp.c:2944 | 8045 | #: src/transport/plugin_transport_tcp.c:2954 |
7974 | msgid "TCP connection limit reached, suspending server\n" | 8046 | msgid "TCP connection limit reached, suspending server\n" |
7975 | msgstr "" | 8047 | msgstr "" |
7976 | 8048 | ||
7977 | #: src/transport/plugin_transport_tcp.c:2946 | 8049 | #: src/transport/plugin_transport_tcp.c:2956 |
7978 | msgid "# TCP service suspended" | 8050 | msgid "# TCP service suspended" |
7979 | msgstr "" | 8051 | msgstr "" |
7980 | 8052 | ||
7981 | #: src/transport/plugin_transport_tcp.c:2986 | 8053 | #: src/transport/plugin_transport_tcp.c:2996 |
7982 | msgid "# TCP service resumed" | 8054 | msgid "# TCP service resumed" |
7983 | msgstr "" | 8055 | msgstr "" |
7984 | 8056 | ||
7985 | #: src/transport/plugin_transport_tcp.c:2996 | 8057 | #: src/transport/plugin_transport_tcp.c:3006 |
7986 | msgid "# network-level TCP disconnect events" | 8058 | msgid "# network-level TCP disconnect events" |
7987 | msgstr "# eventos de desconexión TCP a nivel de red" | 8059 | msgstr "# eventos de desconexión TCP a nivel de red" |
7988 | 8060 | ||
7989 | #: src/transport/plugin_transport_tcp.c:3315 | 8061 | #: src/transport/plugin_transport_tcp.c:3325 |
7990 | msgid "Failed to start service.\n" | 8062 | msgid "Failed to start service.\n" |
7991 | msgstr "Se produjo un fallo al iniciar el servicio.\n" | 8063 | msgstr "Se produjo un fallo al iniciar el servicio.\n" |
7992 | 8064 | ||
7993 | #: src/transport/plugin_transport_tcp.c:3478 | 8065 | #: src/transport/plugin_transport_tcp.c:3486 |
7994 | #, c-format | 8066 | #, c-format |
7995 | msgid "TCP transport listening on port %llu\n" | 8067 | msgid "TCP transport listening on port %llu\n" |
7996 | msgstr "Transporte TCP escuchando en el puerto %llu\n" | 8068 | msgstr "Transporte TCP escuchando en el puerto %llu\n" |
7997 | 8069 | ||
7998 | #: src/transport/plugin_transport_tcp.c:3482 | 8070 | #: src/transport/plugin_transport_tcp.c:3490 |
7999 | msgid "TCP transport not listening on any port (client only)\n" | 8071 | msgid "TCP transport not listening on any port (client only)\n" |
8000 | msgstr "Transporte TCP no escuchando en ningún puerto (únicamente cliente)\n" | 8072 | msgstr "Transporte TCP no escuchando en ningún puerto (únicamente cliente)\n" |
8001 | 8073 | ||
8002 | #: src/transport/plugin_transport_tcp.c:3486 | 8074 | #: src/transport/plugin_transport_tcp.c:3494 |
8003 | #, c-format | 8075 | #, c-format |
8004 | msgid "TCP transport advertises itself as being on port %llu\n" | 8076 | msgid "TCP transport advertises itself as being on port %llu\n" |
8005 | msgstr "El transporte TCP anuncia que está en el puerto %llu\n" | 8077 | msgstr "El transporte TCP anuncia que está en el puerto %llu\n" |
8006 | 8078 | ||
8007 | #: src/transport/plugin_transport_udp_broadcasting.c:170 | 8079 | #: src/transport/plugin_transport_udp_broadcasting.c:169 |
8008 | #, fuzzy | 8080 | #, fuzzy |
8009 | msgid "# Multicast HELLO beacons received via UDP" | 8081 | msgid "# Multicast HELLO beacons received via UDP" |
8010 | msgstr "# beacons HELLO multicast IPv6 recibidos vÃa UDP" | 8082 | msgstr "# beacons HELLO multicast IPv6 recibidos vÃa UDP" |
8011 | 8083 | ||
8012 | #: src/transport/plugin_transport_udp_broadcasting.c:546 | 8084 | #: src/transport/plugin_transport_udp_broadcasting.c:545 |
8013 | msgid "" | 8085 | msgid "" |
8014 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" | 8086 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" |
8015 | msgstr "" | 8087 | msgstr "" |
8016 | 8088 | ||
8017 | #: src/transport/plugin_transport_udp_broadcasting.c:567 | 8089 | #: src/transport/plugin_transport_udp_broadcasting.c:566 |
8018 | #, c-format | 8090 | #, c-format |
8019 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" | 8091 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" |
8020 | msgstr "" | 8092 | msgstr "" |
8021 | "Se produjo un fallo al establecer la opción de «broadcast» IPv4 para el " | 8093 | "Se produjo un fallo al establecer la opción de «broadcast» IPv4 para el " |
8022 | "«socket» en el puerto %d\n" | 8094 | "«socket» en el puerto %d\n" |
8023 | 8095 | ||
8024 | #: src/transport/plugin_transport_udp.c:3344 | 8096 | #: src/transport/plugin_transport_udp.c:3367 |
8025 | #, c-format | 8097 | #, c-format |
8026 | msgid "" | 8098 | msgid "" |
8027 | "UDP could not transmit message to `%s': Network seems down, please check " | 8099 | "UDP could not transmit message to `%s': Network seems down, please check " |
@@ -8030,7 +8102,7 @@ msgstr "" | |||
8030 | "UDP no pudo transmitir el mensaje a «%s»: La red parece caÃda, por favor, " | 8102 | "UDP no pudo transmitir el mensaje a «%s»: La red parece caÃda, por favor, " |
8031 | "compruebe su configuración de red\n" | 8103 | "compruebe su configuración de red\n" |
8032 | 8104 | ||
8033 | #: src/transport/plugin_transport_udp.c:3358 | 8105 | #: src/transport/plugin_transport_udp.c:3381 |
8034 | #, fuzzy | 8106 | #, fuzzy |
8035 | msgid "" | 8107 | msgid "" |
8036 | "UDP could not transmit IPv6 message! Please check your network configuration " | 8108 | "UDP could not transmit IPv6 message! Please check your network configuration " |
@@ -8040,37 +8112,37 @@ msgstr "" | |||
8040 | "configuración de red y deshabilite IPv6 si su conexión carece de una " | 8112 | "configuración de red y deshabilite IPv6 si su conexión carece de una " |
8041 | "dirección IPv6 global\n" | 8113 | "dirección IPv6 global\n" |
8042 | 8114 | ||
8043 | #: src/transport/plugin_transport_udp.c:3676 | 8115 | #: src/transport/plugin_transport_udp.c:3699 |
8044 | #: src/transport/plugin_transport_udp.c:3775 | 8116 | #: src/transport/plugin_transport_udp.c:3798 |
8045 | #, fuzzy, c-format | 8117 | #, fuzzy, c-format |
8046 | msgid "Failed to bind UDP socket to %s: %s\n" | 8118 | msgid "Failed to bind UDP socket to %s: %s\n" |
8047 | msgstr "Se produjo un fallo al abrir los «sockets» UDP\n" | 8119 | msgstr "Se produjo un fallo al abrir los «sockets» UDP\n" |
8048 | 8120 | ||
8049 | #: src/transport/plugin_transport_udp.c:3694 | 8121 | #: src/transport/plugin_transport_udp.c:3717 |
8050 | #, fuzzy | 8122 | #, fuzzy |
8051 | msgid "Disabling IPv4 since it is not supported on this system!\n" | 8123 | msgid "Disabling IPv4 since it is not supported on this system!\n" |
8052 | msgstr "¡Deshabilitando IPv6 ya que no está soportado en este sistema!\n" | 8124 | msgstr "¡Deshabilitando IPv6 ya que no está soportado en este sistema!\n" |
8053 | 8125 | ||
8054 | #: src/transport/plugin_transport_udp.c:3785 | 8126 | #: src/transport/plugin_transport_udp.c:3808 |
8055 | msgid "Failed to open UDP sockets\n" | 8127 | msgid "Failed to open UDP sockets\n" |
8056 | msgstr "Se produjo un fallo al abrir los «sockets» UDP\n" | 8128 | msgstr "Se produjo un fallo al abrir los «sockets» UDP\n" |
8057 | 8129 | ||
8058 | #: src/transport/plugin_transport_udp.c:3857 | 8130 | #: src/transport/plugin_transport_udp.c:3879 |
8059 | #: src/transport/plugin_transport_udp.c:3871 | 8131 | #: src/transport/plugin_transport_udp.c:3893 |
8060 | msgid "must be in [0,65535]" | 8132 | msgid "must be in [0,65535]" |
8061 | msgstr "" | 8133 | msgstr "" |
8062 | 8134 | ||
8063 | #: src/transport/plugin_transport_udp.c:3903 | 8135 | #: src/transport/plugin_transport_udp.c:3925 |
8064 | #, fuzzy | 8136 | #, fuzzy |
8065 | msgid "must be valid IPv4 address" | 8137 | msgid "must be valid IPv4 address" |
8066 | msgstr "«%s» no es una dirección IP válida.\n" | 8138 | msgstr "«%s» no es una dirección IP válida.\n" |
8067 | 8139 | ||
8068 | #: src/transport/plugin_transport_udp.c:3930 | 8140 | #: src/transport/plugin_transport_udp.c:3952 |
8069 | #, fuzzy | 8141 | #, fuzzy |
8070 | msgid "must be valid IPv6 address" | 8142 | msgid "must be valid IPv6 address" |
8071 | msgstr "«%s» no es una dirección IP válida.\n" | 8143 | msgstr "«%s» no es una dirección IP válida.\n" |
8072 | 8144 | ||
8073 | #: src/transport/plugin_transport_udp.c:3996 | 8145 | #: src/transport/plugin_transport_udp.c:4018 |
8074 | #, fuzzy | 8146 | #, fuzzy |
8075 | msgid "Failed to create UDP network sockets\n" | 8147 | msgid "Failed to create UDP network sockets\n" |
8076 | msgstr "Se produjo un fallo al crear una nueva firma" | 8148 | msgstr "Se produjo un fallo al crear una nueva firma" |
@@ -8194,7 +8266,7 @@ msgstr "Los metadatos serializados «%s» son mayores de lo permitido (%u>%u)" | |||
8194 | msgid "Metadata `%s' failed to deserialize" | 8266 | msgid "Metadata `%s' failed to deserialize" |
8195 | msgstr "Se produjo un fallo al deserializar los metadatos «%s»" | 8267 | msgstr "Se produjo un fallo al deserializar los metadatos «%s»" |
8196 | 8268 | ||
8197 | #: src/util/client_new.c:864 | 8269 | #: src/util/client.c:864 |
8198 | #, c-format | 8270 | #, c-format |
8199 | msgid "Need a non-empty hostname for service `%s'.\n" | 8271 | msgid "Need a non-empty hostname for service `%s'.\n" |
8200 | msgstr "Se necesita un nombre de máquina no vacÃo para el servicio «%s».\n" | 8272 | msgstr "Se necesita un nombre de máquina no vacÃo para el servicio «%s».\n" |
@@ -9001,42 +9073,42 @@ msgstr "" | |||
9001 | msgid "Invalid IPv6 address `%s': %s\n" | 9073 | msgid "Invalid IPv6 address `%s': %s\n" |
9002 | msgstr "Dirección IPv6 «%s» no válida: %s\n" | 9074 | msgstr "Dirección IPv6 «%s» no válida: %s\n" |
9003 | 9075 | ||
9004 | #: src/util/strings.c:1475 src/util/strings.c:1491 | 9076 | #: src/util/strings.c:1541 src/util/strings.c:1557 |
9005 | msgid "Port not in range\n" | 9077 | msgid "Port not in range\n" |
9006 | msgstr "" | 9078 | msgstr "" |
9007 | 9079 | ||
9008 | #: src/util/strings.c:1500 | 9080 | #: src/util/strings.c:1566 |
9009 | #, fuzzy, c-format | 9081 | #, fuzzy, c-format |
9010 | msgid "Malformed port policy `%s'\n" | 9082 | msgid "Malformed port policy `%s'\n" |
9011 | msgstr "Se produjo un fallo al iniciar el servicio «%s»\n" | 9083 | msgstr "Se produjo un fallo al iniciar el servicio «%s»\n" |
9012 | 9084 | ||
9013 | #: src/util/strings.c:1583 src/util/strings.c:1614 src/util/strings.c:1662 | 9085 | #: src/util/strings.c:1649 src/util/strings.c:1680 src/util/strings.c:1728 |
9014 | #: src/util/strings.c:1683 | 9086 | #: src/util/strings.c:1749 |
9015 | #, c-format | 9087 | #, c-format |
9016 | msgid "Invalid format for IP: `%s'\n" | 9088 | msgid "Invalid format for IP: `%s'\n" |
9017 | msgstr "Formato no válido para la IP: «%s»\n" | 9089 | msgstr "Formato no válido para la IP: «%s»\n" |
9018 | 9090 | ||
9019 | #: src/util/strings.c:1640 | 9091 | #: src/util/strings.c:1706 |
9020 | #, c-format | 9092 | #, c-format |
9021 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." | 9093 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." |
9022 | msgstr "Notación de red no válida («/%d» no es válido en IPv4 CIDR)." | 9094 | msgstr "Notación de red no válida («/%d» no es válido en IPv4 CIDR)." |
9023 | 9095 | ||
9024 | #: src/util/strings.c:1692 | 9096 | #: src/util/strings.c:1758 |
9025 | #, fuzzy, c-format | 9097 | #, fuzzy, c-format |
9026 | msgid "Invalid format: `%s'\n" | 9098 | msgid "Invalid format: `%s'\n" |
9027 | msgstr "Formato de tiempo no válido «%s»\n" | 9099 | msgstr "Formato de tiempo no válido «%s»\n" |
9028 | 9100 | ||
9029 | #: src/util/strings.c:1744 | 9101 | #: src/util/strings.c:1810 |
9030 | #, c-format | 9102 | #, c-format |
9031 | msgid "Invalid network notation (does not end with ';': `%s')\n" | 9103 | msgid "Invalid network notation (does not end with ';': `%s')\n" |
9032 | msgstr "Notación de red no válida (no termina con «;»: «%s»)\n" | 9104 | msgstr "Notación de red no válida (no termina con «;»: «%s»)\n" |
9033 | 9105 | ||
9034 | #: src/util/strings.c:1794 | 9106 | #: src/util/strings.c:1860 |
9035 | #, c-format | 9107 | #, c-format |
9036 | msgid "Wrong format `%s' for netmask\n" | 9108 | msgid "Wrong format `%s' for netmask\n" |
9037 | msgstr "Formato «%s» erroneo para máscara de red\n" | 9109 | msgstr "Formato «%s» erroneo para máscara de red\n" |
9038 | 9110 | ||
9039 | #: src/util/strings.c:1825 | 9111 | #: src/util/strings.c:1891 |
9040 | #, c-format | 9112 | #, c-format |
9041 | msgid "Wrong format `%s' for network\n" | 9113 | msgid "Wrong format `%s' for network\n" |
9042 | msgstr "Formato «%s» erroneo para red\n" | 9114 | msgstr "Formato «%s» erroneo para red\n" |
@@ -9223,22 +9295,66 @@ msgid "Setup tunnels via VPN." | |||
9223 | msgstr "Configurar túneles vÃa VPN." | 9295 | msgstr "Configurar túneles vÃa VPN." |
9224 | 9296 | ||
9225 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 | 9297 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 |
9226 | #: src/include/gnunet_common.h:660 | 9298 | #: src/include/gnunet_common.h:662 src/include/gnunet_common.h:670 |
9227 | #, c-format | 9299 | #, c-format |
9228 | msgid "Assertion failed at %s:%d.\n" | 9300 | msgid "Assertion failed at %s:%d.\n" |
9229 | msgstr "Aserción fallida en %s:%d.\n" | 9301 | msgstr "Aserción fallida en %s:%d.\n" |
9230 | 9302 | ||
9231 | #: src/include/gnunet_common.h:672 | 9303 | #: src/include/gnunet_common.h:682 |
9232 | #, c-format | 9304 | #, c-format |
9233 | msgid "External protocol violation detected at %s:%d.\n" | 9305 | msgid "External protocol violation detected at %s:%d.\n" |
9234 | msgstr "Violación externa del protocolo detectada en %s:%d.\n" | 9306 | msgstr "Violación externa del protocolo detectada en %s:%d.\n" |
9235 | 9307 | ||
9236 | #: src/include/gnunet_common.h:699 src/include/gnunet_common.h:708 | 9308 | #: src/include/gnunet_common.h:709 src/include/gnunet_common.h:718 |
9237 | #, c-format | 9309 | #, c-format |
9238 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" | 9310 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" |
9239 | msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | 9311 | msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" |
9240 | 9312 | ||
9241 | #, fuzzy | 9313 | #, fuzzy |
9314 | #~ msgid "Failed to run upnp client for port %u\n" | ||
9315 | #~ msgstr "" | ||
9316 | #~ "Se produjo un fallo al inicializar la clave de la máquina desde el par " | ||
9317 | #~ "%u\n" | ||
9318 | |||
9319 | #~ msgid "malformed" | ||
9320 | #~ msgstr "mal formado" | ||
9321 | |||
9322 | #~ msgid "" | ||
9323 | #~ "Configuration requires `%s', but binary is not installed properly (SUID " | ||
9324 | #~ "bit not set). Option disabled.\n" | ||
9325 | #~ msgstr "" | ||
9326 | #~ "La configuración requiere «%s», pero el binario no está instalado de " | ||
9327 | #~ "forma correcta (SUID bit no activado). Opción deshabilitada.\n" | ||
9328 | |||
9329 | #~ msgid "" | ||
9330 | #~ "Internal IP address not known, cannot use ICMP NAT traversal method\n" | ||
9331 | #~ msgstr "" | ||
9332 | #~ "Direcciones internas IP no conocidas, no se puede usar el método del " | ||
9333 | #~ "recorrido NAT ICMP\n" | ||
9334 | |||
9335 | #~ msgid "Running gnunet-helper-nat-client %s %s %u\n" | ||
9336 | #~ msgstr "Ejecutando gnunet-helper-nat-client %s %s %u\n" | ||
9337 | |||
9338 | #, fuzzy | ||
9339 | #~ msgid "NAT plugin `%s' reports: %s\n" | ||
9340 | #~ msgstr "Módulo de transporte: «%s» puerto %llu\n" | ||
9341 | |||
9342 | #~ msgid "No transport plugins configured, peer will never communicate\n" | ||
9343 | #~ msgstr "" | ||
9344 | #~ "No hay módulos de transporte configurados, el par nunca se comunicará\n" | ||
9345 | |||
9346 | #~ msgid "No port configured for plugin `%s', cannot test it\n" | ||
9347 | #~ msgstr "" | ||
9348 | #~ "Ningún puerto fue configurado para el módulo «%s», no se puede probar\n" | ||
9349 | |||
9350 | #, fuzzy | ||
9351 | #~ msgid "Failed to start resolver!\n" | ||
9352 | #~ msgstr "Se produjo un fallo al arrancar %s\n" | ||
9353 | |||
9354 | #~ msgid "test transport configuration (involves external server)" | ||
9355 | #~ msgstr "probar configuración de transporte (requiere un servidor externo)" | ||
9356 | |||
9357 | #, fuzzy | ||
9242 | #~ msgid "Unable to initialize Postgres: %s\n" | 9358 | #~ msgid "Unable to initialize Postgres: %s\n" |
9243 | #~ msgstr "No se pudo inicializar Postgres: %s" | 9359 | #~ msgstr "No se pudo inicializar Postgres: %s" |
9244 | 9360 | ||
@@ -11276,9 +11392,6 @@ msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | |||
11276 | #~ "Par todavÃa no ejecutandose, no se puede cambiar la configuración en este " | 11392 | #~ "Par todavÃa no ejecutandose, no se puede cambiar la configuración en este " |
11277 | #~ "punto." | 11393 | #~ "punto." |
11278 | 11394 | ||
11279 | #~ msgid "Failed to write new configuration to disk." | ||
11280 | #~ msgstr "Se produjo un fallo al guardar la nueva configuración al disco" | ||
11281 | |||
11282 | #~ msgid "Could not start `%s' process to copy configuration file.\n" | 11395 | #~ msgid "Could not start `%s' process to copy configuration file.\n" |
11283 | #~ msgstr "" | 11396 | #~ msgstr "" |
11284 | #~ "No se pudo iniciar el proceso «%s» para copiar el fichero de " | 11397 | #~ "No se pudo iniciar el proceso «%s» para copiar el fichero de " |
@@ -11528,9 +11641,6 @@ msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | |||
11528 | #~ msgid "# failed connection attempts due to timeout" | 11641 | #~ msgid "# failed connection attempts due to timeout" |
11529 | #~ msgstr "# conexiones fallidas debido a expiración de plazo" | 11642 | #~ msgstr "# conexiones fallidas debido a expiración de plazo" |
11530 | 11643 | ||
11531 | #~ msgid "# peers disconnected due to external request" | ||
11532 | #~ msgstr "# pares desconectados debido a petición externa" | ||
11533 | |||
11534 | #~ msgid "# peers disconnected due to timeout" | 11644 | #~ msgid "# peers disconnected due to timeout" |
11535 | #~ msgstr "# pares desconectados debido a expiración de plazo" | 11645 | #~ msgstr "# pares desconectados debido a expiración de plazo" |
11536 | 11646 | ||
@@ -11549,9 +11659,6 @@ msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | |||
11549 | #~ msgid "Found valid IPv4 NAT address (creating session)!\n" | 11659 | #~ msgid "Found valid IPv4 NAT address (creating session)!\n" |
11550 | #~ msgstr "¡Encontrada una dirección NAT IPv4 válida (creando sesión)!\n" | 11660 | #~ msgstr "¡Encontrada una dirección NAT IPv4 válida (creando sesión)!\n" |
11551 | 11661 | ||
11552 | #~ msgid "Failed to find option %s in section %s!\n" | ||
11553 | #~ msgstr "¡Se produjo un fallo al buscar la opción %s en la sección %s!\n" | ||
11554 | |||
11555 | #~ msgid "# wlan session timeouts" | 11662 | #~ msgid "# wlan session timeouts" |
11556 | #~ msgstr "# expiraciones de plazo en sesiones wlan" | 11663 | #~ msgstr "# expiraciones de plazo en sesiones wlan" |
11557 | 11664 | ||
@@ -11837,10 +11944,6 @@ msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | |||
11837 | #~ msgstr "# bytes recibidos por TCP" | 11944 | #~ msgstr "# bytes recibidos por TCP" |
11838 | 11945 | ||
11839 | #, fuzzy | 11946 | #, fuzzy |
11840 | #~ msgid "Misconfigured address to bind to in configuration!\n" | ||
11841 | #~ msgstr "¡Ninguna aplicación definida en la configuración!\n" | ||
11842 | |||
11843 | #, fuzzy | ||
11844 | #~ msgid "Failed to load transport plugin for http\n" | 11947 | #~ msgid "Failed to load transport plugin for http\n" |
11845 | #~ msgstr "Imposible inicializar la aplicación '%s'\n" | 11948 | #~ msgstr "Imposible inicializar la aplicación '%s'\n" |
11846 | 11949 | ||
@@ -12042,10 +12145,6 @@ msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | |||
12042 | #~ "máxima velocidad de tu conexión a Internet." | 12145 | #~ "máxima velocidad de tu conexión a Internet." |
12043 | 12146 | ||
12044 | #, fuzzy | 12147 | #, fuzzy |
12045 | #~ msgid "Quota configuration" | ||
12046 | #~ msgstr "Configuración de GNUnet" | ||
12047 | |||
12048 | #, fuzzy | ||
12049 | #~ msgid "" | 12148 | #~ msgid "" |
12050 | #~ "The GNUnet datastore contains all content that GNUnet needs to store " | 12149 | #~ "The GNUnet datastore contains all content that GNUnet needs to store " |
12051 | #~ "(indexed, inserted and migrated content)." | 12150 | #~ "(indexed, inserted and migrated content)." |
@@ -12867,10 +12966,6 @@ msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | |||
12867 | #~ "El contenido descifrado no encuentra una clave. Esto puede ser un bug o " | 12966 | #~ "El contenido descifrado no encuentra una clave. Esto puede ser un bug o " |
12868 | #~ "un fichero introducido maliciosamente. Descarga abortada.\n" | 12967 | #~ "un fichero introducido maliciosamente. Descarga abortada.\n" |
12869 | 12968 | ||
12870 | #, fuzzy | ||
12871 | #~ msgid "Application aborted." | ||
12872 | #~ msgstr "_Opciones" | ||
12873 | |||
12874 | #~ msgid "FSUI state file `%s' had syntax error at offset %u.\n" | 12969 | #~ msgid "FSUI state file `%s' had syntax error at offset %u.\n" |
12875 | #~ msgstr "" | 12970 | #~ msgstr "" |
12876 | #~ "Fichero del estado de FSUI '%s' tiene un error de sintáxis en la " | 12971 | #~ "Fichero del estado de FSUI '%s' tiene un error de sintáxis en la " |
@@ -13527,10 +13622,6 @@ msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | |||
13527 | #~ msgstr "Grupo:" | 13622 | #~ msgstr "Grupo:" |
13528 | 13623 | ||
13529 | #, fuzzy | 13624 | #, fuzzy |
13530 | #~ msgid "Save configuration" | ||
13531 | #~ msgstr "Configuración de GNUnet" | ||
13532 | |||
13533 | #, fuzzy | ||
13534 | #~ msgid "Show copyright information for gnunet-setup." | 13625 | #~ msgid "Show copyright information for gnunet-setup." |
13535 | #~ msgstr "Se produjo un error leyendo información de gnunetd.\n" | 13626 | #~ msgstr "Se produjo un error leyendo información de gnunetd.\n" |
13536 | 13627 | ||
@@ -14183,11 +14274,6 @@ msgstr "«%s» falló en el fichero «%s» en %s:%d con el error: %s\n" | |||
14183 | #~ msgid "Template for gnunet-clients." | 14274 | #~ msgid "Template for gnunet-clients." |
14184 | #~ msgstr "Plantilla para clientes-de-gnunet." | 14275 | #~ msgstr "Plantilla para clientes-de-gnunet." |
14185 | 14276 | ||
14186 | #~ msgid "Invalid port \"%s\" in hostlist specification, trying port %d.\n" | ||
14187 | #~ msgstr "" | ||
14188 | #~ "Puerto inválido \"%s\" en la especificación de la lista local, probando " | ||
14189 | #~ "el puerto %d.\n" | ||
14190 | |||
14191 | #~ msgid "Parsing HTTP response for URL `%s' failed.\n" | 14277 | #~ msgid "Parsing HTTP response for URL `%s' failed.\n" |
14192 | #~ msgstr "Analizando HTTP de la URL '%s' se produjo un fallo.\n" | 14278 | #~ msgstr "Analizando HTTP de la URL '%s' se produjo un fallo.\n" |
14193 | 14279 | ||
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
8 | "Project-Id-Version: gnunet 0.10.1\n" | 8 | "Project-Id-Version: gnunet 0.10.1\n" |
9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
10 | "POT-Creation-Date: 2016-11-27 09:18+0100\n" | 10 | "POT-Creation-Date: 2017-01-12 17:19+0100\n" |
11 | "PO-Revision-Date: 2015-12-24 01:20+0100\n" | 11 | "PO-Revision-Date: 2015-12-24 01:20+0100\n" |
12 | "Last-Translator: Stéphane Aulery <lkppo@free.fr>\n" | 12 | "Last-Translator: Stéphane Aulery <lkppo@free.fr>\n" |
13 | "Language-Team: French <traduc@traduc.org>\n" | 13 | "Language-Team: French <traduc@traduc.org>\n" |
@@ -244,21 +244,20 @@ msgstr "" | |||
244 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 | 244 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 |
245 | #: src/transport/plugin_transport_tcp.c:652 | 245 | #: src/transport/plugin_transport_tcp.c:652 |
246 | #: src/transport/plugin_transport_tcp.c:658 | 246 | #: src/transport/plugin_transport_tcp.c:658 |
247 | #: src/transport/plugin_transport_tcp.c:3299 src/util/service.c:584 | 247 | #: src/transport/plugin_transport_tcp.c:3309 src/util/service.c:584 |
248 | #: src/util/service.c:590 src/util/service_new.c:637 | 248 | #: src/util/service.c:590 src/util/service_new.c:637 src/util/service_new.c:643 |
249 | #: src/util/service_new.c:643 | ||
250 | #, c-format | 249 | #, c-format |
251 | msgid "Require valid port number for service `%s' in configuration!\n" | 250 | msgid "Require valid port number for service `%s' in configuration!\n" |
252 | msgstr "" | 251 | msgstr "" |
253 | 252 | ||
254 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 | 253 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 |
255 | #: src/util/client_new.c:464 src/util/service.c:621 src/util/service_new.c:682 | 254 | #: src/util/client.c:464 src/util/service.c:621 src/util/service_new.c:682 |
256 | #, c-format | 255 | #, c-format |
257 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 256 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
258 | msgstr "" | 257 | msgstr "" |
259 | 258 | ||
260 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 | 259 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 |
261 | #: src/util/client_new.c:469 src/util/service.c:625 src/util/service_new.c:687 | 260 | #: src/util/client.c:469 src/util/service.c:625 src/util/service_new.c:687 |
262 | #, c-format | 261 | #, c-format |
263 | msgid "Using `%s' instead\n" | 262 | msgid "Using `%s' instead\n" |
264 | msgstr "" | 263 | msgstr "" |
@@ -278,7 +277,7 @@ msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | |||
278 | msgstr "" | 277 | msgstr "" |
279 | 278 | ||
280 | #: src/arm/gnunet-service-arm.c:513 | 279 | #: src/arm/gnunet-service-arm.c:513 |
281 | #: src/transport/plugin_transport_http_server.c:2617 | 280 | #: src/transport/plugin_transport_http_server.c:2620 |
282 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 | 281 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 |
283 | #: src/util/service_new.c:782 | 282 | #: src/util/service_new.c:782 |
284 | #, c-format | 283 | #, c-format |
@@ -286,7 +285,7 @@ msgid "Failed to resolve `%s': %s\n" | |||
286 | msgstr "Résolution de « %s » échouée : %s\n" | 285 | msgstr "Résolution de « %s » échouée : %s\n" |
287 | 286 | ||
288 | #: src/arm/gnunet-service-arm.c:532 | 287 | #: src/arm/gnunet-service-arm.c:532 |
289 | #: src/transport/plugin_transport_http_server.c:2635 | 288 | #: src/transport/plugin_transport_http_server.c:2638 |
290 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 | 289 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 |
291 | #: src/util/service_new.c:802 | 290 | #: src/util/service_new.c:802 |
292 | #, c-format | 291 | #, c-format |
@@ -380,13 +379,11 @@ msgid "" | |||
380 | "%llu\n" | 379 | "%llu\n" |
381 | msgstr "" | 380 | msgstr "" |
382 | 381 | ||
383 | #: src/ats/gnunet-ats-solver-eval.c:3293 | 382 | #: src/ats/gnunet-ats-solver-eval.c:3293 src/ats-tests/gnunet-solver-eval.c:935 |
384 | #: src/ats-tests/gnunet-solver-eval.c:935 | ||
385 | msgid "solver to use" | 383 | msgid "solver to use" |
386 | msgstr "solveur utilisé" | 384 | msgstr "solveur utilisé" |
387 | 385 | ||
388 | #: src/ats/gnunet-ats-solver-eval.c:3296 | 386 | #: src/ats/gnunet-ats-solver-eval.c:3296 src/ats-tests/gnunet-solver-eval.c:938 |
389 | #: src/ats-tests/gnunet-solver-eval.c:938 | ||
390 | #: src/ats-tests/gnunet-solver-eval.c:941 | 387 | #: src/ats-tests/gnunet-solver-eval.c:941 |
391 | msgid "experiment to use" | 388 | msgid "experiment to use" |
392 | msgstr "" | 389 | msgstr "" |
@@ -491,12 +488,12 @@ msgstr "" | |||
491 | msgid "Invalid %s configuration %f\n" | 488 | msgid "Invalid %s configuration %f\n" |
492 | msgstr "fornat invalide : « %s »\n" | 489 | msgstr "fornat invalide : « %s »\n" |
493 | 490 | ||
494 | #: src/ats-tests/ats-testing.c:441 | 491 | #: src/ats-tests/ats-testing.c:422 |
495 | #, c-format | 492 | #, c-format |
496 | msgid "Connected master [%u] with slave [%u]\n" | 493 | msgid "Connected master [%u] with slave [%u]\n" |
497 | msgstr "" | 494 | msgstr "" |
498 | 495 | ||
499 | #: src/ats-tests/ats-testing.c:448 | 496 | #: src/ats-tests/ats-testing.c:429 |
500 | #, c-format | 497 | #, c-format |
501 | msgid "Failed to connect master peer [%u] with slave [%u]\n" | 498 | msgid "Failed to connect master peer [%u] with slave [%u]\n" |
502 | msgstr "" | 499 | msgstr "" |
@@ -553,7 +550,7 @@ msgid "Quota for network `%11s' (in/out): %10s / %10s\n" | |||
553 | msgstr "" | 550 | msgstr "" |
554 | 551 | ||
555 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 | 552 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 |
556 | #: src/transport/gnunet-transport.c:1476 | 553 | #: src/transport/gnunet-transport.c:1255 |
557 | #, c-format | 554 | #, c-format |
558 | msgid "Failed to parse peer identity `%s'\n" | 555 | msgid "Failed to parse peer identity `%s'\n" |
559 | msgstr "" | 556 | msgstr "" |
@@ -633,6 +630,37 @@ msgstr "" | |||
633 | msgid "Print information about ATS state" | 630 | msgid "Print information about ATS state" |
634 | msgstr "" | 631 | msgstr "" |
635 | 632 | ||
633 | #: src/auction/gnunet-auction-create.c:69 | ||
634 | msgid "description of the item to be sold" | ||
635 | msgstr "" | ||
636 | |||
637 | #: src/auction/gnunet-auction-create.c:72 | ||
638 | msgid "mapping of possible prices" | ||
639 | msgstr "" | ||
640 | |||
641 | #: src/auction/gnunet-auction-create.c:75 | ||
642 | msgid "max duration per round" | ||
643 | msgstr "" | ||
644 | |||
645 | #: src/auction/gnunet-auction-create.c:78 | ||
646 | msgid "duration until auction starts" | ||
647 | msgstr "" | ||
648 | |||
649 | #: src/auction/gnunet-auction-create.c:81 | ||
650 | msgid "number of items to sell, 0 for first price auction" | ||
651 | msgstr "" | ||
652 | |||
653 | #: src/auction/gnunet-auction-create.c:84 | ||
654 | msgid "public auction outcome" | ||
655 | msgstr "" | ||
656 | |||
657 | #: src/auction/gnunet-auction-create.c:94 src/auction/gnunet-auction-info.c:76 | ||
658 | #: src/auction/gnunet-auction-join.c:76 | ||
659 | #: src/conversation/gnunet-conversation-test.c:243 | ||
660 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
661 | msgid "help text" | ||
662 | msgstr "" | ||
663 | |||
636 | #: src/cadet/gnunet-cadet.c:511 | 664 | #: src/cadet/gnunet-cadet.c:511 |
637 | #, c-format | 665 | #, c-format |
638 | msgid "Invalid target `%s'\n" | 666 | msgid "Invalid target `%s'\n" |
@@ -684,7 +712,7 @@ msgstr "" | |||
684 | msgid "provide information about all tunnels" | 712 | msgid "provide information about all tunnels" |
685 | msgstr "" | 713 | msgstr "" |
686 | 714 | ||
687 | #: src/cadet/gnunet-service-cadet_peer.c:681 | 715 | #: src/cadet/gnunet-service-cadet_peer.c:686 |
688 | msgid "Wrong CORE service\n" | 716 | msgid "Wrong CORE service\n" |
689 | msgstr "" | 717 | msgstr "" |
690 | 718 | ||
@@ -1002,11 +1030,6 @@ msgid "" | |||
1002 | "played back to you..." | 1030 | "played back to you..." |
1003 | msgstr "" | 1031 | msgstr "" |
1004 | 1032 | ||
1005 | #: src/conversation/gnunet-conversation-test.c:243 | ||
1006 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
1007 | msgid "help text" | ||
1008 | msgstr "" | ||
1009 | |||
1010 | #: src/conversation/gnunet_gst.c:630 | 1033 | #: src/conversation/gnunet_gst.c:630 |
1011 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 | 1034 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 |
1012 | #, c-format | 1035 | #, c-format |
@@ -1199,7 +1222,7 @@ msgstr "" | |||
1199 | msgid "Failed to connect to CORE service!\n" | 1222 | msgid "Failed to connect to CORE service!\n" |
1200 | msgstr "" | 1223 | msgstr "" |
1201 | 1224 | ||
1202 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1677 | 1225 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1456 |
1203 | msgid "provide information about all current connections (continuously)" | 1226 | msgid "provide information about all current connections (continuously)" |
1204 | msgstr "" | 1227 | msgstr "" |
1205 | 1228 | ||
@@ -1446,7 +1469,7 @@ msgstr "" | |||
1446 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 | 1469 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 |
1447 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 | 1470 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 |
1448 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 | 1471 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 |
1449 | #: src/include/gnunet_common.h:681 src/include/gnunet_common.h:690 | 1472 | #: src/include/gnunet_common.h:691 src/include/gnunet_common.h:700 |
1450 | #: src/scalarproduct/scalarproduct.h:35 | 1473 | #: src/scalarproduct/scalarproduct.h:35 |
1451 | #, c-format | 1474 | #, c-format |
1452 | msgid "`%s' failed at %s:%d with error: %s\n" | 1475 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -1833,8 +1856,7 @@ msgstr "" | |||
1833 | msgid "Prints all packets that go through the DHT." | 1856 | msgid "Prints all packets that go through the DHT." |
1834 | msgstr "" | 1857 | msgstr "" |
1835 | 1858 | ||
1836 | #: src/dht/gnunet_dht_profiler.c:1161 | 1859 | #: src/dht/gnunet_dht_profiler.c:1161 src/testbed/gnunet-testbed-profiler.c:255 |
1837 | #: src/testbed/gnunet-testbed-profiler.c:255 | ||
1838 | #, c-format | 1860 | #, c-format |
1839 | msgid "Exiting as the number of peers is %u\n" | 1861 | msgid "Exiting as the number of peers is %u\n" |
1840 | msgstr "" | 1862 | msgstr "" |
@@ -2010,8 +2032,7 @@ msgstr "" | |||
2010 | msgid "# GET requests given to datacache" | 2032 | msgid "# GET requests given to datacache" |
2011 | msgstr "" | 2033 | msgstr "" |
2012 | 2034 | ||
2013 | #: src/dht/gnunet-service-dht_hello.c:84 | 2035 | #: src/dht/gnunet-service-dht_hello.c:84 src/dht/gnunet-service-xdht_hello.c:82 |
2014 | #: src/dht/gnunet-service-xdht_hello.c:82 | ||
2015 | msgid "# HELLOs obtained from peerinfo" | 2036 | msgid "# HELLOs obtained from peerinfo" |
2016 | msgstr "" | 2037 | msgstr "" |
2017 | 2038 | ||
@@ -2076,35 +2097,35 @@ msgstr "" | |||
2076 | msgid "# P2P PUT bytes received" | 2097 | msgid "# P2P PUT bytes received" |
2077 | msgstr "" | 2098 | msgstr "" |
2078 | 2099 | ||
2079 | #: src/dht/gnunet-service-dht_neighbours.c:1854 | 2100 | #: src/dht/gnunet-service-dht_neighbours.c:1858 |
2080 | msgid "# FIND PEER requests ignored due to Bloomfilter" | 2101 | msgid "# FIND PEER requests ignored due to Bloomfilter" |
2081 | msgstr "" | 2102 | msgstr "" |
2082 | 2103 | ||
2083 | #: src/dht/gnunet-service-dht_neighbours.c:1862 | 2104 | #: src/dht/gnunet-service-dht_neighbours.c:1866 |
2084 | msgid "# FIND PEER requests ignored due to lack of HELLO" | 2105 | msgid "# FIND PEER requests ignored due to lack of HELLO" |
2085 | msgstr "" | 2106 | msgstr "" |
2086 | 2107 | ||
2087 | #: src/dht/gnunet-service-dht_neighbours.c:2018 | 2108 | #: src/dht/gnunet-service-dht_neighbours.c:2022 |
2088 | msgid "# P2P GET requests received" | 2109 | msgid "# P2P GET requests received" |
2089 | msgstr "" | 2110 | msgstr "" |
2090 | 2111 | ||
2091 | #: src/dht/gnunet-service-dht_neighbours.c:2022 | 2112 | #: src/dht/gnunet-service-dht_neighbours.c:2026 |
2092 | msgid "# P2P GET bytes received" | 2113 | msgid "# P2P GET bytes received" |
2093 | msgstr "" | 2114 | msgstr "" |
2094 | 2115 | ||
2095 | #: src/dht/gnunet-service-dht_neighbours.c:2097 | 2116 | #: src/dht/gnunet-service-dht_neighbours.c:2101 |
2096 | msgid "# P2P FIND PEER requests processed" | 2117 | msgid "# P2P FIND PEER requests processed" |
2097 | msgstr "" | 2118 | msgstr "" |
2098 | 2119 | ||
2099 | #: src/dht/gnunet-service-dht_neighbours.c:2120 | 2120 | #: src/dht/gnunet-service-dht_neighbours.c:2124 |
2100 | msgid "# P2P GET requests ONLY routed" | 2121 | msgid "# P2P GET requests ONLY routed" |
2101 | msgstr "" | 2122 | msgstr "" |
2102 | 2123 | ||
2103 | #: src/dht/gnunet-service-dht_neighbours.c:2222 | 2124 | #: src/dht/gnunet-service-dht_neighbours.c:2226 |
2104 | msgid "# P2P RESULTS received" | 2125 | msgid "# P2P RESULTS received" |
2105 | msgstr "" | 2126 | msgstr "" |
2106 | 2127 | ||
2107 | #: src/dht/gnunet-service-dht_neighbours.c:2226 | 2128 | #: src/dht/gnunet-service-dht_neighbours.c:2230 |
2108 | msgid "# P2P RESULT bytes received" | 2129 | msgid "# P2P RESULT bytes received" |
2109 | msgstr "" | 2130 | msgstr "" |
2110 | 2131 | ||
@@ -2112,35 +2133,35 @@ msgstr "" | |||
2112 | msgid "# Network size estimates received" | 2133 | msgid "# Network size estimates received" |
2113 | msgstr "" | 2134 | msgstr "" |
2114 | 2135 | ||
2115 | #: src/dht/gnunet-service-dht_routing.c:218 | 2136 | #: src/dht/gnunet-service-dht_routing.c:220 |
2116 | msgid "# Good REPLIES matched against routing table" | 2137 | msgid "# Good REPLIES matched against routing table" |
2117 | msgstr "" | 2138 | msgstr "" |
2118 | 2139 | ||
2119 | #: src/dht/gnunet-service-dht_routing.c:227 | 2140 | #: src/dht/gnunet-service-dht_routing.c:229 |
2120 | msgid "# Duplicate REPLIES matched against routing table" | 2141 | msgid "# Duplicate REPLIES matched against routing table" |
2121 | msgstr "" | 2142 | msgstr "" |
2122 | 2143 | ||
2123 | #: src/dht/gnunet-service-dht_routing.c:233 | 2144 | #: src/dht/gnunet-service-dht_routing.c:235 |
2124 | msgid "# Invalid REPLIES matched against routing table" | 2145 | msgid "# Invalid REPLIES matched against routing table" |
2125 | msgstr "" | 2146 | msgstr "" |
2126 | 2147 | ||
2127 | #: src/dht/gnunet-service-dht_routing.c:239 | 2148 | #: src/dht/gnunet-service-dht_routing.c:241 |
2128 | msgid "# Irrelevant REPLIES matched against routing table" | 2149 | msgid "# Irrelevant REPLIES matched against routing table" |
2129 | msgstr "" | 2150 | msgstr "" |
2130 | 2151 | ||
2131 | #: src/dht/gnunet-service-dht_routing.c:251 | 2152 | #: src/dht/gnunet-service-dht_routing.c:253 |
2132 | msgid "# Unsupported REPLIES matched against routing table" | 2153 | msgid "# Unsupported REPLIES matched against routing table" |
2133 | msgstr "" | 2154 | msgstr "" |
2134 | 2155 | ||
2135 | #: src/dht/gnunet-service-dht_routing.c:327 | 2156 | #: src/dht/gnunet-service-dht_routing.c:329 |
2136 | msgid "# Entries removed from routing table" | 2157 | msgid "# Entries removed from routing table" |
2137 | msgstr "" | 2158 | msgstr "" |
2138 | 2159 | ||
2139 | #: src/dht/gnunet-service-dht_routing.c:409 | 2160 | #: src/dht/gnunet-service-dht_routing.c:411 |
2140 | msgid "# Entries added to routing table" | 2161 | msgid "# Entries added to routing table" |
2141 | msgstr "" | 2162 | msgstr "" |
2142 | 2163 | ||
2143 | #: src/dht/gnunet-service-dht_routing.c:427 | 2164 | #: src/dht/gnunet-service-dht_routing.c:429 |
2144 | msgid "# DHT requests combined" | 2165 | msgid "# DHT requests combined" |
2145 | msgstr "" | 2166 | msgstr "" |
2146 | 2167 | ||
@@ -2267,16 +2288,16 @@ msgstr "" | |||
2267 | "\n" | 2288 | "\n" |
2268 | "SUPU %s, %s, %d,my_identity = %s" | 2289 | "SUPU %s, %s, %d,my_identity = %s" |
2269 | 2290 | ||
2270 | #: src/dht/plugin_block_dht.c:142 | 2291 | #: src/dht/plugin_block_dht.c:144 |
2271 | #, c-format | 2292 | #, c-format |
2272 | msgid "Block not of type %u\n" | 2293 | msgid "Block not of type %u\n" |
2273 | msgstr "" | 2294 | msgstr "" |
2274 | 2295 | ||
2275 | #: src/dht/plugin_block_dht.c:149 | 2296 | #: src/dht/plugin_block_dht.c:151 |
2276 | msgid "Size mismatch for block\n" | 2297 | msgid "Size mismatch for block\n" |
2277 | msgstr "" | 2298 | msgstr "" |
2278 | 2299 | ||
2279 | #: src/dht/plugin_block_dht.c:159 | 2300 | #: src/dht/plugin_block_dht.c:161 |
2280 | #, c-format | 2301 | #, c-format |
2281 | msgid "Block of type %u is malformed\n" | 2302 | msgid "Block of type %u is malformed\n" |
2282 | msgstr "" | 2303 | msgstr "" |
@@ -3350,7 +3371,7 @@ msgid "Option `%s' is required when using option `%s'.\n" | |||
3350 | msgstr "" | 3371 | msgstr "" |
3351 | 3372 | ||
3352 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 | 3373 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 |
3353 | #: src/transport/gnunet-transport.c:1517 src/transport/gnunet-transport.c:1542 | 3374 | #: src/transport/gnunet-transport.c:1296 src/transport/gnunet-transport.c:1321 |
3354 | #, c-format | 3375 | #, c-format |
3355 | msgid "Option `%s' makes no sense without option `%s'.\n" | 3376 | msgid "Option `%s' makes no sense without option `%s'.\n" |
3356 | msgstr "" | 3377 | msgstr "" |
@@ -3836,39 +3857,39 @@ msgstr "" | |||
3836 | msgid "Received unsupported DNS request from %s\n" | 3857 | msgid "Received unsupported DNS request from %s\n" |
3837 | msgstr "" | 3858 | msgstr "" |
3838 | 3859 | ||
3839 | #: src/gns/gnunet-dns2gns.c:709 | 3860 | #: src/gns/gnunet-dns2gns.c:712 |
3840 | msgid "No ego configured for `dns2gns` subsystem\n" | 3861 | msgid "No ego configured for `dns2gns` subsystem\n" |
3841 | msgstr "" | 3862 | msgstr "" |
3842 | 3863 | ||
3843 | #: src/gns/gnunet-dns2gns.c:737 | 3864 | #: src/gns/gnunet-dns2gns.c:740 |
3844 | msgid "No DNS server specified!\n" | 3865 | msgid "No DNS server specified!\n" |
3845 | msgstr "" | 3866 | msgstr "" |
3846 | 3867 | ||
3847 | #: src/gns/gnunet-dns2gns.c:758 | 3868 | #: src/gns/gnunet-dns2gns.c:761 |
3848 | msgid "No valid GNS zone specified!\n" | 3869 | msgid "No valid GNS zone specified!\n" |
3849 | msgstr "" | 3870 | msgstr "" |
3850 | 3871 | ||
3851 | #: src/gns/gnunet-dns2gns.c:779 | 3872 | #: src/gns/gnunet-dns2gns.c:782 |
3852 | msgid "IP of recursive DNS resolver to use (required)" | 3873 | msgid "IP of recursive DNS resolver to use (required)" |
3853 | msgstr "" | 3874 | msgstr "" |
3854 | 3875 | ||
3855 | #: src/gns/gnunet-dns2gns.c:782 | 3876 | #: src/gns/gnunet-dns2gns.c:785 |
3856 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" | 3877 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" |
3857 | msgstr "" | 3878 | msgstr "" |
3858 | 3879 | ||
3859 | #: src/gns/gnunet-dns2gns.c:785 | 3880 | #: src/gns/gnunet-dns2gns.c:788 |
3860 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" | 3881 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" |
3861 | msgstr "" | 3882 | msgstr "" |
3862 | 3883 | ||
3863 | #: src/gns/gnunet-dns2gns.c:788 | 3884 | #: src/gns/gnunet-dns2gns.c:791 |
3864 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 3885 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
3865 | msgstr "" | 3886 | msgstr "" |
3866 | 3887 | ||
3867 | #: src/gns/gnunet-dns2gns.c:791 | 3888 | #: src/gns/gnunet-dns2gns.c:794 |
3868 | msgid "Public key of the GNS zone to use (overrides default)" | 3889 | msgid "Public key of the GNS zone to use (overrides default)" |
3869 | msgstr "" | 3890 | msgstr "" |
3870 | 3891 | ||
3871 | #: src/gns/gnunet-dns2gns.c:804 | 3892 | #: src/gns/gnunet-dns2gns.c:807 |
3872 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 3893 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
3873 | msgstr "" | 3894 | msgstr "" |
3874 | 3895 | ||
@@ -4027,80 +4048,82 @@ msgstr "" | |||
4027 | msgid "Unsupported HTTP method `%s'\n" | 4048 | msgid "Unsupported HTTP method `%s'\n" |
4028 | msgstr "" | 4049 | msgstr "" |
4029 | 4050 | ||
4030 | #: src/gns/gnunet-gns-proxy.c:2167 | 4051 | #: src/gns/gnunet-gns-proxy.c:2168 |
4031 | #, c-format | 4052 | #, c-format |
4032 | msgid "Unable to import private key from file `%s'\n" | 4053 | msgid "Unable to import private key from file `%s'\n" |
4033 | msgstr "" | 4054 | msgstr "" |
4034 | 4055 | ||
4035 | #: src/gns/gnunet-gns-proxy.c:2197 | 4056 | #: src/gns/gnunet-gns-proxy.c:2198 |
4036 | #, c-format | 4057 | #, c-format |
4037 | msgid "Unable to import certificate %s\n" | 4058 | msgid "Unable to import certificate %s\n" |
4038 | msgstr "" | 4059 | msgstr "" |
4039 | 4060 | ||
4040 | #: src/gns/gnunet-gns-proxy.c:2370 | 4061 | #: src/gns/gnunet-gns-proxy.c:2371 |
4041 | #, c-format | 4062 | #, c-format |
4042 | msgid "Failed to start HTTPS server for `%s'\n" | 4063 | msgid "Failed to start HTTPS server for `%s'\n" |
4043 | msgstr "" | 4064 | msgstr "" |
4044 | 4065 | ||
4045 | #: src/gns/gnunet-gns-proxy.c:2389 src/rest/gnunet-rest-server.c:533 | 4066 | #: src/gns/gnunet-gns-proxy.c:2390 src/rest/gnunet-rest-server.c:533 |
4046 | msgid "Failed to pass client to MHD\n" | 4067 | msgid "Failed to pass client to MHD\n" |
4047 | msgstr "" | 4068 | msgstr "" |
4048 | 4069 | ||
4049 | #: src/gns/gnunet-gns-proxy.c:2709 | 4070 | #: src/gns/gnunet-gns-proxy.c:2710 |
4050 | #, c-format | 4071 | #, c-format |
4051 | msgid "Unsupported socks version %d\n" | 4072 | msgid "Unsupported socks version %d\n" |
4052 | msgstr "" | 4073 | msgstr "" |
4053 | 4074 | ||
4054 | #: src/gns/gnunet-gns-proxy.c:2738 | 4075 | #: src/gns/gnunet-gns-proxy.c:2739 |
4055 | #, c-format | 4076 | #, c-format |
4056 | msgid "Unsupported socks command %d\n" | 4077 | msgid "Unsupported socks command %d\n" |
4057 | msgstr "" | 4078 | msgstr "" |
4058 | 4079 | ||
4059 | #: src/gns/gnunet-gns-proxy.c:2756 src/gns/gnunet-gns-proxy.c:2785 | 4080 | #: src/gns/gnunet-gns-proxy.c:2757 src/gns/gnunet-gns-proxy.c:2786 |
4060 | msgid "SSL connection to plain IPv4 address requested\n" | 4081 | msgid "SSL connection to plain IPv4 address requested\n" |
4061 | msgstr "" | 4082 | msgstr "" |
4062 | 4083 | ||
4063 | #: src/gns/gnunet-gns-proxy.c:2836 | 4084 | #: src/gns/gnunet-gns-proxy.c:2837 |
4064 | #, c-format | 4085 | #, c-format |
4065 | msgid "Unsupported socks address type %d\n" | 4086 | msgid "Unsupported socks address type %d\n" |
4066 | msgstr "" | 4087 | msgstr "" |
4067 | 4088 | ||
4068 | #: src/gns/gnunet-gns-proxy.c:3171 | 4089 | #: src/gns/gnunet-gns-proxy.c:3172 |
4069 | msgid "No ego configured for `shorten-zone`\n" | 4090 | msgid "No ego configured for `shorten-zone`\n" |
4070 | msgstr "" | 4091 | msgstr "" |
4071 | 4092 | ||
4072 | #: src/gns/gnunet-gns-proxy.c:3211 src/gns/gnunet-service-gns.c:1093 | 4093 | #: src/gns/gnunet-gns-proxy.c:3212 src/gns/gnunet-service-gns.c:493 |
4073 | #: src/gns/gnunet-service-gns.c:1149 | 4094 | #: src/gns/gnunet-service-gns.c:548 |
4074 | #, c-format | 4095 | #, c-format |
4075 | msgid "No ego configured for `%s`\n" | 4096 | msgid "No ego configured for `%s`\n" |
4076 | msgstr "" | 4097 | msgstr "" |
4077 | 4098 | ||
4078 | #: src/gns/gnunet-gns-proxy.c:3273 | 4099 | #: src/gns/gnunet-gns-proxy.c:3274 |
4079 | #, c-format | 4100 | #, c-format |
4080 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" | 4101 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" |
4081 | msgstr "" | 4102 | msgstr "" |
4082 | 4103 | ||
4083 | #: src/gns/gnunet-gns-proxy.c:3313 | 4104 | #: src/gns/gnunet-gns-proxy.c:3314 |
4084 | msgid "listen on specified port (default: 7777)" | 4105 | msgid "listen on specified port (default: 7777)" |
4085 | msgstr "" | 4106 | msgstr "" |
4086 | 4107 | ||
4087 | #: src/gns/gnunet-gns-proxy.c:3316 | 4108 | #: src/gns/gnunet-gns-proxy.c:3317 |
4088 | msgid "pem file to use as CA" | 4109 | msgid "pem file to use as CA" |
4089 | msgstr "" | 4110 | msgstr "" |
4090 | 4111 | ||
4091 | #: src/gns/gnunet-gns-proxy.c:3335 | 4112 | #: src/gns/gnunet-gns-proxy.c:3336 |
4092 | msgid "GNUnet GNS proxy" | 4113 | msgid "GNUnet GNS proxy" |
4093 | msgstr "" | 4114 | msgstr "" |
4094 | 4115 | ||
4095 | #: src/gns/gnunet-service-gns.c:1187 | 4116 | #: src/gns/gnunet-service-gns.c:585 |
4117 | #: src/zonemaster/gnunet-service-zonemaster.c:705 | ||
4096 | msgid "Failed to connect to the namestore!\n" | 4118 | msgid "Failed to connect to the namestore!\n" |
4097 | msgstr "" | 4119 | msgstr "" |
4098 | 4120 | ||
4099 | #: src/gns/gnunet-service-gns.c:1195 | 4121 | #: src/gns/gnunet-service-gns.c:593 |
4100 | msgid "Failed to connect to the namecache!\n" | 4122 | msgid "Failed to connect to the namecache!\n" |
4101 | msgstr "" | 4123 | msgstr "" |
4102 | 4124 | ||
4103 | #: src/gns/gnunet-service-gns.c:1228 | 4125 | #: src/gns/gnunet-service-gns.c:612 |
4126 | #: src/zonemaster/gnunet-service-zonemaster.c:740 | ||
4104 | msgid "Could not connect to DHT!\n" | 4127 | msgid "Could not connect to DHT!\n" |
4105 | msgstr "" | 4128 | msgstr "" |
4106 | 4129 | ||
@@ -4918,8 +4941,7 @@ msgstr "supprimer" | |||
4918 | msgid "Invalid public key for reverse lookup `%s'\n" | 4941 | msgid "Invalid public key for reverse lookup `%s'\n" |
4919 | msgstr "" | 4942 | msgstr "" |
4920 | 4943 | ||
4921 | #: src/namestore/gnunet-namestore.c:979 | 4944 | #: src/namestore/gnunet-namestore.c:979 src/peerinfo-tool/gnunet-peerinfo.c:775 |
4922 | #: src/peerinfo-tool/gnunet-peerinfo.c:775 | ||
4923 | #, c-format | 4945 | #, c-format |
4924 | msgid "Invalid URI `%s'\n" | 4946 | msgid "Invalid URI `%s'\n" |
4925 | msgstr "URI invalide « %s »\n" | 4947 | msgstr "URI invalide « %s »\n" |
@@ -5071,211 +5093,282 @@ msgstr "" | |||
5071 | msgid "Namestore REST API initialized\n" | 5093 | msgid "Namestore REST API initialized\n" |
5072 | msgstr "" | 5094 | msgstr "" |
5073 | 5095 | ||
5074 | #: src/nat/gnunet-nat.c:159 | 5096 | #: src/nat-auto/gnunet-nat-auto.c:192 |
5075 | msgid "GNUnet NAT traversal autoconfigure daemon" | 5097 | msgid "Suggested configuration changes:\n" |
5098 | msgstr "" | ||
5099 | |||
5100 | #: src/nat-auto/gnunet-nat-auto.c:220 | ||
5101 | #, fuzzy, c-format | ||
5102 | msgid "Failed to write configuration to `%s'\n" | ||
5103 | msgstr "fornat invalide : « %s »\n" | ||
5104 | |||
5105 | #: src/nat-auto/gnunet-nat-auto.c:227 | ||
5106 | #, c-format | ||
5107 | msgid "Wrote updated configuration to `%s'\n" | ||
5108 | msgstr "" | ||
5109 | |||
5110 | #: src/nat-auto/gnunet-nat-auto.c:345 | ||
5111 | #, fuzzy | ||
5112 | msgid "run autoconfiguration" | ||
5113 | msgstr "fornat invalide : « %s »\n" | ||
5114 | |||
5115 | #: src/nat-auto/gnunet-nat-auto.c:348 | ||
5116 | msgid "section name providing the configuration for the adapter" | ||
5117 | msgstr "" | ||
5118 | |||
5119 | #: src/nat-auto/gnunet-nat-auto.c:351 src/nat/gnunet-nat.c:436 | ||
5120 | msgid "use TCP" | ||
5121 | msgstr "" | ||
5122 | |||
5123 | #: src/nat-auto/gnunet-nat-auto.c:354 src/nat/gnunet-nat.c:439 | ||
5124 | msgid "use UDP" | ||
5125 | msgstr "" | ||
5126 | |||
5127 | #: src/nat-auto/gnunet-nat-auto.c:357 | ||
5128 | msgid "write configuration file (for autoconfiguration)" | ||
5129 | msgstr "" | ||
5130 | |||
5131 | #: src/nat-auto/gnunet-nat-auto.c:369 | ||
5132 | msgid "GNUnet NAT traversal autoconfiguration" | ||
5133 | msgstr "" | ||
5134 | |||
5135 | #: src/nat-auto/gnunet-nat-auto_legacy.c:403 | ||
5136 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:681 | ||
5137 | #: src/nat-auto/nat_auto_api_test.c:405 | ||
5138 | msgid "Failed to connect to `gnunet-nat-server'\n" | ||
5076 | msgstr "" | 5139 | msgstr "" |
5077 | 5140 | ||
5078 | #: src/nat/gnunet-nat-server.c:321 | 5141 | #: src/nat-auto/gnunet-nat-auto_legacy.c:518 |
5142 | #: src/nat-auto/nat_auto_api_test.c:520 | ||
5143 | #, c-format | ||
5144 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5145 | msgstr "" | ||
5146 | |||
5147 | #: src/nat-auto/gnunet-nat-auto_legacy.c:568 | ||
5148 | #: src/nat-auto/nat_auto_api_test.c:569 | ||
5149 | msgid "NAT test failed to start NAT library\n" | ||
5150 | msgstr "" | ||
5151 | |||
5152 | #: src/nat-auto/gnunet-nat-server.c:336 | ||
5079 | #, c-format | 5153 | #, c-format |
5080 | msgid "Please pass valid port number as the first argument! (got `%s')\n" | 5154 | msgid "Please pass valid port number as the first argument! (got `%s')\n" |
5081 | msgstr "" | 5155 | msgstr "" |
5082 | 5156 | ||
5083 | #: src/nat/gnunet-nat-server.c:363 | 5157 | #: src/nat-auto/gnunet-nat-server.c:386 |
5084 | msgid "GNUnet NAT traversal test helper daemon" | 5158 | msgid "GNUnet NAT traversal test helper daemon" |
5085 | msgstr "" | 5159 | msgstr "" |
5086 | 5160 | ||
5087 | #: src/nat/nat_api.c:880 src/nat/nat.c:2010 | 5161 | #: src/nat-auto/gnunet-service-nat-auto.c:342 |
5162 | msgid "UPnP client `upnpc` command not found, disabling UPnP\n" | ||
5163 | msgstr "" | ||
5164 | |||
5165 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:385 | ||
5166 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5167 | msgstr "" | ||
5168 | |||
5169 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:386 | ||
5170 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5171 | msgstr "" | ||
5172 | |||
5173 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:405 | ||
5174 | msgid "Testing connection reversal with ICMP server.\n" | ||
5175 | msgstr "" | ||
5176 | |||
5177 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:437 | ||
5178 | #, c-format | ||
5179 | msgid "Detected external IP `%s'\n" | ||
5180 | msgstr "" | ||
5181 | |||
5182 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:572 | ||
5183 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | ||
5184 | msgstr "" | ||
5185 | |||
5186 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:590 | ||
5187 | #, c-format | ||
5188 | msgid "Detected internal network address `%s'.\n" | ||
5189 | msgstr "" | ||
5190 | |||
5191 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:724 | ||
5192 | msgid "upnpc found, enabling its use\n" | ||
5193 | msgstr "" | ||
5194 | |||
5195 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:725 | ||
5196 | msgid "upnpc not found\n" | ||
5197 | msgstr "upnpc introuvable\n" | ||
5198 | |||
5199 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:762 | ||
5200 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5201 | msgstr "" | ||
5202 | |||
5203 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:774 | ||
5204 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:834 | ||
5205 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | ||
5206 | msgstr "" | ||
5207 | |||
5208 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:786 | ||
5209 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:846 | ||
5210 | msgid "No working gnunet-helper-nat-server found\n" | ||
5211 | msgstr "" | ||
5212 | |||
5213 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:823 | ||
5214 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | ||
5215 | msgstr "" | ||
5216 | |||
5217 | #: src/nat-auto/nat_auto_api.c:76 | ||
5088 | msgid "Operation Successful" | 5218 | msgid "Operation Successful" |
5089 | msgstr "" | 5219 | msgstr "" |
5090 | 5220 | ||
5091 | #: src/nat/nat_api.c:882 src/nat/nat.c:2012 | 5221 | #: src/nat-auto/nat_auto_api.c:78 |
5092 | msgid "Internal Failure (IPC, ...)" | 5222 | msgid "IPC failure" |
5093 | msgstr "" | 5223 | msgstr "" |
5094 | 5224 | ||
5095 | #: src/nat/nat_api.c:884 src/nat/nat.c:2014 | 5225 | #: src/nat-auto/nat_auto_api.c:80 |
5096 | msgid "Failure in network subsystem, check permissions." | 5226 | msgid "Failure in network subsystem, check permissions." |
5097 | msgstr "" | 5227 | msgstr "" |
5098 | 5228 | ||
5099 | #: src/nat/nat_api.c:886 src/nat/nat.c:2016 | 5229 | #: src/nat-auto/nat_auto_api.c:82 |
5100 | msgid "Encountered timeout while performing operation" | 5230 | msgid "Encountered timeout while performing operation" |
5101 | msgstr "" | 5231 | msgstr "" |
5102 | 5232 | ||
5103 | #: src/nat/nat_api.c:888 src/nat/nat.c:2018 | 5233 | #: src/nat-auto/nat_auto_api.c:84 |
5104 | msgid "detected that we are offline" | 5234 | msgid "detected that we are offline" |
5105 | msgstr "" | 5235 | msgstr "" |
5106 | 5236 | ||
5107 | #: src/nat/nat_api.c:890 src/nat/nat.c:2020 | 5237 | #: src/nat-auto/nat_auto_api.c:86 |
5108 | msgid "`upnpc` command not found" | 5238 | msgid "`upnpc` command not found" |
5109 | msgstr "" | 5239 | msgstr "" |
5110 | 5240 | ||
5111 | #: src/nat/nat_api.c:892 src/nat/nat.c:2022 | 5241 | #: src/nat-auto/nat_auto_api.c:88 |
5112 | msgid "Failed to run `upnpc` command" | 5242 | msgid "Failed to run `upnpc` command" |
5113 | msgstr "" | 5243 | msgstr "" |
5114 | 5244 | ||
5115 | #: src/nat/nat_api.c:894 src/nat/nat.c:2024 | 5245 | #: src/nat-auto/nat_auto_api.c:90 |
5116 | msgid "`upnpc' command took too long, process killed" | 5246 | msgid "`upnpc' command took too long, process killed" |
5117 | msgstr "" | 5247 | msgstr "" |
5118 | 5248 | ||
5119 | #: src/nat/nat_api.c:896 src/nat/nat.c:2026 | 5249 | #: src/nat-auto/nat_auto_api.c:92 |
5120 | msgid "`upnpc' command failed to establish port mapping" | 5250 | msgid "`upnpc' command failed to establish port mapping" |
5121 | msgstr "" | 5251 | msgstr "" |
5122 | 5252 | ||
5123 | #: src/nat/nat_api.c:898 src/nat/nat.c:2028 | 5253 | #: src/nat-auto/nat_auto_api.c:94 |
5124 | msgid "`external-ip' command not found" | 5254 | msgid "`external-ip' command not found" |
5125 | msgstr "" | 5255 | msgstr "" |
5126 | 5256 | ||
5127 | #: src/nat/nat_api.c:900 src/nat/nat.c:2030 | 5257 | #: src/nat-auto/nat_auto_api.c:96 |
5128 | msgid "Failed to run `external-ip` command" | 5258 | msgid "Failed to run `external-ip` command" |
5129 | msgstr "" | 5259 | msgstr "" |
5130 | 5260 | ||
5131 | #: src/nat/nat_api.c:902 src/nat/nat.c:2032 | 5261 | #: src/nat-auto/nat_auto_api.c:98 |
5132 | msgid "`external-ip' command output invalid" | 5262 | msgid "`external-ip' command output invalid" |
5133 | msgstr "" | 5263 | msgstr "" |
5134 | 5264 | ||
5135 | #: src/nat/nat_api.c:904 src/nat/nat.c:2034 | 5265 | #: src/nat-auto/nat_auto_api.c:100 |
5136 | msgid "no valid address was returned by `external-ip'" | 5266 | msgid "no valid address was returned by `external-ip'" |
5137 | msgstr "" | 5267 | msgstr "" |
5138 | 5268 | ||
5139 | #: src/nat/nat_api.c:906 src/nat/nat.c:2036 | 5269 | #: src/nat-auto/nat_auto_api.c:102 |
5140 | msgid "Could not determine interface with internal/local network address" | 5270 | msgid "Could not determine interface with internal/local network address" |
5141 | msgstr "" | 5271 | msgstr "" |
5142 | 5272 | ||
5143 | #: src/nat/nat_api.c:908 src/nat/nat.c:2038 | 5273 | #: src/nat-auto/nat_auto_api.c:104 |
5144 | msgid "No functioning gnunet-helper-nat-server installation found" | 5274 | msgid "No functioning gnunet-helper-nat-server installation found" |
5145 | msgstr "" | 5275 | msgstr "" |
5146 | 5276 | ||
5147 | #: src/nat/nat_api.c:910 src/nat/nat.c:2040 | 5277 | #: src/nat-auto/nat_auto_api.c:106 |
5148 | msgid "NAT test could not be initialized" | 5278 | msgid "NAT test could not be initialized" |
5149 | msgstr "" | 5279 | msgstr "" |
5150 | 5280 | ||
5151 | #: src/nat/nat_api.c:912 src/nat/nat.c:2042 | 5281 | #: src/nat-auto/nat_auto_api.c:108 |
5152 | msgid "NAT test timeout reached" | 5282 | msgid "NAT test timeout reached" |
5153 | msgstr "" | 5283 | msgstr "" |
5154 | 5284 | ||
5155 | #: src/nat/nat_api.c:914 src/nat/nat.c:2044 | 5285 | #: src/nat-auto/nat_auto_api.c:110 |
5156 | msgid "could not register NAT" | 5286 | msgid "could not register NAT" |
5157 | msgstr "" | 5287 | msgstr "" |
5158 | 5288 | ||
5159 | #: src/nat/nat_api.c:916 src/nat/nat.c:2046 | 5289 | #: src/nat-auto/nat_auto_api.c:112 |
5160 | msgid "No working gnunet-helper-nat-client installation found" | 5290 | msgid "No working gnunet-helper-nat-client installation found" |
5161 | msgstr "" | 5291 | msgstr "" |
5162 | 5292 | ||
5163 | #: src/nat/nat_auto.c:385 | 5293 | #: src/nat-auto/nat_auto_api_test.c:477 |
5164 | msgid "NAT traversal with ICMP Server succeeded.\n" | 5294 | #, fuzzy, c-format |
5165 | msgstr "" | 5295 | msgid "Failed to find valid PORT in section `%s'\n" |
5166 | 5296 | msgstr "Résolution de « %s » échouée : %s\n" | |
5167 | #: src/nat/nat_auto.c:386 | ||
5168 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5169 | msgstr "" | ||
5170 | |||
5171 | #: src/nat/nat_auto.c:405 | ||
5172 | msgid "Testing connection reversal with ICMP server.\n" | ||
5173 | msgstr "" | ||
5174 | |||
5175 | #: src/nat/nat_auto.c:437 | ||
5176 | #, c-format | ||
5177 | msgid "Detected external IP `%s'\n" | ||
5178 | msgstr "" | ||
5179 | |||
5180 | #: src/nat/nat_auto.c:572 | ||
5181 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | ||
5182 | msgstr "" | ||
5183 | 5297 | ||
5184 | #: src/nat/nat_auto.c:590 | 5298 | #: src/nat/gnunet-nat.c:424 |
5185 | #, c-format | 5299 | msgid "which IP and port are we locally using to bind/listen to" |
5186 | msgid "Detected internal network address `%s'.\n" | ||
5187 | msgstr "" | 5300 | msgstr "" |
5188 | 5301 | ||
5189 | #: src/nat/nat_auto.c:681 src/nat/nat_test.c:403 | 5302 | #: src/nat/gnunet-nat.c:427 |
5190 | msgid "Failed to connect to `gnunet-nat-server'\n" | 5303 | msgid "which remote IP and port should be asked for connection reversal" |
5191 | msgstr "" | 5304 | msgstr "" |
5192 | 5305 | ||
5193 | #: src/nat/nat_auto.c:724 | 5306 | #: src/nat/gnunet-nat.c:430 |
5194 | msgid "upnpc found, enabling its use\n" | 5307 | msgid "" |
5308 | "name of configuration section to find additional options, such as manual " | ||
5309 | "host punching data" | ||
5195 | msgstr "" | 5310 | msgstr "" |
5196 | 5311 | ||
5197 | #: src/nat/nat_auto.c:725 | 5312 | #: src/nat/gnunet-nat.c:433 |
5198 | msgid "upnpc not found\n" | 5313 | msgid "enable STUN processing" |
5199 | msgstr "upnpc introuvable\n" | ||
5200 | |||
5201 | #: src/nat/nat_auto.c:762 | ||
5202 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5203 | msgstr "" | 5314 | msgstr "" |
5204 | 5315 | ||
5205 | #: src/nat/nat_auto.c:774 src/nat/nat_auto.c:834 | 5316 | #: src/nat/gnunet-nat.c:442 |
5206 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | 5317 | msgid "watch for connection reversal requests" |
5207 | msgstr "" | 5318 | msgstr "" |
5208 | 5319 | ||
5209 | #: src/nat/nat_auto.c:786 src/nat/nat_auto.c:846 | 5320 | #: src/nat/gnunet-nat.c:454 |
5210 | msgid "No working gnunet-helper-nat-server found\n" | 5321 | msgid "GNUnet NAT traversal autoconfigure daemon" |
5211 | msgstr "" | 5322 | msgstr "" |
5212 | 5323 | ||
5213 | #: src/nat/nat_auto.c:823 | 5324 | #: src/nat/gnunet-service-nat.c:1313 |
5214 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | 5325 | #, c-format |
5326 | msgid "Malformed punched hole specification `%s' (lacks port)\n" | ||
5215 | msgstr "" | 5327 | msgstr "" |
5216 | 5328 | ||
5217 | #: src/nat/nat.c:1019 | 5329 | #: src/nat/gnunet-service-nat.c:1323 |
5218 | #, c-format | 5330 | #, c-format |
5219 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" | 5331 | msgid "Invalid port number in punched hole specification `%s' (lacks port)\n" |
5220 | msgstr "" | 5332 | msgstr "" |
5221 | 5333 | ||
5222 | #: src/nat/nat.c:1070 | 5334 | #: src/nat/gnunet-service-nat.c:1339 |
5223 | #, c-format | 5335 | #, c-format |
5224 | msgid "Failed to start %s\n" | 5336 | msgid "Malformed punched hole specification `%s' (lacks `]')\n" |
5225 | msgstr "Échec du démarrage de %s\n" | ||
5226 | |||
5227 | #: src/nat/nat.c:1327 | ||
5228 | msgid "Error while running upnp client:\n" | ||
5229 | msgstr "" | 5337 | msgstr "" |
5230 | 5338 | ||
5231 | #: src/nat/nat.c:1402 | 5339 | #: src/nat/gnunet-service-nat.c:1350 |
5232 | #, c-format | 5340 | #, c-format |
5233 | msgid "Failed to run upnp client for port %u\n" | 5341 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
5234 | msgstr "" | 5342 | msgstr "" |
5235 | 5343 | ||
5236 | #: src/nat/nat.c:1546 | 5344 | #: src/nat/gnunet-service-nat.c:1803 |
5237 | msgid "malformed" | 5345 | msgid "Connection reversal request failed\n" |
5238 | msgstr "malformé" | 5346 | msgstr "" |
5239 | 5347 | ||
5240 | #: src/nat/nat.c:1600 | 5348 | #: src/nat/gnunet-service-nat.c:1876 |
5241 | msgid "" | 5349 | msgid "" |
5242 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 5350 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
5243 | "disabling UPnP \n" | 5351 | "disabling UPnP\n" |
5244 | msgstr "" | 5352 | msgstr "" |
5245 | 5353 | ||
5246 | #: src/nat/nat.c:1726 src/nat/nat.c:1739 | 5354 | #: src/nat/gnunet-service-nat_helper.c:186 |
5247 | #, c-format | 5355 | #, c-format |
5248 | msgid "" | 5356 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" |
5249 | "Configuration requires `%s', but binary is not installed properly (SUID bit " | ||
5250 | "not set). Option disabled.\n" | ||
5251 | msgstr "" | ||
5252 | |||
5253 | #: src/nat/nat.c:1903 | ||
5254 | msgid "Internal IP address not known, cannot use ICMP NAT traversal method\n" | ||
5255 | msgstr "" | 5357 | msgstr "" |
5256 | 5358 | ||
5257 | #: src/nat/nat.c:1919 | 5359 | #: src/nat/gnunet-service-nat_helper.c:260 |
5258 | #, c-format | 5360 | #, c-format |
5259 | msgid "Running gnunet-helper-nat-client %s %s %u\n" | 5361 | msgid "Failed to start %s\n" |
5260 | msgstr "" | 5362 | msgstr "Échec du démarrage de %s\n" |
5261 | 5363 | ||
5262 | #: src/nat/nat_mini.c:205 | 5364 | #: src/nat/gnunet-service-nat_mini.c:196 |
5263 | msgid "`external-ip' command not found\n" | 5365 | msgid "`external-ip' command not found\n" |
5264 | msgstr "" | 5366 | msgstr "" |
5265 | 5367 | ||
5266 | #: src/nat/nat_mini.c:611 | 5368 | #: src/nat/gnunet-service-nat_mini.c:654 |
5267 | msgid "`upnpc' command not found\n" | 5369 | msgid "`upnpc' command not found\n" |
5268 | msgstr "" | 5370 | msgstr "" |
5269 | 5371 | ||
5270 | #: src/nat/nat_test.c:518 | ||
5271 | #, c-format | ||
5272 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5273 | msgstr "" | ||
5274 | |||
5275 | #: src/nat/nat_test.c:568 | ||
5276 | msgid "NAT test failed to start NAT library\n" | ||
5277 | msgstr "" | ||
5278 | |||
5279 | #: src/nse/gnunet-nse.c:122 | 5372 | #: src/nse/gnunet-nse.c:122 |
5280 | msgid "Show network size estimates from NSE service." | 5373 | msgid "Show network size estimates from NSE service." |
5281 | msgstr "" | 5374 | msgstr "" |
@@ -6974,171 +7067,148 @@ msgstr "" | |||
6974 | msgid "# validations succeeded" | 7067 | msgid "# validations succeeded" |
6975 | msgstr "" | 7068 | msgstr "" |
6976 | 7069 | ||
6977 | #: src/transport/gnunet-transport.c:486 | 7070 | #: src/transport/gnunet-transport.c:418 |
6978 | #, c-format | 7071 | #, c-format |
6979 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" | 7072 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" |
6980 | msgstr "" | 7073 | msgstr "" |
6981 | 7074 | ||
6982 | #: src/transport/gnunet-transport.c:496 | 7075 | #: src/transport/gnunet-transport.c:428 |
6983 | #, c-format | 7076 | #, c-format |
6984 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" | 7077 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" |
6985 | msgstr "" | 7078 | msgstr "" |
6986 | 7079 | ||
6987 | #: src/transport/gnunet-transport.c:540 | 7080 | #: src/transport/gnunet-transport.c:472 |
6988 | #, c-format | 7081 | #, c-format |
6989 | msgid "Failed to connect to `%s'\n" | 7082 | msgid "Failed to connect to `%s'\n" |
6990 | msgstr "" | 7083 | msgstr "" |
6991 | 7084 | ||
6992 | #: src/transport/gnunet-transport.c:553 | 7085 | #: src/transport/gnunet-transport.c:485 |
6993 | #, c-format | 7086 | #, c-format |
6994 | msgid "Failed to resolve address for peer `%s'\n" | 7087 | msgid "Failed to resolve address for peer `%s'\n" |
6995 | msgstr "" | 7088 | msgstr "" |
6996 | 7089 | ||
6997 | #: src/transport/gnunet-transport.c:565 | 7090 | #: src/transport/gnunet-transport.c:499 |
6998 | msgid "Failed to list connections, timeout occured\n" | 7091 | msgid "Failed to list connections, timeout occured\n" |
6999 | msgstr "" | 7092 | msgstr "" |
7000 | 7093 | ||
7001 | #: src/transport/gnunet-transport.c:588 | 7094 | #: src/transport/gnunet-transport.c:532 |
7002 | #, c-format | ||
7003 | msgid "NAT plugin `%s' reports: %s\n" | ||
7004 | msgstr "" | ||
7005 | |||
7006 | #: src/transport/gnunet-transport.c:675 | ||
7007 | msgid "No transport plugins configured, peer will never communicate\n" | ||
7008 | msgstr "" | ||
7009 | |||
7010 | #: src/transport/gnunet-transport.c:689 | ||
7011 | #, c-format | ||
7012 | msgid "No port configured for plugin `%s', cannot test it\n" | ||
7013 | msgstr "" | ||
7014 | |||
7015 | #: src/transport/gnunet-transport.c:714 | ||
7016 | #, fuzzy | ||
7017 | msgid "Failed to start resolver!\n" | ||
7018 | msgstr "Échec du démarrage de %s\n" | ||
7019 | |||
7020 | #: src/transport/gnunet-transport.c:750 | ||
7021 | #, c-format | 7095 | #, c-format |
7022 | msgid "Transmitting %u bytes\n" | 7096 | msgid "Transmitting %u bytes\n" |
7023 | msgstr "" | 7097 | msgstr "" |
7024 | 7098 | ||
7025 | #: src/transport/gnunet-transport.c:784 | 7099 | #: src/transport/gnunet-transport.c:566 |
7026 | #, c-format | 7100 | #, c-format |
7027 | msgid "" | 7101 | msgid "" |
7028 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " | 7102 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " |
7029 | "blocks\n" | 7103 | "blocks\n" |
7030 | msgstr "" | 7104 | msgstr "" |
7031 | 7105 | ||
7032 | #: src/transport/gnunet-transport.c:815 | 7106 | #: src/transport/gnunet-transport.c:597 |
7033 | #, c-format | 7107 | #, c-format |
7034 | msgid "Disconnected from peer `%s' while benchmarking\n" | 7108 | msgid "Disconnected from peer `%s' while benchmarking\n" |
7035 | msgstr "" | 7109 | msgstr "" |
7036 | 7110 | ||
7037 | #: src/transport/gnunet-transport.c:839 src/transport/gnunet-transport.c:868 | 7111 | #: src/transport/gnunet-transport.c:621 src/transport/gnunet-transport.c:650 |
7038 | #, c-format | 7112 | #, c-format |
7039 | msgid "%24s: %-17s %4s (%u connections in total)\n" | 7113 | msgid "%24s: %-17s %4s (%u connections in total)\n" |
7040 | msgstr "" | 7114 | msgstr "" |
7041 | 7115 | ||
7042 | #: src/transport/gnunet-transport.c:841 | 7116 | #: src/transport/gnunet-transport.c:623 |
7043 | msgid "Connected to" | 7117 | msgid "Connected to" |
7044 | msgstr "Connecté à " | 7118 | msgstr "Connecté à " |
7045 | 7119 | ||
7046 | #: src/transport/gnunet-transport.c:870 | 7120 | #: src/transport/gnunet-transport.c:652 |
7047 | msgid "Disconnected from" | 7121 | msgid "Disconnected from" |
7048 | msgstr "Déconnecté de" | 7122 | msgstr "Déconnecté de" |
7049 | 7123 | ||
7050 | #: src/transport/gnunet-transport.c:905 | 7124 | #: src/transport/gnunet-transport.c:687 |
7051 | #, fuzzy, c-format | 7125 | #, fuzzy, c-format |
7052 | msgid "Received %u bytes\n" | 7126 | msgid "Received %u bytes\n" |
7053 | msgstr "%s message(s) reçu(s)\n" | 7127 | msgstr "%s message(s) reçu(s)\n" |
7054 | 7128 | ||
7055 | #: src/transport/gnunet-transport.c:942 | 7129 | #: src/transport/gnunet-transport.c:724 |
7056 | #, c-format | 7130 | #, c-format |
7057 | msgid "Peer `%s': %s %s in state `%s' until %s\n" | 7131 | msgid "Peer `%s': %s %s in state `%s' until %s\n" |
7058 | msgstr "" | 7132 | msgstr "" |
7059 | 7133 | ||
7060 | #: src/transport/gnunet-transport.c:954 | 7134 | #: src/transport/gnunet-transport.c:736 |
7061 | #, c-format | 7135 | #, c-format |
7062 | msgid "Peer `%s': %s %s\n" | 7136 | msgid "Peer `%s': %s %s\n" |
7063 | msgstr "" | 7137 | msgstr "" |
7064 | 7138 | ||
7065 | #: src/transport/gnunet-transport.c:1366 | 7139 | #: src/transport/gnunet-transport.c:1150 |
7066 | msgid "Monitor disconnected from transport service. Reconnecting.\n" | 7140 | msgid "Monitor disconnected from transport service. Reconnecting.\n" |
7067 | msgstr "" | 7141 | msgstr "" |
7068 | 7142 | ||
7069 | #: src/transport/gnunet-transport.c:1488 | 7143 | #: src/transport/gnunet-transport.c:1267 |
7070 | #, c-format | 7144 | #, c-format |
7071 | msgid "" | 7145 | msgid "" |
7072 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " | 7146 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " |
7073 | "%s, %s %s\n" | 7147 | "%s, %s %s\n" |
7074 | msgstr "" | 7148 | msgstr "" |
7075 | 7149 | ||
7076 | #: src/transport/gnunet-transport.c:1501 | 7150 | #: src/transport/gnunet-transport.c:1280 |
7077 | #, c-format | 7151 | #, c-format |
7078 | msgid "" | 7152 | msgid "" |
7079 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" | 7153 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" |
7080 | msgstr "" | 7154 | msgstr "" |
7081 | 7155 | ||
7082 | #: src/transport/gnunet-transport.c:1529 | 7156 | #: src/transport/gnunet-transport.c:1308 |
7083 | msgid "Failed to connect to transport service for disconnection\n" | 7157 | msgid "Failed to connect to transport service for disconnection\n" |
7084 | msgstr "" | 7158 | msgstr "" |
7085 | 7159 | ||
7086 | #: src/transport/gnunet-transport.c:1535 | 7160 | #: src/transport/gnunet-transport.c:1314 |
7087 | msgid "Blacklisting request in place, stop with CTRL-C\n" | 7161 | msgid "Blacklisting request in place, stop with CTRL-C\n" |
7088 | msgstr "" | 7162 | msgstr "" |
7089 | 7163 | ||
7090 | #: src/transport/gnunet-transport.c:1558 src/transport/gnunet-transport.c:1588 | 7164 | #: src/transport/gnunet-transport.c:1337 src/transport/gnunet-transport.c:1367 |
7091 | #: src/transport/gnunet-transport.c:1641 | 7165 | #: src/transport/gnunet-transport.c:1420 |
7092 | msgid "Failed to connect to transport service\n" | 7166 | msgid "Failed to connect to transport service\n" |
7093 | msgstr "" | 7167 | msgstr "" |
7094 | 7168 | ||
7095 | #: src/transport/gnunet-transport.c:1595 | 7169 | #: src/transport/gnunet-transport.c:1374 |
7096 | msgid "Starting to receive benchmark data\n" | 7170 | msgid "Starting to receive benchmark data\n" |
7097 | msgstr "" | 7171 | msgstr "" |
7098 | 7172 | ||
7099 | #: src/transport/gnunet-transport.c:1665 | 7173 | #: src/transport/gnunet-transport.c:1444 |
7100 | msgid "print information for all peers (instead of only connected peers)" | 7174 | msgid "print information for all peers (instead of only connected peers)" |
7101 | msgstr "" | 7175 | msgstr "" |
7102 | 7176 | ||
7103 | #: src/transport/gnunet-transport.c:1668 | 7177 | #: src/transport/gnunet-transport.c:1447 |
7104 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" | 7178 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" |
7105 | msgstr "" | 7179 | msgstr "" |
7106 | 7180 | ||
7107 | #: src/transport/gnunet-transport.c:1671 | 7181 | #: src/transport/gnunet-transport.c:1450 |
7108 | msgid "disconnect from a peer" | 7182 | msgid "disconnect from a peer" |
7109 | msgstr "" | 7183 | msgstr "" |
7110 | 7184 | ||
7111 | #: src/transport/gnunet-transport.c:1674 | 7185 | #: src/transport/gnunet-transport.c:1453 |
7112 | msgid "provide information about all current connections (once)" | 7186 | msgid "provide information about all current connections (once)" |
7113 | msgstr "" | 7187 | msgstr "" |
7114 | 7188 | ||
7115 | #: src/transport/gnunet-transport.c:1680 | 7189 | #: src/transport/gnunet-transport.c:1459 |
7116 | msgid "" | 7190 | msgid "" |
7117 | "provide information about all connects and disconnect events (continuously)" | 7191 | "provide information about all connects and disconnect events (continuously)" |
7118 | msgstr "" | 7192 | msgstr "" |
7119 | 7193 | ||
7120 | #: src/transport/gnunet-transport.c:1683 | 7194 | #: src/transport/gnunet-transport.c:1462 |
7121 | msgid "do not resolve hostnames" | 7195 | msgid "do not resolve hostnames" |
7122 | msgstr "" | 7196 | msgstr "" |
7123 | 7197 | ||
7124 | #: src/transport/gnunet-transport.c:1686 | 7198 | #: src/transport/gnunet-transport.c:1465 |
7125 | #: src/transport/gnunet-transport-profiler.c:631 | 7199 | #: src/transport/gnunet-transport-profiler.c:631 |
7126 | msgid "peer identity" | 7200 | msgid "peer identity" |
7127 | msgstr "" | 7201 | msgstr "" |
7128 | 7202 | ||
7129 | #: src/transport/gnunet-transport.c:1689 | 7203 | #: src/transport/gnunet-transport.c:1468 |
7130 | msgid "monitor plugin sessions" | 7204 | msgid "monitor plugin sessions" |
7131 | msgstr "" | 7205 | msgstr "" |
7132 | 7206 | ||
7133 | #: src/transport/gnunet-transport.c:1692 | 7207 | #: src/transport/gnunet-transport.c:1471 |
7134 | msgid "send data for benchmarking to the other peer (until CTRL-C)" | 7208 | msgid "send data for benchmarking to the other peer (until CTRL-C)" |
7135 | msgstr "" | 7209 | msgstr "" |
7136 | 7210 | ||
7137 | #: src/transport/gnunet-transport.c:1695 | 7211 | #: src/transport/gnunet-transport.c:1482 |
7138 | msgid "test transport configuration (involves external server)" | ||
7139 | msgstr "" | ||
7140 | |||
7141 | #: src/transport/gnunet-transport.c:1706 | ||
7142 | #: src/transport/gnunet-transport-profiler.c:642 | 7212 | #: src/transport/gnunet-transport-profiler.c:642 |
7143 | msgid "Direct access to transport service." | 7213 | msgid "Direct access to transport service." |
7144 | msgstr "" | 7214 | msgstr "" |
@@ -7171,9 +7241,9 @@ msgstr "" | |||
7171 | 7241 | ||
7172 | #: src/transport/plugin_transport_http_client.c:1477 | 7242 | #: src/transport/plugin_transport_http_client.c:1477 |
7173 | #: src/transport/plugin_transport_http_server.c:2248 | 7243 | #: src/transport/plugin_transport_http_server.c:2248 |
7174 | #: src/transport/plugin_transport_http_server.c:3457 | 7244 | #: src/transport/plugin_transport_http_server.c:3462 |
7175 | #: src/transport/plugin_transport_tcp.c:3365 | 7245 | #: src/transport/plugin_transport_tcp.c:3375 |
7176 | #: src/transport/plugin_transport_tcp.c:3372 | 7246 | #: src/transport/plugin_transport_tcp.c:3382 |
7177 | msgid "TCP_STEALTH not supported on this platform.\n" | 7247 | msgid "TCP_STEALTH not supported on this platform.\n" |
7178 | msgstr "" | 7248 | msgstr "" |
7179 | 7249 | ||
@@ -7183,13 +7253,13 @@ msgid "Could not initialize curl multi handle, failed to start %s plugin!\n" | |||
7183 | msgstr "" | 7253 | msgstr "" |
7184 | 7254 | ||
7185 | #: src/transport/plugin_transport_http_client.c:2167 | 7255 | #: src/transport/plugin_transport_http_client.c:2167 |
7186 | #: src/transport/plugin_transport_http_server.c:3172 | 7256 | #: src/transport/plugin_transport_http_server.c:3177 |
7187 | #, c-format | 7257 | #, c-format |
7188 | msgid "Shutting down plugin `%s'\n" | 7258 | msgid "Shutting down plugin `%s'\n" |
7189 | msgstr "" | 7259 | msgstr "" |
7190 | 7260 | ||
7191 | #: src/transport/plugin_transport_http_client.c:2184 | 7261 | #: src/transport/plugin_transport_http_client.c:2184 |
7192 | #: src/transport/plugin_transport_http_server.c:3242 | 7262 | #: src/transport/plugin_transport_http_server.c:3247 |
7193 | #, c-format | 7263 | #, c-format |
7194 | msgid "Shutdown for plugin `%s' complete\n" | 7264 | msgid "Shutdown for plugin `%s' complete\n" |
7195 | msgstr "" | 7265 | msgstr "" |
@@ -7232,69 +7302,69 @@ msgstr "" | |||
7232 | msgid "Could not load or create server certificate! Loading plugin failed!\n" | 7302 | msgid "Could not load or create server certificate! Loading plugin failed!\n" |
7233 | msgstr "" | 7303 | msgstr "" |
7234 | 7304 | ||
7235 | #: src/transport/plugin_transport_http_server.c:2583 | 7305 | #: src/transport/plugin_transport_http_server.c:2586 |
7236 | msgid "Require valid port number for service in configuration!\n" | 7306 | msgid "Require valid port number for service in configuration!\n" |
7237 | msgstr "" | 7307 | msgstr "" |
7238 | 7308 | ||
7239 | #: src/transport/plugin_transport_http_server.c:2748 | 7309 | #: src/transport/plugin_transport_http_server.c:2751 |
7240 | #, c-format | 7310 | #, c-format |
7241 | msgid "Found %u addresses to report to NAT service\n" | 7311 | msgid "Found %u addresses to report to NAT service\n" |
7242 | msgstr "" | 7312 | msgstr "" |
7243 | 7313 | ||
7244 | #: src/transport/plugin_transport_http_server.c:2832 | 7314 | #: src/transport/plugin_transport_http_server.c:2837 |
7245 | #: src/transport/plugin_transport_udp.c:3600 | 7315 | #: src/transport/plugin_transport_udp.c:3623 |
7246 | msgid "Disabling IPv6 since it is not supported on this system!\n" | 7316 | msgid "Disabling IPv6 since it is not supported on this system!\n" |
7247 | msgstr "" | 7317 | msgstr "" |
7248 | 7318 | ||
7249 | #: src/transport/plugin_transport_http_server.c:2938 | 7319 | #: src/transport/plugin_transport_http_server.c:2943 |
7250 | #, c-format | 7320 | #, c-format |
7251 | msgid "IPv4 support is %s\n" | 7321 | msgid "IPv4 support is %s\n" |
7252 | msgstr "Prise en charge d’IPv4 %s\n" | 7322 | msgstr "Prise en charge d’IPv4 %s\n" |
7253 | 7323 | ||
7254 | #: src/transport/plugin_transport_http_server.c:2953 | 7324 | #: src/transport/plugin_transport_http_server.c:2958 |
7255 | #, c-format | 7325 | #, c-format |
7256 | msgid "IPv6 support is %s\n" | 7326 | msgid "IPv6 support is %s\n" |
7257 | msgstr "Prise en charge d’IPv6 %s\n" | 7327 | msgstr "Prise en charge d’IPv6 %s\n" |
7258 | 7328 | ||
7259 | #: src/transport/plugin_transport_http_server.c:2959 | 7329 | #: src/transport/plugin_transport_http_server.c:2964 |
7260 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" | 7330 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" |
7261 | msgstr "" | 7331 | msgstr "" |
7262 | 7332 | ||
7263 | #: src/transport/plugin_transport_http_server.c:2970 | 7333 | #: src/transport/plugin_transport_http_server.c:2975 |
7264 | msgid "Port is required! Fix in configuration\n" | 7334 | msgid "Port is required! Fix in configuration\n" |
7265 | msgstr "" | 7335 | msgstr "" |
7266 | 7336 | ||
7267 | #: src/transport/plugin_transport_http_server.c:2976 | 7337 | #: src/transport/plugin_transport_http_server.c:2981 |
7268 | #, c-format | 7338 | #, c-format |
7269 | msgid "Using port %u\n" | 7339 | msgid "Using port %u\n" |
7270 | msgstr "Utilisation du port %u\n" | 7340 | msgstr "Utilisation du port %u\n" |
7271 | 7341 | ||
7272 | #: src/transport/plugin_transport_http_server.c:2995 | 7342 | #: src/transport/plugin_transport_http_server.c:3000 |
7273 | #, c-format | 7343 | #, c-format |
7274 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" | 7344 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" |
7275 | msgstr "" | 7345 | msgstr "" |
7276 | 7346 | ||
7277 | #: src/transport/plugin_transport_http_server.c:3030 | 7347 | #: src/transport/plugin_transport_http_server.c:3035 |
7278 | #, c-format | 7348 | #, c-format |
7279 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" | 7349 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" |
7280 | msgstr "" | 7350 | msgstr "" |
7281 | 7351 | ||
7282 | #: src/transport/plugin_transport_http_server.c:3105 | 7352 | #: src/transport/plugin_transport_http_server.c:3110 |
7283 | #, c-format | 7353 | #, c-format |
7284 | msgid "Using external hostname `%s'\n" | 7354 | msgid "Using external hostname `%s'\n" |
7285 | msgstr "" | 7355 | msgstr "" |
7286 | 7356 | ||
7287 | #: src/transport/plugin_transport_http_server.c:3126 | 7357 | #: src/transport/plugin_transport_http_server.c:3131 |
7288 | #, c-format | 7358 | #, c-format |
7289 | msgid "Notifying transport only about hostname `%s'\n" | 7359 | msgid "Notifying transport only about hostname `%s'\n" |
7290 | msgstr "" | 7360 | msgstr "" |
7291 | 7361 | ||
7292 | #: src/transport/plugin_transport_http_server.c:3143 | 7362 | #: src/transport/plugin_transport_http_server.c:3148 |
7293 | #, c-format | 7363 | #, c-format |
7294 | msgid "Maximum number of connections is %u\n" | 7364 | msgid "Maximum number of connections is %u\n" |
7295 | msgstr "" | 7365 | msgstr "" |
7296 | 7366 | ||
7297 | #: src/transport/plugin_transport_http_server.c:3469 | 7367 | #: src/transport/plugin_transport_http_server.c:3474 |
7298 | msgid "Unable to compile URL regex\n" | 7368 | msgid "Unable to compile URL regex\n" |
7299 | msgstr "" | 7369 | msgstr "" |
7300 | 7370 | ||
@@ -7340,157 +7410,157 @@ msgstr "" | |||
7340 | msgid "# bytes dropped by SMTP (outgoing)" | 7410 | msgid "# bytes dropped by SMTP (outgoing)" |
7341 | msgstr "" | 7411 | msgstr "" |
7342 | 7412 | ||
7343 | #: src/transport/plugin_transport_tcp.c:1051 | 7413 | #: src/transport/plugin_transport_tcp.c:1060 |
7344 | #: src/transport/plugin_transport_tcp.c:2362 | 7414 | #: src/transport/plugin_transport_tcp.c:2379 |
7345 | #, c-format | 7415 | #, c-format |
7346 | msgid "Unexpected address length: %u bytes\n" | 7416 | msgid "Unexpected address length: %u bytes\n" |
7347 | msgstr "" | 7417 | msgstr "" |
7348 | 7418 | ||
7349 | #: src/transport/plugin_transport_tcp.c:1234 | 7419 | #: src/transport/plugin_transport_tcp.c:1243 |
7350 | #: src/transport/plugin_transport_tcp.c:1458 | 7420 | #: src/transport/plugin_transport_tcp.c:1467 |
7351 | #: src/transport/plugin_transport_tcp.c:2633 | 7421 | #: src/transport/plugin_transport_tcp.c:2643 |
7352 | #: src/transport/plugin_transport_tcp.c:3490 | 7422 | #: src/transport/plugin_transport_tcp.c:3498 |
7353 | msgid "# TCP sessions active" | 7423 | msgid "# TCP sessions active" |
7354 | msgstr "# Session TCP active" | 7424 | msgstr "# Session TCP active" |
7355 | 7425 | ||
7356 | #: src/transport/plugin_transport_tcp.c:1276 | 7426 | #: src/transport/plugin_transport_tcp.c:1285 |
7357 | #: src/transport/plugin_transport_tcp.c:1440 | 7427 | #: src/transport/plugin_transport_tcp.c:1449 |
7358 | #: src/transport/plugin_transport_tcp.c:1564 | 7428 | #: src/transport/plugin_transport_tcp.c:1573 |
7359 | #: src/transport/plugin_transport_tcp.c:1637 | 7429 | #: src/transport/plugin_transport_tcp.c:1646 |
7360 | #: src/transport/plugin_transport_tcp.c:1737 | 7430 | #: src/transport/plugin_transport_tcp.c:1746 |
7361 | #: src/transport/plugin_transport_tcp.c:1762 | 7431 | #: src/transport/plugin_transport_tcp.c:1771 |
7362 | msgid "# bytes currently in TCP buffers" | 7432 | msgid "# bytes currently in TCP buffers" |
7363 | msgstr "" | 7433 | msgstr "" |
7364 | 7434 | ||
7365 | #: src/transport/plugin_transport_tcp.c:1279 | 7435 | #: src/transport/plugin_transport_tcp.c:1288 |
7366 | msgid "# bytes discarded by TCP (disconnect)" | 7436 | msgid "# bytes discarded by TCP (disconnect)" |
7367 | msgstr "" | 7437 | msgstr "" |
7368 | 7438 | ||
7369 | #: src/transport/plugin_transport_tcp.c:1567 | 7439 | #: src/transport/plugin_transport_tcp.c:1576 |
7370 | msgid "# bytes discarded by TCP (timeout)" | 7440 | msgid "# bytes discarded by TCP (timeout)" |
7371 | msgstr "" | 7441 | msgstr "" |
7372 | 7442 | ||
7373 | #: src/transport/plugin_transport_tcp.c:1641 | 7443 | #: src/transport/plugin_transport_tcp.c:1650 |
7374 | msgid "# bytes transmitted via TCP" | 7444 | msgid "# bytes transmitted via TCP" |
7375 | msgstr "" | 7445 | msgstr "" |
7376 | 7446 | ||
7377 | #: src/transport/plugin_transport_tcp.c:2032 | 7447 | #: src/transport/plugin_transport_tcp.c:2041 |
7378 | msgid "# requests to create session with invalid address" | 7448 | msgid "# requests to create session with invalid address" |
7379 | msgstr "" | 7449 | msgstr "" |
7380 | 7450 | ||
7381 | #: src/transport/plugin_transport_tcp.c:2200 | 7451 | #: src/transport/plugin_transport_tcp.c:2217 |
7382 | msgid "# transport-service disconnect requests for TCP" | 7452 | msgid "# transport-service disconnect requests for TCP" |
7383 | msgstr "" | 7453 | msgstr "" |
7384 | 7454 | ||
7385 | #: src/transport/plugin_transport_tcp.c:2692 | 7455 | #: src/transport/plugin_transport_tcp.c:2702 |
7386 | msgid "# TCP WELCOME messages received" | 7456 | msgid "# TCP WELCOME messages received" |
7387 | msgstr "" | 7457 | msgstr "" |
7388 | 7458 | ||
7389 | #: src/transport/plugin_transport_tcp.c:2883 | 7459 | #: src/transport/plugin_transport_tcp.c:2893 |
7390 | msgid "# bytes received via TCP" | 7460 | msgid "# bytes received via TCP" |
7391 | msgstr "" | 7461 | msgstr "" |
7392 | 7462 | ||
7393 | #: src/transport/plugin_transport_tcp.c:2934 | 7463 | #: src/transport/plugin_transport_tcp.c:2944 |
7394 | #: src/transport/plugin_transport_tcp.c:2992 | 7464 | #: src/transport/plugin_transport_tcp.c:3002 |
7395 | #, fuzzy | 7465 | #, fuzzy |
7396 | msgid "# TCP server connections active" | 7466 | msgid "# TCP server connections active" |
7397 | msgstr "# Session TCP active" | 7467 | msgstr "# Session TCP active" |
7398 | 7468 | ||
7399 | #: src/transport/plugin_transport_tcp.c:2938 | 7469 | #: src/transport/plugin_transport_tcp.c:2948 |
7400 | msgid "# TCP server connect events" | 7470 | msgid "# TCP server connect events" |
7401 | msgstr "" | 7471 | msgstr "" |
7402 | 7472 | ||
7403 | #: src/transport/plugin_transport_tcp.c:2944 | 7473 | #: src/transport/plugin_transport_tcp.c:2954 |
7404 | msgid "TCP connection limit reached, suspending server\n" | 7474 | msgid "TCP connection limit reached, suspending server\n" |
7405 | msgstr "" | 7475 | msgstr "" |
7406 | 7476 | ||
7407 | #: src/transport/plugin_transport_tcp.c:2946 | 7477 | #: src/transport/plugin_transport_tcp.c:2956 |
7408 | msgid "# TCP service suspended" | 7478 | msgid "# TCP service suspended" |
7409 | msgstr "" | 7479 | msgstr "" |
7410 | 7480 | ||
7411 | #: src/transport/plugin_transport_tcp.c:2986 | 7481 | #: src/transport/plugin_transport_tcp.c:2996 |
7412 | msgid "# TCP service resumed" | 7482 | msgid "# TCP service resumed" |
7413 | msgstr "" | 7483 | msgstr "" |
7414 | 7484 | ||
7415 | #: src/transport/plugin_transport_tcp.c:2996 | 7485 | #: src/transport/plugin_transport_tcp.c:3006 |
7416 | msgid "# network-level TCP disconnect events" | 7486 | msgid "# network-level TCP disconnect events" |
7417 | msgstr "" | 7487 | msgstr "" |
7418 | 7488 | ||
7419 | #: src/transport/plugin_transport_tcp.c:3315 | 7489 | #: src/transport/plugin_transport_tcp.c:3325 |
7420 | msgid "Failed to start service.\n" | 7490 | msgid "Failed to start service.\n" |
7421 | msgstr "" | 7491 | msgstr "" |
7422 | 7492 | ||
7423 | #: src/transport/plugin_transport_tcp.c:3478 | 7493 | #: src/transport/plugin_transport_tcp.c:3486 |
7424 | #, c-format | 7494 | #, c-format |
7425 | msgid "TCP transport listening on port %llu\n" | 7495 | msgid "TCP transport listening on port %llu\n" |
7426 | msgstr "" | 7496 | msgstr "" |
7427 | 7497 | ||
7428 | #: src/transport/plugin_transport_tcp.c:3482 | 7498 | #: src/transport/plugin_transport_tcp.c:3490 |
7429 | msgid "TCP transport not listening on any port (client only)\n" | 7499 | msgid "TCP transport not listening on any port (client only)\n" |
7430 | msgstr "" | 7500 | msgstr "" |
7431 | 7501 | ||
7432 | #: src/transport/plugin_transport_tcp.c:3486 | 7502 | #: src/transport/plugin_transport_tcp.c:3494 |
7433 | #, c-format | 7503 | #, c-format |
7434 | msgid "TCP transport advertises itself as being on port %llu\n" | 7504 | msgid "TCP transport advertises itself as being on port %llu\n" |
7435 | msgstr "" | 7505 | msgstr "" |
7436 | 7506 | ||
7437 | #: src/transport/plugin_transport_udp_broadcasting.c:170 | 7507 | #: src/transport/plugin_transport_udp_broadcasting.c:169 |
7438 | msgid "# Multicast HELLO beacons received via UDP" | 7508 | msgid "# Multicast HELLO beacons received via UDP" |
7439 | msgstr "" | 7509 | msgstr "" |
7440 | 7510 | ||
7441 | #: src/transport/plugin_transport_udp_broadcasting.c:546 | 7511 | #: src/transport/plugin_transport_udp_broadcasting.c:545 |
7442 | msgid "" | 7512 | msgid "" |
7443 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" | 7513 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" |
7444 | msgstr "" | 7514 | msgstr "" |
7445 | 7515 | ||
7446 | #: src/transport/plugin_transport_udp_broadcasting.c:567 | 7516 | #: src/transport/plugin_transport_udp_broadcasting.c:566 |
7447 | #, c-format | 7517 | #, c-format |
7448 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" | 7518 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" |
7449 | msgstr "" | 7519 | msgstr "" |
7450 | 7520 | ||
7451 | #: src/transport/plugin_transport_udp.c:3344 | 7521 | #: src/transport/plugin_transport_udp.c:3367 |
7452 | #, c-format | 7522 | #, c-format |
7453 | msgid "" | 7523 | msgid "" |
7454 | "UDP could not transmit message to `%s': Network seems down, please check " | 7524 | "UDP could not transmit message to `%s': Network seems down, please check " |
7455 | "your network configuration\n" | 7525 | "your network configuration\n" |
7456 | msgstr "" | 7526 | msgstr "" |
7457 | 7527 | ||
7458 | #: src/transport/plugin_transport_udp.c:3358 | 7528 | #: src/transport/plugin_transport_udp.c:3381 |
7459 | msgid "" | 7529 | msgid "" |
7460 | "UDP could not transmit IPv6 message! Please check your network configuration " | 7530 | "UDP could not transmit IPv6 message! Please check your network configuration " |
7461 | "and disable IPv6 if your connection does not have a global IPv6 address\n" | 7531 | "and disable IPv6 if your connection does not have a global IPv6 address\n" |
7462 | msgstr "" | 7532 | msgstr "" |
7463 | 7533 | ||
7464 | #: src/transport/plugin_transport_udp.c:3676 | 7534 | #: src/transport/plugin_transport_udp.c:3699 |
7465 | #: src/transport/plugin_transport_udp.c:3775 | 7535 | #: src/transport/plugin_transport_udp.c:3798 |
7466 | #, fuzzy, c-format | 7536 | #, fuzzy, c-format |
7467 | msgid "Failed to bind UDP socket to %s: %s\n" | 7537 | msgid "Failed to bind UDP socket to %s: %s\n" |
7468 | msgstr "Résolution de « %s » échouée : %s\n" | 7538 | msgstr "Résolution de « %s » échouée : %s\n" |
7469 | 7539 | ||
7470 | #: src/transport/plugin_transport_udp.c:3694 | 7540 | #: src/transport/plugin_transport_udp.c:3717 |
7471 | msgid "Disabling IPv4 since it is not supported on this system!\n" | 7541 | msgid "Disabling IPv4 since it is not supported on this system!\n" |
7472 | msgstr "" | 7542 | msgstr "" |
7473 | 7543 | ||
7474 | #: src/transport/plugin_transport_udp.c:3785 | 7544 | #: src/transport/plugin_transport_udp.c:3808 |
7475 | msgid "Failed to open UDP sockets\n" | 7545 | msgid "Failed to open UDP sockets\n" |
7476 | msgstr "" | 7546 | msgstr "" |
7477 | 7547 | ||
7478 | #: src/transport/plugin_transport_udp.c:3857 | 7548 | #: src/transport/plugin_transport_udp.c:3879 |
7479 | #: src/transport/plugin_transport_udp.c:3871 | 7549 | #: src/transport/plugin_transport_udp.c:3893 |
7480 | msgid "must be in [0,65535]" | 7550 | msgid "must be in [0,65535]" |
7481 | msgstr "" | 7551 | msgstr "" |
7482 | 7552 | ||
7483 | #: src/transport/plugin_transport_udp.c:3903 | 7553 | #: src/transport/plugin_transport_udp.c:3925 |
7484 | #, fuzzy | 7554 | #, fuzzy |
7485 | msgid "must be valid IPv4 address" | 7555 | msgid "must be valid IPv4 address" |
7486 | msgstr "adresse invalide" | 7556 | msgstr "adresse invalide" |
7487 | 7557 | ||
7488 | #: src/transport/plugin_transport_udp.c:3930 | 7558 | #: src/transport/plugin_transport_udp.c:3952 |
7489 | #, fuzzy | 7559 | #, fuzzy |
7490 | msgid "must be valid IPv6 address" | 7560 | msgid "must be valid IPv6 address" |
7491 | msgstr "adresse invalide" | 7561 | msgstr "adresse invalide" |
7492 | 7562 | ||
7493 | #: src/transport/plugin_transport_udp.c:3996 | 7563 | #: src/transport/plugin_transport_udp.c:4018 |
7494 | msgid "Failed to create UDP network sockets\n" | 7564 | msgid "Failed to create UDP network sockets\n" |
7495 | msgstr "" | 7565 | msgstr "" |
7496 | 7566 | ||
@@ -7600,7 +7670,7 @@ msgstr "" | |||
7600 | msgid "Metadata `%s' failed to deserialize" | 7670 | msgid "Metadata `%s' failed to deserialize" |
7601 | msgstr "" | 7671 | msgstr "" |
7602 | 7672 | ||
7603 | #: src/util/client_new.c:864 | 7673 | #: src/util/client.c:864 |
7604 | #, c-format | 7674 | #, c-format |
7605 | msgid "Need a non-empty hostname for service `%s'.\n" | 7675 | msgid "Need a non-empty hostname for service `%s'.\n" |
7606 | msgstr "" | 7676 | msgstr "" |
@@ -8360,42 +8430,42 @@ msgstr "" | |||
8360 | msgid "Invalid IPv6 address `%s': %s\n" | 8430 | msgid "Invalid IPv6 address `%s': %s\n" |
8361 | msgstr "" | 8431 | msgstr "" |
8362 | 8432 | ||
8363 | #: src/util/strings.c:1475 src/util/strings.c:1491 | 8433 | #: src/util/strings.c:1541 src/util/strings.c:1557 |
8364 | msgid "Port not in range\n" | 8434 | msgid "Port not in range\n" |
8365 | msgstr "" | 8435 | msgstr "" |
8366 | 8436 | ||
8367 | #: src/util/strings.c:1500 | 8437 | #: src/util/strings.c:1566 |
8368 | #, c-format | 8438 | #, c-format |
8369 | msgid "Malformed port policy `%s'\n" | 8439 | msgid "Malformed port policy `%s'\n" |
8370 | msgstr "" | 8440 | msgstr "" |
8371 | 8441 | ||
8372 | #: src/util/strings.c:1583 src/util/strings.c:1614 src/util/strings.c:1662 | 8442 | #: src/util/strings.c:1649 src/util/strings.c:1680 src/util/strings.c:1728 |
8373 | #: src/util/strings.c:1683 | 8443 | #: src/util/strings.c:1749 |
8374 | #, c-format | 8444 | #, c-format |
8375 | msgid "Invalid format for IP: `%s'\n" | 8445 | msgid "Invalid format for IP: `%s'\n" |
8376 | msgstr "" | 8446 | msgstr "" |
8377 | 8447 | ||
8378 | #: src/util/strings.c:1640 | 8448 | #: src/util/strings.c:1706 |
8379 | #, c-format | 8449 | #, c-format |
8380 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." | 8450 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." |
8381 | msgstr "" | 8451 | msgstr "" |
8382 | 8452 | ||
8383 | #: src/util/strings.c:1692 | 8453 | #: src/util/strings.c:1758 |
8384 | #, c-format | 8454 | #, c-format |
8385 | msgid "Invalid format: `%s'\n" | 8455 | msgid "Invalid format: `%s'\n" |
8386 | msgstr "fornat invalide : « %s »\n" | 8456 | msgstr "fornat invalide : « %s »\n" |
8387 | 8457 | ||
8388 | #: src/util/strings.c:1744 | 8458 | #: src/util/strings.c:1810 |
8389 | #, c-format | 8459 | #, c-format |
8390 | msgid "Invalid network notation (does not end with ';': `%s')\n" | 8460 | msgid "Invalid network notation (does not end with ';': `%s')\n" |
8391 | msgstr "" | 8461 | msgstr "" |
8392 | 8462 | ||
8393 | #: src/util/strings.c:1794 | 8463 | #: src/util/strings.c:1860 |
8394 | #, c-format | 8464 | #, c-format |
8395 | msgid "Wrong format `%s' for netmask\n" | 8465 | msgid "Wrong format `%s' for netmask\n" |
8396 | msgstr "" | 8466 | msgstr "" |
8397 | 8467 | ||
8398 | #: src/util/strings.c:1825 | 8468 | #: src/util/strings.c:1891 |
8399 | #, c-format | 8469 | #, c-format |
8400 | msgid "Wrong format `%s' for network\n" | 8470 | msgid "Wrong format `%s' for network\n" |
8401 | msgstr "" | 8471 | msgstr "" |
@@ -8569,21 +8639,28 @@ msgid "Setup tunnels via VPN." | |||
8569 | msgstr "Configurer des tunnels via VPN." | 8639 | msgstr "Configurer des tunnels via VPN." |
8570 | 8640 | ||
8571 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 | 8641 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 |
8572 | #: src/include/gnunet_common.h:660 | 8642 | #: src/include/gnunet_common.h:662 src/include/gnunet_common.h:670 |
8573 | #, c-format | 8643 | #, c-format |
8574 | msgid "Assertion failed at %s:%d.\n" | 8644 | msgid "Assertion failed at %s:%d.\n" |
8575 | msgstr "" | 8645 | msgstr "" |
8576 | 8646 | ||
8577 | #: src/include/gnunet_common.h:672 | 8647 | #: src/include/gnunet_common.h:682 |
8578 | #, c-format | 8648 | #, c-format |
8579 | msgid "External protocol violation detected at %s:%d.\n" | 8649 | msgid "External protocol violation detected at %s:%d.\n" |
8580 | msgstr "" | 8650 | msgstr "" |
8581 | 8651 | ||
8582 | #: src/include/gnunet_common.h:699 src/include/gnunet_common.h:708 | 8652 | #: src/include/gnunet_common.h:709 src/include/gnunet_common.h:718 |
8583 | #, c-format | 8653 | #, c-format |
8584 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" | 8654 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" |
8585 | msgstr "" | 8655 | msgstr "" |
8586 | 8656 | ||
8657 | #~ msgid "malformed" | ||
8658 | #~ msgstr "malformé" | ||
8659 | |||
8660 | #, fuzzy | ||
8661 | #~ msgid "Failed to start resolver!\n" | ||
8662 | #~ msgstr "Échec du démarrage de %s\n" | ||
8663 | |||
8587 | #, fuzzy | 8664 | #, fuzzy |
8588 | #~ msgid "Failed to start NAT test for plugin `%s'\n" | 8665 | #~ msgid "Failed to start NAT test for plugin `%s'\n" |
8589 | #~ msgstr "Résolution de « %s » échouée\n" | 8666 | #~ msgstr "Résolution de « %s » échouée\n" |
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
8 | "Project-Id-Version: GNUnet 0.7.0b\n" | 8 | "Project-Id-Version: GNUnet 0.7.0b\n" |
9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
10 | "POT-Creation-Date: 2016-11-27 09:18+0100\n" | 10 | "POT-Creation-Date: 2017-01-12 17:19+0100\n" |
11 | "PO-Revision-Date: 2006-01-21 17:16+0100\n" | 11 | "PO-Revision-Date: 2006-01-21 17:16+0100\n" |
12 | "Last-Translator: Daniel Nylander <po@danielnylander.se>\n" | 12 | "Last-Translator: Daniel Nylander <po@danielnylander.se>\n" |
13 | "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" | 13 | "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" |
@@ -251,21 +251,20 @@ msgstr "" | |||
251 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 | 251 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 |
252 | #: src/transport/plugin_transport_tcp.c:652 | 252 | #: src/transport/plugin_transport_tcp.c:652 |
253 | #: src/transport/plugin_transport_tcp.c:658 | 253 | #: src/transport/plugin_transport_tcp.c:658 |
254 | #: src/transport/plugin_transport_tcp.c:3299 src/util/service.c:584 | 254 | #: src/transport/plugin_transport_tcp.c:3309 src/util/service.c:584 |
255 | #: src/util/service.c:590 src/util/service_new.c:637 | 255 | #: src/util/service.c:590 src/util/service_new.c:637 src/util/service_new.c:643 |
256 | #: src/util/service_new.c:643 | ||
257 | #, c-format | 256 | #, c-format |
258 | msgid "Require valid port number for service `%s' in configuration!\n" | 257 | msgid "Require valid port number for service `%s' in configuration!\n" |
259 | msgstr "" | 258 | msgstr "" |
260 | 259 | ||
261 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 | 260 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 |
262 | #: src/util/client_new.c:464 src/util/service.c:621 src/util/service_new.c:682 | 261 | #: src/util/client.c:464 src/util/service.c:621 src/util/service_new.c:682 |
263 | #, c-format | 262 | #, c-format |
264 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 263 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
265 | msgstr "" | 264 | msgstr "" |
266 | 265 | ||
267 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 | 266 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 |
268 | #: src/util/client_new.c:469 src/util/service.c:625 src/util/service_new.c:687 | 267 | #: src/util/client.c:469 src/util/service.c:625 src/util/service_new.c:687 |
269 | #, fuzzy, c-format | 268 | #, fuzzy, c-format |
270 | msgid "Using `%s' instead\n" | 269 | msgid "Using `%s' instead\n" |
271 | msgstr "%s: flagga \"%s\" är tvetydig\n" | 270 | msgstr "%s: flagga \"%s\" är tvetydig\n" |
@@ -285,7 +284,7 @@ msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | |||
285 | msgstr "" | 284 | msgstr "" |
286 | 285 | ||
287 | #: src/arm/gnunet-service-arm.c:513 | 286 | #: src/arm/gnunet-service-arm.c:513 |
288 | #: src/transport/plugin_transport_http_server.c:2617 | 287 | #: src/transport/plugin_transport_http_server.c:2620 |
289 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 | 288 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 |
290 | #: src/util/service_new.c:782 | 289 | #: src/util/service_new.c:782 |
291 | #, fuzzy, c-format | 290 | #, fuzzy, c-format |
@@ -293,7 +292,7 @@ msgid "Failed to resolve `%s': %s\n" | |||
293 | msgstr "Misslyckades att leverera \"%s\" meddelande.\n" | 292 | msgstr "Misslyckades att leverera \"%s\" meddelande.\n" |
294 | 293 | ||
295 | #: src/arm/gnunet-service-arm.c:532 | 294 | #: src/arm/gnunet-service-arm.c:532 |
296 | #: src/transport/plugin_transport_http_server.c:2635 | 295 | #: src/transport/plugin_transport_http_server.c:2638 |
297 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 | 296 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 |
298 | #: src/util/service_new.c:802 | 297 | #: src/util/service_new.c:802 |
299 | #, fuzzy, c-format | 298 | #, fuzzy, c-format |
@@ -388,13 +387,11 @@ msgid "" | |||
388 | "%llu\n" | 387 | "%llu\n" |
389 | msgstr "" | 388 | msgstr "" |
390 | 389 | ||
391 | #: src/ats/gnunet-ats-solver-eval.c:3293 | 390 | #: src/ats/gnunet-ats-solver-eval.c:3293 src/ats-tests/gnunet-solver-eval.c:935 |
392 | #: src/ats-tests/gnunet-solver-eval.c:935 | ||
393 | msgid "solver to use" | 391 | msgid "solver to use" |
394 | msgstr "" | 392 | msgstr "" |
395 | 393 | ||
396 | #: src/ats/gnunet-ats-solver-eval.c:3296 | 394 | #: src/ats/gnunet-ats-solver-eval.c:3296 src/ats-tests/gnunet-solver-eval.c:938 |
397 | #: src/ats-tests/gnunet-solver-eval.c:938 | ||
398 | #: src/ats-tests/gnunet-solver-eval.c:941 | 395 | #: src/ats-tests/gnunet-solver-eval.c:941 |
399 | msgid "experiment to use" | 396 | msgid "experiment to use" |
400 | msgstr "" | 397 | msgstr "" |
@@ -500,12 +497,12 @@ msgstr "" | |||
500 | msgid "Invalid %s configuration %f\n" | 497 | msgid "Invalid %s configuration %f\n" |
501 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 498 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
502 | 499 | ||
503 | #: src/ats-tests/ats-testing.c:441 | 500 | #: src/ats-tests/ats-testing.c:422 |
504 | #, c-format | 501 | #, c-format |
505 | msgid "Connected master [%u] with slave [%u]\n" | 502 | msgid "Connected master [%u] with slave [%u]\n" |
506 | msgstr "" | 503 | msgstr "" |
507 | 504 | ||
508 | #: src/ats-tests/ats-testing.c:448 | 505 | #: src/ats-tests/ats-testing.c:429 |
509 | #, fuzzy, c-format | 506 | #, fuzzy, c-format |
510 | msgid "Failed to connect master peer [%u] with slave [%u]\n" | 507 | msgid "Failed to connect master peer [%u] with slave [%u]\n" |
511 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 508 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
@@ -562,7 +559,7 @@ msgid "Quota for network `%11s' (in/out): %10s / %10s\n" | |||
562 | msgstr "" | 559 | msgstr "" |
563 | 560 | ||
564 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 | 561 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 |
565 | #: src/transport/gnunet-transport.c:1476 | 562 | #: src/transport/gnunet-transport.c:1255 |
566 | #, fuzzy, c-format | 563 | #, fuzzy, c-format |
567 | msgid "Failed to parse peer identity `%s'\n" | 564 | msgid "Failed to parse peer identity `%s'\n" |
568 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 565 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
@@ -648,6 +645,38 @@ msgstr "" | |||
648 | msgid "Print information about ATS state" | 645 | msgid "Print information about ATS state" |
649 | msgstr "Skriv ut information om GNUnets motparter." | 646 | msgstr "Skriv ut information om GNUnets motparter." |
650 | 647 | ||
648 | #: src/auction/gnunet-auction-create.c:69 | ||
649 | msgid "description of the item to be sold" | ||
650 | msgstr "" | ||
651 | |||
652 | #: src/auction/gnunet-auction-create.c:72 | ||
653 | msgid "mapping of possible prices" | ||
654 | msgstr "" | ||
655 | |||
656 | #: src/auction/gnunet-auction-create.c:75 | ||
657 | msgid "max duration per round" | ||
658 | msgstr "" | ||
659 | |||
660 | #: src/auction/gnunet-auction-create.c:78 | ||
661 | msgid "duration until auction starts" | ||
662 | msgstr "" | ||
663 | |||
664 | #: src/auction/gnunet-auction-create.c:81 | ||
665 | msgid "number of items to sell, 0 for first price auction" | ||
666 | msgstr "" | ||
667 | |||
668 | #: src/auction/gnunet-auction-create.c:84 | ||
669 | msgid "public auction outcome" | ||
670 | msgstr "" | ||
671 | |||
672 | #: src/auction/gnunet-auction-create.c:94 src/auction/gnunet-auction-info.c:76 | ||
673 | #: src/auction/gnunet-auction-join.c:76 | ||
674 | #: src/conversation/gnunet-conversation-test.c:243 | ||
675 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
676 | #, fuzzy | ||
677 | msgid "help text" | ||
678 | msgstr "hjälptext för -t" | ||
679 | |||
651 | #: src/cadet/gnunet-cadet.c:511 | 680 | #: src/cadet/gnunet-cadet.c:511 |
652 | #, fuzzy, c-format | 681 | #, fuzzy, c-format |
653 | msgid "Invalid target `%s'\n" | 682 | msgid "Invalid target `%s'\n" |
@@ -704,7 +733,7 @@ msgstr "Skriv ut information om GNUnets motparter." | |||
704 | msgid "provide information about all tunnels" | 733 | msgid "provide information about all tunnels" |
705 | msgstr "Skriv ut information om GNUnets motparter." | 734 | msgstr "Skriv ut information om GNUnets motparter." |
706 | 735 | ||
707 | #: src/cadet/gnunet-service-cadet_peer.c:681 | 736 | #: src/cadet/gnunet-service-cadet_peer.c:686 |
708 | msgid "Wrong CORE service\n" | 737 | msgid "Wrong CORE service\n" |
709 | msgstr "" | 738 | msgstr "" |
710 | 739 | ||
@@ -1029,12 +1058,6 @@ msgid "" | |||
1029 | "played back to you..." | 1058 | "played back to you..." |
1030 | msgstr "" | 1059 | msgstr "" |
1031 | 1060 | ||
1032 | #: src/conversation/gnunet-conversation-test.c:243 | ||
1033 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
1034 | #, fuzzy | ||
1035 | msgid "help text" | ||
1036 | msgstr "hjälptext för -t" | ||
1037 | |||
1038 | #: src/conversation/gnunet_gst.c:630 | 1061 | #: src/conversation/gnunet_gst.c:630 |
1039 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 | 1062 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 |
1040 | #, c-format | 1063 | #, c-format |
@@ -1241,7 +1264,7 @@ msgstr "Ogiltiga kommandoradsargument:\n" | |||
1241 | msgid "Failed to connect to CORE service!\n" | 1264 | msgid "Failed to connect to CORE service!\n" |
1242 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 1265 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
1243 | 1266 | ||
1244 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1677 | 1267 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1456 |
1245 | #, fuzzy | 1268 | #, fuzzy |
1246 | msgid "provide information about all current connections (continuously)" | 1269 | msgid "provide information about all current connections (continuously)" |
1247 | msgstr "Skriv ut information om GNUnets motparter." | 1270 | msgstr "Skriv ut information om GNUnets motparter." |
@@ -1523,7 +1546,7 @@ msgstr "" | |||
1523 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 | 1546 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 |
1524 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 | 1547 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 |
1525 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 | 1548 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 |
1526 | #: src/include/gnunet_common.h:681 src/include/gnunet_common.h:690 | 1549 | #: src/include/gnunet_common.h:691 src/include/gnunet_common.h:700 |
1527 | #: src/scalarproduct/scalarproduct.h:35 | 1550 | #: src/scalarproduct/scalarproduct.h:35 |
1528 | #, c-format | 1551 | #, c-format |
1529 | msgid "`%s' failed at %s:%d with error: %s\n" | 1552 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -1923,8 +1946,7 @@ msgstr "" | |||
1923 | msgid "Prints all packets that go through the DHT." | 1946 | msgid "Prints all packets that go through the DHT." |
1924 | msgstr "" | 1947 | msgstr "" |
1925 | 1948 | ||
1926 | #: src/dht/gnunet_dht_profiler.c:1161 | 1949 | #: src/dht/gnunet_dht_profiler.c:1161 src/testbed/gnunet-testbed-profiler.c:255 |
1927 | #: src/testbed/gnunet-testbed-profiler.c:255 | ||
1928 | #, fuzzy, c-format | 1950 | #, fuzzy, c-format |
1929 | msgid "Exiting as the number of peers is %u\n" | 1951 | msgid "Exiting as the number of peers is %u\n" |
1930 | msgstr "Maximalt antal chattklienter uppnått.\n" | 1952 | msgstr "Maximalt antal chattklienter uppnått.\n" |
@@ -2109,8 +2131,7 @@ msgstr "" | |||
2109 | msgid "# GET requests given to datacache" | 2131 | msgid "# GET requests given to datacache" |
2110 | msgstr "# byte mottogs via TCP" | 2132 | msgstr "# byte mottogs via TCP" |
2111 | 2133 | ||
2112 | #: src/dht/gnunet-service-dht_hello.c:84 | 2134 | #: src/dht/gnunet-service-dht_hello.c:84 src/dht/gnunet-service-xdht_hello.c:82 |
2113 | #: src/dht/gnunet-service-xdht_hello.c:82 | ||
2114 | #, fuzzy | 2135 | #, fuzzy |
2115 | msgid "# HELLOs obtained from peerinfo" | 2136 | msgid "# HELLOs obtained from peerinfo" |
2116 | msgstr "Meddelande mottaget från klient är ogiltig.\n" | 2137 | msgstr "Meddelande mottaget från klient är ogiltig.\n" |
@@ -2186,40 +2207,40 @@ msgstr "# byte mottogs via TCP" | |||
2186 | msgid "# P2P PUT bytes received" | 2207 | msgid "# P2P PUT bytes received" |
2187 | msgstr "# byte mottogs via TCP" | 2208 | msgstr "# byte mottogs via TCP" |
2188 | 2209 | ||
2189 | #: src/dht/gnunet-service-dht_neighbours.c:1854 | 2210 | #: src/dht/gnunet-service-dht_neighbours.c:1858 |
2190 | msgid "# FIND PEER requests ignored due to Bloomfilter" | 2211 | msgid "# FIND PEER requests ignored due to Bloomfilter" |
2191 | msgstr "" | 2212 | msgstr "" |
2192 | 2213 | ||
2193 | #: src/dht/gnunet-service-dht_neighbours.c:1862 | 2214 | #: src/dht/gnunet-service-dht_neighbours.c:1866 |
2194 | msgid "# FIND PEER requests ignored due to lack of HELLO" | 2215 | msgid "# FIND PEER requests ignored due to lack of HELLO" |
2195 | msgstr "" | 2216 | msgstr "" |
2196 | 2217 | ||
2197 | #: src/dht/gnunet-service-dht_neighbours.c:2018 | 2218 | #: src/dht/gnunet-service-dht_neighbours.c:2022 |
2198 | #, fuzzy | 2219 | #, fuzzy |
2199 | msgid "# P2P GET requests received" | 2220 | msgid "# P2P GET requests received" |
2200 | msgstr "# byte mottogs via TCP" | 2221 | msgstr "# byte mottogs via TCP" |
2201 | 2222 | ||
2202 | #: src/dht/gnunet-service-dht_neighbours.c:2022 | 2223 | #: src/dht/gnunet-service-dht_neighbours.c:2026 |
2203 | #, fuzzy | 2224 | #, fuzzy |
2204 | msgid "# P2P GET bytes received" | 2225 | msgid "# P2P GET bytes received" |
2205 | msgstr "# byte mottogs via TCP" | 2226 | msgstr "# byte mottogs via TCP" |
2206 | 2227 | ||
2207 | #: src/dht/gnunet-service-dht_neighbours.c:2097 | 2228 | #: src/dht/gnunet-service-dht_neighbours.c:2101 |
2208 | #, fuzzy | 2229 | #, fuzzy |
2209 | msgid "# P2P FIND PEER requests processed" | 2230 | msgid "# P2P FIND PEER requests processed" |
2210 | msgstr "# byte mottogs via TCP" | 2231 | msgstr "# byte mottogs via TCP" |
2211 | 2232 | ||
2212 | #: src/dht/gnunet-service-dht_neighbours.c:2120 | 2233 | #: src/dht/gnunet-service-dht_neighbours.c:2124 |
2213 | #, fuzzy | 2234 | #, fuzzy |
2214 | msgid "# P2P GET requests ONLY routed" | 2235 | msgid "# P2P GET requests ONLY routed" |
2215 | msgstr "# byte mottogs via TCP" | 2236 | msgstr "# byte mottogs via TCP" |
2216 | 2237 | ||
2217 | #: src/dht/gnunet-service-dht_neighbours.c:2222 | 2238 | #: src/dht/gnunet-service-dht_neighbours.c:2226 |
2218 | #, fuzzy | 2239 | #, fuzzy |
2219 | msgid "# P2P RESULTS received" | 2240 | msgid "# P2P RESULTS received" |
2220 | msgstr "# krypterade PONG-meddelanden mottagna" | 2241 | msgstr "# krypterade PONG-meddelanden mottagna" |
2221 | 2242 | ||
2222 | #: src/dht/gnunet-service-dht_neighbours.c:2226 | 2243 | #: src/dht/gnunet-service-dht_neighbours.c:2230 |
2223 | #, fuzzy | 2244 | #, fuzzy |
2224 | msgid "# P2P RESULT bytes received" | 2245 | msgid "# P2P RESULT bytes received" |
2225 | msgstr "# krypterade PONG-meddelanden mottagna" | 2246 | msgstr "# krypterade PONG-meddelanden mottagna" |
@@ -2229,35 +2250,35 @@ msgstr "# krypterade PONG-meddelanden mottagna" | |||
2229 | msgid "# Network size estimates received" | 2250 | msgid "# Network size estimates received" |
2230 | msgstr "# byte mottogs via TCP" | 2251 | msgstr "# byte mottogs via TCP" |
2231 | 2252 | ||
2232 | #: src/dht/gnunet-service-dht_routing.c:218 | 2253 | #: src/dht/gnunet-service-dht_routing.c:220 |
2233 | msgid "# Good REPLIES matched against routing table" | 2254 | msgid "# Good REPLIES matched against routing table" |
2234 | msgstr "" | 2255 | msgstr "" |
2235 | 2256 | ||
2236 | #: src/dht/gnunet-service-dht_routing.c:227 | 2257 | #: src/dht/gnunet-service-dht_routing.c:229 |
2237 | msgid "# Duplicate REPLIES matched against routing table" | 2258 | msgid "# Duplicate REPLIES matched against routing table" |
2238 | msgstr "" | 2259 | msgstr "" |
2239 | 2260 | ||
2240 | #: src/dht/gnunet-service-dht_routing.c:233 | 2261 | #: src/dht/gnunet-service-dht_routing.c:235 |
2241 | msgid "# Invalid REPLIES matched against routing table" | 2262 | msgid "# Invalid REPLIES matched against routing table" |
2242 | msgstr "" | 2263 | msgstr "" |
2243 | 2264 | ||
2244 | #: src/dht/gnunet-service-dht_routing.c:239 | 2265 | #: src/dht/gnunet-service-dht_routing.c:241 |
2245 | msgid "# Irrelevant REPLIES matched against routing table" | 2266 | msgid "# Irrelevant REPLIES matched against routing table" |
2246 | msgstr "" | 2267 | msgstr "" |
2247 | 2268 | ||
2248 | #: src/dht/gnunet-service-dht_routing.c:251 | 2269 | #: src/dht/gnunet-service-dht_routing.c:253 |
2249 | msgid "# Unsupported REPLIES matched against routing table" | 2270 | msgid "# Unsupported REPLIES matched against routing table" |
2250 | msgstr "" | 2271 | msgstr "" |
2251 | 2272 | ||
2252 | #: src/dht/gnunet-service-dht_routing.c:327 | 2273 | #: src/dht/gnunet-service-dht_routing.c:329 |
2253 | msgid "# Entries removed from routing table" | 2274 | msgid "# Entries removed from routing table" |
2254 | msgstr "" | 2275 | msgstr "" |
2255 | 2276 | ||
2256 | #: src/dht/gnunet-service-dht_routing.c:409 | 2277 | #: src/dht/gnunet-service-dht_routing.c:411 |
2257 | msgid "# Entries added to routing table" | 2278 | msgid "# Entries added to routing table" |
2258 | msgstr "" | 2279 | msgstr "" |
2259 | 2280 | ||
2260 | #: src/dht/gnunet-service-dht_routing.c:427 | 2281 | #: src/dht/gnunet-service-dht_routing.c:429 |
2261 | #, fuzzy | 2282 | #, fuzzy |
2262 | msgid "# DHT requests combined" | 2283 | msgid "# DHT requests combined" |
2263 | msgstr "# byte mottogs via TCP" | 2284 | msgstr "# byte mottogs via TCP" |
@@ -2371,16 +2392,16 @@ msgid "" | |||
2371 | "SUPU %s, %s, %d, trail->prev_hop = %s" | 2392 | "SUPU %s, %s, %d, trail->prev_hop = %s" |
2372 | msgstr "" | 2393 | msgstr "" |
2373 | 2394 | ||
2374 | #: src/dht/plugin_block_dht.c:142 | 2395 | #: src/dht/plugin_block_dht.c:144 |
2375 | #, fuzzy, c-format | 2396 | #, fuzzy, c-format |
2376 | msgid "Block not of type %u\n" | 2397 | msgid "Block not of type %u\n" |
2377 | msgstr "Ingen transport av typ %d är känd.\n" | 2398 | msgstr "Ingen transport av typ %d är känd.\n" |
2378 | 2399 | ||
2379 | #: src/dht/plugin_block_dht.c:149 | 2400 | #: src/dht/plugin_block_dht.c:151 |
2380 | msgid "Size mismatch for block\n" | 2401 | msgid "Size mismatch for block\n" |
2381 | msgstr "" | 2402 | msgstr "" |
2382 | 2403 | ||
2383 | #: src/dht/plugin_block_dht.c:159 | 2404 | #: src/dht/plugin_block_dht.c:161 |
2384 | #, c-format | 2405 | #, c-format |
2385 | msgid "Block of type %u is malformed\n" | 2406 | msgid "Block of type %u is malformed\n" |
2386 | msgstr "" | 2407 | msgstr "" |
@@ -3515,7 +3536,7 @@ msgid "Option `%s' is required when using option `%s'.\n" | |||
3515 | msgstr "Kommando \"%s\" kräver ett argument (\"%s\").\n" | 3536 | msgstr "Kommando \"%s\" kräver ett argument (\"%s\").\n" |
3516 | 3537 | ||
3517 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 | 3538 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 |
3518 | #: src/transport/gnunet-transport.c:1517 src/transport/gnunet-transport.c:1542 | 3539 | #: src/transport/gnunet-transport.c:1296 src/transport/gnunet-transport.c:1321 |
3519 | #, c-format | 3540 | #, c-format |
3520 | msgid "Option `%s' makes no sense without option `%s'.\n" | 3541 | msgid "Option `%s' makes no sense without option `%s'.\n" |
3521 | msgstr "" | 3542 | msgstr "" |
@@ -4034,41 +4055,41 @@ msgstr "Mottog ogiltig \"%s\" begäran (storlek %d)\n" | |||
4034 | msgid "Received unsupported DNS request from %s\n" | 4055 | msgid "Received unsupported DNS request from %s\n" |
4035 | msgstr "Mottog okänd typ av begäran %d vid %s:%d\n" | 4056 | msgstr "Mottog okänd typ av begäran %d vid %s:%d\n" |
4036 | 4057 | ||
4037 | #: src/gns/gnunet-dns2gns.c:709 | 4058 | #: src/gns/gnunet-dns2gns.c:712 |
4038 | msgid "No ego configured for `dns2gns` subsystem\n" | 4059 | msgid "No ego configured for `dns2gns` subsystem\n" |
4039 | msgstr "" | 4060 | msgstr "" |
4040 | 4061 | ||
4041 | #: src/gns/gnunet-dns2gns.c:737 | 4062 | #: src/gns/gnunet-dns2gns.c:740 |
4042 | #, fuzzy | 4063 | #, fuzzy |
4043 | msgid "No DNS server specified!\n" | 4064 | msgid "No DNS server specified!\n" |
4044 | msgstr "Inga nyckelord angivna!\n" | 4065 | msgstr "Inga nyckelord angivna!\n" |
4045 | 4066 | ||
4046 | #: src/gns/gnunet-dns2gns.c:758 | 4067 | #: src/gns/gnunet-dns2gns.c:761 |
4047 | #, fuzzy | 4068 | #, fuzzy |
4048 | msgid "No valid GNS zone specified!\n" | 4069 | msgid "No valid GNS zone specified!\n" |
4049 | msgstr "Inga nyckelord angivna!\n" | 4070 | msgstr "Inga nyckelord angivna!\n" |
4050 | 4071 | ||
4051 | #: src/gns/gnunet-dns2gns.c:779 | 4072 | #: src/gns/gnunet-dns2gns.c:782 |
4052 | msgid "IP of recursive DNS resolver to use (required)" | 4073 | msgid "IP of recursive DNS resolver to use (required)" |
4053 | msgstr "" | 4074 | msgstr "" |
4054 | 4075 | ||
4055 | #: src/gns/gnunet-dns2gns.c:782 | 4076 | #: src/gns/gnunet-dns2gns.c:785 |
4056 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" | 4077 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" |
4057 | msgstr "" | 4078 | msgstr "" |
4058 | 4079 | ||
4059 | #: src/gns/gnunet-dns2gns.c:785 | 4080 | #: src/gns/gnunet-dns2gns.c:788 |
4060 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" | 4081 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" |
4061 | msgstr "" | 4082 | msgstr "" |
4062 | 4083 | ||
4063 | #: src/gns/gnunet-dns2gns.c:788 | 4084 | #: src/gns/gnunet-dns2gns.c:791 |
4064 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4085 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4065 | msgstr "" | 4086 | msgstr "" |
4066 | 4087 | ||
4067 | #: src/gns/gnunet-dns2gns.c:791 | 4088 | #: src/gns/gnunet-dns2gns.c:794 |
4068 | msgid "Public key of the GNS zone to use (overrides default)" | 4089 | msgid "Public key of the GNS zone to use (overrides default)" |
4069 | msgstr "" | 4090 | msgstr "" |
4070 | 4091 | ||
4071 | #: src/gns/gnunet-dns2gns.c:804 | 4092 | #: src/gns/gnunet-dns2gns.c:807 |
4072 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4093 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4073 | msgstr "" | 4094 | msgstr "" |
4074 | 4095 | ||
@@ -4233,83 +4254,85 @@ msgstr "" | |||
4233 | msgid "Unsupported HTTP method `%s'\n" | 4254 | msgid "Unsupported HTTP method `%s'\n" |
4234 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" | 4255 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" |
4235 | 4256 | ||
4236 | #: src/gns/gnunet-gns-proxy.c:2167 | 4257 | #: src/gns/gnunet-gns-proxy.c:2168 |
4237 | #, fuzzy, c-format | 4258 | #, fuzzy, c-format |
4238 | msgid "Unable to import private key from file `%s'\n" | 4259 | msgid "Unable to import private key from file `%s'\n" |
4239 | msgstr "Kunde inte skapa användarkonto:" | 4260 | msgstr "Kunde inte skapa användarkonto:" |
4240 | 4261 | ||
4241 | #: src/gns/gnunet-gns-proxy.c:2197 | 4262 | #: src/gns/gnunet-gns-proxy.c:2198 |
4242 | #, fuzzy, c-format | 4263 | #, fuzzy, c-format |
4243 | msgid "Unable to import certificate %s\n" | 4264 | msgid "Unable to import certificate %s\n" |
4244 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 4265 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
4245 | 4266 | ||
4246 | #: src/gns/gnunet-gns-proxy.c:2370 | 4267 | #: src/gns/gnunet-gns-proxy.c:2371 |
4247 | #, fuzzy, c-format | 4268 | #, fuzzy, c-format |
4248 | msgid "Failed to start HTTPS server for `%s'\n" | 4269 | msgid "Failed to start HTTPS server for `%s'\n" |
4249 | msgstr "Misslyckades att starta samling.\n" | 4270 | msgstr "Misslyckades att starta samling.\n" |
4250 | 4271 | ||
4251 | #: src/gns/gnunet-gns-proxy.c:2389 src/rest/gnunet-rest-server.c:533 | 4272 | #: src/gns/gnunet-gns-proxy.c:2390 src/rest/gnunet-rest-server.c:533 |
4252 | #, fuzzy | 4273 | #, fuzzy |
4253 | msgid "Failed to pass client to MHD\n" | 4274 | msgid "Failed to pass client to MHD\n" |
4254 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 4275 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
4255 | 4276 | ||
4256 | #: src/gns/gnunet-gns-proxy.c:2709 | 4277 | #: src/gns/gnunet-gns-proxy.c:2710 |
4257 | #, fuzzy, c-format | 4278 | #, fuzzy, c-format |
4258 | msgid "Unsupported socks version %d\n" | 4279 | msgid "Unsupported socks version %d\n" |
4259 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" | 4280 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" |
4260 | 4281 | ||
4261 | #: src/gns/gnunet-gns-proxy.c:2738 | 4282 | #: src/gns/gnunet-gns-proxy.c:2739 |
4262 | #, fuzzy, c-format | 4283 | #, fuzzy, c-format |
4263 | msgid "Unsupported socks command %d\n" | 4284 | msgid "Unsupported socks command %d\n" |
4264 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" | 4285 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" |
4265 | 4286 | ||
4266 | #: src/gns/gnunet-gns-proxy.c:2756 src/gns/gnunet-gns-proxy.c:2785 | 4287 | #: src/gns/gnunet-gns-proxy.c:2757 src/gns/gnunet-gns-proxy.c:2786 |
4267 | msgid "SSL connection to plain IPv4 address requested\n" | 4288 | msgid "SSL connection to plain IPv4 address requested\n" |
4268 | msgstr "" | 4289 | msgstr "" |
4269 | 4290 | ||
4270 | #: src/gns/gnunet-gns-proxy.c:2836 | 4291 | #: src/gns/gnunet-gns-proxy.c:2837 |
4271 | #, fuzzy, c-format | 4292 | #, fuzzy, c-format |
4272 | msgid "Unsupported socks address type %d\n" | 4293 | msgid "Unsupported socks address type %d\n" |
4273 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" | 4294 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" |
4274 | 4295 | ||
4275 | #: src/gns/gnunet-gns-proxy.c:3171 | 4296 | #: src/gns/gnunet-gns-proxy.c:3172 |
4276 | msgid "No ego configured for `shorten-zone`\n" | 4297 | msgid "No ego configured for `shorten-zone`\n" |
4277 | msgstr "" | 4298 | msgstr "" |
4278 | 4299 | ||
4279 | #: src/gns/gnunet-gns-proxy.c:3211 src/gns/gnunet-service-gns.c:1093 | 4300 | #: src/gns/gnunet-gns-proxy.c:3212 src/gns/gnunet-service-gns.c:493 |
4280 | #: src/gns/gnunet-service-gns.c:1149 | 4301 | #: src/gns/gnunet-service-gns.c:548 |
4281 | #, c-format | 4302 | #, c-format |
4282 | msgid "No ego configured for `%s`\n" | 4303 | msgid "No ego configured for `%s`\n" |
4283 | msgstr "" | 4304 | msgstr "" |
4284 | 4305 | ||
4285 | #: src/gns/gnunet-gns-proxy.c:3273 | 4306 | #: src/gns/gnunet-gns-proxy.c:3274 |
4286 | #, fuzzy, c-format | 4307 | #, fuzzy, c-format |
4287 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" | 4308 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" |
4288 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 4309 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
4289 | 4310 | ||
4290 | #: src/gns/gnunet-gns-proxy.c:3313 | 4311 | #: src/gns/gnunet-gns-proxy.c:3314 |
4291 | msgid "listen on specified port (default: 7777)" | 4312 | msgid "listen on specified port (default: 7777)" |
4292 | msgstr "" | 4313 | msgstr "" |
4293 | 4314 | ||
4294 | #: src/gns/gnunet-gns-proxy.c:3316 | 4315 | #: src/gns/gnunet-gns-proxy.c:3317 |
4295 | msgid "pem file to use as CA" | 4316 | msgid "pem file to use as CA" |
4296 | msgstr "" | 4317 | msgstr "" |
4297 | 4318 | ||
4298 | #: src/gns/gnunet-gns-proxy.c:3335 | 4319 | #: src/gns/gnunet-gns-proxy.c:3336 |
4299 | msgid "GNUnet GNS proxy" | 4320 | msgid "GNUnet GNS proxy" |
4300 | msgstr "" | 4321 | msgstr "" |
4301 | 4322 | ||
4302 | #: src/gns/gnunet-service-gns.c:1187 | 4323 | #: src/gns/gnunet-service-gns.c:585 |
4324 | #: src/zonemaster/gnunet-service-zonemaster.c:705 | ||
4303 | #, fuzzy | 4325 | #, fuzzy |
4304 | msgid "Failed to connect to the namestore!\n" | 4326 | msgid "Failed to connect to the namestore!\n" |
4305 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 4327 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
4306 | 4328 | ||
4307 | #: src/gns/gnunet-service-gns.c:1195 | 4329 | #: src/gns/gnunet-service-gns.c:593 |
4308 | #, fuzzy | 4330 | #, fuzzy |
4309 | msgid "Failed to connect to the namecache!\n" | 4331 | msgid "Failed to connect to the namecache!\n" |
4310 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 4332 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
4311 | 4333 | ||
4312 | #: src/gns/gnunet-service-gns.c:1228 | 4334 | #: src/gns/gnunet-service-gns.c:612 |
4335 | #: src/zonemaster/gnunet-service-zonemaster.c:740 | ||
4313 | #, fuzzy | 4336 | #, fuzzy |
4314 | msgid "Could not connect to DHT!\n" | 4337 | msgid "Could not connect to DHT!\n" |
4315 | msgstr "Kunde inte ansluta till gnunetd.\n" | 4338 | msgstr "Kunde inte ansluta till gnunetd.\n" |
@@ -5156,8 +5179,7 @@ msgstr "" | |||
5156 | msgid "Invalid public key for reverse lookup `%s'\n" | 5179 | msgid "Invalid public key for reverse lookup `%s'\n" |
5157 | msgstr "Ogiltigt argument: \"%s\"\n" | 5180 | msgstr "Ogiltigt argument: \"%s\"\n" |
5158 | 5181 | ||
5159 | #: src/namestore/gnunet-namestore.c:979 | 5182 | #: src/namestore/gnunet-namestore.c:979 src/peerinfo-tool/gnunet-peerinfo.c:775 |
5160 | #: src/peerinfo-tool/gnunet-peerinfo.c:775 | ||
5161 | #, fuzzy, c-format | 5183 | #, fuzzy, c-format |
5162 | msgid "Invalid URI `%s'\n" | 5184 | msgid "Invalid URI `%s'\n" |
5163 | msgstr "Ogiltiga argument: " | 5185 | msgstr "Ogiltiga argument: " |
@@ -5316,221 +5338,297 @@ msgstr "" | |||
5316 | msgid "Namestore REST API initialized\n" | 5338 | msgid "Namestore REST API initialized\n" |
5317 | msgstr " Anslutning misslyckades\n" | 5339 | msgstr " Anslutning misslyckades\n" |
5318 | 5340 | ||
5319 | #: src/nat/gnunet-nat.c:159 | 5341 | #: src/nat-auto/gnunet-nat-auto.c:192 |
5320 | msgid "GNUnet NAT traversal autoconfigure daemon" | 5342 | #, fuzzy |
5343 | msgid "Suggested configuration changes:\n" | ||
5344 | msgstr "Konfigurationsfil \"%s\" skapad.\n" | ||
5345 | |||
5346 | #: src/nat-auto/gnunet-nat-auto.c:220 | ||
5347 | #, fuzzy, c-format | ||
5348 | msgid "Failed to write configuration to `%s'\n" | ||
5349 | msgstr "Kunde inte spara konfiguration!" | ||
5350 | |||
5351 | #: src/nat-auto/gnunet-nat-auto.c:227 | ||
5352 | #, fuzzy, c-format | ||
5353 | msgid "Wrote updated configuration to `%s'\n" | ||
5354 | msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n" | ||
5355 | |||
5356 | #: src/nat-auto/gnunet-nat-auto.c:345 | ||
5357 | #, fuzzy | ||
5358 | msgid "run autoconfiguration" | ||
5359 | msgstr "GNUnet-konfiguration" | ||
5360 | |||
5361 | #: src/nat-auto/gnunet-nat-auto.c:348 | ||
5362 | msgid "section name providing the configuration for the adapter" | ||
5363 | msgstr "" | ||
5364 | |||
5365 | #: src/nat-auto/gnunet-nat-auto.c:351 src/nat/gnunet-nat.c:436 | ||
5366 | msgid "use TCP" | ||
5367 | msgstr "" | ||
5368 | |||
5369 | #: src/nat-auto/gnunet-nat-auto.c:354 src/nat/gnunet-nat.c:439 | ||
5370 | msgid "use UDP" | ||
5371 | msgstr "" | ||
5372 | |||
5373 | #: src/nat-auto/gnunet-nat-auto.c:357 | ||
5374 | #, fuzzy | ||
5375 | msgid "write configuration file (for autoconfiguration)" | ||
5376 | msgstr "Inga applikationer definierade i konfiguration!\n" | ||
5377 | |||
5378 | #: src/nat-auto/gnunet-nat-auto.c:369 | ||
5379 | #, fuzzy | ||
5380 | msgid "GNUnet NAT traversal autoconfiguration" | ||
5381 | msgstr "GNUnet-konfiguration" | ||
5382 | |||
5383 | #: src/nat-auto/gnunet-nat-auto_legacy.c:403 | ||
5384 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:681 | ||
5385 | #: src/nat-auto/nat_auto_api_test.c:405 | ||
5386 | #, fuzzy | ||
5387 | msgid "Failed to connect to `gnunet-nat-server'\n" | ||
5388 | msgstr "Misslyckades att ansluta till gnunetd.\n" | ||
5389 | |||
5390 | #: src/nat-auto/gnunet-nat-auto_legacy.c:518 | ||
5391 | #: src/nat-auto/nat_auto_api_test.c:520 | ||
5392 | #, c-format | ||
5393 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5321 | msgstr "" | 5394 | msgstr "" |
5322 | 5395 | ||
5323 | #: src/nat/gnunet-nat-server.c:321 | 5396 | #: src/nat-auto/gnunet-nat-auto_legacy.c:568 |
5397 | #: src/nat-auto/nat_auto_api_test.c:569 | ||
5398 | #, fuzzy | ||
5399 | msgid "NAT test failed to start NAT library\n" | ||
5400 | msgstr "Misslyckades att starta samling.\n" | ||
5401 | |||
5402 | #: src/nat-auto/gnunet-nat-server.c:336 | ||
5324 | #, c-format | 5403 | #, c-format |
5325 | msgid "Please pass valid port number as the first argument! (got `%s')\n" | 5404 | msgid "Please pass valid port number as the first argument! (got `%s')\n" |
5326 | msgstr "" | 5405 | msgstr "" |
5327 | 5406 | ||
5328 | #: src/nat/gnunet-nat-server.c:363 | 5407 | #: src/nat-auto/gnunet-nat-server.c:386 |
5329 | msgid "GNUnet NAT traversal test helper daemon" | 5408 | msgid "GNUnet NAT traversal test helper daemon" |
5330 | msgstr "" | 5409 | msgstr "" |
5331 | 5410 | ||
5332 | #: src/nat/nat_api.c:880 src/nat/nat.c:2010 | 5411 | #: src/nat-auto/gnunet-service-nat-auto.c:342 |
5412 | #, fuzzy | ||
5413 | msgid "UPnP client `upnpc` command not found, disabling UPnP\n" | ||
5414 | msgstr "Kommando \"%s\" hittades inte!\n" | ||
5415 | |||
5416 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:385 | ||
5417 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5418 | msgstr "" | ||
5419 | |||
5420 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:386 | ||
5421 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5422 | msgstr "" | ||
5423 | |||
5424 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:405 | ||
5425 | #, fuzzy | ||
5426 | msgid "Testing connection reversal with ICMP server.\n" | ||
5427 | msgstr "Skriv ut information om GNUnets motparter." | ||
5428 | |||
5429 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:437 | ||
5430 | #, fuzzy, c-format | ||
5431 | msgid "Detected external IP `%s'\n" | ||
5432 | msgstr "Mottog ogiltig RPC \"%s\".\n" | ||
5433 | |||
5434 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:572 | ||
5435 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | ||
5436 | msgstr "" | ||
5437 | |||
5438 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:590 | ||
5439 | #, c-format | ||
5440 | msgid "Detected internal network address `%s'.\n" | ||
5441 | msgstr "" | ||
5442 | |||
5443 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:724 | ||
5444 | msgid "upnpc found, enabling its use\n" | ||
5445 | msgstr "" | ||
5446 | |||
5447 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:725 | ||
5448 | #, fuzzy | ||
5449 | msgid "upnpc not found\n" | ||
5450 | msgstr "Kommando \"%s\" hittades inte!\n" | ||
5451 | |||
5452 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:762 | ||
5453 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5454 | msgstr "" | ||
5455 | |||
5456 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:774 | ||
5457 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:834 | ||
5458 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | ||
5459 | msgstr "" | ||
5460 | |||
5461 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:786 | ||
5462 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:846 | ||
5463 | msgid "No working gnunet-helper-nat-server found\n" | ||
5464 | msgstr "" | ||
5465 | |||
5466 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:823 | ||
5467 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | ||
5468 | msgstr "" | ||
5469 | |||
5470 | #: src/nat-auto/nat_auto_api.c:76 | ||
5333 | msgid "Operation Successful" | 5471 | msgid "Operation Successful" |
5334 | msgstr "" | 5472 | msgstr "" |
5335 | 5473 | ||
5336 | #: src/nat/nat_api.c:882 src/nat/nat.c:2012 | 5474 | #: src/nat-auto/nat_auto_api.c:78 |
5337 | msgid "Internal Failure (IPC, ...)" | 5475 | msgid "IPC failure" |
5338 | msgstr "" | 5476 | msgstr "" |
5339 | 5477 | ||
5340 | #: src/nat/nat_api.c:884 src/nat/nat.c:2014 | 5478 | #: src/nat-auto/nat_auto_api.c:80 |
5341 | msgid "Failure in network subsystem, check permissions." | 5479 | msgid "Failure in network subsystem, check permissions." |
5342 | msgstr "" | 5480 | msgstr "" |
5343 | 5481 | ||
5344 | #: src/nat/nat_api.c:886 src/nat/nat.c:2016 | 5482 | #: src/nat-auto/nat_auto_api.c:82 |
5345 | msgid "Encountered timeout while performing operation" | 5483 | msgid "Encountered timeout while performing operation" |
5346 | msgstr "" | 5484 | msgstr "" |
5347 | 5485 | ||
5348 | #: src/nat/nat_api.c:888 src/nat/nat.c:2018 | 5486 | #: src/nat-auto/nat_auto_api.c:84 |
5349 | msgid "detected that we are offline" | 5487 | msgid "detected that we are offline" |
5350 | msgstr "" | 5488 | msgstr "" |
5351 | 5489 | ||
5352 | #: src/nat/nat_api.c:890 src/nat/nat.c:2020 | 5490 | #: src/nat-auto/nat_auto_api.c:86 |
5353 | #, fuzzy | 5491 | #, fuzzy |
5354 | msgid "`upnpc` command not found" | 5492 | msgid "`upnpc` command not found" |
5355 | msgstr "Kommando \"%s\" hittades inte!\n" | 5493 | msgstr "Kommando \"%s\" hittades inte!\n" |
5356 | 5494 | ||
5357 | #: src/nat/nat_api.c:892 src/nat/nat.c:2022 | 5495 | #: src/nat-auto/nat_auto_api.c:88 |
5358 | #, fuzzy | 5496 | #, fuzzy |
5359 | msgid "Failed to run `upnpc` command" | 5497 | msgid "Failed to run `upnpc` command" |
5360 | msgstr "Misslyckades att starta samling.\n" | 5498 | msgstr "Misslyckades att starta samling.\n" |
5361 | 5499 | ||
5362 | #: src/nat/nat_api.c:894 src/nat/nat.c:2024 | 5500 | #: src/nat-auto/nat_auto_api.c:90 |
5363 | #, fuzzy | 5501 | #, fuzzy |
5364 | msgid "`upnpc' command took too long, process killed" | 5502 | msgid "`upnpc' command took too long, process killed" |
5365 | msgstr "Kommando \"%s\" hittades inte!\n" | 5503 | msgstr "Kommando \"%s\" hittades inte!\n" |
5366 | 5504 | ||
5367 | #: src/nat/nat_api.c:896 src/nat/nat.c:2026 | 5505 | #: src/nat-auto/nat_auto_api.c:92 |
5368 | msgid "`upnpc' command failed to establish port mapping" | 5506 | msgid "`upnpc' command failed to establish port mapping" |
5369 | msgstr "" | 5507 | msgstr "" |
5370 | 5508 | ||
5371 | #: src/nat/nat_api.c:898 src/nat/nat.c:2028 | 5509 | #: src/nat-auto/nat_auto_api.c:94 |
5372 | #, fuzzy | 5510 | #, fuzzy |
5373 | msgid "`external-ip' command not found" | 5511 | msgid "`external-ip' command not found" |
5374 | msgstr "Kommando \"%s\" hittades inte!\n" | 5512 | msgstr "Kommando \"%s\" hittades inte!\n" |
5375 | 5513 | ||
5376 | #: src/nat/nat_api.c:900 src/nat/nat.c:2030 | 5514 | #: src/nat-auto/nat_auto_api.c:96 |
5377 | #, fuzzy | 5515 | #, fuzzy |
5378 | msgid "Failed to run `external-ip` command" | 5516 | msgid "Failed to run `external-ip` command" |
5379 | msgstr "Misslyckades att starta samling.\n" | 5517 | msgstr "Misslyckades att starta samling.\n" |
5380 | 5518 | ||
5381 | #: src/nat/nat_api.c:902 src/nat/nat.c:2032 | 5519 | #: src/nat-auto/nat_auto_api.c:98 |
5382 | msgid "`external-ip' command output invalid" | 5520 | msgid "`external-ip' command output invalid" |
5383 | msgstr "" | 5521 | msgstr "" |
5384 | 5522 | ||
5385 | #: src/nat/nat_api.c:904 src/nat/nat.c:2034 | 5523 | #: src/nat-auto/nat_auto_api.c:100 |
5386 | msgid "no valid address was returned by `external-ip'" | 5524 | msgid "no valid address was returned by `external-ip'" |
5387 | msgstr "" | 5525 | msgstr "" |
5388 | 5526 | ||
5389 | #: src/nat/nat_api.c:906 src/nat/nat.c:2036 | 5527 | #: src/nat-auto/nat_auto_api.c:102 |
5390 | #, fuzzy | 5528 | #, fuzzy |
5391 | msgid "Could not determine interface with internal/local network address" | 5529 | msgid "Could not determine interface with internal/local network address" |
5392 | msgstr "Kunde inte fastställa min publika IPv6-adress.\n" | 5530 | msgstr "Kunde inte fastställa min publika IPv6-adress.\n" |
5393 | 5531 | ||
5394 | #: src/nat/nat_api.c:908 src/nat/nat.c:2038 | 5532 | #: src/nat-auto/nat_auto_api.c:104 |
5395 | msgid "No functioning gnunet-helper-nat-server installation found" | 5533 | msgid "No functioning gnunet-helper-nat-server installation found" |
5396 | msgstr "" | 5534 | msgstr "" |
5397 | 5535 | ||
5398 | #: src/nat/nat_api.c:910 src/nat/nat.c:2040 | 5536 | #: src/nat-auto/nat_auto_api.c:106 |
5399 | msgid "NAT test could not be initialized" | 5537 | msgid "NAT test could not be initialized" |
5400 | msgstr "" | 5538 | msgstr "" |
5401 | 5539 | ||
5402 | #: src/nat/nat_api.c:912 src/nat/nat.c:2042 | 5540 | #: src/nat-auto/nat_auto_api.c:108 |
5403 | msgid "NAT test timeout reached" | 5541 | msgid "NAT test timeout reached" |
5404 | msgstr "" | 5542 | msgstr "" |
5405 | 5543 | ||
5406 | #: src/nat/nat_api.c:914 src/nat/nat.c:2044 | 5544 | #: src/nat-auto/nat_auto_api.c:110 |
5407 | msgid "could not register NAT" | 5545 | msgid "could not register NAT" |
5408 | msgstr "" | 5546 | msgstr "" |
5409 | 5547 | ||
5410 | #: src/nat/nat_api.c:916 src/nat/nat.c:2046 | 5548 | #: src/nat-auto/nat_auto_api.c:112 |
5411 | msgid "No working gnunet-helper-nat-client installation found" | 5549 | msgid "No working gnunet-helper-nat-client installation found" |
5412 | msgstr "" | 5550 | msgstr "" |
5413 | 5551 | ||
5414 | #: src/nat/nat_auto.c:385 | 5552 | #: src/nat-auto/nat_auto_api_test.c:477 |
5415 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5416 | msgstr "" | ||
5417 | |||
5418 | #: src/nat/nat_auto.c:386 | ||
5419 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5420 | msgstr "" | ||
5421 | |||
5422 | #: src/nat/nat_auto.c:405 | ||
5423 | #, fuzzy | ||
5424 | msgid "Testing connection reversal with ICMP server.\n" | ||
5425 | msgstr "Skriv ut information om GNUnets motparter." | ||
5426 | |||
5427 | #: src/nat/nat_auto.c:437 | ||
5428 | #, fuzzy, c-format | 5553 | #, fuzzy, c-format |
5429 | msgid "Detected external IP `%s'\n" | 5554 | msgid "Failed to find valid PORT in section `%s'\n" |
5430 | msgstr "Mottog ogiltig RPC \"%s\".\n" | 5555 | msgstr "Misslyckades att binda till UDP-port %d.\n" |
5431 | 5556 | ||
5432 | #: src/nat/nat_auto.c:572 | 5557 | #: src/nat/gnunet-nat.c:424 |
5433 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | 5558 | msgid "which IP and port are we locally using to bind/listen to" |
5434 | msgstr "" | 5559 | msgstr "" |
5435 | 5560 | ||
5436 | #: src/nat/nat_auto.c:590 | 5561 | #: src/nat/gnunet-nat.c:427 |
5437 | #, c-format | 5562 | msgid "which remote IP and port should be asked for connection reversal" |
5438 | msgid "Detected internal network address `%s'.\n" | ||
5439 | msgstr "" | 5563 | msgstr "" |
5440 | 5564 | ||
5441 | #: src/nat/nat_auto.c:681 src/nat/nat_test.c:403 | 5565 | #: src/nat/gnunet-nat.c:430 |
5442 | #, fuzzy | 5566 | msgid "" |
5443 | msgid "Failed to connect to `gnunet-nat-server'\n" | 5567 | "name of configuration section to find additional options, such as manual " |
5444 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 5568 | "host punching data" |
5445 | |||
5446 | #: src/nat/nat_auto.c:724 | ||
5447 | msgid "upnpc found, enabling its use\n" | ||
5448 | msgstr "" | 5569 | msgstr "" |
5449 | 5570 | ||
5450 | #: src/nat/nat_auto.c:725 | 5571 | #: src/nat/gnunet-nat.c:433 |
5451 | #, fuzzy | 5572 | msgid "enable STUN processing" |
5452 | msgid "upnpc not found\n" | ||
5453 | msgstr "Kommando \"%s\" hittades inte!\n" | ||
5454 | |||
5455 | #: src/nat/nat_auto.c:762 | ||
5456 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5457 | msgstr "" | 5573 | msgstr "" |
5458 | 5574 | ||
5459 | #: src/nat/nat_auto.c:774 src/nat/nat_auto.c:834 | 5575 | #: src/nat/gnunet-nat.c:442 |
5460 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | 5576 | msgid "watch for connection reversal requests" |
5461 | msgstr "" | 5577 | msgstr "" |
5462 | 5578 | ||
5463 | #: src/nat/nat_auto.c:786 src/nat/nat_auto.c:846 | 5579 | #: src/nat/gnunet-nat.c:454 |
5464 | msgid "No working gnunet-helper-nat-server found\n" | 5580 | msgid "GNUnet NAT traversal autoconfigure daemon" |
5465 | msgstr "" | 5581 | msgstr "" |
5466 | 5582 | ||
5467 | #: src/nat/nat_auto.c:823 | 5583 | #: src/nat/gnunet-service-nat.c:1313 |
5468 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | 5584 | #, c-format |
5585 | msgid "Malformed punched hole specification `%s' (lacks port)\n" | ||
5469 | msgstr "" | 5586 | msgstr "" |
5470 | 5587 | ||
5471 | #: src/nat/nat.c:1019 | 5588 | #: src/nat/gnunet-service-nat.c:1323 |
5472 | #, c-format | 5589 | #, c-format |
5473 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" | 5590 | msgid "Invalid port number in punched hole specification `%s' (lacks port)\n" |
5474 | msgstr "" | 5591 | msgstr "" |
5475 | 5592 | ||
5476 | #: src/nat/nat.c:1070 | 5593 | #: src/nat/gnunet-service-nat.c:1339 |
5477 | #, fuzzy, c-format | 5594 | #, c-format |
5478 | msgid "Failed to start %s\n" | 5595 | msgid "Malformed punched hole specification `%s' (lacks `]')\n" |
5479 | msgstr "Misslyckades att starta samling.\n" | ||
5480 | |||
5481 | #: src/nat/nat.c:1327 | ||
5482 | msgid "Error while running upnp client:\n" | ||
5483 | msgstr "" | 5596 | msgstr "" |
5484 | 5597 | ||
5485 | #: src/nat/nat.c:1402 | 5598 | #: src/nat/gnunet-service-nat.c:1350 |
5486 | #, fuzzy, c-format | 5599 | #, c-format |
5487 | msgid "Failed to run upnp client for port %u\n" | 5600 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
5488 | msgstr "Misslyckades att initiera tjänsten \"%s\".\n" | ||
5489 | |||
5490 | #: src/nat/nat.c:1546 | ||
5491 | msgid "malformed" | ||
5492 | msgstr "" | 5601 | msgstr "" |
5493 | 5602 | ||
5494 | #: src/nat/nat.c:1600 | 5603 | #: src/nat/gnunet-service-nat.c:1803 |
5604 | #, fuzzy | ||
5605 | msgid "Connection reversal request failed\n" | ||
5606 | msgstr "Samling stoppad.\n" | ||
5607 | |||
5608 | #: src/nat/gnunet-service-nat.c:1876 | ||
5495 | msgid "" | 5609 | msgid "" |
5496 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 5610 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
5497 | "disabling UPnP \n" | 5611 | "disabling UPnP\n" |
5498 | msgstr "" | 5612 | msgstr "" |
5499 | 5613 | ||
5500 | #: src/nat/nat.c:1726 src/nat/nat.c:1739 | 5614 | #: src/nat/gnunet-service-nat_helper.c:186 |
5501 | #, c-format | 5615 | #, c-format |
5502 | msgid "" | 5616 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" |
5503 | "Configuration requires `%s', but binary is not installed properly (SUID bit " | ||
5504 | "not set). Option disabled.\n" | ||
5505 | msgstr "" | ||
5506 | |||
5507 | #: src/nat/nat.c:1903 | ||
5508 | msgid "Internal IP address not known, cannot use ICMP NAT traversal method\n" | ||
5509 | msgstr "" | 5617 | msgstr "" |
5510 | 5618 | ||
5511 | #: src/nat/nat.c:1919 | 5619 | #: src/nat/gnunet-service-nat_helper.c:260 |
5512 | #, c-format | 5620 | #, fuzzy, c-format |
5513 | msgid "Running gnunet-helper-nat-client %s %s %u\n" | 5621 | msgid "Failed to start %s\n" |
5514 | msgstr "" | 5622 | msgstr "Misslyckades att starta samling.\n" |
5515 | 5623 | ||
5516 | #: src/nat/nat_mini.c:205 | 5624 | #: src/nat/gnunet-service-nat_mini.c:196 |
5517 | msgid "`external-ip' command not found\n" | 5625 | msgid "`external-ip' command not found\n" |
5518 | msgstr "" | 5626 | msgstr "" |
5519 | 5627 | ||
5520 | #: src/nat/nat_mini.c:611 | 5628 | #: src/nat/gnunet-service-nat_mini.c:654 |
5521 | msgid "`upnpc' command not found\n" | 5629 | msgid "`upnpc' command not found\n" |
5522 | msgstr "" | 5630 | msgstr "" |
5523 | 5631 | ||
5524 | #: src/nat/nat_test.c:518 | ||
5525 | #, c-format | ||
5526 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5527 | msgstr "" | ||
5528 | |||
5529 | #: src/nat/nat_test.c:568 | ||
5530 | #, fuzzy | ||
5531 | msgid "NAT test failed to start NAT library\n" | ||
5532 | msgstr "Misslyckades att starta samling.\n" | ||
5533 | |||
5534 | #: src/nse/gnunet-nse.c:122 | 5632 | #: src/nse/gnunet-nse.c:122 |
5535 | #, fuzzy | 5633 | #, fuzzy |
5536 | msgid "Show network size estimates from NSE service." | 5634 | msgid "Show network size estimates from NSE service." |
@@ -7330,182 +7428,159 @@ msgstr "" | |||
7330 | msgid "# validations succeeded" | 7428 | msgid "# validations succeeded" |
7331 | msgstr "" | 7429 | msgstr "" |
7332 | 7430 | ||
7333 | #: src/transport/gnunet-transport.c:486 | 7431 | #: src/transport/gnunet-transport.c:418 |
7334 | #, fuzzy, c-format | 7432 | #, fuzzy, c-format |
7335 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" | 7433 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" |
7336 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 7434 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
7337 | 7435 | ||
7338 | #: src/transport/gnunet-transport.c:496 | 7436 | #: src/transport/gnunet-transport.c:428 |
7339 | #, c-format | 7437 | #, c-format |
7340 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" | 7438 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" |
7341 | msgstr "" | 7439 | msgstr "" |
7342 | 7440 | ||
7343 | #: src/transport/gnunet-transport.c:540 | 7441 | #: src/transport/gnunet-transport.c:472 |
7344 | #, fuzzy, c-format | 7442 | #, fuzzy, c-format |
7345 | msgid "Failed to connect to `%s'\n" | 7443 | msgid "Failed to connect to `%s'\n" |
7346 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 7444 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
7347 | 7445 | ||
7348 | #: src/transport/gnunet-transport.c:553 | 7446 | #: src/transport/gnunet-transport.c:485 |
7349 | #, fuzzy, c-format | 7447 | #, fuzzy, c-format |
7350 | msgid "Failed to resolve address for peer `%s'\n" | 7448 | msgid "Failed to resolve address for peer `%s'\n" |
7351 | msgstr "Misslyckades att binda till UDP-port %d.\n" | 7449 | msgstr "Misslyckades att binda till UDP-port %d.\n" |
7352 | 7450 | ||
7353 | #: src/transport/gnunet-transport.c:565 | 7451 | #: src/transport/gnunet-transport.c:499 |
7354 | #, fuzzy | 7452 | #, fuzzy |
7355 | msgid "Failed to list connections, timeout occured\n" | 7453 | msgid "Failed to list connections, timeout occured\n" |
7356 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 7454 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
7357 | 7455 | ||
7358 | #: src/transport/gnunet-transport.c:588 | 7456 | #: src/transport/gnunet-transport.c:532 |
7359 | #, fuzzy, c-format | ||
7360 | msgid "NAT plugin `%s' reports: %s\n" | ||
7361 | msgstr "Testar transport(er) %s\n" | ||
7362 | |||
7363 | #: src/transport/gnunet-transport.c:675 | ||
7364 | msgid "No transport plugins configured, peer will never communicate\n" | ||
7365 | msgstr "" | ||
7366 | |||
7367 | #: src/transport/gnunet-transport.c:689 | ||
7368 | #, c-format | ||
7369 | msgid "No port configured for plugin `%s', cannot test it\n" | ||
7370 | msgstr "" | ||
7371 | |||
7372 | #: src/transport/gnunet-transport.c:714 | ||
7373 | #, fuzzy | ||
7374 | msgid "Failed to start resolver!\n" | ||
7375 | msgstr "Misslyckades att starta samling.\n" | ||
7376 | |||
7377 | #: src/transport/gnunet-transport.c:750 | ||
7378 | #, fuzzy, c-format | 7457 | #, fuzzy, c-format |
7379 | msgid "Transmitting %u bytes\n" | 7458 | msgid "Transmitting %u bytes\n" |
7380 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 7459 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
7381 | 7460 | ||
7382 | #: src/transport/gnunet-transport.c:784 | 7461 | #: src/transport/gnunet-transport.c:566 |
7383 | #, c-format | 7462 | #, c-format |
7384 | msgid "" | 7463 | msgid "" |
7385 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " | 7464 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " |
7386 | "blocks\n" | 7465 | "blocks\n" |
7387 | msgstr "" | 7466 | msgstr "" |
7388 | 7467 | ||
7389 | #: src/transport/gnunet-transport.c:815 | 7468 | #: src/transport/gnunet-transport.c:597 |
7390 | #, fuzzy, c-format | 7469 | #, fuzzy, c-format |
7391 | msgid "Disconnected from peer `%s' while benchmarking\n" | 7470 | msgid "Disconnected from peer `%s' while benchmarking\n" |
7392 | msgstr "\"%s\" ansluten till \"%s\".\n" | 7471 | msgstr "\"%s\" ansluten till \"%s\".\n" |
7393 | 7472 | ||
7394 | #: src/transport/gnunet-transport.c:839 src/transport/gnunet-transport.c:868 | 7473 | #: src/transport/gnunet-transport.c:621 src/transport/gnunet-transport.c:650 |
7395 | #, c-format | 7474 | #, c-format |
7396 | msgid "%24s: %-17s %4s (%u connections in total)\n" | 7475 | msgid "%24s: %-17s %4s (%u connections in total)\n" |
7397 | msgstr "" | 7476 | msgstr "" |
7398 | 7477 | ||
7399 | #: src/transport/gnunet-transport.c:841 | 7478 | #: src/transport/gnunet-transport.c:623 |
7400 | #, fuzzy | 7479 | #, fuzzy |
7401 | msgid "Connected to" | 7480 | msgid "Connected to" |
7402 | msgstr "\"%s\" ansluten till \"%s\".\n" | 7481 | msgstr "\"%s\" ansluten till \"%s\".\n" |
7403 | 7482 | ||
7404 | #: src/transport/gnunet-transport.c:870 | 7483 | #: src/transport/gnunet-transport.c:652 |
7405 | #, fuzzy | 7484 | #, fuzzy |
7406 | msgid "Disconnected from" | 7485 | msgid "Disconnected from" |
7407 | msgstr "\"%s\" ansluten till \"%s\".\n" | 7486 | msgstr "\"%s\" ansluten till \"%s\".\n" |
7408 | 7487 | ||
7409 | #: src/transport/gnunet-transport.c:905 | 7488 | #: src/transport/gnunet-transport.c:687 |
7410 | #, fuzzy, c-format | 7489 | #, fuzzy, c-format |
7411 | msgid "Received %u bytes\n" | 7490 | msgid "Received %u bytes\n" |
7412 | msgstr "mottog ogiltigt \"%s\" meddelande\n" | 7491 | msgstr "mottog ogiltigt \"%s\" meddelande\n" |
7413 | 7492 | ||
7414 | #: src/transport/gnunet-transport.c:942 | 7493 | #: src/transport/gnunet-transport.c:724 |
7415 | #, c-format | 7494 | #, c-format |
7416 | msgid "Peer `%s': %s %s in state `%s' until %s\n" | 7495 | msgid "Peer `%s': %s %s in state `%s' until %s\n" |
7417 | msgstr "" | 7496 | msgstr "" |
7418 | 7497 | ||
7419 | #: src/transport/gnunet-transport.c:954 | 7498 | #: src/transport/gnunet-transport.c:736 |
7420 | #, fuzzy, c-format | 7499 | #, fuzzy, c-format |
7421 | msgid "Peer `%s': %s %s\n" | 7500 | msgid "Peer `%s': %s %s\n" |
7422 | msgstr "Jag är ändpunkt \"%s\".\n" | 7501 | msgstr "Jag är ändpunkt \"%s\".\n" |
7423 | 7502 | ||
7424 | #: src/transport/gnunet-transport.c:1366 | 7503 | #: src/transport/gnunet-transport.c:1150 |
7425 | #, fuzzy | 7504 | #, fuzzy |
7426 | msgid "Monitor disconnected from transport service. Reconnecting.\n" | 7505 | msgid "Monitor disconnected from transport service. Reconnecting.\n" |
7427 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 7506 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
7428 | 7507 | ||
7429 | #: src/transport/gnunet-transport.c:1488 | 7508 | #: src/transport/gnunet-transport.c:1267 |
7430 | #, c-format | 7509 | #, c-format |
7431 | msgid "" | 7510 | msgid "" |
7432 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " | 7511 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " |
7433 | "%s, %s %s\n" | 7512 | "%s, %s %s\n" |
7434 | msgstr "" | 7513 | msgstr "" |
7435 | 7514 | ||
7436 | #: src/transport/gnunet-transport.c:1501 | 7515 | #: src/transport/gnunet-transport.c:1280 |
7437 | #, c-format | 7516 | #, c-format |
7438 | msgid "" | 7517 | msgid "" |
7439 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" | 7518 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" |
7440 | msgstr "" | 7519 | msgstr "" |
7441 | 7520 | ||
7442 | #: src/transport/gnunet-transport.c:1529 | 7521 | #: src/transport/gnunet-transport.c:1308 |
7443 | #, fuzzy | 7522 | #, fuzzy |
7444 | msgid "Failed to connect to transport service for disconnection\n" | 7523 | msgid "Failed to connect to transport service for disconnection\n" |
7445 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 7524 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
7446 | 7525 | ||
7447 | #: src/transport/gnunet-transport.c:1535 | 7526 | #: src/transport/gnunet-transport.c:1314 |
7448 | msgid "Blacklisting request in place, stop with CTRL-C\n" | 7527 | msgid "Blacklisting request in place, stop with CTRL-C\n" |
7449 | msgstr "" | 7528 | msgstr "" |
7450 | 7529 | ||
7451 | #: src/transport/gnunet-transport.c:1558 src/transport/gnunet-transport.c:1588 | 7530 | #: src/transport/gnunet-transport.c:1337 src/transport/gnunet-transport.c:1367 |
7452 | #: src/transport/gnunet-transport.c:1641 | 7531 | #: src/transport/gnunet-transport.c:1420 |
7453 | #, fuzzy | 7532 | #, fuzzy |
7454 | msgid "Failed to connect to transport service\n" | 7533 | msgid "Failed to connect to transport service\n" |
7455 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 7534 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
7456 | 7535 | ||
7457 | #: src/transport/gnunet-transport.c:1595 | 7536 | #: src/transport/gnunet-transport.c:1374 |
7458 | msgid "Starting to receive benchmark data\n" | 7537 | msgid "Starting to receive benchmark data\n" |
7459 | msgstr "" | 7538 | msgstr "" |
7460 | 7539 | ||
7461 | #: src/transport/gnunet-transport.c:1665 | 7540 | #: src/transport/gnunet-transport.c:1444 |
7462 | #, fuzzy | 7541 | #, fuzzy |
7463 | msgid "print information for all peers (instead of only connected peers)" | 7542 | msgid "print information for all peers (instead of only connected peers)" |
7464 | msgstr "Skriv ut information om GNUnets motparter." | 7543 | msgstr "Skriv ut information om GNUnets motparter." |
7465 | 7544 | ||
7466 | #: src/transport/gnunet-transport.c:1668 | 7545 | #: src/transport/gnunet-transport.c:1447 |
7467 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" | 7546 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" |
7468 | msgstr "" | 7547 | msgstr "" |
7469 | 7548 | ||
7470 | #: src/transport/gnunet-transport.c:1671 | 7549 | #: src/transport/gnunet-transport.c:1450 |
7471 | #, fuzzy | 7550 | #, fuzzy |
7472 | msgid "disconnect from a peer" | 7551 | msgid "disconnect from a peer" |
7473 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 7552 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
7474 | 7553 | ||
7475 | #: src/transport/gnunet-transport.c:1674 | 7554 | #: src/transport/gnunet-transport.c:1453 |
7476 | #, fuzzy | 7555 | #, fuzzy |
7477 | msgid "provide information about all current connections (once)" | 7556 | msgid "provide information about all current connections (once)" |
7478 | msgstr "Skriv ut information om GNUnets motparter." | 7557 | msgstr "Skriv ut information om GNUnets motparter." |
7479 | 7558 | ||
7480 | #: src/transport/gnunet-transport.c:1680 | 7559 | #: src/transport/gnunet-transport.c:1459 |
7481 | #, fuzzy | 7560 | #, fuzzy |
7482 | msgid "" | 7561 | msgid "" |
7483 | "provide information about all connects and disconnect events (continuously)" | 7562 | "provide information about all connects and disconnect events (continuously)" |
7484 | msgstr "Skriv ut information om GNUnets motparter." | 7563 | msgstr "Skriv ut information om GNUnets motparter." |
7485 | 7564 | ||
7486 | #: src/transport/gnunet-transport.c:1683 | 7565 | #: src/transport/gnunet-transport.c:1462 |
7487 | #, fuzzy | 7566 | #, fuzzy |
7488 | msgid "do not resolve hostnames" | 7567 | msgid "do not resolve hostnames" |
7489 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 7568 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
7490 | 7569 | ||
7491 | #: src/transport/gnunet-transport.c:1686 | 7570 | #: src/transport/gnunet-transport.c:1465 |
7492 | #: src/transport/gnunet-transport-profiler.c:631 | 7571 | #: src/transport/gnunet-transport-profiler.c:631 |
7493 | msgid "peer identity" | 7572 | msgid "peer identity" |
7494 | msgstr "" | 7573 | msgstr "" |
7495 | 7574 | ||
7496 | #: src/transport/gnunet-transport.c:1689 | 7575 | #: src/transport/gnunet-transport.c:1468 |
7497 | msgid "monitor plugin sessions" | 7576 | msgid "monitor plugin sessions" |
7498 | msgstr "" | 7577 | msgstr "" |
7499 | 7578 | ||
7500 | #: src/transport/gnunet-transport.c:1692 | 7579 | #: src/transport/gnunet-transport.c:1471 |
7501 | msgid "send data for benchmarking to the other peer (until CTRL-C)" | 7580 | msgid "send data for benchmarking to the other peer (until CTRL-C)" |
7502 | msgstr "" | 7581 | msgstr "" |
7503 | 7582 | ||
7504 | #: src/transport/gnunet-transport.c:1695 | 7583 | #: src/transport/gnunet-transport.c:1482 |
7505 | msgid "test transport configuration (involves external server)" | ||
7506 | msgstr "" | ||
7507 | |||
7508 | #: src/transport/gnunet-transport.c:1706 | ||
7509 | #: src/transport/gnunet-transport-profiler.c:642 | 7584 | #: src/transport/gnunet-transport-profiler.c:642 |
7510 | #, fuzzy | 7585 | #, fuzzy |
7511 | msgid "Direct access to transport service." | 7586 | msgid "Direct access to transport service." |
@@ -7542,9 +7617,9 @@ msgstr "meddelandestorlek" | |||
7542 | 7617 | ||
7543 | #: src/transport/plugin_transport_http_client.c:1477 | 7618 | #: src/transport/plugin_transport_http_client.c:1477 |
7544 | #: src/transport/plugin_transport_http_server.c:2248 | 7619 | #: src/transport/plugin_transport_http_server.c:2248 |
7545 | #: src/transport/plugin_transport_http_server.c:3457 | 7620 | #: src/transport/plugin_transport_http_server.c:3462 |
7546 | #: src/transport/plugin_transport_tcp.c:3365 | 7621 | #: src/transport/plugin_transport_tcp.c:3375 |
7547 | #: src/transport/plugin_transport_tcp.c:3372 | 7622 | #: src/transport/plugin_transport_tcp.c:3382 |
7548 | msgid "TCP_STEALTH not supported on this platform.\n" | 7623 | msgid "TCP_STEALTH not supported on this platform.\n" |
7549 | msgstr "" | 7624 | msgstr "" |
7550 | 7625 | ||
@@ -7554,13 +7629,13 @@ msgid "Could not initialize curl multi handle, failed to start %s plugin!\n" | |||
7554 | msgstr "" | 7629 | msgstr "" |
7555 | 7630 | ||
7556 | #: src/transport/plugin_transport_http_client.c:2167 | 7631 | #: src/transport/plugin_transport_http_client.c:2167 |
7557 | #: src/transport/plugin_transport_http_server.c:3172 | 7632 | #: src/transport/plugin_transport_http_server.c:3177 |
7558 | #, fuzzy, c-format | 7633 | #, fuzzy, c-format |
7559 | msgid "Shutting down plugin `%s'\n" | 7634 | msgid "Shutting down plugin `%s'\n" |
7560 | msgstr "Testar transport(er) %s\n" | 7635 | msgstr "Testar transport(er) %s\n" |
7561 | 7636 | ||
7562 | #: src/transport/plugin_transport_http_client.c:2184 | 7637 | #: src/transport/plugin_transport_http_client.c:2184 |
7563 | #: src/transport/plugin_transport_http_server.c:3242 | 7638 | #: src/transport/plugin_transport_http_server.c:3247 |
7564 | #, fuzzy, c-format | 7639 | #, fuzzy, c-format |
7565 | msgid "Shutdown for plugin `%s' complete\n" | 7640 | msgid "Shutdown for plugin `%s' complete\n" |
7566 | msgstr "" | 7641 | msgstr "" |
@@ -7604,75 +7679,75 @@ msgstr "" | |||
7604 | msgid "Could not load or create server certificate! Loading plugin failed!\n" | 7679 | msgid "Could not load or create server certificate! Loading plugin failed!\n" |
7605 | msgstr "" | 7680 | msgstr "" |
7606 | 7681 | ||
7607 | #: src/transport/plugin_transport_http_server.c:2583 | 7682 | #: src/transport/plugin_transport_http_server.c:2586 |
7608 | #, fuzzy | 7683 | #, fuzzy |
7609 | msgid "Require valid port number for service in configuration!\n" | 7684 | msgid "Require valid port number for service in configuration!\n" |
7610 | msgstr "Inga applikationer definierade i konfiguration!\n" | 7685 | msgstr "Inga applikationer definierade i konfiguration!\n" |
7611 | 7686 | ||
7612 | #: src/transport/plugin_transport_http_server.c:2748 | 7687 | #: src/transport/plugin_transport_http_server.c:2751 |
7613 | #, c-format | 7688 | #, c-format |
7614 | msgid "Found %u addresses to report to NAT service\n" | 7689 | msgid "Found %u addresses to report to NAT service\n" |
7615 | msgstr "" | 7690 | msgstr "" |
7616 | 7691 | ||
7617 | #: src/transport/plugin_transport_http_server.c:2832 | 7692 | #: src/transport/plugin_transport_http_server.c:2837 |
7618 | #: src/transport/plugin_transport_udp.c:3600 | 7693 | #: src/transport/plugin_transport_udp.c:3623 |
7619 | msgid "Disabling IPv6 since it is not supported on this system!\n" | 7694 | msgid "Disabling IPv6 since it is not supported on this system!\n" |
7620 | msgstr "" | 7695 | msgstr "" |
7621 | 7696 | ||
7622 | #: src/transport/plugin_transport_http_server.c:2938 | 7697 | #: src/transport/plugin_transport_http_server.c:2943 |
7623 | #, c-format | 7698 | #, c-format |
7624 | msgid "IPv4 support is %s\n" | 7699 | msgid "IPv4 support is %s\n" |
7625 | msgstr "" | 7700 | msgstr "" |
7626 | 7701 | ||
7627 | #: src/transport/plugin_transport_http_server.c:2953 | 7702 | #: src/transport/plugin_transport_http_server.c:2958 |
7628 | #, c-format | 7703 | #, c-format |
7629 | msgid "IPv6 support is %s\n" | 7704 | msgid "IPv6 support is %s\n" |
7630 | msgstr "" | 7705 | msgstr "" |
7631 | 7706 | ||
7632 | #: src/transport/plugin_transport_http_server.c:2959 | 7707 | #: src/transport/plugin_transport_http_server.c:2964 |
7633 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" | 7708 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" |
7634 | msgstr "" | 7709 | msgstr "" |
7635 | 7710 | ||
7636 | #: src/transport/plugin_transport_http_server.c:2970 | 7711 | #: src/transport/plugin_transport_http_server.c:2975 |
7637 | #, fuzzy | 7712 | #, fuzzy |
7638 | msgid "Port is required! Fix in configuration\n" | 7713 | msgid "Port is required! Fix in configuration\n" |
7639 | msgstr " gconfig\tGTK-konfiguration\n" | 7714 | msgstr " gconfig\tGTK-konfiguration\n" |
7640 | 7715 | ||
7641 | #: src/transport/plugin_transport_http_server.c:2976 | 7716 | #: src/transport/plugin_transport_http_server.c:2981 |
7642 | #, fuzzy, c-format | 7717 | #, fuzzy, c-format |
7643 | msgid "Using port %u\n" | 7718 | msgid "Using port %u\n" |
7644 | msgstr "Testar transport(er) %s\n" | 7719 | msgstr "Testar transport(er) %s\n" |
7645 | 7720 | ||
7646 | #: src/transport/plugin_transport_http_server.c:2995 | 7721 | #: src/transport/plugin_transport_http_server.c:3000 |
7647 | #, fuzzy, c-format | 7722 | #, fuzzy, c-format |
7648 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" | 7723 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" |
7649 | msgstr "" | 7724 | msgstr "" |
7650 | "Du måste ange ett positivt nummer för \"%s\" i konfigurationen i sektion \"%s" | 7725 | "Du måste ange ett positivt nummer för \"%s\" i konfigurationen i sektion \"%s" |
7651 | "\".\n" | 7726 | "\".\n" |
7652 | 7727 | ||
7653 | #: src/transport/plugin_transport_http_server.c:3030 | 7728 | #: src/transport/plugin_transport_http_server.c:3035 |
7654 | #, fuzzy, c-format | 7729 | #, fuzzy, c-format |
7655 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" | 7730 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" |
7656 | msgstr "" | 7731 | msgstr "" |
7657 | "Du måste ange ett positivt nummer för \"%s\" i konfigurationen i sektion \"%s" | 7732 | "Du måste ange ett positivt nummer för \"%s\" i konfigurationen i sektion \"%s" |
7658 | "\".\n" | 7733 | "\".\n" |
7659 | 7734 | ||
7660 | #: src/transport/plugin_transport_http_server.c:3105 | 7735 | #: src/transport/plugin_transport_http_server.c:3110 |
7661 | #, fuzzy, c-format | 7736 | #, fuzzy, c-format |
7662 | msgid "Using external hostname `%s'\n" | 7737 | msgid "Using external hostname `%s'\n" |
7663 | msgstr "Startade samling \"%s\".\n" | 7738 | msgstr "Startade samling \"%s\".\n" |
7664 | 7739 | ||
7665 | #: src/transport/plugin_transport_http_server.c:3126 | 7740 | #: src/transport/plugin_transport_http_server.c:3131 |
7666 | #, fuzzy, c-format | 7741 | #, fuzzy, c-format |
7667 | msgid "Notifying transport only about hostname `%s'\n" | 7742 | msgid "Notifying transport only about hostname `%s'\n" |
7668 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 7743 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
7669 | 7744 | ||
7670 | #: src/transport/plugin_transport_http_server.c:3143 | 7745 | #: src/transport/plugin_transport_http_server.c:3148 |
7671 | #, fuzzy, c-format | 7746 | #, fuzzy, c-format |
7672 | msgid "Maximum number of connections is %u\n" | 7747 | msgid "Maximum number of connections is %u\n" |
7673 | msgstr "Maximalt antal chattklienter uppnått.\n" | 7748 | msgstr "Maximalt antal chattklienter uppnått.\n" |
7674 | 7749 | ||
7675 | #: src/transport/plugin_transport_http_server.c:3469 | 7750 | #: src/transport/plugin_transport_http_server.c:3474 |
7676 | #, fuzzy | 7751 | #, fuzzy |
7677 | msgid "Unable to compile URL regex\n" | 7752 | msgid "Unable to compile URL regex\n" |
7678 | msgstr "Kunde inte initiera SQLite.\n" | 7753 | msgstr "Kunde inte initiera SQLite.\n" |
@@ -7725,167 +7800,167 @@ msgstr "# byte skickades via TCP" | |||
7725 | msgid "# bytes dropped by SMTP (outgoing)" | 7800 | msgid "# bytes dropped by SMTP (outgoing)" |
7726 | msgstr "# byte kastade via TCP (utgående)" | 7801 | msgstr "# byte kastade via TCP (utgående)" |
7727 | 7802 | ||
7728 | #: src/transport/plugin_transport_tcp.c:1051 | 7803 | #: src/transport/plugin_transport_tcp.c:1060 |
7729 | #: src/transport/plugin_transport_tcp.c:2362 | 7804 | #: src/transport/plugin_transport_tcp.c:2379 |
7730 | #, c-format | 7805 | #, c-format |
7731 | msgid "Unexpected address length: %u bytes\n" | 7806 | msgid "Unexpected address length: %u bytes\n" |
7732 | msgstr "" | 7807 | msgstr "" |
7733 | 7808 | ||
7734 | #: src/transport/plugin_transport_tcp.c:1234 | 7809 | #: src/transport/plugin_transport_tcp.c:1243 |
7735 | #: src/transport/plugin_transport_tcp.c:1458 | 7810 | #: src/transport/plugin_transport_tcp.c:1467 |
7736 | #: src/transport/plugin_transport_tcp.c:2633 | 7811 | #: src/transport/plugin_transport_tcp.c:2643 |
7737 | #: src/transport/plugin_transport_tcp.c:3490 | 7812 | #: src/transport/plugin_transport_tcp.c:3498 |
7738 | #, fuzzy | 7813 | #, fuzzy |
7739 | msgid "# TCP sessions active" | 7814 | msgid "# TCP sessions active" |
7740 | msgstr "# sessionsnycklar accepterade" | 7815 | msgstr "# sessionsnycklar accepterade" |
7741 | 7816 | ||
7742 | #: src/transport/plugin_transport_tcp.c:1276 | 7817 | #: src/transport/plugin_transport_tcp.c:1285 |
7743 | #: src/transport/plugin_transport_tcp.c:1440 | 7818 | #: src/transport/plugin_transport_tcp.c:1449 |
7744 | #: src/transport/plugin_transport_tcp.c:1564 | 7819 | #: src/transport/plugin_transport_tcp.c:1573 |
7745 | #: src/transport/plugin_transport_tcp.c:1637 | 7820 | #: src/transport/plugin_transport_tcp.c:1646 |
7746 | #: src/transport/plugin_transport_tcp.c:1737 | 7821 | #: src/transport/plugin_transport_tcp.c:1746 |
7747 | #: src/transport/plugin_transport_tcp.c:1762 | 7822 | #: src/transport/plugin_transport_tcp.c:1771 |
7748 | #, fuzzy | 7823 | #, fuzzy |
7749 | msgid "# bytes currently in TCP buffers" | 7824 | msgid "# bytes currently in TCP buffers" |
7750 | msgstr "# byte skickades via TCP" | 7825 | msgstr "# byte skickades via TCP" |
7751 | 7826 | ||
7752 | #: src/transport/plugin_transport_tcp.c:1279 | 7827 | #: src/transport/plugin_transport_tcp.c:1288 |
7753 | #, fuzzy | 7828 | #, fuzzy |
7754 | msgid "# bytes discarded by TCP (disconnect)" | 7829 | msgid "# bytes discarded by TCP (disconnect)" |
7755 | msgstr "# byte kastade via TCP (utgående)" | 7830 | msgstr "# byte kastade via TCP (utgående)" |
7756 | 7831 | ||
7757 | #: src/transport/plugin_transport_tcp.c:1567 | 7832 | #: src/transport/plugin_transport_tcp.c:1576 |
7758 | #, fuzzy | 7833 | #, fuzzy |
7759 | msgid "# bytes discarded by TCP (timeout)" | 7834 | msgid "# bytes discarded by TCP (timeout)" |
7760 | msgstr "# byte kastade via TCP (utgående)" | 7835 | msgstr "# byte kastade via TCP (utgående)" |
7761 | 7836 | ||
7762 | #: src/transport/plugin_transport_tcp.c:1641 | 7837 | #: src/transport/plugin_transport_tcp.c:1650 |
7763 | #, fuzzy | 7838 | #, fuzzy |
7764 | msgid "# bytes transmitted via TCP" | 7839 | msgid "# bytes transmitted via TCP" |
7765 | msgstr "# byte skickade av typen %d" | 7840 | msgstr "# byte skickade av typen %d" |
7766 | 7841 | ||
7767 | #: src/transport/plugin_transport_tcp.c:2032 | 7842 | #: src/transport/plugin_transport_tcp.c:2041 |
7768 | msgid "# requests to create session with invalid address" | 7843 | msgid "# requests to create session with invalid address" |
7769 | msgstr "" | 7844 | msgstr "" |
7770 | 7845 | ||
7771 | #: src/transport/plugin_transport_tcp.c:2200 | 7846 | #: src/transport/plugin_transport_tcp.c:2217 |
7772 | msgid "# transport-service disconnect requests for TCP" | 7847 | msgid "# transport-service disconnect requests for TCP" |
7773 | msgstr "" | 7848 | msgstr "" |
7774 | 7849 | ||
7775 | #: src/transport/plugin_transport_tcp.c:2692 | 7850 | #: src/transport/plugin_transport_tcp.c:2702 |
7776 | #, fuzzy | 7851 | #, fuzzy |
7777 | msgid "# TCP WELCOME messages received" | 7852 | msgid "# TCP WELCOME messages received" |
7778 | msgstr "# krypterade PONG-meddelanden mottagna" | 7853 | msgstr "# krypterade PONG-meddelanden mottagna" |
7779 | 7854 | ||
7780 | #: src/transport/plugin_transport_tcp.c:2883 | 7855 | #: src/transport/plugin_transport_tcp.c:2893 |
7781 | msgid "# bytes received via TCP" | 7856 | msgid "# bytes received via TCP" |
7782 | msgstr "# byte mottogs via TCP" | 7857 | msgstr "# byte mottogs via TCP" |
7783 | 7858 | ||
7784 | #: src/transport/plugin_transport_tcp.c:2934 | 7859 | #: src/transport/plugin_transport_tcp.c:2944 |
7785 | #: src/transport/plugin_transport_tcp.c:2992 | 7860 | #: src/transport/plugin_transport_tcp.c:3002 |
7786 | #, fuzzy | 7861 | #, fuzzy |
7787 | msgid "# TCP server connections active" | 7862 | msgid "# TCP server connections active" |
7788 | msgstr "Nätverksanslutning" | 7863 | msgstr "Nätverksanslutning" |
7789 | 7864 | ||
7790 | #: src/transport/plugin_transport_tcp.c:2938 | 7865 | #: src/transport/plugin_transport_tcp.c:2948 |
7791 | #, fuzzy | 7866 | #, fuzzy |
7792 | msgid "# TCP server connect events" | 7867 | msgid "# TCP server connect events" |
7793 | msgstr "# av anslutna parter" | 7868 | msgstr "# av anslutna parter" |
7794 | 7869 | ||
7795 | #: src/transport/plugin_transport_tcp.c:2944 | 7870 | #: src/transport/plugin_transport_tcp.c:2954 |
7796 | msgid "TCP connection limit reached, suspending server\n" | 7871 | msgid "TCP connection limit reached, suspending server\n" |
7797 | msgstr "" | 7872 | msgstr "" |
7798 | 7873 | ||
7799 | #: src/transport/plugin_transport_tcp.c:2946 | 7874 | #: src/transport/plugin_transport_tcp.c:2956 |
7800 | msgid "# TCP service suspended" | 7875 | msgid "# TCP service suspended" |
7801 | msgstr "" | 7876 | msgstr "" |
7802 | 7877 | ||
7803 | #: src/transport/plugin_transport_tcp.c:2986 | 7878 | #: src/transport/plugin_transport_tcp.c:2996 |
7804 | msgid "# TCP service resumed" | 7879 | msgid "# TCP service resumed" |
7805 | msgstr "" | 7880 | msgstr "" |
7806 | 7881 | ||
7807 | #: src/transport/plugin_transport_tcp.c:2996 | 7882 | #: src/transport/plugin_transport_tcp.c:3006 |
7808 | msgid "# network-level TCP disconnect events" | 7883 | msgid "# network-level TCP disconnect events" |
7809 | msgstr "" | 7884 | msgstr "" |
7810 | 7885 | ||
7811 | #: src/transport/plugin_transport_tcp.c:3315 | 7886 | #: src/transport/plugin_transport_tcp.c:3325 |
7812 | #, fuzzy | 7887 | #, fuzzy |
7813 | msgid "Failed to start service.\n" | 7888 | msgid "Failed to start service.\n" |
7814 | msgstr "Misslyckades att starta samling.\n" | 7889 | msgstr "Misslyckades att starta samling.\n" |
7815 | 7890 | ||
7816 | #: src/transport/plugin_transport_tcp.c:3478 | 7891 | #: src/transport/plugin_transport_tcp.c:3486 |
7817 | #, c-format | 7892 | #, c-format |
7818 | msgid "TCP transport listening on port %llu\n" | 7893 | msgid "TCP transport listening on port %llu\n" |
7819 | msgstr "" | 7894 | msgstr "" |
7820 | 7895 | ||
7821 | #: src/transport/plugin_transport_tcp.c:3482 | 7896 | #: src/transport/plugin_transport_tcp.c:3490 |
7822 | msgid "TCP transport not listening on any port (client only)\n" | 7897 | msgid "TCP transport not listening on any port (client only)\n" |
7823 | msgstr "" | 7898 | msgstr "" |
7824 | 7899 | ||
7825 | #: src/transport/plugin_transport_tcp.c:3486 | 7900 | #: src/transport/plugin_transport_tcp.c:3494 |
7826 | #, c-format | 7901 | #, c-format |
7827 | msgid "TCP transport advertises itself as being on port %llu\n" | 7902 | msgid "TCP transport advertises itself as being on port %llu\n" |
7828 | msgstr "" | 7903 | msgstr "" |
7829 | 7904 | ||
7830 | #: src/transport/plugin_transport_udp_broadcasting.c:170 | 7905 | #: src/transport/plugin_transport_udp_broadcasting.c:169 |
7831 | #, fuzzy | 7906 | #, fuzzy |
7832 | msgid "# Multicast HELLO beacons received via UDP" | 7907 | msgid "# Multicast HELLO beacons received via UDP" |
7833 | msgstr "# krypterade PONG-meddelanden mottagna" | 7908 | msgstr "# krypterade PONG-meddelanden mottagna" |
7834 | 7909 | ||
7835 | #: src/transport/plugin_transport_udp_broadcasting.c:546 | 7910 | #: src/transport/plugin_transport_udp_broadcasting.c:545 |
7836 | msgid "" | 7911 | msgid "" |
7837 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" | 7912 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" |
7838 | msgstr "" | 7913 | msgstr "" |
7839 | 7914 | ||
7840 | #: src/transport/plugin_transport_udp_broadcasting.c:567 | 7915 | #: src/transport/plugin_transport_udp_broadcasting.c:566 |
7841 | #, c-format | 7916 | #, c-format |
7842 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" | 7917 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" |
7843 | msgstr "" | 7918 | msgstr "" |
7844 | 7919 | ||
7845 | #: src/transport/plugin_transport_udp.c:3344 | 7920 | #: src/transport/plugin_transport_udp.c:3367 |
7846 | #, c-format | 7921 | #, c-format |
7847 | msgid "" | 7922 | msgid "" |
7848 | "UDP could not transmit message to `%s': Network seems down, please check " | 7923 | "UDP could not transmit message to `%s': Network seems down, please check " |
7849 | "your network configuration\n" | 7924 | "your network configuration\n" |
7850 | msgstr "" | 7925 | msgstr "" |
7851 | 7926 | ||
7852 | #: src/transport/plugin_transport_udp.c:3358 | 7927 | #: src/transport/plugin_transport_udp.c:3381 |
7853 | msgid "" | 7928 | msgid "" |
7854 | "UDP could not transmit IPv6 message! Please check your network configuration " | 7929 | "UDP could not transmit IPv6 message! Please check your network configuration " |
7855 | "and disable IPv6 if your connection does not have a global IPv6 address\n" | 7930 | "and disable IPv6 if your connection does not have a global IPv6 address\n" |
7856 | msgstr "" | 7931 | msgstr "" |
7857 | 7932 | ||
7858 | #: src/transport/plugin_transport_udp.c:3676 | 7933 | #: src/transport/plugin_transport_udp.c:3699 |
7859 | #: src/transport/plugin_transport_udp.c:3775 | 7934 | #: src/transport/plugin_transport_udp.c:3798 |
7860 | #, fuzzy, c-format | 7935 | #, fuzzy, c-format |
7861 | msgid "Failed to bind UDP socket to %s: %s\n" | 7936 | msgid "Failed to bind UDP socket to %s: %s\n" |
7862 | msgstr "Misslyckades att binda till UDP6-port %d.\n" | 7937 | msgstr "Misslyckades att binda till UDP6-port %d.\n" |
7863 | 7938 | ||
7864 | #: src/transport/plugin_transport_udp.c:3694 | 7939 | #: src/transport/plugin_transport_udp.c:3717 |
7865 | msgid "Disabling IPv4 since it is not supported on this system!\n" | 7940 | msgid "Disabling IPv4 since it is not supported on this system!\n" |
7866 | msgstr "" | 7941 | msgstr "" |
7867 | 7942 | ||
7868 | #: src/transport/plugin_transport_udp.c:3785 | 7943 | #: src/transport/plugin_transport_udp.c:3808 |
7869 | #, fuzzy | 7944 | #, fuzzy |
7870 | msgid "Failed to open UDP sockets\n" | 7945 | msgid "Failed to open UDP sockets\n" |
7871 | msgstr "Misslyckades att binda till UDP6-port %d.\n" | 7946 | msgstr "Misslyckades att binda till UDP6-port %d.\n" |
7872 | 7947 | ||
7873 | #: src/transport/plugin_transport_udp.c:3857 | 7948 | #: src/transport/plugin_transport_udp.c:3879 |
7874 | #: src/transport/plugin_transport_udp.c:3871 | 7949 | #: src/transport/plugin_transport_udp.c:3893 |
7875 | msgid "must be in [0,65535]" | 7950 | msgid "must be in [0,65535]" |
7876 | msgstr "" | 7951 | msgstr "" |
7877 | 7952 | ||
7878 | #: src/transport/plugin_transport_udp.c:3903 | 7953 | #: src/transport/plugin_transport_udp.c:3925 |
7879 | #, fuzzy | 7954 | #, fuzzy |
7880 | msgid "must be valid IPv4 address" | 7955 | msgid "must be valid IPv4 address" |
7881 | msgstr "\"%s\" är inte tillgänglig." | 7956 | msgstr "\"%s\" är inte tillgänglig." |
7882 | 7957 | ||
7883 | #: src/transport/plugin_transport_udp.c:3930 | 7958 | #: src/transport/plugin_transport_udp.c:3952 |
7884 | #, fuzzy | 7959 | #, fuzzy |
7885 | msgid "must be valid IPv6 address" | 7960 | msgid "must be valid IPv6 address" |
7886 | msgstr "\"%s\" är inte tillgänglig." | 7961 | msgstr "\"%s\" är inte tillgänglig." |
7887 | 7962 | ||
7888 | #: src/transport/plugin_transport_udp.c:3996 | 7963 | #: src/transport/plugin_transport_udp.c:4018 |
7889 | #, fuzzy | 7964 | #, fuzzy |
7890 | msgid "Failed to create UDP network sockets\n" | 7965 | msgid "Failed to create UDP network sockets\n" |
7891 | msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" | 7966 | msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" |
@@ -8007,7 +8082,7 @@ msgstr "" | |||
8007 | msgid "Metadata `%s' failed to deserialize" | 8082 | msgid "Metadata `%s' failed to deserialize" |
8008 | msgstr "" | 8083 | msgstr "" |
8009 | 8084 | ||
8010 | #: src/util/client_new.c:864 | 8085 | #: src/util/client.c:864 |
8011 | #, c-format | 8086 | #, c-format |
8012 | msgid "Need a non-empty hostname for service `%s'.\n" | 8087 | msgid "Need a non-empty hostname for service `%s'.\n" |
8013 | msgstr "" | 8088 | msgstr "" |
@@ -8782,42 +8857,42 @@ msgstr "" | |||
8782 | msgid "Invalid IPv6 address `%s': %s\n" | 8857 | msgid "Invalid IPv6 address `%s': %s\n" |
8783 | msgstr "Ogiltigt svar på \"%s\".\n" | 8858 | msgstr "Ogiltigt svar på \"%s\".\n" |
8784 | 8859 | ||
8785 | #: src/util/strings.c:1475 src/util/strings.c:1491 | 8860 | #: src/util/strings.c:1541 src/util/strings.c:1557 |
8786 | msgid "Port not in range\n" | 8861 | msgid "Port not in range\n" |
8787 | msgstr "" | 8862 | msgstr "" |
8788 | 8863 | ||
8789 | #: src/util/strings.c:1500 | 8864 | #: src/util/strings.c:1566 |
8790 | #, fuzzy, c-format | 8865 | #, fuzzy, c-format |
8791 | msgid "Malformed port policy `%s'\n" | 8866 | msgid "Malformed port policy `%s'\n" |
8792 | msgstr "Misslyckades att starta samling.\n" | 8867 | msgstr "Misslyckades att starta samling.\n" |
8793 | 8868 | ||
8794 | #: src/util/strings.c:1583 src/util/strings.c:1614 src/util/strings.c:1662 | 8869 | #: src/util/strings.c:1649 src/util/strings.c:1680 src/util/strings.c:1728 |
8795 | #: src/util/strings.c:1683 | 8870 | #: src/util/strings.c:1749 |
8796 | #, c-format | 8871 | #, c-format |
8797 | msgid "Invalid format for IP: `%s'\n" | 8872 | msgid "Invalid format for IP: `%s'\n" |
8798 | msgstr "Ogiltigt format för IP: \"%s\"\n" | 8873 | msgstr "Ogiltigt format för IP: \"%s\"\n" |
8799 | 8874 | ||
8800 | #: src/util/strings.c:1640 | 8875 | #: src/util/strings.c:1706 |
8801 | #, c-format | 8876 | #, c-format |
8802 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." | 8877 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." |
8803 | msgstr "Ogiltig nätverksnotation (\"/%d\" är inte giltig i IPv4 CIDR)." | 8878 | msgstr "Ogiltig nätverksnotation (\"/%d\" är inte giltig i IPv4 CIDR)." |
8804 | 8879 | ||
8805 | #: src/util/strings.c:1692 | 8880 | #: src/util/strings.c:1758 |
8806 | #, fuzzy, c-format | 8881 | #, fuzzy, c-format |
8807 | msgid "Invalid format: `%s'\n" | 8882 | msgid "Invalid format: `%s'\n" |
8808 | msgstr "Ogiltigt format för IP: \"%s\"\n" | 8883 | msgstr "Ogiltigt format för IP: \"%s\"\n" |
8809 | 8884 | ||
8810 | #: src/util/strings.c:1744 | 8885 | #: src/util/strings.c:1810 |
8811 | #, c-format | 8886 | #, c-format |
8812 | msgid "Invalid network notation (does not end with ';': `%s')\n" | 8887 | msgid "Invalid network notation (does not end with ';': `%s')\n" |
8813 | msgstr "Ogiltig nätverksnotation (slutar inte med \";\": \"%s\")\n" | 8888 | msgstr "Ogiltig nätverksnotation (slutar inte med \";\": \"%s\")\n" |
8814 | 8889 | ||
8815 | #: src/util/strings.c:1794 | 8890 | #: src/util/strings.c:1860 |
8816 | #, fuzzy, c-format | 8891 | #, fuzzy, c-format |
8817 | msgid "Wrong format `%s' for netmask\n" | 8892 | msgid "Wrong format `%s' for netmask\n" |
8818 | msgstr "Fel format \"%s\" för nätmask: %s\n" | 8893 | msgstr "Fel format \"%s\" för nätmask: %s\n" |
8819 | 8894 | ||
8820 | #: src/util/strings.c:1825 | 8895 | #: src/util/strings.c:1891 |
8821 | #, fuzzy, c-format | 8896 | #, fuzzy, c-format |
8822 | msgid "Wrong format `%s' for network\n" | 8897 | msgid "Wrong format `%s' for network\n" |
8823 | msgstr "Fel format \"%s\" för nätverk: %s\n" | 8898 | msgstr "Fel format \"%s\" för nätverk: %s\n" |
@@ -9006,22 +9081,34 @@ msgid "Setup tunnels via VPN." | |||
9006 | msgstr "" | 9081 | msgstr "" |
9007 | 9082 | ||
9008 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 | 9083 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 |
9009 | #: src/include/gnunet_common.h:660 | 9084 | #: src/include/gnunet_common.h:662 src/include/gnunet_common.h:670 |
9010 | #, fuzzy, c-format | 9085 | #, fuzzy, c-format |
9011 | msgid "Assertion failed at %s:%d.\n" | 9086 | msgid "Assertion failed at %s:%d.\n" |
9012 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" | 9087 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" |
9013 | 9088 | ||
9014 | #: src/include/gnunet_common.h:672 | 9089 | #: src/include/gnunet_common.h:682 |
9015 | #, c-format | 9090 | #, c-format |
9016 | msgid "External protocol violation detected at %s:%d.\n" | 9091 | msgid "External protocol violation detected at %s:%d.\n" |
9017 | msgstr "" | 9092 | msgstr "" |
9018 | 9093 | ||
9019 | #: src/include/gnunet_common.h:699 src/include/gnunet_common.h:708 | 9094 | #: src/include/gnunet_common.h:709 src/include/gnunet_common.h:718 |
9020 | #, c-format | 9095 | #, c-format |
9021 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" | 9096 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" |
9022 | msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" | 9097 | msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" |
9023 | 9098 | ||
9024 | #, fuzzy | 9099 | #, fuzzy |
9100 | #~ msgid "Failed to run upnp client for port %u\n" | ||
9101 | #~ msgstr "Misslyckades att initiera tjänsten \"%s\".\n" | ||
9102 | |||
9103 | #, fuzzy | ||
9104 | #~ msgid "NAT plugin `%s' reports: %s\n" | ||
9105 | #~ msgstr "Testar transport(er) %s\n" | ||
9106 | |||
9107 | #, fuzzy | ||
9108 | #~ msgid "Failed to start resolver!\n" | ||
9109 | #~ msgstr "Misslyckades att starta samling.\n" | ||
9110 | |||
9111 | #, fuzzy | ||
9025 | #~ msgid "Unable to initialize Postgres: %s\n" | 9112 | #~ msgid "Unable to initialize Postgres: %s\n" |
9026 | #~ msgstr "Kunde inte initiera SQLite.\n" | 9113 | #~ msgstr "Kunde inte initiera SQLite.\n" |
9027 | 9114 | ||
@@ -10251,10 +10338,6 @@ msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" | |||
10251 | #~ msgstr "Startade samling \"%s\".\n" | 10338 | #~ msgstr "Startade samling \"%s\".\n" |
10252 | 10339 | ||
10253 | #, fuzzy | 10340 | #, fuzzy |
10254 | #~ msgid "Failed to write new configuration to disk." | ||
10255 | #~ msgstr "Kunde inte spara konfiguration!" | ||
10256 | |||
10257 | #, fuzzy | ||
10258 | #~ msgid "Could not start `%s' process to copy configuration file.\n" | 10341 | #~ msgid "Could not start `%s' process to copy configuration file.\n" |
10259 | #~ msgstr "Kunde inte skapa värdnyckel!\n" | 10342 | #~ msgstr "Kunde inte skapa värdnyckel!\n" |
10260 | 10343 | ||
@@ -10279,10 +10362,6 @@ msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" | |||
10279 | #~ msgstr "Kunde inte komma åt namnrymdsinformation.\n" | 10362 | #~ msgstr "Kunde inte komma åt namnrymdsinformation.\n" |
10280 | 10363 | ||
10281 | #, fuzzy | 10364 | #, fuzzy |
10282 | #~ msgid "Failed to find option %s in section %s!\n" | ||
10283 | #~ msgstr "Misslyckades att binda till UDP-port %d.\n" | ||
10284 | |||
10285 | #, fuzzy | ||
10286 | #~ msgid "Invalid configuration option `%s' in section `%s'\n" | 10365 | #~ msgid "Invalid configuration option `%s' in section `%s'\n" |
10287 | #~ msgstr "Konfigurationsfil \"%s\" skapad.\n" | 10366 | #~ msgstr "Konfigurationsfil \"%s\" skapad.\n" |
10288 | 10367 | ||
@@ -10462,10 +10541,6 @@ msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" | |||
10462 | #~ msgstr "Kunde inte slå upp \"%s\": %s\n" | 10541 | #~ msgstr "Kunde inte slå upp \"%s\": %s\n" |
10463 | 10542 | ||
10464 | #, fuzzy | 10543 | #, fuzzy |
10465 | #~ msgid "Misconfigured address to bind to in configuration!\n" | ||
10466 | #~ msgstr "Inga applikationer definierade i konfiguration!\n" | ||
10467 | |||
10468 | #, fuzzy | ||
10469 | #~ msgid "Failed to load transport plugin for http\n" | 10544 | #~ msgid "Failed to load transport plugin for http\n" |
10470 | #~ msgstr "Kunde inte slå upp \"%s\": %s\n" | 10545 | #~ msgstr "Kunde inte slå upp \"%s\": %s\n" |
10471 | 10546 | ||
@@ -10575,10 +10650,6 @@ msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" | |||
10575 | #~ msgstr "Hur mycket CPU (i %) får användas?" | 10650 | #~ msgstr "Hur mycket CPU (i %) får användas?" |
10576 | 10651 | ||
10577 | #, fuzzy | 10652 | #, fuzzy |
10578 | #~ msgid "Quota configuration" | ||
10579 | #~ msgstr "GNUnet-konfiguration" | ||
10580 | |||
10581 | #, fuzzy | ||
10582 | #~ msgid "Daemon configuration: user account" | 10653 | #~ msgid "Daemon configuration: user account" |
10583 | #~ msgstr "Kunde inte skapa användarkonto:" | 10654 | #~ msgstr "Kunde inte skapa användarkonto:" |
10584 | 10655 | ||
@@ -10586,10 +10657,6 @@ msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" | |||
10586 | #~ msgid "Save configuration?" | 10657 | #~ msgid "Save configuration?" |
10587 | #~ msgstr "GNUnet-konfiguration" | 10658 | #~ msgstr "GNUnet-konfiguration" |
10588 | 10659 | ||
10589 | #, fuzzy | ||
10590 | #~ msgid "GNUnet Configuration" | ||
10591 | #~ msgstr "GNUnet-konfiguration" | ||
10592 | |||
10593 | #~ msgid "Back" | 10660 | #~ msgid "Back" |
10594 | #~ msgstr "Tillbaka" | 10661 | #~ msgstr "Tillbaka" |
10595 | 10662 | ||
@@ -10618,10 +10685,6 @@ msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" | |||
10618 | #~ msgstr "Fel: kan inte ta bort tjänst: %s\n" | 10685 | #~ msgstr "Fel: kan inte ta bort tjänst: %s\n" |
10619 | 10686 | ||
10620 | #, fuzzy | 10687 | #, fuzzy |
10621 | #~ msgid "Configuration changed. Save?" | ||
10622 | #~ msgstr "Konfigurationsfil \"%s\" skapad.\n" | ||
10623 | |||
10624 | #, fuzzy | ||
10625 | #~ msgid "Error saving configuration." | 10688 | #~ msgid "Error saving configuration." |
10626 | #~ msgstr "Kunde inte spara konfiguration!" | 10689 | #~ msgstr "Kunde inte spara konfiguration!" |
10627 | 10690 | ||
@@ -8,7 +8,7 @@ msgid "" | |||
8 | msgstr "" | 8 | msgstr "" |
9 | "Project-Id-Version: gnunet 0.8.0a\n" | 9 | "Project-Id-Version: gnunet 0.8.0a\n" |
10 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 10 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
11 | "POT-Creation-Date: 2016-11-27 09:18+0100\n" | 11 | "POT-Creation-Date: 2017-01-12 17:19+0100\n" |
12 | "PO-Revision-Date: 2008-09-10 22:05+0930\n" | 12 | "PO-Revision-Date: 2008-09-10 22:05+0930\n" |
13 | "Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n" | 13 | "Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n" |
14 | "Language-Team: Vietnamese <vi-VN@googlegroups.com>\n" | 14 | "Language-Team: Vietnamese <vi-VN@googlegroups.com>\n" |
@@ -257,21 +257,20 @@ msgstr "" | |||
257 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 | 257 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 |
258 | #: src/transport/plugin_transport_tcp.c:652 | 258 | #: src/transport/plugin_transport_tcp.c:652 |
259 | #: src/transport/plugin_transport_tcp.c:658 | 259 | #: src/transport/plugin_transport_tcp.c:658 |
260 | #: src/transport/plugin_transport_tcp.c:3299 src/util/service.c:584 | 260 | #: src/transport/plugin_transport_tcp.c:3309 src/util/service.c:584 |
261 | #: src/util/service.c:590 src/util/service_new.c:637 | 261 | #: src/util/service.c:590 src/util/service_new.c:637 src/util/service_new.c:643 |
262 | #: src/util/service_new.c:643 | ||
263 | #, c-format | 262 | #, c-format |
264 | msgid "Require valid port number for service `%s' in configuration!\n" | 263 | msgid "Require valid port number for service `%s' in configuration!\n" |
265 | msgstr "" | 264 | msgstr "" |
266 | 265 | ||
267 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 | 266 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 |
268 | #: src/util/client_new.c:464 src/util/service.c:621 src/util/service_new.c:682 | 267 | #: src/util/client.c:464 src/util/service.c:621 src/util/service_new.c:682 |
269 | #, c-format | 268 | #, c-format |
270 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 269 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
271 | msgstr "" | 270 | msgstr "" |
272 | 271 | ||
273 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 | 272 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 |
274 | #: src/util/client_new.c:469 src/util/service.c:625 src/util/service_new.c:687 | 273 | #: src/util/client.c:469 src/util/service.c:625 src/util/service_new.c:687 |
275 | #, fuzzy, c-format | 274 | #, fuzzy, c-format |
276 | msgid "Using `%s' instead\n" | 275 | msgid "Using `%s' instead\n" |
277 | msgstr "%s: tùy chá»n « %s » là mÆ¡ hồ\n" | 276 | msgstr "%s: tùy chá»n « %s » là mÆ¡ hồ\n" |
@@ -291,7 +290,7 @@ msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | |||
291 | msgstr "" | 290 | msgstr "" |
292 | 291 | ||
293 | #: src/arm/gnunet-service-arm.c:513 | 292 | #: src/arm/gnunet-service-arm.c:513 |
294 | #: src/transport/plugin_transport_http_server.c:2617 | 293 | #: src/transport/plugin_transport_http_server.c:2620 |
295 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 | 294 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 |
296 | #: src/util/service_new.c:782 | 295 | #: src/util/service_new.c:782 |
297 | #, fuzzy, c-format | 296 | #, fuzzy, c-format |
@@ -299,7 +298,7 @@ msgid "Failed to resolve `%s': %s\n" | |||
299 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" | 298 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" |
300 | 299 | ||
301 | #: src/arm/gnunet-service-arm.c:532 | 300 | #: src/arm/gnunet-service-arm.c:532 |
302 | #: src/transport/plugin_transport_http_server.c:2635 | 301 | #: src/transport/plugin_transport_http_server.c:2638 |
303 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 | 302 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 |
304 | #: src/util/service_new.c:802 | 303 | #: src/util/service_new.c:802 |
305 | #, fuzzy, c-format | 304 | #, fuzzy, c-format |
@@ -394,13 +393,11 @@ msgid "" | |||
394 | "%llu\n" | 393 | "%llu\n" |
395 | msgstr "" | 394 | msgstr "" |
396 | 395 | ||
397 | #: src/ats/gnunet-ats-solver-eval.c:3293 | 396 | #: src/ats/gnunet-ats-solver-eval.c:3293 src/ats-tests/gnunet-solver-eval.c:935 |
398 | #: src/ats-tests/gnunet-solver-eval.c:935 | ||
399 | msgid "solver to use" | 397 | msgid "solver to use" |
400 | msgstr "" | 398 | msgstr "" |
401 | 399 | ||
402 | #: src/ats/gnunet-ats-solver-eval.c:3296 | 400 | #: src/ats/gnunet-ats-solver-eval.c:3296 src/ats-tests/gnunet-solver-eval.c:938 |
403 | #: src/ats-tests/gnunet-solver-eval.c:938 | ||
404 | #: src/ats-tests/gnunet-solver-eval.c:941 | 401 | #: src/ats-tests/gnunet-solver-eval.c:941 |
405 | msgid "experiment to use" | 402 | msgid "experiment to use" |
406 | msgstr "" | 403 | msgstr "" |
@@ -506,12 +503,12 @@ msgstr "" | |||
506 | msgid "Invalid %s configuration %f\n" | 503 | msgid "Invalid %s configuration %f\n" |
507 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 504 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
508 | 505 | ||
509 | #: src/ats-tests/ats-testing.c:441 | 506 | #: src/ats-tests/ats-testing.c:422 |
510 | #, c-format | 507 | #, c-format |
511 | msgid "Connected master [%u] with slave [%u]\n" | 508 | msgid "Connected master [%u] with slave [%u]\n" |
512 | msgstr "" | 509 | msgstr "" |
513 | 510 | ||
514 | #: src/ats-tests/ats-testing.c:448 | 511 | #: src/ats-tests/ats-testing.c:429 |
515 | #, fuzzy, c-format | 512 | #, fuzzy, c-format |
516 | msgid "Failed to connect master peer [%u] with slave [%u]\n" | 513 | msgid "Failed to connect master peer [%u] with slave [%u]\n" |
517 | msgstr "Lỗi kết nối đến gnunetd.\n" | 514 | msgstr "Lỗi kết nối đến gnunetd.\n" |
@@ -569,7 +566,7 @@ msgid "Quota for network `%11s' (in/out): %10s / %10s\n" | |||
569 | msgstr "" | 566 | msgstr "" |
570 | 567 | ||
571 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 | 568 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 |
572 | #: src/transport/gnunet-transport.c:1476 | 569 | #: src/transport/gnunet-transport.c:1255 |
573 | #, fuzzy, c-format | 570 | #, fuzzy, c-format |
574 | msgid "Failed to parse peer identity `%s'\n" | 571 | msgid "Failed to parse peer identity `%s'\n" |
575 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 572 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
@@ -656,6 +653,38 @@ msgstr "" | |||
656 | msgid "Print information about ATS state" | 653 | msgid "Print information about ATS state" |
657 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 654 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
658 | 655 | ||
656 | #: src/auction/gnunet-auction-create.c:69 | ||
657 | msgid "description of the item to be sold" | ||
658 | msgstr "" | ||
659 | |||
660 | #: src/auction/gnunet-auction-create.c:72 | ||
661 | msgid "mapping of possible prices" | ||
662 | msgstr "" | ||
663 | |||
664 | #: src/auction/gnunet-auction-create.c:75 | ||
665 | msgid "max duration per round" | ||
666 | msgstr "" | ||
667 | |||
668 | #: src/auction/gnunet-auction-create.c:78 | ||
669 | msgid "duration until auction starts" | ||
670 | msgstr "" | ||
671 | |||
672 | #: src/auction/gnunet-auction-create.c:81 | ||
673 | msgid "number of items to sell, 0 for first price auction" | ||
674 | msgstr "" | ||
675 | |||
676 | #: src/auction/gnunet-auction-create.c:84 | ||
677 | #, fuzzy | ||
678 | msgid "public auction outcome" | ||
679 | msgstr "Ứng dụng bị hủy bá»." | ||
680 | |||
681 | #: src/auction/gnunet-auction-create.c:94 src/auction/gnunet-auction-info.c:76 | ||
682 | #: src/auction/gnunet-auction-join.c:76 | ||
683 | #: src/conversation/gnunet-conversation-test.c:243 | ||
684 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
685 | msgid "help text" | ||
686 | msgstr "" | ||
687 | |||
659 | #: src/cadet/gnunet-cadet.c:511 | 688 | #: src/cadet/gnunet-cadet.c:511 |
660 | #, fuzzy, c-format | 689 | #, fuzzy, c-format |
661 | msgid "Invalid target `%s'\n" | 690 | msgid "Invalid target `%s'\n" |
@@ -712,7 +741,7 @@ msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | |||
712 | msgid "provide information about all tunnels" | 741 | msgid "provide information about all tunnels" |
713 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 742 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
714 | 743 | ||
715 | #: src/cadet/gnunet-service-cadet_peer.c:681 | 744 | #: src/cadet/gnunet-service-cadet_peer.c:686 |
716 | msgid "Wrong CORE service\n" | 745 | msgid "Wrong CORE service\n" |
717 | msgstr "" | 746 | msgstr "" |
718 | 747 | ||
@@ -1037,11 +1066,6 @@ msgid "" | |||
1037 | "played back to you..." | 1066 | "played back to you..." |
1038 | msgstr "" | 1067 | msgstr "" |
1039 | 1068 | ||
1040 | #: src/conversation/gnunet-conversation-test.c:243 | ||
1041 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
1042 | msgid "help text" | ||
1043 | msgstr "" | ||
1044 | |||
1045 | #: src/conversation/gnunet_gst.c:630 | 1069 | #: src/conversation/gnunet_gst.c:630 |
1046 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 | 1070 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 |
1047 | #, c-format | 1071 | #, c-format |
@@ -1246,7 +1270,7 @@ msgstr "Äối số không hợp lệ cho « %s ».\n" | |||
1246 | msgid "Failed to connect to CORE service!\n" | 1270 | msgid "Failed to connect to CORE service!\n" |
1247 | msgstr "Lỗi kết nối đến gnunetd.\n" | 1271 | msgstr "Lỗi kết nối đến gnunetd.\n" |
1248 | 1272 | ||
1249 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1677 | 1273 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1456 |
1250 | #, fuzzy | 1274 | #, fuzzy |
1251 | msgid "provide information about all current connections (continuously)" | 1275 | msgid "provide information about all current connections (continuously)" |
1252 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 1276 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
@@ -1531,7 +1555,7 @@ msgstr "kho dữ liệu sqlite" | |||
1531 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 | 1555 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 |
1532 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 | 1556 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 |
1533 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 | 1557 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 |
1534 | #: src/include/gnunet_common.h:681 src/include/gnunet_common.h:690 | 1558 | #: src/include/gnunet_common.h:691 src/include/gnunet_common.h:700 |
1535 | #: src/scalarproduct/scalarproduct.h:35 | 1559 | #: src/scalarproduct/scalarproduct.h:35 |
1536 | #, c-format | 1560 | #, c-format |
1537 | msgid "`%s' failed at %s:%d with error: %s\n" | 1561 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -1943,8 +1967,7 @@ msgstr "" | |||
1943 | msgid "Prints all packets that go through the DHT." | 1967 | msgid "Prints all packets that go through the DHT." |
1944 | msgstr "" | 1968 | msgstr "" |
1945 | 1969 | ||
1946 | #: src/dht/gnunet_dht_profiler.c:1161 | 1970 | #: src/dht/gnunet_dht_profiler.c:1161 src/testbed/gnunet-testbed-profiler.c:255 |
1947 | #: src/testbed/gnunet-testbed-profiler.c:255 | ||
1948 | #, fuzzy, c-format | 1971 | #, fuzzy, c-format |
1949 | msgid "Exiting as the number of peers is %u\n" | 1972 | msgid "Exiting as the number of peers is %u\n" |
1950 | msgstr "tăng sổ tối đa các kết nối TCP/IP" | 1973 | msgstr "tăng sổ tối đa các kết nối TCP/IP" |
@@ -2128,8 +2151,7 @@ msgstr "" | |||
2128 | msgid "# GET requests given to datacache" | 2151 | msgid "# GET requests given to datacache" |
2129 | msgstr "# các yêu cầu get (lấy) dht được nháºn" | 2152 | msgstr "# các yêu cầu get (lấy) dht được nháºn" |
2130 | 2153 | ||
2131 | #: src/dht/gnunet-service-dht_hello.c:84 | 2154 | #: src/dht/gnunet-service-dht_hello.c:84 src/dht/gnunet-service-xdht_hello.c:82 |
2132 | #: src/dht/gnunet-service-xdht_hello.c:82 | ||
2133 | #, fuzzy | 2155 | #, fuzzy |
2134 | msgid "# HELLOs obtained from peerinfo" | 2156 | msgid "# HELLOs obtained from peerinfo" |
2135 | msgstr "Nháºn được thông báo « %s » sai từ đồng đẳng « %s ».\n" | 2157 | msgstr "Nháºn được thông báo « %s » sai từ đồng đẳng « %s ».\n" |
@@ -2206,41 +2228,41 @@ msgstr "# các yêu cầu get (lấy) dht được nháºn" | |||
2206 | msgid "# P2P PUT bytes received" | 2228 | msgid "# P2P PUT bytes received" |
2207 | msgstr "# các yêu cầu get (lấy) dht được nháºn" | 2229 | msgstr "# các yêu cầu get (lấy) dht được nháºn" |
2208 | 2230 | ||
2209 | #: src/dht/gnunet-service-dht_neighbours.c:1854 | 2231 | #: src/dht/gnunet-service-dht_neighbours.c:1858 |
2210 | #, fuzzy | 2232 | #, fuzzy |
2211 | msgid "# FIND PEER requests ignored due to Bloomfilter" | 2233 | msgid "# FIND PEER requests ignored due to Bloomfilter" |
2212 | msgstr "# các yêu cầu được lá»c theo bá»™ lá»c bloom" | 2234 | msgstr "# các yêu cầu được lá»c theo bá»™ lá»c bloom" |
2213 | 2235 | ||
2214 | #: src/dht/gnunet-service-dht_neighbours.c:1862 | 2236 | #: src/dht/gnunet-service-dht_neighbours.c:1866 |
2215 | msgid "# FIND PEER requests ignored due to lack of HELLO" | 2237 | msgid "# FIND PEER requests ignored due to lack of HELLO" |
2216 | msgstr "" | 2238 | msgstr "" |
2217 | 2239 | ||
2218 | #: src/dht/gnunet-service-dht_neighbours.c:2018 | 2240 | #: src/dht/gnunet-service-dht_neighbours.c:2022 |
2219 | #, fuzzy | 2241 | #, fuzzy |
2220 | msgid "# P2P GET requests received" | 2242 | msgid "# P2P GET requests received" |
2221 | msgstr "# các yêu cầu get (lấy) dht được nháºn" | 2243 | msgstr "# các yêu cầu get (lấy) dht được nháºn" |
2222 | 2244 | ||
2223 | #: src/dht/gnunet-service-dht_neighbours.c:2022 | 2245 | #: src/dht/gnunet-service-dht_neighbours.c:2026 |
2224 | #, fuzzy | 2246 | #, fuzzy |
2225 | msgid "# P2P GET bytes received" | 2247 | msgid "# P2P GET bytes received" |
2226 | msgstr "# các yêu cầu get (lấy) dht được nháºn" | 2248 | msgstr "# các yêu cầu get (lấy) dht được nháºn" |
2227 | 2249 | ||
2228 | #: src/dht/gnunet-service-dht_neighbours.c:2097 | 2250 | #: src/dht/gnunet-service-dht_neighbours.c:2101 |
2229 | #, fuzzy | 2251 | #, fuzzy |
2230 | msgid "# P2P FIND PEER requests processed" | 2252 | msgid "# P2P FIND PEER requests processed" |
2231 | msgstr "# các yêu cầu get (lấy) dht được nháºn" | 2253 | msgstr "# các yêu cầu get (lấy) dht được nháºn" |
2232 | 2254 | ||
2233 | #: src/dht/gnunet-service-dht_neighbours.c:2120 | 2255 | #: src/dht/gnunet-service-dht_neighbours.c:2124 |
2234 | #, fuzzy | 2256 | #, fuzzy |
2235 | msgid "# P2P GET requests ONLY routed" | 2257 | msgid "# P2P GET requests ONLY routed" |
2236 | msgstr "# các yêu cầu dht được định tuyến" | 2258 | msgstr "# các yêu cầu dht được định tuyến" |
2237 | 2259 | ||
2238 | #: src/dht/gnunet-service-dht_neighbours.c:2222 | 2260 | #: src/dht/gnunet-service-dht_neighbours.c:2226 |
2239 | #, fuzzy | 2261 | #, fuzzy |
2240 | msgid "# P2P RESULTS received" | 2262 | msgid "# P2P RESULTS received" |
2241 | msgstr "# TÃn hiệu HTTP PUT được nháºn" | 2263 | msgstr "# TÃn hiệu HTTP PUT được nháºn" |
2242 | 2264 | ||
2243 | #: src/dht/gnunet-service-dht_neighbours.c:2226 | 2265 | #: src/dht/gnunet-service-dht_neighbours.c:2230 |
2244 | #, fuzzy | 2266 | #, fuzzy |
2245 | msgid "# P2P RESULT bytes received" | 2267 | msgid "# P2P RESULT bytes received" |
2246 | msgstr "# TÃn hiệu HTTP PUT được nháºn" | 2268 | msgstr "# TÃn hiệu HTTP PUT được nháºn" |
@@ -2250,35 +2272,35 @@ msgstr "# TÃn hiệu HTTP PUT được nháºn" | |||
2250 | msgid "# Network size estimates received" | 2272 | msgid "# Network size estimates received" |
2251 | msgstr "# các yêu cầu get (lấy) dht được nháºn" | 2273 | msgstr "# các yêu cầu get (lấy) dht được nháºn" |
2252 | 2274 | ||
2253 | #: src/dht/gnunet-service-dht_routing.c:218 | 2275 | #: src/dht/gnunet-service-dht_routing.c:220 |
2254 | msgid "# Good REPLIES matched against routing table" | 2276 | msgid "# Good REPLIES matched against routing table" |
2255 | msgstr "" | 2277 | msgstr "" |
2256 | 2278 | ||
2257 | #: src/dht/gnunet-service-dht_routing.c:227 | 2279 | #: src/dht/gnunet-service-dht_routing.c:229 |
2258 | msgid "# Duplicate REPLIES matched against routing table" | 2280 | msgid "# Duplicate REPLIES matched against routing table" |
2259 | msgstr "" | 2281 | msgstr "" |
2260 | 2282 | ||
2261 | #: src/dht/gnunet-service-dht_routing.c:233 | 2283 | #: src/dht/gnunet-service-dht_routing.c:235 |
2262 | msgid "# Invalid REPLIES matched against routing table" | 2284 | msgid "# Invalid REPLIES matched against routing table" |
2263 | msgstr "" | 2285 | msgstr "" |
2264 | 2286 | ||
2265 | #: src/dht/gnunet-service-dht_routing.c:239 | 2287 | #: src/dht/gnunet-service-dht_routing.c:241 |
2266 | msgid "# Irrelevant REPLIES matched against routing table" | 2288 | msgid "# Irrelevant REPLIES matched against routing table" |
2267 | msgstr "" | 2289 | msgstr "" |
2268 | 2290 | ||
2269 | #: src/dht/gnunet-service-dht_routing.c:251 | 2291 | #: src/dht/gnunet-service-dht_routing.c:253 |
2270 | msgid "# Unsupported REPLIES matched against routing table" | 2292 | msgid "# Unsupported REPLIES matched against routing table" |
2271 | msgstr "" | 2293 | msgstr "" |
2272 | 2294 | ||
2273 | #: src/dht/gnunet-service-dht_routing.c:327 | 2295 | #: src/dht/gnunet-service-dht_routing.c:329 |
2274 | msgid "# Entries removed from routing table" | 2296 | msgid "# Entries removed from routing table" |
2275 | msgstr "" | 2297 | msgstr "" |
2276 | 2298 | ||
2277 | #: src/dht/gnunet-service-dht_routing.c:409 | 2299 | #: src/dht/gnunet-service-dht_routing.c:411 |
2278 | msgid "# Entries added to routing table" | 2300 | msgid "# Entries added to routing table" |
2279 | msgstr "" | 2301 | msgstr "" |
2280 | 2302 | ||
2281 | #: src/dht/gnunet-service-dht_routing.c:427 | 2303 | #: src/dht/gnunet-service-dht_routing.c:429 |
2282 | #, fuzzy | 2304 | #, fuzzy |
2283 | msgid "# DHT requests combined" | 2305 | msgid "# DHT requests combined" |
2284 | msgstr "# các yêu cầu get (lấy) dht được nháºn" | 2306 | msgstr "# các yêu cầu get (lấy) dht được nháºn" |
@@ -2391,16 +2413,16 @@ msgid "" | |||
2391 | "SUPU %s, %s, %d, trail->prev_hop = %s" | 2413 | "SUPU %s, %s, %d, trail->prev_hop = %s" |
2392 | msgstr "" | 2414 | msgstr "" |
2393 | 2415 | ||
2394 | #: src/dht/plugin_block_dht.c:142 | 2416 | #: src/dht/plugin_block_dht.c:144 |
2395 | #, fuzzy, c-format | 2417 | #, fuzzy, c-format |
2396 | msgid "Block not of type %u\n" | 2418 | msgid "Block not of type %u\n" |
2397 | msgstr "Không biết truyá»n tải nà o kiểu %d.\n" | 2419 | msgstr "Không biết truyá»n tải nà o kiểu %d.\n" |
2398 | 2420 | ||
2399 | #: src/dht/plugin_block_dht.c:149 | 2421 | #: src/dht/plugin_block_dht.c:151 |
2400 | msgid "Size mismatch for block\n" | 2422 | msgid "Size mismatch for block\n" |
2401 | msgstr "" | 2423 | msgstr "" |
2402 | 2424 | ||
2403 | #: src/dht/plugin_block_dht.c:159 | 2425 | #: src/dht/plugin_block_dht.c:161 |
2404 | #, c-format | 2426 | #, c-format |
2405 | msgid "Block of type %u is malformed\n" | 2427 | msgid "Block of type %u is malformed\n" |
2406 | msgstr "" | 2428 | msgstr "" |
@@ -3534,7 +3556,7 @@ msgid "Option `%s' is required when using option `%s'.\n" | |||
3534 | msgstr "Tùy chá»n « %s » cần thiết khi dùng tùy chá»n « %s ».\n" | 3556 | msgstr "Tùy chá»n « %s » cần thiết khi dùng tùy chá»n « %s ».\n" |
3535 | 3557 | ||
3536 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 | 3558 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 |
3537 | #: src/transport/gnunet-transport.c:1517 src/transport/gnunet-transport.c:1542 | 3559 | #: src/transport/gnunet-transport.c:1296 src/transport/gnunet-transport.c:1321 |
3538 | #, c-format | 3560 | #, c-format |
3539 | msgid "Option `%s' makes no sense without option `%s'.\n" | 3561 | msgid "Option `%s' makes no sense without option `%s'.\n" |
3540 | msgstr "Tùy chá»n « %s » không có nghÄ©a khi không có tùy chá»n « %s ».\n" | 3562 | msgstr "Tùy chá»n « %s » không có nghÄ©a khi không có tùy chá»n « %s ».\n" |
@@ -4077,41 +4099,41 @@ msgstr "Nháºn yêu cầu định tuyến\n" | |||
4077 | msgid "Received unsupported DNS request from %s\n" | 4099 | msgid "Received unsupported DNS request from %s\n" |
4078 | msgstr "Nháºn yêu cầu định tuyến\n" | 4100 | msgstr "Nháºn yêu cầu định tuyến\n" |
4079 | 4101 | ||
4080 | #: src/gns/gnunet-dns2gns.c:709 | 4102 | #: src/gns/gnunet-dns2gns.c:712 |
4081 | msgid "No ego configured for `dns2gns` subsystem\n" | 4103 | msgid "No ego configured for `dns2gns` subsystem\n" |
4082 | msgstr "" | 4104 | msgstr "" |
4083 | 4105 | ||
4084 | #: src/gns/gnunet-dns2gns.c:737 | 4106 | #: src/gns/gnunet-dns2gns.c:740 |
4085 | #, fuzzy | 4107 | #, fuzzy |
4086 | msgid "No DNS server specified!\n" | 4108 | msgid "No DNS server specified!\n" |
4087 | msgstr "Chưa ghi rõ từ khoá.\n" | 4109 | msgstr "Chưa ghi rõ từ khoá.\n" |
4088 | 4110 | ||
4089 | #: src/gns/gnunet-dns2gns.c:758 | 4111 | #: src/gns/gnunet-dns2gns.c:761 |
4090 | #, fuzzy | 4112 | #, fuzzy |
4091 | msgid "No valid GNS zone specified!\n" | 4113 | msgid "No valid GNS zone specified!\n" |
4092 | msgstr "Chưa ghi rõ từ khoá.\n" | 4114 | msgstr "Chưa ghi rõ từ khoá.\n" |
4093 | 4115 | ||
4094 | #: src/gns/gnunet-dns2gns.c:779 | 4116 | #: src/gns/gnunet-dns2gns.c:782 |
4095 | msgid "IP of recursive DNS resolver to use (required)" | 4117 | msgid "IP of recursive DNS resolver to use (required)" |
4096 | msgstr "" | 4118 | msgstr "" |
4097 | 4119 | ||
4098 | #: src/gns/gnunet-dns2gns.c:782 | 4120 | #: src/gns/gnunet-dns2gns.c:785 |
4099 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" | 4121 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" |
4100 | msgstr "" | 4122 | msgstr "" |
4101 | 4123 | ||
4102 | #: src/gns/gnunet-dns2gns.c:785 | 4124 | #: src/gns/gnunet-dns2gns.c:788 |
4103 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" | 4125 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" |
4104 | msgstr "" | 4126 | msgstr "" |
4105 | 4127 | ||
4106 | #: src/gns/gnunet-dns2gns.c:788 | 4128 | #: src/gns/gnunet-dns2gns.c:791 |
4107 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4129 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4108 | msgstr "" | 4130 | msgstr "" |
4109 | 4131 | ||
4110 | #: src/gns/gnunet-dns2gns.c:791 | 4132 | #: src/gns/gnunet-dns2gns.c:794 |
4111 | msgid "Public key of the GNS zone to use (overrides default)" | 4133 | msgid "Public key of the GNS zone to use (overrides default)" |
4112 | msgstr "" | 4134 | msgstr "" |
4113 | 4135 | ||
4114 | #: src/gns/gnunet-dns2gns.c:804 | 4136 | #: src/gns/gnunet-dns2gns.c:807 |
4115 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4137 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4116 | msgstr "" | 4138 | msgstr "" |
4117 | 4139 | ||
@@ -4276,83 +4298,85 @@ msgstr "" | |||
4276 | msgid "Unsupported HTTP method `%s'\n" | 4298 | msgid "Unsupported HTTP method `%s'\n" |
4277 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" | 4299 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" |
4278 | 4300 | ||
4279 | #: src/gns/gnunet-gns-proxy.c:2167 | 4301 | #: src/gns/gnunet-gns-proxy.c:2168 |
4280 | #, fuzzy, c-format | 4302 | #, fuzzy, c-format |
4281 | msgid "Unable to import private key from file `%s'\n" | 4303 | msgid "Unable to import private key from file `%s'\n" |
4282 | msgstr "Không thể tạo tà i khoản ngÆ°á»i dùng:" | 4304 | msgstr "Không thể tạo tà i khoản ngÆ°á»i dùng:" |
4283 | 4305 | ||
4284 | #: src/gns/gnunet-gns-proxy.c:2197 | 4306 | #: src/gns/gnunet-gns-proxy.c:2198 |
4285 | #, fuzzy, c-format | 4307 | #, fuzzy, c-format |
4286 | msgid "Unable to import certificate %s\n" | 4308 | msgid "Unable to import certificate %s\n" |
4287 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 4309 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
4288 | 4310 | ||
4289 | #: src/gns/gnunet-gns-proxy.c:2370 | 4311 | #: src/gns/gnunet-gns-proxy.c:2371 |
4290 | #, fuzzy, c-format | 4312 | #, fuzzy, c-format |
4291 | msgid "Failed to start HTTPS server for `%s'\n" | 4313 | msgid "Failed to start HTTPS server for `%s'\n" |
4292 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | 4314 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
4293 | 4315 | ||
4294 | #: src/gns/gnunet-gns-proxy.c:2389 src/rest/gnunet-rest-server.c:533 | 4316 | #: src/gns/gnunet-gns-proxy.c:2390 src/rest/gnunet-rest-server.c:533 |
4295 | #, fuzzy | 4317 | #, fuzzy |
4296 | msgid "Failed to pass client to MHD\n" | 4318 | msgid "Failed to pass client to MHD\n" |
4297 | msgstr "Lỗi kết nối đến gnunetd.\n" | 4319 | msgstr "Lỗi kết nối đến gnunetd.\n" |
4298 | 4320 | ||
4299 | #: src/gns/gnunet-gns-proxy.c:2709 | 4321 | #: src/gns/gnunet-gns-proxy.c:2710 |
4300 | #, fuzzy, c-format | 4322 | #, fuzzy, c-format |
4301 | msgid "Unsupported socks version %d\n" | 4323 | msgid "Unsupported socks version %d\n" |
4302 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" | 4324 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" |
4303 | 4325 | ||
4304 | #: src/gns/gnunet-gns-proxy.c:2738 | 4326 | #: src/gns/gnunet-gns-proxy.c:2739 |
4305 | #, fuzzy, c-format | 4327 | #, fuzzy, c-format |
4306 | msgid "Unsupported socks command %d\n" | 4328 | msgid "Unsupported socks command %d\n" |
4307 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" | 4329 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" |
4308 | 4330 | ||
4309 | #: src/gns/gnunet-gns-proxy.c:2756 src/gns/gnunet-gns-proxy.c:2785 | 4331 | #: src/gns/gnunet-gns-proxy.c:2757 src/gns/gnunet-gns-proxy.c:2786 |
4310 | msgid "SSL connection to plain IPv4 address requested\n" | 4332 | msgid "SSL connection to plain IPv4 address requested\n" |
4311 | msgstr "" | 4333 | msgstr "" |
4312 | 4334 | ||
4313 | #: src/gns/gnunet-gns-proxy.c:2836 | 4335 | #: src/gns/gnunet-gns-proxy.c:2837 |
4314 | #, fuzzy, c-format | 4336 | #, fuzzy, c-format |
4315 | msgid "Unsupported socks address type %d\n" | 4337 | msgid "Unsupported socks address type %d\n" |
4316 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" | 4338 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" |
4317 | 4339 | ||
4318 | #: src/gns/gnunet-gns-proxy.c:3171 | 4340 | #: src/gns/gnunet-gns-proxy.c:3172 |
4319 | msgid "No ego configured for `shorten-zone`\n" | 4341 | msgid "No ego configured for `shorten-zone`\n" |
4320 | msgstr "" | 4342 | msgstr "" |
4321 | 4343 | ||
4322 | #: src/gns/gnunet-gns-proxy.c:3211 src/gns/gnunet-service-gns.c:1093 | 4344 | #: src/gns/gnunet-gns-proxy.c:3212 src/gns/gnunet-service-gns.c:493 |
4323 | #: src/gns/gnunet-service-gns.c:1149 | 4345 | #: src/gns/gnunet-service-gns.c:548 |
4324 | #, c-format | 4346 | #, c-format |
4325 | msgid "No ego configured for `%s`\n" | 4347 | msgid "No ego configured for `%s`\n" |
4326 | msgstr "" | 4348 | msgstr "" |
4327 | 4349 | ||
4328 | #: src/gns/gnunet-gns-proxy.c:3273 | 4350 | #: src/gns/gnunet-gns-proxy.c:3274 |
4329 | #, fuzzy, c-format | 4351 | #, fuzzy, c-format |
4330 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" | 4352 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" |
4331 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 4353 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
4332 | 4354 | ||
4333 | #: src/gns/gnunet-gns-proxy.c:3313 | 4355 | #: src/gns/gnunet-gns-proxy.c:3314 |
4334 | msgid "listen on specified port (default: 7777)" | 4356 | msgid "listen on specified port (default: 7777)" |
4335 | msgstr "" | 4357 | msgstr "" |
4336 | 4358 | ||
4337 | #: src/gns/gnunet-gns-proxy.c:3316 | 4359 | #: src/gns/gnunet-gns-proxy.c:3317 |
4338 | msgid "pem file to use as CA" | 4360 | msgid "pem file to use as CA" |
4339 | msgstr "" | 4361 | msgstr "" |
4340 | 4362 | ||
4341 | #: src/gns/gnunet-gns-proxy.c:3335 | 4363 | #: src/gns/gnunet-gns-proxy.c:3336 |
4342 | msgid "GNUnet GNS proxy" | 4364 | msgid "GNUnet GNS proxy" |
4343 | msgstr "" | 4365 | msgstr "" |
4344 | 4366 | ||
4345 | #: src/gns/gnunet-service-gns.c:1187 | 4367 | #: src/gns/gnunet-service-gns.c:585 |
4368 | #: src/zonemaster/gnunet-service-zonemaster.c:705 | ||
4346 | #, fuzzy | 4369 | #, fuzzy |
4347 | msgid "Failed to connect to the namestore!\n" | 4370 | msgid "Failed to connect to the namestore!\n" |
4348 | msgstr "Không kết nối được đến trình ná»n gnunetd." | 4371 | msgstr "Không kết nối được đến trình ná»n gnunetd." |
4349 | 4372 | ||
4350 | #: src/gns/gnunet-service-gns.c:1195 | 4373 | #: src/gns/gnunet-service-gns.c:593 |
4351 | #, fuzzy | 4374 | #, fuzzy |
4352 | msgid "Failed to connect to the namecache!\n" | 4375 | msgid "Failed to connect to the namecache!\n" |
4353 | msgstr "Không kết nối được đến trình ná»n gnunetd." | 4376 | msgstr "Không kết nối được đến trình ná»n gnunetd." |
4354 | 4377 | ||
4355 | #: src/gns/gnunet-service-gns.c:1228 | 4378 | #: src/gns/gnunet-service-gns.c:612 |
4379 | #: src/zonemaster/gnunet-service-zonemaster.c:740 | ||
4356 | #, fuzzy | 4380 | #, fuzzy |
4357 | msgid "Could not connect to DHT!\n" | 4381 | msgid "Could not connect to DHT!\n" |
4358 | msgstr "Không thể kết nối tới %s:%u: %s\n" | 4382 | msgstr "Không thể kết nối tới %s:%u: %s\n" |
@@ -5207,8 +5231,7 @@ msgstr "" | |||
5207 | msgid "Invalid public key for reverse lookup `%s'\n" | 5231 | msgid "Invalid public key for reverse lookup `%s'\n" |
5208 | msgstr "Äối số không hợp lệ cho « %s ».\n" | 5232 | msgstr "Äối số không hợp lệ cho « %s ».\n" |
5209 | 5233 | ||
5210 | #: src/namestore/gnunet-namestore.c:979 | 5234 | #: src/namestore/gnunet-namestore.c:979 src/peerinfo-tool/gnunet-peerinfo.c:775 |
5211 | #: src/peerinfo-tool/gnunet-peerinfo.c:775 | ||
5212 | #, fuzzy, c-format | 5235 | #, fuzzy, c-format |
5213 | msgid "Invalid URI `%s'\n" | 5236 | msgid "Invalid URI `%s'\n" |
5214 | msgstr "Dữ liệu nháºp không hợp lệ.\n" | 5237 | msgstr "Dữ liệu nháºp không hợp lệ.\n" |
@@ -5367,217 +5390,293 @@ msgstr "kho dữ liệu sqlite" | |||
5367 | msgid "Namestore REST API initialized\n" | 5390 | msgid "Namestore REST API initialized\n" |
5368 | msgstr "Lỗi sơ khởi lõi.\n" | 5391 | msgstr "Lỗi sơ khởi lõi.\n" |
5369 | 5392 | ||
5370 | #: src/nat/gnunet-nat.c:159 | 5393 | #: src/nat-auto/gnunet-nat-auto.c:192 |
5371 | msgid "GNUnet NAT traversal autoconfigure daemon" | 5394 | #, fuzzy |
5395 | msgid "Suggested configuration changes:\n" | ||
5372 | msgstr "" | 5396 | msgstr "" |
5397 | "\n" | ||
5398 | "CHƯA lưu các thay đổi trong cấu hình.\n" | ||
5373 | 5399 | ||
5374 | #: src/nat/gnunet-nat-server.c:321 | 5400 | #: src/nat-auto/gnunet-nat-auto.c:220 |
5401 | #, fuzzy, c-format | ||
5402 | msgid "Failed to write configuration to `%s'\n" | ||
5403 | msgstr "Lỗi lưu cấu hình." | ||
5404 | |||
5405 | #: src/nat-auto/gnunet-nat-auto.c:227 | ||
5406 | #, fuzzy, c-format | ||
5407 | msgid "Wrote updated configuration to `%s'\n" | ||
5408 | msgstr "Không thể truy cáºp đến táºp tin gnunet-directory « %s »\n" | ||
5409 | |||
5410 | #: src/nat-auto/gnunet-nat-auto.c:345 | ||
5411 | #, fuzzy | ||
5412 | msgid "run autoconfiguration" | ||
5413 | msgstr "Cấu hình hạn ngạch" | ||
5414 | |||
5415 | #: src/nat-auto/gnunet-nat-auto.c:348 | ||
5416 | msgid "section name providing the configuration for the adapter" | ||
5417 | msgstr "" | ||
5418 | |||
5419 | #: src/nat-auto/gnunet-nat-auto.c:351 src/nat/gnunet-nat.c:436 | ||
5420 | msgid "use TCP" | ||
5421 | msgstr "" | ||
5422 | |||
5423 | #: src/nat-auto/gnunet-nat-auto.c:354 src/nat/gnunet-nat.c:439 | ||
5424 | msgid "use UDP" | ||
5425 | msgstr "" | ||
5426 | |||
5427 | #: src/nat-auto/gnunet-nat-auto.c:357 | ||
5428 | msgid "write configuration file (for autoconfiguration)" | ||
5429 | msgstr "" | ||
5430 | |||
5431 | #: src/nat-auto/gnunet-nat-auto.c:369 | ||
5432 | #, fuzzy | ||
5433 | msgid "GNUnet NAT traversal autoconfiguration" | ||
5434 | msgstr "Cấu hình GNUnet" | ||
5435 | |||
5436 | #: src/nat-auto/gnunet-nat-auto_legacy.c:403 | ||
5437 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:681 | ||
5438 | #: src/nat-auto/nat_auto_api_test.c:405 | ||
5439 | #, fuzzy | ||
5440 | msgid "Failed to connect to `gnunet-nat-server'\n" | ||
5441 | msgstr "Lỗi kết nối đến gnunetd.\n" | ||
5442 | |||
5443 | #: src/nat-auto/gnunet-nat-auto_legacy.c:518 | ||
5444 | #: src/nat-auto/nat_auto_api_test.c:520 | ||
5445 | #, c-format | ||
5446 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5447 | msgstr "" | ||
5448 | |||
5449 | #: src/nat-auto/gnunet-nat-auto_legacy.c:568 | ||
5450 | #: src/nat-auto/nat_auto_api_test.c:569 | ||
5451 | #, fuzzy | ||
5452 | msgid "NAT test failed to start NAT library\n" | ||
5453 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | ||
5454 | |||
5455 | #: src/nat-auto/gnunet-nat-server.c:336 | ||
5375 | #, c-format | 5456 | #, c-format |
5376 | msgid "Please pass valid port number as the first argument! (got `%s')\n" | 5457 | msgid "Please pass valid port number as the first argument! (got `%s')\n" |
5377 | msgstr "" | 5458 | msgstr "" |
5378 | 5459 | ||
5379 | #: src/nat/gnunet-nat-server.c:363 | 5460 | #: src/nat-auto/gnunet-nat-server.c:386 |
5380 | msgid "GNUnet NAT traversal test helper daemon" | 5461 | msgid "GNUnet NAT traversal test helper daemon" |
5381 | msgstr "" | 5462 | msgstr "" |
5382 | 5463 | ||
5383 | #: src/nat/nat_api.c:880 src/nat/nat.c:2010 | 5464 | #: src/nat-auto/gnunet-service-nat-auto.c:342 |
5465 | msgid "UPnP client `upnpc` command not found, disabling UPnP\n" | ||
5466 | msgstr "" | ||
5467 | |||
5468 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:385 | ||
5469 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5470 | msgstr "" | ||
5471 | |||
5472 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:386 | ||
5473 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5474 | msgstr "" | ||
5475 | |||
5476 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:405 | ||
5477 | #, fuzzy | ||
5478 | msgid "Testing connection reversal with ICMP server.\n" | ||
5479 | msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" | ||
5480 | |||
5481 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:437 | ||
5482 | #, c-format | ||
5483 | msgid "Detected external IP `%s'\n" | ||
5484 | msgstr "" | ||
5485 | |||
5486 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:572 | ||
5487 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | ||
5488 | msgstr "" | ||
5489 | |||
5490 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:590 | ||
5491 | #, fuzzy, c-format | ||
5492 | msgid "Detected internal network address `%s'.\n" | ||
5493 | msgstr "GNUnet bây giỠsỠdụng địa chỉ IP %s.\n" | ||
5494 | |||
5495 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:724 | ||
5496 | msgid "upnpc found, enabling its use\n" | ||
5497 | msgstr "" | ||
5498 | |||
5499 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:725 | ||
5500 | msgid "upnpc not found\n" | ||
5501 | msgstr "" | ||
5502 | |||
5503 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:762 | ||
5504 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5505 | msgstr "" | ||
5506 | |||
5507 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:774 | ||
5508 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:834 | ||
5509 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | ||
5510 | msgstr "" | ||
5511 | |||
5512 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:786 | ||
5513 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:846 | ||
5514 | msgid "No working gnunet-helper-nat-server found\n" | ||
5515 | msgstr "" | ||
5516 | |||
5517 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:823 | ||
5518 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | ||
5519 | msgstr "" | ||
5520 | |||
5521 | #: src/nat-auto/nat_auto_api.c:76 | ||
5384 | msgid "Operation Successful" | 5522 | msgid "Operation Successful" |
5385 | msgstr "" | 5523 | msgstr "" |
5386 | 5524 | ||
5387 | #: src/nat/nat_api.c:882 src/nat/nat.c:2012 | 5525 | #: src/nat-auto/nat_auto_api.c:78 |
5388 | msgid "Internal Failure (IPC, ...)" | 5526 | msgid "IPC failure" |
5389 | msgstr "" | 5527 | msgstr "" |
5390 | 5528 | ||
5391 | #: src/nat/nat_api.c:884 src/nat/nat.c:2014 | 5529 | #: src/nat-auto/nat_auto_api.c:80 |
5392 | msgid "Failure in network subsystem, check permissions." | 5530 | msgid "Failure in network subsystem, check permissions." |
5393 | msgstr "" | 5531 | msgstr "" |
5394 | 5532 | ||
5395 | #: src/nat/nat_api.c:886 src/nat/nat.c:2016 | 5533 | #: src/nat-auto/nat_auto_api.c:82 |
5396 | msgid "Encountered timeout while performing operation" | 5534 | msgid "Encountered timeout while performing operation" |
5397 | msgstr "" | 5535 | msgstr "" |
5398 | 5536 | ||
5399 | #: src/nat/nat_api.c:888 src/nat/nat.c:2018 | 5537 | #: src/nat-auto/nat_auto_api.c:84 |
5400 | msgid "detected that we are offline" | 5538 | msgid "detected that we are offline" |
5401 | msgstr "" | 5539 | msgstr "" |
5402 | 5540 | ||
5403 | #: src/nat/nat_api.c:890 src/nat/nat.c:2020 | 5541 | #: src/nat-auto/nat_auto_api.c:86 |
5404 | msgid "`upnpc` command not found" | 5542 | msgid "`upnpc` command not found" |
5405 | msgstr "" | 5543 | msgstr "" |
5406 | 5544 | ||
5407 | #: src/nat/nat_api.c:892 src/nat/nat.c:2022 | 5545 | #: src/nat-auto/nat_auto_api.c:88 |
5408 | #, fuzzy | 5546 | #, fuzzy |
5409 | msgid "Failed to run `upnpc` command" | 5547 | msgid "Failed to run `upnpc` command" |
5410 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | 5548 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
5411 | 5549 | ||
5412 | #: src/nat/nat_api.c:894 src/nat/nat.c:2024 | 5550 | #: src/nat-auto/nat_auto_api.c:90 |
5413 | msgid "`upnpc' command took too long, process killed" | 5551 | msgid "`upnpc' command took too long, process killed" |
5414 | msgstr "" | 5552 | msgstr "" |
5415 | 5553 | ||
5416 | #: src/nat/nat_api.c:896 src/nat/nat.c:2026 | 5554 | #: src/nat-auto/nat_auto_api.c:92 |
5417 | msgid "`upnpc' command failed to establish port mapping" | 5555 | msgid "`upnpc' command failed to establish port mapping" |
5418 | msgstr "" | 5556 | msgstr "" |
5419 | 5557 | ||
5420 | #: src/nat/nat_api.c:898 src/nat/nat.c:2028 | 5558 | #: src/nat-auto/nat_auto_api.c:94 |
5421 | msgid "`external-ip' command not found" | 5559 | msgid "`external-ip' command not found" |
5422 | msgstr "" | 5560 | msgstr "" |
5423 | 5561 | ||
5424 | #: src/nat/nat_api.c:900 src/nat/nat.c:2030 | 5562 | #: src/nat-auto/nat_auto_api.c:96 |
5425 | #, fuzzy | 5563 | #, fuzzy |
5426 | msgid "Failed to run `external-ip` command" | 5564 | msgid "Failed to run `external-ip` command" |
5427 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | 5565 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
5428 | 5566 | ||
5429 | #: src/nat/nat_api.c:902 src/nat/nat.c:2032 | 5567 | #: src/nat-auto/nat_auto_api.c:98 |
5430 | msgid "`external-ip' command output invalid" | 5568 | msgid "`external-ip' command output invalid" |
5431 | msgstr "" | 5569 | msgstr "" |
5432 | 5570 | ||
5433 | #: src/nat/nat_api.c:904 src/nat/nat.c:2034 | 5571 | #: src/nat-auto/nat_auto_api.c:100 |
5434 | msgid "no valid address was returned by `external-ip'" | 5572 | msgid "no valid address was returned by `external-ip'" |
5435 | msgstr "" | 5573 | msgstr "" |
5436 | 5574 | ||
5437 | #: src/nat/nat_api.c:906 src/nat/nat.c:2036 | 5575 | #: src/nat-auto/nat_auto_api.c:102 |
5438 | #, fuzzy | 5576 | #, fuzzy |
5439 | msgid "Could not determine interface with internal/local network address" | 5577 | msgid "Could not determine interface with internal/local network address" |
5440 | msgstr "Không thể truy cáºp đến thông tin vá» không gian tên.\n" | 5578 | msgstr "Không thể truy cáºp đến thông tin vá» không gian tên.\n" |
5441 | 5579 | ||
5442 | #: src/nat/nat_api.c:908 src/nat/nat.c:2038 | 5580 | #: src/nat-auto/nat_auto_api.c:104 |
5443 | msgid "No functioning gnunet-helper-nat-server installation found" | 5581 | msgid "No functioning gnunet-helper-nat-server installation found" |
5444 | msgstr "" | 5582 | msgstr "" |
5445 | 5583 | ||
5446 | #: src/nat/nat_api.c:910 src/nat/nat.c:2040 | 5584 | #: src/nat-auto/nat_auto_api.c:106 |
5447 | msgid "NAT test could not be initialized" | 5585 | msgid "NAT test could not be initialized" |
5448 | msgstr "" | 5586 | msgstr "" |
5449 | 5587 | ||
5450 | #: src/nat/nat_api.c:912 src/nat/nat.c:2042 | 5588 | #: src/nat-auto/nat_auto_api.c:108 |
5451 | msgid "NAT test timeout reached" | 5589 | msgid "NAT test timeout reached" |
5452 | msgstr "" | 5590 | msgstr "" |
5453 | 5591 | ||
5454 | #: src/nat/nat_api.c:914 src/nat/nat.c:2044 | 5592 | #: src/nat-auto/nat_auto_api.c:110 |
5455 | msgid "could not register NAT" | 5593 | msgid "could not register NAT" |
5456 | msgstr "" | 5594 | msgstr "" |
5457 | 5595 | ||
5458 | #: src/nat/nat_api.c:916 src/nat/nat.c:2046 | 5596 | #: src/nat-auto/nat_auto_api.c:112 |
5459 | msgid "No working gnunet-helper-nat-client installation found" | 5597 | msgid "No working gnunet-helper-nat-client installation found" |
5460 | msgstr "" | 5598 | msgstr "" |
5461 | 5599 | ||
5462 | #: src/nat/nat_auto.c:385 | 5600 | #: src/nat-auto/nat_auto_api_test.c:477 |
5463 | msgid "NAT traversal with ICMP Server succeeded.\n" | 5601 | #, fuzzy, c-format |
5464 | msgstr "" | 5602 | msgid "Failed to find valid PORT in section `%s'\n" |
5603 | msgstr "Lỗi đóng kết đến cổng %s %d.\n" | ||
5465 | 5604 | ||
5466 | #: src/nat/nat_auto.c:386 | 5605 | #: src/nat/gnunet-nat.c:424 |
5467 | msgid "NAT traversal with ICMP Server failed.\n" | 5606 | msgid "which IP and port are we locally using to bind/listen to" |
5468 | msgstr "" | 5607 | msgstr "" |
5469 | 5608 | ||
5470 | #: src/nat/nat_auto.c:405 | 5609 | #: src/nat/gnunet-nat.c:427 |
5471 | #, fuzzy | 5610 | msgid "which remote IP and port should be asked for connection reversal" |
5472 | msgid "Testing connection reversal with ICMP server.\n" | ||
5473 | msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" | ||
5474 | |||
5475 | #: src/nat/nat_auto.c:437 | ||
5476 | #, c-format | ||
5477 | msgid "Detected external IP `%s'\n" | ||
5478 | msgstr "" | 5611 | msgstr "" |
5479 | 5612 | ||
5480 | #: src/nat/nat_auto.c:572 | 5613 | #: src/nat/gnunet-nat.c:430 |
5481 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | 5614 | msgid "" |
5615 | "name of configuration section to find additional options, such as manual " | ||
5616 | "host punching data" | ||
5482 | msgstr "" | 5617 | msgstr "" |
5483 | 5618 | ||
5484 | #: src/nat/nat_auto.c:590 | 5619 | #: src/nat/gnunet-nat.c:433 |
5485 | #, fuzzy, c-format | 5620 | msgid "enable STUN processing" |
5486 | msgid "Detected internal network address `%s'.\n" | ||
5487 | msgstr "GNUnet bây giỠsỠdụng địa chỉ IP %s.\n" | ||
5488 | |||
5489 | #: src/nat/nat_auto.c:681 src/nat/nat_test.c:403 | ||
5490 | #, fuzzy | ||
5491 | msgid "Failed to connect to `gnunet-nat-server'\n" | ||
5492 | msgstr "Lỗi kết nối đến gnunetd.\n" | ||
5493 | |||
5494 | #: src/nat/nat_auto.c:724 | ||
5495 | msgid "upnpc found, enabling its use\n" | ||
5496 | msgstr "" | 5621 | msgstr "" |
5497 | 5622 | ||
5498 | #: src/nat/nat_auto.c:725 | 5623 | #: src/nat/gnunet-nat.c:442 |
5499 | msgid "upnpc not found\n" | 5624 | msgid "watch for connection reversal requests" |
5500 | msgstr "" | 5625 | msgstr "" |
5501 | 5626 | ||
5502 | #: src/nat/nat_auto.c:762 | 5627 | #: src/nat/gnunet-nat.c:454 |
5503 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | 5628 | msgid "GNUnet NAT traversal autoconfigure daemon" |
5504 | msgstr "" | ||
5505 | |||
5506 | #: src/nat/nat_auto.c:774 src/nat/nat_auto.c:834 | ||
5507 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | ||
5508 | msgstr "" | 5629 | msgstr "" |
5509 | 5630 | ||
5510 | #: src/nat/nat_auto.c:786 src/nat/nat_auto.c:846 | 5631 | #: src/nat/gnunet-service-nat.c:1313 |
5511 | msgid "No working gnunet-helper-nat-server found\n" | 5632 | #, c-format |
5633 | msgid "Malformed punched hole specification `%s' (lacks port)\n" | ||
5512 | msgstr "" | 5634 | msgstr "" |
5513 | 5635 | ||
5514 | #: src/nat/nat_auto.c:823 | 5636 | #: src/nat/gnunet-service-nat.c:1323 |
5515 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | 5637 | #, c-format |
5638 | msgid "Invalid port number in punched hole specification `%s' (lacks port)\n" | ||
5516 | msgstr "" | 5639 | msgstr "" |
5517 | 5640 | ||
5518 | #: src/nat/nat.c:1019 | 5641 | #: src/nat/gnunet-service-nat.c:1339 |
5519 | #, c-format | 5642 | #, c-format |
5520 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" | 5643 | msgid "Malformed punched hole specification `%s' (lacks `]')\n" |
5521 | msgstr "" | 5644 | msgstr "" |
5522 | 5645 | ||
5523 | #: src/nat/nat.c:1070 | 5646 | #: src/nat/gnunet-service-nat.c:1350 |
5524 | #, fuzzy, c-format | 5647 | #, c-format |
5525 | msgid "Failed to start %s\n" | 5648 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
5526 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | ||
5527 | |||
5528 | #: src/nat/nat.c:1327 | ||
5529 | msgid "Error while running upnp client:\n" | ||
5530 | msgstr "" | 5649 | msgstr "" |
5531 | 5650 | ||
5532 | #: src/nat/nat.c:1402 | 5651 | #: src/nat/gnunet-service-nat.c:1803 |
5533 | #, fuzzy, c-format | 5652 | #, fuzzy |
5534 | msgid "Failed to run upnp client for port %u\n" | 5653 | msgid "Connection reversal request failed\n" |
5535 | msgstr "Lá»—i sÆ¡ khởi dịch vụ « %s ».\n" | 5654 | msgstr "Thu tháºp bị dừng.\n" |
5536 | |||
5537 | #: src/nat/nat.c:1546 | ||
5538 | msgid "malformed" | ||
5539 | msgstr "" | ||
5540 | 5655 | ||
5541 | #: src/nat/nat.c:1600 | 5656 | #: src/nat/gnunet-service-nat.c:1876 |
5542 | msgid "" | 5657 | msgid "" |
5543 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 5658 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
5544 | "disabling UPnP \n" | 5659 | "disabling UPnP\n" |
5545 | msgstr "" | 5660 | msgstr "" |
5546 | 5661 | ||
5547 | #: src/nat/nat.c:1726 src/nat/nat.c:1739 | 5662 | #: src/nat/gnunet-service-nat_helper.c:186 |
5548 | #, c-format | 5663 | #, c-format |
5549 | msgid "" | 5664 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" |
5550 | "Configuration requires `%s', but binary is not installed properly (SUID bit " | ||
5551 | "not set). Option disabled.\n" | ||
5552 | msgstr "" | ||
5553 | |||
5554 | #: src/nat/nat.c:1903 | ||
5555 | msgid "Internal IP address not known, cannot use ICMP NAT traversal method\n" | ||
5556 | msgstr "" | 5665 | msgstr "" |
5557 | 5666 | ||
5558 | #: src/nat/nat.c:1919 | 5667 | #: src/nat/gnunet-service-nat_helper.c:260 |
5559 | #, c-format | 5668 | #, fuzzy, c-format |
5560 | msgid "Running gnunet-helper-nat-client %s %s %u\n" | 5669 | msgid "Failed to start %s\n" |
5561 | msgstr "" | 5670 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
5562 | 5671 | ||
5563 | #: src/nat/nat_mini.c:205 | 5672 | #: src/nat/gnunet-service-nat_mini.c:196 |
5564 | msgid "`external-ip' command not found\n" | 5673 | msgid "`external-ip' command not found\n" |
5565 | msgstr "" | 5674 | msgstr "" |
5566 | 5675 | ||
5567 | #: src/nat/nat_mini.c:611 | 5676 | #: src/nat/gnunet-service-nat_mini.c:654 |
5568 | msgid "`upnpc' command not found\n" | 5677 | msgid "`upnpc' command not found\n" |
5569 | msgstr "" | 5678 | msgstr "" |
5570 | 5679 | ||
5571 | #: src/nat/nat_test.c:518 | ||
5572 | #, c-format | ||
5573 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5574 | msgstr "" | ||
5575 | |||
5576 | #: src/nat/nat_test.c:568 | ||
5577 | #, fuzzy | ||
5578 | msgid "NAT test failed to start NAT library\n" | ||
5579 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | ||
5580 | |||
5581 | #: src/nse/gnunet-nse.c:122 | 5680 | #: src/nse/gnunet-nse.c:122 |
5582 | #, fuzzy | 5681 | #, fuzzy |
5583 | msgid "Show network size estimates from NSE service." | 5682 | msgid "Show network size estimates from NSE service." |
@@ -7390,182 +7489,159 @@ msgstr "" | |||
7390 | msgid "# validations succeeded" | 7489 | msgid "# validations succeeded" |
7391 | msgstr "" | 7490 | msgstr "" |
7392 | 7491 | ||
7393 | #: src/transport/gnunet-transport.c:486 | 7492 | #: src/transport/gnunet-transport.c:418 |
7394 | #, fuzzy, c-format | 7493 | #, fuzzy, c-format |
7395 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" | 7494 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" |
7396 | msgstr "Äang thá» tải danh sách các máy xuống « %s »\n" | 7495 | msgstr "Äang thá» tải danh sách các máy xuống « %s »\n" |
7397 | 7496 | ||
7398 | #: src/transport/gnunet-transport.c:496 | 7497 | #: src/transport/gnunet-transport.c:428 |
7399 | #, fuzzy, c-format | 7498 | #, fuzzy, c-format |
7400 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" | 7499 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" |
7401 | msgstr "Nháºn yêu cầu định tuyến\n" | 7500 | msgstr "Nháºn yêu cầu định tuyến\n" |
7402 | 7501 | ||
7403 | #: src/transport/gnunet-transport.c:540 | 7502 | #: src/transport/gnunet-transport.c:472 |
7404 | #, fuzzy, c-format | 7503 | #, fuzzy, c-format |
7405 | msgid "Failed to connect to `%s'\n" | 7504 | msgid "Failed to connect to `%s'\n" |
7406 | msgstr "Lỗi kết nối đến gnunetd.\n" | 7505 | msgstr "Lỗi kết nối đến gnunetd.\n" |
7407 | 7506 | ||
7408 | #: src/transport/gnunet-transport.c:553 | 7507 | #: src/transport/gnunet-transport.c:485 |
7409 | #, fuzzy, c-format | 7508 | #, fuzzy, c-format |
7410 | msgid "Failed to resolve address for peer `%s'\n" | 7509 | msgid "Failed to resolve address for peer `%s'\n" |
7411 | msgstr "Lỗi đóng kết đến cổng %s %d.\n" | 7510 | msgstr "Lỗi đóng kết đến cổng %s %d.\n" |
7412 | 7511 | ||
7413 | #: src/transport/gnunet-transport.c:565 | 7512 | #: src/transport/gnunet-transport.c:499 |
7414 | #, fuzzy | 7513 | #, fuzzy |
7415 | msgid "Failed to list connections, timeout occured\n" | 7514 | msgid "Failed to list connections, timeout occured\n" |
7416 | msgstr "Không kết nối được đến trình ná»n gnunetd." | 7515 | msgstr "Không kết nối được đến trình ná»n gnunetd." |
7417 | 7516 | ||
7418 | #: src/transport/gnunet-transport.c:588 | 7517 | #: src/transport/gnunet-transport.c:532 |
7419 | #, fuzzy, c-format | ||
7420 | msgid "NAT plugin `%s' reports: %s\n" | ||
7421 | msgstr "Äang nạp các truyá»n tải « %s »\n" | ||
7422 | |||
7423 | #: src/transport/gnunet-transport.c:675 | ||
7424 | msgid "No transport plugins configured, peer will never communicate\n" | ||
7425 | msgstr "" | ||
7426 | |||
7427 | #: src/transport/gnunet-transport.c:689 | ||
7428 | #, c-format | ||
7429 | msgid "No port configured for plugin `%s', cannot test it\n" | ||
7430 | msgstr "" | ||
7431 | |||
7432 | #: src/transport/gnunet-transport.c:714 | ||
7433 | #, fuzzy | ||
7434 | msgid "Failed to start resolver!\n" | ||
7435 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | ||
7436 | |||
7437 | #: src/transport/gnunet-transport.c:750 | ||
7438 | #, fuzzy, c-format | 7518 | #, fuzzy, c-format |
7439 | msgid "Transmitting %u bytes\n" | 7519 | msgid "Transmitting %u bytes\n" |
7440 | msgstr "Äang thá» tải danh sách các máy xuống « %s »\n" | 7520 | msgstr "Äang thá» tải danh sách các máy xuống « %s »\n" |
7441 | 7521 | ||
7442 | #: src/transport/gnunet-transport.c:784 | 7522 | #: src/transport/gnunet-transport.c:566 |
7443 | #, c-format | 7523 | #, c-format |
7444 | msgid "" | 7524 | msgid "" |
7445 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " | 7525 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " |
7446 | "blocks\n" | 7526 | "blocks\n" |
7447 | msgstr "" | 7527 | msgstr "" |
7448 | 7528 | ||
7449 | #: src/transport/gnunet-transport.c:815 | 7529 | #: src/transport/gnunet-transport.c:597 |
7450 | #, fuzzy, c-format | 7530 | #, fuzzy, c-format |
7451 | msgid "Disconnected from peer `%s' while benchmarking\n" | 7531 | msgid "Disconnected from peer `%s' while benchmarking\n" |
7452 | msgstr "« %.*s » được kết nối tới « %.*s ».\n" | 7532 | msgstr "« %.*s » được kết nối tới « %.*s ».\n" |
7453 | 7533 | ||
7454 | #: src/transport/gnunet-transport.c:839 src/transport/gnunet-transport.c:868 | 7534 | #: src/transport/gnunet-transport.c:621 src/transport/gnunet-transport.c:650 |
7455 | #, c-format | 7535 | #, c-format |
7456 | msgid "%24s: %-17s %4s (%u connections in total)\n" | 7536 | msgid "%24s: %-17s %4s (%u connections in total)\n" |
7457 | msgstr "" | 7537 | msgstr "" |
7458 | 7538 | ||
7459 | #: src/transport/gnunet-transport.c:841 | 7539 | #: src/transport/gnunet-transport.c:623 |
7460 | #, fuzzy | 7540 | #, fuzzy |
7461 | msgid "Connected to" | 7541 | msgid "Connected to" |
7462 | msgstr "« %s » được kết nối tới « %s ».\n" | 7542 | msgstr "« %s » được kết nối tới « %s ».\n" |
7463 | 7543 | ||
7464 | #: src/transport/gnunet-transport.c:870 | 7544 | #: src/transport/gnunet-transport.c:652 |
7465 | #, fuzzy | 7545 | #, fuzzy |
7466 | msgid "Disconnected from" | 7546 | msgid "Disconnected from" |
7467 | msgstr "« %.*s » được kết nối tới « %.*s ».\n" | 7547 | msgstr "« %.*s » được kết nối tới « %.*s ».\n" |
7468 | 7548 | ||
7469 | #: src/transport/gnunet-transport.c:905 | 7549 | #: src/transport/gnunet-transport.c:687 |
7470 | #, fuzzy, c-format | 7550 | #, fuzzy, c-format |
7471 | msgid "Received %u bytes\n" | 7551 | msgid "Received %u bytes\n" |
7472 | msgstr "Nháºn yêu cầu định tuyến\n" | 7552 | msgstr "Nháºn yêu cầu định tuyến\n" |
7473 | 7553 | ||
7474 | #: src/transport/gnunet-transport.c:942 | 7554 | #: src/transport/gnunet-transport.c:724 |
7475 | #, c-format | 7555 | #, c-format |
7476 | msgid "Peer `%s': %s %s in state `%s' until %s\n" | 7556 | msgid "Peer `%s': %s %s in state `%s' until %s\n" |
7477 | msgstr "" | 7557 | msgstr "" |
7478 | 7558 | ||
7479 | #: src/transport/gnunet-transport.c:954 | 7559 | #: src/transport/gnunet-transport.c:736 |
7480 | #, fuzzy, c-format | 7560 | #, fuzzy, c-format |
7481 | msgid "Peer `%s': %s %s\n" | 7561 | msgid "Peer `%s': %s %s\n" |
7482 | msgstr "Tôi là đồng đẳng « %s ».\n" | 7562 | msgstr "Tôi là đồng đẳng « %s ».\n" |
7483 | 7563 | ||
7484 | #: src/transport/gnunet-transport.c:1366 | 7564 | #: src/transport/gnunet-transport.c:1150 |
7485 | #, fuzzy | 7565 | #, fuzzy |
7486 | msgid "Monitor disconnected from transport service. Reconnecting.\n" | 7566 | msgid "Monitor disconnected from transport service. Reconnecting.\n" |
7487 | msgstr "Lỗi kết nối đến gnunetd.\n" | 7567 | msgstr "Lỗi kết nối đến gnunetd.\n" |
7488 | 7568 | ||
7489 | #: src/transport/gnunet-transport.c:1488 | 7569 | #: src/transport/gnunet-transport.c:1267 |
7490 | #, c-format | 7570 | #, c-format |
7491 | msgid "" | 7571 | msgid "" |
7492 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " | 7572 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " |
7493 | "%s, %s %s\n" | 7573 | "%s, %s %s\n" |
7494 | msgstr "" | 7574 | msgstr "" |
7495 | 7575 | ||
7496 | #: src/transport/gnunet-transport.c:1501 | 7576 | #: src/transport/gnunet-transport.c:1280 |
7497 | #, c-format | 7577 | #, c-format |
7498 | msgid "" | 7578 | msgid "" |
7499 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" | 7579 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" |
7500 | msgstr "" | 7580 | msgstr "" |
7501 | 7581 | ||
7502 | #: src/transport/gnunet-transport.c:1529 | 7582 | #: src/transport/gnunet-transport.c:1308 |
7503 | #, fuzzy | 7583 | #, fuzzy |
7504 | msgid "Failed to connect to transport service for disconnection\n" | 7584 | msgid "Failed to connect to transport service for disconnection\n" |
7505 | msgstr "Lỗi kết nối đến gnunetd.\n" | 7585 | msgstr "Lỗi kết nối đến gnunetd.\n" |
7506 | 7586 | ||
7507 | #: src/transport/gnunet-transport.c:1535 | 7587 | #: src/transport/gnunet-transport.c:1314 |
7508 | msgid "Blacklisting request in place, stop with CTRL-C\n" | 7588 | msgid "Blacklisting request in place, stop with CTRL-C\n" |
7509 | msgstr "" | 7589 | msgstr "" |
7510 | 7590 | ||
7511 | #: src/transport/gnunet-transport.c:1558 src/transport/gnunet-transport.c:1588 | 7591 | #: src/transport/gnunet-transport.c:1337 src/transport/gnunet-transport.c:1367 |
7512 | #: src/transport/gnunet-transport.c:1641 | 7592 | #: src/transport/gnunet-transport.c:1420 |
7513 | #, fuzzy | 7593 | #, fuzzy |
7514 | msgid "Failed to connect to transport service\n" | 7594 | msgid "Failed to connect to transport service\n" |
7515 | msgstr "Lỗi kết nối đến gnunetd.\n" | 7595 | msgstr "Lỗi kết nối đến gnunetd.\n" |
7516 | 7596 | ||
7517 | #: src/transport/gnunet-transport.c:1595 | 7597 | #: src/transport/gnunet-transport.c:1374 |
7518 | msgid "Starting to receive benchmark data\n" | 7598 | msgid "Starting to receive benchmark data\n" |
7519 | msgstr "" | 7599 | msgstr "" |
7520 | 7600 | ||
7521 | #: src/transport/gnunet-transport.c:1665 | 7601 | #: src/transport/gnunet-transport.c:1444 |
7522 | #, fuzzy | 7602 | #, fuzzy |
7523 | msgid "print information for all peers (instead of only connected peers)" | 7603 | msgid "print information for all peers (instead of only connected peers)" |
7524 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 7604 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
7525 | 7605 | ||
7526 | #: src/transport/gnunet-transport.c:1668 | 7606 | #: src/transport/gnunet-transport.c:1447 |
7527 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" | 7607 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" |
7528 | msgstr "" | 7608 | msgstr "" |
7529 | 7609 | ||
7530 | #: src/transport/gnunet-transport.c:1671 | 7610 | #: src/transport/gnunet-transport.c:1450 |
7531 | #, fuzzy | 7611 | #, fuzzy |
7532 | msgid "disconnect from a peer" | 7612 | msgid "disconnect from a peer" |
7533 | msgstr "Lỗi kết nối đến gnunetd.\n" | 7613 | msgstr "Lỗi kết nối đến gnunetd.\n" |
7534 | 7614 | ||
7535 | #: src/transport/gnunet-transport.c:1674 | 7615 | #: src/transport/gnunet-transport.c:1453 |
7536 | #, fuzzy | 7616 | #, fuzzy |
7537 | msgid "provide information about all current connections (once)" | 7617 | msgid "provide information about all current connections (once)" |
7538 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 7618 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
7539 | 7619 | ||
7540 | #: src/transport/gnunet-transport.c:1680 | 7620 | #: src/transport/gnunet-transport.c:1459 |
7541 | #, fuzzy | 7621 | #, fuzzy |
7542 | msgid "" | 7622 | msgid "" |
7543 | "provide information about all connects and disconnect events (continuously)" | 7623 | "provide information about all connects and disconnect events (continuously)" |
7544 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 7624 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
7545 | 7625 | ||
7546 | #: src/transport/gnunet-transport.c:1683 | 7626 | #: src/transport/gnunet-transport.c:1462 |
7547 | #, fuzzy | 7627 | #, fuzzy |
7548 | msgid "do not resolve hostnames" | 7628 | msgid "do not resolve hostnames" |
7549 | msgstr "không quyết định các tên máy" | 7629 | msgstr "không quyết định các tên máy" |
7550 | 7630 | ||
7551 | #: src/transport/gnunet-transport.c:1686 | 7631 | #: src/transport/gnunet-transport.c:1465 |
7552 | #: src/transport/gnunet-transport-profiler.c:631 | 7632 | #: src/transport/gnunet-transport-profiler.c:631 |
7553 | msgid "peer identity" | 7633 | msgid "peer identity" |
7554 | msgstr "" | 7634 | msgstr "" |
7555 | 7635 | ||
7556 | #: src/transport/gnunet-transport.c:1689 | 7636 | #: src/transport/gnunet-transport.c:1468 |
7557 | msgid "monitor plugin sessions" | 7637 | msgid "monitor plugin sessions" |
7558 | msgstr "" | 7638 | msgstr "" |
7559 | 7639 | ||
7560 | #: src/transport/gnunet-transport.c:1692 | 7640 | #: src/transport/gnunet-transport.c:1471 |
7561 | msgid "send data for benchmarking to the other peer (until CTRL-C)" | 7641 | msgid "send data for benchmarking to the other peer (until CTRL-C)" |
7562 | msgstr "" | 7642 | msgstr "" |
7563 | 7643 | ||
7564 | #: src/transport/gnunet-transport.c:1695 | 7644 | #: src/transport/gnunet-transport.c:1482 |
7565 | msgid "test transport configuration (involves external server)" | ||
7566 | msgstr "" | ||
7567 | |||
7568 | #: src/transport/gnunet-transport.c:1706 | ||
7569 | #: src/transport/gnunet-transport-profiler.c:642 | 7645 | #: src/transport/gnunet-transport-profiler.c:642 |
7570 | #, fuzzy | 7646 | #, fuzzy |
7571 | msgid "Direct access to transport service." | 7647 | msgid "Direct access to transport service." |
@@ -7602,9 +7678,9 @@ msgstr "kÃch cỡ tin nhắn" | |||
7602 | 7678 | ||
7603 | #: src/transport/plugin_transport_http_client.c:1477 | 7679 | #: src/transport/plugin_transport_http_client.c:1477 |
7604 | #: src/transport/plugin_transport_http_server.c:2248 | 7680 | #: src/transport/plugin_transport_http_server.c:2248 |
7605 | #: src/transport/plugin_transport_http_server.c:3457 | 7681 | #: src/transport/plugin_transport_http_server.c:3462 |
7606 | #: src/transport/plugin_transport_tcp.c:3365 | 7682 | #: src/transport/plugin_transport_tcp.c:3375 |
7607 | #: src/transport/plugin_transport_tcp.c:3372 | 7683 | #: src/transport/plugin_transport_tcp.c:3382 |
7608 | msgid "TCP_STEALTH not supported on this platform.\n" | 7684 | msgid "TCP_STEALTH not supported on this platform.\n" |
7609 | msgstr "" | 7685 | msgstr "" |
7610 | 7686 | ||
@@ -7614,13 +7690,13 @@ msgid "Could not initialize curl multi handle, failed to start %s plugin!\n" | |||
7614 | msgstr "" | 7690 | msgstr "" |
7615 | 7691 | ||
7616 | #: src/transport/plugin_transport_http_client.c:2167 | 7692 | #: src/transport/plugin_transport_http_client.c:2167 |
7617 | #: src/transport/plugin_transport_http_server.c:3172 | 7693 | #: src/transport/plugin_transport_http_server.c:3177 |
7618 | #, fuzzy, c-format | 7694 | #, fuzzy, c-format |
7619 | msgid "Shutting down plugin `%s'\n" | 7695 | msgid "Shutting down plugin `%s'\n" |
7620 | msgstr "Äang nạp các truyá»n tải « %s »\n" | 7696 | msgstr "Äang nạp các truyá»n tải « %s »\n" |
7621 | 7697 | ||
7622 | #: src/transport/plugin_transport_http_client.c:2184 | 7698 | #: src/transport/plugin_transport_http_client.c:2184 |
7623 | #: src/transport/plugin_transport_http_server.c:3242 | 7699 | #: src/transport/plugin_transport_http_server.c:3247 |
7624 | #, fuzzy, c-format | 7700 | #, fuzzy, c-format |
7625 | msgid "Shutdown for plugin `%s' complete\n" | 7701 | msgid "Shutdown for plugin `%s' complete\n" |
7626 | msgstr "Tải lên « %s » hoà n thà nh, địa chỉ URI là « %s ».\n" | 7702 | msgstr "Tải lên « %s » hoà n thà nh, địa chỉ URI là « %s ».\n" |
@@ -7663,73 +7739,73 @@ msgstr "" | |||
7663 | msgid "Could not load or create server certificate! Loading plugin failed!\n" | 7739 | msgid "Could not load or create server certificate! Loading plugin failed!\n" |
7664 | msgstr "" | 7740 | msgstr "" |
7665 | 7741 | ||
7666 | #: src/transport/plugin_transport_http_server.c:2583 | 7742 | #: src/transport/plugin_transport_http_server.c:2586 |
7667 | #, fuzzy | 7743 | #, fuzzy |
7668 | msgid "Require valid port number for service in configuration!\n" | 7744 | msgid "Require valid port number for service in configuration!\n" |
7669 | msgstr "Lỗi lưu cấu hình." | 7745 | msgstr "Lỗi lưu cấu hình." |
7670 | 7746 | ||
7671 | #: src/transport/plugin_transport_http_server.c:2748 | 7747 | #: src/transport/plugin_transport_http_server.c:2751 |
7672 | #, c-format | 7748 | #, c-format |
7673 | msgid "Found %u addresses to report to NAT service\n" | 7749 | msgid "Found %u addresses to report to NAT service\n" |
7674 | msgstr "" | 7750 | msgstr "" |
7675 | 7751 | ||
7676 | #: src/transport/plugin_transport_http_server.c:2832 | 7752 | #: src/transport/plugin_transport_http_server.c:2837 |
7677 | #: src/transport/plugin_transport_udp.c:3600 | 7753 | #: src/transport/plugin_transport_udp.c:3623 |
7678 | msgid "Disabling IPv6 since it is not supported on this system!\n" | 7754 | msgid "Disabling IPv6 since it is not supported on this system!\n" |
7679 | msgstr "" | 7755 | msgstr "" |
7680 | 7756 | ||
7681 | #: src/transport/plugin_transport_http_server.c:2938 | 7757 | #: src/transport/plugin_transport_http_server.c:2943 |
7682 | #, c-format | 7758 | #, c-format |
7683 | msgid "IPv4 support is %s\n" | 7759 | msgid "IPv4 support is %s\n" |
7684 | msgstr "" | 7760 | msgstr "" |
7685 | 7761 | ||
7686 | #: src/transport/plugin_transport_http_server.c:2953 | 7762 | #: src/transport/plugin_transport_http_server.c:2958 |
7687 | #, c-format | 7763 | #, c-format |
7688 | msgid "IPv6 support is %s\n" | 7764 | msgid "IPv6 support is %s\n" |
7689 | msgstr "" | 7765 | msgstr "" |
7690 | 7766 | ||
7691 | #: src/transport/plugin_transport_http_server.c:2959 | 7767 | #: src/transport/plugin_transport_http_server.c:2964 |
7692 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" | 7768 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" |
7693 | msgstr "" | 7769 | msgstr "" |
7694 | 7770 | ||
7695 | #: src/transport/plugin_transport_http_server.c:2970 | 7771 | #: src/transport/plugin_transport_http_server.c:2975 |
7696 | #, fuzzy | 7772 | #, fuzzy |
7697 | msgid "Port is required! Fix in configuration\n" | 7773 | msgid "Port is required! Fix in configuration\n" |
7698 | msgstr "" | 7774 | msgstr "" |
7699 | "\n" | 7775 | "\n" |
7700 | "Kết thúc cấu hình.\n" | 7776 | "Kết thúc cấu hình.\n" |
7701 | 7777 | ||
7702 | #: src/transport/plugin_transport_http_server.c:2976 | 7778 | #: src/transport/plugin_transport_http_server.c:2981 |
7703 | #, fuzzy, c-format | 7779 | #, fuzzy, c-format |
7704 | msgid "Using port %u\n" | 7780 | msgid "Using port %u\n" |
7705 | msgstr "Äang thá» nghiệm (các) truyá»n tải %s\n" | 7781 | msgstr "Äang thá» nghiệm (các) truyá»n tải %s\n" |
7706 | 7782 | ||
7707 | #: src/transport/plugin_transport_http_server.c:2995 | 7783 | #: src/transport/plugin_transport_http_server.c:3000 |
7708 | #, fuzzy, c-format | 7784 | #, fuzzy, c-format |
7709 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" | 7785 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" |
7710 | msgstr "Äang thá» dùng táºp tin « %s » cho cấu hình MySQL.\n" | 7786 | msgstr "Äang thá» dùng táºp tin « %s » cho cấu hình MySQL.\n" |
7711 | 7787 | ||
7712 | #: src/transport/plugin_transport_http_server.c:3030 | 7788 | #: src/transport/plugin_transport_http_server.c:3035 |
7713 | #, fuzzy, c-format | 7789 | #, fuzzy, c-format |
7714 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" | 7790 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" |
7715 | msgstr "Äang thá» dùng táºp tin « %s » cho cấu hình MySQL.\n" | 7791 | msgstr "Äang thá» dùng táºp tin « %s » cho cấu hình MySQL.\n" |
7716 | 7792 | ||
7717 | #: src/transport/plugin_transport_http_server.c:3105 | 7793 | #: src/transport/plugin_transport_http_server.c:3110 |
7718 | #, fuzzy, c-format | 7794 | #, fuzzy, c-format |
7719 | msgid "Using external hostname `%s'\n" | 7795 | msgid "Using external hostname `%s'\n" |
7720 | msgstr "Äang bắt đầu tà i vỠ« %s »\n" | 7796 | msgstr "Äang bắt đầu tà i vỠ« %s »\n" |
7721 | 7797 | ||
7722 | #: src/transport/plugin_transport_http_server.c:3126 | 7798 | #: src/transport/plugin_transport_http_server.c:3131 |
7723 | #, fuzzy, c-format | 7799 | #, fuzzy, c-format |
7724 | msgid "Notifying transport only about hostname `%s'\n" | 7800 | msgid "Notifying transport only about hostname `%s'\n" |
7725 | msgstr "không quyết định các tên máy" | 7801 | msgstr "không quyết định các tên máy" |
7726 | 7802 | ||
7727 | #: src/transport/plugin_transport_http_server.c:3143 | 7803 | #: src/transport/plugin_transport_http_server.c:3148 |
7728 | #, fuzzy, c-format | 7804 | #, fuzzy, c-format |
7729 | msgid "Maximum number of connections is %u\n" | 7805 | msgid "Maximum number of connections is %u\n" |
7730 | msgstr "tăng sổ tối đa các kết nối TCP/IP" | 7806 | msgstr "tăng sổ tối đa các kết nối TCP/IP" |
7731 | 7807 | ||
7732 | #: src/transport/plugin_transport_http_server.c:3469 | 7808 | #: src/transport/plugin_transport_http_server.c:3474 |
7733 | #, fuzzy | 7809 | #, fuzzy |
7734 | msgid "Unable to compile URL regex\n" | 7810 | msgid "Unable to compile URL regex\n" |
7735 | msgstr "Không thể sơ khởi SQLite: %s.\n" | 7811 | msgstr "Không thể sơ khởi SQLite: %s.\n" |
@@ -7776,167 +7852,167 @@ msgstr "# các byte đã gá»i qua SMTP" | |||
7776 | msgid "# bytes dropped by SMTP (outgoing)" | 7852 | msgid "# bytes dropped by SMTP (outgoing)" |
7777 | msgstr "# các byte loại đi bởi SMTP (đi ra)" | 7853 | msgstr "# các byte loại đi bởi SMTP (đi ra)" |
7778 | 7854 | ||
7779 | #: src/transport/plugin_transport_tcp.c:1051 | 7855 | #: src/transport/plugin_transport_tcp.c:1060 |
7780 | #: src/transport/plugin_transport_tcp.c:2362 | 7856 | #: src/transport/plugin_transport_tcp.c:2379 |
7781 | #, fuzzy, c-format | 7857 | #, fuzzy, c-format |
7782 | msgid "Unexpected address length: %u bytes\n" | 7858 | msgid "Unexpected address length: %u bytes\n" |
7783 | msgstr "Gặp sá»± kiện bất thÆ°á»ng: %d\n" | 7859 | msgstr "Gặp sá»± kiện bất thÆ°á»ng: %d\n" |
7784 | 7860 | ||
7785 | #: src/transport/plugin_transport_tcp.c:1234 | 7861 | #: src/transport/plugin_transport_tcp.c:1243 |
7786 | #: src/transport/plugin_transport_tcp.c:1458 | 7862 | #: src/transport/plugin_transport_tcp.c:1467 |
7787 | #: src/transport/plugin_transport_tcp.c:2633 | 7863 | #: src/transport/plugin_transport_tcp.c:2643 |
7788 | #: src/transport/plugin_transport_tcp.c:3490 | 7864 | #: src/transport/plugin_transport_tcp.c:3498 |
7789 | #, fuzzy | 7865 | #, fuzzy |
7790 | msgid "# TCP sessions active" | 7866 | msgid "# TCP sessions active" |
7791 | msgstr "# các khoá phiên chạy được chấp nháºn" | 7867 | msgstr "# các khoá phiên chạy được chấp nháºn" |
7792 | 7868 | ||
7793 | #: src/transport/plugin_transport_tcp.c:1276 | 7869 | #: src/transport/plugin_transport_tcp.c:1285 |
7794 | #: src/transport/plugin_transport_tcp.c:1440 | 7870 | #: src/transport/plugin_transport_tcp.c:1449 |
7795 | #: src/transport/plugin_transport_tcp.c:1564 | 7871 | #: src/transport/plugin_transport_tcp.c:1573 |
7796 | #: src/transport/plugin_transport_tcp.c:1637 | 7872 | #: src/transport/plugin_transport_tcp.c:1646 |
7797 | #: src/transport/plugin_transport_tcp.c:1737 | 7873 | #: src/transport/plugin_transport_tcp.c:1746 |
7798 | #: src/transport/plugin_transport_tcp.c:1762 | 7874 | #: src/transport/plugin_transport_tcp.c:1771 |
7799 | #, fuzzy | 7875 | #, fuzzy |
7800 | msgid "# bytes currently in TCP buffers" | 7876 | msgid "# bytes currently in TCP buffers" |
7801 | msgstr "# các byte đã gừi qua TCP" | 7877 | msgstr "# các byte đã gừi qua TCP" |
7802 | 7878 | ||
7803 | #: src/transport/plugin_transport_tcp.c:1279 | 7879 | #: src/transport/plugin_transport_tcp.c:1288 |
7804 | #, fuzzy | 7880 | #, fuzzy |
7805 | msgid "# bytes discarded by TCP (disconnect)" | 7881 | msgid "# bytes discarded by TCP (disconnect)" |
7806 | msgstr "# các byte loại đi bởi TCP (đi ra)" | 7882 | msgstr "# các byte loại đi bởi TCP (đi ra)" |
7807 | 7883 | ||
7808 | #: src/transport/plugin_transport_tcp.c:1567 | 7884 | #: src/transport/plugin_transport_tcp.c:1576 |
7809 | #, fuzzy | 7885 | #, fuzzy |
7810 | msgid "# bytes discarded by TCP (timeout)" | 7886 | msgid "# bytes discarded by TCP (timeout)" |
7811 | msgstr "# các byte loại đi bởi TCP (đi ra)" | 7887 | msgstr "# các byte loại đi bởi TCP (đi ra)" |
7812 | 7888 | ||
7813 | #: src/transport/plugin_transport_tcp.c:1641 | 7889 | #: src/transport/plugin_transport_tcp.c:1650 |
7814 | #, fuzzy | 7890 | #, fuzzy |
7815 | msgid "# bytes transmitted via TCP" | 7891 | msgid "# bytes transmitted via TCP" |
7816 | msgstr "# các byte được gá»i" | 7892 | msgstr "# các byte được gá»i" |
7817 | 7893 | ||
7818 | #: src/transport/plugin_transport_tcp.c:2032 | 7894 | #: src/transport/plugin_transport_tcp.c:2041 |
7819 | msgid "# requests to create session with invalid address" | 7895 | msgid "# requests to create session with invalid address" |
7820 | msgstr "" | 7896 | msgstr "" |
7821 | 7897 | ||
7822 | #: src/transport/plugin_transport_tcp.c:2200 | 7898 | #: src/transport/plugin_transport_tcp.c:2217 |
7823 | msgid "# transport-service disconnect requests for TCP" | 7899 | msgid "# transport-service disconnect requests for TCP" |
7824 | msgstr "" | 7900 | msgstr "" |
7825 | 7901 | ||
7826 | #: src/transport/plugin_transport_tcp.c:2692 | 7902 | #: src/transport/plugin_transport_tcp.c:2702 |
7827 | #, fuzzy | 7903 | #, fuzzy |
7828 | msgid "# TCP WELCOME messages received" | 7904 | msgid "# TCP WELCOME messages received" |
7829 | msgstr "# các thông báo PONG đã máºt mã được nháºn" | 7905 | msgstr "# các thông báo PONG đã máºt mã được nháºn" |
7830 | 7906 | ||
7831 | #: src/transport/plugin_transport_tcp.c:2883 | 7907 | #: src/transport/plugin_transport_tcp.c:2893 |
7832 | msgid "# bytes received via TCP" | 7908 | msgid "# bytes received via TCP" |
7833 | msgstr "# các byte đã nháºn qua TCP" | 7909 | msgstr "# các byte đã nháºn qua TCP" |
7834 | 7910 | ||
7835 | #: src/transport/plugin_transport_tcp.c:2934 | 7911 | #: src/transport/plugin_transport_tcp.c:2944 |
7836 | #: src/transport/plugin_transport_tcp.c:2992 | 7912 | #: src/transport/plugin_transport_tcp.c:3002 |
7837 | #, fuzzy | 7913 | #, fuzzy |
7838 | msgid "# TCP server connections active" | 7914 | msgid "# TCP server connections active" |
7839 | msgstr "# các kết nối dht" | 7915 | msgstr "# các kết nối dht" |
7840 | 7916 | ||
7841 | #: src/transport/plugin_transport_tcp.c:2938 | 7917 | #: src/transport/plugin_transport_tcp.c:2948 |
7842 | #, fuzzy | 7918 | #, fuzzy |
7843 | msgid "# TCP server connect events" | 7919 | msgid "# TCP server connect events" |
7844 | msgstr "# của các đồng đẳng đã kết nối" | 7920 | msgstr "# của các đồng đẳng đã kết nối" |
7845 | 7921 | ||
7846 | #: src/transport/plugin_transport_tcp.c:2944 | 7922 | #: src/transport/plugin_transport_tcp.c:2954 |
7847 | msgid "TCP connection limit reached, suspending server\n" | 7923 | msgid "TCP connection limit reached, suspending server\n" |
7848 | msgstr "" | 7924 | msgstr "" |
7849 | 7925 | ||
7850 | #: src/transport/plugin_transport_tcp.c:2946 | 7926 | #: src/transport/plugin_transport_tcp.c:2956 |
7851 | msgid "# TCP service suspended" | 7927 | msgid "# TCP service suspended" |
7852 | msgstr "" | 7928 | msgstr "" |
7853 | 7929 | ||
7854 | #: src/transport/plugin_transport_tcp.c:2986 | 7930 | #: src/transport/plugin_transport_tcp.c:2996 |
7855 | msgid "# TCP service resumed" | 7931 | msgid "# TCP service resumed" |
7856 | msgstr "" | 7932 | msgstr "" |
7857 | 7933 | ||
7858 | #: src/transport/plugin_transport_tcp.c:2996 | 7934 | #: src/transport/plugin_transport_tcp.c:3006 |
7859 | msgid "# network-level TCP disconnect events" | 7935 | msgid "# network-level TCP disconnect events" |
7860 | msgstr "" | 7936 | msgstr "" |
7861 | 7937 | ||
7862 | #: src/transport/plugin_transport_tcp.c:3315 | 7938 | #: src/transport/plugin_transport_tcp.c:3325 |
7863 | #, fuzzy | 7939 | #, fuzzy |
7864 | msgid "Failed to start service.\n" | 7940 | msgid "Failed to start service.\n" |
7865 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | 7941 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
7866 | 7942 | ||
7867 | #: src/transport/plugin_transport_tcp.c:3478 | 7943 | #: src/transport/plugin_transport_tcp.c:3486 |
7868 | #, c-format | 7944 | #, c-format |
7869 | msgid "TCP transport listening on port %llu\n" | 7945 | msgid "TCP transport listening on port %llu\n" |
7870 | msgstr "" | 7946 | msgstr "" |
7871 | 7947 | ||
7872 | #: src/transport/plugin_transport_tcp.c:3482 | 7948 | #: src/transport/plugin_transport_tcp.c:3490 |
7873 | msgid "TCP transport not listening on any port (client only)\n" | 7949 | msgid "TCP transport not listening on any port (client only)\n" |
7874 | msgstr "" | 7950 | msgstr "" |
7875 | 7951 | ||
7876 | #: src/transport/plugin_transport_tcp.c:3486 | 7952 | #: src/transport/plugin_transport_tcp.c:3494 |
7877 | #, c-format | 7953 | #, c-format |
7878 | msgid "TCP transport advertises itself as being on port %llu\n" | 7954 | msgid "TCP transport advertises itself as being on port %llu\n" |
7879 | msgstr "" | 7955 | msgstr "" |
7880 | 7956 | ||
7881 | #: src/transport/plugin_transport_udp_broadcasting.c:170 | 7957 | #: src/transport/plugin_transport_udp_broadcasting.c:169 |
7882 | #, fuzzy | 7958 | #, fuzzy |
7883 | msgid "# Multicast HELLO beacons received via UDP" | 7959 | msgid "# Multicast HELLO beacons received via UDP" |
7884 | msgstr "# các thông báo PONG đã máºt mã được nháºn" | 7960 | msgstr "# các thông báo PONG đã máºt mã được nháºn" |
7885 | 7961 | ||
7886 | #: src/transport/plugin_transport_udp_broadcasting.c:546 | 7962 | #: src/transport/plugin_transport_udp_broadcasting.c:545 |
7887 | msgid "" | 7963 | msgid "" |
7888 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" | 7964 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" |
7889 | msgstr "" | 7965 | msgstr "" |
7890 | 7966 | ||
7891 | #: src/transport/plugin_transport_udp_broadcasting.c:567 | 7967 | #: src/transport/plugin_transport_udp_broadcasting.c:566 |
7892 | #, c-format | 7968 | #, c-format |
7893 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" | 7969 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" |
7894 | msgstr "" | 7970 | msgstr "" |
7895 | 7971 | ||
7896 | #: src/transport/plugin_transport_udp.c:3344 | 7972 | #: src/transport/plugin_transport_udp.c:3367 |
7897 | #, c-format | 7973 | #, c-format |
7898 | msgid "" | 7974 | msgid "" |
7899 | "UDP could not transmit message to `%s': Network seems down, please check " | 7975 | "UDP could not transmit message to `%s': Network seems down, please check " |
7900 | "your network configuration\n" | 7976 | "your network configuration\n" |
7901 | msgstr "" | 7977 | msgstr "" |
7902 | 7978 | ||
7903 | #: src/transport/plugin_transport_udp.c:3358 | 7979 | #: src/transport/plugin_transport_udp.c:3381 |
7904 | msgid "" | 7980 | msgid "" |
7905 | "UDP could not transmit IPv6 message! Please check your network configuration " | 7981 | "UDP could not transmit IPv6 message! Please check your network configuration " |
7906 | "and disable IPv6 if your connection does not have a global IPv6 address\n" | 7982 | "and disable IPv6 if your connection does not have a global IPv6 address\n" |
7907 | msgstr "" | 7983 | msgstr "" |
7908 | 7984 | ||
7909 | #: src/transport/plugin_transport_udp.c:3676 | 7985 | #: src/transport/plugin_transport_udp.c:3699 |
7910 | #: src/transport/plugin_transport_udp.c:3775 | 7986 | #: src/transport/plugin_transport_udp.c:3798 |
7911 | #, fuzzy, c-format | 7987 | #, fuzzy, c-format |
7912 | msgid "Failed to bind UDP socket to %s: %s\n" | 7988 | msgid "Failed to bind UDP socket to %s: %s\n" |
7913 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" | 7989 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" |
7914 | 7990 | ||
7915 | #: src/transport/plugin_transport_udp.c:3694 | 7991 | #: src/transport/plugin_transport_udp.c:3717 |
7916 | msgid "Disabling IPv4 since it is not supported on this system!\n" | 7992 | msgid "Disabling IPv4 since it is not supported on this system!\n" |
7917 | msgstr "" | 7993 | msgstr "" |
7918 | 7994 | ||
7919 | #: src/transport/plugin_transport_udp.c:3785 | 7995 | #: src/transport/plugin_transport_udp.c:3808 |
7920 | #, fuzzy | 7996 | #, fuzzy |
7921 | msgid "Failed to open UDP sockets\n" | 7997 | msgid "Failed to open UDP sockets\n" |
7922 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" | 7998 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" |
7923 | 7999 | ||
7924 | #: src/transport/plugin_transport_udp.c:3857 | 8000 | #: src/transport/plugin_transport_udp.c:3879 |
7925 | #: src/transport/plugin_transport_udp.c:3871 | 8001 | #: src/transport/plugin_transport_udp.c:3893 |
7926 | msgid "must be in [0,65535]" | 8002 | msgid "must be in [0,65535]" |
7927 | msgstr "" | 8003 | msgstr "" |
7928 | 8004 | ||
7929 | #: src/transport/plugin_transport_udp.c:3903 | 8005 | #: src/transport/plugin_transport_udp.c:3925 |
7930 | #, fuzzy | 8006 | #, fuzzy |
7931 | msgid "must be valid IPv4 address" | 8007 | msgid "must be valid IPv4 address" |
7932 | msgstr "« %s » không sẵn sà ng.\n" | 8008 | msgstr "« %s » không sẵn sà ng.\n" |
7933 | 8009 | ||
7934 | #: src/transport/plugin_transport_udp.c:3930 | 8010 | #: src/transport/plugin_transport_udp.c:3952 |
7935 | #, fuzzy | 8011 | #, fuzzy |
7936 | msgid "must be valid IPv6 address" | 8012 | msgid "must be valid IPv6 address" |
7937 | msgstr "« %s » không sẵn sà ng.\n" | 8013 | msgstr "« %s » không sẵn sà ng.\n" |
7938 | 8014 | ||
7939 | #: src/transport/plugin_transport_udp.c:3996 | 8015 | #: src/transport/plugin_transport_udp.c:4018 |
7940 | #, fuzzy | 8016 | #, fuzzy |
7941 | msgid "Failed to create UDP network sockets\n" | 8017 | msgid "Failed to create UDP network sockets\n" |
7942 | msgstr "Không thể tạo miá»n tên.\n" | 8018 | msgstr "Không thể tạo miá»n tên.\n" |
@@ -8057,7 +8133,7 @@ msgstr "" | |||
8057 | msgid "Metadata `%s' failed to deserialize" | 8133 | msgid "Metadata `%s' failed to deserialize" |
8058 | msgstr "" | 8134 | msgstr "" |
8059 | 8135 | ||
8060 | #: src/util/client_new.c:864 | 8136 | #: src/util/client.c:864 |
8061 | #, c-format | 8137 | #, c-format |
8062 | msgid "Need a non-empty hostname for service `%s'.\n" | 8138 | msgid "Need a non-empty hostname for service `%s'.\n" |
8063 | msgstr "" | 8139 | msgstr "" |
@@ -8833,42 +8909,42 @@ msgstr "" | |||
8833 | msgid "Invalid IPv6 address `%s': %s\n" | 8909 | msgid "Invalid IPv6 address `%s': %s\n" |
8834 | msgstr "Mức ưu tiên tiến trình không hợp lê « %s ».\n" | 8910 | msgstr "Mức ưu tiên tiến trình không hợp lê « %s ».\n" |
8835 | 8911 | ||
8836 | #: src/util/strings.c:1475 src/util/strings.c:1491 | 8912 | #: src/util/strings.c:1541 src/util/strings.c:1557 |
8837 | msgid "Port not in range\n" | 8913 | msgid "Port not in range\n" |
8838 | msgstr "" | 8914 | msgstr "" |
8839 | 8915 | ||
8840 | #: src/util/strings.c:1500 | 8916 | #: src/util/strings.c:1566 |
8841 | #, fuzzy, c-format | 8917 | #, fuzzy, c-format |
8842 | msgid "Malformed port policy `%s'\n" | 8918 | msgid "Malformed port policy `%s'\n" |
8843 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | 8919 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
8844 | 8920 | ||
8845 | #: src/util/strings.c:1583 src/util/strings.c:1614 src/util/strings.c:1662 | 8921 | #: src/util/strings.c:1649 src/util/strings.c:1680 src/util/strings.c:1728 |
8846 | #: src/util/strings.c:1683 | 8922 | #: src/util/strings.c:1749 |
8847 | #, c-format | 8923 | #, c-format |
8848 | msgid "Invalid format for IP: `%s'\n" | 8924 | msgid "Invalid format for IP: `%s'\n" |
8849 | msgstr "Äịa chỉ IP định dạng sai: %s\n" | 8925 | msgstr "Äịa chỉ IP định dạng sai: %s\n" |
8850 | 8926 | ||
8851 | #: src/util/strings.c:1640 | 8927 | #: src/util/strings.c:1706 |
8852 | #, c-format | 8928 | #, c-format |
8853 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." | 8929 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." |
8854 | msgstr "Ký hiệu mạng sai (« /%d » không hợp lệ trong CIDR IPv4)." | 8930 | msgstr "Ký hiệu mạng sai (« /%d » không hợp lệ trong CIDR IPv4)." |
8855 | 8931 | ||
8856 | #: src/util/strings.c:1692 | 8932 | #: src/util/strings.c:1758 |
8857 | #, fuzzy, c-format | 8933 | #, fuzzy, c-format |
8858 | msgid "Invalid format: `%s'\n" | 8934 | msgid "Invalid format: `%s'\n" |
8859 | msgstr "Äịa chỉ IP định dạng sai: %s\n" | 8935 | msgstr "Äịa chỉ IP định dạng sai: %s\n" |
8860 | 8936 | ||
8861 | #: src/util/strings.c:1744 | 8937 | #: src/util/strings.c:1810 |
8862 | #, c-format | 8938 | #, c-format |
8863 | msgid "Invalid network notation (does not end with ';': `%s')\n" | 8939 | msgid "Invalid network notation (does not end with ';': `%s')\n" |
8864 | msgstr "Ký hiệu mạng sai (không kết thúc với « ; »: « %s »)\n" | 8940 | msgstr "Ký hiệu mạng sai (không kết thúc với « ; »: « %s »)\n" |
8865 | 8941 | ||
8866 | #: src/util/strings.c:1794 | 8942 | #: src/util/strings.c:1860 |
8867 | #, fuzzy, c-format | 8943 | #, fuzzy, c-format |
8868 | msgid "Wrong format `%s' for netmask\n" | 8944 | msgid "Wrong format `%s' for netmask\n" |
8869 | msgstr "Mặt nạ mạng có định dạng sai « %s »: %s\n" | 8945 | msgstr "Mặt nạ mạng có định dạng sai « %s »: %s\n" |
8870 | 8946 | ||
8871 | #: src/util/strings.c:1825 | 8947 | #: src/util/strings.c:1891 |
8872 | #, fuzzy, c-format | 8948 | #, fuzzy, c-format |
8873 | msgid "Wrong format `%s' for network\n" | 8949 | msgid "Wrong format `%s' for network\n" |
8874 | msgstr "Mạng có định dạng sai « %s »: %s\n" | 8950 | msgstr "Mạng có định dạng sai « %s »: %s\n" |
@@ -9057,22 +9133,34 @@ msgid "Setup tunnels via VPN." | |||
9057 | msgstr "" | 9133 | msgstr "" |
9058 | 9134 | ||
9059 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 | 9135 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 |
9060 | #: src/include/gnunet_common.h:660 | 9136 | #: src/include/gnunet_common.h:662 src/include/gnunet_common.h:670 |
9061 | #, fuzzy, c-format | 9137 | #, fuzzy, c-format |
9062 | msgid "Assertion failed at %s:%d.\n" | 9138 | msgid "Assertion failed at %s:%d.\n" |
9063 | msgstr "Lỗi nội bộ : khẳng định không thà nh công tại %s:%d.\n" | 9139 | msgstr "Lỗi nội bộ : khẳng định không thà nh công tại %s:%d.\n" |
9064 | 9140 | ||
9065 | #: src/include/gnunet_common.h:672 | 9141 | #: src/include/gnunet_common.h:682 |
9066 | #, fuzzy, c-format | 9142 | #, fuzzy, c-format |
9067 | msgid "External protocol violation detected at %s:%d.\n" | 9143 | msgid "External protocol violation detected at %s:%d.\n" |
9068 | msgstr "Lỗi nội bộ : khẳng định không thà nh công tại %s:%d.\n" | 9144 | msgstr "Lỗi nội bộ : khẳng định không thà nh công tại %s:%d.\n" |
9069 | 9145 | ||
9070 | #: src/include/gnunet_common.h:699 src/include/gnunet_common.h:708 | 9146 | #: src/include/gnunet_common.h:709 src/include/gnunet_common.h:718 |
9071 | #, c-format | 9147 | #, c-format |
9072 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" | 9148 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" |
9073 | msgstr "« %s » thất bại ở táºp tin « %s » tại %s:%d vá»›i lá»—i: %s\n" | 9149 | msgstr "« %s » thất bại ở táºp tin « %s » tại %s:%d vá»›i lá»—i: %s\n" |
9074 | 9150 | ||
9075 | #, fuzzy | 9151 | #, fuzzy |
9152 | #~ msgid "Failed to run upnp client for port %u\n" | ||
9153 | #~ msgstr "Lỗi sơ khởi dịch vụ « %s ».\n" | ||
9154 | |||
9155 | #, fuzzy | ||
9156 | #~ msgid "NAT plugin `%s' reports: %s\n" | ||
9157 | #~ msgstr "Äang nạp các truyá»n tải « %s »\n" | ||
9158 | |||
9159 | #, fuzzy | ||
9160 | #~ msgid "Failed to start resolver!\n" | ||
9161 | #~ msgstr "Lá»—i bắt đầu thu tháºp.\n" | ||
9162 | |||
9163 | #, fuzzy | ||
9076 | #~ msgid "Unable to initialize Postgres: %s\n" | 9164 | #~ msgid "Unable to initialize Postgres: %s\n" |
9077 | #~ msgstr "Không thể sơ khởi SQLite: %s.\n" | 9165 | #~ msgstr "Không thể sơ khởi SQLite: %s.\n" |
9078 | 9166 | ||
@@ -10482,10 +10570,6 @@ msgstr "« %s » thất bại ở táºp tin « %s » tại %s:%d vá»›i lá»—i: %s | |||
10482 | #~ msgstr "Äang bắt đầu tà i lên « %s ».\n" | 10570 | #~ msgstr "Äang bắt đầu tà i lên « %s ».\n" |
10483 | 10571 | ||
10484 | #, fuzzy | 10572 | #, fuzzy |
10485 | #~ msgid "Failed to write new configuration to disk." | ||
10486 | #~ msgstr "Lỗi lưu cấu hình." | ||
10487 | |||
10488 | #, fuzzy | ||
10489 | #~ msgid "Could not start `%s' process to copy configuration file.\n" | 10573 | #~ msgid "Could not start `%s' process to copy configuration file.\n" |
10490 | #~ msgstr "Không tìm thấy phương pháp « %s%s » trong thư viện « %s ».\n" | 10574 | #~ msgstr "Không tìm thấy phương pháp « %s%s » trong thư viện « %s ».\n" |
10491 | 10575 | ||
@@ -10533,10 +10617,6 @@ msgstr "« %s » thất bại ở táºp tin « %s » tại %s:%d vá»›i lá»—i: %s | |||
10533 | #~ msgstr "Bị từ chối đặt tùy chá»n « %s » trong phần « %s » thà nh « %s ».\n" | 10617 | #~ msgstr "Bị từ chối đặt tùy chá»n « %s » trong phần « %s » thà nh « %s ».\n" |
10534 | 10618 | ||
10535 | #, fuzzy | 10619 | #, fuzzy |
10536 | #~ msgid "Failed to find option %s in section %s!\n" | ||
10537 | #~ msgstr "Lỗi đóng kết đến cổng %s %d.\n" | ||
10538 | |||
10539 | #, fuzzy | ||
10540 | #~ msgid "Invalid configuration option `%s' in section `%s'\n" | 10620 | #~ msgid "Invalid configuration option `%s' in section `%s'\n" |
10541 | #~ msgstr "" | 10621 | #~ msgstr "" |
10542 | #~ "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" | 10622 | #~ "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" |
@@ -10948,9 +11028,6 @@ msgstr "« %s » thất bại ở táºp tin « %s » tại %s:%d vá»›i lá»—i: %s | |||
10948 | #~ "thì có thể đặt thà nh tốc độ kết nối Internet lớn nhất. Không nên đặt giá " | 11028 | #~ "thì có thể đặt thà nh tốc độ kết nối Internet lớn nhất. Không nên đặt giá " |
10949 | #~ "trị lớn hơn số được gán cho kết nối Internet của bạn." | 11029 | #~ "trị lớn hơn số được gán cho kết nối Internet của bạn." |
10950 | 11030 | ||
10951 | #~ msgid "Quota configuration" | ||
10952 | #~ msgstr "Cấu hình hạn ngạch" | ||
10953 | |||
10954 | #~ msgid "What is the maximum size of the datastore in MB?" | 11031 | #~ msgid "What is the maximum size of the datastore in MB?" |
10955 | #~ msgstr "Kho dữ liệu có kÃch cỡ tối Ä‘a (theo MB)?" | 11032 | #~ msgstr "Kho dữ liệu có kÃch cỡ tối Ä‘a (theo MB)?" |
10956 | 11033 | ||
@@ -11031,9 +11108,6 @@ msgstr "« %s » thất bại ở táºp tin « %s » tại %s:%d vá»›i lá»—i: %s | |||
11031 | #~ msgid "Save configuration?" | 11108 | #~ msgid "Save configuration?" |
11032 | #~ msgstr "Lưu cấu hình không?" | 11109 | #~ msgstr "Lưu cấu hình không?" |
11033 | 11110 | ||
11034 | #~ msgid "GNUnet Configuration" | ||
11035 | #~ msgstr "Cấu hình GNUnet" | ||
11036 | |||
11037 | #~ msgid "Back" | 11111 | #~ msgid "Back" |
11038 | #~ msgstr "Lùi" | 11112 | #~ msgstr "Lùi" |
11039 | 11113 | ||
@@ -11058,13 +11132,6 @@ msgstr "« %s » thất bại ở táºp tin « %s » tại %s:%d vá»›i lá»—i: %s | |||
11058 | #~ msgid "Do you wish to save your new configuration?" | 11132 | #~ msgid "Do you wish to save your new configuration?" |
11059 | #~ msgstr "Bạn có muốn lưu cấu hình mới không?" | 11133 | #~ msgstr "Bạn có muốn lưu cấu hình mới không?" |
11060 | 11134 | ||
11061 | #~ msgid "" | ||
11062 | #~ "\n" | ||
11063 | #~ "Your configuration changes were NOT saved.\n" | ||
11064 | #~ msgstr "" | ||
11065 | #~ "\n" | ||
11066 | #~ "CHƯA lưu các thay đổi trong cấu hình.\n" | ||
11067 | |||
11068 | #~ msgid "install GNUnet as Windows service" | 11135 | #~ msgid "install GNUnet as Windows service" |
11069 | #~ msgstr "cà i đặt GNUnet như là một dịch vụ Windows" | 11136 | #~ msgstr "cà i đặt GNUnet như là một dịch vụ Windows" |
11070 | 11137 | ||
@@ -12024,9 +12091,6 @@ msgstr "« %s » thất bại ở táºp tin « %s » tại %s:%d vá»›i lá»—i: %s | |||
12024 | #~ msgid "Revision %u" | 12091 | #~ msgid "Revision %u" |
12025 | #~ msgstr "Bản sá»a đổi %u" | 12092 | #~ msgstr "Bản sá»a đổi %u" |
12026 | 12093 | ||
12027 | #~ msgid "Application aborted." | ||
12028 | #~ msgstr "Ứng dụng bị hủy bá»." | ||
12029 | |||
12030 | #~ msgid "FSUI state file `%s' had syntax error at offset %u.\n" | 12094 | #~ msgid "FSUI state file `%s' had syntax error at offset %u.\n" |
12031 | #~ msgstr "Táºp tin tình trạng FSUI « %s » có lá»—i cú pháp tại khoảng bù %u.\n" | 12095 | #~ msgstr "Táºp tin tình trạng FSUI « %s » có lá»—i cú pháp tại khoảng bù %u.\n" |
12032 | 12096 | ||
diff --git a/po/zh_CN.po b/po/zh_CN.po index 16fee9b24..579bc8364 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po | |||
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
8 | "Project-Id-Version: gnunet-0.8.1\n" | 8 | "Project-Id-Version: gnunet-0.8.1\n" |
9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
10 | "POT-Creation-Date: 2016-11-27 09:18+0100\n" | 10 | "POT-Creation-Date: 2017-01-12 17:19+0100\n" |
11 | "PO-Revision-Date: 2011-07-09 12:12+0800\n" | 11 | "PO-Revision-Date: 2011-07-09 12:12+0800\n" |
12 | "Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n" | 12 | "Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n" |
13 | "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" | 13 | "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" |
@@ -250,21 +250,20 @@ msgstr "" | |||
250 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 | 250 | #: src/arm/gnunet-service-arm.c:393 src/arm/gnunet-service-arm.c:399 |
251 | #: src/transport/plugin_transport_tcp.c:652 | 251 | #: src/transport/plugin_transport_tcp.c:652 |
252 | #: src/transport/plugin_transport_tcp.c:658 | 252 | #: src/transport/plugin_transport_tcp.c:658 |
253 | #: src/transport/plugin_transport_tcp.c:3299 src/util/service.c:584 | 253 | #: src/transport/plugin_transport_tcp.c:3309 src/util/service.c:584 |
254 | #: src/util/service.c:590 src/util/service_new.c:637 | 254 | #: src/util/service.c:590 src/util/service_new.c:637 src/util/service_new.c:643 |
255 | #: src/util/service_new.c:643 | ||
256 | #, c-format | 255 | #, c-format |
257 | msgid "Require valid port number for service `%s' in configuration!\n" | 256 | msgid "Require valid port number for service `%s' in configuration!\n" |
258 | msgstr "" | 257 | msgstr "" |
259 | 258 | ||
260 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 | 259 | #: src/arm/gnunet-service-arm.c:430 src/transport/plugin_transport_tcp.c:689 |
261 | #: src/util/client_new.c:464 src/util/service.c:621 src/util/service_new.c:682 | 260 | #: src/util/client.c:464 src/util/service.c:621 src/util/service_new.c:682 |
262 | #, c-format | 261 | #, c-format |
263 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 262 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
264 | msgstr "" | 263 | msgstr "" |
265 | 264 | ||
266 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 | 265 | #: src/arm/gnunet-service-arm.c:434 src/transport/plugin_transport_tcp.c:693 |
267 | #: src/util/client_new.c:469 src/util/service.c:625 src/util/service_new.c:687 | 266 | #: src/util/client.c:469 src/util/service.c:625 src/util/service_new.c:687 |
268 | #, fuzzy, c-format | 267 | #, fuzzy, c-format |
269 | msgid "Using `%s' instead\n" | 268 | msgid "Using `%s' instead\n" |
270 | msgstr "%s:选项“%sâ€æœ‰æ§ä¹‰\n" | 269 | msgstr "%s:选项“%sâ€æœ‰æ§ä¹‰\n" |
@@ -284,7 +283,7 @@ msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | |||
284 | msgstr "" | 283 | msgstr "" |
285 | 284 | ||
286 | #: src/arm/gnunet-service-arm.c:513 | 285 | #: src/arm/gnunet-service-arm.c:513 |
287 | #: src/transport/plugin_transport_http_server.c:2617 | 286 | #: src/transport/plugin_transport_http_server.c:2620 |
288 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 | 287 | #: src/transport/plugin_transport_tcp.c:772 src/util/service.c:704 |
289 | #: src/util/service_new.c:782 | 288 | #: src/util/service_new.c:782 |
290 | #, fuzzy, c-format | 289 | #, fuzzy, c-format |
@@ -292,7 +291,7 @@ msgid "Failed to resolve `%s': %s\n" | |||
292 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" | 291 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" |
293 | 292 | ||
294 | #: src/arm/gnunet-service-arm.c:532 | 293 | #: src/arm/gnunet-service-arm.c:532 |
295 | #: src/transport/plugin_transport_http_server.c:2635 | 294 | #: src/transport/plugin_transport_http_server.c:2638 |
296 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 | 295 | #: src/transport/plugin_transport_tcp.c:791 src/util/service.c:723 |
297 | #: src/util/service_new.c:802 | 296 | #: src/util/service_new.c:802 |
298 | #, fuzzy, c-format | 297 | #, fuzzy, c-format |
@@ -387,13 +386,11 @@ msgid "" | |||
387 | "%llu\n" | 386 | "%llu\n" |
388 | msgstr "" | 387 | msgstr "" |
389 | 388 | ||
390 | #: src/ats/gnunet-ats-solver-eval.c:3293 | 389 | #: src/ats/gnunet-ats-solver-eval.c:3293 src/ats-tests/gnunet-solver-eval.c:935 |
391 | #: src/ats-tests/gnunet-solver-eval.c:935 | ||
392 | msgid "solver to use" | 390 | msgid "solver to use" |
393 | msgstr "" | 391 | msgstr "" |
394 | 392 | ||
395 | #: src/ats/gnunet-ats-solver-eval.c:3296 | 393 | #: src/ats/gnunet-ats-solver-eval.c:3296 src/ats-tests/gnunet-solver-eval.c:938 |
396 | #: src/ats-tests/gnunet-solver-eval.c:938 | ||
397 | #: src/ats-tests/gnunet-solver-eval.c:941 | 394 | #: src/ats-tests/gnunet-solver-eval.c:941 |
398 | msgid "experiment to use" | 395 | msgid "experiment to use" |
399 | msgstr "" | 396 | msgstr "" |
@@ -499,12 +496,12 @@ msgstr "" | |||
499 | msgid "Invalid %s configuration %f\n" | 496 | msgid "Invalid %s configuration %f\n" |
500 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 497 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
501 | 498 | ||
502 | #: src/ats-tests/ats-testing.c:441 | 499 | #: src/ats-tests/ats-testing.c:422 |
503 | #, c-format | 500 | #, c-format |
504 | msgid "Connected master [%u] with slave [%u]\n" | 501 | msgid "Connected master [%u] with slave [%u]\n" |
505 | msgstr "" | 502 | msgstr "" |
506 | 503 | ||
507 | #: src/ats-tests/ats-testing.c:448 | 504 | #: src/ats-tests/ats-testing.c:429 |
508 | #, fuzzy, c-format | 505 | #, fuzzy, c-format |
509 | msgid "Failed to connect master peer [%u] with slave [%u]\n" | 506 | msgid "Failed to connect master peer [%u] with slave [%u]\n" |
510 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 507 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
@@ -561,7 +558,7 @@ msgid "Quota for network `%11s' (in/out): %10s / %10s\n" | |||
561 | msgstr "" | 558 | msgstr "" |
562 | 559 | ||
563 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 | 560 | #: src/ats-tool/gnunet-ats.c:748 src/ats-tool/gnunet-ats.c:761 |
564 | #: src/transport/gnunet-transport.c:1476 | 561 | #: src/transport/gnunet-transport.c:1255 |
565 | #, fuzzy, c-format | 562 | #, fuzzy, c-format |
566 | msgid "Failed to parse peer identity `%s'\n" | 563 | msgid "Failed to parse peer identity `%s'\n" |
567 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 564 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
@@ -647,6 +644,37 @@ msgstr "" | |||
647 | msgid "Print information about ATS state" | 644 | msgid "Print information about ATS state" |
648 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | 645 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" |
649 | 646 | ||
647 | #: src/auction/gnunet-auction-create.c:69 | ||
648 | msgid "description of the item to be sold" | ||
649 | msgstr "" | ||
650 | |||
651 | #: src/auction/gnunet-auction-create.c:72 | ||
652 | msgid "mapping of possible prices" | ||
653 | msgstr "" | ||
654 | |||
655 | #: src/auction/gnunet-auction-create.c:75 | ||
656 | msgid "max duration per round" | ||
657 | msgstr "" | ||
658 | |||
659 | #: src/auction/gnunet-auction-create.c:78 | ||
660 | msgid "duration until auction starts" | ||
661 | msgstr "" | ||
662 | |||
663 | #: src/auction/gnunet-auction-create.c:81 | ||
664 | msgid "number of items to sell, 0 for first price auction" | ||
665 | msgstr "" | ||
666 | |||
667 | #: src/auction/gnunet-auction-create.c:84 | ||
668 | msgid "public auction outcome" | ||
669 | msgstr "" | ||
670 | |||
671 | #: src/auction/gnunet-auction-create.c:94 src/auction/gnunet-auction-info.c:76 | ||
672 | #: src/auction/gnunet-auction-join.c:76 | ||
673 | #: src/conversation/gnunet-conversation-test.c:243 | ||
674 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
675 | msgid "help text" | ||
676 | msgstr "" | ||
677 | |||
650 | #: src/cadet/gnunet-cadet.c:511 | 678 | #: src/cadet/gnunet-cadet.c:511 |
651 | #, fuzzy, c-format | 679 | #, fuzzy, c-format |
652 | msgid "Invalid target `%s'\n" | 680 | msgid "Invalid target `%s'\n" |
@@ -703,7 +731,7 @@ msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | |||
703 | msgid "provide information about all tunnels" | 731 | msgid "provide information about all tunnels" |
704 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | 732 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" |
705 | 733 | ||
706 | #: src/cadet/gnunet-service-cadet_peer.c:681 | 734 | #: src/cadet/gnunet-service-cadet_peer.c:686 |
707 | msgid "Wrong CORE service\n" | 735 | msgid "Wrong CORE service\n" |
708 | msgstr "" | 736 | msgstr "" |
709 | 737 | ||
@@ -1026,11 +1054,6 @@ msgid "" | |||
1026 | "played back to you..." | 1054 | "played back to you..." |
1027 | msgstr "" | 1055 | msgstr "" |
1028 | 1056 | ||
1029 | #: src/conversation/gnunet-conversation-test.c:243 | ||
1030 | #: src/revocation/gnunet-revocation.c:550 src/template/gnunet-template.c:76 | ||
1031 | msgid "help text" | ||
1032 | msgstr "" | ||
1033 | |||
1034 | #: src/conversation/gnunet_gst.c:630 | 1057 | #: src/conversation/gnunet_gst.c:630 |
1035 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 | 1058 | #: src/conversation/gnunet-helper-audio-playback-gst.c:357 |
1036 | #, c-format | 1059 | #, c-format |
@@ -1231,7 +1254,7 @@ msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" | |||
1231 | msgid "Failed to connect to CORE service!\n" | 1254 | msgid "Failed to connect to CORE service!\n" |
1232 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 1255 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
1233 | 1256 | ||
1234 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1677 | 1257 | #: src/core/gnunet-core.c:176 src/transport/gnunet-transport.c:1456 |
1235 | msgid "provide information about all current connections (continuously)" | 1258 | msgid "provide information about all current connections (continuously)" |
1236 | msgstr "" | 1259 | msgstr "" |
1237 | 1260 | ||
@@ -1483,7 +1506,7 @@ msgstr "sqlite æ•°æ®ä»“库" | |||
1483 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 | 1506 | #: src/testbed/gnunet-daemon-testbed-underlay.c:56 |
1484 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 | 1507 | #: src/testbed/testbed_api_hosts.c:69 src/util/crypto_ecc.c:52 |
1485 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 | 1508 | #: src/util/crypto_ecc_setup.c:41 src/util/crypto_mpi.c:39 |
1486 | #: src/include/gnunet_common.h:681 src/include/gnunet_common.h:690 | 1509 | #: src/include/gnunet_common.h:691 src/include/gnunet_common.h:700 |
1487 | #: src/scalarproduct/scalarproduct.h:35 | 1510 | #: src/scalarproduct/scalarproduct.h:35 |
1488 | #, fuzzy, c-format | 1511 | #, fuzzy, c-format |
1489 | msgid "`%s' failed at %s:%d with error: %s\n" | 1512 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -1876,8 +1899,7 @@ msgstr "" | |||
1876 | msgid "Prints all packets that go through the DHT." | 1899 | msgid "Prints all packets that go through the DHT." |
1877 | msgstr "" | 1900 | msgstr "" |
1878 | 1901 | ||
1879 | #: src/dht/gnunet_dht_profiler.c:1161 | 1902 | #: src/dht/gnunet_dht_profiler.c:1161 src/testbed/gnunet-testbed-profiler.c:255 |
1880 | #: src/testbed/gnunet-testbed-profiler.c:255 | ||
1881 | #, fuzzy, c-format | 1903 | #, fuzzy, c-format |
1882 | msgid "Exiting as the number of peers is %u\n" | 1904 | msgid "Exiting as the number of peers is %u\n" |
1883 | msgstr "å¢žåŠ TCP/IP 的最大连接数" | 1905 | msgstr "å¢žåŠ TCP/IP 的最大连接数" |
@@ -2054,8 +2076,7 @@ msgstr "" | |||
2054 | msgid "# GET requests given to datacache" | 2076 | msgid "# GET requests given to datacache" |
2055 | msgstr "" | 2077 | msgstr "" |
2056 | 2078 | ||
2057 | #: src/dht/gnunet-service-dht_hello.c:84 | 2079 | #: src/dht/gnunet-service-dht_hello.c:84 src/dht/gnunet-service-xdht_hello.c:82 |
2058 | #: src/dht/gnunet-service-xdht_hello.c:82 | ||
2059 | msgid "# HELLOs obtained from peerinfo" | 2080 | msgid "# HELLOs obtained from peerinfo" |
2060 | msgstr "" | 2081 | msgstr "" |
2061 | 2082 | ||
@@ -2120,35 +2141,35 @@ msgstr "" | |||
2120 | msgid "# P2P PUT bytes received" | 2141 | msgid "# P2P PUT bytes received" |
2121 | msgstr "" | 2142 | msgstr "" |
2122 | 2143 | ||
2123 | #: src/dht/gnunet-service-dht_neighbours.c:1854 | 2144 | #: src/dht/gnunet-service-dht_neighbours.c:1858 |
2124 | msgid "# FIND PEER requests ignored due to Bloomfilter" | 2145 | msgid "# FIND PEER requests ignored due to Bloomfilter" |
2125 | msgstr "" | 2146 | msgstr "" |
2126 | 2147 | ||
2127 | #: src/dht/gnunet-service-dht_neighbours.c:1862 | 2148 | #: src/dht/gnunet-service-dht_neighbours.c:1866 |
2128 | msgid "# FIND PEER requests ignored due to lack of HELLO" | 2149 | msgid "# FIND PEER requests ignored due to lack of HELLO" |
2129 | msgstr "" | 2150 | msgstr "" |
2130 | 2151 | ||
2131 | #: src/dht/gnunet-service-dht_neighbours.c:2018 | 2152 | #: src/dht/gnunet-service-dht_neighbours.c:2022 |
2132 | msgid "# P2P GET requests received" | 2153 | msgid "# P2P GET requests received" |
2133 | msgstr "" | 2154 | msgstr "" |
2134 | 2155 | ||
2135 | #: src/dht/gnunet-service-dht_neighbours.c:2022 | 2156 | #: src/dht/gnunet-service-dht_neighbours.c:2026 |
2136 | msgid "# P2P GET bytes received" | 2157 | msgid "# P2P GET bytes received" |
2137 | msgstr "" | 2158 | msgstr "" |
2138 | 2159 | ||
2139 | #: src/dht/gnunet-service-dht_neighbours.c:2097 | 2160 | #: src/dht/gnunet-service-dht_neighbours.c:2101 |
2140 | msgid "# P2P FIND PEER requests processed" | 2161 | msgid "# P2P FIND PEER requests processed" |
2141 | msgstr "" | 2162 | msgstr "" |
2142 | 2163 | ||
2143 | #: src/dht/gnunet-service-dht_neighbours.c:2120 | 2164 | #: src/dht/gnunet-service-dht_neighbours.c:2124 |
2144 | msgid "# P2P GET requests ONLY routed" | 2165 | msgid "# P2P GET requests ONLY routed" |
2145 | msgstr "" | 2166 | msgstr "" |
2146 | 2167 | ||
2147 | #: src/dht/gnunet-service-dht_neighbours.c:2222 | 2168 | #: src/dht/gnunet-service-dht_neighbours.c:2226 |
2148 | msgid "# P2P RESULTS received" | 2169 | msgid "# P2P RESULTS received" |
2149 | msgstr "" | 2170 | msgstr "" |
2150 | 2171 | ||
2151 | #: src/dht/gnunet-service-dht_neighbours.c:2226 | 2172 | #: src/dht/gnunet-service-dht_neighbours.c:2230 |
2152 | msgid "# P2P RESULT bytes received" | 2173 | msgid "# P2P RESULT bytes received" |
2153 | msgstr "" | 2174 | msgstr "" |
2154 | 2175 | ||
@@ -2156,35 +2177,35 @@ msgstr "" | |||
2156 | msgid "# Network size estimates received" | 2177 | msgid "# Network size estimates received" |
2157 | msgstr "" | 2178 | msgstr "" |
2158 | 2179 | ||
2159 | #: src/dht/gnunet-service-dht_routing.c:218 | 2180 | #: src/dht/gnunet-service-dht_routing.c:220 |
2160 | msgid "# Good REPLIES matched against routing table" | 2181 | msgid "# Good REPLIES matched against routing table" |
2161 | msgstr "" | 2182 | msgstr "" |
2162 | 2183 | ||
2163 | #: src/dht/gnunet-service-dht_routing.c:227 | 2184 | #: src/dht/gnunet-service-dht_routing.c:229 |
2164 | msgid "# Duplicate REPLIES matched against routing table" | 2185 | msgid "# Duplicate REPLIES matched against routing table" |
2165 | msgstr "" | 2186 | msgstr "" |
2166 | 2187 | ||
2167 | #: src/dht/gnunet-service-dht_routing.c:233 | 2188 | #: src/dht/gnunet-service-dht_routing.c:235 |
2168 | msgid "# Invalid REPLIES matched against routing table" | 2189 | msgid "# Invalid REPLIES matched against routing table" |
2169 | msgstr "" | 2190 | msgstr "" |
2170 | 2191 | ||
2171 | #: src/dht/gnunet-service-dht_routing.c:239 | 2192 | #: src/dht/gnunet-service-dht_routing.c:241 |
2172 | msgid "# Irrelevant REPLIES matched against routing table" | 2193 | msgid "# Irrelevant REPLIES matched against routing table" |
2173 | msgstr "" | 2194 | msgstr "" |
2174 | 2195 | ||
2175 | #: src/dht/gnunet-service-dht_routing.c:251 | 2196 | #: src/dht/gnunet-service-dht_routing.c:253 |
2176 | msgid "# Unsupported REPLIES matched against routing table" | 2197 | msgid "# Unsupported REPLIES matched against routing table" |
2177 | msgstr "" | 2198 | msgstr "" |
2178 | 2199 | ||
2179 | #: src/dht/gnunet-service-dht_routing.c:327 | 2200 | #: src/dht/gnunet-service-dht_routing.c:329 |
2180 | msgid "# Entries removed from routing table" | 2201 | msgid "# Entries removed from routing table" |
2181 | msgstr "" | 2202 | msgstr "" |
2182 | 2203 | ||
2183 | #: src/dht/gnunet-service-dht_routing.c:409 | 2204 | #: src/dht/gnunet-service-dht_routing.c:411 |
2184 | msgid "# Entries added to routing table" | 2205 | msgid "# Entries added to routing table" |
2185 | msgstr "" | 2206 | msgstr "" |
2186 | 2207 | ||
2187 | #: src/dht/gnunet-service-dht_routing.c:427 | 2208 | #: src/dht/gnunet-service-dht_routing.c:429 |
2188 | msgid "# DHT requests combined" | 2209 | msgid "# DHT requests combined" |
2189 | msgstr "" | 2210 | msgstr "" |
2190 | 2211 | ||
@@ -2295,16 +2316,16 @@ msgid "" | |||
2295 | "SUPU %s, %s, %d, trail->prev_hop = %s" | 2316 | "SUPU %s, %s, %d, trail->prev_hop = %s" |
2296 | msgstr "" | 2317 | msgstr "" |
2297 | 2318 | ||
2298 | #: src/dht/plugin_block_dht.c:142 | 2319 | #: src/dht/plugin_block_dht.c:144 |
2299 | #, c-format | 2320 | #, c-format |
2300 | msgid "Block not of type %u\n" | 2321 | msgid "Block not of type %u\n" |
2301 | msgstr "" | 2322 | msgstr "" |
2302 | 2323 | ||
2303 | #: src/dht/plugin_block_dht.c:149 | 2324 | #: src/dht/plugin_block_dht.c:151 |
2304 | msgid "Size mismatch for block\n" | 2325 | msgid "Size mismatch for block\n" |
2305 | msgstr "" | 2326 | msgstr "" |
2306 | 2327 | ||
2307 | #: src/dht/plugin_block_dht.c:159 | 2328 | #: src/dht/plugin_block_dht.c:161 |
2308 | #, c-format | 2329 | #, c-format |
2309 | msgid "Block of type %u is malformed\n" | 2330 | msgid "Block of type %u is malformed\n" |
2310 | msgstr "" | 2331 | msgstr "" |
@@ -3401,7 +3422,7 @@ msgid "Option `%s' is required when using option `%s'.\n" | |||
3401 | msgstr "" | 3422 | msgstr "" |
3402 | 3423 | ||
3403 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 | 3424 | #: src/fs/gnunet-publish.c:849 src/fs/gnunet-publish.c:857 |
3404 | #: src/transport/gnunet-transport.c:1517 src/transport/gnunet-transport.c:1542 | 3425 | #: src/transport/gnunet-transport.c:1296 src/transport/gnunet-transport.c:1321 |
3405 | #, c-format | 3426 | #, c-format |
3406 | msgid "Option `%s' makes no sense without option `%s'.\n" | 3427 | msgid "Option `%s' makes no sense without option `%s'.\n" |
3407 | msgstr "" | 3428 | msgstr "" |
@@ -3894,39 +3915,39 @@ msgstr "" | |||
3894 | msgid "Received unsupported DNS request from %s\n" | 3915 | msgid "Received unsupported DNS request from %s\n" |
3895 | msgstr "" | 3916 | msgstr "" |
3896 | 3917 | ||
3897 | #: src/gns/gnunet-dns2gns.c:709 | 3918 | #: src/gns/gnunet-dns2gns.c:712 |
3898 | msgid "No ego configured for `dns2gns` subsystem\n" | 3919 | msgid "No ego configured for `dns2gns` subsystem\n" |
3899 | msgstr "" | 3920 | msgstr "" |
3900 | 3921 | ||
3901 | #: src/gns/gnunet-dns2gns.c:737 | 3922 | #: src/gns/gnunet-dns2gns.c:740 |
3902 | msgid "No DNS server specified!\n" | 3923 | msgid "No DNS server specified!\n" |
3903 | msgstr "" | 3924 | msgstr "" |
3904 | 3925 | ||
3905 | #: src/gns/gnunet-dns2gns.c:758 | 3926 | #: src/gns/gnunet-dns2gns.c:761 |
3906 | msgid "No valid GNS zone specified!\n" | 3927 | msgid "No valid GNS zone specified!\n" |
3907 | msgstr "" | 3928 | msgstr "" |
3908 | 3929 | ||
3909 | #: src/gns/gnunet-dns2gns.c:779 | 3930 | #: src/gns/gnunet-dns2gns.c:782 |
3910 | msgid "IP of recursive DNS resolver to use (required)" | 3931 | msgid "IP of recursive DNS resolver to use (required)" |
3911 | msgstr "" | 3932 | msgstr "" |
3912 | 3933 | ||
3913 | #: src/gns/gnunet-dns2gns.c:782 | 3934 | #: src/gns/gnunet-dns2gns.c:785 |
3914 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" | 3935 | msgid "Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu" |
3915 | msgstr "" | 3936 | msgstr "" |
3916 | 3937 | ||
3917 | #: src/gns/gnunet-dns2gns.c:785 | 3938 | #: src/gns/gnunet-dns2gns.c:788 |
3918 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" | 3939 | msgid "Authoritative DNS suffix to use (optional); default: zkey.eu" |
3919 | msgstr "" | 3940 | msgstr "" |
3920 | 3941 | ||
3921 | #: src/gns/gnunet-dns2gns.c:788 | 3942 | #: src/gns/gnunet-dns2gns.c:791 |
3922 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 3943 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
3923 | msgstr "" | 3944 | msgstr "" |
3924 | 3945 | ||
3925 | #: src/gns/gnunet-dns2gns.c:791 | 3946 | #: src/gns/gnunet-dns2gns.c:794 |
3926 | msgid "Public key of the GNS zone to use (overrides default)" | 3947 | msgid "Public key of the GNS zone to use (overrides default)" |
3927 | msgstr "" | 3948 | msgstr "" |
3928 | 3949 | ||
3929 | #: src/gns/gnunet-dns2gns.c:804 | 3950 | #: src/gns/gnunet-dns2gns.c:807 |
3930 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 3951 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
3931 | msgstr "" | 3952 | msgstr "" |
3932 | 3953 | ||
@@ -4086,83 +4107,85 @@ msgstr "" | |||
4086 | msgid "Unsupported HTTP method `%s'\n" | 4107 | msgid "Unsupported HTTP method `%s'\n" |
4087 | msgstr "未知的命令“%sâ€ã€‚\n" | 4108 | msgstr "未知的命令“%sâ€ã€‚\n" |
4088 | 4109 | ||
4089 | #: src/gns/gnunet-gns-proxy.c:2167 | 4110 | #: src/gns/gnunet-gns-proxy.c:2168 |
4090 | #, fuzzy, c-format | 4111 | #, fuzzy, c-format |
4091 | msgid "Unable to import private key from file `%s'\n" | 4112 | msgid "Unable to import private key from file `%s'\n" |
4092 | msgstr "æ— æ³•åˆ›å»ºç”¨æˆ·è´¦æˆ·ï¼š" | 4113 | msgstr "æ— æ³•åˆ›å»ºç”¨æˆ·è´¦æˆ·ï¼š" |
4093 | 4114 | ||
4094 | #: src/gns/gnunet-gns-proxy.c:2197 | 4115 | #: src/gns/gnunet-gns-proxy.c:2198 |
4095 | #, fuzzy, c-format | 4116 | #, fuzzy, c-format |
4096 | msgid "Unable to import certificate %s\n" | 4117 | msgid "Unable to import certificate %s\n" |
4097 | msgstr "æ— æ³•ä¿å˜é…置文件“%sâ€ï¼š" | 4118 | msgstr "æ— æ³•ä¿å˜é…置文件“%sâ€ï¼š" |
4098 | 4119 | ||
4099 | #: src/gns/gnunet-gns-proxy.c:2370 | 4120 | #: src/gns/gnunet-gns-proxy.c:2371 |
4100 | #, fuzzy, c-format | 4121 | #, fuzzy, c-format |
4101 | msgid "Failed to start HTTPS server for `%s'\n" | 4122 | msgid "Failed to start HTTPS server for `%s'\n" |
4102 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 4123 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
4103 | 4124 | ||
4104 | #: src/gns/gnunet-gns-proxy.c:2389 src/rest/gnunet-rest-server.c:533 | 4125 | #: src/gns/gnunet-gns-proxy.c:2390 src/rest/gnunet-rest-server.c:533 |
4105 | #, fuzzy | 4126 | #, fuzzy |
4106 | msgid "Failed to pass client to MHD\n" | 4127 | msgid "Failed to pass client to MHD\n" |
4107 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 4128 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
4108 | 4129 | ||
4109 | #: src/gns/gnunet-gns-proxy.c:2709 | 4130 | #: src/gns/gnunet-gns-proxy.c:2710 |
4110 | #, fuzzy, c-format | 4131 | #, fuzzy, c-format |
4111 | msgid "Unsupported socks version %d\n" | 4132 | msgid "Unsupported socks version %d\n" |
4112 | msgstr "未知的命令“%sâ€ã€‚\n" | 4133 | msgstr "未知的命令“%sâ€ã€‚\n" |
4113 | 4134 | ||
4114 | #: src/gns/gnunet-gns-proxy.c:2738 | 4135 | #: src/gns/gnunet-gns-proxy.c:2739 |
4115 | #, fuzzy, c-format | 4136 | #, fuzzy, c-format |
4116 | msgid "Unsupported socks command %d\n" | 4137 | msgid "Unsupported socks command %d\n" |
4117 | msgstr "未知的命令“%sâ€ã€‚\n" | 4138 | msgstr "未知的命令“%sâ€ã€‚\n" |
4118 | 4139 | ||
4119 | #: src/gns/gnunet-gns-proxy.c:2756 src/gns/gnunet-gns-proxy.c:2785 | 4140 | #: src/gns/gnunet-gns-proxy.c:2757 src/gns/gnunet-gns-proxy.c:2786 |
4120 | msgid "SSL connection to plain IPv4 address requested\n" | 4141 | msgid "SSL connection to plain IPv4 address requested\n" |
4121 | msgstr "" | 4142 | msgstr "" |
4122 | 4143 | ||
4123 | #: src/gns/gnunet-gns-proxy.c:2836 | 4144 | #: src/gns/gnunet-gns-proxy.c:2837 |
4124 | #, fuzzy, c-format | 4145 | #, fuzzy, c-format |
4125 | msgid "Unsupported socks address type %d\n" | 4146 | msgid "Unsupported socks address type %d\n" |
4126 | msgstr "未知的命令“%sâ€ã€‚\n" | 4147 | msgstr "未知的命令“%sâ€ã€‚\n" |
4127 | 4148 | ||
4128 | #: src/gns/gnunet-gns-proxy.c:3171 | 4149 | #: src/gns/gnunet-gns-proxy.c:3172 |
4129 | msgid "No ego configured for `shorten-zone`\n" | 4150 | msgid "No ego configured for `shorten-zone`\n" |
4130 | msgstr "" | 4151 | msgstr "" |
4131 | 4152 | ||
4132 | #: src/gns/gnunet-gns-proxy.c:3211 src/gns/gnunet-service-gns.c:1093 | 4153 | #: src/gns/gnunet-gns-proxy.c:3212 src/gns/gnunet-service-gns.c:493 |
4133 | #: src/gns/gnunet-service-gns.c:1149 | 4154 | #: src/gns/gnunet-service-gns.c:548 |
4134 | #, c-format | 4155 | #, c-format |
4135 | msgid "No ego configured for `%s`\n" | 4156 | msgid "No ego configured for `%s`\n" |
4136 | msgstr "" | 4157 | msgstr "" |
4137 | 4158 | ||
4138 | #: src/gns/gnunet-gns-proxy.c:3273 | 4159 | #: src/gns/gnunet-gns-proxy.c:3274 |
4139 | #, fuzzy, c-format | 4160 | #, fuzzy, c-format |
4140 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" | 4161 | msgid "Failed to load SSL/TLS key and certificate from `%s'\n" |
4141 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 4162 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
4142 | 4163 | ||
4143 | #: src/gns/gnunet-gns-proxy.c:3313 | 4164 | #: src/gns/gnunet-gns-proxy.c:3314 |
4144 | msgid "listen on specified port (default: 7777)" | 4165 | msgid "listen on specified port (default: 7777)" |
4145 | msgstr "" | 4166 | msgstr "" |
4146 | 4167 | ||
4147 | #: src/gns/gnunet-gns-proxy.c:3316 | 4168 | #: src/gns/gnunet-gns-proxy.c:3317 |
4148 | msgid "pem file to use as CA" | 4169 | msgid "pem file to use as CA" |
4149 | msgstr "" | 4170 | msgstr "" |
4150 | 4171 | ||
4151 | #: src/gns/gnunet-gns-proxy.c:3335 | 4172 | #: src/gns/gnunet-gns-proxy.c:3336 |
4152 | msgid "GNUnet GNS proxy" | 4173 | msgid "GNUnet GNS proxy" |
4153 | msgstr "" | 4174 | msgstr "" |
4154 | 4175 | ||
4155 | #: src/gns/gnunet-service-gns.c:1187 | 4176 | #: src/gns/gnunet-service-gns.c:585 |
4177 | #: src/zonemaster/gnunet-service-zonemaster.c:705 | ||
4156 | #, fuzzy | 4178 | #, fuzzy |
4157 | msgid "Failed to connect to the namestore!\n" | 4179 | msgid "Failed to connect to the namestore!\n" |
4158 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 4180 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
4159 | 4181 | ||
4160 | #: src/gns/gnunet-service-gns.c:1195 | 4182 | #: src/gns/gnunet-service-gns.c:593 |
4161 | #, fuzzy | 4183 | #, fuzzy |
4162 | msgid "Failed to connect to the namecache!\n" | 4184 | msgid "Failed to connect to the namecache!\n" |
4163 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 4185 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
4164 | 4186 | ||
4165 | #: src/gns/gnunet-service-gns.c:1228 | 4187 | #: src/gns/gnunet-service-gns.c:612 |
4188 | #: src/zonemaster/gnunet-service-zonemaster.c:740 | ||
4166 | #, fuzzy | 4189 | #, fuzzy |
4167 | msgid "Could not connect to DHT!\n" | 4190 | msgid "Could not connect to DHT!\n" |
4168 | msgstr "æ— æ³•è¿žæŽ¥åˆ° %s:%u:%s\n" | 4191 | msgstr "æ— æ³•è¿žæŽ¥åˆ° %s:%u:%s\n" |
@@ -4994,8 +5017,7 @@ msgstr "" | |||
4994 | msgid "Invalid public key for reverse lookup `%s'\n" | 5017 | msgid "Invalid public key for reverse lookup `%s'\n" |
4995 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" | 5018 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" |
4996 | 5019 | ||
4997 | #: src/namestore/gnunet-namestore.c:979 | 5020 | #: src/namestore/gnunet-namestore.c:979 src/peerinfo-tool/gnunet-peerinfo.c:775 |
4998 | #: src/peerinfo-tool/gnunet-peerinfo.c:775 | ||
4999 | #, fuzzy, c-format | 5021 | #, fuzzy, c-format |
5000 | msgid "Invalid URI `%s'\n" | 5022 | msgid "Invalid URI `%s'\n" |
5001 | msgstr "æ— æ•ˆæ¡ç›®ã€‚\n" | 5023 | msgstr "æ— æ•ˆæ¡ç›®ã€‚\n" |
@@ -5153,215 +5175,290 @@ msgstr "sqlite æ•°æ®ä»“库" | |||
5153 | msgid "Namestore REST API initialized\n" | 5175 | msgid "Namestore REST API initialized\n" |
5154 | msgstr "" | 5176 | msgstr "" |
5155 | 5177 | ||
5156 | #: src/nat/gnunet-nat.c:159 | 5178 | #: src/nat-auto/gnunet-nat-auto.c:192 |
5157 | msgid "GNUnet NAT traversal autoconfigure daemon" | 5179 | #, fuzzy |
5180 | msgid "Suggested configuration changes:\n" | ||
5181 | msgstr "" | ||
5182 | "\n" | ||
5183 | "您的é…置更改没有ä¿å˜ã€‚\n" | ||
5184 | |||
5185 | #: src/nat-auto/gnunet-nat-auto.c:220 | ||
5186 | #, fuzzy, c-format | ||
5187 | msgid "Failed to write configuration to `%s'\n" | ||
5188 | msgstr "ä¿å˜é…置失败。" | ||
5189 | |||
5190 | #: src/nat-auto/gnunet-nat-auto.c:227 | ||
5191 | #, fuzzy, c-format | ||
5192 | msgid "Wrote updated configuration to `%s'\n" | ||
5193 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | ||
5194 | |||
5195 | #: src/nat-auto/gnunet-nat-auto.c:345 | ||
5196 | #, fuzzy | ||
5197 | msgid "run autoconfiguration" | ||
5198 | msgstr "é…é¢é…ç½®" | ||
5199 | |||
5200 | #: src/nat-auto/gnunet-nat-auto.c:348 | ||
5201 | msgid "section name providing the configuration for the adapter" | ||
5202 | msgstr "" | ||
5203 | |||
5204 | #: src/nat-auto/gnunet-nat-auto.c:351 src/nat/gnunet-nat.c:436 | ||
5205 | msgid "use TCP" | ||
5206 | msgstr "" | ||
5207 | |||
5208 | #: src/nat-auto/gnunet-nat-auto.c:354 src/nat/gnunet-nat.c:439 | ||
5209 | msgid "use UDP" | ||
5210 | msgstr "" | ||
5211 | |||
5212 | #: src/nat-auto/gnunet-nat-auto.c:357 | ||
5213 | msgid "write configuration file (for autoconfiguration)" | ||
5158 | msgstr "" | 5214 | msgstr "" |
5159 | 5215 | ||
5160 | #: src/nat/gnunet-nat-server.c:321 | 5216 | #: src/nat-auto/gnunet-nat-auto.c:369 |
5217 | #, fuzzy | ||
5218 | msgid "GNUnet NAT traversal autoconfiguration" | ||
5219 | msgstr "GNUnet é…ç½®" | ||
5220 | |||
5221 | #: src/nat-auto/gnunet-nat-auto_legacy.c:403 | ||
5222 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:681 | ||
5223 | #: src/nat-auto/nat_auto_api_test.c:405 | ||
5224 | msgid "Failed to connect to `gnunet-nat-server'\n" | ||
5225 | msgstr "" | ||
5226 | |||
5227 | #: src/nat-auto/gnunet-nat-auto_legacy.c:518 | ||
5228 | #: src/nat-auto/nat_auto_api_test.c:520 | ||
5229 | #, c-format | ||
5230 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5231 | msgstr "" | ||
5232 | |||
5233 | #: src/nat-auto/gnunet-nat-auto_legacy.c:568 | ||
5234 | #: src/nat-auto/nat_auto_api_test.c:569 | ||
5235 | #, fuzzy | ||
5236 | msgid "NAT test failed to start NAT library\n" | ||
5237 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | ||
5238 | |||
5239 | #: src/nat-auto/gnunet-nat-server.c:336 | ||
5161 | #, c-format | 5240 | #, c-format |
5162 | msgid "Please pass valid port number as the first argument! (got `%s')\n" | 5241 | msgid "Please pass valid port number as the first argument! (got `%s')\n" |
5163 | msgstr "" | 5242 | msgstr "" |
5164 | 5243 | ||
5165 | #: src/nat/gnunet-nat-server.c:363 | 5244 | #: src/nat-auto/gnunet-nat-server.c:386 |
5166 | msgid "GNUnet NAT traversal test helper daemon" | 5245 | msgid "GNUnet NAT traversal test helper daemon" |
5167 | msgstr "" | 5246 | msgstr "" |
5168 | 5247 | ||
5169 | #: src/nat/nat_api.c:880 src/nat/nat.c:2010 | 5248 | #: src/nat-auto/gnunet-service-nat-auto.c:342 |
5249 | msgid "UPnP client `upnpc` command not found, disabling UPnP\n" | ||
5250 | msgstr "" | ||
5251 | |||
5252 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:385 | ||
5253 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5254 | msgstr "" | ||
5255 | |||
5256 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:386 | ||
5257 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5258 | msgstr "" | ||
5259 | |||
5260 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:405 | ||
5261 | msgid "Testing connection reversal with ICMP server.\n" | ||
5262 | msgstr "" | ||
5263 | |||
5264 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:437 | ||
5265 | #, c-format | ||
5266 | msgid "Detected external IP `%s'\n" | ||
5267 | msgstr "" | ||
5268 | |||
5269 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:572 | ||
5270 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | ||
5271 | msgstr "" | ||
5272 | |||
5273 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:590 | ||
5274 | #, fuzzy, c-format | ||
5275 | msgid "Detected internal network address `%s'.\n" | ||
5276 | msgstr "GNUnet 现在使用 IP åœ°å€ %s。\n" | ||
5277 | |||
5278 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:724 | ||
5279 | msgid "upnpc found, enabling its use\n" | ||
5280 | msgstr "" | ||
5281 | |||
5282 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:725 | ||
5283 | msgid "upnpc not found\n" | ||
5284 | msgstr "" | ||
5285 | |||
5286 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:762 | ||
5287 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | ||
5288 | msgstr "" | ||
5289 | |||
5290 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:774 | ||
5291 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:834 | ||
5292 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | ||
5293 | msgstr "" | ||
5294 | |||
5295 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:786 | ||
5296 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:846 | ||
5297 | msgid "No working gnunet-helper-nat-server found\n" | ||
5298 | msgstr "" | ||
5299 | |||
5300 | #: src/nat-auto/gnunet-service-nat-auto_legacy.c:823 | ||
5301 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | ||
5302 | msgstr "" | ||
5303 | |||
5304 | #: src/nat-auto/nat_auto_api.c:76 | ||
5170 | msgid "Operation Successful" | 5305 | msgid "Operation Successful" |
5171 | msgstr "" | 5306 | msgstr "" |
5172 | 5307 | ||
5173 | #: src/nat/nat_api.c:882 src/nat/nat.c:2012 | 5308 | #: src/nat-auto/nat_auto_api.c:78 |
5174 | msgid "Internal Failure (IPC, ...)" | 5309 | msgid "IPC failure" |
5175 | msgstr "" | 5310 | msgstr "" |
5176 | 5311 | ||
5177 | #: src/nat/nat_api.c:884 src/nat/nat.c:2014 | 5312 | #: src/nat-auto/nat_auto_api.c:80 |
5178 | msgid "Failure in network subsystem, check permissions." | 5313 | msgid "Failure in network subsystem, check permissions." |
5179 | msgstr "" | 5314 | msgstr "" |
5180 | 5315 | ||
5181 | #: src/nat/nat_api.c:886 src/nat/nat.c:2016 | 5316 | #: src/nat-auto/nat_auto_api.c:82 |
5182 | msgid "Encountered timeout while performing operation" | 5317 | msgid "Encountered timeout while performing operation" |
5183 | msgstr "" | 5318 | msgstr "" |
5184 | 5319 | ||
5185 | #: src/nat/nat_api.c:888 src/nat/nat.c:2018 | 5320 | #: src/nat-auto/nat_auto_api.c:84 |
5186 | msgid "detected that we are offline" | 5321 | msgid "detected that we are offline" |
5187 | msgstr "" | 5322 | msgstr "" |
5188 | 5323 | ||
5189 | #: src/nat/nat_api.c:890 src/nat/nat.c:2020 | 5324 | #: src/nat-auto/nat_auto_api.c:86 |
5190 | msgid "`upnpc` command not found" | 5325 | msgid "`upnpc` command not found" |
5191 | msgstr "" | 5326 | msgstr "" |
5192 | 5327 | ||
5193 | #: src/nat/nat_api.c:892 src/nat/nat.c:2022 | 5328 | #: src/nat-auto/nat_auto_api.c:88 |
5194 | #, fuzzy | 5329 | #, fuzzy |
5195 | msgid "Failed to run `upnpc` command" | 5330 | msgid "Failed to run `upnpc` command" |
5196 | msgstr "è¿è¡Œ %s失败:%s %d\n" | 5331 | msgstr "è¿è¡Œ %s失败:%s %d\n" |
5197 | 5332 | ||
5198 | #: src/nat/nat_api.c:894 src/nat/nat.c:2024 | 5333 | #: src/nat-auto/nat_auto_api.c:90 |
5199 | msgid "`upnpc' command took too long, process killed" | 5334 | msgid "`upnpc' command took too long, process killed" |
5200 | msgstr "" | 5335 | msgstr "" |
5201 | 5336 | ||
5202 | #: src/nat/nat_api.c:896 src/nat/nat.c:2026 | 5337 | #: src/nat-auto/nat_auto_api.c:92 |
5203 | msgid "`upnpc' command failed to establish port mapping" | 5338 | msgid "`upnpc' command failed to establish port mapping" |
5204 | msgstr "" | 5339 | msgstr "" |
5205 | 5340 | ||
5206 | #: src/nat/nat_api.c:898 src/nat/nat.c:2028 | 5341 | #: src/nat-auto/nat_auto_api.c:94 |
5207 | msgid "`external-ip' command not found" | 5342 | msgid "`external-ip' command not found" |
5208 | msgstr "" | 5343 | msgstr "" |
5209 | 5344 | ||
5210 | #: src/nat/nat_api.c:900 src/nat/nat.c:2030 | 5345 | #: src/nat-auto/nat_auto_api.c:96 |
5211 | #, fuzzy | 5346 | #, fuzzy |
5212 | msgid "Failed to run `external-ip` command" | 5347 | msgid "Failed to run `external-ip` command" |
5213 | msgstr "è¿è¡Œ %s失败:%s %d\n" | 5348 | msgstr "è¿è¡Œ %s失败:%s %d\n" |
5214 | 5349 | ||
5215 | #: src/nat/nat_api.c:902 src/nat/nat.c:2032 | 5350 | #: src/nat-auto/nat_auto_api.c:98 |
5216 | msgid "`external-ip' command output invalid" | 5351 | msgid "`external-ip' command output invalid" |
5217 | msgstr "" | 5352 | msgstr "" |
5218 | 5353 | ||
5219 | #: src/nat/nat_api.c:904 src/nat/nat.c:2034 | 5354 | #: src/nat-auto/nat_auto_api.c:100 |
5220 | msgid "no valid address was returned by `external-ip'" | 5355 | msgid "no valid address was returned by `external-ip'" |
5221 | msgstr "" | 5356 | msgstr "" |
5222 | 5357 | ||
5223 | #: src/nat/nat_api.c:906 src/nat/nat.c:2036 | 5358 | #: src/nat-auto/nat_auto_api.c:102 |
5224 | #, fuzzy | 5359 | #, fuzzy |
5225 | msgid "Could not determine interface with internal/local network address" | 5360 | msgid "Could not determine interface with internal/local network address" |
5226 | msgstr "æ— æ³•ç¡®å®šç”¨æˆ·ç•Œé¢å®šä¹‰æ–‡ä»¶ã€‚" | 5361 | msgstr "æ— æ³•ç¡®å®šç”¨æˆ·ç•Œé¢å®šä¹‰æ–‡ä»¶ã€‚" |
5227 | 5362 | ||
5228 | #: src/nat/nat_api.c:908 src/nat/nat.c:2038 | 5363 | #: src/nat-auto/nat_auto_api.c:104 |
5229 | msgid "No functioning gnunet-helper-nat-server installation found" | 5364 | msgid "No functioning gnunet-helper-nat-server installation found" |
5230 | msgstr "" | 5365 | msgstr "" |
5231 | 5366 | ||
5232 | #: src/nat/nat_api.c:910 src/nat/nat.c:2040 | 5367 | #: src/nat-auto/nat_auto_api.c:106 |
5233 | msgid "NAT test could not be initialized" | 5368 | msgid "NAT test could not be initialized" |
5234 | msgstr "" | 5369 | msgstr "" |
5235 | 5370 | ||
5236 | #: src/nat/nat_api.c:912 src/nat/nat.c:2042 | 5371 | #: src/nat-auto/nat_auto_api.c:108 |
5237 | msgid "NAT test timeout reached" | 5372 | msgid "NAT test timeout reached" |
5238 | msgstr "" | 5373 | msgstr "" |
5239 | 5374 | ||
5240 | #: src/nat/nat_api.c:914 src/nat/nat.c:2044 | 5375 | #: src/nat-auto/nat_auto_api.c:110 |
5241 | msgid "could not register NAT" | 5376 | msgid "could not register NAT" |
5242 | msgstr "" | 5377 | msgstr "" |
5243 | 5378 | ||
5244 | #: src/nat/nat_api.c:916 src/nat/nat.c:2046 | 5379 | #: src/nat-auto/nat_auto_api.c:112 |
5245 | msgid "No working gnunet-helper-nat-client installation found" | 5380 | msgid "No working gnunet-helper-nat-client installation found" |
5246 | msgstr "" | 5381 | msgstr "" |
5247 | 5382 | ||
5248 | #: src/nat/nat_auto.c:385 | 5383 | #: src/nat-auto/nat_auto_api_test.c:477 |
5249 | msgid "NAT traversal with ICMP Server succeeded.\n" | ||
5250 | msgstr "" | ||
5251 | |||
5252 | #: src/nat/nat_auto.c:386 | ||
5253 | msgid "NAT traversal with ICMP Server failed.\n" | ||
5254 | msgstr "" | ||
5255 | |||
5256 | #: src/nat/nat_auto.c:405 | ||
5257 | msgid "Testing connection reversal with ICMP server.\n" | ||
5258 | msgstr "" | ||
5259 | |||
5260 | #: src/nat/nat_auto.c:437 | ||
5261 | #, c-format | ||
5262 | msgid "Detected external IP `%s'\n" | ||
5263 | msgstr "" | ||
5264 | |||
5265 | #: src/nat/nat_auto.c:572 | ||
5266 | msgid "This system has a global IPv6 address, setting IPv6 to supported.\n" | ||
5267 | msgstr "" | ||
5268 | |||
5269 | #: src/nat/nat_auto.c:590 | ||
5270 | #, fuzzy, c-format | 5384 | #, fuzzy, c-format |
5271 | msgid "Detected internal network address `%s'.\n" | 5385 | msgid "Failed to find valid PORT in section `%s'\n" |
5272 | msgstr "GNUnet 现在使用 IP åœ°å€ %s。\n" | 5386 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
5273 | 5387 | ||
5274 | #: src/nat/nat_auto.c:681 src/nat/nat_test.c:403 | 5388 | #: src/nat/gnunet-nat.c:424 |
5275 | msgid "Failed to connect to `gnunet-nat-server'\n" | 5389 | msgid "which IP and port are we locally using to bind/listen to" |
5276 | msgstr "" | 5390 | msgstr "" |
5277 | 5391 | ||
5278 | #: src/nat/nat_auto.c:724 | 5392 | #: src/nat/gnunet-nat.c:427 |
5279 | msgid "upnpc found, enabling its use\n" | 5393 | msgid "which remote IP and port should be asked for connection reversal" |
5280 | msgstr "" | 5394 | msgstr "" |
5281 | 5395 | ||
5282 | #: src/nat/nat_auto.c:725 | 5396 | #: src/nat/gnunet-nat.c:430 |
5283 | msgid "upnpc not found\n" | 5397 | msgid "" |
5398 | "name of configuration section to find additional options, such as manual " | ||
5399 | "host punching data" | ||
5284 | msgstr "" | 5400 | msgstr "" |
5285 | 5401 | ||
5286 | #: src/nat/nat_auto.c:762 | 5402 | #: src/nat/gnunet-nat.c:433 |
5287 | msgid "test_icmp_server not possible, as we have no public IPv4 address\n" | 5403 | msgid "enable STUN processing" |
5288 | msgstr "" | 5404 | msgstr "" |
5289 | 5405 | ||
5290 | #: src/nat/nat_auto.c:774 src/nat/nat_auto.c:834 | 5406 | #: src/nat/gnunet-nat.c:442 |
5291 | msgid "test_icmp_server not possible, as we are not behind NAT\n" | 5407 | msgid "watch for connection reversal requests" |
5292 | msgstr "" | 5408 | msgstr "" |
5293 | 5409 | ||
5294 | #: src/nat/nat_auto.c:786 src/nat/nat_auto.c:846 | 5410 | #: src/nat/gnunet-nat.c:454 |
5295 | msgid "No working gnunet-helper-nat-server found\n" | 5411 | msgid "GNUnet NAT traversal autoconfigure daemon" |
5296 | msgstr "" | 5412 | msgstr "" |
5297 | 5413 | ||
5298 | #: src/nat/nat_auto.c:823 | 5414 | #: src/nat/gnunet-service-nat.c:1313 |
5299 | msgid "test_icmp_client not possible, as we have no internal IPv4 address\n" | 5415 | #, c-format |
5416 | msgid "Malformed punched hole specification `%s' (lacks port)\n" | ||
5300 | msgstr "" | 5417 | msgstr "" |
5301 | 5418 | ||
5302 | #: src/nat/nat.c:1019 | 5419 | #: src/nat/gnunet-service-nat.c:1323 |
5303 | #, c-format | 5420 | #, c-format |
5304 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" | 5421 | msgid "Invalid port number in punched hole specification `%s' (lacks port)\n" |
5305 | msgstr "" | 5422 | msgstr "" |
5306 | 5423 | ||
5307 | #: src/nat/nat.c:1070 | 5424 | #: src/nat/gnunet-service-nat.c:1339 |
5308 | #, fuzzy, c-format | 5425 | #, c-format |
5309 | msgid "Failed to start %s\n" | 5426 | msgid "Malformed punched hole specification `%s' (lacks `]')\n" |
5310 | msgstr "è¿è¡Œ %s失败:%s %d\n" | ||
5311 | |||
5312 | #: src/nat/nat.c:1327 | ||
5313 | msgid "Error while running upnp client:\n" | ||
5314 | msgstr "" | 5427 | msgstr "" |
5315 | 5428 | ||
5316 | #: src/nat/nat.c:1402 | 5429 | #: src/nat/gnunet-service-nat.c:1350 |
5317 | #, fuzzy, c-format | 5430 | #, c-format |
5318 | msgid "Failed to run upnp client for port %u\n" | 5431 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
5319 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 5432 | msgstr "" |
5320 | 5433 | ||
5321 | #: src/nat/nat.c:1546 | 5434 | #: src/nat/gnunet-service-nat.c:1803 |
5322 | msgid "malformed" | 5435 | msgid "Connection reversal request failed\n" |
5323 | msgstr "" | 5436 | msgstr "" |
5324 | 5437 | ||
5325 | #: src/nat/nat.c:1600 | 5438 | #: src/nat/gnunet-service-nat.c:1876 |
5326 | msgid "" | 5439 | msgid "" |
5327 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 5440 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
5328 | "disabling UPnP \n" | 5441 | "disabling UPnP\n" |
5329 | msgstr "" | 5442 | msgstr "" |
5330 | 5443 | ||
5331 | #: src/nat/nat.c:1726 src/nat/nat.c:1739 | 5444 | #: src/nat/gnunet-service-nat_helper.c:186 |
5332 | #, c-format | 5445 | #, c-format |
5333 | msgid "" | 5446 | msgid "gnunet-helper-nat-server generated malformed address `%s'\n" |
5334 | "Configuration requires `%s', but binary is not installed properly (SUID bit " | ||
5335 | "not set). Option disabled.\n" | ||
5336 | msgstr "" | ||
5337 | |||
5338 | #: src/nat/nat.c:1903 | ||
5339 | msgid "Internal IP address not known, cannot use ICMP NAT traversal method\n" | ||
5340 | msgstr "" | 5447 | msgstr "" |
5341 | 5448 | ||
5342 | #: src/nat/nat.c:1919 | 5449 | #: src/nat/gnunet-service-nat_helper.c:260 |
5343 | #, c-format | 5450 | #, fuzzy, c-format |
5344 | msgid "Running gnunet-helper-nat-client %s %s %u\n" | 5451 | msgid "Failed to start %s\n" |
5345 | msgstr "" | 5452 | msgstr "è¿è¡Œ %s失败:%s %d\n" |
5346 | 5453 | ||
5347 | #: src/nat/nat_mini.c:205 | 5454 | #: src/nat/gnunet-service-nat_mini.c:196 |
5348 | msgid "`external-ip' command not found\n" | 5455 | msgid "`external-ip' command not found\n" |
5349 | msgstr "" | 5456 | msgstr "" |
5350 | 5457 | ||
5351 | #: src/nat/nat_mini.c:611 | 5458 | #: src/nat/gnunet-service-nat_mini.c:654 |
5352 | msgid "`upnpc' command not found\n" | 5459 | msgid "`upnpc' command not found\n" |
5353 | msgstr "" | 5460 | msgstr "" |
5354 | 5461 | ||
5355 | #: src/nat/nat_test.c:518 | ||
5356 | #, c-format | ||
5357 | msgid "Failed to create listen socket bound to `%s' for NAT test: %s\n" | ||
5358 | msgstr "" | ||
5359 | |||
5360 | #: src/nat/nat_test.c:568 | ||
5361 | #, fuzzy | ||
5362 | msgid "NAT test failed to start NAT library\n" | ||
5363 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | ||
5364 | |||
5365 | #: src/nse/gnunet-nse.c:122 | 5462 | #: src/nse/gnunet-nse.c:122 |
5366 | msgid "Show network size estimates from NSE service." | 5463 | msgid "Show network size estimates from NSE service." |
5367 | msgstr "" | 5464 | msgstr "" |
@@ -7115,179 +7212,156 @@ msgstr "" | |||
7115 | msgid "# validations succeeded" | 7212 | msgid "# validations succeeded" |
7116 | msgstr "" | 7213 | msgstr "" |
7117 | 7214 | ||
7118 | #: src/transport/gnunet-transport.c:486 | 7215 | #: src/transport/gnunet-transport.c:418 |
7119 | #, c-format | 7216 | #, c-format |
7120 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" | 7217 | msgid "Transmitted %llu bytes/s (%llu bytes in %s)\n" |
7121 | msgstr "" | 7218 | msgstr "" |
7122 | 7219 | ||
7123 | #: src/transport/gnunet-transport.c:496 | 7220 | #: src/transport/gnunet-transport.c:428 |
7124 | #, c-format | 7221 | #, c-format |
7125 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" | 7222 | msgid "Received %llu bytes/s (%llu bytes in %s)\n" |
7126 | msgstr "" | 7223 | msgstr "" |
7127 | 7224 | ||
7128 | #: src/transport/gnunet-transport.c:540 | 7225 | #: src/transport/gnunet-transport.c:472 |
7129 | #, fuzzy, c-format | 7226 | #, fuzzy, c-format |
7130 | msgid "Failed to connect to `%s'\n" | 7227 | msgid "Failed to connect to `%s'\n" |
7131 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 7228 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
7132 | 7229 | ||
7133 | #: src/transport/gnunet-transport.c:553 | 7230 | #: src/transport/gnunet-transport.c:485 |
7134 | #, fuzzy, c-format | 7231 | #, fuzzy, c-format |
7135 | msgid "Failed to resolve address for peer `%s'\n" | 7232 | msgid "Failed to resolve address for peer `%s'\n" |
7136 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | 7233 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" |
7137 | 7234 | ||
7138 | #: src/transport/gnunet-transport.c:565 | 7235 | #: src/transport/gnunet-transport.c:499 |
7139 | #, fuzzy | 7236 | #, fuzzy |
7140 | msgid "Failed to list connections, timeout occured\n" | 7237 | msgid "Failed to list connections, timeout occured\n" |
7141 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 7238 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
7142 | 7239 | ||
7143 | #: src/transport/gnunet-transport.c:588 | 7240 | #: src/transport/gnunet-transport.c:532 |
7144 | #, c-format | ||
7145 | msgid "NAT plugin `%s' reports: %s\n" | ||
7146 | msgstr "" | ||
7147 | |||
7148 | #: src/transport/gnunet-transport.c:675 | ||
7149 | msgid "No transport plugins configured, peer will never communicate\n" | ||
7150 | msgstr "" | ||
7151 | |||
7152 | #: src/transport/gnunet-transport.c:689 | ||
7153 | #, c-format | ||
7154 | msgid "No port configured for plugin `%s', cannot test it\n" | ||
7155 | msgstr "" | ||
7156 | |||
7157 | #: src/transport/gnunet-transport.c:714 | ||
7158 | #, fuzzy | ||
7159 | msgid "Failed to start resolver!\n" | ||
7160 | msgstr "è¿è¡Œ %s失败:%s %d\n" | ||
7161 | |||
7162 | #: src/transport/gnunet-transport.c:750 | ||
7163 | #, c-format | 7241 | #, c-format |
7164 | msgid "Transmitting %u bytes\n" | 7242 | msgid "Transmitting %u bytes\n" |
7165 | msgstr "" | 7243 | msgstr "" |
7166 | 7244 | ||
7167 | #: src/transport/gnunet-transport.c:784 | 7245 | #: src/transport/gnunet-transport.c:566 |
7168 | #, c-format | 7246 | #, c-format |
7169 | msgid "" | 7247 | msgid "" |
7170 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " | 7248 | "Successfully connected to `%s', starting to send benchmark data in %u Kb " |
7171 | "blocks\n" | 7249 | "blocks\n" |
7172 | msgstr "" | 7250 | msgstr "" |
7173 | 7251 | ||
7174 | #: src/transport/gnunet-transport.c:815 | 7252 | #: src/transport/gnunet-transport.c:597 |
7175 | #, fuzzy, c-format | 7253 | #, fuzzy, c-format |
7176 | msgid "Disconnected from peer `%s' while benchmarking\n" | 7254 | msgid "Disconnected from peer `%s' while benchmarking\n" |
7177 | msgstr "“%sâ€å·²è¿žæŽ¥åˆ°â€œ%sâ€ã€‚\n" | 7255 | msgstr "“%sâ€å·²è¿žæŽ¥åˆ°â€œ%sâ€ã€‚\n" |
7178 | 7256 | ||
7179 | #: src/transport/gnunet-transport.c:839 src/transport/gnunet-transport.c:868 | 7257 | #: src/transport/gnunet-transport.c:621 src/transport/gnunet-transport.c:650 |
7180 | #, c-format | 7258 | #, c-format |
7181 | msgid "%24s: %-17s %4s (%u connections in total)\n" | 7259 | msgid "%24s: %-17s %4s (%u connections in total)\n" |
7182 | msgstr "" | 7260 | msgstr "" |
7183 | 7261 | ||
7184 | #: src/transport/gnunet-transport.c:841 | 7262 | #: src/transport/gnunet-transport.c:623 |
7185 | #, fuzzy | 7263 | #, fuzzy |
7186 | msgid "Connected to" | 7264 | msgid "Connected to" |
7187 | msgstr "“%sâ€å·²è¿žæŽ¥åˆ°â€œ%sâ€ã€‚\n" | 7265 | msgstr "“%sâ€å·²è¿žæŽ¥åˆ°â€œ%sâ€ã€‚\n" |
7188 | 7266 | ||
7189 | #: src/transport/gnunet-transport.c:870 | 7267 | #: src/transport/gnunet-transport.c:652 |
7190 | #, fuzzy | 7268 | #, fuzzy |
7191 | msgid "Disconnected from" | 7269 | msgid "Disconnected from" |
7192 | msgstr "“%sâ€å·²è¿žæŽ¥åˆ°â€œ%sâ€ã€‚\n" | 7270 | msgstr "“%sâ€å·²è¿žæŽ¥åˆ°â€œ%sâ€ã€‚\n" |
7193 | 7271 | ||
7194 | #: src/transport/gnunet-transport.c:905 | 7272 | #: src/transport/gnunet-transport.c:687 |
7195 | #, c-format | 7273 | #, c-format |
7196 | msgid "Received %u bytes\n" | 7274 | msgid "Received %u bytes\n" |
7197 | msgstr "" | 7275 | msgstr "" |
7198 | 7276 | ||
7199 | #: src/transport/gnunet-transport.c:942 | 7277 | #: src/transport/gnunet-transport.c:724 |
7200 | #, c-format | 7278 | #, c-format |
7201 | msgid "Peer `%s': %s %s in state `%s' until %s\n" | 7279 | msgid "Peer `%s': %s %s in state `%s' until %s\n" |
7202 | msgstr "" | 7280 | msgstr "" |
7203 | 7281 | ||
7204 | #: src/transport/gnunet-transport.c:954 | 7282 | #: src/transport/gnunet-transport.c:736 |
7205 | #, fuzzy, c-format | 7283 | #, fuzzy, c-format |
7206 | msgid "Peer `%s': %s %s\n" | 7284 | msgid "Peer `%s': %s %s\n" |
7207 | msgstr "è¿è¡Œ %s失败:%s %d\n" | 7285 | msgstr "è¿è¡Œ %s失败:%s %d\n" |
7208 | 7286 | ||
7209 | #: src/transport/gnunet-transport.c:1366 | 7287 | #: src/transport/gnunet-transport.c:1150 |
7210 | #, fuzzy | 7288 | #, fuzzy |
7211 | msgid "Monitor disconnected from transport service. Reconnecting.\n" | 7289 | msgid "Monitor disconnected from transport service. Reconnecting.\n" |
7212 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 7290 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
7213 | 7291 | ||
7214 | #: src/transport/gnunet-transport.c:1488 | 7292 | #: src/transport/gnunet-transport.c:1267 |
7215 | #, c-format | 7293 | #, c-format |
7216 | msgid "" | 7294 | msgid "" |
7217 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " | 7295 | "Multiple operations given. Please choose only one operation: %s, %s, %s, %s, " |
7218 | "%s, %s %s\n" | 7296 | "%s, %s %s\n" |
7219 | msgstr "" | 7297 | msgstr "" |
7220 | 7298 | ||
7221 | #: src/transport/gnunet-transport.c:1501 | 7299 | #: src/transport/gnunet-transport.c:1280 |
7222 | #, c-format | 7300 | #, c-format |
7223 | msgid "" | 7301 | msgid "" |
7224 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" | 7302 | "No operation given. Please choose one operation: %s, %s, %s, %s, %s, %s, %s\n" |
7225 | msgstr "" | 7303 | msgstr "" |
7226 | 7304 | ||
7227 | #: src/transport/gnunet-transport.c:1529 | 7305 | #: src/transport/gnunet-transport.c:1308 |
7228 | #, fuzzy | 7306 | #, fuzzy |
7229 | msgid "Failed to connect to transport service for disconnection\n" | 7307 | msgid "Failed to connect to transport service for disconnection\n" |
7230 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 7308 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
7231 | 7309 | ||
7232 | #: src/transport/gnunet-transport.c:1535 | 7310 | #: src/transport/gnunet-transport.c:1314 |
7233 | msgid "Blacklisting request in place, stop with CTRL-C\n" | 7311 | msgid "Blacklisting request in place, stop with CTRL-C\n" |
7234 | msgstr "" | 7312 | msgstr "" |
7235 | 7313 | ||
7236 | #: src/transport/gnunet-transport.c:1558 src/transport/gnunet-transport.c:1588 | 7314 | #: src/transport/gnunet-transport.c:1337 src/transport/gnunet-transport.c:1367 |
7237 | #: src/transport/gnunet-transport.c:1641 | 7315 | #: src/transport/gnunet-transport.c:1420 |
7238 | #, fuzzy | 7316 | #, fuzzy |
7239 | msgid "Failed to connect to transport service\n" | 7317 | msgid "Failed to connect to transport service\n" |
7240 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 7318 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
7241 | 7319 | ||
7242 | #: src/transport/gnunet-transport.c:1595 | 7320 | #: src/transport/gnunet-transport.c:1374 |
7243 | msgid "Starting to receive benchmark data\n" | 7321 | msgid "Starting to receive benchmark data\n" |
7244 | msgstr "" | 7322 | msgstr "" |
7245 | 7323 | ||
7246 | #: src/transport/gnunet-transport.c:1665 | 7324 | #: src/transport/gnunet-transport.c:1444 |
7247 | #, fuzzy | 7325 | #, fuzzy |
7248 | msgid "print information for all peers (instead of only connected peers)" | 7326 | msgid "print information for all peers (instead of only connected peers)" |
7249 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | 7327 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" |
7250 | 7328 | ||
7251 | #: src/transport/gnunet-transport.c:1668 | 7329 | #: src/transport/gnunet-transport.c:1447 |
7252 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" | 7330 | msgid "measure how fast we are receiving data from all peers (until CTRL-C)" |
7253 | msgstr "" | 7331 | msgstr "" |
7254 | 7332 | ||
7255 | #: src/transport/gnunet-transport.c:1671 | 7333 | #: src/transport/gnunet-transport.c:1450 |
7256 | #, fuzzy | 7334 | #, fuzzy |
7257 | msgid "disconnect from a peer" | 7335 | msgid "disconnect from a peer" |
7258 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 7336 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
7259 | 7337 | ||
7260 | #: src/transport/gnunet-transport.c:1674 | 7338 | #: src/transport/gnunet-transport.c:1453 |
7261 | msgid "provide information about all current connections (once)" | 7339 | msgid "provide information about all current connections (once)" |
7262 | msgstr "" | 7340 | msgstr "" |
7263 | 7341 | ||
7264 | #: src/transport/gnunet-transport.c:1680 | 7342 | #: src/transport/gnunet-transport.c:1459 |
7265 | msgid "" | 7343 | msgid "" |
7266 | "provide information about all connects and disconnect events (continuously)" | 7344 | "provide information about all connects and disconnect events (continuously)" |
7267 | msgstr "" | 7345 | msgstr "" |
7268 | 7346 | ||
7269 | #: src/transport/gnunet-transport.c:1683 | 7347 | #: src/transport/gnunet-transport.c:1462 |
7270 | msgid "do not resolve hostnames" | 7348 | msgid "do not resolve hostnames" |
7271 | msgstr "" | 7349 | msgstr "" |
7272 | 7350 | ||
7273 | #: src/transport/gnunet-transport.c:1686 | 7351 | #: src/transport/gnunet-transport.c:1465 |
7274 | #: src/transport/gnunet-transport-profiler.c:631 | 7352 | #: src/transport/gnunet-transport-profiler.c:631 |
7275 | msgid "peer identity" | 7353 | msgid "peer identity" |
7276 | msgstr "" | 7354 | msgstr "" |
7277 | 7355 | ||
7278 | #: src/transport/gnunet-transport.c:1689 | 7356 | #: src/transport/gnunet-transport.c:1468 |
7279 | msgid "monitor plugin sessions" | 7357 | msgid "monitor plugin sessions" |
7280 | msgstr "" | 7358 | msgstr "" |
7281 | 7359 | ||
7282 | #: src/transport/gnunet-transport.c:1692 | 7360 | #: src/transport/gnunet-transport.c:1471 |
7283 | msgid "send data for benchmarking to the other peer (until CTRL-C)" | 7361 | msgid "send data for benchmarking to the other peer (until CTRL-C)" |
7284 | msgstr "" | 7362 | msgstr "" |
7285 | 7363 | ||
7286 | #: src/transport/gnunet-transport.c:1695 | 7364 | #: src/transport/gnunet-transport.c:1482 |
7287 | msgid "test transport configuration (involves external server)" | ||
7288 | msgstr "" | ||
7289 | |||
7290 | #: src/transport/gnunet-transport.c:1706 | ||
7291 | #: src/transport/gnunet-transport-profiler.c:642 | 7365 | #: src/transport/gnunet-transport-profiler.c:642 |
7292 | #, fuzzy | 7366 | #, fuzzy |
7293 | msgid "Direct access to transport service." | 7367 | msgid "Direct access to transport service." |
@@ -7322,9 +7396,9 @@ msgstr "消æ¯å°ºå¯¸" | |||
7322 | 7396 | ||
7323 | #: src/transport/plugin_transport_http_client.c:1477 | 7397 | #: src/transport/plugin_transport_http_client.c:1477 |
7324 | #: src/transport/plugin_transport_http_server.c:2248 | 7398 | #: src/transport/plugin_transport_http_server.c:2248 |
7325 | #: src/transport/plugin_transport_http_server.c:3457 | 7399 | #: src/transport/plugin_transport_http_server.c:3462 |
7326 | #: src/transport/plugin_transport_tcp.c:3365 | 7400 | #: src/transport/plugin_transport_tcp.c:3375 |
7327 | #: src/transport/plugin_transport_tcp.c:3372 | 7401 | #: src/transport/plugin_transport_tcp.c:3382 |
7328 | msgid "TCP_STEALTH not supported on this platform.\n" | 7402 | msgid "TCP_STEALTH not supported on this platform.\n" |
7329 | msgstr "" | 7403 | msgstr "" |
7330 | 7404 | ||
@@ -7334,13 +7408,13 @@ msgid "Could not initialize curl multi handle, failed to start %s plugin!\n" | |||
7334 | msgstr "" | 7408 | msgstr "" |
7335 | 7409 | ||
7336 | #: src/transport/plugin_transport_http_client.c:2167 | 7410 | #: src/transport/plugin_transport_http_client.c:2167 |
7337 | #: src/transport/plugin_transport_http_server.c:3172 | 7411 | #: src/transport/plugin_transport_http_server.c:3177 |
7338 | #, fuzzy, c-format | 7412 | #, fuzzy, c-format |
7339 | msgid "Shutting down plugin `%s'\n" | 7413 | msgid "Shutting down plugin `%s'\n" |
7340 | msgstr "未知的命令“%sâ€ã€‚\n" | 7414 | msgstr "未知的命令“%sâ€ã€‚\n" |
7341 | 7415 | ||
7342 | #: src/transport/plugin_transport_http_client.c:2184 | 7416 | #: src/transport/plugin_transport_http_client.c:2184 |
7343 | #: src/transport/plugin_transport_http_server.c:3242 | 7417 | #: src/transport/plugin_transport_http_server.c:3247 |
7344 | #, c-format | 7418 | #, c-format |
7345 | msgid "Shutdown for plugin `%s' complete\n" | 7419 | msgid "Shutdown for plugin `%s' complete\n" |
7346 | msgstr "" | 7420 | msgstr "" |
@@ -7383,73 +7457,73 @@ msgstr "" | |||
7383 | msgid "Could not load or create server certificate! Loading plugin failed!\n" | 7457 | msgid "Could not load or create server certificate! Loading plugin failed!\n" |
7384 | msgstr "" | 7458 | msgstr "" |
7385 | 7459 | ||
7386 | #: src/transport/plugin_transport_http_server.c:2583 | 7460 | #: src/transport/plugin_transport_http_server.c:2586 |
7387 | #, fuzzy | 7461 | #, fuzzy |
7388 | msgid "Require valid port number for service in configuration!\n" | 7462 | msgid "Require valid port number for service in configuration!\n" |
7389 | msgstr "ä¿å˜é…置失败。" | 7463 | msgstr "ä¿å˜é…置失败。" |
7390 | 7464 | ||
7391 | #: src/transport/plugin_transport_http_server.c:2748 | 7465 | #: src/transport/plugin_transport_http_server.c:2751 |
7392 | #, c-format | 7466 | #, c-format |
7393 | msgid "Found %u addresses to report to NAT service\n" | 7467 | msgid "Found %u addresses to report to NAT service\n" |
7394 | msgstr "" | 7468 | msgstr "" |
7395 | 7469 | ||
7396 | #: src/transport/plugin_transport_http_server.c:2832 | 7470 | #: src/transport/plugin_transport_http_server.c:2837 |
7397 | #: src/transport/plugin_transport_udp.c:3600 | 7471 | #: src/transport/plugin_transport_udp.c:3623 |
7398 | msgid "Disabling IPv6 since it is not supported on this system!\n" | 7472 | msgid "Disabling IPv6 since it is not supported on this system!\n" |
7399 | msgstr "" | 7473 | msgstr "" |
7400 | 7474 | ||
7401 | #: src/transport/plugin_transport_http_server.c:2938 | 7475 | #: src/transport/plugin_transport_http_server.c:2943 |
7402 | #, c-format | 7476 | #, c-format |
7403 | msgid "IPv4 support is %s\n" | 7477 | msgid "IPv4 support is %s\n" |
7404 | msgstr "" | 7478 | msgstr "" |
7405 | 7479 | ||
7406 | #: src/transport/plugin_transport_http_server.c:2953 | 7480 | #: src/transport/plugin_transport_http_server.c:2958 |
7407 | #, c-format | 7481 | #, c-format |
7408 | msgid "IPv6 support is %s\n" | 7482 | msgid "IPv6 support is %s\n" |
7409 | msgstr "" | 7483 | msgstr "" |
7410 | 7484 | ||
7411 | #: src/transport/plugin_transport_http_server.c:2959 | 7485 | #: src/transport/plugin_transport_http_server.c:2964 |
7412 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" | 7486 | msgid "Neither IPv4 nor IPv6 are enabled! Fix in configuration\n" |
7413 | msgstr "" | 7487 | msgstr "" |
7414 | 7488 | ||
7415 | #: src/transport/plugin_transport_http_server.c:2970 | 7489 | #: src/transport/plugin_transport_http_server.c:2975 |
7416 | #, fuzzy | 7490 | #, fuzzy |
7417 | msgid "Port is required! Fix in configuration\n" | 7491 | msgid "Port is required! Fix in configuration\n" |
7418 | msgstr "" | 7492 | msgstr "" |
7419 | "\n" | 7493 | "\n" |
7420 | "结æŸé…置。\n" | 7494 | "结æŸé…置。\n" |
7421 | 7495 | ||
7422 | #: src/transport/plugin_transport_http_server.c:2976 | 7496 | #: src/transport/plugin_transport_http_server.c:2981 |
7423 | #, c-format | 7497 | #, c-format |
7424 | msgid "Using port %u\n" | 7498 | msgid "Using port %u\n" |
7425 | msgstr "" | 7499 | msgstr "" |
7426 | 7500 | ||
7427 | #: src/transport/plugin_transport_http_server.c:2995 | 7501 | #: src/transport/plugin_transport_http_server.c:3000 |
7428 | #, c-format | 7502 | #, c-format |
7429 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" | 7503 | msgid "Specific IPv4 address `%s' in configuration file is invalid!\n" |
7430 | msgstr "" | 7504 | msgstr "" |
7431 | 7505 | ||
7432 | #: src/transport/plugin_transport_http_server.c:3030 | 7506 | #: src/transport/plugin_transport_http_server.c:3035 |
7433 | #, c-format | 7507 | #, c-format |
7434 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" | 7508 | msgid "Specific IPv6 address `%s' in configuration file is invalid!\n" |
7435 | msgstr "" | 7509 | msgstr "" |
7436 | 7510 | ||
7437 | #: src/transport/plugin_transport_http_server.c:3105 | 7511 | #: src/transport/plugin_transport_http_server.c:3110 |
7438 | #, fuzzy, c-format | 7512 | #, fuzzy, c-format |
7439 | msgid "Using external hostname `%s'\n" | 7513 | msgid "Using external hostname `%s'\n" |
7440 | msgstr "å¸è½½ GNUnet æœåŠ¡" | 7514 | msgstr "å¸è½½ GNUnet æœåŠ¡" |
7441 | 7515 | ||
7442 | #: src/transport/plugin_transport_http_server.c:3126 | 7516 | #: src/transport/plugin_transport_http_server.c:3131 |
7443 | #, c-format | 7517 | #, c-format |
7444 | msgid "Notifying transport only about hostname `%s'\n" | 7518 | msgid "Notifying transport only about hostname `%s'\n" |
7445 | msgstr "" | 7519 | msgstr "" |
7446 | 7520 | ||
7447 | #: src/transport/plugin_transport_http_server.c:3143 | 7521 | #: src/transport/plugin_transport_http_server.c:3148 |
7448 | #, fuzzy, c-format | 7522 | #, fuzzy, c-format |
7449 | msgid "Maximum number of connections is %u\n" | 7523 | msgid "Maximum number of connections is %u\n" |
7450 | msgstr "å¢žåŠ TCP/IP 的最大连接数" | 7524 | msgstr "å¢žåŠ TCP/IP 的最大连接数" |
7451 | 7525 | ||
7452 | #: src/transport/plugin_transport_http_server.c:3469 | 7526 | #: src/transport/plugin_transport_http_server.c:3474 |
7453 | #, fuzzy | 7527 | #, fuzzy |
7454 | msgid "Unable to compile URL regex\n" | 7528 | msgid "Unable to compile URL regex\n" |
7455 | msgstr "æ— æ³•åˆå§‹åŒ– SQLite:%s。\n" | 7529 | msgstr "æ— æ³•åˆå§‹åŒ– SQLite:%s。\n" |
@@ -7496,164 +7570,164 @@ msgstr "" | |||
7496 | msgid "# bytes dropped by SMTP (outgoing)" | 7570 | msgid "# bytes dropped by SMTP (outgoing)" |
7497 | msgstr "" | 7571 | msgstr "" |
7498 | 7572 | ||
7499 | #: src/transport/plugin_transport_tcp.c:1051 | 7573 | #: src/transport/plugin_transport_tcp.c:1060 |
7500 | #: src/transport/plugin_transport_tcp.c:2362 | 7574 | #: src/transport/plugin_transport_tcp.c:2379 |
7501 | #, c-format | 7575 | #, c-format |
7502 | msgid "Unexpected address length: %u bytes\n" | 7576 | msgid "Unexpected address length: %u bytes\n" |
7503 | msgstr "" | 7577 | msgstr "" |
7504 | 7578 | ||
7505 | #: src/transport/plugin_transport_tcp.c:1234 | 7579 | #: src/transport/plugin_transport_tcp.c:1243 |
7506 | #: src/transport/plugin_transport_tcp.c:1458 | 7580 | #: src/transport/plugin_transport_tcp.c:1467 |
7507 | #: src/transport/plugin_transport_tcp.c:2633 | 7581 | #: src/transport/plugin_transport_tcp.c:2643 |
7508 | #: src/transport/plugin_transport_tcp.c:3490 | 7582 | #: src/transport/plugin_transport_tcp.c:3498 |
7509 | msgid "# TCP sessions active" | 7583 | msgid "# TCP sessions active" |
7510 | msgstr "" | 7584 | msgstr "" |
7511 | 7585 | ||
7512 | #: src/transport/plugin_transport_tcp.c:1276 | 7586 | #: src/transport/plugin_transport_tcp.c:1285 |
7513 | #: src/transport/plugin_transport_tcp.c:1440 | 7587 | #: src/transport/plugin_transport_tcp.c:1449 |
7514 | #: src/transport/plugin_transport_tcp.c:1564 | 7588 | #: src/transport/plugin_transport_tcp.c:1573 |
7515 | #: src/transport/plugin_transport_tcp.c:1637 | 7589 | #: src/transport/plugin_transport_tcp.c:1646 |
7516 | #: src/transport/plugin_transport_tcp.c:1737 | 7590 | #: src/transport/plugin_transport_tcp.c:1746 |
7517 | #: src/transport/plugin_transport_tcp.c:1762 | 7591 | #: src/transport/plugin_transport_tcp.c:1771 |
7518 | msgid "# bytes currently in TCP buffers" | 7592 | msgid "# bytes currently in TCP buffers" |
7519 | msgstr "" | 7593 | msgstr "" |
7520 | 7594 | ||
7521 | #: src/transport/plugin_transport_tcp.c:1279 | 7595 | #: src/transport/plugin_transport_tcp.c:1288 |
7522 | msgid "# bytes discarded by TCP (disconnect)" | 7596 | msgid "# bytes discarded by TCP (disconnect)" |
7523 | msgstr "" | 7597 | msgstr "" |
7524 | 7598 | ||
7525 | #: src/transport/plugin_transport_tcp.c:1567 | 7599 | #: src/transport/plugin_transport_tcp.c:1576 |
7526 | msgid "# bytes discarded by TCP (timeout)" | 7600 | msgid "# bytes discarded by TCP (timeout)" |
7527 | msgstr "" | 7601 | msgstr "" |
7528 | 7602 | ||
7529 | #: src/transport/plugin_transport_tcp.c:1641 | 7603 | #: src/transport/plugin_transport_tcp.c:1650 |
7530 | msgid "# bytes transmitted via TCP" | 7604 | msgid "# bytes transmitted via TCP" |
7531 | msgstr "" | 7605 | msgstr "" |
7532 | 7606 | ||
7533 | #: src/transport/plugin_transport_tcp.c:2032 | 7607 | #: src/transport/plugin_transport_tcp.c:2041 |
7534 | msgid "# requests to create session with invalid address" | 7608 | msgid "# requests to create session with invalid address" |
7535 | msgstr "" | 7609 | msgstr "" |
7536 | 7610 | ||
7537 | #: src/transport/plugin_transport_tcp.c:2200 | 7611 | #: src/transport/plugin_transport_tcp.c:2217 |
7538 | msgid "# transport-service disconnect requests for TCP" | 7612 | msgid "# transport-service disconnect requests for TCP" |
7539 | msgstr "" | 7613 | msgstr "" |
7540 | 7614 | ||
7541 | #: src/transport/plugin_transport_tcp.c:2692 | 7615 | #: src/transport/plugin_transport_tcp.c:2702 |
7542 | msgid "# TCP WELCOME messages received" | 7616 | msgid "# TCP WELCOME messages received" |
7543 | msgstr "" | 7617 | msgstr "" |
7544 | 7618 | ||
7545 | #: src/transport/plugin_transport_tcp.c:2883 | 7619 | #: src/transport/plugin_transport_tcp.c:2893 |
7546 | msgid "# bytes received via TCP" | 7620 | msgid "# bytes received via TCP" |
7547 | msgstr "" | 7621 | msgstr "" |
7548 | 7622 | ||
7549 | #: src/transport/plugin_transport_tcp.c:2934 | 7623 | #: src/transport/plugin_transport_tcp.c:2944 |
7550 | #: src/transport/plugin_transport_tcp.c:2992 | 7624 | #: src/transport/plugin_transport_tcp.c:3002 |
7551 | #, fuzzy | 7625 | #, fuzzy |
7552 | msgid "# TCP server connections active" | 7626 | msgid "# TCP server connections active" |
7553 | msgstr "" | 7627 | msgstr "" |
7554 | "\n" | 7628 | "\n" |
7555 | "按任æ„键继ç»\n" | 7629 | "按任æ„键继ç»\n" |
7556 | 7630 | ||
7557 | #: src/transport/plugin_transport_tcp.c:2938 | 7631 | #: src/transport/plugin_transport_tcp.c:2948 |
7558 | #, fuzzy | 7632 | #, fuzzy |
7559 | msgid "# TCP server connect events" | 7633 | msgid "# TCP server connect events" |
7560 | msgstr "" | 7634 | msgstr "" |
7561 | "\n" | 7635 | "\n" |
7562 | "按任æ„键继ç»\n" | 7636 | "按任æ„键继ç»\n" |
7563 | 7637 | ||
7564 | #: src/transport/plugin_transport_tcp.c:2944 | 7638 | #: src/transport/plugin_transport_tcp.c:2954 |
7565 | msgid "TCP connection limit reached, suspending server\n" | 7639 | msgid "TCP connection limit reached, suspending server\n" |
7566 | msgstr "" | 7640 | msgstr "" |
7567 | 7641 | ||
7568 | #: src/transport/plugin_transport_tcp.c:2946 | 7642 | #: src/transport/plugin_transport_tcp.c:2956 |
7569 | msgid "# TCP service suspended" | 7643 | msgid "# TCP service suspended" |
7570 | msgstr "" | 7644 | msgstr "" |
7571 | 7645 | ||
7572 | #: src/transport/plugin_transport_tcp.c:2986 | 7646 | #: src/transport/plugin_transport_tcp.c:2996 |
7573 | msgid "# TCP service resumed" | 7647 | msgid "# TCP service resumed" |
7574 | msgstr "" | 7648 | msgstr "" |
7575 | 7649 | ||
7576 | #: src/transport/plugin_transport_tcp.c:2996 | 7650 | #: src/transport/plugin_transport_tcp.c:3006 |
7577 | msgid "# network-level TCP disconnect events" | 7651 | msgid "# network-level TCP disconnect events" |
7578 | msgstr "" | 7652 | msgstr "" |
7579 | 7653 | ||
7580 | #: src/transport/plugin_transport_tcp.c:3315 | 7654 | #: src/transport/plugin_transport_tcp.c:3325 |
7581 | #, fuzzy | 7655 | #, fuzzy |
7582 | msgid "Failed to start service.\n" | 7656 | msgid "Failed to start service.\n" |
7583 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 7657 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
7584 | 7658 | ||
7585 | #: src/transport/plugin_transport_tcp.c:3478 | 7659 | #: src/transport/plugin_transport_tcp.c:3486 |
7586 | #, c-format | 7660 | #, c-format |
7587 | msgid "TCP transport listening on port %llu\n" | 7661 | msgid "TCP transport listening on port %llu\n" |
7588 | msgstr "" | 7662 | msgstr "" |
7589 | 7663 | ||
7590 | #: src/transport/plugin_transport_tcp.c:3482 | 7664 | #: src/transport/plugin_transport_tcp.c:3490 |
7591 | msgid "TCP transport not listening on any port (client only)\n" | 7665 | msgid "TCP transport not listening on any port (client only)\n" |
7592 | msgstr "" | 7666 | msgstr "" |
7593 | 7667 | ||
7594 | #: src/transport/plugin_transport_tcp.c:3486 | 7668 | #: src/transport/plugin_transport_tcp.c:3494 |
7595 | #, c-format | 7669 | #, c-format |
7596 | msgid "TCP transport advertises itself as being on port %llu\n" | 7670 | msgid "TCP transport advertises itself as being on port %llu\n" |
7597 | msgstr "" | 7671 | msgstr "" |
7598 | 7672 | ||
7599 | #: src/transport/plugin_transport_udp_broadcasting.c:170 | 7673 | #: src/transport/plugin_transport_udp_broadcasting.c:169 |
7600 | msgid "# Multicast HELLO beacons received via UDP" | 7674 | msgid "# Multicast HELLO beacons received via UDP" |
7601 | msgstr "" | 7675 | msgstr "" |
7602 | 7676 | ||
7603 | #: src/transport/plugin_transport_udp_broadcasting.c:546 | 7677 | #: src/transport/plugin_transport_udp_broadcasting.c:545 |
7604 | msgid "" | 7678 | msgid "" |
7605 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" | 7679 | "Disabling HELLO broadcasting due to friend-to-friend only configuration!\n" |
7606 | msgstr "" | 7680 | msgstr "" |
7607 | 7681 | ||
7608 | #: src/transport/plugin_transport_udp_broadcasting.c:567 | 7682 | #: src/transport/plugin_transport_udp_broadcasting.c:566 |
7609 | #, c-format | 7683 | #, c-format |
7610 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" | 7684 | msgid "Failed to set IPv4 broadcast option for broadcast socket on port %d\n" |
7611 | msgstr "" | 7685 | msgstr "" |
7612 | 7686 | ||
7613 | #: src/transport/plugin_transport_udp.c:3344 | 7687 | #: src/transport/plugin_transport_udp.c:3367 |
7614 | #, c-format | 7688 | #, c-format |
7615 | msgid "" | 7689 | msgid "" |
7616 | "UDP could not transmit message to `%s': Network seems down, please check " | 7690 | "UDP could not transmit message to `%s': Network seems down, please check " |
7617 | "your network configuration\n" | 7691 | "your network configuration\n" |
7618 | msgstr "" | 7692 | msgstr "" |
7619 | 7693 | ||
7620 | #: src/transport/plugin_transport_udp.c:3358 | 7694 | #: src/transport/plugin_transport_udp.c:3381 |
7621 | msgid "" | 7695 | msgid "" |
7622 | "UDP could not transmit IPv6 message! Please check your network configuration " | 7696 | "UDP could not transmit IPv6 message! Please check your network configuration " |
7623 | "and disable IPv6 if your connection does not have a global IPv6 address\n" | 7697 | "and disable IPv6 if your connection does not have a global IPv6 address\n" |
7624 | msgstr "" | 7698 | msgstr "" |
7625 | 7699 | ||
7626 | #: src/transport/plugin_transport_udp.c:3676 | 7700 | #: src/transport/plugin_transport_udp.c:3699 |
7627 | #: src/transport/plugin_transport_udp.c:3775 | 7701 | #: src/transport/plugin_transport_udp.c:3798 |
7628 | #, fuzzy, c-format | 7702 | #, fuzzy, c-format |
7629 | msgid "Failed to bind UDP socket to %s: %s\n" | 7703 | msgid "Failed to bind UDP socket to %s: %s\n" |
7630 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" | 7704 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" |
7631 | 7705 | ||
7632 | #: src/transport/plugin_transport_udp.c:3694 | 7706 | #: src/transport/plugin_transport_udp.c:3717 |
7633 | msgid "Disabling IPv4 since it is not supported on this system!\n" | 7707 | msgid "Disabling IPv4 since it is not supported on this system!\n" |
7634 | msgstr "" | 7708 | msgstr "" |
7635 | 7709 | ||
7636 | #: src/transport/plugin_transport_udp.c:3785 | 7710 | #: src/transport/plugin_transport_udp.c:3808 |
7637 | #, fuzzy | 7711 | #, fuzzy |
7638 | msgid "Failed to open UDP sockets\n" | 7712 | msgid "Failed to open UDP sockets\n" |
7639 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" | 7713 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" |
7640 | 7714 | ||
7641 | #: src/transport/plugin_transport_udp.c:3857 | 7715 | #: src/transport/plugin_transport_udp.c:3879 |
7642 | #: src/transport/plugin_transport_udp.c:3871 | 7716 | #: src/transport/plugin_transport_udp.c:3893 |
7643 | msgid "must be in [0,65535]" | 7717 | msgid "must be in [0,65535]" |
7644 | msgstr "" | 7718 | msgstr "" |
7645 | 7719 | ||
7646 | #: src/transport/plugin_transport_udp.c:3903 | 7720 | #: src/transport/plugin_transport_udp.c:3925 |
7647 | #, fuzzy | 7721 | #, fuzzy |
7648 | msgid "must be valid IPv4 address" | 7722 | msgid "must be valid IPv4 address" |
7649 | msgstr "“%sâ€ä¸å¯ç”¨ã€‚\n" | 7723 | msgstr "“%sâ€ä¸å¯ç”¨ã€‚\n" |
7650 | 7724 | ||
7651 | #: src/transport/plugin_transport_udp.c:3930 | 7725 | #: src/transport/plugin_transport_udp.c:3952 |
7652 | #, fuzzy | 7726 | #, fuzzy |
7653 | msgid "must be valid IPv6 address" | 7727 | msgid "must be valid IPv6 address" |
7654 | msgstr "“%sâ€ä¸å¯ç”¨ã€‚\n" | 7728 | msgstr "“%sâ€ä¸å¯ç”¨ã€‚\n" |
7655 | 7729 | ||
7656 | #: src/transport/plugin_transport_udp.c:3996 | 7730 | #: src/transport/plugin_transport_udp.c:4018 |
7657 | #, fuzzy | 7731 | #, fuzzy |
7658 | msgid "Failed to create UDP network sockets\n" | 7732 | msgid "Failed to create UDP network sockets\n" |
7659 | msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n" | 7733 | msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n" |
@@ -7764,7 +7838,7 @@ msgstr "" | |||
7764 | msgid "Metadata `%s' failed to deserialize" | 7838 | msgid "Metadata `%s' failed to deserialize" |
7765 | msgstr "" | 7839 | msgstr "" |
7766 | 7840 | ||
7767 | #: src/util/client_new.c:864 | 7841 | #: src/util/client.c:864 |
7768 | #, c-format | 7842 | #, c-format |
7769 | msgid "Need a non-empty hostname for service `%s'.\n" | 7843 | msgid "Need a non-empty hostname for service `%s'.\n" |
7770 | msgstr "" | 7844 | msgstr "" |
@@ -8532,42 +8606,42 @@ msgstr "" | |||
8532 | msgid "Invalid IPv6 address `%s': %s\n" | 8606 | msgid "Invalid IPv6 address `%s': %s\n" |
8533 | msgstr "æ— æ•ˆçš„è¿›ç¨‹ä¼˜å…ˆçº§â€œ%sâ€\n" | 8607 | msgstr "æ— æ•ˆçš„è¿›ç¨‹ä¼˜å…ˆçº§â€œ%sâ€\n" |
8534 | 8608 | ||
8535 | #: src/util/strings.c:1475 src/util/strings.c:1491 | 8609 | #: src/util/strings.c:1541 src/util/strings.c:1557 |
8536 | msgid "Port not in range\n" | 8610 | msgid "Port not in range\n" |
8537 | msgstr "" | 8611 | msgstr "" |
8538 | 8612 | ||
8539 | #: src/util/strings.c:1500 | 8613 | #: src/util/strings.c:1566 |
8540 | #, fuzzy, c-format | 8614 | #, fuzzy, c-format |
8541 | msgid "Malformed port policy `%s'\n" | 8615 | msgid "Malformed port policy `%s'\n" |
8542 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 8616 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
8543 | 8617 | ||
8544 | #: src/util/strings.c:1583 src/util/strings.c:1614 src/util/strings.c:1662 | 8618 | #: src/util/strings.c:1649 src/util/strings.c:1680 src/util/strings.c:1728 |
8545 | #: src/util/strings.c:1683 | 8619 | #: src/util/strings.c:1749 |
8546 | #, c-format | 8620 | #, c-format |
8547 | msgid "Invalid format for IP: `%s'\n" | 8621 | msgid "Invalid format for IP: `%s'\n" |
8548 | msgstr "IP æ ¼å¼æ— 效:“%sâ€\n" | 8622 | msgstr "IP æ ¼å¼æ— 效:“%sâ€\n" |
8549 | 8623 | ||
8550 | #: src/util/strings.c:1640 | 8624 | #: src/util/strings.c:1706 |
8551 | #, c-format | 8625 | #, c-format |
8552 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." | 8626 | msgid "Invalid network notation ('/%d' is not legal in IPv4 CIDR)." |
8553 | msgstr "ç½‘ç»œè¡¨ç¤ºæ³•æ— æ•ˆ(“/%d†在 IPv4 CIDR ä¸æ˜¯éžæ³•çš„)。" | 8627 | msgstr "ç½‘ç»œè¡¨ç¤ºæ³•æ— æ•ˆ(“/%d†在 IPv4 CIDR ä¸æ˜¯éžæ³•çš„)。" |
8554 | 8628 | ||
8555 | #: src/util/strings.c:1692 | 8629 | #: src/util/strings.c:1758 |
8556 | #, fuzzy, c-format | 8630 | #, fuzzy, c-format |
8557 | msgid "Invalid format: `%s'\n" | 8631 | msgid "Invalid format: `%s'\n" |
8558 | msgstr "IP æ ¼å¼æ— 效:“%sâ€\n" | 8632 | msgstr "IP æ ¼å¼æ— 效:“%sâ€\n" |
8559 | 8633 | ||
8560 | #: src/util/strings.c:1744 | 8634 | #: src/util/strings.c:1810 |
8561 | #, c-format | 8635 | #, c-format |
8562 | msgid "Invalid network notation (does not end with ';': `%s')\n" | 8636 | msgid "Invalid network notation (does not end with ';': `%s')\n" |
8563 | msgstr "æ— æ•ˆçš„ç½‘ç»œè¡¨ç¤ºæ³•(没有以“;â€ç»“尾:“%sâ€)\n" | 8637 | msgstr "æ— æ•ˆçš„ç½‘ç»œè¡¨ç¤ºæ³•(没有以“;â€ç»“尾:“%sâ€)\n" |
8564 | 8638 | ||
8565 | #: src/util/strings.c:1794 | 8639 | #: src/util/strings.c:1860 |
8566 | #, c-format | 8640 | #, c-format |
8567 | msgid "Wrong format `%s' for netmask\n" | 8641 | msgid "Wrong format `%s' for netmask\n" |
8568 | msgstr "网络掩ç çš„æ ¼å¼â€œ%sâ€é”™è¯¯\n" | 8642 | msgstr "网络掩ç çš„æ ¼å¼â€œ%sâ€é”™è¯¯\n" |
8569 | 8643 | ||
8570 | #: src/util/strings.c:1825 | 8644 | #: src/util/strings.c:1891 |
8571 | #, c-format | 8645 | #, c-format |
8572 | msgid "Wrong format `%s' for network\n" | 8646 | msgid "Wrong format `%s' for network\n" |
8573 | msgstr "ç½‘ç»œçš„æ ¼å¼â€œ%sâ€é”™è¯¯\n" | 8647 | msgstr "ç½‘ç»œçš„æ ¼å¼â€œ%sâ€é”™è¯¯\n" |
@@ -8747,22 +8821,30 @@ msgid "Setup tunnels via VPN." | |||
8747 | msgstr "" | 8821 | msgstr "" |
8748 | 8822 | ||
8749 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 | 8823 | #: src/include/gnunet_common.h:645 src/include/gnunet_common.h:652 |
8750 | #: src/include/gnunet_common.h:660 | 8824 | #: src/include/gnunet_common.h:662 src/include/gnunet_common.h:670 |
8751 | #, c-format | 8825 | #, c-format |
8752 | msgid "Assertion failed at %s:%d.\n" | 8826 | msgid "Assertion failed at %s:%d.\n" |
8753 | msgstr "" | 8827 | msgstr "" |
8754 | 8828 | ||
8755 | #: src/include/gnunet_common.h:672 | 8829 | #: src/include/gnunet_common.h:682 |
8756 | #, c-format | 8830 | #, c-format |
8757 | msgid "External protocol violation detected at %s:%d.\n" | 8831 | msgid "External protocol violation detected at %s:%d.\n" |
8758 | msgstr "" | 8832 | msgstr "" |
8759 | 8833 | ||
8760 | #: src/include/gnunet_common.h:699 src/include/gnunet_common.h:708 | 8834 | #: src/include/gnunet_common.h:709 src/include/gnunet_common.h:718 |
8761 | #, c-format | 8835 | #, c-format |
8762 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" | 8836 | msgid "`%s' failed on file `%s' at %s:%d with error: %s\n" |
8763 | msgstr "" | 8837 | msgstr "" |
8764 | 8838 | ||
8765 | #, fuzzy | 8839 | #, fuzzy |
8840 | #~ msgid "Failed to run upnp client for port %u\n" | ||
8841 | #~ msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | ||
8842 | |||
8843 | #, fuzzy | ||
8844 | #~ msgid "Failed to start resolver!\n" | ||
8845 | #~ msgstr "è¿è¡Œ %s失败:%s %d\n" | ||
8846 | |||
8847 | #, fuzzy | ||
8766 | #~ msgid "Unable to initialize Postgres: %s\n" | 8848 | #~ msgid "Unable to initialize Postgres: %s\n" |
8767 | #~ msgstr "æ— æ³•åˆå§‹åŒ– SQLite:%s。\n" | 8849 | #~ msgstr "æ— æ³•åˆå§‹åŒ– SQLite:%s。\n" |
8768 | 8850 | ||
@@ -9584,10 +9666,6 @@ msgstr "" | |||
9584 | #~ msgstr "å¸è½½ GNUnet æœåŠ¡" | 9666 | #~ msgstr "å¸è½½ GNUnet æœåŠ¡" |
9585 | 9667 | ||
9586 | #, fuzzy | 9668 | #, fuzzy |
9587 | #~ msgid "Failed to write new configuration to disk." | ||
9588 | #~ msgstr "ä¿å˜é…置失败。" | ||
9589 | |||
9590 | #, fuzzy | ||
9591 | #~ msgid "Failed to copy new configuration to remote machine." | 9669 | #~ msgid "Failed to copy new configuration to remote machine." |
9592 | #~ msgstr "ä¿å˜é…置失败。" | 9670 | #~ msgstr "ä¿å˜é…置失败。" |
9593 | 9671 | ||
@@ -9835,9 +9913,6 @@ msgstr "" | |||
9835 | #~ "é‡ã€‚如果您的网速很平稳,您å¯ä»¥å°†è¯¥é™åˆ¶è®¾ç½®ä¸ºç½‘速的最大值。您ä¸åº”该使用超过" | 9913 | #~ "é‡ã€‚如果您的网速很平稳,您å¯ä»¥å°†è¯¥é™åˆ¶è®¾ç½®ä¸ºç½‘速的最大值。您ä¸åº”该使用超过" |
9836 | #~ "实际连接速度æžé™çš„值。" | 9914 | #~ "实际连接速度æžé™çš„值。" |
9837 | 9915 | ||
9838 | #~ msgid "Quota configuration" | ||
9839 | #~ msgstr "é…é¢é…ç½®" | ||
9840 | |||
9841 | #~ msgid "What is the maximum size of the datastore in MB?" | 9916 | #~ msgid "What is the maximum size of the datastore in MB?" |
9842 | #~ msgstr "æ•°æ®ä»“库的最大尺寸是多少(MB)?" | 9917 | #~ msgstr "æ•°æ®ä»“库的最大尺寸是多少(MB)?" |
9843 | 9918 | ||
@@ -9912,9 +9987,6 @@ msgstr "" | |||
9912 | #~ msgid "Save configuration?" | 9987 | #~ msgid "Save configuration?" |
9913 | #~ msgstr "ä¿å˜é…置?" | 9988 | #~ msgstr "ä¿å˜é…置?" |
9914 | 9989 | ||
9915 | #~ msgid "GNUnet Configuration" | ||
9916 | #~ msgstr "GNUnet é…ç½®" | ||
9917 | |||
9918 | #~ msgid "Back" | 9990 | #~ msgid "Back" |
9919 | #~ msgstr "åŽé€€" | 9991 | #~ msgstr "åŽé€€" |
9920 | 9992 | ||
@@ -9939,13 +10011,6 @@ msgstr "" | |||
9939 | #~ msgid "Do you wish to save your new configuration?" | 10011 | #~ msgid "Do you wish to save your new configuration?" |
9940 | #~ msgstr "您想ä¿å˜æ–°é…ç½®å—?" | 10012 | #~ msgstr "您想ä¿å˜æ–°é…ç½®å—?" |
9941 | 10013 | ||
9942 | #~ msgid "" | ||
9943 | #~ "\n" | ||
9944 | #~ "Your configuration changes were NOT saved.\n" | ||
9945 | #~ msgstr "" | ||
9946 | #~ "\n" | ||
9947 | #~ "您的é…置更改没有ä¿å˜ã€‚\n" | ||
9948 | |||
9949 | #~ msgid "install GNUnet as Windows service" | 10014 | #~ msgid "install GNUnet as Windows service" |
9950 | #~ msgstr "以 Windows æœåŠ¡æ–¹å¼å®‰è£… GNUnet" | 10015 | #~ msgstr "以 Windows æœåŠ¡æ–¹å¼å®‰è£… GNUnet" |
9951 | 10016 | ||
diff --git a/src/Makefile.am b/src/Makefile.am index 2877cab0b..120d80a3f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -8,6 +8,7 @@ if HAVE_TESTING | |||
8 | TESTBED = testbed-logger testbed | 8 | TESTBED = testbed-logger testbed |
9 | CONSENSUS = consensus | 9 | CONSENSUS = consensus |
10 | SECRETSHARING = secretsharing | 10 | SECRETSHARING = secretsharing |
11 | ATS_TESTS = ats-tests | ||
11 | endif | 12 | endif |
12 | 13 | ||
13 | if HAVE_EXPERIMENTAL | 14 | if HAVE_EXPERIMENTAL |
@@ -59,6 +60,10 @@ if HAVE_JSON | |||
59 | endif | 60 | endif |
60 | endif | 61 | endif |
61 | 62 | ||
63 | if HAVE_JSON | ||
64 | AUCTION_DIR = auction | ||
65 | endif | ||
66 | |||
62 | if TALER_ONLY | 67 | if TALER_ONLY |
63 | SUBDIRS = \ | 68 | SUBDIRS = \ |
64 | include \ | 69 | include \ |
@@ -85,13 +90,14 @@ SUBDIRS = \ | |||
85 | template \ | 90 | template \ |
86 | ats \ | 91 | ats \ |
87 | nat \ | 92 | nat \ |
93 | nat-auto \ | ||
88 | fragmentation \ | 94 | fragmentation \ |
89 | transport \ | 95 | transport \ |
90 | ats-tool \ | 96 | ats-tool \ |
91 | peerinfo-tool \ | 97 | peerinfo-tool \ |
92 | core \ | 98 | core \ |
93 | $(TESTBED) \ | 99 | $(TESTBED) \ |
94 | ats-tests \ | 100 | $(ATS_TESTS) \ |
95 | nse \ | 101 | nse \ |
96 | dht \ | 102 | dht \ |
97 | hostlist \ | 103 | hostlist \ |
@@ -110,6 +116,7 @@ SUBDIRS = \ | |||
110 | vpn \ | 116 | vpn \ |
111 | gns \ | 117 | gns \ |
112 | credential \ | 118 | credential \ |
119 | zonemaster \ | ||
113 | $(CONVERSATION_DIR) \ | 120 | $(CONVERSATION_DIR) \ |
114 | fs \ | 121 | fs \ |
115 | exit \ | 122 | exit \ |
@@ -120,6 +127,7 @@ SUBDIRS = \ | |||
120 | psycstore \ | 127 | psycstore \ |
121 | psyc \ | 128 | psyc \ |
122 | social \ | 129 | social \ |
130 | $(AUCTION_DIR) \ | ||
123 | $(EXP_DIR) \ | 131 | $(EXP_DIR) \ |
124 | $(PROVIDER_DIR) | 132 | $(PROVIDER_DIR) |
125 | 133 | ||
diff --git a/src/arm/.gitignore b/src/arm/.gitignore index 0ea685353..859c6e393 100644 --- a/src/arm/.gitignore +++ b/src/arm/.gitignore | |||
@@ -1,3 +1,7 @@ | |||
1 | mockup-service | 1 | mockup-service |
2 | gnunet-arm | 2 | gnunet-arm |
3 | gnunet-service-arm | 3 | gnunet-service-arm |
4 | test_arm_api | ||
5 | test_exponential_backoff | ||
6 | test_gnunet_arm.py | ||
7 | test_gnunet_service_arm | ||
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 2967e62b7..a61343833 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c | |||
@@ -474,7 +474,7 @@ reconnect_arm (struct GNUNET_ARM_Handle *h) | |||
474 | if (NULL != h->mq) | 474 | if (NULL != h->mq) |
475 | return GNUNET_OK; | 475 | return GNUNET_OK; |
476 | GNUNET_assert (GNUNET_NO == h->currently_up); | 476 | GNUNET_assert (GNUNET_NO == h->currently_up); |
477 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 477 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
478 | "arm", | 478 | "arm", |
479 | handlers, | 479 | handlers, |
480 | &mq_error_handler, | 480 | &mq_error_handler, |
diff --git a/src/arm/arm_monitor_api.c b/src/arm/arm_monitor_api.c index 471393c7e..b4dc6cb6a 100644 --- a/src/arm/arm_monitor_api.c +++ b/src/arm/arm_monitor_api.c | |||
@@ -209,7 +209,7 @@ reconnect_arm_monitor (struct GNUNET_ARM_MonitorHandle *h) | |||
209 | struct GNUNET_MQ_Envelope *env; | 209 | struct GNUNET_MQ_Envelope *env; |
210 | 210 | ||
211 | GNUNET_assert (NULL == h->mq); | 211 | GNUNET_assert (NULL == h->mq); |
212 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 212 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
213 | "arm", | 213 | "arm", |
214 | handlers, | 214 | handlers, |
215 | &mq_error_handler, | 215 | &mq_error_handler, |
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index 3b024ea93..b6f4d99a8 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -110,11 +110,15 @@ static unsigned int phase; | |||
110 | 110 | ||
111 | /** | 111 | /** |
112 | * User defined timestamp for completing operations. | 112 | * User defined timestamp for completing operations. |
113 | * FIXME: to be implemented! | ||
114 | */ | 113 | */ |
115 | static struct GNUNET_TIME_Relative timeout; | 114 | static struct GNUNET_TIME_Relative timeout; |
116 | 115 | ||
117 | /** | 116 | /** |
117 | * Task to be run on timeout. | ||
118 | */ | ||
119 | static struct GNUNET_SCHEDULER_Task *timeout_task; | ||
120 | |||
121 | /** | ||
118 | * Do we want to give our stdout to gnunet-service-arm? | 122 | * Do we want to give our stdout to gnunet-service-arm? |
119 | */ | 123 | */ |
120 | static unsigned int no_stdout; | 124 | static unsigned int no_stdout; |
@@ -191,6 +195,11 @@ shutdown_task (void *cls) | |||
191 | GNUNET_ARM_monitor_stop (m); | 195 | GNUNET_ARM_monitor_stop (m); |
192 | m = NULL; | 196 | m = NULL; |
193 | } | 197 | } |
198 | if (NULL != timeout_task) | ||
199 | { | ||
200 | GNUNET_SCHEDULER_cancel (timeout_task); | ||
201 | timeout_task = NULL; | ||
202 | } | ||
194 | if ((GNUNET_YES == end) && (GNUNET_YES == delete)) | 203 | if ((GNUNET_YES == end) && (GNUNET_YES == delete)) |
195 | delete_files (); | 204 | delete_files (); |
196 | GNUNET_CONFIGURATION_destroy (cfg); | 205 | GNUNET_CONFIGURATION_destroy (cfg); |
@@ -683,6 +692,18 @@ srv_status (void *cls, | |||
683 | 692 | ||
684 | 693 | ||
685 | /** | 694 | /** |
695 | * Task run on timeout (if -T is given). | ||
696 | */ | ||
697 | static void | ||
698 | timeout_task_cb (void *cls) | ||
699 | { | ||
700 | timeout_task = NULL; | ||
701 | ret = 2; | ||
702 | GNUNET_SCHEDULER_shutdown (); | ||
703 | } | ||
704 | |||
705 | |||
706 | /** | ||
686 | * Main function that will be run by the scheduler. | 707 | * Main function that will be run by the scheduler. |
687 | * | 708 | * |
688 | * @param cls closure | 709 | * @param cls closure |
@@ -739,6 +760,10 @@ run (void *cls, | |||
739 | NULL); | 760 | NULL); |
740 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | 761 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
741 | NULL); | 762 | NULL); |
763 | if (0 != timeout.rel_value_us) | ||
764 | timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, | ||
765 | &timeout_task_cb, | ||
766 | NULL); | ||
742 | } | 767 | } |
743 | 768 | ||
744 | 769 | ||
@@ -747,7 +772,7 @@ run (void *cls, | |||
747 | * | 772 | * |
748 | * @param argc number of arguments from the command line | 773 | * @param argc number of arguments from the command line |
749 | * @param argv command line arguments | 774 | * @param argv command line arguments |
750 | * @return 0 ok, 1 on error | 775 | * @return 0 ok, 1 on error, 2 on timeout |
751 | */ | 776 | */ |
752 | int | 777 | int |
753 | main (int argc, char *const *argv) | 778 | main (int argc, char *const *argv) |
@@ -793,10 +818,10 @@ main (int argc, char *const *argv) | |||
793 | gettext_noop | 818 | gettext_noop |
794 | ("Control services and the Automated Restart Manager (ARM)"), | 819 | ("Control services and the Automated Restart Manager (ARM)"), |
795 | options, &run, NULL)) | 820 | options, &run, NULL)) |
796 | { | 821 | { |
797 | GNUNET_free ((void *) argv); | 822 | GNUNET_free ((void *) argv); |
798 | return ret; | 823 | return ret; |
799 | } | 824 | } |
800 | GNUNET_free ((void*) argv); | 825 | GNUNET_free ((void*) argv); |
801 | return 1; | 826 | return 1; |
802 | } | 827 | } |
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c index ab47ff635..0905f145d 100644 --- a/src/arm/test_exponential_backoff.c +++ b/src/arm/test_exponential_backoff.c | |||
@@ -151,7 +151,7 @@ kill_task (void *cbData) | |||
151 | GNUNET_free (shutdown_ctx); | 151 | GNUNET_free (shutdown_ctx); |
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | shutdown_ctx->mq = GNUNET_CLIENT_connecT (cfg, | 154 | shutdown_ctx->mq = GNUNET_CLIENT_connect (cfg, |
155 | SERVICE, | 155 | SERVICE, |
156 | handlers, | 156 | handlers, |
157 | &mq_error_handler, | 157 | &mq_error_handler, |
diff --git a/src/ats-tests/.gitignore b/src/ats-tests/.gitignore index 9e4a44df5..800898bf9 100644 --- a/src/ats-tests/.gitignore +++ b/src/ats-tests/.gitignore | |||
@@ -1,2 +1,8 @@ | |||
1 | gnunet-solver-eval | 1 | gnunet-solver-eval |
2 | gnunet-ats-sim | 2 | gnunet-ats-sim |
3 | perf_ats_proportional_core_bandwidth | ||
4 | perf_ats_proportional_core_latency | ||
5 | perf_ats_proportional_core_none | ||
6 | perf_ats_proportional_transport_bandwidth | ||
7 | perf_ats_proportional_transport_latency | ||
8 | perf_ats_proportional_transport_none | ||
diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c index eb30daa6b..326d3bdd4 100644 --- a/src/ats-tests/ats-testing.c +++ b/src/ats-tests/ats-testing.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2013, 2016 GNUnet e.V. | 3 | Copyright (C) 2010-2013, 2016, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -88,11 +88,6 @@ do_shutdown (void *cls) | |||
88 | 88 | ||
89 | for (c_op = 0; c_op < p->num_partners; c_op++) | 89 | for (c_op = 0; c_op < p->num_partners; c_op++) |
90 | { | 90 | { |
91 | if (NULL != p->partners[c_op].cth) | ||
92 | { | ||
93 | GNUNET_CORE_notify_transmit_ready_cancel (p->partners[c_op].cth); | ||
94 | p->partners[c_op].cth = NULL; | ||
95 | } | ||
96 | if ( (NULL != p->core_connect_ops) && | 91 | if ( (NULL != p->core_connect_ops) && |
97 | (NULL != p->core_connect_ops[c_op].connect_op) ) | 92 | (NULL != p->core_connect_ops[c_op].connect_op) ) |
98 | { | 93 | { |
@@ -128,15 +123,6 @@ do_shutdown (void *cls) | |||
128 | GNUNET_TESTBED_operation_done (p->peer_id_op); | 123 | GNUNET_TESTBED_operation_done (p->peer_id_op); |
129 | p->peer_id_op = NULL; | 124 | p->peer_id_op = NULL; |
130 | } | 125 | } |
131 | |||
132 | for (c_op = 0; c_op < p->num_partners; c_op++) | ||
133 | { | ||
134 | if (NULL != p->partners[c_op].cth) | ||
135 | { | ||
136 | GNUNET_CORE_notify_transmit_ready_cancel (p->partners[c_op].cth); | ||
137 | p->partners[c_op].cth = NULL; | ||
138 | } | ||
139 | } | ||
140 | if (NULL != p->ats_perf_op) | 126 | if (NULL != p->ats_perf_op) |
141 | { | 127 | { |
142 | GNUNET_TESTBED_operation_done (p->ats_perf_op); | 128 | GNUNET_TESTBED_operation_done (p->ats_perf_op); |
@@ -314,11 +300,6 @@ comm_disconnect_cb (void *cls, | |||
314 | "%s disconnected from %s while benchmarking\n", | 300 | "%s disconnected from %s while benchmarking\n", |
315 | id, | 301 | id, |
316 | GNUNET_i2s (peer)); | 302 | GNUNET_i2s (peer)); |
317 | if (NULL != p->cth) | ||
318 | { | ||
319 | GNUNET_CORE_notify_transmit_ready_cancel (p->cth); | ||
320 | p->cth = NULL; | ||
321 | } | ||
322 | } | 303 | } |
323 | GNUNET_free(id); | 304 | GNUNET_free(id); |
324 | } | 305 | } |
@@ -403,7 +384,7 @@ core_connect_adapter (void *cls, | |||
403 | GNUNET_MQ_handler_end () | 384 | GNUNET_MQ_handler_end () |
404 | }; | 385 | }; |
405 | 386 | ||
406 | me->ch = GNUNET_CORE_connecT (cfg, | 387 | me->ch = GNUNET_CORE_connect (cfg, |
407 | me, | 388 | me, |
408 | NULL, | 389 | NULL, |
409 | &comm_connect_cb, | 390 | &comm_connect_cb, |
@@ -422,7 +403,7 @@ core_disconnect_adapter (void *cls, | |||
422 | { | 403 | { |
423 | struct BenchmarkPeer *me = cls; | 404 | struct BenchmarkPeer *me = cls; |
424 | 405 | ||
425 | GNUNET_CORE_disconnecT (me->ch); | 406 | GNUNET_CORE_disconnect (me->ch); |
426 | me->ch = NULL; | 407 | me->ch = NULL; |
427 | } | 408 | } |
428 | 409 | ||
diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h index de189953e..32f0b02d8 100644 --- a/src/ats-tests/ats-testing.h +++ b/src/ats-tests/ats-testing.h | |||
@@ -285,11 +285,6 @@ struct BenchmarkPartner | |||
285 | struct BenchmarkPeer *dest; | 285 | struct BenchmarkPeer *dest; |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * Core transmit handles | ||
289 | */ | ||
290 | struct GNUNET_CORE_TransmitHandle *cth; | ||
291 | |||
292 | /** | ||
293 | * Message queue handle. | 288 | * Message queue handle. |
294 | */ | 289 | */ |
295 | struct GNUNET_MQ_Handle *mq; | 290 | struct GNUNET_MQ_Handle *mq; |
@@ -335,27 +330,27 @@ struct BenchmarkPartner | |||
335 | unsigned int bytes_received; | 330 | unsigned int bytes_received; |
336 | 331 | ||
337 | /** | 332 | /** |
338 | * Current ATS properties | 333 | * Current ATS properties |
339 | */ | 334 | */ |
340 | struct GNUNET_ATS_Properties props; | 335 | struct GNUNET_ATS_Properties props; |
341 | 336 | ||
342 | /** | 337 | /** |
343 | * Bandwidth assigned inbound | 338 | * Bandwidth assigned inbound |
344 | */ | 339 | */ |
345 | uint32_t bandwidth_in; | 340 | uint32_t bandwidth_in; |
346 | 341 | ||
347 | /** | 342 | /** |
348 | * Bandwidth assigned outbound | 343 | * Bandwidth assigned outbound |
349 | */ | 344 | */ |
350 | uint32_t bandwidth_out; | 345 | uint32_t bandwidth_out; |
351 | 346 | ||
352 | /** | 347 | /** |
353 | * Current preference values for bandwidth | 348 | * Current preference values for bandwidth |
354 | */ | 349 | */ |
355 | double pref_bandwidth; | 350 | double pref_bandwidth; |
356 | 351 | ||
357 | /** | 352 | /** |
358 | * Current preference values for delay | 353 | * Current preference values for delay |
359 | */ | 354 | */ |
360 | double pref_delay; | 355 | double pref_delay; |
361 | 356 | ||
diff --git a/src/ats/.gitignore b/src/ats/.gitignore index 7b70f84a5..983dc2843 100644 --- a/src/ats/.gitignore +++ b/src/ats/.gitignore | |||
@@ -1 +1,3 @@ | |||
1 | gnunet-service-ats | 1 | gnunet-service-ats |
2 | test_ats_api_proportional | ||
3 | test_ats_reservation_api_proportional | ||
diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c index 241e5f93c..d551aacd4 100644 --- a/src/ats/ats_api_connectivity.c +++ b/src/ats/ats_api_connectivity.c | |||
@@ -195,7 +195,7 @@ reconnect (struct GNUNET_ATS_ConnectivityHandle *ch) | |||
195 | struct ClientStartMessage *init; | 195 | struct ClientStartMessage *init; |
196 | 196 | ||
197 | GNUNET_assert (NULL == ch->mq); | 197 | GNUNET_assert (NULL == ch->mq); |
198 | ch->mq = GNUNET_CLIENT_connecT (ch->cfg, | 198 | ch->mq = GNUNET_CLIENT_connect (ch->cfg, |
199 | "ats", | 199 | "ats", |
200 | handlers, | 200 | handlers, |
201 | &error_handler, | 201 | &error_handler, |
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index dd8666d4c..cd67583d1 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c | |||
@@ -585,7 +585,7 @@ reconnect (struct GNUNET_ATS_PerformanceHandle *ph) | |||
585 | struct ClientStartMessage *init; | 585 | struct ClientStartMessage *init; |
586 | 586 | ||
587 | GNUNET_assert (NULL == ph->mq); | 587 | GNUNET_assert (NULL == ph->mq); |
588 | ph->mq = GNUNET_CLIENT_connecT (ph->cfg, | 588 | ph->mq = GNUNET_CLIENT_connect (ph->cfg, |
589 | "ats", | 589 | "ats", |
590 | handlers, | 590 | handlers, |
591 | &mq_error_handler, | 591 | &mq_error_handler, |
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index 4a872b90a..faeeb6081 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c | |||
@@ -532,7 +532,7 @@ reconnect (struct GNUNET_ATS_SchedulingHandle *sh) | |||
532 | struct GNUNET_ATS_AddressRecord *ar; | 532 | struct GNUNET_ATS_AddressRecord *ar; |
533 | 533 | ||
534 | GNUNET_assert (NULL == sh->mq); | 534 | GNUNET_assert (NULL == sh->mq); |
535 | sh->mq = GNUNET_CLIENT_connecT (sh->cfg, | 535 | sh->mq = GNUNET_CLIENT_connect (sh->cfg, |
536 | "ats", | 536 | "ats", |
537 | handlers, | 537 | handlers, |
538 | &error_handler, | 538 | &error_handler, |
diff --git a/src/auction/.gitignore b/src/auction/.gitignore new file mode 100644 index 000000000..5c3ec20cb --- /dev/null +++ b/src/auction/.gitignore | |||
@@ -0,0 +1,5 @@ | |||
1 | gnunet-auction-create | ||
2 | gnunet-auction-info | ||
3 | gnunet-auction-join | ||
4 | gnunet-service-auction | ||
5 | test_auction_api | ||
diff --git a/src/auction/Makefile.am b/src/auction/Makefile.am new file mode 100644 index 000000000..87f917283 --- /dev/null +++ b/src/auction/Makefile.am | |||
@@ -0,0 +1,74 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
5 | |||
6 | libexecdir= $(pkglibdir)/libexec/ | ||
7 | |||
8 | |||
9 | pkgcfg_DATA = \ | ||
10 | auction.conf | ||
11 | |||
12 | if MINGW | ||
13 | WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols | ||
14 | endif | ||
15 | |||
16 | if USE_COVERAGE | ||
17 | AM_CFLAGS = -fprofile-arcs -ftest-coverage | ||
18 | endif | ||
19 | |||
20 | |||
21 | libexec_PROGRAMS = \ | ||
22 | gnunet-service-auction | ||
23 | |||
24 | gnunet_service_auction_SOURCES = \ | ||
25 | gnunet-service-auction.c | ||
26 | gnunet_service_auction_LDADD = \ | ||
27 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
28 | -ljansson \ | ||
29 | $(GN_LIBINTL) | ||
30 | |||
31 | |||
32 | bin_PROGRAMS = \ | ||
33 | gnunet-auction-create \ | ||
34 | gnunet-auction-info \ | ||
35 | gnunet-auction-join | ||
36 | |||
37 | gnunet_auction_create_SOURCES = \ | ||
38 | gnunet-auction-create.c | ||
39 | gnunet_auction_create_LDADD = \ | ||
40 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
41 | -ljansson \ | ||
42 | $(GN_LIBINTL) | ||
43 | |||
44 | gnunet_auction_info_SOURCES = \ | ||
45 | gnunet-auction-info.c | ||
46 | gnunet_auction_info_LDADD = \ | ||
47 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
48 | -ljansson \ | ||
49 | $(GN_LIBINTL) | ||
50 | |||
51 | gnunet_auction_join_SOURCES = \ | ||
52 | gnunet-auction-join.c | ||
53 | gnunet_auction_join_LDADD = \ | ||
54 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
55 | -ljansson \ | ||
56 | $(GN_LIBINTL) | ||
57 | |||
58 | |||
59 | check_PROGRAMS = \ | ||
60 | test_auction_api | ||
61 | |||
62 | test_auction_api_SOURCES = \ | ||
63 | test_auction_api.c | ||
64 | test_auction_api_LDADD = \ | ||
65 | $(top_builddir)/src/util/libgnunetutil.la | ||
66 | |||
67 | |||
68 | check_SCRIPTS = \ | ||
69 | test_auction_create.sh | ||
70 | |||
71 | if ENABLE_TEST_RUN | ||
72 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; | ||
73 | TESTS = $(check_PROGRAMS) $(check_SCRIPTS) | ||
74 | endif | ||
diff --git a/src/auction/auction.conf b/src/auction/auction.conf new file mode 100644 index 000000000..6ca35896b --- /dev/null +++ b/src/auction/auction.conf | |||
@@ -0,0 +1,4 @@ | |||
1 | [auction] | ||
2 | AUTOSTART = NO | ||
3 | BINARY = gnunet-service-auction | ||
4 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-auction.sock | ||
diff --git a/src/auction/auction.h b/src/auction/auction.h new file mode 100644 index 000000000..758307aeb --- /dev/null +++ b/src/auction/auction.h | |||
@@ -0,0 +1,77 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2001-2011 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Markus Teich | ||
23 | * @file auction/auction.h | ||
24 | * | ||
25 | * @brief Common type definitions for the auction service and API. | ||
26 | */ | ||
27 | #ifndef AUCTION_H | ||
28 | #define AUCTION_H | ||
29 | |||
30 | #include "gnunet_common.h" | ||
31 | |||
32 | GNUNET_NETWORK_STRUCT_BEGIN | ||
33 | |||
34 | /** | ||
35 | * Auction creation request sent from the client to the service | ||
36 | */ | ||
37 | struct GNUNET_AUCTION_ClientCreateMessage | ||
38 | { | ||
39 | /** | ||
40 | * Type: GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE | ||
41 | */ | ||
42 | struct GNUNET_MessageHeader header; | ||
43 | |||
44 | /** | ||
45 | * When should the auction start | ||
46 | */ | ||
47 | struct GNUNET_TIME_AbsoluteNBO time_start; | ||
48 | |||
49 | /** | ||
50 | * How long is each round allowed to be maximally | ||
51 | */ | ||
52 | struct GNUNET_TIME_RelativeNBO time_round; | ||
53 | |||
54 | /** | ||
55 | * Auction parameter m. | ||
56 | * 0 for first price auctions. | ||
57 | * >0 for M+1st price auctions. | ||
58 | */ | ||
59 | uint16_t m GNUNET_PACKED; | ||
60 | |||
61 | /** | ||
62 | * Should the auction outcome be public? | ||
63 | * 0 for private outcome auctions. | ||
64 | * 1 for public outcome auctions. | ||
65 | */ | ||
66 | uint16_t outcome_public GNUNET_PACKED; | ||
67 | |||
68 | /** | ||
69 | * TODO: Price mapping. | ||
70 | */ | ||
71 | |||
72 | /* DESCRIPTION text copied to end of this message */ | ||
73 | }; | ||
74 | |||
75 | GNUNET_NETWORK_STRUCT_END | ||
76 | |||
77 | #endif | ||
diff --git a/src/auction/gnunet-auction-create.c b/src/auction/gnunet-auction-create.c new file mode 100644 index 000000000..a4c029572 --- /dev/null +++ b/src/auction/gnunet-auction-create.c | |||
@@ -0,0 +1,197 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file auction/gnunet-auction-create.c | ||
23 | * @brief tool to create a new auction | ||
24 | * @author Markus Teich | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | |||
28 | #include <float.h> | ||
29 | |||
30 | #include "gnunet_util_lib.h" | ||
31 | #include "gnunet_json_lib.h" | ||
32 | /* #include "gnunet_auction_service.h" */ | ||
33 | |||
34 | #define FIRST_PRICE 0 | ||
35 | #define OUTCOME_PRIVATE 0 | ||
36 | #define OUTCOME_PUBLIC 1 | ||
37 | |||
38 | static int ret; /** Final status code. */ | ||
39 | static char *fndesc; /** filename of the item description */ | ||
40 | static char *fnprices; /** filename of the price map */ | ||
41 | static struct GNUNET_TIME_Relative dround; /** max round duration */ | ||
42 | static struct GNUNET_TIME_Relative dstart; /** time until auction starts */ | ||
43 | static unsigned int m = FIRST_PRICE; /** auction parameter m */ | ||
44 | static int outcome = OUTCOME_PRIVATE; /** outcome */ | ||
45 | static int interactive; /** keep running in foreground */ | ||
46 | |||
47 | |||
48 | /** | ||
49 | * Main function that will be run by the scheduler. | ||
50 | * | ||
51 | * @param cls closure | ||
52 | * @param args remaining command-line arguments | ||
53 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
54 | * @param cfg configuration | ||
55 | */ | ||
56 | static void | ||
57 | run (void *cls, | ||
58 | char *const *args, | ||
59 | const char *cfgfile, | ||
60 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
61 | { | ||
62 | unsigned int i; | ||
63 | double cur, prev = DBL_MAX; | ||
64 | json_t *pmap; | ||
65 | json_t *parray; | ||
66 | json_t *pnode; | ||
67 | json_error_t jerr; | ||
68 | |||
69 | /* cmdline parsing */ | ||
70 | if (GNUNET_TIME_UNIT_ZERO.rel_value_us == dstart.rel_value_us) | ||
71 | { | ||
72 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
73 | "required argument --regtime missing or invalid (zero)\n"); | ||
74 | goto fail; | ||
75 | } | ||
76 | if (GNUNET_TIME_UNIT_ZERO.rel_value_us == dround.rel_value_us) | ||
77 | { | ||
78 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
79 | "required argument --roundtime missing or invalid (zero)\n"); | ||
80 | goto fail; | ||
81 | } | ||
82 | if (!fndesc) | ||
83 | { | ||
84 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
85 | "required argument --description missing\n"); | ||
86 | goto fail; | ||
87 | } | ||
88 | if (!fnprices) | ||
89 | { | ||
90 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
91 | "required argument --pricemap missing\n"); | ||
92 | goto fail; | ||
93 | } | ||
94 | |||
95 | /* parse and check pricemap validity */ | ||
96 | if (!(pmap = json_load_file (fnprices, JSON_DECODE_INT_AS_REAL, &jerr))) | ||
97 | { | ||
98 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
99 | "parsing pricemap json at %d:%d: %s\n", | ||
100 | jerr.line, jerr.column, jerr.text); | ||
101 | goto fail; | ||
102 | } | ||
103 | if (-1 == json_unpack_ex (pmap, &jerr, JSON_VALIDATE_ONLY, | ||
104 | "{s:s, s:[]}", "currency", "prices")) | ||
105 | { | ||
106 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
107 | "validating pricemap: %s\n", jerr.text); | ||
108 | goto fail; | ||
109 | } | ||
110 | if (!(parray = json_object_get (pmap, "prices")) || !json_is_array (parray)) | ||
111 | { | ||
112 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
113 | "could not get `prices` array node from pricemap\n"); | ||
114 | goto fail; | ||
115 | } | ||
116 | if (0 == json_array_size (parray)) | ||
117 | { | ||
118 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "empty pricemap array\n"); | ||
119 | goto fail; | ||
120 | } | ||
121 | json_array_foreach (parray, i, pnode) | ||
122 | { | ||
123 | if (-1 == json_unpack_ex (pnode, &jerr, 0, "F", &cur)) | ||
124 | { | ||
125 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
126 | "validating pricearray index %d: %s\n", i, jerr.text); | ||
127 | goto fail; | ||
128 | } | ||
129 | if (prev <= cur) | ||
130 | { | ||
131 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
132 | "validating pricearray index %d: " | ||
133 | "prices must be strictly monotonically decreasing\n", | ||
134 | i); | ||
135 | goto fail; | ||
136 | } | ||
137 | prev = cur; | ||
138 | } | ||
139 | |||
140 | return; | ||
141 | |||
142 | fail: | ||
143 | ret = 1; | ||
144 | return; | ||
145 | } | ||
146 | |||
147 | |||
148 | /** | ||
149 | * The main function. | ||
150 | * | ||
151 | * @param argc number of arguments from the command line | ||
152 | * @param argv command line arguments | ||
153 | * @return 0 ok, 1 on error | ||
154 | */ | ||
155 | int | ||
156 | main (int argc, char *const *argv) | ||
157 | { | ||
158 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
159 | {'d', "description", "FILE", | ||
160 | gettext_noop ("description of the item to be sold"), | ||
161 | 1, &GNUNET_GETOPT_set_filename, &fndesc}, | ||
162 | {'p', "pricemap", "FILE", | ||
163 | gettext_noop ("mapping of possible prices"), | ||
164 | 1, &GNUNET_GETOPT_set_filename, &fnprices}, | ||
165 | {'r', "roundtime", "DURATION", | ||
166 | gettext_noop ("max duration per round"), | ||
167 | 1, &GNUNET_GETOPT_set_relative_time, &dround}, | ||
168 | {'s', "regtime", "DURATION", | ||
169 | gettext_noop ("duration until auction starts"), | ||
170 | 1, &GNUNET_GETOPT_set_relative_time, &dstart}, | ||
171 | {'m', "m", "NUMBER", | ||
172 | gettext_noop ("number of items to sell\n" | ||
173 | "0 for first price auction\n" | ||
174 | ">0 for vickrey/M+1st price auction"), | ||
175 | 1, &GNUNET_GETOPT_set_uint, &m}, | ||
176 | {'u', "public", NULL, | ||
177 | gettext_noop ("public auction outcome"), | ||
178 | 0, &GNUNET_GETOPT_set_one, &outcome}, | ||
179 | {'i', "interactive", NULL, | ||
180 | gettext_noop ("keep running in foreground until auction completes"), | ||
181 | 0, &GNUNET_GETOPT_set_one, &interactive}, | ||
182 | GNUNET_GETOPT_OPTION_END | ||
183 | }; | ||
184 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | ||
185 | return 2; | ||
186 | |||
187 | ret = (GNUNET_OK == | ||
188 | GNUNET_PROGRAM_run (argc, argv, | ||
189 | "gnunet-auction-create", | ||
190 | gettext_noop ("create a new auction and " | ||
191 | "start listening for bidders"), | ||
192 | options, | ||
193 | &run, | ||
194 | NULL)) ? ret : 1; | ||
195 | GNUNET_free ((void*) argv); | ||
196 | return ret; | ||
197 | } | ||
diff --git a/src/auction/gnunet-auction-info.c b/src/auction/gnunet-auction-info.c new file mode 100644 index 000000000..a4af1152a --- /dev/null +++ b/src/auction/gnunet-auction-info.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file auction/gnunet-auction.c | ||
23 | * @brief auction for writing a tool | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | /* #include "gnunet_auction_service.h" */ | ||
29 | |||
30 | /** | ||
31 | * Final status code. | ||
32 | */ | ||
33 | static int ret; | ||
34 | |||
35 | |||
36 | /** | ||
37 | * Main function that will be run by the scheduler. | ||
38 | * | ||
39 | * @param cls closure | ||
40 | * @param args remaining command-line arguments | ||
41 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
42 | * @param cfg configuration | ||
43 | */ | ||
44 | static void | ||
45 | run (void *cls, | ||
46 | char *const *args, | ||
47 | const char *cfgfile, | ||
48 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
49 | { | ||
50 | /* main code here */ | ||
51 | } | ||
52 | |||
53 | |||
54 | /** | ||
55 | * The main function. | ||
56 | * | ||
57 | * @param argc number of arguments from the command line | ||
58 | * @param argv command line arguments | ||
59 | * @return 0 ok, 1 on error | ||
60 | */ | ||
61 | int | ||
62 | main (int argc, char *const *argv) | ||
63 | { | ||
64 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
65 | /* FIMXE: add options here */ | ||
66 | GNUNET_GETOPT_OPTION_END | ||
67 | }; | ||
68 | if (GNUNET_OK != | ||
69 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
70 | &argc, &argv)) | ||
71 | return 2; | ||
72 | |||
73 | ret = (GNUNET_OK == | ||
74 | GNUNET_PROGRAM_run (argc, argv, | ||
75 | "gnunet-auction", | ||
76 | gettext_noop ("help text"), | ||
77 | options, | ||
78 | &run, | ||
79 | NULL)) ? ret : 1; | ||
80 | GNUNET_free ((void*) argv); | ||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | /* end of gnunet-auction.c */ | ||
diff --git a/src/auction/gnunet-auction-join.c b/src/auction/gnunet-auction-join.c new file mode 100644 index 000000000..a4af1152a --- /dev/null +++ b/src/auction/gnunet-auction-join.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file auction/gnunet-auction.c | ||
23 | * @brief auction for writing a tool | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | /* #include "gnunet_auction_service.h" */ | ||
29 | |||
30 | /** | ||
31 | * Final status code. | ||
32 | */ | ||
33 | static int ret; | ||
34 | |||
35 | |||
36 | /** | ||
37 | * Main function that will be run by the scheduler. | ||
38 | * | ||
39 | * @param cls closure | ||
40 | * @param args remaining command-line arguments | ||
41 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
42 | * @param cfg configuration | ||
43 | */ | ||
44 | static void | ||
45 | run (void *cls, | ||
46 | char *const *args, | ||
47 | const char *cfgfile, | ||
48 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
49 | { | ||
50 | /* main code here */ | ||
51 | } | ||
52 | |||
53 | |||
54 | /** | ||
55 | * The main function. | ||
56 | * | ||
57 | * @param argc number of arguments from the command line | ||
58 | * @param argv command line arguments | ||
59 | * @return 0 ok, 1 on error | ||
60 | */ | ||
61 | int | ||
62 | main (int argc, char *const *argv) | ||
63 | { | ||
64 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
65 | /* FIMXE: add options here */ | ||
66 | GNUNET_GETOPT_OPTION_END | ||
67 | }; | ||
68 | if (GNUNET_OK != | ||
69 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
70 | &argc, &argv)) | ||
71 | return 2; | ||
72 | |||
73 | ret = (GNUNET_OK == | ||
74 | GNUNET_PROGRAM_run (argc, argv, | ||
75 | "gnunet-auction", | ||
76 | gettext_noop ("help text"), | ||
77 | options, | ||
78 | &run, | ||
79 | NULL)) ? ret : 1; | ||
80 | GNUNET_free ((void*) argv); | ||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | /* end of gnunet-auction.c */ | ||
diff --git a/src/auction/gnunet-service-auction.c b/src/auction/gnunet-service-auction.c new file mode 100644 index 000000000..dac38914d --- /dev/null +++ b/src/auction/gnunet-service-auction.c | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file auction/gnunet-service-auction.c | ||
23 | * @brief service for executing auctions | ||
24 | * @author Markus Teich | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | |||
29 | #include "auction.h" | ||
30 | |||
31 | /** | ||
32 | * Check AUCTION CREATE messages from the client. | ||
33 | * | ||
34 | * @param cls the client we received this message from | ||
35 | * @param msg the actual message received | ||
36 | * @return #GNUNET_OK (always) | ||
37 | */ | ||
38 | static int | ||
39 | check_create (void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg) | ||
40 | { | ||
41 | /* always well-formed due to arbitrary length description */ | ||
42 | return GNUNET_OK; | ||
43 | } | ||
44 | |||
45 | |||
46 | /** | ||
47 | * Handler for CREATE messages. | ||
48 | * | ||
49 | * @param cls the client we received this message from | ||
50 | * @param msg the actual message received | ||
51 | */ | ||
52 | static void | ||
53 | handle_create (void *cls, const struct GNUNET_AUCTION_ClientCreateMessage *msg) | ||
54 | { | ||
55 | struct GNUNET_SERVICE_Client *client = cls; | ||
56 | // struct GNUNET_MQ_Handle *mq; | ||
57 | // struct GNUNET_MQ_Envelope *env; | ||
58 | // struct GNUNET_AUCTION_blabla em; | ||
59 | uint16_t size; | ||
60 | |||
61 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
62 | "Received CREATE message from client\n"); | ||
63 | |||
64 | size = ntohs (msg->header.size); | ||
65 | |||
66 | /**TODO: create auction and return auction object */ | ||
67 | // mq = GNUNET_SERVICE_client_get_mq (client); | ||
68 | // setup_info_message (&em); | ||
69 | // env = GNUNET_MQ_msg_copy (&em.header); | ||
70 | // GNUNET_MQ_send (mq, env); | ||
71 | |||
72 | GNUNET_SERVICE_client_continue (client); | ||
73 | } | ||
74 | |||
75 | |||
76 | /** | ||
77 | * Task run during shutdown. | ||
78 | * | ||
79 | * @param cls unused | ||
80 | */ | ||
81 | static void | ||
82 | cleanup_task (void *cls) | ||
83 | { | ||
84 | /* FIXME: do clean up here */ | ||
85 | } | ||
86 | |||
87 | |||
88 | /** | ||
89 | * Callback called when a client connects to the service. | ||
90 | * | ||
91 | * @param cls closure for the service | ||
92 | * @param c the new client that connected to the service | ||
93 | * @param mq the message queue used to send messages to the client | ||
94 | * @return @a c | ||
95 | */ | ||
96 | static void * | ||
97 | client_connect_cb (void *cls, | ||
98 | struct GNUNET_SERVICE_Client *c, | ||
99 | struct GNUNET_MQ_Handle *mq) | ||
100 | { | ||
101 | return c; | ||
102 | } | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Callback called when a client disconnected from the service | ||
107 | * | ||
108 | * @param cls closure for the service | ||
109 | * @param c the client that disconnected | ||
110 | * @param internal_cls should be equal to @a c | ||
111 | */ | ||
112 | static void | ||
113 | client_disconnect_cb (void *cls, | ||
114 | struct GNUNET_SERVICE_Client *c, | ||
115 | void *internal_cls) | ||
116 | { | ||
117 | GNUNET_assert (c == internal_cls); | ||
118 | } | ||
119 | |||
120 | |||
121 | /** | ||
122 | * Process auction requests. | ||
123 | * | ||
124 | * @param cls closure | ||
125 | * @param cfg configuration to use | ||
126 | * @param service the initialized service | ||
127 | */ | ||
128 | static void | ||
129 | run (void *cls, | ||
130 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
131 | struct GNUNET_SERVICE_Handle *service) | ||
132 | { | ||
133 | /* FIXME: do setup here */ | ||
134 | GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL); | ||
135 | } | ||
136 | |||
137 | |||
138 | /** | ||
139 | * Define "main" method using service macro. | ||
140 | */ | ||
141 | GNUNET_SERVICE_MAIN | ||
142 | ("auction", | ||
143 | GNUNET_SERVICE_OPTION_NONE, | ||
144 | &run, | ||
145 | &client_connect_cb, | ||
146 | &client_disconnect_cb, | ||
147 | NULL, | ||
148 | GNUNET_MQ_hd_var_size (create, | ||
149 | GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE, | ||
150 | struct GNUNET_AUCTION_ClientCreateMessage, | ||
151 | NULL), | ||
152 | GNUNET_MQ_handler_end ()) | ||
153 | |||
154 | |||
155 | /* end of gnunet-service-auction.c */ | ||
diff --git a/src/auction/test_auction_api.c b/src/auction/test_auction_api.c new file mode 100644 index 000000000..38e93c6fc --- /dev/null +++ b/src/auction/test_auction_api.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file auction/test_auction_api.c | ||
22 | * @brief testcase for auction.c | ||
23 | */ | ||
24 | #include "platform.h" | ||
25 | |||
26 | static int | ||
27 | check () | ||
28 | { | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | int | ||
33 | main (int argc, char *argv[]) | ||
34 | { | ||
35 | int ret; | ||
36 | |||
37 | ret = check (); | ||
38 | |||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | /* end of test_auction_api.c */ | ||
diff --git a/src/auction/test_auction_create.sh b/src/auction/test_auction_create.sh new file mode 100755 index 000000000..b0f4de738 --- /dev/null +++ b/src/auction/test_auction_create.sh | |||
@@ -0,0 +1,80 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | trap 'rm -f test.json' EXIT | ||
4 | |||
5 | |||
6 | # missing required cmdline args | ||
7 | gnunet-auction-create -r 1 -d foo -p test.json && exit 1 | ||
8 | gnunet-auction-create -s 1 -d foo -p test.json && exit 1 | ||
9 | gnunet-auction-create -s 1 -r 1 -p test.json && exit 1 | ||
10 | gnunet-auction-create -s 1 -r 1 -d foo && exit 1 | ||
11 | |||
12 | |||
13 | # no pricemap | ||
14 | rm -f test.json | ||
15 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
16 | |||
17 | |||
18 | # json errors | ||
19 | cat <<DOG >test.json | ||
20 | [,] | ||
21 | DOG | ||
22 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
23 | |||
24 | cat <<DOG >test.json | ||
25 | bla | ||
26 | DOG | ||
27 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
28 | |||
29 | |||
30 | # unexpected structures | ||
31 | cat <<DOG >test.json | ||
32 | {"foo": "bar"} | ||
33 | DOG | ||
34 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
35 | |||
36 | cat <<DOG >test.json | ||
37 | {"currency": "foo"} | ||
38 | DOG | ||
39 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
40 | |||
41 | cat <<DOG >test.json | ||
42 | {"prices": []} | ||
43 | DOG | ||
44 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
45 | |||
46 | cat <<DOG >test.json | ||
47 | {"currency": "foo", "prices": "bar"} | ||
48 | DOG | ||
49 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
50 | |||
51 | |||
52 | # wrong array content | ||
53 | cat <<DOG >test.json | ||
54 | {"currency": "foo", "prices": []} | ||
55 | DOG | ||
56 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
57 | |||
58 | cat <<DOG >test.json | ||
59 | {"currency": "foo", "prices": ["bar"]} | ||
60 | DOG | ||
61 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
62 | |||
63 | cat <<DOG >test.json | ||
64 | {"currency": "foo", "prices": [null]} | ||
65 | DOG | ||
66 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
67 | |||
68 | cat <<DOG >test.json | ||
69 | {"currency": "foo", "prices": [1, 2]} | ||
70 | DOG | ||
71 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json && exit 1 | ||
72 | |||
73 | |||
74 | # correct example | ||
75 | cat <<DOG >test.json | ||
76 | {"currency": "foo", "prices": [2, 1]} | ||
77 | DOG | ||
78 | gnunet-auction-create -s 1 -r 1 -d foo -p test.json || exit 1 | ||
79 | |||
80 | rm -f test.json | ||
diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am index d823b4872..53d17dd9c 100644 --- a/src/cadet/Makefile.am +++ b/src/cadet/Makefile.am | |||
@@ -22,7 +22,9 @@ plugindir = $(libdir)/gnunet | |||
22 | AM_CLFAGS = -g | 22 | AM_CLFAGS = -g |
23 | 23 | ||
24 | libexec_PROGRAMS = \ | 24 | libexec_PROGRAMS = \ |
25 | gnunet-service-cadet $(EXP_LIBEXEC) | 25 | gnunet-service-cadet \ |
26 | gnunet-service-cadet-new \ | ||
27 | $(EXP_LIBEXEC) | ||
26 | 28 | ||
27 | bin_PROGRAMS = \ | 29 | bin_PROGRAMS = \ |
28 | gnunet-cadet | 30 | gnunet-cadet |
@@ -46,6 +48,27 @@ gnunet_cadet_LDADD = \ | |||
46 | libgnunetcadet.la \ | 48 | libgnunetcadet.la \ |
47 | $(top_builddir)/src/util/libgnunetutil.la | 49 | $(top_builddir)/src/util/libgnunetutil.la |
48 | 50 | ||
51 | gnunet_service_cadet_new_SOURCES = \ | ||
52 | gnunet-service-cadet-new.c gnunet-service-cadet-new.h \ | ||
53 | gnunet-service-cadet-new_channel.c gnunet-service-cadet-new_channel.h \ | ||
54 | gnunet-service-cadet-new_connection.c gnunet-service-cadet-new_connection.h \ | ||
55 | gnunet-service-cadet-new_core.c gnunet-service-cadet-new_core.h \ | ||
56 | gnunet-service-cadet-new_dht.c gnunet-service-cadet-new_dht.h \ | ||
57 | gnunet-service-cadet-new_hello.c gnunet-service-cadet-new_hello.h \ | ||
58 | gnunet-service-cadet-new_tunnels.c gnunet-service-cadet-new_tunnels.h \ | ||
59 | gnunet-service-cadet-new_paths.c gnunet-service-cadet-new_paths.h \ | ||
60 | gnunet-service-cadet-new_peer.c gnunet-service-cadet-new_peer.h | ||
61 | gnunet_service_cadet_new_LDADD = \ | ||
62 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
63 | $(top_builddir)/src/ats/libgnunetats.la \ | ||
64 | $(top_builddir)/src/core/libgnunetcore.la \ | ||
65 | $(top_builddir)/src/dht/libgnunetdht.la \ | ||
66 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | ||
67 | $(top_builddir)/src/transport/libgnunettransport.la \ | ||
68 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | ||
69 | $(top_builddir)/src/hello/libgnunethello.la \ | ||
70 | $(top_builddir)/src/block/libgnunetblock.la | ||
71 | |||
49 | gnunet_service_cadet_SOURCES = \ | 72 | gnunet_service_cadet_SOURCES = \ |
50 | gnunet-service-cadet_tunnel.c gnunet-service-cadet_tunnel.h \ | 73 | gnunet-service-cadet_tunnel.c gnunet-service-cadet_tunnel.h \ |
51 | gnunet-service-cadet_connection.c gnunet-service-cadet_connection.h \ | 74 | gnunet-service-cadet_connection.c gnunet-service-cadet_connection.h \ |
@@ -87,6 +110,11 @@ libgnunetcadettest_a_LIBADD = \ | |||
87 | 110 | ||
88 | if HAVE_TESTING | 111 | if HAVE_TESTING |
89 | check_PROGRAMS = \ | 112 | check_PROGRAMS = \ |
113 | test_cadet_2_speed_reliable_backwards \ | ||
114 | test_cadet_5_speed \ | ||
115 | test_cadet_5_speed_ack \ | ||
116 | test_cadet_5_speed_reliable \ | ||
117 | test_cadet_5_speed_reliable_backwards \ | ||
90 | test_cadet_single \ | 118 | test_cadet_single \ |
91 | test_cadet_local \ | 119 | test_cadet_local \ |
92 | test_cadet_2_forward \ | 120 | test_cadet_2_forward \ |
@@ -96,15 +124,10 @@ check_PROGRAMS = \ | |||
96 | test_cadet_2_speed_ack \ | 124 | test_cadet_2_speed_ack \ |
97 | test_cadet_2_speed_backwards \ | 125 | test_cadet_2_speed_backwards \ |
98 | test_cadet_2_speed_reliable \ | 126 | test_cadet_2_speed_reliable \ |
99 | test_cadet_2_speed_reliable_backwards \ | ||
100 | test_cadet_5_forward \ | 127 | test_cadet_5_forward \ |
101 | test_cadet_5_signal \ | 128 | test_cadet_5_signal \ |
102 | test_cadet_5_keepalive \ | 129 | test_cadet_5_keepalive \ |
103 | test_cadet_5_speed \ | 130 | test_cadet_5_speed_backwards |
104 | test_cadet_5_speed_ack \ | ||
105 | test_cadet_5_speed_backwards \ | ||
106 | test_cadet_5_speed_reliable \ | ||
107 | test_cadet_5_speed_reliable_backwards | ||
108 | endif | 131 | endif |
109 | 132 | ||
110 | ld_cadet_test_lib = \ | 133 | ld_cadet_test_lib = \ |
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 049f3a85a..c16fb2917 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h | |||
@@ -57,6 +57,7 @@ extern "C" | |||
57 | #include "gnunet_util_lib.h" | 57 | #include "gnunet_util_lib.h" |
58 | #include "gnunet_peer_lib.h" | 58 | #include "gnunet_peer_lib.h" |
59 | #include "gnunet_core_service.h" | 59 | #include "gnunet_core_service.h" |
60 | #include "gnunet_cadet_service.h" | ||
60 | #include "gnunet_protocols.h" | 61 | #include "gnunet_protocols.h" |
61 | #include <gnunet_cadet_service.h> | 62 | #include <gnunet_cadet_service.h> |
62 | 63 | ||
@@ -64,13 +65,29 @@ extern "C" | |||
64 | /************************** CONSTANTS ******************************/ | 65 | /************************** CONSTANTS ******************************/ |
65 | /******************************************************************************/ | 66 | /******************************************************************************/ |
66 | 67 | ||
68 | /** | ||
69 | * Minimum value for channel IDs of local clients. | ||
70 | */ | ||
67 | #define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI 0x80000000 | 71 | #define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI 0x80000000 |
68 | #define GNUNET_CADET_LOCAL_CHANNEL_ID_SERV 0xB0000000 | ||
69 | 72 | ||
70 | #define HIGH_PID 0xFFFF0000 | 73 | /** |
71 | #define LOW_PID 0x0000FFFF | 74 | * FIXME. |
75 | */ | ||
76 | #define HIGH_PID 0xFF000000 | ||
77 | |||
78 | /** | ||
79 | * FIXME. | ||
80 | */ | ||
81 | #define LOW_PID 0x00FFFFFF | ||
72 | 82 | ||
73 | #define PID_OVERFLOW(pid, max) (pid > HIGH_PID && max < LOW_PID) | 83 | |
84 | /** | ||
85 | * Test if the two PIDs (of type `uint32_t`) are in the range where we | ||
86 | * have to worry about overflows. This is the case when @a pid is | ||
87 | * large and @a max is small, useful when comparing @a pid smaller | ||
88 | * than @a max. | ||
89 | */ | ||
90 | #define PID_OVERFLOW(pid, max) (((pid) > HIGH_PID) && ((max) < LOW_PID)) | ||
74 | 91 | ||
75 | /******************************************************************************/ | 92 | /******************************************************************************/ |
76 | /************************** MESSAGES ******************************/ | 93 | /************************** MESSAGES ******************************/ |
@@ -80,6 +97,22 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
80 | 97 | ||
81 | 98 | ||
82 | /** | 99 | /** |
100 | * Number uniquely identifying a channel of a client. | ||
101 | */ | ||
102 | struct GNUNET_CADET_ClientChannelNumber | ||
103 | { | ||
104 | /** | ||
105 | * Values for channel numbering. | ||
106 | * Local channel numbers given by the service (incoming) are | ||
107 | * smaller than #GNUNET_CADET_LOCAL_CHANNEL_ID_CLI. | ||
108 | * Local channel numbers given by the client (created) are | ||
109 | * larger than #GNUNET_CADET_LOCAL_CHANNEL_ID_CLI. | ||
110 | */ | ||
111 | uint32_t channel_of_client GNUNET_PACKED; | ||
112 | }; | ||
113 | |||
114 | |||
115 | /** | ||
83 | * Message for a client to create and destroy channels. | 116 | * Message for a client to create and destroy channels. |
84 | */ | 117 | */ |
85 | struct GNUNET_CADET_PortMessage | 118 | struct GNUNET_CADET_PortMessage |
@@ -98,31 +131,23 @@ struct GNUNET_CADET_PortMessage | |||
98 | struct GNUNET_HashCode port GNUNET_PACKED; | 131 | struct GNUNET_HashCode port GNUNET_PACKED; |
99 | }; | 132 | }; |
100 | 133 | ||
101 | /** | ||
102 | * Type for channel numbering. | ||
103 | * - Local channel numbers given by the service (incoming) are >= 0xB0000000 | ||
104 | * - Local channel numbers given by the client (created) are >= 0x80000000 | ||
105 | * - Global channel numbers are < 0x80000000 | ||
106 | */ | ||
107 | typedef uint32_t CADET_ChannelNumber; | ||
108 | |||
109 | 134 | ||
110 | /** | 135 | /** |
111 | * Message for a client to create channels. | 136 | * Message for a client to create channels. |
112 | */ | 137 | */ |
113 | struct GNUNET_CADET_ChannelCreateMessage | 138 | struct GNUNET_CADET_ChannelOpenMessageMessage |
114 | { | 139 | { |
115 | /** | 140 | /** |
116 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE | 141 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE |
117 | * | 142 | * |
118 | * Size: sizeof(struct GNUNET_CADET_ChannelCreateMessage) | 143 | * Size: sizeof(struct GNUNET_CADET_ChannelOpenMessageMessage) |
119 | */ | 144 | */ |
120 | struct GNUNET_MessageHeader header; | 145 | struct GNUNET_MessageHeader header; |
121 | 146 | ||
122 | /** | 147 | /** |
123 | * ID of a channel controlled by this client. | 148 | * ID of a channel controlled by this client. |
124 | */ | 149 | */ |
125 | CADET_ChannelNumber channel_id GNUNET_PACKED; | 150 | struct GNUNET_CADET_ClientChannelNumber channel_id; |
126 | 151 | ||
127 | /** | 152 | /** |
128 | * Channel's peer | 153 | * Channel's peer |
@@ -152,11 +177,11 @@ struct GNUNET_CADET_ChannelDestroyMessage | |||
152 | * Size: sizeof(struct GNUNET_CADET_ChannelDestroyMessage) | 177 | * Size: sizeof(struct GNUNET_CADET_ChannelDestroyMessage) |
153 | */ | 178 | */ |
154 | struct GNUNET_MessageHeader header; | 179 | struct GNUNET_MessageHeader header; |
155 | 180 | ||
156 | /** | 181 | /** |
157 | * ID of a channel controlled by this client. | 182 | * ID of a channel controlled by this client. |
158 | */ | 183 | */ |
159 | CADET_ChannelNumber channel_id GNUNET_PACKED; | 184 | struct GNUNET_CADET_ClientChannelNumber channel_id; |
160 | }; | 185 | }; |
161 | 186 | ||
162 | 187 | ||
@@ -173,7 +198,7 @@ struct GNUNET_CADET_LocalData | |||
173 | /** | 198 | /** |
174 | * ID of the channel | 199 | * ID of the channel |
175 | */ | 200 | */ |
176 | uint32_t id GNUNET_PACKED; | 201 | struct GNUNET_CADET_ClientChannelNumber id; |
177 | 202 | ||
178 | /** | 203 | /** |
179 | * Payload follows | 204 | * Payload follows |
@@ -195,7 +220,7 @@ struct GNUNET_CADET_LocalAck | |||
195 | /** | 220 | /** |
196 | * ID of the channel allowed to send more data. | 221 | * ID of the channel allowed to send more data. |
197 | */ | 222 | */ |
198 | CADET_ChannelNumber channel_id GNUNET_PACKED; | 223 | struct GNUNET_CADET_ClientChannelNumber channel_id; |
199 | 224 | ||
200 | }; | 225 | }; |
201 | 226 | ||
@@ -214,7 +239,7 @@ struct GNUNET_CADET_LocalInfo | |||
214 | /** | 239 | /** |
215 | * ID of the channel allowed to send more data. | 240 | * ID of the channel allowed to send more data. |
216 | */ | 241 | */ |
217 | CADET_ChannelNumber channel_id GNUNET_PACKED; | 242 | struct GNUNET_CADET_ClientChannelNumber channel_id; |
218 | 243 | ||
219 | /** | 244 | /** |
220 | * ID of the owner of the channel (can be local peer). | 245 | * ID of the owner of the channel (can be local peer). |
@@ -258,6 +283,7 @@ struct GNUNET_CADET_LocalInfoPeer | |||
258 | * (each path ends in destination) */ | 283 | * (each path ends in destination) */ |
259 | }; | 284 | }; |
260 | 285 | ||
286 | |||
261 | /** | 287 | /** |
262 | * Message to inform the client about one of the tunnels in the service. | 288 | * Message to inform the client about one of the tunnels in the service. |
263 | */ | 289 | */ |
@@ -294,7 +320,7 @@ struct GNUNET_CADET_LocalInfoTunnel | |||
294 | */ | 320 | */ |
295 | uint16_t cstate GNUNET_PACKED; | 321 | uint16_t cstate GNUNET_PACKED; |
296 | 322 | ||
297 | /* If TUNNEL (no 'S'): GNUNET_PeerIdentity connection_ids[connections] */ | 323 | /* If TUNNEL (no 'S'): struct GNUNET_CADET_ConnectionTunnelIdentifier connection_ids[connections] */ |
298 | /* If TUNNEL (no 'S'): uint32_t channel_ids[channels] */ | 324 | /* If TUNNEL (no 'S'): uint32_t channel_ids[channels] */ |
299 | }; | 325 | }; |
300 | 326 | ||
@@ -350,25 +376,6 @@ GC_min_pid (uint32_t a, uint32_t b); | |||
350 | 376 | ||
351 | 377 | ||
352 | /** | 378 | /** |
353 | * Convert a 256 bit CadetHash into a 512 HashCode to use in GNUNET_h2s, | ||
354 | * multihashmap, and other HashCode-based functions. | ||
355 | * | ||
356 | * @param id A 256 bit hash to expand. | ||
357 | * | ||
358 | * @return A HashCode containing the original 256 bit hash right-padded with 0. | ||
359 | */ | ||
360 | const struct GNUNET_HashCode * | ||
361 | GC_h2hc (const struct GNUNET_CADET_Hash *id); | ||
362 | |||
363 | /** | ||
364 | * Get a string from a Cadet Hash (256 bits). | ||
365 | * WARNING: Not reentrant (based on GNUNET_h2s). | ||
366 | */ | ||
367 | const char * | ||
368 | GC_h2s (const struct GNUNET_CADET_Hash *id); | ||
369 | |||
370 | |||
371 | /** | ||
372 | * Allocate a string with a hexdump of any binary data. | 379 | * Allocate a string with a hexdump of any binary data. |
373 | * | 380 | * |
374 | * @param bin Arbitrary binary data. | 381 | * @param bin Arbitrary binary data. |
@@ -378,7 +385,10 @@ GC_h2s (const struct GNUNET_CADET_Hash *id); | |||
378 | * @return The size of the output. | 385 | * @return The size of the output. |
379 | */ | 386 | */ |
380 | size_t | 387 | size_t |
381 | GC_bin2s (void *bin, unsigned int len, char **output); | 388 | GC_bin2s (void *bin, |
389 | unsigned int len, | ||
390 | char **output); | ||
391 | |||
382 | 392 | ||
383 | /** | 393 | /** |
384 | * Convert a message type into a string to help debug | 394 | * Convert a message type into a string to help debug |
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index d75815588..8f1274d63 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2011 GNUnet e.V. | 3 | Copyright (C) 2011, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file cadet/cadet_api.c | 21 | * @file cadet/cadet_api.c |
22 | * @brief cadet api: client implementation of new cadet service | 22 | * @brief cadet api: client implementation of cadet service |
23 | * @author Bartlomiej Polot | 23 | * @author Bartlomiej Polot |
24 | */ | 24 | */ |
25 | 25 | ||
@@ -41,46 +41,48 @@ | |||
41 | */ | 41 | */ |
42 | struct GNUNET_CADET_TransmitHandle | 42 | struct GNUNET_CADET_TransmitHandle |
43 | { | 43 | { |
44 | /** | 44 | /** |
45 | * Double Linked list | 45 | * Double Linked list |
46 | */ | 46 | */ |
47 | struct GNUNET_CADET_TransmitHandle *next; | 47 | struct GNUNET_CADET_TransmitHandle *next; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Double Linked list | 50 | * Double Linked list |
51 | */ | 51 | */ |
52 | struct GNUNET_CADET_TransmitHandle *prev; | 52 | struct GNUNET_CADET_TransmitHandle *prev; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Channel this message is sent on / for (may be NULL for control messages). | 55 | * Channel this message is sent on / for (may be NULL for control messages). |
56 | */ | 56 | */ |
57 | struct GNUNET_CADET_Channel *channel; | 57 | struct GNUNET_CADET_Channel *channel; |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Request data task. | 60 | * Request data task. |
61 | */ | 61 | */ |
62 | struct GNUNET_SCHEDULER_Task *request_data_task; | 62 | struct GNUNET_SCHEDULER_Task *request_data_task; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Callback to obtain the message to transmit, or NULL if we | 65 | * Callback to obtain the message to transmit, or NULL if we |
66 | * got the message in 'data'. Notice that messages built | 66 | * got the message in 'data'. Notice that messages built |
67 | * by 'notify' need to be encapsulated with information about | 67 | * by 'notify' need to be encapsulated with information about |
68 | * the 'target'. | 68 | * the 'target'. |
69 | */ | 69 | */ |
70 | GNUNET_CONNECTION_TransmitReadyNotify notify; | 70 | GNUNET_CONNECTION_TransmitReadyNotify notify; |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Closure for 'notify' | 73 | * Closure for 'notify' |
74 | */ | 74 | */ |
75 | void *notify_cls; | 75 | void *notify_cls; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Size of the payload. | 78 | * Size of the payload. |
79 | */ | 79 | */ |
80 | size_t size; | 80 | size_t size; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | union CadetInfoCB { | 83 | |
84 | union CadetInfoCB | ||
85 | { | ||
84 | 86 | ||
85 | /** | 87 | /** |
86 | * Channel callback. | 88 | * Channel callback. |
@@ -114,14 +116,14 @@ union CadetInfoCB { | |||
114 | */ | 116 | */ |
115 | struct GNUNET_CADET_Handle | 117 | struct GNUNET_CADET_Handle |
116 | { | 118 | { |
117 | /** | 119 | /** |
118 | * Message queue (if available). | 120 | * Message queue (if available). |
119 | */ | 121 | */ |
120 | struct GNUNET_MQ_Handle *mq; | 122 | struct GNUNET_MQ_Handle *mq; |
121 | 123 | ||
122 | /** | 124 | /** |
123 | * Set of handlers used for processing incoming messages in the channels | 125 | * Set of handlers used for processing incoming messages in the channels |
124 | */ | 126 | */ |
125 | const struct GNUNET_CADET_MessageHandler *message_handlers; | 127 | const struct GNUNET_CADET_MessageHandler *message_handlers; |
126 | 128 | ||
127 | /** | 129 | /** |
@@ -134,40 +136,40 @@ struct GNUNET_CADET_Handle | |||
134 | */ | 136 | */ |
135 | struct GNUNET_CONTAINER_MultiHashMap *ports; | 137 | struct GNUNET_CONTAINER_MultiHashMap *ports; |
136 | 138 | ||
137 | /** | 139 | /** |
138 | * Double linked list of the channels this client is connected to, head. | 140 | * Double linked list of the channels this client is connected to, head. |
139 | */ | 141 | */ |
140 | struct GNUNET_CADET_Channel *channels_head; | 142 | struct GNUNET_CADET_Channel *channels_head; |
141 | 143 | ||
142 | /** | 144 | /** |
143 | * Double linked list of the channels this client is connected to, tail. | 145 | * Double linked list of the channels this client is connected to, tail. |
144 | */ | 146 | */ |
145 | struct GNUNET_CADET_Channel *channels_tail; | 147 | struct GNUNET_CADET_Channel *channels_tail; |
146 | 148 | ||
147 | /** | 149 | /** |
148 | * Callback for inbound channel disconnection | 150 | * Callback for inbound channel disconnection |
149 | */ | 151 | */ |
150 | GNUNET_CADET_ChannelEndHandler *cleaner; | 152 | GNUNET_CADET_ChannelEndHandler *cleaner; |
151 | 153 | ||
152 | /** | 154 | /** |
153 | * Closure for all the handlers given by the client | 155 | * Closure for all the handlers given by the client |
154 | */ | 156 | */ |
155 | void *cls; | 157 | void *cls; |
156 | 158 | ||
157 | /** | 159 | /** |
158 | * Messages to send to the service, head. | 160 | * Messages to send to the service, head. |
159 | */ | 161 | */ |
160 | struct GNUNET_CADET_TransmitHandle *th_head; | 162 | struct GNUNET_CADET_TransmitHandle *th_head; |
161 | 163 | ||
162 | /** | 164 | /** |
163 | * Messages to send to the service, tail. | 165 | * Messages to send to the service, tail. |
164 | */ | 166 | */ |
165 | struct GNUNET_CADET_TransmitHandle *th_tail; | 167 | struct GNUNET_CADET_TransmitHandle *th_tail; |
166 | 168 | ||
167 | /** | 169 | /** |
168 | * chid of the next channel to create (to avoid reusing IDs often) | 170 | * child of the next channel to create (to avoid reusing IDs often) |
169 | */ | 171 | */ |
170 | CADET_ChannelNumber next_chid; | 172 | struct GNUNET_CADET_ClientChannelNumber next_chid; |
171 | 173 | ||
172 | /** | 174 | /** |
173 | * Configuration given by the client, in case of reconnection | 175 | * Configuration given by the client, in case of reconnection |
@@ -201,9 +203,9 @@ struct GNUNET_CADET_Handle | |||
201 | */ | 203 | */ |
202 | struct GNUNET_CADET_Peer | 204 | struct GNUNET_CADET_Peer |
203 | { | 205 | { |
204 | /** | 206 | /** |
205 | * ID of the peer in short form | 207 | * ID of the peer in short form |
206 | */ | 208 | */ |
207 | GNUNET_PEER_Id id; | 209 | GNUNET_PEER_Id id; |
208 | 210 | ||
209 | /** | 211 | /** |
@@ -218,34 +220,34 @@ struct GNUNET_CADET_Peer | |||
218 | */ | 220 | */ |
219 | struct GNUNET_CADET_Channel | 221 | struct GNUNET_CADET_Channel |
220 | { | 222 | { |
221 | /** | 223 | /** |
222 | * DLL next | 224 | * DLL next |
223 | */ | 225 | */ |
224 | struct GNUNET_CADET_Channel *next; | 226 | struct GNUNET_CADET_Channel *next; |
225 | 227 | ||
226 | /** | 228 | /** |
227 | * DLL prev | 229 | * DLL prev |
228 | */ | 230 | */ |
229 | struct GNUNET_CADET_Channel *prev; | 231 | struct GNUNET_CADET_Channel *prev; |
230 | 232 | ||
231 | /** | 233 | /** |
232 | * Handle to the cadet this channel belongs to | 234 | * Handle to the cadet this channel belongs to |
233 | */ | 235 | */ |
234 | struct GNUNET_CADET_Handle *cadet; | 236 | struct GNUNET_CADET_Handle *cadet; |
235 | 237 | ||
236 | /** | 238 | /** |
237 | * Local ID of the channel | 239 | * Local ID of the channel |
238 | */ | 240 | */ |
239 | CADET_ChannelNumber chid; | 241 | struct GNUNET_CADET_ClientChannelNumber chid; |
240 | 242 | ||
241 | /** | 243 | /** |
242 | * Channel's port, if any. | 244 | * Channel's port, if any. |
243 | */ | 245 | */ |
244 | struct GNUNET_CADET_Port *port; | 246 | struct GNUNET_CADET_Port *port; |
245 | 247 | ||
246 | /** | 248 | /** |
247 | * Other end of the channel. | 249 | * Other end of the channel. |
248 | */ | 250 | */ |
249 | GNUNET_PEER_Id peer; | 251 | GNUNET_PEER_Id peer; |
250 | 252 | ||
251 | /** | 253 | /** |
@@ -253,46 +255,47 @@ struct GNUNET_CADET_Channel | |||
253 | */ | 255 | */ |
254 | void *ctx; | 256 | void *ctx; |
255 | 257 | ||
256 | /** | 258 | /** |
257 | * Size of packet queued in this channel | 259 | * Size of packet queued in this channel |
258 | */ | 260 | */ |
259 | unsigned int packet_size; | 261 | unsigned int packet_size; |
260 | 262 | ||
261 | /** | 263 | /** |
262 | * Channel options: reliability, etc. | 264 | * Channel options: reliability, etc. |
263 | */ | 265 | */ |
264 | enum GNUNET_CADET_ChannelOption options; | 266 | enum GNUNET_CADET_ChannelOption options; |
265 | 267 | ||
266 | /** | 268 | /** |
267 | * Are we allowed to send to the service? | 269 | * Are we allowed to send to the service? |
268 | */ | 270 | */ |
269 | int allow_send; | 271 | int allow_send; |
270 | 272 | ||
271 | }; | 273 | }; |
272 | 274 | ||
275 | |||
273 | /** | 276 | /** |
274 | * Opaque handle to a port. | 277 | * Opaque handle to a port. |
275 | */ | 278 | */ |
276 | struct GNUNET_CADET_Port | 279 | struct GNUNET_CADET_Port |
277 | { | 280 | { |
278 | /** | 281 | /** |
279 | * Handle to the CADET session this port belongs to. | 282 | * Handle to the CADET session this port belongs to. |
280 | */ | 283 | */ |
281 | struct GNUNET_CADET_Handle *cadet; | 284 | struct GNUNET_CADET_Handle *cadet; |
282 | 285 | ||
283 | /** | 286 | /** |
284 | * Port ID. | 287 | * Port ID. |
285 | */ | 288 | */ |
286 | struct GNUNET_HashCode *hash; | 289 | struct GNUNET_HashCode *hash; |
287 | 290 | ||
288 | /** | 291 | /** |
289 | * Callback handler for incoming channels on this port. | 292 | * Callback handler for incoming channels on this port. |
290 | */ | 293 | */ |
291 | GNUNET_CADET_InboundChannelNotificationHandler *handler; | 294 | GNUNET_CADET_InboundChannelNotificationHandler *handler; |
292 | 295 | ||
293 | /** | 296 | /** |
294 | * Closure for @a handler. | 297 | * Closure for @a handler. |
295 | */ | 298 | */ |
296 | void *cls; | 299 | void *cls; |
297 | }; | 300 | }; |
298 | 301 | ||
@@ -356,22 +359,20 @@ find_port (const struct GNUNET_CADET_Handle *h, | |||
356 | 359 | ||
357 | /** | 360 | /** |
358 | * Get the channel handler for the channel specified by id from the given handle | 361 | * Get the channel handler for the channel specified by id from the given handle |
362 | * | ||
359 | * @param h Cadet handle | 363 | * @param h Cadet handle |
360 | * @param chid ID of the wanted channel | 364 | * @param chid ID of the wanted channel |
361 | * @return handle to the required channel or NULL if not found | 365 | * @return handle to the required channel or NULL if not found |
362 | */ | 366 | */ |
363 | static struct GNUNET_CADET_Channel * | 367 | static struct GNUNET_CADET_Channel * |
364 | retrieve_channel (struct GNUNET_CADET_Handle *h, CADET_ChannelNumber chid) | 368 | retrieve_channel (struct GNUNET_CADET_Handle *h, |
369 | struct GNUNET_CADET_ClientChannelNumber chid) | ||
365 | { | 370 | { |
366 | struct GNUNET_CADET_Channel *ch; | 371 | struct GNUNET_CADET_Channel *ch; |
367 | 372 | ||
368 | ch = h->channels_head; | 373 | for (ch = h->channels_head; NULL != ch; ch = ch->next) |
369 | while (ch != NULL) | 374 | if (ch->chid.channel_of_client == chid.channel_of_client) |
370 | { | ||
371 | if (ch->chid == chid) | ||
372 | return ch; | 375 | return ch; |
373 | ch = ch->next; | ||
374 | } | ||
375 | return NULL; | 376 | return NULL; |
376 | } | 377 | } |
377 | 378 | ||
@@ -385,21 +386,27 @@ retrieve_channel (struct GNUNET_CADET_Handle *h, CADET_ChannelNumber chid) | |||
385 | * @return Handle to the created channel. | 386 | * @return Handle to the created channel. |
386 | */ | 387 | */ |
387 | static struct GNUNET_CADET_Channel * | 388 | static struct GNUNET_CADET_Channel * |
388 | create_channel (struct GNUNET_CADET_Handle *h, CADET_ChannelNumber chid) | 389 | create_channel (struct GNUNET_CADET_Handle *h, |
390 | struct GNUNET_CADET_ClientChannelNumber chid) | ||
389 | { | 391 | { |
390 | struct GNUNET_CADET_Channel *ch; | 392 | struct GNUNET_CADET_Channel *ch; |
391 | 393 | ||
392 | ch = GNUNET_new (struct GNUNET_CADET_Channel); | 394 | ch = GNUNET_new (struct GNUNET_CADET_Channel); |
393 | GNUNET_CONTAINER_DLL_insert (h->channels_head, h->channels_tail, ch); | 395 | GNUNET_CONTAINER_DLL_insert (h->channels_head, |
396 | h->channels_tail, | ||
397 | ch); | ||
394 | ch->cadet = h; | 398 | ch->cadet = h; |
395 | if (0 == chid) | 399 | if (0 == chid.channel_of_client) |
396 | { | 400 | { |
397 | ch->chid = h->next_chid; | 401 | ch->chid = h->next_chid; |
398 | while (NULL != retrieve_channel (h, h->next_chid)) | 402 | while (NULL != retrieve_channel (h, |
403 | h->next_chid)) | ||
399 | { | 404 | { |
400 | h->next_chid++; | 405 | h->next_chid.channel_of_client |
401 | h->next_chid &= ~GNUNET_CADET_LOCAL_CHANNEL_ID_SERV; | 406 | = htonl (1 + ntohl (h->next_chid.channel_of_client)); |
402 | h->next_chid |= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; | 407 | if (0 == ntohl (h->next_chid.channel_of_client)) |
408 | h->next_chid.channel_of_client | ||
409 | = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | ||
403 | } | 410 | } |
404 | } | 411 | } |
405 | else | 412 | else |
@@ -440,7 +447,9 @@ destroy_channel (struct GNUNET_CADET_Channel *ch, int call_cleaner) | |||
440 | } | 447 | } |
441 | h = ch->cadet; | 448 | h = ch->cadet; |
442 | 449 | ||
443 | GNUNET_CONTAINER_DLL_remove (h->channels_head, h->channels_tail, ch); | 450 | GNUNET_CONTAINER_DLL_remove (h->channels_head, |
451 | h->channels_tail, | ||
452 | ch); | ||
444 | 453 | ||
445 | /* signal channel destruction */ | 454 | /* signal channel destruction */ |
446 | if ( (NULL != h->cleaner) && (0 != ch->peer) && (GNUNET_YES == call_cleaner) ) | 455 | if ( (NULL != h->cleaner) && (0 != ch->peer) && (GNUNET_YES == call_cleaner) ) |
@@ -466,7 +475,7 @@ destroy_channel (struct GNUNET_CADET_Channel *ch, int call_cleaner) | |||
466 | if (0 != ch->peer) | 475 | if (0 != ch->peer) |
467 | GNUNET_PEER_change_rc (ch->peer, -1); | 476 | GNUNET_PEER_change_rc (ch->peer, -1); |
468 | GNUNET_free (ch); | 477 | GNUNET_free (ch); |
469 | return; | 478 | |
470 | } | 479 | } |
471 | 480 | ||
472 | 481 | ||
@@ -516,13 +525,15 @@ send_ack (struct GNUNET_CADET_Channel *ch) | |||
516 | struct GNUNET_CADET_LocalAck *msg; | 525 | struct GNUNET_CADET_LocalAck *msg; |
517 | struct GNUNET_MQ_Envelope *env; | 526 | struct GNUNET_MQ_Envelope *env; |
518 | 527 | ||
519 | env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); | 528 | env = GNUNET_MQ_msg (msg, |
520 | 529 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); | |
521 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending ACK on channel %X\n", ch->chid); | ||
522 | msg->channel_id = htonl (ch->chid); | ||
523 | GNUNET_MQ_send (ch->cadet->mq, env); | ||
524 | 530 | ||
525 | return; | 531 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
532 | "Sending ACK on channel %X\n", | ||
533 | ch->chid.channel_of_client); | ||
534 | msg->channel_id = ch->chid; | ||
535 | GNUNET_MQ_send (ch->cadet->mq, | ||
536 | env); | ||
526 | } | 537 | } |
527 | 538 | ||
528 | 539 | ||
@@ -555,13 +566,16 @@ request_data (void *cls) | |||
555 | th->channel->packet_size = 0; | 566 | th->channel->packet_size = 0; |
556 | remove_from_queue (th); | 567 | remove_from_queue (th); |
557 | 568 | ||
558 | env = GNUNET_MQ_msg_extra (msg, th->size, | 569 | env = GNUNET_MQ_msg_extra (msg, |
570 | th->size, | ||
559 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); | 571 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); |
560 | msg->id = htonl (th->channel->chid); | 572 | msg->id = th->channel->chid; |
561 | osize = th->notify (th->notify_cls, th->size, &msg[1]); | 573 | osize = th->notify (th->notify_cls, |
574 | th->size, | ||
575 | &msg[1]); | ||
562 | GNUNET_assert (osize == th->size); | 576 | GNUNET_assert (osize == th->size); |
563 | GNUNET_MQ_send (th->channel->cadet->mq, env); | 577 | GNUNET_MQ_send (th->channel->cadet->mq, |
564 | 578 | env); | |
565 | GNUNET_free (th); | 579 | GNUNET_free (th); |
566 | } | 580 | } |
567 | 581 | ||
@@ -574,19 +588,21 @@ request_data (void *cls) | |||
574 | */ | 588 | */ |
575 | static void | 589 | static void |
576 | handle_channel_created (void *cls, | 590 | handle_channel_created (void *cls, |
577 | const struct GNUNET_CADET_ChannelCreateMessage *msg) | 591 | const struct GNUNET_CADET_ChannelOpenMessageMessage *msg) |
578 | { | 592 | { |
579 | struct GNUNET_CADET_Handle *h = cls; | 593 | struct GNUNET_CADET_Handle *h = cls; |
580 | struct GNUNET_CADET_Channel *ch; | 594 | struct GNUNET_CADET_Channel *ch; |
581 | struct GNUNET_CADET_Port *port; | 595 | struct GNUNET_CADET_Port *port; |
582 | const struct GNUNET_HashCode *port_number; | 596 | const struct GNUNET_HashCode *port_number; |
583 | CADET_ChannelNumber chid; | 597 | struct GNUNET_CADET_ClientChannelNumber chid; |
584 | 598 | ||
585 | chid = ntohl (msg->channel_id); | 599 | chid = msg->channel_id; |
586 | port_number = &msg->port; | 600 | port_number = &msg->port; |
587 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating incoming channel %X [%s]\n", | 601 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
588 | chid, GNUNET_h2s (port_number)); | 602 | "Creating incoming channel %X [%s]\n", |
589 | if (chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV) | 603 | ntohl (chid.channel_of_client), |
604 | GNUNET_h2s (port_number)); | ||
605 | if (ntohl (chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
590 | { | 606 | { |
591 | GNUNET_break (0); | 607 | GNUNET_break (0); |
592 | return; | 608 | return; |
@@ -636,18 +652,24 @@ handle_channel_destroy (void *cls, | |||
636 | { | 652 | { |
637 | struct GNUNET_CADET_Handle *h = cls; | 653 | struct GNUNET_CADET_Handle *h = cls; |
638 | struct GNUNET_CADET_Channel *ch; | 654 | struct GNUNET_CADET_Channel *ch; |
639 | CADET_ChannelNumber chid; | 655 | struct GNUNET_CADET_ClientChannelNumber chid; |
640 | 656 | ||
641 | chid = ntohl (msg->channel_id); | 657 | chid = msg->channel_id; |
642 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %X Destroy from service\n", chid); | 658 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
643 | ch = retrieve_channel (h, chid); | 659 | "Channel %X Destroy from service\n", |
660 | ntohl (chid.channel_of_client)); | ||
661 | ch = retrieve_channel (h, | ||
662 | chid); | ||
644 | 663 | ||
645 | if (NULL == ch) | 664 | if (NULL == ch) |
646 | { | 665 | { |
647 | LOG (GNUNET_ERROR_TYPE_DEBUG, "channel %X unknown\n", chid); | 666 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
667 | "channel %X unknown\n", | ||
668 | ntohl (chid.channel_of_client)); | ||
648 | return; | 669 | return; |
649 | } | 670 | } |
650 | destroy_channel (ch, GNUNET_YES); | 671 | destroy_channel (ch, |
672 | GNUNET_YES); | ||
651 | } | 673 | } |
652 | 674 | ||
653 | 675 | ||
@@ -674,7 +696,8 @@ check_local_data (void *cls, | |||
674 | return GNUNET_SYSERR; | 696 | return GNUNET_SYSERR; |
675 | } | 697 | } |
676 | 698 | ||
677 | ch = retrieve_channel (h, ntohl (message->id)); | 699 | ch = retrieve_channel (h, |
700 | message->id); | ||
678 | if (NULL == ch) | 701 | if (NULL == ch) |
679 | { | 702 | { |
680 | GNUNET_break_op (0); | 703 | GNUNET_break_op (0); |
@@ -702,14 +725,17 @@ handle_local_data (void *cls, | |||
702 | unsigned int i; | 725 | unsigned int i; |
703 | uint16_t type; | 726 | uint16_t type; |
704 | 727 | ||
705 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a data message!\n"); | 728 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
706 | ch = retrieve_channel (h, ntohl (message->id)); | 729 | "Got a data message!\n"); |
730 | ch = retrieve_channel (h, message->id); | ||
707 | GNUNET_assert (NULL != ch); | 731 | GNUNET_assert (NULL != ch); |
708 | 732 | ||
709 | payload = (struct GNUNET_MessageHeader *) &message[1]; | 733 | payload = (struct GNUNET_MessageHeader *) &message[1]; |
710 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n", | 734 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n", |
711 | GC_f2s (ch->chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV), | 735 | GC_f2s (ntohl (ch->chid.channel_of_client) >= |
712 | GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), ntohl (message->id)); | 736 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI), |
737 | GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), | ||
738 | ntohl (message->id.channel_of_client)); | ||
713 | 739 | ||
714 | type = ntohs (payload->type); | 740 | type = ntohs (payload->type); |
715 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %s\n", GC_m2s (type)); | 741 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %s\n", GC_m2s (type)); |
@@ -751,17 +777,21 @@ handle_local_ack (void *cls, | |||
751 | { | 777 | { |
752 | struct GNUNET_CADET_Handle *h = cls; | 778 | struct GNUNET_CADET_Handle *h = cls; |
753 | struct GNUNET_CADET_Channel *ch; | 779 | struct GNUNET_CADET_Channel *ch; |
754 | CADET_ChannelNumber chid; | 780 | struct GNUNET_CADET_ClientChannelNumber chid; |
755 | 781 | ||
756 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK!\n"); | 782 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK!\n"); |
757 | chid = ntohl (message->channel_id); | 783 | chid = message->channel_id; |
758 | ch = retrieve_channel (h, chid); | 784 | ch = retrieve_channel (h, chid); |
759 | if (NULL == ch) | 785 | if (NULL == ch) |
760 | { | 786 | { |
761 | LOG (GNUNET_ERROR_TYPE_DEBUG, "ACK on unknown channel %X\n", chid); | 787 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
788 | "ACK on unknown channel %X\n", | ||
789 | ntohl (chid.channel_of_client)); | ||
762 | return; | 790 | return; |
763 | } | 791 | } |
764 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X!\n", ch->chid); | 792 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
793 | " on channel %X!\n", | ||
794 | ntohl (ch->chid.channel_of_client)); | ||
765 | ch->allow_send = GNUNET_YES; | 795 | ch->allow_send = GNUNET_YES; |
766 | if (0 < ch->packet_size) | 796 | if (0 < ch->packet_size) |
767 | { | 797 | { |
@@ -1132,9 +1162,12 @@ handle_get_tunnels (void *cls, | |||
1132 | { | 1162 | { |
1133 | struct GNUNET_CADET_Handle *h = cls; | 1163 | struct GNUNET_CADET_Handle *h = cls; |
1134 | 1164 | ||
1135 | h->info_cb.tunnels_cb (h->info_cls, &msg->destination, | 1165 | h->info_cb.tunnels_cb (h->info_cls, |
1136 | ntohl (msg->channels), ntohl (msg->connections), | 1166 | &msg->destination, |
1137 | ntohs (msg->estate), ntohs (msg->cstate)); | 1167 | ntohl (msg->channels), |
1168 | ntohl (msg->connections), | ||
1169 | ntohs (msg->estate), | ||
1170 | ntohs (msg->cstate)); | ||
1138 | 1171 | ||
1139 | } | 1172 | } |
1140 | 1173 | ||
@@ -1170,13 +1203,14 @@ check_get_tunnel (void *cls, | |||
1170 | if (esize > msize) | 1203 | if (esize > msize) |
1171 | { | 1204 | { |
1172 | GNUNET_break_op (0); | 1205 | GNUNET_break_op (0); |
1173 | h->info_cb.tunnel_cb (h->info_cls, NULL, 0, 0, NULL, NULL, 0, 0); | 1206 | h->info_cb.tunnel_cb (h->info_cls, |
1207 | NULL, 0, 0, NULL, NULL, 0, 0); | ||
1174 | goto clean_cls; | 1208 | goto clean_cls; |
1175 | } | 1209 | } |
1176 | ch_n = ntohl (msg->channels); | 1210 | ch_n = ntohl (msg->channels); |
1177 | c_n = ntohl (msg->connections); | 1211 | c_n = ntohl (msg->connections); |
1178 | esize += ch_n * sizeof (CADET_ChannelNumber); | 1212 | esize += ch_n * sizeof (struct GNUNET_CADET_ChannelTunnelNumber); |
1179 | esize += c_n * sizeof (struct GNUNET_CADET_Hash); | 1213 | esize += c_n * sizeof (struct GNUNET_CADET_ConnectionTunnelIdentifier); |
1180 | if (msize != esize) | 1214 | if (msize != esize) |
1181 | { | 1215 | { |
1182 | GNUNET_break_op (0); | 1216 | GNUNET_break_op (0); |
@@ -1186,7 +1220,8 @@ check_get_tunnel (void *cls, | |||
1186 | (unsigned int) esize, | 1220 | (unsigned int) esize, |
1187 | ch_n, | 1221 | ch_n, |
1188 | c_n); | 1222 | c_n); |
1189 | h->info_cb.tunnel_cb (h->info_cls, NULL, 0, 0, NULL, NULL, 0, 0); | 1223 | h->info_cb.tunnel_cb (h->info_cls, |
1224 | NULL, 0, 0, NULL, NULL, 0, 0); | ||
1190 | goto clean_cls; | 1225 | goto clean_cls; |
1191 | } | 1226 | } |
1192 | 1227 | ||
@@ -1212,18 +1247,23 @@ handle_get_tunnel (void *cls, | |||
1212 | struct GNUNET_CADET_Handle *h = cls; | 1247 | struct GNUNET_CADET_Handle *h = cls; |
1213 | unsigned int ch_n; | 1248 | unsigned int ch_n; |
1214 | unsigned int c_n; | 1249 | unsigned int c_n; |
1215 | struct GNUNET_CADET_Hash *conns; | 1250 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *conns; |
1216 | CADET_ChannelNumber *chns; | 1251 | const struct GNUNET_CADET_ChannelTunnelNumber *chns; |
1217 | 1252 | ||
1218 | ch_n = ntohl (msg->channels); | 1253 | ch_n = ntohl (msg->channels); |
1219 | c_n = ntohl (msg->connections); | 1254 | c_n = ntohl (msg->connections); |
1220 | 1255 | ||
1221 | /* Call Callback with tunnel info. */ | 1256 | /* Call Callback with tunnel info. */ |
1222 | conns = (struct GNUNET_CADET_Hash *) &msg[1]; | 1257 | conns = (const struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1]; |
1223 | chns = (CADET_ChannelNumber *) &conns[c_n]; | 1258 | chns = (const struct GNUNET_CADET_ChannelTunnelNumber *) &conns[c_n]; |
1224 | h->info_cb.tunnel_cb (h->info_cls, &msg->destination, | 1259 | h->info_cb.tunnel_cb (h->info_cls, |
1225 | ch_n, c_n, chns, conns, | 1260 | &msg->destination, |
1226 | ntohs (msg->estate), ntohs (msg->cstate)); | 1261 | ch_n, |
1262 | c_n, | ||
1263 | chns, | ||
1264 | conns, | ||
1265 | ntohs (msg->estate), | ||
1266 | ntohs (msg->cstate)); | ||
1227 | } | 1267 | } |
1228 | 1268 | ||
1229 | 1269 | ||
@@ -1241,8 +1281,8 @@ do_reconnect (struct GNUNET_CADET_Handle *h) | |||
1241 | { | 1281 | { |
1242 | struct GNUNET_MQ_MessageHandler handlers[] = { | 1282 | struct GNUNET_MQ_MessageHandler handlers[] = { |
1243 | GNUNET_MQ_hd_fixed_size (channel_created, | 1283 | GNUNET_MQ_hd_fixed_size (channel_created, |
1244 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE, | 1284 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN, |
1245 | struct GNUNET_CADET_ChannelCreateMessage, | 1285 | struct GNUNET_CADET_ChannelOpenMessageMessage, |
1246 | h), | 1286 | h), |
1247 | GNUNET_MQ_hd_fixed_size (channel_destroy, | 1287 | GNUNET_MQ_hd_fixed_size (channel_destroy, |
1248 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, | 1288 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, |
@@ -1274,7 +1314,7 @@ do_reconnect (struct GNUNET_CADET_Handle *h) | |||
1274 | h), | 1314 | h), |
1275 | // FIXME | 1315 | // FIXME |
1276 | // GNUNET_MQ_hd_fixed_Y size (channel_destroyed, | 1316 | // GNUNET_MQ_hd_fixed_Y size (channel_destroyed, |
1277 | // GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK, | 1317 | // GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED, |
1278 | // struct GNUNET_CADET_ChannelDestroyMessage); | 1318 | // struct GNUNET_CADET_ChannelDestroyMessage); |
1279 | GNUNET_MQ_handler_end () | 1319 | GNUNET_MQ_handler_end () |
1280 | }; | 1320 | }; |
@@ -1282,7 +1322,7 @@ do_reconnect (struct GNUNET_CADET_Handle *h) | |||
1282 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to CADET\n"); | 1322 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to CADET\n"); |
1283 | 1323 | ||
1284 | GNUNET_assert (NULL == h->mq); | 1324 | GNUNET_assert (NULL == h->mq); |
1285 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 1325 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
1286 | "cadet", | 1326 | "cadet", |
1287 | handlers, | 1327 | handlers, |
1288 | &handle_mq_error, | 1328 | &handle_mq_error, |
@@ -1343,9 +1383,10 @@ reconnect (struct GNUNET_CADET_Handle *h) | |||
1343 | /******************************************************************************/ | 1383 | /******************************************************************************/ |
1344 | 1384 | ||
1345 | struct GNUNET_CADET_Handle * | 1385 | struct GNUNET_CADET_Handle * |
1346 | GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, | 1386 | GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1347 | GNUNET_CADET_ChannelEndHandler cleaner, | 1387 | void *cls, |
1348 | const struct GNUNET_CADET_MessageHandler *handlers) | 1388 | GNUNET_CADET_ChannelEndHandler cleaner, |
1389 | const struct GNUNET_CADET_MessageHandler *handlers) | ||
1349 | { | 1390 | { |
1350 | struct GNUNET_CADET_Handle *h; | 1391 | struct GNUNET_CADET_Handle *h; |
1351 | 1392 | ||
@@ -1364,7 +1405,7 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, | |||
1364 | } | 1405 | } |
1365 | h->cls = cls; | 1406 | h->cls = cls; |
1366 | h->message_handlers = handlers; | 1407 | h->message_handlers = handlers; |
1367 | h->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; | 1408 | h->next_chid.channel_of_client = htonl (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); |
1368 | h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; | 1409 | h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; |
1369 | h->reconnect_task = NULL; | 1410 | h->reconnect_task = NULL; |
1370 | 1411 | ||
@@ -1384,21 +1425,24 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle) | |||
1384 | struct GNUNET_CADET_Channel *aux; | 1425 | struct GNUNET_CADET_Channel *aux; |
1385 | struct GNUNET_CADET_TransmitHandle *th; | 1426 | struct GNUNET_CADET_TransmitHandle *th; |
1386 | 1427 | ||
1387 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET DISCONNECT\n"); | 1428 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1388 | 1429 | "CADET DISCONNECT\n"); | |
1389 | ch = handle->channels_head; | 1430 | ch = handle->channels_head; |
1390 | while (NULL != ch) | 1431 | while (NULL != ch) |
1391 | { | 1432 | { |
1392 | aux = ch->next; | 1433 | aux = ch->next; |
1393 | if (ch->chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV) | 1434 | if (ntohl (ch->chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) |
1394 | { | 1435 | { |
1395 | GNUNET_break (0); | 1436 | GNUNET_break (0); |
1396 | LOG (GNUNET_ERROR_TYPE_DEBUG, "channel %X not destroyed\n", ch->chid); | 1437 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1438 | "channel %X not destroyed\n", | ||
1439 | ntohl (ch->chid.channel_of_client)); | ||
1397 | } | 1440 | } |
1398 | destroy_channel (ch, GNUNET_YES); | 1441 | destroy_channel (ch, |
1442 | GNUNET_YES); | ||
1399 | ch = aux; | 1443 | ch = aux; |
1400 | } | 1444 | } |
1401 | while ( (th = handle->th_head) != NULL) | 1445 | while (NULL != (th = handle->th_head)) |
1402 | { | 1446 | { |
1403 | struct GNUNET_MessageHeader *msg; | 1447 | struct GNUNET_MessageHeader *msg; |
1404 | 1448 | ||
@@ -1409,7 +1453,7 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle) | |||
1409 | msg = (struct GNUNET_MessageHeader *) &th[1]; | 1453 | msg = (struct GNUNET_MessageHeader *) &th[1]; |
1410 | switch (ntohs(msg->type)) | 1454 | switch (ntohs(msg->type)) |
1411 | { | 1455 | { |
1412 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: | 1456 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: |
1413 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: | 1457 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
1414 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN: | 1458 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN: |
1415 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE: | 1459 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE: |
@@ -1531,27 +1575,30 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, | |||
1531 | const struct GNUNET_HashCode *port, | 1575 | const struct GNUNET_HashCode *port, |
1532 | enum GNUNET_CADET_ChannelOption options) | 1576 | enum GNUNET_CADET_ChannelOption options) |
1533 | { | 1577 | { |
1534 | struct GNUNET_CADET_ChannelCreateMessage *msg; | 1578 | struct GNUNET_CADET_ChannelOpenMessageMessage *msg; |
1535 | struct GNUNET_MQ_Envelope *env; | 1579 | struct GNUNET_MQ_Envelope *env; |
1536 | struct GNUNET_CADET_Channel *ch; | 1580 | struct GNUNET_CADET_Channel *ch; |
1581 | struct GNUNET_CADET_ClientChannelNumber chid; | ||
1537 | 1582 | ||
1538 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1583 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1539 | "Creating new channel to %s:%u\n", | 1584 | "Creating new channel to %s:%u\n", |
1540 | GNUNET_i2s (peer), port); | 1585 | GNUNET_i2s (peer), port); |
1541 | ch = create_channel (h, 0); | 1586 | chid.channel_of_client = htonl (0); |
1587 | ch = create_channel (h, chid); | ||
1542 | LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", ch); | 1588 | LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", ch); |
1543 | LOG (GNUNET_ERROR_TYPE_DEBUG, " number %X\n", ch->chid); | 1589 | LOG (GNUNET_ERROR_TYPE_DEBUG, " number %X\n", |
1590 | ntohl (ch->chid.channel_of_client)); | ||
1544 | ch->ctx = channel_ctx; | 1591 | ch->ctx = channel_ctx; |
1545 | ch->peer = GNUNET_PEER_intern (peer); | 1592 | ch->peer = GNUNET_PEER_intern (peer); |
1546 | 1593 | ||
1547 | env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); | 1594 | env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); |
1548 | msg->channel_id = htonl (ch->chid); | 1595 | msg->channel_id = ch->chid; |
1549 | msg->port = *port; | 1596 | msg->port = *port; |
1550 | msg->peer = *peer; | 1597 | msg->peer = *peer; |
1551 | msg->opt = htonl (options); | 1598 | msg->opt = htonl (options); |
1552 | ch->allow_send = GNUNET_NO; | 1599 | ch->allow_send = GNUNET_NO; |
1553 | GNUNET_MQ_send (h->mq, env); | 1600 | GNUNET_MQ_send (h->mq, |
1554 | 1601 | env); | |
1555 | return ch; | 1602 | return ch; |
1556 | } | 1603 | } |
1557 | 1604 | ||
@@ -1590,7 +1637,7 @@ GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel) | |||
1590 | } | 1637 | } |
1591 | 1638 | ||
1592 | env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); | 1639 | env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); |
1593 | msg->channel_id = htonl (channel->chid); | 1640 | msg->channel_id = channel->chid; |
1594 | GNUNET_MQ_send (h->mq, env); | 1641 | GNUNET_MQ_send (h->mq, env); |
1595 | 1642 | ||
1596 | destroy_channel (channel, GNUNET_YES); | 1643 | destroy_channel (channel, GNUNET_YES); |
@@ -1617,7 +1664,7 @@ GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, | |||
1617 | { | 1664 | { |
1618 | case GNUNET_CADET_OPTION_NOBUFFER: | 1665 | case GNUNET_CADET_OPTION_NOBUFFER: |
1619 | case GNUNET_CADET_OPTION_RELIABLE: | 1666 | case GNUNET_CADET_OPTION_RELIABLE: |
1620 | case GNUNET_CADET_OPTION_OOORDER: | 1667 | case GNUNET_CADET_OPTION_OUT_OF_ORDER: |
1621 | if (0 != (option & channel->options)) | 1668 | if (0 != (option & channel->options)) |
1622 | bool_flag = GNUNET_YES; | 1669 | bool_flag = GNUNET_YES; |
1623 | else | 1670 | else |
@@ -1651,7 +1698,8 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, | |||
1651 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY\n"); | 1698 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY\n"); |
1652 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->chid); | 1699 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->chid); |
1653 | LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send); | 1700 | LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send); |
1654 | if (channel->chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV) | 1701 | if (ntohl (channel->chid.channel_of_client) >= |
1702 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
1655 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to origin\n"); | 1703 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to origin\n"); |
1656 | else | 1704 | else |
1657 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to destination\n"); | 1705 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to destination\n"); |
@@ -1946,7 +1994,7 @@ GNUNET_CADET_show_channel (struct GNUNET_CADET_Handle *h, | |||
1946 | 1994 | ||
1947 | env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL); | 1995 | env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL); |
1948 | msg->peer = *initiator; | 1996 | msg->peer = *initiator; |
1949 | msg->channel_id = htonl (channel_number); | 1997 | msg->channel_id.channel_of_client = htonl (channel_number); |
1950 | GNUNET_MQ_send (h->mq, env); | 1998 | GNUNET_MQ_send (h->mq, env); |
1951 | 1999 | ||
1952 | h->info_cb.channel_cb = callback; | 2000 | h->info_cb.channel_cb = callback; |
diff --git a/src/cadet/cadet_common.c b/src/cadet/cadet_common.c index a9d9a35be..95a3144e4 100644 --- a/src/cadet/cadet_common.c +++ b/src/cadet/cadet_common.c | |||
@@ -51,11 +51,20 @@ GC_f2s (int fwd) | |||
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | |||
55 | /** | ||
56 | * Test if @a bigger is larger than @a smaller. | ||
57 | * Considers the case that @a bigger just overflowed | ||
58 | * and is thus tiny while @a smaller is still below | ||
59 | * `UINT32_MAX`. | ||
60 | */ | ||
54 | int | 61 | int |
55 | GC_is_pid_bigger (uint32_t bigger, uint32_t smaller) | 62 | GC_is_pid_bigger (uint32_t bigger, |
63 | uint32_t smaller) | ||
56 | { | 64 | { |
57 | return (GNUNET_YES == PID_OVERFLOW (smaller, bigger) || | 65 | return (PID_OVERFLOW (smaller, bigger) || |
58 | (bigger > smaller && GNUNET_NO == PID_OVERFLOW (bigger, smaller))); | 66 | ( (bigger > smaller) && |
67 | (! PID_OVERFLOW (bigger, smaller))) ); | ||
59 | } | 68 | } |
60 | 69 | ||
61 | 70 | ||
@@ -77,28 +86,6 @@ GC_min_pid (uint32_t a, uint32_t b) | |||
77 | } | 86 | } |
78 | 87 | ||
79 | 88 | ||
80 | const struct GNUNET_HashCode * | ||
81 | GC_h2hc (const struct GNUNET_CADET_Hash *id) | ||
82 | { | ||
83 | static struct GNUNET_HashCode hc; | ||
84 | GNUNET_memcpy (&hc, id, sizeof (*id)); | ||
85 | |||
86 | return &hc; | ||
87 | } | ||
88 | |||
89 | |||
90 | const char * | ||
91 | GC_h2s (const struct GNUNET_CADET_Hash *id) | ||
92 | { | ||
93 | static char s[53]; | ||
94 | |||
95 | GNUNET_memcpy (s, GNUNET_h2s_full (GC_h2hc (id)), 52); | ||
96 | s[52] = '\0'; | ||
97 | |||
98 | return s; | ||
99 | } | ||
100 | |||
101 | |||
102 | /** | 89 | /** |
103 | * Allocate a string with a hexdump of any binary data. | 90 | * Allocate a string with a hexdump of any binary data. |
104 | * | 91 | * |
@@ -159,7 +146,7 @@ GC_m2s (uint16_t m) | |||
159 | /** | 146 | /** |
160 | * Request the modification of an existing path | 147 | * Request the modification of an existing path |
161 | */ | 148 | */ |
162 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: | 149 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK: |
163 | s = "CONN_ACK"; | 150 | s = "CONN_ACK"; |
164 | break; | 151 | break; |
165 | 152 | ||
@@ -173,35 +160,35 @@ GC_m2s (uint16_t m) | |||
173 | /** | 160 | /** |
174 | * At some point, the route will spontaneously change | 161 | * At some point, the route will spontaneously change |
175 | */ | 162 | */ |
176 | case GNUNET_MESSAGE_TYPE_CADET_PATH_CHANGED: | 163 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_PATH_CHANGED_UNIMPLEMENTED: |
177 | s = "PATH_CHNGD"; | 164 | s = "PATH_CHNGD"; |
178 | break; | 165 | break; |
179 | 166 | ||
180 | /** | 167 | /** |
181 | * Transport payload data. | 168 | * Transport payload data. |
182 | */ | 169 | */ |
183 | case GNUNET_MESSAGE_TYPE_CADET_DATA: | 170 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: |
184 | s = "DATA"; | 171 | s = "DATA"; |
185 | break; | 172 | break; |
186 | 173 | ||
187 | /** | 174 | /** |
188 | * Confirm receipt of payload data. | 175 | * Confirm receipt of payload data. |
189 | */ | 176 | */ |
190 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: | 177 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: |
191 | s = "DATA_ACK"; | 178 | s = "DATA_ACK"; |
192 | break; | 179 | break; |
193 | 180 | ||
194 | /** | 181 | /** |
195 | * Key exchange message. | 182 | * Key exchange message. |
196 | */ | 183 | */ |
197 | case GNUNET_MESSAGE_TYPE_CADET_KX: | 184 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX: |
198 | s = "KX"; | 185 | s = "KX"; |
199 | break; | 186 | break; |
200 | 187 | ||
201 | /** | 188 | /** |
202 | * Encrypted. | 189 | * Encrypted. |
203 | */ | 190 | */ |
204 | case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: | 191 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED: |
205 | s = "ENCRYPTED"; | 192 | s = "ENCRYPTED"; |
206 | break; | 193 | break; |
207 | 194 | ||
@@ -215,21 +202,21 @@ GC_m2s (uint16_t m) | |||
215 | /** | 202 | /** |
216 | * ACK for a data packet. | 203 | * ACK for a data packet. |
217 | */ | 204 | */ |
218 | case GNUNET_MESSAGE_TYPE_CADET_ACK: | 205 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK: |
219 | s = "ACK"; | 206 | s = "ACK"; |
220 | break; | 207 | break; |
221 | 208 | ||
222 | /** | 209 | /** |
223 | * POLL for ACK. | 210 | * POLL for ACK. |
224 | */ | 211 | */ |
225 | case GNUNET_MESSAGE_TYPE_CADET_POLL: | 212 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL: |
226 | s = "POLL"; | 213 | s = "POLL"; |
227 | break; | 214 | break; |
228 | 215 | ||
229 | /** | 216 | /** |
230 | * Announce origin is still alive. | 217 | * Announce origin is still alive. |
231 | */ | 218 | */ |
232 | case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE: | 219 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE: |
233 | s = "KEEPALIVE"; | 220 | s = "KEEPALIVE"; |
234 | break; | 221 | break; |
235 | 222 | ||
@@ -250,7 +237,7 @@ GC_m2s (uint16_t m) | |||
250 | /** | 237 | /** |
251 | * Ask the cadet service to create a new tunnel | 238 | * Ask the cadet service to create a new tunnel |
252 | */ | 239 | */ |
253 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: | 240 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: |
254 | s = "CHAN_CREAT"; | 241 | s = "CHAN_CREAT"; |
255 | break; | 242 | break; |
256 | 243 | ||
@@ -264,14 +251,14 @@ GC_m2s (uint16_t m) | |||
264 | /** | 251 | /** |
265 | * Confirm the creation of a channel. | 252 | * Confirm the creation of a channel. |
266 | */ | 253 | */ |
267 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: | 254 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: |
268 | s = "CHAN_ACK"; | 255 | s = "CHAN_ACK"; |
269 | break; | 256 | break; |
270 | 257 | ||
271 | /** | 258 | /** |
272 | * Confirm the creation of a channel. | 259 | * Confirm the creation of a channel. |
273 | */ | 260 | */ |
274 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: | 261 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: |
275 | s = "CHAN_NACK"; | 262 | s = "CHAN_NACK"; |
276 | break; | 263 | break; |
277 | 264 | ||
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index d034c63b0..cf32e0d6d 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h | |||
@@ -56,12 +56,12 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
56 | /** | 56 | /** |
57 | * Message for cadet connection creation. | 57 | * Message for cadet connection creation. |
58 | */ | 58 | */ |
59 | struct GNUNET_CADET_ConnectionCreate | 59 | struct GNUNET_CADET_ConnectionCreateMessage |
60 | { | 60 | { |
61 | /** | 61 | /** |
62 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE | 62 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE |
63 | * | 63 | * |
64 | * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) + | 64 | * Size: sizeof (struct GNUNET_CADET_ConnectionCreateMessage) + |
65 | * path_length * sizeof (struct GNUNET_PeerIdentity) | 65 | * path_length * sizeof (struct GNUNET_PeerIdentity) |
66 | */ | 66 | */ |
67 | struct GNUNET_MessageHeader header; | 67 | struct GNUNET_MessageHeader header; |
@@ -70,11 +70,11 @@ struct GNUNET_CADET_ConnectionCreate | |||
70 | * For alignment. | 70 | * For alignment. |
71 | */ | 71 | */ |
72 | uint32_t reserved GNUNET_PACKED; | 72 | uint32_t reserved GNUNET_PACKED; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * ID of the connection | 75 | * ID of the connection |
76 | */ | 76 | */ |
77 | struct GNUNET_CADET_Hash cid; | 77 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * path_length structs defining the *whole* path from the origin [0] to the | 80 | * path_length structs defining the *whole* path from the origin [0] to the |
@@ -87,10 +87,10 @@ struct GNUNET_CADET_ConnectionCreate | |||
87 | /** | 87 | /** |
88 | * Message for ack'ing a connection | 88 | * Message for ack'ing a connection |
89 | */ | 89 | */ |
90 | struct GNUNET_CADET_ConnectionACK | 90 | struct GNUNET_CADET_ConnectionCreateMessageAckMessage |
91 | { | 91 | { |
92 | /** | 92 | /** |
93 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK | 93 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK |
94 | */ | 94 | */ |
95 | struct GNUNET_MessageHeader header; | 95 | struct GNUNET_MessageHeader header; |
96 | 96 | ||
@@ -102,7 +102,7 @@ struct GNUNET_CADET_ConnectionACK | |||
102 | /** | 102 | /** |
103 | * ID of the connection. | 103 | * ID of the connection. |
104 | */ | 104 | */ |
105 | struct GNUNET_CADET_Hash cid; | 105 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; |
106 | 106 | ||
107 | }; | 107 | }; |
108 | 108 | ||
@@ -110,10 +110,10 @@ struct GNUNET_CADET_ConnectionACK | |||
110 | /** | 110 | /** |
111 | * Message for notifying a disconnection in a path | 111 | * Message for notifying a disconnection in a path |
112 | */ | 112 | */ |
113 | struct GNUNET_CADET_ConnectionBroken | 113 | struct GNUNET_CADET_ConnectionBrokenMessage |
114 | { | 114 | { |
115 | /** | 115 | /** |
116 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN | 116 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN. |
117 | */ | 117 | */ |
118 | struct GNUNET_MessageHeader header; | 118 | struct GNUNET_MessageHeader header; |
119 | 119 | ||
@@ -125,7 +125,7 @@ struct GNUNET_CADET_ConnectionBroken | |||
125 | /** | 125 | /** |
126 | * ID of the connection. | 126 | * ID of the connection. |
127 | */ | 127 | */ |
128 | struct GNUNET_CADET_Hash cid; | 128 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * ID of the endpoint | 131 | * ID of the endpoint |
@@ -142,7 +142,7 @@ struct GNUNET_CADET_ConnectionBroken | |||
142 | /** | 142 | /** |
143 | * Message to destroy a connection. | 143 | * Message to destroy a connection. |
144 | */ | 144 | */ |
145 | struct GNUNET_CADET_ConnectionDestroy | 145 | struct GNUNET_CADET_ConnectionDestroyMessage |
146 | { | 146 | { |
147 | /** | 147 | /** |
148 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY | 148 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY |
@@ -157,60 +157,31 @@ struct GNUNET_CADET_ConnectionDestroy | |||
157 | /** | 157 | /** |
158 | * ID of the connection. | 158 | * ID of the connection. |
159 | */ | 159 | */ |
160 | struct GNUNET_CADET_Hash cid; | 160 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; |
161 | }; | 161 | }; |
162 | 162 | ||
163 | 163 | ||
164 | /** | 164 | /******************************************************************************/ |
165 | * Message to acknowledge cadet encrypted traffic. | 165 | /******************************* TUNNEL ***********************************/ |
166 | */ | 166 | /******************************************************************************/ |
167 | struct GNUNET_CADET_ACK | ||
168 | { | ||
169 | /** | ||
170 | * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK | ||
171 | */ | ||
172 | struct GNUNET_MessageHeader header; | ||
173 | |||
174 | /** | ||
175 | * Maximum packet ID authorized. | ||
176 | */ | ||
177 | uint32_t ack GNUNET_PACKED; | ||
178 | |||
179 | /** | ||
180 | * ID of the connection. | ||
181 | */ | ||
182 | struct GNUNET_CADET_Hash cid; | ||
183 | }; | ||
184 | |||
185 | 167 | ||
186 | /** | 168 | /** |
187 | * Message to query a peer about its Flow Control status regarding a tunnel. | 169 | * Unique identifier (counter) for an encrypted message in a channel. |
170 | * Used to match #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK | ||
171 | * and #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL messages | ||
172 | * against the respective #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED | ||
173 | * messages. | ||
188 | */ | 174 | */ |
189 | struct GNUNET_CADET_Poll | 175 | struct CadetEncryptedMessageIdentifier |
190 | { | 176 | { |
191 | /** | 177 | /** |
192 | * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL | 178 | * This number is incremented by one per message. It may wrap around. |
193 | */ | 179 | * In network byte order. |
194 | struct GNUNET_MessageHeader header; | ||
195 | |||
196 | /** | ||
197 | * Last packet sent. | ||
198 | */ | 180 | */ |
199 | uint32_t pid GNUNET_PACKED; | 181 | uint32_t pid GNUNET_PACKED; |
200 | |||
201 | /** | ||
202 | * ID of the connection. | ||
203 | */ | ||
204 | struct GNUNET_CADET_Hash cid; | ||
205 | |||
206 | }; | 182 | }; |
207 | 183 | ||
208 | 184 | ||
209 | |||
210 | /******************************************************************************/ | ||
211 | /******************************* TUNNEL ***********************************/ | ||
212 | /******************************************************************************/ | ||
213 | |||
214 | /** | 185 | /** |
215 | * Flags to be used in GNUNET_CADET_KX. | 186 | * Flags to be used in GNUNET_CADET_KX. |
216 | */ | 187 | */ |
@@ -231,10 +202,10 @@ enum GNUNET_CADET_KX_Flags { | |||
231 | /** | 202 | /** |
232 | * Message for a Key eXchange for a tunnel. | 203 | * Message for a Key eXchange for a tunnel. |
233 | */ | 204 | */ |
234 | struct GNUNET_CADET_KX | 205 | struct GNUNET_CADET_TunnelKeyExchangeMessage |
235 | { | 206 | { |
236 | /** | 207 | /** |
237 | * Type: #GNUNET_MESSAGE_TYPE_CADET_KX. | 208 | * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX. |
238 | */ | 209 | */ |
239 | struct GNUNET_MessageHeader header; | 210 | struct GNUNET_MessageHeader header; |
240 | 211 | ||
@@ -247,7 +218,7 @@ struct GNUNET_CADET_KX | |||
247 | /** | 218 | /** |
248 | * ID of the connection. | 219 | * ID of the connection. |
249 | */ | 220 | */ |
250 | struct GNUNET_CADET_Hash cid; | 221 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; |
251 | 222 | ||
252 | /** | 223 | /** |
253 | * Sender's ephemeral public ECC key encoded in a | 224 | * Sender's ephemeral public ECC key encoded in a |
@@ -262,35 +233,42 @@ struct GNUNET_CADET_KX | |||
262 | * using 'gcry_sexp_sprint'. | 233 | * using 'gcry_sexp_sprint'. |
263 | */ | 234 | */ |
264 | struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key; | 235 | struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key; |
236 | |||
237 | #ifdef NEW_CADET | ||
238 | /** | ||
239 | * Proof that sender could compute the 3-DH, in lieu of a signature. | ||
240 | */ | ||
241 | struct GNUNET_HashCode triple_dh_proof; | ||
242 | #endif | ||
265 | }; | 243 | }; |
266 | 244 | ||
267 | 245 | ||
268 | /** | 246 | /** |
269 | * Axolotl tunnel message. | 247 | * Axolotl tunnel message. |
270 | */ | 248 | */ |
271 | struct GNUNET_CADET_Encrypted | 249 | struct GNUNET_CADET_TunnelEncryptedMessage |
272 | { | 250 | { |
273 | /** | 251 | /** |
274 | * Type: #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED | 252 | * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED |
275 | */ | 253 | */ |
276 | struct GNUNET_MessageHeader header; | 254 | struct GNUNET_MessageHeader header; |
277 | 255 | ||
278 | /** | 256 | /** |
279 | * ID of the packet (hop by hop). | 257 | * ID of the packet (hop by hop). |
280 | */ | 258 | */ |
281 | uint32_t pid GNUNET_PACKED; | 259 | struct CadetEncryptedMessageIdentifier cemi; |
282 | 260 | ||
283 | /** | 261 | /** |
284 | * ID of the connection. | 262 | * ID of the connection. |
285 | */ | 263 | */ |
286 | struct GNUNET_CADET_Hash cid; | 264 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; |
287 | 265 | ||
288 | /** | 266 | /** |
289 | * MAC of the encrypted message, used to verify message integrity. | 267 | * MAC of the encrypted message, used to verify message integrity. |
290 | * Everything after this value will be encrypted with the header key | 268 | * Everything after this value will be encrypted with the header key |
291 | * and authenticated. | 269 | * and authenticated. |
292 | */ | 270 | */ |
293 | struct GNUNET_CADET_Hash hmac; | 271 | struct GNUNET_ShortHashCode hmac; |
294 | 272 | ||
295 | /**************** AX_HEADER start ****************/ | 273 | /**************** AX_HEADER start ****************/ |
296 | 274 | ||
@@ -317,18 +295,69 @@ struct GNUNET_CADET_Encrypted | |||
317 | }; | 295 | }; |
318 | 296 | ||
319 | 297 | ||
298 | /** | ||
299 | * Message to query a peer about its Flow Control status regarding a tunnel. | ||
300 | * | ||
301 | * It is NOT yet clear if we need this. | ||
302 | */ | ||
303 | struct GNUNET_CADET_ConnectionHopByHopPollMessage | ||
304 | { | ||
305 | /** | ||
306 | * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL | ||
307 | */ | ||
308 | struct GNUNET_MessageHeader header; | ||
309 | |||
310 | /** | ||
311 | * Last packet sent. | ||
312 | */ | ||
313 | struct CadetEncryptedMessageIdentifier cemi; | ||
314 | |||
315 | /** | ||
316 | * ID of the connection. | ||
317 | */ | ||
318 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; | ||
319 | |||
320 | }; | ||
321 | |||
322 | |||
323 | /** | ||
324 | * Message to acknowledge cadet encrypted traffic, used for | ||
325 | * flow-control on a hop-by-hop basis on the connection-level. Note | ||
326 | * that we do use the @e cemi from the tunnel layer as the connection | ||
327 | * layer's header is included/shared with the tunnel layer messages, | ||
328 | * and we only do flow control for the payload. | ||
329 | */ | ||
330 | struct GNUNET_CADET_ConnectionEncryptedAckMessage | ||
331 | { | ||
332 | /** | ||
333 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK | ||
334 | */ | ||
335 | struct GNUNET_MessageHeader header; | ||
336 | |||
337 | /** | ||
338 | * Maximum packet ID authorized. | ||
339 | */ | ||
340 | struct CadetEncryptedMessageIdentifier cemi; | ||
341 | |||
342 | /** | ||
343 | * ID of the connection. | ||
344 | */ | ||
345 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; | ||
346 | }; | ||
347 | |||
320 | 348 | ||
321 | /******************************************************************************/ | 349 | /******************************************************************************/ |
322 | /******************************* CHANNEL ***********************************/ | 350 | /******************************* CHANNEL ***********************************/ |
323 | /******************************************************************************/ | 351 | /******************************************************************************/ |
324 | 352 | ||
353 | |||
325 | /** | 354 | /** |
326 | * Message to create a Channel. | 355 | * Message to create a Channel. |
327 | */ | 356 | */ |
328 | struct GNUNET_CADET_ChannelCreate | 357 | struct GNUNET_CADET_ChannelOpenMessage |
329 | { | 358 | { |
330 | /** | 359 | /** |
331 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE | 360 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN |
332 | */ | 361 | */ |
333 | struct GNUNET_MessageHeader header; | 362 | struct GNUNET_MessageHeader header; |
334 | 363 | ||
@@ -343,33 +372,42 @@ struct GNUNET_CADET_ChannelCreate | |||
343 | struct GNUNET_HashCode port; | 372 | struct GNUNET_HashCode port; |
344 | 373 | ||
345 | /** | 374 | /** |
346 | * ID of the channel | 375 | * ID of the channel within the tunnel. |
347 | */ | 376 | */ |
348 | CADET_ChannelNumber chid GNUNET_PACKED; | 377 | struct GNUNET_CADET_ChannelTunnelNumber chid; |
349 | }; | 378 | }; |
350 | 379 | ||
351 | 380 | ||
352 | /** | 381 | /** |
353 | * Message to manage a Channel (ACK, NACK, Destroy). | 382 | * Message to manage a Channel (ACK, NACK, Destroy). |
354 | */ | 383 | */ |
355 | struct GNUNET_CADET_ChannelManage | 384 | struct GNUNET_CADET_ChannelManageMessage |
356 | { | 385 | { |
357 | /** | 386 | /** |
358 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY} | 387 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY} |
359 | */ | 388 | */ |
360 | struct GNUNET_MessageHeader header; | 389 | struct GNUNET_MessageHeader header; |
361 | 390 | ||
391 | #ifdef NEW_CADET | ||
392 | /** | ||
393 | * For alignment. | ||
394 | */ | ||
395 | uint32_t reserved GNUNET_PACKED; | ||
396 | #endif | ||
397 | |||
362 | /** | 398 | /** |
363 | * ID of the channel | 399 | * ID of the channel |
364 | */ | 400 | */ |
365 | CADET_ChannelNumber chid GNUNET_PACKED; | 401 | struct GNUNET_CADET_ChannelTunnelNumber chid; |
366 | }; | 402 | }; |
367 | 403 | ||
368 | 404 | ||
405 | #ifndef NEW_CADET | ||
406 | |||
369 | /** | 407 | /** |
370 | * Message for cadet data traffic. | 408 | * Message for cadet data traffic. |
371 | */ | 409 | */ |
372 | struct GNUNET_CADET_Data | 410 | struct GNUNET_CADET_ChannelAppDataMessage |
373 | { | 411 | { |
374 | /** | 412 | /** |
375 | * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST, | 413 | * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST, |
@@ -380,12 +418,13 @@ struct GNUNET_CADET_Data | |||
380 | /** | 418 | /** |
381 | * Unique ID of the payload message | 419 | * Unique ID of the payload message |
382 | */ | 420 | */ |
421 | /* NEW: struct ChannelMessageIdentifier */ | ||
383 | uint32_t mid GNUNET_PACKED; | 422 | uint32_t mid GNUNET_PACKED; |
384 | 423 | ||
385 | /** | 424 | /** |
386 | * ID of the channel | 425 | * ID of the channel |
387 | */ | 426 | */ |
388 | CADET_ChannelNumber chid GNUNET_PACKED; | 427 | struct GNUNET_CADET_ChannelTunnelNumber chid; |
389 | 428 | ||
390 | /** | 429 | /** |
391 | * Payload follows | 430 | * Payload follows |
@@ -396,17 +435,17 @@ struct GNUNET_CADET_Data | |||
396 | /** | 435 | /** |
397 | * Message to acknowledge end-to-end data. | 436 | * Message to acknowledge end-to-end data. |
398 | */ | 437 | */ |
399 | struct GNUNET_CADET_DataACK | 438 | struct GNUNET_CADET_ChannelDataAckMessage |
400 | { | 439 | { |
401 | /** | 440 | /** |
402 | * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK | 441 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK |
403 | */ | 442 | */ |
404 | struct GNUNET_MessageHeader header; | 443 | struct GNUNET_MessageHeader header; |
405 | 444 | ||
406 | /** | 445 | /** |
407 | * ID of the channel | 446 | * ID of the channel |
408 | */ | 447 | */ |
409 | CADET_ChannelNumber chid GNUNET_PACKED; | 448 | struct GNUNET_CADET_ChannelTunnelNumber chid; |
410 | 449 | ||
411 | /** | 450 | /** |
412 | * Bitfield of already-received newer messages | 451 | * Bitfield of already-received newer messages |
@@ -418,10 +457,82 @@ struct GNUNET_CADET_DataACK | |||
418 | /** | 457 | /** |
419 | * Last message ID received. | 458 | * Last message ID received. |
420 | */ | 459 | */ |
460 | /* NEW: struct ChannelMessageIdentifier */ | ||
461 | uint32_t mid GNUNET_PACKED; | ||
462 | }; | ||
463 | |||
464 | #else | ||
465 | |||
466 | |||
467 | /** | ||
468 | * Number used to uniquely identify messages in a CADET Channel. | ||
469 | */ | ||
470 | struct ChannelMessageIdentifier | ||
471 | { | ||
472 | /** | ||
473 | * Unique ID of the message, cycles around, in NBO. | ||
474 | */ | ||
421 | uint32_t mid GNUNET_PACKED; | 475 | uint32_t mid GNUNET_PACKED; |
422 | }; | 476 | }; |
423 | 477 | ||
424 | 478 | ||
479 | /** | ||
480 | * Message for cadet data traffic. | ||
481 | */ | ||
482 | struct GNUNET_CADET_ChannelAppDataMessage | ||
483 | { | ||
484 | /** | ||
485 | * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST, | ||
486 | * #GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN | ||
487 | */ | ||
488 | struct GNUNET_MessageHeader header; | ||
489 | |||
490 | /** | ||
491 | * Unique ID of the payload message. | ||
492 | */ | ||
493 | struct ChannelMessageIdentifier mid; | ||
494 | |||
495 | /** | ||
496 | * ID of the channel | ||
497 | */ | ||
498 | struct GNUNET_CADET_ChannelTunnelNumber gid; | ||
499 | |||
500 | /** | ||
501 | * Payload follows | ||
502 | */ | ||
503 | }; | ||
504 | |||
505 | |||
506 | /** | ||
507 | * Message to acknowledge end-to-end data. | ||
508 | */ | ||
509 | struct GNUNET_CADET_ChannelDataAckMessage | ||
510 | { | ||
511 | /** | ||
512 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK | ||
513 | */ | ||
514 | struct GNUNET_MessageHeader header; | ||
515 | |||
516 | /** | ||
517 | * ID of the channel | ||
518 | */ | ||
519 | struct GNUNET_CADET_ChannelTunnelNumber gid; | ||
520 | |||
521 | /** | ||
522 | * Bitfield of already-received messages past @e mid. | ||
523 | * pid + 1 @ LSB | ||
524 | * pid + 64 @ MSB | ||
525 | */ | ||
526 | uint64_t futures GNUNET_PACKED; | ||
527 | |||
528 | /** | ||
529 | * Last message ID received. | ||
530 | */ | ||
531 | struct ChannelMessageIdentifier mid; | ||
532 | }; | ||
533 | |||
534 | |||
535 | #endif | ||
425 | 536 | ||
426 | GNUNET_NETWORK_STRUCT_END | 537 | GNUNET_NETWORK_STRUCT_END |
427 | 538 | ||
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index 5afb64e24..80010ec54 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c | |||
@@ -727,8 +727,8 @@ tunnel_callback (void *cls, | |||
727 | const struct GNUNET_PeerIdentity *peer, | 727 | const struct GNUNET_PeerIdentity *peer, |
728 | unsigned int n_channels, | 728 | unsigned int n_channels, |
729 | unsigned int n_connections, | 729 | unsigned int n_connections, |
730 | uint32_t *channels, | 730 | const struct GNUNET_CADET_ChannelTunnelNumber *channels, |
731 | struct GNUNET_CADET_Hash *connections, | 731 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *connections, |
732 | unsigned int estate, | 732 | unsigned int estate, |
733 | unsigned int cstate) | 733 | unsigned int cstate) |
734 | { | 734 | { |
@@ -739,10 +739,10 @@ tunnel_callback (void *cls, | |||
739 | FPRINTF (stdout, "Tunnel %s\n", GNUNET_i2s_full (peer)); | 739 | FPRINTF (stdout, "Tunnel %s\n", GNUNET_i2s_full (peer)); |
740 | FPRINTF (stdout, "\t%u channels\n", n_channels); | 740 | FPRINTF (stdout, "\t%u channels\n", n_channels); |
741 | for (i = 0; i < n_channels; i++) | 741 | for (i = 0; i < n_channels; i++) |
742 | FPRINTF (stdout, "\t\t%X\n", ntohl (channels[i])); | 742 | FPRINTF (stdout, "\t\t%X\n", ntohl (channels[i].cn)); |
743 | FPRINTF (stdout, "\t%u connections\n", n_connections); | 743 | FPRINTF (stdout, "\t%u connections\n", n_connections); |
744 | for (i = 0; i < n_connections; i++) | 744 | for (i = 0; i < n_connections; i++) |
745 | FPRINTF (stdout, "\t\t%s\n", GC_h2s (&connections[i])); | 745 | FPRINTF (stdout, "\t\t%s\n", GNUNET_sh2s (&connections[i].connection_of_tunnel)); |
746 | FPRINTF (stdout, "\tencryption state: %s\n", enc_2s (estate)); | 746 | FPRINTF (stdout, "\tencryption state: %s\n", enc_2s (estate)); |
747 | FPRINTF (stdout, "\tconnection state: %s\n", conn_2s (cstate)); | 747 | FPRINTF (stdout, "\tconnection state: %s\n", conn_2s (cstate)); |
748 | } | 748 | } |
@@ -827,7 +827,10 @@ show_tunnel (void *cls) | |||
827 | GNUNET_SCHEDULER_shutdown (); | 827 | GNUNET_SCHEDULER_shutdown (); |
828 | return; | 828 | return; |
829 | } | 829 | } |
830 | GNUNET_CADET_get_tunnel (mh, &pid, tunnel_callback, NULL); | 830 | GNUNET_CADET_get_tunnel (mh, |
831 | &pid, | ||
832 | &tunnel_callback, | ||
833 | NULL); | ||
831 | } | 834 | } |
832 | 835 | ||
833 | 836 | ||
diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c new file mode 100644 index 000000000..2f6cc7b11 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new.c | |||
@@ -0,0 +1,1350 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2001-2013, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file cadet/gnunet-service-cadet-new.c | ||
23 | * @brief GNUnet CADET service with encryption | ||
24 | * @author Bartlomiej Polot | ||
25 | * @author Christian Grothoff | ||
26 | * | ||
27 | * Dictionary: | ||
28 | * - peer: other cadet instance. If there is direct connection it's a neighbor. | ||
29 | * - path: series of directly connected peer from one peer to another. | ||
30 | * - connection: path which is being used in a tunnel. | ||
31 | * - tunnel: encrypted connection to a peer, neighbor or not. | ||
32 | * - channel: logical link between two clients, on the same or different peers. | ||
33 | * have properties like reliability. | ||
34 | */ | ||
35 | |||
36 | #include "platform.h" | ||
37 | #include "gnunet_util_lib.h" | ||
38 | #include "cadet.h" | ||
39 | #include "gnunet_statistics_service.h" | ||
40 | #include "gnunet-service-cadet-new.h" | ||
41 | #include "gnunet-service-cadet-new_channel.h" | ||
42 | #include "gnunet-service-cadet-new_connection.h" | ||
43 | #include "gnunet-service-cadet-new_core.h" | ||
44 | #include "gnunet-service-cadet-new_dht.h" | ||
45 | #include "gnunet-service-cadet-new_hello.h" | ||
46 | #include "gnunet-service-cadet-new_tunnels.h" | ||
47 | #include "gnunet-service-cadet-new_peer.h" | ||
48 | #include "gnunet-service-cadet-new_paths.h" | ||
49 | |||
50 | #define LOG(level, ...) GNUNET_log (level,__VA_ARGS__) | ||
51 | |||
52 | |||
53 | /** | ||
54 | * Struct containing information about a client of the service | ||
55 | */ | ||
56 | struct CadetClient | ||
57 | { | ||
58 | /** | ||
59 | * Linked list next | ||
60 | */ | ||
61 | struct CadetClient *next; | ||
62 | |||
63 | /** | ||
64 | * Linked list prev | ||
65 | */ | ||
66 | struct CadetClient *prev; | ||
67 | |||
68 | /** | ||
69 | * Tunnels that belong to this client, indexed by local id | ||
70 | */ | ||
71 | struct GNUNET_CONTAINER_MultiHashMap32 *own_channels; | ||
72 | |||
73 | /** | ||
74 | * Tunnels this client has accepted, indexed by incoming local id | ||
75 | */ | ||
76 | struct GNUNET_CONTAINER_MultiHashMap32 *incoming_channels; | ||
77 | |||
78 | /** | ||
79 | * Channel ID for the next incoming channel. | ||
80 | */ | ||
81 | struct GNUNET_CADET_ClientChannelNumber next_chid; | ||
82 | |||
83 | /** | ||
84 | * Handle to communicate with the client | ||
85 | */ | ||
86 | struct GNUNET_MQ_Handle *mq; | ||
87 | |||
88 | /** | ||
89 | * Client handle. | ||
90 | */ | ||
91 | struct GNUNET_SERVICE_Client *client; | ||
92 | |||
93 | /** | ||
94 | * Ports that this client has declared interest in. | ||
95 | * Indexed by port, contains *Client. | ||
96 | */ | ||
97 | struct GNUNET_CONTAINER_MultiHashMap *ports; | ||
98 | |||
99 | /** | ||
100 | * Whether the client is active or shutting down (don't send confirmations | ||
101 | * to a client that is shutting down). | ||
102 | */ | ||
103 | int shutting_down; | ||
104 | |||
105 | /** | ||
106 | * ID of the client, mainly for debug messages | ||
107 | */ | ||
108 | unsigned int id; | ||
109 | }; | ||
110 | |||
111 | /******************************************************************************/ | ||
112 | /*********************** GLOBAL VARIABLES ****************************/ | ||
113 | /******************************************************************************/ | ||
114 | |||
115 | /****************************** Global variables ******************************/ | ||
116 | |||
117 | /** | ||
118 | * Handle to the statistics service. | ||
119 | */ | ||
120 | struct GNUNET_STATISTICS_Handle *stats; | ||
121 | |||
122 | /** | ||
123 | * Handle to communicate with ATS. | ||
124 | */ | ||
125 | struct GNUNET_ATS_ConnectivityHandle *ats_ch; | ||
126 | |||
127 | /** | ||
128 | * Local peer own ID. | ||
129 | */ | ||
130 | struct GNUNET_PeerIdentity my_full_id; | ||
131 | |||
132 | /** | ||
133 | * Own private key. | ||
134 | */ | ||
135 | struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; | ||
136 | |||
137 | /** | ||
138 | * Signal that shutdown is happening: prevent recover measures. | ||
139 | */ | ||
140 | int shutting_down; | ||
141 | |||
142 | /** | ||
143 | * DLL with all the clients, head. | ||
144 | */ | ||
145 | static struct CadetClient *clients_head; | ||
146 | |||
147 | /** | ||
148 | * DLL with all the clients, tail. | ||
149 | */ | ||
150 | static struct CadetClient *clients_tail; | ||
151 | |||
152 | /** | ||
153 | * Next ID to assign to a client. | ||
154 | */ | ||
155 | static unsigned int next_client_id; | ||
156 | |||
157 | /** | ||
158 | * All ports clients of this peer have opened. | ||
159 | */ | ||
160 | struct GNUNET_CONTAINER_MultiHashMap *open_ports; | ||
161 | |||
162 | /** | ||
163 | * Map from ports to channels where the ports were closed at the | ||
164 | * time we got the inbound connection. | ||
165 | * Indexed by port, contains `struct CadetChannel`. | ||
166 | */ | ||
167 | struct GNUNET_CONTAINER_MultiHashMap *loose_channels; | ||
168 | |||
169 | /** | ||
170 | * Map from PIDs to `struct CadetPeer` entries. | ||
171 | */ | ||
172 | struct GNUNET_CONTAINER_MultiPeerMap *peers; | ||
173 | |||
174 | /** | ||
175 | * Map from `struct GNUNET_CADET_ConnectionTunnelIdentifier` | ||
176 | * hash codes to `struct CadetConnection` objects. | ||
177 | */ | ||
178 | struct GNUNET_CONTAINER_MultiShortmap *connections; | ||
179 | |||
180 | /** | ||
181 | * How many messages are needed to trigger an AXOLOTL ratchet advance. | ||
182 | */ | ||
183 | unsigned long long ratchet_messages; | ||
184 | |||
185 | /** | ||
186 | * How long until we trigger a ratched advance due to time. | ||
187 | */ | ||
188 | struct GNUNET_TIME_Relative ratchet_time; | ||
189 | |||
190 | |||
191 | |||
192 | /** | ||
193 | * Send a message to a client. | ||
194 | * | ||
195 | * @param c client to get the message | ||
196 | * @param env envelope with the message | ||
197 | */ | ||
198 | void | ||
199 | GSC_send_to_client (struct CadetClient *c, | ||
200 | struct GNUNET_MQ_Envelope *env) | ||
201 | { | ||
202 | GNUNET_MQ_send (c->mq, | ||
203 | env); | ||
204 | } | ||
205 | |||
206 | |||
207 | /** | ||
208 | * Return identifier for a client as a string. | ||
209 | * | ||
210 | * @param c client to identify | ||
211 | * @return string for debugging | ||
212 | */ | ||
213 | const char * | ||
214 | GSC_2s (struct CadetClient *c) | ||
215 | { | ||
216 | static char buf[32]; | ||
217 | |||
218 | if (NULL == c) | ||
219 | return "Client(NULL)"; | ||
220 | GNUNET_snprintf (buf, | ||
221 | sizeof (buf), | ||
222 | "Client(%u)", | ||
223 | c->id); | ||
224 | return buf; | ||
225 | } | ||
226 | |||
227 | |||
228 | /** | ||
229 | * Obtain the next LID to use for incoming connections to | ||
230 | * the given client. | ||
231 | * | ||
232 | * @param c client handle | ||
233 | */ | ||
234 | static struct GNUNET_CADET_ClientChannelNumber | ||
235 | client_get_next_lid (struct CadetClient *c) | ||
236 | { | ||
237 | struct GNUNET_CADET_ClientChannelNumber ccn = c->next_chid; | ||
238 | |||
239 | /* increment until we have a free one... */ | ||
240 | while (NULL != | ||
241 | GNUNET_CONTAINER_multihashmap32_get (c->incoming_channels, | ||
242 | ntohl (ccn.channel_of_client))) | ||
243 | { | ||
244 | ccn.channel_of_client | ||
245 | = htonl (1 + (ntohl (ccn.channel_of_client))); | ||
246 | if (ntohl (ccn.channel_of_client) >= | ||
247 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
248 | ccn.channel_of_client = htonl (0); | ||
249 | } | ||
250 | c->next_chid.channel_of_client | ||
251 | = htonl (1 + (ntohl (ccn.channel_of_client))); | ||
252 | return ccn; | ||
253 | } | ||
254 | |||
255 | |||
256 | /** | ||
257 | * Bind incoming channel to this client, and notify client | ||
258 | * about incoming connection. | ||
259 | * | ||
260 | * @param c client to bind to | ||
261 | * @param ch channel to be bound | ||
262 | * @param dest peer that establishes the connection | ||
263 | * @param port port number | ||
264 | * @param options options | ||
265 | * @return local channel number assigned to the new client | ||
266 | */ | ||
267 | struct GNUNET_CADET_ClientChannelNumber | ||
268 | GSC_bind (struct CadetClient *c, | ||
269 | struct CadetChannel *ch, | ||
270 | struct CadetPeer *dest, | ||
271 | const struct GNUNET_HashCode *port, | ||
272 | uint32_t options) | ||
273 | { | ||
274 | struct GNUNET_MQ_Envelope *env; | ||
275 | struct GNUNET_CADET_ChannelOpenMessageMessage *msg; | ||
276 | struct GNUNET_CADET_ClientChannelNumber lid; | ||
277 | |||
278 | lid = client_get_next_lid (c); | ||
279 | GNUNET_assert (GNUNET_YES == | ||
280 | GNUNET_CONTAINER_multihashmap32_put (c->incoming_channels, | ||
281 | ntohl (lid.channel_of_client), | ||
282 | ch, | ||
283 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
284 | |||
285 | /* notify local client about incoming connection! */ | ||
286 | env = GNUNET_MQ_msg (msg, | ||
287 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); | ||
288 | msg->channel_id = lid; | ||
289 | msg->port = *port; | ||
290 | msg->opt = htonl (options); | ||
291 | msg->peer = *GCP_get_id (dest); | ||
292 | GSC_send_to_client (c, | ||
293 | env); | ||
294 | return lid; | ||
295 | } | ||
296 | |||
297 | |||
298 | /******************************************************************************/ | ||
299 | /************************ MAIN FUNCTIONS ****************************/ | ||
300 | /******************************************************************************/ | ||
301 | |||
302 | /** | ||
303 | * Task run during shutdown. | ||
304 | * | ||
305 | * @param cls unused | ||
306 | */ | ||
307 | static void | ||
308 | shutdown_task (void *cls) | ||
309 | { | ||
310 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
311 | "shutting down\n"); | ||
312 | shutting_down = GNUNET_YES; | ||
313 | GCO_shutdown (); | ||
314 | if (NULL != stats) | ||
315 | { | ||
316 | GNUNET_STATISTICS_destroy (stats, | ||
317 | GNUNET_NO); | ||
318 | stats = NULL; | ||
319 | } | ||
320 | if (NULL != open_ports) | ||
321 | { | ||
322 | GNUNET_CONTAINER_multihashmap_destroy (open_ports); | ||
323 | open_ports = NULL; | ||
324 | } | ||
325 | if (NULL != loose_channels) | ||
326 | { | ||
327 | GNUNET_CONTAINER_multihashmap_destroy (loose_channels); | ||
328 | loose_channels = NULL; | ||
329 | } | ||
330 | /* All channels, connections and CORE must be down before this point. */ | ||
331 | GCP_destroy_all_peers (); | ||
332 | if (NULL != peers) | ||
333 | { | ||
334 | GNUNET_CONTAINER_multipeermap_destroy (peers); | ||
335 | peers = NULL; | ||
336 | } | ||
337 | if (NULL != connections) | ||
338 | { | ||
339 | GNUNET_CONTAINER_multishortmap_destroy (connections); | ||
340 | connections = NULL; | ||
341 | } | ||
342 | if (NULL != ats_ch) | ||
343 | { | ||
344 | GNUNET_ATS_connectivity_done (ats_ch); | ||
345 | ats_ch = NULL; | ||
346 | } | ||
347 | GCD_shutdown (); | ||
348 | GCH_shutdown (); | ||
349 | GNUNET_free_non_null (my_private_key); | ||
350 | my_private_key = NULL; | ||
351 | } | ||
352 | |||
353 | |||
354 | /** | ||
355 | * We had a remote connection @a value to port @a port before | ||
356 | * client @a cls opened port @a port. Bind them now. | ||
357 | * | ||
358 | * @param cls the `struct CadetClient` | ||
359 | * @param port the port | ||
360 | * @param value the `struct CadetChannel` | ||
361 | * @return #GNUNET_YES (iterate over all such channels) | ||
362 | */ | ||
363 | static int | ||
364 | bind_loose_channel (void *cls, | ||
365 | const struct GNUNET_HashCode *port, | ||
366 | void *value) | ||
367 | { | ||
368 | struct CadetClient *c = cls; | ||
369 | struct CadetChannel *ch = value; | ||
370 | |||
371 | GCCH_bind (ch, | ||
372 | c); | ||
373 | GNUNET_assert (GNUNET_YES == | ||
374 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, | ||
375 | port, | ||
376 | value)); | ||
377 | return GNUNET_YES; | ||
378 | } | ||
379 | |||
380 | |||
381 | /** | ||
382 | * Handler for port open requests. | ||
383 | * | ||
384 | * @param cls Identification of the client. | ||
385 | * @param pmsg The actual message. | ||
386 | */ | ||
387 | static void | ||
388 | handle_port_open (void *cls, | ||
389 | const struct GNUNET_CADET_PortMessage *pmsg) | ||
390 | { | ||
391 | struct CadetClient *c = cls; | ||
392 | |||
393 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
394 | "Open port %s requested by client %u\n", | ||
395 | GNUNET_h2s (&pmsg->port), | ||
396 | c->id); | ||
397 | if (NULL == c->ports) | ||
398 | c->ports = GNUNET_CONTAINER_multihashmap_create (4, | ||
399 | GNUNET_NO); | ||
400 | if (GNUNET_OK != | ||
401 | GNUNET_CONTAINER_multihashmap_put (c->ports, | ||
402 | &pmsg->port, | ||
403 | c, | ||
404 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | ||
405 | { | ||
406 | GNUNET_break (0); | ||
407 | GNUNET_SERVICE_client_drop (c->client); | ||
408 | return; | ||
409 | } | ||
410 | /* store in global hashmap */ | ||
411 | /* FIXME only allow one client to have the port open, | ||
412 | * have a backup hashmap with waiting clients */ | ||
413 | GNUNET_CONTAINER_multihashmap_put (open_ports, | ||
414 | &pmsg->port, | ||
415 | c, | ||
416 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
417 | GNUNET_CONTAINER_multihashmap_get_multiple (loose_channels, | ||
418 | &pmsg->port, | ||
419 | &bind_loose_channel, | ||
420 | c); | ||
421 | GNUNET_SERVICE_client_continue (c->client); | ||
422 | } | ||
423 | |||
424 | |||
425 | /** | ||
426 | * Handler for port close requests. | ||
427 | * | ||
428 | * @param cls Identification of the client. | ||
429 | * @param pmsg The actual message. | ||
430 | */ | ||
431 | static void | ||
432 | handle_port_close (void *cls, | ||
433 | const struct GNUNET_CADET_PortMessage *pmsg) | ||
434 | { | ||
435 | struct CadetClient *c = cls; | ||
436 | |||
437 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
438 | "Open port %s requested by client %u\n", | ||
439 | GNUNET_h2s (&pmsg->port), | ||
440 | c->id); | ||
441 | if (GNUNET_YES != | ||
442 | GNUNET_CONTAINER_multihashmap_remove (c->ports, | ||
443 | &pmsg->port, | ||
444 | c)) | ||
445 | { | ||
446 | GNUNET_break (0); | ||
447 | GNUNET_SERVICE_client_drop (c->client); | ||
448 | return; | ||
449 | } | ||
450 | GNUNET_assert (GNUNET_YES == | ||
451 | GNUNET_CONTAINER_multihashmap_remove (open_ports, | ||
452 | &pmsg->port, | ||
453 | c)); | ||
454 | |||
455 | GNUNET_SERVICE_client_continue (c->client); | ||
456 | } | ||
457 | |||
458 | |||
459 | /** | ||
460 | * Handler for requests of new channels. | ||
461 | * | ||
462 | * @param cls Identification of the client. | ||
463 | * @param ccm The actual message. | ||
464 | */ | ||
465 | static void | ||
466 | handle_channel_create (void *cls, | ||
467 | const struct GNUNET_CADET_ChannelOpenMessageMessage *ccm) | ||
468 | { | ||
469 | struct CadetClient *c = cls; | ||
470 | struct CadetChannel *ch; | ||
471 | struct GNUNET_CADET_ClientChannelNumber chid; | ||
472 | struct CadetPeer *dst; | ||
473 | |||
474 | chid = ccm->channel_id; | ||
475 | if (ntohl (chid.channel_of_client) < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
476 | { | ||
477 | /* Channel ID not in allowed range. */ | ||
478 | GNUNET_break (0); | ||
479 | GNUNET_SERVICE_client_drop (c->client); | ||
480 | return; | ||
481 | } | ||
482 | ch = GNUNET_CONTAINER_multihashmap32_get (c->own_channels, | ||
483 | ntohl (chid.channel_of_client)); | ||
484 | if (NULL != ch) | ||
485 | { | ||
486 | /* Channel ID already in use. Not allowed. */ | ||
487 | GNUNET_break (0); | ||
488 | GNUNET_SERVICE_client_drop (c->client); | ||
489 | return; | ||
490 | } | ||
491 | |||
492 | dst = GCP_get (&ccm->peer, | ||
493 | GNUNET_YES); | ||
494 | |||
495 | /* Create channel */ | ||
496 | ch = GCCH_channel_local_new (c, | ||
497 | chid, | ||
498 | dst, | ||
499 | &ccm->port, | ||
500 | ntohl (ccm->opt)); | ||
501 | if (NULL == ch) | ||
502 | { | ||
503 | GNUNET_break (0); | ||
504 | GNUNET_SERVICE_client_drop (c->client); | ||
505 | return; | ||
506 | } | ||
507 | GNUNET_assert (GNUNET_YES == | ||
508 | GNUNET_CONTAINER_multihashmap32_put (c->own_channels, | ||
509 | ntohl (chid.channel_of_client), | ||
510 | ch, | ||
511 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
512 | |||
513 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
514 | "New channel %s to %s at port %s requested by client %u\n", | ||
515 | GCCH_2s (ch), | ||
516 | GNUNET_i2s (&ccm->peer), | ||
517 | GNUNET_h2s (&ccm->port), | ||
518 | c->id); | ||
519 | GNUNET_SERVICE_client_continue (c->client); | ||
520 | } | ||
521 | |||
522 | |||
523 | /** | ||
524 | * Return the map which we use for client @a c for a channel ID of @a chid | ||
525 | * | ||
526 | * @param c client to find map for | ||
527 | * @param chid chid to find map for | ||
528 | * @return applicable map we use | ||
529 | */ | ||
530 | static struct GNUNET_CONTAINER_MultiHashMap32 * | ||
531 | get_map_by_chid (struct CadetClient *c, | ||
532 | struct GNUNET_CADET_ClientChannelNumber chid) | ||
533 | { | ||
534 | return (ntohl (chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
535 | ? c->own_channels | ||
536 | : c->incoming_channels; | ||
537 | } | ||
538 | |||
539 | |||
540 | /** | ||
541 | * Handler for requests of deleting tunnels | ||
542 | * | ||
543 | * @param cls client identification of the client | ||
544 | * @param msg the actual message | ||
545 | */ | ||
546 | static void | ||
547 | handle_channel_destroy (void *cls, | ||
548 | const struct GNUNET_CADET_ChannelDestroyMessage *msg) | ||
549 | { | ||
550 | struct CadetClient *c = cls; | ||
551 | struct GNUNET_CADET_ClientChannelNumber chid; | ||
552 | struct GNUNET_CONTAINER_MultiHashMap32 *map; | ||
553 | struct CadetChannel *ch; | ||
554 | |||
555 | /* Retrieve tunnel */ | ||
556 | chid = msg->channel_id; | ||
557 | map = get_map_by_chid (c, | ||
558 | chid); | ||
559 | ch = GNUNET_CONTAINER_multihashmap32_get (map, | ||
560 | ntohl (chid.channel_of_client)); | ||
561 | if (NULL == ch) | ||
562 | { | ||
563 | /* Client attempted to destroy unknown channel */ | ||
564 | GNUNET_break (0); | ||
565 | GNUNET_SERVICE_client_drop (c->client); | ||
566 | return; | ||
567 | } | ||
568 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
569 | "Client %u is destroying channel %s\n", | ||
570 | c->id, | ||
571 | GCCH_2s (ch)); | ||
572 | GNUNET_assert (GNUNET_YES == | ||
573 | GNUNET_CONTAINER_multihashmap32_remove (map, | ||
574 | ntohl (chid.channel_of_client), | ||
575 | ch)); | ||
576 | GCCH_channel_local_destroy (ch); | ||
577 | GNUNET_SERVICE_client_continue (c->client); | ||
578 | } | ||
579 | |||
580 | |||
581 | /** | ||
582 | * Check for client traffic data message is well-formed | ||
583 | * | ||
584 | * @param cls identification of the client | ||
585 | * @param msg the actual message | ||
586 | * @return #GNUNET_OK if @a msg is OK, #GNUNET_SYSERR if not | ||
587 | */ | ||
588 | static int | ||
589 | check_data (void *cls, | ||
590 | const struct GNUNET_CADET_LocalData *msg) | ||
591 | { | ||
592 | const struct GNUNET_MessageHeader *payload; | ||
593 | size_t payload_size; | ||
594 | size_t payload_claimed_size; | ||
595 | |||
596 | /* Sanity check for message size */ | ||
597 | payload_size = ntohs (msg->header.size) - sizeof (*msg); | ||
598 | if ( (payload_size < sizeof (struct GNUNET_MessageHeader)) || | ||
599 | (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE < payload_size) ) | ||
600 | { | ||
601 | GNUNET_break (0); | ||
602 | return GNUNET_SYSERR; | ||
603 | } | ||
604 | payload = (struct GNUNET_MessageHeader *) &msg[1]; | ||
605 | payload_claimed_size = ntohs (payload->size); | ||
606 | if (payload_size != payload_claimed_size) | ||
607 | { | ||
608 | GNUNET_break (0); | ||
609 | return GNUNET_SYSERR; | ||
610 | } | ||
611 | return GNUNET_OK; | ||
612 | } | ||
613 | |||
614 | |||
615 | /** | ||
616 | * Handler for client traffic | ||
617 | * | ||
618 | * @param cls identification of the client | ||
619 | * @param msg the actual message | ||
620 | */ | ||
621 | static void | ||
622 | handle_data (void *cls, | ||
623 | const struct GNUNET_CADET_LocalData *msg) | ||
624 | { | ||
625 | struct CadetClient *c = cls; | ||
626 | struct GNUNET_CONTAINER_MultiHashMap32 *map; | ||
627 | struct GNUNET_CADET_ClientChannelNumber chid; | ||
628 | struct CadetChannel *ch; | ||
629 | const struct GNUNET_MessageHeader *payload; | ||
630 | |||
631 | chid = msg->id; | ||
632 | map = get_map_by_chid (c, | ||
633 | chid); | ||
634 | ch = GNUNET_CONTAINER_multihashmap32_get (map, | ||
635 | ntohl (chid.channel_of_client)); | ||
636 | if (NULL == ch) | ||
637 | { | ||
638 | /* Channel does not exist! */ | ||
639 | GNUNET_break (0); | ||
640 | GNUNET_SERVICE_client_drop (c->client); | ||
641 | return; | ||
642 | } | ||
643 | |||
644 | payload = (const struct GNUNET_MessageHeader *) &msg[1]; | ||
645 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
646 | "Received %u bytes payload from client %u for channel %s\n", | ||
647 | ntohs (payload->size), | ||
648 | c->id, | ||
649 | GCCH_2s (ch)); | ||
650 | if (GNUNET_OK != | ||
651 | GCCH_handle_local_data (ch, | ||
652 | payload)) | ||
653 | { | ||
654 | GNUNET_SERVICE_client_drop (c->client); | ||
655 | return; | ||
656 | } | ||
657 | GNUNET_SERVICE_client_continue (c->client); | ||
658 | } | ||
659 | |||
660 | |||
661 | /** | ||
662 | * Handler for client's ACKs for payload traffic. | ||
663 | * | ||
664 | * @param cls identification of the client. | ||
665 | * @param msg The actual message. | ||
666 | */ | ||
667 | static void | ||
668 | handle_ack (void *cls, | ||
669 | const struct GNUNET_CADET_LocalAck *msg) | ||
670 | { | ||
671 | struct CadetClient *c = cls; | ||
672 | struct GNUNET_CONTAINER_MultiHashMap32 *map; | ||
673 | struct GNUNET_CADET_ClientChannelNumber chid; | ||
674 | struct CadetChannel *ch; | ||
675 | |||
676 | chid = msg->channel_id; | ||
677 | map = get_map_by_chid (c, | ||
678 | chid); | ||
679 | ch = GNUNET_CONTAINER_multihashmap32_get (map, | ||
680 | ntohl (chid.channel_of_client)); | ||
681 | if (NULL == ch) | ||
682 | { | ||
683 | /* Channel does not exist! */ | ||
684 | GNUNET_break (0); | ||
685 | GNUNET_SERVICE_client_drop (c->client); | ||
686 | return; | ||
687 | } | ||
688 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
689 | "Got a local ACK from client %u for channel %s\n", | ||
690 | c->id, | ||
691 | GCCH_2s (ch)); | ||
692 | GCCH_handle_local_ack (ch); | ||
693 | GNUNET_SERVICE_client_continue (c->client); | ||
694 | } | ||
695 | |||
696 | |||
697 | /** | ||
698 | * Iterator over all peers to send a monitoring client info about each peer. | ||
699 | * | ||
700 | * @param cls Closure (). | ||
701 | * @param peer Peer ID (tunnel remote peer). | ||
702 | * @param value Peer info. | ||
703 | * @return #GNUNET_YES, to keep iterating. | ||
704 | */ | ||
705 | static int | ||
706 | get_all_peers_iterator (void *cls, | ||
707 | const struct GNUNET_PeerIdentity *peer, | ||
708 | void *value) | ||
709 | { | ||
710 | struct CadetClient *c = cls; | ||
711 | struct CadetPeer *p = value; | ||
712 | struct GNUNET_MQ_Envelope *env; | ||
713 | struct GNUNET_CADET_LocalInfoPeer *msg; | ||
714 | |||
715 | env = GNUNET_MQ_msg (msg, | ||
716 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); | ||
717 | msg->destination = *peer; | ||
718 | msg->paths = htons (GCP_count_paths (p)); | ||
719 | msg->tunnel = htons (NULL != GCP_get_tunnel (p, | ||
720 | GNUNET_NO)); | ||
721 | GNUNET_MQ_send (c->mq, | ||
722 | env); | ||
723 | return GNUNET_YES; | ||
724 | } | ||
725 | |||
726 | |||
727 | /** | ||
728 | * Handler for client's INFO PEERS request. | ||
729 | * | ||
730 | * @param cls Identification of the client. | ||
731 | * @param message The actual message. | ||
732 | */ | ||
733 | static void | ||
734 | handle_get_peers (void *cls, | ||
735 | const struct GNUNET_MessageHeader *message) | ||
736 | { | ||
737 | struct CadetClient *c = cls; | ||
738 | struct GNUNET_MQ_Envelope *env; | ||
739 | struct GNUNET_MessageHeader *reply; | ||
740 | |||
741 | GCP_iterate_all (&get_all_peers_iterator, | ||
742 | c); | ||
743 | env = GNUNET_MQ_msg (reply, | ||
744 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); | ||
745 | GNUNET_MQ_send (c->mq, | ||
746 | env); | ||
747 | GNUNET_SERVICE_client_continue (c->client); | ||
748 | } | ||
749 | |||
750 | |||
751 | /** | ||
752 | * Iterator over all paths of a peer to build an InfoPeer message. | ||
753 | * Message contains blocks of peers, first not included. | ||
754 | * | ||
755 | * @param cls message queue for transmission | ||
756 | * @param path Path itself | ||
757 | * @param off offset of the peer on @a path | ||
758 | * @return #GNUNET_YES if should keep iterating. | ||
759 | * #GNUNET_NO otherwise. | ||
760 | */ | ||
761 | static int | ||
762 | path_info_iterator (void *cls, | ||
763 | struct CadetPeerPath *path, | ||
764 | unsigned int off) | ||
765 | { | ||
766 | struct GNUNET_MQ_Handle *mq = cls; | ||
767 | struct GNUNET_MQ_Envelope *env; | ||
768 | struct GNUNET_MessageHeader *resp; | ||
769 | struct GNUNET_PeerIdentity *id; | ||
770 | uint16_t path_size; | ||
771 | unsigned int i; | ||
772 | unsigned int path_length; | ||
773 | |||
774 | path_length = GCPP_get_length (path); | ||
775 | path_size = sizeof (struct GNUNET_PeerIdentity) * (path_length - 1); | ||
776 | if (sizeof (*resp) + path_size > UINT16_MAX) | ||
777 | { | ||
778 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
779 | "Path of %u entries is too long for info message\n", | ||
780 | path_length); | ||
781 | return GNUNET_YES; | ||
782 | } | ||
783 | env = GNUNET_MQ_msg_extra (resp, | ||
784 | path_size, | ||
785 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); | ||
786 | id = (struct GNUNET_PeerIdentity *) &resp[1]; | ||
787 | |||
788 | /* Don't copy first peer. First peer is always the local one. Last | ||
789 | * peer is always the destination (leave as 0, EOL). | ||
790 | */ | ||
791 | for (i = 0; i < off; i++) | ||
792 | id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path, | ||
793 | i + 1)); | ||
794 | GNUNET_MQ_send (mq, | ||
795 | env); | ||
796 | return GNUNET_YES; | ||
797 | } | ||
798 | |||
799 | |||
800 | /** | ||
801 | * Handler for client's SHOW_PEER request. | ||
802 | * | ||
803 | * @param cls Identification of the client. | ||
804 | * @param msg The actual message. | ||
805 | */ | ||
806 | static void | ||
807 | handle_show_peer (void *cls, | ||
808 | const struct GNUNET_CADET_LocalInfo *msg) | ||
809 | { | ||
810 | struct CadetClient *c = cls; | ||
811 | struct CadetPeer *p; | ||
812 | struct GNUNET_MQ_Envelope *env; | ||
813 | struct GNUNET_MessageHeader *resp; | ||
814 | |||
815 | p = GCP_get (&msg->peer, | ||
816 | GNUNET_NO); | ||
817 | if (NULL != p) | ||
818 | GCP_iterate_paths (p, | ||
819 | &path_info_iterator, | ||
820 | c->mq); | ||
821 | /* Send message with 0/0 to indicate the end */ | ||
822 | env = GNUNET_MQ_msg (resp, | ||
823 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER_END); | ||
824 | GNUNET_MQ_send (c->mq, | ||
825 | env); | ||
826 | GNUNET_SERVICE_client_continue (c->client); | ||
827 | } | ||
828 | |||
829 | |||
830 | /** | ||
831 | * Iterator over all tunnels to send a monitoring client info about each tunnel. | ||
832 | * | ||
833 | * @param cls Closure (). | ||
834 | * @param peer Peer ID (tunnel remote peer). | ||
835 | * @param value a `struct CadetPeer` | ||
836 | * @return #GNUNET_YES, to keep iterating. | ||
837 | */ | ||
838 | static int | ||
839 | get_all_tunnels_iterator (void *cls, | ||
840 | const struct GNUNET_PeerIdentity *peer, | ||
841 | void *value) | ||
842 | { | ||
843 | struct CadetClient *c = cls; | ||
844 | struct CadetPeer *p = value; | ||
845 | struct GNUNET_MQ_Envelope *env; | ||
846 | struct GNUNET_CADET_LocalInfoTunnel *msg; | ||
847 | struct CadetTunnel *t; | ||
848 | |||
849 | t = GCP_get_tunnel (p, | ||
850 | GNUNET_NO); | ||
851 | if (NULL == t) | ||
852 | return GNUNET_YES; | ||
853 | env = GNUNET_MQ_msg (msg, | ||
854 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS); | ||
855 | msg->destination = *peer; | ||
856 | msg->channels = htonl (GCT_count_channels (t)); | ||
857 | msg->connections = htonl (GCT_count_any_connections (t)); | ||
858 | msg->cstate = htons ((uint16_t) GCT_get_cstate (t)); | ||
859 | msg->estate = htons ((uint16_t) GCT_get_estate (t)); | ||
860 | GNUNET_MQ_send (c->mq, | ||
861 | env); | ||
862 | return GNUNET_YES; | ||
863 | } | ||
864 | |||
865 | |||
866 | /** | ||
867 | * Handler for client's INFO TUNNELS request. | ||
868 | * | ||
869 | * @param cls client Identification of the client. | ||
870 | * @param message The actual message. | ||
871 | */ | ||
872 | static void | ||
873 | handle_get_tunnels (void *cls, | ||
874 | const struct GNUNET_MessageHeader *message) | ||
875 | { | ||
876 | struct CadetClient *c = cls; | ||
877 | struct GNUNET_MQ_Envelope *env; | ||
878 | struct GNUNET_MessageHeader *reply; | ||
879 | |||
880 | GCP_iterate_all (&get_all_tunnels_iterator, | ||
881 | c); | ||
882 | env = GNUNET_MQ_msg (reply, | ||
883 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS); | ||
884 | GNUNET_MQ_send (c->mq, | ||
885 | env); | ||
886 | GNUNET_SERVICE_client_continue (c->client); | ||
887 | } | ||
888 | |||
889 | |||
890 | /** | ||
891 | * FIXME. | ||
892 | */ | ||
893 | static void | ||
894 | iter_connection (void *cls, | ||
895 | struct CadetConnection *c) | ||
896 | { | ||
897 | struct GNUNET_CADET_LocalInfoTunnel *msg = cls; | ||
898 | struct GNUNET_CADET_ConnectionTunnelIdentifier *h; | ||
899 | |||
900 | h = (struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1]; | ||
901 | h[msg->connections++] = *(GCC_get_id (c)); | ||
902 | } | ||
903 | |||
904 | |||
905 | /** | ||
906 | * FIXME. | ||
907 | */ | ||
908 | static void | ||
909 | iter_channel (void *cls, | ||
910 | struct CadetChannel *ch) | ||
911 | { | ||
912 | struct GNUNET_CADET_LocalInfoTunnel *msg = cls; | ||
913 | struct GNUNET_CADET_ConnectionTunnelIdentifier *h = (struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1]; | ||
914 | struct GNUNET_CADET_ChannelTunnelNumber *chn | ||
915 | = (struct GNUNET_CADET_ChannelTunnelNumber *) &h[msg->connections]; | ||
916 | |||
917 | chn[msg->channels++] = GCCH_get_id (ch); | ||
918 | } | ||
919 | |||
920 | |||
921 | /** | ||
922 | * Handler for client's SHOW_TUNNEL request. | ||
923 | * | ||
924 | * @param cls Identification of the client. | ||
925 | * @param msg The actual message. | ||
926 | */ | ||
927 | static void | ||
928 | handle_show_tunnel (void *cls, | ||
929 | const struct GNUNET_CADET_LocalInfo *msg) | ||
930 | { | ||
931 | struct CadetClient *c = cls; | ||
932 | struct GNUNET_MQ_Envelope *env; | ||
933 | struct GNUNET_CADET_LocalInfoTunnel *resp; | ||
934 | struct CadetTunnel *t; | ||
935 | struct CadetPeer *p; | ||
936 | unsigned int ch_n; | ||
937 | unsigned int c_n; | ||
938 | |||
939 | p = GCP_get (&msg->peer, | ||
940 | GNUNET_NO); | ||
941 | t = GCP_get_tunnel (p, | ||
942 | GNUNET_NO); | ||
943 | if (NULL == t) | ||
944 | { | ||
945 | /* We don't know the tunnel */ | ||
946 | struct GNUNET_MQ_Envelope *env; | ||
947 | struct GNUNET_CADET_LocalInfoTunnel *warn; | ||
948 | |||
949 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
950 | "Tunnel to %s unknown\n", | ||
951 | GNUNET_i2s_full (&msg->peer)); | ||
952 | env = GNUNET_MQ_msg (warn, | ||
953 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL); | ||
954 | warn->destination = msg->peer; | ||
955 | GNUNET_MQ_send (c->mq, | ||
956 | env); | ||
957 | GNUNET_SERVICE_client_continue (c->client); | ||
958 | return; | ||
959 | } | ||
960 | |||
961 | /* Initialize context */ | ||
962 | ch_n = GCT_count_channels (t); | ||
963 | c_n = GCT_count_any_connections (t); | ||
964 | env = GNUNET_MQ_msg_extra (resp, | ||
965 | c_n * sizeof (struct GNUNET_CADET_ConnectionTunnelIdentifier) + | ||
966 | ch_n * sizeof (struct GNUNET_CADET_ChannelTunnelNumber), | ||
967 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL); | ||
968 | resp->destination = msg->peer; | ||
969 | /* Do not reorder! #iter_channel needs counters in HBO! */ | ||
970 | GCT_iterate_connections (t, | ||
971 | &iter_connection, | ||
972 | resp); | ||
973 | GCT_iterate_channels (t, | ||
974 | &iter_channel, | ||
975 | resp); | ||
976 | resp->connections = htonl (resp->connections); | ||
977 | resp->channels = htonl (resp->channels); | ||
978 | resp->cstate = htons (GCT_get_cstate (t)); | ||
979 | resp->estate = htons (GCT_get_estate (t)); | ||
980 | GNUNET_MQ_send (c->mq, | ||
981 | env); | ||
982 | GNUNET_SERVICE_client_continue (c->client); | ||
983 | } | ||
984 | |||
985 | |||
986 | /** | ||
987 | * Iterator over all peers to dump info for each peer. | ||
988 | * | ||
989 | * @param cls Closure (unused). | ||
990 | * @param peer Peer ID (tunnel remote peer). | ||
991 | * @param value Peer info. | ||
992 | * | ||
993 | * @return #GNUNET_YES, to keep iterating. | ||
994 | */ | ||
995 | static int | ||
996 | show_peer_iterator (void *cls, | ||
997 | const struct GNUNET_PeerIdentity *peer, | ||
998 | void *value) | ||
999 | { | ||
1000 | struct CadetPeer *p = value; | ||
1001 | struct CadetTunnel *t; | ||
1002 | |||
1003 | t = GCP_get_tunnel (p, | ||
1004 | GNUNET_NO); | ||
1005 | if (NULL != t) | ||
1006 | GCT_debug (t, | ||
1007 | GNUNET_ERROR_TYPE_ERROR); | ||
1008 | LOG (GNUNET_ERROR_TYPE_ERROR, "\n"); | ||
1009 | return GNUNET_YES; | ||
1010 | } | ||
1011 | |||
1012 | |||
1013 | /** | ||
1014 | * Handler for client's INFO_DUMP request. | ||
1015 | * | ||
1016 | * @param cls Identification of the client. | ||
1017 | * @param message The actual message. | ||
1018 | */ | ||
1019 | static void | ||
1020 | handle_info_dump (void *cls, | ||
1021 | const struct GNUNET_MessageHeader *message) | ||
1022 | { | ||
1023 | struct CadetClient *c = cls; | ||
1024 | |||
1025 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1026 | "Received dump info request from client %u\n", | ||
1027 | c->id); | ||
1028 | |||
1029 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1030 | "*************************** DUMP START ***************************\n"); | ||
1031 | for (struct CadetClient *ci = clients_head; NULL != ci; ci = ci->next) | ||
1032 | { | ||
1033 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1034 | "Client %u (%p), handle: %p, ports: %u, own channels: %u, incoming channels: %u\n", | ||
1035 | ci->id, | ||
1036 | ci, | ||
1037 | ci->client, | ||
1038 | (NULL != c->ports) | ||
1039 | ? GNUNET_CONTAINER_multihashmap_size (ci->ports) | ||
1040 | : 0, | ||
1041 | GNUNET_CONTAINER_multihashmap32_size (ci->own_channels), | ||
1042 | GNUNET_CONTAINER_multihashmap32_size (ci->incoming_channels)); | ||
1043 | } | ||
1044 | LOG (GNUNET_ERROR_TYPE_ERROR, "***************************\n"); | ||
1045 | GCP_iterate_all (&show_peer_iterator, | ||
1046 | NULL); | ||
1047 | |||
1048 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1049 | "**************************** DUMP END ****************************\n"); | ||
1050 | |||
1051 | GNUNET_SERVICE_client_continue (c->client); | ||
1052 | } | ||
1053 | |||
1054 | |||
1055 | |||
1056 | /** | ||
1057 | * Callback called when a client connects to the service. | ||
1058 | * | ||
1059 | * @param cls closure for the service | ||
1060 | * @param client the new client that connected to the service | ||
1061 | * @param mq the message queue used to send messages to the client | ||
1062 | * @return @a c | ||
1063 | */ | ||
1064 | static void * | ||
1065 | client_connect_cb (void *cls, | ||
1066 | struct GNUNET_SERVICE_Client *client, | ||
1067 | struct GNUNET_MQ_Handle *mq) | ||
1068 | { | ||
1069 | struct CadetClient *c; | ||
1070 | |||
1071 | c = GNUNET_new (struct CadetClient); | ||
1072 | c->client = client; | ||
1073 | c->mq = mq; | ||
1074 | c->id = next_client_id++; /* overflow not important: just for debug */ | ||
1075 | c->own_channels | ||
1076 | = GNUNET_CONTAINER_multihashmap32_create (32); | ||
1077 | c->incoming_channels | ||
1078 | = GNUNET_CONTAINER_multihashmap32_create (32); | ||
1079 | GNUNET_CONTAINER_DLL_insert (clients_head, | ||
1080 | clients_tail, | ||
1081 | c); | ||
1082 | GNUNET_STATISTICS_update (stats, | ||
1083 | "# clients", | ||
1084 | +1, | ||
1085 | GNUNET_NO); | ||
1086 | return c; | ||
1087 | } | ||
1088 | |||
1089 | |||
1090 | /** | ||
1091 | * Iterator for deleting each channel whose client endpoint disconnected. | ||
1092 | * | ||
1093 | * @param cls Closure (client that has disconnected). | ||
1094 | * @param key The local channel id (used to access the hashmap). | ||
1095 | * @param value The value stored at the key (channel to destroy). | ||
1096 | * @return #GNUNET_OK, keep iterating. | ||
1097 | */ | ||
1098 | static int | ||
1099 | own_channel_destroy_iterator (void *cls, | ||
1100 | uint32_t key, | ||
1101 | void *value) | ||
1102 | { | ||
1103 | struct CadetClient *c = cls; | ||
1104 | struct CadetChannel *ch = value; | ||
1105 | |||
1106 | GNUNET_assert (GNUNET_YES == | ||
1107 | GNUNET_CONTAINER_multihashmap32_remove (c->own_channels, | ||
1108 | key, | ||
1109 | ch)); | ||
1110 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1111 | "Destroying own channel %s, due to client %u shutdown.\n", | ||
1112 | GCCH_2s (ch), | ||
1113 | c->id); | ||
1114 | GCCH_channel_local_destroy (ch); | ||
1115 | return GNUNET_OK; | ||
1116 | } | ||
1117 | |||
1118 | |||
1119 | /** | ||
1120 | * Iterator for deleting each channel whose client endpoint disconnected. | ||
1121 | * | ||
1122 | * @param cls Closure (client that has disconnected). | ||
1123 | * @param key The local channel id (used to access the hashmap). | ||
1124 | * @param value The value stored at the key (channel to destroy). | ||
1125 | * @return #GNUNET_OK, keep iterating. | ||
1126 | */ | ||
1127 | static int | ||
1128 | incoming_channel_destroy_iterator (void *cls, | ||
1129 | uint32_t key, | ||
1130 | void *value) | ||
1131 | { | ||
1132 | struct CadetChannel *ch = value; | ||
1133 | struct CadetClient *c = cls; | ||
1134 | |||
1135 | GNUNET_assert (GNUNET_YES == | ||
1136 | GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels, | ||
1137 | key, | ||
1138 | ch)); | ||
1139 | |||
1140 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1141 | "Destroying incoming channel %s due to client %u shutdown.\n", | ||
1142 | GCCH_2s (ch), | ||
1143 | c->id); | ||
1144 | GCCH_channel_incoming_destroy (ch); | ||
1145 | return GNUNET_OK; | ||
1146 | } | ||
1147 | |||
1148 | |||
1149 | /** | ||
1150 | * Remove client's ports from the global hashmap on disconnect. | ||
1151 | * | ||
1152 | * @param cls Closure (unused). | ||
1153 | * @param key Port. | ||
1154 | * @param value the `struct CadetClient` to remove | ||
1155 | * @return #GNUNET_OK, keep iterating. | ||
1156 | */ | ||
1157 | static int | ||
1158 | client_release_ports (void *cls, | ||
1159 | const struct GNUNET_HashCode *key, | ||
1160 | void *value) | ||
1161 | { | ||
1162 | struct CadetClient *c = value; | ||
1163 | |||
1164 | GNUNET_assert (GNUNET_YES == | ||
1165 | GNUNET_CONTAINER_multihashmap_remove (open_ports, | ||
1166 | key, | ||
1167 | value)); | ||
1168 | GNUNET_assert (GNUNET_YES == | ||
1169 | GNUNET_CONTAINER_multihashmap_remove (c->ports, | ||
1170 | key, | ||
1171 | value)); | ||
1172 | return GNUNET_OK; | ||
1173 | } | ||
1174 | |||
1175 | |||
1176 | /** | ||
1177 | * Callback called when a client disconnected from the service | ||
1178 | * | ||
1179 | * @param cls closure for the service | ||
1180 | * @param client the client that disconnected | ||
1181 | * @param internal_cls should be equal to @a c | ||
1182 | */ | ||
1183 | static void | ||
1184 | client_disconnect_cb (void *cls, | ||
1185 | struct GNUNET_SERVICE_Client *client, | ||
1186 | void *internal_cls) | ||
1187 | { | ||
1188 | struct CadetClient *c = internal_cls; | ||
1189 | |||
1190 | GNUNET_assert (c->client == client); | ||
1191 | c->shutting_down = GNUNET_YES; | ||
1192 | if (NULL != c->own_channels) | ||
1193 | { | ||
1194 | GNUNET_CONTAINER_multihashmap32_iterate (c->own_channels, | ||
1195 | &own_channel_destroy_iterator, | ||
1196 | c); | ||
1197 | GNUNET_CONTAINER_multihashmap32_destroy (c->own_channels); | ||
1198 | } | ||
1199 | if (NULL != c->incoming_channels) | ||
1200 | { | ||
1201 | GNUNET_CONTAINER_multihashmap32_iterate (c->incoming_channels, | ||
1202 | &incoming_channel_destroy_iterator, | ||
1203 | c); | ||
1204 | GNUNET_CONTAINER_multihashmap32_destroy (c->incoming_channels); | ||
1205 | } | ||
1206 | if (NULL != c->ports) | ||
1207 | { | ||
1208 | GNUNET_CONTAINER_multihashmap_iterate (c->ports, | ||
1209 | &client_release_ports, | ||
1210 | c); | ||
1211 | GNUNET_CONTAINER_multihashmap_destroy (c->ports); | ||
1212 | } | ||
1213 | GNUNET_CONTAINER_DLL_remove (clients_head, | ||
1214 | clients_tail, | ||
1215 | c); | ||
1216 | GNUNET_STATISTICS_update (stats, | ||
1217 | "# clients", | ||
1218 | -1, | ||
1219 | GNUNET_NO); | ||
1220 | GNUNET_free (c); | ||
1221 | } | ||
1222 | |||
1223 | |||
1224 | /** | ||
1225 | * Setup CADET internals. | ||
1226 | * | ||
1227 | * @param cls closure | ||
1228 | * @param server the initialized server | ||
1229 | * @param c configuration to use | ||
1230 | */ | ||
1231 | static void | ||
1232 | run (void *cls, | ||
1233 | const struct GNUNET_CONFIGURATION_Handle *c, | ||
1234 | struct GNUNET_SERVICE_Handle *service) | ||
1235 | { | ||
1236 | if (GNUNET_OK != | ||
1237 | GNUNET_CONFIGURATION_get_value_number (c, | ||
1238 | "CADET", | ||
1239 | "RATCHET_MESSAGES", | ||
1240 | &ratchet_messages)) | ||
1241 | { | ||
1242 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, | ||
1243 | "CADET", | ||
1244 | "RATCHET_MESSAGES", | ||
1245 | "needs to be a number"); | ||
1246 | ratchet_messages = 64; | ||
1247 | } | ||
1248 | if (GNUNET_OK != | ||
1249 | GNUNET_CONFIGURATION_get_value_time (c, | ||
1250 | "CADET", | ||
1251 | "RATCHET_TIME", | ||
1252 | &ratchet_time)) | ||
1253 | { | ||
1254 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, | ||
1255 | "CADET", | ||
1256 | "RATCHET_TIME", | ||
1257 | "need delay value"); | ||
1258 | ratchet_time = GNUNET_TIME_UNIT_HOURS; | ||
1259 | } | ||
1260 | |||
1261 | my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration (c); | ||
1262 | if (NULL == my_private_key) | ||
1263 | { | ||
1264 | GNUNET_break (0); | ||
1265 | GNUNET_SCHEDULER_shutdown (); | ||
1266 | return; | ||
1267 | } | ||
1268 | GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, | ||
1269 | &my_full_id.public_key); | ||
1270 | stats = GNUNET_STATISTICS_create ("cadet", | ||
1271 | c); | ||
1272 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | ||
1273 | NULL); | ||
1274 | ats_ch = GNUNET_ATS_connectivity_init (c); | ||
1275 | /* FIXME: optimize code to allow GNUNET_YES here! */ | ||
1276 | open_ports = GNUNET_CONTAINER_multihashmap_create (16, | ||
1277 | GNUNET_NO); | ||
1278 | loose_channels = GNUNET_CONTAINER_multihashmap_create (16, | ||
1279 | GNUNET_NO); | ||
1280 | peers = GNUNET_CONTAINER_multipeermap_create (16, | ||
1281 | GNUNET_YES); | ||
1282 | connections = GNUNET_CONTAINER_multishortmap_create (256, | ||
1283 | GNUNET_YES); | ||
1284 | GCH_init (c); | ||
1285 | GCD_init (c); | ||
1286 | GCO_init (c); | ||
1287 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1288 | "CADET starting at peer %s\n", | ||
1289 | GNUNET_i2s (&my_full_id)); | ||
1290 | |||
1291 | } | ||
1292 | |||
1293 | |||
1294 | /** | ||
1295 | * Define "main" method using service macro. | ||
1296 | */ | ||
1297 | GNUNET_SERVICE_MAIN | ||
1298 | ("cadet", | ||
1299 | GNUNET_SERVICE_OPTION_NONE, | ||
1300 | &run, | ||
1301 | &client_connect_cb, | ||
1302 | &client_disconnect_cb, | ||
1303 | NULL, | ||
1304 | GNUNET_MQ_hd_fixed_size (port_open, | ||
1305 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN, | ||
1306 | struct GNUNET_CADET_PortMessage, | ||
1307 | NULL), | ||
1308 | GNUNET_MQ_hd_fixed_size (port_close, | ||
1309 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, | ||
1310 | struct GNUNET_CADET_PortMessage, | ||
1311 | NULL), | ||
1312 | GNUNET_MQ_hd_fixed_size (channel_create, | ||
1313 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN, | ||
1314 | struct GNUNET_CADET_ChannelOpenMessageMessage, | ||
1315 | NULL), | ||
1316 | GNUNET_MQ_hd_fixed_size (channel_destroy, | ||
1317 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, | ||
1318 | struct GNUNET_CADET_ChannelDestroyMessage, | ||
1319 | NULL), | ||
1320 | GNUNET_MQ_hd_var_size (data, | ||
1321 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, | ||
1322 | struct GNUNET_CADET_LocalData, | ||
1323 | NULL), | ||
1324 | GNUNET_MQ_hd_fixed_size (ack, | ||
1325 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK, | ||
1326 | struct GNUNET_CADET_LocalAck, | ||
1327 | NULL), | ||
1328 | GNUNET_MQ_hd_fixed_size (get_peers, | ||
1329 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS, | ||
1330 | struct GNUNET_MessageHeader, | ||
1331 | NULL), | ||
1332 | GNUNET_MQ_hd_fixed_size (show_peer, | ||
1333 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER, | ||
1334 | struct GNUNET_CADET_LocalInfo, | ||
1335 | NULL), | ||
1336 | GNUNET_MQ_hd_fixed_size (get_tunnels, | ||
1337 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS, | ||
1338 | struct GNUNET_MessageHeader, | ||
1339 | NULL), | ||
1340 | GNUNET_MQ_hd_fixed_size (show_tunnel, | ||
1341 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL, | ||
1342 | struct GNUNET_CADET_LocalInfo, | ||
1343 | NULL), | ||
1344 | GNUNET_MQ_hd_fixed_size (info_dump, | ||
1345 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_DUMP, | ||
1346 | struct GNUNET_MessageHeader, | ||
1347 | NULL), | ||
1348 | GNUNET_MQ_handler_end ()); | ||
1349 | |||
1350 | /* end of gnunet-service-cadet-new.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new.h b/src/cadet/gnunet-service-cadet-new.h new file mode 100644 index 000000000..9f4667e23 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new.h | |||
@@ -0,0 +1,264 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new.h | ||
24 | * @brief Information we track per peer. | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | */ | ||
28 | #ifndef GNUNET_SERVICE_CADET_H | ||
29 | #define GNUNET_SERVICE_CADET_H | ||
30 | |||
31 | #include "gnunet_util_lib.h" | ||
32 | #define NEW_CADET 1 | ||
33 | |||
34 | /** | ||
35 | * A client to the CADET service. Each client gets a unique handle. | ||
36 | */ | ||
37 | struct CadetClient; | ||
38 | |||
39 | /** | ||
40 | * A peer in the GNUnet network. Each peer we care about must have one globally | ||
41 | * unique such handle within this process. | ||
42 | */ | ||
43 | struct CadetPeer; | ||
44 | |||
45 | /** | ||
46 | * Tunnel from us to another peer. There can only be at most one | ||
47 | * tunnel per peer. | ||
48 | */ | ||
49 | struct CadetTunnel; | ||
50 | |||
51 | /** | ||
52 | * Entry in the message queue of a `struct CadetTunnel`. | ||
53 | */ | ||
54 | struct CadetTunnelQueueEntry; | ||
55 | |||
56 | /** | ||
57 | * A path of peer in the GNUnet network. There must only be at most | ||
58 | * once such path. Paths may share disjoint prefixes, but must all | ||
59 | * end at a unique suffix. Paths must also not be proper subsets of | ||
60 | * other existing paths. | ||
61 | */ | ||
62 | struct CadetPeerPath; | ||
63 | |||
64 | /** | ||
65 | * Entry in a peer path. | ||
66 | */ | ||
67 | struct CadetPeerPathEntry | ||
68 | { | ||
69 | /** | ||
70 | * DLL of paths where the same @e peer is at the same offset. | ||
71 | */ | ||
72 | struct CadetPeerPathEntry *next; | ||
73 | |||
74 | /** | ||
75 | * DLL of paths where the same @e peer is at the same offset. | ||
76 | */ | ||
77 | struct CadetPeerPathEntry *prev; | ||
78 | |||
79 | /** | ||
80 | * The peer at this offset of the path. | ||
81 | */ | ||
82 | struct CadetPeer *peer; | ||
83 | |||
84 | /** | ||
85 | * Path this entry belongs to. | ||
86 | */ | ||
87 | struct CadetPeerPath *path; | ||
88 | |||
89 | /** | ||
90 | * Connection using this path, or NULL for none. | ||
91 | */ | ||
92 | struct CadetConnection *cc; | ||
93 | |||
94 | /** | ||
95 | * Path's historic score up to this point. Basically, how often did | ||
96 | * we succeed or fail to use the path up to this entry in a | ||
97 | * connection. Positive values indicate good experiences, negative | ||
98 | * values bad experiences. Code updating the score must guard | ||
99 | * against overflows. | ||
100 | */ | ||
101 | int score; | ||
102 | |||
103 | }; | ||
104 | |||
105 | /** | ||
106 | * Entry in list of connections used by tunnel, with metadata. | ||
107 | */ | ||
108 | struct CadetTConnection | ||
109 | { | ||
110 | /** | ||
111 | * Next in DLL. | ||
112 | */ | ||
113 | struct CadetTConnection *next; | ||
114 | |||
115 | /** | ||
116 | * Prev in DLL. | ||
117 | */ | ||
118 | struct CadetTConnection *prev; | ||
119 | |||
120 | /** | ||
121 | * Connection handle. | ||
122 | */ | ||
123 | struct CadetConnection *cc; | ||
124 | |||
125 | /** | ||
126 | * Tunnel this connection belongs to. | ||
127 | */ | ||
128 | struct CadetTunnel *t; | ||
129 | |||
130 | /** | ||
131 | * Creation time, to keep oldest connection alive. | ||
132 | */ | ||
133 | struct GNUNET_TIME_Absolute created; | ||
134 | |||
135 | /** | ||
136 | * Connection throughput, to keep fastest connection alive. | ||
137 | */ | ||
138 | uint32_t throughput; | ||
139 | |||
140 | /** | ||
141 | * Is the connection currently ready for transmission? | ||
142 | */ | ||
143 | int is_ready; | ||
144 | }; | ||
145 | |||
146 | |||
147 | /** | ||
148 | * Active path through the network (used by a tunnel). There may | ||
149 | * be at most one connection per path. | ||
150 | */ | ||
151 | struct CadetConnection; | ||
152 | |||
153 | /** | ||
154 | * Description of a segment of a `struct CadetConnection` at the | ||
155 | * intermediate peers. Routes are basically entries in a peer's | ||
156 | * routing table for forwarding traffic. At both endpoints, the | ||
157 | * routes are terminated by a `struct CadetConnection`, which knows | ||
158 | * the complete `struct CadetPath` that is formed by the individual | ||
159 | * routes. | ||
160 | */ | ||
161 | struct CadetRoute; | ||
162 | |||
163 | /** | ||
164 | * Logical end-to-end conenction between clients. There can be | ||
165 | * any number of channels between clients. | ||
166 | */ | ||
167 | struct CadetChannel; | ||
168 | |||
169 | /** | ||
170 | * Handle to the statistics service. | ||
171 | */ | ||
172 | extern struct GNUNET_STATISTICS_Handle *stats; | ||
173 | |||
174 | /** | ||
175 | * Handle to communicate with ATS. | ||
176 | */ | ||
177 | extern struct GNUNET_ATS_ConnectivityHandle *ats_ch; | ||
178 | |||
179 | /** | ||
180 | * Local peer own ID. | ||
181 | */ | ||
182 | extern struct GNUNET_PeerIdentity my_full_id; | ||
183 | |||
184 | /** | ||
185 | * Own private key. | ||
186 | */ | ||
187 | extern struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; | ||
188 | |||
189 | /** | ||
190 | * All ports clients of this peer have opened. | ||
191 | */ | ||
192 | extern struct GNUNET_CONTAINER_MultiHashMap *open_ports; | ||
193 | |||
194 | /** | ||
195 | * Map from `struct GNUNET_CADET_ConnectionTunnelIdentifier` | ||
196 | * hash codes to `struct CadetConnection` objects. | ||
197 | */ | ||
198 | extern struct GNUNET_CONTAINER_MultiShortmap *connections; | ||
199 | |||
200 | /** | ||
201 | * Map from ports to channels where the ports were closed at the | ||
202 | * time we got the inbound connection. | ||
203 | * Indexed by port, contains `struct CadetChannel`. | ||
204 | */ | ||
205 | extern struct GNUNET_CONTAINER_MultiHashMap *loose_channels; | ||
206 | |||
207 | /** | ||
208 | * Map from PIDs to `struct CadetPeer` entries. | ||
209 | */ | ||
210 | extern struct GNUNET_CONTAINER_MultiPeerMap *peers; | ||
211 | |||
212 | /** | ||
213 | * How many messages are needed to trigger an AXOLOTL ratchet advance. | ||
214 | */ | ||
215 | extern unsigned long long ratchet_messages; | ||
216 | |||
217 | /** | ||
218 | * How long until we trigger a ratched advance due to time. | ||
219 | */ | ||
220 | extern struct GNUNET_TIME_Relative ratchet_time; | ||
221 | |||
222 | |||
223 | |||
224 | /** | ||
225 | * Send a message to a client. | ||
226 | * | ||
227 | * @param c client to get the message | ||
228 | * @param env envelope with the message | ||
229 | */ | ||
230 | void | ||
231 | GSC_send_to_client (struct CadetClient *c, | ||
232 | struct GNUNET_MQ_Envelope *env); | ||
233 | |||
234 | |||
235 | /** | ||
236 | * Bind incoming channel to this client, and notify client | ||
237 | * about incoming connection. | ||
238 | * | ||
239 | * @param c client to bind to | ||
240 | * @param ch channel to be bound | ||
241 | * @param dest peer that establishes the connection | ||
242 | * @param port port number | ||
243 | * @param options options | ||
244 | * @return local channel number assigned to the new client | ||
245 | */ | ||
246 | struct GNUNET_CADET_ClientChannelNumber | ||
247 | GSC_bind (struct CadetClient *c, | ||
248 | struct CadetChannel *ch, | ||
249 | struct CadetPeer *dest, | ||
250 | const struct GNUNET_HashCode *port, | ||
251 | uint32_t options); | ||
252 | |||
253 | |||
254 | /** | ||
255 | * Return identifier for a client as a string. | ||
256 | * | ||
257 | * @param c client to identify | ||
258 | * @return string for debugging | ||
259 | */ | ||
260 | const char * | ||
261 | GSC_2s (struct CadetClient *c); | ||
262 | |||
263 | |||
264 | #endif | ||
diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c new file mode 100644 index 000000000..5acd098b6 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_channel.c | |||
@@ -0,0 +1,1077 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_channel.c | ||
24 | * @brief logical links between CADET clients | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | * | ||
28 | * TODO: | ||
29 | * - estimate max bandwidth using bursts and use to optimize | ||
30 | * transmission rate(s) | ||
31 | */ | ||
32 | |||
33 | #include "platform.h" | ||
34 | #include "gnunet_util_lib.h" | ||
35 | #include "cadet.h" | ||
36 | #include "gnunet_statistics_service.h" | ||
37 | #include "gnunet-service-cadet-new.h" | ||
38 | #include "gnunet-service-cadet-new_channel.h" | ||
39 | #include "gnunet-service-cadet-new_connection.h" | ||
40 | #include "gnunet-service-cadet-new_tunnels.h" | ||
41 | #include "gnunet-service-cadet-new_peer.h" | ||
42 | #include "gnunet-service-cadet-new_paths.h" | ||
43 | |||
44 | #define LOG(level, ...) GNUNET_log (level,__VA_ARGS__) | ||
45 | |||
46 | /** | ||
47 | * How long do we initially wait before retransmitting? | ||
48 | */ | ||
49 | #define CADET_INITIAL_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250) | ||
50 | |||
51 | /** | ||
52 | * How long do we wait before dropping state about incoming | ||
53 | * connection to closed port? | ||
54 | */ | ||
55 | #define TIMEOUT_CLOSED_PORT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30) | ||
56 | |||
57 | |||
58 | /** | ||
59 | * All the states a connection can be in. | ||
60 | */ | ||
61 | enum CadetChannelState | ||
62 | { | ||
63 | /** | ||
64 | * Uninitialized status, should never appear in operation. | ||
65 | */ | ||
66 | CADET_CHANNEL_NEW, | ||
67 | |||
68 | /** | ||
69 | * Connection create message sent, waiting for ACK. | ||
70 | */ | ||
71 | CADET_CHANNEL_CREATE_SENT, | ||
72 | |||
73 | /** | ||
74 | * Connection confirmed, ready to carry traffic. | ||
75 | */ | ||
76 | CADET_CHANNEL_READY | ||
77 | }; | ||
78 | |||
79 | |||
80 | /** | ||
81 | * Info needed to retry a message in case it gets lost. | ||
82 | * Note that we DO use this structure also for unreliable | ||
83 | * messages. | ||
84 | */ | ||
85 | struct CadetReliableMessage | ||
86 | { | ||
87 | /** | ||
88 | * Double linked list, FIFO style | ||
89 | */ | ||
90 | struct CadetReliableMessage *next; | ||
91 | |||
92 | /** | ||
93 | * Double linked list, FIFO style | ||
94 | */ | ||
95 | struct CadetReliableMessage *prev; | ||
96 | |||
97 | /** | ||
98 | * Which channel is this message in? | ||
99 | */ | ||
100 | struct CadetChannel *ch; | ||
101 | |||
102 | /** | ||
103 | * Entry in the tunnels queue for this message, NULL if it has left | ||
104 | * the tunnel. Used to cancel transmission in case we receive an | ||
105 | * ACK in time. | ||
106 | */ | ||
107 | struct CadetTunnelQueueEntry *qe; | ||
108 | |||
109 | /** | ||
110 | * How soon should we retry if we fail to get an ACK? | ||
111 | * Messages in the queue are sorted by this value. | ||
112 | */ | ||
113 | struct GNUNET_TIME_Absolute next_retry; | ||
114 | |||
115 | /** | ||
116 | * How long do we wait for an ACK after transmission? | ||
117 | * Use for the back-off calculation. | ||
118 | */ | ||
119 | struct GNUNET_TIME_Relative retry_delay; | ||
120 | |||
121 | /** | ||
122 | * Data message we are trying to send. | ||
123 | */ | ||
124 | struct GNUNET_CADET_ChannelAppDataMessage data_message; | ||
125 | |||
126 | /* followed by variable-size payload */ | ||
127 | }; | ||
128 | |||
129 | |||
130 | /** | ||
131 | * List of received out-of-order data messages. | ||
132 | */ | ||
133 | struct CadetOutOfOrderMessage | ||
134 | { | ||
135 | /** | ||
136 | * Double linked list, FIFO style | ||
137 | */ | ||
138 | struct CadetOutOfOrderMessage *next; | ||
139 | |||
140 | /** | ||
141 | * Double linked list, FIFO style | ||
142 | */ | ||
143 | struct CadetOutOfOrderMessage *prev; | ||
144 | |||
145 | /** | ||
146 | * ID of the message (ACK needed to free) | ||
147 | */ | ||
148 | struct ChannelMessageIdentifier mid; | ||
149 | |||
150 | /** | ||
151 | * The envelope with the payload of the out-of-order message | ||
152 | */ | ||
153 | struct GNUNET_MQ_Envelope *env; | ||
154 | |||
155 | }; | ||
156 | |||
157 | |||
158 | /** | ||
159 | * Struct containing all information regarding a channel to a remote client. | ||
160 | */ | ||
161 | struct CadetChannel | ||
162 | { | ||
163 | /** | ||
164 | * Tunnel this channel is in. | ||
165 | */ | ||
166 | struct CadetTunnel *t; | ||
167 | |||
168 | /** | ||
169 | * Last entry in the tunnel's queue relating to control messages | ||
170 | * (#GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN or | ||
171 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK). Used to cancel | ||
172 | * transmission in case we receive updated information. | ||
173 | */ | ||
174 | struct CadetTunnelQueueEntry *last_control_qe; | ||
175 | |||
176 | /** | ||
177 | * Client owner of the tunnel, if any. | ||
178 | * (Used if this channel represends the initiating end of the tunnel.) | ||
179 | */ | ||
180 | struct CadetClient *owner; | ||
181 | |||
182 | /** | ||
183 | * Client destination of the tunnel, if any. | ||
184 | * (Used if this channel represents the listening end of the tunnel.) | ||
185 | */ | ||
186 | struct CadetClient *dest; | ||
187 | |||
188 | /** | ||
189 | * Head of DLL of messages sent and not yet ACK'd. | ||
190 | */ | ||
191 | struct CadetReliableMessage *head_sent; | ||
192 | |||
193 | /** | ||
194 | * Tail of DLL of messages sent and not yet ACK'd. | ||
195 | */ | ||
196 | struct CadetReliableMessage *tail_sent; | ||
197 | |||
198 | /** | ||
199 | * Head of DLL of messages received out of order or while client was unready. | ||
200 | */ | ||
201 | struct CadetOutOfOrderMessage *head_recv; | ||
202 | |||
203 | /** | ||
204 | * Tail DLL of messages received out of order or while client was unready. | ||
205 | */ | ||
206 | struct CadetOutOfOrderMessage *tail_recv; | ||
207 | |||
208 | /** | ||
209 | * Task to resend/poll in case no ACK is received. | ||
210 | */ | ||
211 | struct GNUNET_SCHEDULER_Task *retry_task; | ||
212 | |||
213 | /** | ||
214 | * Last time the channel was used | ||
215 | */ | ||
216 | struct GNUNET_TIME_Absolute timestamp; | ||
217 | |||
218 | /** | ||
219 | * Destination port of the channel. | ||
220 | */ | ||
221 | struct GNUNET_HashCode port; | ||
222 | |||
223 | /** | ||
224 | * Counter for exponential backoff. | ||
225 | */ | ||
226 | struct GNUNET_TIME_Relative retry_time; | ||
227 | |||
228 | /** | ||
229 | * How long does it usually take to get an ACK. | ||
230 | */ | ||
231 | struct GNUNET_TIME_Relative expected_delay; | ||
232 | |||
233 | /** | ||
234 | * Bitfield of already-received messages past @e mid_recv. | ||
235 | */ | ||
236 | uint64_t mid_futures; | ||
237 | |||
238 | /** | ||
239 | * Next MID expected for incoming traffic. | ||
240 | */ | ||
241 | struct ChannelMessageIdentifier mid_recv; | ||
242 | |||
243 | /** | ||
244 | * Next MID to use for outgoing traffic. | ||
245 | */ | ||
246 | struct ChannelMessageIdentifier mid_send; | ||
247 | |||
248 | /** | ||
249 | * Total (reliable) messages pending ACK for this channel. | ||
250 | */ | ||
251 | unsigned int pending_messages; | ||
252 | |||
253 | /** | ||
254 | * Maximum (reliable) messages pending ACK for this channel | ||
255 | * before we throttle the client. | ||
256 | */ | ||
257 | unsigned int max_pending_messages; | ||
258 | |||
259 | /** | ||
260 | * Number identifying this channel in its tunnel. | ||
261 | */ | ||
262 | struct GNUNET_CADET_ChannelTunnelNumber gid; | ||
263 | |||
264 | /** | ||
265 | * Local tunnel number for local client owning the channel. | ||
266 | * ( >= #GNUNET_CADET_LOCAL_CHANNEL_ID_CLI or 0 ) | ||
267 | */ | ||
268 | struct GNUNET_CADET_ClientChannelNumber lid; | ||
269 | |||
270 | /** | ||
271 | * Channel state. | ||
272 | */ | ||
273 | enum CadetChannelState state; | ||
274 | |||
275 | /** | ||
276 | * Can we send data to the client? | ||
277 | */ | ||
278 | int client_ready; | ||
279 | |||
280 | /** | ||
281 | * Can the client send data to us? | ||
282 | */ | ||
283 | int client_allowed; | ||
284 | |||
285 | /** | ||
286 | * Is the tunnel bufferless (minimum latency)? | ||
287 | */ | ||
288 | int nobuffer; | ||
289 | |||
290 | /** | ||
291 | * Is the tunnel reliable? | ||
292 | */ | ||
293 | int reliable; | ||
294 | |||
295 | /** | ||
296 | * Is the tunnel out-of-order? | ||
297 | */ | ||
298 | int out_of_order; | ||
299 | |||
300 | /** | ||
301 | * Flag to signal the destruction of the channel. If this is set to | ||
302 | * #GNUNET_YES the channel will be destroyed once the queue is | ||
303 | * empty. | ||
304 | */ | ||
305 | int destroy; | ||
306 | |||
307 | }; | ||
308 | |||
309 | |||
310 | |||
311 | /** | ||
312 | * Get the static string for identification of the channel. | ||
313 | * | ||
314 | * @param ch Channel. | ||
315 | * | ||
316 | * @return Static string with the channel IDs. | ||
317 | */ | ||
318 | const char * | ||
319 | GCCH_2s (const struct CadetChannel *ch) | ||
320 | { | ||
321 | static char buf[128]; | ||
322 | |||
323 | if (NULL == ch) | ||
324 | return "(NULL Channel)"; | ||
325 | GNUNET_snprintf (buf, | ||
326 | sizeof (buf), | ||
327 | "%s:%s gid:%X (%X)", | ||
328 | GCT_2s (ch->t), | ||
329 | GNUNET_h2s (&ch->port), | ||
330 | ch->gid, | ||
331 | ntohl (ch->lid.channel_of_client)); | ||
332 | return buf; | ||
333 | } | ||
334 | |||
335 | |||
336 | /** | ||
337 | * Get the channel's public ID. | ||
338 | * | ||
339 | * @param ch Channel. | ||
340 | * | ||
341 | * @return ID used to identify the channel with the remote peer. | ||
342 | */ | ||
343 | struct GNUNET_CADET_ChannelTunnelNumber | ||
344 | GCCH_get_id (const struct CadetChannel *ch) | ||
345 | { | ||
346 | return ch->gid; | ||
347 | } | ||
348 | |||
349 | |||
350 | /** | ||
351 | * Destroy the given channel. | ||
352 | * | ||
353 | * @param ch channel to destroy | ||
354 | */ | ||
355 | static void | ||
356 | channel_destroy (struct CadetChannel *ch) | ||
357 | { | ||
358 | struct CadetReliableMessage *crm; | ||
359 | struct CadetOutOfOrderMessage *com; | ||
360 | |||
361 | while (NULL != (crm = ch->head_sent)) | ||
362 | { | ||
363 | GNUNET_assert (ch == crm->ch); | ||
364 | if (NULL != crm->qe) | ||
365 | { | ||
366 | GCT_send_cancel (crm->qe); | ||
367 | crm->qe = NULL; | ||
368 | } | ||
369 | GNUNET_CONTAINER_DLL_remove (ch->head_sent, | ||
370 | ch->tail_sent, | ||
371 | crm); | ||
372 | GNUNET_free (crm); | ||
373 | } | ||
374 | while (NULL != (com = ch->head_recv)) | ||
375 | { | ||
376 | GNUNET_CONTAINER_DLL_remove (ch->head_recv, | ||
377 | ch->tail_recv, | ||
378 | com); | ||
379 | GNUNET_MQ_discard (com->env); | ||
380 | GNUNET_free (com); | ||
381 | } | ||
382 | if (NULL != ch->last_control_qe) | ||
383 | { | ||
384 | GCT_send_cancel (ch->last_control_qe); | ||
385 | ch->last_control_qe = NULL; | ||
386 | } | ||
387 | if (NULL != ch->retry_task) | ||
388 | { | ||
389 | GNUNET_SCHEDULER_cancel (ch->retry_task); | ||
390 | ch->retry_task = NULL; | ||
391 | } | ||
392 | GCT_remove_channel (ch->t, | ||
393 | ch, | ||
394 | ch->gid); | ||
395 | GNUNET_free (ch); | ||
396 | } | ||
397 | |||
398 | |||
399 | /** | ||
400 | * Send a channel create message. | ||
401 | * | ||
402 | * @param cls Channel for which to send. | ||
403 | */ | ||
404 | static void | ||
405 | send_create (void *cls); | ||
406 | |||
407 | |||
408 | /** | ||
409 | * Function called once the tunnel confirms that we sent the | ||
410 | * create message. Delays for a bit until we retry. | ||
411 | * | ||
412 | * @param cls our `struct CadetChannel`. | ||
413 | */ | ||
414 | static void | ||
415 | create_sent_cb (void *cls) | ||
416 | { | ||
417 | struct CadetChannel *ch = cls; | ||
418 | |||
419 | ch->last_control_qe = NULL; | ||
420 | ch->retry_time = GNUNET_TIME_STD_BACKOFF (ch->retry_time); | ||
421 | ch->retry_task = GNUNET_SCHEDULER_add_delayed (ch->retry_time, | ||
422 | &send_create, | ||
423 | ch); | ||
424 | } | ||
425 | |||
426 | |||
427 | /** | ||
428 | * Send a channel create message. | ||
429 | * | ||
430 | * @param cls Channel for which to send. | ||
431 | */ | ||
432 | static void | ||
433 | send_create (void *cls) | ||
434 | { | ||
435 | struct CadetChannel *ch = cls; | ||
436 | struct GNUNET_CADET_ChannelOpenMessage msgcc; | ||
437 | uint32_t options; | ||
438 | |||
439 | options = 0; | ||
440 | if (ch->nobuffer) | ||
441 | options |= GNUNET_CADET_OPTION_NOBUFFER; | ||
442 | if (ch->reliable) | ||
443 | options |= GNUNET_CADET_OPTION_RELIABLE; | ||
444 | if (ch->out_of_order) | ||
445 | options |= GNUNET_CADET_OPTION_OUT_OF_ORDER; | ||
446 | msgcc.header.size = htons (sizeof (msgcc)); | ||
447 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); | ||
448 | msgcc.opt = htonl (options); | ||
449 | msgcc.port = ch->port; | ||
450 | msgcc.chid = ch->gid; | ||
451 | ch->state = CADET_CHANNEL_CREATE_SENT; | ||
452 | ch->last_control_qe = GCT_send (ch->t, | ||
453 | &msgcc.header, | ||
454 | &create_sent_cb, | ||
455 | ch); | ||
456 | } | ||
457 | |||
458 | |||
459 | /** | ||
460 | * Create a new channel. | ||
461 | * | ||
462 | * @param owner local client owning the channel | ||
463 | * @param owner_id local chid of this channel at the @a owner | ||
464 | * @param destination peer to which we should build the channel | ||
465 | * @param port desired port at @a destination | ||
466 | * @param options options for the channel | ||
467 | * @return handle to the new channel | ||
468 | */ | ||
469 | struct CadetChannel * | ||
470 | GCCH_channel_local_new (struct CadetClient *owner, | ||
471 | struct GNUNET_CADET_ClientChannelNumber owner_id, | ||
472 | struct CadetPeer *destination, | ||
473 | const struct GNUNET_HashCode *port, | ||
474 | uint32_t options) | ||
475 | { | ||
476 | struct CadetChannel *ch; | ||
477 | |||
478 | ch = GNUNET_new (struct CadetChannel); | ||
479 | ch->max_pending_messages = 32; /* FIXME: allow control via options | ||
480 | or adjust dynamically... */ | ||
481 | ch->owner = owner; | ||
482 | ch->lid = owner_id; | ||
483 | ch->port = *port; | ||
484 | ch->t = GCP_get_tunnel (destination, | ||
485 | GNUNET_YES); | ||
486 | ch->gid = GCT_add_channel (ch->t, | ||
487 | ch); | ||
488 | ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; | ||
489 | ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER)); | ||
490 | ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE)); | ||
491 | ch->out_of_order = (0 != (options & GNUNET_CADET_OPTION_OUT_OF_ORDER)); | ||
492 | ch->retry_task = GNUNET_SCHEDULER_add_now (&send_create, | ||
493 | ch); | ||
494 | GNUNET_STATISTICS_update (stats, | ||
495 | "# channels", | ||
496 | 1, | ||
497 | GNUNET_NO); | ||
498 | return ch; | ||
499 | } | ||
500 | |||
501 | |||
502 | /** | ||
503 | * We had an incoming channel to a port that is closed. | ||
504 | * It has not been opened for a while, drop it. | ||
505 | * | ||
506 | * @param cls the channel to drop | ||
507 | */ | ||
508 | static void | ||
509 | timeout_closed_cb (void *cls) | ||
510 | { | ||
511 | struct CadetChannel *ch = cls; | ||
512 | |||
513 | ch->retry_task = NULL; | ||
514 | channel_destroy (ch); | ||
515 | } | ||
516 | |||
517 | |||
518 | /** | ||
519 | * Create a new channel. | ||
520 | * | ||
521 | * @param t tunnel to the remote peer | ||
522 | * @param gid identifier of this channel in the tunnel | ||
523 | * @param port desired local port | ||
524 | * @param options options for the channel | ||
525 | * @return handle to the new channel | ||
526 | */ | ||
527 | struct CadetChannel * | ||
528 | GCCH_channel_incoming_new (struct CadetTunnel *t, | ||
529 | struct GNUNET_CADET_ChannelTunnelNumber gid, | ||
530 | const struct GNUNET_HashCode *port, | ||
531 | uint32_t options) | ||
532 | { | ||
533 | struct CadetChannel *ch; | ||
534 | struct CadetClient *c; | ||
535 | |||
536 | ch = GNUNET_new (struct CadetChannel); | ||
537 | ch->max_pending_messages = 32; /* FIXME: allow control via options | ||
538 | or adjust dynamically... */ | ||
539 | ch->port = *port; | ||
540 | ch->t = t; | ||
541 | ch->gid = gid; | ||
542 | ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; | ||
543 | ch->nobuffer = (0 != (options & GNUNET_CADET_OPTION_NOBUFFER)); | ||
544 | ch->reliable = (0 != (options & GNUNET_CADET_OPTION_RELIABLE)); | ||
545 | ch->out_of_order = (0 != (options & GNUNET_CADET_OPTION_OUT_OF_ORDER)); | ||
546 | GNUNET_STATISTICS_update (stats, | ||
547 | "# channels", | ||
548 | 1, | ||
549 | GNUNET_NO); | ||
550 | |||
551 | c = GNUNET_CONTAINER_multihashmap_get (open_ports, | ||
552 | port); | ||
553 | if (NULL == c) | ||
554 | { | ||
555 | /* port closed, wait for it to possibly open */ | ||
556 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, | ||
557 | port, | ||
558 | ch, | ||
559 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
560 | ch->retry_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT_CLOSED_PORT, | ||
561 | &timeout_closed_cb, | ||
562 | ch); | ||
563 | } | ||
564 | else | ||
565 | { | ||
566 | GCCH_bind (ch, | ||
567 | c); | ||
568 | } | ||
569 | GNUNET_STATISTICS_update (stats, | ||
570 | "# channels", | ||
571 | 1, | ||
572 | GNUNET_NO); | ||
573 | return ch; | ||
574 | } | ||
575 | |||
576 | |||
577 | /** | ||
578 | * Function called once the tunnel confirms that we sent the | ||
579 | * ACK message. Just remembers it was sent, we do not expect | ||
580 | * ACKs for ACKs ;-). | ||
581 | * | ||
582 | * @param cls our `struct CadetChannel`. | ||
583 | */ | ||
584 | static void | ||
585 | send_ack_cb (void *cls) | ||
586 | { | ||
587 | struct CadetChannel *ch = cls; | ||
588 | |||
589 | ch->last_control_qe = NULL; | ||
590 | } | ||
591 | |||
592 | |||
593 | /** | ||
594 | * Compute and send the current ACK to the other peer. | ||
595 | * | ||
596 | * @param ch channel to send the ACK for | ||
597 | */ | ||
598 | static void | ||
599 | send_channel_ack (struct CadetChannel *ch) | ||
600 | { | ||
601 | struct GNUNET_CADET_ChannelDataAckMessage msg; | ||
602 | |||
603 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK); | ||
604 | msg.header.size = htons (sizeof (msg)); | ||
605 | msg.gid = ch->gid; | ||
606 | msg.mid.mid = htonl (ntohl (ch->mid_recv.mid) - 1); | ||
607 | msg.futures = GNUNET_htonll (ch->mid_futures); | ||
608 | if (NULL != ch->last_control_qe) | ||
609 | GCT_send_cancel (ch->last_control_qe); | ||
610 | ch->last_control_qe = GCT_send (ch->t, | ||
611 | &msg.header, | ||
612 | &send_ack_cb, | ||
613 | ch); | ||
614 | } | ||
615 | |||
616 | |||
617 | /** | ||
618 | * Send our initial ACK to the client confirming that the | ||
619 | * connection is up. | ||
620 | * | ||
621 | * @param cls the `struct CadetChannel` | ||
622 | */ | ||
623 | static void | ||
624 | send_connect_ack (void *cls) | ||
625 | { | ||
626 | struct CadetChannel *ch = cls; | ||
627 | |||
628 | ch->retry_task = NULL; | ||
629 | send_channel_ack (ch); | ||
630 | } | ||
631 | |||
632 | |||
633 | /** | ||
634 | * A client is bound to the port that we have a channel | ||
635 | * open to. Send the acknowledgement for the connection | ||
636 | * request and establish the link with the client. | ||
637 | * | ||
638 | * @param ch open incoming channel | ||
639 | * @param c client listening on the respective port | ||
640 | */ | ||
641 | void | ||
642 | GCCH_bind (struct CadetChannel *ch, | ||
643 | struct CadetClient *c) | ||
644 | { | ||
645 | uint32_t options; | ||
646 | |||
647 | if (NULL != ch->retry_task) | ||
648 | { | ||
649 | /* there might be a timeout task here */ | ||
650 | GNUNET_SCHEDULER_cancel (ch->retry_task); | ||
651 | ch->retry_task = NULL; | ||
652 | } | ||
653 | options = 0; | ||
654 | if (ch->nobuffer) | ||
655 | options |= GNUNET_CADET_OPTION_NOBUFFER; | ||
656 | if (ch->reliable) | ||
657 | options |= GNUNET_CADET_OPTION_RELIABLE; | ||
658 | if (ch->out_of_order) | ||
659 | options |= GNUNET_CADET_OPTION_OUT_OF_ORDER; | ||
660 | ch->dest = c; | ||
661 | ch->lid = GSC_bind (c, | ||
662 | ch, | ||
663 | GCT_get_destination (ch->t), | ||
664 | &ch->port, | ||
665 | options); | ||
666 | ch->mid_recv.mid = htonl (1); /* The CONNECT counts as message 0! */ | ||
667 | |||
668 | /* notify other peer that we accepted the connection */ | ||
669 | ch->retry_task = GNUNET_SCHEDULER_add_now (&send_connect_ack, | ||
670 | ch); | ||
671 | } | ||
672 | |||
673 | |||
674 | /** | ||
675 | * Destroy locally created channel. Called by the | ||
676 | * local client, so no need to tell the client. | ||
677 | * | ||
678 | * @param ch channel to destroy | ||
679 | */ | ||
680 | void | ||
681 | GCCH_channel_local_destroy (struct CadetChannel *ch) | ||
682 | { | ||
683 | if (GNUNET_YES == ch->destroy) | ||
684 | { | ||
685 | /* other end already destroyed, with the local client gone, no need | ||
686 | to finish transmissions, just destroy immediately. */ | ||
687 | channel_destroy (ch); | ||
688 | return; | ||
689 | } | ||
690 | if (NULL != ch->head_sent) | ||
691 | { | ||
692 | /* allow send queue to train first */ | ||
693 | ch->destroy = GNUNET_YES; | ||
694 | return; | ||
695 | } | ||
696 | /* Nothing left to do, just finish destruction */ | ||
697 | channel_destroy (ch); | ||
698 | } | ||
699 | |||
700 | |||
701 | /** | ||
702 | * Destroy channel that was incoming. Called by the | ||
703 | * local client, so no need to tell the client. | ||
704 | * | ||
705 | * @param ch channel to destroy | ||
706 | */ | ||
707 | void | ||
708 | GCCH_channel_incoming_destroy (struct CadetChannel *ch) | ||
709 | { | ||
710 | if (GNUNET_YES == ch->destroy) | ||
711 | { | ||
712 | /* other end already destroyed, with the remote client gone, no need | ||
713 | to finish transmissions, just destroy immediately. */ | ||
714 | channel_destroy (ch); | ||
715 | return; | ||
716 | } | ||
717 | if (NULL != ch->head_recv) | ||
718 | { | ||
719 | /* allow local client to see all data first */ | ||
720 | ch->destroy = GNUNET_YES; | ||
721 | return; | ||
722 | } | ||
723 | /* Nothing left to do, just finish destruction */ | ||
724 | channel_destroy (ch); | ||
725 | } | ||
726 | |||
727 | |||
728 | /** | ||
729 | * Destroy channel, based on the other peer closing the | ||
730 | * connection. Also needs to remove this channel from | ||
731 | * the tunnel. | ||
732 | * | ||
733 | * FIXME: need to make it possible to defer destruction until we have | ||
734 | * received all messages up to the destroy, and right now the destroy | ||
735 | * message (and this API) fails to give is the information we need! | ||
736 | * | ||
737 | * FIXME: also need to know if the other peer got a destroy from | ||
738 | * us before! | ||
739 | * | ||
740 | * @param ch channel to destroy | ||
741 | */ | ||
742 | void | ||
743 | GCCH_channel_remote_destroy (struct CadetChannel *ch) | ||
744 | { | ||
745 | GNUNET_break (0); // FIXME! | ||
746 | } | ||
747 | |||
748 | |||
749 | /** | ||
750 | * Function called once the tunnel has sent one of our messages. | ||
751 | * If the message is unreliable, simply frees the `crm`. If the | ||
752 | * message was reliable, calculate retransmission time and | ||
753 | * wait for ACK (or retransmit). | ||
754 | * | ||
755 | * @param cls the `struct CadetReliableMessage` that was sent | ||
756 | */ | ||
757 | static void | ||
758 | data_sent_cb (void *cls); | ||
759 | |||
760 | |||
761 | /** | ||
762 | * We need to retry a transmission, the last one took too long to | ||
763 | * be acknowledged. | ||
764 | * | ||
765 | * @param cls the `struct CadetChannel` where we need to retransmit | ||
766 | */ | ||
767 | static void | ||
768 | retry_transmission (void *cls) | ||
769 | { | ||
770 | struct CadetChannel *ch = cls; | ||
771 | struct CadetReliableMessage *crm = ch->head_sent; | ||
772 | |||
773 | GNUNET_assert (NULL == crm->qe); | ||
774 | crm->qe = GCT_send (ch->t, | ||
775 | &crm->data_message.header, | ||
776 | &data_sent_cb, | ||
777 | crm); | ||
778 | } | ||
779 | |||
780 | |||
781 | /** | ||
782 | * Check if we can now allow the client to transmit, and if so, | ||
783 | * let the client know about it. | ||
784 | * | ||
785 | * @param ch channel to check | ||
786 | */ | ||
787 | static void | ||
788 | GCCH_check_allow_client (struct CadetChannel *ch) | ||
789 | { | ||
790 | struct GNUNET_MQ_Envelope *env; | ||
791 | struct GNUNET_CADET_LocalAck *msg; | ||
792 | |||
793 | if (GNUNET_YES == ch->client_allowed) | ||
794 | return; /* client already allowed! */ | ||
795 | if (CADET_CHANNEL_READY != ch->state) | ||
796 | { | ||
797 | /* destination did not yet ACK our CREATE! */ | ||
798 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
799 | "Channel %s not yet ready, throttling client until ACK.\n", | ||
800 | GCCH_2s (ch)); | ||
801 | return; | ||
802 | } | ||
803 | if (ch->pending_messages > ch->max_pending_messages) | ||
804 | { | ||
805 | /* Too many messages in queue. */ | ||
806 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
807 | "Message queue still too long on channel %s, throttling client until ACK.\n", | ||
808 | GCCH_2s (ch)); | ||
809 | return; | ||
810 | } | ||
811 | if ( (NULL != ch->head_sent) && | ||
812 | (64 <= ntohl (ch->mid_send.mid) - ntohl (ch->head_sent->data_message.mid.mid)) ) | ||
813 | { | ||
814 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
815 | "Gap in ACKs too big on channel %s, throttling client until ACK.\n", | ||
816 | GCCH_2s (ch)); | ||
817 | return; | ||
818 | } | ||
819 | ch->client_allowed = GNUNET_YES; | ||
820 | |||
821 | |||
822 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
823 | "Sending local ack to channel %s client\n", | ||
824 | GCCH_2s (ch)); | ||
825 | env = GNUNET_MQ_msg (msg, | ||
826 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); | ||
827 | msg->channel_id = ch->lid; | ||
828 | GSC_send_to_client (ch->owner ? ch->owner : ch->dest, | ||
829 | env); | ||
830 | } | ||
831 | |||
832 | |||
833 | /** | ||
834 | * Function called once the tunnel has sent one of our messages. | ||
835 | * If the message is unreliable, simply frees the `crm`. If the | ||
836 | * message was reliable, calculate retransmission time and | ||
837 | * wait for ACK (or retransmit). | ||
838 | * | ||
839 | * @param cls the `struct CadetReliableMessage` that was sent | ||
840 | */ | ||
841 | static void | ||
842 | data_sent_cb (void *cls) | ||
843 | { | ||
844 | struct CadetReliableMessage *crm = cls; | ||
845 | struct CadetChannel *ch = crm->ch; | ||
846 | struct CadetReliableMessage *off; | ||
847 | |||
848 | crm->qe = NULL; | ||
849 | GNUNET_CONTAINER_DLL_remove (ch->head_sent, | ||
850 | ch->tail_sent, | ||
851 | crm); | ||
852 | if (GNUNET_NO == ch->reliable) | ||
853 | { | ||
854 | GNUNET_free (crm); | ||
855 | ch->pending_messages--; | ||
856 | GCCH_check_allow_client (ch); | ||
857 | return; | ||
858 | } | ||
859 | if (0 == crm->retry_delay.rel_value_us) | ||
860 | crm->retry_delay = ch->expected_delay; | ||
861 | crm->next_retry = GNUNET_TIME_relative_to_absolute (crm->retry_delay); | ||
862 | |||
863 | /* find position for re-insertion into the DLL */ | ||
864 | if ( (NULL == ch->head_sent) || | ||
865 | (crm->next_retry.abs_value_us < ch->head_sent->next_retry.abs_value_us) ) | ||
866 | { | ||
867 | /* insert at HEAD, also (re)schedule retry task! */ | ||
868 | GNUNET_CONTAINER_DLL_insert (ch->head_sent, | ||
869 | ch->tail_sent, | ||
870 | crm); | ||
871 | if (NULL != ch->retry_task) | ||
872 | GNUNET_SCHEDULER_cancel (ch->retry_task); | ||
873 | ch->retry_task = GNUNET_SCHEDULER_add_delayed (crm->retry_delay, | ||
874 | &retry_transmission, | ||
875 | ch); | ||
876 | return; | ||
877 | } | ||
878 | for (off = ch->head_sent; NULL != off; off = off->next) | ||
879 | if (crm->next_retry.abs_value_us < off->next_retry.abs_value_us) | ||
880 | break; | ||
881 | if (NULL == off) | ||
882 | { | ||
883 | /* insert at tail */ | ||
884 | GNUNET_CONTAINER_DLL_insert_tail (ch->head_sent, | ||
885 | ch->tail_sent, | ||
886 | crm); | ||
887 | } | ||
888 | else | ||
889 | { | ||
890 | /* insert before off */ | ||
891 | GNUNET_CONTAINER_DLL_insert_after (ch->head_sent, | ||
892 | ch->tail_sent, | ||
893 | off->prev, | ||
894 | crm); | ||
895 | } | ||
896 | } | ||
897 | |||
898 | |||
899 | /** | ||
900 | * Handle data given by a client. | ||
901 | * | ||
902 | * Check whether the client is allowed to send in this tunnel, save if | ||
903 | * channel is reliable and send an ACK to the client if there is still | ||
904 | * buffer space in the tunnel. | ||
905 | * | ||
906 | * @param ch Channel. | ||
907 | * @param message payload to transmit. | ||
908 | * @return #GNUNET_OK if everything goes well, | ||
909 | * #GNUNET_SYSERR in case of an error. | ||
910 | */ | ||
911 | int | ||
912 | GCCH_handle_local_data (struct CadetChannel *ch, | ||
913 | const struct GNUNET_MessageHeader *message) | ||
914 | { | ||
915 | uint16_t payload_size = ntohs (message->size); | ||
916 | struct CadetReliableMessage *crm; | ||
917 | |||
918 | if (GNUNET_NO == ch->client_allowed) | ||
919 | { | ||
920 | GNUNET_break_op (0); | ||
921 | return GNUNET_SYSERR; | ||
922 | } | ||
923 | ch->client_allowed = GNUNET_NO; | ||
924 | ch->pending_messages++; | ||
925 | |||
926 | /* Everything is correct, send the message. */ | ||
927 | crm = GNUNET_malloc (sizeof (*crm) + payload_size); | ||
928 | crm->ch = ch; | ||
929 | crm->data_message.header.size = htons (sizeof (struct GNUNET_CADET_ChannelAppDataMessage) + payload_size); | ||
930 | crm->data_message.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA); | ||
931 | ch->mid_send.mid = htonl (ntohl (ch->mid_send.mid) + 1); | ||
932 | crm->data_message.mid = ch->mid_send; | ||
933 | crm->data_message.gid = ch->gid; | ||
934 | GNUNET_memcpy (&crm[1], | ||
935 | message, | ||
936 | payload_size); | ||
937 | GNUNET_CONTAINER_DLL_insert (ch->head_sent, | ||
938 | ch->tail_sent, | ||
939 | crm); | ||
940 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
941 | "Sending %u bytes from local client to channel %s\n", | ||
942 | payload_size, | ||
943 | GCCH_2s (ch)); | ||
944 | crm->qe = GCT_send (ch->t, | ||
945 | &crm->data_message.header, | ||
946 | &data_sent_cb, | ||
947 | crm); | ||
948 | GCCH_check_allow_client (ch); | ||
949 | return GNUNET_OK; | ||
950 | } | ||
951 | |||
952 | |||
953 | /** | ||
954 | * Try to deliver messages to the local client, if it is ready for more. | ||
955 | * | ||
956 | * @param ch channel to process | ||
957 | */ | ||
958 | static void | ||
959 | send_client_buffered_data (struct CadetChannel *ch) | ||
960 | { | ||
961 | struct CadetOutOfOrderMessage *com; | ||
962 | |||
963 | if (GNUNET_NO == ch->client_ready) | ||
964 | return; /* client not ready */ | ||
965 | com = ch->head_recv; | ||
966 | if (NULL == com) | ||
967 | return; /* none pending */ | ||
968 | if ( (com->mid.mid != ch->mid_recv.mid) && | ||
969 | (GNUNET_NO == ch->out_of_order) ) | ||
970 | return; /* missing next one in-order */ | ||
971 | |||
972 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
973 | "Passing payload message to client on channel %s\n", | ||
974 | GCCH_2s (ch)); | ||
975 | |||
976 | /* all good, pass next message to client */ | ||
977 | GNUNET_CONTAINER_DLL_remove (ch->head_recv, | ||
978 | ch->tail_recv, | ||
979 | com); | ||
980 | ch->mid_recv.mid = htonl (1 + ntohl (com->mid.mid)); | ||
981 | ch->mid_futures >>= 1; /* equivalent to division by 2 */ | ||
982 | GSC_send_to_client (ch->owner ? ch->owner : ch->dest, | ||
983 | com->env); | ||
984 | GNUNET_free (com); | ||
985 | if ( (0xFFULL == (ch->mid_futures & 0xFFULL)) && | ||
986 | (GNUNET_YES == ch->reliable) ) | ||
987 | { | ||
988 | /* The next 15 messages were also already received (0xFF), this | ||
989 | suggests that the sender may be blocked on flow control | ||
990 | urgently waiting for an ACK from us. (As we have an inherent | ||
991 | maximum of 64 bits, and 15 is getting too close for comfort.) | ||
992 | So we should send one now. */ | ||
993 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
994 | "Sender on channel %s likely blocked on flow-control, sending ACK now.\n", | ||
995 | GCCH_2s (ch)); | ||
996 | if (GNUNET_YES == ch->reliable) | ||
997 | send_channel_ack (ch); | ||
998 | } | ||
999 | |||
1000 | if (NULL != ch->head_recv) | ||
1001 | return; | ||
1002 | if (GNUNET_NO == ch->destroy) | ||
1003 | return; | ||
1004 | channel_destroy (ch); | ||
1005 | } | ||
1006 | |||
1007 | |||
1008 | /** | ||
1009 | * Handle ACK from client on local channel. | ||
1010 | * | ||
1011 | * @param ch channel to destroy | ||
1012 | */ | ||
1013 | void | ||
1014 | GCCH_handle_local_ack (struct CadetChannel *ch) | ||
1015 | { | ||
1016 | ch->client_ready = GNUNET_YES; | ||
1017 | send_client_buffered_data (ch); | ||
1018 | } | ||
1019 | |||
1020 | |||
1021 | #define LOG2(level, ...) GNUNET_log_from_nocheck(level,"cadet-chn",__VA_ARGS__) | ||
1022 | |||
1023 | |||
1024 | /** | ||
1025 | * Log channel info. | ||
1026 | * | ||
1027 | * @param ch Channel. | ||
1028 | * @param level Debug level to use. | ||
1029 | */ | ||
1030 | void | ||
1031 | GCCH_debug (struct CadetChannel *ch, | ||
1032 | enum GNUNET_ErrorType level) | ||
1033 | { | ||
1034 | int do_log; | ||
1035 | |||
1036 | do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK), | ||
1037 | "cadet-chn", | ||
1038 | __FILE__, __FUNCTION__, __LINE__); | ||
1039 | if (0 == do_log) | ||
1040 | return; | ||
1041 | |||
1042 | if (NULL == ch) | ||
1043 | { | ||
1044 | LOG2 (level, "CHN *** DEBUG NULL CHANNEL ***\n"); | ||
1045 | return; | ||
1046 | } | ||
1047 | LOG2 (level, | ||
1048 | "CHN Channel %s:%X (%p)\n", | ||
1049 | GCT_2s (ch->t), | ||
1050 | ch->gid, | ||
1051 | ch); | ||
1052 | if (NULL != ch->owner) | ||
1053 | { | ||
1054 | LOG2 (level, | ||
1055 | "CHN origin %s ready %s local-id: %u\n", | ||
1056 | GSC_2s (ch->owner), | ||
1057 | ch->client_ready ? "YES" : "NO", | ||
1058 | ntohl (ch->lid.channel_of_client)); | ||
1059 | } | ||
1060 | if (NULL != ch->dest) | ||
1061 | { | ||
1062 | LOG2 (level, | ||
1063 | "CHN destination %s ready %s local-id: %u\n", | ||
1064 | GSC_2s (ch->dest), | ||
1065 | ch->client_ready ? "YES" : "NO", | ||
1066 | ntohl (ch->lid.channel_of_client)); | ||
1067 | } | ||
1068 | LOG2 (level, | ||
1069 | "CHN Message IDs recv: %d (%LLX), send: %d\n", | ||
1070 | ntohl (ch->mid_recv.mid), | ||
1071 | (unsigned long long) ch->mid_futures, | ||
1072 | ntohl (ch->mid_send.mid)); | ||
1073 | } | ||
1074 | |||
1075 | |||
1076 | |||
1077 | /* end of gnunet-service-cadet-new_channel.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_channel.h b/src/cadet/gnunet-service-cadet-new_channel.h new file mode 100644 index 000000000..8caa254d1 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_channel.h | |||
@@ -0,0 +1,191 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_channel.h | ||
24 | * @brief GNUnet CADET service with encryption | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | */ | ||
28 | #ifndef GNUNET_SERVICE_CADET_CHANNEL_H | ||
29 | #define GNUNET_SERVICE_CADET_CHANNEL_H | ||
30 | |||
31 | #include "gnunet-service-cadet-new.h" | ||
32 | #include "gnunet-service-cadet-new_peer.h" | ||
33 | |||
34 | |||
35 | /** | ||
36 | * A channel is a bidirectional connection between two CADET | ||
37 | * clients. Communiation can be reliable, unreliable, in-order | ||
38 | * or out-of-order. One client is the "local" client, this | ||
39 | * one initiated the connection. The other client is the | ||
40 | * "incoming" client, this one listened on a port to accept | ||
41 | * the connection from the "local" client. | ||
42 | */ | ||
43 | struct CadetChannel; | ||
44 | |||
45 | |||
46 | /** | ||
47 | * Get the static string for identification of the channel. | ||
48 | * | ||
49 | * @param ch Channel. | ||
50 | * | ||
51 | * @return Static string with the channel IDs. | ||
52 | */ | ||
53 | const char * | ||
54 | GCCH_2s (const struct CadetChannel *ch); | ||
55 | |||
56 | |||
57 | /** | ||
58 | * Log channel info. | ||
59 | * | ||
60 | * @param ch Channel. | ||
61 | * @param level Debug level to use. | ||
62 | */ | ||
63 | void | ||
64 | GCCH_debug (struct CadetChannel *ch, | ||
65 | enum GNUNET_ErrorType level); | ||
66 | |||
67 | |||
68 | /** | ||
69 | * Get the channel's public ID. | ||
70 | * | ||
71 | * @param ch Channel. | ||
72 | * | ||
73 | * @return ID used to identify the channel with the remote peer. | ||
74 | */ | ||
75 | struct GNUNET_CADET_ChannelTunnelNumber | ||
76 | GCCH_get_id (const struct CadetChannel *ch); | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Create a new channel. | ||
81 | * | ||
82 | * @param owner local client owning the channel | ||
83 | * @param owner_id local chid of this channel at the @a owner | ||
84 | * @param destination peer to which we should build the channel | ||
85 | * @param port desired port at @a destination | ||
86 | * @param options options for the channel | ||
87 | * @return handle to the new channel | ||
88 | */ | ||
89 | struct CadetChannel * | ||
90 | GCCH_channel_local_new (struct CadetClient *owner, | ||
91 | struct GNUNET_CADET_ClientChannelNumber owner_id, | ||
92 | struct CadetPeer *destination, | ||
93 | const struct GNUNET_HashCode *port, | ||
94 | uint32_t options); | ||
95 | |||
96 | |||
97 | /** | ||
98 | * A client is bound to the port that we have a channel | ||
99 | * open to. Send the acknowledgement for the connection | ||
100 | * request and establish the link with the client. | ||
101 | * | ||
102 | * @param ch open incoming channel | ||
103 | * @param c client listening on the respective port | ||
104 | */ | ||
105 | void | ||
106 | GCCH_bind (struct CadetChannel *ch, | ||
107 | struct CadetClient *c); | ||
108 | |||
109 | |||
110 | |||
111 | /** | ||
112 | * Destroy locally created channel. Called by the | ||
113 | * local client, so no need to tell the client. | ||
114 | * | ||
115 | * @param ch channel to destroy | ||
116 | */ | ||
117 | void | ||
118 | GCCH_channel_local_destroy (struct CadetChannel *ch); | ||
119 | |||
120 | |||
121 | /** | ||
122 | * Create a new channel. | ||
123 | * | ||
124 | * @param t tunnel to the remote peer | ||
125 | * @param gid identifier of this channel in the tunnel | ||
126 | * @param origin peer to who initiated the channel | ||
127 | * @param port desired local port | ||
128 | * @param options options for the channel | ||
129 | * @return handle to the new channel | ||
130 | */ | ||
131 | struct CadetChannel * | ||
132 | GCCH_channel_incoming_new (struct CadetTunnel *t, | ||
133 | struct GNUNET_CADET_ChannelTunnelNumber gid, | ||
134 | const struct GNUNET_HashCode *port, | ||
135 | uint32_t options); | ||
136 | |||
137 | |||
138 | /** | ||
139 | * Destroy channel that was incoming. Called by the | ||
140 | * local client, so no need to tell the client. | ||
141 | * | ||
142 | * @param ch channel to destroy | ||
143 | */ | ||
144 | void | ||
145 | GCCH_channel_incoming_destroy (struct CadetChannel *ch); | ||
146 | |||
147 | |||
148 | /** | ||
149 | * Destroy channel, based on the other peer closing the | ||
150 | * connection. Also needs to remove this channel from | ||
151 | * the tunnel. | ||
152 | * | ||
153 | * FIXME: need to make it possible to defer destruction until we have | ||
154 | * received all messages up to the destroy, and right now the destroy | ||
155 | * message (and this API) fails to give is the information we need! | ||
156 | * | ||
157 | * FIXME: also need to know if the other peer got a destroy from | ||
158 | * us before! | ||
159 | * | ||
160 | * @param ch channel to destroy | ||
161 | */ | ||
162 | void | ||
163 | GCCH_channel_remote_destroy (struct CadetChannel *ch); | ||
164 | |||
165 | |||
166 | /** | ||
167 | * Handle data given by a client. | ||
168 | * | ||
169 | * Check whether the client is allowed to send in this tunnel, save if | ||
170 | * channel is reliable and send an ACK to the client if there is still | ||
171 | * buffer space in the tunnel. | ||
172 | * | ||
173 | * @param ch Channel. | ||
174 | * @param message payload to transmit. | ||
175 | * @return #GNUNET_OK if everything goes well, | ||
176 | * #GNUNET_SYSERR in case of an error. | ||
177 | */ | ||
178 | int | ||
179 | GCCH_handle_local_data (struct CadetChannel *ch, | ||
180 | const struct GNUNET_MessageHeader *message); | ||
181 | |||
182 | |||
183 | /** | ||
184 | * Handle ACK from client on local channel. | ||
185 | * | ||
186 | * @param ch channel to destroy | ||
187 | */ | ||
188 | void | ||
189 | GCCH_handle_local_ack (struct CadetChannel *ch); | ||
190 | |||
191 | #endif | ||
diff --git a/src/cadet/gnunet-service-cadet-new_connection.c b/src/cadet/gnunet-service-cadet-new_connection.c new file mode 100644 index 000000000..bf88d78e1 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_connection.c | |||
@@ -0,0 +1,665 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_connection.c | ||
24 | * @brief management of CORE-level end-to-end connections; establishes | ||
25 | * end-to-end routes and transmits messages along the route | ||
26 | * @author Bartlomiej Polot | ||
27 | * @author Christian Grothoff | ||
28 | * | ||
29 | * TODO: | ||
30 | * - keepalive messages | ||
31 | * - keep performance metrics (?) | ||
32 | */ | ||
33 | #include "platform.h" | ||
34 | #include "gnunet-service-cadet-new_channel.h" | ||
35 | #include "gnunet-service-cadet-new_connection.h" | ||
36 | #include "gnunet-service-cadet-new_paths.h" | ||
37 | #include "gnunet-service-cadet-new_peer.h" | ||
38 | #include "gnunet-service-cadet-new_tunnels.h" | ||
39 | #include "gnunet_cadet_service.h" | ||
40 | #include "cadet_protocol.h" | ||
41 | |||
42 | |||
43 | /** | ||
44 | * All the states a connection can be in. | ||
45 | */ | ||
46 | enum CadetConnectionState | ||
47 | { | ||
48 | /** | ||
49 | * Uninitialized status, we have not yet even gotten the message queue. | ||
50 | */ | ||
51 | CADET_CONNECTION_NEW, | ||
52 | |||
53 | /** | ||
54 | * Connection create message in queue, awaiting transmission by CORE. | ||
55 | */ | ||
56 | CADET_CONNECTION_SENDING_CREATE, | ||
57 | |||
58 | /** | ||
59 | * Connection create message sent, waiting for ACK. | ||
60 | */ | ||
61 | CADET_CONNECTION_SENT, | ||
62 | |||
63 | /** | ||
64 | * We are an inbound connection, and received a CREATE. Need to | ||
65 | * send an CREATE_ACK back. | ||
66 | */ | ||
67 | CADET_CONNECTION_CREATE_RECEIVED, | ||
68 | |||
69 | /** | ||
70 | * Connection confirmed, ready to carry traffic. | ||
71 | */ | ||
72 | CADET_CONNECTION_READY | ||
73 | |||
74 | }; | ||
75 | |||
76 | |||
77 | /** | ||
78 | * Low-level connection to a destination. | ||
79 | */ | ||
80 | struct CadetConnection | ||
81 | { | ||
82 | |||
83 | /** | ||
84 | * ID of the connection. | ||
85 | */ | ||
86 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; | ||
87 | |||
88 | /** | ||
89 | * To which peer does this connection go? | ||
90 | */ | ||
91 | struct CadetPeer *destination; | ||
92 | |||
93 | /** | ||
94 | * Which tunnel is using this connection? | ||
95 | */ | ||
96 | struct CadetTConnection *ct; | ||
97 | |||
98 | /** | ||
99 | * Path we are using to our destination. | ||
100 | */ | ||
101 | struct CadetPeerPath *path; | ||
102 | |||
103 | /** | ||
104 | * Pending message, NULL if we are ready to transmit. | ||
105 | */ | ||
106 | struct GNUNET_MQ_Envelope *env; | ||
107 | |||
108 | /** | ||
109 | * Handle for calling #GCP_request_mq_cancel() once we are finished. | ||
110 | */ | ||
111 | struct GCP_MessageQueueManager *mq_man; | ||
112 | |||
113 | /** | ||
114 | * Task for connection maintenance. | ||
115 | */ | ||
116 | struct GNUNET_SCHEDULER_Task *task; | ||
117 | |||
118 | /** | ||
119 | * Function to call once we are ready to transmit. | ||
120 | */ | ||
121 | GCC_ReadyCallback ready_cb; | ||
122 | |||
123 | /** | ||
124 | * Closure for @e ready_cb. | ||
125 | */ | ||
126 | void *ready_cb_cls; | ||
127 | |||
128 | /** | ||
129 | * How long do we wait before we try again with a CREATE message? | ||
130 | */ | ||
131 | struct GNUNET_TIME_Relative retry_delay; | ||
132 | |||
133 | /** | ||
134 | * State of the connection. | ||
135 | */ | ||
136 | enum CadetConnectionState state; | ||
137 | |||
138 | /** | ||
139 | * Offset of our @e destination in @e path. | ||
140 | */ | ||
141 | unsigned int off; | ||
142 | |||
143 | /** | ||
144 | * Are we ready to transmit via @e mq_man right now? | ||
145 | */ | ||
146 | int mqm_ready; | ||
147 | |||
148 | }; | ||
149 | |||
150 | |||
151 | /** | ||
152 | * Destroy a connection. | ||
153 | * | ||
154 | * @param cc connection to destroy | ||
155 | */ | ||
156 | void | ||
157 | GCC_destroy (struct CadetConnection *cc) | ||
158 | { | ||
159 | struct GNUNET_MQ_Envelope *env = NULL; | ||
160 | |||
161 | if (CADET_CONNECTION_SENDING_CREATE != cc->state) | ||
162 | { | ||
163 | struct GNUNET_CADET_ConnectionDestroyMessage *destroy_msg; | ||
164 | |||
165 | /* Need to notify next hop that we are down. */ | ||
166 | env = GNUNET_MQ_msg (destroy_msg, | ||
167 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY); | ||
168 | destroy_msg->cid = cc->cid; | ||
169 | } | ||
170 | GCP_request_mq_cancel (cc->mq_man, | ||
171 | env); | ||
172 | cc->mq_man = NULL; | ||
173 | GCPP_del_connection (cc->path, | ||
174 | cc->off, | ||
175 | cc); | ||
176 | GNUNET_assert (GNUNET_YES == | ||
177 | GNUNET_CONTAINER_multishortmap_remove (connections, | ||
178 | &GCC_get_id (cc)->connection_of_tunnel, | ||
179 | cc)); | ||
180 | GNUNET_free (cc); | ||
181 | } | ||
182 | |||
183 | |||
184 | /** | ||
185 | * Return the tunnel associated with this connection. | ||
186 | * | ||
187 | * @param cc connection to query | ||
188 | * @return corresponding entry in the tunnel's connection list | ||
189 | */ | ||
190 | struct CadetTConnection * | ||
191 | GCC_get_ct (struct CadetConnection *cc) | ||
192 | { | ||
193 | return cc->ct; | ||
194 | } | ||
195 | |||
196 | |||
197 | /** | ||
198 | * A connection ACK was received for this connection, implying | ||
199 | * that the end-to-end connection is up. Process it. | ||
200 | * | ||
201 | * @param cc the connection that got the ACK. | ||
202 | */ | ||
203 | void | ||
204 | GCC_handle_connection_ack (struct CadetConnection *cc) | ||
205 | { | ||
206 | if (NULL != cc->task) | ||
207 | { | ||
208 | GNUNET_SCHEDULER_cancel (cc->task); | ||
209 | cc->task = NULL; | ||
210 | } | ||
211 | #if FIXME_KEEPALIVE | ||
212 | cc->task = GNUNET_SCHEDULER_add_delayed (cc->keepalive_period, | ||
213 | &send_keepalive, | ||
214 | cc); | ||
215 | #endif | ||
216 | cc->state = CADET_CONNECTION_READY; | ||
217 | if (GNUNET_YES == cc->mqm_ready) | ||
218 | cc->ready_cb (cc->ready_cb_cls, | ||
219 | GNUNET_YES); | ||
220 | } | ||
221 | |||
222 | |||
223 | /** | ||
224 | * Handle KX message. | ||
225 | * | ||
226 | * @param cc connection that received encrypted message | ||
227 | * @param msg the key exchange message | ||
228 | */ | ||
229 | void | ||
230 | GCC_handle_kx (struct CadetConnection *cc, | ||
231 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) | ||
232 | { | ||
233 | if (CADET_CONNECTION_SENT == cc->state) | ||
234 | { | ||
235 | /* We didn't get the CREATE_ACK, but instead got payload. That's fine, | ||
236 | clearly something is working, so pretend we got an ACK. */ | ||
237 | GCC_handle_connection_ack (cc); | ||
238 | } | ||
239 | GCT_handle_kx (cc->ct, | ||
240 | msg); | ||
241 | } | ||
242 | |||
243 | |||
244 | /** | ||
245 | * Handle encrypted message. | ||
246 | * | ||
247 | * @param cc connection that received encrypted message | ||
248 | * @param msg the encrypted message to decrypt | ||
249 | */ | ||
250 | void | ||
251 | GCC_handle_encrypted (struct CadetConnection *cc, | ||
252 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg) | ||
253 | { | ||
254 | if (CADET_CONNECTION_SENT == cc->state) | ||
255 | { | ||
256 | /* We didn't get the CREATE_ACK, but instead got payload. That's fine, | ||
257 | clearly something is working, so pretend we got an ACK. */ | ||
258 | GCC_handle_connection_ack (cc); | ||
259 | } | ||
260 | GCT_handle_encrypted (cc->ct, | ||
261 | msg); | ||
262 | } | ||
263 | |||
264 | |||
265 | /** | ||
266 | * Send a CREATE message to the first hop. | ||
267 | * | ||
268 | * @param cls the `struct CadetConnection` to initiate | ||
269 | */ | ||
270 | static void | ||
271 | send_create (void *cls) | ||
272 | { | ||
273 | struct CadetConnection *cc = cls; | ||
274 | struct GNUNET_CADET_ConnectionCreateMessage *create_msg; | ||
275 | struct GNUNET_PeerIdentity *pids; | ||
276 | struct GNUNET_MQ_Envelope *env; | ||
277 | unsigned int path_length; | ||
278 | |||
279 | cc->task = NULL; | ||
280 | GNUNET_assert (GNUNET_YES == cc->mqm_ready); | ||
281 | path_length = GCPP_get_length (cc->path); | ||
282 | env = GNUNET_MQ_msg_extra (create_msg, | ||
283 | path_length * sizeof (struct GNUNET_PeerIdentity), | ||
284 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); | ||
285 | create_msg->cid = cc->cid; | ||
286 | pids = (struct GNUNET_PeerIdentity *) &create_msg[1]; | ||
287 | for (unsigned int i=0;i<path_length;i++) | ||
288 | pids[i] = *GCP_get_id (GCPP_get_peer_at_offset (cc->path, | ||
289 | i)); | ||
290 | cc->env = env; | ||
291 | cc->mqm_ready = GNUNET_NO; | ||
292 | cc->state = CADET_CONNECTION_SENT; | ||
293 | GCP_send (cc->mq_man, | ||
294 | env); | ||
295 | } | ||
296 | |||
297 | |||
298 | /** | ||
299 | * Send a CREATE_ACK message towards the origin. | ||
300 | * | ||
301 | * @param cls the `struct CadetConnection` to initiate | ||
302 | */ | ||
303 | static void | ||
304 | send_create_ack (void *cls) | ||
305 | { | ||
306 | struct CadetConnection *cc = cls; | ||
307 | struct GNUNET_CADET_ConnectionCreateMessage *create_msg; | ||
308 | struct GNUNET_PeerIdentity *pids; | ||
309 | struct GNUNET_MQ_Envelope *env; | ||
310 | unsigned int path_length; | ||
311 | |||
312 | cc->task = NULL; | ||
313 | GNUNET_assert (GNUNET_YES == cc->mqm_ready); | ||
314 | path_length = GCPP_get_length (cc->path); | ||
315 | env = GNUNET_MQ_msg_extra (create_msg, | ||
316 | path_length * sizeof (struct GNUNET_PeerIdentity), | ||
317 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); | ||
318 | create_msg->cid = cc->cid; | ||
319 | pids = (struct GNUNET_PeerIdentity *) &create_msg[1]; | ||
320 | for (unsigned int i=0;i<path_length;i++) | ||
321 | pids[i] = *GCP_get_id (GCPP_get_peer_at_offset (cc->path, | ||
322 | i)); | ||
323 | cc->env = env; | ||
324 | cc->mqm_ready = GNUNET_NO; | ||
325 | cc->state = CADET_CONNECTION_READY; | ||
326 | GCP_send (cc->mq_man, | ||
327 | env); | ||
328 | } | ||
329 | |||
330 | |||
331 | /** | ||
332 | * We got a #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE for a | ||
333 | * connection that we already have. Either our ACK got lost | ||
334 | * or something is fishy. Consider retransmitting the ACK. | ||
335 | * | ||
336 | * @param cc connection that got the duplicate CREATE | ||
337 | */ | ||
338 | void | ||
339 | GCC_handle_duplicate_create (struct CadetConnection *cc) | ||
340 | { | ||
341 | if (GNUNET_YES == cc->mqm_ready) | ||
342 | { | ||
343 | /* Tell tunnel that we are not ready for transmission anymore | ||
344 | (until CREATE_ACK is done) */ | ||
345 | cc->ready_cb (cc->ready_cb_cls, | ||
346 | GNUNET_NO); | ||
347 | |||
348 | /* Revert back to the state of having only received the 'CREATE', | ||
349 | and immediately proceed to send the CREATE_ACK. */ | ||
350 | cc->state = CADET_CONNECTION_CREATE_RECEIVED; | ||
351 | cc->task = GNUNET_SCHEDULER_add_now (&send_create_ack, | ||
352 | cc); | ||
353 | } | ||
354 | else | ||
355 | { | ||
356 | /* We are currently sending something else back, which | ||
357 | can only be an ACK or payload, either of which would | ||
358 | do. So actually no need to do anything. */ | ||
359 | } | ||
360 | } | ||
361 | |||
362 | |||
363 | /** | ||
364 | * There has been a change in the message queue existence for our | ||
365 | * peer at the first hop. Adjust accordingly. | ||
366 | * | ||
367 | * @param cls the `struct CadetConnection` | ||
368 | * @param available #GNUNET_YES if sending is now possible, | ||
369 | * #GNUNET_NO if sending is no longer possible | ||
370 | * #GNUNET_SYSERR if sending is no longer possible | ||
371 | * and the last envelope was discarded | ||
372 | */ | ||
373 | static void | ||
374 | manage_first_hop_mq (void *cls, | ||
375 | int available) | ||
376 | { | ||
377 | struct CadetConnection *cc = cls; | ||
378 | |||
379 | if (GNUNET_YES != available) | ||
380 | { | ||
381 | /* Connection is down, for now... */ | ||
382 | cc->mqm_ready = GNUNET_NO; | ||
383 | cc->state = CADET_CONNECTION_NEW; | ||
384 | cc->retry_delay = GNUNET_TIME_UNIT_ZERO; | ||
385 | if (NULL != cc->task) | ||
386 | { | ||
387 | GNUNET_SCHEDULER_cancel (cc->task); | ||
388 | cc->task = NULL; | ||
389 | } | ||
390 | cc->ready_cb (cc->ready_cb_cls, | ||
391 | GNUNET_NO); | ||
392 | return; | ||
393 | } | ||
394 | |||
395 | cc->mqm_ready = GNUNET_YES; | ||
396 | switch (cc->state) | ||
397 | { | ||
398 | case CADET_CONNECTION_NEW: | ||
399 | /* Transmit immediately */ | ||
400 | cc->task = GNUNET_SCHEDULER_add_now (&send_create, | ||
401 | cc); | ||
402 | break; | ||
403 | case CADET_CONNECTION_SENDING_CREATE: | ||
404 | /* Should not be possible to be called in this state. */ | ||
405 | GNUNET_assert (0); | ||
406 | break; | ||
407 | case CADET_CONNECTION_SENT: | ||
408 | /* Retry a bit later... */ | ||
409 | cc->retry_delay = GNUNET_TIME_STD_BACKOFF (cc->retry_delay); | ||
410 | cc->task = GNUNET_SCHEDULER_add_delayed (cc->retry_delay, | ||
411 | &send_create, | ||
412 | cc); | ||
413 | break; | ||
414 | case CADET_CONNECTION_CREATE_RECEIVED: | ||
415 | /* We got the 'CREATE' (incoming connection), should send the CREATE_ACK */ | ||
416 | cc->task = GNUNET_SCHEDULER_add_now (&send_create_ack, | ||
417 | cc); | ||
418 | break; | ||
419 | case CADET_CONNECTION_READY: | ||
420 | cc->ready_cb (cc->ready_cb_cls, | ||
421 | GNUNET_YES); | ||
422 | break; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | |||
427 | /** | ||
428 | * Create a connection to @a destination via @a path and notify @a cb | ||
429 | * whenever we are ready for more data. Shared logic independent of | ||
430 | * who is initiating the connection. | ||
431 | * | ||
432 | * @param destination where to go | ||
433 | * @param path which path to take (may not be the full path) | ||
434 | * @param ct which tunnel uses this connection | ||
435 | * @param init_state initial state for the connection | ||
436 | * @param ready_cb function to call when ready to transmit | ||
437 | * @param ready_cb_cls closure for @a cb | ||
438 | * @return handle to the connection | ||
439 | */ | ||
440 | static struct CadetConnection * | ||
441 | connection_create (struct CadetPeer *destination, | ||
442 | struct CadetPeerPath *path, | ||
443 | struct CadetTConnection *ct, | ||
444 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | ||
445 | enum CadetConnectionState init_state, | ||
446 | GCC_ReadyCallback ready_cb, | ||
447 | void *ready_cb_cls) | ||
448 | { | ||
449 | struct CadetConnection *cc; | ||
450 | struct CadetPeer *first_hop; | ||
451 | unsigned int off; | ||
452 | |||
453 | off = GCPP_find_peer (path, | ||
454 | destination); | ||
455 | GNUNET_assert (UINT_MAX > off); | ||
456 | cc = GNUNET_new (struct CadetConnection); | ||
457 | cc->state = init_state; | ||
458 | cc->ct = ct; | ||
459 | cc->cid = *cid; | ||
460 | GNUNET_assert (GNUNET_OK == | ||
461 | GNUNET_CONTAINER_multishortmap_put (connections, | ||
462 | &GCC_get_id (cc)->connection_of_tunnel, | ||
463 | cc, | ||
464 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
465 | cc->ready_cb = ready_cb; | ||
466 | cc->ready_cb_cls = ready_cb_cls; | ||
467 | cc->path = path; | ||
468 | cc->off = off; | ||
469 | GCPP_add_connection (path, | ||
470 | off, | ||
471 | cc); | ||
472 | for (unsigned int i=0;i<off;i++) | ||
473 | GCP_add_connection (GCPP_get_peer_at_offset (path, | ||
474 | off), | ||
475 | cc); | ||
476 | |||
477 | first_hop = GCPP_get_peer_at_offset (path, | ||
478 | 0); | ||
479 | cc->mq_man = GCP_request_mq (first_hop, | ||
480 | &manage_first_hop_mq, | ||
481 | cc); | ||
482 | return cc; | ||
483 | } | ||
484 | |||
485 | |||
486 | /** | ||
487 | * Create a connection to @a destination via @a path and | ||
488 | * notify @a cb whenever we are ready for more data. This | ||
489 | * is an inbound tunnel, so we must use the existing @a cid | ||
490 | * | ||
491 | * @param destination where to go | ||
492 | * @param path which path to take (may not be the full path) | ||
493 | * @param ct which tunnel uses this connection | ||
494 | * @param ready_cb function to call when ready to transmit | ||
495 | * @param ready_cb_cls closure for @a cb | ||
496 | * @return handle to the connection | ||
497 | */ | ||
498 | struct CadetConnection * | ||
499 | GCC_create_inbound (struct CadetPeer *destination, | ||
500 | struct CadetPeerPath *path, | ||
501 | struct CadetTConnection *ct, | ||
502 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | ||
503 | GCC_ReadyCallback ready_cb, | ||
504 | void *ready_cb_cls) | ||
505 | { | ||
506 | return connection_create (destination, | ||
507 | path, | ||
508 | ct, | ||
509 | cid, | ||
510 | CADET_CONNECTION_CREATE_RECEIVED, | ||
511 | ready_cb, | ||
512 | ready_cb_cls); | ||
513 | } | ||
514 | |||
515 | |||
516 | /** | ||
517 | * Create a connection to @a destination via @a path and | ||
518 | * notify @a cb whenever we are ready for more data. | ||
519 | * | ||
520 | * @param destination where to go | ||
521 | * @param path which path to take (may not be the full path) | ||
522 | * @param ct tunnel that uses the connection | ||
523 | * @param ready_cb function to call when ready to transmit | ||
524 | * @param ready_cb_cls closure for @a cb | ||
525 | * @return handle to the connection | ||
526 | */ | ||
527 | struct CadetConnection * | ||
528 | GCC_create (struct CadetPeer *destination, | ||
529 | struct CadetPeerPath *path, | ||
530 | struct CadetTConnection *ct, | ||
531 | GCC_ReadyCallback ready_cb, | ||
532 | void *ready_cb_cls) | ||
533 | { | ||
534 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; | ||
535 | |||
536 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, | ||
537 | &cid, | ||
538 | sizeof (cid)); | ||
539 | return connection_create (destination, | ||
540 | path, | ||
541 | ct, | ||
542 | &cid, | ||
543 | CADET_CONNECTION_NEW, | ||
544 | ready_cb, | ||
545 | ready_cb_cls); | ||
546 | } | ||
547 | |||
548 | |||
549 | /** | ||
550 | * Transmit message @a msg via connection @a cc. Must only be called | ||
551 | * (once) after the connection has signalled that it is ready via the | ||
552 | * `ready_cb`. Clients can also use #GCC_is_ready() to check if the | ||
553 | * connection is right now ready for transmission. | ||
554 | * | ||
555 | * @param cc connection identification | ||
556 | * @param env envelope with message to transmit; must NOT | ||
557 | * yet have a #GNUNET_MQ_notify_sent() callback attached to it | ||
558 | */ | ||
559 | void | ||
560 | GCC_transmit (struct CadetConnection *cc, | ||
561 | struct GNUNET_MQ_Envelope *env) | ||
562 | { | ||
563 | GNUNET_assert (GNUNET_YES == cc->mqm_ready); | ||
564 | GNUNET_assert (CADET_CONNECTION_READY == cc->state); | ||
565 | cc->mqm_ready = GNUNET_NO; | ||
566 | GCP_send (cc->mq_man, | ||
567 | env); | ||
568 | } | ||
569 | |||
570 | |||
571 | /** | ||
572 | * Obtain the path used by this connection. | ||
573 | * | ||
574 | * @param cc connection | ||
575 | * @return path to @a cc | ||
576 | */ | ||
577 | struct CadetPeerPath * | ||
578 | GCC_get_path (struct CadetConnection *cc) | ||
579 | { | ||
580 | return cc->path; | ||
581 | } | ||
582 | |||
583 | |||
584 | /** | ||
585 | * Obtain unique ID for the connection. | ||
586 | * | ||
587 | * @param cc connection. | ||
588 | * @return unique number of the connection | ||
589 | */ | ||
590 | const struct GNUNET_CADET_ConnectionTunnelIdentifier * | ||
591 | GCC_get_id (struct CadetConnection *cc) | ||
592 | { | ||
593 | return &cc->cid; | ||
594 | } | ||
595 | |||
596 | |||
597 | /** | ||
598 | * Get a (static) string for a connection. | ||
599 | * | ||
600 | * @param cc Connection. | ||
601 | */ | ||
602 | const char * | ||
603 | GCC_2s (const struct CadetConnection *cc) | ||
604 | { | ||
605 | static char buf[128]; | ||
606 | |||
607 | if (NULL == cc) | ||
608 | return "Connection(NULL)"; | ||
609 | |||
610 | if (NULL != cc->ct) | ||
611 | { | ||
612 | GNUNET_snprintf (buf, | ||
613 | sizeof (buf), | ||
614 | "Connection(%s(Tunnel(%s)))", | ||
615 | GNUNET_sh2s (&cc->cid.connection_of_tunnel), | ||
616 | GCT_2s (cc->ct->t)); | ||
617 | return buf; | ||
618 | } | ||
619 | GNUNET_snprintf (buf, | ||
620 | sizeof (buf), | ||
621 | "Connection(%s(Tunnel(NULL)))", | ||
622 | GNUNET_sh2s (&cc->cid.connection_of_tunnel)); | ||
623 | return buf; | ||
624 | } | ||
625 | |||
626 | |||
627 | #define LOG2(level, ...) GNUNET_log_from_nocheck(level,"cadet-con",__VA_ARGS__) | ||
628 | |||
629 | |||
630 | /** | ||
631 | * Log connection info. | ||
632 | * | ||
633 | * @param cc connection | ||
634 | * @param level Debug level to use. | ||
635 | */ | ||
636 | void | ||
637 | GCC_debug (struct CadetConnection *cc, | ||
638 | enum GNUNET_ErrorType level) | ||
639 | { | ||
640 | int do_log; | ||
641 | char *s; | ||
642 | |||
643 | do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK), | ||
644 | "cadet-con", | ||
645 | __FILE__, __FUNCTION__, __LINE__); | ||
646 | if (0 == do_log) | ||
647 | return; | ||
648 | if (NULL == cc) | ||
649 | { | ||
650 | LOG2 (level, | ||
651 | "Connection (NULL)\n"); | ||
652 | return; | ||
653 | } | ||
654 | s = GCPP_2s (cc->path); | ||
655 | LOG2 (level, | ||
656 | "Connection %s to %s via path %s in state %d is %s\n", | ||
657 | GCC_2s (cc), | ||
658 | GCP_2s (cc->destination), | ||
659 | s, | ||
660 | cc->state, | ||
661 | (GNUNET_YES == cc->mqm_ready) ? "ready" : "busy"); | ||
662 | GNUNET_free (s); | ||
663 | } | ||
664 | |||
665 | /* end of gnunet-service-cadet-new_connection.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_connection.h b/src/cadet/gnunet-service-cadet-new_connection.h new file mode 100644 index 000000000..99426776d --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_connection.h | |||
@@ -0,0 +1,196 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_connection.h | ||
24 | * @brief | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | */ | ||
28 | #ifndef GNUNET_SERVICE_CADET_CONNECTION_H | ||
29 | #define GNUNET_SERVICE_CADET_CONNECTION_H | ||
30 | |||
31 | #include "gnunet_util_lib.h" | ||
32 | #include "gnunet-service-cadet-new.h" | ||
33 | #include "gnunet-service-cadet-new_peer.h" | ||
34 | #include "cadet_protocol.h" | ||
35 | |||
36 | |||
37 | /** | ||
38 | * Function called to notify tunnel about change in our readyness. | ||
39 | * | ||
40 | * @param cls closure | ||
41 | * @param is_ready #GNUNET_YES if the connection is now ready for transmission, | ||
42 | * #GNUNET_NO if the connection is no longer ready for transmission | ||
43 | */ | ||
44 | typedef void | ||
45 | (*GCC_ReadyCallback)(void *cls, | ||
46 | int is_ready); | ||
47 | |||
48 | |||
49 | /** | ||
50 | * Destroy a connection. | ||
51 | * | ||
52 | * @param cc connection to destroy | ||
53 | */ | ||
54 | void | ||
55 | GCC_destroy (struct CadetConnection *cc); | ||
56 | |||
57 | |||
58 | /** | ||
59 | * Create a connection to @a destination via @a path and | ||
60 | * notify @a cb whenever we are ready for more data. | ||
61 | * | ||
62 | * @param destination where to go | ||
63 | * @param path which path to take (may not be the full path) | ||
64 | * @param ct which tunnel uses this connection | ||
65 | * @param ready_cb function to call when ready to transmit | ||
66 | * @param ready_cb_cls closure for @a cb | ||
67 | * @return handle to the connection | ||
68 | */ | ||
69 | struct CadetConnection * | ||
70 | GCC_create (struct CadetPeer *destination, | ||
71 | struct CadetPeerPath *path, | ||
72 | struct CadetTConnection *ct, | ||
73 | GCC_ReadyCallback ready_cb, | ||
74 | void *ready_cb_cls); | ||
75 | |||
76 | |||
77 | /** | ||
78 | * Create a connection to @a destination via @a path and | ||
79 | * notify @a cb whenever we are ready for more data. This | ||
80 | * is an inbound tunnel, so we must use the existing @a cid | ||
81 | * | ||
82 | * @param destination where to go | ||
83 | * @param path which path to take (may not be the full path) | ||
84 | * @param ct which tunnel uses this connection | ||
85 | * @param ready_cb function to call when ready to transmit | ||
86 | * @param ready_cb_cls closure for @a cb | ||
87 | * @return handle to the connection | ||
88 | */ | ||
89 | struct CadetConnection * | ||
90 | GCC_create_inbound (struct CadetPeer *destination, | ||
91 | struct CadetPeerPath *path, | ||
92 | struct CadetTConnection *ct, | ||
93 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | ||
94 | GCC_ReadyCallback ready_cb, | ||
95 | void *ready_cb_cls); | ||
96 | |||
97 | |||
98 | /** | ||
99 | * Transmit message @a msg via connection @a cc. Must only be called | ||
100 | * (once) after the connection has signalled that it is ready via the | ||
101 | * `ready_cb`. Clients can also use #GCC_is_ready() to check if the | ||
102 | * connection is right now ready for transmission. | ||
103 | * | ||
104 | * @param cc connection identification | ||
105 | * @param env envelope with message to transmit; | ||
106 | * the #GNUNET_MQ_notify_send() must not have yet been used | ||
107 | * for the envelope. Also, the message better match the | ||
108 | * connection identifier of this connection... | ||
109 | */ | ||
110 | void | ||
111 | GCC_transmit (struct CadetConnection *cc, | ||
112 | struct GNUNET_MQ_Envelope *env); | ||
113 | |||
114 | |||
115 | /** | ||
116 | * An ACK was received for this connection, process it. | ||
117 | * | ||
118 | * @param cc the connection that got the ACK. | ||
119 | */ | ||
120 | void | ||
121 | GCC_handle_connection_ack (struct CadetConnection *cc); | ||
122 | |||
123 | |||
124 | /** | ||
125 | * Handle KX message. | ||
126 | * | ||
127 | * @param cc connection that received encrypted message | ||
128 | * @param msg the key exchange message | ||
129 | */ | ||
130 | void | ||
131 | GCC_handle_kx (struct CadetConnection *cc, | ||
132 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); | ||
133 | |||
134 | |||
135 | /** | ||
136 | * Handle encrypted message. | ||
137 | * | ||
138 | * @param cc connection that received encrypted message | ||
139 | * @param msg the encrypted message to decrypt | ||
140 | */ | ||
141 | void | ||
142 | GCC_handle_encrypted (struct CadetConnection *cc, | ||
143 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg); | ||
144 | |||
145 | |||
146 | /** | ||
147 | * Return the tunnel associated with this connection. | ||
148 | * | ||
149 | * @param cc connection to query | ||
150 | * @return corresponding entry in the tunnel's connection list | ||
151 | */ | ||
152 | struct CadetTConnection * | ||
153 | GCC_get_ct (struct CadetConnection *cc); | ||
154 | |||
155 | |||
156 | /** | ||
157 | * Obtain the path used by this connection. | ||
158 | * | ||
159 | * @param cc connection | ||
160 | * @return path to @a cc | ||
161 | */ | ||
162 | struct CadetPeerPath * | ||
163 | GCC_get_path (struct CadetConnection *cc); | ||
164 | |||
165 | |||
166 | /** | ||
167 | * Obtain unique ID for the connection. | ||
168 | * | ||
169 | * @param cc connection. | ||
170 | * @return unique number of the connection | ||
171 | */ | ||
172 | const struct GNUNET_CADET_ConnectionTunnelIdentifier * | ||
173 | GCC_get_id (struct CadetConnection *cc); | ||
174 | |||
175 | |||
176 | /** | ||
177 | * Get a (static) string for a connection. | ||
178 | * | ||
179 | * @param cc Connection. | ||
180 | */ | ||
181 | const char * | ||
182 | GCC_2s (const struct CadetConnection *cc); | ||
183 | |||
184 | |||
185 | /** | ||
186 | * Log connection info. | ||
187 | * | ||
188 | * @param cc connection | ||
189 | * @param level Debug level to use. | ||
190 | */ | ||
191 | void | ||
192 | GCC_debug (struct CadetConnection *cc, | ||
193 | enum GNUNET_ErrorType level); | ||
194 | |||
195 | |||
196 | #endif | ||
diff --git a/src/cadet/gnunet-service-cadet-new_core.c b/src/cadet/gnunet-service-cadet-new_core.c new file mode 100644 index 000000000..9ce4418de --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_core.c | |||
@@ -0,0 +1,903 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file cadet/gnunet-service-cadet_core.c | ||
23 | * @brief cadet service; interaction with CORE service | ||
24 | * @author Bartlomiej Polot | ||
25 | * @author Christian Grothoff | ||
26 | * | ||
27 | * All functions in this file should use the prefix GCO (Gnunet Cadet cOre (bottom)) | ||
28 | * | ||
29 | * TODO: | ||
30 | * - pass encrypted ACK to connection (!) | ||
31 | * - given BROKEN messages, destroy paths (?) | ||
32 | * - | ||
33 | * - handle POLL (if needed) | ||
34 | */ | ||
35 | #include "platform.h" | ||
36 | #include "gnunet-service-cadet-new_core.h" | ||
37 | #include "gnunet-service-cadet-new_paths.h" | ||
38 | #include "gnunet-service-cadet-new_peer.h" | ||
39 | #include "gnunet-service-cadet-new_connection.h" | ||
40 | #include "gnunet-service-cadet-new_tunnels.h" | ||
41 | #include "gnunet_core_service.h" | ||
42 | #include "cadet_protocol.h" | ||
43 | |||
44 | /** | ||
45 | * Number of messages we are willing to buffer per route. | ||
46 | */ | ||
47 | #define ROUTE_BUFFER_SIZE 8 | ||
48 | |||
49 | |||
50 | /** | ||
51 | * Information we keep per direction for a route. | ||
52 | */ | ||
53 | struct RouteDirection | ||
54 | { | ||
55 | /** | ||
56 | * Target peer. | ||
57 | */ | ||
58 | struct CadetPeer *hop; | ||
59 | |||
60 | /** | ||
61 | * Route this direction is part of. | ||
62 | */ | ||
63 | struct CadetRoute *my_route; | ||
64 | |||
65 | /** | ||
66 | * Message queue manager for @e hop. | ||
67 | */ | ||
68 | struct GCP_MessageQueueManager *mqm; | ||
69 | |||
70 | /** | ||
71 | * Cyclic message buffer to @e hop. | ||
72 | */ | ||
73 | struct GNUNET_MQ_Envelope *out_buffer[ROUTE_BUFFER_SIZE]; | ||
74 | |||
75 | /** | ||
76 | * Next write offset to use to append messages to @e out_buffer. | ||
77 | */ | ||
78 | unsigned int out_wpos; | ||
79 | |||
80 | /** | ||
81 | * Next read offset to use to retrieve messages from @e out_buffer. | ||
82 | */ | ||
83 | unsigned int out_rpos; | ||
84 | |||
85 | /** | ||
86 | * Is @e mqm currently ready for transmission? | ||
87 | */ | ||
88 | int is_ready; | ||
89 | |||
90 | }; | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Description of a segment of a `struct CadetConnection` at the | ||
95 | * intermediate peers. Routes are basically entries in a peer's | ||
96 | * routing table for forwarding traffic. At both endpoints, the | ||
97 | * routes are terminated by a `struct CadetConnection`, which knows | ||
98 | * the complete `struct CadetPath` that is formed by the individual | ||
99 | * routes. | ||
100 | */ | ||
101 | struct CadetRoute | ||
102 | { | ||
103 | |||
104 | /** | ||
105 | * Information about the next hop on this route. | ||
106 | */ | ||
107 | struct RouteDirection next; | ||
108 | |||
109 | /** | ||
110 | * Information about the previous hop on this route. | ||
111 | */ | ||
112 | struct RouteDirection prev; | ||
113 | |||
114 | /** | ||
115 | * Unique identifier for the connection that uses this route. | ||
116 | */ | ||
117 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; | ||
118 | |||
119 | /** | ||
120 | * When was this route last in use? | ||
121 | */ | ||
122 | struct GNUNET_TIME_Absolute last_use; | ||
123 | |||
124 | }; | ||
125 | |||
126 | |||
127 | /** | ||
128 | * Handle to the CORE service. | ||
129 | */ | ||
130 | static struct GNUNET_CORE_Handle *core; | ||
131 | |||
132 | /** | ||
133 | * Routes on which this peer is an intermediate. | ||
134 | */ | ||
135 | static struct GNUNET_CONTAINER_MultiShortmap *routes; | ||
136 | |||
137 | |||
138 | /** | ||
139 | * Get the route corresponding to a hash. | ||
140 | * | ||
141 | * @param cid hash generated from the connection identifier | ||
142 | */ | ||
143 | static struct CadetRoute * | ||
144 | get_route (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) | ||
145 | { | ||
146 | return GNUNET_CONTAINER_multishortmap_get (routes, | ||
147 | &cid->connection_of_tunnel); | ||
148 | } | ||
149 | |||
150 | |||
151 | /** | ||
152 | * We message @a msg from @a prev. Find its route by @a cid and | ||
153 | * forward to the next hop. Drop and signal broken route if we do not | ||
154 | * have a route. | ||
155 | * | ||
156 | * @param prev previous hop (sender) | ||
157 | * @param cid connection identifier, tells us which route to use | ||
158 | * @param msg the message to forward | ||
159 | */ | ||
160 | static void | ||
161 | route_message (struct CadetPeer *prev, | ||
162 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | ||
163 | const struct GNUNET_MessageHeader *msg) | ||
164 | { | ||
165 | struct CadetRoute *route; | ||
166 | struct RouteDirection *dir; | ||
167 | struct GNUNET_MQ_Envelope *env; | ||
168 | |||
169 | route = get_route (cid); | ||
170 | if (NULL == route) | ||
171 | { | ||
172 | struct GNUNET_MQ_Envelope *env; | ||
173 | struct GNUNET_CADET_ConnectionBrokenMessage *bm; | ||
174 | |||
175 | env = GNUNET_MQ_msg (bm, | ||
176 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); | ||
177 | bm->cid = *cid; | ||
178 | bm->peer1 = my_full_id; | ||
179 | GCP_send_ooo (prev, | ||
180 | env); | ||
181 | return; | ||
182 | } | ||
183 | dir = (prev == route->prev.hop) ? &route->next : &route->prev; | ||
184 | if (GNUNET_YES == dir->is_ready) | ||
185 | { | ||
186 | dir->is_ready = GNUNET_NO; | ||
187 | GCP_send (dir->mqm, | ||
188 | GNUNET_MQ_msg_copy (msg)); | ||
189 | return; | ||
190 | } | ||
191 | env = dir->out_buffer[dir->out_wpos]; | ||
192 | if (NULL != env) | ||
193 | { | ||
194 | /* Queue full, drop earliest message in queue */ | ||
195 | GNUNET_assert (dir->out_rpos == dir->out_wpos); | ||
196 | GNUNET_MQ_discard (env); | ||
197 | dir->out_rpos++; | ||
198 | if (ROUTE_BUFFER_SIZE == dir->out_rpos) | ||
199 | dir->out_rpos = 0; | ||
200 | } | ||
201 | env = GNUNET_MQ_msg_copy (msg); | ||
202 | dir->out_buffer[dir->out_wpos] = env; | ||
203 | dir->out_wpos++; | ||
204 | if (ROUTE_BUFFER_SIZE == dir->out_wpos) | ||
205 | dir->out_wpos = 0; | ||
206 | } | ||
207 | |||
208 | |||
209 | /** | ||
210 | * Check if the create_connection message has the appropriate size. | ||
211 | * | ||
212 | * @param cls Closure (unused). | ||
213 | * @param msg Message to check. | ||
214 | * | ||
215 | * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. | ||
216 | */ | ||
217 | static int | ||
218 | check_connection_create (void *cls, | ||
219 | const struct GNUNET_CADET_ConnectionCreateMessage *msg) | ||
220 | { | ||
221 | uint16_t size = ntohs (msg->header.size) - sizeof (*msg); | ||
222 | |||
223 | if (0 != (size % sizeof (struct GNUNET_PeerIdentity))) | ||
224 | { | ||
225 | GNUNET_break_op (0); | ||
226 | return GNUNET_NO; | ||
227 | } | ||
228 | return GNUNET_YES; | ||
229 | } | ||
230 | |||
231 | |||
232 | /** | ||
233 | * Free internal data of a route direction. | ||
234 | * | ||
235 | * @param dir direction to destroy (do NOT free memory of 'dir' itself) | ||
236 | */ | ||
237 | static void | ||
238 | destroy_direction (struct RouteDirection *dir) | ||
239 | { | ||
240 | for (unsigned int i=0;i<ROUTE_BUFFER_SIZE;i++) | ||
241 | if (NULL != dir->out_buffer[i]) | ||
242 | { | ||
243 | GNUNET_MQ_discard (dir->out_buffer[i]); | ||
244 | dir->out_buffer[i] = NULL; | ||
245 | } | ||
246 | if (NULL != dir->mqm) | ||
247 | { | ||
248 | GCP_request_mq_cancel (dir->mqm, | ||
249 | NULL); | ||
250 | dir->mqm = NULL; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | |||
255 | /** | ||
256 | * Destroy our state for @a route. | ||
257 | * | ||
258 | * @param route route to destroy | ||
259 | */ | ||
260 | static void | ||
261 | destroy_route (struct CadetRoute *route) | ||
262 | { | ||
263 | destroy_direction (&route->prev); | ||
264 | destroy_direction (&route->next); | ||
265 | GNUNET_free (route); | ||
266 | } | ||
267 | |||
268 | |||
269 | /** | ||
270 | * Send message that a route is broken between @a peer1 and @a peer2. | ||
271 | * | ||
272 | * @param target where to send the message | ||
273 | * @param cid connection identifier to use | ||
274 | * @param peer1 one of the peers where a link is broken | ||
275 | * @param peer2 another one of the peers where a link is broken | ||
276 | */ | ||
277 | static void | ||
278 | send_broken (struct RouteDirection *target, | ||
279 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | ||
280 | const struct GNUNET_PeerIdentity *peer1, | ||
281 | const struct GNUNET_PeerIdentity *peer2) | ||
282 | { | ||
283 | struct GNUNET_MQ_Envelope *env; | ||
284 | struct GNUNET_CADET_ConnectionBrokenMessage *bm; | ||
285 | |||
286 | env = GNUNET_MQ_msg (bm, | ||
287 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); | ||
288 | bm->cid = *cid; | ||
289 | if (NULL != peer1) | ||
290 | bm->peer1 = *peer1; | ||
291 | if (NULL != peer2) | ||
292 | bm->peer2 = *peer2; | ||
293 | GCP_request_mq_cancel (target->mqm, | ||
294 | env); | ||
295 | target->mqm = NULL; | ||
296 | } | ||
297 | |||
298 | |||
299 | /** | ||
300 | * Function called when the message queue to the previous hop | ||
301 | * becomes available/unavailable. We expect this function to | ||
302 | * be called immediately when we register, and then again | ||
303 | * later if the connection ever goes down. | ||
304 | * | ||
305 | * @param cls the `struct RouteDirection` | ||
306 | * @param available #GNUNET_YES if sending is now possible, | ||
307 | * #GNUNET_NO if sending is no longer possible | ||
308 | * #GNUNET_SYSERR if sending is no longer possible | ||
309 | * and the last envelope was discarded | ||
310 | */ | ||
311 | static void | ||
312 | dir_ready_cb (void *cls, | ||
313 | int ready) | ||
314 | { | ||
315 | struct RouteDirection *dir = cls; | ||
316 | struct CadetRoute *route = dir->my_route; | ||
317 | struct RouteDirection *odir; | ||
318 | |||
319 | if (GNUNET_YES == ready) | ||
320 | { | ||
321 | struct GNUNET_MQ_Envelope *env; | ||
322 | |||
323 | dir->is_ready = GNUNET_YES; | ||
324 | if (NULL != (env = dir->out_buffer[dir->out_rpos])) | ||
325 | { | ||
326 | dir->out_buffer[dir->out_rpos] = NULL; | ||
327 | dir->out_rpos++; | ||
328 | if (ROUTE_BUFFER_SIZE == dir->out_rpos) | ||
329 | dir->out_rpos = 0; | ||
330 | dir->is_ready = GNUNET_NO; | ||
331 | GCP_send (dir->mqm, | ||
332 | env); | ||
333 | } | ||
334 | return; | ||
335 | } | ||
336 | odir = (dir == &route->next) ? &route->prev : &route->next; | ||
337 | send_broken (&route->next, | ||
338 | &route->cid, | ||
339 | GCP_get_id (odir->hop), | ||
340 | &my_full_id); | ||
341 | destroy_route (route); | ||
342 | } | ||
343 | |||
344 | |||
345 | /** | ||
346 | * Initialize one of the directions of a route. | ||
347 | * | ||
348 | * @param route route the direction belongs to | ||
349 | * @param dir direction to initialize | ||
350 | * @param hop next hop on in the @a dir | ||
351 | */ | ||
352 | static void | ||
353 | dir_init (struct RouteDirection *dir, | ||
354 | struct CadetRoute *route, | ||
355 | struct CadetPeer *hop) | ||
356 | { | ||
357 | dir->hop = hop; | ||
358 | dir->my_route = route; | ||
359 | dir->mqm = GCP_request_mq (hop, | ||
360 | &dir_ready_cb, | ||
361 | dir); | ||
362 | GNUNET_assert (GNUNET_YES == dir->is_ready); | ||
363 | } | ||
364 | |||
365 | |||
366 | /** | ||
367 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE | ||
368 | * | ||
369 | * @param cls Closure (CadetPeer for neighbor that sent the message). | ||
370 | * @param msg Message itself. | ||
371 | */ | ||
372 | static void | ||
373 | handle_connection_create (void *cls, | ||
374 | const struct GNUNET_CADET_ConnectionCreateMessage *msg) | ||
375 | { | ||
376 | struct CadetPeer *sender = cls; | ||
377 | struct CadetPeer *next; | ||
378 | const struct GNUNET_PeerIdentity *pids = (const struct GNUNET_PeerIdentity *) &msg[1]; | ||
379 | struct CadetRoute *route; | ||
380 | uint16_t size = ntohs (msg->header.size) - sizeof (*msg); | ||
381 | unsigned int path_length; | ||
382 | unsigned int off; | ||
383 | |||
384 | path_length = size / sizeof (struct GNUNET_PeerIdentity); | ||
385 | /* Initiator is at offset 0. */ | ||
386 | for (off=1;off<path_length;off++) | ||
387 | if (0 == memcmp (&my_full_id, | ||
388 | &pids[off], | ||
389 | sizeof (struct GNUNET_PeerIdentity))) | ||
390 | break; | ||
391 | if (off == path_length) | ||
392 | { | ||
393 | /* We are not on the path, bogus request */ | ||
394 | GNUNET_break_op (0); | ||
395 | return; | ||
396 | } | ||
397 | /* Check previous hop */ | ||
398 | if (sender != GCP_get (&pids[off - 1], | ||
399 | GNUNET_NO)) | ||
400 | { | ||
401 | /* sender is not on the path, not allowed */ | ||
402 | GNUNET_break_op (0); | ||
403 | return; | ||
404 | } | ||
405 | if (NULL != | ||
406 | get_route (&msg->cid)) | ||
407 | { | ||
408 | /* Duplicate CREATE, pass it on, previous one might have been lost! */ | ||
409 | route_message (sender, | ||
410 | &msg->cid, | ||
411 | &msg->header); | ||
412 | return; | ||
413 | } | ||
414 | if (off == path_length - 1) | ||
415 | { | ||
416 | /* We are the destination, create connection */ | ||
417 | struct CadetConnection *cc; | ||
418 | struct CadetPeerPath *path; | ||
419 | struct CadetPeer *origin; | ||
420 | |||
421 | cc = GNUNET_CONTAINER_multishortmap_get (connections, | ||
422 | &msg->cid.connection_of_tunnel); | ||
423 | if (NULL != cc) | ||
424 | { | ||
425 | /* Duplicate CREATE, likely our ACK got lost, retransmit the ACK! */ | ||
426 | GNUNET_break (0); // FIXME: not implemented! | ||
427 | return; | ||
428 | } | ||
429 | |||
430 | path = GCPP_get_path_from_route (path_length, | ||
431 | pids); | ||
432 | origin = GCP_get (&pids[0], | ||
433 | GNUNET_YES); | ||
434 | GCT_add_inbound_connection (GCT_create_tunnel (origin), | ||
435 | &msg->cid, | ||
436 | path); | ||
437 | return; | ||
438 | } | ||
439 | /* We are merely a hop on the way, check if we can support the route */ | ||
440 | next = GCP_get (&pids[off + 1], | ||
441 | GNUNET_NO); | ||
442 | if ( (NULL == next) || | ||
443 | (GNUNET_NO == GCP_has_core_connection (next)) ) | ||
444 | { | ||
445 | /* unworkable, send back BROKEN notification */ | ||
446 | struct GNUNET_MQ_Envelope *env; | ||
447 | struct GNUNET_CADET_ConnectionBrokenMessage *bm; | ||
448 | |||
449 | env = GNUNET_MQ_msg (bm, | ||
450 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); | ||
451 | bm->cid = msg->cid; | ||
452 | bm->peer1 = pids[off + 1]; | ||
453 | bm->peer2 = my_full_id; | ||
454 | GCP_send_ooo (sender, | ||
455 | env); | ||
456 | return; | ||
457 | } | ||
458 | |||
459 | /* Workable route, create routing entry */ | ||
460 | route = GNUNET_new (struct CadetRoute); | ||
461 | route->cid = msg->cid; | ||
462 | dir_init (&route->prev, | ||
463 | route, | ||
464 | sender); | ||
465 | dir_init (&route->next, | ||
466 | route, | ||
467 | next); | ||
468 | GNUNET_assert (GNUNET_OK == | ||
469 | GNUNET_CONTAINER_multishortmap_put (routes, | ||
470 | &route->cid.connection_of_tunnel, | ||
471 | route, | ||
472 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
473 | } | ||
474 | |||
475 | |||
476 | /** | ||
477 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK | ||
478 | * | ||
479 | * @param cls Closure (CadetPeer for neighbor that sent the message). | ||
480 | * @param msg Message itself. | ||
481 | */ | ||
482 | static void | ||
483 | handle_connection_create_ack (void *cls, | ||
484 | const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg) | ||
485 | { | ||
486 | struct CadetPeer *peer = cls; | ||
487 | struct CadetConnection *cc; | ||
488 | |||
489 | /* First, check if ACK belongs to a connection that ends here. */ | ||
490 | cc = GNUNET_CONTAINER_multishortmap_get (connections, | ||
491 | &msg->cid.connection_of_tunnel); | ||
492 | if (NULL != cc) | ||
493 | { | ||
494 | /* verify ACK came from the right direction */ | ||
495 | struct CadetPeerPath *path = GCC_get_path (cc); | ||
496 | |||
497 | if (peer != | ||
498 | GCPP_get_peer_at_offset (path, | ||
499 | 0)) | ||
500 | { | ||
501 | /* received ACK from unexpected direction, ignore! */ | ||
502 | GNUNET_break_op (0); | ||
503 | return; | ||
504 | } | ||
505 | GCC_handle_connection_ack (cc); | ||
506 | return; | ||
507 | } | ||
508 | |||
509 | /* We're just an intermediary peer, route the message along its path */ | ||
510 | route_message (peer, | ||
511 | &msg->cid, | ||
512 | &msg->header); | ||
513 | } | ||
514 | |||
515 | |||
516 | /** | ||
517 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN | ||
518 | * | ||
519 | * @param cls Closure (CadetPeer for neighbor that sent the message). | ||
520 | * @param msg Message itself. | ||
521 | * @deprecated duplicate logic with #handle_destroy(); dedup! | ||
522 | */ | ||
523 | static void | ||
524 | handle_connection_broken (void *cls, | ||
525 | const struct GNUNET_CADET_ConnectionBrokenMessage *msg) | ||
526 | { | ||
527 | struct CadetPeer *peer = cls; | ||
528 | struct CadetConnection *cc; | ||
529 | struct CadetRoute *route; | ||
530 | |||
531 | /* First, check if message belongs to a connection that ends here. */ | ||
532 | cc = GNUNET_CONTAINER_multishortmap_get (connections, | ||
533 | &msg->cid.connection_of_tunnel); | ||
534 | if (NULL != cc) | ||
535 | { | ||
536 | /* verify message came from the right direction */ | ||
537 | struct CadetPeerPath *path = GCC_get_path (cc); | ||
538 | |||
539 | if (peer != | ||
540 | GCPP_get_peer_at_offset (path, | ||
541 | 0)) | ||
542 | { | ||
543 | /* received message from unexpected direction, ignore! */ | ||
544 | GNUNET_break_op (0); | ||
545 | return; | ||
546 | } | ||
547 | GCC_destroy (cc); | ||
548 | |||
549 | /* FIXME: also destroy the path up to the specified link! */ | ||
550 | return; | ||
551 | } | ||
552 | |||
553 | /* We're just an intermediary peer, route the message along its path */ | ||
554 | route = get_route (&msg->cid); | ||
555 | route_message (peer, | ||
556 | &msg->cid, | ||
557 | &msg->header); | ||
558 | destroy_route (route); | ||
559 | /* FIXME: also destroy paths we MAY have up to the specified link! */ | ||
560 | } | ||
561 | |||
562 | |||
563 | /** | ||
564 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY | ||
565 | * | ||
566 | * @param cls Closure (CadetPeer for neighbor that sent the message). | ||
567 | * @param msg Message itself. | ||
568 | */ | ||
569 | static void | ||
570 | handle_connection_destroy (void *cls, | ||
571 | const struct GNUNET_CADET_ConnectionDestroyMessage *msg) | ||
572 | { | ||
573 | struct CadetPeer *peer = cls; | ||
574 | struct CadetConnection *cc; | ||
575 | struct CadetRoute *route; | ||
576 | |||
577 | /* First, check if message belongs to a connection that ends here. */ | ||
578 | cc = GNUNET_CONTAINER_multishortmap_get (connections, | ||
579 | &msg->cid.connection_of_tunnel); | ||
580 | if (NULL != cc) | ||
581 | { | ||
582 | /* verify message came from the right direction */ | ||
583 | struct CadetPeerPath *path = GCC_get_path (cc); | ||
584 | |||
585 | if (peer != | ||
586 | GCPP_get_peer_at_offset (path, | ||
587 | 0)) | ||
588 | { | ||
589 | /* received message from unexpected direction, ignore! */ | ||
590 | GNUNET_break_op (0); | ||
591 | return; | ||
592 | } | ||
593 | GCC_destroy (cc); | ||
594 | return; | ||
595 | } | ||
596 | |||
597 | /* We're just an intermediary peer, route the message along its path */ | ||
598 | route = get_route (&msg->cid); | ||
599 | route_message (peer, | ||
600 | &msg->cid, | ||
601 | &msg->header); | ||
602 | destroy_route (route); | ||
603 | } | ||
604 | |||
605 | |||
606 | /** | ||
607 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_HOP_BY_HOP_ENCRYPTED_ACK. | ||
608 | * | ||
609 | * @param cls Closure (CadetPeer for neighbor that sent the message). | ||
610 | * @param msg Message itself. | ||
611 | */ | ||
612 | static void | ||
613 | handle_hop_by_hop_encrypted_ack (void *cls, | ||
614 | const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg) | ||
615 | { | ||
616 | struct CadetPeer *peer = cls; | ||
617 | struct CadetConnection *cc; | ||
618 | |||
619 | /* First, check if message belongs to a connection that ends here. */ | ||
620 | cc = GNUNET_CONTAINER_multishortmap_get (connections, | ||
621 | &msg->cid.connection_of_tunnel); | ||
622 | if (NULL != cc) | ||
623 | { | ||
624 | /* verify message came from the right direction */ | ||
625 | struct CadetPeerPath *path = GCC_get_path (cc); | ||
626 | |||
627 | if (peer != | ||
628 | GCPP_get_peer_at_offset (path, | ||
629 | 0)) | ||
630 | { | ||
631 | /* received message from unexpected direction, ignore! */ | ||
632 | GNUNET_break_op (0); | ||
633 | return; | ||
634 | } | ||
635 | #if FIXME | ||
636 | GCC_handle_ack (peer, | ||
637 | msg); | ||
638 | #endif | ||
639 | return; | ||
640 | } | ||
641 | |||
642 | /* We're just an intermediary peer, route the message along its path */ | ||
643 | route_message (peer, | ||
644 | &msg->cid, | ||
645 | &msg->header); | ||
646 | } | ||
647 | |||
648 | |||
649 | /** | ||
650 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL | ||
651 | * | ||
652 | * @param cls Closure (CadetPeer for neighbor that sent the message). | ||
653 | * @param msg Message itself. | ||
654 | */ | ||
655 | static void | ||
656 | handle_poll (void *cls, | ||
657 | const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg) | ||
658 | { | ||
659 | struct CadetPeer *peer = cls; | ||
660 | |||
661 | #if FIXME | ||
662 | GCC_handle_poll (peer, | ||
663 | msg); | ||
664 | #endif | ||
665 | } | ||
666 | |||
667 | |||
668 | /** | ||
669 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX | ||
670 | * | ||
671 | * @param cls Closure (CadetPeer for neighbor that sent the message). | ||
672 | * @param msg Message itself. | ||
673 | */ | ||
674 | static void | ||
675 | handle_tunnel_kx (void *cls, | ||
676 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) | ||
677 | { | ||
678 | struct CadetPeer *peer = cls; | ||
679 | struct CadetConnection *cc; | ||
680 | |||
681 | /* First, check if message belongs to a connection that ends here. */ | ||
682 | cc = GNUNET_CONTAINER_multishortmap_get (connections, | ||
683 | &msg->cid.connection_of_tunnel); | ||
684 | if (NULL != cc) | ||
685 | { | ||
686 | /* verify message came from the right direction */ | ||
687 | struct CadetPeerPath *path = GCC_get_path (cc); | ||
688 | |||
689 | if (peer != | ||
690 | GCPP_get_peer_at_offset (path, | ||
691 | 0)) | ||
692 | { | ||
693 | /* received message from unexpected direction, ignore! */ | ||
694 | GNUNET_break_op (0); | ||
695 | return; | ||
696 | } | ||
697 | GCC_handle_kx (cc, | ||
698 | msg); | ||
699 | return; | ||
700 | } | ||
701 | |||
702 | /* We're just an intermediary peer, route the message along its path */ | ||
703 | route_message (peer, | ||
704 | &msg->cid, | ||
705 | &msg->header); | ||
706 | } | ||
707 | |||
708 | |||
709 | /** | ||
710 | * Check if the encrypted message has the appropriate size. | ||
711 | * | ||
712 | * @param cls Closure (unused). | ||
713 | * @param msg Message to check. | ||
714 | * | ||
715 | * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. | ||
716 | */ | ||
717 | static int | ||
718 | check_tunnel_encrypted (void *cls, | ||
719 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg) | ||
720 | { | ||
721 | return GNUNET_YES; | ||
722 | } | ||
723 | |||
724 | |||
725 | /** | ||
726 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED. | ||
727 | * | ||
728 | * @param cls Closure (CadetPeer for neighbor that sent the message). | ||
729 | * @param msg Message itself. | ||
730 | */ | ||
731 | static void | ||
732 | handle_tunnel_encrypted (void *cls, | ||
733 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg) | ||
734 | { | ||
735 | struct CadetPeer *peer = cls; | ||
736 | struct CadetConnection *cc; | ||
737 | |||
738 | /* First, check if message belongs to a connection that ends here. */ | ||
739 | cc = GNUNET_CONTAINER_multishortmap_get (connections, | ||
740 | &msg->cid.connection_of_tunnel); | ||
741 | if (NULL != cc) | ||
742 | { | ||
743 | /* verify message came from the right direction */ | ||
744 | struct CadetPeerPath *path = GCC_get_path (cc); | ||
745 | |||
746 | if (peer != | ||
747 | GCPP_get_peer_at_offset (path, | ||
748 | 0)) | ||
749 | { | ||
750 | /* received message from unexpected direction, ignore! */ | ||
751 | GNUNET_break_op (0); | ||
752 | return; | ||
753 | } | ||
754 | GCC_handle_encrypted (cc, | ||
755 | msg); | ||
756 | return; | ||
757 | } | ||
758 | |||
759 | /* We're just an intermediary peer, route the message along its path */ | ||
760 | route_message (peer, | ||
761 | &msg->cid, | ||
762 | &msg->header); | ||
763 | } | ||
764 | |||
765 | |||
766 | /** | ||
767 | * Function called after #GNUNET_CORE_connect has succeeded (or failed | ||
768 | * for good). Note that the private key of the peer is intentionally | ||
769 | * not exposed here; if you need it, your process should try to read | ||
770 | * the private key file directly (which should work if you are | ||
771 | * authorized...). Implementations of this function must not call | ||
772 | * #GNUNET_CORE_disconnect (other than by scheduling a new task to | ||
773 | * do this later). | ||
774 | * | ||
775 | * @param cls closure | ||
776 | * @param my_identity ID of this peer, NULL if we failed | ||
777 | */ | ||
778 | static void | ||
779 | core_init_cb (void *cls, | ||
780 | const struct GNUNET_PeerIdentity *my_identity) | ||
781 | { | ||
782 | if (NULL == my_identity) | ||
783 | { | ||
784 | GNUNET_break (0); | ||
785 | return; | ||
786 | } | ||
787 | GNUNET_break (0 == | ||
788 | memcmp (my_identity, | ||
789 | &my_full_id, | ||
790 | sizeof (struct GNUNET_PeerIdentity))); | ||
791 | } | ||
792 | |||
793 | |||
794 | /** | ||
795 | * Method called whenever a given peer connects. | ||
796 | * | ||
797 | * @param cls closure | ||
798 | * @param peer peer identity this notification is about | ||
799 | */ | ||
800 | static void * | ||
801 | core_connect_cb (void *cls, | ||
802 | const struct GNUNET_PeerIdentity *peer, | ||
803 | struct GNUNET_MQ_Handle *mq) | ||
804 | { | ||
805 | struct CadetPeer *cp; | ||
806 | |||
807 | cp = GCP_get (peer, | ||
808 | GNUNET_YES); | ||
809 | GCP_set_mq (cp, | ||
810 | mq); | ||
811 | return cp; | ||
812 | } | ||
813 | |||
814 | |||
815 | /** | ||
816 | * Method called whenever a peer disconnects. | ||
817 | * | ||
818 | * @param cls closure | ||
819 | * @param peer peer identity this notification is about | ||
820 | */ | ||
821 | static void | ||
822 | core_disconnect_cb (void *cls, | ||
823 | const struct GNUNET_PeerIdentity *peer, | ||
824 | void *peer_cls) | ||
825 | { | ||
826 | struct CadetPeer *cp = peer_cls; | ||
827 | |||
828 | GCP_set_mq (cp, | ||
829 | NULL); | ||
830 | } | ||
831 | |||
832 | |||
833 | /** | ||
834 | * Initialize the CORE subsystem. | ||
835 | * | ||
836 | * @param c Configuration. | ||
837 | */ | ||
838 | void | ||
839 | GCO_init (const struct GNUNET_CONFIGURATION_Handle *c) | ||
840 | { | ||
841 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
842 | GNUNET_MQ_hd_var_size (connection_create, | ||
843 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, | ||
844 | struct GNUNET_CADET_ConnectionCreateMessage, | ||
845 | NULL), | ||
846 | GNUNET_MQ_hd_fixed_size (connection_create_ack, | ||
847 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, | ||
848 | struct GNUNET_CADET_ConnectionCreateMessageAckMessage, | ||
849 | NULL), | ||
850 | GNUNET_MQ_hd_fixed_size (connection_broken, | ||
851 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, | ||
852 | struct GNUNET_CADET_ConnectionBrokenMessage, | ||
853 | NULL), | ||
854 | GNUNET_MQ_hd_fixed_size (connection_destroy, | ||
855 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, | ||
856 | struct GNUNET_CADET_ConnectionDestroyMessage, | ||
857 | NULL), | ||
858 | GNUNET_MQ_hd_fixed_size (hop_by_hop_encrypted_ack, | ||
859 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK, | ||
860 | struct GNUNET_CADET_ConnectionEncryptedAckMessage, | ||
861 | NULL), | ||
862 | GNUNET_MQ_hd_fixed_size (poll, | ||
863 | GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL, | ||
864 | struct GNUNET_CADET_ConnectionHopByHopPollMessage, | ||
865 | NULL), | ||
866 | GNUNET_MQ_hd_fixed_size (tunnel_kx, | ||
867 | GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX, | ||
868 | struct GNUNET_CADET_TunnelKeyExchangeMessage, | ||
869 | NULL), | ||
870 | GNUNET_MQ_hd_var_size (tunnel_encrypted, | ||
871 | GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED, | ||
872 | struct GNUNET_CADET_TunnelEncryptedMessage, | ||
873 | NULL), | ||
874 | GNUNET_MQ_handler_end () | ||
875 | }; | ||
876 | |||
877 | routes = GNUNET_CONTAINER_multishortmap_create (1024, | ||
878 | GNUNET_NO); | ||
879 | core = GNUNET_CORE_connect (c, | ||
880 | NULL, | ||
881 | &core_init_cb, | ||
882 | &core_connect_cb, | ||
883 | &core_disconnect_cb, | ||
884 | handlers); | ||
885 | } | ||
886 | |||
887 | |||
888 | /** | ||
889 | * Shut down the CORE subsystem. | ||
890 | */ | ||
891 | void | ||
892 | GCO_shutdown () | ||
893 | { | ||
894 | if (NULL != core) | ||
895 | { | ||
896 | GNUNET_CORE_disconnect (core); | ||
897 | core = NULL; | ||
898 | } | ||
899 | GNUNET_assert (0 == GNUNET_CONTAINER_multishortmap_size (routes)); | ||
900 | GNUNET_CONTAINER_multishortmap_destroy (routes); | ||
901 | } | ||
902 | |||
903 | /* end of gnunet-cadet-service_core.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_core.h b/src/cadet/gnunet-service-cadet-new_core.h new file mode 100644 index 000000000..65b0a6ba5 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_core.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file cadet/gnunet-service-cadet_core.h | ||
23 | * @brief cadet service; interaction with CORE service | ||
24 | * @author Bartlomiej Polot | ||
25 | * @author Christian Grothoff | ||
26 | * | ||
27 | * All functions in this file should use the prefix GCO (Gnunet Cadet cOre (bottom)) | ||
28 | */ | ||
29 | |||
30 | #ifndef GNUNET_SERVICE_CADET_CORE_H | ||
31 | #define GNUNET_SERVICE_CADET_CORE_H | ||
32 | |||
33 | #ifdef __cplusplus | ||
34 | extern "C" | ||
35 | { | ||
36 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
37 | } | ||
38 | #endif | ||
39 | #endif | ||
40 | |||
41 | #include "gnunet_util_lib.h" | ||
42 | |||
43 | |||
44 | /** | ||
45 | * Initialize the CORE subsystem. | ||
46 | * | ||
47 | * @param c Configuration. | ||
48 | */ | ||
49 | void | ||
50 | GCO_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
51 | |||
52 | |||
53 | /** | ||
54 | * Shut down the CORE subsystem. | ||
55 | */ | ||
56 | void | ||
57 | GCO_shutdown (void); | ||
58 | |||
59 | |||
60 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
61 | { | ||
62 | #endif | ||
63 | #ifdef __cplusplus | ||
64 | } | ||
65 | #endif | ||
66 | |||
67 | /* ifndef GNUNET_CADET_SERVICE_CORE_H */ | ||
68 | #endif | ||
69 | /* end of gnunet-cadet-service_core.h */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_dht.c b/src/cadet/gnunet-service-cadet-new_dht.c new file mode 100644 index 000000000..3cf3f0301 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_dht.c | |||
@@ -0,0 +1,315 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2013, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file cadet/gnunet-service-cadet-new_dht.c | ||
22 | * @brief Information we track per peer. | ||
23 | * @author Bartlomiej Polot | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #include "platform.h" | ||
28 | #include "gnunet_util_lib.h" | ||
29 | #include "gnunet_dht_service.h" | ||
30 | #include "gnunet_statistics_service.h" | ||
31 | #include "gnunet-service-cadet-new.h" | ||
32 | #include "gnunet-service-cadet-new_dht.h" | ||
33 | #include "gnunet-service-cadet-new_hello.h" | ||
34 | #include "gnunet-service-cadet-new_peer.h" | ||
35 | #include "gnunet-service-cadet-new_paths.h" | ||
36 | |||
37 | #define LOG(level, ...) GNUNET_log_from (level,"cadet-dht",__VA_ARGS__) | ||
38 | |||
39 | |||
40 | /** | ||
41 | * Handle for DHT searches. | ||
42 | */ | ||
43 | struct GCD_search_handle | ||
44 | { | ||
45 | /** | ||
46 | * DHT_GET handle. | ||
47 | */ | ||
48 | struct GNUNET_DHT_GetHandle *dhtget; | ||
49 | |||
50 | }; | ||
51 | |||
52 | |||
53 | /** | ||
54 | * Handle to use DHT. | ||
55 | */ | ||
56 | static struct GNUNET_DHT_Handle *dht_handle; | ||
57 | |||
58 | /** | ||
59 | * How often to PUT own ID in the DHT. | ||
60 | */ | ||
61 | static struct GNUNET_TIME_Relative id_announce_time; | ||
62 | |||
63 | /** | ||
64 | * DHT replication level, see DHT API: #GNUNET_DHT_get_start(), #GNUNET_DHT_put(). | ||
65 | */ | ||
66 | static unsigned long long dht_replication_level; | ||
67 | |||
68 | /** | ||
69 | * Task to periodically announce itself in the network. | ||
70 | */ | ||
71 | static struct GNUNET_SCHEDULER_Task *announce_id_task; | ||
72 | |||
73 | /** | ||
74 | * Delay for the next ID announce. | ||
75 | */ | ||
76 | static struct GNUNET_TIME_Relative announce_delay; | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Function to process paths received for a new peer addition. The recorded | ||
81 | * paths form the initial tunnel, which can be optimized later. | ||
82 | * Called on each result obtained for the DHT search. | ||
83 | * | ||
84 | * @param cls closure | ||
85 | * @param exp when will this value expire | ||
86 | * @param key key of the result | ||
87 | * @param get_path path of the get request | ||
88 | * @param get_path_length lenght of @a get_path | ||
89 | * @param put_path path of the put request | ||
90 | * @param put_path_length length of the @a put_path | ||
91 | * @param type type of the result | ||
92 | * @param size number of bytes in data | ||
93 | * @param data pointer to the result data | ||
94 | */ | ||
95 | static void | ||
96 | dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, | ||
97 | const struct GNUNET_HashCode *key, | ||
98 | const struct GNUNET_PeerIdentity *get_path, | ||
99 | unsigned int get_path_length, | ||
100 | const struct GNUNET_PeerIdentity *put_path, | ||
101 | unsigned int put_path_length, | ||
102 | enum GNUNET_BLOCK_Type type, | ||
103 | size_t size, | ||
104 | const void *data) | ||
105 | { | ||
106 | const struct GNUNET_HELLO_Message *hello = data; | ||
107 | struct CadetPeer *peer; | ||
108 | |||
109 | GCPP_try_path_from_dht (get_path, | ||
110 | get_path_length, | ||
111 | put_path, | ||
112 | put_path_length); | ||
113 | if ( (size >= sizeof (struct GNUNET_HELLO_Message)) && | ||
114 | (ntohs (hello->header.size) == size) && | ||
115 | (size == GNUNET_HELLO_size (hello)) ) | ||
116 | { | ||
117 | peer = GCP_get (&put_path[0], | ||
118 | GNUNET_YES); | ||
119 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
120 | "Got HELLO for %s\n", | ||
121 | GCP_2s (peer)); | ||
122 | GCP_set_hello (peer, | ||
123 | hello); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | |||
128 | /** | ||
129 | * Periodically announce self id in the DHT | ||
130 | * | ||
131 | * @param cls closure | ||
132 | */ | ||
133 | static void | ||
134 | announce_id (void *cls) | ||
135 | { | ||
136 | struct GNUNET_HashCode phash; | ||
137 | const struct GNUNET_HELLO_Message *hello; | ||
138 | size_t size; | ||
139 | struct GNUNET_TIME_Absolute expiration; | ||
140 | struct GNUNET_TIME_Relative next_put; | ||
141 | |||
142 | hello = GCH_get_mine (); | ||
143 | size = (NULL != hello) ? GNUNET_HELLO_size (hello) : 0; | ||
144 | if (0 == size) | ||
145 | { | ||
146 | expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), | ||
147 | announce_delay); | ||
148 | announce_delay = GNUNET_TIME_STD_BACKOFF (announce_delay); | ||
149 | } | ||
150 | else | ||
151 | { | ||
152 | expiration = GNUNET_HELLO_get_last_expiration (hello); | ||
153 | announce_delay = GNUNET_TIME_UNIT_SECONDS; | ||
154 | } | ||
155 | |||
156 | /* Call again in id_announce_time, unless HELLO expires first, | ||
157 | * but wait at least 1s. */ | ||
158 | next_put | ||
159 | = GNUNET_TIME_absolute_get_remaining (expiration); | ||
160 | next_put | ||
161 | = GNUNET_TIME_relative_min (next_put, | ||
162 | id_announce_time); | ||
163 | next_put | ||
164 | = GNUNET_TIME_relative_max (next_put, | ||
165 | GNUNET_TIME_UNIT_SECONDS); | ||
166 | announce_id_task | ||
167 | = GNUNET_SCHEDULER_add_delayed (next_put, | ||
168 | &announce_id, | ||
169 | cls); | ||
170 | GNUNET_STATISTICS_update (stats, | ||
171 | "# DHT announce", | ||
172 | 1, | ||
173 | GNUNET_NO); | ||
174 | memset (&phash, | ||
175 | 0, | ||
176 | sizeof (phash)); | ||
177 | GNUNET_memcpy (&phash, | ||
178 | &my_full_id, | ||
179 | sizeof (my_full_id)); | ||
180 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
181 | "Announcing my HELLO (%u bytes) in the DHT\n", | ||
182 | size); | ||
183 | GNUNET_DHT_put (dht_handle, /* DHT handle */ | ||
184 | &phash, /* Key to use */ | ||
185 | dht_replication_level, /* Replication level */ | ||
186 | GNUNET_DHT_RO_RECORD_ROUTE | ||
187 | | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, /* DHT options */ | ||
188 | GNUNET_BLOCK_TYPE_DHT_HELLO, /* Block type */ | ||
189 | size, /* Size of the data */ | ||
190 | (const char *) hello, /* Data itself */ | ||
191 | expiration, /* Data expiration */ | ||
192 | NULL, /* Continuation */ | ||
193 | NULL); /* Continuation closure */ | ||
194 | } | ||
195 | |||
196 | |||
197 | /** | ||
198 | * Initialize the DHT subsystem. | ||
199 | * | ||
200 | * @param c Configuration. | ||
201 | */ | ||
202 | void | ||
203 | GCD_init (const struct GNUNET_CONFIGURATION_Handle *c) | ||
204 | { | ||
205 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
206 | "init\n"); | ||
207 | if (GNUNET_OK != | ||
208 | GNUNET_CONFIGURATION_get_value_number (c, | ||
209 | "CADET", | ||
210 | "DHT_REPLICATION_LEVEL", | ||
211 | &dht_replication_level)) | ||
212 | { | ||
213 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, | ||
214 | "CADET", | ||
215 | "DHT_REPLICATION_LEVEL", | ||
216 | "USING DEFAULT"); | ||
217 | dht_replication_level = 3; | ||
218 | } | ||
219 | |||
220 | if (GNUNET_OK != | ||
221 | GNUNET_CONFIGURATION_get_value_time (c, | ||
222 | "CADET", | ||
223 | "ID_ANNOUNCE_TIME", | ||
224 | &id_announce_time)) | ||
225 | { | ||
226 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
227 | "CADET", | ||
228 | "ID_ANNOUNCE_TIME", | ||
229 | "MISSING"); | ||
230 | GNUNET_SCHEDULER_shutdown (); | ||
231 | return; | ||
232 | } | ||
233 | |||
234 | dht_handle = GNUNET_DHT_connect (c, | ||
235 | 64); | ||
236 | GNUNET_break (NULL != dht_handle); | ||
237 | announce_delay = GNUNET_TIME_UNIT_SECONDS; | ||
238 | announce_id_task = GNUNET_SCHEDULER_add_now (&announce_id, | ||
239 | NULL); | ||
240 | } | ||
241 | |||
242 | |||
243 | /** | ||
244 | * Shut down the DHT subsystem. | ||
245 | */ | ||
246 | void | ||
247 | GCD_shutdown (void) | ||
248 | { | ||
249 | if (NULL != dht_handle) | ||
250 | { | ||
251 | GNUNET_DHT_disconnect (dht_handle); | ||
252 | dht_handle = NULL; | ||
253 | } | ||
254 | if (NULL != announce_id_task) | ||
255 | { | ||
256 | GNUNET_SCHEDULER_cancel (announce_id_task); | ||
257 | announce_id_task = NULL; | ||
258 | } | ||
259 | } | ||
260 | |||
261 | |||
262 | /** | ||
263 | * Search DHT for paths to @a peeR_id | ||
264 | * | ||
265 | * @param peer_id peer to search for | ||
266 | * @return handle to abort search | ||
267 | */ | ||
268 | struct GCD_search_handle * | ||
269 | GCD_search (const struct GNUNET_PeerIdentity *peer_id) | ||
270 | { | ||
271 | struct GNUNET_HashCode phash; | ||
272 | struct GCD_search_handle *h; | ||
273 | |||
274 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
275 | "Starting DHT GET for peer %s\n", | ||
276 | GNUNET_i2s (peer_id)); | ||
277 | GNUNET_STATISTICS_update (stats, | ||
278 | "# DHT search", | ||
279 | 1, | ||
280 | GNUNET_NO); | ||
281 | memset (&phash, | ||
282 | 0, | ||
283 | sizeof (phash)); | ||
284 | GNUNET_memcpy (&phash, | ||
285 | peer_id, | ||
286 | sizeof (*peer_id)); | ||
287 | |||
288 | h = GNUNET_new (struct GCD_search_handle); | ||
289 | h->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */ | ||
290 | GNUNET_BLOCK_TYPE_DHT_HELLO, /* type */ | ||
291 | &phash, /* key to search */ | ||
292 | dht_replication_level, /* replication level */ | ||
293 | GNUNET_DHT_RO_RECORD_ROUTE | | ||
294 | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, | ||
295 | NULL, /* xquery */ | ||
296 | 0, /* xquery bits */ | ||
297 | &dht_get_id_handler, | ||
298 | h); | ||
299 | return h; | ||
300 | } | ||
301 | |||
302 | |||
303 | /** | ||
304 | * Stop DHT search started with #GCD_search(). | ||
305 | * | ||
306 | * @param h handle to search to stop | ||
307 | */ | ||
308 | void | ||
309 | GCD_search_stop (struct GCD_search_handle *h) | ||
310 | { | ||
311 | GNUNET_DHT_get_stop (h->dhtget); | ||
312 | GNUNET_free (h); | ||
313 | } | ||
314 | |||
315 | /* end of gnunet-service-cadet_dht.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_dht.h b/src/cadet/gnunet-service-cadet-new_dht.h new file mode 100644 index 000000000..81f16ae99 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_dht.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2013, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file cadet/gnunet-service-cadet_dht.h | ||
23 | * @brief cadet service; dealing with DHT requests and results | ||
24 | * @author Bartlomiej Polot | ||
25 | * @author Christian Grothoff | ||
26 | * | ||
27 | * All functions in this file should use the prefix GCD (Gnunet Cadet Dht) | ||
28 | */ | ||
29 | #ifndef GNUNET_SERVICE_CADET_DHT_H | ||
30 | #define GNUNET_SERVICE_CADET_DHT_H | ||
31 | |||
32 | #ifdef __cplusplus | ||
33 | extern "C" | ||
34 | { | ||
35 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
36 | } | ||
37 | #endif | ||
38 | #endif | ||
39 | |||
40 | #include "platform.h" | ||
41 | #include "gnunet_util_lib.h" | ||
42 | |||
43 | /** | ||
44 | * Handle for DHT search operation. | ||
45 | */ | ||
46 | struct GCD_search_handle; | ||
47 | |||
48 | |||
49 | /** | ||
50 | * Initialize the DHT subsystem. | ||
51 | * | ||
52 | * @param c Configuration. | ||
53 | */ | ||
54 | void | ||
55 | GCD_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
56 | |||
57 | |||
58 | /** | ||
59 | * Shut down the DHT subsystem. | ||
60 | */ | ||
61 | void | ||
62 | GCD_shutdown (void); | ||
63 | |||
64 | |||
65 | /** | ||
66 | * Search DHT for paths to @a peeR_id | ||
67 | * | ||
68 | * @param peer_id peer to search for | ||
69 | * @return handle to abort search | ||
70 | */ | ||
71 | struct GCD_search_handle * | ||
72 | GCD_search (const struct GNUNET_PeerIdentity *peer_id); | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Stop DHT search started with #GCD_search(). | ||
77 | * | ||
78 | * @param h handle to search to stop | ||
79 | */ | ||
80 | void | ||
81 | GCD_search_stop (struct GCD_search_handle *h); | ||
82 | |||
83 | |||
84 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
85 | { | ||
86 | #endif | ||
87 | #ifdef __cplusplus | ||
88 | } | ||
89 | #endif | ||
90 | |||
91 | /* ifndef GNUNET_CADET_SERVICE_DHT_H */ | ||
92 | #endif | ||
93 | /* end of gnunet-service-cadet_dht.h */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_hello.c b/src/cadet/gnunet-service-cadet-new_hello.c new file mode 100644 index 000000000..9d4635021 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_hello.c | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2014, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #include "platform.h" | ||
22 | #include "gnunet_util_lib.h" | ||
23 | |||
24 | #include "gnunet_statistics_service.h" | ||
25 | #include "gnunet_peerinfo_service.h" | ||
26 | #include "cadet_protocol.h" | ||
27 | #include "gnunet-service-cadet-new.h" | ||
28 | #include "gnunet-service-cadet-new_hello.h" | ||
29 | #include "gnunet-service-cadet-new_peer.h" | ||
30 | |||
31 | #define LOG(level, ...) GNUNET_log_from(level,"cadet-hll",__VA_ARGS__) | ||
32 | |||
33 | /** | ||
34 | * Hello message of local peer. | ||
35 | */ | ||
36 | static struct GNUNET_HELLO_Message *mine; | ||
37 | |||
38 | /** | ||
39 | * Handle to peerinfo service. | ||
40 | */ | ||
41 | static struct GNUNET_PEERINFO_Handle *peerinfo; | ||
42 | |||
43 | /** | ||
44 | * Iterator context. | ||
45 | */ | ||
46 | static struct GNUNET_PEERINFO_NotifyContext* nc; | ||
47 | |||
48 | |||
49 | /** | ||
50 | * Process each hello message received from peerinfo. | ||
51 | * | ||
52 | * @param cls Closure (unused). | ||
53 | * @param peer Identity of the peer. | ||
54 | * @param hello Hello of the peer. | ||
55 | * @param err_msg Error message. | ||
56 | */ | ||
57 | static void | ||
58 | got_hello (void *cls, | ||
59 | const struct GNUNET_PeerIdentity *id, | ||
60 | const struct GNUNET_HELLO_Message *hello, | ||
61 | const char *err_msg) | ||
62 | { | ||
63 | struct CadetPeer *peer; | ||
64 | |||
65 | if ( (NULL == id) || | ||
66 | (NULL == hello) ) | ||
67 | return; | ||
68 | if (0 == memcmp (id, | ||
69 | &my_full_id, | ||
70 | sizeof (struct GNUNET_PeerIdentity))) | ||
71 | { | ||
72 | GNUNET_free_non_null (mine); | ||
73 | mine = (struct GNUNET_HELLO_Message *) GNUNET_copy_message (&hello->header); | ||
74 | return; | ||
75 | } | ||
76 | |||
77 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
78 | "Hello for %s (%d bytes), expires on %s\n", | ||
79 | GNUNET_i2s (id), | ||
80 | GNUNET_HELLO_size (hello), | ||
81 | GNUNET_STRINGS_absolute_time_to_string (GNUNET_HELLO_get_last_expiration (hello))); | ||
82 | peer = GCP_get (id, | ||
83 | GNUNET_YES); | ||
84 | GCP_set_hello (peer, | ||
85 | hello); | ||
86 | |||
87 | } | ||
88 | |||
89 | |||
90 | /** | ||
91 | * Initialize the hello subsystem. | ||
92 | * | ||
93 | * @param c Configuration. | ||
94 | */ | ||
95 | void | ||
96 | GCH_init (const struct GNUNET_CONFIGURATION_Handle *c) | ||
97 | { | ||
98 | GNUNET_assert (NULL == nc); | ||
99 | peerinfo = GNUNET_PEERINFO_connect (c); | ||
100 | nc = GNUNET_PEERINFO_notify (c, | ||
101 | GNUNET_NO, | ||
102 | &got_hello, | ||
103 | NULL); | ||
104 | } | ||
105 | |||
106 | |||
107 | /** | ||
108 | * Shut down the hello subsystem. | ||
109 | */ | ||
110 | void | ||
111 | GCH_shutdown () | ||
112 | { | ||
113 | if (NULL != nc) | ||
114 | { | ||
115 | GNUNET_PEERINFO_notify_cancel (nc); | ||
116 | nc = NULL; | ||
117 | } | ||
118 | if (NULL != peerinfo) | ||
119 | { | ||
120 | GNUNET_PEERINFO_disconnect (peerinfo); | ||
121 | peerinfo = NULL; | ||
122 | } | ||
123 | if (NULL != mine) | ||
124 | { | ||
125 | GNUNET_free (mine); | ||
126 | mine = NULL; | ||
127 | } | ||
128 | } | ||
129 | |||
130 | |||
131 | /** | ||
132 | * Get own hello message. | ||
133 | * | ||
134 | * @return Own hello message. | ||
135 | */ | ||
136 | const struct GNUNET_HELLO_Message * | ||
137 | GCH_get_mine (void) | ||
138 | { | ||
139 | return mine; | ||
140 | } | ||
141 | |||
142 | /* end of gnunet-service-cadet-new_hello.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_hello.h b/src/cadet/gnunet-service-cadet-new_hello.h new file mode 100644 index 000000000..4291ae985 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_hello.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2014, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file cadet/gnunet-service-cadet_hello.h | ||
23 | * @brief cadet service; dealing with hello messages | ||
24 | * @author Bartlomiej Polot | ||
25 | * @author Christian Grothoff | ||
26 | * | ||
27 | * All functions in this file should use the prefix GCH (Gnunet Cadet Hello) | ||
28 | */ | ||
29 | |||
30 | #ifndef GNUNET_SERVICE_CADET_HELLO_H | ||
31 | #define GNUNET_SERVICE_CADET_HELLO_H | ||
32 | |||
33 | #ifdef __cplusplus | ||
34 | extern "C" | ||
35 | { | ||
36 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
37 | } | ||
38 | #endif | ||
39 | #endif | ||
40 | |||
41 | #include "platform.h" | ||
42 | #include "gnunet_util_lib.h" | ||
43 | #include "gnunet_hello_lib.h" | ||
44 | |||
45 | |||
46 | /** | ||
47 | * Initialize the hello subsystem. | ||
48 | * | ||
49 | * @param c Configuration. | ||
50 | */ | ||
51 | void | ||
52 | GCH_init (const struct GNUNET_CONFIGURATION_Handle *c); | ||
53 | |||
54 | |||
55 | /** | ||
56 | * Shut down the hello subsystem. | ||
57 | */ | ||
58 | void | ||
59 | GCH_shutdown (void); | ||
60 | |||
61 | |||
62 | /** | ||
63 | * Get own hello message. | ||
64 | * | ||
65 | * @return Own hello message. | ||
66 | */ | ||
67 | const struct GNUNET_HELLO_Message * | ||
68 | GCH_get_mine (void); | ||
69 | |||
70 | |||
71 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
72 | { | ||
73 | #endif | ||
74 | #ifdef __cplusplus | ||
75 | } | ||
76 | #endif | ||
77 | |||
78 | /* ifndef GNUNET_CADET_SERVICE_HELLO_H */ | ||
79 | #endif | ||
80 | /* end of gnunet-cadet-service_hello.h */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_paths.c b/src/cadet/gnunet-service-cadet-new_paths.c new file mode 100644 index 000000000..3cfce337c --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_paths.c | |||
@@ -0,0 +1,557 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_paths.c | ||
24 | * @brief Information we track per path. | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | * | ||
28 | * TODO: | ||
29 | * - path desirability score calculations are not done | ||
30 | * (and will be tricky to have during path changes) | ||
31 | */ | ||
32 | #include "platform.h" | ||
33 | #include "gnunet-service-cadet-new_peer.h" | ||
34 | #include "gnunet-service-cadet-new_paths.h" | ||
35 | |||
36 | |||
37 | /** | ||
38 | * Information regarding a possible path to reach a peer. | ||
39 | */ | ||
40 | struct CadetPeerPath | ||
41 | { | ||
42 | |||
43 | /** | ||
44 | * Array of all the peers on the path. If @e hn is non-NULL, the | ||
45 | * last one is our owner. | ||
46 | */ | ||
47 | struct CadetPeerPathEntry *entries; | ||
48 | |||
49 | /** | ||
50 | * Node of this path in the owner's heap. Used to update our position | ||
51 | * in the heap whenever our @e desirability changes. | ||
52 | */ | ||
53 | struct GNUNET_CONTAINER_HeapNode *hn; | ||
54 | |||
55 | /** | ||
56 | * Connections using this path, by destination peer | ||
57 | * (each hop of the path could correspond to an | ||
58 | * active connection). | ||
59 | */ | ||
60 | struct GNUNET_CONTAINER_MultiPeerMap *connections; | ||
61 | |||
62 | /** | ||
63 | * Desirability of the path. How unique is it for the various peers | ||
64 | * on it? | ||
65 | */ | ||
66 | GNUNET_CONTAINER_HeapCostType desirability; | ||
67 | |||
68 | /** | ||
69 | * Length of the @e entries array. | ||
70 | */ | ||
71 | unsigned int entries_length; | ||
72 | |||
73 | }; | ||
74 | |||
75 | |||
76 | /** | ||
77 | * Return how much we like keeping the path. This is an aggregate | ||
78 | * score based on various factors, including the age of the path | ||
79 | * (older == better), and the value of this path to all of its ajacent | ||
80 | * peers. For example, long paths that end at a peer that we have no | ||
81 | * shorter way to reach are very desirable, while long paths that end | ||
82 | * at a peer for which we have a shorter way as well are much less | ||
83 | * desirable. Higher values indicate more valuable paths. The | ||
84 | * returned value should be used to decide which paths to remember. | ||
85 | * | ||
86 | * @param path path to return the length for | ||
87 | * @return desirability of the path, larger is more desirable | ||
88 | */ | ||
89 | GNUNET_CONTAINER_HeapCostType | ||
90 | GCPP_get_desirability (const struct CadetPeerPath *path) | ||
91 | { | ||
92 | return path->desirability; | ||
93 | } | ||
94 | |||
95 | |||
96 | /** | ||
97 | * Return connection to @a destination using @a path, or return | ||
98 | * NULL if no such connection exists. | ||
99 | * | ||
100 | * @param path path to traverse | ||
101 | * @param destination destination node to get to, must be on path | ||
102 | * @param off offset of @a destination on @a path | ||
103 | * @return NULL if we have no existing connection | ||
104 | * otherwise connection from us to @a destination via @a path | ||
105 | */ | ||
106 | struct CadetConnection * | ||
107 | GCPP_get_connection (struct CadetPeerPath *path, | ||
108 | struct CadetPeer *destination, | ||
109 | unsigned int off) | ||
110 | { | ||
111 | struct CadetPeerPathEntry *entry; | ||
112 | |||
113 | GNUNET_assert (off < path->entries_length); | ||
114 | entry = &path->entries[off]; | ||
115 | GNUNET_assert (entry->peer == destination); | ||
116 | return entry->cc; | ||
117 | } | ||
118 | |||
119 | |||
120 | /** | ||
121 | * Notify @a path that it is used for connection @a cc | ||
122 | * which ends at the path's offset @a off. | ||
123 | * | ||
124 | * @param path the path to remember the @a cc | ||
125 | * @param off the offset where the @a cc ends | ||
126 | * @param cc the connection to remember | ||
127 | */ | ||
128 | void | ||
129 | GCPP_add_connection (struct CadetPeerPath *path, | ||
130 | unsigned int off, | ||
131 | struct CadetConnection *cc) | ||
132 | { | ||
133 | struct CadetPeerPathEntry *entry; | ||
134 | |||
135 | GNUNET_assert (off < path->entries_length); | ||
136 | entry = &path->entries[off]; | ||
137 | GNUNET_assert (NULL == entry->cc); | ||
138 | entry->cc = cc; | ||
139 | } | ||
140 | |||
141 | |||
142 | |||
143 | /** | ||
144 | * Notify @a path that it is no longer used for connection @a cc which | ||
145 | * ended at the path's offset @a off. | ||
146 | * | ||
147 | * @param path the path to forget the @a cc | ||
148 | * @param off the offset where the @a cc ended | ||
149 | * @param cc the connection to forget | ||
150 | */ | ||
151 | void | ||
152 | GCPP_del_connection (struct CadetPeerPath *path, | ||
153 | unsigned int off, | ||
154 | struct CadetConnection *cc) | ||
155 | { | ||
156 | struct CadetPeerPathEntry *entry; | ||
157 | |||
158 | GNUNET_assert (off < path->entries_length); | ||
159 | entry = &path->entries[off]; | ||
160 | GNUNET_assert (cc == entry->cc); | ||
161 | entry->cc = NULL; | ||
162 | } | ||
163 | |||
164 | |||
165 | /** | ||
166 | * This path is no longer needed, free resources. | ||
167 | * | ||
168 | * @param path path resources to free | ||
169 | */ | ||
170 | static void | ||
171 | path_destroy (struct CadetPeerPath *path) | ||
172 | { | ||
173 | GNUNET_assert (0 == | ||
174 | GNUNET_CONTAINER_multipeermap_size (path->connections)); | ||
175 | GNUNET_CONTAINER_multipeermap_destroy (path->connections); | ||
176 | GNUNET_free (path->entries); | ||
177 | GNUNET_free (path); | ||
178 | } | ||
179 | |||
180 | |||
181 | /** | ||
182 | * The owning peer of this path is no longer interested in maintaining | ||
183 | * it, so the path should be discarded or shortened (in case a | ||
184 | * previous peer on the path finds the path desirable). | ||
185 | * | ||
186 | * @param path the path that is being released | ||
187 | */ | ||
188 | void | ||
189 | GCPP_release (struct CadetPeerPath *path) | ||
190 | { | ||
191 | struct CadetPeerPathEntry *entry; | ||
192 | |||
193 | path->hn = NULL; | ||
194 | entry = &path->entries[path->entries_length - 1]; | ||
195 | while (1) | ||
196 | { | ||
197 | /* cut 'off' end of path, verifying it is not in use */ | ||
198 | GNUNET_assert (NULL == | ||
199 | GNUNET_CONTAINER_multipeermap_get (path->connections, | ||
200 | GCP_get_id (entry->peer))); | ||
201 | GCP_path_entry_remove (entry->peer, | ||
202 | entry, | ||
203 | path->entries_length - 1); | ||
204 | path->entries_length--; /* We don't bother shrinking the 'entries' array, | ||
205 | as it's probably not worth it. */ | ||
206 | if (0 == path->entries_length) | ||
207 | break; /* the end */ | ||
208 | |||
209 | /* see if new peer at the end likes this path any better */ | ||
210 | entry = &path->entries[path->entries_length - 1]; | ||
211 | path->hn = GCP_attach_path (entry->peer, | ||
212 | path, | ||
213 | path->entries_length); | ||
214 | if (NULL != path->hn) | ||
215 | return; /* yep, got attached, we are done. */ | ||
216 | } | ||
217 | |||
218 | /* nobody wants us, discard the path */ | ||
219 | path_destroy (path); | ||
220 | } | ||
221 | |||
222 | |||
223 | /** | ||
224 | * Updates the score for an entry on the path based | ||
225 | * on our experiences with using @a path. | ||
226 | * | ||
227 | * @param path the path to update | ||
228 | * @param off offset of the entry to update | ||
229 | * @param delta change in the score to apply | ||
230 | */ | ||
231 | void | ||
232 | GCPP_update_score (struct CadetPeerPath *path, | ||
233 | unsigned int off, | ||
234 | int delta) | ||
235 | { | ||
236 | struct CadetPeerPathEntry *entry; | ||
237 | |||
238 | GNUNET_assert (off < path->entries_length); | ||
239 | entry = &path->entries[off]; | ||
240 | |||
241 | /* Add delta, with checks for overflows */ | ||
242 | if (delta >= 0) | ||
243 | { | ||
244 | if (delta + entry->score < entry->score) | ||
245 | entry->score = INT_MAX; | ||
246 | else | ||
247 | entry->score += delta; | ||
248 | } | ||
249 | else | ||
250 | { | ||
251 | if (delta + entry->score > entry->score) | ||
252 | entry->score = INT_MIN; | ||
253 | else | ||
254 | entry->score += delta; | ||
255 | } | ||
256 | |||
257 | /* FIXME: update path desirability! */ | ||
258 | } | ||
259 | |||
260 | |||
261 | /** | ||
262 | * Closure for #find_peer_at() and #check_match(). | ||
263 | */ | ||
264 | struct CheckMatchContext | ||
265 | { | ||
266 | |||
267 | /** | ||
268 | * Set to a matching path, if any. | ||
269 | */ | ||
270 | struct CadetPeerPath *match; | ||
271 | |||
272 | /** | ||
273 | * Array the combined paths. | ||
274 | */ | ||
275 | struct CadetPeer **cpath; | ||
276 | |||
277 | }; | ||
278 | |||
279 | |||
280 | /** | ||
281 | * Check if the given path is identical on all of the | ||
282 | * hops until @a off, and not longer than @a off. If the | ||
283 | * @a path matches, store it in `match`. | ||
284 | * | ||
285 | * @param cls the `struct CheckMatchContext` to check against | ||
286 | * @param path the path to check | ||
287 | * @param off offset to check at | ||
288 | * @return #GNUNET_YES (continue to iterate), or if found #GNUNET_NO | ||
289 | */ | ||
290 | static int | ||
291 | check_match (void *cls, | ||
292 | struct CadetPeerPath *path, | ||
293 | unsigned int off) | ||
294 | { | ||
295 | struct CheckMatchContext *cm_ctx = cls; | ||
296 | |||
297 | if (path->entries_length > off) | ||
298 | return GNUNET_YES; /* too long, cannot be useful */ | ||
299 | for (unsigned int i=0;i<off;i++) | ||
300 | if (cm_ctx->cpath[i] != | ||
301 | GCPP_get_peer_at_offset (path, | ||
302 | i)) | ||
303 | return GNUNET_YES; /* missmatch, ignore */ | ||
304 | cm_ctx->match = path; | ||
305 | return GNUNET_NO; /* match, we are done! */ | ||
306 | } | ||
307 | |||
308 | |||
309 | /** | ||
310 | * Extend path @a path by the @a num_peers from the @a peers | ||
311 | * array, assuming the owners past the current owner want it. | ||
312 | * | ||
313 | * @param path path to extend | ||
314 | * @param peers list of peers beyond the end of @a path | ||
315 | * @param num_peers length of the @a peers array | ||
316 | */ | ||
317 | static void | ||
318 | extend_path (struct CadetPeerPath *path, | ||
319 | struct CadetPeer **peers, | ||
320 | unsigned int num_peers) | ||
321 | { | ||
322 | unsigned int old_len = path->entries_length; | ||
323 | struct GNUNET_CONTAINER_HeapNode *hn; | ||
324 | int i; | ||
325 | |||
326 | /* If we extend an existing path, detach it from the | ||
327 | old owner and re-attach to the new one */ | ||
328 | hn = NULL; | ||
329 | for (i=num_peers-1;i>=0;i--) | ||
330 | { | ||
331 | /* FIXME: note that path->desirability is used, but not yet updated here! */ | ||
332 | hn = GCP_attach_path (peers[i], | ||
333 | path, | ||
334 | old_len + (unsigned int) i); | ||
335 | if (NULL != hn) | ||
336 | break; | ||
337 | } | ||
338 | if (NULL == hn) | ||
339 | return; /* none of the peers is interested in this path */ | ||
340 | GCP_detach_path (path->entries[old_len-1].peer, | ||
341 | path, | ||
342 | path->hn); | ||
343 | path->hn = hn; | ||
344 | GNUNET_array_grow (path->entries, | ||
345 | path->entries_length, | ||
346 | old_len + i); | ||
347 | for (;i >= 0;i--) | ||
348 | { | ||
349 | struct CadetPeerPathEntry *entry = &path->entries[old_len + i]; | ||
350 | |||
351 | entry->peer = peers[i]; | ||
352 | entry->path = path; | ||
353 | GCP_path_entry_add (entry->peer, | ||
354 | entry, | ||
355 | old_len + i); | ||
356 | } | ||
357 | } | ||
358 | |||
359 | |||
360 | /** | ||
361 | * Create a peer path based on the result of a DHT lookup. If we | ||
362 | * already know this path, or one that is longer, simply return NULL. | ||
363 | * Otherwise, we try to extend an existing path, or create a new one | ||
364 | * if applicable. | ||
365 | * | ||
366 | * @param get_path path of the get request | ||
367 | * @param get_path_length lenght of @a get_path | ||
368 | * @param put_path path of the put request | ||
369 | * @param put_path_length length of the @a put_path | ||
370 | * @return a path through the network | ||
371 | */ | ||
372 | void | ||
373 | GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path, | ||
374 | unsigned int get_path_length, | ||
375 | const struct GNUNET_PeerIdentity *put_path, | ||
376 | unsigned int put_path_length) | ||
377 | { | ||
378 | struct CheckMatchContext cm_ctx; | ||
379 | struct CadetPeer *cpath[get_path_length + put_path_length]; | ||
380 | struct CadetPeerPath *path; | ||
381 | struct GNUNET_CONTAINER_HeapNode *hn; | ||
382 | int i; | ||
383 | |||
384 | /* precompute 'cpath' so we can avoid doing the lookups lots of times */ | ||
385 | for (unsigned int off=0;off<get_path_length + put_path_length;off++) | ||
386 | { | ||
387 | const struct GNUNET_PeerIdentity *pid; | ||
388 | |||
389 | pid = (off < get_path_length) | ||
390 | ? &get_path[get_path_length - off] | ||
391 | : &put_path[get_path_length + put_path_length - off]; | ||
392 | cpath[off] = GCP_get (pid, | ||
393 | GNUNET_YES); | ||
394 | } | ||
395 | |||
396 | /* First figure out if this path is a subset of an existing path, an | ||
397 | extension of an existing path, or a new path. */ | ||
398 | cm_ctx.cpath = cpath; | ||
399 | cm_ctx.match = NULL; | ||
400 | for (i=get_path_length + put_path_length-1;i>=0;i--) | ||
401 | { | ||
402 | GCP_iterate_paths_at (cpath[i], | ||
403 | (unsigned int) i, | ||
404 | &check_match, | ||
405 | &cm_ctx); | ||
406 | if (NULL != cm_ctx.match) | ||
407 | { | ||
408 | if (i == get_path_length + put_path_length - 1) | ||
409 | { | ||
410 | /* Existing path includes this one, nothing to do! */ | ||
411 | return; | ||
412 | } | ||
413 | if (cm_ctx.match->entries_length == i + 1) | ||
414 | { | ||
415 | /* Existing path ends in the middle of new path, extend it! */ | ||
416 | extend_path (cm_ctx.match, | ||
417 | &cpath[i], | ||
418 | get_path_length + put_path_length - i); | ||
419 | return; | ||
420 | } | ||
421 | } | ||
422 | } | ||
423 | |||
424 | /* No match at all, create completely new path */ | ||
425 | path = GNUNET_new (struct CadetPeerPath); | ||
426 | |||
427 | /* First, try to attach it */ | ||
428 | hn = NULL; | ||
429 | for (i=get_path_length + put_path_length-1;i>=0;i--) | ||
430 | { | ||
431 | path->entries_length = i; | ||
432 | /* FIXME: note that path->desirability is used, but not yet initialized here! */ | ||
433 | hn = GCP_attach_path (cpath[i], | ||
434 | path, | ||
435 | (unsigned int) i); | ||
436 | if (NULL != hn) | ||
437 | break; | ||
438 | } | ||
439 | if (NULL == hn) | ||
440 | { | ||
441 | /* None of the peers on the path care about it. */ | ||
442 | GNUNET_free (path); | ||
443 | return; | ||
444 | } | ||
445 | path->hn = hn; | ||
446 | path->entries_length = i; | ||
447 | path->entries = GNUNET_new_array (path->entries_length, | ||
448 | struct CadetPeerPathEntry); | ||
449 | for (;i>=0;i--) | ||
450 | { | ||
451 | struct CadetPeerPathEntry *entry = &path->entries[i]; | ||
452 | |||
453 | entry->peer = cpath[i]; | ||
454 | entry->path = path; | ||
455 | GCP_path_entry_add (entry->peer, | ||
456 | entry, | ||
457 | i); | ||
458 | } | ||
459 | } | ||
460 | |||
461 | |||
462 | /** | ||
463 | * We got an incoming connection, obtain the corresponding path. | ||
464 | * | ||
465 | * @param path_length number of segments on the @a path | ||
466 | * @param path through the network, in reverse order (we are at the end!) | ||
467 | * @return corresponding path object | ||
468 | */ | ||
469 | struct CadetPeerPath * | ||
470 | GCPP_get_path_from_route (unsigned int path_length, | ||
471 | const struct GNUNET_PeerIdentity *pids) | ||
472 | { | ||
473 | GNUNET_assert (0); // FIXME! | ||
474 | return NULL; | ||
475 | } | ||
476 | |||
477 | |||
478 | /** | ||
479 | * Return the length of the path. Excludes one end of the | ||
480 | * path, so the loopback path has length 0. | ||
481 | * | ||
482 | * @param path path to return the length for | ||
483 | * @return number of peers on the path | ||
484 | */ | ||
485 | unsigned int | ||
486 | GCPP_get_length (struct CadetPeerPath *path) | ||
487 | { | ||
488 | return path->entries_length; | ||
489 | } | ||
490 | |||
491 | |||
492 | /** | ||
493 | * Find peer's offset on path. | ||
494 | * | ||
495 | * @param path path to search | ||
496 | * @param cp peer to look for | ||
497 | * @return offset of @a cp on @a path, or UINT_MAX if not found | ||
498 | */ | ||
499 | unsigned int | ||
500 | GCPP_find_peer (struct CadetPeerPath *path, | ||
501 | struct CadetPeer *cp) | ||
502 | { | ||
503 | for (unsigned int off = 0; | ||
504 | off < path->entries_length; | ||
505 | off++) | ||
506 | if (cp == GCPP_get_peer_at_offset (path, | ||
507 | off)) | ||
508 | return off; | ||
509 | return UINT_MAX; | ||
510 | } | ||
511 | |||
512 | |||
513 | /** | ||
514 | * Obtain the peer at offset @a off in @a path. | ||
515 | * | ||
516 | * @param path peer path to inspect | ||
517 | * @param off offset to return, must be smaller than path length | ||
518 | * @return the peer at offset @a off | ||
519 | */ | ||
520 | struct CadetPeer * | ||
521 | GCPP_get_peer_at_offset (struct CadetPeerPath *path, | ||
522 | unsigned int off) | ||
523 | { | ||
524 | return path->entries[off].peer; | ||
525 | } | ||
526 | |||
527 | |||
528 | /** | ||
529 | * Convert a path to a human-readable string. | ||
530 | * | ||
531 | * @param path path to convert | ||
532 | * @return string, to be freed by caller (unlike other *_2s APIs!) | ||
533 | */ | ||
534 | char * | ||
535 | GCPP_2s (struct CadetPeerPath *path) | ||
536 | { | ||
537 | char *s; | ||
538 | char *old; | ||
539 | |||
540 | old = GNUNET_strdup (""); | ||
541 | for (unsigned int i = 0; | ||
542 | i < path->entries_length; | ||
543 | i++) | ||
544 | { | ||
545 | GNUNET_asprintf (&s, | ||
546 | "%s %s", | ||
547 | old, | ||
548 | GCP_2s (GCPP_get_peer_at_offset (path, | ||
549 | i))); | ||
550 | GNUNET_free_non_null (old); | ||
551 | old = s; | ||
552 | } | ||
553 | return old; | ||
554 | } | ||
555 | |||
556 | |||
557 | /* end of gnunet-service-cadet-new_paths.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_paths.h b/src/cadet/gnunet-service-cadet-new_paths.h new file mode 100644 index 000000000..5714368c7 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_paths.h | |||
@@ -0,0 +1,182 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_paths.h | ||
24 | * @brief Information we track per path. | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | */ | ||
28 | #ifndef GNUNET_SERVICE_CADET_PATHS_H | ||
29 | #define GNUNET_SERVICE_CADET_PATHS_H | ||
30 | |||
31 | #include "gnunet_util_lib.h" | ||
32 | #include "gnunet-service-cadet-new.h" | ||
33 | |||
34 | /** | ||
35 | * Create a peer path based on the result of a DHT lookup. If we | ||
36 | * already know this path, or one that is longer, simply return NULL. | ||
37 | * Otherwise, we try to extend an existing path, or create a new one | ||
38 | * if applicable. | ||
39 | * | ||
40 | * @param get_path path of the get request | ||
41 | * @param get_path_length lenght of @a get_path | ||
42 | * @param put_path path of the put request | ||
43 | * @param put_path_length length of the @a put_path | ||
44 | */ | ||
45 | void | ||
46 | GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path, | ||
47 | unsigned int get_path_length, | ||
48 | const struct GNUNET_PeerIdentity *put_path, | ||
49 | unsigned int put_path_length); | ||
50 | |||
51 | |||
52 | /** | ||
53 | * We got an incoming connection, obtain the corresponding path. | ||
54 | * | ||
55 | * @param path_length number of segments on the @a path | ||
56 | * @param path through the network, in reverse order (we are at the end!) | ||
57 | * @return corresponding path object | ||
58 | */ | ||
59 | struct CadetPeerPath * | ||
60 | GCPP_get_path_from_route (unsigned int path_length, | ||
61 | const struct GNUNET_PeerIdentity *pids); | ||
62 | |||
63 | |||
64 | /** | ||
65 | * Return the length of the path. Excludes one end of the | ||
66 | * path, so the loopback path has length 0. | ||
67 | * | ||
68 | * @param path path to return the length for | ||
69 | * @return number of peers on the path | ||
70 | */ | ||
71 | unsigned int | ||
72 | GCPP_get_length (struct CadetPeerPath *path); | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Return connection to @a destination using @a path, or return | ||
77 | * NULL if no such connection exists. | ||
78 | * | ||
79 | * @param path path to traverse | ||
80 | * @param destination destination node to get to, must be on path | ||
81 | * @param off offset of @a destination on @a path | ||
82 | * @return NULL if we have no existing connection | ||
83 | * otherwise connection from us to @a destination via @a path | ||
84 | */ | ||
85 | struct CadetConnection * | ||
86 | GCPP_get_connection (struct CadetPeerPath *path, | ||
87 | struct CadetPeer *destination, | ||
88 | unsigned int off); | ||
89 | |||
90 | |||
91 | /** | ||
92 | * Notify @a path that it is used for connection @a cc | ||
93 | * which ends at the path's offset @a off. | ||
94 | * | ||
95 | * @param path the path to remember the @a cc | ||
96 | * @param off the offset where the @a cc ends | ||
97 | * @param cc the connection to remember | ||
98 | */ | ||
99 | void | ||
100 | GCPP_add_connection (struct CadetPeerPath *path, | ||
101 | unsigned int off, | ||
102 | struct CadetConnection *cc); | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Notify @a path that it is no longer used for connection @a cc which | ||
107 | * ended at the path's offset @a off. | ||
108 | * | ||
109 | * @param path the path to forget the @a cc | ||
110 | * @param off the offset where the @a cc ended | ||
111 | * @param cc the connection to forget | ||
112 | */ | ||
113 | void | ||
114 | GCPP_del_connection (struct CadetPeerPath *path, | ||
115 | unsigned int off, | ||
116 | struct CadetConnection *cc); | ||
117 | |||
118 | |||
119 | /** | ||
120 | * Find peer's offset on path. | ||
121 | * | ||
122 | * @param path path to search | ||
123 | * @param cp peer to look for | ||
124 | * @return offset of @a cp on @a path, or UINT_MAX if not found | ||
125 | */ | ||
126 | unsigned int | ||
127 | GCPP_find_peer (struct CadetPeerPath *path, | ||
128 | struct CadetPeer *cp); | ||
129 | |||
130 | |||
131 | /** | ||
132 | * Return how much we like keeping the path. This is an aggregate | ||
133 | * score based on various factors, including the age of the path | ||
134 | * (older == better), and the value of this path to all of its ajacent | ||
135 | * peers. For example, long paths that end at a peer that we have no | ||
136 | * shorter way to reach are very desirable, while long paths that end | ||
137 | * at a peer for which we have a shorter way as well are much less | ||
138 | * desirable. Higher values indicate more valuable paths. The | ||
139 | * returned value should be used to decide which paths to remember. | ||
140 | * | ||
141 | * @param path path to return the length for | ||
142 | * @return desirability of the path, larger is more desirable | ||
143 | */ | ||
144 | GNUNET_CONTAINER_HeapCostType | ||
145 | GCPP_get_desirability (const struct CadetPeerPath *path); | ||
146 | |||
147 | |||
148 | /** | ||
149 | * The given peer @a cp used to own this @a path. However, it is no | ||
150 | * longer interested in maintaining it, so the path should be | ||
151 | * discarded or shortened (in case a previous peer on the path finds | ||
152 | * the path desirable). | ||
153 | * | ||
154 | * @param path the path that is being released | ||
155 | */ | ||
156 | void | ||
157 | GCPP_release (struct CadetPeerPath *path); | ||
158 | |||
159 | |||
160 | /** | ||
161 | * Obtain the peer at offset @a off in @a path. | ||
162 | * | ||
163 | * @param path peer path to inspect | ||
164 | * @param off offset to return, must be smaller than path length | ||
165 | * @return peer at offset @a off | ||
166 | */ | ||
167 | struct CadetPeer * | ||
168 | GCPP_get_peer_at_offset (struct CadetPeerPath *path, | ||
169 | unsigned int off); | ||
170 | |||
171 | |||
172 | /** | ||
173 | * Convert a path to a human-readable string. | ||
174 | * | ||
175 | * @param path path to convert | ||
176 | * @return string, to be freed by caller (unlike other *_2s APIs!) | ||
177 | */ | ||
178 | char * | ||
179 | GCPP_2s (struct CadetPeerPath *p); | ||
180 | |||
181 | |||
182 | #endif | ||
diff --git a/src/cadet/gnunet-service-cadet-new_peer.c b/src/cadet/gnunet-service-cadet-new_peer.c new file mode 100644 index 000000000..47f725e09 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_peer.c | |||
@@ -0,0 +1,1056 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_peer.c | ||
24 | * @brief Information we track per peer. | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | * | ||
28 | * TODO: | ||
29 | * - implement GCP_set_hello() / do HELLO advertising properly | ||
30 | * - optimize stopping/restarting DHT search to situations | ||
31 | * where we actually need it (i.e. not if we have a direct connection, | ||
32 | * or if we already have plenty of good short ones, or maybe even | ||
33 | * to take a break if we have some connections and have searched a lot (?)) | ||
34 | * - optimize MQM ready scans (O(n) -> O(1)) | ||
35 | */ | ||
36 | #include "platform.h" | ||
37 | #include "gnunet_util_lib.h" | ||
38 | #include "gnunet_signatures.h" | ||
39 | #include "gnunet_transport_service.h" | ||
40 | #include "gnunet_ats_service.h" | ||
41 | #include "gnunet_core_service.h" | ||
42 | #include "gnunet_statistics_service.h" | ||
43 | #include "cadet_protocol.h" | ||
44 | #include "cadet_path.h" | ||
45 | #include "gnunet-service-cadet-new.h" | ||
46 | #include "gnunet-service-cadet-new_connection.h" | ||
47 | #include "gnunet-service-cadet-new_dht.h" | ||
48 | #include "gnunet-service-cadet-new_peer.h" | ||
49 | #include "gnunet-service-cadet-new_paths.h" | ||
50 | #include "gnunet-service-cadet-new_tunnels.h" | ||
51 | |||
52 | /** | ||
53 | * How long do we wait until tearing down an idle peer? | ||
54 | */ | ||
55 | #define IDLE_PEER_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5) | ||
56 | |||
57 | /** | ||
58 | * How long do we keep paths around if we no longer care about the peer? | ||
59 | */ | ||
60 | #define IDLE_PATH_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 2) | ||
61 | |||
62 | |||
63 | |||
64 | |||
65 | /** | ||
66 | * Data structure used to track whom we have to notify about changes | ||
67 | * to our message queue. | ||
68 | */ | ||
69 | struct GCP_MessageQueueManager | ||
70 | { | ||
71 | |||
72 | /** | ||
73 | * Kept in a DLL. | ||
74 | */ | ||
75 | struct GCP_MessageQueueManager *next; | ||
76 | |||
77 | /** | ||
78 | * Kept in a DLL. | ||
79 | */ | ||
80 | struct GCP_MessageQueueManager *prev; | ||
81 | |||
82 | /** | ||
83 | * Function to call with updated message queue object. | ||
84 | */ | ||
85 | GCP_MessageQueueNotificationCallback cb; | ||
86 | |||
87 | /** | ||
88 | * Closure for @e cb. | ||
89 | */ | ||
90 | void *cb_cls; | ||
91 | |||
92 | /** | ||
93 | * The peer this is for. | ||
94 | */ | ||
95 | struct CadetPeer *cp; | ||
96 | |||
97 | /** | ||
98 | * Envelope this manager would like to transmit once it is its turn. | ||
99 | */ | ||
100 | struct GNUNET_MQ_Envelope *env; | ||
101 | |||
102 | }; | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Struct containing all information regarding a given peer | ||
107 | */ | ||
108 | struct CadetPeer | ||
109 | { | ||
110 | /** | ||
111 | * ID of the peer | ||
112 | */ | ||
113 | struct GNUNET_PeerIdentity pid; | ||
114 | |||
115 | /** | ||
116 | * Last time we heard from this peer | ||
117 | */ | ||
118 | struct GNUNET_TIME_Absolute last_contact; | ||
119 | |||
120 | /** | ||
121 | * Array of DLLs of paths traversing the peer, organized by the | ||
122 | * offset of the peer on the larger path. | ||
123 | */ | ||
124 | struct CadetPeerPathEntry **path_heads; | ||
125 | |||
126 | /** | ||
127 | * Array of DLL of paths traversing the peer, organized by the | ||
128 | * offset of the peer on the larger path. | ||
129 | */ | ||
130 | struct CadetPeerPathEntry **path_tails; | ||
131 | |||
132 | /** | ||
133 | * Notifications to call when @e core_mq changes. | ||
134 | */ | ||
135 | struct GCP_MessageQueueManager *mqm_head; | ||
136 | |||
137 | /** | ||
138 | * Notifications to call when @e core_mq changes. | ||
139 | */ | ||
140 | struct GCP_MessageQueueManager *mqm_tail; | ||
141 | |||
142 | /** | ||
143 | * MIN-heap of paths owned by this peer (they also end at this | ||
144 | * peer). Ordered by desirability. | ||
145 | */ | ||
146 | struct GNUNET_CONTAINER_Heap *path_heap; | ||
147 | |||
148 | /** | ||
149 | * Handle to stop the DHT search for paths to this peer | ||
150 | */ | ||
151 | struct GCD_search_handle *search_h; | ||
152 | |||
153 | /** | ||
154 | * Task to stop the DHT search for paths to this peer | ||
155 | */ | ||
156 | struct GNUNET_SCHEDULER_Task *search_delayedXXX; | ||
157 | |||
158 | /** | ||
159 | * Task to destroy this entry. | ||
160 | */ | ||
161 | struct GNUNET_SCHEDULER_Task *destroy_task; | ||
162 | |||
163 | /** | ||
164 | * Tunnel to this peer, if any. | ||
165 | */ | ||
166 | struct CadetTunnel *t; | ||
167 | |||
168 | /** | ||
169 | * Connections that go through this peer; indexed by tid. | ||
170 | */ | ||
171 | struct GNUNET_CONTAINER_MultiShortmap *connections; | ||
172 | |||
173 | /** | ||
174 | * Handle for core transmissions. | ||
175 | */ | ||
176 | struct GNUNET_MQ_Handle *core_mq; | ||
177 | |||
178 | /** | ||
179 | * Hello message of the peer. | ||
180 | */ | ||
181 | struct GNUNET_HELLO_Message *hello; | ||
182 | |||
183 | /** | ||
184 | * Handle to us offering the HELLO to the transport. | ||
185 | */ | ||
186 | struct GNUNET_TRANSPORT_OfferHelloHandle *hello_offer; | ||
187 | |||
188 | /** | ||
189 | * Handle to our ATS request asking ATS to suggest an address | ||
190 | * to TRANSPORT for this peer (to establish a direct link). | ||
191 | */ | ||
192 | struct GNUNET_ATS_ConnectivitySuggestHandle *connectivity_suggestion; | ||
193 | |||
194 | /** | ||
195 | * How many messages are in the queue to this peer. | ||
196 | */ | ||
197 | unsigned int queue_n; | ||
198 | |||
199 | /** | ||
200 | * How many paths do we have to this peer (in all @e path_heads DLLs combined). | ||
201 | */ | ||
202 | unsigned int num_paths; | ||
203 | |||
204 | /** | ||
205 | * Number of message queue managers of this peer that have a message in waiting. | ||
206 | * | ||
207 | * Used to quickly see if we need to bother scanning the @e msm_head DLL. | ||
208 | * TODO: could be replaced by another DLL that would then allow us to avoid | ||
209 | * the O(n)-scan of the DLL for ready entries! | ||
210 | */ | ||
211 | unsigned int mqm_ready_counter; | ||
212 | |||
213 | /** | ||
214 | * Current length of the @e path_heads and @path_tails arrays. | ||
215 | * The arrays should be grown as needed. | ||
216 | */ | ||
217 | unsigned int path_dll_length; | ||
218 | |||
219 | }; | ||
220 | |||
221 | |||
222 | /** | ||
223 | * Get the static string for a peer ID. | ||
224 | * | ||
225 | * @param peer Peer. | ||
226 | * | ||
227 | * @return Static string for it's ID. | ||
228 | */ | ||
229 | const char * | ||
230 | GCP_2s (const struct CadetPeer *peer) | ||
231 | { | ||
232 | if (NULL == peer) | ||
233 | return "PEER(NULL)"; | ||
234 | return GNUNET_i2s (&peer->pid); | ||
235 | } | ||
236 | |||
237 | |||
238 | /** | ||
239 | * This peer is no longer be needed, clean it up now. | ||
240 | * | ||
241 | * @param cls peer to clean up | ||
242 | */ | ||
243 | static void | ||
244 | destroy_peer (void *cls) | ||
245 | { | ||
246 | struct CadetPeer *cp = cls; | ||
247 | |||
248 | cp->destroy_task = NULL; | ||
249 | GNUNET_assert (NULL == cp->t); | ||
250 | GNUNET_assert (NULL == cp->core_mq); | ||
251 | GNUNET_assert (0 == cp->path_dll_length); | ||
252 | GNUNET_assert (0 == GNUNET_CONTAINER_multishortmap_size (cp->connections)); | ||
253 | GNUNET_assert (GNUNET_YES == | ||
254 | GNUNET_CONTAINER_multipeermap_remove (peers, | ||
255 | &cp->pid, | ||
256 | cp)); | ||
257 | GNUNET_free_non_null (cp->path_heads); | ||
258 | GNUNET_free_non_null (cp->path_tails); | ||
259 | cp->path_dll_length = 0; | ||
260 | if (NULL != cp->search_h) | ||
261 | { | ||
262 | GCD_search_stop (cp->search_h); | ||
263 | cp->search_h = NULL; | ||
264 | } | ||
265 | /* FIXME: clean up search_delayedXXX! */ | ||
266 | |||
267 | if (NULL != cp->hello_offer) | ||
268 | { | ||
269 | GNUNET_TRANSPORT_offer_hello_cancel (cp->hello_offer); | ||
270 | cp->hello_offer = NULL; | ||
271 | } | ||
272 | if (NULL != cp->connectivity_suggestion) | ||
273 | { | ||
274 | GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion); | ||
275 | cp->connectivity_suggestion = NULL; | ||
276 | } | ||
277 | GNUNET_CONTAINER_multishortmap_destroy (cp->connections); | ||
278 | GNUNET_CONTAINER_heap_destroy (cp->path_heap); | ||
279 | GNUNET_free_non_null (cp->hello); | ||
280 | /* Peer should not be freed if paths exist; if there are no paths, | ||
281 | there ought to be no connections, and without connections, no | ||
282 | notifications. Thus we can assert that mqm_head is empty at this | ||
283 | point. */ | ||
284 | GNUNET_assert (NULL == cp->mqm_head); | ||
285 | GNUNET_free (cp); | ||
286 | } | ||
287 | |||
288 | |||
289 | /** | ||
290 | * Set the message queue to @a mq for peer @a cp and notify watchers. | ||
291 | * | ||
292 | * @param cp peer to modify | ||
293 | * @param mq message queue to set (can be NULL) | ||
294 | */ | ||
295 | void | ||
296 | GCP_set_mq (struct CadetPeer *cp, | ||
297 | struct GNUNET_MQ_Handle *mq) | ||
298 | { | ||
299 | cp->core_mq = mq; | ||
300 | |||
301 | for (struct GCP_MessageQueueManager *mqm = cp->mqm_head; | ||
302 | NULL != mqm; | ||
303 | mqm = mqm->next) | ||
304 | { | ||
305 | if (NULL == mq) | ||
306 | { | ||
307 | if (NULL != mqm->env) | ||
308 | { | ||
309 | GNUNET_MQ_discard (mqm->env); | ||
310 | mqm->env = NULL; | ||
311 | mqm->cb (mqm->cb_cls, | ||
312 | GNUNET_SYSERR); | ||
313 | } | ||
314 | else | ||
315 | { | ||
316 | mqm->cb (mqm->cb_cls, | ||
317 | GNUNET_NO); | ||
318 | } | ||
319 | } | ||
320 | else | ||
321 | { | ||
322 | GNUNET_assert (NULL == mqm->env); | ||
323 | mqm->cb (mqm->cb_cls, | ||
324 | GNUNET_YES); | ||
325 | } | ||
326 | } | ||
327 | } | ||
328 | |||
329 | |||
330 | /** | ||
331 | * Transmit current envelope from this @a mqm. | ||
332 | * | ||
333 | * @param mqm mqm to transmit message for now | ||
334 | */ | ||
335 | static void | ||
336 | mqm_execute (struct GCP_MessageQueueManager *mqm) | ||
337 | { | ||
338 | struct CadetPeer *cp = mqm->cp; | ||
339 | |||
340 | /* Move entry to the end of the DLL, to be fair. */ | ||
341 | if (mqm != cp->mqm_tail) | ||
342 | { | ||
343 | GNUNET_CONTAINER_DLL_remove (cp->mqm_head, | ||
344 | cp->mqm_tail, | ||
345 | mqm); | ||
346 | GNUNET_CONTAINER_DLL_insert_tail (cp->mqm_head, | ||
347 | cp->mqm_tail, | ||
348 | mqm); | ||
349 | } | ||
350 | GNUNET_MQ_send (cp->core_mq, | ||
351 | mqm->env); | ||
352 | mqm->env = NULL; | ||
353 | cp->mqm_ready_counter--; | ||
354 | } | ||
355 | |||
356 | |||
357 | /** | ||
358 | * Function called when CORE took one of the messages from | ||
359 | * a message queue manager and transmitted it. | ||
360 | * | ||
361 | * @param cls the `struct CadetPeeer` where we made progress | ||
362 | */ | ||
363 | static void | ||
364 | mqm_send_done (void *cls) | ||
365 | { | ||
366 | struct CadetPeer *cp = cls; | ||
367 | |||
368 | if (0 == cp->mqm_ready_counter) | ||
369 | return; /* nothing to do */ | ||
370 | for (struct GCP_MessageQueueManager *mqm = cp->mqm_head; | ||
371 | NULL != mqm; | ||
372 | mqm = mqm->next) | ||
373 | { | ||
374 | if (NULL == mqm->env) | ||
375 | continue; | ||
376 | mqm_execute (mqm); | ||
377 | return; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | |||
382 | /** | ||
383 | * Send the message in @a env to @a cp. | ||
384 | * | ||
385 | * @param mqm the message queue manager to use for transmission | ||
386 | * @param env envelope with the message to send; must NOT | ||
387 | * yet have a #GNUNET_MQ_notify_sent() callback attached to it | ||
388 | */ | ||
389 | void | ||
390 | GCP_send (struct GCP_MessageQueueManager *mqm, | ||
391 | struct GNUNET_MQ_Envelope *env) | ||
392 | { | ||
393 | struct CadetPeer *cp = mqm->cp; | ||
394 | |||
395 | GNUNET_assert (NULL != cp->core_mq); | ||
396 | GNUNET_assert (NULL == mqm->env); | ||
397 | GNUNET_MQ_notify_sent (env, | ||
398 | &mqm_send_done, | ||
399 | cp); | ||
400 | mqm->env = env; | ||
401 | cp->mqm_ready_counter++; | ||
402 | if (0 != GNUNET_MQ_get_length (cp->core_mq)) | ||
403 | return; | ||
404 | mqm_execute (mqm); | ||
405 | } | ||
406 | |||
407 | |||
408 | /** | ||
409 | * Function called to destroy a peer now. | ||
410 | * | ||
411 | * @param cls NULL | ||
412 | * @param pid identity of the peer (unused) | ||
413 | * @param value the `struct CadetPeer` to clean up | ||
414 | * @return #GNUNET_OK (continue to iterate) | ||
415 | */ | ||
416 | static int | ||
417 | destroy_iterator_cb (void *cls, | ||
418 | const struct GNUNET_PeerIdentity *pid, | ||
419 | void *value) | ||
420 | { | ||
421 | struct CadetPeer *cp = value; | ||
422 | |||
423 | if (NULL != cp->destroy_task) | ||
424 | { | ||
425 | GNUNET_SCHEDULER_cancel (cp->destroy_task); | ||
426 | cp->destroy_task = NULL; | ||
427 | } | ||
428 | destroy_peer (cp); | ||
429 | return GNUNET_OK; | ||
430 | } | ||
431 | |||
432 | |||
433 | /** | ||
434 | * Clean up all entries about all peers. | ||
435 | * Must only be called after all tunnels, CORE-connections and | ||
436 | * connections are down. | ||
437 | */ | ||
438 | void | ||
439 | GCP_destroy_all_peers () | ||
440 | { | ||
441 | GNUNET_CONTAINER_multipeermap_iterate (peers, | ||
442 | &destroy_iterator_cb, | ||
443 | NULL); | ||
444 | } | ||
445 | |||
446 | |||
447 | /** | ||
448 | * This peer may no longer be needed, consider cleaning it up. | ||
449 | * | ||
450 | * @param cp peer to clean up | ||
451 | */ | ||
452 | static void | ||
453 | consider_peer_destroy (struct CadetPeer *cp); | ||
454 | |||
455 | |||
456 | /** | ||
457 | * We really no longere care about a peer, stop hogging memory with paths to it. | ||
458 | * Afterwards, see if there is more to be cleaned up about this peer. | ||
459 | * | ||
460 | * @param cls a `struct CadetPeer`. | ||
461 | */ | ||
462 | static void | ||
463 | drop_paths (void *cls) | ||
464 | { | ||
465 | struct CadetPeer *cp = cls; | ||
466 | struct CadetPeerPath *path; | ||
467 | |||
468 | cp->destroy_task = NULL; | ||
469 | while (NULL != (path = GNUNET_CONTAINER_heap_remove_root (cp->path_heap))) | ||
470 | GCPP_release (path); | ||
471 | consider_peer_destroy (cp); | ||
472 | } | ||
473 | |||
474 | |||
475 | /** | ||
476 | * This peer may no longer be needed, consider cleaning it up. | ||
477 | * | ||
478 | * @param cp peer to clean up | ||
479 | */ | ||
480 | static void | ||
481 | consider_peer_destroy (struct CadetPeer *cp) | ||
482 | { | ||
483 | struct GNUNET_TIME_Relative exp; | ||
484 | |||
485 | if (NULL != cp->destroy_task) | ||
486 | { | ||
487 | GNUNET_SCHEDULER_cancel (cp->destroy_task); | ||
488 | cp->destroy_task = NULL; | ||
489 | } | ||
490 | if (NULL != cp->t) | ||
491 | return; /* still relevant! */ | ||
492 | if (NULL != cp->core_mq) | ||
493 | return; /* still relevant! */ | ||
494 | if (0 != GNUNET_CONTAINER_multishortmap_size (cp->connections)) | ||
495 | return; /* still relevant! */ | ||
496 | if (0 < GNUNET_CONTAINER_heap_get_size (cp->path_heap)) | ||
497 | { | ||
498 | cp->destroy_task = GNUNET_SCHEDULER_add_delayed (IDLE_PATH_TIMEOUT, | ||
499 | &drop_paths, | ||
500 | cp); | ||
501 | return; | ||
502 | } | ||
503 | if (0 < cp->path_dll_length) | ||
504 | return; /* still relevant! */ | ||
505 | if (NULL != cp->hello) | ||
506 | { | ||
507 | /* relevant only until HELLO expires */ | ||
508 | exp = GNUNET_TIME_absolute_get_remaining (GNUNET_HELLO_get_last_expiration (cp->hello)); | ||
509 | cp->destroy_task = GNUNET_SCHEDULER_add_delayed (exp, | ||
510 | &destroy_peer, | ||
511 | cp); | ||
512 | return; | ||
513 | } | ||
514 | cp->destroy_task = GNUNET_SCHEDULER_add_delayed (IDLE_PEER_TIMEOUT, | ||
515 | &destroy_peer, | ||
516 | cp); | ||
517 | } | ||
518 | |||
519 | |||
520 | /** | ||
521 | * Add an entry to the DLL of all of the paths that this peer is on. | ||
522 | * | ||
523 | * @param cp peer to modify | ||
524 | * @param entry an entry on a path | ||
525 | * @param off offset of this peer on the path | ||
526 | */ | ||
527 | void | ||
528 | GCP_path_entry_add (struct CadetPeer *cp, | ||
529 | struct CadetPeerPathEntry *entry, | ||
530 | unsigned int off) | ||
531 | { | ||
532 | if (off >= cp->path_dll_length) | ||
533 | { | ||
534 | unsigned int len = cp->path_dll_length; | ||
535 | |||
536 | GNUNET_array_grow (cp->path_heads, | ||
537 | len, | ||
538 | off + 4); | ||
539 | GNUNET_array_grow (cp->path_tails, | ||
540 | cp->path_dll_length, | ||
541 | off + 4); | ||
542 | } | ||
543 | GNUNET_CONTAINER_DLL_insert (cp->path_heads[off], | ||
544 | cp->path_tails[off], | ||
545 | entry); | ||
546 | cp->num_paths++; | ||
547 | |||
548 | /* If we have a tunnel to this peer, tell the tunnel that there is a | ||
549 | new path available. */ | ||
550 | if (NULL != cp->t) | ||
551 | GCT_consider_path (cp->t, | ||
552 | entry->path, | ||
553 | off); | ||
554 | } | ||
555 | |||
556 | |||
557 | /** | ||
558 | * Remove an entry from the DLL of all of the paths that this peer is on. | ||
559 | * | ||
560 | * @param cp peer to modify | ||
561 | * @param entry an entry on a path | ||
562 | * @param off offset of this peer on the path | ||
563 | */ | ||
564 | void | ||
565 | GCP_path_entry_remove (struct CadetPeer *cp, | ||
566 | struct CadetPeerPathEntry *entry, | ||
567 | unsigned int off) | ||
568 | { | ||
569 | GNUNET_CONTAINER_DLL_remove (cp->path_heads[off], | ||
570 | cp->path_tails[off], | ||
571 | entry); | ||
572 | GNUNET_assert (0 < cp->num_paths); | ||
573 | cp->num_paths--; | ||
574 | } | ||
575 | |||
576 | |||
577 | /** | ||
578 | * Try adding a @a path to this @a peer. If the peer already | ||
579 | * has plenty of paths, return NULL. | ||
580 | * | ||
581 | * @param cp peer to which the @a path leads to | ||
582 | * @param path a path looking for an owner; may not be fully initialized yet! | ||
583 | * @param off offset of @a cp in @a path | ||
584 | * @return NULL if this peer does not care to become a new owner, | ||
585 | * otherwise the node in the peer's path heap for the @a path. | ||
586 | */ | ||
587 | struct GNUNET_CONTAINER_HeapNode * | ||
588 | GCP_attach_path (struct CadetPeer *cp, | ||
589 | struct CadetPeerPath *path, | ||
590 | unsigned int off) | ||
591 | { | ||
592 | GNUNET_CONTAINER_HeapCostType desirability; | ||
593 | struct CadetPeerPath *root; | ||
594 | GNUNET_CONTAINER_HeapCostType root_desirability; | ||
595 | struct GNUNET_CONTAINER_HeapNode *hn; | ||
596 | |||
597 | /* FIXME: desirability is not yet initialized; tricky! */ | ||
598 | desirability = GCPP_get_desirability (path); | ||
599 | if (GNUNET_NO == | ||
600 | GNUNET_CONTAINER_heap_peek2 (cp->path_heap, | ||
601 | (void **) &root, | ||
602 | &root_desirability)) | ||
603 | { | ||
604 | root = NULL; | ||
605 | root_desirability = 0; | ||
606 | } | ||
607 | |||
608 | if ( (DESIRED_CONNECTIONS_PER_TUNNEL > cp->num_paths) && | ||
609 | (desirability < root_desirability) ) | ||
610 | return NULL; | ||
611 | |||
612 | /* Yes, we'd like to add this path, add to our heap */ | ||
613 | hn = GNUNET_CONTAINER_heap_insert (cp->path_heap, | ||
614 | (void *) cp, | ||
615 | desirability); | ||
616 | |||
617 | /* Consider maybe dropping other paths because of the new one */ | ||
618 | if (GNUNET_CONTAINER_heap_get_size (cp->path_heap) >= | ||
619 | 2 * DESIRED_CONNECTIONS_PER_TUNNEL) | ||
620 | { | ||
621 | /* Now we have way too many, drop least desirable UNLESS it is in use! | ||
622 | (Note that this intentionally keeps highly desireable, but currently | ||
623 | unused paths around in the hope that we might be able to switch, even | ||
624 | if the number of paths exceeds the threshold.) */ | ||
625 | root = GNUNET_CONTAINER_heap_peek (cp->path_heap); | ||
626 | if (NULL == | ||
627 | GCPP_get_connection (root, | ||
628 | cp, | ||
629 | GCPP_get_length (root) - 1)) | ||
630 | { | ||
631 | /* Got plenty of paths to this destination, and this is a low-quality | ||
632 | one that we don't care, allow it to die. */ | ||
633 | GNUNET_assert (root == | ||
634 | GNUNET_CONTAINER_heap_remove_root (cp->path_heap)); | ||
635 | GCPP_release (root); | ||
636 | } | ||
637 | } | ||
638 | return hn; | ||
639 | } | ||
640 | |||
641 | |||
642 | /** | ||
643 | * This peer can no longer own @a path as the path | ||
644 | * has been extended and a peer further down the line | ||
645 | * is now the new owner. | ||
646 | * | ||
647 | * @param cp old owner of the @a path | ||
648 | * @param path path where the ownership is lost | ||
649 | * @param hn note in @a cp's path heap that must be deleted | ||
650 | */ | ||
651 | void | ||
652 | GCP_detach_path (struct CadetPeer *cp, | ||
653 | struct CadetPeerPath *path, | ||
654 | struct GNUNET_CONTAINER_HeapNode *hn) | ||
655 | { | ||
656 | GNUNET_assert (path == | ||
657 | GNUNET_CONTAINER_heap_remove_node (hn)); | ||
658 | } | ||
659 | |||
660 | |||
661 | /** | ||
662 | * Add a @a connection to this @a cp. | ||
663 | * | ||
664 | * @param cp peer via which the @a connection goes | ||
665 | * @param cc the connection to add | ||
666 | */ | ||
667 | void | ||
668 | GCP_add_connection (struct CadetPeer *cp, | ||
669 | struct CadetConnection *cc) | ||
670 | { | ||
671 | GNUNET_assert (GNUNET_OK == | ||
672 | GNUNET_CONTAINER_multishortmap_put (cp->connections, | ||
673 | &GCC_get_id (cc)->connection_of_tunnel, | ||
674 | cc, | ||
675 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
676 | } | ||
677 | |||
678 | |||
679 | /** | ||
680 | * Remove a @a connection that went via this @a cp. | ||
681 | * | ||
682 | * @param cp peer via which the @a connection went | ||
683 | * @param cc the connection to remove | ||
684 | */ | ||
685 | void | ||
686 | GCP_remove_connection (struct CadetPeer *cp, | ||
687 | struct CadetConnection *cc) | ||
688 | { | ||
689 | GNUNET_assert (GNUNET_YES == | ||
690 | GNUNET_CONTAINER_multishortmap_remove (cp->connections, | ||
691 | &GCC_get_id (cc)->connection_of_tunnel, | ||
692 | cc)); | ||
693 | } | ||
694 | |||
695 | |||
696 | /** | ||
697 | * This peer is now on more "active" duty, activate processes related to it. | ||
698 | * | ||
699 | * @param cp the more-active peer | ||
700 | */ | ||
701 | static void | ||
702 | consider_peer_activate (struct CadetPeer *cp) | ||
703 | { | ||
704 | uint32_t strength; | ||
705 | |||
706 | if (NULL != cp->destroy_task) | ||
707 | { | ||
708 | /* It's active, do not destory! */ | ||
709 | GNUNET_SCHEDULER_cancel (cp->destroy_task); | ||
710 | cp->destroy_task = NULL; | ||
711 | } | ||
712 | if ( (0 == GNUNET_CONTAINER_multishortmap_size (cp->connections)) && | ||
713 | (NULL == cp->t) ) | ||
714 | { | ||
715 | /* We're just on a path or directly connected; don't bother too much */ | ||
716 | if (NULL != cp->connectivity_suggestion) | ||
717 | { | ||
718 | GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion); | ||
719 | cp->connectivity_suggestion = NULL; | ||
720 | } | ||
721 | if (NULL != cp->search_h) | ||
722 | { | ||
723 | GCD_search_stop (cp->search_h); | ||
724 | cp->search_h = NULL; | ||
725 | } | ||
726 | return; | ||
727 | } | ||
728 | if (NULL == cp->core_mq) | ||
729 | { | ||
730 | /* Lacks direct connection, try to create one by querying the DHT */ | ||
731 | if ( (NULL == cp->search_h) && | ||
732 | (DESIRED_CONNECTIONS_PER_TUNNEL < cp->num_paths) ) | ||
733 | cp->search_h | ||
734 | = GCD_search (&cp->pid); | ||
735 | } | ||
736 | else | ||
737 | { | ||
738 | /* Have direct connection, stop DHT search if active */ | ||
739 | if (NULL != cp->search_h) | ||
740 | { | ||
741 | GCD_search_stop (cp->search_h); | ||
742 | cp->search_h = NULL; | ||
743 | } | ||
744 | } | ||
745 | |||
746 | /* If we have a tunnel, our urge for connections is much bigger */ | ||
747 | strength = (NULL != cp->t) ? 32 : 1; | ||
748 | if (NULL != cp->connectivity_suggestion) | ||
749 | GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion); | ||
750 | cp->connectivity_suggestion | ||
751 | = GNUNET_ATS_connectivity_suggest (ats_ch, | ||
752 | &cp->pid, | ||
753 | strength); | ||
754 | } | ||
755 | |||
756 | |||
757 | /** | ||
758 | * Retrieve the CadetPeer stucture associated with the | ||
759 | * peer. Optionally create one and insert it in the appropriate | ||
760 | * structures if the peer is not known yet. | ||
761 | * | ||
762 | * @param peer_id Full identity of the peer. | ||
763 | * @param create #GNUNET_YES if a new peer should be created if unknown. | ||
764 | * #GNUNET_NO to return NULL if peer is unknown. | ||
765 | * @return Existing or newly created peer structure. | ||
766 | * NULL if unknown and not requested @a create | ||
767 | */ | ||
768 | struct CadetPeer * | ||
769 | GCP_get (const struct GNUNET_PeerIdentity *peer_id, | ||
770 | int create) | ||
771 | { | ||
772 | struct CadetPeer *cp; | ||
773 | |||
774 | cp = GNUNET_CONTAINER_multipeermap_get (peers, | ||
775 | peer_id); | ||
776 | if (NULL != cp) | ||
777 | return cp; | ||
778 | if (GNUNET_NO == create) | ||
779 | return NULL; | ||
780 | cp = GNUNET_new (struct CadetPeer); | ||
781 | cp->pid = *peer_id; | ||
782 | cp->connections = GNUNET_CONTAINER_multishortmap_create (32, | ||
783 | GNUNET_YES); | ||
784 | cp->path_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | ||
785 | GNUNET_assert (GNUNET_YES == | ||
786 | GNUNET_CONTAINER_multipeermap_put (peers, | ||
787 | &cp->pid, | ||
788 | cp, | ||
789 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
790 | return cp; | ||
791 | } | ||
792 | |||
793 | |||
794 | /** | ||
795 | * Obtain the peer identity for a `struct CadetPeer`. | ||
796 | * | ||
797 | * @param cp our peer handle | ||
798 | * @return the peer identity | ||
799 | */ | ||
800 | const struct GNUNET_PeerIdentity * | ||
801 | GCP_get_id (struct CadetPeer *cp) | ||
802 | { | ||
803 | return &cp->pid; | ||
804 | } | ||
805 | |||
806 | |||
807 | /** | ||
808 | * Iterate over all known peers. | ||
809 | * | ||
810 | * @param iter Iterator. | ||
811 | * @param cls Closure for @c iter. | ||
812 | */ | ||
813 | void | ||
814 | GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, | ||
815 | void *cls) | ||
816 | { | ||
817 | GNUNET_CONTAINER_multipeermap_iterate (peers, | ||
818 | iter, | ||
819 | cls); | ||
820 | } | ||
821 | |||
822 | |||
823 | /** | ||
824 | * Count the number of known paths toward the peer. | ||
825 | * | ||
826 | * @param peer Peer to get path info. | ||
827 | * @return Number of known paths. | ||
828 | */ | ||
829 | unsigned int | ||
830 | GCP_count_paths (const struct CadetPeer *peer) | ||
831 | { | ||
832 | return peer->num_paths; | ||
833 | } | ||
834 | |||
835 | |||
836 | /** | ||
837 | * Iterate over the paths to a peer. | ||
838 | * | ||
839 | * @param peer Peer to get path info. | ||
840 | * @param callback Function to call for every path. | ||
841 | * @param callback_cls Closure for @a callback. | ||
842 | * @return Number of iterated paths. | ||
843 | */ | ||
844 | unsigned int | ||
845 | GCP_iterate_paths (struct CadetPeer *peer, | ||
846 | GCP_PathIterator callback, | ||
847 | void *callback_cls) | ||
848 | { | ||
849 | unsigned int ret = 0; | ||
850 | |||
851 | for (unsigned int i=0;i<peer->path_dll_length;i++) | ||
852 | { | ||
853 | for (struct CadetPeerPathEntry *pe = peer->path_heads[i]; | ||
854 | NULL != pe; | ||
855 | pe = pe->next) | ||
856 | { | ||
857 | if (GNUNET_NO == | ||
858 | callback (callback_cls, | ||
859 | pe->path, | ||
860 | i)) | ||
861 | return ret; | ||
862 | ret++; | ||
863 | } | ||
864 | } | ||
865 | return ret; | ||
866 | } | ||
867 | |||
868 | |||
869 | /** | ||
870 | * Iterate over the paths to @a peer where | ||
871 | * @a peer is at distance @a dist from us. | ||
872 | * | ||
873 | * @param peer Peer to get path info. | ||
874 | * @param dist desired distance of @a peer to us on the path | ||
875 | * @param callback Function to call for every path. | ||
876 | * @param callback_cls Closure for @a callback. | ||
877 | * @return Number of iterated paths. | ||
878 | */ | ||
879 | unsigned int | ||
880 | GCP_iterate_paths_at (struct CadetPeer *peer, | ||
881 | unsigned int dist, | ||
882 | GCP_PathIterator callback, | ||
883 | void *callback_cls) | ||
884 | { | ||
885 | unsigned int ret = 0; | ||
886 | |||
887 | if (dist<peer->path_dll_length) | ||
888 | return 0; | ||
889 | for (struct CadetPeerPathEntry *pe = peer->path_heads[dist]; | ||
890 | NULL != pe; | ||
891 | pe = pe->next) | ||
892 | { | ||
893 | if (GNUNET_NO == | ||
894 | callback (callback_cls, | ||
895 | pe->path, | ||
896 | dist)) | ||
897 | return ret; | ||
898 | ret++; | ||
899 | } | ||
900 | return ret; | ||
901 | } | ||
902 | |||
903 | |||
904 | /** | ||
905 | * Get the tunnel towards a peer. | ||
906 | * | ||
907 | * @param peer Peer to get from. | ||
908 | * @param create #GNUNET_YES to create a tunnel if we do not have one | ||
909 | * @return Tunnel towards peer. | ||
910 | */ | ||
911 | struct CadetTunnel * | ||
912 | GCP_get_tunnel (struct CadetPeer *peer, | ||
913 | int create) | ||
914 | { | ||
915 | if (NULL == peer) | ||
916 | return NULL; | ||
917 | if ( (NULL != peer->t) || | ||
918 | (GNUNET_NO == create) ) | ||
919 | return peer->t; | ||
920 | peer->t = GCT_create_tunnel (peer); | ||
921 | consider_peer_activate (peer); | ||
922 | return peer->t; | ||
923 | } | ||
924 | |||
925 | |||
926 | /** | ||
927 | * We got a HELLO for a @a peer, remember it, and possibly | ||
928 | * trigger adequate actions (like trying to connect). | ||
929 | * | ||
930 | * @param peer the peer we got a HELLO for | ||
931 | * @param hello the HELLO to remember | ||
932 | */ | ||
933 | void | ||
934 | GCP_set_hello (struct CadetPeer *peer, | ||
935 | const struct GNUNET_HELLO_Message *hello) | ||
936 | { | ||
937 | /* FIXME: keep HELLO, possibly offer to TRANSPORT... */ | ||
938 | |||
939 | consider_peer_destroy (peer); | ||
940 | } | ||
941 | |||
942 | |||
943 | /** | ||
944 | * The tunnel to the given peer no longer exists, remove it from our | ||
945 | * data structures, and possibly clean up the peer itself. | ||
946 | * | ||
947 | * @param peer the peer affected | ||
948 | * @param t the dead tunnel | ||
949 | */ | ||
950 | void | ||
951 | GCP_drop_tunnel (struct CadetPeer *peer, | ||
952 | struct CadetTunnel *t) | ||
953 | { | ||
954 | GNUNET_assert (peer->t == t); | ||
955 | peer->t = NULL; | ||
956 | consider_peer_destroy (peer); | ||
957 | } | ||
958 | |||
959 | |||
960 | /** | ||
961 | * Test if @a cp has a core-level connection | ||
962 | * | ||
963 | * @param cp peer to test | ||
964 | * @return #GNUNET_YES if @a cp has a core-level connection | ||
965 | */ | ||
966 | int | ||
967 | GCP_has_core_connection (struct CadetPeer *cp) | ||
968 | { | ||
969 | return (NULL != cp->core_mq) ? GNUNET_YES : GNUNET_NO; | ||
970 | } | ||
971 | |||
972 | |||
973 | /** | ||
974 | * Start message queue change notifications. | ||
975 | * | ||
976 | * @param cp peer to notify for | ||
977 | * @param cb function to call if mq becomes available or unavailable | ||
978 | * @param cb_cls closure for @a cb | ||
979 | * @return handle to cancel request | ||
980 | */ | ||
981 | struct GCP_MessageQueueManager * | ||
982 | GCP_request_mq (struct CadetPeer *cp, | ||
983 | GCP_MessageQueueNotificationCallback cb, | ||
984 | void *cb_cls) | ||
985 | { | ||
986 | struct GCP_MessageQueueManager *mqm; | ||
987 | |||
988 | mqm = GNUNET_new (struct GCP_MessageQueueManager); | ||
989 | mqm->cb = cb; | ||
990 | mqm->cb_cls = cb_cls; | ||
991 | mqm->cp = cp; | ||
992 | GNUNET_CONTAINER_DLL_insert (cp->mqm_head, | ||
993 | cp->mqm_tail, | ||
994 | mqm); | ||
995 | if (NULL != cp->core_mq) | ||
996 | cb (cb_cls, | ||
997 | GNUNET_YES); | ||
998 | return mqm; | ||
999 | } | ||
1000 | |||
1001 | |||
1002 | /** | ||
1003 | * Stops message queue change notifications. | ||
1004 | * | ||
1005 | * @param mqm handle matching request to cancel | ||
1006 | * @param last_env final message to transmit, or NULL | ||
1007 | */ | ||
1008 | void | ||
1009 | GCP_request_mq_cancel (struct GCP_MessageQueueManager *mqm, | ||
1010 | struct GNUNET_MQ_Envelope *last_env) | ||
1011 | { | ||
1012 | struct CadetPeer *cp = mqm->cp; | ||
1013 | |||
1014 | if (NULL != mqm->env) | ||
1015 | GNUNET_MQ_discard (mqm->env); | ||
1016 | if (NULL != last_env) | ||
1017 | { | ||
1018 | if (NULL != cp->core_mq) | ||
1019 | GNUNET_MQ_send (cp->core_mq, | ||
1020 | last_env); | ||
1021 | else | ||
1022 | GNUNET_MQ_discard (last_env); | ||
1023 | } | ||
1024 | GNUNET_CONTAINER_DLL_remove (cp->mqm_head, | ||
1025 | cp->mqm_tail, | ||
1026 | mqm); | ||
1027 | GNUNET_free (mqm); | ||
1028 | } | ||
1029 | |||
1030 | |||
1031 | /** | ||
1032 | * Send the message in @a env to @a cp, overriding queueing logic. | ||
1033 | * This function should only be used to send error messages outside | ||
1034 | * of flow and congestion control, similar to ICMP. Note that | ||
1035 | * the envelope may be silently discarded as well. | ||
1036 | * | ||
1037 | * @param cp peer to send the message to | ||
1038 | * @param env envelope with the message to send | ||
1039 | */ | ||
1040 | void | ||
1041 | GCP_send_ooo (struct CadetPeer *cp, | ||
1042 | struct GNUNET_MQ_Envelope *env) | ||
1043 | { | ||
1044 | if (NULL == cp->core_mq) | ||
1045 | { | ||
1046 | GNUNET_MQ_discard (env); | ||
1047 | return; | ||
1048 | } | ||
1049 | GNUNET_MQ_send (cp->core_mq, | ||
1050 | env); | ||
1051 | } | ||
1052 | |||
1053 | |||
1054 | |||
1055 | |||
1056 | /* end of gnunet-service-cadet-new_peer.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_peer.h b/src/cadet/gnunet-service-cadet-new_peer.h new file mode 100644 index 000000000..c633f47e5 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_peer.h | |||
@@ -0,0 +1,368 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_peer.h | ||
24 | * @brief Information we track per peer. | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | */ | ||
28 | #ifndef GNUNET_SERVICE_CADET_PEER_H | ||
29 | #define GNUNET_SERVICE_CADET_PEER_H | ||
30 | |||
31 | #include "gnunet-service-cadet-new.h" | ||
32 | #include "gnunet_hello_lib.h" | ||
33 | |||
34 | |||
35 | /** | ||
36 | * Get the static string for a peer ID. | ||
37 | * | ||
38 | * @param peer Peer. | ||
39 | * | ||
40 | * @return Static string for it's ID. | ||
41 | */ | ||
42 | const char * | ||
43 | GCP_2s (const struct CadetPeer *peer); | ||
44 | |||
45 | |||
46 | /** | ||
47 | * Retrieve the CadetPeer stucture associated with the | ||
48 | * peer. Optionally create one and insert it in the appropriate | ||
49 | * structures if the peer is not known yet. | ||
50 | * | ||
51 | * @param peer_id Full identity of the peer. | ||
52 | * @param create #GNUNET_YES if a new peer should be created if unknown. | ||
53 | * #GNUNET_NO to return NULL if peer is unknown. | ||
54 | * @return Existing or newly created peer structure. | ||
55 | * NULL if unknown and not requested @a create | ||
56 | */ | ||
57 | struct CadetPeer * | ||
58 | GCP_get (const struct GNUNET_PeerIdentity *peer_id, | ||
59 | int create); | ||
60 | |||
61 | |||
62 | /** | ||
63 | * Obtain the peer identity for a `struct CadetPeer`. | ||
64 | * | ||
65 | * @param cp our peer handle | ||
66 | * @return the peer identity | ||
67 | */ | ||
68 | const struct GNUNET_PeerIdentity * | ||
69 | GCP_get_id (struct CadetPeer *cp); | ||
70 | |||
71 | |||
72 | /** | ||
73 | * Iterate over all known peers. | ||
74 | * | ||
75 | * @param iter Iterator. | ||
76 | * @param cls Closure for @c iter. | ||
77 | */ | ||
78 | void | ||
79 | GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, | ||
80 | void *cls); | ||
81 | |||
82 | |||
83 | /** | ||
84 | * Count the number of known paths toward the peer. | ||
85 | * | ||
86 | * @param cp Peer to get path info. | ||
87 | * @return Number of known paths. | ||
88 | */ | ||
89 | unsigned int | ||
90 | GCP_count_paths (const struct CadetPeer *cp); | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Peer path iterator. | ||
95 | * | ||
96 | * @param cls Closure. | ||
97 | * @param path Path itself | ||
98 | * @param off offset of the target peer in @a path | ||
99 | * @return #GNUNET_YES if should keep iterating. | ||
100 | * #GNUNET_NO otherwise. | ||
101 | */ | ||
102 | typedef int | ||
103 | (*GCP_PathIterator) (void *cls, | ||
104 | struct CadetPeerPath *path, | ||
105 | unsigned int off); | ||
106 | |||
107 | |||
108 | /** | ||
109 | * Iterate over the paths to a peer. | ||
110 | * | ||
111 | * @param cp Peer to get path info. | ||
112 | * @param callback Function to call for every path. | ||
113 | * @param callback_cls Closure for @a callback. | ||
114 | * @return Number of iterated paths. | ||
115 | */ | ||
116 | unsigned int | ||
117 | GCP_iterate_paths (struct CadetPeer *cp, | ||
118 | GCP_PathIterator callback, | ||
119 | void *callback_cls); | ||
120 | |||
121 | |||
122 | /** | ||
123 | * Iterate over the paths to @a peer where | ||
124 | * @a peer is at distance @a dist from us. | ||
125 | * | ||
126 | * @param peer Peer to get path info. | ||
127 | * @param dist desired distance of @a peer to us on the path | ||
128 | * @param callback Function to call for every path. | ||
129 | * @param callback_cls Closure for @a callback. | ||
130 | * @return Number of iterated paths. | ||
131 | */ | ||
132 | unsigned int | ||
133 | GCP_iterate_paths_at (struct CadetPeer *peer, | ||
134 | unsigned int dist, | ||
135 | GCP_PathIterator callback, | ||
136 | void *callback_cls); | ||
137 | |||
138 | |||
139 | /** | ||
140 | * Remove an entry from the DLL of all of the paths that this peer is on. | ||
141 | * | ||
142 | * @param cp peer to modify | ||
143 | * @param entry an entry on a path | ||
144 | * @param off offset of this peer on the path | ||
145 | */ | ||
146 | void | ||
147 | GCP_path_entry_remove (struct CadetPeer *cp, | ||
148 | struct CadetPeerPathEntry *entry, | ||
149 | unsigned int off); | ||
150 | |||
151 | |||
152 | /** | ||
153 | * Add an entry to the DLL of all of the paths that this peer is on. | ||
154 | * | ||
155 | * @param cp peer to modify | ||
156 | * @param entry an entry on a path | ||
157 | * @param off offset of this peer on the path | ||
158 | */ | ||
159 | void | ||
160 | GCP_path_entry_add (struct CadetPeer *cp, | ||
161 | struct CadetPeerPathEntry *entry, | ||
162 | unsigned int off); | ||
163 | |||
164 | |||
165 | /** | ||
166 | * Get the tunnel towards a peer. | ||
167 | * | ||
168 | * @param cp Peer to get from. | ||
169 | * @param create #GNUNET_YES to create a tunnel if we do not have one | ||
170 | * @return Tunnel towards peer. | ||
171 | */ | ||
172 | struct CadetTunnel * | ||
173 | GCP_get_tunnel (struct CadetPeer *cp, | ||
174 | int create); | ||
175 | |||
176 | |||
177 | /** | ||
178 | * The tunnel to the given peer no longer exists, remove it from our | ||
179 | * data structures, and possibly clean up the peer itself. | ||
180 | * | ||
181 | * @param cp the peer affected | ||
182 | * @param t the dead tunnel | ||
183 | */ | ||
184 | void | ||
185 | GCP_drop_tunnel (struct CadetPeer *cp, | ||
186 | struct CadetTunnel *t); | ||
187 | |||
188 | |||
189 | /** | ||
190 | * Try adding a @a path to this @a cp. If the peer already | ||
191 | * has plenty of paths, return NULL. | ||
192 | * | ||
193 | * @param cp peer to which the @a path leads to | ||
194 | * @param path a path looking for an owner; may not be fully initialized yet! | ||
195 | * @param off offset of @a cp in @a path | ||
196 | * @return NULL if this peer does not care to become a new owner, | ||
197 | * otherwise the node in the peer's path heap for the @a path. | ||
198 | */ | ||
199 | struct GNUNET_CONTAINER_HeapNode * | ||
200 | GCP_attach_path (struct CadetPeer *cp, | ||
201 | struct CadetPeerPath *path, | ||
202 | unsigned int off); | ||
203 | |||
204 | |||
205 | /** | ||
206 | * This peer can no longer own @a path as the path | ||
207 | * has been extended and a peer further down the line | ||
208 | * is now the new owner. | ||
209 | * | ||
210 | * @param cp old owner of the @a path | ||
211 | * @param path path where the ownership is lost | ||
212 | * @param hn note in @a cp's path heap that must be deleted | ||
213 | */ | ||
214 | void | ||
215 | GCP_detach_path (struct CadetPeer *cp, | ||
216 | struct CadetPeerPath *path, | ||
217 | struct GNUNET_CONTAINER_HeapNode *hn); | ||
218 | |||
219 | |||
220 | /** | ||
221 | * Add a @a connection to this @a cp. | ||
222 | * | ||
223 | * @param cp peer via which the @a connection goes | ||
224 | * @param cc the connection to add | ||
225 | */ | ||
226 | void | ||
227 | GCP_add_connection (struct CadetPeer *cp, | ||
228 | struct CadetConnection *cc); | ||
229 | |||
230 | |||
231 | /** | ||
232 | * Remove a @a connection that went via this @a cp. | ||
233 | * | ||
234 | * @param cp peer via which the @a connection went | ||
235 | * @param cc the connection to remove | ||
236 | */ | ||
237 | void | ||
238 | GCP_remove_connection (struct CadetPeer *cp, | ||
239 | struct CadetConnection *cc); | ||
240 | |||
241 | |||
242 | /** | ||
243 | * We got a HELLO for a @a cp, remember it, and possibly | ||
244 | * trigger adequate actions (like trying to connect). | ||
245 | * | ||
246 | * @param cp the peer we got a HELLO for | ||
247 | * @param hello the HELLO to remember | ||
248 | */ | ||
249 | void | ||
250 | GCP_set_hello (struct CadetPeer *cp, | ||
251 | const struct GNUNET_HELLO_Message *hello); | ||
252 | |||
253 | |||
254 | /** | ||
255 | * Clean up all entries about all peers. | ||
256 | * Must only be called after all tunnels, CORE-connections and | ||
257 | * connections are down. | ||
258 | */ | ||
259 | void | ||
260 | GCP_destroy_all_peers (void); | ||
261 | |||
262 | |||
263 | /** | ||
264 | * Data structure used to track whom we have to notify about changes | ||
265 | * in our ability to transmit to a given peer. | ||
266 | * | ||
267 | * All queue managers will be given equal chance for sending messages | ||
268 | * to @a cp. This construct this guarantees fairness for access to @a | ||
269 | * cp among the different message queues. Each connection or route | ||
270 | * will have its respective message queue managers for each direction. | ||
271 | */ | ||
272 | struct GCP_MessageQueueManager; | ||
273 | |||
274 | |||
275 | /** | ||
276 | * Function to call with updated message queue object. | ||
277 | * | ||
278 | * @param cls closure | ||
279 | * @param available #GNUNET_YES if sending is now possible, | ||
280 | * #GNUNET_NO if sending is no longer possible | ||
281 | * #GNUNET_SYSERR if sending is no longer possible | ||
282 | * and the last envelope was discarded | ||
283 | */ | ||
284 | typedef void | ||
285 | (*GCP_MessageQueueNotificationCallback)(void *cls, | ||
286 | int available); | ||
287 | |||
288 | |||
289 | /** | ||
290 | * Start message queue change notifications. Will create a new slot | ||
291 | * to manage the message queue to the given @a cp. | ||
292 | * | ||
293 | * @param cp peer to notify for | ||
294 | * @param cb function to call if mq becomes available or unavailable | ||
295 | * @param cb_cls closure for @a cb | ||
296 | * @return handle to cancel request | ||
297 | */ | ||
298 | struct GCP_MessageQueueManager * | ||
299 | GCP_request_mq (struct CadetPeer *cp, | ||
300 | GCP_MessageQueueNotificationCallback cb, | ||
301 | void *cb_cls); | ||
302 | |||
303 | |||
304 | /** | ||
305 | * Test if @a cp has a core-level connection | ||
306 | * | ||
307 | * @param cp peer to test | ||
308 | * @return #GNUNET_YES if @a cp has a core-level connection | ||
309 | */ | ||
310 | int | ||
311 | GCP_has_core_connection (struct CadetPeer *cp); | ||
312 | |||
313 | |||
314 | /** | ||
315 | * Send the message in @a env via a @a mqm. Must only be called at | ||
316 | * most once after the respective | ||
317 | * #GCP_MessageQueueNotificationCallback was called with `available` | ||
318 | * set to #GNUNET_YES, and not after the callback was called with | ||
319 | * `available` set to #GNUNET_NO or #GNUNET_SYSERR. | ||
320 | * | ||
321 | * @param mqm message queue manager for the transmission | ||
322 | * @param env envelope with the message to send; must NOT | ||
323 | * yet have a #GNUNET_MQ_notify_sent() callback attached to it | ||
324 | */ | ||
325 | void | ||
326 | GCP_send (struct GCP_MessageQueueManager *mqm, | ||
327 | struct GNUNET_MQ_Envelope *env); | ||
328 | |||
329 | |||
330 | /** | ||
331 | * Send the message in @a env to @a cp, overriding queueing logic. | ||
332 | * This function should only be used to send error messages outside | ||
333 | * of flow and congestion control, similar to ICMP. Note that | ||
334 | * the envelope may be silently discarded as well. | ||
335 | * | ||
336 | * @param cp peer to send the message to | ||
337 | * @param env envelope with the message to send | ||
338 | */ | ||
339 | void | ||
340 | GCP_send_ooo (struct CadetPeer *cp, | ||
341 | struct GNUNET_MQ_Envelope *env); | ||
342 | |||
343 | |||
344 | /** | ||
345 | * Stops message queue change notifications and sends a last message. | ||
346 | * In practice, this is implemented by sending that @a last_env | ||
347 | * message immediately (if any), ignoring queue order. | ||
348 | * | ||
349 | * @param mqm handle matching request to cancel | ||
350 | * @param last_env final message to transmit, or NULL | ||
351 | */ | ||
352 | void | ||
353 | GCP_request_mq_cancel (struct GCP_MessageQueueManager *mqm, | ||
354 | struct GNUNET_MQ_Envelope *last_env); | ||
355 | |||
356 | |||
357 | /** | ||
358 | * Set the message queue to @a mq for peer @a cp and notify watchers. | ||
359 | * | ||
360 | * @param cp peer to modify | ||
361 | * @param mq message queue to set (can be NULL) | ||
362 | */ | ||
363 | void | ||
364 | GCP_set_mq (struct CadetPeer *cp, | ||
365 | struct GNUNET_MQ_Handle *mq); | ||
366 | |||
367 | |||
368 | #endif | ||
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c new file mode 100644 index 000000000..23b270b82 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_tunnels.c | |||
@@ -0,0 +1,2249 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2013, 2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_tunnels.c | ||
24 | * @brief Information we track per tunnel. | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | * | ||
28 | * FIXME: | ||
29 | * - when managing connections, distinguish those that | ||
30 | * have (recently) had traffic from those that were | ||
31 | * never ready (or not recently) | ||
32 | * - implement sending and receiving KX messages | ||
33 | * - implement processing of incoming decrypted plaintext messages | ||
34 | * - clean up KX logic! | ||
35 | */ | ||
36 | #include "platform.h" | ||
37 | #include "gnunet_util_lib.h" | ||
38 | #include "gnunet_statistics_service.h" | ||
39 | #include "gnunet_signatures.h" | ||
40 | #include "cadet_protocol.h" | ||
41 | #include "cadet_path.h" | ||
42 | #include "gnunet-service-cadet-new.h" | ||
43 | #include "gnunet-service-cadet-new_channel.h" | ||
44 | #include "gnunet-service-cadet-new_connection.h" | ||
45 | #include "gnunet-service-cadet-new_tunnels.h" | ||
46 | #include "gnunet-service-cadet-new_peer.h" | ||
47 | #include "gnunet-service-cadet-new_paths.h" | ||
48 | |||
49 | |||
50 | #define LOG(level, ...) GNUNET_log_from(level,"cadet-tun",__VA_ARGS__) | ||
51 | |||
52 | |||
53 | /** | ||
54 | * How long do we wait until tearing down an idle tunnel? | ||
55 | */ | ||
56 | #define IDLE_DESTROY_DELAY GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 90) | ||
57 | |||
58 | /** | ||
59 | * Yuck, replace by 'offsetof' expression? | ||
60 | * FIXME. | ||
61 | */ | ||
62 | #define AX_HEADER_SIZE (sizeof (uint32_t) * 2\ | ||
63 | + sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)) | ||
64 | |||
65 | |||
66 | /** | ||
67 | * Maximum number of skipped keys we keep in memory per tunnel. | ||
68 | */ | ||
69 | #define MAX_SKIPPED_KEYS 64 | ||
70 | |||
71 | /** | ||
72 | * Maximum number of keys (and thus ratchet steps) we are willing to | ||
73 | * skip before we decide this is either a bogus packet or a DoS-attempt. | ||
74 | */ | ||
75 | #define MAX_KEY_GAP 256 | ||
76 | |||
77 | |||
78 | /** | ||
79 | * Struct to old keys for skipped messages while advancing the Axolotl ratchet. | ||
80 | */ | ||
81 | struct CadetTunnelSkippedKey | ||
82 | { | ||
83 | /** | ||
84 | * DLL next. | ||
85 | */ | ||
86 | struct CadetTunnelSkippedKey *next; | ||
87 | |||
88 | /** | ||
89 | * DLL prev. | ||
90 | */ | ||
91 | struct CadetTunnelSkippedKey *prev; | ||
92 | |||
93 | /** | ||
94 | * When was this key stored (for timeout). | ||
95 | */ | ||
96 | struct GNUNET_TIME_Absolute timestamp; | ||
97 | |||
98 | /** | ||
99 | * Header key. | ||
100 | */ | ||
101 | struct GNUNET_CRYPTO_SymmetricSessionKey HK; | ||
102 | |||
103 | /** | ||
104 | * Message key. | ||
105 | */ | ||
106 | struct GNUNET_CRYPTO_SymmetricSessionKey MK; | ||
107 | |||
108 | /** | ||
109 | * Key number for a given HK. | ||
110 | */ | ||
111 | unsigned int Kn; | ||
112 | }; | ||
113 | |||
114 | |||
115 | /** | ||
116 | * Axolotl data, according to https://github.com/trevp/axolotl/wiki . | ||
117 | */ | ||
118 | struct CadetTunnelAxolotl | ||
119 | { | ||
120 | /** | ||
121 | * A (double linked) list of stored message keys and associated header keys | ||
122 | * for "skipped" messages, i.e. messages that have not been | ||
123 | * received despite the reception of more recent messages, (head). | ||
124 | */ | ||
125 | struct CadetTunnelSkippedKey *skipped_head; | ||
126 | |||
127 | /** | ||
128 | * Skipped messages' keys DLL, tail. | ||
129 | */ | ||
130 | struct CadetTunnelSkippedKey *skipped_tail; | ||
131 | |||
132 | /** | ||
133 | * 32-byte root key which gets updated by DH ratchet. | ||
134 | */ | ||
135 | struct GNUNET_CRYPTO_SymmetricSessionKey RK; | ||
136 | |||
137 | /** | ||
138 | * 32-byte header key (send). | ||
139 | */ | ||
140 | struct GNUNET_CRYPTO_SymmetricSessionKey HKs; | ||
141 | |||
142 | /** | ||
143 | * 32-byte header key (recv) | ||
144 | */ | ||
145 | struct GNUNET_CRYPTO_SymmetricSessionKey HKr; | ||
146 | |||
147 | /** | ||
148 | * 32-byte next header key (send). | ||
149 | */ | ||
150 | struct GNUNET_CRYPTO_SymmetricSessionKey NHKs; | ||
151 | |||
152 | /** | ||
153 | * 32-byte next header key (recv). | ||
154 | */ | ||
155 | struct GNUNET_CRYPTO_SymmetricSessionKey NHKr; | ||
156 | |||
157 | /** | ||
158 | * 32-byte chain keys (used for forward-secrecy updating, send). | ||
159 | */ | ||
160 | struct GNUNET_CRYPTO_SymmetricSessionKey CKs; | ||
161 | |||
162 | /** | ||
163 | * 32-byte chain keys (used for forward-secrecy updating, recv). | ||
164 | */ | ||
165 | struct GNUNET_CRYPTO_SymmetricSessionKey CKr; | ||
166 | |||
167 | /** | ||
168 | * ECDH for key exchange (A0 / B0). | ||
169 | */ | ||
170 | struct GNUNET_CRYPTO_EcdhePrivateKey *kx_0; | ||
171 | |||
172 | /** | ||
173 | * ECDH Ratchet key (send). | ||
174 | */ | ||
175 | struct GNUNET_CRYPTO_EcdhePrivateKey *DHRs; | ||
176 | |||
177 | /** | ||
178 | * ECDH Ratchet key (recv). | ||
179 | */ | ||
180 | struct GNUNET_CRYPTO_EcdhePublicKey DHRr; | ||
181 | |||
182 | /** | ||
183 | * When does this ratchet expire and a new one is triggered. | ||
184 | */ | ||
185 | struct GNUNET_TIME_Absolute ratchet_expiration; | ||
186 | |||
187 | /** | ||
188 | * Number of elements in @a skipped_head <-> @a skipped_tail. | ||
189 | */ | ||
190 | unsigned int skipped; | ||
191 | |||
192 | /** | ||
193 | * Message number (reset to 0 with each new ratchet, next message to send). | ||
194 | */ | ||
195 | uint32_t Ns; | ||
196 | |||
197 | /** | ||
198 | * Message number (reset to 0 with each new ratchet, next message to recv). | ||
199 | */ | ||
200 | uint32_t Nr; | ||
201 | |||
202 | /** | ||
203 | * Previous message numbers (# of msgs sent under prev ratchet) | ||
204 | */ | ||
205 | uint32_t PNs; | ||
206 | |||
207 | /** | ||
208 | * True (#GNUNET_YES) if we have to send a new ratchet key in next msg. | ||
209 | */ | ||
210 | int ratchet_flag; | ||
211 | |||
212 | /** | ||
213 | * Number of messages recieved since our last ratchet advance. | ||
214 | * - If this counter = 0, we cannot send a new ratchet key in next msg. | ||
215 | * - If this counter > 0, we can (but don't yet have to) send a new key. | ||
216 | */ | ||
217 | unsigned int ratchet_allowed; | ||
218 | |||
219 | /** | ||
220 | * Number of messages recieved since our last ratchet advance. | ||
221 | * - If this counter = 0, we cannot send a new ratchet key in next msg. | ||
222 | * - If this counter > 0, we can (but don't yet have to) send a new key. | ||
223 | */ | ||
224 | unsigned int ratchet_counter; | ||
225 | |||
226 | }; | ||
227 | |||
228 | |||
229 | /** | ||
230 | * Struct used to save messages in a non-ready tunnel to send once connected. | ||
231 | */ | ||
232 | struct CadetTunnelQueueEntry | ||
233 | { | ||
234 | /** | ||
235 | * We are entries in a DLL | ||
236 | */ | ||
237 | struct CadetTunnelQueueEntry *next; | ||
238 | |||
239 | /** | ||
240 | * We are entries in a DLL | ||
241 | */ | ||
242 | struct CadetTunnelQueueEntry *prev; | ||
243 | |||
244 | /** | ||
245 | * Tunnel these messages belong in. | ||
246 | */ | ||
247 | struct CadetTunnel *t; | ||
248 | |||
249 | /** | ||
250 | * Continuation to call once sent (on the channel layer). | ||
251 | */ | ||
252 | GNUNET_SCHEDULER_TaskCallback cont; | ||
253 | |||
254 | /** | ||
255 | * Closure for @c cont. | ||
256 | */ | ||
257 | void *cont_cls; | ||
258 | |||
259 | /** | ||
260 | * Envelope of message to send follows. | ||
261 | */ | ||
262 | struct GNUNET_MQ_Envelope *env; | ||
263 | |||
264 | /** | ||
265 | * Where to put the connection identifier into the payload | ||
266 | * of the message in @e env once we have it? | ||
267 | */ | ||
268 | struct GNUNET_CADET_ConnectionTunnelIdentifier *cid; | ||
269 | }; | ||
270 | |||
271 | |||
272 | /** | ||
273 | * Struct containing all information regarding a tunnel to a peer. | ||
274 | */ | ||
275 | struct CadetTunnel | ||
276 | { | ||
277 | /** | ||
278 | * Destination of the tunnel. | ||
279 | */ | ||
280 | struct CadetPeer *destination; | ||
281 | |||
282 | /** | ||
283 | * Peer's ephemeral key, to recreate @c e_key and @c d_key when own | ||
284 | * ephemeral key changes. | ||
285 | */ | ||
286 | struct GNUNET_CRYPTO_EcdhePublicKey peers_ephemeral_key; | ||
287 | |||
288 | /** | ||
289 | * Encryption ("our") key. It is only "confirmed" if kx_ctx is NULL. | ||
290 | */ | ||
291 | struct GNUNET_CRYPTO_SymmetricSessionKey e_key; | ||
292 | |||
293 | /** | ||
294 | * Decryption ("their") key. It is only "confirmed" if kx_ctx is NULL. | ||
295 | */ | ||
296 | struct GNUNET_CRYPTO_SymmetricSessionKey d_key; | ||
297 | |||
298 | /** | ||
299 | * Axolotl info. | ||
300 | */ | ||
301 | struct CadetTunnelAxolotl ax; | ||
302 | |||
303 | /** | ||
304 | * State of the tunnel connectivity. | ||
305 | */ | ||
306 | enum CadetTunnelCState cstate; | ||
307 | |||
308 | /** | ||
309 | * State of the tunnel encryption. | ||
310 | */ | ||
311 | enum CadetTunnelEState estate; | ||
312 | |||
313 | /** | ||
314 | * Task to start the rekey process. | ||
315 | */ | ||
316 | struct GNUNET_SCHEDULER_Task *rekey_task; | ||
317 | |||
318 | /** | ||
319 | * Tokenizer for decrypted messages. | ||
320 | */ | ||
321 | struct GNUNET_MessageStreamTokenizer *mst; | ||
322 | |||
323 | /** | ||
324 | * Dispatcher for decrypted messages only (do NOT use for sending!). | ||
325 | */ | ||
326 | struct GNUNET_MQ_Handle *mq; | ||
327 | |||
328 | /** | ||
329 | * DLL of connections that are actively used to reach the destination peer. | ||
330 | */ | ||
331 | struct CadetTConnection *connection_head; | ||
332 | |||
333 | /** | ||
334 | * DLL of connections that are actively used to reach the destination peer. | ||
335 | */ | ||
336 | struct CadetTConnection *connection_tail; | ||
337 | |||
338 | /** | ||
339 | * Channels inside this tunnel. Maps | ||
340 | * `struct GNUNET_CADET_ChannelTunnelNumber` to a `struct CadetChannel`. | ||
341 | */ | ||
342 | struct GNUNET_CONTAINER_MultiHashMap32 *channels; | ||
343 | |||
344 | /** | ||
345 | * Channel ID for the next created channel in this tunnel. | ||
346 | */ | ||
347 | struct GNUNET_CADET_ChannelTunnelNumber next_chid; | ||
348 | |||
349 | /** | ||
350 | * Queued messages, to transmit once tunnel gets connected. | ||
351 | */ | ||
352 | struct CadetTunnelQueueEntry *tq_head; | ||
353 | |||
354 | /** | ||
355 | * Queued messages, to transmit once tunnel gets connected. | ||
356 | */ | ||
357 | struct CadetTunnelQueueEntry *tq_tail; | ||
358 | |||
359 | /** | ||
360 | * Task scheduled if there are no more channels using the tunnel. | ||
361 | */ | ||
362 | struct GNUNET_SCHEDULER_Task *destroy_task; | ||
363 | |||
364 | /** | ||
365 | * Task to trim connections if too many are present. | ||
366 | */ | ||
367 | struct GNUNET_SCHEDULER_Task *maintain_connections_task; | ||
368 | |||
369 | /** | ||
370 | * Ephemeral message in the queue (to avoid queueing more than one). | ||
371 | */ | ||
372 | struct CadetConnectionQueue *ephm_hKILL; | ||
373 | |||
374 | /** | ||
375 | * Pong message in the queue. | ||
376 | */ | ||
377 | struct CadetConnectionQueue *pong_hKILL; | ||
378 | |||
379 | /** | ||
380 | * Number of connections in the @e connection_head DLL. | ||
381 | */ | ||
382 | unsigned int num_connections; | ||
383 | |||
384 | /** | ||
385 | * Number of entries in the @e tq_head DLL. | ||
386 | */ | ||
387 | unsigned int tq_len; | ||
388 | }; | ||
389 | |||
390 | |||
391 | /** | ||
392 | * Get the static string for the peer this tunnel is directed. | ||
393 | * | ||
394 | * @param t Tunnel. | ||
395 | * | ||
396 | * @return Static string the destination peer's ID. | ||
397 | */ | ||
398 | const char * | ||
399 | GCT_2s (const struct CadetTunnel *t) | ||
400 | { | ||
401 | static char buf[64]; | ||
402 | |||
403 | if (NULL == t) | ||
404 | return "T(NULL)"; | ||
405 | |||
406 | GNUNET_snprintf (buf, | ||
407 | sizeof (buf), | ||
408 | "T(%s)", | ||
409 | GCP_2s (t->destination)); | ||
410 | return buf; | ||
411 | } | ||
412 | |||
413 | |||
414 | /** | ||
415 | * Return the peer to which this tunnel goes. | ||
416 | * | ||
417 | * @param t a tunnel | ||
418 | * @return the destination of the tunnel | ||
419 | */ | ||
420 | struct CadetPeer * | ||
421 | GCT_get_destination (struct CadetTunnel *t) | ||
422 | { | ||
423 | return t->destination; | ||
424 | } | ||
425 | |||
426 | |||
427 | /** | ||
428 | * Count channels of a tunnel. | ||
429 | * | ||
430 | * @param t Tunnel on which to count. | ||
431 | * | ||
432 | * @return Number of channels. | ||
433 | */ | ||
434 | unsigned int | ||
435 | GCT_count_channels (struct CadetTunnel *t) | ||
436 | { | ||
437 | return GNUNET_CONTAINER_multihashmap32_size (t->channels); | ||
438 | } | ||
439 | |||
440 | |||
441 | /** | ||
442 | * Lookup a channel by its @a chid. | ||
443 | * | ||
444 | * @param t tunnel to look in | ||
445 | * @param chid number of channel to find | ||
446 | * @return NULL if channel does not exist | ||
447 | */ | ||
448 | struct CadetChannel * | ||
449 | lookup_channel (struct CadetTunnel *t, | ||
450 | struct GNUNET_CADET_ChannelTunnelNumber chid) | ||
451 | { | ||
452 | return GNUNET_CONTAINER_multihashmap32_get (t->channels, | ||
453 | ntohl (chid.cn)); | ||
454 | } | ||
455 | |||
456 | |||
457 | /** | ||
458 | * Count all created connections of a tunnel. Not necessarily ready connections! | ||
459 | * | ||
460 | * @param t Tunnel on which to count. | ||
461 | * | ||
462 | * @return Number of connections created, either being established or ready. | ||
463 | */ | ||
464 | unsigned int | ||
465 | GCT_count_any_connections (struct CadetTunnel *t) | ||
466 | { | ||
467 | return t->num_connections; | ||
468 | } | ||
469 | |||
470 | |||
471 | /** | ||
472 | * Get the connectivity state of a tunnel. | ||
473 | * | ||
474 | * @param t Tunnel. | ||
475 | * | ||
476 | * @return Tunnel's connectivity state. | ||
477 | */ | ||
478 | enum CadetTunnelCState | ||
479 | GCT_get_cstate (struct CadetTunnel *t) | ||
480 | { | ||
481 | return t->cstate; | ||
482 | } | ||
483 | |||
484 | |||
485 | /** | ||
486 | * Get the encryption state of a tunnel. | ||
487 | * | ||
488 | * @param t Tunnel. | ||
489 | * | ||
490 | * @return Tunnel's encryption state. | ||
491 | */ | ||
492 | enum CadetTunnelEState | ||
493 | GCT_get_estate (struct CadetTunnel *t) | ||
494 | { | ||
495 | return t->estate; | ||
496 | } | ||
497 | |||
498 | |||
499 | /** | ||
500 | * Create a new Axolotl ephemeral (ratchet) key. | ||
501 | * | ||
502 | * @param t Tunnel. | ||
503 | */ | ||
504 | static void | ||
505 | new_ephemeral (struct CadetTunnel *t) | ||
506 | { | ||
507 | GNUNET_free_non_null (t->ax.DHRs); | ||
508 | t->ax.DHRs = GNUNET_CRYPTO_ecdhe_key_create (); | ||
509 | } | ||
510 | |||
511 | |||
512 | /* ************************************** start core crypto ***************************** */ | ||
513 | |||
514 | |||
515 | /** | ||
516 | * Calculate HMAC. | ||
517 | * | ||
518 | * @param plaintext Content to HMAC. | ||
519 | * @param size Size of @c plaintext. | ||
520 | * @param iv Initialization vector for the message. | ||
521 | * @param key Key to use. | ||
522 | * @param hmac[out] Destination to store the HMAC. | ||
523 | */ | ||
524 | static void | ||
525 | t_hmac (const void *plaintext, | ||
526 | size_t size, | ||
527 | uint32_t iv, | ||
528 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key, | ||
529 | struct GNUNET_ShortHashCode *hmac) | ||
530 | { | ||
531 | static const char ctx[] = "cadet authentication key"; | ||
532 | struct GNUNET_CRYPTO_AuthKey auth_key; | ||
533 | struct GNUNET_HashCode hash; | ||
534 | |||
535 | GNUNET_CRYPTO_hmac_derive_key (&auth_key, | ||
536 | key, | ||
537 | &iv, sizeof (iv), | ||
538 | key, sizeof (*key), | ||
539 | ctx, sizeof (ctx), | ||
540 | NULL); | ||
541 | /* Two step: CADET_Hash is only 256 bits, HashCode is 512. */ | ||
542 | GNUNET_CRYPTO_hmac (&auth_key, | ||
543 | plaintext, | ||
544 | size, | ||
545 | &hash); | ||
546 | GNUNET_memcpy (hmac, | ||
547 | &hash, | ||
548 | sizeof (*hmac)); | ||
549 | } | ||
550 | |||
551 | |||
552 | /** | ||
553 | * Perform a HMAC. | ||
554 | * | ||
555 | * @param key Key to use. | ||
556 | * @param hash[out] Resulting HMAC. | ||
557 | * @param source Source key material (data to HMAC). | ||
558 | * @param len Length of @a source. | ||
559 | */ | ||
560 | static void | ||
561 | t_ax_hmac_hash (const struct GNUNET_CRYPTO_SymmetricSessionKey *key, | ||
562 | struct GNUNET_HashCode *hash, | ||
563 | const void *source, | ||
564 | unsigned int len) | ||
565 | { | ||
566 | static const char ctx[] = "axolotl HMAC-HASH"; | ||
567 | struct GNUNET_CRYPTO_AuthKey auth_key; | ||
568 | |||
569 | GNUNET_CRYPTO_hmac_derive_key (&auth_key, | ||
570 | key, | ||
571 | ctx, sizeof (ctx), | ||
572 | NULL); | ||
573 | GNUNET_CRYPTO_hmac (&auth_key, | ||
574 | source, | ||
575 | len, | ||
576 | hash); | ||
577 | } | ||
578 | |||
579 | |||
580 | /** | ||
581 | * Derive a symmetric encryption key from an HMAC-HASH. | ||
582 | * | ||
583 | * @param key Key to use for the HMAC. | ||
584 | * @param[out] out Key to generate. | ||
585 | * @param source Source key material (data to HMAC). | ||
586 | * @param len Length of @a source. | ||
587 | */ | ||
588 | static void | ||
589 | t_hmac_derive_key (const struct GNUNET_CRYPTO_SymmetricSessionKey *key, | ||
590 | struct GNUNET_CRYPTO_SymmetricSessionKey *out, | ||
591 | const void *source, | ||
592 | unsigned int len) | ||
593 | { | ||
594 | static const char ctx[] = "axolotl derive key"; | ||
595 | struct GNUNET_HashCode h; | ||
596 | |||
597 | t_ax_hmac_hash (key, | ||
598 | &h, | ||
599 | source, | ||
600 | len); | ||
601 | GNUNET_CRYPTO_kdf (out, sizeof (*out), | ||
602 | ctx, sizeof (ctx), | ||
603 | &h, sizeof (h), | ||
604 | NULL); | ||
605 | } | ||
606 | |||
607 | |||
608 | /** | ||
609 | * Encrypt data with the axolotl tunnel key. | ||
610 | * | ||
611 | * @param t Tunnel whose key to use. | ||
612 | * @param dst Destination with @a size bytes for the encrypted data. | ||
613 | * @param src Source of the plaintext. Can overlap with @c dst, must contain @a size bytes | ||
614 | * @param size Size of the buffers at @a src and @a dst | ||
615 | */ | ||
616 | static void | ||
617 | t_ax_encrypt (struct CadetTunnel *t, | ||
618 | void *dst, | ||
619 | const void *src, | ||
620 | size_t size) | ||
621 | { | ||
622 | struct GNUNET_CRYPTO_SymmetricSessionKey MK; | ||
623 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | ||
624 | struct CadetTunnelAxolotl *ax; | ||
625 | size_t out_size; | ||
626 | |||
627 | ax = &t->ax; | ||
628 | ax->ratchet_counter++; | ||
629 | if ( (GNUNET_YES == ax->ratchet_allowed) && | ||
630 | ( (ratchet_messages <= ax->ratchet_counter) || | ||
631 | (0 == GNUNET_TIME_absolute_get_remaining (ax->ratchet_expiration).rel_value_us)) ) | ||
632 | { | ||
633 | ax->ratchet_flag = GNUNET_YES; | ||
634 | } | ||
635 | if (GNUNET_YES == ax->ratchet_flag) | ||
636 | { | ||
637 | /* Advance ratchet */ | ||
638 | struct GNUNET_CRYPTO_SymmetricSessionKey keys[3]; | ||
639 | struct GNUNET_HashCode dh; | ||
640 | struct GNUNET_HashCode hmac; | ||
641 | static const char ctx[] = "axolotl ratchet"; | ||
642 | |||
643 | new_ephemeral (t); | ||
644 | ax->HKs = ax->NHKs; | ||
645 | |||
646 | /* RK, NHKs, CKs = KDF( HMAC-HASH(RK, DH(DHRs, DHRr)) ) */ | ||
647 | GNUNET_CRYPTO_ecc_ecdh (ax->DHRs, | ||
648 | &ax->DHRr, | ||
649 | &dh); | ||
650 | t_ax_hmac_hash (&ax->RK, | ||
651 | &hmac, | ||
652 | &dh, | ||
653 | sizeof (dh)); | ||
654 | GNUNET_CRYPTO_kdf (keys, sizeof (keys), | ||
655 | ctx, sizeof (ctx), | ||
656 | &hmac, sizeof (hmac), | ||
657 | NULL); | ||
658 | ax->RK = keys[0]; | ||
659 | ax->NHKs = keys[1]; | ||
660 | ax->CKs = keys[2]; | ||
661 | |||
662 | ax->PNs = ax->Ns; | ||
663 | ax->Ns = 0; | ||
664 | ax->ratchet_flag = GNUNET_NO; | ||
665 | ax->ratchet_allowed = GNUNET_NO; | ||
666 | ax->ratchet_counter = 0; | ||
667 | ax->ratchet_expiration | ||
668 | = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), | ||
669 | ratchet_time); | ||
670 | } | ||
671 | |||
672 | t_hmac_derive_key (&ax->CKs, | ||
673 | &MK, | ||
674 | "0", | ||
675 | 1); | ||
676 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, | ||
677 | &MK, | ||
678 | NULL, 0, | ||
679 | NULL); | ||
680 | |||
681 | out_size = GNUNET_CRYPTO_symmetric_encrypt (src, | ||
682 | size, | ||
683 | &MK, | ||
684 | &iv, | ||
685 | dst); | ||
686 | GNUNET_assert (size == out_size); | ||
687 | t_hmac_derive_key (&ax->CKs, | ||
688 | &ax->CKs, | ||
689 | "1", | ||
690 | 1); | ||
691 | } | ||
692 | |||
693 | |||
694 | /** | ||
695 | * Decrypt data with the axolotl tunnel key. | ||
696 | * | ||
697 | * @param t Tunnel whose key to use. | ||
698 | * @param dst Destination for the decrypted data, must contain @a size bytes. | ||
699 | * @param src Source of the ciphertext. Can overlap with @c dst, must contain @a size bytes. | ||
700 | * @param size Size of the @a src and @a dst buffers | ||
701 | */ | ||
702 | static void | ||
703 | t_ax_decrypt (struct CadetTunnel *t, | ||
704 | void *dst, | ||
705 | const void *src, | ||
706 | size_t size) | ||
707 | { | ||
708 | struct GNUNET_CRYPTO_SymmetricSessionKey MK; | ||
709 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | ||
710 | struct CadetTunnelAxolotl *ax; | ||
711 | size_t out_size; | ||
712 | |||
713 | ax = &t->ax; | ||
714 | t_hmac_derive_key (&ax->CKr, | ||
715 | &MK, | ||
716 | "0", | ||
717 | 1); | ||
718 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, | ||
719 | &MK, | ||
720 | NULL, 0, | ||
721 | NULL); | ||
722 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); | ||
723 | out_size = GNUNET_CRYPTO_symmetric_decrypt (src, | ||
724 | size, | ||
725 | &MK, | ||
726 | &iv, | ||
727 | dst); | ||
728 | GNUNET_assert (out_size == size); | ||
729 | t_hmac_derive_key (&ax->CKr, | ||
730 | &ax->CKr, | ||
731 | "1", | ||
732 | 1); | ||
733 | } | ||
734 | |||
735 | |||
736 | /** | ||
737 | * Encrypt header with the axolotl header key. | ||
738 | * | ||
739 | * @param t Tunnel whose key to use. | ||
740 | * @param msg Message whose header to encrypt. | ||
741 | */ | ||
742 | static void | ||
743 | t_h_encrypt (struct CadetTunnel *t, | ||
744 | struct GNUNET_CADET_TunnelEncryptedMessage *msg) | ||
745 | { | ||
746 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | ||
747 | struct CadetTunnelAxolotl *ax; | ||
748 | size_t out_size; | ||
749 | |||
750 | ax = &t->ax; | ||
751 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, | ||
752 | &ax->HKs, | ||
753 | NULL, 0, | ||
754 | NULL); | ||
755 | out_size = GNUNET_CRYPTO_symmetric_encrypt (&msg->Ns, | ||
756 | AX_HEADER_SIZE, | ||
757 | &ax->HKs, | ||
758 | &iv, | ||
759 | &msg->Ns); | ||
760 | GNUNET_assert (AX_HEADER_SIZE == out_size); | ||
761 | } | ||
762 | |||
763 | |||
764 | /** | ||
765 | * Decrypt header with the current axolotl header key. | ||
766 | * | ||
767 | * @param t Tunnel whose current ax HK to use. | ||
768 | * @param src Message whose header to decrypt. | ||
769 | * @param dst Where to decrypt header to. | ||
770 | */ | ||
771 | static void | ||
772 | t_h_decrypt (struct CadetTunnel *t, | ||
773 | const struct GNUNET_CADET_TunnelEncryptedMessage *src, | ||
774 | struct GNUNET_CADET_TunnelEncryptedMessage *dst) | ||
775 | { | ||
776 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | ||
777 | struct CadetTunnelAxolotl *ax; | ||
778 | size_t out_size; | ||
779 | |||
780 | ax = &t->ax; | ||
781 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, | ||
782 | &ax->HKr, | ||
783 | NULL, 0, | ||
784 | NULL); | ||
785 | out_size = GNUNET_CRYPTO_symmetric_decrypt (&src->Ns, | ||
786 | AX_HEADER_SIZE, | ||
787 | &ax->HKr, | ||
788 | &iv, | ||
789 | &dst->Ns); | ||
790 | GNUNET_assert (AX_HEADER_SIZE == out_size); | ||
791 | } | ||
792 | |||
793 | |||
794 | /** | ||
795 | * Delete a key from the list of skipped keys. | ||
796 | * | ||
797 | * @param t Tunnel to delete from. | ||
798 | * @param key Key to delete. | ||
799 | */ | ||
800 | static void | ||
801 | delete_skipped_key (struct CadetTunnel *t, | ||
802 | struct CadetTunnelSkippedKey *key) | ||
803 | { | ||
804 | GNUNET_CONTAINER_DLL_remove (t->ax.skipped_head, | ||
805 | t->ax.skipped_tail, | ||
806 | key); | ||
807 | GNUNET_free (key); | ||
808 | t->ax.skipped--; | ||
809 | } | ||
810 | |||
811 | |||
812 | /** | ||
813 | * Decrypt and verify data with the appropriate tunnel key and verify that the | ||
814 | * data has not been altered since it was sent by the remote peer. | ||
815 | * | ||
816 | * @param t Tunnel whose key to use. | ||
817 | * @param dst Destination for the plaintext. | ||
818 | * @param src Source of the message. Can overlap with @c dst. | ||
819 | * @param size Size of the message. | ||
820 | * @return Size of the decrypted data, -1 if an error was encountered. | ||
821 | */ | ||
822 | static ssize_t | ||
823 | try_old_ax_keys (struct CadetTunnel *t, | ||
824 | void *dst, | ||
825 | const struct GNUNET_CADET_TunnelEncryptedMessage *src, | ||
826 | size_t size) | ||
827 | { | ||
828 | struct CadetTunnelSkippedKey *key; | ||
829 | struct GNUNET_ShortHashCode *hmac; | ||
830 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | ||
831 | struct GNUNET_CADET_TunnelEncryptedMessage plaintext_header; | ||
832 | struct GNUNET_CRYPTO_SymmetricSessionKey *valid_HK; | ||
833 | size_t esize; | ||
834 | size_t res; | ||
835 | size_t len; | ||
836 | unsigned int N; | ||
837 | |||
838 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
839 | "Trying skipped keys\n"); | ||
840 | hmac = &plaintext_header.hmac; | ||
841 | esize = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); | ||
842 | |||
843 | /* Find a correct Header Key */ | ||
844 | valid_HK = NULL; | ||
845 | for (key = t->ax.skipped_head; NULL != key; key = key->next) | ||
846 | { | ||
847 | t_hmac (&src->Ns, | ||
848 | AX_HEADER_SIZE + esize, | ||
849 | 0, | ||
850 | &key->HK, | ||
851 | hmac); | ||
852 | if (0 == memcmp (hmac, | ||
853 | &src->hmac, | ||
854 | sizeof (*hmac))) | ||
855 | { | ||
856 | valid_HK = &key->HK; | ||
857 | break; | ||
858 | } | ||
859 | } | ||
860 | if (NULL == key) | ||
861 | return -1; | ||
862 | |||
863 | /* Should've been checked in -cadet_connection.c handle_cadet_encrypted. */ | ||
864 | GNUNET_assert (size > sizeof (struct GNUNET_CADET_TunnelEncryptedMessage)); | ||
865 | len = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); | ||
866 | GNUNET_assert (len >= sizeof (struct GNUNET_MessageHeader)); | ||
867 | |||
868 | /* Decrypt header */ | ||
869 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, | ||
870 | &key->HK, | ||
871 | NULL, 0, | ||
872 | NULL); | ||
873 | res = GNUNET_CRYPTO_symmetric_decrypt (&src->Ns, | ||
874 | AX_HEADER_SIZE, | ||
875 | &key->HK, | ||
876 | &iv, | ||
877 | &plaintext_header.Ns); | ||
878 | GNUNET_assert (AX_HEADER_SIZE == res); | ||
879 | |||
880 | /* Find the correct message key */ | ||
881 | N = ntohl (plaintext_header.Ns); | ||
882 | while ( (NULL != key) && | ||
883 | (N != key->Kn) ) | ||
884 | key = key->next; | ||
885 | if ( (NULL == key) || | ||
886 | (0 != memcmp (&key->HK, | ||
887 | valid_HK, | ||
888 | sizeof (*valid_HK))) ) | ||
889 | return -1; | ||
890 | |||
891 | /* Decrypt payload */ | ||
892 | GNUNET_CRYPTO_symmetric_derive_iv (&iv, | ||
893 | &key->MK, | ||
894 | NULL, | ||
895 | 0, | ||
896 | NULL); | ||
897 | res = GNUNET_CRYPTO_symmetric_decrypt (&src[1], | ||
898 | len, | ||
899 | &key->MK, | ||
900 | &iv, | ||
901 | dst); | ||
902 | delete_skipped_key (t, | ||
903 | key); | ||
904 | return res; | ||
905 | } | ||
906 | |||
907 | |||
908 | /** | ||
909 | * Delete a key from the list of skipped keys. | ||
910 | * | ||
911 | * @param t Tunnel to delete from. | ||
912 | * @param HKr Header Key to use. | ||
913 | */ | ||
914 | static void | ||
915 | store_skipped_key (struct CadetTunnel *t, | ||
916 | const struct GNUNET_CRYPTO_SymmetricSessionKey *HKr) | ||
917 | { | ||
918 | struct CadetTunnelSkippedKey *key; | ||
919 | |||
920 | key = GNUNET_new (struct CadetTunnelSkippedKey); | ||
921 | key->timestamp = GNUNET_TIME_absolute_get (); | ||
922 | key->Kn = t->ax.Nr; | ||
923 | key->HK = t->ax.HKr; | ||
924 | t_hmac_derive_key (&t->ax.CKr, | ||
925 | &key->MK, | ||
926 | "0", | ||
927 | 1); | ||
928 | t_hmac_derive_key (&t->ax.CKr, | ||
929 | &t->ax.CKr, | ||
930 | "1", | ||
931 | 1); | ||
932 | GNUNET_CONTAINER_DLL_insert (t->ax.skipped_head, | ||
933 | t->ax.skipped_tail, | ||
934 | key); | ||
935 | t->ax.skipped++; | ||
936 | t->ax.Nr++; | ||
937 | } | ||
938 | |||
939 | |||
940 | /** | ||
941 | * Stage skipped AX keys and calculate the message key. | ||
942 | * Stores each HK and MK for skipped messages. | ||
943 | * | ||
944 | * @param t Tunnel where to stage the keys. | ||
945 | * @param HKr Header key. | ||
946 | * @param Np Received meesage number. | ||
947 | * @return #GNUNET_OK if keys were stored. | ||
948 | * #GNUNET_SYSERR if an error ocurred (Np not expected). | ||
949 | */ | ||
950 | static int | ||
951 | store_ax_keys (struct CadetTunnel *t, | ||
952 | const struct GNUNET_CRYPTO_SymmetricSessionKey *HKr, | ||
953 | uint32_t Np) | ||
954 | { | ||
955 | int gap; | ||
956 | |||
957 | gap = Np - t->ax.Nr; | ||
958 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
959 | "Storing skipped keys [%u, %u)\n", | ||
960 | t->ax.Nr, | ||
961 | Np); | ||
962 | if (MAX_KEY_GAP < gap) | ||
963 | { | ||
964 | /* Avoid DoS (forcing peer to do 2^33 chain HMAC operations) */ | ||
965 | /* TODO: start new key exchange on return */ | ||
966 | GNUNET_break_op (0); | ||
967 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
968 | "Got message %u, expected %u+\n", | ||
969 | Np, | ||
970 | t->ax.Nr); | ||
971 | return GNUNET_SYSERR; | ||
972 | } | ||
973 | if (0 > gap) | ||
974 | { | ||
975 | /* Delayed message: don't store keys, flag to try old keys. */ | ||
976 | return GNUNET_SYSERR; | ||
977 | } | ||
978 | |||
979 | while (t->ax.Nr < Np) | ||
980 | store_skipped_key (t, | ||
981 | HKr); | ||
982 | |||
983 | while (t->ax.skipped > MAX_SKIPPED_KEYS) | ||
984 | delete_skipped_key (t, | ||
985 | t->ax.skipped_tail); | ||
986 | return GNUNET_OK; | ||
987 | } | ||
988 | |||
989 | |||
990 | /** | ||
991 | * Decrypt and verify data with the appropriate tunnel key and verify that the | ||
992 | * data has not been altered since it was sent by the remote peer. | ||
993 | * | ||
994 | * @param t Tunnel whose key to use. | ||
995 | * @param dst Destination for the plaintext. | ||
996 | * @param src Source of the message. Can overlap with @c dst. | ||
997 | * @param size Size of the message. | ||
998 | * @return Size of the decrypted data, -1 if an error was encountered. | ||
999 | */ | ||
1000 | static ssize_t | ||
1001 | t_ax_decrypt_and_validate (struct CadetTunnel *t, | ||
1002 | void *dst, | ||
1003 | const struct GNUNET_CADET_TunnelEncryptedMessage *src, | ||
1004 | size_t size) | ||
1005 | { | ||
1006 | struct CadetTunnelAxolotl *ax; | ||
1007 | struct GNUNET_ShortHashCode msg_hmac; | ||
1008 | struct GNUNET_HashCode hmac; | ||
1009 | struct GNUNET_CADET_TunnelEncryptedMessage plaintext_header; | ||
1010 | uint32_t Np; | ||
1011 | uint32_t PNp; | ||
1012 | size_t esize; /* Size of encryped payload */ | ||
1013 | |||
1014 | esize = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); | ||
1015 | ax = &t->ax; | ||
1016 | |||
1017 | /* Try current HK */ | ||
1018 | t_hmac (&src->Ns, | ||
1019 | AX_HEADER_SIZE + esize, | ||
1020 | 0, &ax->HKr, | ||
1021 | &msg_hmac); | ||
1022 | if (0 != memcmp (&msg_hmac, | ||
1023 | &src->hmac, | ||
1024 | sizeof (msg_hmac))) | ||
1025 | { | ||
1026 | static const char ctx[] = "axolotl ratchet"; | ||
1027 | struct GNUNET_CRYPTO_SymmetricSessionKey keys[3]; /* RKp, NHKp, CKp */ | ||
1028 | struct GNUNET_CRYPTO_SymmetricSessionKey HK; | ||
1029 | struct GNUNET_HashCode dh; | ||
1030 | struct GNUNET_CRYPTO_EcdhePublicKey *DHRp; | ||
1031 | |||
1032 | /* Try Next HK */ | ||
1033 | t_hmac (&src->Ns, | ||
1034 | AX_HEADER_SIZE + esize, | ||
1035 | 0, | ||
1036 | &ax->NHKr, | ||
1037 | &msg_hmac); | ||
1038 | if (0 != memcmp (&msg_hmac, | ||
1039 | &src->hmac, | ||
1040 | sizeof (msg_hmac))) | ||
1041 | { | ||
1042 | /* Try the skipped keys, if that fails, we're out of luck. */ | ||
1043 | return try_old_ax_keys (t, | ||
1044 | dst, | ||
1045 | src, | ||
1046 | size); | ||
1047 | } | ||
1048 | HK = ax->HKr; | ||
1049 | ax->HKr = ax->NHKr; | ||
1050 | t_h_decrypt (t, | ||
1051 | src, | ||
1052 | &plaintext_header); | ||
1053 | Np = ntohl (plaintext_header.Ns); | ||
1054 | PNp = ntohl (plaintext_header.PNs); | ||
1055 | DHRp = &plaintext_header.DHRs; | ||
1056 | store_ax_keys (t, | ||
1057 | &HK, | ||
1058 | PNp); | ||
1059 | |||
1060 | /* RKp, NHKp, CKp = KDF (HMAC-HASH (RK, DH (DHRp, DHRs))) */ | ||
1061 | GNUNET_CRYPTO_ecc_ecdh (ax->DHRs, | ||
1062 | DHRp, | ||
1063 | &dh); | ||
1064 | t_ax_hmac_hash (&ax->RK, | ||
1065 | &hmac, | ||
1066 | &dh, sizeof (dh)); | ||
1067 | GNUNET_CRYPTO_kdf (keys, sizeof (keys), | ||
1068 | ctx, sizeof (ctx), | ||
1069 | &hmac, sizeof (hmac), | ||
1070 | NULL); | ||
1071 | |||
1072 | /* Commit "purported" keys */ | ||
1073 | ax->RK = keys[0]; | ||
1074 | ax->NHKr = keys[1]; | ||
1075 | ax->CKr = keys[2]; | ||
1076 | ax->DHRr = *DHRp; | ||
1077 | ax->Nr = 0; | ||
1078 | ax->ratchet_allowed = GNUNET_YES; | ||
1079 | } | ||
1080 | else | ||
1081 | { | ||
1082 | t_h_decrypt (t, | ||
1083 | src, | ||
1084 | &plaintext_header); | ||
1085 | Np = ntohl (plaintext_header.Ns); | ||
1086 | PNp = ntohl (plaintext_header.PNs); | ||
1087 | } | ||
1088 | if ( (Np != ax->Nr) && | ||
1089 | (GNUNET_OK != store_ax_keys (t, | ||
1090 | &ax->HKr, | ||
1091 | Np)) ) | ||
1092 | { | ||
1093 | /* Try the skipped keys, if that fails, we're out of luck. */ | ||
1094 | return try_old_ax_keys (t, | ||
1095 | dst, | ||
1096 | src, | ||
1097 | size); | ||
1098 | } | ||
1099 | |||
1100 | t_ax_decrypt (t, | ||
1101 | dst, | ||
1102 | &src[1], | ||
1103 | esize); | ||
1104 | ax->Nr = Np + 1; | ||
1105 | return esize; | ||
1106 | } | ||
1107 | |||
1108 | |||
1109 | /** | ||
1110 | * Send a KX message. | ||
1111 | * | ||
1112 | * FIXME: does not take care of sender-authentication yet! | ||
1113 | * | ||
1114 | * @param t Tunnel on which to send it. | ||
1115 | * @param force_reply Force the other peer to reply with a KX message. | ||
1116 | */ | ||
1117 | static void | ||
1118 | send_kx (struct CadetTunnel *t, | ||
1119 | int force_reply) | ||
1120 | { | ||
1121 | struct CadetTunnelAxolotl *ax = &t->ax; | ||
1122 | struct CadetConnection *c; | ||
1123 | struct GNUNET_MQ_Envelope *env; | ||
1124 | struct GNUNET_CADET_TunnelKeyExchangeMessage *msg; | ||
1125 | enum GNUNET_CADET_KX_Flags flags; | ||
1126 | |||
1127 | #if FIXME | ||
1128 | if (NULL != t->ephm_h) | ||
1129 | { | ||
1130 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1131 | " already queued, nop\n"); | ||
1132 | return; | ||
1133 | } | ||
1134 | #endif | ||
1135 | c = NULL; // FIXME: figure out where to transmit... | ||
1136 | |||
1137 | // GNUNET_assert (GNUNET_NO == GCT_is_loopback (t)); | ||
1138 | env = GNUNET_MQ_msg (msg, | ||
1139 | GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX); | ||
1140 | flags = GNUNET_CADET_KX_FLAG_NONE; | ||
1141 | if (GNUNET_YES == force_reply) | ||
1142 | flags |= GNUNET_CADET_KX_FLAG_FORCE_REPLY; | ||
1143 | msg->flags = htonl (flags); | ||
1144 | msg->cid = *GCC_get_id (c); | ||
1145 | GNUNET_CRYPTO_ecdhe_key_get_public (ax->kx_0, | ||
1146 | &msg->ephemeral_key); | ||
1147 | GNUNET_CRYPTO_ecdhe_key_get_public (ax->DHRs, | ||
1148 | &msg->ratchet_key); | ||
1149 | |||
1150 | // FIXME: send 'env'. | ||
1151 | #if FIXME | ||
1152 | t->ephm_h = GCC_send_prebuilt_message (&msg.header, | ||
1153 | UINT16_MAX, | ||
1154 | zero, | ||
1155 | c, | ||
1156 | GCC_is_origin (c, GNUNET_YES), | ||
1157 | GNUNET_YES, &ephm_sent, t); | ||
1158 | if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) | ||
1159 | GCT_change_estate (t, CADET_TUNNEL_KEY_SENT); | ||
1160 | #endif | ||
1161 | } | ||
1162 | |||
1163 | |||
1164 | /** | ||
1165 | * Handle KX message. | ||
1166 | * | ||
1167 | * FIXME: sender-authentication in KX is missing! | ||
1168 | * | ||
1169 | * @param ct connection/tunnel combo that received encrypted message | ||
1170 | * @param msg the key exchange message | ||
1171 | */ | ||
1172 | void | ||
1173 | GCT_handle_kx (struct CadetTConnection *ct, | ||
1174 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) | ||
1175 | { | ||
1176 | struct CadetTunnel *t = ct->t; | ||
1177 | struct CadetTunnelAxolotl *ax = &t->ax; | ||
1178 | struct GNUNET_HashCode key_material[3]; | ||
1179 | struct GNUNET_CRYPTO_SymmetricSessionKey keys[5]; | ||
1180 | const char salt[] = "CADET Axolotl salt"; | ||
1181 | const struct GNUNET_PeerIdentity *pid; | ||
1182 | int am_I_alice; | ||
1183 | |||
1184 | pid = GCP_get_id (t->destination); | ||
1185 | if (0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, | ||
1186 | pid)) | ||
1187 | am_I_alice = GNUNET_YES; | ||
1188 | else if (0 < GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, | ||
1189 | pid)) | ||
1190 | am_I_alice = GNUNET_NO; | ||
1191 | else | ||
1192 | { | ||
1193 | GNUNET_break_op (0); | ||
1194 | return; | ||
1195 | } | ||
1196 | |||
1197 | if (0 != (GNUNET_CADET_KX_FLAG_FORCE_REPLY & ntohl (msg->flags))) | ||
1198 | { | ||
1199 | if (NULL != t->rekey_task) | ||
1200 | { | ||
1201 | GNUNET_SCHEDULER_cancel (t->rekey_task); | ||
1202 | t->rekey_task = NULL; | ||
1203 | } | ||
1204 | send_kx (t, | ||
1205 | GNUNET_NO); | ||
1206 | } | ||
1207 | |||
1208 | if (0 == memcmp (&ax->DHRr, | ||
1209 | &msg->ratchet_key, | ||
1210 | sizeof (msg->ratchet_key))) | ||
1211 | { | ||
1212 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1213 | " known ratchet key, exit\n"); | ||
1214 | return; | ||
1215 | } | ||
1216 | |||
1217 | ax->DHRr = msg->ratchet_key; | ||
1218 | |||
1219 | /* ECDH A B0 */ | ||
1220 | if (GNUNET_YES == am_I_alice) | ||
1221 | { | ||
1222 | GNUNET_CRYPTO_eddsa_ecdh (my_private_key, /* A */ | ||
1223 | &msg->ephemeral_key, /* B0 */ | ||
1224 | &key_material[0]); | ||
1225 | } | ||
1226 | else | ||
1227 | { | ||
1228 | GNUNET_CRYPTO_ecdh_eddsa (ax->kx_0, /* B0 */ | ||
1229 | &pid->public_key, /* A */ | ||
1230 | &key_material[0]); | ||
1231 | } | ||
1232 | |||
1233 | /* ECDH A0 B */ | ||
1234 | if (GNUNET_YES == am_I_alice) | ||
1235 | { | ||
1236 | GNUNET_CRYPTO_ecdh_eddsa (ax->kx_0, /* A0 */ | ||
1237 | &pid->public_key, /* B */ | ||
1238 | &key_material[1]); | ||
1239 | } | ||
1240 | else | ||
1241 | { | ||
1242 | GNUNET_CRYPTO_eddsa_ecdh (my_private_key, /* A */ | ||
1243 | &msg->ephemeral_key, /* B0 */ | ||
1244 | &key_material[1]); | ||
1245 | |||
1246 | |||
1247 | } | ||
1248 | |||
1249 | /* ECDH A0 B0 */ | ||
1250 | /* (This is the triple-DH, we could probably safely skip this, | ||
1251 | as A0/B0 are already in the key material.) */ | ||
1252 | GNUNET_CRYPTO_ecc_ecdh (ax->kx_0, /* A0 or B0 */ | ||
1253 | &msg->ephemeral_key, /* B0 or A0 */ | ||
1254 | &key_material[2]); | ||
1255 | |||
1256 | /* KDF */ | ||
1257 | GNUNET_CRYPTO_kdf (keys, sizeof (keys), | ||
1258 | salt, sizeof (salt), | ||
1259 | &key_material, sizeof (key_material), | ||
1260 | NULL); | ||
1261 | |||
1262 | if (0 == memcmp (&ax->RK, | ||
1263 | &keys[0], | ||
1264 | sizeof (ax->RK))) | ||
1265 | { | ||
1266 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1267 | " known handshake key, exit\n"); | ||
1268 | return; | ||
1269 | } | ||
1270 | ax->RK = keys[0]; | ||
1271 | if (GNUNET_YES == am_I_alice) | ||
1272 | { | ||
1273 | ax->HKr = keys[1]; | ||
1274 | ax->NHKs = keys[2]; | ||
1275 | ax->NHKr = keys[3]; | ||
1276 | ax->CKr = keys[4]; | ||
1277 | ax->ratchet_flag = GNUNET_YES; | ||
1278 | } | ||
1279 | else | ||
1280 | { | ||
1281 | ax->HKs = keys[1]; | ||
1282 | ax->NHKr = keys[2]; | ||
1283 | ax->NHKs = keys[3]; | ||
1284 | ax->CKs = keys[4]; | ||
1285 | ax->ratchet_flag = GNUNET_NO; | ||
1286 | ax->ratchet_allowed = GNUNET_NO; | ||
1287 | ax->ratchet_counter = 0; | ||
1288 | ax->ratchet_expiration | ||
1289 | = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), | ||
1290 | ratchet_time); | ||
1291 | } | ||
1292 | ax->PNs = 0; | ||
1293 | ax->Nr = 0; | ||
1294 | ax->Ns = 0; | ||
1295 | |||
1296 | #if FIXME | ||
1297 | /* After KX is done, update state machine and begin transmissions... */ | ||
1298 | GCT_change_estate (t, | ||
1299 | CADET_TUNNEL_KEY_PING); | ||
1300 | send_queued_data (t); | ||
1301 | #endif | ||
1302 | } | ||
1303 | |||
1304 | |||
1305 | /* ************************************** end core crypto ***************************** */ | ||
1306 | |||
1307 | |||
1308 | /** | ||
1309 | * Add a channel to a tunnel. | ||
1310 | * | ||
1311 | * @param t Tunnel. | ||
1312 | * @param ch Channel | ||
1313 | * @return unique number identifying @a ch within @a t | ||
1314 | */ | ||
1315 | struct GNUNET_CADET_ChannelTunnelNumber | ||
1316 | GCT_add_channel (struct CadetTunnel *t, | ||
1317 | struct CadetChannel *ch) | ||
1318 | { | ||
1319 | struct GNUNET_CADET_ChannelTunnelNumber ret; | ||
1320 | uint32_t chid; | ||
1321 | |||
1322 | chid = ntohl (t->next_chid.cn); | ||
1323 | while (NULL != | ||
1324 | GNUNET_CONTAINER_multihashmap32_get (t->channels, | ||
1325 | chid)) | ||
1326 | chid++; | ||
1327 | GNUNET_assert (GNUNET_YES == | ||
1328 | GNUNET_CONTAINER_multihashmap32_put (t->channels, | ||
1329 | chid, | ||
1330 | ch, | ||
1331 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
1332 | t->next_chid.cn = htonl (chid + 1); | ||
1333 | ret.cn = htonl (chid); | ||
1334 | return ret; | ||
1335 | } | ||
1336 | |||
1337 | |||
1338 | /** | ||
1339 | * This tunnel is no longer used, destroy it. | ||
1340 | * | ||
1341 | * @param cls the idle tunnel | ||
1342 | */ | ||
1343 | static void | ||
1344 | destroy_tunnel (void *cls) | ||
1345 | { | ||
1346 | struct CadetTunnel *t = cls; | ||
1347 | struct CadetTConnection *ct; | ||
1348 | struct CadetTunnelQueueEntry *tqe; | ||
1349 | |||
1350 | t->destroy_task = NULL; | ||
1351 | GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap32_size (t->channels)); | ||
1352 | while (NULL != (ct = t->connection_head)) | ||
1353 | { | ||
1354 | GNUNET_assert (ct->t == t); | ||
1355 | GNUNET_CONTAINER_DLL_remove (t->connection_head, | ||
1356 | t->connection_tail, | ||
1357 | ct); | ||
1358 | GCC_destroy (ct->cc); | ||
1359 | GNUNET_free (ct); | ||
1360 | } | ||
1361 | while (NULL != (tqe = t->tq_head)) | ||
1362 | { | ||
1363 | GNUNET_CONTAINER_DLL_remove (t->tq_head, | ||
1364 | t->tq_tail, | ||
1365 | tqe); | ||
1366 | GNUNET_MQ_discard (tqe->env); | ||
1367 | GNUNET_free (tqe); | ||
1368 | } | ||
1369 | GCP_drop_tunnel (t->destination, | ||
1370 | t); | ||
1371 | GNUNET_CONTAINER_multihashmap32_destroy (t->channels); | ||
1372 | if (NULL != t->maintain_connections_task) | ||
1373 | { | ||
1374 | GNUNET_SCHEDULER_cancel (t->maintain_connections_task); | ||
1375 | t->maintain_connections_task = NULL; | ||
1376 | } | ||
1377 | GNUNET_MST_destroy (t->mst); | ||
1378 | GNUNET_MQ_destroy (t->mq); | ||
1379 | GNUNET_free (t); | ||
1380 | } | ||
1381 | |||
1382 | |||
1383 | /** | ||
1384 | * A connection is @a is_ready for transmission. Looks at our message | ||
1385 | * queue and if there is a message, sends it out via the connection. | ||
1386 | * | ||
1387 | * @param cls the `struct CadetTConnection` that is @a is_ready | ||
1388 | * @param is_ready #GNUNET_YES if connection are now ready, | ||
1389 | * #GNUNET_NO if connection are no longer ready | ||
1390 | */ | ||
1391 | static void | ||
1392 | connection_ready_cb (void *cls, | ||
1393 | int is_ready) | ||
1394 | { | ||
1395 | struct CadetTConnection *ct = cls; | ||
1396 | struct CadetTunnel *t = ct->t; | ||
1397 | struct CadetTunnelQueueEntry *tq = t->tq_head; | ||
1398 | |||
1399 | if (GNUNET_NO == ct->is_ready) | ||
1400 | { | ||
1401 | ct->is_ready = GNUNET_NO; | ||
1402 | return; | ||
1403 | } | ||
1404 | ct->is_ready = GNUNET_YES; | ||
1405 | if (NULL == tq) | ||
1406 | return; /* no messages pending right now */ | ||
1407 | |||
1408 | /* ready to send message 'tq' on tunnel 'ct' */ | ||
1409 | GNUNET_assert (t == tq->t); | ||
1410 | GNUNET_CONTAINER_DLL_remove (t->tq_head, | ||
1411 | t->tq_tail, | ||
1412 | tq); | ||
1413 | if (NULL != tq->cid) | ||
1414 | *tq->cid = *GCC_get_id (ct->cc); | ||
1415 | ct->is_ready = GNUNET_NO; | ||
1416 | GCC_transmit (ct->cc, | ||
1417 | tq->env); | ||
1418 | tq->cont (tq->cont_cls); | ||
1419 | GNUNET_free (tq); | ||
1420 | } | ||
1421 | |||
1422 | |||
1423 | /** | ||
1424 | * Called when either we have a new connection, or a new message in the | ||
1425 | * queue, or some existing connection has transmission capacity. Looks | ||
1426 | * at our message queue and if there is a message, picks a connection | ||
1427 | * to send it on. | ||
1428 | * | ||
1429 | * FIXME: yuck... Need better selection logic! | ||
1430 | * | ||
1431 | * @param t tunnel to process messages on | ||
1432 | */ | ||
1433 | static void | ||
1434 | trigger_transmissions (struct CadetTunnel *t) | ||
1435 | { | ||
1436 | struct CadetTConnection *ct; | ||
1437 | |||
1438 | if (NULL == t->tq_head) | ||
1439 | return; /* no messages pending right now */ | ||
1440 | for (ct = t->connection_head; | ||
1441 | NULL != ct; | ||
1442 | ct = ct->next) | ||
1443 | if (GNUNET_YES == ct->is_ready) | ||
1444 | break; | ||
1445 | if (NULL == ct) | ||
1446 | return; /* no connections ready */ | ||
1447 | |||
1448 | /* FIXME: a bit hackish to do it like this... */ | ||
1449 | connection_ready_cb (ct, | ||
1450 | GNUNET_YES); | ||
1451 | } | ||
1452 | |||
1453 | |||
1454 | /** | ||
1455 | * Function called to maintain the connections underlying our tunnel. | ||
1456 | * Tries to maintain (incl. tear down) connections for the tunnel, and | ||
1457 | * if there is a significant change, may trigger transmissions. | ||
1458 | * | ||
1459 | * Basically, needs to check if there are connections that perform | ||
1460 | * badly, and if so eventually kill them and trigger a replacement. | ||
1461 | * The strategy is to open one more connection than | ||
1462 | * #DESIRED_CONNECTIONS_PER_TUNNEL, and then periodically kick out the | ||
1463 | * least-performing one, and then inquire for new ones. | ||
1464 | * | ||
1465 | * @param cls the `struct CadetTunnel` | ||
1466 | */ | ||
1467 | static void | ||
1468 | maintain_connections_cb (void *cls) | ||
1469 | { | ||
1470 | struct CadetTunnel *t = cls; | ||
1471 | |||
1472 | GNUNET_break (0); // FIXME: implement! | ||
1473 | } | ||
1474 | |||
1475 | |||
1476 | /** | ||
1477 | * Consider using the path @a p for the tunnel @a t. | ||
1478 | * The tunnel destination is at offset @a off in path @a p. | ||
1479 | * | ||
1480 | * @param cls our tunnel | ||
1481 | * @param path a path to our destination | ||
1482 | * @param off offset of the destination on path @a path | ||
1483 | * @return #GNUNET_YES (should keep iterating) | ||
1484 | */ | ||
1485 | static int | ||
1486 | consider_path_cb (void *cls, | ||
1487 | struct CadetPeerPath *path, | ||
1488 | unsigned int off) | ||
1489 | { | ||
1490 | struct CadetTunnel *t = cls; | ||
1491 | unsigned int min_length = UINT_MAX; | ||
1492 | GNUNET_CONTAINER_HeapCostType max_desire = 0; | ||
1493 | struct CadetTConnection *ct; | ||
1494 | |||
1495 | /* Check if we care about the new path. */ | ||
1496 | for (ct = t->connection_head; | ||
1497 | NULL != ct; | ||
1498 | ct = ct->next) | ||
1499 | { | ||
1500 | struct CadetPeerPath *ps; | ||
1501 | |||
1502 | ps = GCC_get_path (ct->cc); | ||
1503 | if (ps == path) | ||
1504 | return GNUNET_YES; /* duplicate */ | ||
1505 | min_length = GNUNET_MIN (min_length, | ||
1506 | GCPP_get_length (ps)); | ||
1507 | max_desire = GNUNET_MAX (max_desire, | ||
1508 | GCPP_get_desirability (ps)); | ||
1509 | } | ||
1510 | |||
1511 | /* FIXME: not sure we should really just count | ||
1512 | 'num_connections' here, as they may all have | ||
1513 | consistently failed to connect. */ | ||
1514 | |||
1515 | /* We iterate by increasing path length; if we have enough paths and | ||
1516 | this one is more than twice as long than what we are currently | ||
1517 | using, then ignore all of these super-long ones! */ | ||
1518 | if ( (t->num_connections > DESIRED_CONNECTIONS_PER_TUNNEL) && | ||
1519 | (min_length * 2 < off) ) | ||
1520 | { | ||
1521 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1522 | "Ignoring paths of length %u, they are way too long.\n", | ||
1523 | min_length * 2); | ||
1524 | return GNUNET_NO; | ||
1525 | } | ||
1526 | /* If we have enough paths and this one looks no better, ignore it. */ | ||
1527 | if ( (t->num_connections >= DESIRED_CONNECTIONS_PER_TUNNEL) && | ||
1528 | (min_length < GCPP_get_length (path)) && | ||
1529 | (max_desire > GCPP_get_desirability (path)) ) | ||
1530 | { | ||
1531 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1532 | "Ignoring path (%u/%llu) to %s, got something better already.\n", | ||
1533 | GCPP_get_length (path), | ||
1534 | (unsigned long long) GCPP_get_desirability (path), | ||
1535 | GCP_2s (t->destination)); | ||
1536 | return GNUNET_YES; | ||
1537 | } | ||
1538 | |||
1539 | /* Path is interesting (better by some metric, or we don't have | ||
1540 | enough paths yet). */ | ||
1541 | ct = GNUNET_new (struct CadetTConnection); | ||
1542 | ct->created = GNUNET_TIME_absolute_get (); | ||
1543 | ct->t = t; | ||
1544 | ct->cc = GCC_create (t->destination, | ||
1545 | path, | ||
1546 | ct, | ||
1547 | &connection_ready_cb, | ||
1548 | ct); | ||
1549 | /* FIXME: schedule job to kill connection (and path?) if it takes | ||
1550 | too long to get ready! (And track performance data on how long | ||
1551 | other connections took with the tunnel!) | ||
1552 | => Note: to be done within 'connection'-logic! */ | ||
1553 | GNUNET_CONTAINER_DLL_insert (t->connection_head, | ||
1554 | t->connection_tail, | ||
1555 | ct); | ||
1556 | t->num_connections++; | ||
1557 | return GNUNET_YES; | ||
1558 | } | ||
1559 | |||
1560 | |||
1561 | /** | ||
1562 | * Consider using the path @a p for the tunnel @a t. | ||
1563 | * The tunnel destination is at offset @a off in path @a p. | ||
1564 | * | ||
1565 | * @param cls our tunnel | ||
1566 | * @param path a path to our destination | ||
1567 | * @param off offset of the destination on path @a path | ||
1568 | */ | ||
1569 | void | ||
1570 | GCT_consider_path (struct CadetTunnel *t, | ||
1571 | struct CadetPeerPath *p, | ||
1572 | unsigned int off) | ||
1573 | { | ||
1574 | (void) consider_path_cb (t, | ||
1575 | p, | ||
1576 | off); | ||
1577 | } | ||
1578 | |||
1579 | |||
1580 | /** | ||
1581 | * | ||
1582 | * | ||
1583 | * @param cls the `struct CadetTunnel` for which we decrypted the message | ||
1584 | * @param msg the message we received on the tunnel | ||
1585 | */ | ||
1586 | static void | ||
1587 | handle_plaintext_keepalive (void *cls, | ||
1588 | const struct GNUNET_MessageHeader *msg) | ||
1589 | { | ||
1590 | struct CadetTunnel *t = cls; | ||
1591 | GNUNET_break (0); // FIXME | ||
1592 | } | ||
1593 | |||
1594 | |||
1595 | /** | ||
1596 | * Check that @a msg is well-formed. | ||
1597 | * | ||
1598 | * @param cls the `struct CadetTunnel` for which we decrypted the message | ||
1599 | * @param msg the message we received on the tunnel | ||
1600 | * @return #GNUNET_OK (any variable-size payload goes) | ||
1601 | */ | ||
1602 | static int | ||
1603 | check_plaintext_data (void *cls, | ||
1604 | const struct GNUNET_CADET_ChannelAppDataMessage *msg) | ||
1605 | { | ||
1606 | return GNUNET_OK; | ||
1607 | } | ||
1608 | |||
1609 | |||
1610 | /** | ||
1611 | * | ||
1612 | * | ||
1613 | * @param cls the `struct CadetTunnel` for which we decrypted the message | ||
1614 | * @param msg the message we received on the tunnel | ||
1615 | */ | ||
1616 | static void | ||
1617 | handle_plaintext_data (void *cls, | ||
1618 | const struct GNUNET_CADET_ChannelAppDataMessage *msg) | ||
1619 | { | ||
1620 | struct CadetTunnel *t = cls; | ||
1621 | GNUNET_break (0); // FIXME! | ||
1622 | } | ||
1623 | |||
1624 | |||
1625 | /** | ||
1626 | * | ||
1627 | * | ||
1628 | * @param cls the `struct CadetTunnel` for which we decrypted the message | ||
1629 | * @param ack the message we received on the tunnel | ||
1630 | */ | ||
1631 | static void | ||
1632 | handle_plaintext_data_ack (void *cls, | ||
1633 | const struct GNUNET_CADET_ChannelDataAckMessage *ack) | ||
1634 | { | ||
1635 | struct CadetTunnel *t = cls; | ||
1636 | GNUNET_break (0); // FIXME! | ||
1637 | } | ||
1638 | |||
1639 | |||
1640 | /** | ||
1641 | * | ||
1642 | * | ||
1643 | * @param cls the `struct CadetTunnel` for which we decrypted the message | ||
1644 | * @param cc the message we received on the tunnel | ||
1645 | */ | ||
1646 | static void | ||
1647 | handle_plaintext_channel_create (void *cls, | ||
1648 | const struct GNUNET_CADET_ChannelOpenMessage *cc) | ||
1649 | { | ||
1650 | struct CadetTunnel *t = cls; | ||
1651 | GNUNET_break (0); // FIXME! | ||
1652 | } | ||
1653 | |||
1654 | |||
1655 | /** | ||
1656 | * | ||
1657 | * | ||
1658 | * @param cls the `struct CadetTunnel` for which we decrypted the message | ||
1659 | * @param cm the message we received on the tunnel | ||
1660 | */ | ||
1661 | static void | ||
1662 | handle_plaintext_channel_nack (void *cls, | ||
1663 | const struct GNUNET_CADET_ChannelManageMessage *cm) | ||
1664 | { | ||
1665 | struct CadetTunnel *t = cls; | ||
1666 | GNUNET_break (0); // FIXME! | ||
1667 | } | ||
1668 | |||
1669 | |||
1670 | /** | ||
1671 | * | ||
1672 | * | ||
1673 | * @param cls the `struct CadetTunnel` for which we decrypted the message | ||
1674 | * @param cm the message we received on the tunnel | ||
1675 | */ | ||
1676 | static void | ||
1677 | handle_plaintext_channel_ack (void *cls, | ||
1678 | const struct GNUNET_CADET_ChannelManageMessage *cm) | ||
1679 | { | ||
1680 | struct CadetTunnel *t = cls; | ||
1681 | GNUNET_break (0); // FIXME! | ||
1682 | } | ||
1683 | |||
1684 | |||
1685 | /** | ||
1686 | * We received a message saying that a channel should be destroyed. | ||
1687 | * Pass it on to the correct channel. | ||
1688 | * | ||
1689 | * @param cls the `struct CadetTunnel` for which we decrypted the message | ||
1690 | * @param cm the message we received on the tunnel | ||
1691 | */ | ||
1692 | static void | ||
1693 | handle_plaintext_channel_destroy (void *cls, | ||
1694 | const struct GNUNET_CADET_ChannelManageMessage *cm) | ||
1695 | { | ||
1696 | struct CadetTunnel *t = cls; | ||
1697 | struct CadetChannel *cc = lookup_channel (t, | ||
1698 | cm->chid); | ||
1699 | |||
1700 | GCCH_channel_remote_destroy (cc); | ||
1701 | } | ||
1702 | |||
1703 | |||
1704 | /** | ||
1705 | * Handles a message we decrypted, by injecting it into | ||
1706 | * our message queue (which will do the dispatching). | ||
1707 | * | ||
1708 | * @param cls the `struct CadetTunnel` that got the message | ||
1709 | * @param msg the message | ||
1710 | * @return #GNUNET_OK (continue to process) | ||
1711 | */ | ||
1712 | static int | ||
1713 | handle_decrypted (void *cls, | ||
1714 | const struct GNUNET_MessageHeader *msg) | ||
1715 | { | ||
1716 | struct CadetTunnel *t = cls; | ||
1717 | |||
1718 | GNUNET_MQ_inject_message (t->mq, | ||
1719 | msg); | ||
1720 | return GNUNET_OK; | ||
1721 | } | ||
1722 | |||
1723 | |||
1724 | /** | ||
1725 | * Function called if we had an error processing | ||
1726 | * an incoming decrypted message. | ||
1727 | * | ||
1728 | * @param cls the `struct CadetTunnel` | ||
1729 | * @param error error code | ||
1730 | */ | ||
1731 | static void | ||
1732 | decrypted_error_cb (void *cls, | ||
1733 | enum GNUNET_MQ_Error error) | ||
1734 | { | ||
1735 | GNUNET_break_op (0); | ||
1736 | } | ||
1737 | |||
1738 | |||
1739 | /** | ||
1740 | * Create a tunnel to @a destionation. Must only be called | ||
1741 | * from within #GCP_get_tunnel(). | ||
1742 | * | ||
1743 | * @param destination where to create the tunnel to | ||
1744 | * @return new tunnel to @a destination | ||
1745 | */ | ||
1746 | struct CadetTunnel * | ||
1747 | GCT_create_tunnel (struct CadetPeer *destination) | ||
1748 | { | ||
1749 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
1750 | GNUNET_MQ_hd_fixed_size (plaintext_keepalive, | ||
1751 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE, | ||
1752 | struct GNUNET_MessageHeader, | ||
1753 | NULL), | ||
1754 | GNUNET_MQ_hd_var_size (plaintext_data, | ||
1755 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA, | ||
1756 | struct GNUNET_CADET_ChannelAppDataMessage, | ||
1757 | NULL), | ||
1758 | GNUNET_MQ_hd_fixed_size (plaintext_data_ack, | ||
1759 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK, | ||
1760 | struct GNUNET_CADET_ChannelDataAckMessage, | ||
1761 | NULL), | ||
1762 | GNUNET_MQ_hd_fixed_size (plaintext_channel_create, | ||
1763 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN, | ||
1764 | struct GNUNET_CADET_ChannelOpenMessage, | ||
1765 | NULL), | ||
1766 | GNUNET_MQ_hd_fixed_size (plaintext_channel_nack, | ||
1767 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED, | ||
1768 | struct GNUNET_CADET_ChannelManageMessage, | ||
1769 | NULL), | ||
1770 | GNUNET_MQ_hd_fixed_size (plaintext_channel_ack, | ||
1771 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK, | ||
1772 | struct GNUNET_CADET_ChannelManageMessage, | ||
1773 | NULL), | ||
1774 | GNUNET_MQ_hd_fixed_size (plaintext_channel_destroy, | ||
1775 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, | ||
1776 | struct GNUNET_CADET_ChannelManageMessage, | ||
1777 | NULL), | ||
1778 | GNUNET_MQ_handler_end () | ||
1779 | }; | ||
1780 | struct CadetTunnel *t; | ||
1781 | |||
1782 | t = GNUNET_new (struct CadetTunnel); | ||
1783 | t->destination = destination; | ||
1784 | t->channels = GNUNET_CONTAINER_multihashmap32_create (8); | ||
1785 | (void) GCP_iterate_paths (destination, | ||
1786 | &consider_path_cb, | ||
1787 | t); | ||
1788 | t->maintain_connections_task | ||
1789 | = GNUNET_SCHEDULER_add_now (&maintain_connections_cb, | ||
1790 | t); | ||
1791 | t->mq = GNUNET_MQ_queue_for_callbacks (NULL, | ||
1792 | NULL, | ||
1793 | NULL, | ||
1794 | NULL, | ||
1795 | handlers, | ||
1796 | &decrypted_error_cb, | ||
1797 | t); | ||
1798 | t->mst = GNUNET_MST_create (&handle_decrypted, | ||
1799 | t); | ||
1800 | return t; | ||
1801 | } | ||
1802 | |||
1803 | |||
1804 | /** | ||
1805 | * Remove a channel from a tunnel. | ||
1806 | * | ||
1807 | * @param t Tunnel. | ||
1808 | * @param ch Channel | ||
1809 | * @param gid unique number identifying @a ch within @a t | ||
1810 | */ | ||
1811 | void | ||
1812 | GCT_remove_channel (struct CadetTunnel *t, | ||
1813 | struct CadetChannel *ch, | ||
1814 | struct GNUNET_CADET_ChannelTunnelNumber gid) | ||
1815 | { | ||
1816 | GNUNET_assert (GNUNET_YES == | ||
1817 | GNUNET_CONTAINER_multihashmap32_remove (t->channels, | ||
1818 | ntohl (gid.cn), | ||
1819 | ch)); | ||
1820 | if (0 == | ||
1821 | GNUNET_CONTAINER_multihashmap32_size (t->channels)) | ||
1822 | { | ||
1823 | t->destroy_task = GNUNET_SCHEDULER_add_delayed (IDLE_DESTROY_DELAY, | ||
1824 | &destroy_tunnel, | ||
1825 | t); | ||
1826 | } | ||
1827 | } | ||
1828 | |||
1829 | |||
1830 | /** | ||
1831 | * Change the tunnel encryption state. | ||
1832 | * If the encryption state changes to OK, stop the rekey task. | ||
1833 | * | ||
1834 | * @param t Tunnel whose encryption state to change, or NULL. | ||
1835 | * @param state New encryption state. | ||
1836 | */ | ||
1837 | void | ||
1838 | GCT_change_estate (struct CadetTunnel *t, | ||
1839 | enum CadetTunnelEState state) | ||
1840 | { | ||
1841 | enum CadetTunnelEState old = t->estate; | ||
1842 | |||
1843 | t->estate = state; | ||
1844 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1845 | "Tunnel %s estate changed from %d to %d\n", | ||
1846 | GCT_2s (t), | ||
1847 | old, | ||
1848 | state); | ||
1849 | |||
1850 | if ( (CADET_TUNNEL_KEY_OK != old) && | ||
1851 | (CADET_TUNNEL_KEY_OK == t->estate) ) | ||
1852 | { | ||
1853 | if (NULL != t->rekey_task) | ||
1854 | { | ||
1855 | GNUNET_SCHEDULER_cancel (t->rekey_task); | ||
1856 | t->rekey_task = NULL; | ||
1857 | } | ||
1858 | #if FIXME | ||
1859 | /* Send queued data if tunnel is not loopback */ | ||
1860 | if (myid != GCP_get_short_id (t->peer)) | ||
1861 | send_queued_data (t); | ||
1862 | #endif | ||
1863 | } | ||
1864 | } | ||
1865 | |||
1866 | |||
1867 | /** | ||
1868 | * Add a @a connection to the @a tunnel. | ||
1869 | * | ||
1870 | * @param t a tunnel | ||
1871 | * @param cid connection identifer to use for the connection | ||
1872 | * @param path path to use for the connection | ||
1873 | */ | ||
1874 | void | ||
1875 | GCT_add_inbound_connection (struct CadetTunnel *t, | ||
1876 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | ||
1877 | struct CadetPeerPath *path) | ||
1878 | { | ||
1879 | struct CadetConnection *cc; | ||
1880 | struct CadetTConnection *ct; | ||
1881 | |||
1882 | ct = GNUNET_new (struct CadetTConnection); | ||
1883 | ct->created = GNUNET_TIME_absolute_get (); | ||
1884 | ct->t = t; | ||
1885 | ct->cc = GCC_create_inbound (t->destination, | ||
1886 | path, | ||
1887 | ct, | ||
1888 | cid, | ||
1889 | &connection_ready_cb, | ||
1890 | t); | ||
1891 | /* FIXME: schedule job to kill connection (and path?) if it takes | ||
1892 | too long to get ready! (And track performance data on how long | ||
1893 | other connections took with the tunnel!) | ||
1894 | => Note: to be done within 'connection'-logic! */ | ||
1895 | GNUNET_CONTAINER_DLL_insert (t->connection_head, | ||
1896 | t->connection_tail, | ||
1897 | ct); | ||
1898 | t->num_connections++; | ||
1899 | } | ||
1900 | |||
1901 | |||
1902 | /** | ||
1903 | * Handle encrypted message. | ||
1904 | * | ||
1905 | * @param ct connection/tunnel combo that received encrypted message | ||
1906 | * @param msg the encrypted message to decrypt | ||
1907 | */ | ||
1908 | void | ||
1909 | GCT_handle_encrypted (struct CadetTConnection *ct, | ||
1910 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg) | ||
1911 | { | ||
1912 | struct CadetTunnel *t = ct->t; | ||
1913 | uint16_t size = ntohs (msg->header.size); | ||
1914 | char cbuf [size] GNUNET_ALIGN; | ||
1915 | ssize_t decrypted_size; | ||
1916 | |||
1917 | GNUNET_STATISTICS_update (stats, | ||
1918 | "# received encrypted", | ||
1919 | 1, | ||
1920 | GNUNET_NO); | ||
1921 | |||
1922 | decrypted_size = t_ax_decrypt_and_validate (t, | ||
1923 | cbuf, | ||
1924 | msg, | ||
1925 | size); | ||
1926 | |||
1927 | if (-1 == decrypted_size) | ||
1928 | { | ||
1929 | GNUNET_STATISTICS_update (stats, | ||
1930 | "# unable to decrypt", | ||
1931 | 1, | ||
1932 | GNUNET_NO); | ||
1933 | if (CADET_TUNNEL_KEY_PING <= t->estate) | ||
1934 | { | ||
1935 | GNUNET_break_op (0); | ||
1936 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1937 | "Wrong crypto, tunnel %s\n", | ||
1938 | GCT_2s (t)); | ||
1939 | GCT_debug (t, | ||
1940 | GNUNET_ERROR_TYPE_WARNING); | ||
1941 | } | ||
1942 | return; | ||
1943 | } | ||
1944 | |||
1945 | GCT_change_estate (t, | ||
1946 | CADET_TUNNEL_KEY_OK); | ||
1947 | /* The MST will ultimately call #handle_decrypted() on each message. */ | ||
1948 | GNUNET_break_op (GNUNET_OK == | ||
1949 | GNUNET_MST_from_buffer (t->mst, | ||
1950 | cbuf, | ||
1951 | decrypted_size, | ||
1952 | GNUNET_YES, | ||
1953 | GNUNET_NO)); | ||
1954 | } | ||
1955 | |||
1956 | |||
1957 | /** | ||
1958 | * Sends an already built message on a tunnel, encrypting it and | ||
1959 | * choosing the best connection if not provided. | ||
1960 | * | ||
1961 | * @param message Message to send. Function modifies it. | ||
1962 | * @param t Tunnel on which this message is transmitted. | ||
1963 | * @param cont Continuation to call once message is really sent. | ||
1964 | * @param cont_cls Closure for @c cont. | ||
1965 | * @return Handle to cancel message. NULL if @c cont is NULL. | ||
1966 | */ | ||
1967 | struct CadetTunnelQueueEntry * | ||
1968 | GCT_send (struct CadetTunnel *t, | ||
1969 | const struct GNUNET_MessageHeader *message, | ||
1970 | GNUNET_SCHEDULER_TaskCallback cont, | ||
1971 | void *cont_cls) | ||
1972 | { | ||
1973 | struct CadetTunnelQueueEntry *tq; | ||
1974 | uint16_t payload_size; | ||
1975 | struct GNUNET_MQ_Envelope *env; | ||
1976 | struct GNUNET_CADET_TunnelEncryptedMessage *ax_msg; | ||
1977 | |||
1978 | /* FIXME: what about KX not yet being ready? (see "is_ready()" check in old code!) */ | ||
1979 | |||
1980 | payload_size = ntohs (message->size); | ||
1981 | env = GNUNET_MQ_msg_extra (ax_msg, | ||
1982 | payload_size, | ||
1983 | GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED); | ||
1984 | t_ax_encrypt (t, | ||
1985 | &ax_msg[1], | ||
1986 | message, | ||
1987 | payload_size); | ||
1988 | ax_msg->Ns = htonl (t->ax.Ns++); | ||
1989 | ax_msg->PNs = htonl (t->ax.PNs); | ||
1990 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax.DHRs, | ||
1991 | &ax_msg->DHRs); | ||
1992 | t_h_encrypt (t, | ||
1993 | ax_msg); | ||
1994 | t_hmac (&ax_msg->Ns, | ||
1995 | AX_HEADER_SIZE + payload_size, | ||
1996 | 0, | ||
1997 | &t->ax.HKs, | ||
1998 | &ax_msg->hmac); | ||
1999 | // ax_msg->pid = htonl (GCC_get_pid (c, fwd)); // FIXME: connection flow-control not (re)implemented yet! | ||
2000 | |||
2001 | tq = GNUNET_malloc (sizeof (*tq)); | ||
2002 | tq->t = t; | ||
2003 | tq->env = env; | ||
2004 | tq->cid = &ax_msg->cid; | ||
2005 | tq->cont = cont; | ||
2006 | tq->cont_cls = cont_cls; | ||
2007 | GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, | ||
2008 | t->tq_tail, | ||
2009 | tq); | ||
2010 | trigger_transmissions (t); | ||
2011 | return tq; | ||
2012 | } | ||
2013 | |||
2014 | |||
2015 | /** | ||
2016 | * Cancel a previously sent message while it's in the queue. | ||
2017 | * | ||
2018 | * ONLY can be called before the continuation given to the send | ||
2019 | * function is called. Once the continuation is called, the message is | ||
2020 | * no longer in the queue! | ||
2021 | * | ||
2022 | * @param q Handle to the queue entry to cancel. | ||
2023 | */ | ||
2024 | void | ||
2025 | GCT_send_cancel (struct CadetTunnelQueueEntry *q) | ||
2026 | { | ||
2027 | struct CadetTunnel *t = q->t; | ||
2028 | |||
2029 | GNUNET_CONTAINER_DLL_remove (t->tq_head, | ||
2030 | t->tq_tail, | ||
2031 | q); | ||
2032 | GNUNET_free (q); | ||
2033 | } | ||
2034 | |||
2035 | |||
2036 | /** | ||
2037 | * Iterate over all connections of a tunnel. | ||
2038 | * | ||
2039 | * @param t Tunnel whose connections to iterate. | ||
2040 | * @param iter Iterator. | ||
2041 | * @param iter_cls Closure for @c iter. | ||
2042 | */ | ||
2043 | void | ||
2044 | GCT_iterate_connections (struct CadetTunnel *t, | ||
2045 | GCT_ConnectionIterator iter, | ||
2046 | void *iter_cls) | ||
2047 | { | ||
2048 | for (struct CadetTConnection *ct = t->connection_head; | ||
2049 | NULL != ct; | ||
2050 | ct = ct->next) | ||
2051 | iter (iter_cls, | ||
2052 | ct->cc); | ||
2053 | } | ||
2054 | |||
2055 | |||
2056 | /** | ||
2057 | * Closure for #iterate_channels_cb. | ||
2058 | */ | ||
2059 | struct ChanIterCls | ||
2060 | { | ||
2061 | /** | ||
2062 | * Function to call. | ||
2063 | */ | ||
2064 | GCT_ChannelIterator iter; | ||
2065 | |||
2066 | /** | ||
2067 | * Closure for @e iter. | ||
2068 | */ | ||
2069 | void *iter_cls; | ||
2070 | }; | ||
2071 | |||
2072 | |||
2073 | /** | ||
2074 | * Helper function for #GCT_iterate_channels. | ||
2075 | * | ||
2076 | * @param cls the `struct ChanIterCls` | ||
2077 | * @param key unused | ||
2078 | * @param value a `struct CadetChannel` | ||
2079 | * @return #GNUNET_OK | ||
2080 | */ | ||
2081 | static int | ||
2082 | iterate_channels_cb (void *cls, | ||
2083 | uint32_t key, | ||
2084 | void *value) | ||
2085 | { | ||
2086 | struct ChanIterCls *ctx = cls; | ||
2087 | struct CadetChannel *ch = value; | ||
2088 | |||
2089 | ctx->iter (ctx->iter_cls, | ||
2090 | ch); | ||
2091 | return GNUNET_OK; | ||
2092 | } | ||
2093 | |||
2094 | |||
2095 | /** | ||
2096 | * Iterate over all channels of a tunnel. | ||
2097 | * | ||
2098 | * @param t Tunnel whose channels to iterate. | ||
2099 | * @param iter Iterator. | ||
2100 | * @param iter_cls Closure for @c iter. | ||
2101 | */ | ||
2102 | void | ||
2103 | GCT_iterate_channels (struct CadetTunnel *t, | ||
2104 | GCT_ChannelIterator iter, | ||
2105 | void *iter_cls) | ||
2106 | { | ||
2107 | struct ChanIterCls ctx; | ||
2108 | |||
2109 | ctx.iter = iter; | ||
2110 | ctx.iter_cls = iter_cls; | ||
2111 | GNUNET_CONTAINER_multihashmap32_iterate (t->channels, | ||
2112 | &iterate_channels_cb, | ||
2113 | &ctx); | ||
2114 | |||
2115 | } | ||
2116 | |||
2117 | |||
2118 | /** | ||
2119 | * Call #GCCH_debug() on a channel. | ||
2120 | * | ||
2121 | * @param cls points to the log level to use | ||
2122 | * @param key unused | ||
2123 | * @param value the `struct CadetChannel` to dump | ||
2124 | * @return #GNUNET_OK (continue iteration) | ||
2125 | */ | ||
2126 | static int | ||
2127 | debug_channel (void *cls, | ||
2128 | uint32_t key, | ||
2129 | void *value) | ||
2130 | { | ||
2131 | const enum GNUNET_ErrorType *level = cls; | ||
2132 | struct CadetChannel *ch = value; | ||
2133 | |||
2134 | GCCH_debug (ch, *level); | ||
2135 | return GNUNET_OK; | ||
2136 | } | ||
2137 | |||
2138 | |||
2139 | /** | ||
2140 | * Get string description for tunnel connectivity state. | ||
2141 | * | ||
2142 | * @param cs Tunnel state. | ||
2143 | * | ||
2144 | * @return String representation. | ||
2145 | */ | ||
2146 | static const char * | ||
2147 | cstate2s (enum CadetTunnelCState cs) | ||
2148 | { | ||
2149 | static char buf[32]; | ||
2150 | |||
2151 | switch (cs) | ||
2152 | { | ||
2153 | case CADET_TUNNEL_NEW: | ||
2154 | return "CADET_TUNNEL_NEW"; | ||
2155 | case CADET_TUNNEL_SEARCHING: | ||
2156 | return "CADET_TUNNEL_SEARCHING"; | ||
2157 | case CADET_TUNNEL_WAITING: | ||
2158 | return "CADET_TUNNEL_WAITING"; | ||
2159 | case CADET_TUNNEL_READY: | ||
2160 | return "CADET_TUNNEL_READY"; | ||
2161 | case CADET_TUNNEL_SHUTDOWN: | ||
2162 | return "CADET_TUNNEL_SHUTDOWN"; | ||
2163 | default: | ||
2164 | SPRINTF (buf, "%u (UNKNOWN STATE)", cs); | ||
2165 | return buf; | ||
2166 | } | ||
2167 | } | ||
2168 | |||
2169 | |||
2170 | /** | ||
2171 | * Get string description for tunnel encryption state. | ||
2172 | * | ||
2173 | * @param es Tunnel state. | ||
2174 | * | ||
2175 | * @return String representation. | ||
2176 | */ | ||
2177 | static const char * | ||
2178 | estate2s (enum CadetTunnelEState es) | ||
2179 | { | ||
2180 | static char buf[32]; | ||
2181 | |||
2182 | switch (es) | ||
2183 | { | ||
2184 | case CADET_TUNNEL_KEY_UNINITIALIZED: | ||
2185 | return "CADET_TUNNEL_KEY_UNINITIALIZED"; | ||
2186 | case CADET_TUNNEL_KEY_SENT: | ||
2187 | return "CADET_TUNNEL_KEY_SENT"; | ||
2188 | case CADET_TUNNEL_KEY_PING: | ||
2189 | return "CADET_TUNNEL_KEY_PING"; | ||
2190 | case CADET_TUNNEL_KEY_OK: | ||
2191 | return "CADET_TUNNEL_KEY_OK"; | ||
2192 | case CADET_TUNNEL_KEY_REKEY: | ||
2193 | return "CADET_TUNNEL_KEY_REKEY"; | ||
2194 | default: | ||
2195 | SPRINTF (buf, "%u (UNKNOWN STATE)", es); | ||
2196 | return buf; | ||
2197 | } | ||
2198 | } | ||
2199 | |||
2200 | |||
2201 | #define LOG2(level, ...) GNUNET_log_from_nocheck(level,"cadet-tun",__VA_ARGS__) | ||
2202 | |||
2203 | |||
2204 | /** | ||
2205 | * Log all possible info about the tunnel state. | ||
2206 | * | ||
2207 | * @param t Tunnel to debug. | ||
2208 | * @param level Debug level to use. | ||
2209 | */ | ||
2210 | void | ||
2211 | GCT_debug (const struct CadetTunnel *t, | ||
2212 | enum GNUNET_ErrorType level) | ||
2213 | { | ||
2214 | struct CadetTConnection *iter_c; | ||
2215 | int do_log; | ||
2216 | |||
2217 | do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK), | ||
2218 | "cadet-tun", | ||
2219 | __FILE__, __FUNCTION__, __LINE__); | ||
2220 | if (0 == do_log) | ||
2221 | return; | ||
2222 | |||
2223 | LOG2 (level, | ||
2224 | "TTT TUNNEL TOWARDS %s in cstate %s, estate %s tq_len: %u #cons: %u\n", | ||
2225 | GCT_2s (t), | ||
2226 | cstate2s (t->cstate), | ||
2227 | estate2s (t->estate), | ||
2228 | t->tq_len, | ||
2229 | t->num_connections); | ||
2230 | #if DUMP_KEYS_TO_STDERR | ||
2231 | ax_debug (t->ax, level); | ||
2232 | #endif | ||
2233 | LOG2 (level, | ||
2234 | "TTT channels:\n"); | ||
2235 | GNUNET_CONTAINER_multihashmap32_iterate (t->channels, | ||
2236 | &debug_channel, | ||
2237 | &level); | ||
2238 | LOG2 (level, | ||
2239 | "TTT connections:\n"); | ||
2240 | for (iter_c = t->connection_head; NULL != iter_c; iter_c = iter_c->next) | ||
2241 | GCC_debug (iter_c->cc, | ||
2242 | level); | ||
2243 | |||
2244 | LOG2 (level, | ||
2245 | "TTT TUNNEL END\n"); | ||
2246 | } | ||
2247 | |||
2248 | |||
2249 | /* end of gnunet-service-cadet-new_tunnels.c */ | ||
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.h b/src/cadet/gnunet-service-cadet-new_tunnels.h new file mode 100644 index 000000000..82e4b0da6 --- /dev/null +++ b/src/cadet/gnunet-service-cadet-new_tunnels.h | |||
@@ -0,0 +1,357 @@ | |||
1 | |||
2 | /* | ||
3 | This file is part of GNUnet. | ||
4 | Copyright (C) 2001-2017 GNUnet e.V. | ||
5 | |||
6 | GNUnet is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 3, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | GNUnet is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with GNUnet; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file cadet/gnunet-service-cadet-new_tunnels.h | ||
24 | * @brief Information we track per tunnel. | ||
25 | * @author Bartlomiej Polot | ||
26 | * @author Christian Grothoff | ||
27 | */ | ||
28 | #ifndef GNUNET_SERVICE_CADET_TUNNELS_H | ||
29 | #define GNUNET_SERVICE_CADET_TUNNELS_H | ||
30 | |||
31 | #include "gnunet-service-cadet-new.h" | ||
32 | #include "cadet_protocol.h" | ||
33 | |||
34 | |||
35 | /** | ||
36 | * How many connections would we like to have per tunnel? | ||
37 | */ | ||
38 | #define DESIRED_CONNECTIONS_PER_TUNNEL 3 | ||
39 | |||
40 | |||
41 | /** | ||
42 | * All the connectivity states a tunnel can be in. | ||
43 | */ | ||
44 | enum CadetTunnelCState | ||
45 | { | ||
46 | /** | ||
47 | * Uninitialized status, should never appear in operation. | ||
48 | */ | ||
49 | CADET_TUNNEL_NEW, | ||
50 | |||
51 | /** | ||
52 | * No path to the peer known yet. | ||
53 | */ | ||
54 | CADET_TUNNEL_SEARCHING, | ||
55 | |||
56 | /** | ||
57 | * Request sent, not yet answered. | ||
58 | */ | ||
59 | CADET_TUNNEL_WAITING, | ||
60 | |||
61 | /** | ||
62 | * Peer connected and ready to accept data. | ||
63 | */ | ||
64 | CADET_TUNNEL_READY, | ||
65 | |||
66 | /** | ||
67 | * Tunnel being shut down, don't try to keep it alive. | ||
68 | */ | ||
69 | CADET_TUNNEL_SHUTDOWN | ||
70 | }; | ||
71 | |||
72 | |||
73 | |||
74 | /** | ||
75 | * All the encryption states a tunnel can be in. | ||
76 | */ | ||
77 | enum CadetTunnelEState | ||
78 | { | ||
79 | /** | ||
80 | * Uninitialized status, should never appear in operation. | ||
81 | */ | ||
82 | CADET_TUNNEL_KEY_UNINITIALIZED, | ||
83 | |||
84 | /** | ||
85 | * Ephemeral key sent, waiting for peer's key. | ||
86 | */ | ||
87 | CADET_TUNNEL_KEY_SENT, | ||
88 | |||
89 | /** | ||
90 | * In OTR: New ephemeral key and ping sent, waiting for pong. | ||
91 | * | ||
92 | * This means that we DO have the peer's ephemeral key, otherwise the | ||
93 | * state would be KEY_SENT. We DO NOT have a valid session key (either no | ||
94 | * previous key or previous key expired). | ||
95 | * | ||
96 | * | ||
97 | * In Axolotl: Key sent and received but no deciphered traffic yet. | ||
98 | * | ||
99 | * This means that we can send traffic (otherwise we would never complete | ||
100 | * the handshake), but we don't have complete confirmation. Since the first | ||
101 | * traffic MUST be a complete channel creation 3-way handshake, no payload | ||
102 | * will be sent before confirmation. | ||
103 | */ | ||
104 | CADET_TUNNEL_KEY_PING, | ||
105 | |||
106 | /** | ||
107 | * Handshake completed: session key available. | ||
108 | */ | ||
109 | CADET_TUNNEL_KEY_OK, | ||
110 | |||
111 | /** | ||
112 | * New ephemeral key and ping sent, waiting for pong. Unlike KEY_PING, | ||
113 | * we still have a valid session key and therefore we *can* still send | ||
114 | * traffic on the tunnel. | ||
115 | */ | ||
116 | CADET_TUNNEL_KEY_REKEY | ||
117 | }; | ||
118 | |||
119 | |||
120 | /** | ||
121 | * Get the static string for the peer this tunnel is directed. | ||
122 | * | ||
123 | * @param t Tunnel. | ||
124 | * | ||
125 | * @return Static string the destination peer's ID. | ||
126 | */ | ||
127 | const char * | ||
128 | GCT_2s (const struct CadetTunnel *t); | ||
129 | |||
130 | |||
131 | /** | ||
132 | * Create a tunnel to @a destionation. Must only be called | ||
133 | * from within #GCP_get_tunnel(). | ||
134 | * | ||
135 | * @param destination where to create the tunnel to | ||
136 | * @return new tunnel to @a destination | ||
137 | */ | ||
138 | struct CadetTunnel * | ||
139 | GCT_create_tunnel (struct CadetPeer *destination); | ||
140 | |||
141 | |||
142 | /** | ||
143 | * Add a @a connection to the @a tunnel. | ||
144 | * | ||
145 | * @param t a tunnel | ||
146 | * @param cid connection identifer to use for the connection | ||
147 | * @param path path to use for the connection | ||
148 | */ | ||
149 | void | ||
150 | GCT_add_inbound_connection (struct CadetTunnel *t, | ||
151 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | ||
152 | struct CadetPeerPath *path); | ||
153 | |||
154 | |||
155 | /** | ||
156 | * Return the peer to which this tunnel goes. | ||
157 | * | ||
158 | * @param t a tunnel | ||
159 | * @return the destination of the tunnel | ||
160 | */ | ||
161 | struct CadetPeer * | ||
162 | GCT_get_destination (struct CadetTunnel *t); | ||
163 | |||
164 | |||
165 | /** | ||
166 | * Consider using the path @a p for the tunnel @a t. | ||
167 | * The tunnel destination is at offset @a off in path @a p. | ||
168 | * | ||
169 | * @param cls our tunnel | ||
170 | * @param path a path to our destination | ||
171 | * @param off offset of the destination on path @a path | ||
172 | */ | ||
173 | void | ||
174 | GCT_consider_path (struct CadetTunnel *t, | ||
175 | struct CadetPeerPath *p, | ||
176 | unsigned int off); | ||
177 | |||
178 | |||
179 | /** | ||
180 | * Add a channel to a tunnel. | ||
181 | * | ||
182 | * @param t Tunnel. | ||
183 | * @param ch Channel | ||
184 | * @return unique number identifying @a ch within @a t | ||
185 | */ | ||
186 | struct GNUNET_CADET_ChannelTunnelNumber | ||
187 | GCT_add_channel (struct CadetTunnel *t, | ||
188 | struct CadetChannel *ch); | ||
189 | |||
190 | |||
191 | /** | ||
192 | * Remove a channel from a tunnel. | ||
193 | * | ||
194 | * @param t Tunnel. | ||
195 | * @param ch Channel | ||
196 | * @param gid unique number identifying @a ch within @a t | ||
197 | */ | ||
198 | void | ||
199 | GCT_remove_channel (struct CadetTunnel *t, | ||
200 | struct CadetChannel *ch, | ||
201 | struct GNUNET_CADET_ChannelTunnelNumber gid); | ||
202 | |||
203 | |||
204 | /** | ||
205 | * Sends an already built message on a tunnel, encrypting it and | ||
206 | * choosing the best connection if not provided. | ||
207 | * | ||
208 | * @param message Message to send. Function modifies it. | ||
209 | * @param t Tunnel on which this message is transmitted. | ||
210 | * @param cont Continuation to call once message is really sent. | ||
211 | * @param cont_cls Closure for @c cont. | ||
212 | * @return Handle to cancel message. NULL if @c cont is NULL. | ||
213 | */ | ||
214 | struct CadetTunnelQueueEntry * | ||
215 | GCT_send (struct CadetTunnel *t, | ||
216 | const struct GNUNET_MessageHeader *message, | ||
217 | GNUNET_SCHEDULER_TaskCallback cont, | ||
218 | void *cont_cls); | ||
219 | |||
220 | |||
221 | /** | ||
222 | * Cancel a previously sent message while it's in the queue. | ||
223 | * | ||
224 | * ONLY can be called before the continuation given to the send | ||
225 | * function is called. Once the continuation is called, the message is | ||
226 | * no longer in the queue! | ||
227 | * | ||
228 | * @param q Handle to the queue entry to cancel. | ||
229 | */ | ||
230 | void | ||
231 | GCT_send_cancel (struct CadetTunnelQueueEntry *q); | ||
232 | |||
233 | |||
234 | /** | ||
235 | * Return the number of channels using a tunnel. | ||
236 | * | ||
237 | * @param t tunnel to count obtain the number of channels for | ||
238 | * @return number of channels using the tunnel | ||
239 | */ | ||
240 | unsigned int | ||
241 | GCT_count_channels (struct CadetTunnel *t); | ||
242 | |||
243 | |||
244 | /** | ||
245 | * Return the number of connections available for a tunnel. | ||
246 | * | ||
247 | * @param t tunnel to count obtain the number of connections for | ||
248 | * @return number of connections available for the tunnel | ||
249 | */ | ||
250 | unsigned int | ||
251 | GCT_count_any_connections (struct CadetTunnel *t); | ||
252 | |||
253 | |||
254 | /** | ||
255 | * Iterator over connections. | ||
256 | * | ||
257 | * @param cls closure | ||
258 | * @param c one of the connections | ||
259 | */ | ||
260 | typedef void | ||
261 | (*GCT_ConnectionIterator) (void *cls, | ||
262 | struct CadetConnection *c); | ||
263 | |||
264 | |||
265 | /** | ||
266 | * Iterate over all connections of a tunnel. | ||
267 | * | ||
268 | * @param t Tunnel whose connections to iterate. | ||
269 | * @param iter Iterator. | ||
270 | * @param iter_cls Closure for @c iter. | ||
271 | */ | ||
272 | void | ||
273 | GCT_iterate_connections (struct CadetTunnel *t, | ||
274 | GCT_ConnectionIterator iter, | ||
275 | void *iter_cls); | ||
276 | |||
277 | |||
278 | /** | ||
279 | * Iterator over channels. | ||
280 | * | ||
281 | * @param cls closure | ||
282 | * @param ch one of the channels | ||
283 | */ | ||
284 | typedef void | ||
285 | (*GCT_ChannelIterator) (void *cls, | ||
286 | struct CadetChannel *ch); | ||
287 | |||
288 | |||
289 | /** | ||
290 | * Iterate over all channels of a tunnel. | ||
291 | * | ||
292 | * @param t Tunnel whose channels to iterate. | ||
293 | * @param iter Iterator. | ||
294 | * @param iter_cls Closure for @c iter. | ||
295 | */ | ||
296 | void | ||
297 | GCT_iterate_channels (struct CadetTunnel *t, | ||
298 | GCT_ChannelIterator iter, | ||
299 | void *iter_cls); | ||
300 | |||
301 | |||
302 | /** | ||
303 | * Get the connectivity state of a tunnel. | ||
304 | * | ||
305 | * @param t Tunnel. | ||
306 | * | ||
307 | * @return Tunnel's connectivity state. | ||
308 | */ | ||
309 | enum CadetTunnelCState | ||
310 | GCT_get_cstate (struct CadetTunnel *t); | ||
311 | |||
312 | |||
313 | /** | ||
314 | * Get the encryption state of a tunnel. | ||
315 | * | ||
316 | * @param t Tunnel. | ||
317 | * | ||
318 | * @return Tunnel's encryption state. | ||
319 | */ | ||
320 | enum CadetTunnelEState | ||
321 | GCT_get_estate (struct CadetTunnel *t); | ||
322 | |||
323 | |||
324 | /** | ||
325 | * Handle KX message. | ||
326 | * | ||
327 | * @param ct connection/tunnel combo that received encrypted message | ||
328 | * @param msg the key exchange message | ||
329 | */ | ||
330 | void | ||
331 | GCT_handle_kx (struct CadetTConnection *ct, | ||
332 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); | ||
333 | |||
334 | |||
335 | /** | ||
336 | * Handle encrypted message. | ||
337 | * | ||
338 | * @param ct connection/tunnel combo that received encrypted message | ||
339 | * @param msg the encrypted message to decrypt | ||
340 | */ | ||
341 | void | ||
342 | GCT_handle_encrypted (struct CadetTConnection *ct, | ||
343 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg); | ||
344 | |||
345 | |||
346 | /** | ||
347 | * Log all possible info about the tunnel state. | ||
348 | * | ||
349 | * @param t Tunnel to debug. | ||
350 | * @param level Debug level to use. | ||
351 | */ | ||
352 | void | ||
353 | GCT_debug (const struct CadetTunnel *t, | ||
354 | enum GNUNET_ErrorType level); | ||
355 | |||
356 | |||
357 | #endif | ||
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 22349aa80..dee0c37d7 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c | |||
@@ -58,7 +58,7 @@ enum CadetChannelState | |||
58 | /** | 58 | /** |
59 | * Connection confirmed, ready to carry traffic. | 59 | * Connection confirmed, ready to carry traffic. |
60 | */ | 60 | */ |
61 | CADET_CHANNEL_READY, | 61 | CADET_CHANNEL_READY |
62 | }; | 62 | }; |
63 | 63 | ||
64 | 64 | ||
@@ -125,7 +125,7 @@ struct CadetReliableMessage | |||
125 | */ | 125 | */ |
126 | struct GNUNET_TIME_Absolute timestamp; | 126 | struct GNUNET_TIME_Absolute timestamp; |
127 | 127 | ||
128 | /* struct GNUNET_CADET_Data with payload */ | 128 | /* struct GNUNET_CADET_ChannelAppDataMessage with payload */ |
129 | }; | 129 | }; |
130 | 130 | ||
131 | 131 | ||
@@ -216,19 +216,19 @@ struct CadetChannel | |||
216 | /** | 216 | /** |
217 | * Global channel number ( < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | 217 | * Global channel number ( < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) |
218 | */ | 218 | */ |
219 | CADET_ChannelNumber gid; | 219 | struct GNUNET_CADET_ChannelTunnelNumber gid; |
220 | 220 | ||
221 | /** | 221 | /** |
222 | * Local tunnel number for root (owner) client. | 222 | * Local tunnel number for root (owner) client. |
223 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI or 0 ) | 223 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI or 0 ) |
224 | */ | 224 | */ |
225 | CADET_ChannelNumber lid_root; | 225 | struct GNUNET_CADET_ClientChannelNumber lid_root; |
226 | 226 | ||
227 | /** | 227 | /** |
228 | * Local tunnel number for local destination clients (incoming number) | 228 | * Local tunnel number for local destination clients (incoming number) |
229 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV or 0). | 229 | * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV or 0). |
230 | */ | 230 | */ |
231 | CADET_ChannelNumber lid_dest; | 231 | struct GNUNET_CADET_ClientChannelNumber lid_dest; |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * Channel state. | 234 | * Channel state. |
@@ -368,7 +368,7 @@ is_loopback (const struct CadetChannel *ch) | |||
368 | * @param rel Reliability data for retransmission. | 368 | * @param rel Reliability data for retransmission. |
369 | */ | 369 | */ |
370 | static struct CadetReliableMessage * | 370 | static struct CadetReliableMessage * |
371 | copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid, | 371 | copy_message (const struct GNUNET_CADET_ChannelAppDataMessage *msg, uint32_t mid, |
372 | struct CadetChannelReliability *rel) | 372 | struct CadetChannelReliability *rel) |
373 | { | 373 | { |
374 | struct CadetReliableMessage *copy; | 374 | struct CadetReliableMessage *copy; |
@@ -378,7 +378,7 @@ copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid, | |||
378 | copy = GNUNET_malloc (sizeof (*copy) + size); | 378 | copy = GNUNET_malloc (sizeof (*copy) + size); |
379 | copy->mid = mid; | 379 | copy->mid = mid; |
380 | copy->rel = rel; | 380 | copy->rel = rel; |
381 | copy->type = GNUNET_MESSAGE_TYPE_CADET_DATA; | 381 | copy->type = GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA; |
382 | GNUNET_memcpy (©[1], msg, size); | 382 | GNUNET_memcpy (©[1], msg, size); |
383 | 383 | ||
384 | return copy; | 384 | return copy; |
@@ -393,7 +393,7 @@ copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid, | |||
393 | * @param rel Reliability data to the corresponding direction. | 393 | * @param rel Reliability data to the corresponding direction. |
394 | */ | 394 | */ |
395 | static void | 395 | static void |
396 | add_buffered_data (const struct GNUNET_CADET_Data *msg, | 396 | add_buffered_data (const struct GNUNET_CADET_ChannelAppDataMessage *msg, |
397 | struct CadetChannelReliability *rel) | 397 | struct CadetChannelReliability *rel) |
398 | { | 398 | { |
399 | struct CadetReliableMessage *copy; | 399 | struct CadetReliableMessage *copy; |
@@ -513,11 +513,11 @@ channel_get_options (struct CadetChannel *ch) | |||
513 | static void | 513 | static void |
514 | send_destroy (struct CadetChannel *ch, int local_only) | 514 | send_destroy (struct CadetChannel *ch, int local_only) |
515 | { | 515 | { |
516 | struct GNUNET_CADET_ChannelManage msg; | 516 | struct GNUNET_CADET_ChannelManageMessage msg; |
517 | 517 | ||
518 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); | 518 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); |
519 | msg.header.size = htons (sizeof (msg)); | 519 | msg.header.size = htons (sizeof (msg)); |
520 | msg.chid = htonl (ch->gid); | 520 | msg.chid = ch->gid; |
521 | 521 | ||
522 | /* If root is not NULL, notify. | 522 | /* If root is not NULL, notify. |
523 | * If it's NULL, check lid_root. When a local destroy comes in, root | 523 | * If it's NULL, check lid_root. When a local destroy comes in, root |
@@ -526,12 +526,12 @@ send_destroy (struct CadetChannel *ch, int local_only) | |||
526 | */ | 526 | */ |
527 | if (NULL != ch->root) | 527 | if (NULL != ch->root) |
528 | GML_send_channel_destroy (ch->root, ch->lid_root); | 528 | GML_send_channel_destroy (ch->root, ch->lid_root); |
529 | else if (0 == ch->lid_root && GNUNET_NO == local_only) | 529 | else if (0 == ch->lid_root.channel_of_client && GNUNET_NO == local_only) |
530 | GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); | 530 | GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); |
531 | 531 | ||
532 | if (NULL != ch->dest) | 532 | if (NULL != ch->dest) |
533 | GML_send_channel_destroy (ch->dest, ch->lid_dest); | 533 | GML_send_channel_destroy (ch->dest, ch->lid_dest); |
534 | else if (0 == ch->lid_dest && GNUNET_NO == local_only) | 534 | else if (0 == ch->lid_dest.channel_of_client && GNUNET_NO == local_only) |
535 | GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES, NULL); | 535 | GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES, NULL); |
536 | } | 536 | } |
537 | 537 | ||
@@ -552,7 +552,10 @@ send_client_create (struct CadetChannel *ch) | |||
552 | opt = 0; | 552 | opt = 0; |
553 | opt |= GNUNET_YES == ch->reliable ? GNUNET_CADET_OPTION_RELIABLE : 0; | 553 | opt |= GNUNET_YES == ch->reliable ? GNUNET_CADET_OPTION_RELIABLE : 0; |
554 | opt |= GNUNET_YES == ch->nobuffer ? GNUNET_CADET_OPTION_NOBUFFER : 0; | 554 | opt |= GNUNET_YES == ch->nobuffer ? GNUNET_CADET_OPTION_NOBUFFER : 0; |
555 | GML_send_channel_create (ch->dest, ch->lid_dest, &ch->port, opt, | 555 | GML_send_channel_create (ch->dest, |
556 | ch->lid_dest, | ||
557 | &ch->port, | ||
558 | opt, | ||
556 | GCT_get_destination (ch->t)); | 559 | GCT_get_destination (ch->t)); |
557 | 560 | ||
558 | } | 561 | } |
@@ -570,7 +573,7 @@ send_client_create (struct CadetChannel *ch) | |||
570 | */ | 573 | */ |
571 | static void | 574 | static void |
572 | send_client_data (struct CadetChannel *ch, | 575 | send_client_data (struct CadetChannel *ch, |
573 | const struct GNUNET_CADET_Data *msg, | 576 | const struct GNUNET_CADET_ChannelAppDataMessage *msg, |
574 | int fwd) | 577 | int fwd) |
575 | { | 578 | { |
576 | if (fwd) | 579 | if (fwd) |
@@ -628,7 +631,7 @@ send_client_buffered_data (struct CadetChannel *ch, | |||
628 | { | 631 | { |
629 | if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable) | 632 | if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable) |
630 | { | 633 | { |
631 | struct GNUNET_CADET_Data *msg = (struct GNUNET_CADET_Data *) ©[1]; | 634 | struct GNUNET_CADET_ChannelAppDataMessage *msg = (struct GNUNET_CADET_ChannelAppDataMessage *) ©[1]; |
632 | 635 | ||
633 | LOG (GNUNET_ERROR_TYPE_DEBUG, " have %u! now expecting %u\n", | 636 | LOG (GNUNET_ERROR_TYPE_DEBUG, " have %u! now expecting %u\n", |
634 | copy->mid, rel->mid_recv + 1); | 637 | copy->mid, rel->mid_recv + 1); |
@@ -728,7 +731,7 @@ channel_retransmit_message (void *cls) | |||
728 | struct CadetChannelReliability *rel = cls; | 731 | struct CadetChannelReliability *rel = cls; |
729 | struct CadetReliableMessage *copy; | 732 | struct CadetReliableMessage *copy; |
730 | struct CadetChannel *ch; | 733 | struct CadetChannel *ch; |
731 | struct GNUNET_CADET_Data *payload; | 734 | struct GNUNET_CADET_ChannelAppDataMessage *payload; |
732 | int fwd; | 735 | int fwd; |
733 | 736 | ||
734 | rel->retry_task = NULL; | 737 | rel->retry_task = NULL; |
@@ -740,7 +743,7 @@ channel_retransmit_message (void *cls) | |||
740 | return; | 743 | return; |
741 | } | 744 | } |
742 | 745 | ||
743 | payload = (struct GNUNET_CADET_Data *) ©[1]; | 746 | payload = (struct GNUNET_CADET_ChannelAppDataMessage *) ©[1]; |
744 | fwd = (rel == ch->root_rel); | 747 | fwd = (rel == ch->root_rel); |
745 | 748 | ||
746 | /* Message not found in the queue that we are going to use. */ | 749 | /* Message not found in the queue that we are going to use. */ |
@@ -805,7 +808,7 @@ ch_message_sent (void *cls, | |||
805 | 808 | ||
806 | switch (chq->type) | 809 | switch (chq->type) |
807 | { | 810 | { |
808 | case GNUNET_MESSAGE_TYPE_CADET_DATA: | 811 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: |
809 | LOG (GNUNET_ERROR_TYPE_DEBUG, "data MID %u sent\n", copy->mid); | 812 | LOG (GNUNET_ERROR_TYPE_DEBUG, "data MID %u sent\n", copy->mid); |
810 | GNUNET_assert (chq == copy->chq); | 813 | GNUNET_assert (chq == copy->chq); |
811 | copy->timestamp = GNUNET_TIME_absolute_get (); | 814 | copy->timestamp = GNUNET_TIME_absolute_get (); |
@@ -841,16 +844,16 @@ ch_message_sent (void *cls, | |||
841 | break; | 844 | break; |
842 | 845 | ||
843 | 846 | ||
844 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: | 847 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: |
845 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: | 848 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: |
846 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: | 849 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: |
847 | LOG (GNUNET_ERROR_TYPE_DEBUG, "sent %s\n", GC_m2s (chq->type)); | 850 | LOG (GNUNET_ERROR_TYPE_DEBUG, "sent %s\n", GC_m2s (chq->type)); |
848 | rel = chq->rel; | 851 | rel = chq->rel; |
849 | GNUNET_assert (rel->uniq == chq); | 852 | GNUNET_assert (rel->uniq == chq); |
850 | rel->uniq = NULL; | 853 | rel->uniq = NULL; |
851 | 854 | ||
852 | if (CADET_CHANNEL_READY != rel->ch->state | 855 | if (CADET_CHANNEL_READY != rel->ch->state |
853 | && GNUNET_MESSAGE_TYPE_CADET_DATA_ACK != type | 856 | && GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK != type |
854 | && GNUNET_NO == rel->ch->destroy) | 857 | && GNUNET_NO == rel->ch->destroy) |
855 | { | 858 | { |
856 | GNUNET_assert (NULL == rel->retry_task); | 859 | GNUNET_assert (NULL == rel->retry_task); |
@@ -879,11 +882,11 @@ ch_message_sent (void *cls, | |||
879 | static void | 882 | static void |
880 | send_create (struct CadetChannel *ch) | 883 | send_create (struct CadetChannel *ch) |
881 | { | 884 | { |
882 | struct GNUNET_CADET_ChannelCreate msgcc; | 885 | struct GNUNET_CADET_ChannelOpenMessage msgcc; |
883 | 886 | ||
884 | msgcc.header.size = htons (sizeof (msgcc)); | 887 | msgcc.header.size = htons (sizeof (msgcc)); |
885 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); | 888 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); |
886 | msgcc.chid = htonl (ch->gid); | 889 | msgcc.chid = ch->gid; |
887 | msgcc.port = ch->port; | 890 | msgcc.port = ch->port; |
888 | msgcc.opt = htonl (channel_get_options (ch)); | 891 | msgcc.opt = htonl (channel_get_options (ch)); |
889 | 892 | ||
@@ -900,14 +903,15 @@ send_create (struct CadetChannel *ch) | |||
900 | static void | 903 | static void |
901 | send_ack (struct CadetChannel *ch, int fwd) | 904 | send_ack (struct CadetChannel *ch, int fwd) |
902 | { | 905 | { |
903 | struct GNUNET_CADET_ChannelManage msg; | 906 | struct GNUNET_CADET_ChannelManageMessage msg; |
904 | 907 | ||
905 | msg.header.size = htons (sizeof (msg)); | 908 | msg.header.size = htons (sizeof (msg)); |
906 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK); | 909 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK); |
907 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n", | 910 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
911 | " sending channel %s ack for channel %s\n", | ||
908 | GC_f2s (fwd), GCCH_2s (ch)); | 912 | GC_f2s (fwd), GCCH_2s (ch)); |
909 | 913 | ||
910 | msg.chid = htonl (ch->gid); | 914 | msg.chid =ch->gid; |
911 | GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL); | 915 | GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL); |
912 | } | 916 | } |
913 | 917 | ||
@@ -925,8 +929,9 @@ fire_and_forget (const struct GNUNET_MessageHeader *msg, | |||
925 | struct CadetChannel *ch, | 929 | struct CadetChannel *ch, |
926 | int force) | 930 | int force) |
927 | { | 931 | { |
928 | GNUNET_break (NULL == GCT_send_prebuilt_message (msg, ch->t, NULL, | 932 | GNUNET_break (NULL == |
929 | force, NULL, NULL)); | 933 | GCT_send_prebuilt_message (msg, ch->t, NULL, |
934 | force, NULL, NULL)); | ||
930 | } | 935 | } |
931 | 936 | ||
932 | 937 | ||
@@ -938,15 +943,15 @@ fire_and_forget (const struct GNUNET_MessageHeader *msg, | |||
938 | static void | 943 | static void |
939 | send_nack (struct CadetChannel *ch) | 944 | send_nack (struct CadetChannel *ch) |
940 | { | 945 | { |
941 | struct GNUNET_CADET_ChannelManage msg; | 946 | struct GNUNET_CADET_ChannelManageMessage msg; |
942 | 947 | ||
943 | msg.header.size = htons (sizeof (msg)); | 948 | msg.header.size = htons (sizeof (msg)); |
944 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK); | 949 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED); |
945 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 950 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
946 | " sending channel NACK for channel %s\n", | 951 | " sending channel NACK for channel %s\n", |
947 | GCCH_2s (ch)); | 952 | GCCH_2s (ch)); |
948 | 953 | ||
949 | msg.chid = htonl (ch->gid); | 954 | msg.chid = ch->gid; |
950 | GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); | 955 | GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); |
951 | } | 956 | } |
952 | 957 | ||
@@ -1019,7 +1024,7 @@ channel_rel_free_all (struct CadetChannelReliability *rel) | |||
1019 | */ | 1024 | */ |
1020 | static unsigned int | 1025 | static unsigned int |
1021 | channel_rel_free_sent (struct CadetChannelReliability *rel, | 1026 | channel_rel_free_sent (struct CadetChannelReliability *rel, |
1022 | const struct GNUNET_CADET_DataACK *msg) | 1027 | const struct GNUNET_CADET_ChannelDataAckMessage *msg) |
1023 | { | 1028 | { |
1024 | struct CadetReliableMessage *copy; | 1029 | struct CadetReliableMessage *copy; |
1025 | struct CadetReliableMessage *next; | 1030 | struct CadetReliableMessage *next; |
@@ -1252,7 +1257,7 @@ channel_save_copy (struct CadetChannel *ch, | |||
1252 | static struct CadetChannel * | 1257 | static struct CadetChannel * |
1253 | channel_new (struct CadetTunnel *t, | 1258 | channel_new (struct CadetTunnel *t, |
1254 | struct CadetClient *owner, | 1259 | struct CadetClient *owner, |
1255 | CADET_ChannelNumber lid_root) | 1260 | struct GNUNET_CADET_ClientChannelNumber lid_root) |
1256 | { | 1261 | { |
1257 | struct CadetChannel *ch; | 1262 | struct CadetChannel *ch; |
1258 | 1263 | ||
@@ -1295,35 +1300,35 @@ handle_loopback (struct CadetChannel *ch, | |||
1295 | 1300 | ||
1296 | switch (type) | 1301 | switch (type) |
1297 | { | 1302 | { |
1298 | case GNUNET_MESSAGE_TYPE_CADET_DATA: | 1303 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: |
1299 | /* Don't send hop ACK, wait for client to ACK */ | 1304 | /* Don't send hop ACK, wait for client to ACK */ |
1300 | LOG (GNUNET_ERROR_TYPE_DEBUG, "SEND loopback %u (%u)\n", | 1305 | LOG (GNUNET_ERROR_TYPE_DEBUG, "SEND loopback %u (%u)\n", |
1301 | ntohl (((struct GNUNET_CADET_Data *) msgh)->mid), ntohs (msgh->size)); | 1306 | ntohl (((struct GNUNET_CADET_ChannelAppDataMessage *) msgh)->mid), ntohs (msgh->size)); |
1302 | GCCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd); | 1307 | GCCH_handle_data (ch, (struct GNUNET_CADET_ChannelAppDataMessage *) msgh, fwd); |
1303 | break; | 1308 | break; |
1304 | 1309 | ||
1305 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: | 1310 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: |
1306 | GCCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd); | 1311 | GCCH_handle_data_ack (ch, (struct GNUNET_CADET_ChannelDataAckMessage *) msgh, fwd); |
1307 | break; | 1312 | break; |
1308 | 1313 | ||
1309 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: | 1314 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: |
1310 | GCCH_handle_create (ch->t, | 1315 | GCCH_handle_create (ch->t, |
1311 | (struct GNUNET_CADET_ChannelCreate *) msgh); | 1316 | (struct GNUNET_CADET_ChannelOpenMessage *) msgh); |
1312 | break; | 1317 | break; |
1313 | 1318 | ||
1314 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: | 1319 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: |
1315 | GCCH_handle_ack (ch, | 1320 | GCCH_handle_ack (ch, |
1316 | (struct GNUNET_CADET_ChannelManage *) msgh, | 1321 | (struct GNUNET_CADET_ChannelManageMessage *) msgh, |
1317 | fwd); | 1322 | fwd); |
1318 | break; | 1323 | break; |
1319 | 1324 | ||
1320 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: | 1325 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: |
1321 | GCCH_handle_nack (ch); | 1326 | GCCH_handle_nack (ch); |
1322 | break; | 1327 | break; |
1323 | 1328 | ||
1324 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: | 1329 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
1325 | GCCH_handle_destroy (ch, | 1330 | GCCH_handle_destroy (ch, |
1326 | (struct GNUNET_CADET_ChannelManage *) msgh, | 1331 | (struct GNUNET_CADET_ChannelManageMessage *) msgh, |
1327 | fwd); | 1332 | fwd); |
1328 | break; | 1333 | break; |
1329 | 1334 | ||
@@ -1393,7 +1398,7 @@ GCCH_destroy (struct CadetChannel *ch) | |||
1393 | * | 1398 | * |
1394 | * @return ID used to identify the channel with the remote peer. | 1399 | * @return ID used to identify the channel with the remote peer. |
1395 | */ | 1400 | */ |
1396 | CADET_ChannelNumber | 1401 | struct GNUNET_CADET_ChannelTunnelNumber |
1397 | GCCH_get_id (const struct CadetChannel *ch) | 1402 | GCCH_get_id (const struct CadetChannel *ch) |
1398 | { | 1403 | { |
1399 | return ch->gid; | 1404 | return ch->gid; |
@@ -1518,7 +1523,7 @@ GCCH_is_terminal (struct CadetChannel *ch, int fwd) | |||
1518 | void | 1523 | void |
1519 | GCCH_send_data_ack (struct CadetChannel *ch, int fwd) | 1524 | GCCH_send_data_ack (struct CadetChannel *ch, int fwd) |
1520 | { | 1525 | { |
1521 | struct GNUNET_CADET_DataACK msg; | 1526 | struct GNUNET_CADET_ChannelDataAckMessage msg; |
1522 | struct CadetChannelReliability *rel; | 1527 | struct CadetChannelReliability *rel; |
1523 | struct CadetReliableMessage *copy; | 1528 | struct CadetReliableMessage *copy; |
1524 | unsigned int delta; | 1529 | unsigned int delta; |
@@ -1531,15 +1536,15 @@ GCCH_send_data_ack (struct CadetChannel *ch, int fwd) | |||
1531 | rel = fwd ? ch->dest_rel : ch->root_rel; | 1536 | rel = fwd ? ch->dest_rel : ch->root_rel; |
1532 | ack = rel->mid_recv - 1; | 1537 | ack = rel->mid_recv - 1; |
1533 | 1538 | ||
1534 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA_ACK); | 1539 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK); |
1535 | msg.header.size = htons (sizeof (msg)); | 1540 | msg.header.size = htons (sizeof (msg)); |
1536 | msg.chid = htonl (ch->gid); | 1541 | msg.chid = ch->gid; |
1537 | msg.mid = htonl (ack); | 1542 | msg.mid = htonl (ack); |
1538 | 1543 | ||
1539 | msg.futures = 0LL; | 1544 | msg.futures = 0LL; |
1540 | for (copy = rel->head_recv; NULL != copy; copy = copy->next) | 1545 | for (copy = rel->head_recv; NULL != copy; copy = copy->next) |
1541 | { | 1546 | { |
1542 | if (copy->type != GNUNET_MESSAGE_TYPE_CADET_DATA) | 1547 | if (copy->type != GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA) |
1543 | { | 1548 | { |
1544 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Type %s, expected DATA\n", | 1549 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Type %s, expected DATA\n", |
1545 | GC_m2s (copy->type)); | 1550 | GC_m2s (copy->type)); |
@@ -1657,7 +1662,7 @@ GCCH_debug (struct CadetChannel *ch, enum GNUNET_ErrorType level) | |||
1657 | { | 1662 | { |
1658 | LOG2 (level, "CHN cli %s\n", GML_2s (ch->root)); | 1663 | LOG2 (level, "CHN cli %s\n", GML_2s (ch->root)); |
1659 | LOG2 (level, "CHN ready %s\n", ch->root_rel->client_ready ? "YES" : "NO"); | 1664 | LOG2 (level, "CHN ready %s\n", ch->root_rel->client_ready ? "YES" : "NO"); |
1660 | LOG2 (level, "CHN id %X\n", ch->lid_root); | 1665 | LOG2 (level, "CHN id %X\n", ch->lid_root.channel_of_client); |
1661 | LOG2 (level, "CHN recv %d\n", ch->root_rel->n_recv); | 1666 | LOG2 (level, "CHN recv %d\n", ch->root_rel->n_recv); |
1662 | LOG2 (level, "CHN MID r: %d, s: %d\n", | 1667 | LOG2 (level, "CHN MID r: %d, s: %d\n", |
1663 | ch->root_rel->mid_recv, ch->root_rel->mid_send); | 1668 | ch->root_rel->mid_recv, ch->root_rel->mid_send); |
@@ -1733,17 +1738,18 @@ GCCH_handle_local_ack (struct CadetChannel *ch, int fwd) | |||
1733 | * @param message Data message. | 1738 | * @param message Data message. |
1734 | * @param size Size of data. | 1739 | * @param size Size of data. |
1735 | * | 1740 | * |
1736 | * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. | 1741 | * @return #GNUNET_OK if everything goes well, #GNUNET_SYSERR in case of en error. |
1737 | */ | 1742 | */ |
1738 | int | 1743 | int |
1739 | GCCH_handle_local_data (struct CadetChannel *ch, | 1744 | GCCH_handle_local_data (struct CadetChannel *ch, |
1740 | struct CadetClient *c, int fwd, | 1745 | struct CadetClient *c, |
1746 | int fwd, | ||
1741 | const struct GNUNET_MessageHeader *message, | 1747 | const struct GNUNET_MessageHeader *message, |
1742 | size_t size) | 1748 | size_t size) |
1743 | { | 1749 | { |
1744 | struct CadetChannelReliability *rel; | 1750 | struct CadetChannelReliability *rel; |
1745 | struct GNUNET_CADET_Data *payload; | 1751 | struct GNUNET_CADET_ChannelAppDataMessage *payload; |
1746 | uint16_t p2p_size = sizeof(struct GNUNET_CADET_Data) + size; | 1752 | uint16_t p2p_size = sizeof(struct GNUNET_CADET_ChannelAppDataMessage) + size; |
1747 | unsigned char cbuf[p2p_size]; | 1753 | unsigned char cbuf[p2p_size]; |
1748 | unsigned char buffer; | 1754 | unsigned char buffer; |
1749 | 1755 | ||
@@ -1769,13 +1775,13 @@ GCCH_handle_local_data (struct CadetChannel *ch, | |||
1769 | rel->client_allowed = GNUNET_NO; | 1775 | rel->client_allowed = GNUNET_NO; |
1770 | 1776 | ||
1771 | /* Ok, everything is correct, send the message. */ | 1777 | /* Ok, everything is correct, send the message. */ |
1772 | payload = (struct GNUNET_CADET_Data *) cbuf; | 1778 | payload = (struct GNUNET_CADET_ChannelAppDataMessage *) cbuf; |
1773 | payload->mid = htonl (rel->mid_send); | 1779 | payload->mid = htonl (rel->mid_send); |
1774 | rel->mid_send++; | 1780 | rel->mid_send++; |
1775 | GNUNET_memcpy (&payload[1], message, size); | 1781 | GNUNET_memcpy (&payload[1], message, size); |
1776 | payload->header.size = htons (p2p_size); | 1782 | payload->header.size = htons (p2p_size); |
1777 | payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA); | 1783 | payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA); |
1778 | payload->chid = htonl (ch->gid); | 1784 | payload->chid = ch->gid; |
1779 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); | 1785 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); |
1780 | GCCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); | 1786 | GCCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); |
1781 | 1787 | ||
@@ -1840,16 +1846,16 @@ GCCH_handle_local_destroy (struct CadetChannel *ch, | |||
1840 | */ | 1846 | */ |
1841 | int | 1847 | int |
1842 | GCCH_handle_local_create (struct CadetClient *c, | 1848 | GCCH_handle_local_create (struct CadetClient *c, |
1843 | struct GNUNET_CADET_ChannelCreateMessage *msg) | 1849 | struct GNUNET_CADET_ChannelOpenMessageMessage *msg) |
1844 | { | 1850 | { |
1845 | struct CadetChannel *ch; | 1851 | struct CadetChannel *ch; |
1846 | struct CadetTunnel *t; | 1852 | struct CadetTunnel *t; |
1847 | struct CadetPeer *peer; | 1853 | struct CadetPeer *peer; |
1848 | CADET_ChannelNumber chid; | 1854 | struct GNUNET_CADET_ClientChannelNumber chid; |
1849 | 1855 | ||
1850 | LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", | 1856 | LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", |
1851 | GNUNET_i2s (&msg->peer), GNUNET_h2s (&msg->port)); | 1857 | GNUNET_i2s (&msg->peer), GNUNET_h2s (&msg->port)); |
1852 | chid = ntohl (msg->channel_id); | 1858 | chid = msg->channel_id; |
1853 | 1859 | ||
1854 | /* Sanity check for duplicate channel IDs */ | 1860 | /* Sanity check for duplicate channel IDs */ |
1855 | if (NULL != GML_channel_get (c, chid)) | 1861 | if (NULL != GML_channel_get (c, chid)) |
@@ -1908,7 +1914,7 @@ GCCH_handle_local_create (struct CadetClient *c, | |||
1908 | */ | 1914 | */ |
1909 | void | 1915 | void |
1910 | GCCH_handle_data (struct CadetChannel *ch, | 1916 | GCCH_handle_data (struct CadetChannel *ch, |
1911 | const struct GNUNET_CADET_Data *msg, | 1917 | const struct GNUNET_CADET_ChannelAppDataMessage *msg, |
1912 | int fwd) | 1918 | int fwd) |
1913 | { | 1919 | { |
1914 | struct CadetChannelReliability *rel; | 1920 | struct CadetChannelReliability *rel; |
@@ -1966,24 +1972,26 @@ GCCH_handle_data (struct CadetChannel *ch, | |||
1966 | 1972 | ||
1967 | mid = ntohl (msg->mid); | 1973 | mid = ntohl (msg->mid); |
1968 | LOG (GNUNET_ERROR_TYPE_INFO, "<== %s (%s %4u) on chan %s (%p) %s [%5u]\n", | 1974 | LOG (GNUNET_ERROR_TYPE_INFO, "<== %s (%s %4u) on chan %s (%p) %s [%5u]\n", |
1969 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_DATA), GC_m2s (payload_type), mid, | 1975 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA), GC_m2s (payload_type), mid, |
1970 | GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); | 1976 | GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); |
1971 | 1977 | ||
1972 | if (GNUNET_NO == ch->reliable || | 1978 | if ( (GNUNET_NO == ch->reliable) || |
1973 | ( !GC_is_pid_bigger (rel->mid_recv, mid) && | 1979 | ( (! GC_is_pid_bigger (rel->mid_recv, mid)) && |
1974 | GC_is_pid_bigger (rel->mid_recv + 64, mid) ) ) | 1980 | GC_is_pid_bigger (rel->mid_recv + 64, mid) ) ) |
1975 | { | 1981 | { |
1976 | if (GNUNET_YES == ch->reliable) | 1982 | if (GNUNET_YES == ch->reliable) |
1977 | { | 1983 | { |
1978 | /* Is this the exact next expected messasge? */ | 1984 | /* Is this the exact next expected messasge? */ |
1979 | if (mid == rel->mid_recv) | 1985 | if (mid == rel->mid_recv) |
1980 | { | 1986 | { |
1981 | LOG (GNUNET_ERROR_TYPE_DEBUG, "as expected, sending to client\n"); | 1987 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1988 | "as expected, sending to client\n"); | ||
1982 | send_client_data (ch, msg, fwd); | 1989 | send_client_data (ch, msg, fwd); |
1983 | } | 1990 | } |
1984 | else | 1991 | else |
1985 | { | 1992 | { |
1986 | LOG (GNUNET_ERROR_TYPE_DEBUG, "save for later\n"); | 1993 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1994 | "save for later\n"); | ||
1987 | add_buffered_data (msg, rel); | 1995 | add_buffered_data (msg, rel); |
1988 | } | 1996 | } |
1989 | } | 1997 | } |
@@ -2001,7 +2009,7 @@ GCCH_handle_data (struct CadetChannel *ch, | |||
2001 | if (GC_is_pid_bigger (rel->mid_recv, mid)) | 2009 | if (GC_is_pid_bigger (rel->mid_recv, mid)) |
2002 | { | 2010 | { |
2003 | GNUNET_break_op (0); | 2011 | GNUNET_break_op (0); |
2004 | LOG (GNUNET_ERROR_TYPE_INFO, | 2012 | LOG (GNUNET_ERROR_TYPE_WARNING, |
2005 | "MID %u on channel %s not expected (window: %u - %u). Dropping!\n", | 2013 | "MID %u on channel %s not expected (window: %u - %u). Dropping!\n", |
2006 | mid, GCCH_2s (ch), rel->mid_recv, rel->mid_recv + 63); | 2014 | mid, GCCH_2s (ch), rel->mid_recv, rel->mid_recv + 63); |
2007 | } | 2015 | } |
@@ -2036,7 +2044,7 @@ GCCH_handle_data (struct CadetChannel *ch, | |||
2036 | */ | 2044 | */ |
2037 | void | 2045 | void |
2038 | GCCH_handle_data_ack (struct CadetChannel *ch, | 2046 | GCCH_handle_data_ack (struct CadetChannel *ch, |
2039 | const struct GNUNET_CADET_DataACK *msg, | 2047 | const struct GNUNET_CADET_ChannelDataAckMessage *msg, |
2040 | int fwd) | 2048 | int fwd) |
2041 | { | 2049 | { |
2042 | struct CadetChannelReliability *rel; | 2050 | struct CadetChannelReliability *rel; |
@@ -2061,7 +2069,7 @@ GCCH_handle_data_ack (struct CadetChannel *ch, | |||
2061 | ack = ntohl (msg->mid); | 2069 | ack = ntohl (msg->mid); |
2062 | LOG (GNUNET_ERROR_TYPE_INFO, | 2070 | LOG (GNUNET_ERROR_TYPE_INFO, |
2063 | "<== %s (0x%010lX %4u) on chan %s (%p) %s [%5u]\n", | 2071 | "<== %s (0x%010lX %4u) on chan %s (%p) %s [%5u]\n", |
2064 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_DATA_ACK), msg->futures, ack, | 2072 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK), msg->futures, ack, |
2065 | GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); | 2073 | GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); |
2066 | 2074 | ||
2067 | if (GNUNET_YES == fwd) | 2075 | if (GNUNET_YES == fwd) |
@@ -2143,22 +2151,23 @@ GCCH_handle_data_ack (struct CadetChannel *ch, | |||
2143 | */ | 2151 | */ |
2144 | struct CadetChannel * | 2152 | struct CadetChannel * |
2145 | GCCH_handle_create (struct CadetTunnel *t, | 2153 | GCCH_handle_create (struct CadetTunnel *t, |
2146 | const struct GNUNET_CADET_ChannelCreate *msg) | 2154 | const struct GNUNET_CADET_ChannelOpenMessage *msg) |
2147 | { | 2155 | { |
2148 | CADET_ChannelNumber chid; | 2156 | struct GNUNET_CADET_ClientChannelNumber chid; |
2157 | struct GNUNET_CADET_ChannelTunnelNumber gid; | ||
2149 | struct CadetChannel *ch; | 2158 | struct CadetChannel *ch; |
2150 | struct CadetClient *c; | 2159 | struct CadetClient *c; |
2151 | int new_channel; | 2160 | int new_channel; |
2152 | const struct GNUNET_HashCode *port; | 2161 | const struct GNUNET_HashCode *port; |
2153 | 2162 | ||
2154 | chid = ntohl (msg->chid); | 2163 | gid = msg->chid; |
2155 | 2164 | ch = GCT_get_channel (t, gid); | |
2156 | ch = GCT_get_channel (t, chid); | ||
2157 | if (NULL == ch) | 2165 | if (NULL == ch) |
2158 | { | 2166 | { |
2159 | /* Create channel */ | 2167 | /* Create channel */ |
2160 | ch = channel_new (t, NULL, 0); | 2168 | chid.channel_of_client = htonl (0); |
2161 | ch->gid = chid; | 2169 | ch = channel_new (t, NULL, chid); |
2170 | ch->gid = gid; | ||
2162 | channel_set_options (ch, ntohl (msg->opt)); | 2171 | channel_set_options (ch, ntohl (msg->opt)); |
2163 | new_channel = GNUNET_YES; | 2172 | new_channel = GNUNET_YES; |
2164 | } | 2173 | } |
@@ -2170,7 +2179,7 @@ GCCH_handle_create (struct CadetTunnel *t, | |||
2170 | 2179 | ||
2171 | LOG (GNUNET_ERROR_TYPE_INFO, | 2180 | LOG (GNUNET_ERROR_TYPE_INFO, |
2172 | "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", | 2181 | "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", |
2173 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE), chid, port, | 2182 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN), chid, port, |
2174 | GCCH_2s (ch), ch, GC_f2s (GNUNET_YES), ntohs (msg->header.size)); | 2183 | GCCH_2s (ch), ch, GC_f2s (GNUNET_YES), ntohs (msg->header.size)); |
2175 | 2184 | ||
2176 | if (GNUNET_YES == new_channel || GCT_is_loopback (t)) | 2185 | if (GNUNET_YES == new_channel || GCT_is_loopback (t)) |
@@ -2243,7 +2252,7 @@ GCCH_handle_nack (struct CadetChannel *ch) | |||
2243 | { | 2252 | { |
2244 | LOG (GNUNET_ERROR_TYPE_INFO, | 2253 | LOG (GNUNET_ERROR_TYPE_INFO, |
2245 | "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", | 2254 | "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", |
2246 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK), ch->gid, 0, | 2255 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED), ch->gid, 0, |
2247 | GCCH_2s (ch), ch, "---", 0); | 2256 | GCCH_2s (ch), ch, "---", 0); |
2248 | 2257 | ||
2249 | send_client_nack (ch); | 2258 | send_client_nack (ch); |
@@ -2263,12 +2272,12 @@ GCCH_handle_nack (struct CadetChannel *ch) | |||
2263 | */ | 2272 | */ |
2264 | void | 2273 | void |
2265 | GCCH_handle_ack (struct CadetChannel *ch, | 2274 | GCCH_handle_ack (struct CadetChannel *ch, |
2266 | const struct GNUNET_CADET_ChannelManage *msg, | 2275 | const struct GNUNET_CADET_ChannelManageMessage *msg, |
2267 | int fwd) | 2276 | int fwd) |
2268 | { | 2277 | { |
2269 | LOG (GNUNET_ERROR_TYPE_INFO, | 2278 | LOG (GNUNET_ERROR_TYPE_INFO, |
2270 | "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", | 2279 | "<== %s ( 0x%08X %4u) on chan %s (%p) %s [%5u]\n", |
2271 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK), ch->gid, 0, | 2280 | GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK), ch->gid, 0, |
2272 | GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); | 2281 | GCCH_2s (ch), ch, GC_f2s (fwd), ntohs (msg->header.size)); |
2273 | 2282 | ||
2274 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | 2283 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ |
@@ -2299,7 +2308,7 @@ GCCH_handle_ack (struct CadetChannel *ch, | |||
2299 | */ | 2308 | */ |
2300 | void | 2309 | void |
2301 | GCCH_handle_destroy (struct CadetChannel *ch, | 2310 | GCCH_handle_destroy (struct CadetChannel *ch, |
2302 | const struct GNUNET_CADET_ChannelManage *msg, | 2311 | const struct GNUNET_CADET_ChannelManageMessage *msg, |
2303 | int fwd) | 2312 | int fwd) |
2304 | { | 2313 | { |
2305 | struct CadetChannelReliability *rel; | 2314 | struct CadetChannelReliability *rel; |
@@ -2374,13 +2383,13 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2374 | data_id = 0; | 2383 | data_id = 0; |
2375 | switch (type) | 2384 | switch (type) |
2376 | { | 2385 | { |
2377 | case GNUNET_MESSAGE_TYPE_CADET_DATA: | 2386 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: |
2378 | { | 2387 | { |
2379 | struct GNUNET_CADET_Data *data_msg; | 2388 | struct GNUNET_CADET_ChannelAppDataMessage *data_msg; |
2380 | struct GNUNET_MessageHeader *payload_msg; | 2389 | struct GNUNET_MessageHeader *payload_msg; |
2381 | uint16_t payload_type; | 2390 | uint16_t payload_type; |
2382 | 2391 | ||
2383 | data_msg = (struct GNUNET_CADET_Data *) message; | 2392 | data_msg = (struct GNUNET_CADET_ChannelAppDataMessage *) message; |
2384 | data_id = ntohl (data_msg->mid); | 2393 | data_id = ntohl (data_msg->mid); |
2385 | payload_msg = (struct GNUNET_MessageHeader *) &data_msg[1]; | 2394 | payload_msg = (struct GNUNET_MessageHeader *) &data_msg[1]; |
2386 | payload_type = ntohs (payload_msg->type); | 2395 | payload_type = ntohs (payload_msg->type); |
@@ -2388,28 +2397,29 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2388 | info[31] = '\0'; | 2397 | info[31] = '\0'; |
2389 | break; | 2398 | break; |
2390 | } | 2399 | } |
2391 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: | 2400 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: |
2392 | { | 2401 | { |
2393 | struct GNUNET_CADET_DataACK *ack_msg; | 2402 | struct GNUNET_CADET_ChannelDataAckMessage *ack_msg; |
2394 | ack_msg = (struct GNUNET_CADET_DataACK *) message; | 2403 | ack_msg = (struct GNUNET_CADET_ChannelDataAckMessage *) message; |
2395 | data_id = ntohl (ack_msg->mid); | 2404 | data_id = ntohl (ack_msg->mid); |
2396 | SPRINTF (info, "0x%010lX", ack_msg->futures); | 2405 | SPRINTF (info, "0x%010lX", |
2406 | (unsigned long int) ack_msg->futures); | ||
2397 | break; | 2407 | break; |
2398 | } | 2408 | } |
2399 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: | 2409 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: |
2400 | { | 2410 | { |
2401 | struct GNUNET_CADET_ChannelCreate *cc_msg; | 2411 | struct GNUNET_CADET_ChannelOpenMessage *cc_msg; |
2402 | cc_msg = (struct GNUNET_CADET_ChannelCreate *) message; | 2412 | cc_msg = (struct GNUNET_CADET_ChannelOpenMessage *) message; |
2403 | SPRINTF (info, " 0x%08X", ntohl (cc_msg->chid)); | 2413 | SPRINTF (info, " 0x%08X", ntohl (cc_msg->chid.cn)); |
2404 | break; | 2414 | break; |
2405 | } | 2415 | } |
2406 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: | 2416 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: |
2407 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: | 2417 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: |
2408 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: | 2418 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
2409 | { | 2419 | { |
2410 | struct GNUNET_CADET_ChannelManage *m_msg; | 2420 | struct GNUNET_CADET_ChannelManageMessage *m_msg; |
2411 | m_msg = (struct GNUNET_CADET_ChannelManage *) message; | 2421 | m_msg = (struct GNUNET_CADET_ChannelManageMessage *) message; |
2412 | SPRINTF (info, " 0x%08X", ntohl (m_msg->chid)); | 2422 | SPRINTF (info, " 0x%08X", ntohl (m_msg->chid.cn)); |
2413 | break; | 2423 | break; |
2414 | } | 2424 | } |
2415 | default: | 2425 | default: |
@@ -2428,7 +2438,7 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2428 | 2438 | ||
2429 | switch (type) | 2439 | switch (type) |
2430 | { | 2440 | { |
2431 | case GNUNET_MESSAGE_TYPE_CADET_DATA: | 2441 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: |
2432 | if (GNUNET_YES == ch->reliable) | 2442 | if (GNUNET_YES == ch->reliable) |
2433 | { | 2443 | { |
2434 | chq = GNUNET_new (struct CadetChannelQueue); | 2444 | chq = GNUNET_new (struct CadetChannelQueue); |
@@ -2474,9 +2484,9 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2474 | break; | 2484 | break; |
2475 | 2485 | ||
2476 | 2486 | ||
2477 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: | 2487 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: |
2478 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: | 2488 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: |
2479 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: | 2489 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: |
2480 | chq = GNUNET_new (struct CadetChannelQueue); | 2490 | chq = GNUNET_new (struct CadetChannelQueue); |
2481 | chq->type = type; | 2491 | chq->type = type; |
2482 | chq->rel = fwd ? ch->root_rel : ch->dest_rel; | 2492 | chq->rel = fwd ? ch->root_rel : ch->dest_rel; |
@@ -2495,22 +2505,23 @@ GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2495 | } | 2505 | } |
2496 | } | 2506 | } |
2497 | 2507 | ||
2508 | chq->rel->uniq = chq; | ||
2498 | chq->tq = GCT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES, | 2509 | chq->tq = GCT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES, |
2499 | &ch_message_sent, chq); | 2510 | &ch_message_sent, chq); |
2500 | if (NULL == chq->tq) | 2511 | if (NULL == chq->tq) |
2501 | { | 2512 | { |
2502 | GNUNET_break (0); | 2513 | GNUNET_break (0); |
2514 | chq->rel->uniq = NULL; | ||
2503 | GCT_debug (ch->t, GNUNET_ERROR_TYPE_ERROR); | 2515 | GCT_debug (ch->t, GNUNET_ERROR_TYPE_ERROR); |
2504 | GNUNET_free (chq); | 2516 | GNUNET_free (chq); |
2505 | chq = NULL; | 2517 | chq = NULL; |
2506 | return; | 2518 | return; |
2507 | } | 2519 | } |
2508 | chq->rel->uniq = chq; | ||
2509 | break; | 2520 | break; |
2510 | 2521 | ||
2511 | 2522 | ||
2512 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: | 2523 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
2513 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: | 2524 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: |
2514 | fire_and_forget (message, ch, GNUNET_YES); | 2525 | fire_and_forget (message, ch, GNUNET_YES); |
2515 | break; | 2526 | break; |
2516 | 2527 | ||
@@ -2538,9 +2549,13 @@ GCCH_2s (const struct CadetChannel *ch) | |||
2538 | if (NULL == ch) | 2549 | if (NULL == ch) |
2539 | return "(NULL Channel)"; | 2550 | return "(NULL Channel)"; |
2540 | 2551 | ||
2541 | SPRINTF (buf, "%s:%s gid:%X (%X / %X)", | 2552 | SPRINTF (buf, |
2542 | GCT_2s (ch->t), GNUNET_h2s (&ch->port), | 2553 | "%s:%s gid:%X (%X / %X)", |
2543 | ch->gid, ch->lid_root, ch->lid_dest); | 2554 | GCT_2s (ch->t), |
2555 | GNUNET_h2s (&ch->port), | ||
2556 | ntohl (ch->gid.cn), | ||
2557 | ntohl (ch->lid_root.channel_of_client), | ||
2558 | ntohl (ch->lid_dest.channel_of_client)); | ||
2544 | 2559 | ||
2545 | return buf; | 2560 | return buf; |
2546 | } | 2561 | } |
diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h index eeea02712..1eeebf34b 100644 --- a/src/cadet/gnunet-service-cadet_channel.h +++ b/src/cadet/gnunet-service-cadet_channel.h | |||
@@ -69,7 +69,7 @@ GCCH_destroy (struct CadetChannel *ch); | |||
69 | * | 69 | * |
70 | * @return ID used to identify the channel with the remote peer. | 70 | * @return ID used to identify the channel with the remote peer. |
71 | */ | 71 | */ |
72 | CADET_ChannelNumber | 72 | struct GNUNET_CADET_ChannelTunnelNumber |
73 | GCCH_get_id (const struct CadetChannel *ch); | 73 | GCCH_get_id (const struct CadetChannel *ch); |
74 | 74 | ||
75 | /** | 75 | /** |
@@ -224,7 +224,7 @@ GCCH_handle_local_destroy (struct CadetChannel *ch, | |||
224 | */ | 224 | */ |
225 | int | 225 | int |
226 | GCCH_handle_local_create (struct CadetClient *c, | 226 | GCCH_handle_local_create (struct CadetClient *c, |
227 | struct GNUNET_CADET_ChannelCreateMessage *msg); | 227 | struct GNUNET_CADET_ChannelOpenMessageMessage *msg); |
228 | 228 | ||
229 | /** | 229 | /** |
230 | * Handler for cadet network payload traffic. | 230 | * Handler for cadet network payload traffic. |
@@ -238,7 +238,7 @@ GCCH_handle_local_create (struct CadetClient *c, | |||
238 | */ | 238 | */ |
239 | void | 239 | void |
240 | GCCH_handle_data (struct CadetChannel *ch, | 240 | GCCH_handle_data (struct CadetChannel *ch, |
241 | const struct GNUNET_CADET_Data *msg, | 241 | const struct GNUNET_CADET_ChannelAppDataMessage *msg, |
242 | int fwd); | 242 | int fwd); |
243 | 243 | ||
244 | 244 | ||
@@ -254,7 +254,7 @@ GCCH_handle_data (struct CadetChannel *ch, | |||
254 | */ | 254 | */ |
255 | void | 255 | void |
256 | GCCH_handle_data_ack (struct CadetChannel *ch, | 256 | GCCH_handle_data_ack (struct CadetChannel *ch, |
257 | const struct GNUNET_CADET_DataACK *msg, | 257 | const struct GNUNET_CADET_ChannelDataAckMessage *msg, |
258 | int fwd); | 258 | int fwd); |
259 | 259 | ||
260 | 260 | ||
@@ -268,7 +268,7 @@ GCCH_handle_data_ack (struct CadetChannel *ch, | |||
268 | */ | 268 | */ |
269 | struct CadetChannel * | 269 | struct CadetChannel * |
270 | GCCH_handle_create (struct CadetTunnel *t, | 270 | GCCH_handle_create (struct CadetTunnel *t, |
271 | const struct GNUNET_CADET_ChannelCreate *msg); | 271 | const struct GNUNET_CADET_ChannelOpenMessage *msg); |
272 | 272 | ||
273 | 273 | ||
274 | /** | 274 | /** |
@@ -294,7 +294,7 @@ GCCH_handle_nack (struct CadetChannel *ch); | |||
294 | */ | 294 | */ |
295 | void | 295 | void |
296 | GCCH_handle_ack (struct CadetChannel *ch, | 296 | GCCH_handle_ack (struct CadetChannel *ch, |
297 | const struct GNUNET_CADET_ChannelManage *msg, | 297 | const struct GNUNET_CADET_ChannelManageMessage *msg, |
298 | int fwd); | 298 | int fwd); |
299 | 299 | ||
300 | 300 | ||
@@ -310,7 +310,7 @@ GCCH_handle_ack (struct CadetChannel *ch, | |||
310 | */ | 310 | */ |
311 | void | 311 | void |
312 | GCCH_handle_destroy (struct CadetChannel *ch, | 312 | GCCH_handle_destroy (struct CadetChannel *ch, |
313 | const struct GNUNET_CADET_ChannelManage *msg, | 313 | const struct GNUNET_CADET_ChannelManageMessage *msg, |
314 | int fwd); | 314 | int fwd); |
315 | 315 | ||
316 | 316 | ||
@@ -347,6 +347,8 @@ const char * | |||
347 | GCCH_2s (const struct CadetChannel *ch); | 347 | GCCH_2s (const struct CadetChannel *ch); |
348 | 348 | ||
349 | 349 | ||
350 | |||
351 | |||
350 | #if 0 /* keep Emacsens' auto-indent happy */ | 352 | #if 0 /* keep Emacsens' auto-indent happy */ |
351 | { | 353 | { |
352 | #endif | 354 | #endif |
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 1c500f716..931b32b95 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c | |||
@@ -112,17 +112,17 @@ struct CadetFlowControl | |||
112 | /** | 112 | /** |
113 | * ID of the next packet to send. | 113 | * ID of the next packet to send. |
114 | */ | 114 | */ |
115 | uint32_t next_pid; | 115 | struct CadetEncryptedMessageIdentifier next_pid; |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * ID of the last packet sent towards the peer. | 118 | * ID of the last packet sent towards the peer. |
119 | */ | 119 | */ |
120 | uint32_t last_pid_sent; | 120 | struct CadetEncryptedMessageIdentifier last_pid_sent; |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * ID of the last packet received from the peer. | 123 | * ID of the last packet received from the peer. |
124 | */ | 124 | */ |
125 | uint32_t last_pid_recv; | 125 | struct CadetEncryptedMessageIdentifier last_pid_recv; |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Bitmap of past 32 messages received: | 128 | * Bitmap of past 32 messages received: |
@@ -132,14 +132,15 @@ struct CadetFlowControl | |||
132 | uint32_t recv_bitmap; | 132 | uint32_t recv_bitmap; |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * Last ACK sent to the peer (peer can't send more than this PID). | 135 | * Last ACK sent to the peer (peer is not allowed to send |
136 | * messages with PIDs higher than this value). | ||
136 | */ | 137 | */ |
137 | uint32_t last_ack_sent; | 138 | struct CadetEncryptedMessageIdentifier last_ack_sent; |
138 | 139 | ||
139 | /** | 140 | /** |
140 | * Last ACK sent towards the origin (for traffic towards leaf node). | 141 | * Last ACK sent towards the origin (for traffic towards leaf node). |
141 | */ | 142 | */ |
142 | uint32_t last_ack_recv; | 143 | struct CadetEncryptedMessageIdentifier last_ack_recv; |
143 | 144 | ||
144 | /** | 145 | /** |
145 | * Task to poll the peer in case of a lost ACK causes stall. | 146 | * Task to poll the peer in case of a lost ACK causes stall. |
@@ -217,7 +218,7 @@ struct CadetConnection | |||
217 | /** | 218 | /** |
218 | * ID of the connection. | 219 | * ID of the connection. |
219 | */ | 220 | */ |
220 | struct GNUNET_CADET_Hash id; | 221 | struct GNUNET_CADET_ConnectionTunnelIdentifier id; |
221 | 222 | ||
222 | /** | 223 | /** |
223 | * Path being used for the tunnel. At the origin of the connection | 224 | * Path being used for the tunnel. At the origin of the connection |
@@ -321,7 +322,7 @@ extern struct GNUNET_PeerIdentity my_full_id; | |||
321 | /** | 322 | /** |
322 | * Connections known, indexed by cid (CadetConnection). | 323 | * Connections known, indexed by cid (CadetConnection). |
323 | */ | 324 | */ |
324 | static struct GNUNET_CONTAINER_MultiHashMap *connections; | 325 | static struct GNUNET_CONTAINER_MultiShortmap *connections; |
325 | 326 | ||
326 | /** | 327 | /** |
327 | * How many connections are we willing to maintain. | 328 | * How many connections are we willing to maintain. |
@@ -358,7 +359,8 @@ static void | |||
358 | fc_debug (struct CadetFlowControl *fc) | 359 | fc_debug (struct CadetFlowControl *fc) |
359 | { | 360 | { |
360 | LOG (GNUNET_ERROR_TYPE_DEBUG, " IN: %u/%u\n", | 361 | LOG (GNUNET_ERROR_TYPE_DEBUG, " IN: %u/%u\n", |
361 | fc->last_pid_recv, fc->last_ack_sent); | 362 | ntohl (fc->last_pid_recv.pid), |
363 | ntohl (fc->last_ack_sent.pid)); | ||
362 | LOG (GNUNET_ERROR_TYPE_DEBUG, " OUT: %u/%u\n", | 364 | LOG (GNUNET_ERROR_TYPE_DEBUG, " OUT: %u/%u\n", |
363 | fc->last_pid_sent, fc->last_ack_recv); | 365 | fc->last_pid_sent, fc->last_ack_recv); |
364 | LOG (GNUNET_ERROR_TYPE_DEBUG, " QUEUE: %u/%u\n", | 366 | LOG (GNUNET_ERROR_TYPE_DEBUG, " QUEUE: %u/%u\n", |
@@ -452,11 +454,11 @@ GCC_state2s (enum CadetConnectionState s) | |||
452 | static void | 454 | static void |
453 | fc_init (struct CadetFlowControl *fc) | 455 | fc_init (struct CadetFlowControl *fc) |
454 | { | 456 | { |
455 | fc->next_pid = (uint32_t) 0; | 457 | fc->next_pid.pid = 0; |
456 | fc->last_pid_sent = (uint32_t) -1; | 458 | fc->last_pid_sent.pid = htonl (UINT32_MAX); |
457 | fc->last_pid_recv = (uint32_t) -1; | 459 | fc->last_pid_recv.pid = htonl (UINT32_MAX); |
458 | fc->last_ack_sent = (uint32_t) 0; | 460 | fc->last_ack_sent.pid = (uint32_t) 0; |
459 | fc->last_ack_recv = (uint32_t) 0; | 461 | fc->last_ack_recv.pid = (uint32_t) 0; |
460 | fc->poll_task = NULL; | 462 | fc->poll_task = NULL; |
461 | fc->poll_time = GNUNET_TIME_UNIT_SECONDS; | 463 | fc->poll_time = GNUNET_TIME_UNIT_SECONDS; |
462 | fc->queue_n = 0; | 464 | fc->queue_n = 0; |
@@ -472,9 +474,10 @@ fc_init (struct CadetFlowControl *fc) | |||
472 | * @return conntection with the given ID @cid or NULL if not found. | 474 | * @return conntection with the given ID @cid or NULL if not found. |
473 | */ | 475 | */ |
474 | static struct CadetConnection * | 476 | static struct CadetConnection * |
475 | connection_get (const struct GNUNET_CADET_Hash *cid) | 477 | connection_get (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) |
476 | { | 478 | { |
477 | return GNUNET_CONTAINER_multihashmap_get (connections, GC_h2hc (cid)); | 479 | return GNUNET_CONTAINER_multishortmap_get (connections, |
480 | &cid->connection_of_tunnel); | ||
478 | } | 481 | } |
479 | 482 | ||
480 | 483 | ||
@@ -540,12 +543,16 @@ send_poll (void *cls); | |||
540 | * @param force Don't optimize out. | 543 | * @param force Don't optimize out. |
541 | */ | 544 | */ |
542 | static void | 545 | static void |
543 | send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) | 546 | send_ack (struct CadetConnection *c, |
547 | unsigned int buffer, | ||
548 | int fwd, | ||
549 | int force) | ||
544 | { | 550 | { |
551 | static struct CadetEncryptedMessageIdentifier zero; | ||
545 | struct CadetFlowControl *next_fc; | 552 | struct CadetFlowControl *next_fc; |
546 | struct CadetFlowControl *prev_fc; | 553 | struct CadetFlowControl *prev_fc; |
547 | struct GNUNET_CADET_ACK msg; | 554 | struct GNUNET_CADET_ConnectionEncryptedAckMessage msg; |
548 | uint32_t ack; | 555 | struct CadetEncryptedMessageIdentifier ack_cemi; |
549 | int delta; | 556 | int delta; |
550 | 557 | ||
551 | GCC_check_connections (); | 558 | GCC_check_connections (); |
@@ -558,24 +565,28 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) | |||
558 | GC_f2s (fwd), GCC_2s (c)); | 565 | GC_f2s (fwd), GCC_2s (c)); |
559 | 566 | ||
560 | /* Check if we need to transmit the ACK. */ | 567 | /* Check if we need to transmit the ACK. */ |
561 | delta = prev_fc->last_ack_sent - prev_fc->last_pid_recv; | 568 | delta = ntohl (prev_fc->last_ack_sent.pid) - ntohl (prev_fc->last_pid_recv.pid); |
562 | if (3 < delta && buffer < delta && GNUNET_NO == force) | 569 | if (3 < delta && buffer < delta && GNUNET_NO == force) |
563 | { | 570 | { |
564 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Not sending ACK, delta > 3\n"); | 571 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Not sending ACK, delta > 3\n"); |
565 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 572 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
566 | " last pid recv: %u, last ack sent: %u\n", | 573 | " last pid recv: %u, last ack sent: %u\n", |
567 | prev_fc->last_pid_recv, prev_fc->last_ack_sent); | 574 | ntohl (prev_fc->last_pid_recv.pid), |
575 | ntohl (prev_fc->last_ack_sent.pid)); | ||
568 | GCC_check_connections (); | 576 | GCC_check_connections (); |
569 | return; | 577 | return; |
570 | } | 578 | } |
571 | 579 | ||
572 | /* Ok, ACK might be necessary, what PID to ACK? */ | 580 | /* Ok, ACK might be necessary, what PID to ACK? */ |
573 | ack = prev_fc->last_pid_recv + buffer; | 581 | ack_cemi.pid = htonl (ntohl (prev_fc->last_pid_recv.pid) + buffer); |
574 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 582 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
575 | " ACK %u, last PID %u, last ACK %u, qmax %u, q %u\n", | 583 | " ACK %u, last PID %u, last ACK %u, qmax %u, q %u\n", |
576 | ack, prev_fc->last_pid_recv, prev_fc->last_ack_sent, | 584 | ntohl (ack_cemi.pid), |
585 | ntohl (prev_fc->last_pid_recv.pid), | ||
586 | ntohl (prev_fc->last_ack_sent.pid), | ||
577 | next_fc->queue_max, next_fc->queue_n); | 587 | next_fc->queue_max, next_fc->queue_n); |
578 | if (ack == prev_fc->last_ack_sent && GNUNET_NO == force) | 588 | if ( (ack_cemi.pid == prev_fc->last_ack_sent.pid) && |
589 | (GNUNET_NO == force) ) | ||
579 | { | 590 | { |
580 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Not sending FWD ACK, not needed\n"); | 591 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Not sending FWD ACK, not needed\n"); |
581 | GCC_check_connections (); | 592 | GCC_check_connections (); |
@@ -585,7 +596,8 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) | |||
585 | /* Check if message is already in queue */ | 596 | /* Check if message is already in queue */ |
586 | if (NULL != prev_fc->ack_msg) | 597 | if (NULL != prev_fc->ack_msg) |
587 | { | 598 | { |
588 | if (GC_is_pid_bigger (ack, prev_fc->last_ack_sent)) | 599 | if (GC_is_pid_bigger (ntohl (ack_cemi.pid), |
600 | ntohl (prev_fc->last_ack_sent.pid))) | ||
589 | { | 601 | { |
590 | LOG (GNUNET_ERROR_TYPE_DEBUG, " canceling old ACK\n"); | 602 | LOG (GNUNET_ERROR_TYPE_DEBUG, " canceling old ACK\n"); |
591 | GCC_cancel (prev_fc->ack_msg); | 603 | GCC_cancel (prev_fc->ack_msg); |
@@ -598,17 +610,22 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) | |||
598 | return; | 610 | return; |
599 | } | 611 | } |
600 | } | 612 | } |
601 | 613 | GNUNET_break (GC_is_pid_bigger (ntohl (ack_cemi.pid), | |
602 | prev_fc->last_ack_sent = ack; | 614 | ntohl (prev_fc->last_ack_sent.pid))); |
615 | prev_fc->last_ack_sent = ack_cemi; | ||
603 | 616 | ||
604 | /* Build ACK message and send on conn */ | 617 | /* Build ACK message and send on conn */ |
605 | msg.header.size = htons (sizeof (msg)); | 618 | msg.header.size = htons (sizeof (msg)); |
606 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_ACK); | 619 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK); |
607 | msg.ack = htonl (ack); | 620 | msg.cemi = ack_cemi; |
608 | msg.cid = c->id; | 621 | msg.cid = c->id; |
609 | 622 | ||
610 | prev_fc->ack_msg = GCC_send_prebuilt_message (&msg.header, UINT16_MAX, ack, | 623 | prev_fc->ack_msg = GCC_send_prebuilt_message (&msg.header, |
611 | c, !fwd, GNUNET_YES, | 624 | UINT16_MAX, |
625 | zero, | ||
626 | c, | ||
627 | !fwd, | ||
628 | GNUNET_YES, | ||
612 | NULL, NULL); | 629 | NULL, NULL); |
613 | GNUNET_assert (NULL != prev_fc->ack_msg); | 630 | GNUNET_assert (NULL != prev_fc->ack_msg); |
614 | GCC_check_connections (); | 631 | GCC_check_connections (); |
@@ -672,8 +689,12 @@ update_perf (struct CadetConnection *c, | |||
672 | */ | 689 | */ |
673 | static void | 690 | static void |
674 | conn_message_sent (void *cls, | 691 | conn_message_sent (void *cls, |
675 | struct CadetConnection *c, int fwd, int sent, | 692 | struct CadetConnection *c, |
676 | uint16_t type, uint16_t payload_type, uint32_t pid, | 693 | int fwd, |
694 | int sent, | ||
695 | uint16_t type, | ||
696 | uint16_t payload_type, | ||
697 | struct CadetEncryptedMessageIdentifier pid, | ||
677 | size_t size, | 698 | size_t size, |
678 | struct GNUNET_TIME_Relative wait) | 699 | struct GNUNET_TIME_Relative wait) |
679 | { | 700 | { |
@@ -684,8 +705,11 @@ conn_message_sent (void *cls, | |||
684 | GCC_check_connections (); | 705 | GCC_check_connections (); |
685 | LOG (GNUNET_ERROR_TYPE_INFO, | 706 | LOG (GNUNET_ERROR_TYPE_INFO, |
686 | ">>> %s (%s %4u) on conn %s (%p) %s [%5u] in queue %s\n", | 707 | ">>> %s (%s %4u) on conn %s (%p) %s [%5u] in queue %s\n", |
687 | GC_m2s (type), GC_m2s (payload_type), pid, GCC_2s (c), c, | 708 | GC_m2s (type), GC_m2s (payload_type), |
688 | GC_f2s(fwd), size, | 709 | ntohl (pid.pid), |
710 | GCC_2s (c), | ||
711 | c, | ||
712 | GC_f2s (fwd), size, | ||
689 | GNUNET_STRINGS_relative_time_to_string (wait, GNUNET_YES)); | 713 | GNUNET_STRINGS_relative_time_to_string (wait, GNUNET_YES)); |
690 | 714 | ||
691 | /* If c is NULL, nothing to update. */ | 715 | /* If c is NULL, nothing to update. */ |
@@ -703,7 +727,8 @@ conn_message_sent (void *cls, | |||
703 | 727 | ||
704 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %ssent %s %s pid %u\n", | 728 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %ssent %s %s pid %u\n", |
705 | sent ? "" : "not ", GC_f2s (fwd), | 729 | sent ? "" : "not ", GC_f2s (fwd), |
706 | GC_m2s (type), GC_m2s (payload_type), pid); | 730 | GC_m2s (type), GC_m2s (payload_type), |
731 | ntohl (pid.pid)); | ||
707 | GCC_debug (c, GNUNET_ERROR_TYPE_DEBUG); | 732 | GCC_debug (c, GNUNET_ERROR_TYPE_DEBUG); |
708 | 733 | ||
709 | /* Update flow control info. */ | 734 | /* Update flow control info. */ |
@@ -722,7 +747,7 @@ conn_message_sent (void *cls, | |||
722 | } | 747 | } |
723 | else /* CONN_CREATE or CONN_ACK */ | 748 | else /* CONN_CREATE or CONN_ACK */ |
724 | { | 749 | { |
725 | GNUNET_assert (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED != type); | 750 | GNUNET_assert (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED != type); |
726 | forced = GNUNET_YES; | 751 | forced = GNUNET_YES; |
727 | } | 752 | } |
728 | 753 | ||
@@ -742,18 +767,19 @@ conn_message_sent (void *cls, | |||
742 | switch (type) | 767 | switch (type) |
743 | { | 768 | { |
744 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: | 769 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: |
745 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: | 770 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK: |
746 | c->maintenance_q = NULL; | 771 | c->maintenance_q = NULL; |
747 | /* Don't trigger a keepalive for sent ACKs, only SYN and SYNACKs */ | 772 | /* Don't trigger a keepalive for sent ACKs, only SYN and SYNACKs */ |
748 | if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE == type || !fwd) | 773 | if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE == type || !fwd) |
749 | schedule_next_keepalive (c, fwd); | 774 | schedule_next_keepalive (c, fwd); |
750 | break; | 775 | break; |
751 | 776 | ||
752 | case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: | 777 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED: |
753 | if (GNUNET_YES == sent) | 778 | if (GNUNET_YES == sent) |
754 | { | 779 | { |
755 | fc->last_pid_sent = pid; | 780 | fc->last_pid_sent = pid; |
756 | if (GC_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv)) | 781 | if (GC_is_pid_bigger (ntohl (fc->last_pid_sent.pid) + 1, |
782 | ntohl (fc->last_ack_recv.pid)) ) | ||
757 | GCC_start_poll (c, fwd); | 783 | GCC_start_poll (c, fwd); |
758 | GCC_send_ack (c, fwd, GNUNET_NO); | 784 | GCC_send_ack (c, fwd, GNUNET_NO); |
759 | connection_reset_timeout (c, fwd); | 785 | connection_reset_timeout (c, fwd); |
@@ -764,23 +790,23 @@ conn_message_sent (void *cls, | |||
764 | { | 790 | { |
765 | fc->queue_n--; | 791 | fc->queue_n--; |
766 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 792 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
767 | "! accounting pid %u\n", | 793 | "! accounting pid %u\n", |
768 | fc->last_pid_sent); | 794 | ntohl (fc->last_pid_sent.pid)); |
769 | } | 795 | } |
770 | else | 796 | else |
771 | { | 797 | { |
772 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 798 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
773 | "! forced, Q_N not accounting pid %u\n", | 799 | "! forced, Q_N not accounting pid %u\n", |
774 | fc->last_pid_sent); | 800 | ntohl (fc->last_pid_sent.pid)); |
775 | } | 801 | } |
776 | break; | 802 | break; |
777 | 803 | ||
778 | case GNUNET_MESSAGE_TYPE_CADET_KX: | 804 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX: |
779 | if (GNUNET_YES == sent) | 805 | if (GNUNET_YES == sent) |
780 | connection_reset_timeout (c, fwd); | 806 | connection_reset_timeout (c, fwd); |
781 | break; | 807 | break; |
782 | 808 | ||
783 | case GNUNET_MESSAGE_TYPE_CADET_POLL: | 809 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL: |
784 | fc->poll_msg = NULL; | 810 | fc->poll_msg = NULL; |
785 | if (2 == c->destroy) | 811 | if (2 == c->destroy) |
786 | { | 812 | { |
@@ -801,7 +827,7 @@ conn_message_sent (void *cls, | |||
801 | LOG (GNUNET_ERROR_TYPE_DEBUG, " task %u\n", fc->poll_task); | 827 | LOG (GNUNET_ERROR_TYPE_DEBUG, " task %u\n", fc->poll_task); |
802 | break; | 828 | break; |
803 | 829 | ||
804 | case GNUNET_MESSAGE_TYPE_CADET_ACK: | 830 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK: |
805 | fc->ack_msg = NULL; | 831 | fc->ack_msg = NULL; |
806 | break; | 832 | break; |
807 | 833 | ||
@@ -905,7 +931,7 @@ check_neighbours (const struct CadetConnection *c) | |||
905 | */ | 931 | */ |
906 | static int | 932 | static int |
907 | check_connection (void *cls, | 933 | check_connection (void *cls, |
908 | const struct GNUNET_HashCode *key, | 934 | const struct GNUNET_ShortHashCode *key, |
909 | void *value) | 935 | void *value) |
910 | { | 936 | { |
911 | struct CadetConnection *c = value; | 937 | struct CadetConnection *c = value; |
@@ -925,9 +951,9 @@ GCC_check_connections () | |||
925 | return; | 951 | return; |
926 | if (NULL == connections) | 952 | if (NULL == connections) |
927 | return; | 953 | return; |
928 | GNUNET_CONTAINER_multihashmap_iterate (connections, | 954 | GNUNET_CONTAINER_multishortmap_iterate (connections, |
929 | &check_connection, | 955 | &check_connection, |
930 | NULL); | 956 | NULL); |
931 | } | 957 | } |
932 | 958 | ||
933 | 959 | ||
@@ -953,9 +979,11 @@ get_hop (struct CadetConnection *c, int fwd) | |||
953 | * @param ooo_pid PID of the out-of-order message. | 979 | * @param ooo_pid PID of the out-of-order message. |
954 | */ | 980 | */ |
955 | static uint32_t | 981 | static uint32_t |
956 | get_recv_bitmask (uint32_t last_pid_recv, uint32_t ooo_pid) | 982 | get_recv_bitmask (struct CadetEncryptedMessageIdentifier last_pid_recv, |
983 | struct CadetEncryptedMessageIdentifier ooo_pid) | ||
957 | { | 984 | { |
958 | return 1 << (last_pid_recv - ooo_pid); | 985 | // FIXME: should assert that the delta is in range... |
986 | return 1 << (ntohl (last_pid_recv.pid) - ntohl (ooo_pid.pid)); | ||
959 | } | 987 | } |
960 | 988 | ||
961 | 989 | ||
@@ -967,14 +995,18 @@ get_recv_bitmask (uint32_t last_pid_recv, uint32_t ooo_pid) | |||
967 | * @param last_pid_recv Last in-order PID received. | 995 | * @param last_pid_recv Last in-order PID received. |
968 | */ | 996 | */ |
969 | static int | 997 | static int |
970 | is_ooo_ok (uint32_t last_pid_recv, uint32_t ooo_pid, uint32_t ooo_bitmap) | 998 | is_ooo_ok (struct CadetEncryptedMessageIdentifier last_pid_recv, |
999 | struct CadetEncryptedMessageIdentifier ooo_pid, | ||
1000 | uint32_t ooo_bitmap) | ||
971 | { | 1001 | { |
972 | uint32_t mask; | 1002 | uint32_t mask; |
973 | 1003 | ||
974 | if (GC_is_pid_bigger (last_pid_recv - 31, ooo_pid)) | 1004 | if (GC_is_pid_bigger (ntohl (last_pid_recv.pid) - 31, |
1005 | ntohl (ooo_pid.pid))) | ||
975 | return GNUNET_NO; | 1006 | return GNUNET_NO; |
976 | 1007 | ||
977 | mask = get_recv_bitmask (last_pid_recv, ooo_pid); | 1008 | mask = get_recv_bitmask (last_pid_recv, |
1009 | ooo_pid); | ||
978 | if (0 != (ooo_bitmap & mask)) | 1010 | if (0 != (ooo_bitmap & mask)) |
979 | return GNUNET_NO; | 1011 | return GNUNET_NO; |
980 | 1012 | ||
@@ -1021,10 +1053,11 @@ is_fwd (const struct CadetConnection *c, | |||
1021 | static void | 1053 | static void |
1022 | send_connection_ack (struct CadetConnection *c, int fwd) | 1054 | send_connection_ack (struct CadetConnection *c, int fwd) |
1023 | { | 1055 | { |
1024 | struct GNUNET_CADET_ConnectionACK msg; | 1056 | static struct CadetEncryptedMessageIdentifier zero; |
1057 | struct GNUNET_CADET_ConnectionCreateMessageAckMessage msg; | ||
1025 | struct CadetTunnel *t; | 1058 | struct CadetTunnel *t; |
1026 | const uint16_t size = sizeof (struct GNUNET_CADET_ConnectionACK); | 1059 | const uint16_t size = sizeof (struct GNUNET_CADET_ConnectionCreateMessageAckMessage); |
1027 | const uint16_t type = GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK; | 1060 | const uint16_t type = GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK; |
1028 | 1061 | ||
1029 | GCC_check_connections (); | 1062 | GCC_check_connections (); |
1030 | t = c->t; | 1063 | t = c->t; |
@@ -1038,9 +1071,12 @@ send_connection_ack (struct CadetConnection *c, int fwd) | |||
1038 | msg.cid = c->id; | 1071 | msg.cid = c->id; |
1039 | 1072 | ||
1040 | GNUNET_assert (NULL == c->maintenance_q); | 1073 | GNUNET_assert (NULL == c->maintenance_q); |
1041 | c->maintenance_q = GCP_send (get_hop (c, fwd), &msg.header, | 1074 | c->maintenance_q = GCP_send (get_hop (c, fwd), |
1042 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0, | 1075 | &msg.header, |
1043 | c, fwd, | 1076 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, |
1077 | zero, | ||
1078 | c, | ||
1079 | fwd, | ||
1044 | &conn_message_sent, NULL); | 1080 | &conn_message_sent, NULL); |
1045 | LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (conn`ACK)\n", | 1081 | LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (conn`ACK)\n", |
1046 | c, c->pending_messages); | 1082 | c, c->pending_messages); |
@@ -1068,17 +1104,23 @@ send_broken (struct CadetConnection *c, | |||
1068 | const struct GNUNET_PeerIdentity *id2, | 1104 | const struct GNUNET_PeerIdentity *id2, |
1069 | int fwd) | 1105 | int fwd) |
1070 | { | 1106 | { |
1071 | struct GNUNET_CADET_ConnectionBroken msg; | 1107 | static struct CadetEncryptedMessageIdentifier zero; |
1108 | struct GNUNET_CADET_ConnectionBrokenMessage msg; | ||
1072 | 1109 | ||
1073 | GCC_check_connections (); | 1110 | GCC_check_connections (); |
1074 | msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken)); | 1111 | msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBrokenMessage)); |
1075 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); | 1112 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); |
1076 | msg.cid = c->id; | 1113 | msg.cid = c->id; |
1077 | msg.reserved = htonl (0); | 1114 | msg.reserved = htonl (0); |
1078 | msg.peer1 = *id1; | 1115 | msg.peer1 = *id1; |
1079 | msg.peer2 = *id2; | 1116 | msg.peer2 = *id2; |
1080 | (void) GCC_send_prebuilt_message (&msg.header, UINT16_MAX, 0, c, fwd, | 1117 | (void) GCC_send_prebuilt_message (&msg.header, |
1081 | GNUNET_YES, NULL, NULL); | 1118 | UINT16_MAX, |
1119 | zero, | ||
1120 | c, | ||
1121 | fwd, | ||
1122 | GNUNET_YES, | ||
1123 | NULL, NULL); | ||
1082 | GCC_check_connections (); | 1124 | GCC_check_connections (); |
1083 | } | 1125 | } |
1084 | 1126 | ||
@@ -1093,18 +1135,19 @@ send_broken (struct CadetConnection *c, | |||
1093 | * @param neighbor Peer to notify (neighbor who sent the connection). | 1135 | * @param neighbor Peer to notify (neighbor who sent the connection). |
1094 | */ | 1136 | */ |
1095 | static void | 1137 | static void |
1096 | send_broken_unknown (const struct GNUNET_CADET_Hash *connection_id, | 1138 | send_broken_unknown (const struct GNUNET_CADET_ConnectionTunnelIdentifier *connection_id, |
1097 | const struct GNUNET_PeerIdentity *id1, | 1139 | const struct GNUNET_PeerIdentity *id1, |
1098 | const struct GNUNET_PeerIdentity *id2, | 1140 | const struct GNUNET_PeerIdentity *id2, |
1099 | struct CadetPeer *neighbor) | 1141 | struct CadetPeer *neighbor) |
1100 | { | 1142 | { |
1101 | struct GNUNET_CADET_ConnectionBroken msg; | 1143 | static struct CadetEncryptedMessageIdentifier zero; |
1144 | struct GNUNET_CADET_ConnectionBrokenMessage msg; | ||
1102 | 1145 | ||
1103 | GCC_check_connections (); | 1146 | GCC_check_connections (); |
1104 | LOG (GNUNET_ERROR_TYPE_INFO, "--> BROKEN on unknown connection %s\n", | 1147 | LOG (GNUNET_ERROR_TYPE_INFO, "--> BROKEN on unknown connection %s\n", |
1105 | GNUNET_h2s (GC_h2hc (connection_id))); | 1148 | GNUNET_sh2s (&connection_id->connection_of_tunnel)); |
1106 | 1149 | ||
1107 | msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken)); | 1150 | msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBrokenMessage)); |
1108 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); | 1151 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN); |
1109 | msg.cid = *connection_id; | 1152 | msg.cid = *connection_id; |
1110 | msg.reserved = htonl (0); | 1153 | msg.reserved = htonl (0); |
@@ -1113,9 +1156,12 @@ send_broken_unknown (const struct GNUNET_CADET_Hash *connection_id, | |||
1113 | msg.peer2 = *id2; | 1156 | msg.peer2 = *id2; |
1114 | else | 1157 | else |
1115 | memset (&msg.peer2, 0, sizeof (msg.peer2)); | 1158 | memset (&msg.peer2, 0, sizeof (msg.peer2)); |
1116 | GNUNET_assert (NULL != GCP_send (neighbor, &msg.header, | 1159 | GNUNET_assert (NULL != GCP_send (neighbor, |
1117 | UINT16_MAX, 2, | 1160 | &msg.header, |
1118 | NULL, GNUNET_SYSERR, /* connection, fwd */ | 1161 | UINT16_MAX, |
1162 | zero, | ||
1163 | NULL, | ||
1164 | GNUNET_SYSERR, /* connection, fwd */ | ||
1119 | NULL, NULL)); /* continuation */ | 1165 | NULL, NULL)); /* continuation */ |
1120 | GCC_check_connections (); | 1166 | GCC_check_connections (); |
1121 | } | 1167 | } |
@@ -1153,7 +1199,7 @@ send_connection_keepalive (struct CadetConnection *c, int fwd) | |||
1153 | 1199 | ||
1154 | GNUNET_assert (NULL != c->t); | 1200 | GNUNET_assert (NULL != c->t); |
1155 | msg.size = htons (sizeof (msg)); | 1201 | msg.size = htons (sizeof (msg)); |
1156 | msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE); | 1202 | msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE); |
1157 | 1203 | ||
1158 | GNUNET_assert (NULL == | 1204 | GNUNET_assert (NULL == |
1159 | GCT_send_prebuilt_message (&msg, c->t, c, | 1205 | GCT_send_prebuilt_message (&msg, c->t, c, |
@@ -1410,8 +1456,9 @@ connection_cancel_queues (struct CadetConnection *c, | |||
1410 | static void | 1456 | static void |
1411 | send_poll (void *cls) | 1457 | send_poll (void *cls) |
1412 | { | 1458 | { |
1459 | static struct CadetEncryptedMessageIdentifier zero; | ||
1413 | struct CadetFlowControl *fc = cls; | 1460 | struct CadetFlowControl *fc = cls; |
1414 | struct GNUNET_CADET_Poll msg; | 1461 | struct GNUNET_CADET_ConnectionHopByHopPollMessage msg; |
1415 | struct CadetConnection *c; | 1462 | struct CadetConnection *c; |
1416 | int fwd; | 1463 | int fwd; |
1417 | 1464 | ||
@@ -1422,14 +1469,20 @@ send_poll (void *cls) | |||
1422 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Polling connection %s %s\n", | 1469 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Polling connection %s %s\n", |
1423 | GCC_2s (c), GC_f2s (fwd)); | 1470 | GCC_2s (c), GC_f2s (fwd)); |
1424 | 1471 | ||
1425 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_POLL); | 1472 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL); |
1426 | msg.header.size = htons (sizeof (msg)); | 1473 | msg.header.size = htons (sizeof (msg)); |
1427 | msg.cid = c->id; | 1474 | msg.cid = c->id; |
1428 | msg.pid = htonl (fc->last_pid_sent); | 1475 | msg.cemi = fc->last_pid_sent; |
1429 | LOG (GNUNET_ERROR_TYPE_DEBUG, " last pid sent: %u\n", fc->last_pid_sent); | 1476 | LOG (GNUNET_ERROR_TYPE_DEBUG, " last pid sent: %u\n", ntohl (fc->last_pid_sent.pid)); |
1430 | fc->poll_msg = | 1477 | fc->poll_msg |
1431 | GCC_send_prebuilt_message (&msg.header, UINT16_MAX, fc->last_pid_sent, c, | 1478 | = GCC_send_prebuilt_message (&msg.header, |
1432 | fc == &c->fwd_fc, GNUNET_YES, NULL, NULL); | 1479 | UINT16_MAX, |
1480 | zero, | ||
1481 | c, | ||
1482 | fc == &c->fwd_fc, | ||
1483 | GNUNET_YES, | ||
1484 | NULL, | ||
1485 | NULL); | ||
1433 | GNUNET_assert (NULL != fc->poll_msg); | 1486 | GNUNET_assert (NULL != fc->poll_msg); |
1434 | GCC_check_connections (); | 1487 | GCC_check_connections (); |
1435 | } | 1488 | } |
@@ -1829,7 +1882,7 @@ add_to_peer (struct CadetConnection *c, | |||
1829 | static void | 1882 | static void |
1830 | log_message (const struct GNUNET_MessageHeader *message, | 1883 | log_message (const struct GNUNET_MessageHeader *message, |
1831 | const struct CadetPeer *peer, | 1884 | const struct CadetPeer *peer, |
1832 | const struct GNUNET_CADET_Hash *conn_id) | 1885 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *conn_id) |
1833 | { | 1886 | { |
1834 | uint16_t size; | 1887 | uint16_t size; |
1835 | uint16_t type; | 1888 | uint16_t type; |
@@ -1840,7 +1893,7 @@ log_message (const struct GNUNET_MessageHeader *message, | |||
1840 | switch (type) | 1893 | switch (type) |
1841 | { | 1894 | { |
1842 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: | 1895 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: |
1843 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: | 1896 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK: |
1844 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: | 1897 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: |
1845 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: | 1898 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: |
1846 | arrow = "=="; | 1899 | arrow = "=="; |
@@ -1848,9 +1901,13 @@ log_message (const struct GNUNET_MessageHeader *message, | |||
1848 | default: | 1901 | default: |
1849 | arrow = "--"; | 1902 | arrow = "--"; |
1850 | } | 1903 | } |
1851 | LOG (GNUNET_ERROR_TYPE_INFO, "<%s %s on conn %s from %s, %6u bytes\n", | 1904 | LOG (GNUNET_ERROR_TYPE_INFO, |
1852 | arrow, GC_m2s (type), GNUNET_h2s (GC_h2hc (conn_id)), | 1905 | "<%s %s on conn %s from %s, %6u bytes\n", |
1853 | GCP_2s(peer), (unsigned int) size); | 1906 | arrow, |
1907 | GC_m2s (type), | ||
1908 | GNUNET_sh2s (&conn_id->connection_of_tunnel), | ||
1909 | GCP_2s(peer), | ||
1910 | (unsigned int) size); | ||
1854 | } | 1911 | } |
1855 | 1912 | ||
1856 | /******************************************************************************/ | 1913 | /******************************************************************************/ |
@@ -1865,9 +1922,10 @@ log_message (const struct GNUNET_MessageHeader *message, | |||
1865 | */ | 1922 | */ |
1866 | void | 1923 | void |
1867 | GCC_handle_create (struct CadetPeer *peer, | 1924 | GCC_handle_create (struct CadetPeer *peer, |
1868 | const struct GNUNET_CADET_ConnectionCreate *msg) | 1925 | const struct GNUNET_CADET_ConnectionCreateMessage *msg) |
1869 | { | 1926 | { |
1870 | const struct GNUNET_CADET_Hash *cid; | 1927 | static struct CadetEncryptedMessageIdentifier zero; |
1928 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid; | ||
1871 | struct GNUNET_PeerIdentity *id; | 1929 | struct GNUNET_PeerIdentity *id; |
1872 | struct CadetPeerPath *path; | 1930 | struct CadetPeerPath *path; |
1873 | struct CadetPeer *dest_peer; | 1931 | struct CadetPeer *dest_peer; |
@@ -1880,7 +1938,7 @@ GCC_handle_create (struct CadetPeer *peer, | |||
1880 | size = ntohs (msg->header.size); | 1938 | size = ntohs (msg->header.size); |
1881 | 1939 | ||
1882 | /* Calculate hops */ | 1940 | /* Calculate hops */ |
1883 | size -= sizeof (struct GNUNET_CADET_ConnectionCreate); | 1941 | size -= sizeof (struct GNUNET_CADET_ConnectionCreateMessage); |
1884 | if (0 != size % sizeof (struct GNUNET_PeerIdentity)) | 1942 | if (0 != size % sizeof (struct GNUNET_PeerIdentity)) |
1885 | { | 1943 | { |
1886 | GNUNET_break_op (0); | 1944 | GNUNET_break_op (0); |
@@ -1989,8 +2047,12 @@ GCC_handle_create (struct CadetPeer *peer, | |||
1989 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); | 2047 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); |
1990 | GCP_add_path (dest_peer, path_duplicate (path), GNUNET_NO); | 2048 | GCP_add_path (dest_peer, path_duplicate (path), GNUNET_NO); |
1991 | GCP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO); | 2049 | GCP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO); |
1992 | (void) GCC_send_prebuilt_message (&msg->header, 0, 0, c, | 2050 | (void) GCC_send_prebuilt_message (&msg->header, |
1993 | GNUNET_YES, GNUNET_YES, NULL, NULL); | 2051 | 0, |
2052 | zero, | ||
2053 | c, | ||
2054 | GNUNET_YES, GNUNET_YES, | ||
2055 | NULL, NULL); | ||
1994 | } | 2056 | } |
1995 | path_destroy (path); | 2057 | path_destroy (path); |
1996 | GCC_check_connections (); | 2058 | GCC_check_connections (); |
@@ -2005,8 +2067,9 @@ GCC_handle_create (struct CadetPeer *peer, | |||
2005 | */ | 2067 | */ |
2006 | void | 2068 | void |
2007 | GCC_handle_confirm (struct CadetPeer *peer, | 2069 | GCC_handle_confirm (struct CadetPeer *peer, |
2008 | const struct GNUNET_CADET_ConnectionACK *msg) | 2070 | const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg) |
2009 | { | 2071 | { |
2072 | static struct CadetEncryptedMessageIdentifier zero; | ||
2010 | struct CadetConnection *c; | 2073 | struct CadetConnection *c; |
2011 | enum CadetConnectionState oldstate; | 2074 | enum CadetConnectionState oldstate; |
2012 | int fwd; | 2075 | int fwd; |
@@ -2114,7 +2177,10 @@ GCC_handle_confirm (struct CadetPeer *peer, | |||
2114 | else | 2177 | else |
2115 | { | 2178 | { |
2116 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); | 2179 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); |
2117 | (void) GCC_send_prebuilt_message (&msg->header, 0, 0, c, fwd, | 2180 | (void) GCC_send_prebuilt_message (&msg->header, 0, |
2181 | zero, | ||
2182 | c, | ||
2183 | fwd, | ||
2118 | GNUNET_YES, NULL, NULL); | 2184 | GNUNET_YES, NULL, NULL); |
2119 | } | 2185 | } |
2120 | GCC_check_connections (); | 2186 | GCC_check_connections (); |
@@ -2129,8 +2195,9 @@ GCC_handle_confirm (struct CadetPeer *peer, | |||
2129 | */ | 2195 | */ |
2130 | void | 2196 | void |
2131 | GCC_handle_broken (struct CadetPeer *peer, | 2197 | GCC_handle_broken (struct CadetPeer *peer, |
2132 | const struct GNUNET_CADET_ConnectionBroken *msg) | 2198 | const struct GNUNET_CADET_ConnectionBrokenMessage *msg) |
2133 | { | 2199 | { |
2200 | static struct CadetEncryptedMessageIdentifier zero; | ||
2134 | struct CadetConnection *c; | 2201 | struct CadetConnection *c; |
2135 | struct CadetTunnel *t; | 2202 | struct CadetTunnel *t; |
2136 | int fwd; | 2203 | int fwd; |
@@ -2183,7 +2250,8 @@ GCC_handle_broken (struct CadetPeer *peer, | |||
2183 | } | 2250 | } |
2184 | else | 2251 | else |
2185 | { | 2252 | { |
2186 | (void) GCC_send_prebuilt_message (&msg->header, 0, 0, c, fwd, | 2253 | (void) GCC_send_prebuilt_message (&msg->header, 0, |
2254 | zero, c, fwd, | ||
2187 | GNUNET_YES, NULL, NULL); | 2255 | GNUNET_YES, NULL, NULL); |
2188 | connection_cancel_queues (c, !fwd); | 2256 | connection_cancel_queues (c, !fwd); |
2189 | } | 2257 | } |
@@ -2200,8 +2268,9 @@ GCC_handle_broken (struct CadetPeer *peer, | |||
2200 | */ | 2268 | */ |
2201 | void | 2269 | void |
2202 | GCC_handle_destroy (struct CadetPeer *peer, | 2270 | GCC_handle_destroy (struct CadetPeer *peer, |
2203 | const struct GNUNET_CADET_ConnectionDestroy *msg) | 2271 | const struct GNUNET_CADET_ConnectionDestroyMessage *msg) |
2204 | { | 2272 | { |
2273 | static struct CadetEncryptedMessageIdentifier zero; | ||
2205 | struct CadetConnection *c; | 2274 | struct CadetConnection *c; |
2206 | int fwd; | 2275 | int fwd; |
2207 | 2276 | ||
@@ -2233,7 +2302,8 @@ GCC_handle_destroy (struct CadetPeer *peer, | |||
2233 | 2302 | ||
2234 | if (GNUNET_NO == GCC_is_terminal (c, fwd)) | 2303 | if (GNUNET_NO == GCC_is_terminal (c, fwd)) |
2235 | { | 2304 | { |
2236 | (void) GCC_send_prebuilt_message (&msg->header, 0, 0, c, fwd, | 2305 | (void) GCC_send_prebuilt_message (&msg->header, 0, |
2306 | zero, c, fwd, | ||
2237 | GNUNET_YES, NULL, NULL); | 2307 | GNUNET_YES, NULL, NULL); |
2238 | } | 2308 | } |
2239 | else if (0 == c->pending_messages) | 2309 | else if (0 == c->pending_messages) |
@@ -2262,11 +2332,11 @@ GCC_handle_destroy (struct CadetPeer *peer, | |||
2262 | */ | 2332 | */ |
2263 | void | 2333 | void |
2264 | GCC_handle_ack (struct CadetPeer *peer, | 2334 | GCC_handle_ack (struct CadetPeer *peer, |
2265 | const struct GNUNET_CADET_ACK *msg) | 2335 | const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg) |
2266 | { | 2336 | { |
2267 | struct CadetConnection *c; | 2337 | struct CadetConnection *c; |
2268 | struct CadetFlowControl *fc; | 2338 | struct CadetFlowControl *fc; |
2269 | uint32_t ack; | 2339 | struct CadetEncryptedMessageIdentifier ack; |
2270 | int fwd; | 2340 | int fwd; |
2271 | 2341 | ||
2272 | GCC_check_connections (); | 2342 | GCC_check_connections (); |
@@ -2303,15 +2373,19 @@ GCC_handle_ack (struct CadetPeer *peer, | |||
2303 | return; | 2373 | return; |
2304 | } | 2374 | } |
2305 | 2375 | ||
2306 | ack = ntohl (msg->ack); | 2376 | ack = msg->cemi; |
2307 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %s ACK %u (was %u)\n", | 2377 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %s ACK %u (was %u)\n", |
2308 | GC_f2s (fwd), ack, fc->last_ack_recv); | 2378 | GC_f2s (fwd), |
2309 | if (GC_is_pid_bigger (ack, fc->last_ack_recv)) | 2379 | ntohl (ack.pid), |
2380 | ntohl (fc->last_ack_recv.pid)); | ||
2381 | if (GC_is_pid_bigger (ntohl (ack.pid), | ||
2382 | ntohl (fc->last_ack_recv.pid))) | ||
2310 | fc->last_ack_recv = ack; | 2383 | fc->last_ack_recv = ack; |
2311 | 2384 | ||
2312 | /* Cancel polling if the ACK is big enough. */ | 2385 | /* Cancel polling if the ACK is big enough. */ |
2313 | if (NULL != fc->poll_task && | 2386 | if ( (NULL != fc->poll_task) & |
2314 | GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) | 2387 | GC_is_pid_bigger (ntohl (fc->last_ack_recv.pid), |
2388 | ntohl (fc->last_pid_sent.pid))) | ||
2315 | { | 2389 | { |
2316 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n"); | 2390 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n"); |
2317 | GNUNET_SCHEDULER_cancel (fc->poll_task); | 2391 | GNUNET_SCHEDULER_cancel (fc->poll_task); |
@@ -2331,11 +2405,11 @@ GCC_handle_ack (struct CadetPeer *peer, | |||
2331 | */ | 2405 | */ |
2332 | void | 2406 | void |
2333 | GCC_handle_poll (struct CadetPeer *peer, | 2407 | GCC_handle_poll (struct CadetPeer *peer, |
2334 | const struct GNUNET_CADET_Poll *msg) | 2408 | const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg) |
2335 | { | 2409 | { |
2336 | struct CadetConnection *c; | 2410 | struct CadetConnection *c; |
2337 | struct CadetFlowControl *fc; | 2411 | struct CadetFlowControl *fc; |
2338 | uint32_t pid; | 2412 | struct CadetEncryptedMessageIdentifier pid; |
2339 | int fwd; | 2413 | int fwd; |
2340 | 2414 | ||
2341 | GCC_check_connections (); | 2415 | GCC_check_connections (); |
@@ -2347,7 +2421,7 @@ GCC_handle_poll (struct CadetPeer *peer, | |||
2347 | GNUNET_NO); | 2421 | GNUNET_NO); |
2348 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2422 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2349 | "POLL message on unknown connection %s!\n", | 2423 | "POLL message on unknown connection %s!\n", |
2350 | GNUNET_h2s (GC_h2hc (&msg->cid))); | 2424 | GNUNET_sh2s (&msg->cid.connection_of_tunnel)); |
2351 | send_broken_unknown (&msg->cid, | 2425 | send_broken_unknown (&msg->cid, |
2352 | &my_full_id, | 2426 | &my_full_id, |
2353 | NULL, | 2427 | NULL, |
@@ -2377,8 +2451,11 @@ GCC_handle_poll (struct CadetPeer *peer, | |||
2377 | return; | 2451 | return; |
2378 | } | 2452 | } |
2379 | 2453 | ||
2380 | pid = ntohl (msg->pid); | 2454 | pid = msg->cemi; |
2381 | LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u, OLD %u\n", pid, fc->last_pid_recv); | 2455 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2456 | " PID %u, OLD %u\n", | ||
2457 | ntohl (pid.pid), | ||
2458 | ntohl (fc->last_pid_recv.pid)); | ||
2382 | fc->last_pid_recv = pid; | 2459 | fc->last_pid_recv = pid; |
2383 | fwd = fc == &c->bck_fc; | 2460 | fwd = fc == &c->bck_fc; |
2384 | GCC_send_ack (c, fwd, GNUNET_YES); | 2461 | GCC_send_ack (c, fwd, GNUNET_YES); |
@@ -2402,10 +2479,10 @@ GCC_handle_poll (struct CadetPeer *peer, | |||
2402 | */ | 2479 | */ |
2403 | static int | 2480 | static int |
2404 | check_message (const struct GNUNET_MessageHeader *message, | 2481 | check_message (const struct GNUNET_MessageHeader *message, |
2405 | const struct GNUNET_CADET_Hash* cid, | 2482 | const struct GNUNET_CADET_ConnectionTunnelIdentifier* cid, |
2406 | struct CadetConnection *c, | 2483 | struct CadetConnection *c, |
2407 | struct CadetPeer *sender, | 2484 | struct CadetPeer *sender, |
2408 | uint32_t pid) | 2485 | struct CadetEncryptedMessageIdentifier pid) |
2409 | { | 2486 | { |
2410 | struct CadetFlowControl *fc; | 2487 | struct CadetFlowControl *fc; |
2411 | struct CadetPeer *hop; | 2488 | struct CadetPeer *hop; |
@@ -2421,7 +2498,8 @@ check_message (const struct GNUNET_MessageHeader *message, | |||
2421 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2498 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2422 | "%s on unknown connection %s\n", | 2499 | "%s on unknown connection %s\n", |
2423 | GC_m2s (ntohs (message->type)), | 2500 | GC_m2s (ntohs (message->type)), |
2424 | GNUNET_h2s (GC_h2hc (cid))); | 2501 | GNUNET_sh2s (&cid->connection_of_tunnel)); |
2502 | GNUNET_break_op (0); | ||
2425 | send_broken_unknown (cid, | 2503 | send_broken_unknown (cid, |
2426 | &my_full_id, | 2504 | &my_full_id, |
2427 | NULL, | 2505 | NULL, |
@@ -2453,43 +2531,59 @@ check_message (const struct GNUNET_MessageHeader *message, | |||
2453 | 2531 | ||
2454 | /* Check PID for payload messages */ | 2532 | /* Check PID for payload messages */ |
2455 | type = ntohs (message->type); | 2533 | type = ntohs (message->type); |
2456 | if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type) | 2534 | if (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED == type) |
2457 | { | 2535 | { |
2458 | fc = fwd ? &c->bck_fc : &c->fwd_fc; | 2536 | fc = fwd ? &c->bck_fc : &c->fwd_fc; |
2459 | LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u (expected %u - %u)\n", | 2537 | LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u (expected in interval [%u,%u])\n", |
2460 | pid, fc->last_pid_recv + 1, fc->last_ack_sent); | 2538 | ntohl (pid.pid), |
2461 | if (GC_is_pid_bigger (pid, fc->last_ack_sent)) | 2539 | ntohl (fc->last_pid_recv.pid) + 1, |
2540 | ntohl (fc->last_ack_sent.pid)); | ||
2541 | if (GC_is_pid_bigger (ntohl (pid.pid), | ||
2542 | ntohl (fc->last_ack_sent.pid))) | ||
2462 | { | 2543 | { |
2463 | GNUNET_break_op (0); | 2544 | GNUNET_STATISTICS_update (stats, |
2464 | GNUNET_STATISTICS_update (stats, "# unsolicited message", 1, GNUNET_NO); | 2545 | "# unsolicited message", |
2465 | LOG (GNUNET_ERROR_TYPE_WARNING, "Received PID %u, (prev %u), ACK %u\n", | 2546 | 1, |
2466 | pid, fc->last_pid_recv, fc->last_ack_sent); | 2547 | GNUNET_NO); |
2548 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
2549 | "Received PID %u, (prev %u), ACK %u\n", | ||
2550 | pid, fc->last_pid_recv, fc->last_ack_sent); | ||
2467 | return GNUNET_SYSERR; | 2551 | return GNUNET_SYSERR; |
2468 | } | 2552 | } |
2469 | if (GC_is_pid_bigger (pid, fc->last_pid_recv)) | 2553 | if (GC_is_pid_bigger (ntohl (pid.pid), |
2554 | ntohl (fc->last_pid_recv.pid))) | ||
2470 | { | 2555 | { |
2471 | unsigned int delta; | 2556 | unsigned int delta; |
2472 | 2557 | ||
2473 | delta = pid - fc->last_pid_recv; | 2558 | delta = ntohl (pid.pid) - ntohl (fc->last_pid_recv.pid); |
2474 | fc->last_pid_recv = pid; | 2559 | fc->last_pid_recv = pid; |
2475 | fc->recv_bitmap <<= delta; | 2560 | fc->recv_bitmap <<= delta; |
2476 | fc->recv_bitmap |= 1; | 2561 | fc->recv_bitmap |= 1; |
2477 | } | 2562 | } |
2478 | else | 2563 | else |
2479 | { | 2564 | { |
2480 | GNUNET_STATISTICS_update (stats, "# out of order PID", 1, GNUNET_NO); | 2565 | GNUNET_STATISTICS_update (stats, |
2481 | if (GNUNET_NO == is_ooo_ok (fc->last_pid_recv, pid, fc->recv_bitmap)) | 2566 | "# out of order PID", |
2567 | 1, | ||
2568 | GNUNET_NO); | ||
2569 | if (GNUNET_NO == is_ooo_ok (fc->last_pid_recv, | ||
2570 | pid, | ||
2571 | fc->recv_bitmap)) | ||
2482 | { | 2572 | { |
2483 | LOG (GNUNET_ERROR_TYPE_WARNING, "PID %u unexpected (%u+), dropping!\n", | 2573 | LOG (GNUNET_ERROR_TYPE_WARNING, |
2484 | pid, fc->last_pid_recv - 31); | 2574 | "PID %u unexpected (%u+), dropping!\n", |
2575 | ntohl (pid.pid), | ||
2576 | ntohl (fc->last_pid_recv.pid) - 31); | ||
2485 | return GNUNET_SYSERR; | 2577 | return GNUNET_SYSERR; |
2486 | } | 2578 | } |
2487 | fc->recv_bitmap |= get_recv_bitmask (fc->last_pid_recv, pid); | 2579 | fc->recv_bitmap |= get_recv_bitmask (fc->last_pid_recv, |
2580 | pid); | ||
2488 | } | 2581 | } |
2489 | } | 2582 | } |
2490 | 2583 | ||
2491 | /* Count as connection confirmation. */ | 2584 | /* Count as connection confirmation. */ |
2492 | if (CADET_CONNECTION_SENT == c->state || CADET_CONNECTION_ACK == c->state) | 2585 | if ( (CADET_CONNECTION_SENT == c->state) || |
2586 | (CADET_CONNECTION_ACK == c->state) ) | ||
2493 | { | 2587 | { |
2494 | connection_change_state (c, CADET_CONNECTION_READY); | 2588 | connection_change_state (c, CADET_CONNECTION_READY); |
2495 | if (NULL != c->t) | 2589 | if (NULL != c->t) |
@@ -2512,9 +2606,10 @@ check_message (const struct GNUNET_MessageHeader *message, | |||
2512 | */ | 2606 | */ |
2513 | void | 2607 | void |
2514 | GCC_handle_kx (struct CadetPeer *peer, | 2608 | GCC_handle_kx (struct CadetPeer *peer, |
2515 | const struct GNUNET_CADET_KX *msg) | 2609 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) |
2516 | { | 2610 | { |
2517 | const struct GNUNET_CADET_Hash* cid; | 2611 | static struct CadetEncryptedMessageIdentifier zero; |
2612 | const struct GNUNET_CADET_ConnectionTunnelIdentifier* cid; | ||
2518 | struct CadetConnection *c; | 2613 | struct CadetConnection *c; |
2519 | int fwd; | 2614 | int fwd; |
2520 | 2615 | ||
@@ -2527,7 +2622,7 @@ GCC_handle_kx (struct CadetPeer *peer, | |||
2527 | cid, | 2622 | cid, |
2528 | c, | 2623 | c, |
2529 | peer, | 2624 | peer, |
2530 | 0); | 2625 | zero); |
2531 | 2626 | ||
2532 | /* If something went wrong, discard message. */ | 2627 | /* If something went wrong, discard message. */ |
2533 | if (GNUNET_SYSERR == fwd) | 2628 | if (GNUNET_SYSERR == fwd) |
@@ -2555,7 +2650,8 @@ GCC_handle_kx (struct CadetPeer *peer, | |||
2555 | /* Message not for us: forward to next hop */ | 2650 | /* Message not for us: forward to next hop */ |
2556 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); | 2651 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); |
2557 | GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); | 2652 | GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); |
2558 | (void) GCC_send_prebuilt_message (&msg->header, 0, 0, c, fwd, | 2653 | (void) GCC_send_prebuilt_message (&msg->header, 0, |
2654 | zero, c, fwd, | ||
2559 | GNUNET_NO, NULL, NULL); | 2655 | GNUNET_NO, NULL, NULL); |
2560 | GCC_check_connections (); | 2656 | GCC_check_connections (); |
2561 | } | 2657 | } |
@@ -2569,16 +2665,17 @@ GCC_handle_kx (struct CadetPeer *peer, | |||
2569 | */ | 2665 | */ |
2570 | void | 2666 | void |
2571 | GCC_handle_encrypted (struct CadetPeer *peer, | 2667 | GCC_handle_encrypted (struct CadetPeer *peer, |
2572 | const struct GNUNET_CADET_Encrypted *msg) | 2668 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg) |
2573 | { | 2669 | { |
2574 | const struct GNUNET_CADET_Hash* cid; | 2670 | static struct CadetEncryptedMessageIdentifier zero; |
2671 | const struct GNUNET_CADET_ConnectionTunnelIdentifier* cid; | ||
2575 | struct CadetConnection *c; | 2672 | struct CadetConnection *c; |
2576 | uint32_t pid; | 2673 | struct CadetEncryptedMessageIdentifier pid; |
2577 | int fwd; | 2674 | int fwd; |
2578 | 2675 | ||
2579 | GCC_check_connections (); | 2676 | GCC_check_connections (); |
2580 | cid = &msg->cid; | 2677 | cid = &msg->cid; |
2581 | pid = ntohl (msg->pid); | 2678 | pid = msg->cemi; |
2582 | log_message (&msg->header, peer, cid); | 2679 | log_message (&msg->header, peer, cid); |
2583 | 2680 | ||
2584 | c = connection_get (cid); | 2681 | c = connection_get (cid); |
@@ -2591,7 +2688,6 @@ GCC_handle_encrypted (struct CadetPeer *peer, | |||
2591 | /* If something went wrong, discard message. */ | 2688 | /* If something went wrong, discard message. */ |
2592 | if (GNUNET_SYSERR == fwd) | 2689 | if (GNUNET_SYSERR == fwd) |
2593 | { | 2690 | { |
2594 | GNUNET_break_op (0); | ||
2595 | GCC_check_connections (); | 2691 | GCC_check_connections (); |
2596 | return; | 2692 | return; |
2597 | } | 2693 | } |
@@ -2615,7 +2711,8 @@ GCC_handle_encrypted (struct CadetPeer *peer, | |||
2615 | /* Message not for us: forward to next hop */ | 2711 | /* Message not for us: forward to next hop */ |
2616 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); | 2712 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); |
2617 | GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); | 2713 | GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); |
2618 | (void) GCC_send_prebuilt_message (&msg->header, 0, 0, c, fwd, | 2714 | (void) GCC_send_prebuilt_message (&msg->header, 0, |
2715 | zero, c, fwd, | ||
2619 | GNUNET_NO, NULL, NULL); | 2716 | GNUNET_NO, NULL, NULL); |
2620 | GCC_check_connections (); | 2717 | GCC_check_connections (); |
2621 | } | 2718 | } |
@@ -2661,7 +2758,8 @@ GCC_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
2661 | } | 2758 | } |
2662 | create_connection_time = GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_SECONDS, | 2759 | create_connection_time = GNUNET_TIME_relative_min (GNUNET_TIME_UNIT_SECONDS, |
2663 | refresh_connection_time); | 2760 | refresh_connection_time); |
2664 | connections = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO); | 2761 | connections = GNUNET_CONTAINER_multishortmap_create (1024, |
2762 | GNUNET_YES); | ||
2665 | } | 2763 | } |
2666 | 2764 | ||
2667 | 2765 | ||
@@ -2676,7 +2774,7 @@ GCC_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
2676 | */ | 2774 | */ |
2677 | static int | 2775 | static int |
2678 | shutdown_iterator (void *cls, | 2776 | shutdown_iterator (void *cls, |
2679 | const struct GNUNET_HashCode *key, | 2777 | const struct GNUNET_ShortHashCode *key, |
2680 | void *value) | 2778 | void *value) |
2681 | { | 2779 | { |
2682 | struct CadetConnection *c = value; | 2780 | struct CadetConnection *c = value; |
@@ -2695,10 +2793,10 @@ GCC_shutdown (void) | |||
2695 | { | 2793 | { |
2696 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down connections\n"); | 2794 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down connections\n"); |
2697 | GCC_check_connections (); | 2795 | GCC_check_connections (); |
2698 | GNUNET_CONTAINER_multihashmap_iterate (connections, | 2796 | GNUNET_CONTAINER_multishortmap_iterate (connections, |
2699 | &shutdown_iterator, | 2797 | &shutdown_iterator, |
2700 | NULL); | 2798 | NULL); |
2701 | GNUNET_CONTAINER_multihashmap_destroy (connections); | 2799 | GNUNET_CONTAINER_multishortmap_destroy (connections); |
2702 | connections = NULL; | 2800 | connections = NULL; |
2703 | } | 2801 | } |
2704 | 2802 | ||
@@ -2715,7 +2813,7 @@ GCC_shutdown (void) | |||
2715 | * NULL in case of error: own id not in path, wrong neighbors, ... | 2813 | * NULL in case of error: own id not in path, wrong neighbors, ... |
2716 | */ | 2814 | */ |
2717 | struct CadetConnection * | 2815 | struct CadetConnection * |
2718 | GCC_new (const struct GNUNET_CADET_Hash *cid, | 2816 | GCC_new (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, |
2719 | struct CadetTunnel *t, | 2817 | struct CadetTunnel *t, |
2720 | struct CadetPeerPath *path, | 2818 | struct CadetPeerPath *path, |
2721 | unsigned int own_pos) | 2819 | unsigned int own_pos) |
@@ -2729,9 +2827,10 @@ GCC_new (const struct GNUNET_CADET_Hash *cid, | |||
2729 | c = GNUNET_new (struct CadetConnection); | 2827 | c = GNUNET_new (struct CadetConnection); |
2730 | c->id = *cid; | 2828 | c->id = *cid; |
2731 | GNUNET_assert (GNUNET_OK == | 2829 | GNUNET_assert (GNUNET_OK == |
2732 | GNUNET_CONTAINER_multihashmap_put (connections, | 2830 | GNUNET_CONTAINER_multishortmap_put (connections, |
2733 | GCC_get_h (c), c, | 2831 | &c->id.connection_of_tunnel, |
2734 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 2832 | c, |
2833 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
2735 | fc_init (&c->fwd_fc); | 2834 | fc_init (&c->fwd_fc); |
2736 | fc_init (&c->bck_fc); | 2835 | fc_init (&c->bck_fc); |
2737 | c->fwd_fc.c = c; | 2836 | c->fwd_fc.c = c; |
@@ -2832,9 +2931,9 @@ GCC_destroy (struct CadetConnection *c) | |||
2832 | if (GNUNET_NO == c->was_removed) | 2931 | if (GNUNET_NO == c->was_removed) |
2833 | { | 2932 | { |
2834 | GNUNET_break (GNUNET_YES == | 2933 | GNUNET_break (GNUNET_YES == |
2835 | GNUNET_CONTAINER_multihashmap_remove (connections, | 2934 | GNUNET_CONTAINER_multishortmap_remove (connections, |
2836 | GCC_get_h (c), | 2935 | &c->id.connection_of_tunnel, |
2837 | c)); | 2936 | c)); |
2838 | } | 2937 | } |
2839 | GNUNET_STATISTICS_update (stats, | 2938 | GNUNET_STATISTICS_update (stats, |
2840 | "# connections", | 2939 | "# connections", |
@@ -2852,7 +2951,7 @@ GCC_destroy (struct CadetConnection *c) | |||
2852 | * | 2951 | * |
2853 | * @return ID of the connection. | 2952 | * @return ID of the connection. |
2854 | */ | 2953 | */ |
2855 | const struct GNUNET_CADET_Hash * | 2954 | const struct GNUNET_CADET_ConnectionTunnelIdentifier * |
2856 | GCC_get_id (const struct CadetConnection *c) | 2955 | GCC_get_id (const struct CadetConnection *c) |
2857 | { | 2956 | { |
2858 | return &c->id; | 2957 | return &c->id; |
@@ -2860,20 +2959,6 @@ GCC_get_id (const struct CadetConnection *c) | |||
2860 | 2959 | ||
2861 | 2960 | ||
2862 | /** | 2961 | /** |
2863 | * Get the connection ID. | ||
2864 | * | ||
2865 | * @param c Connection to get the ID from. | ||
2866 | * | ||
2867 | * @return ID of the connection. | ||
2868 | */ | ||
2869 | const struct GNUNET_HashCode * | ||
2870 | GCC_get_h (const struct CadetConnection *c) | ||
2871 | { | ||
2872 | return GC_h2hc (&c->id); | ||
2873 | } | ||
2874 | |||
2875 | |||
2876 | /** | ||
2877 | * Get the connection path. | 2962 | * Get the connection path. |
2878 | * | 2963 | * |
2879 | * @param c Connection to get the path from. | 2964 | * @param c Connection to get the path from. |
@@ -2953,12 +3038,13 @@ GCC_get_allowed (struct CadetConnection *c, int fwd) | |||
2953 | struct CadetFlowControl *fc; | 3038 | struct CadetFlowControl *fc; |
2954 | 3039 | ||
2955 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 3040 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
2956 | if (CADET_CONNECTION_READY != c->state | 3041 | if ( (CADET_CONNECTION_READY != c->state) || |
2957 | || GC_is_pid_bigger (fc->last_pid_recv, fc->last_ack_sent)) | 3042 | GC_is_pid_bigger (ntohl (fc->last_pid_recv.pid), |
3043 | ntohl (fc->last_ack_sent.pid)) ) | ||
2958 | { | 3044 | { |
2959 | return 0; | 3045 | return 0; |
2960 | } | 3046 | } |
2961 | return (fc->last_ack_sent - fc->last_pid_recv); | 3047 | return (ntohl (fc->last_ack_sent.pid) - ntohl (fc->last_pid_recv.pid)); |
2962 | } | 3048 | } |
2963 | 3049 | ||
2964 | 3050 | ||
@@ -2986,18 +3072,17 @@ GCC_get_qn (struct CadetConnection *c, int fwd) | |||
2986 | * | 3072 | * |
2987 | * @param c Connection. | 3073 | * @param c Connection. |
2988 | * @param fwd Is query about FWD traffic? | 3074 | * @param fwd Is query about FWD traffic? |
2989 | * | ||
2990 | * @return Next PID to use. | 3075 | * @return Next PID to use. |
2991 | */ | 3076 | */ |
2992 | uint32_t | 3077 | struct CadetEncryptedMessageIdentifier |
2993 | GCC_get_pid (struct CadetConnection *c, int fwd) | 3078 | GCC_get_pid (struct CadetConnection *c, int fwd) |
2994 | { | 3079 | { |
2995 | struct CadetFlowControl *fc; | 3080 | struct CadetFlowControl *fc; |
2996 | uint32_t pid; | 3081 | struct CadetEncryptedMessageIdentifier pid; |
2997 | 3082 | ||
2998 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 3083 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
2999 | pid = fc->next_pid; | 3084 | pid = fc->next_pid; |
3000 | fc->next_pid++; | 3085 | fc->next_pid.pid = htonl (1 + ntohl (pid.pid)); |
3001 | return pid; | 3086 | return pid; |
3002 | } | 3087 | } |
3003 | 3088 | ||
@@ -3072,9 +3157,9 @@ GCC_neighbor_disconnected (struct CadetConnection *c, struct CadetPeer *peer) | |||
3072 | GNUNET_assert (GNUNET_NO == c->was_removed); | 3157 | GNUNET_assert (GNUNET_NO == c->was_removed); |
3073 | c->was_removed = GNUNET_YES; | 3158 | c->was_removed = GNUNET_YES; |
3074 | GNUNET_break (GNUNET_YES == | 3159 | GNUNET_break (GNUNET_YES == |
3075 | GNUNET_CONTAINER_multihashmap_remove (connections, | 3160 | GNUNET_CONTAINER_multishortmap_remove (connections, |
3076 | GCC_get_h (c), | 3161 | &c->id.connection_of_tunnel, |
3077 | c)); | 3162 | c)); |
3078 | /* Cancel queue in the direction that just died. */ | 3163 | /* Cancel queue in the direction that just died. */ |
3079 | connection_cancel_queues (c, ! fwd); | 3164 | connection_cancel_queues (c, ! fwd); |
3080 | GCC_stop_poll (c, ! fwd); | 3165 | GCC_stop_poll (c, ! fwd); |
@@ -3142,8 +3227,10 @@ GCC_is_sendable (struct CadetConnection *c, int fwd) | |||
3142 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 3227 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
3143 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 3228 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
3144 | " last ack recv: %u, last pid sent: %u\n", | 3229 | " last ack recv: %u, last pid sent: %u\n", |
3145 | fc->last_ack_recv, fc->last_pid_sent); | 3230 | ntohl (fc->last_ack_recv.pid), |
3146 | if (GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) | 3231 | ntohl (fc->last_pid_sent.pid)); |
3232 | if (GC_is_pid_bigger (ntohl (fc->last_ack_recv.pid), | ||
3233 | ntohl (fc->last_pid_sent.pid))) | ||
3147 | { | 3234 | { |
3148 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sendable\n"); | 3235 | LOG (GNUNET_ERROR_TYPE_DEBUG, " sendable\n"); |
3149 | return GNUNET_YES; | 3236 | return GNUNET_YES; |
@@ -3188,7 +3275,8 @@ GCC_is_direct (struct CadetConnection *c) | |||
3188 | */ | 3275 | */ |
3189 | struct CadetConnectionQueue * | 3276 | struct CadetConnectionQueue * |
3190 | GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | 3277 | GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, |
3191 | uint16_t payload_type, uint32_t payload_id, | 3278 | uint16_t payload_type, |
3279 | struct CadetEncryptedMessageIdentifier payload_id, | ||
3192 | struct CadetConnection *c, int fwd, int force, | 3280 | struct CadetConnection *c, int fwd, int force, |
3193 | GCC_sent cont, void *cont_cls) | 3281 | GCC_sent cont, void *cont_cls) |
3194 | { | 3282 | { |
@@ -3214,27 +3302,30 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
3214 | GC_f2s(fwd), size); | 3302 | GC_f2s(fwd), size); |
3215 | switch (type) | 3303 | switch (type) |
3216 | { | 3304 | { |
3217 | case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: | 3305 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED: |
3218 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u, PIDsnt: %u, ACKrcv: %u\n", | 3306 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u, PIDsnt: %u, ACKrcv: %u\n", |
3219 | fc, fc->queue_n, fc->last_pid_sent, fc->last_ack_recv); | 3307 | fc, |
3308 | fc->queue_n, | ||
3309 | ntohl (fc->last_pid_sent.pid), | ||
3310 | ntohl (fc->last_ack_recv.pid)); | ||
3220 | if (GNUNET_NO == force) | 3311 | if (GNUNET_NO == force) |
3221 | { | 3312 | { |
3222 | fc->queue_n++; | 3313 | fc->queue_n++; |
3223 | } | 3314 | } |
3224 | break; | 3315 | break; |
3225 | 3316 | ||
3226 | case GNUNET_MESSAGE_TYPE_CADET_KX: | 3317 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX: |
3227 | /* nothing to do here */ | 3318 | /* nothing to do here */ |
3228 | break; | 3319 | break; |
3229 | 3320 | ||
3230 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: | 3321 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: |
3231 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: | 3322 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK: |
3232 | /* Should've only be used for restransmissions. */ | 3323 | /* Should've only be used for restransmissions. */ |
3233 | GNUNET_break (0 == payload_type); | 3324 | GNUNET_break (0 == payload_type); |
3234 | break; | 3325 | break; |
3235 | 3326 | ||
3236 | case GNUNET_MESSAGE_TYPE_CADET_ACK: | 3327 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK: |
3237 | case GNUNET_MESSAGE_TYPE_CADET_POLL: | 3328 | case GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL: |
3238 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: | 3329 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: |
3239 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: | 3330 | case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: |
3240 | GNUNET_assert (GNUNET_YES == force); | 3331 | GNUNET_assert (GNUNET_YES == force); |
@@ -3252,7 +3343,7 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
3252 | GNUNET_break (0); | 3343 | GNUNET_break (0); |
3253 | LOG (GNUNET_ERROR_TYPE_DEBUG, "queue full: %u/%u\n", | 3344 | LOG (GNUNET_ERROR_TYPE_DEBUG, "queue full: %u/%u\n", |
3254 | fc->queue_n, fc->queue_max); | 3345 | fc->queue_n, fc->queue_max); |
3255 | if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type) | 3346 | if (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED == type) |
3256 | { | 3347 | { |
3257 | fc->queue_n--; | 3348 | fc->queue_n--; |
3258 | } | 3349 | } |
@@ -3264,21 +3355,25 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
3264 | c->pending_messages++; | 3355 | c->pending_messages++; |
3265 | 3356 | ||
3266 | q = GNUNET_new (struct CadetConnectionQueue); | 3357 | q = GNUNET_new (struct CadetConnectionQueue); |
3358 | q->cont = cont; | ||
3359 | q->cont_cls = cont_cls; | ||
3267 | q->forced = force; | 3360 | q->forced = force; |
3268 | q->peer_q = GCP_send (get_hop (c, fwd), message, | 3361 | GNUNET_CONTAINER_DLL_insert (fc->q_head, fc->q_tail, q); |
3269 | payload_type, payload_id, | 3362 | q->peer_q = GCP_send (get_hop (c, fwd), |
3270 | c, fwd, | 3363 | message, |
3364 | payload_type, | ||
3365 | payload_id, | ||
3366 | c, | ||
3367 | fwd, | ||
3271 | &conn_message_sent, q); | 3368 | &conn_message_sent, q); |
3272 | if (NULL == q->peer_q) | 3369 | if (NULL == q->peer_q) |
3273 | { | 3370 | { |
3274 | LOG (GNUNET_ERROR_TYPE_DEBUG, "dropping msg on %s, NULL q\n", GCC_2s (c)); | 3371 | LOG (GNUNET_ERROR_TYPE_DEBUG, "dropping msg on %s, NULL q\n", GCC_2s (c)); |
3372 | GNUNET_CONTAINER_DLL_remove (fc->q_head, fc->q_tail, q); | ||
3275 | GNUNET_free (q); | 3373 | GNUNET_free (q); |
3276 | GCC_check_connections (); | 3374 | GCC_check_connections (); |
3277 | return NULL; | 3375 | return NULL; |
3278 | } | 3376 | } |
3279 | q->cont = cont; | ||
3280 | q->cont_cls = cont_cls; | ||
3281 | GNUNET_CONTAINER_DLL_insert (fc->q_head, fc->q_tail, q); | ||
3282 | GCC_check_connections (); | 3377 | GCC_check_connections (); |
3283 | return q; | 3378 | return q; |
3284 | } | 3379 | } |
@@ -3313,19 +3408,21 @@ GCC_cancel (struct CadetConnectionQueue *q) | |||
3313 | void | 3408 | void |
3314 | GCC_send_create (struct CadetConnection *c) | 3409 | GCC_send_create (struct CadetConnection *c) |
3315 | { | 3410 | { |
3411 | static struct CadetEncryptedMessageIdentifier zero; | ||
3316 | enum CadetTunnelCState state; | 3412 | enum CadetTunnelCState state; |
3317 | size_t size; | 3413 | size_t size; |
3318 | 3414 | ||
3319 | GCC_check_connections (); | 3415 | GCC_check_connections (); |
3320 | size = sizeof (struct GNUNET_CADET_ConnectionCreate); | 3416 | size = sizeof (struct GNUNET_CADET_ConnectionCreateMessage); |
3321 | size += c->path->length * sizeof (struct GNUNET_PeerIdentity); | 3417 | size += c->path->length * sizeof (struct GNUNET_PeerIdentity); |
3322 | { | 3418 | { |
3323 | /* Allocate message on the stack */ | 3419 | /* Allocate message on the stack */ |
3324 | unsigned char cbuf[size]; | 3420 | unsigned char cbuf[size]; |
3325 | struct GNUNET_CADET_ConnectionCreate *msg; | 3421 | struct GNUNET_CADET_ConnectionCreateMessage *msg; |
3326 | struct GNUNET_PeerIdentity *peers; | 3422 | struct GNUNET_PeerIdentity *peers; |
3327 | 3423 | ||
3328 | msg = (struct GNUNET_CADET_ConnectionCreate *) cbuf; | 3424 | |
3425 | msg = (struct GNUNET_CADET_ConnectionCreateMessage *) cbuf; | ||
3329 | msg->header.size = htons (size); | 3426 | msg->header.size = htons (size); |
3330 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); | 3427 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); |
3331 | msg->reserved = htonl (0); | 3428 | msg->reserved = htonl (0); |
@@ -3338,7 +3435,8 @@ GCC_send_create (struct CadetConnection *c) | |||
3338 | GNUNET_assert (NULL == c->maintenance_q); | 3435 | GNUNET_assert (NULL == c->maintenance_q); |
3339 | c->maintenance_q = GCP_send (get_next_hop (c), | 3436 | c->maintenance_q = GCP_send (get_next_hop (c), |
3340 | &msg->header, | 3437 | &msg->header, |
3341 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0, | 3438 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, |
3439 | zero, | ||
3342 | c, GNUNET_YES, | 3440 | c, GNUNET_YES, |
3343 | &conn_message_sent, NULL); | 3441 | &conn_message_sent, NULL); |
3344 | } | 3442 | } |
@@ -3435,7 +3533,8 @@ GCC_send_ack (struct CadetConnection *c, int fwd, int force) | |||
3435 | void | 3533 | void |
3436 | GCC_send_destroy (struct CadetConnection *c) | 3534 | GCC_send_destroy (struct CadetConnection *c) |
3437 | { | 3535 | { |
3438 | struct GNUNET_CADET_ConnectionDestroy msg; | 3536 | static struct CadetEncryptedMessageIdentifier zero; |
3537 | struct GNUNET_CADET_ConnectionDestroyMessage msg; | ||
3439 | 3538 | ||
3440 | if (GNUNET_YES == c->destroy) | 3539 | if (GNUNET_YES == c->destroy) |
3441 | return; | 3540 | return; |
@@ -3449,10 +3548,16 @@ GCC_send_destroy (struct CadetConnection *c) | |||
3449 | GCC_2s (c)); | 3548 | GCC_2s (c)); |
3450 | 3549 | ||
3451 | if (GNUNET_NO == GCC_is_terminal (c, GNUNET_YES)) | 3550 | if (GNUNET_NO == GCC_is_terminal (c, GNUNET_YES)) |
3452 | (void) GCC_send_prebuilt_message (&msg.header, UINT16_MAX, 0, c, | 3551 | (void) GCC_send_prebuilt_message (&msg.header, |
3552 | UINT16_MAX, | ||
3553 | zero, | ||
3554 | c, | ||
3453 | GNUNET_YES, GNUNET_YES, NULL, NULL); | 3555 | GNUNET_YES, GNUNET_YES, NULL, NULL); |
3454 | if (GNUNET_NO == GCC_is_terminal (c, GNUNET_NO)) | 3556 | if (GNUNET_NO == GCC_is_terminal (c, GNUNET_NO)) |
3455 | (void) GCC_send_prebuilt_message (&msg.header, UINT16_MAX, 0, c, | 3557 | (void) GCC_send_prebuilt_message (&msg.header, |
3558 | UINT16_MAX, | ||
3559 | zero, | ||
3560 | c, | ||
3456 | GNUNET_NO, GNUNET_YES, NULL, NULL); | 3561 | GNUNET_NO, GNUNET_YES, NULL, NULL); |
3457 | mark_destroyed (c); | 3562 | mark_destroyed (c); |
3458 | GCC_check_connections (); | 3563 | GCC_check_connections (); |
@@ -3538,10 +3643,11 @@ GCC_2s (const struct CadetConnection *c) | |||
3538 | static char buf[128]; | 3643 | static char buf[128]; |
3539 | 3644 | ||
3540 | SPRINTF (buf, "%s (->%s)", | 3645 | SPRINTF (buf, "%s (->%s)", |
3541 | GNUNET_h2s (GC_h2hc (GCC_get_id (c))), GCT_2s (c->t)); | 3646 | GNUNET_sh2s (&GCC_get_id (c)->connection_of_tunnel), |
3647 | GCT_2s (c->t)); | ||
3542 | return buf; | 3648 | return buf; |
3543 | } | 3649 | } |
3544 | return GNUNET_h2s (GC_h2hc (&c->id)); | 3650 | return GNUNET_sh2s (&c->id.connection_of_tunnel); |
3545 | } | 3651 | } |
3546 | 3652 | ||
3547 | 3653 | ||
@@ -3582,9 +3688,11 @@ GCC_debug (const struct CadetConnection *c, enum GNUNET_ErrorType level) | |||
3582 | LOG2 (level, "CCC FWD flow control:\n"); | 3688 | LOG2 (level, "CCC FWD flow control:\n"); |
3583 | LOG2 (level, "CCC queue: %u/%u\n", c->fwd_fc.queue_n, c->fwd_fc.queue_max); | 3689 | LOG2 (level, "CCC queue: %u/%u\n", c->fwd_fc.queue_n, c->fwd_fc.queue_max); |
3584 | LOG2 (level, "CCC last PID sent: %5u, recv: %5u\n", | 3690 | LOG2 (level, "CCC last PID sent: %5u, recv: %5u\n", |
3585 | c->fwd_fc.last_pid_sent, c->fwd_fc.last_pid_recv); | 3691 | ntohl (c->fwd_fc.last_pid_sent.pid), |
3692 | ntohl (c->fwd_fc.last_pid_recv.pid)); | ||
3586 | LOG2 (level, "CCC last ACK sent: %5u, recv: %5u\n", | 3693 | LOG2 (level, "CCC last ACK sent: %5u, recv: %5u\n", |
3587 | c->fwd_fc.last_ack_sent, c->fwd_fc.last_ack_recv); | 3694 | ntohl (c->fwd_fc.last_ack_sent.pid), |
3695 | ntohl (c->fwd_fc.last_ack_recv.pid)); | ||
3588 | LOG2 (level, "CCC recv PID bitmap: %X\n", c->fwd_fc.recv_bitmap); | 3696 | LOG2 (level, "CCC recv PID bitmap: %X\n", c->fwd_fc.recv_bitmap); |
3589 | LOG2 (level, "CCC poll: task %d, msg %p, msg_ack %p)\n", | 3697 | LOG2 (level, "CCC poll: task %d, msg %p, msg_ack %p)\n", |
3590 | c->fwd_fc.poll_task, c->fwd_fc.poll_msg, c->fwd_fc.ack_msg); | 3698 | c->fwd_fc.poll_task, c->fwd_fc.poll_msg, c->fwd_fc.ack_msg); |
@@ -3592,9 +3700,11 @@ GCC_debug (const struct CadetConnection *c, enum GNUNET_ErrorType level) | |||
3592 | LOG2 (level, "CCC BCK flow control:\n"); | 3700 | LOG2 (level, "CCC BCK flow control:\n"); |
3593 | LOG2 (level, "CCC queue: %u/%u\n", c->bck_fc.queue_n, c->bck_fc.queue_max); | 3701 | LOG2 (level, "CCC queue: %u/%u\n", c->bck_fc.queue_n, c->bck_fc.queue_max); |
3594 | LOG2 (level, "CCC last PID sent: %5u, recv: %5u\n", | 3702 | LOG2 (level, "CCC last PID sent: %5u, recv: %5u\n", |
3595 | c->bck_fc.last_pid_sent, c->bck_fc.last_pid_recv); | 3703 | ntohl (c->bck_fc.last_pid_sent.pid), |
3704 | ntohl (c->bck_fc.last_pid_recv.pid)); | ||
3596 | LOG2 (level, "CCC last ACK sent: %5u, recv: %5u\n", | 3705 | LOG2 (level, "CCC last ACK sent: %5u, recv: %5u\n", |
3597 | c->bck_fc.last_ack_sent, c->bck_fc.last_ack_recv); | 3706 | ntohl (c->bck_fc.last_ack_sent.pid), |
3707 | ntohl (c->bck_fc.last_ack_recv.pid)); | ||
3598 | LOG2 (level, "CCC recv PID bitmap: %X\n", c->bck_fc.recv_bitmap); | 3708 | LOG2 (level, "CCC recv PID bitmap: %X\n", c->bck_fc.recv_bitmap); |
3599 | LOG2 (level, "CCC poll: task %d, msg %p, msg_ack %p)\n", | 3709 | LOG2 (level, "CCC poll: task %d, msg %p, msg_ack %p)\n", |
3600 | c->bck_fc.poll_task, c->bck_fc.poll_msg, c->bck_fc.ack_msg); | 3710 | c->bck_fc.poll_task, c->bck_fc.poll_msg, c->bck_fc.ack_msg); |
diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h index 18f33ce7c..1c3160dfd 100644 --- a/src/cadet/gnunet-service-cadet_connection.h +++ b/src/cadet/gnunet-service-cadet_connection.h | |||
@@ -125,7 +125,7 @@ typedef void | |||
125 | */ | 125 | */ |
126 | void | 126 | void |
127 | GCC_handle_create (struct CadetPeer *peer, | 127 | GCC_handle_create (struct CadetPeer *peer, |
128 | const struct GNUNET_CADET_ConnectionCreate *msg); | 128 | const struct GNUNET_CADET_ConnectionCreateMessage *msg); |
129 | 129 | ||
130 | 130 | ||
131 | /** | 131 | /** |
@@ -136,7 +136,7 @@ GCC_handle_create (struct CadetPeer *peer, | |||
136 | */ | 136 | */ |
137 | void | 137 | void |
138 | GCC_handle_confirm (struct CadetPeer *peer, | 138 | GCC_handle_confirm (struct CadetPeer *peer, |
139 | const struct GNUNET_CADET_ConnectionACK *msg); | 139 | const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg); |
140 | 140 | ||
141 | 141 | ||
142 | /** | 142 | /** |
@@ -147,7 +147,7 @@ GCC_handle_confirm (struct CadetPeer *peer, | |||
147 | */ | 147 | */ |
148 | void | 148 | void |
149 | GCC_handle_broken (struct CadetPeer *peer, | 149 | GCC_handle_broken (struct CadetPeer *peer, |
150 | const struct GNUNET_CADET_ConnectionBroken *msg); | 150 | const struct GNUNET_CADET_ConnectionBrokenMessage *msg); |
151 | 151 | ||
152 | /** | 152 | /** |
153 | * Handler for notifications of destroyed connections. | 153 | * Handler for notifications of destroyed connections. |
@@ -157,7 +157,7 @@ GCC_handle_broken (struct CadetPeer *peer, | |||
157 | */ | 157 | */ |
158 | void | 158 | void |
159 | GCC_handle_destroy (struct CadetPeer *peer, | 159 | GCC_handle_destroy (struct CadetPeer *peer, |
160 | const struct GNUNET_CADET_ConnectionDestroy *msg); | 160 | const struct GNUNET_CADET_ConnectionDestroyMessage *msg); |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * Handler for cadet network traffic hop-by-hop acks. | 163 | * Handler for cadet network traffic hop-by-hop acks. |
@@ -167,7 +167,7 @@ GCC_handle_destroy (struct CadetPeer *peer, | |||
167 | */ | 167 | */ |
168 | void | 168 | void |
169 | GCC_handle_ack (struct CadetPeer *peer, | 169 | GCC_handle_ack (struct CadetPeer *peer, |
170 | const struct GNUNET_CADET_ACK *msg); | 170 | const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg); |
171 | 171 | ||
172 | /** | 172 | /** |
173 | * Handler for cadet network traffic hop-by-hop data counter polls. | 173 | * Handler for cadet network traffic hop-by-hop data counter polls. |
@@ -177,7 +177,7 @@ GCC_handle_ack (struct CadetPeer *peer, | |||
177 | */ | 177 | */ |
178 | void | 178 | void |
179 | GCC_handle_poll (struct CadetPeer *peer, | 179 | GCC_handle_poll (struct CadetPeer *peer, |
180 | const struct GNUNET_CADET_Poll *msg); | 180 | const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg); |
181 | 181 | ||
182 | /** | 182 | /** |
183 | * Handler for key exchange traffic (Axolotl KX). | 183 | * Handler for key exchange traffic (Axolotl KX). |
@@ -187,7 +187,7 @@ GCC_handle_poll (struct CadetPeer *peer, | |||
187 | */ | 187 | */ |
188 | void | 188 | void |
189 | GCC_handle_kx (struct CadetPeer *peer, | 189 | GCC_handle_kx (struct CadetPeer *peer, |
190 | const struct GNUNET_CADET_KX *msg); | 190 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | * Handler for encrypted cadet network traffic (channel mgmt, data). | 193 | * Handler for encrypted cadet network traffic (channel mgmt, data). |
@@ -197,7 +197,7 @@ GCC_handle_kx (struct CadetPeer *peer, | |||
197 | */ | 197 | */ |
198 | void | 198 | void |
199 | GCC_handle_encrypted (struct CadetPeer *peer, | 199 | GCC_handle_encrypted (struct CadetPeer *peer, |
200 | const struct GNUNET_CADET_Encrypted *msg); | 200 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg); |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * Core handler for axolotl key exchange traffic. | 203 | * Core handler for axolotl key exchange traffic. |
@@ -277,7 +277,7 @@ GCC_shutdown (void); | |||
277 | * NULL in case of error: own id not in path, wrong neighbors, ... | 277 | * NULL in case of error: own id not in path, wrong neighbors, ... |
278 | */ | 278 | */ |
279 | struct CadetConnection * | 279 | struct CadetConnection * |
280 | GCC_new (const struct GNUNET_CADET_Hash *cid, | 280 | GCC_new (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, |
281 | struct CadetTunnel *t, | 281 | struct CadetTunnel *t, |
282 | struct CadetPeerPath *path, | 282 | struct CadetPeerPath *path, |
283 | unsigned int own_pos); | 283 | unsigned int own_pos); |
@@ -300,22 +300,11 @@ GCC_destroy (struct CadetConnection *c); | |||
300 | * | 300 | * |
301 | * @return ID of the connection. | 301 | * @return ID of the connection. |
302 | */ | 302 | */ |
303 | const struct GNUNET_CADET_Hash * | 303 | const struct GNUNET_CADET_ConnectionTunnelIdentifier * |
304 | GCC_get_id (const struct CadetConnection *c); | 304 | GCC_get_id (const struct CadetConnection *c); |
305 | 305 | ||
306 | 306 | ||
307 | /** | 307 | /** |
308 | * Get a hash for the connection ID. | ||
309 | * | ||
310 | * @param c Connection to get the hash. | ||
311 | * | ||
312 | * @return Hash expanded from the ID of the connection. | ||
313 | */ | ||
314 | const struct GNUNET_HashCode * | ||
315 | GCC_get_h (const struct CadetConnection *c); | ||
316 | |||
317 | |||
318 | /** | ||
319 | * Get the connection path. | 308 | * Get the connection path. |
320 | * | 309 | * |
321 | * @param c Connection to get the path from. | 310 | * @param c Connection to get the path from. |
@@ -383,10 +372,9 @@ GCC_get_qn (struct CadetConnection *c, int fwd); | |||
383 | * | 372 | * |
384 | * @param c Connection. | 373 | * @param c Connection. |
385 | * @param fwd Is query about FWD traffic? | 374 | * @param fwd Is query about FWD traffic? |
386 | * | ||
387 | * @return Next PID to use. | 375 | * @return Next PID to use. |
388 | */ | 376 | */ |
389 | uint32_t | 377 | struct CadetEncryptedMessageIdentifier |
390 | GCC_get_pid (struct CadetConnection *c, int fwd); | 378 | GCC_get_pid (struct CadetConnection *c, int fwd); |
391 | 379 | ||
392 | /** | 380 | /** |
@@ -508,7 +496,8 @@ GCC_cancel (struct CadetConnectionQueue *q); | |||
508 | */ | 496 | */ |
509 | struct CadetConnectionQueue * | 497 | struct CadetConnectionQueue * |
510 | GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | 498 | GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, |
511 | uint16_t payload_type, uint32_t payload_id, | 499 | uint16_t payload_type, |
500 | struct CadetEncryptedMessageIdentifier payload_id, | ||
512 | struct CadetConnection *c, int fwd, int force, | 501 | struct CadetConnection *c, int fwd, int force, |
513 | GCC_sent cont, void *cont_cls); | 502 | GCC_sent cont, void *cont_cls); |
514 | 503 | ||
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c index 9b11ebf18..22673b167 100644 --- a/src/cadet/gnunet-service-cadet_dht.c +++ b/src/cadet/gnunet-service-cadet_dht.c | |||
@@ -42,16 +42,24 @@ | |||
42 | */ | 42 | */ |
43 | struct GCD_search_handle | 43 | struct GCD_search_handle |
44 | { | 44 | { |
45 | /** DHT_GET handle. */ | 45 | /** |
46 | * DHT_GET handle. | ||
47 | */ | ||
46 | struct GNUNET_DHT_GetHandle *dhtget; | 48 | struct GNUNET_DHT_GetHandle *dhtget; |
47 | 49 | ||
48 | /** Provided callback to call when a path is found. */ | 50 | /** |
51 | * Provided callback to call when a path is found. | ||
52 | */ | ||
49 | GCD_search_callback callback; | 53 | GCD_search_callback callback; |
50 | 54 | ||
51 | /** Provided closure. */ | 55 | /** |
56 | * Provided closure. | ||
57 | */ | ||
52 | void *cls; | 58 | void *cls; |
53 | 59 | ||
54 | /** Peer ID searched for */ | 60 | /** |
61 | * Peer ID searched for | ||
62 | */ | ||
55 | GNUNET_PEER_Id peer_id; | 63 | GNUNET_PEER_Id peer_id; |
56 | }; | 64 | }; |
57 | 65 | ||
@@ -224,13 +232,16 @@ announce_id (void *cls) | |||
224 | announce_id_task = NULL; | 232 | announce_id_task = NULL; |
225 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Announce ID\n"); | 233 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Announce ID\n"); |
226 | hello = GCH_get_mine (); | 234 | hello = GCH_get_mine (); |
227 | size = NULL != hello ? GNUNET_HELLO_size (hello) : 0; | 235 | size = (NULL != hello) ? GNUNET_HELLO_size (hello) : 0; |
228 | if (NULL == hello || 0 == size) | 236 | if ( (NULL == hello) || (0 == size) ) |
229 | { | 237 | { |
230 | /* Peerinfo gave us no hello yet, try again soon. */ | 238 | /* Peerinfo gave us no hello yet, try again soon. */ |
231 | LOG (GNUNET_ERROR_TYPE_INFO, " no hello, waiting!\n"); | 239 | LOG (GNUNET_ERROR_TYPE_INFO, |
232 | GNUNET_STATISTICS_update (stats, "# DHT announce skipped (no hello)", | 240 | " no hello, waiting!\n"); |
233 | 1, GNUNET_NO); | 241 | GNUNET_STATISTICS_update (stats, |
242 | "# DHT announce skipped (no hello)", | ||
243 | 1, | ||
244 | GNUNET_NO); | ||
234 | expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), | 245 | expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), |
235 | announce_delay); | 246 | announce_delay); |
236 | announce_delay = GNUNET_TIME_STD_BACKOFF (announce_delay); | 247 | announce_delay = GNUNET_TIME_STD_BACKOFF (announce_delay); |
@@ -241,29 +252,43 @@ announce_id (void *cls) | |||
241 | announce_delay = GNUNET_TIME_UNIT_SECONDS; | 252 | announce_delay = GNUNET_TIME_UNIT_SECONDS; |
242 | } | 253 | } |
243 | 254 | ||
244 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Hello %p size: %u\n", hello, size); | 255 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
245 | GNUNET_STATISTICS_update (stats, "# DHT announce", | 256 | "Hello %p size: %u\n", |
246 | 1, GNUNET_NO); | 257 | hello, |
247 | memset (&phash, 0, sizeof (phash)); | 258 | size); |
248 | GNUNET_memcpy (&phash, &my_full_id, sizeof (my_full_id)); | 259 | if (NULL != hello) |
249 | GNUNET_DHT_put (dht_handle, /* DHT handle */ | 260 | { |
250 | &phash, /* Key to use */ | 261 | GNUNET_STATISTICS_update (stats, |
251 | dht_replication_level, /* Replication level */ | 262 | "# DHT announce", |
252 | GNUNET_DHT_RO_RECORD_ROUTE | 263 | 1, GNUNET_NO); |
253 | | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, /* DHT options */ | 264 | memset (&phash, |
254 | GNUNET_BLOCK_TYPE_DHT_HELLO, /* Block type */ | 265 | 0, |
255 | size, /* Size of the data */ | 266 | sizeof (phash)); |
256 | (const char *) hello, /* Data itself */ | 267 | GNUNET_memcpy (&phash, |
257 | expiration, /* Data expiration */ | 268 | &my_full_id, |
258 | NULL, /* Continuation */ | 269 | sizeof (my_full_id)); |
259 | NULL); /* Continuation closure */ | 270 | GNUNET_DHT_put (dht_handle, /* DHT handle */ |
260 | 271 | &phash, /* Key to use */ | |
272 | dht_replication_level, /* Replication level */ | ||
273 | GNUNET_DHT_RO_RECORD_ROUTE | ||
274 | | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, /* DHT options */ | ||
275 | GNUNET_BLOCK_TYPE_DHT_HELLO, /* Block type */ | ||
276 | size, /* Size of the data */ | ||
277 | (const char *) hello, /* Data itself */ | ||
278 | expiration, /* Data expiration */ | ||
279 | NULL, /* Continuation */ | ||
280 | NULL); /* Continuation closure */ | ||
281 | } | ||
261 | /* Call again in id_announce_time, unless HELLO expires first, | 282 | /* Call again in id_announce_time, unless HELLO expires first, |
262 | * but wait at least 1s. */ | 283 | * but wait at least 1s. */ |
263 | next_put = GNUNET_TIME_absolute_get_remaining (expiration); | 284 | next_put = GNUNET_TIME_absolute_get_remaining (expiration); |
264 | next_put = GNUNET_TIME_relative_min (next_put, id_announce_time); | 285 | next_put = GNUNET_TIME_relative_min (next_put, |
265 | next_put = GNUNET_TIME_relative_max (next_put, GNUNET_TIME_UNIT_SECONDS); | 286 | id_announce_time); |
266 | announce_id_task = GNUNET_SCHEDULER_add_delayed (next_put, &announce_id, cls); | 287 | next_put = GNUNET_TIME_relative_max (next_put, |
288 | GNUNET_TIME_UNIT_SECONDS); | ||
289 | announce_id_task = GNUNET_SCHEDULER_add_delayed (next_put, | ||
290 | &announce_id, | ||
291 | cls); | ||
267 | } | 292 | } |
268 | 293 | ||
269 | /** | 294 | /** |
@@ -378,8 +403,11 @@ GCD_search (const struct GNUNET_PeerIdentity *peer_id, | |||
378 | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, | 403 | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, |
379 | NULL, /* xquery */ | 404 | NULL, /* xquery */ |
380 | 0, /* xquery bits */ | 405 | 0, /* xquery bits */ |
381 | &dht_get_id_handler, h); | 406 | &dht_get_id_handler, |
382 | GNUNET_CONTAINER_multihashmap32_put (get_requests, h->peer_id, h, | 407 | h); |
408 | GNUNET_CONTAINER_multihashmap32_put (get_requests, | ||
409 | h->peer_id, | ||
410 | h, | ||
383 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 411 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
384 | return h; | 412 | return h; |
385 | } | 413 | } |
diff --git a/src/cadet/gnunet-service-cadet_hello.h b/src/cadet/gnunet-service-cadet_hello.h index 5f535b496..34121e1e0 100644 --- a/src/cadet/gnunet-service-cadet_hello.h +++ b/src/cadet/gnunet-service-cadet_hello.h | |||
@@ -50,11 +50,13 @@ extern "C" | |||
50 | void | 50 | void |
51 | GCH_init (const struct GNUNET_CONFIGURATION_Handle *c); | 51 | GCH_init (const struct GNUNET_CONFIGURATION_Handle *c); |
52 | 52 | ||
53 | |||
53 | /** | 54 | /** |
54 | * Shut down the hello subsystem. | 55 | * Shut down the hello subsystem. |
55 | */ | 56 | */ |
56 | void | 57 | void |
57 | GCH_shutdown (); | 58 | GCH_shutdown (void); |
59 | |||
58 | 60 | ||
59 | /** | 61 | /** |
60 | * Get own hello message. | 62 | * Get own hello message. |
@@ -64,6 +66,7 @@ GCH_shutdown (); | |||
64 | const struct GNUNET_HELLO_Message * | 66 | const struct GNUNET_HELLO_Message * |
65 | GCH_get_mine (void); | 67 | GCH_get_mine (void); |
66 | 68 | ||
69 | |||
67 | #if 0 /* keep Emacsens' auto-indent happy */ | 70 | #if 0 /* keep Emacsens' auto-indent happy */ |
68 | { | 71 | { |
69 | #endif | 72 | #endif |
diff --git a/src/cadet/gnunet-service-cadet_local.c b/src/cadet/gnunet-service-cadet_local.c index 9be1224c1..e1f6ac4c3 100644 --- a/src/cadet/gnunet-service-cadet_local.c +++ b/src/cadet/gnunet-service-cadet_local.c | |||
@@ -61,7 +61,7 @@ struct CadetClient | |||
61 | * Tunnels that belong to this client, indexed by local id | 61 | * Tunnels that belong to this client, indexed by local id |
62 | */ | 62 | */ |
63 | struct GNUNET_CONTAINER_MultiHashMap32 *own_channels; | 63 | struct GNUNET_CONTAINER_MultiHashMap32 *own_channels; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Tunnels this client has accepted, indexed by incoming local id | 66 | * Tunnels this client has accepted, indexed by incoming local id |
67 | */ | 67 | */ |
@@ -70,7 +70,7 @@ struct CadetClient | |||
70 | /** | 70 | /** |
71 | * Channel ID for the next incoming channel. | 71 | * Channel ID for the next incoming channel. |
72 | */ | 72 | */ |
73 | CADET_ChannelNumber next_chid; | 73 | struct GNUNET_CADET_ClientChannelNumber next_chid; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Handle to communicate with the client | 76 | * Handle to communicate with the client |
@@ -188,7 +188,9 @@ channel_destroy_iterator (void *cls, | |||
188 | " Channel %s destroy, due to client %s shutdown.\n", | 188 | " Channel %s destroy, due to client %s shutdown.\n", |
189 | GCCH_2s (ch), GML_2s (c)); | 189 | GCCH_2s (ch), GML_2s (c)); |
190 | 190 | ||
191 | GCCH_handle_local_destroy (ch, c, key < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV); | 191 | GCCH_handle_local_destroy (ch, |
192 | c, | ||
193 | key < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | ||
192 | return GNUNET_OK; | 194 | return GNUNET_OK; |
193 | } | 195 | } |
194 | 196 | ||
@@ -247,7 +249,6 @@ client_new (struct GNUNET_SERVER_Client *client) | |||
247 | c = GNUNET_new (struct CadetClient); | 249 | c = GNUNET_new (struct CadetClient); |
248 | c->handle = client; | 250 | c->handle = client; |
249 | c->id = next_client_id++; /* overflow not important: just for debug */ | 251 | c->id = next_client_id++; /* overflow not important: just for debug */ |
250 | c->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_SERV; | ||
251 | 252 | ||
252 | c->own_channels = GNUNET_CONTAINER_multihashmap32_create (32); | 253 | c->own_channels = GNUNET_CONTAINER_multihashmap32_create (32); |
253 | c->incoming_channels = GNUNET_CONTAINER_multihashmap32_create (32); | 254 | c->incoming_channels = GNUNET_CONTAINER_multihashmap32_create (32); |
@@ -439,7 +440,7 @@ handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
439 | LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id); | 440 | LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id); |
440 | 441 | ||
441 | /* Message size sanity check */ | 442 | /* Message size sanity check */ |
442 | if (sizeof (struct GNUNET_CADET_ChannelCreateMessage) | 443 | if (sizeof (struct GNUNET_CADET_ChannelOpenMessageMessage) |
443 | != ntohs (message->size)) | 444 | != ntohs (message->size)) |
444 | { | 445 | { |
445 | GNUNET_break (0); | 446 | GNUNET_break (0); |
@@ -449,7 +450,7 @@ handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
449 | 450 | ||
450 | if (GNUNET_OK != | 451 | if (GNUNET_OK != |
451 | GCCH_handle_local_create (c, | 452 | GCCH_handle_local_create (c, |
452 | (struct GNUNET_CADET_ChannelCreateMessage *) | 453 | (struct GNUNET_CADET_ChannelOpenMessageMessage *) |
453 | message)) | 454 | message)) |
454 | { | 455 | { |
455 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 456 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
@@ -474,7 +475,7 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client, | |||
474 | struct GNUNET_CADET_ChannelDestroyMessage *msg; | 475 | struct GNUNET_CADET_ChannelDestroyMessage *msg; |
475 | struct CadetClient *c; | 476 | struct CadetClient *c; |
476 | struct CadetChannel *ch; | 477 | struct CadetChannel *ch; |
477 | CADET_ChannelNumber chid; | 478 | struct GNUNET_CADET_ClientChannelNumber chid; |
478 | 479 | ||
479 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a DESTROY CHANNEL from client!\n"); | 480 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a DESTROY CHANNEL from client!\n"); |
480 | 481 | ||
@@ -499,7 +500,7 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client, | |||
499 | msg = (struct GNUNET_CADET_ChannelDestroyMessage *) message; | 500 | msg = (struct GNUNET_CADET_ChannelDestroyMessage *) message; |
500 | 501 | ||
501 | /* Retrieve tunnel */ | 502 | /* Retrieve tunnel */ |
502 | chid = ntohl (msg->channel_id); | 503 | chid = msg->channel_id; |
503 | ch = GML_channel_get (c, chid); | 504 | ch = GML_channel_get (c, chid); |
504 | 505 | ||
505 | LOG (GNUNET_ERROR_TYPE_INFO, "Client %u is destroying channel %X\n", | 506 | LOG (GNUNET_ERROR_TYPE_INFO, "Client %u is destroying channel %X\n", |
@@ -515,7 +516,9 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client, | |||
515 | return; | 516 | return; |
516 | } | 517 | } |
517 | 518 | ||
518 | GCCH_handle_local_destroy (ch, c, chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV); | 519 | GCCH_handle_local_destroy (ch, |
520 | c, | ||
521 | ntohl (chid.channel_of_client) < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | ||
519 | 522 | ||
520 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 523 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
521 | return; | 524 | return; |
@@ -537,7 +540,7 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client, | |||
537 | struct GNUNET_CADET_LocalData *msg; | 540 | struct GNUNET_CADET_LocalData *msg; |
538 | struct CadetClient *c; | 541 | struct CadetClient *c; |
539 | struct CadetChannel *ch; | 542 | struct CadetChannel *ch; |
540 | CADET_ChannelNumber chid; | 543 | struct GNUNET_CADET_ClientChannelNumber chid; |
541 | size_t message_size; | 544 | size_t message_size; |
542 | size_t payload_size; | 545 | size_t payload_size; |
543 | size_t payload_claimed_size; | 546 | size_t payload_claimed_size; |
@@ -583,12 +586,12 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client, | |||
583 | return; | 586 | return; |
584 | } | 587 | } |
585 | 588 | ||
586 | chid = ntohl (msg->id); | 589 | chid = msg->id; |
587 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %u bytes (%u payload) by client %u\n", | 590 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %u bytes (%u payload) by client %u\n", |
588 | payload_size, payload_claimed_size, c->id); | 591 | payload_size, payload_claimed_size, c->id); |
589 | 592 | ||
590 | /* Channel exists? */ | 593 | /* Channel exists? */ |
591 | fwd = chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV; | 594 | fwd = ntohl (chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; |
592 | ch = GML_channel_get (c, chid); | 595 | ch = GML_channel_get (c, chid); |
593 | if (NULL == ch) | 596 | if (NULL == ch) |
594 | { | 597 | { |
@@ -626,7 +629,7 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client, | |||
626 | struct GNUNET_CADET_LocalAck *msg; | 629 | struct GNUNET_CADET_LocalAck *msg; |
627 | struct CadetChannel *ch; | 630 | struct CadetChannel *ch; |
628 | struct CadetClient *c; | 631 | struct CadetClient *c; |
629 | CADET_ChannelNumber chid; | 632 | struct GNUNET_CADET_ClientChannelNumber chid; |
630 | int fwd; | 633 | int fwd; |
631 | 634 | ||
632 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n"); | 635 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n"); |
@@ -644,13 +647,16 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client, | |||
644 | msg = (struct GNUNET_CADET_LocalAck *) message; | 647 | msg = (struct GNUNET_CADET_LocalAck *) message; |
645 | 648 | ||
646 | /* Channel exists? */ | 649 | /* Channel exists? */ |
647 | chid = ntohl (msg->channel_id); | 650 | chid = msg->channel_id; |
648 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid); | 651 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", |
652 | ntohl (chid.channel_of_client)); | ||
649 | ch = GML_channel_get (c, chid); | 653 | ch = GML_channel_get (c, chid); |
650 | LOG (GNUNET_ERROR_TYPE_DEBUG, " -- ch %p\n", ch); | 654 | LOG (GNUNET_ERROR_TYPE_DEBUG, " -- ch %p\n", ch); |
651 | if (NULL == ch) | 655 | if (NULL == ch) |
652 | { | 656 | { |
653 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %X unknown.\n", chid); | 657 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
658 | "Channel %X unknown.\n", | ||
659 | ntohl (chid.channel_of_client)); | ||
654 | LOG (GNUNET_ERROR_TYPE_DEBUG, " for client %u.\n", c->id); | 660 | LOG (GNUNET_ERROR_TYPE_DEBUG, " for client %u.\n", c->id); |
655 | GNUNET_STATISTICS_update (stats, | 661 | GNUNET_STATISTICS_update (stats, |
656 | "# client ack messages on unknown channel", | 662 | "# client ack messages on unknown channel", |
@@ -661,12 +667,10 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client, | |||
661 | 667 | ||
662 | /* If client is root, the ACK is going FWD, therefore this is "BCK ACK". */ | 668 | /* If client is root, the ACK is going FWD, therefore this is "BCK ACK". */ |
663 | /* If client is dest, the ACK is going BCK, therefore this is "FWD ACK" */ | 669 | /* If client is dest, the ACK is going BCK, therefore this is "FWD ACK" */ |
664 | fwd = chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV; | 670 | fwd = ntohl (chid.channel_of_client) < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; |
665 | 671 | ||
666 | GCCH_handle_local_ack (ch, fwd); | 672 | GCCH_handle_local_ack (ch, fwd); |
667 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 673 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
668 | |||
669 | return; | ||
670 | } | 674 | } |
671 | 675 | ||
672 | 676 | ||
@@ -961,8 +965,9 @@ static void | |||
961 | iter_connection (void *cls, struct CadetConnection *c) | 965 | iter_connection (void *cls, struct CadetConnection *c) |
962 | { | 966 | { |
963 | struct GNUNET_CADET_LocalInfoTunnel *msg = cls; | 967 | struct GNUNET_CADET_LocalInfoTunnel *msg = cls; |
964 | struct GNUNET_CADET_Hash *h = (struct GNUNET_CADET_Hash *) &msg[1]; | 968 | struct GNUNET_CADET_ConnectionTunnelIdentifier *h; |
965 | 969 | ||
970 | h = (struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1]; | ||
966 | h[msg->connections] = *(GCC_get_id (c)); | 971 | h[msg->connections] = *(GCC_get_id (c)); |
967 | msg->connections++; | 972 | msg->connections++; |
968 | } | 973 | } |
@@ -971,10 +976,10 @@ static void | |||
971 | iter_channel (void *cls, struct CadetChannel *ch) | 976 | iter_channel (void *cls, struct CadetChannel *ch) |
972 | { | 977 | { |
973 | struct GNUNET_CADET_LocalInfoTunnel *msg = cls; | 978 | struct GNUNET_CADET_LocalInfoTunnel *msg = cls; |
974 | struct GNUNET_CADET_Hash *h = (struct GNUNET_CADET_Hash *) &msg[1]; | 979 | struct GNUNET_CADET_ConnectionTunnelIdentifier *h = (struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1]; |
975 | CADET_ChannelNumber *chn = (CADET_ChannelNumber *) &h[msg->connections]; | 980 | struct GNUNET_CADET_ChannelTunnelNumber *chn = (struct GNUNET_CADET_ChannelTunnelNumber *) &h[msg->connections]; |
976 | 981 | ||
977 | chn[msg->channels] = htonl (GCCH_get_id (ch)); | 982 | chn[msg->channels] = GCCH_get_id (ch); |
978 | msg->channels++; | 983 | msg->channels++; |
979 | } | 984 | } |
980 | 985 | ||
@@ -1039,8 +1044,8 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, | |||
1039 | c_n = GCT_count_any_connections (t); | 1044 | c_n = GCT_count_any_connections (t); |
1040 | 1045 | ||
1041 | size = sizeof (struct GNUNET_CADET_LocalInfoTunnel); | 1046 | size = sizeof (struct GNUNET_CADET_LocalInfoTunnel); |
1042 | size += c_n * sizeof (struct GNUNET_CADET_Hash); | 1047 | size += c_n * sizeof (struct GNUNET_CADET_ConnectionTunnelIdentifier); |
1043 | size += ch_n * sizeof (CADET_ChannelNumber); | 1048 | size += ch_n * sizeof (struct GNUNET_CADET_ChannelTunnelNumber); |
1044 | 1049 | ||
1045 | resp = GNUNET_malloc (size); | 1050 | resp = GNUNET_malloc (size); |
1046 | resp->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL); | 1051 | resp->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL); |
@@ -1123,8 +1128,8 @@ static struct GNUNET_SERVER_MessageHandler client_handlers[] = { | |||
1123 | sizeof (struct GNUNET_CADET_PortMessage)}, | 1128 | sizeof (struct GNUNET_CADET_PortMessage)}, |
1124 | {&handle_port_close, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, | 1129 | {&handle_port_close, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, |
1125 | sizeof (struct GNUNET_CADET_PortMessage)}, | 1130 | sizeof (struct GNUNET_CADET_PortMessage)}, |
1126 | {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE, | 1131 | {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN, |
1127 | sizeof (struct GNUNET_CADET_ChannelCreateMessage)}, | 1132 | sizeof (struct GNUNET_CADET_ChannelOpenMessageMessage)}, |
1128 | {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, | 1133 | {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, |
1129 | sizeof (struct GNUNET_CADET_ChannelDestroyMessage)}, | 1134 | sizeof (struct GNUNET_CADET_ChannelDestroyMessage)}, |
1130 | {&handle_data, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, 0}, | 1135 | {&handle_data, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, 0}, |
@@ -1214,26 +1219,16 @@ GML_shutdown (void) | |||
1214 | * @return non-NULL if channel exists in the clients lists | 1219 | * @return non-NULL if channel exists in the clients lists |
1215 | */ | 1220 | */ |
1216 | struct CadetChannel * | 1221 | struct CadetChannel * |
1217 | GML_channel_get (struct CadetClient *c, CADET_ChannelNumber chid) | 1222 | GML_channel_get (struct CadetClient *c, |
1223 | struct GNUNET_CADET_ClientChannelNumber chid) | ||
1218 | { | 1224 | { |
1219 | struct GNUNET_CONTAINER_MultiHashMap32 *map; | 1225 | struct GNUNET_CONTAINER_MultiHashMap32 *map; |
1220 | 1226 | ||
1221 | if (0 == (chid & GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)) | 1227 | if (ntohl (chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) |
1222 | { | ||
1223 | GNUNET_break_op (0); | ||
1224 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid); | ||
1225 | return NULL; | ||
1226 | } | ||
1227 | |||
1228 | if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV) | ||
1229 | map = c->incoming_channels; | ||
1230 | else if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
1231 | map = c->own_channels; | 1228 | map = c->own_channels; |
1232 | else | 1229 | else |
1233 | { | 1230 | map = c->incoming_channels; |
1234 | GNUNET_break (0); | 1231 | |
1235 | map = NULL; | ||
1236 | } | ||
1237 | if (NULL == map) | 1232 | if (NULL == map) |
1238 | { | 1233 | { |
1239 | GNUNET_break (0); | 1234 | GNUNET_break (0); |
@@ -1242,7 +1237,8 @@ GML_channel_get (struct CadetClient *c, CADET_ChannelNumber chid) | |||
1242 | GML_2s (c), chid); | 1237 | GML_2s (c), chid); |
1243 | return NULL; | 1238 | return NULL; |
1244 | } | 1239 | } |
1245 | return GNUNET_CONTAINER_multihashmap32_get (map, chid); | 1240 | return GNUNET_CONTAINER_multihashmap32_get (map, |
1241 | chid.channel_of_client); | ||
1246 | } | 1242 | } |
1247 | 1243 | ||
1248 | 1244 | ||
@@ -1255,17 +1251,19 @@ GML_channel_get (struct CadetClient *c, CADET_ChannelNumber chid) | |||
1255 | */ | 1251 | */ |
1256 | void | 1252 | void |
1257 | GML_channel_add (struct CadetClient *client, | 1253 | GML_channel_add (struct CadetClient *client, |
1258 | uint32_t chid, | 1254 | struct GNUNET_CADET_ClientChannelNumber chid, |
1259 | struct CadetChannel *ch) | 1255 | struct CadetChannel *ch) |
1260 | { | 1256 | { |
1261 | if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV) | 1257 | if (ntohl (chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) |
1262 | GNUNET_CONTAINER_multihashmap32_put (client->incoming_channels, chid, ch, | 1258 | GNUNET_CONTAINER_multihashmap32_put (client->own_channels, |
1263 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1259 | chid.channel_of_client, |
1264 | else if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | 1260 | ch, |
1265 | GNUNET_CONTAINER_multihashmap32_put (client->own_channels, chid, ch, | ||
1266 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1261 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1267 | else | 1262 | else |
1268 | GNUNET_break (0); | 1263 | GNUNET_CONTAINER_multihashmap32_put (client->incoming_channels, |
1264 | chid.channel_of_client, | ||
1265 | ch, | ||
1266 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | ||
1269 | } | 1267 | } |
1270 | 1268 | ||
1271 | 1269 | ||
@@ -1278,19 +1276,17 @@ GML_channel_add (struct CadetClient *client, | |||
1278 | */ | 1276 | */ |
1279 | void | 1277 | void |
1280 | GML_channel_remove (struct CadetClient *client, | 1278 | GML_channel_remove (struct CadetClient *client, |
1281 | uint32_t chid, | 1279 | struct GNUNET_CADET_ClientChannelNumber chid, |
1282 | struct CadetChannel *ch) | 1280 | struct CadetChannel *ch) |
1283 | { | 1281 | { |
1284 | if (GNUNET_CADET_LOCAL_CHANNEL_ID_SERV <= chid) | 1282 | if (ntohl (chid.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) |
1285 | GNUNET_break (GNUNET_YES == | 1283 | GNUNET_CONTAINER_multihashmap32_remove (client->own_channels, |
1286 | GNUNET_CONTAINER_multihashmap32_remove (client->incoming_channels, | 1284 | chid.channel_of_client, |
1287 | chid, ch)); | 1285 | ch); |
1288 | else if (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI <= chid) | ||
1289 | GNUNET_break (GNUNET_YES == | ||
1290 | GNUNET_CONTAINER_multihashmap32_remove (client->own_channels, | ||
1291 | chid, ch)); | ||
1292 | else | 1286 | else |
1293 | GNUNET_break (0); | 1287 | GNUNET_CONTAINER_multihashmap32_remove (client->incoming_channels, |
1288 | chid.channel_of_client, | ||
1289 | ch); | ||
1294 | } | 1290 | } |
1295 | 1291 | ||
1296 | 1292 | ||
@@ -1301,18 +1297,26 @@ GML_channel_remove (struct CadetClient *client, | |||
1301 | * | 1297 | * |
1302 | * @return LID of a channel free to use. | 1298 | * @return LID of a channel free to use. |
1303 | */ | 1299 | */ |
1304 | CADET_ChannelNumber | 1300 | struct GNUNET_CADET_ClientChannelNumber |
1305 | GML_get_next_chid (struct CadetClient *c) | 1301 | GML_get_next_chid (struct CadetClient *c) |
1306 | { | 1302 | { |
1307 | CADET_ChannelNumber chid; | 1303 | struct GNUNET_CADET_ClientChannelNumber chid; |
1308 | 1304 | ||
1309 | while (NULL != GML_channel_get (c, c->next_chid)) | 1305 | while (NULL != GML_channel_get (c, |
1306 | c->next_chid)) | ||
1310 | { | 1307 | { |
1311 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", c->next_chid); | 1308 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1312 | c->next_chid = (c->next_chid + 1) | GNUNET_CADET_LOCAL_CHANNEL_ID_SERV; | 1309 | "Channel %u exists...\n", |
1310 | c->next_chid); | ||
1311 | c->next_chid.channel_of_client | ||
1312 | = htonl (1 + (ntohl (c->next_chid.channel_of_client))); | ||
1313 | if (ntohl (c->next_chid.channel_of_client) >= | ||
1314 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) | ||
1315 | c->next_chid.channel_of_client = htonl (0); | ||
1313 | } | 1316 | } |
1314 | chid = c->next_chid; | 1317 | chid = c->next_chid; |
1315 | c->next_chid = (c->next_chid + 1) | GNUNET_CADET_LOCAL_CHANNEL_ID_SERV; | 1318 | c->next_chid.channel_of_client |
1319 | = htonl (1 + (ntohl (c->next_chid.channel_of_client))); | ||
1316 | 1320 | ||
1317 | return chid; | 1321 | return chid; |
1318 | } | 1322 | } |
@@ -1330,9 +1334,11 @@ GML_client_get (struct GNUNET_SERVER_Client *client) | |||
1330 | { | 1334 | { |
1331 | if (NULL == client) | 1335 | if (NULL == client) |
1332 | return NULL; | 1336 | return NULL; |
1333 | return GNUNET_SERVER_client_get_user_context (client, struct CadetClient); | 1337 | return GNUNET_SERVER_client_get_user_context (client, |
1338 | struct CadetClient); | ||
1334 | } | 1339 | } |
1335 | 1340 | ||
1341 | |||
1336 | /** | 1342 | /** |
1337 | * Find a client that has opened a port | 1343 | * Find a client that has opened a port |
1338 | * | 1344 | * |
@@ -1357,27 +1363,25 @@ GML_client_get_by_port (const struct GNUNET_HashCode *port) | |||
1357 | void | 1363 | void |
1358 | GML_client_delete_channel (struct CadetClient *c, | 1364 | GML_client_delete_channel (struct CadetClient *c, |
1359 | struct CadetChannel *ch, | 1365 | struct CadetChannel *ch, |
1360 | CADET_ChannelNumber id) | 1366 | struct GNUNET_CADET_ClientChannelNumber id) |
1361 | { | 1367 | { |
1362 | int res; | 1368 | int res; |
1363 | 1369 | ||
1364 | if (GNUNET_CADET_LOCAL_CHANNEL_ID_SERV <= id) | 1370 | if (ntohl (id.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) |
1365 | { | ||
1366 | res = GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels, | ||
1367 | id, ch); | ||
1368 | if (GNUNET_YES != res) | ||
1369 | LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel dest KO\n"); | ||
1370 | } | ||
1371 | else if (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI <= id) | ||
1372 | { | 1371 | { |
1373 | res = GNUNET_CONTAINER_multihashmap32_remove (c->own_channels, | 1372 | res = GNUNET_CONTAINER_multihashmap32_remove (c->own_channels, |
1374 | id, ch); | 1373 | id.channel_of_client, |
1374 | ch); | ||
1375 | if (GNUNET_YES != res) | 1375 | if (GNUNET_YES != res) |
1376 | LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_tunnel root KO\n"); | 1376 | LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_tunnel root KO\n"); |
1377 | } | 1377 | } |
1378 | else | 1378 | else |
1379 | { | 1379 | { |
1380 | GNUNET_break (0); | 1380 | res = GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels, |
1381 | id.channel_of_client, | ||
1382 | ch); | ||
1383 | if (GNUNET_YES != res) | ||
1384 | LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel dest KO\n"); | ||
1381 | } | 1385 | } |
1382 | } | 1386 | } |
1383 | 1387 | ||
@@ -1390,17 +1394,21 @@ GML_client_delete_channel (struct CadetClient *c, | |||
1390 | * @param id Channel ID to use | 1394 | * @param id Channel ID to use |
1391 | */ | 1395 | */ |
1392 | void | 1396 | void |
1393 | GML_send_ack (struct CadetClient *c, CADET_ChannelNumber id) | 1397 | GML_send_ack (struct CadetClient *c, |
1398 | struct GNUNET_CADET_ClientChannelNumber id) | ||
1394 | { | 1399 | { |
1395 | struct GNUNET_CADET_LocalAck msg; | 1400 | struct GNUNET_CADET_LocalAck msg; |
1396 | 1401 | ||
1397 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1402 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1398 | "send local %s ack on %X towards %p\n", | 1403 | "send local %s ack on %X towards %p\n", |
1399 | id < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV ? "FWD" : "BCK", id, c); | 1404 | ntohl (id.channel_of_client) < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI |
1405 | ? "FWD" : "BCK", | ||
1406 | ntohl (id.channel_of_client), | ||
1407 | c); | ||
1400 | 1408 | ||
1401 | msg.header.size = htons (sizeof (msg)); | 1409 | msg.header.size = htons (sizeof (msg)); |
1402 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); | 1410 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); |
1403 | msg.channel_id = htonl (id); | 1411 | msg.channel_id = id; |
1404 | GNUNET_SERVER_notification_context_unicast (nc, | 1412 | GNUNET_SERVER_notification_context_unicast (nc, |
1405 | c->handle, | 1413 | c->handle, |
1406 | &msg.header, | 1414 | &msg.header, |
@@ -1421,14 +1429,16 @@ GML_send_ack (struct CadetClient *c, CADET_ChannelNumber id) | |||
1421 | */ | 1429 | */ |
1422 | void | 1430 | void |
1423 | GML_send_channel_create (struct CadetClient *c, | 1431 | GML_send_channel_create (struct CadetClient *c, |
1424 | uint32_t id, struct GNUNET_HashCode *port, | 1432 | struct GNUNET_CADET_ClientChannelNumber id, |
1425 | uint32_t opt, const struct GNUNET_PeerIdentity *peer) | 1433 | const struct GNUNET_HashCode *port, |
1434 | uint32_t opt, | ||
1435 | const struct GNUNET_PeerIdentity *peer) | ||
1426 | { | 1436 | { |
1427 | struct GNUNET_CADET_ChannelCreateMessage msg; | 1437 | struct GNUNET_CADET_ChannelOpenMessageMessage msg; |
1428 | 1438 | ||
1429 | msg.header.size = htons (sizeof (msg)); | 1439 | msg.header.size = htons (sizeof (msg)); |
1430 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); | 1440 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); |
1431 | msg.channel_id = htonl (id); | 1441 | msg.channel_id = id; |
1432 | msg.port = *port; | 1442 | msg.port = *port; |
1433 | msg.opt = htonl (opt); | 1443 | msg.opt = htonl (opt); |
1434 | msg.peer = *peer; | 1444 | msg.peer = *peer; |
@@ -1444,17 +1454,19 @@ GML_send_channel_create (struct CadetClient *c, | |||
1444 | * @param id Channel ID to use | 1454 | * @param id Channel ID to use |
1445 | */ | 1455 | */ |
1446 | void | 1456 | void |
1447 | GML_send_channel_nack (struct CadetClient *c, CADET_ChannelNumber id) | 1457 | GML_send_channel_nack (struct CadetClient *c, |
1458 | struct GNUNET_CADET_ClientChannelNumber id) | ||
1448 | { | 1459 | { |
1449 | struct GNUNET_CADET_LocalAck msg; | 1460 | struct GNUNET_CADET_LocalAck msg; |
1450 | 1461 | ||
1451 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1462 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1452 | "send local nack on %X towards %p\n", | 1463 | "send local nack on %X towards %p\n", |
1453 | id, c); | 1464 | ntohl (id.channel_of_client), |
1465 | c); | ||
1454 | 1466 | ||
1455 | msg.header.size = htons (sizeof (msg)); | 1467 | msg.header.size = htons (sizeof (msg)); |
1456 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK); | 1468 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED); |
1457 | msg.channel_id = htonl (id); | 1469 | msg.channel_id = id; |
1458 | GNUNET_SERVER_notification_context_unicast (nc, | 1470 | GNUNET_SERVER_notification_context_unicast (nc, |
1459 | c->handle, | 1471 | c->handle, |
1460 | &msg.header, | 1472 | &msg.header, |
@@ -1469,7 +1481,8 @@ GML_send_channel_nack (struct CadetClient *c, CADET_ChannelNumber id) | |||
1469 | * @param id ID of the channel that is destroyed. | 1481 | * @param id ID of the channel that is destroyed. |
1470 | */ | 1482 | */ |
1471 | void | 1483 | void |
1472 | GML_send_channel_destroy (struct CadetClient *c, uint32_t id) | 1484 | GML_send_channel_destroy (struct CadetClient *c, |
1485 | struct GNUNET_CADET_ClientChannelNumber id) | ||
1473 | { | 1486 | { |
1474 | struct GNUNET_CADET_ChannelDestroyMessage msg; | 1487 | struct GNUNET_CADET_ChannelDestroyMessage msg; |
1475 | 1488 | ||
@@ -1482,7 +1495,7 @@ GML_send_channel_destroy (struct CadetClient *c, uint32_t id) | |||
1482 | return; | 1495 | return; |
1483 | msg.header.size = htons (sizeof (msg)); | 1496 | msg.header.size = htons (sizeof (msg)); |
1484 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); | 1497 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); |
1485 | msg.channel_id = htonl (id); | 1498 | msg.channel_id = id; |
1486 | GNUNET_SERVER_notification_context_unicast (nc, c->handle, | 1499 | GNUNET_SERVER_notification_context_unicast (nc, c->handle, |
1487 | &msg.header, GNUNET_NO); | 1500 | &msg.header, GNUNET_NO); |
1488 | } | 1501 | } |
@@ -1497,11 +1510,11 @@ GML_send_channel_destroy (struct CadetClient *c, uint32_t id) | |||
1497 | */ | 1510 | */ |
1498 | void | 1511 | void |
1499 | GML_send_data (struct CadetClient *c, | 1512 | GML_send_data (struct CadetClient *c, |
1500 | const struct GNUNET_CADET_Data *msg, | 1513 | const struct GNUNET_CADET_ChannelAppDataMessage *msg, |
1501 | CADET_ChannelNumber id) | 1514 | struct GNUNET_CADET_ClientChannelNumber id) |
1502 | { | 1515 | { |
1503 | struct GNUNET_CADET_LocalData *copy; | 1516 | struct GNUNET_CADET_LocalData *copy; |
1504 | uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_CADET_Data); | 1517 | uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_CADET_ChannelAppDataMessage); |
1505 | char cbuf[size + sizeof (struct GNUNET_CADET_LocalData)]; | 1518 | char cbuf[size + sizeof (struct GNUNET_CADET_LocalData)]; |
1506 | 1519 | ||
1507 | if (size < sizeof (struct GNUNET_MessageHeader)) | 1520 | if (size < sizeof (struct GNUNET_MessageHeader)) |
@@ -1518,7 +1531,7 @@ GML_send_data (struct CadetClient *c, | |||
1518 | GNUNET_memcpy (©[1], &msg[1], size); | 1531 | GNUNET_memcpy (©[1], &msg[1], size); |
1519 | copy->header.size = htons (sizeof (struct GNUNET_CADET_LocalData) + size); | 1532 | copy->header.size = htons (sizeof (struct GNUNET_CADET_LocalData) + size); |
1520 | copy->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); | 1533 | copy->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); |
1521 | copy->id = htonl (id); | 1534 | copy->id = id; |
1522 | GNUNET_SERVER_notification_context_unicast (nc, c->handle, | 1535 | GNUNET_SERVER_notification_context_unicast (nc, c->handle, |
1523 | ©->header, GNUNET_NO); | 1536 | ©->header, GNUNET_NO); |
1524 | } | 1537 | } |
diff --git a/src/cadet/gnunet-service-cadet_local.h b/src/cadet/gnunet-service-cadet_local.h index f89745092..bf691f9c3 100644 --- a/src/cadet/gnunet-service-cadet_local.h +++ b/src/cadet/gnunet-service-cadet_local.h | |||
@@ -80,7 +80,8 @@ GML_shutdown (void); | |||
80 | * @return non-NULL if channel exists in the clients lists | 80 | * @return non-NULL if channel exists in the clients lists |
81 | */ | 81 | */ |
82 | struct CadetChannel * | 82 | struct CadetChannel * |
83 | GML_channel_get (struct CadetClient *c, uint32_t chid); | 83 | GML_channel_get (struct CadetClient *c, |
84 | struct GNUNET_CADET_ClientChannelNumber chid); | ||
84 | 85 | ||
85 | /** | 86 | /** |
86 | * Add a channel to a client | 87 | * Add a channel to a client |
@@ -91,7 +92,7 @@ GML_channel_get (struct CadetClient *c, uint32_t chid); | |||
91 | */ | 92 | */ |
92 | void | 93 | void |
93 | GML_channel_add (struct CadetClient *client, | 94 | GML_channel_add (struct CadetClient *client, |
94 | uint32_t chid, | 95 | struct GNUNET_CADET_ClientChannelNumber chid, |
95 | struct CadetChannel *ch); | 96 | struct CadetChannel *ch); |
96 | 97 | ||
97 | /** | 98 | /** |
@@ -103,7 +104,7 @@ GML_channel_add (struct CadetClient *client, | |||
103 | */ | 104 | */ |
104 | void | 105 | void |
105 | GML_channel_remove (struct CadetClient *client, | 106 | GML_channel_remove (struct CadetClient *client, |
106 | uint32_t chid, | 107 | struct GNUNET_CADET_ClientChannelNumber chid, |
107 | struct CadetChannel *ch); | 108 | struct CadetChannel *ch); |
108 | 109 | ||
109 | /** | 110 | /** |
@@ -113,7 +114,7 @@ GML_channel_remove (struct CadetClient *client, | |||
113 | * | 114 | * |
114 | * @return LID of a channel free to use. | 115 | * @return LID of a channel free to use. |
115 | */ | 116 | */ |
116 | CADET_ChannelNumber | 117 | struct GNUNET_CADET_ClientChannelNumber |
117 | GML_get_next_chid (struct CadetClient *c); | 118 | GML_get_next_chid (struct CadetClient *c); |
118 | 119 | ||
119 | /** | 120 | /** |
@@ -146,7 +147,7 @@ GML_client_get_by_port (const struct GNUNET_HashCode *port); | |||
146 | void | 147 | void |
147 | GML_client_delete_channel (struct CadetClient *c, | 148 | GML_client_delete_channel (struct CadetClient *c, |
148 | struct CadetChannel *ch, | 149 | struct CadetChannel *ch, |
149 | CADET_ChannelNumber id); | 150 | struct GNUNET_CADET_ClientChannelNumber id); |
150 | 151 | ||
151 | /** | 152 | /** |
152 | * Build a local ACK message and send it to a local client, if needed. | 153 | * Build a local ACK message and send it to a local client, if needed. |
@@ -157,7 +158,8 @@ GML_client_delete_channel (struct CadetClient *c, | |||
157 | * @param id Channel ID to use | 158 | * @param id Channel ID to use |
158 | */ | 159 | */ |
159 | void | 160 | void |
160 | GML_send_ack (struct CadetClient *c, CADET_ChannelNumber id); | 161 | GML_send_ack (struct CadetClient *c, |
162 | struct GNUNET_CADET_ClientChannelNumber id); | ||
161 | 163 | ||
162 | /** | 164 | /** |
163 | * Notify the appropriate client that a new incoming channel was created. | 165 | * Notify the appropriate client that a new incoming channel was created. |
@@ -170,8 +172,10 @@ GML_send_ack (struct CadetClient *c, CADET_ChannelNumber id); | |||
170 | */ | 172 | */ |
171 | void | 173 | void |
172 | GML_send_channel_create (struct CadetClient *c, | 174 | GML_send_channel_create (struct CadetClient *c, |
173 | uint32_t id, struct GNUNET_HashCode *port, | 175 | struct GNUNET_CADET_ClientChannelNumber id, |
174 | uint32_t opt, const struct GNUNET_PeerIdentity *peer); | 176 | const struct GNUNET_HashCode *port, |
177 | uint32_t opt, | ||
178 | const struct GNUNET_PeerIdentity *peer); | ||
175 | 179 | ||
176 | /** | 180 | /** |
177 | * Build a local channel NACK message and send it to a local client. | 181 | * Build a local channel NACK message and send it to a local client. |
@@ -180,7 +184,9 @@ GML_send_channel_create (struct CadetClient *c, | |||
180 | * @param id Channel ID to use | 184 | * @param id Channel ID to use |
181 | */ | 185 | */ |
182 | void | 186 | void |
183 | GML_send_channel_nack (struct CadetClient *c, CADET_ChannelNumber id); | 187 | GML_send_channel_nack (struct CadetClient *c, |
188 | struct GNUNET_CADET_ClientChannelNumber id); | ||
189 | |||
184 | 190 | ||
185 | /** | 191 | /** |
186 | * Notify a client that a channel is no longer valid. | 192 | * Notify a client that a channel is no longer valid. |
@@ -189,7 +195,9 @@ GML_send_channel_nack (struct CadetClient *c, CADET_ChannelNumber id); | |||
189 | * @param id ID of the channel that is destroyed. | 195 | * @param id ID of the channel that is destroyed. |
190 | */ | 196 | */ |
191 | void | 197 | void |
192 | GML_send_channel_destroy (struct CadetClient *c, uint32_t id); | 198 | GML_send_channel_destroy (struct CadetClient *c, |
199 | struct GNUNET_CADET_ClientChannelNumber id); | ||
200 | |||
193 | 201 | ||
194 | /** | 202 | /** |
195 | * Modify the cadet message ID from global to local and send to client. | 203 | * Modify the cadet message ID from global to local and send to client. |
@@ -200,8 +208,8 @@ GML_send_channel_destroy (struct CadetClient *c, uint32_t id); | |||
200 | */ | 208 | */ |
201 | void | 209 | void |
202 | GML_send_data (struct CadetClient *c, | 210 | GML_send_data (struct CadetClient *c, |
203 | const struct GNUNET_CADET_Data *msg, | 211 | const struct GNUNET_CADET_ChannelAppDataMessage *msg, |
204 | CADET_ChannelNumber id); | 212 | struct GNUNET_CADET_ClientChannelNumber id); |
205 | 213 | ||
206 | /** | 214 | /** |
207 | * Get the static string to represent a client. | 215 | * Get the static string to represent a client. |
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index c312d56bf..3f8b7bbb8 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -73,6 +73,11 @@ struct CadetPeerQueue { | |||
73 | void *cont_cls; | 73 | void *cont_cls; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Task to asynchronously run the drop continuation. | ||
77 | */ | ||
78 | struct GNUNET_SCHEDULER_Task *drop_task; | ||
79 | |||
80 | /** | ||
76 | * Time when message was queued for sending. | 81 | * Time when message was queued for sending. |
77 | */ | 82 | */ |
78 | struct GNUNET_TIME_Absolute queue_timestamp; | 83 | struct GNUNET_TIME_Absolute queue_timestamp; |
@@ -98,9 +103,9 @@ struct CadetPeerQueue { | |||
98 | uint16_t payload_type; | 103 | uint16_t payload_type; |
99 | 104 | ||
100 | /** | 105 | /** |
101 | *ID of the payload (PID, ACK #, ...). | 106 | * ID of the payload (PID, ACK #, ...). |
102 | */ | 107 | */ |
103 | uint16_t payload_id; | 108 | struct CadetEncryptedMessageIdentifier payload_id; |
104 | 109 | ||
105 | /** | 110 | /** |
106 | * Connection this message was sent on. | 111 | * Connection this message was sent on. |
@@ -160,7 +165,7 @@ struct CadetPeer | |||
160 | /** | 165 | /** |
161 | * Connections that go through this peer; indexed by tid. | 166 | * Connections that go through this peer; indexed by tid. |
162 | */ | 167 | */ |
163 | struct GNUNET_CONTAINER_MultiHashMap *connections; | 168 | struct GNUNET_CONTAINER_MultiShortmap *connections; |
164 | 169 | ||
165 | /** | 170 | /** |
166 | * Handle for core transmissions. | 171 | * Handle for core transmissions. |
@@ -263,7 +268,7 @@ static int in_shutdown; | |||
263 | */ | 268 | */ |
264 | static int | 269 | static int |
265 | notify_broken (void *cls, | 270 | notify_broken (void *cls, |
266 | const struct GNUNET_HashCode *key, | 271 | const struct GNUNET_ShortHashCode *key, |
267 | void *value) | 272 | void *value) |
268 | { | 273 | { |
269 | struct CadetPeer *peer = cls; | 274 | struct CadetPeer *peer = cls; |
@@ -368,7 +373,8 @@ core_connect_handler (void *cls, | |||
368 | 373 | ||
369 | /* Create the connections hashmap */ | 374 | /* Create the connections hashmap */ |
370 | GNUNET_assert (NULL == neighbor->connections); | 375 | GNUNET_assert (NULL == neighbor->connections); |
371 | neighbor->connections = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO); | 376 | neighbor->connections = GNUNET_CONTAINER_multishortmap_create (16, |
377 | GNUNET_YES); | ||
372 | GNUNET_STATISTICS_update (stats, | 378 | GNUNET_STATISTICS_update (stats, |
373 | "# peers", | 379 | "# peers", |
374 | 1, | 380 | 1, |
@@ -420,11 +426,11 @@ core_disconnect_handler (void *cls, | |||
420 | direct_path = pop_direct_path (p); | 426 | direct_path = pop_direct_path (p); |
421 | if (NULL != p->connections) | 427 | if (NULL != p->connections) |
422 | { | 428 | { |
423 | GNUNET_CONTAINER_multihashmap_iterate (p->connections, | 429 | GNUNET_CONTAINER_multishortmap_iterate (p->connections, |
424 | ¬ify_broken, | 430 | ¬ify_broken, |
425 | p); | 431 | p); |
426 | GNUNET_CONTAINER_multihashmap_destroy (p->connections); | 432 | GNUNET_CONTAINER_multishortmap_destroy (p->connections); |
427 | p->connections = NULL; | 433 | p->connections = NULL; |
428 | } | 434 | } |
429 | GNUNET_STATISTICS_update (stats, | 435 | GNUNET_STATISTICS_update (stats, |
430 | "# peers", | 436 | "# peers", |
@@ -450,7 +456,7 @@ core_disconnect_handler (void *cls, | |||
450 | * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. | 456 | * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. |
451 | */ | 457 | */ |
452 | static int | 458 | static int |
453 | check_create (void *cls, const struct GNUNET_CADET_ConnectionCreate *msg) | 459 | check_create (void *cls, const struct GNUNET_CADET_ConnectionCreateMessage *msg) |
454 | { | 460 | { |
455 | uint16_t size; | 461 | uint16_t size; |
456 | 462 | ||
@@ -470,7 +476,7 @@ check_create (void *cls, const struct GNUNET_CADET_ConnectionCreate *msg) | |||
470 | * @param msg Message itself. | 476 | * @param msg Message itself. |
471 | */ | 477 | */ |
472 | static void | 478 | static void |
473 | handle_create (void *cls, const struct GNUNET_CADET_ConnectionCreate *msg) | 479 | handle_create (void *cls, const struct GNUNET_CADET_ConnectionCreateMessage *msg) |
474 | { | 480 | { |
475 | struct CadetPeer *peer = cls; | 481 | struct CadetPeer *peer = cls; |
476 | GCC_handle_create (peer, msg); | 482 | GCC_handle_create (peer, msg); |
@@ -478,13 +484,13 @@ handle_create (void *cls, const struct GNUNET_CADET_ConnectionCreate *msg) | |||
478 | 484 | ||
479 | 485 | ||
480 | /** | 486 | /** |
481 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK | 487 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK |
482 | * | 488 | * |
483 | * @param cls Closure (CadetPeer for neighbor that sent the message). | 489 | * @param cls Closure (CadetPeer for neighbor that sent the message). |
484 | * @param msg Message itself. | 490 | * @param msg Message itself. |
485 | */ | 491 | */ |
486 | static void | 492 | static void |
487 | handle_confirm (void *cls, const struct GNUNET_CADET_ConnectionACK *msg) | 493 | handle_confirm (void *cls, const struct GNUNET_CADET_ConnectionCreateMessageAckMessage *msg) |
488 | { | 494 | { |
489 | struct CadetPeer *peer = cls; | 495 | struct CadetPeer *peer = cls; |
490 | GCC_handle_confirm (peer, msg); | 496 | GCC_handle_confirm (peer, msg); |
@@ -498,7 +504,7 @@ handle_confirm (void *cls, const struct GNUNET_CADET_ConnectionACK *msg) | |||
498 | * @param msg Message itself. | 504 | * @param msg Message itself. |
499 | */ | 505 | */ |
500 | static void | 506 | static void |
501 | handle_broken (void *cls, const struct GNUNET_CADET_ConnectionBroken *msg) | 507 | handle_broken (void *cls, const struct GNUNET_CADET_ConnectionBrokenMessage *msg) |
502 | { | 508 | { |
503 | struct CadetPeer *peer = cls; | 509 | struct CadetPeer *peer = cls; |
504 | GCC_handle_broken (peer, msg); | 510 | GCC_handle_broken (peer, msg); |
@@ -512,7 +518,7 @@ handle_broken (void *cls, const struct GNUNET_CADET_ConnectionBroken *msg) | |||
512 | * @param msg Message itself. | 518 | * @param msg Message itself. |
513 | */ | 519 | */ |
514 | static void | 520 | static void |
515 | handle_destroy (void *cls, const struct GNUNET_CADET_ConnectionDestroy *msg) | 521 | handle_destroy (void *cls, const struct GNUNET_CADET_ConnectionDestroyMessage *msg) |
516 | { | 522 | { |
517 | struct CadetPeer *peer = cls; | 523 | struct CadetPeer *peer = cls; |
518 | GCC_handle_destroy (peer, msg); | 524 | GCC_handle_destroy (peer, msg); |
@@ -520,13 +526,13 @@ handle_destroy (void *cls, const struct GNUNET_CADET_ConnectionDestroy *msg) | |||
520 | 526 | ||
521 | 527 | ||
522 | /** | 528 | /** |
523 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_ACK | 529 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK |
524 | * | 530 | * |
525 | * @param cls Closure (CadetPeer for neighbor that sent the message). | 531 | * @param cls Closure (CadetPeer for neighbor that sent the message). |
526 | * @param msg Message itself. | 532 | * @param msg Message itself. |
527 | */ | 533 | */ |
528 | static void | 534 | static void |
529 | handle_ack (void *cls, const struct GNUNET_CADET_ACK *msg) | 535 | handle_ack (void *cls, const struct GNUNET_CADET_ConnectionEncryptedAckMessage *msg) |
530 | { | 536 | { |
531 | struct CadetPeer *peer = cls; | 537 | struct CadetPeer *peer = cls; |
532 | GCC_handle_ack (peer, msg); | 538 | GCC_handle_ack (peer, msg); |
@@ -534,13 +540,13 @@ handle_ack (void *cls, const struct GNUNET_CADET_ACK *msg) | |||
534 | 540 | ||
535 | 541 | ||
536 | /** | 542 | /** |
537 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_POLL | 543 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL |
538 | * | 544 | * |
539 | * @param cls Closure (CadetPeer for neighbor that sent the message). | 545 | * @param cls Closure (CadetPeer for neighbor that sent the message). |
540 | * @param msg Message itself. | 546 | * @param msg Message itself. |
541 | */ | 547 | */ |
542 | static void | 548 | static void |
543 | handle_poll (void *cls, const struct GNUNET_CADET_Poll *msg) | 549 | handle_poll (void *cls, const struct GNUNET_CADET_ConnectionHopByHopPollMessage *msg) |
544 | { | 550 | { |
545 | struct CadetPeer *peer = cls; | 551 | struct CadetPeer *peer = cls; |
546 | GCC_handle_poll (peer, msg); | 552 | GCC_handle_poll (peer, msg); |
@@ -548,13 +554,13 @@ handle_poll (void *cls, const struct GNUNET_CADET_Poll *msg) | |||
548 | 554 | ||
549 | 555 | ||
550 | /** | 556 | /** |
551 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_KX | 557 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX |
552 | * | 558 | * |
553 | * @param cls Closure (CadetPeer for neighbor that sent the message). | 559 | * @param cls Closure (CadetPeer for neighbor that sent the message). |
554 | * @param msg Message itself. | 560 | * @param msg Message itself. |
555 | */ | 561 | */ |
556 | static void | 562 | static void |
557 | handle_kx (void *cls, const struct GNUNET_CADET_KX *msg) | 563 | handle_kx (void *cls, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) |
558 | { | 564 | { |
559 | struct CadetPeer *peer = cls; | 565 | struct CadetPeer *peer = cls; |
560 | GCC_handle_kx (peer, msg); | 566 | GCC_handle_kx (peer, msg); |
@@ -570,13 +576,13 @@ handle_kx (void *cls, const struct GNUNET_CADET_KX *msg) | |||
570 | * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. | 576 | * @return #GNUNET_YES if size is correct, #GNUNET_NO otherwise. |
571 | */ | 577 | */ |
572 | static int | 578 | static int |
573 | check_encrypted (void *cls, const struct GNUNET_CADET_Encrypted *msg) | 579 | check_encrypted (void *cls, const struct GNUNET_CADET_TunnelEncryptedMessage *msg) |
574 | { | 580 | { |
575 | uint16_t size; | 581 | uint16_t size; |
576 | uint16_t minimum_size; | 582 | uint16_t minimum_size; |
577 | 583 | ||
578 | size = ntohs (msg->header.size); | 584 | size = ntohs (msg->header.size); |
579 | minimum_size = sizeof (struct GNUNET_CADET_Encrypted) | 585 | minimum_size = sizeof (struct GNUNET_CADET_TunnelEncryptedMessage) |
580 | + sizeof (struct GNUNET_MessageHeader); | 586 | + sizeof (struct GNUNET_MessageHeader); |
581 | 587 | ||
582 | if (size < minimum_size) | 588 | if (size < minimum_size) |
@@ -588,13 +594,13 @@ check_encrypted (void *cls, const struct GNUNET_CADET_Encrypted *msg) | |||
588 | } | 594 | } |
589 | 595 | ||
590 | /** | 596 | /** |
591 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED. | 597 | * Handle for #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED. |
592 | * | 598 | * |
593 | * @param cls Closure (CadetPeer for neighbor that sent the message). | 599 | * @param cls Closure (CadetPeer for neighbor that sent the message). |
594 | * @param msg Message itself. | 600 | * @param msg Message itself. |
595 | */ | 601 | */ |
596 | static void | 602 | static void |
597 | handle_encrypted (void *cls, const struct GNUNET_CADET_Encrypted *msg) | 603 | handle_encrypted (void *cls, const struct GNUNET_CADET_TunnelEncryptedMessage *msg) |
598 | { | 604 | { |
599 | struct CadetPeer *peer = cls; | 605 | struct CadetPeer *peer = cls; |
600 | GCC_handle_encrypted (peer, msg); | 606 | GCC_handle_encrypted (peer, msg); |
@@ -618,39 +624,39 @@ connect_to_core (const struct GNUNET_CONFIGURATION_Handle *c) | |||
618 | struct GNUNET_MQ_MessageHandler core_handlers[] = { | 624 | struct GNUNET_MQ_MessageHandler core_handlers[] = { |
619 | GNUNET_MQ_hd_var_size (create, | 625 | GNUNET_MQ_hd_var_size (create, |
620 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, | 626 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, |
621 | struct GNUNET_CADET_ConnectionCreate, | 627 | struct GNUNET_CADET_ConnectionCreateMessage, |
622 | NULL), | 628 | NULL), |
623 | GNUNET_MQ_hd_fixed_size (confirm, | 629 | GNUNET_MQ_hd_fixed_size (confirm, |
624 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, | 630 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, |
625 | struct GNUNET_CADET_ConnectionACK, | 631 | struct GNUNET_CADET_ConnectionCreateMessageAckMessage, |
626 | NULL), | 632 | NULL), |
627 | GNUNET_MQ_hd_fixed_size (broken, | 633 | GNUNET_MQ_hd_fixed_size (broken, |
628 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, | 634 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, |
629 | struct GNUNET_CADET_ConnectionBroken, | 635 | struct GNUNET_CADET_ConnectionBrokenMessage, |
630 | NULL), | 636 | NULL), |
631 | GNUNET_MQ_hd_fixed_size (destroy, | 637 | GNUNET_MQ_hd_fixed_size (destroy, |
632 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, | 638 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, |
633 | struct GNUNET_CADET_ConnectionDestroy, | 639 | struct GNUNET_CADET_ConnectionDestroyMessage, |
634 | NULL), | 640 | NULL), |
635 | GNUNET_MQ_hd_fixed_size (ack, | 641 | GNUNET_MQ_hd_fixed_size (ack, |
636 | GNUNET_MESSAGE_TYPE_CADET_ACK, | 642 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK, |
637 | struct GNUNET_CADET_ACK, | 643 | struct GNUNET_CADET_ConnectionEncryptedAckMessage, |
638 | NULL), | 644 | NULL), |
639 | GNUNET_MQ_hd_fixed_size (poll, | 645 | GNUNET_MQ_hd_fixed_size (poll, |
640 | GNUNET_MESSAGE_TYPE_CADET_POLL, | 646 | GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL, |
641 | struct GNUNET_CADET_Poll, | 647 | struct GNUNET_CADET_ConnectionHopByHopPollMessage, |
642 | NULL), | 648 | NULL), |
643 | GNUNET_MQ_hd_fixed_size (kx, | 649 | GNUNET_MQ_hd_fixed_size (kx, |
644 | GNUNET_MESSAGE_TYPE_CADET_KX, | 650 | GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX, |
645 | struct GNUNET_CADET_KX, | 651 | struct GNUNET_CADET_TunnelKeyExchangeMessage, |
646 | NULL), | 652 | NULL), |
647 | GNUNET_MQ_hd_var_size (encrypted, | 653 | GNUNET_MQ_hd_var_size (encrypted, |
648 | GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, | 654 | GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED, |
649 | struct GNUNET_CADET_Encrypted, | 655 | struct GNUNET_CADET_TunnelEncryptedMessage, |
650 | NULL), | 656 | NULL), |
651 | GNUNET_MQ_handler_end () | 657 | GNUNET_MQ_handler_end () |
652 | }; | 658 | }; |
653 | core_handle = GNUNET_CORE_connecT (c, NULL, | 659 | core_handle = GNUNET_CORE_connect (c, NULL, |
654 | &core_init_notify, | 660 | &core_init_notify, |
655 | &core_connect_handler, | 661 | &core_connect_handler, |
656 | &core_disconnect_handler, | 662 | &core_disconnect_handler, |
@@ -681,7 +687,7 @@ core_init_notify (void *cls, | |||
681 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n")); | 687 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n")); |
682 | LOG (GNUNET_ERROR_TYPE_ERROR, " core id %s\n", GNUNET_i2s (core_identity)); | 688 | LOG (GNUNET_ERROR_TYPE_ERROR, " core id %s\n", GNUNET_i2s (core_identity)); |
683 | LOG (GNUNET_ERROR_TYPE_ERROR, " my id %s\n", GNUNET_i2s (&my_full_id)); | 689 | LOG (GNUNET_ERROR_TYPE_ERROR, " my id %s\n", GNUNET_i2s (&my_full_id)); |
684 | GNUNET_CORE_disconnecT (core_handle); | 690 | GNUNET_CORE_disconnect (core_handle); |
685 | connect_to_core (c); | 691 | connect_to_core (c); |
686 | return; | 692 | return; |
687 | } | 693 | } |
@@ -729,7 +735,7 @@ get_priority (struct CadetPeerQueue *q) | |||
729 | } | 735 | } |
730 | 736 | ||
731 | /* Bulky payload has lower priority, control traffic has higher. */ | 737 | /* Bulky payload has lower priority, control traffic has higher. */ |
732 | if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == q->type) | 738 | if (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED == q->type) |
733 | return low; | 739 | return low; |
734 | return high; | 740 | return high; |
735 | } | 741 | } |
@@ -795,8 +801,8 @@ peer_destroy (struct CadetPeer *peer) | |||
795 | GCT_destroy_empty (peer->tunnel); | 801 | GCT_destroy_empty (peer->tunnel); |
796 | if (NULL != peer->connections) | 802 | if (NULL != peer->connections) |
797 | { | 803 | { |
798 | GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (peer->connections)); | 804 | GNUNET_assert (0 == GNUNET_CONTAINER_multishortmap_size (peer->connections)); |
799 | GNUNET_CONTAINER_multihashmap_destroy (peer->connections); | 805 | GNUNET_CONTAINER_multishortmap_destroy (peer->connections); |
800 | peer->connections = NULL; | 806 | peer->connections = NULL; |
801 | } | 807 | } |
802 | if (NULL != peer->hello_offer) | 808 | if (NULL != peer->hello_offer) |
@@ -1053,8 +1059,8 @@ search_handler (void *cls, const struct CadetPeerPath *path) | |||
1053 | static int | 1059 | static int |
1054 | is_connection_management (uint16_t type) | 1060 | is_connection_management (uint16_t type) |
1055 | { | 1061 | { |
1056 | return type == GNUNET_MESSAGE_TYPE_CADET_ACK || | 1062 | return type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK || |
1057 | type == GNUNET_MESSAGE_TYPE_CADET_POLL; | 1063 | type == GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL; |
1058 | } | 1064 | } |
1059 | 1065 | ||
1060 | 1066 | ||
@@ -1104,8 +1110,11 @@ call_peer_cont (struct CadetPeerQueue *q, int sent) | |||
1104 | GNUNET_STRINGS_relative_time_to_string (wait_time, GNUNET_NO)); | 1110 | GNUNET_STRINGS_relative_time_to_string (wait_time, GNUNET_NO)); |
1105 | q->cont (q->cont_cls, | 1111 | q->cont (q->cont_cls, |
1106 | q->c, q->c_fwd, sent, | 1112 | q->c, q->c_fwd, sent, |
1107 | q->type, q->payload_type, q->payload_id, | 1113 | q->type, |
1114 | q->payload_type, | ||
1115 | q->payload_id, | ||
1108 | q->size, wait_time); | 1116 | q->size, wait_time); |
1117 | q->cont = NULL; | ||
1109 | } | 1118 | } |
1110 | GNUNET_CONTAINER_DLL_remove (q->peer->q_head, q->peer->q_tail, q); | 1119 | GNUNET_CONTAINER_DLL_remove (q->peer->q_head, q->peer->q_tail, q); |
1111 | } | 1120 | } |
@@ -1131,6 +1140,22 @@ mq_sent (void *cls) | |||
1131 | 1140 | ||
1132 | 1141 | ||
1133 | /** | 1142 | /** |
1143 | * Finish the drop operation. | ||
1144 | * | ||
1145 | * @param cls queue entry to finish drop for | ||
1146 | */ | ||
1147 | static void | ||
1148 | drop_cb (void *cls) | ||
1149 | { | ||
1150 | struct CadetPeerQueue *q = cls; | ||
1151 | |||
1152 | GNUNET_MQ_discard (q->env); | ||
1153 | call_peer_cont (q, GNUNET_YES); | ||
1154 | GNUNET_free (q); | ||
1155 | } | ||
1156 | |||
1157 | |||
1158 | /** | ||
1134 | * @brief Send a message to another peer (using CORE). | 1159 | * @brief Send a message to another peer (using CORE). |
1135 | * | 1160 | * |
1136 | * @param peer Peer towards which to queue the message. | 1161 | * @param peer Peer towards which to queue the message. |
@@ -1150,7 +1175,7 @@ struct CadetPeerQueue * | |||
1150 | GCP_send (struct CadetPeer *peer, | 1175 | GCP_send (struct CadetPeer *peer, |
1151 | const struct GNUNET_MessageHeader *message, | 1176 | const struct GNUNET_MessageHeader *message, |
1152 | uint16_t payload_type, | 1177 | uint16_t payload_type, |
1153 | uint32_t payload_id, | 1178 | struct CadetEncryptedMessageIdentifier payload_id, |
1154 | struct CadetConnection *c, | 1179 | struct CadetConnection *c, |
1155 | int fwd, | 1180 | int fwd, |
1156 | GCP_sent cont, | 1181 | GCP_sent cont, |
@@ -1165,7 +1190,8 @@ GCP_send (struct CadetPeer *peer, | |||
1165 | size = ntohs (message->size); | 1190 | size = ntohs (message->size); |
1166 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1191 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1167 | "que %s (%s %4u) on conn %s (%p) %s towards %s (size %u)\n", | 1192 | "que %s (%s %4u) on conn %s (%p) %s towards %s (size %u)\n", |
1168 | GC_m2s (type), GC_m2s (payload_type), payload_id, | 1193 | GC_m2s (type), GC_m2s (payload_type), |
1194 | ntohl (payload_id.pid), | ||
1169 | GCC_2s (c), c, GC_f2s (fwd), GCP_2s (peer), size); | 1195 | GCC_2s (c), c, GC_f2s (fwd), GCP_2s (peer), size); |
1170 | 1196 | ||
1171 | if (NULL == peer->connections) | 1197 | if (NULL == peer->connections) |
@@ -1191,7 +1217,8 @@ GCP_send (struct CadetPeer *peer, | |||
1191 | q->payload_id = payload_id; | 1217 | q->payload_id = payload_id; |
1192 | q->c = c; | 1218 | q->c = c; |
1193 | q->c_fwd = fwd; | 1219 | q->c_fwd = fwd; |
1194 | GNUNET_MQ_notify_sent (q->env, mq_sent, q); | 1220 | GNUNET_MQ_notify_sent (q->env, &mq_sent, q); |
1221 | GNUNET_CONTAINER_DLL_insert (peer->q_head, peer->q_tail, q); | ||
1195 | 1222 | ||
1196 | if (GNUNET_YES == q->management_traffic) | 1223 | if (GNUNET_YES == q->management_traffic) |
1197 | { | 1224 | { |
@@ -1201,19 +1228,21 @@ GCP_send (struct CadetPeer *peer, | |||
1201 | { | 1228 | { |
1202 | if (GNUNET_YES == should_I_drop ()) | 1229 | if (GNUNET_YES == should_I_drop ()) |
1203 | { | 1230 | { |
1204 | LOG (GNUNET_ERROR_TYPE_WARNING, "DD %s (%s %u) on conn %s %s\n", | 1231 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1205 | GC_m2s (q->type), GC_m2s (q->payload_type), | 1232 | "DD %s (%s %u) on conn %s %s (random drop for testing)\n", |
1206 | q->payload_id, GCC_2s (c), GC_f2s (q->c_fwd)); | 1233 | GC_m2s (q->type), |
1207 | GNUNET_MQ_discard (q->env); | 1234 | GC_m2s (q->payload_type), |
1208 | call_peer_cont (q, GNUNET_YES); | 1235 | ntohl (q->payload_id.pid), |
1209 | GNUNET_free (q); | 1236 | GCC_2s (c), |
1210 | return NULL; | 1237 | GC_f2s (q->c_fwd)); |
1238 | q->drop_task = GNUNET_SCHEDULER_add_now (&drop_cb, | ||
1239 | q); | ||
1240 | return q; | ||
1211 | } | 1241 | } |
1212 | GNUNET_MQ_send (peer->core_mq, q->env); | 1242 | GNUNET_MQ_send (peer->core_mq, q->env); |
1213 | peer->queue_n++; | 1243 | peer->queue_n++; |
1214 | } | 1244 | } |
1215 | 1245 | ||
1216 | GNUNET_CONTAINER_DLL_insert (peer->q_head, peer->q_tail, q); | ||
1217 | GCC_check_connections (); | 1246 | GCC_check_connections (); |
1218 | return q; | 1247 | return q; |
1219 | } | 1248 | } |
@@ -1231,9 +1260,18 @@ GCP_send (struct CadetPeer *peer, | |||
1231 | void | 1260 | void |
1232 | GCP_send_cancel (struct CadetPeerQueue *q) | 1261 | GCP_send_cancel (struct CadetPeerQueue *q) |
1233 | { | 1262 | { |
1234 | call_peer_cont (q, GNUNET_NO); | 1263 | if (NULL != q->drop_task) |
1264 | { | ||
1265 | GNUNET_SCHEDULER_cancel (q->drop_task); | ||
1266 | q->drop_task = NULL; | ||
1267 | GNUNET_MQ_discard (q->env); | ||
1268 | } | ||
1269 | else | ||
1270 | { | ||
1235 | GNUNET_MQ_send_cancel (q->env); | 1271 | GNUNET_MQ_send_cancel (q->env); |
1236 | GNUNET_free (q); | 1272 | } |
1273 | call_peer_cont (q, GNUNET_NO); | ||
1274 | GNUNET_free (q); | ||
1237 | } | 1275 | } |
1238 | 1276 | ||
1239 | 1277 | ||
@@ -1294,12 +1332,12 @@ GCP_shutdown (void) | |||
1294 | in_shutdown = GNUNET_YES; | 1332 | in_shutdown = GNUNET_YES; |
1295 | if (NULL != core_handle) | 1333 | if (NULL != core_handle) |
1296 | { | 1334 | { |
1297 | GNUNET_CORE_disconnecT (core_handle); | 1335 | GNUNET_CORE_disconnect (core_handle); |
1298 | core_handle = NULL; | 1336 | core_handle = NULL; |
1299 | } | 1337 | } |
1300 | GNUNET_PEER_change_rc (myid, -1); | 1338 | GNUNET_PEER_change_rc (myid, -1); |
1301 | /* With MQ API, CORE calls the disconnect handler for every peer | 1339 | /* With MQ API, CORE calls the disconnect handler for every peer |
1302 | * after calling GNUNET_CORE_disconnecT, shutdown must occur *after* that. | 1340 | * after calling GNUNET_CORE_disconnect, shutdown must occur *after* that. |
1303 | */ | 1341 | */ |
1304 | GNUNET_CONTAINER_multipeermap_iterate (peers, | 1342 | GNUNET_CONTAINER_multipeermap_iterate (peers, |
1305 | &shutdown_peer, | 1343 | &shutdown_peer, |
@@ -1543,14 +1581,14 @@ GCP_add_connection (struct CadetPeer *peer, | |||
1543 | GCP_2s (peer)); | 1581 | GCP_2s (peer)); |
1544 | GNUNET_assert (NULL != peer->connections); | 1582 | GNUNET_assert (NULL != peer->connections); |
1545 | GNUNET_assert (GNUNET_OK == | 1583 | GNUNET_assert (GNUNET_OK == |
1546 | GNUNET_CONTAINER_multihashmap_put (peer->connections, | 1584 | GNUNET_CONTAINER_multishortmap_put (peer->connections, |
1547 | GCC_get_h (c), | 1585 | &GCC_get_id (c)->connection_of_tunnel, |
1548 | c, | 1586 | c, |
1549 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1587 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
1550 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1588 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1551 | "Peer %s has now %u connections.\n", | 1589 | "Peer %s has now %u connections.\n", |
1552 | GCP_2s (peer), | 1590 | GCP_2s (peer), |
1553 | GNUNET_CONTAINER_multihashmap_size (peer->connections)); | 1591 | GNUNET_CONTAINER_multishortmap_size (peer->connections)); |
1554 | } | 1592 | } |
1555 | 1593 | ||
1556 | 1594 | ||
@@ -1761,13 +1799,13 @@ void | |||
1761 | GCP_check_connection (const struct CadetPeer *peer, | 1799 | GCP_check_connection (const struct CadetPeer *peer, |
1762 | const struct CadetConnection *c) | 1800 | const struct CadetConnection *c) |
1763 | { | 1801 | { |
1764 | GNUNET_assert (NULL != peer); | 1802 | GNUNET_assert (NULL != peer); |
1765 | GNUNET_assert (NULL != peer->connections); | 1803 | GNUNET_assert (NULL != peer->connections); |
1766 | return; | 1804 | return; // ???? |
1767 | GNUNET_assert (GNUNET_YES == | 1805 | GNUNET_assert (GNUNET_YES == |
1768 | GNUNET_CONTAINER_multihashmap_contains_value (peer->connections, | 1806 | GNUNET_CONTAINER_multishortmap_contains_value (peer->connections, |
1769 | GCC_get_h (c), | 1807 | &GCC_get_id (c)->connection_of_tunnel, |
1770 | c)); | 1808 | c)); |
1771 | } | 1809 | } |
1772 | 1810 | ||
1773 | 1811 | ||
@@ -1791,13 +1829,13 @@ GCP_remove_connection (struct CadetPeer *peer, | |||
1791 | (NULL == peer->connections) ) | 1829 | (NULL == peer->connections) ) |
1792 | return; | 1830 | return; |
1793 | GNUNET_assert (GNUNET_YES == | 1831 | GNUNET_assert (GNUNET_YES == |
1794 | GNUNET_CONTAINER_multihashmap_remove (peer->connections, | 1832 | GNUNET_CONTAINER_multishortmap_remove (peer->connections, |
1795 | GCC_get_h (c), | 1833 | &GCC_get_id (c)->connection_of_tunnel, |
1796 | c)); | 1834 | c)); |
1797 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1835 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1798 | "Peer %s remains with %u connections.\n", | 1836 | "Peer %s remains with %u connections.\n", |
1799 | GCP_2s (peer), | 1837 | GCP_2s (peer), |
1800 | GNUNET_CONTAINER_multihashmap_size (peer->connections)); | 1838 | GNUNET_CONTAINER_multishortmap_size (peer->connections)); |
1801 | } | 1839 | } |
1802 | 1840 | ||
1803 | 1841 | ||
diff --git a/src/cadet/gnunet-service-cadet_peer.h b/src/cadet/gnunet-service-cadet_peer.h index 093cfa21a..1e206e10f 100644 --- a/src/cadet/gnunet-service-cadet_peer.h +++ b/src/cadet/gnunet-service-cadet_peer.h | |||
@@ -69,8 +69,12 @@ struct CadetPeerQueue; | |||
69 | */ | 69 | */ |
70 | typedef void | 70 | typedef void |
71 | (*GCP_sent) (void *cls, | 71 | (*GCP_sent) (void *cls, |
72 | struct CadetConnection *c, int fwd, int sent, | 72 | struct CadetConnection *c, |
73 | uint16_t type, uint16_t payload_type, uint32_t pid, | 73 | int fwd, |
74 | int sent, | ||
75 | uint16_t type, | ||
76 | uint16_t payload_type, | ||
77 | struct CadetEncryptedMessageIdentifier pid, | ||
74 | size_t size, | 78 | size_t size, |
75 | struct GNUNET_TIME_Relative wait); | 79 | struct GNUNET_TIME_Relative wait); |
76 | 80 | ||
@@ -122,6 +126,7 @@ GCP_shutdown (void); | |||
122 | struct CadetPeer * | 126 | struct CadetPeer * |
123 | GCP_get (const struct GNUNET_PeerIdentity *peer_id, int create); | 127 | GCP_get (const struct GNUNET_PeerIdentity *peer_id, int create); |
124 | 128 | ||
129 | |||
125 | /** | 130 | /** |
126 | * Retrieve the CadetPeer stucture associated with the peer. Optionally create | 131 | * Retrieve the CadetPeer stucture associated with the peer. Optionally create |
127 | * one and insert it in the appropriate structures if the peer is not known yet. | 132 | * one and insert it in the appropriate structures if the peer is not known yet. |
@@ -136,6 +141,7 @@ GCP_get (const struct GNUNET_PeerIdentity *peer_id, int create); | |||
136 | struct CadetPeer * | 141 | struct CadetPeer * |
137 | GCP_get_short (const GNUNET_PEER_Id peer, int create); | 142 | GCP_get_short (const GNUNET_PEER_Id peer, int create); |
138 | 143 | ||
144 | |||
139 | /** | 145 | /** |
140 | * Try to establish a new connection to this peer (in its tunnel). | 146 | * Try to establish a new connection to this peer (in its tunnel). |
141 | * If the peer doesn't have any path to it yet, try to get one. | 147 | * If the peer doesn't have any path to it yet, try to get one. |
@@ -164,7 +170,7 @@ struct CadetPeerQueue * | |||
164 | GCP_send (struct CadetPeer *peer, | 170 | GCP_send (struct CadetPeer *peer, |
165 | const struct GNUNET_MessageHeader *message, | 171 | const struct GNUNET_MessageHeader *message, |
166 | uint16_t payload_type, | 172 | uint16_t payload_type, |
167 | uint32_t payload_id, | 173 | struct CadetEncryptedMessageIdentifier payload_id, |
168 | struct CadetConnection *c, | 174 | struct CadetConnection *c, |
169 | int fwd, | 175 | int fwd, |
170 | GCP_sent cont, | 176 | GCP_sent cont, |
@@ -440,7 +446,8 @@ GCP_iterate_paths (struct CadetPeer *peer, | |||
440 | * @param cls Closure for @c iter. | 446 | * @param cls Closure for @c iter. |
441 | */ | 447 | */ |
442 | void | 448 | void |
443 | GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls); | 449 | GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, |
450 | void *cls); | ||
444 | 451 | ||
445 | 452 | ||
446 | /** | 453 | /** |
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index 5b07e42c0..65775ce66 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c | |||
@@ -63,7 +63,7 @@ struct CadetTChannel | |||
63 | 63 | ||
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Connection list and metadata. | 66 | * Entry in list of connections used by tunnel, with metadata. |
67 | */ | 67 | */ |
68 | struct CadetTConnection | 68 | struct CadetTConnection |
69 | { | 69 | { |
@@ -243,6 +243,7 @@ struct CadetTunnelAxolotl | |||
243 | struct GNUNET_TIME_Absolute ratchet_expiration; | 243 | struct GNUNET_TIME_Absolute ratchet_expiration; |
244 | }; | 244 | }; |
245 | 245 | ||
246 | |||
246 | /** | 247 | /** |
247 | * Struct containing all information regarding a tunnel to a peer. | 248 | * Struct containing all information regarding a tunnel to a peer. |
248 | */ | 249 | */ |
@@ -309,7 +310,7 @@ struct CadetTunnel | |||
309 | /** | 310 | /** |
310 | * Channel ID for the next created channel. | 311 | * Channel ID for the next created channel. |
311 | */ | 312 | */ |
312 | CADET_ChannelNumber next_chid; | 313 | struct GNUNET_CADET_ChannelTunnelNumber next_chid; |
313 | 314 | ||
314 | /** | 315 | /** |
315 | * Destroy flag: if true, destroy on last message. | 316 | * Destroy flag: if true, destroy on last message. |
@@ -648,7 +649,7 @@ new_ephemeral (struct CadetTunnel *t) | |||
648 | static void | 649 | static void |
649 | t_hmac (const void *plaintext, size_t size, | 650 | t_hmac (const void *plaintext, size_t size, |
650 | uint32_t iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *key, | 651 | uint32_t iv, const struct GNUNET_CRYPTO_SymmetricSessionKey *key, |
651 | struct GNUNET_CADET_Hash *hmac) | 652 | struct GNUNET_ShortHashCode *hmac) |
652 | { | 653 | { |
653 | static const char ctx[] = "cadet authentication key"; | 654 | static const char ctx[] = "cadet authentication key"; |
654 | struct GNUNET_CRYPTO_AuthKey auth_key; | 655 | struct GNUNET_CRYPTO_AuthKey auth_key; |
@@ -842,7 +843,7 @@ t_ax_decrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size) | |||
842 | * @param msg Message whose header to encrypt. | 843 | * @param msg Message whose header to encrypt. |
843 | */ | 844 | */ |
844 | static void | 845 | static void |
845 | t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_Encrypted *msg) | 846 | t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_TunnelEncryptedMessage *msg) |
846 | { | 847 | { |
847 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | 848 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
848 | struct CadetTunnelAxolotl *ax; | 849 | struct CadetTunnelAxolotl *ax; |
@@ -873,8 +874,8 @@ t_h_encrypt (struct CadetTunnel *t, struct GNUNET_CADET_Encrypted *msg) | |||
873 | * @param dst Where to decrypt header to. | 874 | * @param dst Where to decrypt header to. |
874 | */ | 875 | */ |
875 | static void | 876 | static void |
876 | t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_Encrypted *src, | 877 | t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_TunnelEncryptedMessage *src, |
877 | struct GNUNET_CADET_Encrypted *dst) | 878 | struct GNUNET_CADET_TunnelEncryptedMessage *dst) |
878 | { | 879 | { |
879 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | 880 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
880 | struct CadetTunnelAxolotl *ax; | 881 | struct CadetTunnelAxolotl *ax; |
@@ -912,12 +913,12 @@ t_h_decrypt (struct CadetTunnel *t, const struct GNUNET_CADET_Encrypted *src, | |||
912 | */ | 913 | */ |
913 | static int | 914 | static int |
914 | try_old_ax_keys (struct CadetTunnel *t, void *dst, | 915 | try_old_ax_keys (struct CadetTunnel *t, void *dst, |
915 | const struct GNUNET_CADET_Encrypted *src, size_t size) | 916 | const struct GNUNET_CADET_TunnelEncryptedMessage *src, size_t size) |
916 | { | 917 | { |
917 | struct CadetTunnelSkippedKey *key; | 918 | struct CadetTunnelSkippedKey *key; |
918 | struct GNUNET_CADET_Hash *hmac; | 919 | struct GNUNET_ShortHashCode *hmac; |
919 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | 920 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
920 | struct GNUNET_CADET_Encrypted plaintext_header; | 921 | struct GNUNET_CADET_TunnelEncryptedMessage plaintext_header; |
921 | struct GNUNET_CRYPTO_SymmetricSessionKey *valid_HK; | 922 | struct GNUNET_CRYPTO_SymmetricSessionKey *valid_HK; |
922 | size_t esize; | 923 | size_t esize; |
923 | size_t res; | 924 | size_t res; |
@@ -926,7 +927,7 @@ try_old_ax_keys (struct CadetTunnel *t, void *dst, | |||
926 | 927 | ||
927 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying old keys\n"); | 928 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying old keys\n"); |
928 | hmac = &plaintext_header.hmac; | 929 | hmac = &plaintext_header.hmac; |
929 | esize = size - sizeof (struct GNUNET_CADET_Encrypted); | 930 | esize = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); |
930 | 931 | ||
931 | /* Find a correct Header Key */ | 932 | /* Find a correct Header Key */ |
932 | for (key = t->ax->skipped_head; NULL != key; key = key->next) | 933 | for (key = t->ax->skipped_head; NULL != key; key = key->next) |
@@ -947,8 +948,8 @@ try_old_ax_keys (struct CadetTunnel *t, void *dst, | |||
947 | return -1; | 948 | return -1; |
948 | 949 | ||
949 | /* Should've been checked in -cadet_connection.c handle_cadet_encrypted. */ | 950 | /* Should've been checked in -cadet_connection.c handle_cadet_encrypted. */ |
950 | GNUNET_assert (size > sizeof (struct GNUNET_CADET_Encrypted)); | 951 | GNUNET_assert (size > sizeof (struct GNUNET_CADET_TunnelEncryptedMessage)); |
951 | len = size - sizeof (struct GNUNET_CADET_Encrypted); | 952 | len = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); |
952 | GNUNET_assert (len >= sizeof (struct GNUNET_MessageHeader)); | 953 | GNUNET_assert (len >= sizeof (struct GNUNET_MessageHeader)); |
953 | 954 | ||
954 | /* Decrypt header */ | 955 | /* Decrypt header */ |
@@ -1091,19 +1092,19 @@ store_ax_keys (struct CadetTunnel *t, | |||
1091 | */ | 1092 | */ |
1092 | static int | 1093 | static int |
1093 | t_ax_decrypt_and_validate (struct CadetTunnel *t, void *dst, | 1094 | t_ax_decrypt_and_validate (struct CadetTunnel *t, void *dst, |
1094 | const struct GNUNET_CADET_Encrypted *src, | 1095 | const struct GNUNET_CADET_TunnelEncryptedMessage *src, |
1095 | size_t size) | 1096 | size_t size) |
1096 | { | 1097 | { |
1097 | struct CadetTunnelAxolotl *ax; | 1098 | struct CadetTunnelAxolotl *ax; |
1098 | struct GNUNET_CADET_Hash msg_hmac; | 1099 | struct GNUNET_ShortHashCode msg_hmac; |
1099 | struct GNUNET_HashCode hmac; | 1100 | struct GNUNET_HashCode hmac; |
1100 | struct GNUNET_CADET_Encrypted plaintext_header; | 1101 | struct GNUNET_CADET_TunnelEncryptedMessage plaintext_header; |
1101 | uint32_t Np; | 1102 | uint32_t Np; |
1102 | uint32_t PNp; | 1103 | uint32_t PNp; |
1103 | size_t esize; /* Size of encryped payload */ | 1104 | size_t esize; /* Size of encryped payload */ |
1104 | size_t osize; /* Size of output (decrypted payload) */ | 1105 | size_t osize; /* Size of output (decrypted payload) */ |
1105 | 1106 | ||
1106 | esize = size - sizeof (struct GNUNET_CADET_Encrypted); | 1107 | esize = size - sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); |
1107 | ax = t->ax; | 1108 | ax = t->ax; |
1108 | if (NULL == ax) | 1109 | if (NULL == ax) |
1109 | return -1; | 1110 | return -1; |
@@ -1321,12 +1322,11 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1321 | struct CadetTunnelQueue *existing_q) | 1322 | struct CadetTunnelQueue *existing_q) |
1322 | { | 1323 | { |
1323 | struct GNUNET_MessageHeader *msg; | 1324 | struct GNUNET_MessageHeader *msg; |
1324 | struct GNUNET_CADET_Encrypted *ax_msg; | 1325 | struct GNUNET_CADET_TunnelEncryptedMessage *ax_msg; |
1325 | struct CadetTunnelQueue *tq; | 1326 | struct CadetTunnelQueue *tq; |
1326 | size_t size = ntohs (message->size); | 1327 | size_t size = ntohs (message->size); |
1327 | char cbuf[sizeof (struct GNUNET_CADET_Encrypted) + size] GNUNET_ALIGN; | 1328 | char cbuf[sizeof (struct GNUNET_CADET_TunnelEncryptedMessage) + size] GNUNET_ALIGN; |
1328 | size_t esize; | 1329 | size_t esize; |
1329 | uint32_t mid; | ||
1330 | uint16_t type; | 1330 | uint16_t type; |
1331 | int fwd; | 1331 | int fwd; |
1332 | 1332 | ||
@@ -1352,10 +1352,10 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1352 | 1352 | ||
1353 | GNUNET_assert (GNUNET_NO == GCT_is_loopback (t)); | 1353 | GNUNET_assert (GNUNET_NO == GCT_is_loopback (t)); |
1354 | 1354 | ||
1355 | ax_msg = (struct GNUNET_CADET_Encrypted *) cbuf; | 1355 | ax_msg = (struct GNUNET_CADET_TunnelEncryptedMessage *) cbuf; |
1356 | msg = &ax_msg->header; | 1356 | msg = &ax_msg->header; |
1357 | msg->size = htons (sizeof (struct GNUNET_CADET_Encrypted) + size); | 1357 | msg->size = htons (sizeof (struct GNUNET_CADET_TunnelEncryptedMessage) + size); |
1358 | msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED); | 1358 | msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED); |
1359 | esize = t_ax_encrypt (t, &ax_msg[1], message, size); | 1359 | esize = t_ax_encrypt (t, &ax_msg[1], message, size); |
1360 | ax_msg->Ns = htonl (t->ax->Ns++); | 1360 | ax_msg->Ns = htonl (t->ax->Ns++); |
1361 | ax_msg->PNs = htonl (t->ax->PNs); | 1361 | ax_msg->PNs = htonl (t->ax->PNs); |
@@ -1378,34 +1378,22 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1378 | } | 1378 | } |
1379 | fwd = GCC_is_origin (c, GNUNET_YES); | 1379 | fwd = GCC_is_origin (c, GNUNET_YES); |
1380 | ax_msg->cid = *GCC_get_id (c); | 1380 | ax_msg->cid = *GCC_get_id (c); |
1381 | ax_msg->pid = htonl (GCC_get_pid (c, fwd)); | 1381 | ax_msg->cemi = GCC_get_pid (c, fwd); |
1382 | 1382 | ||
1383 | mid = 0; | 1383 | type = htons (message->type); |
1384 | type = ntohs (message->type); | 1384 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1385 | switch (type) | 1385 | "Sending message of type %s with CEMI %u and CID %s\n", |
1386 | { | 1386 | GC_m2s (type), |
1387 | case GNUNET_MESSAGE_TYPE_CADET_DATA: | 1387 | htonl (ax_msg->cemi.pid), |
1388 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: | 1388 | GNUNET_sh2s (&ax_msg->cid.connection_of_tunnel)); |
1389 | if (GNUNET_MESSAGE_TYPE_CADET_DATA == type) | ||
1390 | mid = ntohl (((struct GNUNET_CADET_Data *) message)->mid); | ||
1391 | else | ||
1392 | mid = ntohl (((struct GNUNET_CADET_DataACK *) message)->mid); | ||
1393 | /* Fall thru */ | ||
1394 | case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE: | ||
1395 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: | ||
1396 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: | ||
1397 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: | ||
1398 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: | ||
1399 | break; | ||
1400 | default: | ||
1401 | GNUNET_break (0); | ||
1402 | LOG (GNUNET_ERROR_TYPE_ERROR, "type %s not valid\n", GC_m2s (type)); | ||
1403 | } | ||
1404 | LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s\n", GC_m2s (type)); | ||
1405 | 1389 | ||
1406 | if (NULL == cont) | 1390 | if (NULL == cont) |
1407 | { | 1391 | { |
1408 | (void) GCC_send_prebuilt_message (msg, type, mid, c, fwd, | 1392 | (void) GCC_send_prebuilt_message (msg, |
1393 | type, | ||
1394 | ax_msg->cemi, | ||
1395 | c, | ||
1396 | fwd, | ||
1409 | force, NULL, NULL); | 1397 | force, NULL, NULL); |
1410 | return NULL; | 1398 | return NULL; |
1411 | } | 1399 | } |
@@ -1418,11 +1406,16 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1418 | tq = existing_q; | 1406 | tq = existing_q; |
1419 | tq->tqd = NULL; | 1407 | tq->tqd = NULL; |
1420 | } | 1408 | } |
1421 | tq->cq = GCC_send_prebuilt_message (msg, type, mid, c, fwd, force, | ||
1422 | &tun_message_sent, tq); | ||
1423 | GNUNET_assert (NULL != tq->cq); | ||
1424 | tq->cont = cont; | 1409 | tq->cont = cont; |
1425 | tq->cont_cls = cont_cls; | 1410 | tq->cont_cls = cont_cls; |
1411 | tq->cq = GCC_send_prebuilt_message (msg, | ||
1412 | type, | ||
1413 | ax_msg->cemi, | ||
1414 | c, | ||
1415 | fwd, | ||
1416 | force, | ||
1417 | &tun_message_sent, tq); | ||
1418 | GNUNET_assert (NULL != tq->cq); | ||
1426 | 1419 | ||
1427 | return tq; | 1420 | return tq; |
1428 | } | 1421 | } |
@@ -1562,17 +1555,19 @@ destroy_iterator (void *cls, | |||
1562 | * @param gid ID of the channel. | 1555 | * @param gid ID of the channel. |
1563 | */ | 1556 | */ |
1564 | static void | 1557 | static void |
1565 | send_channel_destroy (struct CadetTunnel *t, unsigned int gid) | 1558 | send_channel_destroy (struct CadetTunnel *t, |
1559 | struct GNUNET_CADET_ChannelTunnelNumber gid) | ||
1566 | { | 1560 | { |
1567 | struct GNUNET_CADET_ChannelManage msg; | 1561 | struct GNUNET_CADET_ChannelManageMessage msg; |
1568 | 1562 | ||
1569 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); | 1563 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); |
1570 | msg.header.size = htons (sizeof (msg)); | 1564 | msg.header.size = htons (sizeof (msg)); |
1571 | msg.chid = htonl (gid); | 1565 | msg.chid = gid; |
1572 | 1566 | ||
1573 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1567 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1574 | "WARNING destroying unknown channel %u on tunnel %s\n", | 1568 | "WARNING destroying unknown channel %u on tunnel %s\n", |
1575 | gid, GCT_2s (t)); | 1569 | ntohl (gid.cn), |
1570 | GCT_2s (t)); | ||
1576 | send_prebuilt_message (&msg.header, t, NULL, GNUNET_YES, NULL, NULL, NULL); | 1571 | send_prebuilt_message (&msg.header, t, NULL, GNUNET_YES, NULL, NULL, NULL); |
1577 | } | 1572 | } |
1578 | 1573 | ||
@@ -1589,7 +1584,7 @@ send_channel_destroy (struct CadetTunnel *t, unsigned int gid) | |||
1589 | */ | 1584 | */ |
1590 | static void | 1585 | static void |
1591 | handle_data (struct CadetTunnel *t, | 1586 | handle_data (struct CadetTunnel *t, |
1592 | const struct GNUNET_CADET_Data *msg, | 1587 | const struct GNUNET_CADET_ChannelAppDataMessage *msg, |
1593 | int fwd) | 1588 | int fwd) |
1594 | { | 1589 | { |
1595 | struct CadetChannel *ch; | 1590 | struct CadetChannel *ch; |
@@ -1600,7 +1595,7 @@ handle_data (struct CadetTunnel *t, | |||
1600 | /* Check size */ | 1595 | /* Check size */ |
1601 | size = ntohs (msg->header.size); | 1596 | size = ntohs (msg->header.size); |
1602 | if (size < | 1597 | if (size < |
1603 | sizeof (struct GNUNET_CADET_Data) + | 1598 | sizeof (struct GNUNET_CADET_ChannelAppDataMessage) + |
1604 | sizeof (struct GNUNET_MessageHeader)) | 1599 | sizeof (struct GNUNET_MessageHeader)) |
1605 | { | 1600 | { |
1606 | GNUNET_break (0); | 1601 | GNUNET_break (0); |
@@ -1613,13 +1608,17 @@ handle_data (struct CadetTunnel *t, | |||
1613 | 1608 | ||
1614 | 1609 | ||
1615 | /* Check channel */ | 1610 | /* Check channel */ |
1616 | ch = GCT_get_channel (t, ntohl (msg->chid)); | 1611 | ch = GCT_get_channel (t, msg->chid); |
1617 | if (NULL == ch) | 1612 | if (NULL == ch) |
1618 | { | 1613 | { |
1619 | GNUNET_STATISTICS_update (stats, "# data on unknown channel", | 1614 | GNUNET_STATISTICS_update (stats, |
1620 | 1, GNUNET_NO); | 1615 | "# data on unknown channel", |
1621 | LOG (GNUNET_ERROR_TYPE_DEBUG, "channel 0x%X unknown\n", ntohl (msg->chid)); | 1616 | 1, |
1622 | send_channel_destroy (t, ntohl (msg->chid)); | 1617 | GNUNET_NO); |
1618 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1619 | "channel 0x%X unknown\n", | ||
1620 | ntohl (msg->chid.cn)); | ||
1621 | send_channel_destroy (t, msg->chid); | ||
1623 | return; | 1622 | return; |
1624 | } | 1623 | } |
1625 | 1624 | ||
@@ -1639,7 +1638,7 @@ handle_data (struct CadetTunnel *t, | |||
1639 | */ | 1638 | */ |
1640 | static void | 1639 | static void |
1641 | handle_data_ack (struct CadetTunnel *t, | 1640 | handle_data_ack (struct CadetTunnel *t, |
1642 | const struct GNUNET_CADET_DataACK *msg, | 1641 | const struct GNUNET_CADET_ChannelDataAckMessage *msg, |
1643 | int fwd) | 1642 | int fwd) |
1644 | { | 1643 | { |
1645 | struct CadetChannel *ch; | 1644 | struct CadetChannel *ch; |
@@ -1647,20 +1646,20 @@ handle_data_ack (struct CadetTunnel *t, | |||
1647 | 1646 | ||
1648 | /* Check size */ | 1647 | /* Check size */ |
1649 | size = ntohs (msg->header.size); | 1648 | size = ntohs (msg->header.size); |
1650 | if (size != sizeof (struct GNUNET_CADET_DataACK)) | 1649 | if (size != sizeof (struct GNUNET_CADET_ChannelDataAckMessage)) |
1651 | { | 1650 | { |
1652 | GNUNET_break (0); | 1651 | GNUNET_break (0); |
1653 | return; | 1652 | return; |
1654 | } | 1653 | } |
1655 | 1654 | ||
1656 | /* Check channel */ | 1655 | /* Check channel */ |
1657 | ch = GCT_get_channel (t, ntohl (msg->chid)); | 1656 | ch = GCT_get_channel (t, msg->chid); |
1658 | if (NULL == ch) | 1657 | if (NULL == ch) |
1659 | { | 1658 | { |
1660 | GNUNET_STATISTICS_update (stats, "# data ack on unknown channel", | 1659 | GNUNET_STATISTICS_update (stats, "# data ack on unknown channel", |
1661 | 1, GNUNET_NO); | 1660 | 1, GNUNET_NO); |
1662 | LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel %u unknown\n", | 1661 | LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel %u unknown\n", |
1663 | ntohl (msg->chid)); | 1662 | ntohl (msg->chid.cn)); |
1664 | return; | 1663 | return; |
1665 | } | 1664 | } |
1666 | 1665 | ||
@@ -1676,21 +1675,21 @@ handle_data_ack (struct CadetTunnel *t, | |||
1676 | */ | 1675 | */ |
1677 | static void | 1676 | static void |
1678 | handle_ch_create (struct CadetTunnel *t, | 1677 | handle_ch_create (struct CadetTunnel *t, |
1679 | const struct GNUNET_CADET_ChannelCreate *msg) | 1678 | const struct GNUNET_CADET_ChannelOpenMessage *msg) |
1680 | { | 1679 | { |
1681 | struct CadetChannel *ch; | 1680 | struct CadetChannel *ch; |
1682 | size_t size; | 1681 | size_t size; |
1683 | 1682 | ||
1684 | /* Check size */ | 1683 | /* Check size */ |
1685 | size = ntohs (msg->header.size); | 1684 | size = ntohs (msg->header.size); |
1686 | if (size != sizeof (struct GNUNET_CADET_ChannelCreate)) | 1685 | if (size != sizeof (struct GNUNET_CADET_ChannelOpenMessage)) |
1687 | { | 1686 | { |
1688 | GNUNET_break_op (0); | 1687 | GNUNET_break_op (0); |
1689 | return; | 1688 | return; |
1690 | } | 1689 | } |
1691 | 1690 | ||
1692 | /* Check channel */ | 1691 | /* Check channel */ |
1693 | ch = GCT_get_channel (t, ntohl (msg->chid)); | 1692 | ch = GCT_get_channel (t, msg->chid); |
1694 | if (NULL != ch && ! GCT_is_loopback (t)) | 1693 | if (NULL != ch && ! GCT_is_loopback (t)) |
1695 | { | 1694 | { |
1696 | /* Probably a retransmission, safe to ignore */ | 1695 | /* Probably a retransmission, safe to ignore */ |
@@ -1711,27 +1710,28 @@ handle_ch_create (struct CadetTunnel *t, | |||
1711 | */ | 1710 | */ |
1712 | static void | 1711 | static void |
1713 | handle_ch_nack (struct CadetTunnel *t, | 1712 | handle_ch_nack (struct CadetTunnel *t, |
1714 | const struct GNUNET_CADET_ChannelManage *msg) | 1713 | const struct GNUNET_CADET_ChannelManageMessage *msg) |
1715 | { | 1714 | { |
1716 | struct CadetChannel *ch; | 1715 | struct CadetChannel *ch; |
1717 | size_t size; | 1716 | size_t size; |
1718 | 1717 | ||
1719 | /* Check size */ | 1718 | /* Check size */ |
1720 | size = ntohs (msg->header.size); | 1719 | size = ntohs (msg->header.size); |
1721 | if (size != sizeof (struct GNUNET_CADET_ChannelManage)) | 1720 | if (size != sizeof (struct GNUNET_CADET_ChannelManageMessage)) |
1722 | { | 1721 | { |
1723 | GNUNET_break (0); | 1722 | GNUNET_break (0); |
1724 | return; | 1723 | return; |
1725 | } | 1724 | } |
1726 | 1725 | ||
1727 | /* Check channel */ | 1726 | /* Check channel */ |
1728 | ch = GCT_get_channel (t, ntohl (msg->chid)); | 1727 | ch = GCT_get_channel (t, msg->chid); |
1729 | if (NULL == ch) | 1728 | if (NULL == ch) |
1730 | { | 1729 | { |
1731 | GNUNET_STATISTICS_update (stats, "# channel NACK on unknown channel", | 1730 | GNUNET_STATISTICS_update (stats, "# channel NACK on unknown channel", |
1732 | 1, GNUNET_NO); | 1731 | 1, GNUNET_NO); |
1733 | LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel %u unknown\n", | 1732 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1734 | ntohl (msg->chid)); | 1733 | "WARNING channel %u unknown\n", |
1734 | ntohl (msg->chid.cn)); | ||
1735 | return; | 1735 | return; |
1736 | } | 1736 | } |
1737 | 1737 | ||
@@ -1751,7 +1751,7 @@ handle_ch_nack (struct CadetTunnel *t, | |||
1751 | */ | 1751 | */ |
1752 | static void | 1752 | static void |
1753 | handle_ch_ack (struct CadetTunnel *t, | 1753 | handle_ch_ack (struct CadetTunnel *t, |
1754 | const struct GNUNET_CADET_ChannelManage *msg, | 1754 | const struct GNUNET_CADET_ChannelManageMessage *msg, |
1755 | int fwd) | 1755 | int fwd) |
1756 | { | 1756 | { |
1757 | struct CadetChannel *ch; | 1757 | struct CadetChannel *ch; |
@@ -1759,20 +1759,23 @@ handle_ch_ack (struct CadetTunnel *t, | |||
1759 | 1759 | ||
1760 | /* Check size */ | 1760 | /* Check size */ |
1761 | size = ntohs (msg->header.size); | 1761 | size = ntohs (msg->header.size); |
1762 | if (size != sizeof (struct GNUNET_CADET_ChannelManage)) | 1762 | if (size != sizeof (struct GNUNET_CADET_ChannelManageMessage)) |
1763 | { | 1763 | { |
1764 | GNUNET_break (0); | 1764 | GNUNET_break (0); |
1765 | return; | 1765 | return; |
1766 | } | 1766 | } |
1767 | 1767 | ||
1768 | /* Check channel */ | 1768 | /* Check channel */ |
1769 | ch = GCT_get_channel (t, ntohl (msg->chid)); | 1769 | ch = GCT_get_channel (t, msg->chid); |
1770 | if (NULL == ch) | 1770 | if (NULL == ch) |
1771 | { | 1771 | { |
1772 | GNUNET_STATISTICS_update (stats, "# channel ack on unknown channel", | 1772 | GNUNET_STATISTICS_update (stats, |
1773 | 1, GNUNET_NO); | 1773 | "# channel ack on unknown channel", |
1774 | LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel %u unknown\n", | 1774 | 1, |
1775 | ntohl (msg->chid)); | 1775 | GNUNET_NO); |
1776 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1777 | "WARNING channel %u unknown\n", | ||
1778 | ntohl (msg->chid.cn)); | ||
1776 | return; | 1779 | return; |
1777 | } | 1780 | } |
1778 | 1781 | ||
@@ -1792,7 +1795,7 @@ handle_ch_ack (struct CadetTunnel *t, | |||
1792 | */ | 1795 | */ |
1793 | static void | 1796 | static void |
1794 | handle_ch_destroy (struct CadetTunnel *t, | 1797 | handle_ch_destroy (struct CadetTunnel *t, |
1795 | const struct GNUNET_CADET_ChannelManage *msg, | 1798 | const struct GNUNET_CADET_ChannelManageMessage *msg, |
1796 | int fwd) | 1799 | int fwd) |
1797 | { | 1800 | { |
1798 | struct CadetChannel *ch; | 1801 | struct CadetChannel *ch; |
@@ -1800,14 +1803,14 @@ handle_ch_destroy (struct CadetTunnel *t, | |||
1800 | 1803 | ||
1801 | /* Check size */ | 1804 | /* Check size */ |
1802 | size = ntohs (msg->header.size); | 1805 | size = ntohs (msg->header.size); |
1803 | if (size != sizeof (struct GNUNET_CADET_ChannelManage)) | 1806 | if (size != sizeof (struct GNUNET_CADET_ChannelManageMessage)) |
1804 | { | 1807 | { |
1805 | GNUNET_break (0); | 1808 | GNUNET_break (0); |
1806 | return; | 1809 | return; |
1807 | } | 1810 | } |
1808 | 1811 | ||
1809 | /* Check channel */ | 1812 | /* Check channel */ |
1810 | ch = GCT_get_channel (t, ntohl (msg->chid)); | 1813 | ch = GCT_get_channel (t, msg->chid); |
1811 | if (NULL == ch) | 1814 | if (NULL == ch) |
1812 | { | 1815 | { |
1813 | /* Probably a retransmission, safe to ignore */ | 1816 | /* Probably a retransmission, safe to ignore */ |
@@ -1877,34 +1880,34 @@ handle_decrypted (struct CadetTunnel *t, | |||
1877 | 1880 | ||
1878 | switch (type) | 1881 | switch (type) |
1879 | { | 1882 | { |
1880 | case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE: | 1883 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE: |
1881 | /* Do nothing, connection aleady got updated. */ | 1884 | /* Do nothing, connection aleady got updated. */ |
1882 | GNUNET_STATISTICS_update (stats, "# keepalives received", 1, GNUNET_NO); | 1885 | GNUNET_STATISTICS_update (stats, "# keepalives received", 1, GNUNET_NO); |
1883 | break; | 1886 | break; |
1884 | 1887 | ||
1885 | case GNUNET_MESSAGE_TYPE_CADET_DATA: | 1888 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA: |
1886 | /* Don't send hop ACK, wait for client to ACK */ | 1889 | /* Don't send hop ACK, wait for client to ACK */ |
1887 | handle_data (t, (struct GNUNET_CADET_Data *) msgh, fwd); | 1890 | handle_data (t, (struct GNUNET_CADET_ChannelAppDataMessage *) msgh, fwd); |
1888 | break; | 1891 | break; |
1889 | 1892 | ||
1890 | case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: | 1893 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK: |
1891 | handle_data_ack (t, (struct GNUNET_CADET_DataACK *) msgh, fwd); | 1894 | handle_data_ack (t, (struct GNUNET_CADET_ChannelDataAckMessage *) msgh, fwd); |
1892 | break; | 1895 | break; |
1893 | 1896 | ||
1894 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: | 1897 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN: |
1895 | handle_ch_create (t, (struct GNUNET_CADET_ChannelCreate *) msgh); | 1898 | handle_ch_create (t, (struct GNUNET_CADET_ChannelOpenMessage *) msgh); |
1896 | break; | 1899 | break; |
1897 | 1900 | ||
1898 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: | 1901 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED: |
1899 | handle_ch_nack (t, (struct GNUNET_CADET_ChannelManage *) msgh); | 1902 | handle_ch_nack (t, (struct GNUNET_CADET_ChannelManageMessage *) msgh); |
1900 | break; | 1903 | break; |
1901 | 1904 | ||
1902 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: | 1905 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK: |
1903 | handle_ch_ack (t, (struct GNUNET_CADET_ChannelManage *) msgh, fwd); | 1906 | handle_ch_ack (t, (struct GNUNET_CADET_ChannelManageMessage *) msgh, fwd); |
1904 | break; | 1907 | break; |
1905 | 1908 | ||
1906 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: | 1909 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
1907 | handle_ch_destroy (t, (struct GNUNET_CADET_ChannelManage *) msgh, fwd); | 1910 | handle_ch_destroy (t, (struct GNUNET_CADET_ChannelManageMessage *) msgh, fwd); |
1908 | break; | 1911 | break; |
1909 | 1912 | ||
1910 | default: | 1913 | default: |
@@ -1931,7 +1934,7 @@ handle_decrypted (struct CadetTunnel *t, | |||
1931 | */ | 1934 | */ |
1932 | void | 1935 | void |
1933 | GCT_handle_encrypted (struct CadetTunnel *t, | 1936 | GCT_handle_encrypted (struct CadetTunnel *t, |
1934 | const struct GNUNET_CADET_Encrypted *msg) | 1937 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg) |
1935 | { | 1938 | { |
1936 | uint16_t size = ntohs (msg->header.size); | 1939 | uint16_t size = ntohs (msg->header.size); |
1937 | char cbuf [size]; | 1940 | char cbuf [size]; |
@@ -1990,7 +1993,7 @@ GCT_handle_encrypted (struct CadetTunnel *t, | |||
1990 | */ | 1993 | */ |
1991 | void | 1994 | void |
1992 | GCT_handle_kx (struct CadetTunnel *t, | 1995 | GCT_handle_kx (struct CadetTunnel *t, |
1993 | const struct GNUNET_CADET_KX *msg) | 1996 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) |
1994 | { | 1997 | { |
1995 | struct CadetTunnelAxolotl *ax; | 1998 | struct CadetTunnelAxolotl *ax; |
1996 | struct GNUNET_HashCode key_material[3]; | 1999 | struct GNUNET_HashCode key_material[3]; |
@@ -2143,9 +2146,9 @@ GCT_init (const struct GNUNET_CONFIGURATION_Handle *c, | |||
2143 | LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); | 2146 | LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); |
2144 | 2147 | ||
2145 | expected_overhead = 0; | 2148 | expected_overhead = 0; |
2146 | expected_overhead += sizeof (struct GNUNET_CADET_Encrypted); | 2149 | expected_overhead += sizeof (struct GNUNET_CADET_TunnelEncryptedMessage); |
2147 | expected_overhead += sizeof (struct GNUNET_CADET_Data); | 2150 | expected_overhead += sizeof (struct GNUNET_CADET_ChannelAppDataMessage); |
2148 | expected_overhead += sizeof (struct GNUNET_CADET_ACK); | 2151 | expected_overhead += sizeof (struct GNUNET_CADET_ConnectionEncryptedAckMessage); |
2149 | GNUNET_assert (GNUNET_CONSTANTS_CADET_P2P_OVERHEAD == expected_overhead); | 2152 | GNUNET_assert (GNUNET_CONSTANTS_CADET_P2P_OVERHEAD == expected_overhead); |
2150 | 2153 | ||
2151 | if (GNUNET_OK != | 2154 | if (GNUNET_OK != |
@@ -2200,7 +2203,7 @@ GCT_new (struct CadetPeer *destination) | |||
2200 | struct CadetTunnel *t; | 2203 | struct CadetTunnel *t; |
2201 | 2204 | ||
2202 | t = GNUNET_new (struct CadetTunnel); | 2205 | t = GNUNET_new (struct CadetTunnel); |
2203 | t->next_chid = 0; | 2206 | t->next_chid.cn = 0; |
2204 | t->peer = destination; | 2207 | t->peer = destination; |
2205 | 2208 | ||
2206 | if (GNUNET_OK != | 2209 | if (GNUNET_OK != |
@@ -2442,7 +2445,8 @@ GCT_remove_connection (struct CadetTunnel *t, | |||
2442 | * @param ch Channel. | 2445 | * @param ch Channel. |
2443 | */ | 2446 | */ |
2444 | void | 2447 | void |
2445 | GCT_add_channel (struct CadetTunnel *t, struct CadetChannel *ch) | 2448 | GCT_add_channel (struct CadetTunnel *t, |
2449 | struct CadetChannel *ch) | ||
2446 | { | 2450 | { |
2447 | struct CadetTChannel *aux; | 2451 | struct CadetTChannel *aux; |
2448 | 2452 | ||
@@ -2510,7 +2514,8 @@ GCT_remove_channel (struct CadetTunnel *t, struct CadetChannel *ch) | |||
2510 | * @return channel handler, NULL if doesn't exist | 2514 | * @return channel handler, NULL if doesn't exist |
2511 | */ | 2515 | */ |
2512 | struct CadetChannel * | 2516 | struct CadetChannel * |
2513 | GCT_get_channel (struct CadetTunnel *t, CADET_ChannelNumber chid) | 2517 | GCT_get_channel (struct CadetTunnel *t, |
2518 | struct GNUNET_CADET_ChannelTunnelNumber chid) | ||
2514 | { | 2519 | { |
2515 | struct CadetTChannel *iter; | 2520 | struct CadetTChannel *iter; |
2516 | 2521 | ||
@@ -2519,7 +2524,7 @@ GCT_get_channel (struct CadetTunnel *t, CADET_ChannelNumber chid) | |||
2519 | 2524 | ||
2520 | for (iter = t->channel_head; NULL != iter; iter = iter->next) | 2525 | for (iter = t->channel_head; NULL != iter; iter = iter->next) |
2521 | { | 2526 | { |
2522 | if (GCCH_get_id (iter->ch) == chid) | 2527 | if (GCCH_get_id (iter->ch).cn == chid.cn) |
2523 | break; | 2528 | break; |
2524 | } | 2529 | } |
2525 | 2530 | ||
@@ -2659,7 +2664,7 @@ GCT_destroy (struct CadetTunnel *t) | |||
2659 | 2664 | ||
2660 | mh = (struct GNUNET_MessageHeader *) &t->tq_head[1]; | 2665 | mh = (struct GNUNET_MessageHeader *) &t->tq_head[1]; |
2661 | type = ntohs (mh->type); | 2666 | type = ntohs (mh->type); |
2662 | if (0 == keepalives_queued && GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE == type) | 2667 | if (0 == keepalives_queued && GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE == type) |
2663 | { | 2668 | { |
2664 | keepalives_queued = 1; | 2669 | keepalives_queued = 1; |
2665 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2670 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2727,7 +2732,7 @@ struct CadetConnection * | |||
2727 | GCT_use_path (struct CadetTunnel *t, struct CadetPeerPath *path) | 2732 | GCT_use_path (struct CadetTunnel *t, struct CadetPeerPath *path) |
2728 | { | 2733 | { |
2729 | struct CadetConnection *c; | 2734 | struct CadetConnection *c; |
2730 | struct GNUNET_CADET_Hash cid; | 2735 | struct GNUNET_CADET_ConnectionTunnelIdentifier cid; |
2731 | unsigned int own_pos; | 2736 | unsigned int own_pos; |
2732 | 2737 | ||
2733 | if (NULL == t || NULL == path) | 2738 | if (NULL == t || NULL == path) |
@@ -2966,11 +2971,11 @@ GCT_get_destination (struct CadetTunnel *t) | |||
2966 | * | 2971 | * |
2967 | * @return GID of a channel free to use. | 2972 | * @return GID of a channel free to use. |
2968 | */ | 2973 | */ |
2969 | CADET_ChannelNumber | 2974 | struct GNUNET_CADET_ChannelTunnelNumber |
2970 | GCT_get_next_chid (struct CadetTunnel *t) | 2975 | GCT_get_next_chid (struct CadetTunnel *t) |
2971 | { | 2976 | { |
2972 | CADET_ChannelNumber chid; | 2977 | struct GNUNET_CADET_ChannelTunnelNumber chid; |
2973 | CADET_ChannelNumber mask; | 2978 | struct GNUNET_CADET_ChannelTunnelNumber mask; |
2974 | int result; | 2979 | int result; |
2975 | 2980 | ||
2976 | /* Set bit 30 depending on the ID relationship. Bit 31 is always 0 for GID. | 2981 | /* Set bit 30 depending on the ID relationship. Bit 31 is always 0 for GID. |
@@ -2979,20 +2984,22 @@ GCT_get_next_chid (struct CadetTunnel *t) | |||
2979 | */ | 2984 | */ |
2980 | result = GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, GCP_get_id (t->peer)); | 2985 | result = GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, GCP_get_id (t->peer)); |
2981 | if (0 > result) | 2986 | if (0 > result) |
2982 | mask = 0x40000000; | 2987 | mask.cn = htonl (0x40000000); |
2983 | else | 2988 | else |
2984 | mask = 0x0; | 2989 | mask.cn = 0x0; |
2985 | t->next_chid |= mask; | 2990 | t->next_chid.cn |= mask.cn; |
2986 | 2991 | ||
2987 | while (NULL != GCT_get_channel (t, t->next_chid)) | 2992 | while (NULL != GCT_get_channel (t, t->next_chid)) |
2988 | { | 2993 | { |
2989 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", t->next_chid); | 2994 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2990 | t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; | 2995 | "Channel %u exists...\n", |
2991 | t->next_chid |= mask; | 2996 | t->next_chid.cn); |
2997 | t->next_chid.cn = htonl ((ntohl (t->next_chid.cn) + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | ||
2998 | t->next_chid.cn |= mask.cn; | ||
2992 | } | 2999 | } |
2993 | chid = t->next_chid; | 3000 | chid = t->next_chid; |
2994 | t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; | 3001 | t->next_chid.cn = (t->next_chid.cn + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; |
2995 | t->next_chid |= mask; | 3002 | t->next_chid.cn |= mask.cn; |
2996 | 3003 | ||
2997 | return chid; | 3004 | return chid; |
2998 | } | 3005 | } |
@@ -3185,7 +3192,8 @@ GCT_has_queued_traffic (struct CadetTunnel *t) | |||
3185 | */ | 3192 | */ |
3186 | struct CadetTunnelQueue * | 3193 | struct CadetTunnelQueue * |
3187 | GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | 3194 | GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, |
3188 | struct CadetTunnel *t, struct CadetConnection *c, | 3195 | struct CadetTunnel *t, |
3196 | struct CadetConnection *c, | ||
3189 | int force, GCT_sent cont, void *cont_cls) | 3197 | int force, GCT_sent cont, void *cont_cls) |
3190 | { | 3198 | { |
3191 | return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL); | 3199 | return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL); |
@@ -3201,8 +3209,9 @@ GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
3201 | void | 3209 | void |
3202 | GCT_send_kx (struct CadetTunnel *t, int force_reply) | 3210 | GCT_send_kx (struct CadetTunnel *t, int force_reply) |
3203 | { | 3211 | { |
3212 | static struct CadetEncryptedMessageIdentifier zero; | ||
3204 | struct CadetConnection *c; | 3213 | struct CadetConnection *c; |
3205 | struct GNUNET_CADET_KX msg; | 3214 | struct GNUNET_CADET_TunnelKeyExchangeMessage msg; |
3206 | enum GNUNET_CADET_KX_Flags flags; | 3215 | enum GNUNET_CADET_KX_Flags flags; |
3207 | 3216 | ||
3208 | LOG (GNUNET_ERROR_TYPE_INFO, "==> { KX} on %s\n", GCT_2s (t)); | 3217 | LOG (GNUNET_ERROR_TYPE_INFO, "==> { KX} on %s\n", GCT_2s (t)); |
@@ -3225,7 +3234,7 @@ GCT_send_kx (struct CadetTunnel *t, int force_reply) | |||
3225 | } | 3234 | } |
3226 | 3235 | ||
3227 | msg.header.size = htons (sizeof (msg)); | 3236 | msg.header.size = htons (sizeof (msg)); |
3228 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX); | 3237 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX); |
3229 | flags = GNUNET_CADET_KX_FLAG_NONE; | 3238 | flags = GNUNET_CADET_KX_FLAG_NONE; |
3230 | if (GNUNET_YES == force_reply) | 3239 | if (GNUNET_YES == force_reply) |
3231 | flags |= GNUNET_CADET_KX_FLAG_FORCE_REPLY; | 3240 | flags |= GNUNET_CADET_KX_FLAG_FORCE_REPLY; |
@@ -3234,8 +3243,11 @@ GCT_send_kx (struct CadetTunnel *t, int force_reply) | |||
3234 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->kx_0, &msg.ephemeral_key); | 3243 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->kx_0, &msg.ephemeral_key); |
3235 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->DHRs, &msg.ratchet_key); | 3244 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->DHRs, &msg.ratchet_key); |
3236 | 3245 | ||
3237 | t->ephm_h = GCC_send_prebuilt_message (&msg.header, UINT16_MAX, 0, | 3246 | t->ephm_h = GCC_send_prebuilt_message (&msg.header, |
3238 | c, GCC_is_origin (c, GNUNET_YES), | 3247 | UINT16_MAX, |
3248 | zero, | ||
3249 | c, | ||
3250 | GCC_is_origin (c, GNUNET_YES), | ||
3239 | GNUNET_YES, &ephm_sent, t); | 3251 | GNUNET_YES, &ephm_sent, t); |
3240 | if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) | 3252 | if (CADET_TUNNEL_KEY_UNINITIALIZED == t->estate) |
3241 | GCT_change_estate (t, CADET_TUNNEL_KEY_SENT); | 3253 | GCT_change_estate (t, CADET_TUNNEL_KEY_SENT); |
@@ -3486,4 +3498,3 @@ GCT_iterate_channels (struct CadetTunnel *t, GCT_chan_iter iter, void *cls) | |||
3486 | for (cht = t->channel_head; NULL != cht; cht = cht->next) | 3498 | for (cht = t->channel_head; NULL != cht; cht = cht->next) |
3487 | iter (cls, cht->ch); | 3499 | iter (cls, cht->ch); |
3488 | } | 3500 | } |
3489 | |||
diff --git a/src/cadet/gnunet-service-cadet_tunnel.h b/src/cadet/gnunet-service-cadet_tunnel.h index e3ca57e9c..c10815a3b 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.h +++ b/src/cadet/gnunet-service-cadet_tunnel.h | |||
@@ -291,7 +291,7 @@ GCT_remove_channel (struct CadetTunnel *t, struct CadetChannel *ch); | |||
291 | * @return channel handler, NULL if doesn't exist | 291 | * @return channel handler, NULL if doesn't exist |
292 | */ | 292 | */ |
293 | struct CadetChannel * | 293 | struct CadetChannel * |
294 | GCT_get_channel (struct CadetTunnel *t, CADET_ChannelNumber chid); | 294 | GCT_get_channel (struct CadetTunnel *t, struct GNUNET_CADET_ChannelTunnelNumber chid); |
295 | 295 | ||
296 | 296 | ||
297 | /** | 297 | /** |
@@ -304,7 +304,7 @@ GCT_get_channel (struct CadetTunnel *t, CADET_ChannelNumber chid); | |||
304 | */ | 304 | */ |
305 | void | 305 | void |
306 | GCT_handle_encrypted (struct CadetTunnel *t, | 306 | GCT_handle_encrypted (struct CadetTunnel *t, |
307 | const struct GNUNET_CADET_Encrypted *msg); | 307 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg); |
308 | 308 | ||
309 | 309 | ||
310 | /** | 310 | /** |
@@ -315,7 +315,7 @@ GCT_handle_encrypted (struct CadetTunnel *t, | |||
315 | */ | 315 | */ |
316 | void | 316 | void |
317 | GCT_handle_kx (struct CadetTunnel *t, | 317 | GCT_handle_kx (struct CadetTunnel *t, |
318 | const struct GNUNET_CADET_KX *msg); | 318 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); |
319 | 319 | ||
320 | 320 | ||
321 | /** | 321 | /** |
@@ -427,7 +427,7 @@ GCT_get_destination (struct CadetTunnel *t); | |||
427 | * | 427 | * |
428 | * @return ID of a channel free to use. | 428 | * @return ID of a channel free to use. |
429 | */ | 429 | */ |
430 | CADET_ChannelNumber | 430 | struct GNUNET_CADET_ChannelTunnelNumber |
431 | GCT_get_next_chid (struct CadetTunnel *t); | 431 | GCT_get_next_chid (struct CadetTunnel *t); |
432 | 432 | ||
433 | 433 | ||
diff --git a/src/cadet/test_cadet.conf b/src/cadet/test_cadet.conf index b6ed64c58..e0c00858e 100644 --- a/src/cadet/test_cadet.conf +++ b/src/cadet/test_cadet.conf | |||
@@ -59,11 +59,6 @@ USE_EPHEMERAL_KEYS = NO | |||
59 | [PATHS] | 59 | [PATHS] |
60 | GNUNET_TEST_HOME = /tmp/test-cadet/ | 60 | GNUNET_TEST_HOME = /tmp/test-cadet/ |
61 | 61 | ||
62 | [nat] | ||
63 | RETURN_LOCAL_ADDRESSES = YES | ||
64 | DISABLEV6 = YES | ||
65 | USE_LOCALADDR = YES | ||
66 | |||
67 | [peerinfo] | 62 | [peerinfo] |
68 | NO_IO = YES | 63 | NO_IO = YES |
69 | 64 | ||
diff --git a/src/cadet/test_cadet_local.c b/src/cadet/test_cadet_local.c index c226563d5..d15785cb0 100644 --- a/src/cadet/test_cadet_local.c +++ b/src/cadet/test_cadet_local.c | |||
@@ -178,7 +178,8 @@ inbound_channel (void *cls, | |||
178 | * with the channel is stored | 178 | * with the channel is stored |
179 | */ | 179 | */ |
180 | static void | 180 | static void |
181 | channel_end (void *cls, const struct GNUNET_CADET_Channel *channel, | 181 | channel_end (void *cls, |
182 | const struct GNUNET_CADET_Channel *channel, | ||
182 | void *channel_ctx) | 183 | void *channel_ctx) |
183 | { | 184 | { |
184 | long id = (long) cls; | 185 | long id = (long) cls; |
@@ -191,6 +192,8 @@ channel_end (void *cls, const struct GNUNET_CADET_Channel *channel, | |||
191 | GNUNET_CADET_notify_transmit_ready_cancel (mth); | 192 | GNUNET_CADET_notify_transmit_ready_cancel (mth); |
192 | mth = NULL; | 193 | mth = NULL; |
193 | } | 194 | } |
195 | if (channel == ch) | ||
196 | ch = NULL; | ||
194 | if (GNUNET_NO == got_data) | 197 | if (GNUNET_NO == got_data) |
195 | { | 198 | { |
196 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply ( | 199 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply ( |
diff --git a/src/consensus/consensus_api.c b/src/consensus/consensus_api.c index 18898bebd..d5ed8db80 100644 --- a/src/consensus/consensus_api.c +++ b/src/consensus/consensus_api.c | |||
@@ -222,7 +222,7 @@ GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
222 | consensus->new_element_cb = new_element_cb; | 222 | consensus->new_element_cb = new_element_cb; |
223 | consensus->new_element_cls = new_element_cls; | 223 | consensus->new_element_cls = new_element_cls; |
224 | consensus->session_id = *session_id; | 224 | consensus->session_id = *session_id; |
225 | consensus->mq = GNUNET_CLIENT_connecT (cfg, | 225 | consensus->mq = GNUNET_CLIENT_connect (cfg, |
226 | "consensus", | 226 | "consensus", |
227 | mq_handlers, | 227 | mq_handlers, |
228 | &mq_error_handler, | 228 | &mq_error_handler, |
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c index 8a74f0ca6..0b3920633 100644 --- a/src/conversation/conversation_api.c +++ b/src/conversation/conversation_api.c | |||
@@ -584,7 +584,7 @@ reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone) | |||
584 | phone->mq = NULL; | 584 | phone->mq = NULL; |
585 | } | 585 | } |
586 | phone->state = PS_REGISTER; | 586 | phone->state = PS_REGISTER; |
587 | phone->mq = GNUNET_CLIENT_connecT (phone->cfg, | 587 | phone->mq = GNUNET_CLIENT_connect (phone->cfg, |
588 | "conversation", | 588 | "conversation", |
589 | handlers, | 589 | handlers, |
590 | &phone_error_handler, | 590 | &phone_error_handler, |
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c index 17e26465e..a6bc506bc 100644 --- a/src/conversation/conversation_api_call.c +++ b/src/conversation/conversation_api_call.c | |||
@@ -570,7 +570,7 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
570 | }; | 570 | }; |
571 | struct GNUNET_CRYPTO_EcdsaPublicKey my_zone; | 571 | struct GNUNET_CRYPTO_EcdsaPublicKey my_zone; |
572 | 572 | ||
573 | call->mq = GNUNET_CLIENT_connecT (cfg, | 573 | call->mq = GNUNET_CLIENT_connect (cfg, |
574 | "conversation", | 574 | "conversation", |
575 | handlers, | 575 | handlers, |
576 | &call_error_handler, | 576 | &call_error_handler, |
diff --git a/src/core/.gitignore b/src/core/.gitignore index 42b7030b3..cdd1f93c2 100644 --- a/src/core/.gitignore +++ b/src/core/.gitignore | |||
@@ -1,2 +1,9 @@ | |||
1 | gnunet-service-core | 1 | gnunet-service-core |
2 | gnunet-core | 2 | gnunet-core |
3 | test_core_api | ||
4 | test_core_api_reliability | ||
5 | test_core_api_send_to_self | ||
6 | test_core_api_start_only | ||
7 | test_core_quota_compliance_asymmetric_recv_limited | ||
8 | test_core_quota_compliance_asymmetric_send_limited | ||
9 | test_core_quota_compliance_symmetric | ||
diff --git a/src/core/Makefile.am b/src/core/Makefile.am index aea64fa34..ed80bae73 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am | |||
@@ -23,7 +23,6 @@ lib_LTLIBRARIES = \ | |||
23 | 23 | ||
24 | libgnunetcore_la_SOURCES = \ | 24 | libgnunetcore_la_SOURCES = \ |
25 | core_api.c core.h \ | 25 | core_api.c core.h \ |
26 | core_api_2.c \ | ||
27 | core_api_monitor_peers.c | 26 | core_api_monitor_peers.c |
28 | libgnunetcore_la_LIBADD = \ | 27 | libgnunetcore_la_LIBADD = \ |
29 | $(top_builddir)/src/util/libgnunetutil.la \ | 28 | $(top_builddir)/src/util/libgnunetutil.la \ |
diff --git a/src/core/core_api.c b/src/core/core_api.c index fda49e259..ace80b952 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -33,79 +33,32 @@ | |||
33 | 33 | ||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Handle for a transmission request. | 36 | * Information we track for each peer. |
37 | */ | 37 | */ |
38 | struct GNUNET_CORE_TransmitHandle | 38 | struct PeerRecord |
39 | { | 39 | { |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Corresponding peer record. | 42 | * Corresponding CORE handle. |
43 | */ | ||
44 | struct PeerRecord *peer; | ||
45 | |||
46 | /** | ||
47 | * Function that will be called to get the actual request | ||
48 | * (once we are ready to transmit this request to the core). | ||
49 | * The function will be called with a NULL buffer to signal | ||
50 | * timeout. | ||
51 | */ | ||
52 | GNUNET_CONNECTION_TransmitReadyNotify get_message; | ||
53 | |||
54 | /** | ||
55 | * Closure for @e get_message. | ||
56 | */ | ||
57 | void *get_message_cls; | ||
58 | |||
59 | /** | ||
60 | * Deadline for the transmission (the request does not get cancelled | ||
61 | * at this time, this is merely how soon the application wants this out). | ||
62 | */ | ||
63 | struct GNUNET_TIME_Absolute deadline; | ||
64 | |||
65 | /** | ||
66 | * When did this request get queued? | ||
67 | */ | ||
68 | struct GNUNET_TIME_Absolute request_time; | ||
69 | |||
70 | /** | ||
71 | * How important is this message? | ||
72 | */ | ||
73 | enum GNUNET_CORE_Priority priority; | ||
74 | |||
75 | /** | ||
76 | * Is corking allowed? | ||
77 | */ | ||
78 | int cork; | ||
79 | |||
80 | /** | ||
81 | * Size of this request. | ||
82 | */ | 43 | */ |
83 | uint16_t msize; | 44 | struct GNUNET_CORE_Handle *h; |
84 | 45 | ||
85 | /** | 46 | /** |
86 | * Send message request ID for this request. | 47 | * Message queue for the peer. |
87 | */ | 48 | */ |
88 | uint16_t smr_id; | 49 | struct GNUNET_MQ_Handle *mq; |
89 | |||
90 | }; | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Information we track for each peer. | ||
95 | */ | ||
96 | struct PeerRecord | ||
97 | { | ||
98 | 50 | ||
99 | /** | 51 | /** |
100 | * Corresponding CORE handle. | 52 | * Message we are currently trying to pass to the CORE service |
53 | * for this peer (from @e mq). | ||
101 | */ | 54 | */ |
102 | struct GNUNET_CORE_Handle *ch; | 55 | struct GNUNET_MQ_Envelope *env; |
103 | 56 | ||
104 | /** | 57 | /** |
105 | * Pending request, if any. 'th->peer' is set to NULL if the | 58 | * Value the client returned when we connected, used |
106 | * request is not active. | 59 | * as the closure in various places. |
107 | */ | 60 | */ |
108 | struct GNUNET_CORE_TransmitHandle th; | 61 | void *client_cls; |
109 | 62 | ||
110 | /** | 63 | /** |
111 | * Peer the record is about. | 64 | * Peer the record is about. |
@@ -152,19 +105,9 @@ struct GNUNET_CORE_Handle | |||
152 | GNUNET_CORE_DisconnectEventHandler disconnects; | 105 | GNUNET_CORE_DisconnectEventHandler disconnects; |
153 | 106 | ||
154 | /** | 107 | /** |
155 | * Function to call whenever we receive an inbound message. | ||
156 | */ | ||
157 | GNUNET_CORE_MessageCallback inbound_notify; | ||
158 | |||
159 | /** | ||
160 | * Function to call whenever we receive an outbound message. | ||
161 | */ | ||
162 | GNUNET_CORE_MessageCallback outbound_notify; | ||
163 | |||
164 | /** | ||
165 | * Function handlers for messages of particular type. | 108 | * Function handlers for messages of particular type. |
166 | */ | 109 | */ |
167 | struct GNUNET_CORE_MessageHandler *handlers; | 110 | struct GNUNET_MQ_MessageHandler *handlers; |
168 | 111 | ||
169 | /** | 112 | /** |
170 | * Our message queue for transmissions to the service. | 113 | * Our message queue for transmissions to the service. |
@@ -198,24 +141,6 @@ struct GNUNET_CORE_Handle | |||
198 | unsigned int hcnt; | 141 | unsigned int hcnt; |
199 | 142 | ||
200 | /** | 143 | /** |
201 | * For inbound notifications without a specific handler, do | ||
202 | * we expect to only receive headers? | ||
203 | */ | ||
204 | int inbound_hdr_only; | ||
205 | |||
206 | /** | ||
207 | * For outbound notifications without a specific handler, do | ||
208 | * we expect to only receive headers? | ||
209 | */ | ||
210 | int outbound_hdr_only; | ||
211 | |||
212 | /** | ||
213 | * Are we currently disconnected and hence unable to forward | ||
214 | * requests? | ||
215 | */ | ||
216 | int currently_down; | ||
217 | |||
218 | /** | ||
219 | * Did we ever get INIT? | 144 | * Did we ever get INIT? |
220 | */ | 145 | */ |
221 | int have_init; | 146 | int have_init; |
@@ -266,25 +191,19 @@ disconnect_and_free_peer_entry (void *cls, | |||
266 | void *value) | 191 | void *value) |
267 | { | 192 | { |
268 | struct GNUNET_CORE_Handle *h = cls; | 193 | struct GNUNET_CORE_Handle *h = cls; |
269 | struct GNUNET_CORE_TransmitHandle *th; | ||
270 | struct PeerRecord *pr = value; | 194 | struct PeerRecord *pr = value; |
271 | 195 | ||
196 | GNUNET_assert (pr->h == h); | ||
272 | if (NULL != h->disconnects) | 197 | if (NULL != h->disconnects) |
273 | h->disconnects (h->cls, | 198 | h->disconnects (h->cls, |
274 | &pr->peer); | 199 | &pr->peer, |
275 | /* all requests should have been cancelled, clean up anyway, just in case */ | 200 | pr->client_cls); |
276 | th = &pr->th; | ||
277 | if (NULL != th->peer) | ||
278 | { | ||
279 | GNUNET_break (0); | ||
280 | th->peer = NULL; | ||
281 | } | ||
282 | /* done with 'voluntary' cleanups, now on to normal freeing */ | ||
283 | GNUNET_assert (GNUNET_YES == | 201 | GNUNET_assert (GNUNET_YES == |
284 | GNUNET_CONTAINER_multipeermap_remove (h->peers, | 202 | GNUNET_CONTAINER_multipeermap_remove (h->peers, |
285 | key, | 203 | key, |
286 | pr)); | 204 | pr)); |
287 | GNUNET_assert (pr->ch == h); | 205 | GNUNET_MQ_destroy (pr->mq); |
206 | GNUNET_assert (NULL == pr->mq); | ||
288 | GNUNET_free (pr); | 207 | GNUNET_free (pr); |
289 | return GNUNET_YES; | 208 | return GNUNET_YES; |
290 | } | 209 | } |
@@ -305,8 +224,7 @@ reconnect_later (struct GNUNET_CORE_Handle *h) | |||
305 | GNUNET_MQ_destroy (h->mq); | 224 | GNUNET_MQ_destroy (h->mq); |
306 | h->mq = NULL; | 225 | h->mq = NULL; |
307 | } | 226 | } |
308 | h->currently_down = GNUNET_YES; | 227 | GNUNET_assert (NULL == h->reconnect_task); |
309 | GNUNET_assert (h->reconnect_task == NULL); | ||
310 | h->reconnect_task = | 228 | h->reconnect_task = |
311 | GNUNET_SCHEDULER_add_delayed (h->retry_backoff, | 229 | GNUNET_SCHEDULER_add_delayed (h->retry_backoff, |
312 | &reconnect_task, | 230 | &reconnect_task, |
@@ -319,9 +237,8 @@ reconnect_later (struct GNUNET_CORE_Handle *h) | |||
319 | 237 | ||
320 | 238 | ||
321 | /** | 239 | /** |
322 | * Generic error handler, called with the appropriate error code and | 240 | * Error handler for the message queue to the CORE service. |
323 | * the same closure specified at the creation of the message queue. | 241 | * On errors, we reconnect. |
324 | * Not every message queue implementation supports an error handler. | ||
325 | * | 242 | * |
326 | * @param cls closure, a `struct GNUNET_CORE_Handle *` | 243 | * @param cls closure, a `struct GNUNET_CORE_Handle *` |
327 | * @param error error code | 244 | * @param error error code |
@@ -340,6 +257,209 @@ handle_mq_error (void *cls, | |||
340 | 257 | ||
341 | 258 | ||
342 | /** | 259 | /** |
260 | * Inquire with CORE what options should be set for a message | ||
261 | * so that it is transmitted with the given @a priority and | ||
262 | * the given @a cork value. | ||
263 | * | ||
264 | * @param cork desired corking | ||
265 | * @param priority desired message priority | ||
266 | * @param[out] flags set to `flags` value for #GNUNET_MQ_set_options() | ||
267 | * @return `extra` argument to give to #GNUNET_MQ_set_options() | ||
268 | */ | ||
269 | const void * | ||
270 | GNUNET_CORE_get_mq_options (int cork, | ||
271 | enum GNUNET_CORE_Priority priority, | ||
272 | uint64_t *flags) | ||
273 | { | ||
274 | *flags = ((uint64_t) priority) + (((uint64_t) cork) << 32); | ||
275 | return NULL; | ||
276 | } | ||
277 | |||
278 | |||
279 | /** | ||
280 | * Implement sending functionality of a message queue for | ||
281 | * us sending messages to a peer. | ||
282 | * | ||
283 | * @param mq the message queue | ||
284 | * @param msg the message to send | ||
285 | * @param impl_state state of the implementation | ||
286 | */ | ||
287 | static void | ||
288 | core_mq_send_impl (struct GNUNET_MQ_Handle *mq, | ||
289 | const struct GNUNET_MessageHeader *msg, | ||
290 | void *impl_state) | ||
291 | { | ||
292 | struct PeerRecord *pr = impl_state; | ||
293 | struct GNUNET_CORE_Handle *h = pr->h; | ||
294 | struct SendMessageRequest *smr; | ||
295 | struct SendMessage *sm; | ||
296 | struct GNUNET_MQ_Envelope *env; | ||
297 | uint16_t msize; | ||
298 | uint64_t flags; | ||
299 | int cork; | ||
300 | enum GNUNET_CORE_Priority priority; | ||
301 | |||
302 | if (NULL == h->mq) | ||
303 | { | ||
304 | /* We're currently reconnecting, pretend this worked */ | ||
305 | GNUNET_MQ_impl_send_continue (mq); | ||
306 | return; | ||
307 | } | ||
308 | GNUNET_assert (NULL == pr->env); | ||
309 | /* extract options from envelope */ | ||
310 | env = GNUNET_MQ_get_current_envelope (mq); | ||
311 | GNUNET_break (NULL == | ||
312 | GNUNET_MQ_env_get_options (env, | ||
313 | &flags)); | ||
314 | cork = (int) (flags >> 32); | ||
315 | priority = (uint32_t) flags; | ||
316 | |||
317 | /* check message size for sanity */ | ||
318 | msize = ntohs (msg->size); | ||
319 | if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct SendMessage)) | ||
320 | { | ||
321 | GNUNET_break (0); | ||
322 | GNUNET_MQ_impl_send_continue (mq); | ||
323 | return; | ||
324 | } | ||
325 | |||
326 | /* ask core for transmission */ | ||
327 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
328 | "Asking core for transmission of %u bytes to `%s'\n", | ||
329 | (unsigned int) msize, | ||
330 | GNUNET_i2s (&pr->peer)); | ||
331 | env = GNUNET_MQ_msg (smr, | ||
332 | GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST); | ||
333 | smr->priority = htonl ((uint32_t) priority); | ||
334 | // smr->deadline = GNUNET_TIME_absolute_hton (deadline); | ||
335 | smr->peer = pr->peer; | ||
336 | smr->reserved = htonl (0); | ||
337 | smr->size = htons (msize); | ||
338 | smr->smr_id = htons (++pr->smr_id_gen); | ||
339 | GNUNET_MQ_send (h->mq, | ||
340 | env); | ||
341 | |||
342 | /* prepare message with actual transmission data */ | ||
343 | pr->env = GNUNET_MQ_msg_nested_mh (sm, | ||
344 | GNUNET_MESSAGE_TYPE_CORE_SEND, | ||
345 | msg); | ||
346 | sm->priority = htonl ((uint32_t) priority); | ||
347 | // sm->deadline = GNUNET_TIME_absolute_hton (deadline); | ||
348 | sm->peer = pr->peer; | ||
349 | sm->cork = htonl ((uint32_t) cork); | ||
350 | sm->reserved = htonl (0); | ||
351 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
352 | "Calling get_message with buffer of %u bytes (%s)\n", | ||
353 | (unsigned int) msize, | ||
354 | cork ? "corked" : "uncorked"); | ||
355 | } | ||
356 | |||
357 | |||
358 | /** | ||
359 | * Handle destruction of a message queue. Implementations must not | ||
360 | * free @a mq, but should take care of @a impl_state. | ||
361 | * | ||
362 | * @param mq the message queue to destroy | ||
363 | * @param impl_state state of the implementation | ||
364 | */ | ||
365 | static void | ||
366 | core_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, | ||
367 | void *impl_state) | ||
368 | { | ||
369 | struct PeerRecord *pr = impl_state; | ||
370 | |||
371 | GNUNET_assert (mq == pr->mq); | ||
372 | pr->mq = NULL; | ||
373 | } | ||
374 | |||
375 | |||
376 | /** | ||
377 | * Implementation function that cancels the currently sent message. | ||
378 | * Should basically undo whatever #mq_send_impl() did. | ||
379 | * | ||
380 | * @param mq message queue | ||
381 | * @param impl_state state specific to the implementation | ||
382 | */ | ||
383 | static void | ||
384 | core_mq_cancel_impl (struct GNUNET_MQ_Handle *mq, | ||
385 | void *impl_state) | ||
386 | { | ||
387 | struct PeerRecord *pr = impl_state; | ||
388 | |||
389 | GNUNET_assert (NULL != pr->env); | ||
390 | GNUNET_MQ_discard (pr->env); | ||
391 | pr->env = NULL; | ||
392 | } | ||
393 | |||
394 | |||
395 | /** | ||
396 | * We had an error processing a message we forwarded from a peer to | ||
397 | * the CORE service. We should just complain about it but otherwise | ||
398 | * continue processing. | ||
399 | * | ||
400 | * @param cls closure | ||
401 | * @param error error code | ||
402 | */ | ||
403 | static void | ||
404 | core_mq_error_handler (void *cls, | ||
405 | enum GNUNET_MQ_Error error) | ||
406 | { | ||
407 | /* struct PeerRecord *pr = cls; */ | ||
408 | |||
409 | GNUNET_break_op (0); | ||
410 | } | ||
411 | |||
412 | |||
413 | /** | ||
414 | * Add the given peer to the list of our connected peers | ||
415 | * and create the respective data structures and notify | ||
416 | * the application. | ||
417 | * | ||
418 | * @param h the core handle | ||
419 | * @param peer the peer that is connecting to us | ||
420 | */ | ||
421 | static void | ||
422 | connect_peer (struct GNUNET_CORE_Handle *h, | ||
423 | const struct GNUNET_PeerIdentity *peer) | ||
424 | { | ||
425 | struct PeerRecord *pr; | ||
426 | uint64_t flags; | ||
427 | const void *extra; | ||
428 | |||
429 | pr = GNUNET_new (struct PeerRecord); | ||
430 | pr->peer = *peer; | ||
431 | pr->h = h; | ||
432 | GNUNET_assert (GNUNET_YES == | ||
433 | GNUNET_CONTAINER_multipeermap_put (h->peers, | ||
434 | &pr->peer, | ||
435 | pr, | ||
436 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
437 | pr->mq = GNUNET_MQ_queue_for_callbacks (&core_mq_send_impl, | ||
438 | &core_mq_destroy_impl, | ||
439 | &core_mq_cancel_impl, | ||
440 | pr, | ||
441 | h->handlers, | ||
442 | &core_mq_error_handler, | ||
443 | pr); | ||
444 | /* get our default options */ | ||
445 | extra = GNUNET_CORE_get_mq_options (GNUNET_NO, | ||
446 | GNUNET_CORE_PRIO_BEST_EFFORT, | ||
447 | &flags); | ||
448 | GNUNET_MQ_set_options (pr->mq, | ||
449 | flags, | ||
450 | extra); | ||
451 | if (NULL != h->connects) | ||
452 | { | ||
453 | pr->client_cls = h->connects (h->cls, | ||
454 | &pr->peer, | ||
455 | pr->mq); | ||
456 | GNUNET_MQ_set_handlers_closure (pr->mq, | ||
457 | pr->client_cls); | ||
458 | } | ||
459 | } | ||
460 | |||
461 | |||
462 | /** | ||
343 | * Handle init reply message received from CORE service. Notify | 463 | * Handle init reply message received from CORE service. Notify |
344 | * application that we are now connected to the CORE. Also fake | 464 | * application that we are now connected to the CORE. Also fake |
345 | * loopback connection. | 465 | * loopback connection. |
@@ -353,11 +473,8 @@ handle_init_reply (void *cls, | |||
353 | { | 473 | { |
354 | struct GNUNET_CORE_Handle *h = cls; | 474 | struct GNUNET_CORE_Handle *h = cls; |
355 | GNUNET_CORE_StartupCallback init; | 475 | GNUNET_CORE_StartupCallback init; |
356 | struct PeerRecord *pr; | ||
357 | 476 | ||
358 | GNUNET_break (0 == ntohl (m->reserved)); | 477 | GNUNET_break (0 == ntohl (m->reserved)); |
359 | GNUNET_break (GNUNET_YES == h->currently_down); | ||
360 | h->currently_down = GNUNET_NO; | ||
361 | h->retry_backoff = GNUNET_TIME_UNIT_MILLISECONDS; | 478 | h->retry_backoff = GNUNET_TIME_UNIT_MILLISECONDS; |
362 | if (NULL != (init = h->init)) | 479 | if (NULL != (init = h->init)) |
363 | { | 480 | { |
@@ -388,17 +505,8 @@ handle_init_reply (void *cls, | |||
388 | } | 505 | } |
389 | } | 506 | } |
390 | /* fake 'connect to self' */ | 507 | /* fake 'connect to self' */ |
391 | pr = GNUNET_new (struct PeerRecord); | 508 | connect_peer (h, |
392 | pr->peer = h->me; | 509 | &h->me); |
393 | pr->ch = h; | ||
394 | GNUNET_assert (GNUNET_YES == | ||
395 | GNUNET_CONTAINER_multipeermap_put (h->peers, | ||
396 | &h->me, | ||
397 | pr, | ||
398 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
399 | if (NULL != h->connects) | ||
400 | h->connects (h->cls, | ||
401 | &pr->peer); | ||
402 | } | 510 | } |
403 | 511 | ||
404 | 512 | ||
@@ -416,7 +524,6 @@ handle_connect_notify (void *cls, | |||
416 | struct GNUNET_CORE_Handle *h = cls; | 524 | struct GNUNET_CORE_Handle *h = cls; |
417 | struct PeerRecord *pr; | 525 | struct PeerRecord *pr; |
418 | 526 | ||
419 | GNUNET_break (GNUNET_NO == h->currently_down); | ||
420 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 527 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
421 | "Received notification about connection from `%s'.\n", | 528 | "Received notification about connection from `%s'.\n", |
422 | GNUNET_i2s (&cnm->peer)); | 529 | GNUNET_i2s (&cnm->peer)); |
@@ -436,17 +543,8 @@ handle_connect_notify (void *cls, | |||
436 | reconnect_later (h); | 543 | reconnect_later (h); |
437 | return; | 544 | return; |
438 | } | 545 | } |
439 | pr = GNUNET_new (struct PeerRecord); | 546 | connect_peer (h, |
440 | pr->peer = cnm->peer; | 547 | &cnm->peer); |
441 | pr->ch = h; | ||
442 | GNUNET_assert (GNUNET_YES == | ||
443 | GNUNET_CONTAINER_multipeermap_put (h->peers, | ||
444 | &cnm->peer, | ||
445 | pr, | ||
446 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
447 | if (NULL != h->connects) | ||
448 | h->connects (h->cls, | ||
449 | &pr->peer); | ||
450 | } | 548 | } |
451 | 549 | ||
452 | 550 | ||
@@ -459,17 +557,16 @@ handle_connect_notify (void *cls, | |||
459 | */ | 557 | */ |
460 | static void | 558 | static void |
461 | handle_disconnect_notify (void *cls, | 559 | handle_disconnect_notify (void *cls, |
462 | const struct DisconnectNotifyMessage * dnm) | 560 | const struct DisconnectNotifyMessage *dnm) |
463 | { | 561 | { |
464 | struct GNUNET_CORE_Handle *h = cls; | 562 | struct GNUNET_CORE_Handle *h = cls; |
465 | struct PeerRecord *pr; | 563 | struct PeerRecord *pr; |
466 | 564 | ||
467 | GNUNET_break (GNUNET_NO == h->currently_down); | ||
468 | if (0 == memcmp (&h->me, | 565 | if (0 == memcmp (&h->me, |
469 | &dnm->peer, | 566 | &dnm->peer, |
470 | sizeof (struct GNUNET_PeerIdentity))) | 567 | sizeof (struct GNUNET_PeerIdentity))) |
471 | { | 568 | { |
472 | /* connection to self!? */ | 569 | /* disconnect from self!? */ |
473 | GNUNET_break (0); | 570 | GNUNET_break (0); |
474 | return; | 571 | return; |
475 | } | 572 | } |
@@ -486,7 +583,7 @@ handle_disconnect_notify (void *cls, | |||
486 | return; | 583 | return; |
487 | } | 584 | } |
488 | disconnect_and_free_peer_entry (h, | 585 | disconnect_and_free_peer_entry (h, |
489 | &dnm->peer, | 586 | &pr->peer, |
490 | pr); | 587 | pr); |
491 | } | 588 | } |
492 | 589 | ||
@@ -502,11 +599,9 @@ static int | |||
502 | check_notify_inbound (void *cls, | 599 | check_notify_inbound (void *cls, |
503 | const struct NotifyTrafficMessage *ntm) | 600 | const struct NotifyTrafficMessage *ntm) |
504 | { | 601 | { |
505 | struct GNUNET_CORE_Handle *h = cls; | ||
506 | uint16_t msize; | 602 | uint16_t msize; |
507 | const struct GNUNET_MessageHeader *em; | 603 | const struct GNUNET_MessageHeader *em; |
508 | 604 | ||
509 | GNUNET_break (GNUNET_NO == h->currently_down); | ||
510 | msize = ntohs (ntm->header.size) - sizeof (struct NotifyTrafficMessage); | 605 | msize = ntohs (ntm->header.size) - sizeof (struct NotifyTrafficMessage); |
511 | if (msize < sizeof (struct GNUNET_MessageHeader)) | 606 | if (msize < sizeof (struct GNUNET_MessageHeader)) |
512 | { | 607 | { |
@@ -514,8 +609,7 @@ check_notify_inbound (void *cls, | |||
514 | return GNUNET_SYSERR; | 609 | return GNUNET_SYSERR; |
515 | } | 610 | } |
516 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; | 611 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; |
517 | if ( (GNUNET_NO == h->inbound_hdr_only) && | 612 | if (msize != ntohs (em->size)) |
518 | (msize != ntohs (em->size)) ) | ||
519 | { | 613 | { |
520 | GNUNET_break (0); | 614 | GNUNET_break (0); |
521 | return GNUNET_SYSERR; | 615 | return GNUNET_SYSERR; |
@@ -538,120 +632,21 @@ handle_notify_inbound (void *cls, | |||
538 | struct GNUNET_CORE_Handle *h = cls; | 632 | struct GNUNET_CORE_Handle *h = cls; |
539 | const struct GNUNET_MessageHeader *em; | 633 | const struct GNUNET_MessageHeader *em; |
540 | struct PeerRecord *pr; | 634 | struct PeerRecord *pr; |
541 | uint16_t et; | ||
542 | 635 | ||
543 | GNUNET_break (GNUNET_NO == h->currently_down); | ||
544 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; | ||
545 | et = ntohs (em->type); | ||
546 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 636 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
547 | "Received inbound message of type %d from `%s'.\n", | 637 | "Received inbound message from `%s'.\n", |
548 | (int) et, | ||
549 | GNUNET_i2s (&ntm->peer)); | 638 | GNUNET_i2s (&ntm->peer)); |
550 | for (unsigned int hpos = 0; NULL != h->handlers[hpos].callback; hpos++) | ||
551 | { | ||
552 | const struct GNUNET_CORE_MessageHandler *mh; | ||
553 | |||
554 | mh = &h->handlers[hpos]; | ||
555 | if (mh->type != et) | ||
556 | continue; | ||
557 | if ( (mh->expected_size != ntohs (em->size)) && | ||
558 | (0 != mh->expected_size) ) | ||
559 | { | ||
560 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
561 | "Unexpected message size %u for message of type %u from peer `%s'\n", | ||
562 | htons (em->size), | ||
563 | mh->type, | ||
564 | GNUNET_i2s (&ntm->peer)); | ||
565 | GNUNET_break_op (0); | ||
566 | continue; | ||
567 | } | ||
568 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, | ||
569 | &ntm->peer); | ||
570 | if (NULL == pr) | ||
571 | { | ||
572 | GNUNET_break (0); | ||
573 | reconnect_later (h); | ||
574 | return; | ||
575 | } | ||
576 | if (GNUNET_OK != | ||
577 | h->handlers[hpos].callback (h->cls, | ||
578 | &ntm->peer, | ||
579 | em)) | ||
580 | { | ||
581 | /* error in processing, do not process other messages! */ | ||
582 | break; | ||
583 | } | ||
584 | } | ||
585 | if (NULL != h->inbound_notify) | ||
586 | h->inbound_notify (h->cls, | ||
587 | &ntm->peer, | ||
588 | em); | ||
589 | } | ||
590 | |||
591 | |||
592 | /** | ||
593 | * Check that message received from CORE service is well-formed. | ||
594 | * | ||
595 | * @param cls the `struct GNUNET_CORE_Handle` | ||
596 | * @param ntm the message we got | ||
597 | * @return #GNUNET_OK if the message is well-formed | ||
598 | */ | ||
599 | static int | ||
600 | check_notify_outbound (void *cls, | ||
601 | const struct NotifyTrafficMessage *ntm) | ||
602 | { | ||
603 | struct GNUNET_CORE_Handle *h = cls; | ||
604 | uint16_t msize; | ||
605 | const struct GNUNET_MessageHeader *em; | ||
606 | |||
607 | GNUNET_break (GNUNET_NO == h->currently_down); | ||
608 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
609 | "Received outbound message from `%s'.\n", | ||
610 | GNUNET_i2s (&ntm->peer)); | ||
611 | msize = ntohs (ntm->header.size) - sizeof (struct NotifyTrafficMessage); | ||
612 | if (msize < sizeof (struct GNUNET_MessageHeader)) | ||
613 | { | ||
614 | GNUNET_break (0); | ||
615 | return GNUNET_SYSERR; | ||
616 | } | ||
617 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; | ||
618 | if ( (GNUNET_NO == h->outbound_hdr_only) && | ||
619 | (msize != ntohs (em->size)) ) | ||
620 | { | ||
621 | GNUNET_break (0); | ||
622 | return GNUNET_SYSERR; | ||
623 | } | ||
624 | return GNUNET_OK; | ||
625 | } | ||
626 | |||
627 | |||
628 | /** | ||
629 | * Handle outbound message received from CORE service. If applicable, | ||
630 | * notify the application. | ||
631 | * | ||
632 | * @param cls the `struct GNUNET_CORE_Handle` | ||
633 | * @param ntm the message we got | ||
634 | */ | ||
635 | static void | ||
636 | handle_notify_outbound (void *cls, | ||
637 | const struct NotifyTrafficMessage *ntm) | ||
638 | { | ||
639 | struct GNUNET_CORE_Handle *h = cls; | ||
640 | const struct GNUNET_MessageHeader *em; | ||
641 | |||
642 | GNUNET_break (GNUNET_NO == h->currently_down); | ||
643 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; | 639 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; |
644 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 640 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, |
645 | "Received notification about transmission to `%s'.\n", | 641 | &ntm->peer); |
646 | GNUNET_i2s (&ntm->peer)); | 642 | if (NULL == pr) |
647 | if (NULL == h->outbound_notify) | ||
648 | { | 643 | { |
649 | GNUNET_break (0); | 644 | GNUNET_break (0); |
645 | reconnect_later (h); | ||
650 | return; | 646 | return; |
651 | } | 647 | } |
652 | h->outbound_notify (h->cls, | 648 | GNUNET_MQ_inject_message (pr->mq, |
653 | &ntm->peer, | 649 | em); |
654 | em); | ||
655 | } | 650 | } |
656 | 651 | ||
657 | 652 | ||
@@ -661,7 +656,7 @@ handle_notify_outbound (void *cls, | |||
661 | * pending, put it into the queue to be transmitted. | 656 | * pending, put it into the queue to be transmitted. |
662 | * | 657 | * |
663 | * @param cls the `struct GNUNET_CORE_Handle` | 658 | * @param cls the `struct GNUNET_CORE_Handle` |
664 | * @param ntm the message we got | 659 | * @param smr the message we got |
665 | */ | 660 | */ |
666 | static void | 661 | static void |
667 | handle_send_ready (void *cls, | 662 | handle_send_ready (void *cls, |
@@ -669,16 +664,7 @@ handle_send_ready (void *cls, | |||
669 | { | 664 | { |
670 | struct GNUNET_CORE_Handle *h = cls; | 665 | struct GNUNET_CORE_Handle *h = cls; |
671 | struct PeerRecord *pr; | 666 | struct PeerRecord *pr; |
672 | struct GNUNET_CORE_TransmitHandle *th; | ||
673 | struct SendMessage *sm; | ||
674 | struct GNUNET_MQ_Envelope *env; | ||
675 | struct GNUNET_TIME_Relative delay; | ||
676 | struct GNUNET_TIME_Relative overdue; | ||
677 | unsigned int ret; | ||
678 | unsigned int priority; | ||
679 | int cork; | ||
680 | 667 | ||
681 | GNUNET_break (GNUNET_NO == h->currently_down); | ||
682 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, | 668 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, |
683 | &smr->peer); | 669 | &smr->peer); |
684 | if (NULL == pr) | 670 | if (NULL == pr) |
@@ -690,72 +676,24 @@ handle_send_ready (void *cls, | |||
690 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 676 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
691 | "Received notification about transmission readiness to `%s'.\n", | 677 | "Received notification about transmission readiness to `%s'.\n", |
692 | GNUNET_i2s (&smr->peer)); | 678 | GNUNET_i2s (&smr->peer)); |
693 | if (NULL == pr->th.peer) | 679 | if (NULL == pr->env) |
694 | { | 680 | { |
695 | /* request must have been cancelled between the original request | 681 | /* request must have been cancelled between the original request |
696 | * and the response from CORE, ignore CORE's readiness */ | 682 | * and the response from CORE, ignore CORE's readiness */ |
697 | return; | 683 | return; |
698 | } | 684 | } |
699 | th = &pr->th; | 685 | if (ntohs (smr->smr_id) != pr->smr_id_gen) |
700 | if (ntohs (smr->smr_id) != th->smr_id) | ||
701 | { | 686 | { |
702 | /* READY message is for expired or cancelled message, | 687 | /* READY message is for expired or cancelled message, |
703 | * ignore! (we should have already sent another request) */ | 688 | * ignore! (we should have already sent another request) */ |
704 | return; | 689 | return; |
705 | } | 690 | } |
691 | |||
706 | /* ok, all good, send message out! */ | 692 | /* ok, all good, send message out! */ |
707 | th->peer = NULL; | ||
708 | env = GNUNET_MQ_msg_extra (sm, | ||
709 | th->msize, | ||
710 | GNUNET_MESSAGE_TYPE_CORE_SEND); | ||
711 | sm->priority = htonl ((uint32_t) th->priority); | ||
712 | sm->deadline = GNUNET_TIME_absolute_hton (th->deadline); | ||
713 | sm->peer = pr->peer; | ||
714 | sm->cork = htonl ((uint32_t) (cork = th->cork)); | ||
715 | sm->reserved = htonl (0); | ||
716 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
717 | "Calling get_message with buffer of %u bytes (%s)\n", | ||
718 | (unsigned int) th->msize, | ||
719 | cork ? "corked" : "uncorked"); | ||
720 | /* FIXME: this is ugly and a bit brutal, but "get_message" | ||
721 | may call GNUNET_CORE_notify_transmit_ready() which | ||
722 | may call GNUNET_MQ_send() as well, and we MUST get this | ||
723 | message out before the next SEND_REQUEST. So we queue | ||
724 | it (even though incomplete) and then---relying on MQ being | ||
725 | nice and not actually touching 'env' until much later--- | ||
726 | fill it afterwards. This is horrible style, and once | ||
727 | the core_api abandons GNUNET_CORE_notify_transmit_ready | ||
728 | in favor of an MQ-style API, this hack should no longer | ||
729 | be required */ | ||
730 | GNUNET_MQ_send (h->mq, | 693 | GNUNET_MQ_send (h->mq, |
731 | env); | 694 | pr->env); |
732 | delay = GNUNET_TIME_absolute_get_duration (th->request_time); | 695 | pr->env = NULL; |
733 | overdue = GNUNET_TIME_absolute_get_duration (th->deadline); | 696 | GNUNET_MQ_impl_send_continue (pr->mq); |
734 | priority = th->priority; | ||
735 | ret = th->get_message (th->get_message_cls, | ||
736 | th->msize, | ||
737 | &sm[1]); | ||
738 | /* after this point, 'th' should not be used anymore, it | ||
739 | may now be about another message! */ | ||
740 | sm->header.size = htons (ret + sizeof (struct SendMessage)); | ||
741 | if (overdue.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us) | ||
742 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
743 | "Transmitting overdue %u bytes to `%s' at priority %u with %s delay %s\n", | ||
744 | ret, | ||
745 | GNUNET_i2s (&pr->peer), | ||
746 | priority, | ||
747 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
748 | GNUNET_YES), | ||
749 | (cork) ? " (corked)" : " (uncorked)"); | ||
750 | else | ||
751 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
752 | "Transmitting %u bytes to `%s' at priority %u with %s delay %s\n", | ||
753 | ret, | ||
754 | GNUNET_i2s (&pr->peer), | ||
755 | priority, | ||
756 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
757 | GNUNET_YES), | ||
758 | (cork) ? " (corked)" : " (uncorked)"); | ||
759 | } | 697 | } |
760 | 698 | ||
761 | 699 | ||
@@ -785,10 +723,6 @@ reconnect (struct GNUNET_CORE_Handle *h) | |||
785 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND, | 723 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND, |
786 | struct NotifyTrafficMessage, | 724 | struct NotifyTrafficMessage, |
787 | h), | 725 | h), |
788 | GNUNET_MQ_hd_var_size (notify_outbound, | ||
789 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND, | ||
790 | struct NotifyTrafficMessage, | ||
791 | h), | ||
792 | GNUNET_MQ_hd_fixed_size (send_ready, | 726 | GNUNET_MQ_hd_fixed_size (send_ready, |
793 | GNUNET_MESSAGE_TYPE_CORE_SEND_READY, | 727 | GNUNET_MESSAGE_TYPE_CORE_SEND_READY, |
794 | struct SendMessageReady, | 728 | struct SendMessageReady, |
@@ -797,12 +731,10 @@ reconnect (struct GNUNET_CORE_Handle *h) | |||
797 | }; | 731 | }; |
798 | struct InitMessage *init; | 732 | struct InitMessage *init; |
799 | struct GNUNET_MQ_Envelope *env; | 733 | struct GNUNET_MQ_Envelope *env; |
800 | uint32_t opt; | ||
801 | uint16_t *ts; | 734 | uint16_t *ts; |
802 | 735 | ||
803 | GNUNET_assert (NULL == h->mq); | 736 | GNUNET_assert (NULL == h->mq); |
804 | GNUNET_assert (GNUNET_YES == h->currently_down); | 737 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
805 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | ||
806 | "core", | 738 | "core", |
807 | handlers, | 739 | handlers, |
808 | &handle_mq_error, | 740 | &handle_mq_error, |
@@ -815,25 +747,9 @@ reconnect (struct GNUNET_CORE_Handle *h) | |||
815 | env = GNUNET_MQ_msg_extra (init, | 747 | env = GNUNET_MQ_msg_extra (init, |
816 | sizeof (uint16_t) * h->hcnt, | 748 | sizeof (uint16_t) * h->hcnt, |
817 | GNUNET_MESSAGE_TYPE_CORE_INIT); | 749 | GNUNET_MESSAGE_TYPE_CORE_INIT); |
818 | opt = GNUNET_CORE_OPTION_NOTHING; | ||
819 | if (NULL != h->inbound_notify) | ||
820 | { | ||
821 | if (h->inbound_hdr_only) | ||
822 | opt |= GNUNET_CORE_OPTION_SEND_HDR_INBOUND; | ||
823 | else | ||
824 | opt |= GNUNET_CORE_OPTION_SEND_FULL_INBOUND; | ||
825 | } | ||
826 | if (NULL != h->outbound_notify) | ||
827 | { | ||
828 | if (h->outbound_hdr_only) | ||
829 | opt |= GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND; | ||
830 | else | ||
831 | opt |= GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND; | ||
832 | } | ||
833 | LOG (GNUNET_ERROR_TYPE_INFO, | 750 | LOG (GNUNET_ERROR_TYPE_INFO, |
834 | "(Re)connecting to CORE service, monitoring messages of type %u\n", | 751 | "(Re)connecting to CORE service\n"); |
835 | opt); | 752 | init->options = htonl (0); |
836 | init->options = htonl (opt); | ||
837 | ts = (uint16_t *) &init[1]; | 753 | ts = (uint16_t *) &init[1]; |
838 | for (unsigned int hpos = 0; hpos < h->hcnt; hpos++) | 754 | for (unsigned int hpos = 0; hpos < h->hcnt; hpos++) |
839 | ts[hpos] = htons (h->handlers[hpos].type); | 755 | ts[hpos] = htons (h->handlers[hpos].type); |
@@ -852,14 +768,6 @@ reconnect (struct GNUNET_CORE_Handle *h) | |||
852 | * connected to the core service | 768 | * connected to the core service |
853 | * @param connects function to call on peer connect, can be NULL | 769 | * @param connects function to call on peer connect, can be NULL |
854 | * @param disconnects function to call on peer disconnect / timeout, can be NULL | 770 | * @param disconnects function to call on peer disconnect / timeout, can be NULL |
855 | * @param inbound_notify function to call for all inbound messages, can be NULL | ||
856 | * @param inbound_hdr_only set to #GNUNET_YES if inbound_notify will only read the | ||
857 | * GNUNET_MessageHeader and hence we do not need to give it the full message; | ||
858 | * can be used to improve efficiency, ignored if @a inbound_notify is NULL | ||
859 | * @param outbound_notify function to call for all outbound messages, can be NULL | ||
860 | * @param outbound_hdr_only set to #GNUNET_YES if outbound_notify will only read the | ||
861 | * GNUNET_MessageHeader and hence we do not need to give it the full message | ||
862 | * can be used to improve efficiency, ignored if @a outbound_notify is NULL | ||
863 | * @param handlers callbacks for messages we care about, NULL-terminated | 771 | * @param handlers callbacks for messages we care about, NULL-terminated |
864 | * @return handle to the core service (only useful for disconnect until @a init is called); | 772 | * @return handle to the core service (only useful for disconnect until @a init is called); |
865 | * NULL on error (in this case, init is never called) | 773 | * NULL on error (in this case, init is never called) |
@@ -870,11 +778,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
870 | GNUNET_CORE_StartupCallback init, | 778 | GNUNET_CORE_StartupCallback init, |
871 | GNUNET_CORE_ConnectEventHandler connects, | 779 | GNUNET_CORE_ConnectEventHandler connects, |
872 | GNUNET_CORE_DisconnectEventHandler disconnects, | 780 | GNUNET_CORE_DisconnectEventHandler disconnects, |
873 | GNUNET_CORE_MessageCallback inbound_notify, | 781 | const struct GNUNET_MQ_MessageHandler *handlers) |
874 | int inbound_hdr_only, | ||
875 | GNUNET_CORE_MessageCallback outbound_notify, | ||
876 | int outbound_hdr_only, | ||
877 | const struct GNUNET_CORE_MessageHandler *handlers) | ||
878 | { | 782 | { |
879 | struct GNUNET_CORE_Handle *h; | 783 | struct GNUNET_CORE_Handle *h; |
880 | unsigned int hcnt; | 784 | unsigned int hcnt; |
@@ -885,22 +789,18 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
885 | h->init = init; | 789 | h->init = init; |
886 | h->connects = connects; | 790 | h->connects = connects; |
887 | h->disconnects = disconnects; | 791 | h->disconnects = disconnects; |
888 | h->inbound_notify = inbound_notify; | 792 | h->peers = GNUNET_CONTAINER_multipeermap_create (128, |
889 | h->outbound_notify = outbound_notify; | 793 | GNUNET_NO); |
890 | h->inbound_hdr_only = inbound_hdr_only; | ||
891 | h->outbound_hdr_only = outbound_hdr_only; | ||
892 | h->currently_down = GNUNET_YES; | ||
893 | h->peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); | ||
894 | hcnt = 0; | 794 | hcnt = 0; |
895 | if (NULL != handlers) | 795 | if (NULL != handlers) |
896 | while (NULL != handlers[hcnt].callback) | 796 | while (NULL != handlers[hcnt].cb) |
897 | hcnt++; | 797 | hcnt++; |
898 | h->handlers = GNUNET_new_array (hcnt + 1, | 798 | h->handlers = GNUNET_new_array (hcnt + 1, |
899 | struct GNUNET_CORE_MessageHandler); | 799 | struct GNUNET_MQ_MessageHandler); |
900 | if (NULL != handlers) | 800 | if (NULL != handlers) |
901 | GNUNET_memcpy (h->handlers, | 801 | GNUNET_memcpy (h->handlers, |
902 | handlers, | 802 | handlers, |
903 | hcnt * sizeof (struct GNUNET_CORE_MessageHandler)); | 803 | hcnt * sizeof (struct GNUNET_MQ_MessageHandler)); |
904 | h->hcnt = hcnt; | 804 | h->hcnt = hcnt; |
905 | GNUNET_assert (hcnt < | 805 | GNUNET_assert (hcnt < |
906 | (GNUNET_SERVER_MAX_MESSAGE_SIZE - | 806 | (GNUNET_SERVER_MAX_MESSAGE_SIZE - |
@@ -918,9 +818,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
918 | 818 | ||
919 | 819 | ||
920 | /** | 820 | /** |
921 | * Disconnect from the core service. This function can only | 821 | * Disconnect from the core service. |
922 | * be called *after* all pending #GNUNET_CORE_notify_transmit_ready() | ||
923 | * requests have been explicitly canceled. | ||
924 | * | 822 | * |
925 | * @param handle connection to core to disconnect | 823 | * @param handle connection to core to disconnect |
926 | */ | 824 | */ |
@@ -950,148 +848,23 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) | |||
950 | 848 | ||
951 | 849 | ||
952 | /** | 850 | /** |
953 | * Ask the core to call @a notify once it is ready to transmit the | 851 | * Obtain the message queue for a connected peer. |
954 | * given number of bytes to the specified @a target. Must only be | ||
955 | * called after a connection to the respective peer has been | ||
956 | * established (and the client has been informed about this). You may | ||
957 | * have one request of this type pending for each connected peer at | ||
958 | * any time. If a peer disconnects, the application MUST call | ||
959 | * #GNUNET_CORE_notify_transmit_ready_cancel on the respective | ||
960 | * transmission request, if one such request is pending. | ||
961 | * | 852 | * |
962 | * @param handle connection to core service | 853 | * @param h the core handle |
963 | * @param cork is corking allowed for this transmission? | 854 | * @param pid the identity of the peer to check if it has been connected to us |
964 | * @param priority how important is the message? | 855 | * @return NULL if peer is not connected |
965 | * @param maxdelay how long can the message wait? Only effective if @a cork is #GNUNET_YES | ||
966 | * @param target who should receive the message, never NULL (can be this peer's identity for loopback) | ||
967 | * @param notify_size how many bytes of buffer space does @a notify want? | ||
968 | * @param notify function to call when buffer space is available; | ||
969 | * will be called with NULL on timeout; clients MUST cancel | ||
970 | * all pending transmission requests DURING the disconnect | ||
971 | * handler | ||
972 | * @param notify_cls closure for @a notify | ||
973 | * @return non-NULL if the notify callback was queued, | ||
974 | * NULL if we can not even queue the request (request already pending); | ||
975 | * if NULL is returned, @a notify will NOT be called. | ||
976 | */ | 856 | */ |
977 | struct GNUNET_CORE_TransmitHandle * | 857 | struct GNUNET_MQ_Handle * |
978 | GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, | 858 | GNUNET_CORE_get_mq (const struct GNUNET_CORE_Handle *h, |
979 | int cork, | 859 | const struct GNUNET_PeerIdentity *pid) |
980 | enum GNUNET_CORE_Priority priority, | ||
981 | struct GNUNET_TIME_Relative maxdelay, | ||
982 | const struct GNUNET_PeerIdentity *target, | ||
983 | size_t notify_size, | ||
984 | GNUNET_CONNECTION_TransmitReadyNotify notify, | ||
985 | void *notify_cls) | ||
986 | { | 860 | { |
987 | struct PeerRecord *pr; | 861 | struct PeerRecord *pr; |
988 | struct GNUNET_CORE_TransmitHandle *th; | ||
989 | struct SendMessageRequest *smr; | ||
990 | struct GNUNET_MQ_Envelope *env; | ||
991 | 862 | ||
992 | if (NULL == handle->mq) | 863 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, |
993 | { | 864 | pid); |
994 | GNUNET_break (0); /* SEE #4588: do not call NTR from disconnect notification! */ | ||
995 | return NULL; | ||
996 | } | ||
997 | GNUNET_assert (NULL != notify); | ||
998 | if ( (notify_size > GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE) || | ||
999 | (notify_size + sizeof (struct SendMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ) | ||
1000 | { | ||
1001 | GNUNET_break (0); | ||
1002 | return NULL; | ||
1003 | } | ||
1004 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1005 | "Asking core for transmission of %u bytes to `%s'%s\n", | ||
1006 | (unsigned int) notify_size, | ||
1007 | GNUNET_i2s (target), | ||
1008 | cork ? " (corked)" : ""); | ||
1009 | pr = GNUNET_CONTAINER_multipeermap_get (handle->peers, | ||
1010 | target); | ||
1011 | if (NULL == pr) | 865 | if (NULL == pr) |
1012 | { | ||
1013 | /* attempt to send to peer that is not connected */ | ||
1014 | GNUNET_break (0); | ||
1015 | return NULL; | 866 | return NULL; |
1016 | } | 867 | return pr->mq; |
1017 | if (NULL != pr->th.peer) | ||
1018 | { | ||
1019 | /* attempting to queue a second request for the same destination */ | ||
1020 | GNUNET_break (0); | ||
1021 | return NULL; | ||
1022 | } | ||
1023 | th = &pr->th; | ||
1024 | memset (th, | ||
1025 | 0, | ||
1026 | sizeof (struct GNUNET_CORE_TransmitHandle)); | ||
1027 | th->peer = pr; | ||
1028 | th->get_message = notify; | ||
1029 | th->get_message_cls = notify_cls; | ||
1030 | th->request_time = GNUNET_TIME_absolute_get (); | ||
1031 | if (GNUNET_YES == cork) | ||
1032 | th->deadline = GNUNET_TIME_relative_to_absolute (maxdelay); | ||
1033 | else | ||
1034 | th->deadline = th->request_time; | ||
1035 | th->priority = priority; | ||
1036 | th->msize = notify_size; | ||
1037 | th->cork = cork; | ||
1038 | if (NULL == handle->mq) | ||
1039 | return th; /* see #4588 (hack until we transition core fully to MQ) */ | ||
1040 | env = GNUNET_MQ_msg (smr, | ||
1041 | GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST); | ||
1042 | smr->priority = htonl ((uint32_t) th->priority); | ||
1043 | smr->deadline = GNUNET_TIME_absolute_hton (th->deadline); | ||
1044 | smr->peer = pr->peer; | ||
1045 | smr->reserved = htonl (0); | ||
1046 | smr->size = htons (th->msize); | ||
1047 | smr->smr_id = htons (th->smr_id = pr->smr_id_gen++); | ||
1048 | GNUNET_MQ_send (handle->mq, | ||
1049 | env); | ||
1050 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1051 | "Transmission request added to queue\n"); | ||
1052 | return th; | ||
1053 | } | ||
1054 | |||
1055 | |||
1056 | /** | ||
1057 | * Cancel the specified transmission-ready notification. | ||
1058 | * | ||
1059 | * @param th handle that was returned by #GNUNET_CORE_notify_transmit_ready(). | ||
1060 | */ | ||
1061 | void | ||
1062 | GNUNET_CORE_notify_transmit_ready_cancel (struct GNUNET_CORE_TransmitHandle *th) | ||
1063 | { | ||
1064 | struct PeerRecord *pr = th->peer; | ||
1065 | |||
1066 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1067 | "Aborting transmission request to core for %u bytes to `%s'\n", | ||
1068 | (unsigned int) th->msize, | ||
1069 | GNUNET_i2s (&pr->peer)); | ||
1070 | th->peer = NULL; | ||
1071 | } | ||
1072 | |||
1073 | |||
1074 | /** | ||
1075 | * Check if the given peer is currently connected. This function is for special | ||
1076 | * cirumstances (GNUNET_TESTBED uses it), normal users of the CORE API are | ||
1077 | * expected to track which peers are connected based on the connect/disconnect | ||
1078 | * callbacks from #GNUNET_CORE_connect(). This function is NOT part of the | ||
1079 | * 'versioned', 'official' API. The difference between this function and the | ||
1080 | * function GNUNET_CORE_is_peer_connected() is that this one returns | ||
1081 | * synchronously after looking in the CORE API cache. The function | ||
1082 | * GNUNET_CORE_is_peer_connected() sends a message to the CORE service and hence | ||
1083 | * its response is given asynchronously. | ||
1084 | * | ||
1085 | * @param h the core handle | ||
1086 | * @param pid the identity of the peer to check if it has been connected to us | ||
1087 | * @return #GNUNET_YES if the peer is connected to us; #GNUNET_NO if not | ||
1088 | */ | ||
1089 | int | ||
1090 | GNUNET_CORE_is_peer_connected_sync (const struct GNUNET_CORE_Handle *h, | ||
1091 | const struct GNUNET_PeerIdentity *pid) | ||
1092 | { | ||
1093 | return GNUNET_CONTAINER_multipeermap_contains (h->peers, | ||
1094 | pid); | ||
1095 | } | 868 | } |
1096 | 869 | ||
1097 | 870 | ||
diff --git a/src/core/core_api_2.c b/src/core/core_api_2.c deleted file mode 100644 index d810bf2ec..000000000 --- a/src/core/core_api_2.c +++ /dev/null | |||
@@ -1,865 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009-2016 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file core/core_api_2.c | ||
22 | * @brief core service; this is the main API for encrypted P2P | ||
23 | * communications | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_constants.h" | ||
29 | #include "gnunet_core_service.h" | ||
30 | #include "core.h" | ||
31 | |||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "core-api",__VA_ARGS__) | ||
33 | |||
34 | |||
35 | /** | ||
36 | * Information we track for each peer. | ||
37 | */ | ||
38 | struct PeerRecord | ||
39 | { | ||
40 | |||
41 | /** | ||
42 | * Corresponding CORE handle. | ||
43 | */ | ||
44 | struct GNUNET_CORE_Handle *h; | ||
45 | |||
46 | /** | ||
47 | * Message queue for the peer. | ||
48 | */ | ||
49 | struct GNUNET_MQ_Handle *mq; | ||
50 | |||
51 | /** | ||
52 | * Message we are currently trying to pass to the CORE service | ||
53 | * for this peer (from @e mq). | ||
54 | */ | ||
55 | struct GNUNET_MQ_Envelope *env; | ||
56 | |||
57 | /** | ||
58 | * Value the client returned when we connected, used | ||
59 | * as the closure in various places. | ||
60 | */ | ||
61 | void *client_cls; | ||
62 | |||
63 | /** | ||
64 | * Peer the record is about. | ||
65 | */ | ||
66 | struct GNUNET_PeerIdentity peer; | ||
67 | |||
68 | /** | ||
69 | * SendMessageRequest ID generator for this peer. | ||
70 | */ | ||
71 | uint16_t smr_id_gen; | ||
72 | |||
73 | }; | ||
74 | |||
75 | |||
76 | /** | ||
77 | * Context for the core service connection. | ||
78 | */ | ||
79 | struct GNUNET_CORE_Handle | ||
80 | { | ||
81 | |||
82 | /** | ||
83 | * Configuration we're using. | ||
84 | */ | ||
85 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
86 | |||
87 | /** | ||
88 | * Closure for the various callbacks. | ||
89 | */ | ||
90 | void *cls; | ||
91 | |||
92 | /** | ||
93 | * Function to call once we've handshaked with the core service. | ||
94 | */ | ||
95 | GNUNET_CORE_StartupCallback init; | ||
96 | |||
97 | /** | ||
98 | * Function to call whenever we're notified about a peer connecting. | ||
99 | */ | ||
100 | GNUNET_CORE_ConnecTEventHandler connects; | ||
101 | |||
102 | /** | ||
103 | * Function to call whenever we're notified about a peer disconnecting. | ||
104 | */ | ||
105 | GNUNET_CORE_DisconnecTEventHandler disconnects; | ||
106 | |||
107 | /** | ||
108 | * Function handlers for messages of particular type. | ||
109 | */ | ||
110 | struct GNUNET_MQ_MessageHandler *handlers; | ||
111 | |||
112 | /** | ||
113 | * Our message queue for transmissions to the service. | ||
114 | */ | ||
115 | struct GNUNET_MQ_Handle *mq; | ||
116 | |||
117 | /** | ||
118 | * Hash map listing all of the peers that we are currently | ||
119 | * connected to. | ||
120 | */ | ||
121 | struct GNUNET_CONTAINER_MultiPeerMap *peers; | ||
122 | |||
123 | /** | ||
124 | * Identity of this peer. | ||
125 | */ | ||
126 | struct GNUNET_PeerIdentity me; | ||
127 | |||
128 | /** | ||
129 | * ID of reconnect task (if any). | ||
130 | */ | ||
131 | struct GNUNET_SCHEDULER_Task *reconnect_task; | ||
132 | |||
133 | /** | ||
134 | * Current delay we use for re-trying to connect to core. | ||
135 | */ | ||
136 | struct GNUNET_TIME_Relative retry_backoff; | ||
137 | |||
138 | /** | ||
139 | * Number of entries in the handlers array. | ||
140 | */ | ||
141 | unsigned int hcnt; | ||
142 | |||
143 | /** | ||
144 | * Did we ever get INIT? | ||
145 | */ | ||
146 | int have_init; | ||
147 | |||
148 | }; | ||
149 | |||
150 | |||
151 | /** | ||
152 | * Our current client connection went down. Clean it up | ||
153 | * and try to reconnect! | ||
154 | * | ||
155 | * @param h our handle to the core service | ||
156 | */ | ||
157 | static void | ||
158 | reconnect (struct GNUNET_CORE_Handle *h); | ||
159 | |||
160 | |||
161 | /** | ||
162 | * Task schedule to try to re-connect to core. | ||
163 | * | ||
164 | * @param cls the `struct GNUNET_CORE_Handle` | ||
165 | * @param tc task context | ||
166 | */ | ||
167 | static void | ||
168 | reconnect_task (void *cls) | ||
169 | { | ||
170 | struct GNUNET_CORE_Handle *h = cls; | ||
171 | |||
172 | h->reconnect_task = NULL; | ||
173 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
174 | "Connecting to CORE service after delay\n"); | ||
175 | reconnect (h); | ||
176 | } | ||
177 | |||
178 | |||
179 | /** | ||
180 | * Notify clients about disconnect and free the entry for connected | ||
181 | * peer. | ||
182 | * | ||
183 | * @param cls the `struct GNUNET_CORE_Handle *` | ||
184 | * @param key the peer identity (not used) | ||
185 | * @param value the `struct PeerRecord` to free. | ||
186 | * @return #GNUNET_YES (continue) | ||
187 | */ | ||
188 | static int | ||
189 | disconnect_and_free_peer_entry (void *cls, | ||
190 | const struct GNUNET_PeerIdentity *key, | ||
191 | void *value) | ||
192 | { | ||
193 | struct GNUNET_CORE_Handle *h = cls; | ||
194 | struct PeerRecord *pr = value; | ||
195 | |||
196 | GNUNET_assert (pr->h == h); | ||
197 | if (NULL != h->disconnects) | ||
198 | h->disconnects (h->cls, | ||
199 | &pr->peer, | ||
200 | pr->client_cls); | ||
201 | GNUNET_assert (GNUNET_YES == | ||
202 | GNUNET_CONTAINER_multipeermap_remove (h->peers, | ||
203 | key, | ||
204 | pr)); | ||
205 | GNUNET_MQ_destroy (pr->mq); | ||
206 | GNUNET_assert (NULL == pr->mq); | ||
207 | GNUNET_free (pr); | ||
208 | return GNUNET_YES; | ||
209 | } | ||
210 | |||
211 | |||
212 | /** | ||
213 | * Close down any existing connection to the CORE service and | ||
214 | * try re-establishing it later. | ||
215 | * | ||
216 | * @param h our handle | ||
217 | */ | ||
218 | static void | ||
219 | reconnect_later (struct GNUNET_CORE_Handle *h) | ||
220 | { | ||
221 | GNUNET_assert (NULL == h->reconnect_task); | ||
222 | if (NULL != h->mq) | ||
223 | { | ||
224 | GNUNET_MQ_destroy (h->mq); | ||
225 | h->mq = NULL; | ||
226 | } | ||
227 | GNUNET_assert (NULL == h->reconnect_task); | ||
228 | h->reconnect_task = | ||
229 | GNUNET_SCHEDULER_add_delayed (h->retry_backoff, | ||
230 | &reconnect_task, | ||
231 | h); | ||
232 | GNUNET_CONTAINER_multipeermap_iterate (h->peers, | ||
233 | &disconnect_and_free_peer_entry, | ||
234 | h); | ||
235 | h->retry_backoff = GNUNET_TIME_STD_BACKOFF (h->retry_backoff); | ||
236 | } | ||
237 | |||
238 | |||
239 | /** | ||
240 | * Error handler for the message queue to the CORE service. | ||
241 | * On errors, we reconnect. | ||
242 | * | ||
243 | * @param cls closure, a `struct GNUNET_CORE_Handle *` | ||
244 | * @param error error code | ||
245 | */ | ||
246 | static void | ||
247 | handle_mq_error (void *cls, | ||
248 | enum GNUNET_MQ_Error error) | ||
249 | { | ||
250 | struct GNUNET_CORE_Handle *h = cls; | ||
251 | |||
252 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
253 | "MQ ERROR: %d\n", | ||
254 | error); | ||
255 | reconnect_later (h); | ||
256 | } | ||
257 | |||
258 | |||
259 | /** | ||
260 | * Inquire with CORE what options should be set for a message | ||
261 | * so that it is transmitted with the given @a priority and | ||
262 | * the given @a cork value. | ||
263 | * | ||
264 | * @param cork desired corking | ||
265 | * @param priority desired message priority | ||
266 | * @param[out] flags set to `flags` value for #GNUNET_MQ_set_options() | ||
267 | * @return `extra` argument to give to #GNUNET_MQ_set_options() | ||
268 | */ | ||
269 | const void * | ||
270 | GNUNET_CORE_get_mq_options (int cork, | ||
271 | enum GNUNET_CORE_Priority priority, | ||
272 | uint64_t *flags) | ||
273 | { | ||
274 | *flags = ((uint64_t) priority) + (((uint64_t) cork) << 32); | ||
275 | return NULL; | ||
276 | } | ||
277 | |||
278 | |||
279 | /** | ||
280 | * Implement sending functionality of a message queue for | ||
281 | * us sending messages to a peer. | ||
282 | * | ||
283 | * @param mq the message queue | ||
284 | * @param msg the message to send | ||
285 | * @param impl_state state of the implementation | ||
286 | */ | ||
287 | static void | ||
288 | core_mq_send_impl (struct GNUNET_MQ_Handle *mq, | ||
289 | const struct GNUNET_MessageHeader *msg, | ||
290 | void *impl_state) | ||
291 | { | ||
292 | struct PeerRecord *pr = impl_state; | ||
293 | struct GNUNET_CORE_Handle *h = pr->h; | ||
294 | struct SendMessageRequest *smr; | ||
295 | struct SendMessage *sm; | ||
296 | struct GNUNET_MQ_Envelope *env; | ||
297 | uint16_t msize; | ||
298 | uint64_t flags; | ||
299 | int cork; | ||
300 | enum GNUNET_CORE_Priority priority; | ||
301 | |||
302 | GNUNET_assert (NULL == pr->env); | ||
303 | /* extract options from envelope */ | ||
304 | env = GNUNET_MQ_get_current_envelope (mq); | ||
305 | GNUNET_break (NULL == | ||
306 | GNUNET_MQ_env_get_options (env, | ||
307 | &flags)); | ||
308 | cork = (int) (flags >> 32); | ||
309 | priority = (uint32_t) flags; | ||
310 | |||
311 | /* check message size for sanity */ | ||
312 | msize = ntohs (msg->size); | ||
313 | if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct SendMessage)) | ||
314 | { | ||
315 | GNUNET_break (0); | ||
316 | GNUNET_MQ_impl_send_continue (mq); | ||
317 | return; | ||
318 | } | ||
319 | |||
320 | /* ask core for transmission */ | ||
321 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
322 | "Asking core for transmission of %u bytes to `%s'\n", | ||
323 | (unsigned int) msize, | ||
324 | GNUNET_i2s (&pr->peer)); | ||
325 | env = GNUNET_MQ_msg (smr, | ||
326 | GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST); | ||
327 | smr->priority = htonl ((uint32_t) priority); | ||
328 | // smr->deadline = GNUNET_TIME_absolute_hton (deadline); | ||
329 | smr->peer = pr->peer; | ||
330 | smr->reserved = htonl (0); | ||
331 | smr->size = htons (msize); | ||
332 | smr->smr_id = htons (++pr->smr_id_gen); | ||
333 | GNUNET_MQ_send (h->mq, | ||
334 | env); | ||
335 | |||
336 | /* prepare message with actual transmission data */ | ||
337 | pr->env = GNUNET_MQ_msg_nested_mh (sm, | ||
338 | GNUNET_MESSAGE_TYPE_CORE_SEND, | ||
339 | msg); | ||
340 | sm->priority = htonl ((uint32_t) priority); | ||
341 | // sm->deadline = GNUNET_TIME_absolute_hton (deadline); | ||
342 | sm->peer = pr->peer; | ||
343 | sm->cork = htonl ((uint32_t) cork); | ||
344 | sm->reserved = htonl (0); | ||
345 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
346 | "Calling get_message with buffer of %u bytes (%s)\n", | ||
347 | (unsigned int) msize, | ||
348 | cork ? "corked" : "uncorked"); | ||
349 | } | ||
350 | |||
351 | |||
352 | /** | ||
353 | * Handle destruction of a message queue. Implementations must not | ||
354 | * free @a mq, but should take care of @a impl_state. | ||
355 | * | ||
356 | * @param mq the message queue to destroy | ||
357 | * @param impl_state state of the implementation | ||
358 | */ | ||
359 | static void | ||
360 | core_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, | ||
361 | void *impl_state) | ||
362 | { | ||
363 | struct PeerRecord *pr = impl_state; | ||
364 | |||
365 | GNUNET_assert (mq == pr->mq); | ||
366 | pr->mq = NULL; | ||
367 | } | ||
368 | |||
369 | |||
370 | /** | ||
371 | * Implementation function that cancels the currently sent message. | ||
372 | * Should basically undo whatever #mq_send_impl() did. | ||
373 | * | ||
374 | * @param mq message queue | ||
375 | * @param impl_state state specific to the implementation | ||
376 | */ | ||
377 | static void | ||
378 | core_mq_cancel_impl (struct GNUNET_MQ_Handle *mq, | ||
379 | void *impl_state) | ||
380 | { | ||
381 | struct PeerRecord *pr = impl_state; | ||
382 | |||
383 | GNUNET_assert (NULL != pr->env); | ||
384 | GNUNET_MQ_discard (pr->env); | ||
385 | pr->env = NULL; | ||
386 | } | ||
387 | |||
388 | |||
389 | /** | ||
390 | * We had an error processing a message we forwarded from a peer to | ||
391 | * the CORE service. We should just complain about it but otherwise | ||
392 | * continue processing. | ||
393 | * | ||
394 | * @param cls closure | ||
395 | * @param error error code | ||
396 | */ | ||
397 | static void | ||
398 | core_mq_error_handler (void *cls, | ||
399 | enum GNUNET_MQ_Error error) | ||
400 | { | ||
401 | /* struct PeerRecord *pr = cls; */ | ||
402 | |||
403 | GNUNET_break_op (0); | ||
404 | } | ||
405 | |||
406 | |||
407 | /** | ||
408 | * Add the given peer to the list of our connected peers | ||
409 | * and create the respective data structures and notify | ||
410 | * the application. | ||
411 | * | ||
412 | * @param h the core handle | ||
413 | * @param peer the peer that is connecting to us | ||
414 | */ | ||
415 | static void | ||
416 | connect_peer (struct GNUNET_CORE_Handle *h, | ||
417 | const struct GNUNET_PeerIdentity *peer) | ||
418 | { | ||
419 | struct PeerRecord *pr; | ||
420 | uint64_t flags; | ||
421 | const void *extra; | ||
422 | |||
423 | pr = GNUNET_new (struct PeerRecord); | ||
424 | pr->peer = *peer; | ||
425 | pr->h = h; | ||
426 | GNUNET_assert (GNUNET_YES == | ||
427 | GNUNET_CONTAINER_multipeermap_put (h->peers, | ||
428 | &pr->peer, | ||
429 | pr, | ||
430 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
431 | pr->mq = GNUNET_MQ_queue_for_callbacks (&core_mq_send_impl, | ||
432 | &core_mq_destroy_impl, | ||
433 | &core_mq_cancel_impl, | ||
434 | pr, | ||
435 | h->handlers, | ||
436 | &core_mq_error_handler, | ||
437 | pr); | ||
438 | /* get our default options */ | ||
439 | extra = GNUNET_CORE_get_mq_options (GNUNET_NO, | ||
440 | GNUNET_CORE_PRIO_BEST_EFFORT, | ||
441 | &flags); | ||
442 | GNUNET_MQ_set_options (pr->mq, | ||
443 | flags, | ||
444 | extra); | ||
445 | if (NULL != h->connects) | ||
446 | { | ||
447 | pr->client_cls = h->connects (h->cls, | ||
448 | &pr->peer, | ||
449 | pr->mq); | ||
450 | GNUNET_MQ_set_handlers_closure (pr->mq, | ||
451 | pr->client_cls); | ||
452 | } | ||
453 | } | ||
454 | |||
455 | |||
456 | /** | ||
457 | * Handle init reply message received from CORE service. Notify | ||
458 | * application that we are now connected to the CORE. Also fake | ||
459 | * loopback connection. | ||
460 | * | ||
461 | * @param cls the `struct GNUNET_CORE_Handle` | ||
462 | * @param m the init reply | ||
463 | */ | ||
464 | static void | ||
465 | handle_init_reply (void *cls, | ||
466 | const struct InitReplyMessage *m) | ||
467 | { | ||
468 | struct GNUNET_CORE_Handle *h = cls; | ||
469 | GNUNET_CORE_StartupCallback init; | ||
470 | |||
471 | GNUNET_break (0 == ntohl (m->reserved)); | ||
472 | h->retry_backoff = GNUNET_TIME_UNIT_MILLISECONDS; | ||
473 | if (NULL != (init = h->init)) | ||
474 | { | ||
475 | /* mark so we don't call init on reconnect */ | ||
476 | h->init = NULL; | ||
477 | h->me = m->my_identity; | ||
478 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
479 | "Connected to core service of peer `%s'.\n", | ||
480 | GNUNET_i2s (&h->me)); | ||
481 | h->have_init = GNUNET_YES; | ||
482 | init (h->cls, | ||
483 | &h->me); | ||
484 | } | ||
485 | else | ||
486 | { | ||
487 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
488 | "Successfully reconnected to core service.\n"); | ||
489 | if (GNUNET_NO == h->have_init) | ||
490 | { | ||
491 | h->me = m->my_identity; | ||
492 | h->have_init = GNUNET_YES; | ||
493 | } | ||
494 | else | ||
495 | { | ||
496 | GNUNET_break (0 == memcmp (&h->me, | ||
497 | &m->my_identity, | ||
498 | sizeof (struct GNUNET_PeerIdentity))); | ||
499 | } | ||
500 | } | ||
501 | /* fake 'connect to self' */ | ||
502 | connect_peer (h, | ||
503 | &h->me); | ||
504 | } | ||
505 | |||
506 | |||
507 | /** | ||
508 | * Handle connect message received from CORE service. | ||
509 | * Notify the application about the new connection. | ||
510 | * | ||
511 | * @param cls the `struct GNUNET_CORE_Handle` | ||
512 | * @param cnm the connect message | ||
513 | */ | ||
514 | static void | ||
515 | handle_connect_notify (void *cls, | ||
516 | const struct ConnectNotifyMessage *cnm) | ||
517 | { | ||
518 | struct GNUNET_CORE_Handle *h = cls; | ||
519 | struct PeerRecord *pr; | ||
520 | |||
521 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
522 | "Received notification about connection from `%s'.\n", | ||
523 | GNUNET_i2s (&cnm->peer)); | ||
524 | if (0 == memcmp (&h->me, | ||
525 | &cnm->peer, | ||
526 | sizeof (struct GNUNET_PeerIdentity))) | ||
527 | { | ||
528 | /* connect to self!? */ | ||
529 | GNUNET_break (0); | ||
530 | return; | ||
531 | } | ||
532 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, | ||
533 | &cnm->peer); | ||
534 | if (NULL != pr) | ||
535 | { | ||
536 | GNUNET_break (0); | ||
537 | reconnect_later (h); | ||
538 | return; | ||
539 | } | ||
540 | connect_peer (h, | ||
541 | &cnm->peer); | ||
542 | } | ||
543 | |||
544 | |||
545 | /** | ||
546 | * Handle disconnect message received from CORE service. | ||
547 | * Notify the application about the lost connection. | ||
548 | * | ||
549 | * @param cls the `struct GNUNET_CORE_Handle` | ||
550 | * @param dnm message about the disconnect event | ||
551 | */ | ||
552 | static void | ||
553 | handle_disconnect_notify (void *cls, | ||
554 | const struct DisconnectNotifyMessage *dnm) | ||
555 | { | ||
556 | struct GNUNET_CORE_Handle *h = cls; | ||
557 | struct PeerRecord *pr; | ||
558 | |||
559 | if (0 == memcmp (&h->me, | ||
560 | &dnm->peer, | ||
561 | sizeof (struct GNUNET_PeerIdentity))) | ||
562 | { | ||
563 | /* disconnect from self!? */ | ||
564 | GNUNET_break (0); | ||
565 | return; | ||
566 | } | ||
567 | GNUNET_break (0 == ntohl (dnm->reserved)); | ||
568 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
569 | "Received notification about disconnect from `%s'.\n", | ||
570 | GNUNET_i2s (&dnm->peer)); | ||
571 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, | ||
572 | &dnm->peer); | ||
573 | if (NULL == pr) | ||
574 | { | ||
575 | GNUNET_break (0); | ||
576 | reconnect_later (h); | ||
577 | return; | ||
578 | } | ||
579 | disconnect_and_free_peer_entry (h, | ||
580 | &pr->peer, | ||
581 | pr); | ||
582 | } | ||
583 | |||
584 | |||
585 | /** | ||
586 | * Check that message received from CORE service is well-formed. | ||
587 | * | ||
588 | * @param cls the `struct GNUNET_CORE_Handle` | ||
589 | * @param ntm the message we got | ||
590 | * @return #GNUNET_OK if the message is well-formed | ||
591 | */ | ||
592 | static int | ||
593 | check_notify_inbound (void *cls, | ||
594 | const struct NotifyTrafficMessage *ntm) | ||
595 | { | ||
596 | uint16_t msize; | ||
597 | const struct GNUNET_MessageHeader *em; | ||
598 | |||
599 | msize = ntohs (ntm->header.size) - sizeof (struct NotifyTrafficMessage); | ||
600 | if (msize < sizeof (struct GNUNET_MessageHeader)) | ||
601 | { | ||
602 | GNUNET_break (0); | ||
603 | return GNUNET_SYSERR; | ||
604 | } | ||
605 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; | ||
606 | if (msize != ntohs (em->size)) | ||
607 | { | ||
608 | GNUNET_break (0); | ||
609 | return GNUNET_SYSERR; | ||
610 | } | ||
611 | return GNUNET_OK; | ||
612 | } | ||
613 | |||
614 | |||
615 | /** | ||
616 | * Handle inbound message received from CORE service. If applicable, | ||
617 | * notify the application. | ||
618 | * | ||
619 | * @param cls the `struct GNUNET_CORE_Handle` | ||
620 | * @param ntm the message we got from CORE. | ||
621 | */ | ||
622 | static void | ||
623 | handle_notify_inbound (void *cls, | ||
624 | const struct NotifyTrafficMessage *ntm) | ||
625 | { | ||
626 | struct GNUNET_CORE_Handle *h = cls; | ||
627 | const struct GNUNET_MessageHeader *em; | ||
628 | struct PeerRecord *pr; | ||
629 | |||
630 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
631 | "Received inbound message from `%s'.\n", | ||
632 | GNUNET_i2s (&ntm->peer)); | ||
633 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; | ||
634 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, | ||
635 | &ntm->peer); | ||
636 | if (NULL == pr) | ||
637 | { | ||
638 | GNUNET_break (0); | ||
639 | reconnect_later (h); | ||
640 | return; | ||
641 | } | ||
642 | GNUNET_MQ_inject_message (pr->mq, | ||
643 | em); | ||
644 | } | ||
645 | |||
646 | |||
647 | /** | ||
648 | * Handle message received from CORE service notifying us that we are | ||
649 | * now allowed to send a message to a peer. If that message is still | ||
650 | * pending, put it into the queue to be transmitted. | ||
651 | * | ||
652 | * @param cls the `struct GNUNET_CORE_Handle` | ||
653 | * @param smr the message we got | ||
654 | */ | ||
655 | static void | ||
656 | handle_send_ready (void *cls, | ||
657 | const struct SendMessageReady *smr) | ||
658 | { | ||
659 | struct GNUNET_CORE_Handle *h = cls; | ||
660 | struct PeerRecord *pr; | ||
661 | |||
662 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, | ||
663 | &smr->peer); | ||
664 | if (NULL == pr) | ||
665 | { | ||
666 | GNUNET_break (0); | ||
667 | reconnect_later (h); | ||
668 | return; | ||
669 | } | ||
670 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
671 | "Received notification about transmission readiness to `%s'.\n", | ||
672 | GNUNET_i2s (&smr->peer)); | ||
673 | if (NULL == pr->env) | ||
674 | { | ||
675 | /* request must have been cancelled between the original request | ||
676 | * and the response from CORE, ignore CORE's readiness */ | ||
677 | return; | ||
678 | } | ||
679 | if (ntohs (smr->smr_id) != pr->smr_id_gen) | ||
680 | { | ||
681 | /* READY message is for expired or cancelled message, | ||
682 | * ignore! (we should have already sent another request) */ | ||
683 | return; | ||
684 | } | ||
685 | |||
686 | /* ok, all good, send message out! */ | ||
687 | GNUNET_MQ_send (h->mq, | ||
688 | pr->env); | ||
689 | pr->env = NULL; | ||
690 | GNUNET_MQ_impl_send_continue (pr->mq); | ||
691 | } | ||
692 | |||
693 | |||
694 | /** | ||
695 | * Our current client connection went down. Clean it up and try to | ||
696 | * reconnect! | ||
697 | * | ||
698 | * @param h our handle to the core service | ||
699 | */ | ||
700 | static void | ||
701 | reconnect (struct GNUNET_CORE_Handle *h) | ||
702 | { | ||
703 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
704 | GNUNET_MQ_hd_fixed_size (init_reply, | ||
705 | GNUNET_MESSAGE_TYPE_CORE_INIT_REPLY, | ||
706 | struct InitReplyMessage, | ||
707 | h), | ||
708 | GNUNET_MQ_hd_fixed_size (connect_notify, | ||
709 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT, | ||
710 | struct ConnectNotifyMessage, | ||
711 | h), | ||
712 | GNUNET_MQ_hd_fixed_size (disconnect_notify, | ||
713 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT, | ||
714 | struct DisconnectNotifyMessage, | ||
715 | h), | ||
716 | GNUNET_MQ_hd_var_size (notify_inbound, | ||
717 | GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND, | ||
718 | struct NotifyTrafficMessage, | ||
719 | h), | ||
720 | GNUNET_MQ_hd_fixed_size (send_ready, | ||
721 | GNUNET_MESSAGE_TYPE_CORE_SEND_READY, | ||
722 | struct SendMessageReady, | ||
723 | h), | ||
724 | GNUNET_MQ_handler_end () | ||
725 | }; | ||
726 | struct InitMessage *init; | ||
727 | struct GNUNET_MQ_Envelope *env; | ||
728 | uint16_t *ts; | ||
729 | |||
730 | GNUNET_assert (NULL == h->mq); | ||
731 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | ||
732 | "core", | ||
733 | handlers, | ||
734 | &handle_mq_error, | ||
735 | h); | ||
736 | if (NULL == h->mq) | ||
737 | { | ||
738 | reconnect_later (h); | ||
739 | return; | ||
740 | } | ||
741 | env = GNUNET_MQ_msg_extra (init, | ||
742 | sizeof (uint16_t) * h->hcnt, | ||
743 | GNUNET_MESSAGE_TYPE_CORE_INIT); | ||
744 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
745 | "(Re)connecting to CORE service\n"); | ||
746 | init->options = htonl (0); | ||
747 | ts = (uint16_t *) &init[1]; | ||
748 | for (unsigned int hpos = 0; hpos < h->hcnt; hpos++) | ||
749 | ts[hpos] = htons (h->handlers[hpos].type); | ||
750 | GNUNET_MQ_send (h->mq, | ||
751 | env); | ||
752 | } | ||
753 | |||
754 | |||
755 | /** | ||
756 | * Connect to the core service. Note that the connection may complete | ||
757 | * (or fail) asynchronously. | ||
758 | * | ||
759 | * @param cfg configuration to use | ||
760 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) | ||
761 | * @param init callback to call once we have successfully | ||
762 | * connected to the core service | ||
763 | * @param connects function to call on peer connect, can be NULL | ||
764 | * @param disconnects function to call on peer disconnect / timeout, can be NULL | ||
765 | * @param handlers callbacks for messages we care about, NULL-terminated | ||
766 | * @return handle to the core service (only useful for disconnect until @a init is called); | ||
767 | * NULL on error (in this case, init is never called) | ||
768 | */ | ||
769 | struct GNUNET_CORE_Handle * | ||
770 | GNUNET_CORE_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
771 | void *cls, | ||
772 | GNUNET_CORE_StartupCallback init, | ||
773 | GNUNET_CORE_ConnecTEventHandler connects, | ||
774 | GNUNET_CORE_DisconnecTEventHandler disconnects, | ||
775 | const struct GNUNET_MQ_MessageHandler *handlers) | ||
776 | { | ||
777 | struct GNUNET_CORE_Handle *h; | ||
778 | unsigned int hcnt; | ||
779 | |||
780 | h = GNUNET_new (struct GNUNET_CORE_Handle); | ||
781 | h->cfg = cfg; | ||
782 | h->cls = cls; | ||
783 | h->init = init; | ||
784 | h->connects = connects; | ||
785 | h->disconnects = disconnects; | ||
786 | h->peers = GNUNET_CONTAINER_multipeermap_create (128, | ||
787 | GNUNET_NO); | ||
788 | hcnt = 0; | ||
789 | if (NULL != handlers) | ||
790 | while (NULL != handlers[hcnt].cb) | ||
791 | hcnt++; | ||
792 | h->handlers = GNUNET_new_array (hcnt + 1, | ||
793 | struct GNUNET_MQ_MessageHandler); | ||
794 | if (NULL != handlers) | ||
795 | GNUNET_memcpy (h->handlers, | ||
796 | handlers, | ||
797 | hcnt * sizeof (struct GNUNET_MQ_MessageHandler)); | ||
798 | h->hcnt = hcnt; | ||
799 | GNUNET_assert (hcnt < | ||
800 | (GNUNET_SERVER_MAX_MESSAGE_SIZE - | ||
801 | sizeof (struct InitMessage)) / sizeof (uint16_t)); | ||
802 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
803 | "Connecting to CORE service\n"); | ||
804 | reconnect (h); | ||
805 | if (NULL == h->mq) | ||
806 | { | ||
807 | GNUNET_CORE_disconnect (h); | ||
808 | return NULL; | ||
809 | } | ||
810 | return h; | ||
811 | } | ||
812 | |||
813 | |||
814 | /** | ||
815 | * Disconnect from the core service. | ||
816 | * | ||
817 | * @param handle connection to core to disconnect | ||
818 | */ | ||
819 | void | ||
820 | GNUNET_CORE_disconnecT (struct GNUNET_CORE_Handle *handle) | ||
821 | { | ||
822 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
823 | "Disconnecting from CORE service\n"); | ||
824 | GNUNET_CONTAINER_multipeermap_iterate (handle->peers, | ||
825 | &disconnect_and_free_peer_entry, | ||
826 | handle); | ||
827 | GNUNET_CONTAINER_multipeermap_destroy (handle->peers); | ||
828 | handle->peers = NULL; | ||
829 | if (NULL != handle->reconnect_task) | ||
830 | { | ||
831 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); | ||
832 | handle->reconnect_task = NULL; | ||
833 | } | ||
834 | if (NULL != handle->mq) | ||
835 | { | ||
836 | GNUNET_MQ_destroy (handle->mq); | ||
837 | handle->mq = NULL; | ||
838 | } | ||
839 | GNUNET_free (handle->handlers); | ||
840 | GNUNET_free (handle); | ||
841 | } | ||
842 | |||
843 | |||
844 | /** | ||
845 | * Obtain the message queue for a connected peer. | ||
846 | * | ||
847 | * @param h the core handle | ||
848 | * @param pid the identity of the peer to check if it has been connected to us | ||
849 | * @return NULL if peer is not connected | ||
850 | */ | ||
851 | struct GNUNET_MQ_Handle * | ||
852 | GNUNET_CORE_get_mq (const struct GNUNET_CORE_Handle *h, | ||
853 | const struct GNUNET_PeerIdentity *pid) | ||
854 | { | ||
855 | struct PeerRecord *pr; | ||
856 | |||
857 | pr = GNUNET_CONTAINER_multipeermap_get (h->peers, | ||
858 | pid); | ||
859 | if (NULL == pr) | ||
860 | return NULL; | ||
861 | return pr->mq; | ||
862 | } | ||
863 | |||
864 | |||
865 | /* end of core_api.c */ | ||
diff --git a/src/core/core_api_monitor_peers.c b/src/core/core_api_monitor_peers.c index 1455eb2b0..796fdb9d5 100644 --- a/src/core/core_api_monitor_peers.c +++ b/src/core/core_api_monitor_peers.c | |||
@@ -127,7 +127,7 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh) | |||
127 | if (NULL != mh->mq) | 127 | if (NULL != mh->mq) |
128 | GNUNET_MQ_destroy (mh->mq); | 128 | GNUNET_MQ_destroy (mh->mq); |
129 | /* FIXME: use backoff? */ | 129 | /* FIXME: use backoff? */ |
130 | mh->mq = GNUNET_CLIENT_connecT (mh->cfg, | 130 | mh->mq = GNUNET_CLIENT_connect (mh->cfg, |
131 | "core", | 131 | "core", |
132 | handlers, | 132 | handlers, |
133 | &handle_mq_error, | 133 | &handle_mq_error, |
diff --git a/src/core/core_api_mq.c b/src/core/core_api_mq.c deleted file mode 100644 index 12c7a3bdd..000000000 --- a/src/core/core_api_mq.c +++ /dev/null | |||
@@ -1,191 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009-2014 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file core/core_api_mq.c | ||
22 | * @brief MQ support for core service | ||
23 | * @author Christian Grothoff | ||
24 | * @author Florian Dold | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_constants.h" | ||
29 | #include "gnunet_core_service.h" | ||
30 | #include "core.h" | ||
31 | |||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "core-api",__VA_ARGS__) | ||
33 | |||
34 | |||
35 | /** | ||
36 | * Internal state of a GNUNET-MQ queue for CORE. | ||
37 | */ | ||
38 | struct CoreMQState | ||
39 | { | ||
40 | /** | ||
41 | * Which peer does this queue target? | ||
42 | */ | ||
43 | struct GNUNET_PeerIdentity target; | ||
44 | |||
45 | /** | ||
46 | * Handle to the CORE service used by this MQ. | ||
47 | */ | ||
48 | struct GNUNET_CORE_Handle *core; | ||
49 | |||
50 | /** | ||
51 | * Transmission handle (if in use). | ||
52 | */ | ||
53 | struct GNUNET_CORE_TransmitHandle *th; | ||
54 | }; | ||
55 | |||
56 | |||
57 | /** | ||
58 | * Function called to notify a client about the connection | ||
59 | * begin ready to queue more data. @a buf will be | ||
60 | * NULL and @a size zero if the connection was closed for | ||
61 | * writing in the meantime. | ||
62 | * | ||
63 | * @param cls closure | ||
64 | * @param size number of bytes available in @a buf | ||
65 | * @param buf where the callee should write the message | ||
66 | * @return number of bytes written to @a buf | ||
67 | */ | ||
68 | static size_t | ||
69 | core_mq_ntr (void *cls, size_t size, | ||
70 | void *buf) | ||
71 | { | ||
72 | struct GNUNET_MQ_Handle *mq = cls; | ||
73 | struct CoreMQState *mqs = GNUNET_MQ_impl_state (mq); | ||
74 | const struct GNUNET_MessageHeader *mh = GNUNET_MQ_impl_current (mq); | ||
75 | size_t msg_size = ntohs (mh->size); | ||
76 | |||
77 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
78 | "ntr called (size %u, type %u)\n", | ||
79 | msg_size, | ||
80 | ntohs (mh->type)); | ||
81 | mqs->th = NULL; | ||
82 | if (NULL == buf) | ||
83 | { | ||
84 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
85 | "send error\n"); | ||
86 | GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_WRITE); | ||
87 | return 0; | ||
88 | } | ||
89 | GNUNET_memcpy (buf, mh, msg_size); | ||
90 | GNUNET_MQ_impl_send_continue (mq); | ||
91 | return msg_size; | ||
92 | } | ||
93 | |||
94 | |||
95 | /** | ||
96 | * Signature of functions implementing the | ||
97 | * sending functionality of a message queue. | ||
98 | * | ||
99 | * @param mq the message queue | ||
100 | * @param msg the message to send | ||
101 | * @param impl_state state of the implementation | ||
102 | */ | ||
103 | static void | ||
104 | core_mq_send (struct GNUNET_MQ_Handle *mq, | ||
105 | const struct GNUNET_MessageHeader *msg, | ||
106 | void *impl_state) | ||
107 | { | ||
108 | struct CoreMQState *mqs = impl_state; | ||
109 | |||
110 | GNUNET_assert (NULL == mqs->th); | ||
111 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
112 | "Sending queued message (size %u)\n", | ||
113 | ntohs (msg->size)); | ||
114 | mqs->th = GNUNET_CORE_notify_transmit_ready (mqs->core, GNUNET_YES, 0, | ||
115 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
116 | &mqs->target, | ||
117 | ntohs (msg->size), | ||
118 | &core_mq_ntr, mq); | ||
119 | } | ||
120 | |||
121 | |||
122 | /** | ||
123 | * Signature of functions implementing the | ||
124 | * destruction of a message queue. | ||
125 | * Implementations must not free @a mq, but should | ||
126 | * take care of @a impl_state. | ||
127 | * | ||
128 | * @param mq the message queue to destroy | ||
129 | * @param impl_state state of the implementation | ||
130 | */ | ||
131 | static void | ||
132 | core_mq_destroy (struct GNUNET_MQ_Handle *mq, | ||
133 | void *impl_state) | ||
134 | { | ||
135 | struct CoreMQState *mqs = impl_state; | ||
136 | |||
137 | if (NULL != mqs->th) | ||
138 | { | ||
139 | GNUNET_CORE_notify_transmit_ready_cancel (mqs->th); | ||
140 | mqs->th = NULL; | ||
141 | } | ||
142 | GNUNET_free (mqs); | ||
143 | } | ||
144 | |||
145 | |||
146 | /** | ||
147 | * Implementation function that cancels the currently sent message. | ||
148 | * | ||
149 | * @param mq message queue | ||
150 | * @param impl_state state specific to the implementation | ||
151 | */ | ||
152 | static void | ||
153 | core_mq_cancel (struct GNUNET_MQ_Handle *mq, | ||
154 | void *impl_state) | ||
155 | { | ||
156 | struct CoreMQState *mqs = impl_state; | ||
157 | |||
158 | GNUNET_assert (NULL != mqs->th); | ||
159 | GNUNET_CORE_notify_transmit_ready_cancel (mqs->th); | ||
160 | } | ||
161 | |||
162 | |||
163 | /** | ||
164 | * Create a message queue for sending messages to a peer with CORE. | ||
165 | * Messages may only be queued with #GNUNET_MQ_send once the init callback has | ||
166 | * been called for the given handle. | ||
167 | * There must only be one queue per peer for each core handle. | ||
168 | * The message queue can only be used to transmit messages, | ||
169 | * not to receive them. | ||
170 | * | ||
171 | * @param h the core handle | ||
172 | * @param target the target peer for this queue, may not be NULL | ||
173 | * @return a message queue for sending messages over the core handle | ||
174 | * to the target peer | ||
175 | */ | ||
176 | struct GNUNET_MQ_Handle * | ||
177 | GNUNET_CORE_mq_create (struct GNUNET_CORE_Handle *h, | ||
178 | const struct GNUNET_PeerIdentity *target) | ||
179 | { | ||
180 | struct CoreMQState *mqs = GNUNET_new (struct CoreMQState); | ||
181 | |||
182 | mqs->core = h; | ||
183 | mqs->target = *target; | ||
184 | return GNUNET_MQ_queue_for_callbacks (&core_mq_send, | ||
185 | &core_mq_destroy, | ||
186 | &core_mq_cancel, | ||
187 | mqs, | ||
188 | NULL, NULL, NULL); | ||
189 | } | ||
190 | |||
191 | /* end of core_api_mq.c */ | ||
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index e6a113b52..847ba6e75 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -92,7 +92,7 @@ terminate_peer (struct PeerContext *p) | |||
92 | { | 92 | { |
93 | if (NULL != p->ch) | 93 | if (NULL != p->ch) |
94 | { | 94 | { |
95 | GNUNET_CORE_disconnecT (p->ch); | 95 | GNUNET_CORE_disconnect (p->ch); |
96 | p->ch = NULL; | 96 | p->ch = NULL; |
97 | } | 97 | } |
98 | if (NULL != p->ghh) | 98 | if (NULL != p->ghh) |
@@ -243,7 +243,7 @@ init_notify (void *cls, | |||
243 | GNUNET_assert (ok == 2); | 243 | GNUNET_assert (ok == 2); |
244 | OKPP; | 244 | OKPP; |
245 | /* connect p2 */ | 245 | /* connect p2 */ |
246 | p2.ch = GNUNET_CORE_connecT (p2.cfg, | 246 | p2.ch = GNUNET_CORE_connect (p2.cfg, |
247 | &p2, | 247 | &p2, |
248 | &init_notify, | 248 | &init_notify, |
249 | &connect_notify, | 249 | &connect_notify, |
@@ -317,7 +317,7 @@ run (void *cls, | |||
317 | (GNUNET_TIME_UNIT_SECONDS, 300), | 317 | (GNUNET_TIME_UNIT_SECONDS, 300), |
318 | &terminate_task_error, NULL); | 318 | &terminate_task_error, NULL); |
319 | p1.ch = | 319 | p1.ch = |
320 | GNUNET_CORE_connecT (p1.cfg, | 320 | GNUNET_CORE_connect (p1.cfg, |
321 | &p1, | 321 | &p1, |
322 | &init_notify, | 322 | &init_notify, |
323 | &connect_notify, | 323 | &connect_notify, |
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index cd2bcad83..900c9f732 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c | |||
@@ -103,7 +103,7 @@ terminate_peer (struct PeerContext *p) | |||
103 | { | 103 | { |
104 | if (NULL != p->ch) | 104 | if (NULL != p->ch) |
105 | { | 105 | { |
106 | GNUNET_CORE_disconnecT (p->ch); | 106 | GNUNET_CORE_disconnect (p->ch); |
107 | p->ch = NULL; | 107 | p->ch = NULL; |
108 | } | 108 | } |
109 | if (NULL != p->ghh) | 109 | if (NULL != p->ghh) |
@@ -341,7 +341,7 @@ init_notify (void *cls, | |||
341 | OKPP; | 341 | OKPP; |
342 | /* connect p2 */ | 342 | /* connect p2 */ |
343 | GNUNET_assert (NULL != | 343 | GNUNET_assert (NULL != |
344 | (p2.ch = GNUNET_CORE_connecT (p2.cfg, | 344 | (p2.ch = GNUNET_CORE_connect (p2.cfg, |
345 | &p2, | 345 | &p2, |
346 | &init_notify, | 346 | &init_notify, |
347 | &connect_notify, | 347 | &connect_notify, |
@@ -464,7 +464,7 @@ run (void *cls, | |||
464 | NULL); | 464 | NULL); |
465 | 465 | ||
466 | GNUNET_assert (NULL != | 466 | GNUNET_assert (NULL != |
467 | (p1.ch = GNUNET_CORE_connecT (p1.cfg, | 467 | (p1.ch = GNUNET_CORE_connect (p1.cfg, |
468 | &p1, | 468 | &p1, |
469 | &init_notify, | 469 | &init_notify, |
470 | &connect_notify, | 470 | &connect_notify, |
diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c index d29da651b..5cfc8b35f 100644 --- a/src/core/test_core_api_send_to_self.c +++ b/src/core/test_core_api_send_to_self.c | |||
@@ -65,7 +65,7 @@ cleanup (void *cls) | |||
65 | } | 65 | } |
66 | if (NULL != core) | 66 | if (NULL != core) |
67 | { | 67 | { |
68 | GNUNET_CORE_disconnecT (core); | 68 | GNUNET_CORE_disconnect (core); |
69 | core = NULL; | 69 | core = NULL; |
70 | } | 70 | } |
71 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 71 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -159,7 +159,7 @@ run (void *cls, | |||
159 | }; | 159 | }; |
160 | 160 | ||
161 | core = | 161 | core = |
162 | GNUNET_CORE_connecT (cfg, | 162 | GNUNET_CORE_connect (cfg, |
163 | NULL, | 163 | NULL, |
164 | &init, | 164 | &init, |
165 | &connect_cb, | 165 | &connect_cb, |
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index 6abc3cc89..31e300b14 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c | |||
@@ -74,9 +74,9 @@ static struct GNUNET_MQ_MessageHandler handlers[] = { | |||
74 | static void | 74 | static void |
75 | shutdown_task (void *cls) | 75 | shutdown_task (void *cls) |
76 | { | 76 | { |
77 | GNUNET_CORE_disconnecT (p1.ch); | 77 | GNUNET_CORE_disconnect (p1.ch); |
78 | p1.ch = NULL; | 78 | p1.ch = NULL; |
79 | GNUNET_CORE_disconnecT (p2.ch); | 79 | GNUNET_CORE_disconnect (p2.ch); |
80 | p2.ch = NULL; | 80 | p2.ch = NULL; |
81 | ok = 0; | 81 | ok = 0; |
82 | } | 82 | } |
@@ -91,7 +91,7 @@ init_notify (void *cls, | |||
91 | if (p == &p1) | 91 | if (p == &p1) |
92 | { | 92 | { |
93 | /* connect p2 */ | 93 | /* connect p2 */ |
94 | p2.ch = GNUNET_CORE_connecT (p2.cfg, | 94 | p2.ch = GNUNET_CORE_connect (p2.cfg, |
95 | &p2, | 95 | &p2, |
96 | &init_notify, | 96 | &init_notify, |
97 | &connect_notify, | 97 | &connect_notify, |
@@ -140,12 +140,12 @@ timeout_task (void *cls) | |||
140 | "Timeout.\n"); | 140 | "Timeout.\n"); |
141 | if (NULL != p1.ch) | 141 | if (NULL != p1.ch) |
142 | { | 142 | { |
143 | GNUNET_CORE_disconnecT (p1.ch); | 143 | GNUNET_CORE_disconnect (p1.ch); |
144 | p1.ch = NULL; | 144 | p1.ch = NULL; |
145 | } | 145 | } |
146 | if (NULL != p2.ch) | 146 | if (NULL != p2.ch) |
147 | { | 147 | { |
148 | GNUNET_CORE_disconnecT (p2.ch); | 148 | GNUNET_CORE_disconnect (p2.ch); |
149 | p2.ch = NULL; | 149 | p2.ch = NULL; |
150 | } | 150 | } |
151 | ok = 42; | 151 | ok = 42; |
@@ -168,7 +168,7 @@ run (void *cls, | |||
168 | TIMEOUT), | 168 | TIMEOUT), |
169 | &timeout_task, | 169 | &timeout_task, |
170 | NULL); | 170 | NULL); |
171 | p1.ch = GNUNET_CORE_connecT (p1.cfg, | 171 | p1.ch = GNUNET_CORE_connect (p1.cfg, |
172 | &p1, | 172 | &p1, |
173 | &init_notify, | 173 | &init_notify, |
174 | &connect_notify, | 174 | &connect_notify, |
diff --git a/src/core/test_core_defaults.conf b/src/core/test_core_defaults.conf index eb9a1c379..4c956987c 100644 --- a/src/core/test_core_defaults.conf +++ b/src/core/test_core_defaults.conf | |||
@@ -5,13 +5,7 @@ | |||
5 | GNUNET_TEST_HOME = /tmp/test-gnunet-core/ | 5 | GNUNET_TEST_HOME = /tmp/test-gnunet-core/ |
6 | 6 | ||
7 | [nat] | 7 | [nat] |
8 | DISABLEV6 = YES | ||
9 | ENABLE_UPNP = NO | 8 | ENABLE_UPNP = NO |
10 | BEHIND_NAT = NO | ||
11 | ALLOW_NAT = NO | ||
12 | INTERNAL_ADDRESS = 127.0.0.1 | ||
13 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
14 | USE_LOCALADDR = NO | ||
15 | 9 | ||
16 | [ats] | 10 | [ats] |
17 | WAN_QUOTA_IN = 1 GB | 11 | WAN_QUOTA_IN = 1 GB |
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index 4dee958f2..dcc33288d 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -117,7 +117,7 @@ terminate_peer (struct PeerContext *p) | |||
117 | { | 117 | { |
118 | if (NULL != p->ch) | 118 | if (NULL != p->ch) |
119 | { | 119 | { |
120 | GNUNET_CORE_disconnecT (p->ch); | 120 | GNUNET_CORE_disconnect (p->ch); |
121 | p->ch = NULL; | 121 | p->ch = NULL; |
122 | } | 122 | } |
123 | if (NULL != p->ghh) | 123 | if (NULL != p->ghh) |
@@ -480,7 +480,7 @@ init_notify (void *cls, | |||
480 | GNUNET_assert (ok == 2); | 480 | GNUNET_assert (ok == 2); |
481 | OKPP; | 481 | OKPP; |
482 | /* connect p2 */ | 482 | /* connect p2 */ |
483 | p2.ch = GNUNET_CORE_connecT (p2.cfg, | 483 | p2.ch = GNUNET_CORE_connect (p2.cfg, |
484 | &p2, | 484 | &p2, |
485 | &init_notify, | 485 | &init_notify, |
486 | &connect_notify, | 486 | &connect_notify, |
@@ -653,7 +653,7 @@ run (void *cls, | |||
653 | "WAN_QUOTA_OUT", | 653 | "WAN_QUOTA_OUT", |
654 | ¤t_quota_p2_out)); | 654 | ¤t_quota_p2_out)); |
655 | 655 | ||
656 | p1.ch = GNUNET_CORE_connecT (p1.cfg, | 656 | p1.ch = GNUNET_CORE_connect (p1.cfg, |
657 | &p1, | 657 | &p1, |
658 | &init_notify, | 658 | &init_notify, |
659 | &connect_notify, | 659 | &connect_notify, |
diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c index b201d4d9c..f90bf9630 100644 --- a/src/credential/credential_api.c +++ b/src/credential/credential_api.c | |||
@@ -283,7 +283,7 @@ reconnect (struct GNUNET_CREDENTIAL_Handle *handle) | |||
283 | GNUNET_assert (NULL == handle->mq); | 283 | GNUNET_assert (NULL == handle->mq); |
284 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 284 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
285 | "Trying to connect to CREDENTIAL\n"); | 285 | "Trying to connect to CREDENTIAL\n"); |
286 | handle->mq = GNUNET_CLIENT_connecT (handle->cfg, | 286 | handle->mq = GNUNET_CLIENT_connect (handle->cfg, |
287 | "credential", | 287 | "credential", |
288 | handlers, | 288 | handlers, |
289 | &mq_error_handler, | 289 | &mq_error_handler, |
diff --git a/src/datacache/.gitignore b/src/datacache/.gitignore new file mode 100644 index 000000000..8e42aa103 --- /dev/null +++ b/src/datacache/.gitignore | |||
@@ -0,0 +1,6 @@ | |||
1 | test_datacache_heap | ||
2 | test_datacache_postgres | ||
3 | test_datacache_quota_heap | ||
4 | test_datacache_quota_postgres | ||
5 | test_datacache_quota_sqlite | ||
6 | test_datacache_sqlite | ||
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c index 185d54f2f..49e60bca1 100644 --- a/src/datacache/plugin_datacache_heap.c +++ b/src/datacache/plugin_datacache_heap.c | |||
@@ -180,8 +180,7 @@ put_cb (void *cls, | |||
180 | GNUNET_memcpy (val->path_info, | 180 | GNUNET_memcpy (val->path_info, |
181 | put_ctx->path_info, | 181 | put_ctx->path_info, |
182 | put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); | 182 | put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); |
183 | GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, | 183 | GNUNET_CONTAINER_heap_update_cost (val->hn, |
184 | val->hn, | ||
185 | val->discard_time.abs_value_us); | 184 | val->discard_time.abs_value_us); |
186 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 185 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
187 | "Got same value for key %s and type %d (size %u vs %u)\n", | 186 | "Got same value for key %s and type %d (size %u vs %u)\n", |
diff --git a/src/datastore/.gitignore b/src/datastore/.gitignore index 38dff9993..51d3391b9 100644 --- a/src/datastore/.gitignore +++ b/src/datastore/.gitignore | |||
@@ -1,2 +1,16 @@ | |||
1 | gnunet-service-datastore | 1 | gnunet-service-datastore |
2 | gnunet-datastore | 2 | gnunet-datastore |
3 | perf_datastore_api_heap | ||
4 | perf_plugin_datastore_heap | ||
5 | test_datastore_api_heap | ||
6 | test_datastore_api_management_heap | ||
7 | test_datastore_api_management_mysql | ||
8 | test_datastore_api_management_postgres | ||
9 | test_datastore_api_management_sqlite | ||
10 | test_datastore_api_mysql | ||
11 | test_datastore_api_postgres | ||
12 | test_datastore_api_sqlite | ||
13 | test_plugin_datastore_heap | ||
14 | test_plugin_datastore_mysql | ||
15 | test_plugin_datastore_postgres | ||
16 | test_plugin_datastore_sqlite | ||
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index d75a58552..db485364e 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -443,7 +443,7 @@ GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, | |||
443 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 443 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
444 | "Re-connecting to issue DROP!\n"); | 444 | "Re-connecting to issue DROP!\n"); |
445 | GNUNET_assert (NULL == h->mq); | 445 | GNUNET_assert (NULL == h->mq); |
446 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 446 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
447 | "datastore", | 447 | "datastore", |
448 | NULL, | 448 | NULL, |
449 | &disconnect_on_mq_error, | 449 | &disconnect_on_mq_error, |
@@ -868,7 +868,7 @@ try_reconnect (void *cls) | |||
868 | h->retry_time = GNUNET_TIME_STD_BACKOFF (h->retry_time); | 868 | h->retry_time = GNUNET_TIME_STD_BACKOFF (h->retry_time); |
869 | h->reconnect_task = NULL; | 869 | h->reconnect_task = NULL; |
870 | GNUNET_assert (NULL == h->mq); | 870 | GNUNET_assert (NULL == h->mq); |
871 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 871 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
872 | "datastore", | 872 | "datastore", |
873 | handlers, | 873 | handlers, |
874 | &mq_error_handler, | 874 | &mq_error_handler, |
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c index 51f61764c..977d599d2 100644 --- a/src/datastore/plugin_datastore_heap.c +++ b/src/datastore/plugin_datastore_heap.c | |||
@@ -331,7 +331,7 @@ struct GetContext | |||
331 | * The plugin. | 331 | * The plugin. |
332 | */ | 332 | */ |
333 | struct Plugin *plugin; | 333 | struct Plugin *plugin; |
334 | 334 | ||
335 | /** | 335 | /** |
336 | * Requested value hash. | 336 | * Requested value hash. |
337 | */ | 337 | */ |
@@ -608,7 +608,7 @@ heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
608 | * priority should be added to the existing priority, ignoring the | 608 | * priority should be added to the existing priority, ignoring the |
609 | * priority in value. | 609 | * priority in value. |
610 | * | 610 | * |
611 | * @param cls our "struct Plugin*" | 611 | * @param cls our `struct Plugin *` |
612 | * @param uid unique identifier of the datum | 612 | * @param uid unique identifier of the datum |
613 | * @param delta by how much should the priority | 613 | * @param delta by how much should the priority |
614 | * change? If priority + delta < 0 the | 614 | * change? If priority + delta < 0 the |
@@ -628,7 +628,6 @@ heap_plugin_update (void *cls, | |||
628 | PluginUpdateCont cont, | 628 | PluginUpdateCont cont, |
629 | void *cont_cls) | 629 | void *cont_cls) |
630 | { | 630 | { |
631 | struct Plugin *plugin = cls; | ||
632 | struct Value *value; | 631 | struct Value *value; |
633 | 632 | ||
634 | value = (struct Value*) (long) uid; | 633 | value = (struct Value*) (long) uid; |
@@ -636,8 +635,7 @@ heap_plugin_update (void *cls, | |||
636 | if (value->expiration.abs_value_us != expire.abs_value_us) | 635 | if (value->expiration.abs_value_us != expire.abs_value_us) |
637 | { | 636 | { |
638 | value->expiration = expire; | 637 | value->expiration = expire; |
639 | GNUNET_CONTAINER_heap_update_cost (plugin->by_expiration, | 638 | GNUNET_CONTAINER_heap_update_cost (value->expire_heap, |
640 | value->expire_heap, | ||
641 | expire.abs_value_us); | 639 | expire.abs_value_us); |
642 | } | 640 | } |
643 | if ( (delta < 0) && (value->priority < - delta) ) | 641 | if ( (delta < 0) && (value->priority < - delta) ) |
diff --git a/src/dht/.gitignore b/src/dht/.gitignore index b8b0ff7d4..e7f3c2a86 100644 --- a/src/dht/.gitignore +++ b/src/dht/.gitignore | |||
@@ -5,3 +5,10 @@ gnunet-dht-profiler | |||
5 | gnunet-dht-put | 5 | gnunet-dht-put |
6 | gnunet-service-dht | 6 | gnunet-service-dht |
7 | gnunet-service-dht-whanau | 7 | gnunet-service-dht-whanau |
8 | test_dht_2dtorus | ||
9 | test_dht_api | ||
10 | test_dht_line | ||
11 | test_dht_monitor | ||
12 | test_dht_multipeer | ||
13 | test_dht_tools.py | ||
14 | test_dht_twopeer | ||
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am index f91917768..1a174165c 100644 --- a/src/dht/Makefile.am +++ b/src/dht/Makefile.am | |||
@@ -58,8 +58,12 @@ endif | |||
58 | noinst_PROGRAMS = \ | 58 | noinst_PROGRAMS = \ |
59 | gnunet-dht-monitor \ | 59 | gnunet-dht-monitor \ |
60 | gnunet-dht-get \ | 60 | gnunet-dht-get \ |
61 | gnunet-dht-put \ | 61 | gnunet-dht-put |
62 | |||
63 | if HAVE_TESTING | ||
64 | noinst_PROGRAMS += \ | ||
62 | gnunet-dht-profiler | 65 | gnunet-dht-profiler |
66 | endif | ||
63 | 67 | ||
64 | gnunet_service_dht_SOURCES = \ | 68 | gnunet_service_dht_SOURCES = \ |
65 | gnunet-service-dht.c gnunet-service-dht.h \ | 69 | gnunet-service-dht.c gnunet-service-dht.h \ |
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c index 57880165e..66eaf1064 100644 --- a/src/dht/dht_api.c +++ b/src/dht/dht_api.c | |||
@@ -867,7 +867,7 @@ try_connect (struct GNUNET_DHT_Handle *h) | |||
867 | }; | 867 | }; |
868 | if (NULL != h->mq) | 868 | if (NULL != h->mq) |
869 | return GNUNET_OK; | 869 | return GNUNET_OK; |
870 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 870 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
871 | "dht", | 871 | "dht", |
872 | handlers, | 872 | handlers, |
873 | &mq_error_handler, | 873 | &mq_error_handler, |
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c index 3716ea3af..5a5c41567 100644 --- a/src/dht/gnunet-service-dht_hello.c +++ b/src/dht/gnunet-service-dht_hello.c | |||
@@ -69,13 +69,15 @@ GDS_HELLO_get (const struct GNUNET_PeerIdentity *peer) | |||
69 | * FIXME this is called once per address. Merge instead of replacing? | 69 | * FIXME this is called once per address. Merge instead of replacing? |
70 | */ | 70 | */ |
71 | static void | 71 | static void |
72 | process_hello (void *cls, const struct GNUNET_PeerIdentity *peer, | 72 | process_hello (void *cls, |
73 | const struct GNUNET_HELLO_Message *hello, const char *err_msg) | 73 | const struct GNUNET_PeerIdentity *peer, |
74 | const struct GNUNET_HELLO_Message *hello, | ||
75 | const char *err_msg) | ||
74 | { | 76 | { |
75 | struct GNUNET_TIME_Absolute ex; | 77 | struct GNUNET_TIME_Absolute ex; |
76 | struct GNUNET_HELLO_Message *hm; | 78 | struct GNUNET_HELLO_Message *hm; |
77 | 79 | ||
78 | if (hello == NULL) | 80 | if (NULL == hello) |
79 | return; | 81 | return; |
80 | ex = GNUNET_HELLO_get_last_expiration (hello); | 82 | ex = GNUNET_HELLO_get_last_expiration (hello); |
81 | if (0 == GNUNET_TIME_absolute_get_remaining (ex).rel_value_us) | 83 | if (0 == GNUNET_TIME_absolute_get_remaining (ex).rel_value_us) |
@@ -100,8 +102,12 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
100 | void | 102 | void |
101 | GDS_HELLO_init () | 103 | GDS_HELLO_init () |
102 | { | 104 | { |
103 | pnc = GNUNET_PEERINFO_notify (GDS_cfg, GNUNET_NO, &process_hello, NULL); | 105 | pnc = GNUNET_PEERINFO_notify (GDS_cfg, |
104 | peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); | 106 | GNUNET_NO, |
107 | &process_hello, | ||
108 | NULL); | ||
109 | peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256, | ||
110 | GNUNET_NO); | ||
105 | } | 111 | } |
106 | 112 | ||
107 | 113 | ||
@@ -131,7 +137,9 @@ GDS_HELLO_done () | |||
131 | } | 137 | } |
132 | if (NULL != peer_to_hello) | 138 | if (NULL != peer_to_hello) |
133 | { | 139 | { |
134 | GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello, &free_hello, NULL); | 140 | GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello, |
141 | &free_hello, | ||
142 | NULL); | ||
135 | GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello); | 143 | GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello); |
136 | } | 144 | } |
137 | } | 145 | } |
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 574ed9ad0..20bdc0ce4 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -1830,10 +1830,16 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, | |||
1830 | /* first, check about our own HELLO */ | 1830 | /* first, check about our own HELLO */ |
1831 | if (NULL != GDS_my_hello) | 1831 | if (NULL != GDS_my_hello) |
1832 | { | 1832 | { |
1833 | GNUNET_BLOCK_mingle_hash (&my_identity_hash, bf_mutator, &mhash); | 1833 | GNUNET_BLOCK_mingle_hash (&my_identity_hash, |
1834 | bf_mutator, | ||
1835 | &mhash); | ||
1834 | if ((NULL == bf) || | 1836 | if ((NULL == bf) || |
1835 | (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash))) | 1837 | (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash))) |
1836 | { | 1838 | { |
1839 | size_t hello_size; | ||
1840 | |||
1841 | hello_size = GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) GDS_my_hello); | ||
1842 | GNUNET_break (hello_size >= sizeof (struct GNUNET_MessageHeader)); | ||
1837 | GDS_NEIGHBOURS_handle_reply (sender, | 1843 | GDS_NEIGHBOURS_handle_reply (sender, |
1838 | GNUNET_BLOCK_TYPE_DHT_HELLO, | 1844 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
1839 | GNUNET_TIME_relative_to_absolute | 1845 | GNUNET_TIME_relative_to_absolute |
@@ -1844,9 +1850,7 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, | |||
1844 | 0, | 1850 | 0, |
1845 | NULL, | 1851 | NULL, |
1846 | GDS_my_hello, | 1852 | GDS_my_hello, |
1847 | GNUNET_HELLO_size ((const struct | 1853 | hello_size); |
1848 | GNUNET_HELLO_Message *) | ||
1849 | GDS_my_hello)); | ||
1850 | } | 1854 | } |
1851 | else | 1855 | else |
1852 | { | 1856 | { |
@@ -2377,7 +2381,7 @@ GDS_NEIGHBOURS_init () | |||
2377 | log_route_details_stderr = | 2381 | log_route_details_stderr = |
2378 | (NULL != getenv("GNUNET_DHT_ROUTE_DEBUG")) ? GNUNET_YES : GNUNET_NO; | 2382 | (NULL != getenv("GNUNET_DHT_ROUTE_DEBUG")) ? GNUNET_YES : GNUNET_NO; |
2379 | ats_ch = GNUNET_ATS_connectivity_init (GDS_cfg); | 2383 | ats_ch = GNUNET_ATS_connectivity_init (GDS_cfg); |
2380 | core_api = GNUNET_CORE_connecT (GDS_cfg, | 2384 | core_api = GNUNET_CORE_connect (GDS_cfg, |
2381 | NULL, | 2385 | NULL, |
2382 | &core_init, | 2386 | &core_init, |
2383 | &handle_core_connect, | 2387 | &handle_core_connect, |
@@ -2401,7 +2405,7 @@ GDS_NEIGHBOURS_done () | |||
2401 | { | 2405 | { |
2402 | if (NULL == core_api) | 2406 | if (NULL == core_api) |
2403 | return; | 2407 | return; |
2404 | GNUNET_CORE_disconnecT (core_api); | 2408 | GNUNET_CORE_disconnect (core_api); |
2405 | core_api = NULL; | 2409 | core_api = NULL; |
2406 | GNUNET_assert (0 == | 2410 | GNUNET_assert (0 == |
2407 | GNUNET_CONTAINER_multipeermap_size (all_connected_peers)); | 2411 | GNUNET_CONTAINER_multipeermap_size (all_connected_peers)); |
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c index 48bece35e..978c46d73 100644 --- a/src/dht/gnunet-service-dht_routing.c +++ b/src/dht/gnunet-service-dht_routing.c | |||
@@ -160,7 +160,9 @@ struct ProcessContext | |||
160 | * #GNUNET_SYSERR if the result is malformed or type unsupported | 160 | * #GNUNET_SYSERR if the result is malformed or type unsupported |
161 | */ | 161 | */ |
162 | static int | 162 | static int |
163 | process (void *cls, const struct GNUNET_HashCode * key, void *value) | 163 | process (void *cls, |
164 | const struct GNUNET_HashCode *key, | ||
165 | void *value) | ||
164 | { | 166 | { |
165 | struct ProcessContext *pc = cls; | 167 | struct ProcessContext *pc = cls; |
166 | struct RecentRequest *rr = value; | 168 | struct RecentRequest *rr = value; |
@@ -170,7 +172,8 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
170 | struct GNUNET_HashCode hc; | 172 | struct GNUNET_HashCode hc; |
171 | const struct GNUNET_HashCode *eval_key; | 173 | const struct GNUNET_HashCode *eval_key; |
172 | 174 | ||
173 | if ((rr->type != GNUNET_BLOCK_TYPE_ANY) && (rr->type != pc->type)) | 175 | if ( (rr->type != GNUNET_BLOCK_TYPE_ANY) && |
176 | (rr->type != pc->type) ) | ||
174 | return GNUNET_OK; /* type missmatch */ | 177 | return GNUNET_OK; /* type missmatch */ |
175 | 178 | ||
176 | if (0 != (rr->options & GNUNET_DHT_RO_RECORD_ROUTE)) | 179 | if (0 != (rr->options & GNUNET_DHT_RO_RECORD_ROUTE)) |
@@ -183,23 +186,26 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
183 | gpl = 0; | 186 | gpl = 0; |
184 | ppl = 0; | 187 | ppl = 0; |
185 | } | 188 | } |
186 | if ((0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && | 189 | if ( (0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && |
187 | (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO)) | 190 | (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO) ) |
188 | { | 191 | { |
189 | /* key may not match HELLO, which is OK since | 192 | /* key may not match HELLO, which is OK since |
190 | * the search is approximate. Still, the evaluation | 193 | * the search is approximate. Still, the evaluation |
191 | * would fail since the match is not exact. So | 194 | * would fail since the match is not exact. So |
192 | * we fake it by changing the key to the actual PID ... */ | 195 | * we fake it by changing the key to the actual PID ... */ |
193 | GNUNET_BLOCK_get_key (GDS_block_context, GNUNET_BLOCK_TYPE_DHT_HELLO, | 196 | GNUNET_BLOCK_get_key (GDS_block_context, |
194 | pc->data, pc->data_size, &hc); | 197 | GNUNET_BLOCK_TYPE_DHT_HELLO, |
198 | pc->data, | ||
199 | pc->data_size, | ||
200 | &hc); | ||
195 | eval_key = &hc; | 201 | eval_key = &hc; |
196 | } | 202 | } |
197 | else | 203 | else |
198 | { | 204 | { |
199 | eval_key = key; | 205 | eval_key = key; |
200 | } | 206 | } |
201 | eval = | 207 | eval |
202 | GNUNET_BLOCK_evaluate (GDS_block_context, | 208 | = GNUNET_BLOCK_evaluate (GDS_block_context, |
203 | pc->type, | 209 | pc->type, |
204 | GNUNET_BLOCK_EO_NONE, | 210 | GNUNET_BLOCK_EO_NONE, |
205 | eval_key, | 211 | eval_key, |
@@ -308,7 +314,10 @@ GDS_ROUTING_process (void *cls, | |||
308 | pc.data_size = 0; | 314 | pc.data_size = 0; |
309 | pc.data = ""; /* something not null */ | 315 | pc.data = ""; /* something not null */ |
310 | } | 316 | } |
311 | GNUNET_CONTAINER_multihashmap_get_multiple (recent_map, key, &process, &pc); | 317 | GNUNET_CONTAINER_multihashmap_get_multiple (recent_map, |
318 | key, | ||
319 | &process, | ||
320 | &pc); | ||
312 | } | 321 | } |
313 | 322 | ||
314 | 323 | ||
@@ -345,11 +354,13 @@ expire_oldest_entry () | |||
345 | * @param cls the new 'struct RecentRequest' (to discard upon successful combination) | 354 | * @param cls the new 'struct RecentRequest' (to discard upon successful combination) |
346 | * @param key the query | 355 | * @param key the query |
347 | * @param value the existing 'struct RecentRequest' (to update upon successful combination) | 356 | * @param value the existing 'struct RecentRequest' (to update upon successful combination) |
348 | * @return GNUNET_OK (continue to iterate), | 357 | * @return #GNUNET_OK (continue to iterate), |
349 | * GNUNET_SYSERR if the request was successfully combined | 358 | * #GNUNET_SYSERR if the request was successfully combined |
350 | */ | 359 | */ |
351 | static int | 360 | static int |
352 | try_combine_recent (void *cls, const struct GNUNET_HashCode * key, void *value) | 361 | try_combine_recent (void *cls, |
362 | const struct GNUNET_HashCode *key, | ||
363 | void *value) | ||
353 | { | 364 | { |
354 | struct RecentRequest *in = cls; | 365 | struct RecentRequest *in = cls; |
355 | struct RecentRequest *rr = value; | 366 | struct RecentRequest *rr = value; |
@@ -396,7 +407,8 @@ void | |||
396 | GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | 407 | GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, |
397 | enum GNUNET_BLOCK_Type type, | 408 | enum GNUNET_BLOCK_Type type, |
398 | enum GNUNET_DHT_RouteOption options, | 409 | enum GNUNET_DHT_RouteOption options, |
399 | const struct GNUNET_HashCode * key, const void *xquery, | 410 | const struct GNUNET_HashCode *key, |
411 | const void *xquery, | ||
400 | size_t xquery_size, | 412 | size_t xquery_size, |
401 | const struct GNUNET_CONTAINER_BloomFilter *reply_bf, | 413 | const struct GNUNET_CONTAINER_BloomFilter *reply_bf, |
402 | uint32_t reply_bf_mutator) | 414 | uint32_t reply_bf_mutator) |
@@ -419,8 +431,10 @@ GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | |||
419 | recent_req->xquery_size = xquery_size; | 431 | recent_req->xquery_size = xquery_size; |
420 | recent_req->reply_bf_mutator = reply_bf_mutator; | 432 | recent_req->reply_bf_mutator = reply_bf_mutator; |
421 | if (GNUNET_SYSERR == | 433 | if (GNUNET_SYSERR == |
422 | GNUNET_CONTAINER_multihashmap_get_multiple (recent_map, key, | 434 | GNUNET_CONTAINER_multihashmap_get_multiple (recent_map, |
423 | &try_combine_recent, recent_req)) | 435 | key, |
436 | &try_combine_recent, | ||
437 | recent_req)) | ||
424 | { | 438 | { |
425 | GNUNET_STATISTICS_update (GDS_stats, | 439 | GNUNET_STATISTICS_update (GDS_stats, |
426 | gettext_noop | 440 | gettext_noop |
diff --git a/src/dht/gnunet-service-wdht_neighbours.c b/src/dht/gnunet-service-wdht_neighbours.c index d3b92585b..78a04d66d 100644 --- a/src/dht/gnunet-service-wdht_neighbours.c +++ b/src/dht/gnunet-service-wdht_neighbours.c | |||
@@ -1712,7 +1712,7 @@ GDS_NEIGHBOURS_init (void) | |||
1712 | GNUNET_MQ_handler_end () | 1712 | GNUNET_MQ_handler_end () |
1713 | }; | 1713 | }; |
1714 | 1714 | ||
1715 | core_api = GNUNET_CORE_connecT (GDS_cfg, NULL, | 1715 | core_api = GNUNET_CORE_connect (GDS_cfg, NULL, |
1716 | &core_init, | 1716 | &core_init, |
1717 | &handle_core_connect, | 1717 | &handle_core_connect, |
1718 | &handle_core_disconnect, | 1718 | &handle_core_disconnect, |
@@ -1736,7 +1736,7 @@ GDS_NEIGHBOURS_done (void) | |||
1736 | { | 1736 | { |
1737 | if (NULL == core_api) | 1737 | if (NULL == core_api) |
1738 | return; | 1738 | return; |
1739 | GNUNET_CORE_disconnecT (core_api); | 1739 | GNUNET_CORE_disconnect (core_api); |
1740 | core_api = NULL; | 1740 | core_api = NULL; |
1741 | GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (friends_peermap)); | 1741 | GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (friends_peermap)); |
1742 | GNUNET_CONTAINER_multipeermap_destroy (friends_peermap); | 1742 | GNUNET_CONTAINER_multipeermap_destroy (friends_peermap); |
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index e3462f618..d41eb1900 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -6150,7 +6150,7 @@ GDS_NEIGHBOURS_init (void) | |||
6150 | GNUNET_MQ_handler_end () | 6150 | GNUNET_MQ_handler_end () |
6151 | }; | 6151 | }; |
6152 | 6152 | ||
6153 | core_api = GNUNET_CORE_connecT (GDS_cfg, | 6153 | core_api = GNUNET_CORE_connect (GDS_cfg, |
6154 | NULL, | 6154 | NULL, |
6155 | &core_init, | 6155 | &core_init, |
6156 | &handle_core_connect, | 6156 | &handle_core_connect, |
@@ -6212,7 +6212,7 @@ GDS_NEIGHBOURS_done (void) | |||
6212 | if (NULL == core_api) | 6212 | if (NULL == core_api) |
6213 | return; | 6213 | return; |
6214 | 6214 | ||
6215 | GNUNET_CORE_disconnecT (core_api); | 6215 | GNUNET_CORE_disconnect (core_api); |
6216 | core_api = NULL; | 6216 | core_api = NULL; |
6217 | 6217 | ||
6218 | delete_finger_table_entries(); | 6218 | delete_finger_table_entries(); |
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c index 17594efcb..8bb533961 100644 --- a/src/dht/plugin_block_dht.c +++ b/src/dht/plugin_block_dht.c | |||
@@ -70,12 +70,13 @@ block_plugin_dht_evaluate (void *cls, | |||
70 | 70 | ||
71 | if (type != GNUNET_BLOCK_TYPE_DHT_HELLO) | 71 | if (type != GNUNET_BLOCK_TYPE_DHT_HELLO) |
72 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; | 72 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; |
73 | if (xquery_size != 0) | 73 | if (0 != xquery_size) |
74 | { | 74 | { |
75 | GNUNET_break_op (0); | 75 | GNUNET_break_op (0); |
76 | return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; | 76 | return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; |
77 | } | 77 | } |
78 | if (NULL == reply_block) | 78 | if ( (NULL == reply_block) || |
79 | (0 == reply_block_size) ) | ||
79 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 80 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
80 | if (reply_block_size < sizeof (struct GNUNET_MessageHeader)) | 81 | if (reply_block_size < sizeof (struct GNUNET_MessageHeader)) |
81 | { | 82 | { |
@@ -121,14 +122,16 @@ block_plugin_dht_evaluate (void *cls, | |||
121 | * @param type block type | 122 | * @param type block type |
122 | * @param block block to get the key for | 123 | * @param block block to get the key for |
123 | * @param block_size number of bytes @a block | 124 | * @param block_size number of bytes @a block |
124 | * @param key set to the key (query) for the given block | 125 | * @param[out] key set to the key (query) for the given block |
125 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported | 126 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported |
126 | * (or if extracting a key from a block of this type does not work) | 127 | * (or if extracting a key from a block of this type does not work) |
127 | */ | 128 | */ |
128 | static int | 129 | static int |
129 | block_plugin_dht_get_key (void *cls, enum GNUNET_BLOCK_Type type, | 130 | block_plugin_dht_get_key (void *cls, |
130 | const void *block, size_t block_size, | 131 | enum GNUNET_BLOCK_Type type, |
131 | struct GNUNET_HashCode * key) | 132 | const void *block, |
133 | size_t block_size, | ||
134 | struct GNUNET_HashCode *key) | ||
132 | { | 135 | { |
133 | const struct GNUNET_MessageHeader *msg; | 136 | const struct GNUNET_MessageHeader *msg; |
134 | const struct GNUNET_HELLO_Message *hello; | 137 | const struct GNUNET_HELLO_Message *hello; |
diff --git a/src/dns/.gitignore b/src/dns/.gitignore index ef9125c50..952f6fb9a 100644 --- a/src/dns/.gitignore +++ b/src/dns/.gitignore | |||
@@ -2,3 +2,4 @@ gnunet-service-dns | |||
2 | gnunet-dns-monitor | 2 | gnunet-dns-monitor |
3 | gnunet-dns-redirector | 3 | gnunet-dns-redirector |
4 | gnunet-helper-dns | 4 | gnunet-helper-dns |
5 | test_hexcoder | ||
diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c index 4803fe3fc..e7450a1d4 100644 --- a/src/dns/dns_api.c +++ b/src/dns/dns_api.c | |||
@@ -217,7 +217,7 @@ reconnect (void *cls) | |||
217 | struct GNUNET_DNS_Register *msg; | 217 | struct GNUNET_DNS_Register *msg; |
218 | 218 | ||
219 | dh->reconnect_task = NULL; | 219 | dh->reconnect_task = NULL; |
220 | dh->mq = GNUNET_CLIENT_connecT (dh->cfg, | 220 | dh->mq = GNUNET_CLIENT_connect (dh->cfg, |
221 | "dns", | 221 | "dns", |
222 | handlers, | 222 | handlers, |
223 | &mq_error_handler, | 223 | &mq_error_handler, |
diff --git a/src/dv/dv_api.c b/src/dv/dv_api.c index 43b6c7db1..062f9a95f 100644 --- a/src/dv/dv_api.c +++ b/src/dv/dv_api.c | |||
@@ -346,7 +346,7 @@ reconnect (struct GNUNET_DV_ServiceHandle *sh) | |||
346 | sh); | 346 | sh); |
347 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 347 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
348 | "Connecting to DV service\n"); | 348 | "Connecting to DV service\n"); |
349 | sh->mq = GNUNET_CLIENT_connecT (sh->cfg, | 349 | sh->mq = GNUNET_CLIENT_connect (sh->cfg, |
350 | "dv", | 350 | "dv", |
351 | handlers, | 351 | handlers, |
352 | &mq_error_handler, | 352 | &mq_error_handler, |
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index fdd871bbd..6adaa04d9 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -1936,7 +1936,7 @@ shutdown_task (void *cls) | |||
1936 | 1936 | ||
1937 | in_shutdown = GNUNET_YES; | 1937 | in_shutdown = GNUNET_YES; |
1938 | GNUNET_assert (NULL != core_api); | 1938 | GNUNET_assert (NULL != core_api); |
1939 | GNUNET_CORE_disconnecT (core_api); | 1939 | GNUNET_CORE_disconnect (core_api); |
1940 | core_api = NULL; | 1940 | core_api = NULL; |
1941 | GNUNET_ATS_performance_done (ats); | 1941 | GNUNET_ATS_performance_done (ats); |
1942 | ats = NULL; | 1942 | ats = NULL; |
@@ -2059,7 +2059,7 @@ run (void *cls, | |||
2059 | GNUNET_NO); | 2059 | GNUNET_NO); |
2060 | all_routes = GNUNET_CONTAINER_multipeermap_create (65536, | 2060 | all_routes = GNUNET_CONTAINER_multipeermap_create (65536, |
2061 | GNUNET_NO); | 2061 | GNUNET_NO); |
2062 | core_api = GNUNET_CORE_connecT (cfg, | 2062 | core_api = GNUNET_CORE_connect (cfg, |
2063 | NULL, | 2063 | NULL, |
2064 | &core_init, | 2064 | &core_init, |
2065 | &handle_core_connect, | 2065 | &handle_core_connect, |
@@ -2073,7 +2073,7 @@ run (void *cls, | |||
2073 | NULL); | 2073 | NULL); |
2074 | if (NULL == ats) | 2074 | if (NULL == ats) |
2075 | { | 2075 | { |
2076 | GNUNET_CORE_disconnecT (core_api); | 2076 | GNUNET_CORE_disconnect (core_api); |
2077 | core_api = NULL; | 2077 | core_api = NULL; |
2078 | return; | 2078 | return; |
2079 | } | 2079 | } |
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 1b129c643..68699db71 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c | |||
@@ -747,9 +747,8 @@ get_redirect_state (int af, | |||
747 | return NULL; | 747 | return NULL; |
748 | /* Mark this connection as freshly used */ | 748 | /* Mark this connection as freshly used */ |
749 | if (NULL == state_key) | 749 | if (NULL == state_key) |
750 | GNUNET_CONTAINER_heap_update_cost (connections_heap, | 750 | GNUNET_CONTAINER_heap_update_cost (state->specifics.tcp_udp.heap_node, |
751 | state->specifics.tcp_udp.heap_node, | 751 | GNUNET_TIME_absolute_get ().abs_value_us); |
752 | GNUNET_TIME_absolute_get ().abs_value_us); | ||
753 | return state; | 752 | return state; |
754 | } | 753 | } |
755 | 754 | ||
diff --git a/src/fragmentation/.gitignore b/src/fragmentation/.gitignore new file mode 100644 index 000000000..c3293ab69 --- /dev/null +++ b/src/fragmentation/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | test_fragmentation | ||
2 | test_fragmentation_parallel | ||
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index eacc3c2df..53b836f22 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -1335,7 +1335,7 @@ do_reconnect (void *cls) | |||
1335 | }; | 1335 | }; |
1336 | 1336 | ||
1337 | dc->task = NULL; | 1337 | dc->task = NULL; |
1338 | dc->mq = GNUNET_CLIENT_connecT (dc->h->cfg, | 1338 | dc->mq = GNUNET_CLIENT_connect (dc->h->cfg, |
1339 | "fs", | 1339 | "fs", |
1340 | handlers, | 1340 | handlers, |
1341 | &download_mq_error_handler, | 1341 | &download_mq_error_handler, |
diff --git a/src/fs/fs_list_indexed.c b/src/fs/fs_list_indexed.c index 67183fce2..eec125a10 100644 --- a/src/fs/fs_list_indexed.c +++ b/src/fs/fs_list_indexed.c | |||
@@ -185,7 +185,7 @@ GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | |||
185 | struct GNUNET_MQ_Envelope *env; | 185 | struct GNUNET_MQ_Envelope *env; |
186 | struct GNUNET_MessageHeader *msg; | 186 | struct GNUNET_MessageHeader *msg; |
187 | 187 | ||
188 | gic->mq = GNUNET_CLIENT_connecT (h->cfg, | 188 | gic->mq = GNUNET_CLIENT_connect (h->cfg, |
189 | "fs", | 189 | "fs", |
190 | handlers, | 190 | handlers, |
191 | &mq_error_handler, | 191 | &mq_error_handler, |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 5820c3d0c..86a58a58b 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -863,7 +863,7 @@ hash_for_index_cb (void *cls, | |||
863 | GNUNET_free (fn); | 863 | GNUNET_free (fn); |
864 | return; | 864 | return; |
865 | } | 865 | } |
866 | pc->mq = GNUNET_CLIENT_connecT (pc->h->cfg, | 866 | pc->mq = GNUNET_CLIENT_connect (pc->h->cfg, |
867 | "fs", | 867 | "fs", |
868 | handlers, | 868 | handlers, |
869 | &index_mq_error_handler, | 869 | &index_mq_error_handler, |
@@ -1016,7 +1016,7 @@ create_loc_uri (struct GNUNET_FS_PublishContext *pc) | |||
1016 | 1016 | ||
1017 | if (NULL != pc->mq) | 1017 | if (NULL != pc->mq) |
1018 | GNUNET_MQ_destroy (pc->mq); | 1018 | GNUNET_MQ_destroy (pc->mq); |
1019 | pc->mq = GNUNET_CLIENT_connecT (pc->h->cfg, | 1019 | pc->mq = GNUNET_CLIENT_connect (pc->h->cfg, |
1020 | "fs", | 1020 | "fs", |
1021 | handlers, | 1021 | handlers, |
1022 | &loc_mq_error_handler, | 1022 | &loc_mq_error_handler, |
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 198577b08..75ce4b54f 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -1244,7 +1244,7 @@ do_reconnect (void *cls) | |||
1244 | }; | 1244 | }; |
1245 | 1245 | ||
1246 | sc->task = NULL; | 1246 | sc->task = NULL; |
1247 | sc->mq = GNUNET_CLIENT_connecT (sc->h->cfg, | 1247 | sc->mq = GNUNET_CLIENT_connect (sc->h->cfg, |
1248 | "fs", | 1248 | "fs", |
1249 | handlers, | 1249 | handlers, |
1250 | &search_mq_error_handler, | 1250 | &search_mq_error_handler, |
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 2a024ecbb..a672b84d5 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -316,7 +316,7 @@ unindex_finish (struct GNUNET_FS_UnindexContext *uc) | |||
316 | uc->seen_dh = NULL; | 316 | uc->seen_dh = NULL; |
317 | uc->state = UNINDEX_STATE_FS_NOTIFY; | 317 | uc->state = UNINDEX_STATE_FS_NOTIFY; |
318 | GNUNET_FS_unindex_sync_ (uc); | 318 | GNUNET_FS_unindex_sync_ (uc); |
319 | uc->mq = GNUNET_CLIENT_connecT (uc->h->cfg, | 319 | uc->mq = GNUNET_CLIENT_connect (uc->h->cfg, |
320 | "fs", | 320 | "fs", |
321 | handlers, | 321 | handlers, |
322 | &unindex_mq_error_handler, | 322 | &unindex_mq_error_handler, |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index c83d73555..e38fdb032 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -1181,7 +1181,7 @@ shutdown_task (void *cls) | |||
1181 | GSF_cadet_stop_server (); | 1181 | GSF_cadet_stop_server (); |
1182 | if (NULL != GSF_core) | 1182 | if (NULL != GSF_core) |
1183 | { | 1183 | { |
1184 | GNUNET_CORE_disconnecT (GSF_core); | 1184 | GNUNET_CORE_disconnect (GSF_core); |
1185 | GSF_core = NULL; | 1185 | GSF_core = NULL; |
1186 | } | 1186 | } |
1187 | if (NULL != GSF_ats) | 1187 | if (NULL != GSF_ats) |
@@ -1219,7 +1219,7 @@ shutdown_task (void *cls) | |||
1219 | 1219 | ||
1220 | 1220 | ||
1221 | /** | 1221 | /** |
1222 | * Function called after GNUNET_CORE_connecT has succeeded | 1222 | * Function called after GNUNET_CORE_connect has succeeded |
1223 | * (or failed for good). Note that the private key of the | 1223 | * (or failed for good). Note that the private key of the |
1224 | * peer is intentionally not exposed here; if you need it, | 1224 | * peer is intentionally not exposed here; if you need it, |
1225 | * your process should try to read the private key file | 1225 | * your process should try to read the private key file |
@@ -1299,7 +1299,7 @@ main_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
1299 | "I am peer %s\n", | 1299 | "I am peer %s\n", |
1300 | GNUNET_i2s (&GSF_my_id)); | 1300 | GNUNET_i2s (&GSF_my_id)); |
1301 | GSF_core | 1301 | GSF_core |
1302 | = GNUNET_CORE_connecT (GSF_cfg, | 1302 | = GNUNET_CORE_connect (GSF_cfg, |
1303 | NULL, | 1303 | NULL, |
1304 | &peer_init_handler, | 1304 | &peer_init_handler, |
1305 | &GSF_peer_connect_handler, | 1305 | &GSF_peer_connect_handler, |
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in index bf59cac15..b34246cef 100644 --- a/src/gns/gns.conf.in +++ b/src/gns/gns.conf.in | |||
@@ -5,7 +5,6 @@ HOSTNAME = localhost | |||
5 | BINARY = gnunet-service-gns | 5 | BINARY = gnunet-service-gns |
6 | UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-gns.sock | 6 | UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-gns.sock |
7 | @JAVAPORT@PORT = 2102 | 7 | @JAVAPORT@PORT = 2102 |
8 | USER_SERVICE = YES | ||
9 | 8 | ||
10 | # Do we require users that want to access GNS to run this process | 9 | # Do we require users that want to access GNS to run this process |
11 | # (usually not a good idea) | 10 | # (usually not a good idea) |
@@ -17,9 +16,6 @@ UNIX_MATCH_GID = YES | |||
17 | # How many queries is GNS allowed to perform in the background at the same time? | 16 | # How many queries is GNS allowed to perform in the background at the same time? |
18 | MAX_PARALLEL_BACKGROUND_QUERIES = 1000 | 17 | MAX_PARALLEL_BACKGROUND_QUERIES = 1000 |
19 | 18 | ||
20 | # How frequently do we try to publish our full zone? | ||
21 | ZONE_PUBLISH_TIME_WINDOW = 4 h | ||
22 | |||
23 | # Using caching or always ask DHT | 19 | # Using caching or always ask DHT |
24 | # USE_CACHE = YES | 20 | # USE_CACHE = YES |
25 | 21 | ||
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 5ad7b4fae..f6f9889ac 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c | |||
@@ -397,7 +397,7 @@ reconnect (struct GNUNET_GNS_Handle *handle) | |||
397 | GNUNET_assert (NULL == handle->mq); | 397 | GNUNET_assert (NULL == handle->mq); |
398 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 398 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
399 | "Trying to connect to GNS\n"); | 399 | "Trying to connect to GNS\n"); |
400 | handle->mq = GNUNET_CLIENT_connecT (handle->cfg, | 400 | handle->mq = GNUNET_CLIENT_connect (handle->cfg, |
401 | "gns", | 401 | "gns", |
402 | handlers, | 402 | handlers, |
403 | &mq_error_handler, | 403 | &mq_error_handler, |
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 3e718dac8..cec31ff48 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -40,43 +40,6 @@ | |||
40 | #include "gnunet-service-gns_interceptor.h" | 40 | #include "gnunet-service-gns_interceptor.h" |
41 | #include "gnunet_protocols.h" | 41 | #include "gnunet_protocols.h" |
42 | 42 | ||
43 | /** | ||
44 | * The initial interval in milliseconds btween puts in | ||
45 | * a zone iteration | ||
46 | */ | ||
47 | #define INITIAL_PUT_INTERVAL GNUNET_TIME_UNIT_MILLISECONDS | ||
48 | |||
49 | /** | ||
50 | * The lower bound for the zone iteration interval | ||
51 | */ | ||
52 | #define MINIMUM_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_SECONDS | ||
53 | |||
54 | /** | ||
55 | * The upper bound for the zone iteration interval | ||
56 | */ | ||
57 | #define MAXIMUM_ZONE_ITERATION_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | ||
58 | |||
59 | /** | ||
60 | * The default put interval for the zone iteration. In case | ||
61 | * no option is found | ||
62 | */ | ||
63 | #define DEFAULT_ZONE_PUBLISH_TIME_WINDOW GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) | ||
64 | |||
65 | /** | ||
66 | * The factor the current zone iteration interval is divided by for each | ||
67 | * additional new record | ||
68 | */ | ||
69 | #define LATE_ITERATION_SPEEDUP_FACTOR 2 | ||
70 | |||
71 | /** | ||
72 | * How long until a DHT PUT attempt should time out? | ||
73 | */ | ||
74 | #define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | ||
75 | |||
76 | /** | ||
77 | * What replication level do we use for DHT PUT operations? | ||
78 | */ | ||
79 | #define DHT_GNS_REPLICATION_LEVEL 5 | ||
80 | 43 | ||
81 | /** | 44 | /** |
82 | * GnsClient prototype | 45 | * GnsClient prototype |
@@ -146,36 +109,14 @@ struct GnsClient | |||
146 | 109 | ||
147 | 110 | ||
148 | /** | 111 | /** |
149 | * Handle for DHT PUT activity triggered from the namestore monitor. | ||
150 | */ | ||
151 | struct MonitorActivity | ||
152 | { | ||
153 | /** | ||
154 | * Kept in a DLL. | ||
155 | */ | ||
156 | struct MonitorActivity *next; | ||
157 | |||
158 | /** | ||
159 | * Kept in a DLL. | ||
160 | */ | ||
161 | struct MonitorActivity *prev; | ||
162 | |||
163 | /** | ||
164 | * Handle for the DHT PUT operation. | ||
165 | */ | ||
166 | struct GNUNET_DHT_PutHandle *ph; | ||
167 | }; | ||
168 | |||
169 | |||
170 | /** | ||
171 | * Our handle to the DHT | 112 | * Our handle to the DHT |
172 | */ | 113 | */ |
173 | static struct GNUNET_DHT_Handle *dht_handle; | 114 | static struct GNUNET_DHT_Handle *dht_handle; |
174 | 115 | ||
175 | /** | 116 | /** |
176 | * Active DHT put operation (or NULL) | 117 | * Our handle to the namecache service |
177 | */ | 118 | */ |
178 | static struct GNUNET_DHT_PutHandle *active_put; | 119 | static struct GNUNET_NAMECACHE_Handle *namecache_handle; |
179 | 120 | ||
180 | /** | 121 | /** |
181 | * Our handle to the namestore service | 122 | * Our handle to the namestore service |
@@ -183,11 +124,6 @@ static struct GNUNET_DHT_PutHandle *active_put; | |||
183 | static struct GNUNET_NAMESTORE_Handle *namestore_handle; | 124 | static struct GNUNET_NAMESTORE_Handle *namestore_handle; |
184 | 125 | ||
185 | /** | 126 | /** |
186 | * Our handle to the namecache service | ||
187 | */ | ||
188 | static struct GNUNET_NAMECACHE_Handle *namecache_handle; | ||
189 | |||
190 | /** | ||
191 | * Our handle to the identity service | 127 | * Our handle to the identity service |
192 | */ | 128 | */ |
193 | static struct GNUNET_IDENTITY_Handle *identity_handle; | 129 | static struct GNUNET_IDENTITY_Handle *identity_handle; |
@@ -199,68 +135,6 @@ static struct GNUNET_IDENTITY_Handle *identity_handle; | |||
199 | static struct GNUNET_IDENTITY_Operation *identity_op; | 135 | static struct GNUNET_IDENTITY_Operation *identity_op; |
200 | 136 | ||
201 | /** | 137 | /** |
202 | * Handle to iterate over our authoritative zone in namestore | ||
203 | */ | ||
204 | static struct GNUNET_NAMESTORE_ZoneIterator *namestore_iter; | ||
205 | |||
206 | /** | ||
207 | * Handle to monitor namestore changes to instant propagation. | ||
208 | */ | ||
209 | static struct GNUNET_NAMESTORE_ZoneMonitor *zmon; | ||
210 | |||
211 | /** | ||
212 | * Head of monitor activities; kept in a DLL. | ||
213 | */ | ||
214 | static struct MonitorActivity *ma_head; | ||
215 | |||
216 | /** | ||
217 | * Tail of monitor activities; kept in a DLL. | ||
218 | */ | ||
219 | static struct MonitorActivity *ma_tail; | ||
220 | |||
221 | /** | ||
222 | * Useful for zone update for DHT put | ||
223 | */ | ||
224 | static unsigned long long num_public_records; | ||
225 | |||
226 | /** | ||
227 | * Last seen record count | ||
228 | */ | ||
229 | static unsigned long long last_num_public_records; | ||
230 | |||
231 | /** | ||
232 | * Minimum relative expiration time of records seem during the current | ||
233 | * zone iteration. | ||
234 | */ | ||
235 | static struct GNUNET_TIME_Relative min_relative_record_time; | ||
236 | |||
237 | /** | ||
238 | * Zone iteration PUT interval. | ||
239 | */ | ||
240 | static struct GNUNET_TIME_Relative put_interval; | ||
241 | |||
242 | /** | ||
243 | * Default time window for zone iteration | ||
244 | */ | ||
245 | static struct GNUNET_TIME_Relative zone_publish_time_window_default; | ||
246 | |||
247 | /** | ||
248 | * Time window for zone iteration, adjusted based on relative record | ||
249 | * expiration times in our zone. | ||
250 | */ | ||
251 | static struct GNUNET_TIME_Relative zone_publish_time_window; | ||
252 | |||
253 | /** | ||
254 | * zone publish task | ||
255 | */ | ||
256 | static struct GNUNET_SCHEDULER_Task *zone_publish_task; | ||
257 | |||
258 | /** | ||
259 | * #GNUNET_YES if zone has never been published before | ||
260 | */ | ||
261 | static int first_zone_iteration; | ||
262 | |||
263 | /** | ||
264 | * #GNUNET_YES if ipv6 is supported | 138 | * #GNUNET_YES if ipv6 is supported |
265 | */ | 139 | */ |
266 | static int v6_enabled; | 140 | static int v6_enabled; |
@@ -285,8 +159,6 @@ static struct GNUNET_STATISTICS_Handle *statistics; | |||
285 | static void | 159 | static void |
286 | shutdown_task (void *cls) | 160 | shutdown_task (void *cls) |
287 | { | 161 | { |
288 | struct MonitorActivity *ma; | ||
289 | |||
290 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 162 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
291 | "Shutting down!\n"); | 163 | "Shutting down!\n"); |
292 | GNS_interceptor_done (); | 164 | GNS_interceptor_done (); |
@@ -303,35 +175,12 @@ shutdown_task (void *cls) | |||
303 | GNS_resolver_done (); | 175 | GNS_resolver_done (); |
304 | GNS_reverse_done (); | 176 | GNS_reverse_done (); |
305 | GNS_shorten_done (); | 177 | GNS_shorten_done (); |
306 | while (NULL != (ma = ma_head)) | ||
307 | { | ||
308 | GNUNET_DHT_put_cancel (ma->ph); | ||
309 | GNUNET_CONTAINER_DLL_remove (ma_head, | ||
310 | ma_tail, | ||
311 | ma); | ||
312 | GNUNET_free (ma); | ||
313 | } | ||
314 | if (NULL != statistics) | 178 | if (NULL != statistics) |
315 | { | 179 | { |
316 | GNUNET_STATISTICS_destroy (statistics, | 180 | GNUNET_STATISTICS_destroy (statistics, |
317 | GNUNET_NO); | 181 | GNUNET_NO); |
318 | statistics = NULL; | 182 | statistics = NULL; |
319 | } | 183 | } |
320 | if (NULL != zone_publish_task) | ||
321 | { | ||
322 | GNUNET_SCHEDULER_cancel (zone_publish_task); | ||
323 | zone_publish_task = NULL; | ||
324 | } | ||
325 | if (NULL != namestore_iter) | ||
326 | { | ||
327 | GNUNET_NAMESTORE_zone_iteration_stop (namestore_iter); | ||
328 | namestore_iter = NULL; | ||
329 | } | ||
330 | if (NULL != zmon) | ||
331 | { | ||
332 | GNUNET_NAMESTORE_zone_monitor_stop (zmon); | ||
333 | zmon = NULL; | ||
334 | } | ||
335 | if (NULL != namestore_handle) | 184 | if (NULL != namestore_handle) |
336 | { | 185 | { |
337 | GNUNET_NAMESTORE_disconnect (namestore_handle); | 186 | GNUNET_NAMESTORE_disconnect (namestore_handle); |
@@ -342,11 +191,6 @@ shutdown_task (void *cls) | |||
342 | GNUNET_NAMECACHE_disconnect (namecache_handle); | 191 | GNUNET_NAMECACHE_disconnect (namecache_handle); |
343 | namecache_handle = NULL; | 192 | namecache_handle = NULL; |
344 | } | 193 | } |
345 | if (NULL != active_put) | ||
346 | { | ||
347 | GNUNET_DHT_put_cancel (active_put); | ||
348 | active_put = NULL; | ||
349 | } | ||
350 | if (NULL != dht_handle) | 194 | if (NULL != dht_handle) |
351 | { | 195 | { |
352 | GNUNET_DHT_disconnect (dht_handle); | 196 | GNUNET_DHT_disconnect (dht_handle); |
@@ -354,6 +198,7 @@ shutdown_task (void *cls) | |||
354 | } | 198 | } |
355 | } | 199 | } |
356 | 200 | ||
201 | |||
357 | /** | 202 | /** |
358 | * Called whenever a client is disconnected. | 203 | * Called whenever a client is disconnected. |
359 | * | 204 | * |
@@ -413,408 +258,6 @@ client_connect_cb (void *cls, | |||
413 | 258 | ||
414 | 259 | ||
415 | /** | 260 | /** |
416 | * Method called periodically that triggers iteration over authoritative records | ||
417 | * | ||
418 | * @param cls closure | ||
419 | */ | ||
420 | static void | ||
421 | publish_zone_dht_next (void *cls) | ||
422 | { | ||
423 | zone_publish_task = NULL; | ||
424 | GNUNET_assert (NULL != namestore_iter); | ||
425 | GNUNET_NAMESTORE_zone_iterator_next (namestore_iter); | ||
426 | } | ||
427 | |||
428 | |||
429 | /** | ||
430 | * Periodically iterate over our zone and store everything in dht | ||
431 | * | ||
432 | * @param cls NULL | ||
433 | */ | ||
434 | static void | ||
435 | publish_zone_dht_start (void *cls); | ||
436 | |||
437 | |||
438 | /** | ||
439 | * Continuation called from DHT once the PUT operation is done. | ||
440 | * | ||
441 | * @param cls closure, NULL if called from regular iteration, | ||
442 | * `struct MonitorActivity` if called from #handle_monitor_event. | ||
443 | * @param success #GNUNET_OK on success | ||
444 | */ | ||
445 | static void | ||
446 | dht_put_continuation (void *cls, | ||
447 | int success) | ||
448 | { | ||
449 | struct MonitorActivity *ma = cls; | ||
450 | struct GNUNET_TIME_Relative next_put_interval; | ||
451 | |||
452 | num_public_records++; | ||
453 | if (NULL == ma) | ||
454 | { | ||
455 | active_put = NULL; | ||
456 | if ( (num_public_records > last_num_public_records) && | ||
457 | (GNUNET_NO == first_zone_iteration) ) | ||
458 | { | ||
459 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
460 | "Last record count was lower than current record count. Reducing interval.\n"); | ||
461 | put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, | ||
462 | num_public_records); | ||
463 | next_put_interval = GNUNET_TIME_relative_divide (put_interval, | ||
464 | LATE_ITERATION_SPEEDUP_FACTOR); | ||
465 | } | ||
466 | else | ||
467 | next_put_interval = put_interval; | ||
468 | next_put_interval = GNUNET_TIME_relative_min (next_put_interval, | ||
469 | MAXIMUM_ZONE_ITERATION_INTERVAL); | ||
470 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
471 | "PUT complete, next PUT in %s!\n", | ||
472 | GNUNET_STRINGS_relative_time_to_string (next_put_interval, | ||
473 | GNUNET_YES)); | ||
474 | |||
475 | GNUNET_STATISTICS_set (statistics, | ||
476 | "Current zone iteration interval (ms)", | ||
477 | next_put_interval.rel_value_us / 1000LL, | ||
478 | GNUNET_NO); | ||
479 | GNUNET_assert (NULL == zone_publish_task); | ||
480 | zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval, | ||
481 | &publish_zone_dht_next, | ||
482 | NULL); | ||
483 | } | ||
484 | else | ||
485 | { | ||
486 | GNUNET_CONTAINER_DLL_remove (ma_head, | ||
487 | ma_tail, | ||
488 | ma); | ||
489 | GNUNET_free (ma); | ||
490 | } | ||
491 | } | ||
492 | |||
493 | |||
494 | /** | ||
495 | * Convert namestore records from the internal format to that | ||
496 | * suitable for publication (removes private records, converts | ||
497 | * to absolute expiration time). | ||
498 | * | ||
499 | * @param rd input records | ||
500 | * @param rd_count size of the @a rd and @a rd_public arrays | ||
501 | * @param rd_public where to write the converted records | ||
502 | * @return number of records written to @a rd_public | ||
503 | */ | ||
504 | static unsigned int | ||
505 | convert_records_for_export (const struct GNUNET_GNSRECORD_Data *rd, | ||
506 | unsigned int rd_count, | ||
507 | struct GNUNET_GNSRECORD_Data *rd_public) | ||
508 | { | ||
509 | struct GNUNET_TIME_Absolute now; | ||
510 | unsigned int rd_public_count; | ||
511 | unsigned int i; | ||
512 | |||
513 | rd_public_count = 0; | ||
514 | now = GNUNET_TIME_absolute_get (); | ||
515 | for (i=0;i<rd_count;i++) | ||
516 | if (0 == (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE)) | ||
517 | { | ||
518 | rd_public[rd_public_count] = rd[i]; | ||
519 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | ||
520 | { | ||
521 | /* GNUNET_GNSRECORD_block_create will convert to absolute time; | ||
522 | we just need to adjust our iteration frequency */ | ||
523 | min_relative_record_time.rel_value_us = | ||
524 | GNUNET_MIN (rd_public[rd_public_count].expiration_time, | ||
525 | min_relative_record_time.rel_value_us); | ||
526 | } | ||
527 | else if (rd_public[rd_public_count].expiration_time < now.abs_value_us) | ||
528 | { | ||
529 | /* record already expired, skip it */ | ||
530 | continue; | ||
531 | } | ||
532 | rd_public_count++; | ||
533 | } | ||
534 | return rd_public_count; | ||
535 | } | ||
536 | |||
537 | |||
538 | /** | ||
539 | * Store GNS records in the DHT. | ||
540 | * | ||
541 | * @param key key of the zone | ||
542 | * @param label label to store under | ||
543 | * @param rd_public public record data | ||
544 | * @param rd_public_count number of records in @a rd_public | ||
545 | * @param pc_arg closure argument to pass to the #dht_put_continuation | ||
546 | * @return DHT PUT handle, NULL on error | ||
547 | */ | ||
548 | static struct GNUNET_DHT_PutHandle * | ||
549 | perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | ||
550 | const char *label, | ||
551 | const struct GNUNET_GNSRECORD_Data *rd_public, | ||
552 | unsigned int rd_public_count, | ||
553 | void *pc_arg) | ||
554 | { | ||
555 | struct GNUNET_GNSRECORD_Block *block; | ||
556 | struct GNUNET_HashCode query; | ||
557 | struct GNUNET_TIME_Absolute expire; | ||
558 | size_t block_size; | ||
559 | struct GNUNET_DHT_PutHandle *ret; | ||
560 | |||
561 | expire = GNUNET_GNSRECORD_record_get_expiration_time (rd_public_count, | ||
562 | rd_public); | ||
563 | block = GNUNET_GNSRECORD_block_create (key, | ||
564 | expire, | ||
565 | label, | ||
566 | rd_public, | ||
567 | rd_public_count); | ||
568 | if (NULL == block) | ||
569 | return NULL; /* whoops */ | ||
570 | block_size = ntohl (block->purpose.size) | ||
571 | + sizeof (struct GNUNET_CRYPTO_EcdsaSignature) | ||
572 | + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); | ||
573 | GNUNET_GNSRECORD_query_from_private_key (key, | ||
574 | label, | ||
575 | &query); | ||
576 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
577 | "Storing %u record(s) for label `%s' in DHT with expiration `%s' under key %s\n", | ||
578 | rd_public_count, | ||
579 | label, | ||
580 | GNUNET_STRINGS_absolute_time_to_string (expire), | ||
581 | GNUNET_h2s (&query)); | ||
582 | ret = GNUNET_DHT_put (dht_handle, | ||
583 | &query, | ||
584 | DHT_GNS_REPLICATION_LEVEL, | ||
585 | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, | ||
586 | GNUNET_BLOCK_TYPE_GNS_NAMERECORD, | ||
587 | block_size, | ||
588 | block, | ||
589 | expire, | ||
590 | &dht_put_continuation, | ||
591 | pc_arg); | ||
592 | GNUNET_free (block); | ||
593 | return ret; | ||
594 | } | ||
595 | |||
596 | |||
597 | /** | ||
598 | * We encountered an error in our zone iteration. | ||
599 | */ | ||
600 | static void | ||
601 | zone_iteration_error (void *cls) | ||
602 | { | ||
603 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
604 | "Got disconnected from namestore database, retrying.\n"); | ||
605 | namestore_iter = NULL; | ||
606 | /* We end up here on error/disconnect/shutdown, so potentially | ||
607 | while a zone publish task or a DHT put is still running; hence | ||
608 | we need to cancel those. */ | ||
609 | if (NULL != zone_publish_task) | ||
610 | { | ||
611 | GNUNET_SCHEDULER_cancel (zone_publish_task); | ||
612 | zone_publish_task = NULL; | ||
613 | } | ||
614 | if (NULL != active_put) | ||
615 | { | ||
616 | GNUNET_DHT_put_cancel (active_put); | ||
617 | active_put = NULL; | ||
618 | } | ||
619 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | ||
620 | NULL); | ||
621 | } | ||
622 | |||
623 | |||
624 | /** | ||
625 | * Zone iteration is completed. | ||
626 | */ | ||
627 | static void | ||
628 | zone_iteration_finished (void *cls) | ||
629 | { | ||
630 | /* we're done with one iteration, calculate when to do the next one */ | ||
631 | namestore_iter = NULL; | ||
632 | last_num_public_records = num_public_records; | ||
633 | first_zone_iteration = GNUNET_NO; | ||
634 | if (0 == num_public_records) | ||
635 | { | ||
636 | /** | ||
637 | * If no records are known (startup) or none present | ||
638 | * we can safely set the interval to the value for a single | ||
639 | * record | ||
640 | */ | ||
641 | put_interval = zone_publish_time_window; | ||
642 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | ||
643 | "No records in namestore database.\n"); | ||
644 | } | ||
645 | else | ||
646 | { | ||
647 | /* If records are present, next publication is based on the minimum | ||
648 | * relative expiration time of the records published divided by 4 | ||
649 | */ | ||
650 | zone_publish_time_window | ||
651 | = GNUNET_TIME_relative_min (GNUNET_TIME_relative_divide (min_relative_record_time, 4), | ||
652 | zone_publish_time_window_default); | ||
653 | put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, | ||
654 | num_public_records); | ||
655 | } | ||
656 | /* reset for next iteration */ | ||
657 | min_relative_record_time = GNUNET_TIME_UNIT_FOREVER_REL; | ||
658 | put_interval = GNUNET_TIME_relative_max (MINIMUM_ZONE_ITERATION_INTERVAL, | ||
659 | put_interval); | ||
660 | put_interval = GNUNET_TIME_relative_min (put_interval, | ||
661 | MAXIMUM_ZONE_ITERATION_INTERVAL); | ||
662 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
663 | "Zone iteration finished. Adjusted zone iteration interval to %s\n", | ||
664 | GNUNET_STRINGS_relative_time_to_string (put_interval, | ||
665 | GNUNET_YES)); | ||
666 | GNUNET_STATISTICS_set (statistics, | ||
667 | "Current zone iteration interval (in ms)", | ||
668 | put_interval.rel_value_us / 1000LL, | ||
669 | GNUNET_NO); | ||
670 | GNUNET_STATISTICS_update (statistics, | ||
671 | "Number of zone iterations", | ||
672 | 1, | ||
673 | GNUNET_NO); | ||
674 | GNUNET_STATISTICS_set (statistics, | ||
675 | "Number of public records in DHT", | ||
676 | last_num_public_records, | ||
677 | GNUNET_NO); | ||
678 | GNUNET_assert (NULL == zone_publish_task); | ||
679 | if (0 == num_public_records) | ||
680 | zone_publish_task = GNUNET_SCHEDULER_add_delayed (put_interval, | ||
681 | &publish_zone_dht_start, | ||
682 | NULL); | ||
683 | else | ||
684 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | ||
685 | NULL); | ||
686 | } | ||
687 | |||
688 | |||
689 | /** | ||
690 | * Function used to put all records successively into the DHT. | ||
691 | * | ||
692 | * @param cls the closure (NULL) | ||
693 | * @param key the private key of the authority (ours) | ||
694 | * @param label the name of the records, NULL once the iteration is done | ||
695 | * @param rd_count the number of records in @a rd | ||
696 | * @param rd the record data | ||
697 | */ | ||
698 | static void | ||
699 | put_gns_record (void *cls, | ||
700 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | ||
701 | const char *label, | ||
702 | unsigned int rd_count, | ||
703 | const struct GNUNET_GNSRECORD_Data *rd) | ||
704 | { | ||
705 | struct GNUNET_GNSRECORD_Data rd_public[rd_count]; | ||
706 | unsigned int rd_public_count; | ||
707 | |||
708 | rd_public_count = convert_records_for_export (rd, | ||
709 | rd_count, | ||
710 | rd_public); | ||
711 | |||
712 | if (0 == rd_public_count) | ||
713 | { | ||
714 | GNUNET_assert (NULL == zone_publish_task); | ||
715 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
716 | "Record set empty, moving to next record set\n"); | ||
717 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_next, | ||
718 | NULL); | ||
719 | return; | ||
720 | } | ||
721 | /* We got a set of records to publish */ | ||
722 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
723 | "Starting DHT PUT\n"); | ||
724 | active_put = perform_dht_put (key, | ||
725 | label, | ||
726 | rd_public, | ||
727 | rd_public_count, | ||
728 | NULL); | ||
729 | if (NULL == active_put) | ||
730 | { | ||
731 | GNUNET_break (0); | ||
732 | dht_put_continuation (NULL, GNUNET_NO); | ||
733 | } | ||
734 | } | ||
735 | |||
736 | |||
737 | /** | ||
738 | * Periodically iterate over all zones and store everything in DHT | ||
739 | * | ||
740 | * @param cls NULL | ||
741 | */ | ||
742 | static void | ||
743 | publish_zone_dht_start (void *cls) | ||
744 | { | ||
745 | zone_publish_task = NULL; | ||
746 | |||
747 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
748 | "Starting DHT zone update!\n"); | ||
749 | /* start counting again */ | ||
750 | num_public_records = 0; | ||
751 | GNUNET_assert (NULL == namestore_iter); | ||
752 | namestore_iter | ||
753 | = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle, | ||
754 | NULL, /* All zones */ | ||
755 | &zone_iteration_error, | ||
756 | NULL, | ||
757 | &put_gns_record, | ||
758 | NULL, | ||
759 | &zone_iteration_finished, | ||
760 | NULL); | ||
761 | } | ||
762 | |||
763 | |||
764 | /** | ||
765 | * Process a record that was stored in the namestore | ||
766 | * (invoked by the monitor). | ||
767 | * | ||
768 | * @param cls closure, NULL | ||
769 | * @param zone private key of the zone; NULL on disconnect | ||
770 | * @param label label of the records; NULL on disconnect | ||
771 | * @param rd_count number of entries in @a rd array, 0 if label was deleted | ||
772 | * @param rd array of records with data to store | ||
773 | */ | ||
774 | static void | ||
775 | handle_monitor_event (void *cls, | ||
776 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | ||
777 | const char *label, | ||
778 | unsigned int rd_count, | ||
779 | const struct GNUNET_GNSRECORD_Data *rd) | ||
780 | { | ||
781 | struct GNUNET_GNSRECORD_Data rd_public[rd_count]; | ||
782 | unsigned int rd_public_count; | ||
783 | struct MonitorActivity *ma; | ||
784 | |||
785 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
786 | "Received %u records for label `%s' via namestore monitor\n", | ||
787 | rd_count, | ||
788 | label); | ||
789 | /* filter out records that are not public, and convert to | ||
790 | absolute expiration time. */ | ||
791 | rd_public_count = convert_records_for_export (rd, | ||
792 | rd_count, | ||
793 | rd_public); | ||
794 | if (0 == rd_public_count) | ||
795 | return; /* nothing to do */ | ||
796 | ma = GNUNET_new (struct MonitorActivity); | ||
797 | ma->ph = perform_dht_put (zone, | ||
798 | label, | ||
799 | rd, | ||
800 | rd_count, | ||
801 | ma); | ||
802 | if (NULL == ma->ph) | ||
803 | { | ||
804 | /* PUT failed, do not remember operation */ | ||
805 | GNUNET_free (ma); | ||
806 | return; | ||
807 | } | ||
808 | GNUNET_CONTAINER_DLL_insert (ma_head, | ||
809 | ma_tail, | ||
810 | ma); | ||
811 | } | ||
812 | |||
813 | |||
814 | /* END DHT ZONE PROPAGATION */ | ||
815 | |||
816 | |||
817 | /** | ||
818 | * Reply to client with the result from our lookup. | 261 | * Reply to client with the result from our lookup. |
819 | * | 262 | * |
820 | * @param cls the closure (our client lookup handle) | 263 | * @param cls the closure (our client lookup handle) |
@@ -1020,49 +463,6 @@ handle_rev_lookup (void *cls, | |||
1020 | 463 | ||
1021 | 464 | ||
1022 | /** | 465 | /** |
1023 | * The zone monitor is now in SYNC with the current state of the | ||
1024 | * name store. Start to perform periodic iterations. | ||
1025 | * | ||
1026 | * @param cls NULL | ||
1027 | */ | ||
1028 | static void | ||
1029 | monitor_sync_event (void *cls) | ||
1030 | { | ||
1031 | GNUNET_assert (NULL == zone_publish_task); | ||
1032 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | ||
1033 | NULL); | ||
1034 | } | ||
1035 | |||
1036 | |||
1037 | /** | ||
1038 | * The zone monitor is now in SYNC with the current state of the | ||
1039 | * name store. Start to perform periodic iterations. | ||
1040 | * | ||
1041 | * @param cls NULL | ||
1042 | */ | ||
1043 | static void | ||
1044 | handle_monitor_error (void *cls) | ||
1045 | { | ||
1046 | if (NULL != zone_publish_task) | ||
1047 | { | ||
1048 | GNUNET_SCHEDULER_cancel (zone_publish_task); | ||
1049 | zone_publish_task = NULL; | ||
1050 | } | ||
1051 | if (NULL != namestore_iter) | ||
1052 | { | ||
1053 | GNUNET_NAMESTORE_zone_iteration_stop (namestore_iter); | ||
1054 | namestore_iter = NULL; | ||
1055 | } | ||
1056 | if (NULL != active_put) | ||
1057 | { | ||
1058 | GNUNET_DHT_put_cancel (active_put); | ||
1059 | active_put = NULL; | ||
1060 | } | ||
1061 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | ||
1062 | NULL); | ||
1063 | } | ||
1064 | |||
1065 | /** | ||
1066 | * Method called to inform about the ego to be used for the master zone | 466 | * Method called to inform about the ego to be used for the master zone |
1067 | * for DNS interceptions. | 467 | * for DNS interceptions. |
1068 | * | 468 | * |
@@ -1107,7 +507,6 @@ identity_reverse_cb (void *cls, | |||
1107 | } | 507 | } |
1108 | 508 | ||
1109 | 509 | ||
1110 | |||
1111 | /** | 510 | /** |
1112 | * Method called to inform about the ego to be used for the master zone | 511 | * Method called to inform about the ego to be used for the master zone |
1113 | * for DNS interceptions. | 512 | * for DNS interceptions. |
@@ -1175,11 +574,10 @@ run (void *cls, | |||
1175 | const struct GNUNET_CONFIGURATION_Handle *c, | 574 | const struct GNUNET_CONFIGURATION_Handle *c, |
1176 | struct GNUNET_SERVICE_Handle *service) | 575 | struct GNUNET_SERVICE_Handle *service) |
1177 | { | 576 | { |
1178 | unsigned long long max_parallel_bg_queries = 0; | 577 | unsigned long long max_parallel_bg_queries = 16; |
1179 | 578 | ||
1180 | v6_enabled = GNUNET_NETWORK_test_pf (PF_INET6); | 579 | v6_enabled = GNUNET_NETWORK_test_pf (PF_INET6); |
1181 | v4_enabled = GNUNET_NETWORK_test_pf (PF_INET); | 580 | v4_enabled = GNUNET_NETWORK_test_pf (PF_INET); |
1182 | min_relative_record_time = GNUNET_TIME_UNIT_FOREVER_REL; | ||
1183 | namestore_handle = GNUNET_NAMESTORE_connect (c); | 581 | namestore_handle = GNUNET_NAMESTORE_connect (c); |
1184 | if (NULL == namestore_handle) | 582 | if (NULL == namestore_handle) |
1185 | { | 583 | { |
@@ -1188,7 +586,7 @@ run (void *cls, | |||
1188 | GNUNET_SCHEDULER_shutdown (); | 586 | GNUNET_SCHEDULER_shutdown (); |
1189 | return; | 587 | return; |
1190 | } | 588 | } |
1191 | namecache_handle = GNUNET_NAMECACHE_connect (c); | 589 | namecache_handle = GNUNET_NAMECACHE_connect (c); |
1192 | if (NULL == namecache_handle) | 590 | if (NULL == namecache_handle) |
1193 | { | 591 | { |
1194 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 592 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -1196,22 +594,9 @@ run (void *cls, | |||
1196 | GNUNET_SCHEDULER_shutdown (); | 594 | GNUNET_SCHEDULER_shutdown (); |
1197 | return; | 595 | return; |
1198 | } | 596 | } |
1199 | |||
1200 | put_interval = INITIAL_PUT_INTERVAL; | ||
1201 | zone_publish_time_window_default = DEFAULT_ZONE_PUBLISH_TIME_WINDOW; | ||
1202 | if (GNUNET_OK == | 597 | if (GNUNET_OK == |
1203 | GNUNET_CONFIGURATION_get_value_time (c, "gns", | 598 | GNUNET_CONFIGURATION_get_value_number (c, |
1204 | "ZONE_PUBLISH_TIME_WINDOW", | 599 | "gns", |
1205 | &zone_publish_time_window_default)) | ||
1206 | { | ||
1207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1208 | "Time window for zone iteration: %s\n", | ||
1209 | GNUNET_STRINGS_relative_time_to_string (zone_publish_time_window, | ||
1210 | GNUNET_YES)); | ||
1211 | } | ||
1212 | zone_publish_time_window = zone_publish_time_window_default; | ||
1213 | if (GNUNET_OK == | ||
1214 | GNUNET_CONFIGURATION_get_value_number (c, "gns", | ||
1215 | "MAX_PARALLEL_BACKGROUND_QUERIES", | 600 | "MAX_PARALLEL_BACKGROUND_QUERIES", |
1216 | &max_parallel_bg_queries)) | 601 | &max_parallel_bg_queries)) |
1217 | { | 602 | { |
@@ -1219,7 +604,6 @@ run (void *cls, | |||
1219 | "Number of allowed parallel background queries: %llu\n", | 604 | "Number of allowed parallel background queries: %llu\n", |
1220 | max_parallel_bg_queries); | 605 | max_parallel_bg_queries); |
1221 | } | 606 | } |
1222 | |||
1223 | dht_handle = GNUNET_DHT_connect (c, | 607 | dht_handle = GNUNET_DHT_connect (c, |
1224 | (unsigned int) max_parallel_bg_queries); | 608 | (unsigned int) max_parallel_bg_queries); |
1225 | if (NULL == dht_handle) | 609 | if (NULL == dht_handle) |
@@ -1254,19 +638,7 @@ run (void *cls, | |||
1254 | GNS_shorten_init (namestore_handle, | 638 | GNS_shorten_init (namestore_handle, |
1255 | namecache_handle, | 639 | namecache_handle, |
1256 | dht_handle); | 640 | dht_handle); |
1257 | /* Schedule periodic put for our records. */ | ||
1258 | first_zone_iteration = GNUNET_YES; | ||
1259 | statistics = GNUNET_STATISTICS_create ("gns", c); | 641 | statistics = GNUNET_STATISTICS_create ("gns", c); |
1260 | zmon = GNUNET_NAMESTORE_zone_monitor_start (c, | ||
1261 | NULL, | ||
1262 | GNUNET_NO, | ||
1263 | &handle_monitor_error, | ||
1264 | NULL, | ||
1265 | &handle_monitor_event, | ||
1266 | NULL, | ||
1267 | &monitor_sync_event, | ||
1268 | NULL); | ||
1269 | GNUNET_break (NULL != zmon); | ||
1270 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | 642 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
1271 | } | 643 | } |
1272 | 644 | ||
diff --git a/src/gns/gnunet-service-gns_reverser.c b/src/gns/gnunet-service-gns_reverser.c index 931dc6809..b5b8b31b7 100644 --- a/src/gns/gnunet-service-gns_reverser.c +++ b/src/gns/gnunet-service-gns_reverser.c | |||
@@ -394,6 +394,7 @@ handle_gns_result_iter (void *cls, | |||
394 | it_task = GNUNET_SCHEDULER_add_now (&next_it, ith); | 394 | it_task = GNUNET_SCHEDULER_add_now (&next_it, ith); |
395 | } | 395 | } |
396 | 396 | ||
397 | |||
397 | static void | 398 | static void |
398 | next_it (void *cls) | 399 | next_it (void *cls) |
399 | { | 400 | { |
@@ -402,6 +403,7 @@ next_it (void *cls) | |||
402 | GNUNET_NAMESTORE_zone_iterator_next (namestore_iter); | 403 | GNUNET_NAMESTORE_zone_iterator_next (namestore_iter); |
403 | } | 404 | } |
404 | 405 | ||
406 | |||
405 | static void | 407 | static void |
406 | iterator_cb (void *cls, | 408 | iterator_cb (void *cls, |
407 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 409 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
@@ -487,6 +489,7 @@ store_reverse (void *cls, | |||
487 | GNUNET_free (ith); | 489 | GNUNET_free (ith); |
488 | } | 490 | } |
489 | 491 | ||
492 | |||
490 | static void | 493 | static void |
491 | finished_cb (void *cls) | 494 | finished_cb (void *cls) |
492 | { | 495 | { |
@@ -522,6 +525,7 @@ finished_cb (void *cls) | |||
522 | 525 | ||
523 | } | 526 | } |
524 | 527 | ||
528 | |||
525 | static void | 529 | static void |
526 | it_error (void *cls) | 530 | it_error (void *cls) |
527 | { | 531 | { |
@@ -529,6 +533,7 @@ it_error (void *cls) | |||
529 | "Error iterating for REVERSE\n"); | 533 | "Error iterating for REVERSE\n"); |
530 | } | 534 | } |
531 | 535 | ||
536 | |||
532 | static void | 537 | static void |
533 | check_reverse_records (void *cls) | 538 | check_reverse_records (void *cls) |
534 | { | 539 | { |
diff --git a/src/gnsrecord/.gitignore b/src/gnsrecord/.gitignore new file mode 100644 index 000000000..374abdb60 --- /dev/null +++ b/src/gnsrecord/.gitignore | |||
@@ -0,0 +1,4 @@ | |||
1 | test_gnsrecord_block_expiration | ||
2 | test_gnsrecord_crypto | ||
3 | test_gnsrecord_serialization | ||
4 | zonefiles | ||
diff --git a/src/hello/.gitignore b/src/hello/.gitignore index 237e1a10e..bb49ceb20 100644 --- a/src/hello/.gitignore +++ b/src/hello/.gitignore | |||
@@ -1 +1,3 @@ | |||
1 | gnunet-hello | 1 | gnunet-hello |
2 | test_friend_hello | ||
3 | test_hello | ||
diff --git a/src/hostlist/.gitignore b/src/hostlist/.gitignore index f20bc2d58..b16e3444a 100644 --- a/src/hostlist/.gitignore +++ b/src/hostlist/.gitignore | |||
@@ -1 +1,4 @@ | |||
1 | gnunet-daemon-hostlist | 1 | gnunet-daemon-hostlist |
2 | test_gnunet_daemon_hostlist | ||
3 | test_gnunet_daemon_hostlist_learning | ||
4 | test_gnunet_daemon_hostlist_reconnect | ||
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 7181a913b..a83d46e07 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c | |||
@@ -47,7 +47,7 @@ static int provide_hostlist; | |||
47 | /** | 47 | /** |
48 | * Handle to hostlist server's connect handler | 48 | * Handle to hostlist server's connect handler |
49 | */ | 49 | */ |
50 | static GNUNET_CORE_ConnecTEventHandler server_ch; | 50 | static GNUNET_CORE_ConnectEventHandler server_ch; |
51 | 51 | ||
52 | #endif | 52 | #endif |
53 | 53 | ||
@@ -81,12 +81,12 @@ static GNUNET_HOSTLIST_UriHandler client_adv_handler; | |||
81 | /** | 81 | /** |
82 | * Handle to hostlist client's connect handler | 82 | * Handle to hostlist client's connect handler |
83 | */ | 83 | */ |
84 | static GNUNET_CORE_ConnecTEventHandler client_ch; | 84 | static GNUNET_CORE_ConnectEventHandler client_ch; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Handle to hostlist client's disconnect handler | 87 | * Handle to hostlist client's disconnect handler |
88 | */ | 88 | */ |
89 | static GNUNET_CORE_DisconnecTEventHandler client_dh; | 89 | static GNUNET_CORE_DisconnectEventHandler client_dh; |
90 | 90 | ||
91 | GNUNET_NETWORK_STRUCT_BEGIN | 91 | GNUNET_NETWORK_STRUCT_BEGIN |
92 | 92 | ||
@@ -260,7 +260,7 @@ cleaning_task (void *cls) | |||
260 | "Hostlist daemon is shutting down\n"); | 260 | "Hostlist daemon is shutting down\n"); |
261 | if (NULL != core) | 261 | if (NULL != core) |
262 | { | 262 | { |
263 | GNUNET_CORE_disconnecT (core); | 263 | GNUNET_CORE_disconnect (core); |
264 | core = NULL; | 264 | core = NULL; |
265 | } | 265 | } |
266 | if (bootstrapping) | 266 | if (bootstrapping) |
@@ -330,7 +330,7 @@ run (void *cls, | |||
330 | &client_adv_handler, | 330 | &client_adv_handler, |
331 | learning); | 331 | learning); |
332 | core = | 332 | core = |
333 | GNUNET_CORE_connecT (cfg, | 333 | GNUNET_CORE_connect (cfg, |
334 | NULL, | 334 | NULL, |
335 | &core_init, | 335 | &core_init, |
336 | &connect_handler, | 336 | &connect_handler, |
diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index c1a2c2721..a973fcc28 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c | |||
@@ -1548,8 +1548,8 @@ save_hostlist_file (int shutdown) | |||
1548 | int | 1548 | int |
1549 | GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, | 1549 | GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, |
1550 | struct GNUNET_STATISTICS_Handle *st, | 1550 | struct GNUNET_STATISTICS_Handle *st, |
1551 | GNUNET_CORE_ConnecTEventHandler *ch, | 1551 | GNUNET_CORE_ConnectEventHandler *ch, |
1552 | GNUNET_CORE_DisconnecTEventHandler *dh, | 1552 | GNUNET_CORE_DisconnectEventHandler *dh, |
1553 | GNUNET_HOSTLIST_UriHandler *msgh, | 1553 | GNUNET_HOSTLIST_UriHandler *msgh, |
1554 | int learn) | 1554 | int learn) |
1555 | { | 1555 | { |
diff --git a/src/hostlist/gnunet-daemon-hostlist_client.h b/src/hostlist/gnunet-daemon-hostlist_client.h index dd80d4a48..e41b90876 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.h +++ b/src/hostlist/gnunet-daemon-hostlist_client.h | |||
@@ -53,8 +53,8 @@ typedef void | |||
53 | int | 53 | int |
54 | GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, | 54 | GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, |
55 | struct GNUNET_STATISTICS_Handle *st, | 55 | struct GNUNET_STATISTICS_Handle *st, |
56 | GNUNET_CORE_ConnecTEventHandler *ch, | 56 | GNUNET_CORE_ConnectEventHandler *ch, |
57 | GNUNET_CORE_DisconnecTEventHandler *dh, | 57 | GNUNET_CORE_DisconnectEventHandler *dh, |
58 | GNUNET_HOSTLIST_UriHandler *msgh, | 58 | GNUNET_HOSTLIST_UriHandler *msgh, |
59 | int learn); | 59 | int learn); |
60 | 60 | ||
diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c b/src/hostlist/gnunet-daemon-hostlist_server.c index b01dbc09e..48c1a5622 100644 --- a/src/hostlist/gnunet-daemon-hostlist_server.c +++ b/src/hostlist/gnunet-daemon-hostlist_server.c | |||
@@ -644,7 +644,7 @@ int | |||
644 | GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c, | 644 | GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c, |
645 | struct GNUNET_STATISTICS_Handle *st, | 645 | struct GNUNET_STATISTICS_Handle *st, |
646 | struct GNUNET_CORE_Handle *co, | 646 | struct GNUNET_CORE_Handle *co, |
647 | GNUNET_CORE_ConnecTEventHandler *server_ch, | 647 | GNUNET_CORE_ConnectEventHandler *server_ch, |
648 | int advertise) | 648 | int advertise) |
649 | { | 649 | { |
650 | unsigned long long port; | 650 | unsigned long long port; |
diff --git a/src/hostlist/gnunet-daemon-hostlist_server.h b/src/hostlist/gnunet-daemon-hostlist_server.h index f18ad0ca2..d9f778a4b 100644 --- a/src/hostlist/gnunet-daemon-hostlist_server.h +++ b/src/hostlist/gnunet-daemon-hostlist_server.h | |||
@@ -46,7 +46,7 @@ int | |||
46 | GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c, | 46 | GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c, |
47 | struct GNUNET_STATISTICS_Handle *st, | 47 | struct GNUNET_STATISTICS_Handle *st, |
48 | struct GNUNET_CORE_Handle *core, | 48 | struct GNUNET_CORE_Handle *core, |
49 | GNUNET_CORE_ConnecTEventHandler *server_ch, | 49 | GNUNET_CORE_ConnectEventHandler *server_ch, |
50 | int advertise); | 50 | int advertise); |
51 | 51 | ||
52 | 52 | ||
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index c39c57eb3..88ad22a1a 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c | |||
@@ -125,12 +125,12 @@ shutdown_testcase () | |||
125 | } | 125 | } |
126 | if (NULL != adv_peer.core) | 126 | if (NULL != adv_peer.core) |
127 | { | 127 | { |
128 | GNUNET_CORE_disconnecT (adv_peer.core); | 128 | GNUNET_CORE_disconnect (adv_peer.core); |
129 | adv_peer.core = NULL; | 129 | adv_peer.core = NULL; |
130 | } | 130 | } |
131 | if (NULL != learn_peer.core) | 131 | if (NULL != learn_peer.core) |
132 | { | 132 | { |
133 | GNUNET_CORE_disconnecT (learn_peer.core); | 133 | GNUNET_CORE_disconnect (learn_peer.core); |
134 | learn_peer.core = NULL; | 134 | learn_peer.core = NULL; |
135 | } | 135 | } |
136 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 136 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -432,7 +432,7 @@ setup_learn_peer (struct PeerContext *p, | |||
432 | } | 432 | } |
433 | GNUNET_free (filename); | 433 | GNUNET_free (filename); |
434 | } | 434 | } |
435 | p->core = GNUNET_CORE_connecT (p->cfg, | 435 | p->core = GNUNET_CORE_connect (p->cfg, |
436 | NULL, | 436 | NULL, |
437 | NULL, | 437 | NULL, |
438 | NULL, | 438 | NULL, |
@@ -567,13 +567,6 @@ main (int argc, char *argv[]) | |||
567 | GNUNET_log_setup ("test-gnunet-daemon-hostlist", | 567 | GNUNET_log_setup ("test-gnunet-daemon-hostlist", |
568 | "WARNING", | 568 | "WARNING", |
569 | NULL); | 569 | NULL); |
570 | #if !WINDOWS | ||
571 | system ("gnunet-peerinfo -s -c test_learning_adv_peer.conf > /dev/null"); | ||
572 | system ("gnunet-peerinfo -s -c test_learning_learn_peer.conf > /dev/null"); | ||
573 | #else | ||
574 | system ("gnunet-peerinfo -s -c test_learning_adv_peer.conf > NUL"); | ||
575 | system ("gnunet-peerinfo -s -c test_learning_learn_peer.conf > NUL"); | ||
576 | #endif | ||
577 | ret = check (); | 570 | ret = check (); |
578 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1"); | 571 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1"); |
579 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2"); | 572 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2"); |
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c index 220c36656..21ec235b6 100644 --- a/src/identity-provider/identity_provider_api.c +++ b/src/identity-provider/identity_provider_api.c | |||
@@ -380,7 +380,7 @@ reconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h) | |||
380 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 380 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
381 | "Connecting to identity provider service.\n"); | 381 | "Connecting to identity provider service.\n"); |
382 | 382 | ||
383 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 383 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
384 | "identity-provider", | 384 | "identity-provider", |
385 | handlers, | 385 | handlers, |
386 | &mq_error_handler, | 386 | &mq_error_handler, |
diff --git a/src/identity/.gitignore b/src/identity/.gitignore index cbabc187e..634a0bdd6 100644 --- a/src/identity/.gitignore +++ b/src/identity/.gitignore | |||
@@ -1,2 +1,4 @@ | |||
1 | gnunet-service-identity | 1 | gnunet-service-identity |
2 | gnunet-identity | 2 | gnunet-identity |
3 | test_identity | ||
4 | test_identity_defaults | ||
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 10a64d1ba..905b3fd8b 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c | |||
@@ -575,7 +575,7 @@ reconnect (void *cls) | |||
575 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 575 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
576 | "Connecting to identity service.\n"); | 576 | "Connecting to identity service.\n"); |
577 | GNUNET_assert (NULL == h->mq); | 577 | GNUNET_assert (NULL == h->mq); |
578 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 578 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
579 | "identity", | 579 | "identity", |
580 | handlers, | 580 | handlers, |
581 | &mq_error_handler, | 581 | &mq_error_handler, |
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index f27fd6e36..bf3ffe482 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -78,7 +78,7 @@ gnunetinclude_HEADERS = \ | |||
78 | gnunet_namecache_service.h \ | 78 | gnunet_namecache_service.h \ |
79 | gnunet_namestore_plugin.h \ | 79 | gnunet_namestore_plugin.h \ |
80 | gnunet_namestore_service.h \ | 80 | gnunet_namestore_service.h \ |
81 | gnunet_nat_lib.h \ | 81 | gnunet_nat_auto_service.h \ |
82 | gnunet_nat_service.h \ | 82 | gnunet_nat_service.h \ |
83 | gnunet_nc_lib.h \ | 83 | gnunet_nc_lib.h \ |
84 | gnunet_network_lib.h \ | 84 | gnunet_network_lib.h \ |
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h index c32311643..7090d4410 100644 --- a/src/include/gnunet_cadet_service.h +++ b/src/include/gnunet_cadet_service.h | |||
@@ -67,15 +67,6 @@ struct GNUNET_CADET_Channel; | |||
67 | */ | 67 | */ |
68 | struct GNUNET_CADET_Port; | 68 | struct GNUNET_CADET_Port; |
69 | 69 | ||
70 | /** | ||
71 | * Hash to be used in Cadet communication. Only 256 bits needed, | ||
72 | * instead of the 512 from `struct GNUNET_HashCode`. | ||
73 | */ | ||
74 | struct GNUNET_CADET_Hash | ||
75 | { | ||
76 | unsigned char bits[256 / 8]; | ||
77 | }; | ||
78 | |||
79 | 70 | ||
80 | /** | 71 | /** |
81 | * Channel options. Second line indicates filed in the | 72 | * Channel options. Second line indicates filed in the |
@@ -102,9 +93,9 @@ enum GNUNET_CADET_ChannelOption | |||
102 | 93 | ||
103 | /** | 94 | /** |
104 | * Enable out of order delivery of messages. | 95 | * Enable out of order delivery of messages. |
105 | * Yes/No. | 96 | * Set bit for out-of-order delivery. |
106 | */ | 97 | */ |
107 | GNUNET_CADET_OPTION_OOORDER = 0x4, | 98 | GNUNET_CADET_OPTION_OUT_OF_ORDER = 0x4, |
108 | 99 | ||
109 | /** | 100 | /** |
110 | * Who is the peer at the other end of the channel. | 101 | * Who is the peer at the other end of the channel. |
@@ -255,8 +246,7 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle); | |||
255 | struct GNUNET_CADET_Port * | 246 | struct GNUNET_CADET_Port * |
256 | GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, | 247 | GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, |
257 | const struct GNUNET_HashCode *port, | 248 | const struct GNUNET_HashCode *port, |
258 | GNUNET_CADET_InboundChannelNotificationHandler | 249 | GNUNET_CADET_InboundChannelNotificationHandler new_channel, |
259 | new_channel, | ||
260 | void *new_channel_cls); | 250 | void *new_channel_cls); |
261 | 251 | ||
262 | /** | 252 | /** |
@@ -332,7 +322,8 @@ union GNUNET_CADET_ChannelInfo | |||
332 | */ | 322 | */ |
333 | const union GNUNET_CADET_ChannelInfo * | 323 | const union GNUNET_CADET_ChannelInfo * |
334 | GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, | 324 | GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, |
335 | enum GNUNET_CADET_ChannelOption option, ...); | 325 | enum GNUNET_CADET_ChannelOption option, |
326 | ...); | ||
336 | 327 | ||
337 | 328 | ||
338 | /** | 329 | /** |
@@ -421,10 +412,10 @@ typedef void | |||
421 | (*GNUNET_CADET_ChannelCB) (void *cls, | 412 | (*GNUNET_CADET_ChannelCB) (void *cls, |
422 | const struct GNUNET_PeerIdentity *root, | 413 | const struct GNUNET_PeerIdentity *root, |
423 | const struct GNUNET_PeerIdentity *dest, | 414 | const struct GNUNET_PeerIdentity *dest, |
424 | uint32_t port, | 415 | uint32_t /* UGH */ port, |
425 | uint32_t root_channel_number, | 416 | uint32_t /* ugh */ root_channel_number, |
426 | uint32_t dest_channel_number, | 417 | uint32_t /* ugh */ dest_channel_number, |
427 | uint32_t public_channel_number); | 418 | uint32_t /* ugh */ public_channel_number); |
428 | 419 | ||
429 | /** | 420 | /** |
430 | * Method called to retrieve information about all peers in CADET, called | 421 | * Method called to retrieve information about all peers in CADET, called |
@@ -491,6 +482,28 @@ typedef void | |||
491 | 482 | ||
492 | 483 | ||
493 | /** | 484 | /** |
485 | * Hash uniquely identifying a connection below a tunnel. | ||
486 | */ | ||
487 | struct GNUNET_CADET_ConnectionTunnelIdentifier | ||
488 | { | ||
489 | struct GNUNET_ShortHashCode connection_of_tunnel; | ||
490 | }; | ||
491 | |||
492 | |||
493 | /** | ||
494 | * Number identifying a CADET channel within a tunnel. | ||
495 | */ | ||
496 | struct GNUNET_CADET_ChannelTunnelNumber | ||
497 | { | ||
498 | /** | ||
499 | * Which number does this channel have that uniquely identfies | ||
500 | * it within its tunnel? | ||
501 | */ | ||
502 | uint32_t cn GNUNET_PACKED; | ||
503 | }; | ||
504 | |||
505 | |||
506 | /** | ||
494 | * Method called to retrieve information about a specific tunnel the cadet peer | 507 | * Method called to retrieve information about a specific tunnel the cadet peer |
495 | * has established, o`r is trying to establish. | 508 | * has established, o`r is trying to establish. |
496 | * | 509 | * |
@@ -508,8 +521,8 @@ typedef void | |||
508 | const struct GNUNET_PeerIdentity *peer, | 521 | const struct GNUNET_PeerIdentity *peer, |
509 | unsigned int n_channels, | 522 | unsigned int n_channels, |
510 | unsigned int n_connections, | 523 | unsigned int n_connections, |
511 | uint32_t *channels, | 524 | const struct GNUNET_CADET_ChannelTunnelNumber *channels, |
512 | struct GNUNET_CADET_Hash *connections, | 525 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *connections, |
513 | unsigned int estate, | 526 | unsigned int estate, |
514 | unsigned int cstate); | 527 | unsigned int cstate); |
515 | 528 | ||
@@ -528,7 +541,7 @@ typedef void | |||
528 | void | 541 | void |
529 | GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h, | 542 | GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h, |
530 | struct GNUNET_PeerIdentity *peer, | 543 | struct GNUNET_PeerIdentity *peer, |
531 | uint32_t channel_number, | 544 | uint32_t /* UGH */ channel_number, |
532 | GNUNET_CADET_ChannelCB callback, | 545 | GNUNET_CADET_ChannelCB callback, |
533 | void *callback_cls); | 546 | void *callback_cls); |
534 | 547 | ||
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h index f98620dfa..613349fdd 100644 --- a/src/include/gnunet_client_lib.h +++ b/src/include/gnunet_client_lib.h | |||
@@ -57,7 +57,7 @@ extern "C" | |||
57 | * @return the message queue, NULL on error | 57 | * @return the message queue, NULL on error |
58 | */ | 58 | */ |
59 | struct GNUNET_MQ_Handle * | 59 | struct GNUNET_MQ_Handle * |
60 | GNUNET_CLIENT_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg, | 60 | GNUNET_CLIENT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
61 | const char *service_name, | 61 | const char *service_name, |
62 | const struct GNUNET_MQ_MessageHandler *handlers, | 62 | const struct GNUNET_MQ_MessageHandler *handlers, |
63 | GNUNET_MQ_ErrorHandler error_handler, | 63 | GNUNET_MQ_ErrorHandler error_handler, |
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 897502155..9ad604711 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -66,7 +66,7 @@ extern "C" | |||
66 | /** | 66 | /** |
67 | * Version of the API (for entire gnunetutil.so library). | 67 | * Version of the API (for entire gnunetutil.so library). |
68 | */ | 68 | */ |
69 | #define GNUNET_UTIL_VERSION 0x000A0101 | 69 | #define GNUNET_UTIL_VERSION 0x000A0102 |
70 | 70 | ||
71 | 71 | ||
72 | /** | 72 | /** |
@@ -558,6 +558,19 @@ GNUNET_logger_remove (GNUNET_Logger logger, | |||
558 | 558 | ||
559 | /** | 559 | /** |
560 | * @ingroup logging | 560 | * @ingroup logging |
561 | * Convert a short hash value to a string (for printing debug messages). | ||
562 | * This is one of the very few calls in the entire API that is | ||
563 | * NOT reentrant! | ||
564 | * | ||
565 | * @param shc the hash code | ||
566 | * @return string | ||
567 | */ | ||
568 | const char * | ||
569 | GNUNET_sh2s (const struct GNUNET_ShortHashCode *shc); | ||
570 | |||
571 | |||
572 | /** | ||
573 | * @ingroup logging | ||
561 | * Convert a hash value to a string (for printing debug messages). | 574 | * Convert a hash value to a string (for printing debug messages). |
562 | * This is one of the very few calls in the entire API that is | 575 | * This is one of the very few calls in the entire API that is |
563 | * NOT reentrant! | 576 | * NOT reentrant! |
@@ -655,7 +668,7 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); | |||
655 | /** | 668 | /** |
656 | * @ingroup logging | 669 | * @ingroup logging |
657 | * Use this for fatal errors that cannot be handled | 670 | * Use this for fatal errors that cannot be handled |
658 | * | 671 | * |
659 | * @param cond Condition to evaluate | 672 | * @param cond Condition to evaluate |
660 | * @param comp Component string to use for logging | 673 | * @param comp Component string to use for logging |
661 | */ | 674 | */ |
diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h index ef9b27318..1d0232cea 100644 --- a/src/include/gnunet_constants.h +++ b/src/include/gnunet_constants.h | |||
@@ -127,9 +127,9 @@ extern "C" | |||
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Size of the CADET message overhead: | 129 | * Size of the CADET message overhead: |
130 | * = sizeof (struct GNUNET_CADET_Encrypted) | 130 | * = sizeof (struct GNUNET_CADET_TunnelEncryptedMessage) |
131 | * + sizeof (struct GNUNET_CADET_Data) | 131 | * + sizeof (struct GNUNET_CADET_ChannelAppDataMessage) |
132 | * + sizeof (struct GNUNET_CADET_ACK)) | 132 | * + sizeof (struct GNUNET_CADET_ConnectionEncryptedAckMessage)) |
133 | * | 133 | * |
134 | * Checked for correcteness in gnunet-service-cadet_tunnel.c: GCT_init(). | 134 | * Checked for correcteness in gnunet-service-cadet_tunnel.c: GCT_init(). |
135 | */ | 135 | */ |
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index 03c47c201..f3aaa943b 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -1285,6 +1285,275 @@ GNUNET_CONTAINER_multipeermap_get_random (const struct GNUNET_CONTAINER_MultiPee | |||
1285 | void *it_cls); | 1285 | void *it_cls); |
1286 | 1286 | ||
1287 | 1287 | ||
1288 | /* ***************** Version of Multihashmap for short hashes ****************** */ | ||
1289 | |||
1290 | /** | ||
1291 | * @ingroup hashmap | ||
1292 | * Iterator over hash map entries. | ||
1293 | * | ||
1294 | * @param cls closure | ||
1295 | * @param key current public key | ||
1296 | * @param value value in the hash map | ||
1297 | * @return #GNUNET_YES if we should continue to | ||
1298 | * iterate, | ||
1299 | * #GNUNET_NO if not. | ||
1300 | */ | ||
1301 | typedef int | ||
1302 | (*GNUNET_CONTAINER_ShortmapIterator) (void *cls, | ||
1303 | const struct GNUNET_ShortHashCode *key, | ||
1304 | void *value); | ||
1305 | |||
1306 | |||
1307 | /** | ||
1308 | * Hash map from peer identities to values. | ||
1309 | */ | ||
1310 | struct GNUNET_CONTAINER_MultiShortmap; | ||
1311 | |||
1312 | |||
1313 | /** | ||
1314 | * @ingroup hashmap | ||
1315 | * Create a multi peer map (hash map for public keys of peers). | ||
1316 | * | ||
1317 | * @param len initial size (map will grow as needed) | ||
1318 | * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default; | ||
1319 | * #GNUNET_YES means that on 'put', the 'key' does not have | ||
1320 | * to be copied as the destination of the pointer is | ||
1321 | * guaranteed to be life as long as the value is stored in | ||
1322 | * the hashmap. This can significantly reduce memory | ||
1323 | * consumption, but of course is also a recipie for | ||
1324 | * heap corruption if the assumption is not true. Only | ||
1325 | * use this if (1) memory use is important in this case and | ||
1326 | * (2) you have triple-checked that the invariant holds | ||
1327 | * @return NULL on error | ||
1328 | */ | ||
1329 | struct GNUNET_CONTAINER_MultiShortmap * | ||
1330 | GNUNET_CONTAINER_multishortmap_create (unsigned int len, | ||
1331 | int do_not_copy_keys); | ||
1332 | |||
1333 | |||
1334 | /** | ||
1335 | * @ingroup hashmap | ||
1336 | * Destroy a hash map. Will not free any values | ||
1337 | * stored in the hash map! | ||
1338 | * | ||
1339 | * @param map the map | ||
1340 | */ | ||
1341 | void | ||
1342 | GNUNET_CONTAINER_multishortmap_destroy (struct GNUNET_CONTAINER_MultiShortmap *map); | ||
1343 | |||
1344 | |||
1345 | /** | ||
1346 | * @ingroup hashmap | ||
1347 | * Given a key find a value in the map matching the key. | ||
1348 | * | ||
1349 | * @param map the map | ||
1350 | * @param key what to look for | ||
1351 | * @return NULL if no value was found; note that | ||
1352 | * this is indistinguishable from values that just | ||
1353 | * happen to be NULL; use "contains" to test for | ||
1354 | * key-value pairs with value NULL | ||
1355 | */ | ||
1356 | void * | ||
1357 | GNUNET_CONTAINER_multishortmap_get (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1358 | const struct GNUNET_ShortHashCode *key); | ||
1359 | |||
1360 | |||
1361 | /** | ||
1362 | * @ingroup hashmap | ||
1363 | * Remove the given key-value pair from the map. Note that if the | ||
1364 | * key-value pair is in the map multiple times, only one of the pairs | ||
1365 | * will be removed. | ||
1366 | * | ||
1367 | * @param map the map | ||
1368 | * @param key key of the key-value pair | ||
1369 | * @param value value of the key-value pair | ||
1370 | * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair | ||
1371 | * is not in the map | ||
1372 | */ | ||
1373 | int | ||
1374 | GNUNET_CONTAINER_multishortmap_remove (struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1375 | const struct GNUNET_ShortHashCode * key, | ||
1376 | const void *value); | ||
1377 | |||
1378 | /** | ||
1379 | * @ingroup hashmap | ||
1380 | * Remove all entries for the given key from the map. | ||
1381 | * Note that the values would not be "freed". | ||
1382 | * | ||
1383 | * @param map the map | ||
1384 | * @param key identifies values to be removed | ||
1385 | * @return number of values removed | ||
1386 | */ | ||
1387 | int | ||
1388 | GNUNET_CONTAINER_multishortmap_remove_all (struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1389 | const struct GNUNET_ShortHashCode *key); | ||
1390 | |||
1391 | |||
1392 | /** | ||
1393 | * @ingroup hashmap | ||
1394 | * Check if the map contains any value under the given | ||
1395 | * key (including values that are NULL). | ||
1396 | * | ||
1397 | * @param map the map | ||
1398 | * @param key the key to test if a value exists for it | ||
1399 | * @return #GNUNET_YES if such a value exists, | ||
1400 | * #GNUNET_NO if not | ||
1401 | */ | ||
1402 | int | ||
1403 | GNUNET_CONTAINER_multishortmap_contains (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1404 | const struct GNUNET_ShortHashCode *key); | ||
1405 | |||
1406 | |||
1407 | /** | ||
1408 | * @ingroup hashmap | ||
1409 | * Check if the map contains the given value under the given | ||
1410 | * key. | ||
1411 | * | ||
1412 | * @param map the map | ||
1413 | * @param key the key to test if a value exists for it | ||
1414 | * @param value value to test for | ||
1415 | * @return #GNUNET_YES if such a value exists, | ||
1416 | * #GNUNET_NO if not | ||
1417 | */ | ||
1418 | int | ||
1419 | GNUNET_CONTAINER_multishortmap_contains_value (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1420 | const struct GNUNET_ShortHashCode * key, | ||
1421 | const void *value); | ||
1422 | |||
1423 | |||
1424 | /** | ||
1425 | * @ingroup hashmap | ||
1426 | * Store a key-value pair in the map. | ||
1427 | * | ||
1428 | * @param map the map | ||
1429 | * @param key key to use | ||
1430 | * @param value value to use | ||
1431 | * @param opt options for put | ||
1432 | * @return #GNUNET_OK on success, | ||
1433 | * #GNUNET_NO if a value was replaced (with REPLACE) | ||
1434 | * #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the | ||
1435 | * value already exists | ||
1436 | */ | ||
1437 | int | ||
1438 | GNUNET_CONTAINER_multishortmap_put (struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1439 | const struct GNUNET_ShortHashCode *key, | ||
1440 | void *value, | ||
1441 | enum GNUNET_CONTAINER_MultiHashMapOption opt); | ||
1442 | |||
1443 | |||
1444 | /** | ||
1445 | * @ingroup hashmap | ||
1446 | * Get the number of key-value pairs in the map. | ||
1447 | * | ||
1448 | * @param map the map | ||
1449 | * @return the number of key value pairs | ||
1450 | */ | ||
1451 | unsigned int | ||
1452 | GNUNET_CONTAINER_multishortmap_size (const struct GNUNET_CONTAINER_MultiShortmap *map); | ||
1453 | |||
1454 | |||
1455 | /** | ||
1456 | * @ingroup hashmap | ||
1457 | * Iterate over all entries in the map. | ||
1458 | * | ||
1459 | * @param map the map | ||
1460 | * @param it function to call on each entry | ||
1461 | * @param it_cls extra argument to @a it | ||
1462 | * @return the number of key value pairs processed, | ||
1463 | * #GNUNET_SYSERR if it aborted iteration | ||
1464 | */ | ||
1465 | int | ||
1466 | GNUNET_CONTAINER_multishortmap_iterate (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1467 | GNUNET_CONTAINER_ShortmapIterator it, | ||
1468 | void *it_cls); | ||
1469 | |||
1470 | |||
1471 | struct GNUNET_CONTAINER_MultiShortmapIterator; | ||
1472 | |||
1473 | |||
1474 | /** | ||
1475 | * @ingroup hashmap | ||
1476 | * Create an iterator for a multihashmap. | ||
1477 | * The iterator can be used to retrieve all the elements in the multihashmap | ||
1478 | * one by one, without having to handle all elements at once (in contrast to | ||
1479 | * #GNUNET_CONTAINER_multishortmap_iterate). Note that the iterator can not be | ||
1480 | * used anymore if elements have been removed from @a map after the creation of | ||
1481 | * the iterator, or 'map' has been destroyed. Adding elements to @a map may | ||
1482 | * result in skipped or repeated elements. | ||
1483 | * | ||
1484 | * @param map the map to create an iterator for | ||
1485 | * @return an iterator over the given multihashmap @a map | ||
1486 | */ | ||
1487 | struct GNUNET_CONTAINER_MultiShortmapIterator * | ||
1488 | GNUNET_CONTAINER_multishortmap_iterator_create (const struct GNUNET_CONTAINER_MultiShortmap *map); | ||
1489 | |||
1490 | |||
1491 | /** | ||
1492 | * @ingroup hashmap | ||
1493 | * Retrieve the next element from the hash map at the iterator's | ||
1494 | * position. If there are no elements left, #GNUNET_NO is returned, | ||
1495 | * and @a key and @a value are not modified. This operation is only | ||
1496 | * allowed if no elements have been removed from the multihashmap | ||
1497 | * since the creation of @a iter, and the map has not been destroyed. | ||
1498 | * Adding elements may result in repeating or skipping elements. | ||
1499 | * | ||
1500 | * @param iter the iterator to get the next element from | ||
1501 | * @param key pointer to store the key in, can be NULL | ||
1502 | * @param value pointer to store the value in, can be NULL | ||
1503 | * @return #GNUNET_YES we returned an element, | ||
1504 | * #GNUNET_NO if we are out of elements | ||
1505 | */ | ||
1506 | int | ||
1507 | GNUNET_CONTAINER_multishortmap_iterator_next (struct GNUNET_CONTAINER_MultiShortmapIterator *iter, | ||
1508 | struct GNUNET_ShortHashCode *key, | ||
1509 | const void **value); | ||
1510 | |||
1511 | |||
1512 | /** | ||
1513 | * @ingroup hashmap | ||
1514 | * Destroy a multishortmap iterator. | ||
1515 | * | ||
1516 | * @param iter the iterator to destroy | ||
1517 | */ | ||
1518 | void | ||
1519 | GNUNET_CONTAINER_multishortmap_iterator_destroy (struct GNUNET_CONTAINER_MultiShortmapIterator *iter); | ||
1520 | |||
1521 | |||
1522 | /** | ||
1523 | * @ingroup hashmap | ||
1524 | * Iterate over all entries in the map that match a particular key. | ||
1525 | * | ||
1526 | * @param map the map | ||
1527 | * @param key public key that the entries must correspond to | ||
1528 | * @param it function to call on each entry | ||
1529 | * @param it_cls extra argument to @a it | ||
1530 | * @return the number of key value pairs processed, | ||
1531 | * #GNUNET_SYSERR if it aborted iteration | ||
1532 | */ | ||
1533 | int | ||
1534 | GNUNET_CONTAINER_multishortmap_get_multiple (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1535 | const struct GNUNET_ShortHashCode *key, | ||
1536 | GNUNET_CONTAINER_ShortmapIterator it, | ||
1537 | void *it_cls); | ||
1538 | |||
1539 | |||
1540 | /** | ||
1541 | * @ingroup hashmap | ||
1542 | * Call @a it on a random value from the map, or not at all | ||
1543 | * if the map is empty. Note that this function has linear | ||
1544 | * complexity (in the size of the map). | ||
1545 | * | ||
1546 | * @param map the map | ||
1547 | * @param it function to call on a random entry | ||
1548 | * @param it_cls extra argument to @a it | ||
1549 | * @return the number of key value pairs processed, zero or one. | ||
1550 | */ | ||
1551 | unsigned int | ||
1552 | GNUNET_CONTAINER_multishortmap_get_random (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
1553 | GNUNET_CONTAINER_ShortmapIterator it, | ||
1554 | void *it_cls); | ||
1555 | |||
1556 | |||
1288 | /* Version of multihashmap with 32 bit keys */ | 1557 | /* Version of multihashmap with 32 bit keys */ |
1289 | 1558 | ||
1290 | /** | 1559 | /** |
@@ -1915,8 +2184,8 @@ GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap); | |||
1915 | * @return cost of the node | 2184 | * @return cost of the node |
1916 | */ | 2185 | */ |
1917 | GNUNET_CONTAINER_HeapCostType | 2186 | GNUNET_CONTAINER_HeapCostType |
1918 | GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode | 2187 | GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode *node); |
1919 | *node); | 2188 | |
1920 | 2189 | ||
1921 | /** | 2190 | /** |
1922 | * @ingroup heap | 2191 | * @ingroup heap |
@@ -2006,13 +2275,11 @@ GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node); | |||
2006 | * @ingroup heap | 2275 | * @ingroup heap |
2007 | * Updates the cost of any node in the tree | 2276 | * Updates the cost of any node in the tree |
2008 | * | 2277 | * |
2009 | * @param heap heap to modify | ||
2010 | * @param node node for which the cost is to be changed | 2278 | * @param node node for which the cost is to be changed |
2011 | * @param new_cost new cost for the node | 2279 | * @param new_cost new cost for the node |
2012 | */ | 2280 | */ |
2013 | void | 2281 | void |
2014 | GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, | 2282 | GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_HeapNode *node, |
2015 | struct GNUNET_CONTAINER_HeapNode *node, | ||
2016 | GNUNET_CONTAINER_HeapCostType new_cost); | 2283 | GNUNET_CONTAINER_HeapCostType new_cost); |
2017 | 2284 | ||
2018 | 2285 | ||
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 6ec486b26..8136770b7 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -91,30 +91,8 @@ struct GNUNET_CORE_Handle; | |||
91 | * @param cls closure | 91 | * @param cls closure |
92 | * @param peer peer identity this notification is about | 92 | * @param peer peer identity this notification is about |
93 | */ | 93 | */ |
94 | typedef void | ||
95 | (*GNUNET_CORE_ConnectEventHandler) (void *cls, | ||
96 | const struct GNUNET_PeerIdentity *peer); | ||
97 | |||
98 | |||
99 | /** | ||
100 | * Method called whenever a peer disconnects. | ||
101 | * | ||
102 | * @param cls closure | ||
103 | * @param peer peer identity this notification is about | ||
104 | */ | ||
105 | typedef void | ||
106 | (*GNUNET_CORE_DisconnectEventHandler) (void *cls, | ||
107 | const struct GNUNET_PeerIdentity *peer); | ||
108 | |||
109 | |||
110 | /** | ||
111 | * Method called whenever a given peer connects. | ||
112 | * | ||
113 | * @param cls closure | ||
114 | * @param peer peer identity this notification is about | ||
115 | */ | ||
116 | typedef void * | 94 | typedef void * |
117 | (*GNUNET_CORE_ConnecTEventHandler) (void *cls, | 95 | (*GNUNET_CORE_ConnectEventHandler) (void *cls, |
118 | const struct GNUNET_PeerIdentity *peer, | 96 | const struct GNUNET_PeerIdentity *peer, |
119 | struct GNUNET_MQ_Handle *mq); | 97 | struct GNUNET_MQ_Handle *mq); |
120 | 98 | ||
@@ -126,55 +104,12 @@ typedef void * | |||
126 | * @param peer peer identity this notification is about | 104 | * @param peer peer identity this notification is about |
127 | */ | 105 | */ |
128 | typedef void | 106 | typedef void |
129 | (*GNUNET_CORE_DisconnecTEventHandler) (void *cls, | 107 | (*GNUNET_CORE_DisconnectEventHandler) (void *cls, |
130 | const struct GNUNET_PeerIdentity *peer, | 108 | const struct GNUNET_PeerIdentity *peer, |
131 | void *peer_cls); | 109 | void *peer_cls); |
132 | 110 | ||
133 | 111 | ||
134 | /** | 112 | /** |
135 | * Functions with this signature are called whenever a message is | ||
136 | * received or transmitted. | ||
137 | * | ||
138 | * @param cls closure (set from #GNUNET_CORE_connect) | ||
139 | * @param peer the other peer involved (sender or receiver, NULL | ||
140 | * for loopback messages where we are both sender and receiver) | ||
141 | * @param message the actual message | ||
142 | * @return #GNUNET_OK to keep the connection open, | ||
143 | * #GNUNET_SYSERR to close connection to the peer (signal serious error) | ||
144 | */ | ||
145 | typedef int | ||
146 | (*GNUNET_CORE_MessageCallback) (void *cls, | ||
147 | const struct GNUNET_PeerIdentity *other, | ||
148 | const struct GNUNET_MessageHeader *message); | ||
149 | |||
150 | |||
151 | /** | ||
152 | * Message handler. Each struct specifies how to handle on particular | ||
153 | * type of message received. | ||
154 | */ | ||
155 | struct GNUNET_CORE_MessageHandler | ||
156 | { | ||
157 | /** | ||
158 | * Function to call for messages of @e type. | ||
159 | */ | ||
160 | GNUNET_CORE_MessageCallback callback; | ||
161 | |||
162 | /** | ||
163 | * Type of the message this handler covers. | ||
164 | */ | ||
165 | uint16_t type; | ||
166 | |||
167 | /** | ||
168 | * Expected size of messages of this type. Use 0 for variable-size. | ||
169 | * If non-zero, messages of the given type will be discarded if they | ||
170 | * do not have the right size. | ||
171 | */ | ||
172 | uint16_t expected_size; | ||
173 | |||
174 | }; | ||
175 | |||
176 | |||
177 | /** | ||
178 | * Function called after #GNUNET_CORE_connect has succeeded (or failed | 113 | * Function called after #GNUNET_CORE_connect has succeeded (or failed |
179 | * for good). Note that the private key of the peer is intentionally | 114 | * for good). Note that the private key of the peer is intentionally |
180 | * not exposed here; if you need it, your process should try to read | 115 | * not exposed here; if you need it, your process should try to read |
@@ -208,26 +143,6 @@ typedef void | |||
208 | * connected to the core service | 143 | * connected to the core service |
209 | * @param connects function to call on peer connect, can be NULL | 144 | * @param connects function to call on peer connect, can be NULL |
210 | * @param disconnects function to call on peer disconnect / timeout, can be NULL | 145 | * @param disconnects function to call on peer disconnect / timeout, can be NULL |
211 | * @param inbound_notify function to call for all inbound messages, can be NULL | ||
212 | * note that the core is allowed to drop notifications about inbound | ||
213 | * messages if the client does not process them fast enough (for this | ||
214 | * notification type, a bounded queue is used) | ||
215 | * @param inbound_hdr_only set to #GNUNET_YES if @a inbound_notify will only read the | ||
216 | * `struct GNUNET_MessageHeader` and hence we do not need to give it the full message; | ||
217 | * can be used to improve efficiency, ignored if inbound_notify is NULL | ||
218 | * note that the core is allowed to drop notifications about inbound | ||
219 | * messages if the client does not process them fast enough (for this | ||
220 | * notification type, a bounded queue is used) | ||
221 | * @param outbound_notify function to call for all outbound messages, can be NULL; | ||
222 | * note that the core is allowed to drop notifications about outbound | ||
223 | * messages if the client does not process them fast enough (for this | ||
224 | * notification type, a bounded queue is used) | ||
225 | * @param outbound_hdr_only set to #GNUNET_YES if @a outbound_notify will only read the | ||
226 | * `struct GNUNET_MessageHeader` and hence we do not need to give it the full message | ||
227 | * can be used to improve efficiency, ignored if outbound_notify is NULL | ||
228 | * note that the core is allowed to drop notifications about outbound | ||
229 | * messages if the client does not process them fast enough (for this | ||
230 | * notification type, a bounded queue is used) | ||
231 | * @param handlers callbacks for messages we care about, NULL-terminated | 146 | * @param handlers callbacks for messages we care about, NULL-terminated |
232 | * note that the core is allowed to drop notifications about inbound | 147 | * note that the core is allowed to drop notifications about inbound |
233 | * messages if the client does not process them fast enough (for this | 148 | * messages if the client does not process them fast enough (for this |
@@ -241,53 +156,6 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
241 | GNUNET_CORE_StartupCallback init, | 156 | GNUNET_CORE_StartupCallback init, |
242 | GNUNET_CORE_ConnectEventHandler connects, | 157 | GNUNET_CORE_ConnectEventHandler connects, |
243 | GNUNET_CORE_DisconnectEventHandler disconnects, | 158 | GNUNET_CORE_DisconnectEventHandler disconnects, |
244 | GNUNET_CORE_MessageCallback inbound_notify, | ||
245 | int inbound_hdr_only, | ||
246 | GNUNET_CORE_MessageCallback outbound_notify, | ||
247 | int outbound_hdr_only, | ||
248 | const struct GNUNET_CORE_MessageHandler *handlers); | ||
249 | |||
250 | /** | ||
251 | * Disconnect from the core service. This function can only | ||
252 | * be called *after* all pending #GNUNET_CORE_notify_transmit_ready | ||
253 | * requests have been explicitly cancelled. | ||
254 | * | ||
255 | * @param handle connection to core to disconnect | ||
256 | */ | ||
257 | void | ||
258 | GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle); | ||
259 | |||
260 | |||
261 | /** | ||
262 | * Connect to the core service. Note that the connection may complete | ||
263 | * (or fail) asynchronously. This function primarily causes the given | ||
264 | * callback notification functions to be invoked whenever the | ||
265 | * specified event happens. The maximum number of queued | ||
266 | * notifications (queue length) is per client; the queue is shared | ||
267 | * across all types of notifications. So a slow client that registers | ||
268 | * for @a outbound_notify also risks missing @a inbound_notify messages. | ||
269 | * Certain events (such as connect/disconnect notifications) are not | ||
270 | * subject to queue size limitations. | ||
271 | * | ||
272 | * @param cfg configuration to use | ||
273 | * @param cls closure for the various callbacks that follow (including handlers in the handlers array) | ||
274 | * @param init callback to call once we have successfully | ||
275 | * connected to the core service | ||
276 | * @param connects function to call on peer connect, can be NULL | ||
277 | * @param disconnects function to call on peer disconnect / timeout, can be NULL | ||
278 | * @param handlers callbacks for messages we care about, NULL-terminated | ||
279 | * note that the core is allowed to drop notifications about inbound | ||
280 | * messages if the client does not process them fast enough (for this | ||
281 | * notification type, a bounded queue is used) | ||
282 | * @return handle to the core service (only useful for disconnect until @a init is called), | ||
283 | * NULL on error (in this case, init is never called) | ||
284 | */ | ||
285 | struct GNUNET_CORE_Handle * | ||
286 | GNUNET_CORE_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
287 | void *cls, | ||
288 | GNUNET_CORE_StartupCallback init, | ||
289 | GNUNET_CORE_ConnecTEventHandler connects, | ||
290 | GNUNET_CORE_DisconnecTEventHandler disconnects, | ||
291 | const struct GNUNET_MQ_MessageHandler *handlers); | 159 | const struct GNUNET_MQ_MessageHandler *handlers); |
292 | 160 | ||
293 | 161 | ||
@@ -297,7 +165,7 @@ GNUNET_CORE_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
297 | * @param handle connection to core to disconnect | 165 | * @param handle connection to core to disconnect |
298 | */ | 166 | */ |
299 | void | 167 | void |
300 | GNUNET_CORE_disconnecT (struct GNUNET_CORE_Handle *handle); | 168 | GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle); |
301 | 169 | ||
302 | 170 | ||
303 | /** | 171 | /** |
@@ -305,7 +173,7 @@ GNUNET_CORE_disconnecT (struct GNUNET_CORE_Handle *handle); | |||
305 | * so that it is transmitted with the given @a priority and | 173 | * so that it is transmitted with the given @a priority and |
306 | * the given @a cork value. | 174 | * the given @a cork value. |
307 | * | 175 | * |
308 | * @param cork desired corking | 176 | * @param cork desired corking |
309 | * @param priority desired message priority | 177 | * @param priority desired message priority |
310 | * @param[out] flags set to `flags` value for #GNUNET_MQ_set_options() | 178 | * @param[out] flags set to `flags` value for #GNUNET_MQ_set_options() |
311 | * @return `extra` argument to give to #GNUNET_MQ_set_options() | 179 | * @return `extra` argument to give to #GNUNET_MQ_set_options() |
@@ -320,7 +188,7 @@ GNUNET_CORE_get_mq_options (int cork, | |||
320 | * Obtain the message queue for a connected peer. | 188 | * Obtain the message queue for a connected peer. |
321 | * | 189 | * |
322 | * @param h the core handle | 190 | * @param h the core handle |
323 | * @param pid the identity of the peer | 191 | * @param pid the identity of the peer |
324 | * @return NULL if @a pid is not connected | 192 | * @return NULL if @a pid is not connected |
325 | */ | 193 | */ |
326 | struct GNUNET_MQ_Handle * | 194 | struct GNUNET_MQ_Handle * |
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 8002b7710..43fd32a58 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -52,9 +52,24 @@ extern "C" | |||
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * @brief A 512-bit hashcode | 55 | * @brief A 512-bit hashcode. These are the default length for GNUnet, using SHA-512. |
56 | */ | 56 | */ |
57 | struct GNUNET_HashCode; | 57 | struct GNUNET_HashCode |
58 | { | ||
59 | uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */ | ||
60 | }; | ||
61 | |||
62 | |||
63 | |||
64 | /** | ||
65 | * @brief A 256-bit hashcode. Used under special conditions, like when space | ||
66 | * is critical and security is not impacted by it. | ||
67 | */ | ||
68 | struct GNUNET_ShortHashCode | ||
69 | { | ||
70 | uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */ | ||
71 | }; | ||
72 | |||
58 | 73 | ||
59 | /** | 74 | /** |
60 | * The identity of the host (wraps the signing key of the peer). | 75 | * The identity of the host (wraps the signing key of the peer). |
@@ -66,15 +81,6 @@ struct GNUNET_PeerIdentity; | |||
66 | 81 | ||
67 | 82 | ||
68 | /** | 83 | /** |
69 | * @brief A 512-bit hashcode | ||
70 | */ | ||
71 | struct GNUNET_HashCode | ||
72 | { | ||
73 | uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */ | ||
74 | }; | ||
75 | |||
76 | |||
77 | /** | ||
78 | * Maximum length of an ECC signature. | 84 | * Maximum length of an ECC signature. |
79 | * Note: round up to multiple of 8 minus 2 for alignment. | 85 | * Note: round up to multiple of 8 minus 2 for alignment. |
80 | */ | 86 | */ |
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index d1a045b8b..108ba5d54 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h | |||
@@ -255,15 +255,6 @@ typedef void | |||
255 | 255 | ||
256 | 256 | ||
257 | /** | 257 | /** |
258 | * Callback used for notifications | ||
259 | * | ||
260 | * @param cls closure | ||
261 | */ | ||
262 | typedef void | ||
263 | (*GNUNET_MQ_NotifyCallback) (void *cls); | ||
264 | |||
265 | |||
266 | /** | ||
267 | * Generic error handler, called with the appropriate | 258 | * Generic error handler, called with the appropriate |
268 | * error code and the same closure specified at the creation of | 259 | * error code and the same closure specified at the creation of |
269 | * the message queue. | 260 | * the message queue. |
@@ -402,7 +393,7 @@ struct GNUNET_MQ_MessageHandler | |||
402 | * @param ctx context for the callbacks | 393 | * @param ctx context for the callbacks |
403 | */ | 394 | */ |
404 | #define GNUNET_MQ_hd_var_size(name,code,str,ctx) \ | 395 | #define GNUNET_MQ_hd_var_size(name,code,str,ctx) \ |
405 | ({ \ | 396 | __extension__ ({ \ |
406 | int (*_mv)(void *cls, const str *msg) = &check_##name; \ | 397 | int (*_mv)(void *cls, const str *msg) = &check_##name; \ |
407 | void (*_cb)(void *cls, const str *msg) = &handle_##name; \ | 398 | void (*_cb)(void *cls, const str *msg) = &handle_##name; \ |
408 | ((struct GNUNET_MQ_MessageHandler) \ | 399 | ((struct GNUNET_MQ_MessageHandler) \ |
@@ -634,7 +625,7 @@ GNUNET_MQ_set_handlers_closure (struct GNUNET_MQ_Handle *mq, | |||
634 | */ | 625 | */ |
635 | void | 626 | void |
636 | GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *ev, | 627 | GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *ev, |
637 | GNUNET_MQ_NotifyCallback cb, | 628 | GNUNET_SCHEDULER_TaskCallback cb, |
638 | void *cb_cls); | 629 | void *cb_cls); |
639 | 630 | ||
640 | 631 | ||
diff --git a/src/include/gnunet_nat_auto_service.h b/src/include/gnunet_nat_auto_service.h new file mode 100644 index 000000000..a369c49e0 --- /dev/null +++ b/src/include/gnunet_nat_auto_service.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2007-2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Christian Grothoff | ||
23 | * @author Milan Bouchet-Valat | ||
24 | * | ||
25 | * @file | ||
26 | * Service for testing and autoconfiguration of | ||
27 | * NAT traversal functionality | ||
28 | * | ||
29 | * @defgroup nat NAT testing library | ||
30 | * | ||
31 | * @{ | ||
32 | */ | ||
33 | |||
34 | #ifndef GNUNET_NAT_AUTO_SERVICE_H | ||
35 | #define GNUNET_NAT_AUTO_SERVICE_H | ||
36 | |||
37 | #include "gnunet_util_lib.h" | ||
38 | #include "gnunet_nat_service.h" | ||
39 | |||
40 | |||
41 | /** | ||
42 | * Handle to a NAT test. | ||
43 | */ | ||
44 | struct GNUNET_NAT_AUTO_Test; | ||
45 | |||
46 | |||
47 | /** | ||
48 | * Start testing if NAT traversal works using the given configuration. | ||
49 | * The transport adapters should be down while using this function. | ||
50 | * | ||
51 | * @param cfg configuration for the NAT traversal | ||
52 | * @param proto protocol to test, i.e. IPPROTO_TCP or IPPROTO_UDP | ||
53 | * @param section_name configuration section to use for configuration | ||
54 | * @param report function to call with the result of the test | ||
55 | * @param report_cls closure for @a report | ||
56 | * @return handle to cancel NAT test | ||
57 | */ | ||
58 | struct GNUNET_NAT_AUTO_Test * | ||
59 | GNUNET_NAT_AUTO_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
60 | uint8_t proto, | ||
61 | const char *section_name, | ||
62 | GNUNET_NAT_TestCallback report, | ||
63 | void *report_cls); | ||
64 | |||
65 | |||
66 | /** | ||
67 | * Stop an active NAT test. | ||
68 | * | ||
69 | * @param tst test to stop. | ||
70 | */ | ||
71 | void | ||
72 | GNUNET_NAT_AUTO_test_stop (struct GNUNET_NAT_AUTO_Test *tst); | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Handle to auto-configuration in progress. | ||
77 | */ | ||
78 | struct GNUNET_NAT_AUTO_AutoHandle; | ||
79 | |||
80 | |||
81 | /** | ||
82 | * Converts `enum GNUNET_NAT_StatusCode` to string | ||
83 | * | ||
84 | * @param err error code to resolve to a string | ||
85 | * @return point to a static string containing the error code | ||
86 | */ | ||
87 | const char * | ||
88 | GNUNET_NAT_AUTO_status2string (enum GNUNET_NAT_StatusCode err); | ||
89 | |||
90 | |||
91 | /** | ||
92 | * Function called with the result from the autoconfiguration. | ||
93 | * | ||
94 | * @param cls closure | ||
95 | * @param diff minimal suggested changes to the original configuration | ||
96 | * to make it work (as best as we can) | ||
97 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
98 | * @param type what the situation of the NAT | ||
99 | */ | ||
100 | typedef void | ||
101 | (*GNUNET_NAT_AUTO_AutoResultCallback)(void *cls, | ||
102 | const struct GNUNET_CONFIGURATION_Handle *diff, | ||
103 | enum GNUNET_NAT_StatusCode result, | ||
104 | enum GNUNET_NAT_Type type); | ||
105 | |||
106 | |||
107 | /** | ||
108 | * Start auto-configuration routine. The transport adapters should | ||
109 | * be stopped while this function is called. | ||
110 | * | ||
111 | * @param cfg initial configuration | ||
112 | * @param cb function to call with autoconfiguration result | ||
113 | * @param cb_cls closure for @a cb | ||
114 | * @return handle to cancel operation | ||
115 | */ | ||
116 | struct GNUNET_NAT_AUTO_AutoHandle * | ||
117 | GNUNET_NAT_AUTO_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
118 | GNUNET_NAT_AUTO_AutoResultCallback cb, | ||
119 | void *cb_cls); | ||
120 | |||
121 | |||
122 | /** | ||
123 | * Abort autoconfiguration. | ||
124 | * | ||
125 | * @param ah handle for operation to abort | ||
126 | */ | ||
127 | void | ||
128 | GNUNET_NAT_AUTO_autoconfig_cancel (struct GNUNET_NAT_AUTO_AutoHandle *ah); | ||
129 | |||
130 | |||
131 | #endif | ||
132 | |||
133 | /** @} */ /* end of group */ | ||
134 | |||
135 | /* end of gnunet_nat_auto_service.h */ | ||
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h deleted file mode 100644 index 853a86c2d..000000000 --- a/src/include/gnunet_nat_lib.h +++ /dev/null | |||
@@ -1,591 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2007-2014 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Christian Grothoff | ||
23 | * @author Milan Bouchet-Valat | ||
24 | * | ||
25 | * @file | ||
26 | * Library handling UPnP and NAT-PMP port forwarding | ||
27 | * and external IP address retrieval | ||
28 | * | ||
29 | * @defgroup nat NAT library | ||
30 | * Library handling UPnP and NAT-PMP port forwarding | ||
31 | * and external IP address retrieval | ||
32 | * | ||
33 | * @{ | ||
34 | */ | ||
35 | |||
36 | #ifndef GNUNET_NAT_LIB_H | ||
37 | #define GNUNET_NAT_LIB_H | ||
38 | |||
39 | #include "gnunet_util_lib.h" | ||
40 | |||
41 | |||
42 | /** | ||
43 | * Signature of the callback passed to #GNUNET_NAT_register() for | ||
44 | * a function to call whenever our set of 'valid' addresses changes. | ||
45 | * | ||
46 | * @param cls closure | ||
47 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | ||
48 | * the previous (now invalid) one | ||
49 | * @param addr either the previous or the new public IP address | ||
50 | * @param addrlen actual length of the @a addr | ||
51 | */ | ||
52 | typedef void | ||
53 | (*GNUNET_NAT_AddressCallback) (void *cls, | ||
54 | int add_remove, | ||
55 | const struct sockaddr *addr, | ||
56 | socklen_t addrlen); | ||
57 | |||
58 | |||
59 | /** | ||
60 | * Signature of the callback passed to #GNUNET_NAT_register(). | ||
61 | * for a function to call whenever someone asks us to do connection | ||
62 | * reversal. | ||
63 | * | ||
64 | * @param cls closure | ||
65 | * @param addr public IP address of the other peer | ||
66 | * @param addrlen actual lenght of the @a addr | ||
67 | */ | ||
68 | typedef void | ||
69 | (*GNUNET_NAT_ReversalCallback) (void *cls, | ||
70 | const struct sockaddr *addr, | ||
71 | socklen_t addrlen); | ||
72 | |||
73 | |||
74 | /** | ||
75 | * Handle for active NAT registrations. | ||
76 | */ | ||
77 | struct GNUNET_NAT_Handle; | ||
78 | |||
79 | |||
80 | |||
81 | /** | ||
82 | * What the situation of the NAT connectivity | ||
83 | */ | ||
84 | enum GNUNET_NAT_Type | ||
85 | { | ||
86 | /** | ||
87 | * We have a direct connection | ||
88 | */ | ||
89 | GNUNET_NAT_TYPE_NO_NAT = GNUNET_OK, | ||
90 | |||
91 | /** | ||
92 | * We are under a NAT but cannot traverse it | ||
93 | */ | ||
94 | GNUNET_NAT_TYPE_UNREACHABLE_NAT, | ||
95 | |||
96 | /** | ||
97 | * We can traverse using STUN | ||
98 | */ | ||
99 | GNUNET_NAT_TYPE_STUN_PUNCHED_NAT, | ||
100 | |||
101 | /** | ||
102 | * WE can traverse using UPNP | ||
103 | */ | ||
104 | GNUNET_NAT_TYPE_UPNP_NAT | ||
105 | |||
106 | }; | ||
107 | |||
108 | /** | ||
109 | * Error Types for the NAT subsystem (which can then later be converted/resolved to a string) | ||
110 | */ | ||
111 | enum GNUNET_NAT_StatusCode | ||
112 | { | ||
113 | /** | ||
114 | * Just the default | ||
115 | */ | ||
116 | GNUNET_NAT_ERROR_SUCCESS = GNUNET_OK, | ||
117 | |||
118 | /** | ||
119 | * IPC Failure | ||
120 | */ | ||
121 | GNUNET_NAT_ERROR_IPC_FAILURE, | ||
122 | |||
123 | /** | ||
124 | * Failure in network subsystem, check permissions | ||
125 | */ | ||
126 | GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR, | ||
127 | |||
128 | /** | ||
129 | * test timed out | ||
130 | */ | ||
131 | GNUNET_NAT_ERROR_TIMEOUT, | ||
132 | |||
133 | /** | ||
134 | * detected that we are offline | ||
135 | */ | ||
136 | GNUNET_NAT_ERROR_NOT_ONLINE, | ||
137 | |||
138 | /** | ||
139 | * `upnpc` command not found | ||
140 | */ | ||
141 | GNUNET_NAT_ERROR_UPNPC_NOT_FOUND, | ||
142 | |||
143 | /** | ||
144 | * Failed to run `upnpc` command | ||
145 | */ | ||
146 | GNUNET_NAT_ERROR_UPNPC_FAILED, | ||
147 | |||
148 | /** | ||
149 | * `upnpc' command took too long, process killed | ||
150 | */ | ||
151 | GNUNET_NAT_ERROR_UPNPC_TIMEOUT, | ||
152 | |||
153 | /** | ||
154 | * `upnpc' command failed to establish port mapping | ||
155 | */ | ||
156 | GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED, | ||
157 | |||
158 | /** | ||
159 | * `external-ip' command not found | ||
160 | */ | ||
161 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND, | ||
162 | |||
163 | /** | ||
164 | * Failed to run `external-ip` command | ||
165 | */ | ||
166 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED, | ||
167 | |||
168 | /** | ||
169 | * `external-ip' command output invalid | ||
170 | */ | ||
171 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID, | ||
172 | |||
173 | /** | ||
174 | * "no valid address was returned by `external-ip'" | ||
175 | */ | ||
176 | GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID, | ||
177 | |||
178 | /** | ||
179 | * Could not determine interface with internal/local network address | ||
180 | */ | ||
181 | GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO, | ||
182 | |||
183 | /** | ||
184 | * No working gnunet-helper-nat-server found | ||
185 | */ | ||
186 | GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND, | ||
187 | |||
188 | /** | ||
189 | * NAT test could not be initialized | ||
190 | */ | ||
191 | GNUNET_NAT_ERROR_NAT_TEST_START_FAILED, | ||
192 | |||
193 | /** | ||
194 | * NAT test timeout | ||
195 | */ | ||
196 | GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT, | ||
197 | |||
198 | /** | ||
199 | * NAT test failed to initiate | ||
200 | */ | ||
201 | GNUNET_NAT_ERROR_NAT_REGISTER_FAILED, | ||
202 | |||
203 | /** | ||
204 | * | ||
205 | */ | ||
206 | GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND, | ||
207 | |||
208 | /** | ||
209 | * | ||
210 | */ | ||
211 | GNUNET_NAT_ERROR_ | ||
212 | }; | ||
213 | |||
214 | |||
215 | /** | ||
216 | * Converts `enum GNUNET_NAT_StatusCode` to string | ||
217 | * | ||
218 | * @param err error code to resolve to a string | ||
219 | * @return point to a static string containing the error code | ||
220 | */ | ||
221 | const char * | ||
222 | GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err); | ||
223 | |||
224 | |||
225 | /** | ||
226 | * Attempt to enable port redirection and detect public IP address | ||
227 | * contacting UPnP or NAT-PMP routers on the local network. Use addr | ||
228 | * to specify to which of the local host's addresses should the | ||
229 | * external port be mapped. The port is taken from the corresponding | ||
230 | * sockaddr_in[6] field. The NAT module should call the given | ||
231 | * callback for any 'plausible' external address. | ||
232 | * | ||
233 | * @param cfg configuration to use | ||
234 | * @param is_tcp #GNUNET_YES for TCP, #GNUNET_NO for UDP | ||
235 | * @param adv_port advertised port (port we are either bound to or that our OS | ||
236 | * locally performs redirection from to our bound port). | ||
237 | * @param num_addrs number of addresses in @a addrs | ||
238 | * @param addrs list of local addresses packets should be redirected to | ||
239 | * @param addrlens actual lengths of the addresses in @a addrs | ||
240 | * @param address_callback function to call everytime the public IP address changes | ||
241 | * @param reversal_callback function to call if someone wants connection reversal from us, | ||
242 | * NULL if connection reversal is not supported | ||
243 | * @param callback_cls closure for callbacks | ||
244 | * @return NULL on error, otherwise handle that can be used to unregister | ||
245 | */ | ||
246 | struct GNUNET_NAT_Handle * | ||
247 | GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
248 | int is_tcp, | ||
249 | uint16_t adv_port, | ||
250 | unsigned int num_addrs, | ||
251 | const struct sockaddr **addrs, | ||
252 | const socklen_t *addrlens, | ||
253 | GNUNET_NAT_AddressCallback address_callback, | ||
254 | GNUNET_NAT_ReversalCallback reversal_callback, | ||
255 | void *callback_cls, | ||
256 | struct GNUNET_NETWORK_Handle* sock); | ||
257 | |||
258 | |||
259 | /** | ||
260 | * Test if the given address is (currently) a plausible IP address for | ||
261 | * this peer. | ||
262 | * | ||
263 | * @param h the handle returned by register | ||
264 | * @param addr IP address to test (IPv4 or IPv6) | ||
265 | * @param addrlen number of bytes in @a addr | ||
266 | * @return #GNUNET_YES if the address is plausible, | ||
267 | * #GNUNET_NO if the address is not plausible, | ||
268 | * #GNUNET_SYSERR if the address is malformed | ||
269 | */ | ||
270 | int | ||
271 | GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, | ||
272 | const void *addr, | ||
273 | socklen_t addrlen); | ||
274 | |||
275 | |||
276 | /** | ||
277 | * We learned about a peer (possibly behind NAT) so run the | ||
278 | * gnunet-nat-client to send dummy ICMP responses to cause | ||
279 | * that peer to connect to us (connection reversal). | ||
280 | * | ||
281 | * @param h handle (used for configuration) | ||
282 | * @param sa the address of the peer (IPv4-only) | ||
283 | * @return #GNUNET_SYSERR on error, #GNUNET_NO if nat client is disabled, | ||
284 | * #GNUNET_OK otherwise | ||
285 | */ | ||
286 | int | ||
287 | GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | ||
288 | const struct sockaddr_in *sa); | ||
289 | |||
290 | |||
291 | /** | ||
292 | * Stop port redirection and public IP address detection for the given | ||
293 | * handle. This frees the handle, after having sent the needed | ||
294 | * commands to close open ports. | ||
295 | * | ||
296 | * @param h the handle to stop | ||
297 | */ | ||
298 | void | ||
299 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h); | ||
300 | |||
301 | |||
302 | /** | ||
303 | * Handle to a NAT test. | ||
304 | */ | ||
305 | struct GNUNET_NAT_Test; | ||
306 | |||
307 | |||
308 | /** | ||
309 | * Function called to report success or failure for | ||
310 | * NAT configuration test. | ||
311 | * | ||
312 | * @param cls closure | ||
313 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
314 | */ | ||
315 | typedef void (*GNUNET_NAT_TestCallback) (void *cls, | ||
316 | enum GNUNET_NAT_StatusCode result); | ||
317 | |||
318 | |||
319 | /** | ||
320 | * Start testing if NAT traversal works using the | ||
321 | * given configuration (IPv4-only). | ||
322 | * | ||
323 | * @param cfg configuration for the NAT traversal | ||
324 | * @param is_tcp #GNUNET_YES to test TCP, #GNUNET_NO to test UDP | ||
325 | * @param bnd_port port to bind to, 0 for connection reversal | ||
326 | * @param adv_port externally advertised port to use | ||
327 | * @param timeout delay after which the test should be aborted | ||
328 | * @param report function to call with the result of the test; | ||
329 | * you still must call #GNUNET_NAT_test_stop(). | ||
330 | * @param report_cls closure for @a report | ||
331 | * @return handle to cancel NAT test | ||
332 | */ | ||
333 | struct GNUNET_NAT_Test * | ||
334 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
335 | int is_tcp, | ||
336 | uint16_t bnd_port, | ||
337 | uint16_t adv_port, | ||
338 | struct GNUNET_TIME_Relative timeout, | ||
339 | GNUNET_NAT_TestCallback report, | ||
340 | void *report_cls); | ||
341 | |||
342 | |||
343 | /** | ||
344 | * Stop an active NAT test. | ||
345 | * | ||
346 | * @param tst test to stop. | ||
347 | */ | ||
348 | void | ||
349 | GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); | ||
350 | |||
351 | |||
352 | /** | ||
353 | * Signature of a callback that is given an IP address. | ||
354 | * | ||
355 | * @param cls closure | ||
356 | * @param addr the address, NULL on errors | ||
357 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
358 | */ | ||
359 | typedef void | ||
360 | (*GNUNET_NAT_IPCallback) (void *cls, | ||
361 | const struct in_addr *addr, | ||
362 | enum GNUNET_NAT_StatusCode result); | ||
363 | |||
364 | |||
365 | /** | ||
366 | * Opaque handle to cancel #GNUNET_NAT_mini_get_external_ipv4() operation. | ||
367 | */ | ||
368 | struct GNUNET_NAT_ExternalHandle; | ||
369 | |||
370 | |||
371 | /** | ||
372 | * Try to get the external IPv4 address of this peer. | ||
373 | * | ||
374 | * @param timeout when to fail | ||
375 | * @param cb function to call with result | ||
376 | * @param cb_cls closure for @a cb | ||
377 | * @return handle for cancellation (can only be used until @a cb is called), NULL on error | ||
378 | */ | ||
379 | struct GNUNET_NAT_ExternalHandle * | ||
380 | GNUNET_NAT_mini_get_external_ipv4 (struct GNUNET_TIME_Relative timeout, | ||
381 | GNUNET_NAT_IPCallback cb, | ||
382 | void *cb_cls); | ||
383 | |||
384 | |||
385 | /** | ||
386 | * Cancel operation. | ||
387 | * | ||
388 | * @param eh operation to cancel | ||
389 | */ | ||
390 | void | ||
391 | GNUNET_NAT_mini_get_external_ipv4_cancel (struct GNUNET_NAT_ExternalHandle *eh); | ||
392 | |||
393 | |||
394 | /** | ||
395 | * Handle to a mapping created with upnpc. | ||
396 | */ | ||
397 | struct GNUNET_NAT_MiniHandle; | ||
398 | |||
399 | |||
400 | /** | ||
401 | * Signature of the callback passed to #GNUNET_NAT_register() for | ||
402 | * a function to call whenever our set of 'valid' addresses changes. | ||
403 | * | ||
404 | * @param cls closure | ||
405 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | ||
406 | * the previous (now invalid) one, #GNUNET_SYSERR indicates an error | ||
407 | * @param addr either the previous or the new public IP address | ||
408 | * @param addrlen actual length of the @a addr | ||
409 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
410 | */ | ||
411 | typedef void | ||
412 | (*GNUNET_NAT_MiniAddressCallback) (void *cls, | ||
413 | int add_remove, | ||
414 | const struct sockaddr *addr, | ||
415 | socklen_t addrlen, | ||
416 | enum GNUNET_NAT_StatusCode result); | ||
417 | |||
418 | |||
419 | /** | ||
420 | * Start mapping the given port using (mini)upnpc. This function | ||
421 | * should typically not be used directly (it is used within the | ||
422 | * general-purpose #GNUNET_NAT_register() code). However, it can be | ||
423 | * used if specifically UPnP-based NAT traversal is to be used or | ||
424 | * tested. | ||
425 | * | ||
426 | * @param port port to map | ||
427 | * @param is_tcp #GNUNET_YES to map TCP, #GNUNET_NO for UDP | ||
428 | * @param ac function to call with mapping result | ||
429 | * @param ac_cls closure for @a ac | ||
430 | * @return NULL on error | ||
431 | */ | ||
432 | struct GNUNET_NAT_MiniHandle * | ||
433 | GNUNET_NAT_mini_map_start (uint16_t port, | ||
434 | int is_tcp, | ||
435 | GNUNET_NAT_MiniAddressCallback ac, | ||
436 | void *ac_cls); | ||
437 | |||
438 | |||
439 | /** | ||
440 | * Remove a mapping created with (mini)upnpc. Calling | ||
441 | * this function will give 'upnpc' 1s to remove the mapping, | ||
442 | * so while this function is non-blocking, a task will be | ||
443 | * left with the scheduler for up to 1s past this call. | ||
444 | * | ||
445 | * @param mini the handle | ||
446 | */ | ||
447 | void | ||
448 | GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini); | ||
449 | |||
450 | |||
451 | /** | ||
452 | * Handle to auto-configuration in progress. | ||
453 | */ | ||
454 | struct GNUNET_NAT_AutoHandle; | ||
455 | |||
456 | |||
457 | /** | ||
458 | * Function called with the result from the autoconfiguration. | ||
459 | * | ||
460 | * @param cls closure | ||
461 | * @param diff minimal suggested changes to the original configuration | ||
462 | * to make it work (as best as we can) | ||
463 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
464 | * @param type what the situation of the NAT | ||
465 | */ | ||
466 | typedef void | ||
467 | (*GNUNET_NAT_AutoResultCallback)(void *cls, | ||
468 | const struct GNUNET_CONFIGURATION_Handle *diff, | ||
469 | enum GNUNET_NAT_StatusCode result, | ||
470 | enum GNUNET_NAT_Type type); | ||
471 | |||
472 | |||
473 | /** | ||
474 | * Start auto-configuration routine. The resolver service should | ||
475 | * be available when this function is called. | ||
476 | * | ||
477 | * @param cfg initial configuration | ||
478 | * @param cb function to call with autoconfiguration result | ||
479 | * @param cb_cls closure for @a cb | ||
480 | * @return handle to cancel operation | ||
481 | */ | ||
482 | struct GNUNET_NAT_AutoHandle * | ||
483 | GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
484 | GNUNET_NAT_AutoResultCallback cb, | ||
485 | void *cb_cls); | ||
486 | |||
487 | |||
488 | /** | ||
489 | * Abort autoconfiguration. | ||
490 | * | ||
491 | * @param ah handle for operation to abort | ||
492 | */ | ||
493 | void | ||
494 | GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah); | ||
495 | |||
496 | /** | ||
497 | * Handle for active STUN Requests. | ||
498 | */ | ||
499 | struct GNUNET_NAT_STUN_Handle; | ||
500 | |||
501 | |||
502 | /** | ||
503 | * Function called with the result if an error happened during STUN request. | ||
504 | * | ||
505 | * @param cls closure | ||
506 | * @param result the specific error code | ||
507 | */ | ||
508 | typedef void | ||
509 | (*GNUNET_NAT_STUN_ErrorCallback)(void *cls, | ||
510 | enum GNUNET_NAT_StatusCode error); | ||
511 | |||
512 | |||
513 | /** | ||
514 | * Handle to a request given to the resolver. Can be used to cancel | ||
515 | * the request prior to the timeout or successful execution. Also | ||
516 | * used to track our internal state for the request. | ||
517 | */ | ||
518 | struct GNUNET_NAT_STUN_Handle; | ||
519 | |||
520 | |||
521 | /** | ||
522 | * Make generic STUN request. Sends a generic stun request to the | ||
523 | * server specified using the specified socket. The caller must | ||
524 | * wait for a reply on the @a sock and call | ||
525 | * #GNUNET_NAT_stun_handle_packet() if a reply is received. | ||
526 | * | ||
527 | * @param server the address of the stun server | ||
528 | * @param port port of the stun server | ||
529 | * @param sock the socket used to send the request | ||
530 | * @param cb callback in case of error (or completion) | ||
531 | * @param cb_cls closure for @a cb | ||
532 | * @return NULL on error | ||
533 | */ | ||
534 | struct GNUNET_NAT_STUN_Handle * | ||
535 | GNUNET_NAT_stun_make_request (const char *server, | ||
536 | uint16_t port, | ||
537 | struct GNUNET_NETWORK_Handle *sock, | ||
538 | GNUNET_NAT_STUN_ErrorCallback cb, | ||
539 | void *cb_cls); | ||
540 | |||
541 | |||
542 | /** | ||
543 | * Cancel active STUN request. Frees associated resources | ||
544 | * and ensures that the callback is no longer invoked. | ||
545 | * | ||
546 | * @param rh request to cancel | ||
547 | */ | ||
548 | void | ||
549 | GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh); | ||
550 | |||
551 | |||
552 | /** | ||
553 | * Handle an incoming STUN message. Do some basic sanity checks on | ||
554 | * packet size and content, try to extract a bit of information, and | ||
555 | * possibly reply. At the moment this only processes BIND requests, | ||
556 | * and returns the externally visible address of the request. If a | ||
557 | * callback is specified, invoke it with the attribute. | ||
558 | * | ||
559 | * @param data the packet | ||
560 | * @param len the length of the packet | ||
561 | * @param arg sockaddr_in where we will set our discovered packet | ||
562 | * @return #GNUNET_OK on OK, | ||
563 | * #GNUNET_NO if the packet is not a stun packet | ||
564 | */ | ||
565 | int | ||
566 | GNUNET_NAT_stun_handle_packet (const void *data, | ||
567 | size_t len, | ||
568 | struct sockaddr_in *arg); | ||
569 | |||
570 | |||
571 | /** | ||
572 | * CHECK if is a valid STUN packet sending to #GNUNET_NAT_stun_handle_packet(). | ||
573 | * It also check if it can handle the packet based on the NAT handler. | ||
574 | * You don't need to call anything else to check if the packet is valid, | ||
575 | * | ||
576 | * @param cls the NAT handle | ||
577 | * @param data packet | ||
578 | * @param len length of @a data | ||
579 | * @return #GNUNET_NO if it can't decode, #GNUNET_YES if is a packet | ||
580 | */ | ||
581 | int | ||
582 | GNUNET_NAT_is_valid_stun_packet (void *cls, | ||
583 | const void *data, | ||
584 | size_t len); | ||
585 | |||
586 | |||
587 | #endif | ||
588 | |||
589 | /** @} */ /* end of group */ | ||
590 | |||
591 | /* end of gnunet_nat_lib.h */ | ||
diff --git a/src/include/gnunet_nat_service.h b/src/include/gnunet_nat_service.h index 1620c9433..e75845207 100644 --- a/src/include/gnunet_nat_service.h +++ b/src/include/gnunet_nat_service.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2007-2016 GNUnet e.V. | 3 | Copyright (C) 2007-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -123,6 +123,12 @@ enum GNUNET_NAT_AddressClass | |||
123 | GNUNET_NAT_AC_EXTERN = 128, | 123 | GNUNET_NAT_AC_EXTERN = 128, |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * Addresses that were manually configured by the user. | ||
127 | * Used as a bit in combination with #GNUNET_NAT_AC_GLOBAL. | ||
128 | */ | ||
129 | GNUNET_NAT_AC_MANUAL = 256, | ||
130 | |||
131 | /** | ||
126 | * Bitmask for "any" address. | 132 | * Bitmask for "any" address. |
127 | */ | 133 | */ |
128 | GNUNET_NAT_AC_ANY = 65535 | 134 | GNUNET_NAT_AC_ANY = 65535 |
@@ -131,6 +137,144 @@ enum GNUNET_NAT_AddressClass | |||
131 | 137 | ||
132 | 138 | ||
133 | /** | 139 | /** |
140 | * Error Types for the NAT subsystem (which can then later be converted/resolved to a string) | ||
141 | */ | ||
142 | enum GNUNET_NAT_StatusCode | ||
143 | { | ||
144 | /** | ||
145 | * Just the default | ||
146 | */ | ||
147 | GNUNET_NAT_ERROR_SUCCESS = GNUNET_OK, | ||
148 | |||
149 | /** | ||
150 | * IPC Failure | ||
151 | */ | ||
152 | GNUNET_NAT_ERROR_IPC_FAILURE, | ||
153 | |||
154 | /** | ||
155 | * Failure in network subsystem, check permissions | ||
156 | */ | ||
157 | GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR, | ||
158 | |||
159 | /** | ||
160 | * test timed out | ||
161 | */ | ||
162 | GNUNET_NAT_ERROR_TIMEOUT, | ||
163 | |||
164 | /** | ||
165 | * detected that we are offline | ||
166 | */ | ||
167 | GNUNET_NAT_ERROR_NOT_ONLINE, | ||
168 | |||
169 | /** | ||
170 | * `upnpc` command not found | ||
171 | */ | ||
172 | GNUNET_NAT_ERROR_UPNPC_NOT_FOUND, | ||
173 | |||
174 | /** | ||
175 | * Failed to run `upnpc` command | ||
176 | */ | ||
177 | GNUNET_NAT_ERROR_UPNPC_FAILED, | ||
178 | |||
179 | /** | ||
180 | * `upnpc' command took too long, process killed | ||
181 | */ | ||
182 | GNUNET_NAT_ERROR_UPNPC_TIMEOUT, | ||
183 | |||
184 | /** | ||
185 | * `upnpc' command failed to establish port mapping | ||
186 | */ | ||
187 | GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED, | ||
188 | |||
189 | /** | ||
190 | * `external-ip' command not found | ||
191 | */ | ||
192 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND, | ||
193 | |||
194 | /** | ||
195 | * Failed to run `external-ip` command | ||
196 | */ | ||
197 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED, | ||
198 | |||
199 | /** | ||
200 | * `external-ip' command output invalid | ||
201 | */ | ||
202 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID, | ||
203 | |||
204 | /** | ||
205 | * "no valid address was returned by `external-ip'" | ||
206 | */ | ||
207 | GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID, | ||
208 | |||
209 | /** | ||
210 | * Could not determine interface with internal/local network address | ||
211 | */ | ||
212 | GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO, | ||
213 | |||
214 | /** | ||
215 | * No working gnunet-helper-nat-server found | ||
216 | */ | ||
217 | GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND, | ||
218 | |||
219 | /** | ||
220 | * NAT test could not be initialized | ||
221 | */ | ||
222 | GNUNET_NAT_ERROR_NAT_TEST_START_FAILED, | ||
223 | |||
224 | /** | ||
225 | * NAT test timeout | ||
226 | */ | ||
227 | GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT, | ||
228 | |||
229 | /** | ||
230 | * NAT test failed to initiate | ||
231 | */ | ||
232 | GNUNET_NAT_ERROR_NAT_REGISTER_FAILED, | ||
233 | |||
234 | /** | ||
235 | * | ||
236 | */ | ||
237 | GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND | ||
238 | |||
239 | }; | ||
240 | |||
241 | |||
242 | |||
243 | /** | ||
244 | * What the situation of the NAT connectivity | ||
245 | */ | ||
246 | enum GNUNET_NAT_Type | ||
247 | { | ||
248 | /** | ||
249 | * We have a direct connection | ||
250 | */ | ||
251 | GNUNET_NAT_TYPE_NO_NAT = GNUNET_OK, | ||
252 | |||
253 | /** | ||
254 | * We are under a NAT but cannot traverse it | ||
255 | */ | ||
256 | GNUNET_NAT_TYPE_UNREACHABLE_NAT, | ||
257 | |||
258 | /** | ||
259 | * We can traverse using STUN | ||
260 | */ | ||
261 | GNUNET_NAT_TYPE_STUN_PUNCHED_NAT, | ||
262 | |||
263 | /** | ||
264 | * We can traverse using UPNP | ||
265 | */ | ||
266 | GNUNET_NAT_TYPE_UPNP_NAT, | ||
267 | |||
268 | /** | ||
269 | * We know nothing about the NAT. | ||
270 | */ | ||
271 | GNUNET_NAT_TYPE_UNKNOWN | ||
272 | |||
273 | }; | ||
274 | |||
275 | |||
276 | |||
277 | /** | ||
134 | * Signature of the callback passed to #GNUNET_NAT_register() for | 278 | * Signature of the callback passed to #GNUNET_NAT_register() for |
135 | * a function to call whenever our set of 'valid' addresses changes. | 279 | * a function to call whenever our set of 'valid' addresses changes. |
136 | * | 280 | * |
@@ -179,8 +323,8 @@ struct GNUNET_NAT_Handle; | |||
179 | * address_callback for any 'plausible' external address. | 323 | * address_callback for any 'plausible' external address. |
180 | * | 324 | * |
181 | * @param cfg configuration to use | 325 | * @param cfg configuration to use |
326 | * @param config_section name of the configuration section for options | ||
182 | * @param proto protocol this is about, IPPROTO_TCP or IPPROTO_UDP | 327 | * @param proto protocol this is about, IPPROTO_TCP or IPPROTO_UDP |
183 | * @param hole_external hostname and port of manually punched hole in NAT, otherwise NULL (or empty string) | ||
184 | * @param num_addrs number of addresses in @a addrs | 328 | * @param num_addrs number of addresses in @a addrs |
185 | * @param addrs list of local addresses packets should be redirected to | 329 | * @param addrs list of local addresses packets should be redirected to |
186 | * @param addrlens actual lengths of the addresses in @a addrs | 330 | * @param addrlens actual lengths of the addresses in @a addrs |
@@ -192,8 +336,8 @@ struct GNUNET_NAT_Handle; | |||
192 | */ | 336 | */ |
193 | struct GNUNET_NAT_Handle * | 337 | struct GNUNET_NAT_Handle * |
194 | GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | 338 | GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, |
339 | const char *config_section, | ||
195 | uint8_t proto, | 340 | uint8_t proto, |
196 | const char *hole_external, | ||
197 | unsigned int num_addrs, | 341 | unsigned int num_addrs, |
198 | const struct sockaddr **addrs, | 342 | const struct sockaddr **addrs, |
199 | const socklen_t *addrlens, | 343 | const socklen_t *addrlens, |
@@ -251,127 +395,6 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh); | |||
251 | 395 | ||
252 | 396 | ||
253 | /** | 397 | /** |
254 | * Handle to a NAT test. | ||
255 | */ | ||
256 | struct GNUNET_NAT_Test; | ||
257 | |||
258 | |||
259 | /** | ||
260 | * Error Types for the NAT subsystem (which can then later be converted/resolved to a string) | ||
261 | */ | ||
262 | enum GNUNET_NAT_StatusCode | ||
263 | { | ||
264 | /** | ||
265 | * Just the default | ||
266 | */ | ||
267 | GNUNET_NAT_ERROR_SUCCESS = GNUNET_OK, | ||
268 | |||
269 | /** | ||
270 | * IPC Failure | ||
271 | */ | ||
272 | GNUNET_NAT_ERROR_IPC_FAILURE, | ||
273 | |||
274 | /** | ||
275 | * Failure in network subsystem, check permissions | ||
276 | */ | ||
277 | GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR, | ||
278 | |||
279 | /** | ||
280 | * test timed out | ||
281 | */ | ||
282 | GNUNET_NAT_ERROR_TIMEOUT, | ||
283 | |||
284 | /** | ||
285 | * detected that we are offline | ||
286 | */ | ||
287 | GNUNET_NAT_ERROR_NOT_ONLINE, | ||
288 | |||
289 | /** | ||
290 | * `upnpc` command not found | ||
291 | */ | ||
292 | GNUNET_NAT_ERROR_UPNPC_NOT_FOUND, | ||
293 | |||
294 | /** | ||
295 | * Failed to run `upnpc` command | ||
296 | */ | ||
297 | GNUNET_NAT_ERROR_UPNPC_FAILED, | ||
298 | |||
299 | /** | ||
300 | * `upnpc' command took too long, process killed | ||
301 | */ | ||
302 | GNUNET_NAT_ERROR_UPNPC_TIMEOUT, | ||
303 | |||
304 | /** | ||
305 | * `upnpc' command failed to establish port mapping | ||
306 | */ | ||
307 | GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED, | ||
308 | |||
309 | /** | ||
310 | * `external-ip' command not found | ||
311 | */ | ||
312 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND, | ||
313 | |||
314 | /** | ||
315 | * Failed to run `external-ip` command | ||
316 | */ | ||
317 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED, | ||
318 | |||
319 | /** | ||
320 | * `external-ip' command output invalid | ||
321 | */ | ||
322 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID, | ||
323 | |||
324 | /** | ||
325 | * "no valid address was returned by `external-ip'" | ||
326 | */ | ||
327 | GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID, | ||
328 | |||
329 | /** | ||
330 | * Could not determine interface with internal/local network address | ||
331 | */ | ||
332 | GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO, | ||
333 | |||
334 | /** | ||
335 | * No working gnunet-helper-nat-server found | ||
336 | */ | ||
337 | GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND, | ||
338 | |||
339 | /** | ||
340 | * NAT test could not be initialized | ||
341 | */ | ||
342 | GNUNET_NAT_ERROR_NAT_TEST_START_FAILED, | ||
343 | |||
344 | /** | ||
345 | * NAT test timeout | ||
346 | */ | ||
347 | GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT, | ||
348 | |||
349 | /** | ||
350 | * NAT test failed to initiate | ||
351 | */ | ||
352 | GNUNET_NAT_ERROR_NAT_REGISTER_FAILED, | ||
353 | |||
354 | /** | ||
355 | * | ||
356 | */ | ||
357 | GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND | ||
358 | |||
359 | }; | ||
360 | |||
361 | |||
362 | /** | ||
363 | * Function called to report success or failure for | ||
364 | * NAT configuration test. | ||
365 | * | ||
366 | * @param cls closure | ||
367 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
368 | */ | ||
369 | typedef void | ||
370 | (*GNUNET_NAT_TestCallback) (void *cls, | ||
371 | enum GNUNET_NAT_StatusCode result); | ||
372 | |||
373 | |||
374 | /** | ||
375 | * Handle an incoming STUN message. This function is useful as | 398 | * Handle an incoming STUN message. This function is useful as |
376 | * some GNUnet service may be listening on a UDP port and might | 399 | * some GNUnet service may be listening on a UDP port and might |
377 | * thus receive STUN messages while trying to receive other data. | 400 | * thus receive STUN messages while trying to receive other data. |
@@ -411,6 +434,18 @@ struct GNUNET_NAT_STUN_Handle; | |||
411 | 434 | ||
412 | 435 | ||
413 | /** | 436 | /** |
437 | * Function called to report success or failure for | ||
438 | * NAT configuration test. | ||
439 | * | ||
440 | * @param cls closure | ||
441 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
442 | */ | ||
443 | typedef void | ||
444 | (*GNUNET_NAT_TestCallback) (void *cls, | ||
445 | enum GNUNET_NAT_StatusCode result); | ||
446 | |||
447 | |||
448 | /** | ||
414 | * Make Generic STUN request. Sends a generic stun request to the | 449 | * Make Generic STUN request. Sends a generic stun request to the |
415 | * server specified using the specified socket. If we do this, | 450 | * server specified using the specified socket. If we do this, |
416 | * we need to watch for possible responses and call | 451 | * we need to watch for possible responses and call |
@@ -442,130 +477,6 @@ void | |||
442 | GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh); | 477 | GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh); |
443 | 478 | ||
444 | 479 | ||
445 | /** | ||
446 | * Start testing if NAT traversal works using the given configuration | ||
447 | * (IPv4-only). The transport adapters should be down while using | ||
448 | * this function. | ||
449 | * | ||
450 | * @param cfg configuration for the NAT traversal | ||
451 | * @param proto protocol to test, i.e. IPPROTO_TCP or IPPROTO_UDP | ||
452 | * @param bind_ip IPv4 address to bind to | ||
453 | * @param bnd_port port to bind to, 0 to test connection reversal | ||
454 | * @param extern_ip IPv4 address to externally advertise | ||
455 | * @param extern_port externally advertised port to use | ||
456 | * @param report function to call with the result of the test | ||
457 | * @param report_cls closure for @a report | ||
458 | * @return handle to cancel NAT test | ||
459 | */ | ||
460 | struct GNUNET_NAT_Test * | ||
461 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
462 | uint8_t proto, | ||
463 | struct in_addr bind_ip, | ||
464 | uint16_t bnd_port, | ||
465 | struct in_addr extern_ip, | ||
466 | uint16_t extern_port, | ||
467 | GNUNET_NAT_TestCallback report, | ||
468 | void *report_cls); | ||
469 | |||
470 | |||
471 | /** | ||
472 | * Stop an active NAT test. | ||
473 | * | ||
474 | * @param tst test to stop. | ||
475 | */ | ||
476 | void | ||
477 | GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); | ||
478 | |||
479 | |||
480 | /** | ||
481 | * Handle to auto-configuration in progress. | ||
482 | */ | ||
483 | struct GNUNET_NAT_AutoHandle; | ||
484 | |||
485 | |||
486 | /** | ||
487 | * What the situation of the NAT connectivity | ||
488 | */ | ||
489 | enum GNUNET_NAT_Type | ||
490 | { | ||
491 | /** | ||
492 | * We have a direct connection | ||
493 | */ | ||
494 | GNUNET_NAT_TYPE_NO_NAT = GNUNET_OK, | ||
495 | |||
496 | /** | ||
497 | * We are under a NAT but cannot traverse it | ||
498 | */ | ||
499 | GNUNET_NAT_TYPE_UNREACHABLE_NAT, | ||
500 | |||
501 | /** | ||
502 | * We can traverse using STUN | ||
503 | */ | ||
504 | GNUNET_NAT_TYPE_STUN_PUNCHED_NAT, | ||
505 | |||
506 | /** | ||
507 | * We can traverse using UPNP | ||
508 | */ | ||
509 | GNUNET_NAT_TYPE_UPNP_NAT, | ||
510 | |||
511 | /** | ||
512 | * We know nothing about the NAT. | ||
513 | */ | ||
514 | GNUNET_NAT_TYPE_UNKNOWN | ||
515 | |||
516 | }; | ||
517 | |||
518 | |||
519 | /** | ||
520 | * Converts `enum GNUNET_NAT_StatusCode` to string | ||
521 | * | ||
522 | * @param err error code to resolve to a string | ||
523 | * @return point to a static string containing the error code | ||
524 | */ | ||
525 | const char * | ||
526 | GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err); | ||
527 | |||
528 | |||
529 | /** | ||
530 | * Function called with the result from the autoconfiguration. | ||
531 | * | ||
532 | * @param cls closure | ||
533 | * @param diff minimal suggested changes to the original configuration | ||
534 | * to make it work (as best as we can) | ||
535 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
536 | * @param type what the situation of the NAT | ||
537 | */ | ||
538 | typedef void | ||
539 | (*GNUNET_NAT_AutoResultCallback)(void *cls, | ||
540 | const struct GNUNET_CONFIGURATION_Handle *diff, | ||
541 | enum GNUNET_NAT_StatusCode result, | ||
542 | enum GNUNET_NAT_Type type); | ||
543 | |||
544 | |||
545 | /** | ||
546 | * Start auto-configuration routine. The transport adapters should | ||
547 | * be stopped while this function is called. | ||
548 | * | ||
549 | * @param cfg initial configuration | ||
550 | * @param cb function to call with autoconfiguration result | ||
551 | * @param cb_cls closure for @a cb | ||
552 | * @return handle to cancel operation | ||
553 | */ | ||
554 | struct GNUNET_NAT_AutoHandle * | ||
555 | GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
556 | GNUNET_NAT_AutoResultCallback cb, | ||
557 | void *cb_cls); | ||
558 | |||
559 | |||
560 | /** | ||
561 | * Abort autoconfiguration. | ||
562 | * | ||
563 | * @param ah handle for operation to abort | ||
564 | */ | ||
565 | void | ||
566 | GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah); | ||
567 | |||
568 | |||
569 | #endif | 480 | #endif |
570 | 481 | ||
571 | /** @} */ /* end of group */ | 482 | /** @} */ /* end of group */ |
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h index 44df483a0..b5c2153ac 100644 --- a/src/include/gnunet_peerinfo_service.h +++ b/src/include/gnunet_peerinfo_service.h | |||
@@ -101,7 +101,7 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h); | |||
101 | struct GNUNET_MQ_Envelope * | 101 | struct GNUNET_MQ_Envelope * |
102 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, | 102 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, |
103 | const struct GNUNET_HELLO_Message *hello, | 103 | const struct GNUNET_HELLO_Message *hello, |
104 | GNUNET_MQ_NotifyCallback cont, | 104 | GNUNET_SCHEDULER_TaskCallback cont, |
105 | void *cont_cls); | 105 | void *cont_cls); |
106 | 106 | ||
107 | 107 | ||
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index cf26f1727..e31b1f33c 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2645,7 +2645,7 @@ extern "C" | |||
2645 | /** | 2645 | /** |
2646 | * Send origin an ACK that the connection is complete | 2646 | * Send origin an ACK that the connection is complete |
2647 | */ | 2647 | */ |
2648 | #define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK 1001 | 2648 | #define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK 1001 |
2649 | 2649 | ||
2650 | /** | 2650 | /** |
2651 | * Notify that a connection is no longer valid | 2651 | * Notify that a connection is no longer valid |
@@ -2660,49 +2660,53 @@ extern "C" | |||
2660 | /** | 2660 | /** |
2661 | * At some point, the route will spontaneously change TODO | 2661 | * At some point, the route will spontaneously change TODO |
2662 | */ | 2662 | */ |
2663 | #define GNUNET_MESSAGE_TYPE_CADET_PATH_CHANGED 1004 | 2663 | #define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_PATH_CHANGED_UNIMPLEMENTED 1004 |
2664 | 2664 | ||
2665 | /** | 2665 | /** |
2666 | * Hop-by-hop, connection dependent ACK. | 2666 | * Hop-by-hop, connection dependent ACK. |
2667 | */ | 2667 | */ |
2668 | #define GNUNET_MESSAGE_TYPE_CADET_ACK 1005 | 2668 | #define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK 1005 |
2669 | 2669 | ||
2670 | /** | 2670 | /** |
2671 | * Poll for a hop-by-hop ACK. | 2671 | * Axolotl key exchange. |
2672 | */ | 2672 | */ |
2673 | #define GNUNET_MESSAGE_TYPE_CADET_POLL 1006 | 2673 | #define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX 1007 |
2674 | 2674 | ||
2675 | /** | 2675 | /** |
2676 | * Key exchange encapsulation. | 2676 | * Axolotl encrypted data. |
2677 | */ | 2677 | */ |
2678 | #define GNUNET_MESSAGE_TYPE_CADET_KX 1007 | 2678 | #define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED 1008 |
2679 | 2679 | ||
2680 | /** | 2680 | /** |
2681 | * Axolotl encrypted data. | 2681 | * We do not bother with ACKs for |
2682 | * #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED messages, but we instead | ||
2683 | * poll for one if we got nothing for a while and start to be worried. | ||
2682 | */ | 2684 | */ |
2683 | #define GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED 1008 | 2685 | #define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL 1006 |
2686 | |||
2687 | |||
2684 | 2688 | ||
2685 | /********************************** Channel *********************************/ | 2689 | /********************************** Channel *********************************/ |
2686 | 2690 | ||
2687 | /** | 2691 | /** |
2688 | * Payload data (inside an encrypted tunnel). | 2692 | * Payload data (inside an encrypted tunnel). |
2689 | */ | 2693 | */ |
2690 | #define GNUNET_MESSAGE_TYPE_CADET_DATA 1010 | 2694 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA 1010 |
2691 | 2695 | ||
2692 | /** | 2696 | /** |
2693 | * Confirm payload data end-to-end. | 2697 | * Confirm payload data end-to-end. |
2694 | */ | 2698 | */ |
2695 | #define GNUNET_MESSAGE_TYPE_CADET_DATA_ACK 1011 | 2699 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK 1011 |
2696 | 2700 | ||
2697 | /** | 2701 | /** |
2698 | * Announce connection is still alive (direction sensitive). | 2702 | * Announce connection is still alive (direction sensitive). |
2699 | */ | 2703 | */ |
2700 | #define GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE 1012 | 2704 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE 1012 |
2701 | 2705 | ||
2702 | /** | 2706 | /** |
2703 | * Ask the cadet service to create a new channel. | 2707 | * Ask the cadet service to create a new channel. |
2704 | */ | 2708 | */ |
2705 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE 1013 | 2709 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN 1013 |
2706 | 2710 | ||
2707 | /** | 2711 | /** |
2708 | * Ask the cadet service to destroy a channel. | 2712 | * Ask the cadet service to destroy a channel. |
@@ -2712,12 +2716,12 @@ extern "C" | |||
2712 | /** | 2716 | /** |
2713 | * Confirm the creation of a channel | 2717 | * Confirm the creation of a channel |
2714 | */ | 2718 | */ |
2715 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK 1015 | 2719 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK 1015 |
2716 | 2720 | ||
2717 | /** | 2721 | /** |
2718 | * Reject the creation of a channel | 2722 | * Reject the creation of a channel |
2719 | */ | 2723 | */ |
2720 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK 1016 | 2724 | #define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_NACK_DEPRECATED 1016 |
2721 | 2725 | ||
2722 | /*********************************** Local **********************************/ | 2726 | /*********************************** Local **********************************/ |
2723 | 2727 | ||
@@ -2789,6 +2793,11 @@ extern "C" | |||
2789 | */ | 2793 | */ |
2790 | #define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_DUMP 1038 | 2794 | #define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_DUMP 1038 |
2791 | 2795 | ||
2796 | /** | ||
2797 | * End of local information about all peers known to the service. | ||
2798 | */ | ||
2799 | #define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER_END 1039 | ||
2800 | |||
2792 | /******************************** Application *******************************/ | 2801 | /******************************** Application *******************************/ |
2793 | 2802 | ||
2794 | /** | 2803 | /** |
@@ -2833,7 +2842,7 @@ extern "C" | |||
2833 | /** | 2842 | /** |
2834 | * Message to ask NAT service to request autoconfiguration. | 2843 | * Message to ask NAT service to request autoconfiguration. |
2835 | */ | 2844 | */ |
2836 | #define GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG 1067 | 2845 | #define GNUNET_MESSAGE_TYPE_NAT_AUTO_REQUEST_CFG 1067 |
2837 | 2846 | ||
2838 | /** | 2847 | /** |
2839 | * Message from NAT service with the autoconfiguration result. | 2848 | * Message from NAT service with the autoconfiguration result. |
@@ -2841,8 +2850,31 @@ extern "C" | |||
2841 | #define GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT 1068 | 2850 | #define GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT 1068 |
2842 | 2851 | ||
2843 | 2852 | ||
2853 | /* 1080-1109 reserved for TMCG (Heiko Stamer, see gnunet-developers, January 2017) */ | ||
2854 | |||
2855 | |||
2856 | /******************************************************************************/ | ||
2857 | /*********************************** AUCTION ********************************/ | ||
2858 | /******************************************************************************/ | ||
2859 | |||
2860 | /** | ||
2861 | * Client wants to create a new auction. | ||
2862 | */ | ||
2863 | #define GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_CREATE 1110 | ||
2864 | |||
2865 | /** | ||
2866 | * Client wants to join an existing auction. | ||
2867 | */ | ||
2868 | #define GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_JOIN 1111 | ||
2869 | |||
2870 | /** | ||
2871 | * Service reports the auction outcome to the client. | ||
2872 | */ | ||
2873 | #define GNUNET_MESSAGE_TYPE_AUCTION_CLIENT_OUTCOME 1112 | ||
2874 | |||
2875 | |||
2844 | /** | 2876 | /** |
2845 | * Next available: 1080 | 2877 | * Next available: 1130 |
2846 | */ | 2878 | */ |
2847 | 2879 | ||
2848 | 2880 | ||
diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h index 353287cbf..03bc4575e 100644 --- a/src/include/gnunet_signatures.h +++ b/src/include/gnunet_signatures.h | |||
@@ -151,11 +151,6 @@ extern "C" | |||
151 | #define GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING 20 | 151 | #define GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING 20 |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Key exchange in CADET | ||
155 | */ | ||
156 | #define GNUNET_SIGNATURE_PURPOSE_CADET_KX 21 | ||
157 | |||
158 | /** | ||
159 | * Signature for the first round of distributed key generation. | 154 | * Signature for the first round of distributed key generation. |
160 | */ | 155 | */ |
161 | #define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1 22 | 156 | #define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1 22 |
diff --git a/src/json/.gitignore b/src/json/.gitignore new file mode 100644 index 000000000..6709c749d --- /dev/null +++ b/src/json/.gitignore | |||
@@ -0,0 +1 @@ | |||
test_json | |||
diff --git a/src/jsonapi/.gitignore b/src/jsonapi/.gitignore new file mode 100644 index 000000000..077606988 --- /dev/null +++ b/src/jsonapi/.gitignore | |||
@@ -0,0 +1 @@ | |||
test_jsonapi | |||
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c index e84fdb20f..de65e0ab7 100644 --- a/src/multicast/gnunet-service-multicast.c +++ b/src/multicast/gnunet-service-multicast.c | |||
@@ -710,15 +710,19 @@ cadet_notify_transmit_ready (void *cls, size_t buf_size, void *buf) | |||
710 | static void | 710 | static void |
711 | cadet_send_channel (struct Channel *chn, const struct GNUNET_MessageHeader *msg) | 711 | cadet_send_channel (struct Channel *chn, const struct GNUNET_MessageHeader *msg) |
712 | { | 712 | { |
713 | uint16_t msg_size = ntohs (msg->size); | ||
714 | struct GNUNET_MessageHeader *msg_copy = GNUNET_malloc (msg_size); | ||
715 | GNUNET_memcpy (msg_copy, msg, msg_size); | ||
716 | |||
713 | struct CadetTransmitClosure *tcls = GNUNET_malloc (sizeof (*tcls)); | 717 | struct CadetTransmitClosure *tcls = GNUNET_malloc (sizeof (*tcls)); |
714 | tcls->chn = chn; | 718 | tcls->chn = chn; |
715 | tcls->msg = msg; | 719 | tcls->msg = msg_copy; |
716 | 720 | ||
717 | chn->msgs_pending++; | 721 | chn->msgs_pending++; |
718 | chn->tmit_handle | 722 | chn->tmit_handle |
719 | = GNUNET_CADET_notify_transmit_ready (chn->channel, GNUNET_NO, | 723 | = GNUNET_CADET_notify_transmit_ready (chn->channel, GNUNET_NO, |
720 | GNUNET_TIME_UNIT_FOREVER_REL, | 724 | GNUNET_TIME_UNIT_FOREVER_REL, |
721 | ntohs (msg->size), | 725 | msg_size, |
722 | &cadet_notify_transmit_ready, | 726 | &cadet_notify_transmit_ready, |
723 | tcls); | 727 | tcls); |
724 | GNUNET_assert (NULL != chn->tmit_handle); | 728 | GNUNET_assert (NULL != chn->tmit_handle); |
@@ -783,9 +787,21 @@ cadet_send_join_decision_cb (void *cls, | |||
783 | const struct MulticastJoinDecisionMessageHeader *hdcsn = cls; | 787 | const struct MulticastJoinDecisionMessageHeader *hdcsn = cls; |
784 | struct Channel *chn = channel; | 788 | struct Channel *chn = channel; |
785 | 789 | ||
790 | const struct MulticastJoinDecisionMessage *dcsn = | ||
791 | (struct MulticastJoinDecisionMessage *) &hdcsn[1]; | ||
792 | |||
786 | if (0 == memcmp (&hdcsn->member_pub_key, &chn->member_pub_key, sizeof (chn->member_pub_key)) | 793 | if (0 == memcmp (&hdcsn->member_pub_key, &chn->member_pub_key, sizeof (chn->member_pub_key)) |
787 | && 0 == memcmp (&hdcsn->peer, &chn->peer, sizeof (chn->peer))) | 794 | && 0 == memcmp (&hdcsn->peer, &chn->peer, sizeof (chn->peer))) |
788 | { | 795 | { |
796 | if (GNUNET_YES == ntohl (dcsn->is_admitted)) | ||
797 | { | ||
798 | chn->join_status = JOIN_ADMITTED; | ||
799 | } | ||
800 | else | ||
801 | { | ||
802 | chn->join_status = JOIN_REFUSED; | ||
803 | } | ||
804 | |||
789 | cadet_send_channel (chn, &hdcsn->header); | 805 | cadet_send_channel (chn, &hdcsn->header); |
790 | return GNUNET_NO; | 806 | return GNUNET_NO; |
791 | } | 807 | } |
@@ -1019,6 +1035,7 @@ handle_client_member_join (void *cls, | |||
1019 | if (NULL == mem) | 1035 | if (NULL == mem) |
1020 | { | 1036 | { |
1021 | mem = GNUNET_new (struct Member); | 1037 | mem = GNUNET_new (struct Member); |
1038 | mem->origin = msg->origin; | ||
1022 | mem->priv_key = msg->member_key; | 1039 | mem->priv_key = msg->member_key; |
1023 | mem->pub_key = mem_pub_key; | 1040 | mem->pub_key = mem_pub_key; |
1024 | mem->pub_key_hash = mem_pub_key_hash; | 1041 | mem->pub_key_hash = mem_pub_key_hash; |
@@ -1083,9 +1100,10 @@ handle_client_member_join (void *cls, | |||
1083 | join_msg_size = ntohs (join_msg->size); | 1100 | join_msg_size = ntohs (join_msg->size); |
1084 | } | 1101 | } |
1085 | 1102 | ||
1103 | uint16_t req_msg_size = sizeof (struct MulticastJoinRequestMessage) + join_msg_size; | ||
1086 | struct MulticastJoinRequestMessage * | 1104 | struct MulticastJoinRequestMessage * |
1087 | req = GNUNET_malloc (sizeof (*req) + join_msg_size); | 1105 | req = GNUNET_malloc (req_msg_size); |
1088 | req->header.size = htons (sizeof (*req) + join_msg_size); | 1106 | req->header.size = htons (req_msg_size); |
1089 | req->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST); | 1107 | req->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST); |
1090 | req->group_pub_key = grp->pub_key; | 1108 | req->group_pub_key = grp->pub_key; |
1091 | req->peer = this_peer; | 1109 | req->peer = this_peer; |
@@ -1094,7 +1112,7 @@ handle_client_member_join (void *cls, | |||
1094 | GNUNET_memcpy (&req[1], join_msg, join_msg_size); | 1112 | GNUNET_memcpy (&req[1], join_msg, join_msg_size); |
1095 | 1113 | ||
1096 | req->member_pub_key = mem->pub_key; | 1114 | req->member_pub_key = mem->pub_key; |
1097 | req->purpose.size = htonl (msg_size | 1115 | req->purpose.size = htonl (req_msg_size |
1098 | - sizeof (req->header) | 1116 | - sizeof (req->header) |
1099 | - sizeof (req->reserved) | 1117 | - sizeof (req->reserved) |
1100 | - sizeof (req->signature)); | 1118 | - sizeof (req->signature)); |
@@ -1534,6 +1552,7 @@ cadet_recv_join_request (void *cls, | |||
1534 | void **ctx, | 1552 | void **ctx, |
1535 | const struct GNUNET_MessageHeader *m) | 1553 | const struct GNUNET_MessageHeader *m) |
1536 | { | 1554 | { |
1555 | GNUNET_CADET_receive_done(channel); | ||
1537 | const struct MulticastJoinRequestMessage * | 1556 | const struct MulticastJoinRequestMessage * |
1538 | req = (const struct MulticastJoinRequestMessage *) m; | 1557 | req = (const struct MulticastJoinRequestMessage *) m; |
1539 | uint16_t size = ntohs (m->size); | 1558 | uint16_t size = ntohs (m->size); |
@@ -1576,6 +1595,7 @@ cadet_recv_join_request (void *cls, | |||
1576 | chn->join_status = JOIN_WAITING; | 1595 | chn->join_status = JOIN_WAITING; |
1577 | GNUNET_CONTAINER_multihashmap_put (channels_in, &chn->group_pub_hash, chn, | 1596 | GNUNET_CONTAINER_multihashmap_put (channels_in, &chn->group_pub_hash, chn, |
1578 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 1597 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
1598 | *ctx = chn; | ||
1579 | 1599 | ||
1580 | client_send_all (&group_pub_hash, m); | 1600 | client_send_all (&group_pub_hash, m); |
1581 | return GNUNET_OK; | 1601 | return GNUNET_OK; |
@@ -1591,10 +1611,14 @@ cadet_recv_join_decision (void *cls, | |||
1591 | void **ctx, | 1611 | void **ctx, |
1592 | const struct GNUNET_MessageHeader *m) | 1612 | const struct GNUNET_MessageHeader *m) |
1593 | { | 1613 | { |
1614 | GNUNET_CADET_receive_done (channel); | ||
1615 | const struct MulticastJoinDecisionMessageHeader * | ||
1616 | hdcsn = (const struct MulticastJoinDecisionMessageHeader *) m; | ||
1594 | const struct MulticastJoinDecisionMessage * | 1617 | const struct MulticastJoinDecisionMessage * |
1595 | dcsn = (const struct MulticastJoinDecisionMessage *) m; | 1618 | dcsn = (const struct MulticastJoinDecisionMessage *) &hdcsn[1]; |
1596 | uint16_t size = ntohs (m->size); | 1619 | uint16_t size = ntohs (m->size); |
1597 | if (size < sizeof (*dcsn)) | 1620 | if (size < sizeof (struct MulticastJoinDecisionMessageHeader) + |
1621 | sizeof (struct MulticastJoinDecisionMessage)) | ||
1598 | { | 1622 | { |
1599 | GNUNET_break_op (0); | 1623 | GNUNET_break_op (0); |
1600 | return GNUNET_SYSERR; | 1624 | return GNUNET_SYSERR; |
@@ -1623,15 +1647,10 @@ cadet_recv_join_decision (void *cls, | |||
1623 | break; | 1647 | break; |
1624 | } | 1648 | } |
1625 | 1649 | ||
1626 | struct MulticastJoinDecisionMessageHeader * | 1650 | // FIXME: do we need to copy chn->peer or compare it with hdcsn->peer? |
1627 | hdcsn = GNUNET_malloc (sizeof (*hdcsn) + size); | ||
1628 | hdcsn->peer = chn->peer; | ||
1629 | GNUNET_memcpy (&hdcsn[1], dcsn, sizeof (*hdcsn) + size); | ||
1630 | |||
1631 | struct Member *mem = (struct Member *) chn->group; | 1651 | struct Member *mem = (struct Member *) chn->group; |
1632 | client_send_join_decision (mem, hdcsn); | 1652 | client_send_join_decision (mem, hdcsn); |
1633 | GNUNET_free (hdcsn); | 1653 | if (GNUNET_YES == ntohl (dcsn->is_admitted)) |
1634 | if (GNUNET_YES == ntohs (dcsn->is_admitted)) | ||
1635 | { | 1654 | { |
1636 | chn->join_status = JOIN_ADMITTED; | 1655 | chn->join_status = JOIN_ADMITTED; |
1637 | return GNUNET_OK; | 1656 | return GNUNET_OK; |
@@ -1652,6 +1671,7 @@ cadet_recv_message (void *cls, | |||
1652 | void **ctx, | 1671 | void **ctx, |
1653 | const struct GNUNET_MessageHeader *m) | 1672 | const struct GNUNET_MessageHeader *m) |
1654 | { | 1673 | { |
1674 | GNUNET_CADET_receive_done(channel); | ||
1655 | const struct GNUNET_MULTICAST_MessageHeader * | 1675 | const struct GNUNET_MULTICAST_MessageHeader * |
1656 | msg = (const struct GNUNET_MULTICAST_MessageHeader *) m; | 1676 | msg = (const struct GNUNET_MULTICAST_MessageHeader *) m; |
1657 | uint16_t size = ntohs (m->size); | 1677 | uint16_t size = ntohs (m->size); |
@@ -1697,6 +1717,7 @@ cadet_recv_request (void *cls, | |||
1697 | void **ctx, | 1717 | void **ctx, |
1698 | const struct GNUNET_MessageHeader *m) | 1718 | const struct GNUNET_MessageHeader *m) |
1699 | { | 1719 | { |
1720 | GNUNET_CADET_receive_done(channel); | ||
1700 | const struct GNUNET_MULTICAST_RequestHeader * | 1721 | const struct GNUNET_MULTICAST_RequestHeader * |
1701 | req = (const struct GNUNET_MULTICAST_RequestHeader *) m; | 1722 | req = (const struct GNUNET_MULTICAST_RequestHeader *) m; |
1702 | uint16_t size = ntohs (m->size); | 1723 | uint16_t size = ntohs (m->size); |
@@ -1742,6 +1763,7 @@ cadet_recv_replay_request (void *cls, | |||
1742 | void **ctx, | 1763 | void **ctx, |
1743 | const struct GNUNET_MessageHeader *m) | 1764 | const struct GNUNET_MessageHeader *m) |
1744 | { | 1765 | { |
1766 | GNUNET_CADET_receive_done(channel); | ||
1745 | struct MulticastReplayRequestMessage rep; | 1767 | struct MulticastReplayRequestMessage rep; |
1746 | uint16_t size = ntohs (m->size); | 1768 | uint16_t size = ntohs (m->size); |
1747 | if (size < sizeof (rep)) | 1769 | if (size < sizeof (rep)) |
@@ -1784,6 +1806,7 @@ cadet_recv_replay_response (void *cls, | |||
1784 | void **ctx, | 1806 | void **ctx, |
1785 | const struct GNUNET_MessageHeader *m) | 1807 | const struct GNUNET_MessageHeader *m) |
1786 | { | 1808 | { |
1809 | GNUNET_CADET_receive_done(channel); | ||
1787 | //struct Channel *chn = *ctx; | 1810 | //struct Channel *chn = *ctx; |
1788 | 1811 | ||
1789 | /* @todo FIXME: got replay error response, send request to other members */ | 1812 | /* @todo FIXME: got replay error response, send request to other members */ |
@@ -1882,6 +1905,9 @@ static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = { | |||
1882 | { cadet_recv_join_request, | 1905 | { cadet_recv_join_request, |
1883 | GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST, 0 }, | 1906 | GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_REQUEST, 0 }, |
1884 | 1907 | ||
1908 | { cadet_recv_join_decision, | ||
1909 | GNUNET_MESSAGE_TYPE_MULTICAST_JOIN_DECISION, 0 }, | ||
1910 | |||
1885 | { cadet_recv_message, | 1911 | { cadet_recv_message, |
1886 | GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE, 0 }, | 1912 | GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE, 0 }, |
1887 | 1913 | ||
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c index 7cfe70835..a8b1dee40 100644 --- a/src/multicast/multicast_api.c +++ b/src/multicast/multicast_api.c | |||
@@ -556,7 +556,7 @@ group_disconnect (struct GNUNET_MULTICAST_Group *grp, | |||
556 | if (NULL != last) | 556 | if (NULL != last) |
557 | { | 557 | { |
558 | GNUNET_MQ_notify_sent (last, | 558 | GNUNET_MQ_notify_sent (last, |
559 | (GNUNET_MQ_NotifyCallback) group_cleanup, grp); | 559 | (GNUNET_SCHEDULER_TaskCallback) group_cleanup, grp); |
560 | } | 560 | } |
561 | else | 561 | else |
562 | { | 562 | { |
@@ -786,7 +786,7 @@ origin_connect (struct GNUNET_MULTICAST_Origin *orig) | |||
786 | GNUNET_MQ_handler_end () | 786 | GNUNET_MQ_handler_end () |
787 | }; | 787 | }; |
788 | 788 | ||
789 | grp->mq = GNUNET_CLIENT_connecT (grp->cfg, "multicast", | 789 | grp->mq = GNUNET_CLIENT_connect (grp->cfg, "multicast", |
790 | handlers, origin_disconnected, orig); | 790 | handlers, origin_disconnected, orig); |
791 | GNUNET_assert (NULL != grp->mq); | 791 | GNUNET_assert (NULL != grp->mq); |
792 | GNUNET_MQ_send_copy (grp->mq, grp->connect_env); | 792 | GNUNET_MQ_send_copy (grp->mq, grp->connect_env); |
@@ -1076,7 +1076,7 @@ member_connect (struct GNUNET_MULTICAST_Member *mem) | |||
1076 | GNUNET_MQ_handler_end () | 1076 | GNUNET_MQ_handler_end () |
1077 | }; | 1077 | }; |
1078 | 1078 | ||
1079 | grp->mq = GNUNET_CLIENT_connecT (grp->cfg, "multicast", | 1079 | grp->mq = GNUNET_CLIENT_connect (grp->cfg, "multicast", |
1080 | handlers, member_disconnected, mem); | 1080 | handlers, member_disconnected, mem); |
1081 | GNUNET_assert (NULL != grp->mq); | 1081 | GNUNET_assert (NULL != grp->mq); |
1082 | GNUNET_MQ_send_copy (grp->mq, grp->connect_env); | 1082 | GNUNET_MQ_send_copy (grp->mq, grp->connect_env); |
diff --git a/src/my/.gitignore b/src/my/.gitignore new file mode 100644 index 000000000..3338ba2ea --- /dev/null +++ b/src/my/.gitignore | |||
@@ -0,0 +1 @@ | |||
test_my | |||
diff --git a/src/namecache/.gitignore b/src/namecache/.gitignore index 7f6924c27..6d2d8488a 100644 --- a/src/namecache/.gitignore +++ b/src/namecache/.gitignore | |||
@@ -1,2 +1,6 @@ | |||
1 | gnunet-service-namecache | 1 | gnunet-service-namecache |
2 | gnunet-namecache | 2 | gnunet-namecache |
3 | test_namecache_api_cache_block | ||
4 | test_plugin_namecache_postgres | ||
5 | test_plugin_namecache_sqlite | ||
6 | zonefiles | ||
diff --git a/src/namecache/namecache_api.c b/src/namecache/namecache_api.c index 9ccb91bc8..c12dacd4c 100644 --- a/src/namecache/namecache_api.c +++ b/src/namecache/namecache_api.c | |||
@@ -336,7 +336,7 @@ reconnect (struct GNUNET_NAMECACHE_Handle *h) | |||
336 | GNUNET_MQ_handler_end () | 336 | GNUNET_MQ_handler_end () |
337 | }; | 337 | }; |
338 | GNUNET_assert (NULL == h->mq); | 338 | GNUNET_assert (NULL == h->mq); |
339 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 339 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
340 | "namecache", | 340 | "namecache", |
341 | handlers, | 341 | handlers, |
342 | &mq_error_handler, | 342 | &mq_error_handler, |
diff --git a/src/namestore/.gitignore b/src/namestore/.gitignore index 15482dd69..a1153c6f9 100644 --- a/src/namestore/.gitignore +++ b/src/namestore/.gitignore | |||
@@ -1,3 +1,20 @@ | |||
1 | gnunet-service-namestore | 1 | gnunet-service-namestore |
2 | gnunet-namestore | 2 | gnunet-namestore |
3 | gnunet-namestore-fcfsd | 3 | gnunet-namestore-fcfsd |
4 | test_namestore_api_lookup_nick | ||
5 | test_namestore_api_lookup_private | ||
6 | test_namestore_api_lookup_public | ||
7 | test_namestore_api_lookup_shadow | ||
8 | test_namestore_api_lookup_shadow_filter | ||
9 | test_namestore_api_monitoring | ||
10 | test_namestore_api_monitoring_existing | ||
11 | test_namestore_api_remove | ||
12 | test_namestore_api_remove_not_existing_record | ||
13 | test_namestore_api_store | ||
14 | test_namestore_api_store_update | ||
15 | test_namestore_api_zone_iteration | ||
16 | test_namestore_api_zone_iteration_nick | ||
17 | test_namestore_api_zone_iteration_specific_zone | ||
18 | test_namestore_api_zone_iteration_stop | ||
19 | test_plugin_namestore_postgres | ||
20 | test_plugin_namestore_sqlite | ||
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index fd232de81..933ba7b95 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -806,7 +806,7 @@ reconnect (struct GNUNET_NAMESTORE_Handle *h) | |||
806 | struct GNUNET_NAMESTORE_QueueEntry *qe; | 806 | struct GNUNET_NAMESTORE_QueueEntry *qe; |
807 | 807 | ||
808 | GNUNET_assert (NULL == h->mq); | 808 | GNUNET_assert (NULL == h->mq); |
809 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 809 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
810 | "namestore", | 810 | "namestore", |
811 | handlers, | 811 | handlers, |
812 | &mq_error_handler, | 812 | &mq_error_handler, |
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c index 00f0887d4..cd7c7dadb 100644 --- a/src/namestore/namestore_api_monitor.c +++ b/src/namestore/namestore_api_monitor.c | |||
@@ -262,7 +262,7 @@ reconnect (struct GNUNET_NAMESTORE_ZoneMonitor *zm) | |||
262 | GNUNET_MQ_destroy (zm->mq); | 262 | GNUNET_MQ_destroy (zm->mq); |
263 | zm->error_cb (zm->error_cb_cls); | 263 | zm->error_cb (zm->error_cb_cls); |
264 | } | 264 | } |
265 | zm->mq = GNUNET_CLIENT_connecT (zm->cfg, | 265 | zm->mq = GNUNET_CLIENT_connect (zm->cfg, |
266 | "namestore", | 266 | "namestore", |
267 | handlers, | 267 | handlers, |
268 | &mq_error_handler, | 268 | &mq_error_handler, |
diff --git a/src/nat-auto/.gitignore b/src/nat-auto/.gitignore new file mode 100644 index 000000000..6ba53d72f --- /dev/null +++ b/src/nat-auto/.gitignore | |||
@@ -0,0 +1,3 @@ | |||
1 | gnunet-service-nat-auto | ||
2 | gnunet-nat-auto | ||
3 | gnunet-nat-server | ||
diff --git a/src/nat-auto/Makefile.am b/src/nat-auto/Makefile.am new file mode 100644 index 000000000..19695fabd --- /dev/null +++ b/src/nat-auto/Makefile.am | |||
@@ -0,0 +1,58 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | libexecdir= $(pkglibdir)/libexec/ | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | pkgcfg_DATA = \ | ||
9 | nat-auto.conf | ||
10 | |||
11 | bin_PROGRAMS = \ | ||
12 | gnunet-nat-auto \ | ||
13 | gnunet-nat-server | ||
14 | |||
15 | libexec_PROGRAMS = \ | ||
16 | gnunet-service-nat-auto | ||
17 | |||
18 | gnunet_nat_server_SOURCES = \ | ||
19 | gnunet-nat-server.c nat-auto.h | ||
20 | gnunet_nat_server_LDADD = \ | ||
21 | $(top_builddir)/src/nat/libgnunetnatnew.la \ | ||
22 | $(top_builddir)/src/util/libgnunetutil.la | ||
23 | |||
24 | gnunet_nat_auto_SOURCES = \ | ||
25 | gnunet-nat-auto.c nat-auto.h | ||
26 | gnunet_nat_auto_LDADD = \ | ||
27 | libgnunetnatauto.la \ | ||
28 | $(top_builddir)/src/util/libgnunetutil.la | ||
29 | |||
30 | |||
31 | if USE_COVERAGE | ||
32 | AM_CFLAGS = -fprofile-arcs -ftest-coverage | ||
33 | endif | ||
34 | |||
35 | lib_LTLIBRARIES = \ | ||
36 | libgnunetnatauto.la | ||
37 | |||
38 | libgnunetnatauto_la_SOURCES = \ | ||
39 | nat_auto_api.c \ | ||
40 | nat_auto_api_test.c | ||
41 | libgnunetnatauto_la_LIBADD = \ | ||
42 | $(top_builddir)/src/nat/libgnunetnatnew.la \ | ||
43 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
44 | $(GN_LIBINTL) @EXT_LIBS@ | ||
45 | libgnunetnatauto_la_LDFLAGS = \ | ||
46 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ | ||
47 | -version-info 0:0:0 | ||
48 | |||
49 | gnunet_service_nat_auto_SOURCES = \ | ||
50 | gnunet-service-nat-auto.c | ||
51 | gnunet_service_nat_auto_LDADD = \ | ||
52 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
53 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | ||
54 | $(top_builddir)/src/nat/libgnunetnatnew.la \ | ||
55 | $(LIBGCRYPT_LIBS) \ | ||
56 | -lgcrypt \ | ||
57 | $(GN_LIBINTL) | ||
58 | |||
diff --git a/src/nat-auto/gnunet-nat-auto.c b/src/nat-auto/gnunet-nat-auto.c new file mode 100644 index 000000000..9ba81eb5f --- /dev/null +++ b/src/nat-auto/gnunet-nat-auto.c | |||
@@ -0,0 +1,381 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2015, 2016, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file src/nat/gnunet-nat-auto.c | ||
23 | * @brief Command-line tool for testing and autoconfiguration of NAT traversal | ||
24 | * @author Christian Grothoff | ||
25 | * @author Bruno Cabral | ||
26 | */ | ||
27 | #include "platform.h" | ||
28 | #include "gnunet_util_lib.h" | ||
29 | #include "gnunet_nat_service.h" | ||
30 | #include "gnunet_nat_auto_service.h" | ||
31 | |||
32 | /** | ||
33 | * Value to return from #main(). | ||
34 | */ | ||
35 | static int global_ret; | ||
36 | |||
37 | /** | ||
38 | * Handle to ongoing autoconfiguration. | ||
39 | */ | ||
40 | static struct GNUNET_NAT_AUTO_AutoHandle *ah; | ||
41 | |||
42 | /** | ||
43 | * If we do auto-configuration, should we write the result | ||
44 | * to a file? | ||
45 | */ | ||
46 | static int write_cfg; | ||
47 | |||
48 | /** | ||
49 | * Configuration filename. | ||
50 | */ | ||
51 | static const char *cfg_file; | ||
52 | |||
53 | /** | ||
54 | * Original configuration. | ||
55 | */ | ||
56 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
57 | |||
58 | /** | ||
59 | * Adapter we are supposed to test. | ||
60 | */ | ||
61 | static char *section_name; | ||
62 | |||
63 | /** | ||
64 | * Should we run autoconfiguration? | ||
65 | */ | ||
66 | static unsigned int do_auto; | ||
67 | |||
68 | /** | ||
69 | * Handle to a NAT test operation. | ||
70 | */ | ||
71 | static struct GNUNET_NAT_AUTO_Test *nt; | ||
72 | |||
73 | /** | ||
74 | * Flag set to 1 if we use IPPROTO_UDP. | ||
75 | */ | ||
76 | static int use_udp; | ||
77 | |||
78 | /** | ||
79 | * Flag set to 1 if we use IPPROTO_TCP. | ||
80 | */ | ||
81 | static int use_tcp; | ||
82 | |||
83 | /** | ||
84 | * Protocol to use. | ||
85 | */ | ||
86 | static uint8_t proto; | ||
87 | |||
88 | /** | ||
89 | * Test if all activities have finished, and if so, | ||
90 | * terminate. | ||
91 | */ | ||
92 | static void | ||
93 | test_finished () | ||
94 | { | ||
95 | if (NULL != ah) | ||
96 | return; | ||
97 | if (NULL != nt) | ||
98 | return; | ||
99 | GNUNET_SCHEDULER_shutdown (); | ||
100 | } | ||
101 | |||
102 | |||
103 | /** | ||
104 | * Function to iterate over sugested changes options | ||
105 | * | ||
106 | * @param cls closure | ||
107 | * @param section name of the section | ||
108 | * @param option name of the option | ||
109 | * @param value value of the option | ||
110 | */ | ||
111 | static void | ||
112 | auto_conf_iter (void *cls, | ||
113 | const char *section, | ||
114 | const char *option, | ||
115 | const char *value) | ||
116 | { | ||
117 | struct GNUNET_CONFIGURATION_Handle *new_cfg = cls; | ||
118 | |||
119 | PRINTF ("%s: %s\n", | ||
120 | option, | ||
121 | value); | ||
122 | if (NULL != new_cfg) | ||
123 | GNUNET_CONFIGURATION_set_value_string (new_cfg, | ||
124 | section, | ||
125 | option, | ||
126 | value); | ||
127 | } | ||
128 | |||
129 | |||
130 | /** | ||
131 | * Function called with the result from the autoconfiguration. | ||
132 | * | ||
133 | * @param cls closure | ||
134 | * @param diff minimal suggested changes to the original configuration | ||
135 | * to make it work (as best as we can) | ||
136 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
137 | * @param type what the situation of the NAT | ||
138 | */ | ||
139 | static void | ||
140 | auto_config_cb (void *cls, | ||
141 | const struct GNUNET_CONFIGURATION_Handle *diff, | ||
142 | enum GNUNET_NAT_StatusCode result, | ||
143 | enum GNUNET_NAT_Type type) | ||
144 | { | ||
145 | const char *nat_type; | ||
146 | char unknown_type[64]; | ||
147 | struct GNUNET_CONFIGURATION_Handle *new_cfg; | ||
148 | |||
149 | ah = NULL; | ||
150 | switch (type) | ||
151 | { | ||
152 | case GNUNET_NAT_TYPE_NO_NAT: | ||
153 | nat_type = "NO NAT"; | ||
154 | break; | ||
155 | case GNUNET_NAT_TYPE_UNREACHABLE_NAT: | ||
156 | nat_type = "NAT but we can traverse"; | ||
157 | break; | ||
158 | case GNUNET_NAT_TYPE_STUN_PUNCHED_NAT: | ||
159 | nat_type = "NAT but STUN is able to identify the correct information"; | ||
160 | break; | ||
161 | case GNUNET_NAT_TYPE_UPNP_NAT: | ||
162 | nat_type = "NAT but UPNP opened the ports"; | ||
163 | break; | ||
164 | default: | ||
165 | SPRINTF (unknown_type, | ||
166 | "NAT unknown, type %u", | ||
167 | type); | ||
168 | nat_type = unknown_type; | ||
169 | break; | ||
170 | } | ||
171 | |||
172 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
173 | "NAT status: %s/%s\n", | ||
174 | GNUNET_NAT_AUTO_status2string (result), | ||
175 | nat_type); | ||
176 | |||
177 | /* Shortcut: if there are no changes suggested, bail out early. */ | ||
178 | if (GNUNET_NO == | ||
179 | GNUNET_CONFIGURATION_is_dirty (diff)) | ||
180 | { | ||
181 | test_finished (); | ||
182 | return; | ||
183 | } | ||
184 | |||
185 | /* Apply diff to original configuration and show changes | ||
186 | to the user */ | ||
187 | new_cfg = write_cfg ? GNUNET_CONFIGURATION_dup (cfg) : NULL; | ||
188 | |||
189 | if (NULL != diff) | ||
190 | { | ||
191 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
192 | _("Suggested configuration changes:\n")); | ||
193 | GNUNET_CONFIGURATION_iterate_section_values (diff, | ||
194 | "nat", | ||
195 | &auto_conf_iter, | ||
196 | new_cfg); | ||
197 | } | ||
198 | |||
199 | /* If desired, write configuration to file; we write only the | ||
200 | changes to the defaults to keep things compact. */ | ||
201 | if ( (write_cfg) && | ||
202 | (NULL != diff) ) | ||
203 | { | ||
204 | struct GNUNET_CONFIGURATION_Handle *def_cfg; | ||
205 | |||
206 | GNUNET_CONFIGURATION_set_value_string (new_cfg, | ||
207 | "ARM", | ||
208 | "CONFIG", | ||
209 | NULL); | ||
210 | def_cfg = GNUNET_CONFIGURATION_create (); | ||
211 | GNUNET_break (GNUNET_OK == | ||
212 | GNUNET_CONFIGURATION_load (def_cfg, | ||
213 | NULL)); | ||
214 | if (GNUNET_OK != | ||
215 | GNUNET_CONFIGURATION_write_diffs (def_cfg, | ||
216 | new_cfg, | ||
217 | cfg_file)) | ||
218 | { | ||
219 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
220 | _("Failed to write configuration to `%s'\n"), | ||
221 | cfg_file); | ||
222 | global_ret = 1; | ||
223 | } | ||
224 | else | ||
225 | { | ||
226 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
227 | _("Wrote updated configuration to `%s'\n"), | ||
228 | cfg_file); | ||
229 | } | ||
230 | GNUNET_CONFIGURATION_destroy (def_cfg); | ||
231 | } | ||
232 | |||
233 | if (NULL != new_cfg) | ||
234 | GNUNET_CONFIGURATION_destroy (new_cfg); | ||
235 | test_finished (); | ||
236 | } | ||
237 | |||
238 | |||
239 | /** | ||
240 | * Function called to report success or failure for | ||
241 | * NAT configuration test. | ||
242 | * | ||
243 | * @param cls closure | ||
244 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
245 | */ | ||
246 | static void | ||
247 | test_report_cb (void *cls, | ||
248 | enum GNUNET_NAT_StatusCode result) | ||
249 | { | ||
250 | nt = NULL; | ||
251 | PRINTF ("NAT test result: %s\n", | ||
252 | GNUNET_NAT_AUTO_status2string (result)); | ||
253 | test_finished (); | ||
254 | } | ||
255 | |||
256 | |||
257 | /** | ||
258 | * Task run on shutdown. | ||
259 | * | ||
260 | * @param cls NULL | ||
261 | */ | ||
262 | static void | ||
263 | do_shutdown (void *cls) | ||
264 | { | ||
265 | if (NULL != ah) | ||
266 | { | ||
267 | GNUNET_NAT_AUTO_autoconfig_cancel (ah); | ||
268 | ah = NULL; | ||
269 | } | ||
270 | if (NULL != nt) | ||
271 | { | ||
272 | GNUNET_NAT_AUTO_test_stop (nt); | ||
273 | nt = NULL; | ||
274 | } | ||
275 | } | ||
276 | |||
277 | |||
278 | /** | ||
279 | * Main function that will be run. | ||
280 | * | ||
281 | * @param cls closure | ||
282 | * @param args remaining command-line arguments | ||
283 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
284 | * @param c configuration | ||
285 | */ | ||
286 | static void | ||
287 | run (void *cls, | ||
288 | char *const *args, | ||
289 | const char *cfgfile, | ||
290 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
291 | { | ||
292 | cfg_file = cfgfile; | ||
293 | cfg = c; | ||
294 | |||
295 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | ||
296 | NULL); | ||
297 | |||
298 | if (do_auto) | ||
299 | { | ||
300 | ah = GNUNET_NAT_AUTO_autoconfig_start (c, | ||
301 | &auto_config_cb, | ||
302 | NULL); | ||
303 | } | ||
304 | |||
305 | if (use_tcp && use_udp) | ||
306 | { | ||
307 | if (do_auto) | ||
308 | return; | ||
309 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
310 | "Cannot use TCP and UDP\n"); | ||
311 | global_ret = 1; | ||
312 | return; | ||
313 | } | ||
314 | proto = 0; | ||
315 | if (use_tcp) | ||
316 | proto = IPPROTO_TCP; | ||
317 | if (use_udp) | ||
318 | proto = IPPROTO_UDP; | ||
319 | |||
320 | if (NULL != section_name) | ||
321 | { | ||
322 | nt = GNUNET_NAT_AUTO_test_start (c, | ||
323 | proto, | ||
324 | section_name, | ||
325 | &test_report_cb, | ||
326 | NULL); | ||
327 | } | ||
328 | test_finished (); | ||
329 | } | ||
330 | |||
331 | |||
332 | /** | ||
333 | * Main function of gnunet-nat-auto | ||
334 | * | ||
335 | * @param argc number of command-line arguments | ||
336 | * @param argv command line | ||
337 | * @return 0 on success, -1 on error | ||
338 | */ | ||
339 | int | ||
340 | main (int argc, | ||
341 | char *const argv[]) | ||
342 | { | ||
343 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
344 | {'a', "auto", NULL, | ||
345 | gettext_noop ("run autoconfiguration"), | ||
346 | GNUNET_NO, &GNUNET_GETOPT_set_one, &do_auto }, | ||
347 | {'S', "section", "NAME", | ||
348 | gettext_noop ("section name providing the configuration for the adapter"), | ||
349 | GNUNET_YES, &GNUNET_GETOPT_set_string, §ion_name }, | ||
350 | {'t', "tcp", NULL, | ||
351 | gettext_noop ("use TCP"), | ||
352 | GNUNET_NO, &GNUNET_GETOPT_set_one, &use_tcp }, | ||
353 | {'u', "udp", NULL, | ||
354 | gettext_noop ("use UDP"), | ||
355 | GNUNET_NO, &GNUNET_GETOPT_set_one, &use_udp }, | ||
356 | {'w', "write", NULL, | ||
357 | gettext_noop ("write configuration file (for autoconfiguration)"), | ||
358 | GNUNET_NO, &GNUNET_GETOPT_set_one, &write_cfg }, | ||
359 | GNUNET_GETOPT_OPTION_END | ||
360 | }; | ||
361 | |||
362 | if (GNUNET_OK != | ||
363 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
364 | &argc, &argv)) | ||
365 | return 2; | ||
366 | if (GNUNET_OK != | ||
367 | GNUNET_PROGRAM_run (argc, argv, | ||
368 | "gnunet-nat-auto [options]", | ||
369 | _("GNUnet NAT traversal autoconfiguration"), | ||
370 | options, | ||
371 | &run, | ||
372 | NULL)) | ||
373 | { | ||
374 | global_ret = 1; | ||
375 | } | ||
376 | GNUNET_free ((void*) argv); | ||
377 | return global_ret; | ||
378 | } | ||
379 | |||
380 | |||
381 | /* end of gnunet-nat-auto.c */ | ||
diff --git a/src/nat/nat_test.c b/src/nat-auto/gnunet-nat-auto_legacy.c index 803ff23e3..32f40c037 100644 --- a/src/nat/nat_test.c +++ b/src/nat-auto/gnunet-nat-auto_legacy.c | |||
@@ -391,7 +391,7 @@ addr_cb (void *cls, | |||
391 | 391 | ||
392 | ca = GNUNET_new (struct ClientActivity); | 392 | ca = GNUNET_new (struct ClientActivity); |
393 | ca->h = h; | 393 | ca->h = h; |
394 | ca->mq = GNUNET_CLIENT_connecT (h->cfg, | 394 | ca->mq = GNUNET_CLIENT_connect (h->cfg, |
395 | "gnunet-nat-server", | 395 | "gnunet-nat-server", |
396 | NULL, | 396 | NULL, |
397 | &mq_error_handler, | 397 | &mq_error_handler, |
diff --git a/src/nat/gnunet-nat-server.c b/src/nat-auto/gnunet-nat-server.c index 1692a8ef1..dd08f8d36 100644 --- a/src/nat/gnunet-nat-server.c +++ b/src/nat-auto/gnunet-nat-server.c | |||
@@ -25,9 +25,9 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_nat_lib.h" | 28 | #include "gnunet_nat_service.h" |
29 | #include "gnunet_protocols.h" | 29 | #include "gnunet_protocols.h" |
30 | #include "nat.h" | 30 | #include "nat-auto.h" |
31 | 31 | ||
32 | 32 | ||
33 | /** | 33 | /** |
@@ -54,24 +54,39 @@ try_anat (uint32_t dst_ipv4, | |||
54 | int is_tcp) | 54 | int is_tcp) |
55 | { | 55 | { |
56 | struct GNUNET_NAT_Handle *h; | 56 | struct GNUNET_NAT_Handle *h; |
57 | struct sockaddr_in sa; | 57 | struct sockaddr_in lsa; |
58 | struct sockaddr_in rsa; | ||
59 | socklen_t sa_len; | ||
58 | 60 | ||
59 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 61 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
60 | "Asking for connection reversal with %x and code %u\n", | 62 | "Asking for connection reversal with %x and code %u\n", |
61 | (unsigned int) dst_ipv4, | 63 | (unsigned int) dst_ipv4, |
62 | (unsigned int) dport); | 64 | (unsigned int) dport); |
63 | h = GNUNET_NAT_register (cfg, | 65 | memset (&lsa, 0, sizeof (lsa)); |
64 | is_tcp, | 66 | lsa.sin_family = AF_INET; |
65 | dport, | ||
66 | 0, | ||
67 | NULL, NULL, NULL, NULL, NULL, NULL); | ||
68 | memset (&sa, 0, sizeof (sa)); | ||
69 | sa.sin_family = AF_INET; | ||
70 | #if HAVE_SOCKADDR_IN_SIN_LEN | 67 | #if HAVE_SOCKADDR_IN_SIN_LEN |
71 | sa.sin_len = sizeof (sa); | 68 | lsa.sin_len = sizeof (sa); |
72 | #endif | 69 | #endif |
73 | sa.sin_addr.s_addr = dst_ipv4; | 70 | lsa.sin_addr.s_addr = 0; |
74 | GNUNET_NAT_run_client (h, &sa); | 71 | lsa.sin_port = htons (dport); |
72 | memset (&rsa, 0, sizeof (rsa)); | ||
73 | rsa.sin_family = AF_INET; | ||
74 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
75 | rsa.sin_len = sizeof (sa); | ||
76 | #endif | ||
77 | rsa.sin_addr.s_addr = dst_ipv4; | ||
78 | rsa.sin_port = htons (dport); | ||
79 | sa_len = sizeof (lsa); | ||
80 | h = GNUNET_NAT_register (cfg, | ||
81 | "none", | ||
82 | is_tcp ? IPPROTO_TCP : IPPROTO_UDP, | ||
83 | 1, | ||
84 | (const struct sockaddr **) &lsa, | ||
85 | &sa_len, | ||
86 | NULL, NULL, NULL); | ||
87 | GNUNET_NAT_request_reversal (h, | ||
88 | &lsa, | ||
89 | &rsa); | ||
75 | GNUNET_NAT_unregister (h); | 90 | GNUNET_NAT_unregister (h); |
76 | } | 91 | } |
77 | 92 | ||
@@ -240,12 +255,12 @@ test (void *cls, | |||
240 | struct GNUNET_SERVER_Client *client, | 255 | struct GNUNET_SERVER_Client *client, |
241 | const struct GNUNET_MessageHeader *msg) | 256 | const struct GNUNET_MessageHeader *msg) |
242 | { | 257 | { |
243 | const struct GNUNET_NAT_TestMessage *tm; | 258 | const struct GNUNET_NAT_AUTO_TestMessage *tm; |
244 | uint16_t dport; | 259 | uint16_t dport; |
245 | 260 | ||
246 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 261 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
247 | "Received test request\n"); | 262 | "Received test request\n"); |
248 | tm = (const struct GNUNET_NAT_TestMessage *) msg; | 263 | tm = (const struct GNUNET_NAT_AUTO_TestMessage *) msg; |
249 | dport = ntohs (tm->dport); | 264 | dport = ntohs (tm->dport); |
250 | if (0 == dport) | 265 | if (0 == dport) |
251 | try_anat (tm->dst_ipv4, | 266 | try_anat (tm->dst_ipv4, |
@@ -293,7 +308,7 @@ run (void *cls, | |||
293 | { | 308 | { |
294 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { | 309 | static const struct GNUNET_SERVER_MessageHandler handlers[] = { |
295 | {&test, NULL, GNUNET_MESSAGE_TYPE_NAT_TEST, | 310 | {&test, NULL, GNUNET_MESSAGE_TYPE_NAT_TEST, |
296 | sizeof (struct GNUNET_NAT_TestMessage)}, | 311 | sizeof (struct GNUNET_NAT_AUTO_TestMessage)}, |
297 | {NULL, NULL, 0, 0} | 312 | {NULL, NULL, 0, 0} |
298 | }; | 313 | }; |
299 | unsigned int port; | 314 | unsigned int port; |
diff --git a/src/nat-auto/gnunet-service-nat-auto.c b/src/nat-auto/gnunet-service-nat-auto.c new file mode 100644 index 000000000..ae570c351 --- /dev/null +++ b/src/nat-auto/gnunet-service-nat-auto.c | |||
@@ -0,0 +1,482 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2016, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file nat-auto/gnunet-service-nat-auto.c | ||
23 | * @brief NAT autoconfiguration service | ||
24 | * @author Christian Grothoff | ||
25 | * | ||
26 | * TODO: | ||
27 | * - merge client handle and autoconfig context | ||
28 | * - implement "more" autoconfig: | ||
29 | * + re-work gnunet-nat-server & integrate! | ||
30 | * + integrate "legacy" code | ||
31 | * + test manually punched NAT (how?) | ||
32 | */ | ||
33 | #include "platform.h" | ||
34 | #include <math.h> | ||
35 | #include "gnunet_util_lib.h" | ||
36 | #include "gnunet_protocols.h" | ||
37 | #include "gnunet_signatures.h" | ||
38 | #include "gnunet_nat_service.h" | ||
39 | #include "gnunet_statistics_service.h" | ||
40 | #include "gnunet_resolver_service.h" | ||
41 | #include "nat-auto.h" | ||
42 | #include <gcrypt.h> | ||
43 | |||
44 | |||
45 | /** | ||
46 | * How long do we wait until we forcefully terminate autoconfiguration? | ||
47 | */ | ||
48 | #define AUTOCONFIG_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | ||
49 | |||
50 | |||
51 | /** | ||
52 | * Internal data structure we track for each of our clients. | ||
53 | */ | ||
54 | struct ClientHandle | ||
55 | { | ||
56 | |||
57 | /** | ||
58 | * Kept in a DLL. | ||
59 | */ | ||
60 | struct ClientHandle *next; | ||
61 | |||
62 | /** | ||
63 | * Kept in a DLL. | ||
64 | */ | ||
65 | struct ClientHandle *prev; | ||
66 | |||
67 | /** | ||
68 | * Underlying handle for this client with the service. | ||
69 | */ | ||
70 | struct GNUNET_SERVICE_Client *client; | ||
71 | |||
72 | /** | ||
73 | * Message queue for communicating with the client. | ||
74 | */ | ||
75 | struct GNUNET_MQ_Handle *mq; | ||
76 | }; | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Context for autoconfiguration operations. | ||
81 | */ | ||
82 | struct AutoconfigContext | ||
83 | { | ||
84 | /** | ||
85 | * Kept in a DLL. | ||
86 | */ | ||
87 | struct AutoconfigContext *prev; | ||
88 | |||
89 | /** | ||
90 | * Kept in a DLL. | ||
91 | */ | ||
92 | struct AutoconfigContext *next; | ||
93 | |||
94 | /** | ||
95 | * Which client asked the question. | ||
96 | */ | ||
97 | struct ClientHandle *ch; | ||
98 | |||
99 | /** | ||
100 | * Configuration we are creating. | ||
101 | */ | ||
102 | struct GNUNET_CONFIGURATION_Handle *c; | ||
103 | |||
104 | /** | ||
105 | * Original configuration (for diffing). | ||
106 | */ | ||
107 | struct GNUNET_CONFIGURATION_Handle *orig; | ||
108 | |||
109 | /** | ||
110 | * Timeout task to force termination. | ||
111 | */ | ||
112 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
113 | |||
114 | /** | ||
115 | * #GNUNET_YES if upnpc should be used, | ||
116 | * #GNUNET_NO if upnpc should not be used, | ||
117 | * #GNUNET_SYSERR if we should simply not change the option. | ||
118 | */ | ||
119 | int enable_upnpc; | ||
120 | |||
121 | /** | ||
122 | * Status code to return to the client. | ||
123 | */ | ||
124 | enum GNUNET_NAT_StatusCode status_code; | ||
125 | |||
126 | /** | ||
127 | * NAT type to return to the client. | ||
128 | */ | ||
129 | enum GNUNET_NAT_Type type; | ||
130 | }; | ||
131 | |||
132 | |||
133 | /** | ||
134 | * Head of client DLL. | ||
135 | */ | ||
136 | static struct ClientHandle *ch_head; | ||
137 | |||
138 | /** | ||
139 | * Tail of client DLL. | ||
140 | */ | ||
141 | static struct ClientHandle *ch_tail; | ||
142 | |||
143 | /** | ||
144 | * DLL of our autoconfiguration operations. | ||
145 | */ | ||
146 | static struct AutoconfigContext *ac_head; | ||
147 | |||
148 | /** | ||
149 | * DLL of our autoconfiguration operations. | ||
150 | */ | ||
151 | static struct AutoconfigContext *ac_tail; | ||
152 | |||
153 | /** | ||
154 | * Handle to our current configuration. | ||
155 | */ | ||
156 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
157 | |||
158 | /** | ||
159 | * Handle to the statistics service. | ||
160 | */ | ||
161 | static struct GNUNET_STATISTICS_Handle *stats; | ||
162 | |||
163 | |||
164 | /** | ||
165 | * Check validity of #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG message | ||
166 | * from client. | ||
167 | * | ||
168 | * @param cls client who sent the message | ||
169 | * @param message the message received | ||
170 | * @return #GNUNET_OK if message is well-formed | ||
171 | */ | ||
172 | static int | ||
173 | check_autoconfig_request (void *cls, | ||
174 | const struct GNUNET_NAT_AUTO_AutoconfigRequestMessage *message) | ||
175 | { | ||
176 | return GNUNET_OK; /* checked later */ | ||
177 | } | ||
178 | |||
179 | |||
180 | /** | ||
181 | * Stop all pending activities with respect to the @a ac | ||
182 | * | ||
183 | * @param ac autoconfiguration to terminate activities for | ||
184 | */ | ||
185 | static void | ||
186 | terminate_ac_activities (struct AutoconfigContext *ac) | ||
187 | { | ||
188 | if (NULL != ac->timeout_task) | ||
189 | { | ||
190 | GNUNET_SCHEDULER_cancel (ac->timeout_task); | ||
191 | ac->timeout_task = NULL; | ||
192 | } | ||
193 | } | ||
194 | |||
195 | |||
196 | /** | ||
197 | * Finish handling the autoconfiguration request and send | ||
198 | * the response to the client. | ||
199 | * | ||
200 | * @param cls the `struct AutoconfigContext` to conclude | ||
201 | */ | ||
202 | static void | ||
203 | conclude_autoconfig_request (void *cls) | ||
204 | { | ||
205 | struct AutoconfigContext *ac = cls; | ||
206 | struct ClientHandle *ch = ac->ch; | ||
207 | struct GNUNET_NAT_AUTO_AutoconfigResultMessage *arm; | ||
208 | struct GNUNET_MQ_Envelope *env; | ||
209 | size_t c_size; | ||
210 | char *buf; | ||
211 | struct GNUNET_CONFIGURATION_Handle *diff; | ||
212 | |||
213 | ac->timeout_task = NULL; | ||
214 | terminate_ac_activities (ac); | ||
215 | |||
216 | /* Send back response */ | ||
217 | diff = GNUNET_CONFIGURATION_get_diff (ac->orig, | ||
218 | ac->c); | ||
219 | buf = GNUNET_CONFIGURATION_serialize (diff, | ||
220 | &c_size); | ||
221 | GNUNET_CONFIGURATION_destroy (diff); | ||
222 | env = GNUNET_MQ_msg_extra (arm, | ||
223 | c_size, | ||
224 | GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT); | ||
225 | arm->status_code = htonl ((uint32_t) ac->status_code); | ||
226 | arm->type = htonl ((uint32_t) ac->type); | ||
227 | GNUNET_memcpy (&arm[1], | ||
228 | buf, | ||
229 | c_size); | ||
230 | GNUNET_free (buf); | ||
231 | GNUNET_MQ_send (ch->mq, | ||
232 | env); | ||
233 | |||
234 | /* clean up */ | ||
235 | GNUNET_CONFIGURATION_destroy (ac->orig); | ||
236 | GNUNET_CONFIGURATION_destroy (ac->c); | ||
237 | GNUNET_CONTAINER_DLL_remove (ac_head, | ||
238 | ac_tail, | ||
239 | ac); | ||
240 | GNUNET_free (ac); | ||
241 | GNUNET_SERVICE_client_continue (ch->client); | ||
242 | } | ||
243 | |||
244 | |||
245 | /** | ||
246 | * Check if all autoconfiguration operations have concluded, | ||
247 | * and if they have, send the result back to the client. | ||
248 | * | ||
249 | * @param ac autoconfiguation context to check | ||
250 | */ | ||
251 | static void | ||
252 | check_autoconfig_finished (struct AutoconfigContext *ac) | ||
253 | { | ||
254 | GNUNET_SCHEDULER_cancel (ac->timeout_task); | ||
255 | ac->timeout_task | ||
256 | = GNUNET_SCHEDULER_add_now (&conclude_autoconfig_request, | ||
257 | ac); | ||
258 | } | ||
259 | |||
260 | |||
261 | /** | ||
262 | * Update ENABLE_UPNPC configuration option. | ||
263 | * | ||
264 | * @param ac autoconfiguration to update | ||
265 | */ | ||
266 | static void | ||
267 | update_enable_upnpc_option (struct AutoconfigContext *ac) | ||
268 | { | ||
269 | switch (ac->enable_upnpc) | ||
270 | { | ||
271 | case GNUNET_YES: | ||
272 | GNUNET_CONFIGURATION_set_value_string (ac->c, | ||
273 | "NAT", | ||
274 | "ENABLE_UPNP", | ||
275 | "YES"); | ||
276 | break; | ||
277 | case GNUNET_NO: | ||
278 | GNUNET_CONFIGURATION_set_value_string (ac->c, | ||
279 | "NAT", | ||
280 | "ENABLE_UPNP", | ||
281 | "NO"); | ||
282 | break; | ||
283 | case GNUNET_SYSERR: | ||
284 | /* We are unsure, do not change option */ | ||
285 | break; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | |||
290 | /** | ||
291 | * Handler for #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG message from | ||
292 | * client. | ||
293 | * | ||
294 | * @param cls client who sent the message | ||
295 | * @param message the message received | ||
296 | */ | ||
297 | static void | ||
298 | handle_autoconfig_request (void *cls, | ||
299 | const struct GNUNET_NAT_AUTO_AutoconfigRequestMessage *message) | ||
300 | { | ||
301 | struct ClientHandle *ch = cls; | ||
302 | size_t left = ntohs (message->header.size) - sizeof (*message); | ||
303 | struct AutoconfigContext *ac; | ||
304 | |||
305 | ac = GNUNET_new (struct AutoconfigContext); | ||
306 | ac->status_code = GNUNET_NAT_ERROR_SUCCESS; | ||
307 | ac->ch = ch; | ||
308 | ac->c = GNUNET_CONFIGURATION_create (); | ||
309 | if (GNUNET_OK != | ||
310 | GNUNET_CONFIGURATION_deserialize (ac->c, | ||
311 | (const char *) &message[1], | ||
312 | left, | ||
313 | GNUNET_NO)) | ||
314 | { | ||
315 | GNUNET_break (0); | ||
316 | GNUNET_SERVICE_client_drop (ch->client); | ||
317 | GNUNET_CONFIGURATION_destroy (ac->c); | ||
318 | GNUNET_free (ac); | ||
319 | return; | ||
320 | } | ||
321 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
322 | "Received REQUEST_AUTO_CONFIG message from client\n"); | ||
323 | |||
324 | GNUNET_CONTAINER_DLL_insert (ac_head, | ||
325 | ac_tail, | ||
326 | ac); | ||
327 | ac->orig | ||
328 | = GNUNET_CONFIGURATION_dup (ac->c); | ||
329 | ac->timeout_task | ||
330 | = GNUNET_SCHEDULER_add_delayed (AUTOCONFIG_TIMEOUT, | ||
331 | &conclude_autoconfig_request, | ||
332 | ac); | ||
333 | ac->enable_upnpc = GNUNET_SYSERR; /* undecided */ | ||
334 | |||
335 | /* Probe for upnpc */ | ||
336 | if (GNUNET_SYSERR == | ||
337 | GNUNET_OS_check_helper_binary ("upnpc", | ||
338 | GNUNET_NO, | ||
339 | NULL)) | ||
340 | { | ||
341 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
342 | _("UPnP client `upnpc` command not found, disabling UPnP\n")); | ||
343 | ac->enable_upnpc = GNUNET_NO; | ||
344 | } | ||
345 | else | ||
346 | { | ||
347 | /* We might at some point be behind NAT, try upnpc */ | ||
348 | ac->enable_upnpc = GNUNET_YES; | ||
349 | } | ||
350 | update_enable_upnpc_option (ac); | ||
351 | |||
352 | /* Finally, check if we are already done */ | ||
353 | check_autoconfig_finished (ac); | ||
354 | } | ||
355 | |||
356 | |||
357 | /** | ||
358 | * Task run during shutdown. | ||
359 | * | ||
360 | * @param cls unused | ||
361 | */ | ||
362 | static void | ||
363 | shutdown_task (void *cls) | ||
364 | { | ||
365 | struct AutoconfigContext *ac; | ||
366 | |||
367 | while (NULL != (ac = ac_head)) | ||
368 | { | ||
369 | GNUNET_CONTAINER_DLL_remove (ac_head, | ||
370 | ac_tail, | ||
371 | ac); | ||
372 | terminate_ac_activities (ac); | ||
373 | GNUNET_free (ac); | ||
374 | } | ||
375 | if (NULL != stats) | ||
376 | { | ||
377 | GNUNET_STATISTICS_destroy (stats, | ||
378 | GNUNET_NO); | ||
379 | stats = NULL; | ||
380 | } | ||
381 | } | ||
382 | |||
383 | |||
384 | /** | ||
385 | * Setup NAT service. | ||
386 | * | ||
387 | * @param cls closure | ||
388 | * @param c configuration to use | ||
389 | * @param service the initialized service | ||
390 | */ | ||
391 | static void | ||
392 | run (void *cls, | ||
393 | const struct GNUNET_CONFIGURATION_Handle *c, | ||
394 | struct GNUNET_SERVICE_Handle *service) | ||
395 | { | ||
396 | cfg = c; | ||
397 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | ||
398 | NULL); | ||
399 | stats = GNUNET_STATISTICS_create ("nat-auto", | ||
400 | cfg); | ||
401 | } | ||
402 | |||
403 | |||
404 | /** | ||
405 | * Callback called when a client connects to the service. | ||
406 | * | ||
407 | * @param cls closure for the service | ||
408 | * @param c the new client that connected to the service | ||
409 | * @param mq the message queue used to send messages to the client | ||
410 | * @return a `struct ClientHandle` | ||
411 | */ | ||
412 | static void * | ||
413 | client_connect_cb (void *cls, | ||
414 | struct GNUNET_SERVICE_Client *c, | ||
415 | struct GNUNET_MQ_Handle *mq) | ||
416 | { | ||
417 | struct ClientHandle *ch; | ||
418 | |||
419 | ch = GNUNET_new (struct ClientHandle); | ||
420 | ch->mq = mq; | ||
421 | ch->client = c; | ||
422 | GNUNET_CONTAINER_DLL_insert (ch_head, | ||
423 | ch_tail, | ||
424 | ch); | ||
425 | return ch; | ||
426 | } | ||
427 | |||
428 | |||
429 | /** | ||
430 | * Callback called when a client disconnected from the service | ||
431 | * | ||
432 | * @param cls closure for the service | ||
433 | * @param c the client that disconnected | ||
434 | * @param internal_cls a `struct ClientHandle *` | ||
435 | */ | ||
436 | static void | ||
437 | client_disconnect_cb (void *cls, | ||
438 | struct GNUNET_SERVICE_Client *c, | ||
439 | void *internal_cls) | ||
440 | { | ||
441 | struct ClientHandle *ch = internal_cls; | ||
442 | |||
443 | GNUNET_CONTAINER_DLL_remove (ch_head, | ||
444 | ch_tail, | ||
445 | ch); | ||
446 | GNUNET_free (ch); | ||
447 | } | ||
448 | |||
449 | |||
450 | /** | ||
451 | * Define "main" method using service macro. | ||
452 | */ | ||
453 | GNUNET_SERVICE_MAIN | ||
454 | ("nat-auto", | ||
455 | GNUNET_SERVICE_OPTION_NONE, | ||
456 | &run, | ||
457 | &client_connect_cb, | ||
458 | &client_disconnect_cb, | ||
459 | NULL, | ||
460 | GNUNET_MQ_hd_var_size (autoconfig_request, | ||
461 | GNUNET_MESSAGE_TYPE_NAT_AUTO_REQUEST_CFG, | ||
462 | struct GNUNET_NAT_AUTO_AutoconfigRequestMessage, | ||
463 | NULL), | ||
464 | GNUNET_MQ_handler_end ()); | ||
465 | |||
466 | |||
467 | #if defined(LINUX) && defined(__GLIBC__) | ||
468 | #include <malloc.h> | ||
469 | |||
470 | /** | ||
471 | * MINIMIZE heap size (way below 128k) since this process doesn't need much. | ||
472 | */ | ||
473 | void __attribute__ ((constructor)) | ||
474 | GNUNET_ARM_memory_init () | ||
475 | { | ||
476 | mallopt (M_TRIM_THRESHOLD, 4 * 1024); | ||
477 | mallopt (M_TOP_PAD, 1 * 1024); | ||
478 | malloc_trim (0); | ||
479 | } | ||
480 | #endif | ||
481 | |||
482 | /* end of gnunet-service-nat.c */ | ||
diff --git a/src/nat/nat_auto.c b/src/nat-auto/gnunet-service-nat-auto_legacy.c index 061d0cbe6..bcfa4b92b 100644 --- a/src/nat/nat_auto.c +++ b/src/nat-auto/gnunet-service-nat-auto_legacy.c | |||
@@ -670,7 +670,7 @@ test_nat_punched (struct GNUNET_NAT_AutoHandle *ah) | |||
670 | LOG (GNUNET_ERROR_TYPE_INFO, | 670 | LOG (GNUNET_ERROR_TYPE_INFO, |
671 | "Asking gnunet-nat-server to connect to `%s'\n", | 671 | "Asking gnunet-nat-server to connect to `%s'\n", |
672 | ah->stun_ip); | 672 | ah->stun_ip); |
673 | ah->mq = GNUNET_CLIENT_connecT (ah->cfg, | 673 | ah->mq = GNUNET_CLIENT_connect (ah->cfg, |
674 | "gnunet-nat-server", | 674 | "gnunet-nat-server", |
675 | NULL, | 675 | NULL, |
676 | &mq_error_handler, | 676 | &mq_error_handler, |
diff --git a/src/nat-auto/nat-auto.conf.in b/src/nat-auto/nat-auto.conf.in new file mode 100644 index 000000000..9461ffcc8 --- /dev/null +++ b/src/nat-auto/nat-auto.conf.in | |||
@@ -0,0 +1,15 @@ | |||
1 | [nat-auto] | ||
2 | AUTOSTART = @AUTOSTART@ | ||
3 | @UNIXONLY@ PORT = 2124 | ||
4 | HOSTNAME = localhost | ||
5 | BINARY = gnunet-service-nat-auto | ||
6 | ACCEPT_FROM = 127.0.0.1; | ||
7 | ACCEPT_FROM6 = ::1; | ||
8 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-nat-auto.sock | ||
9 | UNIX_MATCH_UID = YES | ||
10 | UNIX_MATCH_GID = YES | ||
11 | |||
12 | [gnunet-nat-server] | ||
13 | HOSTNAME = gnunet.org | ||
14 | PORT = 5724 | ||
15 | NOARMBIND = YES | ||
diff --git a/src/nat-auto/nat-auto.h b/src/nat-auto/nat-auto.h new file mode 100644 index 000000000..07b5a5b91 --- /dev/null +++ b/src/nat-auto/nat-auto.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2011, 2016, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file src/nat-auto/nat-auto.h | ||
23 | * @brief Messages for interaction with gnunet-nat-auto-service | ||
24 | * @author Christian Grothoff | ||
25 | * | ||
26 | */ | ||
27 | #ifndef NAT_AUTO_H | ||
28 | #define NAT_AUTO_H | ||
29 | #include "gnunet_util_lib.h" | ||
30 | |||
31 | |||
32 | |||
33 | GNUNET_NETWORK_STRUCT_BEGIN | ||
34 | |||
35 | /** | ||
36 | * Request to test NAT traversal, sent to the gnunet-nat-server | ||
37 | * (not the service!). | ||
38 | */ | ||
39 | struct GNUNET_NAT_AUTO_TestMessage | ||
40 | { | ||
41 | /** | ||
42 | * Header with type #GNUNET_MESSAGE_TYPE_NAT_TEST | ||
43 | */ | ||
44 | struct GNUNET_MessageHeader header; | ||
45 | |||
46 | /** | ||
47 | * IPv4 target IP address | ||
48 | */ | ||
49 | uint32_t dst_ipv4; | ||
50 | |||
51 | /** | ||
52 | * Port to use, 0 to send dummy ICMP response. | ||
53 | */ | ||
54 | uint16_t dport; | ||
55 | |||
56 | /** | ||
57 | * Data to send OR advertised-port (in NBO) to use for dummy ICMP. | ||
58 | */ | ||
59 | uint16_t data; | ||
60 | |||
61 | /** | ||
62 | * #GNUNET_YES for TCP, #GNUNET_NO for UDP. | ||
63 | */ | ||
64 | int32_t is_tcp; | ||
65 | |||
66 | }; | ||
67 | |||
68 | |||
69 | /** | ||
70 | * Client requesting automatic configuration. | ||
71 | */ | ||
72 | struct GNUNET_NAT_AUTO_AutoconfigRequestMessage | ||
73 | { | ||
74 | /** | ||
75 | * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG | ||
76 | */ | ||
77 | struct GNUNET_MessageHeader header; | ||
78 | |||
79 | /* Followed by configuration (diff, serialized, compressed) */ | ||
80 | |||
81 | }; | ||
82 | |||
83 | |||
84 | /** | ||
85 | * Service responding with proposed configuration. | ||
86 | */ | ||
87 | struct GNUNET_NAT_AUTO_AutoconfigResultMessage | ||
88 | { | ||
89 | /** | ||
90 | * Header with type #GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT | ||
91 | */ | ||
92 | struct GNUNET_MessageHeader header; | ||
93 | |||
94 | /** | ||
95 | * An `enum GNUNET_NAT_StatusCode` in NBO. | ||
96 | */ | ||
97 | int32_t status_code GNUNET_PACKED; | ||
98 | |||
99 | /** | ||
100 | * An `enum GNUNET_NAT_Type` in NBO. | ||
101 | */ | ||
102 | int32_t type GNUNET_PACKED; | ||
103 | |||
104 | /* Followed by configuration (diff, serialized, compressed) */ | ||
105 | }; | ||
106 | |||
107 | |||
108 | GNUNET_NETWORK_STRUCT_END | ||
109 | |||
110 | #endif | ||
diff --git a/src/nat-auto/nat_auto_api.c b/src/nat-auto/nat_auto_api.c new file mode 100644 index 000000000..a5b41ac49 --- /dev/null +++ b/src/nat-auto/nat_auto_api.c | |||
@@ -0,0 +1,273 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2007-2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author Christian Grothoff | ||
23 | * @author Milan Bouchet-Valat | ||
24 | * | ||
25 | * @file nat-auto/nat_auto_api.c | ||
26 | * Routines for NAT auto configuration. | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_nat_service.h" | ||
30 | #include "gnunet_nat_auto_service.h" | ||
31 | #include "nat-auto.h" | ||
32 | |||
33 | |||
34 | |||
35 | /** | ||
36 | * Handle to auto-configuration in progress. | ||
37 | */ | ||
38 | struct GNUNET_NAT_AUTO_AutoHandle | ||
39 | { | ||
40 | |||
41 | /** | ||
42 | * Configuration we use. | ||
43 | */ | ||
44 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
45 | |||
46 | /** | ||
47 | * Message queue for communicating with the NAT service. | ||
48 | */ | ||
49 | struct GNUNET_MQ_Handle *mq; | ||
50 | |||
51 | /** | ||
52 | * Function called with the result from the autoconfiguration. | ||
53 | */ | ||
54 | GNUNET_NAT_AUTO_AutoResultCallback arc; | ||
55 | |||
56 | /** | ||
57 | * Closure for @e arc. | ||
58 | */ | ||
59 | void *arc_cls; | ||
60 | |||
61 | }; | ||
62 | |||
63 | |||
64 | /** | ||
65 | * Converts `enum GNUNET_NAT_StatusCode` to string | ||
66 | * | ||
67 | * @param err error code to resolve to a string | ||
68 | * @return point to a static string containing the error code | ||
69 | */ | ||
70 | const char * | ||
71 | GNUNET_NAT_AUTO_status2string (enum GNUNET_NAT_StatusCode err) | ||
72 | { | ||
73 | switch (err) | ||
74 | { | ||
75 | case GNUNET_NAT_ERROR_SUCCESS: | ||
76 | return _ ("Operation Successful"); | ||
77 | case GNUNET_NAT_ERROR_IPC_FAILURE: | ||
78 | return _ ("IPC failure"); | ||
79 | case GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR: | ||
80 | return _ ("Failure in network subsystem, check permissions."); | ||
81 | case GNUNET_NAT_ERROR_TIMEOUT: | ||
82 | return _ ("Encountered timeout while performing operation"); | ||
83 | case GNUNET_NAT_ERROR_NOT_ONLINE: | ||
84 | return _ ("detected that we are offline"); | ||
85 | case GNUNET_NAT_ERROR_UPNPC_NOT_FOUND: | ||
86 | return _ ("`upnpc` command not found"); | ||
87 | case GNUNET_NAT_ERROR_UPNPC_FAILED: | ||
88 | return _ ("Failed to run `upnpc` command"); | ||
89 | case GNUNET_NAT_ERROR_UPNPC_TIMEOUT: | ||
90 | return _ ("`upnpc' command took too long, process killed"); | ||
91 | case GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED: | ||
92 | return _ ("`upnpc' command failed to establish port mapping"); | ||
93 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND: | ||
94 | return _ ("`external-ip' command not found"); | ||
95 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED: | ||
96 | return _ ("Failed to run `external-ip` command"); | ||
97 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID: | ||
98 | return _ ("`external-ip' command output invalid"); | ||
99 | case GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID: | ||
100 | return _ ("no valid address was returned by `external-ip'"); | ||
101 | case GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO: | ||
102 | return _ ("Could not determine interface with internal/local network address"); | ||
103 | case GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND: | ||
104 | return _ ("No functioning gnunet-helper-nat-server installation found"); | ||
105 | case GNUNET_NAT_ERROR_NAT_TEST_START_FAILED: | ||
106 | return _ ("NAT test could not be initialized"); | ||
107 | case GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT: | ||
108 | return _ ("NAT test timeout reached"); | ||
109 | case GNUNET_NAT_ERROR_NAT_REGISTER_FAILED: | ||
110 | return _ ("could not register NAT"); | ||
111 | case GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND: | ||
112 | return _ ("No working gnunet-helper-nat-client installation found"); | ||
113 | default: | ||
114 | return "unknown status code"; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | |||
119 | /** | ||
120 | * Check result from autoconfiguration attempt. | ||
121 | * | ||
122 | * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle` | ||
123 | * @param res the result | ||
124 | * @return #GNUNET_OK if @a res is well-formed (always for now) | ||
125 | */ | ||
126 | static int | ||
127 | check_auto_result (void *cls, | ||
128 | const struct GNUNET_NAT_AUTO_AutoconfigResultMessage *res) | ||
129 | { | ||
130 | return GNUNET_OK; | ||
131 | } | ||
132 | |||
133 | |||
134 | /** | ||
135 | * Handle result from autoconfiguration attempt. | ||
136 | * | ||
137 | * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle` | ||
138 | * @param res the result | ||
139 | */ | ||
140 | static void | ||
141 | handle_auto_result (void *cls, | ||
142 | const struct GNUNET_NAT_AUTO_AutoconfigResultMessage *res) | ||
143 | { | ||
144 | struct GNUNET_NAT_AUTO_AutoHandle *ah = cls; | ||
145 | size_t left; | ||
146 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
147 | enum GNUNET_NAT_Type type | ||
148 | = (enum GNUNET_NAT_Type) ntohl (res->type); | ||
149 | enum GNUNET_NAT_StatusCode status | ||
150 | = (enum GNUNET_NAT_StatusCode) ntohl (res->status_code); | ||
151 | |||
152 | left = ntohs (res->header.size) - sizeof (*res); | ||
153 | cfg = GNUNET_CONFIGURATION_create (); | ||
154 | if (GNUNET_OK != | ||
155 | GNUNET_CONFIGURATION_deserialize (cfg, | ||
156 | (const char *) &res[1], | ||
157 | left, | ||
158 | GNUNET_NO)) | ||
159 | { | ||
160 | GNUNET_break (0); | ||
161 | ah->arc (ah->arc_cls, | ||
162 | NULL, | ||
163 | GNUNET_NAT_ERROR_IPC_FAILURE, | ||
164 | type); | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | ah->arc (ah->arc_cls, | ||
169 | cfg, | ||
170 | status, | ||
171 | type); | ||
172 | } | ||
173 | GNUNET_CONFIGURATION_destroy (cfg); | ||
174 | GNUNET_NAT_AUTO_autoconfig_cancel (ah); | ||
175 | } | ||
176 | |||
177 | |||
178 | /** | ||
179 | * Handle queue errors by reporting autoconfiguration failure. | ||
180 | * | ||
181 | * @param cls the `struct GNUNET_NAT_AUTO_AutoHandle *` | ||
182 | * @param error details about the error | ||
183 | */ | ||
184 | static void | ||
185 | ah_error_handler (void *cls, | ||
186 | enum GNUNET_MQ_Error error) | ||
187 | { | ||
188 | struct GNUNET_NAT_AUTO_AutoHandle *ah = cls; | ||
189 | |||
190 | ah->arc (ah->arc_cls, | ||
191 | NULL, | ||
192 | GNUNET_NAT_ERROR_IPC_FAILURE, | ||
193 | GNUNET_NAT_TYPE_UNKNOWN); | ||
194 | GNUNET_NAT_AUTO_autoconfig_cancel (ah); | ||
195 | } | ||
196 | |||
197 | |||
198 | /** | ||
199 | * Start auto-configuration routine. The transport adapters should | ||
200 | * be stopped while this function is called. | ||
201 | * | ||
202 | * @param cfg initial configuration | ||
203 | * @param cb function to call with autoconfiguration result | ||
204 | * @param cb_cls closure for @a cb | ||
205 | * @return handle to cancel operation | ||
206 | */ | ||
207 | struct GNUNET_NAT_AUTO_AutoHandle * | ||
208 | GNUNET_NAT_AUTO_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
209 | GNUNET_NAT_AUTO_AutoResultCallback cb, | ||
210 | void *cb_cls) | ||
211 | { | ||
212 | struct GNUNET_NAT_AUTO_AutoHandle *ah = GNUNET_new (struct GNUNET_NAT_AUTO_AutoHandle); | ||
213 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
214 | GNUNET_MQ_hd_var_size (auto_result, | ||
215 | GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT, | ||
216 | struct GNUNET_NAT_AUTO_AutoconfigResultMessage, | ||
217 | ah), | ||
218 | GNUNET_MQ_handler_end () | ||
219 | }; | ||
220 | struct GNUNET_MQ_Envelope *env; | ||
221 | struct GNUNET_NAT_AUTO_AutoconfigRequestMessage *req; | ||
222 | char *buf; | ||
223 | size_t size; | ||
224 | |||
225 | buf = GNUNET_CONFIGURATION_serialize (cfg, | ||
226 | &size); | ||
227 | if (size > GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (*req)) | ||
228 | { | ||
229 | GNUNET_break (0); | ||
230 | GNUNET_free (buf); | ||
231 | GNUNET_free (ah); | ||
232 | return NULL; | ||
233 | } | ||
234 | ah->arc = cb; | ||
235 | ah->arc_cls = cb_cls; | ||
236 | ah->mq = GNUNET_CLIENT_connect (cfg, | ||
237 | "nat", | ||
238 | handlers, | ||
239 | &ah_error_handler, | ||
240 | ah); | ||
241 | if (NULL == ah->mq) | ||
242 | { | ||
243 | GNUNET_break (0); | ||
244 | GNUNET_free (buf); | ||
245 | GNUNET_free (ah); | ||
246 | return NULL; | ||
247 | } | ||
248 | env = GNUNET_MQ_msg_extra (req, | ||
249 | size, | ||
250 | GNUNET_MESSAGE_TYPE_NAT_AUTO_REQUEST_CFG); | ||
251 | GNUNET_memcpy (&req[1], | ||
252 | buf, | ||
253 | size); | ||
254 | GNUNET_free (buf); | ||
255 | GNUNET_MQ_send (ah->mq, | ||
256 | env); | ||
257 | return ah; | ||
258 | } | ||
259 | |||
260 | |||
261 | /** | ||
262 | * Abort autoconfiguration. | ||
263 | * | ||
264 | * @param ah handle for operation to abort | ||
265 | */ | ||
266 | void | ||
267 | GNUNET_NAT_AUTO_autoconfig_cancel (struct GNUNET_NAT_AUTO_AutoHandle *ah) | ||
268 | { | ||
269 | GNUNET_MQ_destroy (ah->mq); | ||
270 | GNUNET_free (ah); | ||
271 | } | ||
272 | |||
273 | /* end of nat_api_auto.c */ | ||
diff --git a/src/nat/nat_api_test.c b/src/nat-auto/nat_auto_api_test.c index d47c14094..fb2bcd679 100644 --- a/src/nat/nat_api_test.c +++ b/src/nat-auto/nat_auto_api_test.c | |||
@@ -18,14 +18,15 @@ | |||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file nat/nat_api_test.c | 21 | * @file nat/nat_auto_api_test.c |
22 | * @brief functions to test if the NAT configuration is successful at achieving NAT traversal (with the help of a gnunet-nat-server) | 22 | * @brief functions to test if the NAT configuration is successful at achieving NAT traversal (with the help of a gnunet-nat-server) |
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | */ | 24 | */ |
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
27 | #include "gnunet_nat_lib.h" | 27 | #include "gnunet_nat_service.h" |
28 | #include "nat.h" | 28 | #include "gnunet_nat_auto_service.h" |
29 | #include "nat-auto.h" | ||
29 | 30 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "nat", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "nat", __VA_ARGS__) |
31 | 32 | ||
@@ -54,7 +55,7 @@ struct NatActivity | |||
54 | /** | 55 | /** |
55 | * Handle of the master context. | 56 | * Handle of the master context. |
56 | */ | 57 | */ |
57 | struct GNUNET_NAT_Test *h; | 58 | struct GNUNET_NAT_AUTO_Test *h; |
58 | 59 | ||
59 | /** | 60 | /** |
60 | * Task reading from the incoming connection. | 61 | * Task reading from the incoming connection. |
@@ -86,7 +87,7 @@ struct ClientActivity | |||
86 | /** | 87 | /** |
87 | * Handle to overall NAT test. | 88 | * Handle to overall NAT test. |
88 | */ | 89 | */ |
89 | struct GNUNET_NAT_Test *h; | 90 | struct GNUNET_NAT_AUTO_Test *h; |
90 | 91 | ||
91 | }; | 92 | }; |
92 | 93 | ||
@@ -94,7 +95,7 @@ struct ClientActivity | |||
94 | /** | 95 | /** |
95 | * Handle to a NAT test. | 96 | * Handle to a NAT test. |
96 | */ | 97 | */ |
97 | struct GNUNET_NAT_Test | 98 | struct GNUNET_NAT_AUTO_Test |
98 | { | 99 | { |
99 | 100 | ||
100 | /** | 101 | /** |
@@ -153,19 +154,19 @@ struct GNUNET_NAT_Test | |||
153 | struct GNUNET_SCHEDULER_Task *ttask; | 154 | struct GNUNET_SCHEDULER_Task *ttask; |
154 | 155 | ||
155 | /** | 156 | /** |
156 | * #GNUNET_YES if we're testing TCP | 157 | * Section name of plugin to test. |
157 | */ | 158 | */ |
158 | int is_tcp; | 159 | char *section_name; |
159 | 160 | ||
160 | /** | 161 | /** |
161 | * Data that should be transmitted or source-port. | 162 | * IPPROTO_TCP or IPPROTO_UDP. |
162 | */ | 163 | */ |
163 | uint16_t data; | 164 | int proto; |
164 | 165 | ||
165 | /** | 166 | /** |
166 | * Advertised port to the other peer. | 167 | * Data that should be transmitted or source-port. |
167 | */ | 168 | */ |
168 | uint16_t adv_port; | 169 | uint16_t data; |
169 | 170 | ||
170 | /** | 171 | /** |
171 | * Status code to be reported to the timeout/status call | 172 | * Status code to be reported to the timeout/status call |
@@ -187,7 +188,7 @@ reversal_cb (void *cls, | |||
187 | const struct sockaddr *addr, | 188 | const struct sockaddr *addr, |
188 | socklen_t addrlen) | 189 | socklen_t addrlen) |
189 | { | 190 | { |
190 | struct GNUNET_NAT_Test *h = cls; | 191 | struct GNUNET_NAT_AUTO_Test *h = cls; |
191 | const struct sockaddr_in *sa; | 192 | const struct sockaddr_in *sa; |
192 | 193 | ||
193 | if (sizeof (struct sockaddr_in) != addrlen) | 194 | if (sizeof (struct sockaddr_in) != addrlen) |
@@ -209,12 +210,12 @@ reversal_cb (void *cls, | |||
209 | * Activity on our incoming socket. Read data from the | 210 | * Activity on our incoming socket. Read data from the |
210 | * incoming connection. | 211 | * incoming connection. |
211 | * | 212 | * |
212 | * @param cls the `struct GNUNET_NAT_Test` | 213 | * @param cls the `struct GNUNET_NAT_AUTO_Test` |
213 | */ | 214 | */ |
214 | static void | 215 | static void |
215 | do_udp_read (void *cls) | 216 | do_udp_read (void *cls) |
216 | { | 217 | { |
217 | struct GNUNET_NAT_Test *tst = cls; | 218 | struct GNUNET_NAT_AUTO_Test *tst = cls; |
218 | uint16_t data; | 219 | uint16_t data; |
219 | const struct GNUNET_SCHEDULER_TaskContext *tc; | 220 | const struct GNUNET_SCHEDULER_TaskContext *tc; |
220 | 221 | ||
@@ -255,7 +256,7 @@ static void | |||
255 | do_read (void *cls) | 256 | do_read (void *cls) |
256 | { | 257 | { |
257 | struct NatActivity *na = cls; | 258 | struct NatActivity *na = cls; |
258 | struct GNUNET_NAT_Test *tst; | 259 | struct GNUNET_NAT_AUTO_Test *tst; |
259 | uint16_t data; | 260 | uint16_t data; |
260 | const struct GNUNET_SCHEDULER_TaskContext *tc; | 261 | const struct GNUNET_SCHEDULER_TaskContext *tc; |
261 | 262 | ||
@@ -292,12 +293,12 @@ do_read (void *cls) | |||
292 | * Activity on our listen socket. Accept the | 293 | * Activity on our listen socket. Accept the |
293 | * incoming connection. | 294 | * incoming connection. |
294 | * | 295 | * |
295 | * @param cls the `struct GNUNET_NAT_Test` | 296 | * @param cls the `struct GNUNET_NAT_AUTO_Test` |
296 | */ | 297 | */ |
297 | static void | 298 | static void |
298 | do_accept (void *cls) | 299 | do_accept (void *cls) |
299 | { | 300 | { |
300 | struct GNUNET_NAT_Test *tst = cls; | 301 | struct GNUNET_NAT_AUTO_Test *tst = cls; |
301 | struct GNUNET_NETWORK_Handle *s; | 302 | struct GNUNET_NETWORK_Handle *s; |
302 | struct NatActivity *wl; | 303 | struct NatActivity *wl; |
303 | 304 | ||
@@ -342,7 +343,7 @@ mq_error_handler (void *cls, | |||
342 | enum GNUNET_MQ_Error error) | 343 | enum GNUNET_MQ_Error error) |
343 | { | 344 | { |
344 | struct ClientActivity *ca = cls; | 345 | struct ClientActivity *ca = cls; |
345 | struct GNUNET_NAT_Test *tst = ca->h; | 346 | struct GNUNET_NAT_AUTO_Test *tst = ca->h; |
346 | 347 | ||
347 | GNUNET_CONTAINER_DLL_remove (tst->ca_head, | 348 | GNUNET_CONTAINER_DLL_remove (tst->ca_head, |
348 | tst->ca_tail, | 349 | tst->ca_tail, |
@@ -358,19 +359,21 @@ mq_error_handler (void *cls, | |||
358 | * @param cls closure | 359 | * @param cls closure |
359 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | 360 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean |
360 | * the previous (now invalid) one | 361 | * the previous (now invalid) one |
362 | * @param ac address class the address belongs to | ||
361 | * @param addr either the previous or the new public IP address | 363 | * @param addr either the previous or the new public IP address |
362 | * @param addrlen actual length of the @a addr | 364 | * @param addrlen actual length of the @a addr |
363 | */ | 365 | */ |
364 | static void | 366 | static void |
365 | addr_cb (void *cls, | 367 | addr_cb (void *cls, |
366 | int add_remove, | 368 | int add_remove, |
369 | enum GNUNET_NAT_AddressClass ac, | ||
367 | const struct sockaddr *addr, | 370 | const struct sockaddr *addr, |
368 | socklen_t addrlen) | 371 | socklen_t addrlen) |
369 | { | 372 | { |
370 | struct GNUNET_NAT_Test *h = cls; | 373 | struct GNUNET_NAT_AUTO_Test *h = cls; |
371 | struct ClientActivity *ca; | 374 | struct ClientActivity *ca; |
372 | struct GNUNET_MQ_Envelope *env; | 375 | struct GNUNET_MQ_Envelope *env; |
373 | struct GNUNET_NAT_TestMessage *msg; | 376 | struct GNUNET_NAT_AUTO_TestMessage *msg; |
374 | const struct sockaddr_in *sa; | 377 | const struct sockaddr_in *sa; |
375 | 378 | ||
376 | if (GNUNET_YES != add_remove) | 379 | if (GNUNET_YES != add_remove) |
@@ -390,7 +393,7 @@ addr_cb (void *cls, | |||
390 | 393 | ||
391 | ca = GNUNET_new (struct ClientActivity); | 394 | ca = GNUNET_new (struct ClientActivity); |
392 | ca->h = h; | 395 | ca->h = h; |
393 | ca->mq = GNUNET_CLIENT_connecT (h->cfg, | 396 | ca->mq = GNUNET_CLIENT_connect (h->cfg, |
394 | "gnunet-nat-server", | 397 | "gnunet-nat-server", |
395 | NULL, | 398 | NULL, |
396 | &mq_error_handler, | 399 | &mq_error_handler, |
@@ -411,58 +414,50 @@ addr_cb (void *cls, | |||
411 | msg->dst_ipv4 = sa->sin_addr.s_addr; | 414 | msg->dst_ipv4 = sa->sin_addr.s_addr; |
412 | msg->dport = sa->sin_port; | 415 | msg->dport = sa->sin_port; |
413 | msg->data = h->data; | 416 | msg->data = h->data; |
414 | msg->is_tcp = htonl ((uint32_t) h->is_tcp); | 417 | msg->is_tcp = htonl ((uint32_t) (h->proto == IPPROTO_TCP)); |
415 | GNUNET_MQ_send (ca->mq, | 418 | GNUNET_MQ_send (ca->mq, |
416 | env); | 419 | env); |
417 | } | 420 | } |
418 | 421 | ||
419 | 422 | ||
420 | /** | 423 | /** |
421 | * Timeout task for a nat test. | 424 | * Calls the report-callback reporting failure. |
422 | * Calls the report-callback with a timeout return value | ||
423 | * | 425 | * |
424 | * Destroys the nat handle after the callback has been processed. | 426 | * Destroys the nat handle after the callback has been processed. |
425 | * | 427 | * |
426 | * @param cls handle to the timed out NAT test | 428 | * @param cls handle to the timed out NAT test |
427 | */ | 429 | */ |
428 | static void | 430 | static void |
429 | do_timeout (void *cls) | 431 | do_fail (void *cls) |
430 | { | 432 | { |
431 | struct GNUNET_NAT_Test *nh = cls; | 433 | struct GNUNET_NAT_AUTO_Test *nh = cls; |
432 | 434 | ||
433 | nh->ttask = NULL; | 435 | nh->ttask = NULL; |
434 | nh->report (nh->report_cls, | 436 | nh->report (nh->report_cls, |
435 | (GNUNET_NAT_ERROR_SUCCESS == nh->status) | 437 | nh->status); |
436 | ? GNUNET_NAT_ERROR_TIMEOUT | ||
437 | : nh->status); | ||
438 | } | 438 | } |
439 | 439 | ||
440 | 440 | ||
441 | /** | 441 | /** |
442 | * Start testing if NAT traversal works using the | 442 | * Start testing if NAT traversal works using the given configuration. |
443 | * given configuration (IPv4-only). | 443 | * The transport adapters should be down while using this function. |
444 | * | ||
445 | * ALL failures are reported directly to the report callback | ||
446 | * | 444 | * |
447 | * @param cfg configuration for the NAT traversal | 445 | * @param cfg configuration for the NAT traversal |
448 | * @param is_tcp #GNUNET_YES to test TCP, #GNUNET_NO to test UDP | 446 | * @param proto protocol to test, i.e. IPPROTO_TCP or IPPROTO_UDP |
449 | * @param bnd_port port to bind to, 0 for connection reversal | 447 | * @param section_name configuration section to use for configuration |
450 | * @param adv_port externally advertised port to use | ||
451 | * @param timeout delay after which the test should be aborted | ||
452 | * @param report function to call with the result of the test | 448 | * @param report function to call with the result of the test |
453 | * @param report_cls closure for @a report | 449 | * @param report_cls closure for @a report |
454 | * @return handle to cancel NAT test or NULL. The error is always indicated via the report callback | 450 | * @return handle to cancel NAT test |
455 | */ | 451 | */ |
456 | struct GNUNET_NAT_Test * | 452 | struct GNUNET_NAT_AUTO_Test * |
457 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 453 | GNUNET_NAT_AUTO_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
458 | int is_tcp, | 454 | uint8_t proto, |
459 | uint16_t bnd_port, | 455 | const char *section_name, |
460 | uint16_t adv_port, | 456 | GNUNET_NAT_TestCallback report, |
461 | struct GNUNET_TIME_Relative timeout, | 457 | void *report_cls) |
462 | GNUNET_NAT_TestCallback report, | ||
463 | void *report_cls) | ||
464 | { | 458 | { |
465 | struct GNUNET_NAT_Test *nh; | 459 | struct GNUNET_NAT_AUTO_Test *nh; |
460 | unsigned long long bnd_port; | ||
466 | struct sockaddr_in sa; | 461 | struct sockaddr_in sa; |
467 | const struct sockaddr *addrs[] = { | 462 | const struct sockaddr *addrs[] = { |
468 | (const struct sockaddr *) &sa | 463 | (const struct sockaddr *) &sa |
@@ -471,18 +466,30 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
471 | sizeof (sa) | 466 | sizeof (sa) |
472 | }; | 467 | }; |
473 | 468 | ||
469 | if ( (GNUNET_OK != | ||
470 | GNUNET_CONFIGURATION_get_value_number (cfg, | ||
471 | section_name, | ||
472 | "PORT", | ||
473 | &bnd_port)) || | ||
474 | (bnd_port > 65535) ) | ||
475 | { | ||
476 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
477 | _("Failed to find valid PORT in section `%s'\n"), | ||
478 | section_name); | ||
479 | return NULL; | ||
480 | } | ||
481 | |||
474 | memset (&sa, 0, sizeof (sa)); | 482 | memset (&sa, 0, sizeof (sa)); |
475 | sa.sin_family = AF_INET; | 483 | sa.sin_family = AF_INET; |
476 | sa.sin_port = htons (bnd_port); | 484 | sa.sin_port = htons ((uint16_t) bnd_port); |
477 | #if HAVE_SOCKADDR_IN_SIN_LEN | 485 | #if HAVE_SOCKADDR_IN_SIN_LEN |
478 | sa.sin_len = sizeof (sa); | 486 | sa.sin_len = sizeof (sa); |
479 | #endif | 487 | #endif |
480 | 488 | ||
481 | nh = GNUNET_new (struct GNUNET_NAT_Test); | 489 | nh = GNUNET_new (struct GNUNET_NAT_AUTO_Test); |
482 | nh->cfg = cfg; | 490 | nh->cfg = cfg; |
483 | nh->is_tcp = is_tcp; | 491 | nh->proto = proto; |
484 | nh->data = bnd_port; | 492 | nh->section_name = GNUNET_strdup (section_name); |
485 | nh->adv_port = adv_port; | ||
486 | nh->report = report; | 493 | nh->report = report; |
487 | nh->report_cls = report_cls; | 494 | nh->report_cls = report_cls; |
488 | nh->status = GNUNET_NAT_ERROR_SUCCESS; | 495 | nh->status = GNUNET_NAT_ERROR_SUCCESS; |
@@ -490,28 +497,24 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
490 | { | 497 | { |
491 | nh->nat | 498 | nh->nat |
492 | = GNUNET_NAT_register (cfg, | 499 | = GNUNET_NAT_register (cfg, |
493 | is_tcp, | 500 | section_name, |
494 | 0, | 501 | proto, |
495 | 0, | 502 | 0, NULL, NULL, |
496 | NULL, | ||
497 | NULL, | ||
498 | &addr_cb, | 503 | &addr_cb, |
499 | &reversal_cb, | 504 | &reversal_cb, |
500 | nh, | 505 | nh); |
501 | NULL); | ||
502 | } | 506 | } |
503 | else | 507 | else |
504 | { | 508 | { |
505 | nh->lsock = | 509 | nh->lsock |
506 | GNUNET_NETWORK_socket_create (AF_INET, | 510 | = GNUNET_NETWORK_socket_create (AF_INET, |
507 | (is_tcp == | 511 | proto, |
508 | GNUNET_YES) ? SOCK_STREAM : SOCK_DGRAM, | ||
509 | 0); | 512 | 0); |
510 | if ((nh->lsock == NULL) || | 513 | if ( (NULL == nh->lsock) || |
511 | (GNUNET_OK != | 514 | (GNUNET_OK != |
512 | GNUNET_NETWORK_socket_bind (nh->lsock, | 515 | GNUNET_NETWORK_socket_bind (nh->lsock, |
513 | (const struct sockaddr *) &sa, | 516 | (const struct sockaddr *) &sa, |
514 | sizeof (sa)))) | 517 | sizeof (sa)))) |
515 | { | 518 | { |
516 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 519 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
517 | _("Failed to create listen socket bound to `%s' for NAT test: %s\n"), | 520 | _("Failed to create listen socket bound to `%s' for NAT test: %s\n"), |
@@ -524,11 +527,11 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
524 | nh->lsock = NULL; | 527 | nh->lsock = NULL; |
525 | } | 528 | } |
526 | nh->status = GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR; | 529 | nh->status = GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR; |
527 | nh->ttask = GNUNET_SCHEDULER_add_now (&do_timeout, | 530 | nh->ttask = GNUNET_SCHEDULER_add_now (&do_fail, |
528 | nh); | 531 | nh); |
529 | return nh; | 532 | return nh; |
530 | } | 533 | } |
531 | if (GNUNET_YES == is_tcp) | 534 | if (IPPROTO_TCP == proto) |
532 | { | 535 | { |
533 | GNUNET_break (GNUNET_OK == | 536 | GNUNET_break (GNUNET_OK == |
534 | GNUNET_NETWORK_socket_listen (nh->lsock, | 537 | GNUNET_NETWORK_socket_listen (nh->lsock, |
@@ -550,17 +553,16 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
550 | LOG (GNUNET_ERROR_TYPE_INFO, | 553 | LOG (GNUNET_ERROR_TYPE_INFO, |
551 | "NAT test listens on port %u (%s)\n", | 554 | "NAT test listens on port %u (%s)\n", |
552 | bnd_port, | 555 | bnd_port, |
553 | (GNUNET_YES == is_tcp) ? "tcp" : "udp"); | 556 | (IPPROTO_TCP == proto) ? "tcp" : "udp"); |
554 | nh->nat = GNUNET_NAT_register (cfg, | 557 | nh->nat = GNUNET_NAT_register (cfg, |
555 | is_tcp, | 558 | section_name, |
556 | adv_port, | 559 | proto, |
557 | 1, | 560 | 1, |
558 | addrs, | 561 | addrs, |
559 | addrlens, | 562 | addrlens, |
560 | &addr_cb, | 563 | &addr_cb, |
561 | NULL, | 564 | NULL, |
562 | nh, | 565 | nh); |
563 | NULL); | ||
564 | if (NULL == nh->nat) | 566 | if (NULL == nh->nat) |
565 | { | 567 | { |
566 | LOG (GNUNET_ERROR_TYPE_INFO, | 568 | LOG (GNUNET_ERROR_TYPE_INFO, |
@@ -576,14 +578,11 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
576 | nh->lsock = NULL; | 578 | nh->lsock = NULL; |
577 | } | 579 | } |
578 | nh->status = GNUNET_NAT_ERROR_NAT_REGISTER_FAILED; | 580 | nh->status = GNUNET_NAT_ERROR_NAT_REGISTER_FAILED; |
579 | nh->ttask = GNUNET_SCHEDULER_add_now (&do_timeout, | 581 | nh->ttask = GNUNET_SCHEDULER_add_now (&do_fail, |
580 | nh); | 582 | nh); |
581 | return nh; | 583 | return nh; |
582 | } | 584 | } |
583 | } | 585 | } |
584 | nh->ttask = GNUNET_SCHEDULER_add_delayed (timeout, | ||
585 | &do_timeout, | ||
586 | nh); | ||
587 | return nh; | 586 | return nh; |
588 | } | 587 | } |
589 | 588 | ||
@@ -594,7 +593,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
594 | * @param tst test to stop. | 593 | * @param tst test to stop. |
595 | */ | 594 | */ |
596 | void | 595 | void |
597 | GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst) | 596 | GNUNET_NAT_AUTO_test_stop (struct GNUNET_NAT_AUTO_Test *tst) |
598 | { | 597 | { |
599 | struct NatActivity *pos; | 598 | struct NatActivity *pos; |
600 | struct ClientActivity *cpos; | 599 | struct ClientActivity *cpos; |
@@ -638,7 +637,8 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst) | |||
638 | GNUNET_NAT_unregister (tst->nat); | 637 | GNUNET_NAT_unregister (tst->nat); |
639 | tst->nat = NULL; | 638 | tst->nat = NULL; |
640 | } | 639 | } |
640 | GNUNET_free (tst->section_name); | ||
641 | GNUNET_free (tst); | 641 | GNUNET_free (tst); |
642 | } | 642 | } |
643 | 643 | ||
644 | /* end of nat_test.c */ | 644 | /* end of nat_auto_api_test.c */ |
diff --git a/src/nat/Makefile.am b/src/nat/Makefile.am index 1dd8e44b9..3dc001dd7 100644 --- a/src/nat/Makefile.am +++ b/src/nat/Makefile.am | |||
@@ -34,7 +34,6 @@ install-exec-hook: | |||
34 | endif | 34 | endif |
35 | 35 | ||
36 | bin_PROGRAMS = \ | 36 | bin_PROGRAMS = \ |
37 | gnunet-nat-server \ | ||
38 | gnunet-nat | 37 | gnunet-nat |
39 | 38 | ||
40 | libexec_PROGRAMS = \ | 39 | libexec_PROGRAMS = \ |
@@ -42,12 +41,6 @@ libexec_PROGRAMS = \ | |||
42 | gnunet-service-nat | 41 | gnunet-service-nat |
43 | 42 | ||
44 | 43 | ||
45 | gnunet_nat_server_SOURCES = \ | ||
46 | gnunet-nat-server.c nat.h | ||
47 | gnunet_nat_server_LDADD = \ | ||
48 | libgnunetnat.la \ | ||
49 | $(top_builddir)/src/util/libgnunetutil.la | ||
50 | |||
51 | gnunet_helper_nat_server_SOURCES = \ | 44 | gnunet_helper_nat_server_SOURCES = \ |
52 | $(NATSERVER) | 45 | $(NATSERVER) |
53 | 46 | ||
@@ -67,26 +60,11 @@ if USE_COVERAGE | |||
67 | endif | 60 | endif |
68 | 61 | ||
69 | lib_LTLIBRARIES = \ | 62 | lib_LTLIBRARIES = \ |
70 | libgnunetnat.la \ | ||
71 | libgnunetnatnew.la | 63 | libgnunetnatnew.la |
72 | 64 | ||
73 | libgnunetnat_la_SOURCES = \ | ||
74 | nat.c nat.h \ | ||
75 | nat_auto.c \ | ||
76 | nat_test.c \ | ||
77 | nat_mini.c \ | ||
78 | nat_stun.c | ||
79 | libgnunetnat_la_LIBADD = \ | ||
80 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
81 | $(GN_LIBINTL) @EXT_LIBS@ | ||
82 | libgnunetnat_la_LDFLAGS = \ | ||
83 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ | ||
84 | -version-info 1:1:1 | ||
85 | |||
86 | libgnunetnatnew_la_SOURCES = \ | 65 | libgnunetnatnew_la_SOURCES = \ |
87 | nat_api.c \ | 66 | nat_api.c \ |
88 | nat_api_stun.c nat_stun.h \ | 67 | nat_api_stun.c nat_stun.h \ |
89 | nat_api_test.c \ | ||
90 | nat.h | 68 | nat.h |
91 | libgnunetnatnew_la_LIBADD = \ | 69 | libgnunetnatnew_la_LIBADD = \ |
92 | $(top_builddir)/src/util/libgnunetutil.la \ | 70 | $(top_builddir)/src/util/libgnunetutil.la \ |
@@ -96,7 +74,8 @@ libgnunetnatnew_la_LDFLAGS = \ | |||
96 | -version-info 2:0:0 | 74 | -version-info 2:0:0 |
97 | 75 | ||
98 | gnunet_service_nat_SOURCES = \ | 76 | gnunet_service_nat_SOURCES = \ |
99 | gnunet-service-nat.c \ | 77 | gnunet-service-nat.c gnunet-service-nat.h \ |
78 | gnunet-service-nat_externalip.c gnunet-service-nat_externalip.h \ | ||
100 | gnunet-service-nat_stun.c gnunet-service-nat_stun.h \ | 79 | gnunet-service-nat_stun.c gnunet-service-nat_stun.h \ |
101 | gnunet-service-nat_mini.c gnunet-service-nat_mini.h \ | 80 | gnunet-service-nat_mini.c gnunet-service-nat_mini.h \ |
102 | gnunet-service-nat_helper.c gnunet-service-nat_helper.h | 81 | gnunet-service-nat_helper.c gnunet-service-nat_helper.h |
@@ -107,40 +86,40 @@ gnunet_service_nat_LDADD = \ | |||
107 | -lgcrypt \ | 86 | -lgcrypt \ |
108 | $(GN_LIBINTL) | 87 | $(GN_LIBINTL) |
109 | 88 | ||
110 | check_PROGRAMS = \ | 89 | #check_PROGRAMS = \ |
111 | test_nat \ | 90 | # test_nat \ |
112 | test_nat_mini \ | 91 | # test_nat_mini \ |
113 | test_nat_test \ | 92 | # test_nat_test \ |
114 | test_stun | 93 | # test_stun |
115 | 94 | ||
116 | if ENABLE_TEST_RUN | 95 | if ENABLE_TEST_RUN |
117 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; | 96 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; |
118 | TESTS = $(check_PROGRAMS) | 97 | TESTS = $(check_PROGRAMS) |
119 | endif | 98 | endif |
120 | 99 | ||
121 | test_nat_SOURCES = \ | 100 | #test_nat_SOURCES = \ |
122 | test_nat.c | 101 | # test_nat.c |
123 | test_nat_LDADD = \ | 102 | #test_nat_LDADD = \ |
124 | libgnunetnat.la \ | 103 | # libgnunetnat.la \ |
125 | $(top_builddir)/src/util/libgnunetutil.la | 104 | # $(top_builddir)/src/util/libgnunetutil.la |
126 | 105 | ||
127 | test_nat_mini_SOURCES = \ | 106 | #test_nat_mini_SOURCES = \ |
128 | test_nat_mini.c | 107 | # test_nat_mini.c |
129 | test_nat_mini_LDADD = \ | 108 | #test_nat_mini_LDADD = \ |
130 | libgnunetnat.la \ | 109 | # libgnunetnat.la \ |
131 | $(top_builddir)/src/util/libgnunetutil.la | 110 | # $(top_builddir)/src/util/libgnunetutil.la |
132 | 111 | ||
133 | test_nat_test_SOURCES = \ | 112 | #test_nat_test_SOURCES = \ |
134 | test_nat_test.c | 113 | # test_nat_test.c |
135 | test_nat_test_LDADD = \ | 114 | #test_nat_test_LDADD = \ |
136 | libgnunetnat.la \ | 115 | # libgnunetnat.la \ |
137 | $(top_builddir)/src/util/libgnunetutil.la | 116 | # $(top_builddir)/src/util/libgnunetutil.la |
138 | 117 | ||
139 | test_stun_SOURCES = \ | 118 | #test_stun_SOURCES = \ |
140 | test_stun.c | 119 | # test_stun.c |
141 | test_stun_LDADD = \ | 120 | #test_stun_LDADD = \ |
142 | libgnunetnat.la \ | 121 | # libgnunetnat.la \ |
143 | $(top_builddir)/src/util/libgnunetutil.la | 122 | # $(top_builddir)/src/util/libgnunetutil.la |
144 | 123 | ||
145 | EXTRA_DIST = \ | 124 | EXTRA_DIST = \ |
146 | test_nat_data.conf \ | 125 | test_nat_data.conf \ |
diff --git a/src/nat/gnunet-nat.c b/src/nat/gnunet-nat.c index 81e4549b5..f198adc0a 100644 --- a/src/nat/gnunet-nat.c +++ b/src/nat/gnunet-nat.c | |||
@@ -34,15 +34,10 @@ | |||
34 | static int global_ret; | 34 | static int global_ret; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Handle to ongoing autoconfiguration. | 37 | * Name of section in configuration file to use for |
38 | */ | 38 | * additional options. |
39 | static struct GNUNET_NAT_AutoHandle *ah; | ||
40 | |||
41 | /** | ||
42 | * External hostname and port, if user manually punched | ||
43 | * the NAT. | ||
44 | */ | 39 | */ |
45 | static char *hole_external; | 40 | static char *section_name; |
46 | 41 | ||
47 | /** | 42 | /** |
48 | * Flag set to 1 if we use IPPROTO_UDP. | 43 | * Flag set to 1 if we use IPPROTO_UDP. |
@@ -60,39 +55,11 @@ static int listen_reversal; | |||
60 | static int use_tcp; | 55 | static int use_tcp; |
61 | 56 | ||
62 | /** | 57 | /** |
63 | * If we do auto-configuration, should we write the result | ||
64 | * to a file? | ||
65 | */ | ||
66 | static int write_cfg; | ||
67 | |||
68 | /** | ||
69 | * Configuration filename. | ||
70 | */ | ||
71 | static const char *cfg_file; | ||
72 | |||
73 | /** | ||
74 | * Original configuration. | ||
75 | */ | ||
76 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
77 | |||
78 | /** | ||
79 | * Protocol to use. | 58 | * Protocol to use. |
80 | */ | 59 | */ |
81 | static uint8_t proto; | 60 | static uint8_t proto; |
82 | 61 | ||
83 | /** | 62 | /** |
84 | * Address we are bound to (in test), or should bind to | ||
85 | * (if #do_stun is set). | ||
86 | */ | ||
87 | static char *bind_addr; | ||
88 | |||
89 | /** | ||
90 | * External IP address and port to use for the test. | ||
91 | * If not set, use #bind_addr. | ||
92 | */ | ||
93 | static char *extern_addr; | ||
94 | |||
95 | /** | ||
96 | * Local address to use for connection reversal request. | 63 | * Local address to use for connection reversal request. |
97 | */ | 64 | */ |
98 | static char *local_addr; | 65 | static char *local_addr; |
@@ -108,16 +75,6 @@ static char *remote_addr; | |||
108 | static unsigned int do_stun; | 75 | static unsigned int do_stun; |
109 | 76 | ||
110 | /** | 77 | /** |
111 | * Should we run autoconfiguration? | ||
112 | */ | ||
113 | static unsigned int do_auto; | ||
114 | |||
115 | /** | ||
116 | * Handle to a NAT test operation. | ||
117 | */ | ||
118 | static struct GNUNET_NAT_Test *nt; | ||
119 | |||
120 | /** | ||
121 | * Handle to NAT operation. | 78 | * Handle to NAT operation. |
122 | */ | 79 | */ |
123 | static struct GNUNET_NAT_Handle *nh; | 80 | static struct GNUNET_NAT_Handle *nh; |
@@ -140,10 +97,6 @@ static struct GNUNET_SCHEDULER_Task *rtask; | |||
140 | static void | 97 | static void |
141 | test_finished () | 98 | test_finished () |
142 | { | 99 | { |
143 | if (NULL != ah) | ||
144 | return; | ||
145 | if (NULL != nt) | ||
146 | return; | ||
147 | if (NULL != nh) | 100 | if (NULL != nh) |
148 | return; | 101 | return; |
149 | if (NULL != rtask) | 102 | if (NULL != rtask) |
@@ -153,160 +106,6 @@ test_finished () | |||
153 | 106 | ||
154 | 107 | ||
155 | /** | 108 | /** |
156 | * Function to iterate over sugested changes options | ||
157 | * | ||
158 | * @param cls closure | ||
159 | * @param section name of the section | ||
160 | * @param option name of the option | ||
161 | * @param value value of the option | ||
162 | */ | ||
163 | static void | ||
164 | auto_conf_iter (void *cls, | ||
165 | const char *section, | ||
166 | const char *option, | ||
167 | const char *value) | ||
168 | { | ||
169 | struct GNUNET_CONFIGURATION_Handle *new_cfg = cls; | ||
170 | |||
171 | PRINTF ("%s: %s\n", | ||
172 | option, | ||
173 | value); | ||
174 | if (NULL != new_cfg) | ||
175 | GNUNET_CONFIGURATION_set_value_string (new_cfg, | ||
176 | section, | ||
177 | option, | ||
178 | value); | ||
179 | } | ||
180 | |||
181 | |||
182 | /** | ||
183 | * Function called with the result from the autoconfiguration. | ||
184 | * | ||
185 | * @param cls closure | ||
186 | * @param diff minimal suggested changes to the original configuration | ||
187 | * to make it work (as best as we can) | ||
188 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
189 | * @param type what the situation of the NAT | ||
190 | */ | ||
191 | static void | ||
192 | auto_config_cb (void *cls, | ||
193 | const struct GNUNET_CONFIGURATION_Handle *diff, | ||
194 | enum GNUNET_NAT_StatusCode result, | ||
195 | enum GNUNET_NAT_Type type) | ||
196 | { | ||
197 | const char *nat_type; | ||
198 | char unknown_type[64]; | ||
199 | struct GNUNET_CONFIGURATION_Handle *new_cfg; | ||
200 | |||
201 | ah = NULL; | ||
202 | switch (type) | ||
203 | { | ||
204 | case GNUNET_NAT_TYPE_NO_NAT: | ||
205 | nat_type = "NO NAT"; | ||
206 | break; | ||
207 | case GNUNET_NAT_TYPE_UNREACHABLE_NAT: | ||
208 | nat_type = "NAT but we can traverse"; | ||
209 | break; | ||
210 | case GNUNET_NAT_TYPE_STUN_PUNCHED_NAT: | ||
211 | nat_type = "NAT but STUN is able to identify the correct information"; | ||
212 | break; | ||
213 | case GNUNET_NAT_TYPE_UPNP_NAT: | ||
214 | nat_type = "NAT but UPNP opened the ports"; | ||
215 | break; | ||
216 | default: | ||
217 | SPRINTF (unknown_type, | ||
218 | "NAT unknown, type %u", | ||
219 | type); | ||
220 | nat_type = unknown_type; | ||
221 | break; | ||
222 | } | ||
223 | |||
224 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
225 | "NAT status: %s/%s\n", | ||
226 | GNUNET_NAT_status2string (result), | ||
227 | nat_type); | ||
228 | |||
229 | /* Shortcut: if there are no changes suggested, bail out early. */ | ||
230 | if (GNUNET_NO == | ||
231 | GNUNET_CONFIGURATION_is_dirty (diff)) | ||
232 | { | ||
233 | test_finished (); | ||
234 | return; | ||
235 | } | ||
236 | |||
237 | /* Apply diff to original configuration and show changes | ||
238 | to the user */ | ||
239 | new_cfg = write_cfg ? GNUNET_CONFIGURATION_dup (cfg) : NULL; | ||
240 | |||
241 | if (NULL != diff) | ||
242 | { | ||
243 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
244 | _("Suggested configuration changes:\n")); | ||
245 | GNUNET_CONFIGURATION_iterate_section_values (diff, | ||
246 | "nat", | ||
247 | &auto_conf_iter, | ||
248 | new_cfg); | ||
249 | } | ||
250 | |||
251 | /* If desired, write configuration to file; we write only the | ||
252 | changes to the defaults to keep things compact. */ | ||
253 | if ( (write_cfg) && | ||
254 | (NULL != diff) ) | ||
255 | { | ||
256 | struct GNUNET_CONFIGURATION_Handle *def_cfg; | ||
257 | |||
258 | GNUNET_CONFIGURATION_set_value_string (new_cfg, | ||
259 | "ARM", | ||
260 | "CONFIG", | ||
261 | NULL); | ||
262 | def_cfg = GNUNET_CONFIGURATION_create (); | ||
263 | GNUNET_break (GNUNET_OK == | ||
264 | GNUNET_CONFIGURATION_load (def_cfg, | ||
265 | NULL)); | ||
266 | if (GNUNET_OK != | ||
267 | GNUNET_CONFIGURATION_write_diffs (def_cfg, | ||
268 | new_cfg, | ||
269 | cfg_file)) | ||
270 | { | ||
271 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
272 | _("Failed to write configuration to `%s'\n"), | ||
273 | cfg_file); | ||
274 | global_ret = 1; | ||
275 | } | ||
276 | else | ||
277 | { | ||
278 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
279 | _("Wrote updated configuration to `%s'\n"), | ||
280 | cfg_file); | ||
281 | } | ||
282 | GNUNET_CONFIGURATION_destroy (def_cfg); | ||
283 | } | ||
284 | |||
285 | if (NULL != new_cfg) | ||
286 | GNUNET_CONFIGURATION_destroy (new_cfg); | ||
287 | test_finished (); | ||
288 | } | ||
289 | |||
290 | |||
291 | /** | ||
292 | * Function called to report success or failure for | ||
293 | * NAT configuration test. | ||
294 | * | ||
295 | * @param cls closure | ||
296 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
297 | */ | ||
298 | static void | ||
299 | test_report_cb (void *cls, | ||
300 | enum GNUNET_NAT_StatusCode result) | ||
301 | { | ||
302 | nt = NULL; | ||
303 | PRINTF ("NAT test result: %s\n", | ||
304 | GNUNET_NAT_status2string (result)); | ||
305 | test_finished (); | ||
306 | } | ||
307 | |||
308 | |||
309 | /** | ||
310 | * Signature of the callback passed to #GNUNET_NAT_register() for | 109 | * Signature of the callback passed to #GNUNET_NAT_register() for |
311 | * a function to call whenever our set of 'valid' addresses changes. | 110 | * a function to call whenever our set of 'valid' addresses changes. |
312 | * | 111 | * |
@@ -362,16 +161,6 @@ reversal_cb (void *cls, | |||
362 | static void | 161 | static void |
363 | do_shutdown (void *cls) | 162 | do_shutdown (void *cls) |
364 | { | 163 | { |
365 | if (NULL != ah) | ||
366 | { | ||
367 | GNUNET_NAT_autoconfig_cancel (ah); | ||
368 | ah = NULL; | ||
369 | } | ||
370 | if (NULL != nt) | ||
371 | { | ||
372 | GNUNET_NAT_test_stop (nt); | ||
373 | nt = NULL; | ||
374 | } | ||
375 | if (NULL != nh) | 164 | if (NULL != nh) |
376 | { | 165 | { |
377 | GNUNET_NAT_unregister (nh); | 166 | GNUNET_NAT_unregister (nh); |
@@ -452,16 +241,11 @@ run (void *cls, | |||
452 | const struct GNUNET_CONFIGURATION_Handle *c) | 241 | const struct GNUNET_CONFIGURATION_Handle *c) |
453 | { | 242 | { |
454 | uint8_t af; | 243 | uint8_t af; |
455 | struct sockaddr_in bind_sa; | ||
456 | struct sockaddr_in extern_sa; | ||
457 | struct sockaddr *local_sa; | 244 | struct sockaddr *local_sa; |
458 | struct sockaddr *remote_sa; | 245 | struct sockaddr *remote_sa; |
459 | socklen_t local_len; | 246 | socklen_t local_len; |
460 | size_t remote_len; | 247 | size_t remote_len; |
461 | 248 | ||
462 | cfg_file = cfgfile; | ||
463 | cfg = c; | ||
464 | |||
465 | if (use_tcp && use_udp) | 249 | if (use_tcp && use_udp) |
466 | { | 250 | { |
467 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 251 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
@@ -478,50 +262,13 @@ run (void *cls, | |||
478 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 262 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
479 | NULL); | 263 | NULL); |
480 | 264 | ||
481 | if (do_auto) | ||
482 | { | ||
483 | ah = GNUNET_NAT_autoconfig_start (c, | ||
484 | &auto_config_cb, | ||
485 | NULL); | ||
486 | } | ||
487 | |||
488 | if (0 == proto) | 265 | if (0 == proto) |
489 | { | 266 | { |
490 | if (do_auto) | ||
491 | return; /* all good, we just run auto config */ | ||
492 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 267 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
493 | "Must specify either TCP or UDP\n"); | 268 | "Must specify either TCP or UDP\n"); |
494 | global_ret = 1; | 269 | global_ret = 1; |
495 | return; | 270 | return; |
496 | } | 271 | } |
497 | if (NULL != bind_addr) | ||
498 | { | ||
499 | if (GNUNET_OK != | ||
500 | GNUNET_STRINGS_to_address_ipv4 (bind_addr, | ||
501 | strlen (bind_addr), | ||
502 | &bind_sa)) | ||
503 | { | ||
504 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
505 | "Invalid socket address `%s'\n", | ||
506 | bind_addr); | ||
507 | global_ret = 1; | ||
508 | return; | ||
509 | } | ||
510 | } | ||
511 | if (NULL != extern_addr) | ||
512 | { | ||
513 | if (GNUNET_OK != | ||
514 | GNUNET_STRINGS_to_address_ipv4 (extern_addr, | ||
515 | strlen (extern_addr), | ||
516 | &extern_sa)) | ||
517 | { | ||
518 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
519 | "Invalid socket address `%s'\n", | ||
520 | extern_addr); | ||
521 | global_ret = 1; | ||
522 | return; | ||
523 | } | ||
524 | } | ||
525 | if (NULL != local_addr) | 272 | if (NULL != local_addr) |
526 | { | 273 | { |
527 | local_len = (socklen_t) GNUNET_STRINGS_parse_socket_addr (local_addr, | 274 | local_len = (socklen_t) GNUNET_STRINGS_parse_socket_addr (local_addr, |
@@ -551,25 +298,13 @@ run (void *cls, | |||
551 | } | 298 | } |
552 | } | 299 | } |
553 | 300 | ||
554 | if (NULL != bind_addr) | ||
555 | { | ||
556 | if (NULL == extern_addr) | ||
557 | extern_sa = bind_sa; | ||
558 | nt = GNUNET_NAT_test_start (c, | ||
559 | proto, | ||
560 | bind_sa.sin_addr, | ||
561 | ntohs (bind_sa.sin_port), | ||
562 | extern_sa.sin_addr, | ||
563 | ntohs (extern_sa.sin_port), | ||
564 | &test_report_cb, | ||
565 | NULL); | ||
566 | } | ||
567 | |||
568 | if (NULL != local_addr) | 301 | if (NULL != local_addr) |
569 | { | 302 | { |
303 | if (NULL == section_name) | ||
304 | section_name = GNUNET_strdup ("undefined"); | ||
570 | nh = GNUNET_NAT_register (c, | 305 | nh = GNUNET_NAT_register (c, |
306 | section_name, | ||
571 | proto, | 307 | proto, |
572 | hole_external, | ||
573 | 1, | 308 | 1, |
574 | (const struct sockaddr **) &local_sa, | 309 | (const struct sockaddr **) &local_sa, |
575 | &local_len, | 310 | &local_len, |
@@ -607,9 +342,11 @@ run (void *cls, | |||
607 | GNUNET_SCHEDULER_shutdown (); | 342 | GNUNET_SCHEDULER_shutdown (); |
608 | return; | 343 | return; |
609 | } | 344 | } |
345 | GNUNET_assert (AF_INET == local_sa->sa_family); | ||
346 | GNUNET_assert (AF_INET == remote_sa->sa_family); | ||
610 | ret = GNUNET_NAT_request_reversal (nh, | 347 | ret = GNUNET_NAT_request_reversal (nh, |
611 | (const struct sockaddr_in *) &local_sa, | 348 | (const struct sockaddr_in *) local_sa, |
612 | (const struct sockaddr_in *) &remote_sa); | 349 | (const struct sockaddr_in *) remote_sa); |
613 | switch (ret) | 350 | switch (ret) |
614 | { | 351 | { |
615 | case GNUNET_SYSERR: | 352 | case GNUNET_SYSERR: |
@@ -683,24 +420,15 @@ main (int argc, | |||
683 | char *const argv[]) | 420 | char *const argv[]) |
684 | { | 421 | { |
685 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 422 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
686 | {'a', "auto", NULL, | ||
687 | gettext_noop ("run autoconfiguration"), | ||
688 | GNUNET_NO, &GNUNET_GETOPT_set_one, &do_auto }, | ||
689 | {'b', "bind", "ADDRESS", | ||
690 | gettext_noop ("which IP and port are we bound to"), | ||
691 | GNUNET_YES, &GNUNET_GETOPT_set_string, &bind_addr }, | ||
692 | {'e', "external", "ADDRESS", | ||
693 | gettext_noop ("which external IP and port should be used to test"), | ||
694 | GNUNET_YES, &GNUNET_GETOPT_set_string, &extern_addr }, | ||
695 | {'i', "in", "ADDRESS", | 423 | {'i', "in", "ADDRESS", |
696 | gettext_noop ("which IP and port are we locally using to bind/listen to"), | 424 | gettext_noop ("which IP and port are we locally using to bind/listen to"), |
697 | GNUNET_YES, &GNUNET_GETOPT_set_string, &local_addr }, | 425 | GNUNET_YES, &GNUNET_GETOPT_set_string, &local_addr }, |
698 | {'r', "remote", "ADDRESS", | 426 | {'r', "remote", "ADDRESS", |
699 | gettext_noop ("which remote IP and port should be asked for connection reversal"), | 427 | gettext_noop ("which remote IP and port should be asked for connection reversal"), |
700 | GNUNET_YES, &GNUNET_GETOPT_set_string, &remote_addr }, | 428 | GNUNET_YES, &GNUNET_GETOPT_set_string, &remote_addr }, |
701 | {'p', "punched", NULL, | 429 | {'S', "section", NULL, |
702 | gettext_noop ("external hostname and port of NAT, if punched manually; use AUTO for hostname for automatic determination of the external IP"), | 430 | gettext_noop ("name of configuration section to find additional options, such as manual host punching data"), |
703 | GNUNET_YES, &GNUNET_GETOPT_set_string, &hole_external }, | 431 | GNUNET_YES, &GNUNET_GETOPT_set_string, §ion_name }, |
704 | {'s', "stun", NULL, | 432 | {'s', "stun", NULL, |
705 | gettext_noop ("enable STUN processing"), | 433 | gettext_noop ("enable STUN processing"), |
706 | GNUNET_NO, &GNUNET_GETOPT_set_one, &do_stun }, | 434 | GNUNET_NO, &GNUNET_GETOPT_set_one, &do_stun }, |
@@ -710,9 +438,6 @@ main (int argc, | |||
710 | {'u', "udp", NULL, | 438 | {'u', "udp", NULL, |
711 | gettext_noop ("use UDP"), | 439 | gettext_noop ("use UDP"), |
712 | GNUNET_NO, &GNUNET_GETOPT_set_one, &use_udp }, | 440 | GNUNET_NO, &GNUNET_GETOPT_set_one, &use_udp }, |
713 | {'w', "write", NULL, | ||
714 | gettext_noop ("write configuration file (for autoconfiguration)"), | ||
715 | GNUNET_NO, &GNUNET_GETOPT_set_one, &write_cfg }, | ||
716 | {'W', "watch", NULL, | 441 | {'W', "watch", NULL, |
717 | gettext_noop ("watch for connection reversal requests"), | 442 | gettext_noop ("watch for connection reversal requests"), |
718 | GNUNET_NO, &GNUNET_GETOPT_set_one, &listen_reversal }, | 443 | GNUNET_NO, &GNUNET_GETOPT_set_one, &listen_reversal }, |
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c index e29f37108..98d87262e 100644 --- a/src/nat/gnunet-service-nat.c +++ b/src/nat/gnunet-service-nat.c | |||
@@ -23,20 +23,16 @@ | |||
23 | * @brief network address translation traversal service | 23 | * @brief network address translation traversal service |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | 25 | * |
26 | * The purpose of this service is to enable transports to | 26 | * The purpose of this service is to enable transports to |
27 | * traverse NAT routers, by providing traversal options and | 27 | * traverse NAT routers, by providing traversal options and |
28 | * knowledge about the local network topology. | 28 | * knowledge about the local network topology. |
29 | * | 29 | * |
30 | * TODO: | 30 | * TODO: |
31 | * - test and document (!) ICMP based NAT traversal | 31 | * - migrate test cases to new NAT service |
32 | * - implement manual hole punching support (incl. DNS | 32 | * - add new traceroute-based logic for external IP detection |
33 | * lookup for DynDNS setups!) | 33 | * |
34 | * - implement "more" autoconfig: | ||
35 | * re-work gnunet-nat-server & integrate! | ||
36 | * + test manually punched NAT (how?) | ||
37 | * - implement & test STUN processing to classify NAT; | 34 | * - implement & test STUN processing to classify NAT; |
38 | * basically, open port & try different methods. | 35 | * basically, open port & try different methods. |
39 | * - implement NEW logic for external IP detection | ||
40 | */ | 36 | */ |
41 | #include "platform.h" | 37 | #include "platform.h" |
42 | #include <math.h> | 38 | #include <math.h> |
@@ -44,7 +40,10 @@ | |||
44 | #include "gnunet_protocols.h" | 40 | #include "gnunet_protocols.h" |
45 | #include "gnunet_signatures.h" | 41 | #include "gnunet_signatures.h" |
46 | #include "gnunet_statistics_service.h" | 42 | #include "gnunet_statistics_service.h" |
43 | #include "gnunet_resolver_service.h" | ||
47 | #include "gnunet_nat_service.h" | 44 | #include "gnunet_nat_service.h" |
45 | #include "gnunet-service-nat.h" | ||
46 | #include "gnunet-service-nat_externalip.h" | ||
48 | #include "gnunet-service-nat_stun.h" | 47 | #include "gnunet-service-nat_stun.h" |
49 | #include "gnunet-service-nat_mini.h" | 48 | #include "gnunet-service-nat_mini.h" |
50 | #include "gnunet-service-nat_helper.h" | 49 | #include "gnunet-service-nat_helper.h" |
@@ -64,26 +63,13 @@ | |||
64 | #define AUTOCONFIG_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | 63 | #define AUTOCONFIG_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
65 | 64 | ||
66 | /** | 65 | /** |
67 | * How long do we wait until we re-try running `external-ip` if the | 66 | * How often do we scan for changes in how our external (dyndns) hostname resolves? |
68 | * command failed to terminate nicely? | ||
69 | */ | 67 | */ |
70 | #define EXTERN_IP_RETRY_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | 68 | #define DYNDNS_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 7) |
71 | 69 | ||
72 | /** | ||
73 | * How long do we wait until we re-try running `external-ip` if the | ||
74 | * command failed (but terminated)? | ||
75 | */ | ||
76 | #define EXTERN_IP_RETRY_FAILURE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30) | ||
77 | 70 | ||
78 | /** | 71 | /** |
79 | * How long do we wait until we re-try running `external-ip` if the | 72 | * Information we track per client address. |
80 | * command succeeded? | ||
81 | */ | ||
82 | #define EXTERN_IP_RETRY_SUCCESS GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
83 | |||
84 | |||
85 | /** | ||
86 | * Information we track per client address. | ||
87 | */ | 73 | */ |
88 | struct ClientAddress | 74 | struct ClientAddress |
89 | { | 75 | { |
@@ -98,7 +84,54 @@ struct ClientAddress | |||
98 | * pending. | 84 | * pending. |
99 | */ | 85 | */ |
100 | struct GNUNET_NAT_MiniHandle *mh; | 86 | struct GNUNET_NAT_MiniHandle *mh; |
101 | 87 | ||
88 | }; | ||
89 | |||
90 | |||
91 | /** | ||
92 | * List of local addresses this system has. | ||
93 | */ | ||
94 | struct LocalAddressList | ||
95 | { | ||
96 | /** | ||
97 | * This is a linked list. | ||
98 | */ | ||
99 | struct LocalAddressList *next; | ||
100 | |||
101 | /** | ||
102 | * Previous entry. | ||
103 | */ | ||
104 | struct LocalAddressList *prev; | ||
105 | |||
106 | /** | ||
107 | * Context for a gnunet-helper-nat-server used to listen | ||
108 | * for ICMP messages to this client for connection reversal. | ||
109 | */ | ||
110 | struct HelperContext *hc; | ||
111 | |||
112 | /** | ||
113 | * The address itself (i.e. `struct sockaddr_in` or `struct | ||
114 | * sockaddr_in6`, in the respective byte order). | ||
115 | */ | ||
116 | struct sockaddr_storage addr; | ||
117 | |||
118 | /** | ||
119 | * Address family. (FIXME: redundant, addr.ss_family! Remove!?) | ||
120 | */ | ||
121 | int af; | ||
122 | |||
123 | /** | ||
124 | * #GNUNET_YES if we saw this one in the previous iteration, | ||
125 | * but not in the current iteration and thus might need to | ||
126 | * remove it at the end. | ||
127 | */ | ||
128 | int old; | ||
129 | |||
130 | /** | ||
131 | * What type of address is this? | ||
132 | */ | ||
133 | enum GNUNET_NAT_AddressClass ac; | ||
134 | |||
102 | }; | 135 | }; |
103 | 136 | ||
104 | 137 | ||
@@ -112,7 +145,7 @@ struct ClientHandle | |||
112 | * Kept in a DLL. | 145 | * Kept in a DLL. |
113 | */ | 146 | */ |
114 | struct ClientHandle *next; | 147 | struct ClientHandle *next; |
115 | 148 | ||
116 | /** | 149 | /** |
117 | * Kept in a DLL. | 150 | * Kept in a DLL. |
118 | */ | 151 | */ |
@@ -120,7 +153,7 @@ struct ClientHandle | |||
120 | 153 | ||
121 | /** | 154 | /** |
122 | * Underlying handle for this client with the service. | 155 | * Underlying handle for this client with the service. |
123 | */ | 156 | */ |
124 | struct GNUNET_SERVICE_Client *client; | 157 | struct GNUNET_SERVICE_Client *client; |
125 | 158 | ||
126 | /** | 159 | /** |
@@ -136,74 +169,70 @@ struct ClientHandle | |||
136 | /** | 169 | /** |
137 | * External DNS name and port given by user due to manual | 170 | * External DNS name and port given by user due to manual |
138 | * hole punching. Special DNS name 'AUTO' is used to indicate | 171 | * hole punching. Special DNS name 'AUTO' is used to indicate |
139 | * desire for automatic determination of the external IP | 172 | * desire for automatic determination of the external IP |
140 | * (instead of DNS or manual configuration, i.e. to be used | 173 | * (instead of DNS or manual configuration, i.e. to be used |
141 | * if the IP keeps changing and we have no DynDNS, but we do | 174 | * if the IP keeps changing and we have no DynDNS, but we do |
142 | * have a hole punched). | 175 | * have a hole punched). |
143 | */ | 176 | */ |
144 | char *hole_external; | 177 | char *hole_external; |
145 | 178 | ||
146 | /** | 179 | /** |
147 | * What does this client care about? | 180 | * Name of the configuration section this client cares about. |
148 | */ | 181 | */ |
149 | enum GNUNET_NAT_RegisterFlags flags; | 182 | char *section_name; |
150 | 183 | ||
151 | /** | 184 | /** |
152 | * Is any of the @e caddrs in a reserved subnet for NAT? | 185 | * Task for periodically re-running the @e ext_dns DNS lookup. |
153 | */ | 186 | */ |
154 | int natted_address; | 187 | struct GNUNET_SCHEDULER_Task *ext_dns_task; |
155 | 188 | ||
156 | /** | 189 | /** |
157 | * Number of addresses that this service is bound to. | 190 | * Handle for (DYN)DNS lookup of our external IP as given in |
158 | * Length of the @e caddrs array. | 191 | * @e hole_external. |
159 | */ | 192 | */ |
160 | uint16_t num_caddrs; | 193 | struct GNUNET_RESOLVER_RequestHandle *ext_dns; |
161 | 194 | ||
162 | /** | 195 | /** |
163 | * Client's IPPROTO, e.g. IPPROTO_UDP or IPPROTO_TCP. | 196 | * Handle for monitoring external IP changes. |
164 | */ | 197 | */ |
165 | uint8_t proto; | 198 | struct GN_ExternalIPMonitor *external_monitor; |
166 | |||
167 | }; | ||
168 | 199 | ||
200 | /** | ||
201 | * DLL of external IP addresses as given in @e hole_external. | ||
202 | */ | ||
203 | struct LocalAddressList *ext_addr_head; | ||
169 | 204 | ||
170 | /** | ||
171 | * List of local addresses this system has. | ||
172 | */ | ||
173 | struct LocalAddressList | ||
174 | { | ||
175 | /** | 205 | /** |
176 | * This is a linked list. | 206 | * DLL of external IP addresses as given in @e hole_external. |
177 | */ | 207 | */ |
178 | struct LocalAddressList *next; | 208 | struct LocalAddressList *ext_addr_tail; |
179 | 209 | ||
180 | /** | 210 | /** |
181 | * Previous entry. | 211 | * Port number we found in @e hole_external. |
182 | */ | 212 | */ |
183 | struct LocalAddressList *prev; | 213 | uint16_t ext_dns_port; |
184 | 214 | ||
185 | /** | 215 | /** |
186 | * Context for a gnunet-helper-nat-server used to listen | 216 | * What does this client care about? |
187 | * for ICMP messages to this client for connection reversal. | ||
188 | */ | 217 | */ |
189 | struct HelperContext *hc; | 218 | enum GNUNET_NAT_RegisterFlags flags; |
190 | 219 | ||
191 | /** | 220 | /** |
192 | * The address itself (i.e. `struct sockaddr_in` or `struct | 221 | * Is any of the @e caddrs in a reserved subnet for NAT? |
193 | * sockaddr_in6`, in the respective byte order). | ||
194 | */ | 222 | */ |
195 | struct sockaddr_storage addr; | 223 | int natted_address; |
196 | 224 | ||
197 | /** | 225 | /** |
198 | * Address family. | 226 | * Number of addresses that this service is bound to. |
227 | * Length of the @e caddrs array. | ||
199 | */ | 228 | */ |
200 | int af; | 229 | uint16_t num_caddrs; |
201 | 230 | ||
202 | /** | 231 | /** |
203 | * What type of address is this? | 232 | * Client's IPPROTO, e.g. IPPROTO_UDP or IPPROTO_TCP. |
204 | */ | 233 | */ |
205 | enum GNUNET_NAT_AddressClass ac; | 234 | uint8_t proto; |
206 | 235 | ||
207 | }; | 236 | }; |
208 | 237 | ||
209 | 238 | ||
@@ -214,12 +243,12 @@ struct StunExternalIP | |||
214 | { | 243 | { |
215 | /** | 244 | /** |
216 | * Kept in a DLL. | 245 | * Kept in a DLL. |
217 | */ | 246 | */ |
218 | struct StunExternalIP *next; | 247 | struct StunExternalIP *next; |
219 | 248 | ||
220 | /** | 249 | /** |
221 | * Kept in a DLL. | 250 | * Kept in a DLL. |
222 | */ | 251 | */ |
223 | struct StunExternalIP *prev; | 252 | struct StunExternalIP *prev; |
224 | 253 | ||
225 | /** | 254 | /** |
@@ -228,13 +257,13 @@ struct StunExternalIP | |||
228 | struct GNUNET_SCHEDULER_Task *timeout_task; | 257 | struct GNUNET_SCHEDULER_Task *timeout_task; |
229 | 258 | ||
230 | /** | 259 | /** |
231 | * Our external IP address as reported by the | 260 | * Our external IP address as reported by the |
232 | * STUN server. | 261 | * STUN server. |
233 | */ | 262 | */ |
234 | struct sockaddr_in external_addr; | 263 | struct sockaddr_in external_addr; |
235 | 264 | ||
236 | /** | 265 | /** |
237 | * Address of the reporting STUN server. Used to | 266 | * Address of the reporting STUN server. Used to |
238 | * detect when a STUN server changes its opinion | 267 | * detect when a STUN server changes its opinion |
239 | * to more quickly remove stale results. | 268 | * to more quickly remove stale results. |
240 | */ | 269 | */ |
@@ -248,83 +277,14 @@ struct StunExternalIP | |||
248 | 277 | ||
249 | 278 | ||
250 | /** | 279 | /** |
251 | * Context for autoconfiguration operations. | 280 | * Timeout to use when STUN data is considered stale. |
252 | */ | ||
253 | struct AutoconfigContext | ||
254 | { | ||
255 | /** | ||
256 | * Kept in a DLL. | ||
257 | */ | ||
258 | struct AutoconfigContext *prev; | ||
259 | |||
260 | /** | ||
261 | * Kept in a DLL. | ||
262 | */ | ||
263 | struct AutoconfigContext *next; | ||
264 | |||
265 | /** | ||
266 | * Which client asked the question. | ||
267 | */ | ||
268 | struct ClientHandle *ch; | ||
269 | |||
270 | /** | ||
271 | * Configuration we are creating. | ||
272 | */ | ||
273 | struct GNUNET_CONFIGURATION_Handle *c; | ||
274 | |||
275 | /** | ||
276 | * Original configuration (for diffing). | ||
277 | */ | ||
278 | struct GNUNET_CONFIGURATION_Handle *orig; | ||
279 | |||
280 | /** | ||
281 | * Timeout task to force termination. | ||
282 | */ | ||
283 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
284 | |||
285 | /** | ||
286 | * What type of system are we on? | ||
287 | */ | ||
288 | char *system_type; | ||
289 | |||
290 | /** | ||
291 | * Handle to activity to probe for our external IP. | ||
292 | */ | ||
293 | struct GNUNET_NAT_ExternalHandle *probe_external; | ||
294 | |||
295 | /** | ||
296 | * #GNUNET_YES if upnpc should be used, | ||
297 | * #GNUNET_NO if upnpc should not be used, | ||
298 | * #GNUNET_SYSERR if we should simply not change the option. | ||
299 | */ | ||
300 | int enable_upnpc; | ||
301 | |||
302 | /** | ||
303 | * Status code to return to the client. | ||
304 | */ | ||
305 | enum GNUNET_NAT_StatusCode status_code; | ||
306 | |||
307 | /** | ||
308 | * NAT type to return to the client. | ||
309 | */ | ||
310 | enum GNUNET_NAT_Type type; | ||
311 | }; | ||
312 | |||
313 | |||
314 | /** | ||
315 | * DLL of our autoconfiguration operations. | ||
316 | */ | ||
317 | static struct AutoconfigContext *ac_head; | ||
318 | |||
319 | /** | ||
320 | * DLL of our autoconfiguration operations. | ||
321 | */ | 281 | */ |
322 | static struct AutoconfigContext *ac_tail; | 282 | static struct GNUNET_TIME_Relative stun_stale_timeout; |
323 | 283 | ||
324 | /** | 284 | /** |
325 | * Timeout to use when STUN data is considered stale. | 285 | * How often do we scan for changes in how our external (dyndns) hostname resolves? |
326 | */ | 286 | */ |
327 | static struct GNUNET_TIME_Relative stun_stale_timeout; | 287 | static struct GNUNET_TIME_Relative dyndns_frequency; |
328 | 288 | ||
329 | /** | 289 | /** |
330 | * Handle to our current configuration. | 290 | * Handle to our current configuration. |
@@ -345,7 +305,7 @@ static struct GNUNET_SCHEDULER_Task *scan_task; | |||
345 | * Head of client DLL. | 305 | * Head of client DLL. |
346 | */ | 306 | */ |
347 | static struct ClientHandle *ch_head; | 307 | static struct ClientHandle *ch_head; |
348 | 308 | ||
349 | /** | 309 | /** |
350 | * Tail of client DLL. | 310 | * Tail of client DLL. |
351 | */ | 311 | */ |
@@ -363,36 +323,19 @@ static struct LocalAddressList *lal_tail; | |||
363 | 323 | ||
364 | /** | 324 | /** |
365 | * Kept in a DLL. | 325 | * Kept in a DLL. |
366 | */ | 326 | */ |
367 | static struct StunExternalIP *se_head; | 327 | static struct StunExternalIP *se_head; |
368 | 328 | ||
369 | /** | 329 | /** |
370 | * Kept in a DLL. | 330 | * Kept in a DLL. |
371 | */ | 331 | */ |
372 | static struct StunExternalIP *se_tail; | 332 | static struct StunExternalIP *se_tail; |
373 | 333 | ||
374 | /** | 334 | /** |
375 | * Is UPnP enabled? #GNUNET_YES if enabled, #GNUNET_NO if disabled, | 335 | * Is UPnP enabled? #GNUNET_YES if enabled, #GNUNET_NO if disabled, |
376 | * #GNUNET_SYSERR if configuration enabled but binary is unavailable. | 336 | * #GNUNET_SYSERR if configuration enabled but binary is unavailable. |
377 | */ | 337 | */ |
378 | static int enable_upnp; | 338 | int enable_upnp; |
379 | |||
380 | /** | ||
381 | * Task run to obtain our external IP (if #enable_upnp is set | ||
382 | * and if we find we have a NATed IP address). | ||
383 | */ | ||
384 | static struct GNUNET_SCHEDULER_Task *probe_external_ip_task; | ||
385 | |||
386 | /** | ||
387 | * Handle to our operation to run `external-ip`. | ||
388 | */ | ||
389 | static struct GNUNET_NAT_ExternalHandle *probe_external_ip_op; | ||
390 | |||
391 | /** | ||
392 | * What is our external IP address as claimed by `external-ip`? | ||
393 | * 0 for unknown. | ||
394 | */ | ||
395 | static struct in_addr mini_external_ipv4; | ||
396 | 339 | ||
397 | 340 | ||
398 | /** | 341 | /** |
@@ -422,7 +365,7 @@ free_lal (struct LocalAddressList *lal) | |||
422 | 365 | ||
423 | /** | 366 | /** |
424 | * Free the DLL starting at #lal_head. | 367 | * Free the DLL starting at #lal_head. |
425 | */ | 368 | */ |
426 | static void | 369 | static void |
427 | destroy_lal () | 370 | destroy_lal () |
428 | { | 371 | { |
@@ -474,22 +417,22 @@ check_register (void *cls, | |||
474 | #endif | 417 | #endif |
475 | default: | 418 | default: |
476 | GNUNET_break (0); | 419 | GNUNET_break (0); |
477 | return GNUNET_SYSERR; | 420 | return GNUNET_SYSERR; |
478 | } | 421 | } |
479 | if (alen > left) | 422 | if (alen > left) |
480 | { | 423 | { |
481 | GNUNET_break (0); | 424 | GNUNET_break (0); |
482 | return GNUNET_SYSERR; | 425 | return GNUNET_SYSERR; |
483 | } | 426 | } |
484 | off += alen; | 427 | off += alen; |
485 | left -= alen; | 428 | left -= alen; |
486 | } | 429 | } |
487 | if (left != ntohs (message->hole_external_len)) | 430 | if (left != ntohs (message->str_len)) |
488 | { | 431 | { |
489 | GNUNET_break (0); | 432 | GNUNET_break (0); |
490 | return GNUNET_SYSERR; | 433 | return GNUNET_SYSERR; |
491 | } | 434 | } |
492 | return GNUNET_OK; | 435 | return GNUNET_OK; |
493 | } | 436 | } |
494 | 437 | ||
495 | 438 | ||
@@ -535,7 +478,7 @@ match_ipv6 (const char *network, | |||
535 | struct in6_addr net; | 478 | struct in6_addr net; |
536 | struct in6_addr mask; | 479 | struct in6_addr mask; |
537 | unsigned int off; | 480 | unsigned int off; |
538 | 481 | ||
539 | if (0 == bits) | 482 | if (0 == bits) |
540 | return GNUNET_YES; | 483 | return GNUNET_YES; |
541 | GNUNET_assert (1 == inet_pton (AF_INET6, | 484 | GNUNET_assert (1 == inet_pton (AF_INET6, |
@@ -607,7 +550,7 @@ is_nat_v6 (const struct in6_addr *ip) | |||
607 | struct IfcProcContext | 550 | struct IfcProcContext |
608 | { | 551 | { |
609 | 552 | ||
610 | /** | 553 | /** |
611 | * Head of DLL of local addresses. | 554 | * Head of DLL of local addresses. |
612 | */ | 555 | */ |
613 | struct LocalAddressList *lal_head; | 556 | struct LocalAddressList *lal_head; |
@@ -718,7 +661,7 @@ notify_client (enum GNUNET_NAT_AddressClass ac, | |||
718 | { | 661 | { |
719 | struct GNUNET_MQ_Envelope *env; | 662 | struct GNUNET_MQ_Envelope *env; |
720 | struct GNUNET_NAT_AddressChangeNotificationMessage *msg; | 663 | struct GNUNET_NAT_AddressChangeNotificationMessage *msg; |
721 | 664 | ||
722 | env = GNUNET_MQ_msg_extra (msg, | 665 | env = GNUNET_MQ_msg_extra (msg, |
723 | addr_len, | 666 | addr_len, |
724 | GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE); | 667 | GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE); |
@@ -729,7 +672,7 @@ notify_client (enum GNUNET_NAT_AddressClass ac, | |||
729 | addr_len); | 672 | addr_len); |
730 | GNUNET_MQ_send (ch->mq, | 673 | GNUNET_MQ_send (ch->mq, |
731 | env); | 674 | env); |
732 | } | 675 | } |
733 | 676 | ||
734 | 677 | ||
735 | /** | 678 | /** |
@@ -748,7 +691,7 @@ check_notify_client (struct LocalAddressList *delta, | |||
748 | size_t alen; | 691 | size_t alen; |
749 | struct sockaddr_in v4; | 692 | struct sockaddr_in v4; |
750 | struct sockaddr_in6 v6; | 693 | struct sockaddr_in6 v6; |
751 | 694 | ||
752 | if (0 == (ch->flags & GNUNET_NAT_RF_ADDRESSES)) | 695 | if (0 == (ch->flags & GNUNET_NAT_RF_ADDRESSES)) |
753 | return; | 696 | return; |
754 | switch (delta->af) | 697 | switch (delta->af) |
@@ -758,14 +701,14 @@ check_notify_client (struct LocalAddressList *delta, | |||
758 | GNUNET_memcpy (&v4, | 701 | GNUNET_memcpy (&v4, |
759 | &delta->addr, | 702 | &delta->addr, |
760 | alen); | 703 | alen); |
761 | 704 | ||
762 | /* Check for client notifications */ | 705 | /* Check for client notifications */ |
763 | for (unsigned int i=0;i<ch->num_caddrs;i++) | 706 | for (unsigned int i=0;i<ch->num_caddrs;i++) |
764 | { | 707 | { |
765 | const struct sockaddr_in *c4; | 708 | const struct sockaddr_in *c4; |
766 | 709 | ||
767 | if (AF_INET != ch->caddrs[i].ss.ss_family) | 710 | if (AF_INET != ch->caddrs[i].ss.ss_family) |
768 | return; /* IPv4 not relevant */ | 711 | continue; /* IPv4 not relevant */ |
769 | c4 = (const struct sockaddr_in *) &ch->caddrs[i].ss; | 712 | c4 = (const struct sockaddr_in *) &ch->caddrs[i].ss; |
770 | if ( match_ipv4 ("127.0.0.1", &c4->sin_addr, 8) && | 713 | if ( match_ipv4 ("127.0.0.1", &c4->sin_addr, 8) && |
771 | (0 != c4->sin_addr.s_addr) && | 714 | (0 != c4->sin_addr.s_addr) && |
@@ -806,9 +749,9 @@ check_notify_client (struct LocalAddressList *delta, | |||
806 | for (unsigned int i=0;i<ch->num_caddrs;i++) | 749 | for (unsigned int i=0;i<ch->num_caddrs;i++) |
807 | { | 750 | { |
808 | const struct sockaddr_in6 *c6; | 751 | const struct sockaddr_in6 *c6; |
809 | 752 | ||
810 | if (AF_INET6 != ch->caddrs[i].ss.ss_family) | 753 | if (AF_INET6 != ch->caddrs[i].ss.ss_family) |
811 | return; /* IPv4 not relevant */ | 754 | continue; /* IPv4 not relevant */ |
812 | c6 = (const struct sockaddr_in6 *) &ch->caddrs[i].ss; | 755 | c6 = (const struct sockaddr_in6 *) &ch->caddrs[i].ss; |
813 | if ( match_ipv6 ("::1", &c6->sin6_addr, 128) && | 756 | if ( match_ipv6 ("::1", &c6->sin6_addr, 128) && |
814 | (0 != memcmp (&c6->sin6_addr, | 757 | (0 != memcmp (&c6->sin6_addr, |
@@ -888,19 +831,40 @@ notify_clients (struct LocalAddressList *delta, | |||
888 | /** | 831 | /** |
889 | * Tell relevant client about a change in our external | 832 | * Tell relevant client about a change in our external |
890 | * IPv4 address. | 833 | * IPv4 address. |
891 | * | 834 | * |
835 | * @param cls client to check if it cares and possibly notify | ||
892 | * @param v4 the external address that changed | 836 | * @param v4 the external address that changed |
893 | * @param ch client to check if it cares and possibly notify | ||
894 | * @param add #GNUNET_YES to add, #GNUNET_NO to remove | 837 | * @param add #GNUNET_YES to add, #GNUNET_NO to remove |
895 | */ | 838 | */ |
896 | static void | 839 | static void |
897 | check_notify_client_external_ipv4_change (const struct in_addr *v4, | 840 | notify_client_external_ipv4_change (void *cls, |
898 | struct ClientHandle *ch, | 841 | const struct in_addr *v4, |
899 | int add) | 842 | int add) |
900 | { | 843 | { |
844 | struct ClientHandle *ch = cls; | ||
901 | struct sockaddr_in sa; | 845 | struct sockaddr_in sa; |
902 | int have_v4; | 846 | int have_v4; |
903 | 847 | ||
848 | /* (0) check if this impacts 'hole_external' */ | ||
849 | if ( (NULL != ch->hole_external) && | ||
850 | (0 == strcasecmp (ch->hole_external, | ||
851 | "AUTO")) ) | ||
852 | { | ||
853 | struct LocalAddressList lal; | ||
854 | struct sockaddr_in *s4; | ||
855 | |||
856 | memset (&lal, 0, sizeof (lal)); | ||
857 | s4 = (struct sockaddr_in *) &lal.addr; | ||
858 | s4->sin_family = AF_INET; | ||
859 | s4->sin_port = htons (ch->ext_dns_port); | ||
860 | s4->sin_addr = *v4; | ||
861 | lal.af = AF_INET; | ||
862 | lal.ac = GNUNET_NAT_AC_GLOBAL | GNUNET_NAT_AC_MANUAL; | ||
863 | check_notify_client (&lal, | ||
864 | ch, | ||
865 | add); | ||
866 | } | ||
867 | |||
904 | /* (1) check if client cares. */ | 868 | /* (1) check if client cares. */ |
905 | if (! ch->natted_address) | 869 | if (! ch->natted_address) |
906 | return; | 870 | return; |
@@ -919,17 +883,17 @@ check_notify_client_external_ipv4_change (const struct in_addr *v4, | |||
919 | if (GNUNET_NO == have_v4) | 883 | if (GNUNET_NO == have_v4) |
920 | return; /* IPv6-only */ | 884 | return; /* IPv6-only */ |
921 | 885 | ||
922 | /* build address info */ | 886 | /* (2) build address info */ |
923 | memset (&sa, | 887 | memset (&sa, |
924 | 0, | 888 | 0, |
925 | sizeof (sa)); | 889 | sizeof (sa)); |
926 | sa.sin_family = AF_INET; | 890 | sa.sin_family = AF_INET; |
927 | sa.sin_addr = *v4; | 891 | sa.sin_addr = *v4; |
928 | sa.sin_port = htons (0); | 892 | sa.sin_port = htons (0); |
929 | 893 | ||
930 | /* (3) notify client of change */ | 894 | /* (3) notify client of change */ |
931 | notify_client (is_nat_v4 (v4) | 895 | notify_client (is_nat_v4 (v4) |
932 | ? GNUNET_NAT_AC_EXTERN | GNUNET_NAT_AC_LAN | 896 | ? GNUNET_NAT_AC_EXTERN | GNUNET_NAT_AC_LAN |
933 | : GNUNET_NAT_AC_EXTERN | GNUNET_NAT_AC_GLOBAL, | 897 | : GNUNET_NAT_AC_EXTERN | GNUNET_NAT_AC_GLOBAL, |
934 | ch, | 898 | ch, |
935 | add, | 899 | add, |
@@ -939,117 +903,11 @@ check_notify_client_external_ipv4_change (const struct in_addr *v4, | |||
939 | 903 | ||
940 | 904 | ||
941 | /** | 905 | /** |
942 | * Tell relevant clients about a change in our external | ||
943 | * IPv4 address. | ||
944 | * | ||
945 | * @param add #GNUNET_YES to add, #GNUNET_NO to remove | ||
946 | * @param v4 the external address that changed | ||
947 | */ | ||
948 | static void | ||
949 | notify_clients_external_ipv4_change (int add, | ||
950 | const struct in_addr *v4) | ||
951 | { | ||
952 | for (struct ClientHandle *ch = ch_head; | ||
953 | NULL != ch; | ||
954 | ch = ch->next) | ||
955 | check_notify_client_external_ipv4_change (v4, | ||
956 | ch, | ||
957 | add); | ||
958 | } | ||
959 | |||
960 | |||
961 | /** | ||
962 | * Task used to run `external-ip` to get our external IPv4 | ||
963 | * address and pass it to NATed clients if possible. | ||
964 | * | ||
965 | * @param cls NULL | ||
966 | */ | ||
967 | static void | ||
968 | run_external_ip (void *cls); | ||
969 | |||
970 | |||
971 | /** | ||
972 | * We learn our current external IP address. If it changed, | ||
973 | * notify all of our applicable clients. Also re-schedule | ||
974 | * #run_external_ip with an appropriate timeout. | ||
975 | * | ||
976 | * @param cls NULL | ||
977 | * @param addr the address, NULL on errors | ||
978 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
979 | */ | ||
980 | static void | ||
981 | handle_external_ip (void *cls, | ||
982 | const struct in_addr *addr, | ||
983 | enum GNUNET_NAT_StatusCode result) | ||
984 | { | ||
985 | char buf[INET_ADDRSTRLEN]; | ||
986 | |||
987 | probe_external_ip_op = NULL; | ||
988 | GNUNET_SCHEDULER_cancel (probe_external_ip_task); | ||
989 | probe_external_ip_task | ||
990 | = GNUNET_SCHEDULER_add_delayed ((NULL == addr) | ||
991 | ? EXTERN_IP_RETRY_FAILURE | ||
992 | : EXTERN_IP_RETRY_SUCCESS, | ||
993 | &run_external_ip, | ||
994 | NULL); | ||
995 | switch (result) | ||
996 | { | ||
997 | case GNUNET_NAT_ERROR_SUCCESS: | ||
998 | if (addr->s_addr == mini_external_ipv4.s_addr) | ||
999 | return; /* not change */ | ||
1000 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1001 | "Our external IP is now %s\n", | ||
1002 | inet_ntop (AF_INET, | ||
1003 | addr, | ||
1004 | buf, | ||
1005 | sizeof (buf))); | ||
1006 | if (0 != mini_external_ipv4.s_addr) | ||
1007 | notify_clients_external_ipv4_change (GNUNET_NO, | ||
1008 | &mini_external_ipv4); | ||
1009 | mini_external_ipv4 = *addr; | ||
1010 | notify_clients_external_ipv4_change (GNUNET_YES, | ||
1011 | &mini_external_ipv4); | ||
1012 | break; | ||
1013 | default: | ||
1014 | if (0 != mini_external_ipv4.s_addr) | ||
1015 | notify_clients_external_ipv4_change (GNUNET_NO, | ||
1016 | &mini_external_ipv4); | ||
1017 | mini_external_ipv4.s_addr = 0; | ||
1018 | break; | ||
1019 | } | ||
1020 | } | ||
1021 | |||
1022 | |||
1023 | /** | ||
1024 | * Task used to run `external-ip` to get our external IPv4 | ||
1025 | * address and pass it to NATed clients if possible. | ||
1026 | * | ||
1027 | * @param cls NULL | ||
1028 | */ | ||
1029 | static void | ||
1030 | run_external_ip (void *cls) | ||
1031 | { | ||
1032 | probe_external_ip_task | ||
1033 | = GNUNET_SCHEDULER_add_delayed (EXTERN_IP_RETRY_TIMEOUT, | ||
1034 | &run_external_ip, | ||
1035 | NULL); | ||
1036 | if (NULL != probe_external_ip_op) | ||
1037 | { | ||
1038 | GNUNET_NAT_mini_get_external_ipv4_cancel_ (probe_external_ip_op); | ||
1039 | probe_external_ip_op = NULL; | ||
1040 | } | ||
1041 | probe_external_ip_op | ||
1042 | = GNUNET_NAT_mini_get_external_ipv4_ (&handle_external_ip, | ||
1043 | NULL); | ||
1044 | } | ||
1045 | |||
1046 | |||
1047 | /** | ||
1048 | * We got a connection reversal request from another peer. | 906 | * We got a connection reversal request from another peer. |
1049 | * Notify applicable clients. | 907 | * Notify applicable clients. |
1050 | * | 908 | * |
1051 | * @param cls closure with the `struct LocalAddressList` | 909 | * @param cls closure with the `struct LocalAddressList` |
1052 | * @param ra IP address of the peer who wants us to connect to it | 910 | * @param ra IP address of the peer who wants us to connect to it |
1053 | */ | 911 | */ |
1054 | static void | 912 | static void |
1055 | reversal_callback (void *cls, | 913 | reversal_callback (void *cls, |
@@ -1063,7 +921,7 @@ reversal_callback (void *cls, | |||
1063 | for (struct ClientHandle *ch = ch_head; | 921 | for (struct ClientHandle *ch = ch_head; |
1064 | NULL != ch; | 922 | NULL != ch; |
1065 | ch = ch->next) | 923 | ch = ch->next) |
1066 | { | 924 | { |
1067 | struct GNUNET_NAT_ConnectionReversalRequestedMessage *crrm; | 925 | struct GNUNET_NAT_ConnectionReversalRequestedMessage *crrm; |
1068 | struct GNUNET_MQ_Envelope *env; | 926 | struct GNUNET_MQ_Envelope *env; |
1069 | int match; | 927 | int match; |
@@ -1077,7 +935,7 @@ reversal_callback (void *cls, | |||
1077 | { | 935 | { |
1078 | struct ClientAddress *ca = &ch->caddrs[i]; | 936 | struct ClientAddress *ca = &ch->caddrs[i]; |
1079 | const struct sockaddr_in *c4; | 937 | const struct sockaddr_in *c4; |
1080 | 938 | ||
1081 | if (AF_INET != ca->ss.ss_family) | 939 | if (AF_INET != ca->ss.ss_family) |
1082 | continue; | 940 | continue; |
1083 | c4 = (const struct sockaddr_in *) &ca->ss; | 941 | c4 = (const struct sockaddr_in *) &ca->ss; |
@@ -1107,7 +965,7 @@ reversal_callback (void *cls, | |||
1107 | * Task we run periodically to scan for network interfaces. | 965 | * Task we run periodically to scan for network interfaces. |
1108 | * | 966 | * |
1109 | * @param cls NULL | 967 | * @param cls NULL |
1110 | */ | 968 | */ |
1111 | static void | 969 | static void |
1112 | run_scan (void *cls) | 970 | run_scan (void *cls) |
1113 | { | 971 | { |
@@ -1115,7 +973,7 @@ run_scan (void *cls) | |||
1115 | int found; | 973 | int found; |
1116 | int have_nat; | 974 | int have_nat; |
1117 | struct LocalAddressList *lnext; | 975 | struct LocalAddressList *lnext; |
1118 | 976 | ||
1119 | scan_task = GNUNET_SCHEDULER_add_delayed (SCAN_FREQ, | 977 | scan_task = GNUNET_SCHEDULER_add_delayed (SCAN_FREQ, |
1120 | &run_scan, | 978 | &run_scan, |
1121 | NULL); | 979 | NULL); |
@@ -1194,8 +1052,8 @@ run_scan (void *cls) | |||
1194 | { | 1052 | { |
1195 | const struct sockaddr_in *s4 | 1053 | const struct sockaddr_in *s4 |
1196 | = (const struct sockaddr_in *) &pos->addr; | 1054 | = (const struct sockaddr_in *) &pos->addr; |
1197 | 1055 | ||
1198 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 1056 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1199 | "Found NATed local address %s, starting NAT server\n", | 1057 | "Found NATed local address %s, starting NAT server\n", |
1200 | GNUNET_a2s ((void *) &pos->addr, sizeof (*s4))); | 1058 | GNUNET_a2s ((void *) &pos->addr, sizeof (*s4))); |
1201 | pos->hc = GN_start_gnunet_nat_server_ (&s4->sin_addr, | 1059 | pos->hc = GN_start_gnunet_nat_server_ (&s4->sin_addr, |
@@ -1204,29 +1062,7 @@ run_scan (void *cls) | |||
1204 | } | 1062 | } |
1205 | } | 1063 | } |
1206 | } | 1064 | } |
1207 | if ( (GNUNET_YES == have_nat) && | 1065 | GN_nat_status_changed (have_nat); |
1208 | (GNUNET_YES == enable_upnp) && | ||
1209 | (NULL == probe_external_ip_task) && | ||
1210 | (NULL == probe_external_ip_op) ) | ||
1211 | { | ||
1212 | probe_external_ip_task | ||
1213 | = GNUNET_SCHEDULER_add_now (&run_external_ip, | ||
1214 | NULL); | ||
1215 | } | ||
1216 | if ( (GNUNET_NO == have_nat) && | ||
1217 | (GNUNET_YES == enable_upnp) ) | ||
1218 | { | ||
1219 | if (NULL != probe_external_ip_task) | ||
1220 | { | ||
1221 | GNUNET_SCHEDULER_cancel (probe_external_ip_task); | ||
1222 | probe_external_ip_task = NULL; | ||
1223 | } | ||
1224 | if (NULL != probe_external_ip_op) | ||
1225 | { | ||
1226 | GNUNET_NAT_mini_get_external_ipv4_cancel_ (probe_external_ip_op); | ||
1227 | probe_external_ip_op = NULL; | ||
1228 | } | ||
1229 | } | ||
1230 | } | 1066 | } |
1231 | 1067 | ||
1232 | 1068 | ||
@@ -1267,6 +1103,10 @@ upnp_addr_change_cb (void *cls, | |||
1267 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1103 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1268 | "external-ip binary not found\n"); | 1104 | "external-ip binary not found\n"); |
1269 | return; | 1105 | return; |
1106 | case GNUNET_NAT_ERROR_UPNPC_NOT_FOUND: | ||
1107 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1108 | "upnpc binary not found\n"); | ||
1109 | return; | ||
1270 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED: | 1110 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED: |
1271 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1111 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1272 | "external-ip binary could not be run\n"); | 1112 | "external-ip binary could not be run\n"); |
@@ -1317,6 +1157,250 @@ upnp_addr_change_cb (void *cls, | |||
1317 | 1157 | ||
1318 | 1158 | ||
1319 | /** | 1159 | /** |
1160 | * Resolve the `hole_external` name to figure out our | ||
1161 | * external address from a manually punched hole. The | ||
1162 | * port number has already been parsed, this task is | ||
1163 | * responsible for periodically doing a DNS lookup. | ||
1164 | * | ||
1165 | * @param ch client handle to act upon | ||
1166 | */ | ||
1167 | static void | ||
1168 | dyndns_lookup (void *cls); | ||
1169 | |||
1170 | |||
1171 | /** | ||
1172 | * Our (external) hostname was resolved. Update lists of | ||
1173 | * current external IPs (note that DNS may return multiple | ||
1174 | * addresses!) and notify client accordingly. | ||
1175 | * | ||
1176 | * @param cls the `struct ClientHandle` | ||
1177 | * @param addr NULL on error, otherwise result of DNS lookup | ||
1178 | * @param addrlen number of bytes in @a addr | ||
1179 | */ | ||
1180 | static void | ||
1181 | process_external_ip (void *cls, | ||
1182 | const struct sockaddr *addr, | ||
1183 | socklen_t addrlen) | ||
1184 | { | ||
1185 | struct ClientHandle *ch = cls; | ||
1186 | struct LocalAddressList *lal; | ||
1187 | struct sockaddr_storage ss; | ||
1188 | struct sockaddr_in *v4; | ||
1189 | struct sockaddr_in6 *v6; | ||
1190 | |||
1191 | if (NULL == addr) | ||
1192 | { | ||
1193 | struct LocalAddressList *laln; | ||
1194 | |||
1195 | ch->ext_dns = NULL; | ||
1196 | ch->ext_dns_task | ||
1197 | = GNUNET_SCHEDULER_add_delayed (dyndns_frequency, | ||
1198 | &dyndns_lookup, | ||
1199 | ch); | ||
1200 | /* Current iteration is over, remove 'old' IPs now */ | ||
1201 | for (lal = ch->ext_addr_head; NULL != lal; lal = laln) | ||
1202 | { | ||
1203 | laln = lal->next; | ||
1204 | if (GNUNET_YES == lal->old) | ||
1205 | { | ||
1206 | GNUNET_CONTAINER_DLL_remove (ch->ext_addr_head, | ||
1207 | ch->ext_addr_tail, | ||
1208 | lal); | ||
1209 | check_notify_client (lal, | ||
1210 | ch, | ||
1211 | GNUNET_NO); | ||
1212 | GNUNET_free (lal); | ||
1213 | } | ||
1214 | } | ||
1215 | return; | ||
1216 | } | ||
1217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1218 | "Got IP `%s' for external address `%s'\n", | ||
1219 | GNUNET_a2s (addr, | ||
1220 | addrlen), | ||
1221 | ch->hole_external); | ||
1222 | |||
1223 | /* build sockaddr storage with port number */ | ||
1224 | memset (&ss, 0, sizeof (ss)); | ||
1225 | memcpy (&ss, addr, addrlen); | ||
1226 | switch (addr->sa_family) | ||
1227 | { | ||
1228 | case AF_INET: | ||
1229 | v4 = (struct sockaddr_in *) &ss; | ||
1230 | v4->sin_port = htons (ch->ext_dns_port); | ||
1231 | break; | ||
1232 | case AF_INET6: | ||
1233 | v6 = (struct sockaddr_in6 *) &ss; | ||
1234 | v6->sin6_port = htons (ch->ext_dns_port); | ||
1235 | break; | ||
1236 | default: | ||
1237 | GNUNET_break (0); | ||
1238 | return; | ||
1239 | } | ||
1240 | /* See if 'ss' matches any of our known addresses */ | ||
1241 | for (lal = ch->ext_addr_head; NULL != lal; lal = lal->next) | ||
1242 | { | ||
1243 | if (GNUNET_NO == lal->old) | ||
1244 | continue; /* already processed, skip */ | ||
1245 | if ( (addr->sa_family == lal->addr.ss_family) && | ||
1246 | (0 == memcmp (&ss, | ||
1247 | &lal->addr, | ||
1248 | addrlen)) ) | ||
1249 | { | ||
1250 | /* Address unchanged, remember so we do not remove */ | ||
1251 | lal->old = GNUNET_NO; | ||
1252 | return; /* done here */ | ||
1253 | } | ||
1254 | } | ||
1255 | /* notify client, and remember IP for later removal! */ | ||
1256 | lal = GNUNET_new (struct LocalAddressList); | ||
1257 | lal->addr = ss; | ||
1258 | lal->af = ss.ss_family; | ||
1259 | lal->ac = GNUNET_NAT_AC_GLOBAL | GNUNET_NAT_AC_MANUAL; | ||
1260 | GNUNET_CONTAINER_DLL_insert (ch->ext_addr_head, | ||
1261 | ch->ext_addr_tail, | ||
1262 | lal); | ||
1263 | check_notify_client (lal, | ||
1264 | ch, | ||
1265 | GNUNET_YES); | ||
1266 | } | ||
1267 | |||
1268 | |||
1269 | /** | ||
1270 | * Resolve the `hole_external` name to figure out our | ||
1271 | * external address from a manually punched hole. The | ||
1272 | * port number has already been parsed, this task is | ||
1273 | * responsible for periodically doing a DNS lookup. | ||
1274 | * | ||
1275 | * @param ch client handle to act upon | ||
1276 | */ | ||
1277 | static void | ||
1278 | dyndns_lookup (void *cls) | ||
1279 | { | ||
1280 | struct ClientHandle *ch = cls; | ||
1281 | struct LocalAddressList *lal; | ||
1282 | |||
1283 | for (lal = ch->ext_addr_head; NULL != lal; lal = lal->next) | ||
1284 | lal->old = GNUNET_YES; | ||
1285 | ch->ext_dns_task = NULL; | ||
1286 | ch->ext_dns = GNUNET_RESOLVER_ip_get (ch->hole_external, | ||
1287 | AF_UNSPEC, | ||
1288 | GNUNET_TIME_UNIT_MINUTES, | ||
1289 | &process_external_ip, | ||
1290 | ch); | ||
1291 | } | ||
1292 | |||
1293 | |||
1294 | /** | ||
1295 | * Resolve the `hole_external` name to figure out our | ||
1296 | * external address from a manually punched hole. The | ||
1297 | * given name may be "AUTO" in which case we should use | ||
1298 | * the IP address(es) we have from upnpc or other methods. | ||
1299 | * The name can also be an IP address, in which case we | ||
1300 | * do not need to do DNS resolution. Finally, we also | ||
1301 | * need to parse the port number. | ||
1302 | * | ||
1303 | * @param ch client handle to act upon | ||
1304 | */ | ||
1305 | static void | ||
1306 | lookup_hole_external (struct ClientHandle *ch) | ||
1307 | { | ||
1308 | char *port; | ||
1309 | unsigned int pnum; | ||
1310 | struct sockaddr_in *s4; | ||
1311 | struct LocalAddressList *lal; | ||
1312 | |||
1313 | port = strrchr (ch->hole_external, ':'); | ||
1314 | if (NULL == port) | ||
1315 | { | ||
1316 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1317 | _("Malformed punched hole specification `%s' (lacks port)\n"), | ||
1318 | ch->hole_external); | ||
1319 | return; | ||
1320 | } | ||
1321 | if ( (1 != sscanf (port + 1, | ||
1322 | "%u", | ||
1323 | &pnum)) || | ||
1324 | (pnum > 65535) ) | ||
1325 | { | ||
1326 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1327 | _("Invalid port number in punched hole specification `%s' (lacks port)\n"), | ||
1328 | port + 1); | ||
1329 | return; | ||
1330 | } | ||
1331 | ch->ext_dns_port = (uint16_t) pnum; | ||
1332 | *port = '\0'; | ||
1333 | |||
1334 | lal = GNUNET_new (struct LocalAddressList); | ||
1335 | if ('[' == *ch->hole_external) | ||
1336 | { | ||
1337 | struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) &lal->addr; | ||
1338 | |||
1339 | s6->sin6_family = AF_INET6; | ||
1340 | if (']' != (ch->hole_external[strlen(ch->hole_external)-1])) | ||
1341 | { | ||
1342 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1343 | _("Malformed punched hole specification `%s' (lacks `]')\n"), | ||
1344 | ch->hole_external); | ||
1345 | GNUNET_free (lal); | ||
1346 | return; | ||
1347 | } | ||
1348 | ch->hole_external[strlen(ch->hole_external)-1] = '\0'; | ||
1349 | if (1 != inet_pton (AF_INET6, | ||
1350 | ch->hole_external + 1, | ||
1351 | &s6->sin6_addr)) | ||
1352 | { | ||
1353 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1354 | _("Malformed punched hole specification `%s' (IPv6 address invalid)"), | ||
1355 | ch->hole_external + 1); | ||
1356 | GNUNET_free (lal); | ||
1357 | return; | ||
1358 | } | ||
1359 | s6->sin6_port = htons (ch->ext_dns_port); | ||
1360 | lal->af = AF_INET6; | ||
1361 | lal->ac = GNUNET_NAT_AC_GLOBAL | GNUNET_NAT_AC_MANUAL; | ||
1362 | GNUNET_CONTAINER_DLL_insert (ch->ext_addr_head, | ||
1363 | ch->ext_addr_tail, | ||
1364 | lal); | ||
1365 | check_notify_client (lal, | ||
1366 | ch, | ||
1367 | GNUNET_YES); | ||
1368 | return; | ||
1369 | } | ||
1370 | |||
1371 | s4 = (struct sockaddr_in *) &lal->addr; | ||
1372 | s4->sin_family = AF_INET; | ||
1373 | if (1 == inet_pton (AF_INET, | ||
1374 | ch->hole_external, | ||
1375 | &s4->sin_addr)) | ||
1376 | { | ||
1377 | s4->sin_port = htons (ch->ext_dns_port); | ||
1378 | lal->af = AF_INET; | ||
1379 | lal->ac = GNUNET_NAT_AC_GLOBAL | GNUNET_NAT_AC_MANUAL; | ||
1380 | GNUNET_CONTAINER_DLL_insert (ch->ext_addr_head, | ||
1381 | ch->ext_addr_tail, | ||
1382 | lal); | ||
1383 | check_notify_client (lal, | ||
1384 | ch, | ||
1385 | GNUNET_YES); | ||
1386 | return; | ||
1387 | } | ||
1388 | if (0 == strcasecmp (ch->hole_external, | ||
1389 | "AUTO")) | ||
1390 | { | ||
1391 | /* handled in #notify_client_external_ipv4_change() */ | ||
1392 | GNUNET_free (lal); | ||
1393 | return; | ||
1394 | } | ||
1395 | /* got a DNS name, trigger lookup! */ | ||
1396 | GNUNET_free (lal); | ||
1397 | ch->ext_dns_task | ||
1398 | = GNUNET_SCHEDULER_add_now (&dyndns_lookup, | ||
1399 | ch); | ||
1400 | } | ||
1401 | |||
1402 | |||
1403 | /** | ||
1320 | * Handler for #GNUNET_MESSAGE_TYPE_NAT_REGISTER message from client. | 1404 | * Handler for #GNUNET_MESSAGE_TYPE_NAT_REGISTER message from client. |
1321 | * We remember the client for updates upon future NAT events. | 1405 | * We remember the client for updates upon future NAT events. |
1322 | * | 1406 | * |
@@ -1367,7 +1451,7 @@ handle_register (void *cls, | |||
1367 | case AF_INET: | 1451 | case AF_INET: |
1368 | { | 1452 | { |
1369 | const struct sockaddr_in *s4 = (const struct sockaddr_in *) sa; | 1453 | const struct sockaddr_in *s4 = (const struct sockaddr_in *) sa; |
1370 | 1454 | ||
1371 | alen = sizeof (struct sockaddr_in); | 1455 | alen = sizeof (struct sockaddr_in); |
1372 | if (is_nat_v4 (&s4->sin_addr)) | 1456 | if (is_nat_v4 (&s4->sin_addr)) |
1373 | is_nat = GNUNET_YES; | 1457 | is_nat = GNUNET_YES; |
@@ -1377,7 +1461,7 @@ handle_register (void *cls, | |||
1377 | case AF_INET6: | 1461 | case AF_INET6: |
1378 | { | 1462 | { |
1379 | const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *) sa; | 1463 | const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *) sa; |
1380 | 1464 | ||
1381 | alen = sizeof (struct sockaddr_in6); | 1465 | alen = sizeof (struct sockaddr_in6); |
1382 | if (is_nat_v6 (&s6->sin6_addr)) | 1466 | if (is_nat_v6 (&s6->sin6_addr)) |
1383 | is_nat = GNUNET_YES; | 1467 | is_nat = GNUNET_YES; |
@@ -1393,14 +1477,14 @@ handle_register (void *cls, | |||
1393 | default: | 1477 | default: |
1394 | GNUNET_break (0); | 1478 | GNUNET_break (0); |
1395 | GNUNET_SERVICE_client_drop (ch->client); | 1479 | GNUNET_SERVICE_client_drop (ch->client); |
1396 | return; | 1480 | return; |
1397 | } | 1481 | } |
1398 | /* store address */ | 1482 | /* store address */ |
1399 | GNUNET_assert (alen <= left); | 1483 | GNUNET_assert (alen <= left); |
1400 | GNUNET_assert (alen <= sizeof (struct sockaddr_storage)); | 1484 | GNUNET_assert (alen <= sizeof (struct sockaddr_storage)); |
1401 | GNUNET_memcpy (&ch->caddrs[i].ss, | 1485 | GNUNET_memcpy (&ch->caddrs[i].ss, |
1402 | sa, | 1486 | sa, |
1403 | alen); | 1487 | alen); |
1404 | 1488 | ||
1405 | /* If applicable, try UPNPC NAT punching */ | 1489 | /* If applicable, try UPNPC NAT punching */ |
1406 | if ( (is_nat) && | 1490 | if ( (is_nat) && |
@@ -1419,10 +1503,16 @@ handle_register (void *cls, | |||
1419 | off += alen; | 1503 | off += alen; |
1420 | } | 1504 | } |
1421 | 1505 | ||
1422 | ch->hole_external | 1506 | ch->section_name |
1423 | = GNUNET_strndup (off, | 1507 | = GNUNET_strndup (off, |
1424 | ntohs (message->hole_external_len)); | 1508 | ntohs (message->str_len)); |
1425 | 1509 | if (GNUNET_OK == | |
1510 | GNUNET_CONFIGURATION_get_value_string (cfg, | ||
1511 | ch->section_name, | ||
1512 | "HOLE_EXTERNAL", | ||
1513 | &ch->hole_external)) | ||
1514 | lookup_hole_external (ch); | ||
1515 | |||
1426 | /* Actually send IP address list to client */ | 1516 | /* Actually send IP address list to client */ |
1427 | for (struct LocalAddressList *lal = lal_head; | 1517 | for (struct LocalAddressList *lal = lal_head; |
1428 | NULL != lal; | 1518 | NULL != lal; |
@@ -1433,12 +1523,9 @@ handle_register (void *cls, | |||
1433 | GNUNET_YES); | 1523 | GNUNET_YES); |
1434 | } | 1524 | } |
1435 | /* Also consider IPv4 determined by `external-ip` */ | 1525 | /* Also consider IPv4 determined by `external-ip` */ |
1436 | if (0 != mini_external_ipv4.s_addr) | 1526 | ch->external_monitor |
1437 | { | 1527 | = GN_external_ipv4_monitor_start (¬ify_client_external_ipv4_change, |
1438 | check_notify_client_external_ipv4_change (&mini_external_ipv4, | 1528 | ch); |
1439 | ch, | ||
1440 | GNUNET_YES); | ||
1441 | } | ||
1442 | GNUNET_SERVICE_client_continue (ch->client); | 1529 | GNUNET_SERVICE_client_continue (ch->client); |
1443 | } | 1530 | } |
1444 | 1531 | ||
@@ -1457,7 +1544,7 @@ check_stun (void *cls, | |||
1457 | { | 1544 | { |
1458 | size_t sa_len = ntohs (message->sender_addr_size); | 1545 | size_t sa_len = ntohs (message->sender_addr_size); |
1459 | size_t expect = sa_len + ntohs (message->payload_size); | 1546 | size_t expect = sa_len + ntohs (message->payload_size); |
1460 | 1547 | ||
1461 | if (ntohs (message->header.size) - sizeof (*message) != expect) | 1548 | if (ntohs (message->header.size) - sizeof (*message) != expect) |
1462 | { | 1549 | { |
1463 | GNUNET_break (0); | 1550 | GNUNET_break (0); |
@@ -1490,7 +1577,7 @@ notify_clients_stun_change (const struct sockaddr_in *ip, | |||
1490 | struct sockaddr_in v4; | 1577 | struct sockaddr_in v4; |
1491 | struct GNUNET_NAT_AddressChangeNotificationMessage *msg; | 1578 | struct GNUNET_NAT_AddressChangeNotificationMessage *msg; |
1492 | struct GNUNET_MQ_Envelope *env; | 1579 | struct GNUNET_MQ_Envelope *env; |
1493 | 1580 | ||
1494 | if (! ch->natted_address) | 1581 | if (! ch->natted_address) |
1495 | continue; | 1582 | continue; |
1496 | v4 = *ip; | 1583 | v4 = *ip; |
@@ -1580,9 +1667,9 @@ handle_stun (void *cls, | |||
1580 | GNUNET_NAT_stun_handle_packet_ (payload, | 1667 | GNUNET_NAT_stun_handle_packet_ (payload, |
1581 | payload_size, | 1668 | payload_size, |
1582 | &external_addr)) | 1669 | &external_addr)) |
1583 | { | 1670 | { |
1584 | /* We now know that a server at "sa" claims that | 1671 | /* We now know that a server at "sa" claims that |
1585 | we are visible at IP "external_addr". | 1672 | we are visible at IP "external_addr". |
1586 | 1673 | ||
1587 | We should (for some fixed period of time) tell | 1674 | We should (for some fixed period of time) tell |
1588 | all of our clients that listen to a NAT'ed address | 1675 | all of our clients that listen to a NAT'ed address |
@@ -1685,347 +1772,44 @@ handle_request_connection_reversal (void *cls, | |||
1685 | const char *buf = (const char *) &message[1]; | 1772 | const char *buf = (const char *) &message[1]; |
1686 | size_t local_sa_len = ntohs (message->local_addr_size); | 1773 | size_t local_sa_len = ntohs (message->local_addr_size); |
1687 | size_t remote_sa_len = ntohs (message->remote_addr_size); | 1774 | size_t remote_sa_len = ntohs (message->remote_addr_size); |
1688 | const struct sockaddr *local_sa = (const struct sockaddr *) &buf[0]; | 1775 | struct sockaddr_in l4; |
1689 | const struct sockaddr *remote_sa = (const struct sockaddr *) &buf[local_sa_len]; | 1776 | struct sockaddr_in r4; |
1690 | const struct sockaddr_in *l4 = NULL; | ||
1691 | const struct sockaddr_in *r4; | ||
1692 | int ret; | 1777 | int ret; |
1693 | 1778 | ||
1694 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1779 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1695 | "Received REQUEST CONNECTION REVERSAL message from client\n"); | 1780 | "Received REQUEST CONNECTION REVERSAL message from client\n"); |
1696 | switch (local_sa->sa_family) | 1781 | if (local_sa_len != sizeof (struct sockaddr_in)) |
1697 | { | 1782 | { |
1698 | case AF_INET: | 1783 | GNUNET_break_op (0); |
1699 | if (local_sa_len != sizeof (struct sockaddr_in)) | ||
1700 | { | ||
1701 | GNUNET_break (0); | ||
1702 | GNUNET_SERVICE_client_drop (ch->client); | ||
1703 | return; | ||
1704 | } | ||
1705 | l4 = (const struct sockaddr_in *) local_sa; | ||
1706 | break; | ||
1707 | case AF_INET6: | ||
1708 | if (local_sa_len != sizeof (struct sockaddr_in6)) | ||
1709 | { | ||
1710 | GNUNET_break (0); | ||
1711 | GNUNET_SERVICE_client_drop (ch->client); | ||
1712 | return; | ||
1713 | } | ||
1714 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1715 | _("Connection reversal for IPv6 not supported yet\n")); | ||
1716 | ret = GNUNET_SYSERR; | ||
1717 | break; | ||
1718 | default: | ||
1719 | GNUNET_break (0); | ||
1720 | GNUNET_SERVICE_client_drop (ch->client); | 1784 | GNUNET_SERVICE_client_drop (ch->client); |
1721 | return; | 1785 | return; |
1722 | } | 1786 | } |
1723 | switch (remote_sa->sa_family) | 1787 | if (remote_sa_len != sizeof (struct sockaddr_in)) |
1724 | { | 1788 | { |
1725 | case AF_INET: | 1789 | GNUNET_break_op (0); |
1726 | if (remote_sa_len != sizeof (struct sockaddr_in)) | ||
1727 | { | ||
1728 | GNUNET_break (0); | ||
1729 | GNUNET_SERVICE_client_drop (ch->client); | ||
1730 | return; | ||
1731 | } | ||
1732 | r4 = (const struct sockaddr_in *) remote_sa; | ||
1733 | ret = GN_request_connection_reversal (&l4->sin_addr, | ||
1734 | ntohs (l4->sin_port), | ||
1735 | &r4->sin_addr); | ||
1736 | break; | ||
1737 | case AF_INET6: | ||
1738 | if (remote_sa_len != sizeof (struct sockaddr_in6)) | ||
1739 | { | ||
1740 | GNUNET_break (0); | ||
1741 | GNUNET_SERVICE_client_drop (ch->client); | ||
1742 | return; | ||
1743 | } | ||
1744 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1745 | _("Connection reversal for IPv6 not supported yet\n")); | ||
1746 | ret = GNUNET_SYSERR; | ||
1747 | break; | ||
1748 | default: | ||
1749 | GNUNET_break (0); | ||
1750 | GNUNET_SERVICE_client_drop (ch->client); | 1790 | GNUNET_SERVICE_client_drop (ch->client); |
1751 | return; | 1791 | return; |
1752 | } | 1792 | } |
1793 | GNUNET_memcpy (&l4, | ||
1794 | buf, | ||
1795 | sizeof (struct sockaddr_in)); | ||
1796 | GNUNET_break_op (AF_INET == l4.sin_family); | ||
1797 | buf += sizeof (struct sockaddr_in); | ||
1798 | GNUNET_memcpy (&r4, | ||
1799 | buf, | ||
1800 | sizeof (struct sockaddr_in)); | ||
1801 | GNUNET_break_op (AF_INET == r4.sin_family); | ||
1802 | ret = GN_request_connection_reversal (&l4.sin_addr, | ||
1803 | ntohs (l4.sin_port), | ||
1804 | &r4.sin_addr); | ||
1753 | if (GNUNET_OK != ret) | 1805 | if (GNUNET_OK != ret) |
1754 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1806 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1755 | _("Connection reversal request failed\n")); | 1807 | _("Connection reversal request failed\n")); |
1756 | GNUNET_SERVICE_client_continue (ch->client); | 1808 | GNUNET_SERVICE_client_continue (ch->client); |
1757 | } | 1809 | } |
1758 | 1810 | ||
1759 | 1811 | ||
1760 | /** | 1812 | /** |
1761 | * Check validity of #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG message | ||
1762 | * from client. | ||
1763 | * | ||
1764 | * @param cls client who sent the message | ||
1765 | * @param message the message received | ||
1766 | * @return #GNUNET_OK if message is well-formed | ||
1767 | */ | ||
1768 | static int | ||
1769 | check_autoconfig_request (void *cls, | ||
1770 | const struct GNUNET_NAT_AutoconfigRequestMessage *message) | ||
1771 | { | ||
1772 | return GNUNET_OK; /* checked later */ | ||
1773 | } | ||
1774 | |||
1775 | |||
1776 | /** | ||
1777 | * Stop all pending activities with respect to the @a ac | ||
1778 | * | ||
1779 | * @param ac autoconfiguration to terminate activities for | ||
1780 | */ | ||
1781 | static void | ||
1782 | terminate_ac_activities (struct AutoconfigContext *ac) | ||
1783 | { | ||
1784 | if (NULL != ac->probe_external) | ||
1785 | { | ||
1786 | GNUNET_NAT_mini_get_external_ipv4_cancel_ (ac->probe_external); | ||
1787 | ac->probe_external = NULL; | ||
1788 | } | ||
1789 | if (NULL != ac->timeout_task) | ||
1790 | { | ||
1791 | GNUNET_SCHEDULER_cancel (ac->timeout_task); | ||
1792 | ac->timeout_task = NULL; | ||
1793 | } | ||
1794 | } | ||
1795 | |||
1796 | |||
1797 | /** | ||
1798 | * Finish handling the autoconfiguration request and send | ||
1799 | * the response to the client. | ||
1800 | * | ||
1801 | * @param cls the `struct AutoconfigContext` to conclude | ||
1802 | */ | ||
1803 | static void | ||
1804 | conclude_autoconfig_request (void *cls) | ||
1805 | { | ||
1806 | struct AutoconfigContext *ac = cls; | ||
1807 | struct ClientHandle *ch = ac->ch; | ||
1808 | struct GNUNET_NAT_AutoconfigResultMessage *arm; | ||
1809 | struct GNUNET_MQ_Envelope *env; | ||
1810 | size_t c_size; | ||
1811 | char *buf; | ||
1812 | struct GNUNET_CONFIGURATION_Handle *diff; | ||
1813 | |||
1814 | ac->timeout_task = NULL; | ||
1815 | terminate_ac_activities (ac); | ||
1816 | |||
1817 | /* Send back response */ | ||
1818 | diff = GNUNET_CONFIGURATION_get_diff (ac->orig, | ||
1819 | ac->c); | ||
1820 | buf = GNUNET_CONFIGURATION_serialize (diff, | ||
1821 | &c_size); | ||
1822 | GNUNET_CONFIGURATION_destroy (diff); | ||
1823 | env = GNUNET_MQ_msg_extra (arm, | ||
1824 | c_size, | ||
1825 | GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT); | ||
1826 | arm->status_code = htonl ((uint32_t) ac->status_code); | ||
1827 | arm->type = htonl ((uint32_t) ac->type); | ||
1828 | GNUNET_memcpy (&arm[1], | ||
1829 | buf, | ||
1830 | c_size); | ||
1831 | GNUNET_free (buf); | ||
1832 | GNUNET_MQ_send (ch->mq, | ||
1833 | env); | ||
1834 | |||
1835 | /* clean up */ | ||
1836 | GNUNET_free (ac->system_type); | ||
1837 | GNUNET_CONFIGURATION_destroy (ac->orig); | ||
1838 | GNUNET_CONFIGURATION_destroy (ac->c); | ||
1839 | GNUNET_CONTAINER_DLL_remove (ac_head, | ||
1840 | ac_tail, | ||
1841 | ac); | ||
1842 | GNUNET_free (ac); | ||
1843 | GNUNET_SERVICE_client_continue (ch->client); | ||
1844 | } | ||
1845 | |||
1846 | |||
1847 | /** | ||
1848 | * Check if all autoconfiguration operations have concluded, | ||
1849 | * and if they have, send the result back to the client. | ||
1850 | * | ||
1851 | * @param ac autoconfiguation context to check | ||
1852 | */ | ||
1853 | static void | ||
1854 | check_autoconfig_finished (struct AutoconfigContext *ac) | ||
1855 | { | ||
1856 | if (NULL != ac->probe_external) | ||
1857 | return; | ||
1858 | GNUNET_SCHEDULER_cancel (ac->timeout_task); | ||
1859 | ac->timeout_task | ||
1860 | = GNUNET_SCHEDULER_add_now (&conclude_autoconfig_request, | ||
1861 | ac); | ||
1862 | } | ||
1863 | |||
1864 | |||
1865 | /** | ||
1866 | * Update ENABLE_UPNPC configuration option. | ||
1867 | * | ||
1868 | * @param ac autoconfiguration to update | ||
1869 | */ | ||
1870 | static void | ||
1871 | update_enable_upnpc_option (struct AutoconfigContext *ac) | ||
1872 | { | ||
1873 | switch (ac->enable_upnpc) | ||
1874 | { | ||
1875 | case GNUNET_YES: | ||
1876 | GNUNET_CONFIGURATION_set_value_string (ac->c, | ||
1877 | "NAT", | ||
1878 | "ENABLE_UPNP", | ||
1879 | "YES"); | ||
1880 | break; | ||
1881 | case GNUNET_NO: | ||
1882 | GNUNET_CONFIGURATION_set_value_string (ac->c, | ||
1883 | "NAT", | ||
1884 | "ENABLE_UPNP", | ||
1885 | "NO"); | ||
1886 | break; | ||
1887 | case GNUNET_SYSERR: | ||
1888 | /* We are unsure, do not change option */ | ||
1889 | break; | ||
1890 | } | ||
1891 | } | ||
1892 | |||
1893 | |||
1894 | /** | ||
1895 | * Handle result from external IP address probe during | ||
1896 | * autoconfiguration. | ||
1897 | * | ||
1898 | * @param cls our `struct AutoconfigContext` | ||
1899 | * @param addr the address, NULL on errors | ||
1900 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
1901 | */ | ||
1902 | static void | ||
1903 | auto_external_result_cb (void *cls, | ||
1904 | const struct in_addr *addr, | ||
1905 | enum GNUNET_NAT_StatusCode result) | ||
1906 | { | ||
1907 | struct AutoconfigContext *ac = cls; | ||
1908 | |||
1909 | ac->probe_external = NULL; | ||
1910 | switch (result) | ||
1911 | { | ||
1912 | case GNUNET_NAT_ERROR_SUCCESS: | ||
1913 | ac->enable_upnpc = GNUNET_YES; | ||
1914 | break; | ||
1915 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID: | ||
1916 | case GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID: | ||
1917 | case GNUNET_NAT_ERROR_IPC_FAILURE: | ||
1918 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1919 | "Disabling UPNPC: %d\n", | ||
1920 | (int) result); | ||
1921 | ac->enable_upnpc = GNUNET_NO; /* did not work */ | ||
1922 | break; | ||
1923 | default: | ||
1924 | GNUNET_break (0); /* unexpected */ | ||
1925 | ac->enable_upnpc = GNUNET_SYSERR; | ||
1926 | break; | ||
1927 | } | ||
1928 | update_enable_upnpc_option (ac); | ||
1929 | check_autoconfig_finished (ac); | ||
1930 | } | ||
1931 | |||
1932 | |||
1933 | /** | ||
1934 | * Handler for #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG message from | ||
1935 | * client. | ||
1936 | * | ||
1937 | * @param cls client who sent the message | ||
1938 | * @param message the message received | ||
1939 | */ | ||
1940 | static void | ||
1941 | handle_autoconfig_request (void *cls, | ||
1942 | const struct GNUNET_NAT_AutoconfigRequestMessage *message) | ||
1943 | { | ||
1944 | struct ClientHandle *ch = cls; | ||
1945 | size_t left = ntohs (message->header.size) - sizeof (*message); | ||
1946 | struct LocalAddressList *lal; | ||
1947 | struct AutoconfigContext *ac; | ||
1948 | |||
1949 | ac = GNUNET_new (struct AutoconfigContext); | ||
1950 | ac->status_code = GNUNET_NAT_ERROR_SUCCESS; | ||
1951 | ac->ch = ch; | ||
1952 | ac->c = GNUNET_CONFIGURATION_create (); | ||
1953 | if (GNUNET_OK != | ||
1954 | GNUNET_CONFIGURATION_deserialize (ac->c, | ||
1955 | (const char *) &message[1], | ||
1956 | left, | ||
1957 | GNUNET_NO)) | ||
1958 | { | ||
1959 | GNUNET_break (0); | ||
1960 | GNUNET_SERVICE_client_drop (ch->client); | ||
1961 | GNUNET_CONFIGURATION_destroy (ac->c); | ||
1962 | GNUNET_free (ac); | ||
1963 | return; | ||
1964 | } | ||
1965 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1966 | "Received REQUEST_AUTO_CONFIG message from client\n"); | ||
1967 | |||
1968 | if (GNUNET_OK != | ||
1969 | GNUNET_CONFIGURATION_get_value_string (ac->c, | ||
1970 | "PEER", | ||
1971 | "SYSTEM_TYPE", | ||
1972 | &ac->system_type)) | ||
1973 | ac->system_type = GNUNET_strdup ("UNKNOWN"); | ||
1974 | |||
1975 | GNUNET_CONTAINER_DLL_insert (ac_head, | ||
1976 | ac_tail, | ||
1977 | ac); | ||
1978 | ac->orig | ||
1979 | = GNUNET_CONFIGURATION_dup (ac->c); | ||
1980 | ac->timeout_task | ||
1981 | = GNUNET_SCHEDULER_add_delayed (AUTOCONFIG_TIMEOUT, | ||
1982 | &conclude_autoconfig_request, | ||
1983 | ac); | ||
1984 | ac->enable_upnpc = GNUNET_SYSERR; /* undecided */ | ||
1985 | |||
1986 | /* Probe for upnpc */ | ||
1987 | if (GNUNET_SYSERR == | ||
1988 | GNUNET_OS_check_helper_binary ("upnpc", | ||
1989 | GNUNET_NO, | ||
1990 | NULL)) | ||
1991 | { | ||
1992 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1993 | _("UPnP client `upnpc` command not found, disabling UPnP\n")); | ||
1994 | ac->enable_upnpc = GNUNET_NO; | ||
1995 | } | ||
1996 | else | ||
1997 | { | ||
1998 | for (lal = lal_head; NULL != lal; lal = lal->next) | ||
1999 | if (GNUNET_NAT_AC_LAN == (lal->ac & GNUNET_NAT_AC_LAN)) | ||
2000 | /* we are behind NAT, useful to try upnpc */ | ||
2001 | ac->enable_upnpc = GNUNET_YES; | ||
2002 | } | ||
2003 | if (GNUNET_YES == ac->enable_upnpc) | ||
2004 | { | ||
2005 | /* If we are a mobile device, always leave it on as the network | ||
2006 | may change to one that supports UPnP anytime. If we are | ||
2007 | stationary, check if our network actually supports UPnP, and if | ||
2008 | not, disable it. */ | ||
2009 | if ( (0 == strcasecmp (ac->system_type, | ||
2010 | "INFRASTRUCTURE")) || | ||
2011 | (0 == strcasecmp (ac->system_type, | ||
2012 | "DESKTOP")) ) | ||
2013 | { | ||
2014 | /* Check if upnpc gives us an external IP */ | ||
2015 | ac->probe_external | ||
2016 | = GNUNET_NAT_mini_get_external_ipv4_ (&auto_external_result_cb, | ||
2017 | ac); | ||
2018 | } | ||
2019 | } | ||
2020 | if (NULL == ac->probe_external) | ||
2021 | update_enable_upnpc_option (ac); | ||
2022 | |||
2023 | /* Finally, check if we are already done */ | ||
2024 | check_autoconfig_finished (ac); | ||
2025 | } | ||
2026 | |||
2027 | |||
2028 | /** | ||
2029 | * Task run during shutdown. | 1813 | * Task run during shutdown. |
2030 | * | 1814 | * |
2031 | * @param cls unused | 1815 | * @param cls unused |
@@ -2034,16 +1818,7 @@ static void | |||
2034 | shutdown_task (void *cls) | 1818 | shutdown_task (void *cls) |
2035 | { | 1819 | { |
2036 | struct StunExternalIP *se; | 1820 | struct StunExternalIP *se; |
2037 | struct AutoconfigContext *ac; | ||
2038 | 1821 | ||
2039 | while (NULL != (ac = ac_head)) | ||
2040 | { | ||
2041 | GNUNET_CONTAINER_DLL_remove (ac_head, | ||
2042 | ac_tail, | ||
2043 | ac); | ||
2044 | terminate_ac_activities (ac); | ||
2045 | GNUNET_free (ac); | ||
2046 | } | ||
2047 | while (NULL != (se = se_head)) | 1822 | while (NULL != (se = se_head)) |
2048 | { | 1823 | { |
2049 | GNUNET_CONTAINER_DLL_remove (se_head, | 1824 | GNUNET_CONTAINER_DLL_remove (se_head, |
@@ -2052,16 +1827,7 @@ shutdown_task (void *cls) | |||
2052 | GNUNET_SCHEDULER_cancel (se->timeout_task); | 1827 | GNUNET_SCHEDULER_cancel (se->timeout_task); |
2053 | GNUNET_free (se); | 1828 | GNUNET_free (se); |
2054 | } | 1829 | } |
2055 | if (NULL != probe_external_ip_task) | 1830 | GN_nat_status_changed (GNUNET_NO); |
2056 | { | ||
2057 | GNUNET_SCHEDULER_cancel (probe_external_ip_task); | ||
2058 | probe_external_ip_task = NULL; | ||
2059 | } | ||
2060 | if (NULL != probe_external_ip_op) | ||
2061 | { | ||
2062 | GNUNET_NAT_mini_get_external_ipv4_cancel_ (probe_external_ip_op); | ||
2063 | probe_external_ip_op = NULL; | ||
2064 | } | ||
2065 | if (NULL != scan_task) | 1831 | if (NULL != scan_task) |
2066 | { | 1832 | { |
2067 | GNUNET_SCHEDULER_cancel (scan_task); | 1833 | GNUNET_SCHEDULER_cancel (scan_task); |
@@ -2098,7 +1864,7 @@ run (void *cls, | |||
2098 | stun_stale_timeout = GNUNET_TIME_UNIT_HOURS; | 1864 | stun_stale_timeout = GNUNET_TIME_UNIT_HOURS; |
2099 | 1865 | ||
2100 | /* Check for UPnP */ | 1866 | /* Check for UPnP */ |
2101 | enable_upnp | 1867 | enable_upnp |
2102 | = GNUNET_CONFIGURATION_get_value_yesno (cfg, | 1868 | = GNUNET_CONFIGURATION_get_value_yesno (cfg, |
2103 | "NAT", | 1869 | "NAT", |
2104 | "ENABLE_UPNP"); | 1870 | "ENABLE_UPNP"); |
@@ -2115,7 +1881,13 @@ run (void *cls, | |||
2115 | enable_upnp = GNUNET_SYSERR; | 1881 | enable_upnp = GNUNET_SYSERR; |
2116 | } | 1882 | } |
2117 | } | 1883 | } |
2118 | 1884 | if (GNUNET_OK != | |
1885 | GNUNET_CONFIGURATION_get_value_time (cfg, | ||
1886 | "nat", | ||
1887 | "DYNDNS_FREQUENCY", | ||
1888 | &dyndns_frequency)) | ||
1889 | dyndns_frequency = DYNDNS_FREQUENCY; | ||
1890 | |||
2119 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | 1891 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
2120 | NULL); | 1892 | NULL); |
2121 | stats = GNUNET_STATISTICS_create ("nat", | 1893 | stats = GNUNET_STATISTICS_create ("nat", |
@@ -2163,6 +1935,7 @@ client_disconnect_cb (void *cls, | |||
2163 | void *internal_cls) | 1935 | void *internal_cls) |
2164 | { | 1936 | { |
2165 | struct ClientHandle *ch = internal_cls; | 1937 | struct ClientHandle *ch = internal_cls; |
1938 | struct LocalAddressList *lal; | ||
2166 | 1939 | ||
2167 | GNUNET_CONTAINER_DLL_remove (ch_head, | 1940 | GNUNET_CONTAINER_DLL_remove (ch_head, |
2168 | ch_tail, | 1941 | ch_tail, |
@@ -2176,7 +1949,30 @@ client_disconnect_cb (void *cls, | |||
2176 | } | 1949 | } |
2177 | } | 1950 | } |
2178 | GNUNET_free_non_null (ch->caddrs); | 1951 | GNUNET_free_non_null (ch->caddrs); |
2179 | GNUNET_free (ch->hole_external); | 1952 | while (NULL != (lal = ch->ext_addr_head)) |
1953 | { | ||
1954 | GNUNET_CONTAINER_DLL_remove (ch->ext_addr_head, | ||
1955 | ch->ext_addr_tail, | ||
1956 | lal); | ||
1957 | GNUNET_free (lal); | ||
1958 | } | ||
1959 | if (NULL != ch->ext_dns_task) | ||
1960 | { | ||
1961 | GNUNET_SCHEDULER_cancel (ch->ext_dns_task); | ||
1962 | ch->ext_dns_task = NULL; | ||
1963 | } | ||
1964 | if (NULL != ch->external_monitor) | ||
1965 | { | ||
1966 | GN_external_ipv4_monitor_stop (ch->external_monitor); | ||
1967 | ch->external_monitor = NULL; | ||
1968 | } | ||
1969 | if (NULL != ch->ext_dns) | ||
1970 | { | ||
1971 | GNUNET_RESOLVER_request_cancel (ch->ext_dns); | ||
1972 | ch->ext_dns = NULL; | ||
1973 | } | ||
1974 | GNUNET_free_non_null (ch->hole_external); | ||
1975 | GNUNET_free_non_null (ch->section_name); | ||
2180 | GNUNET_free (ch); | 1976 | GNUNET_free (ch); |
2181 | } | 1977 | } |
2182 | 1978 | ||
@@ -2203,10 +1999,6 @@ GNUNET_SERVICE_MAIN | |||
2203 | GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL, | 1999 | GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL, |
2204 | struct GNUNET_NAT_RequestConnectionReversalMessage, | 2000 | struct GNUNET_NAT_RequestConnectionReversalMessage, |
2205 | NULL), | 2001 | NULL), |
2206 | GNUNET_MQ_hd_var_size (autoconfig_request, | ||
2207 | GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG, | ||
2208 | struct GNUNET_NAT_AutoconfigRequestMessage, | ||
2209 | NULL), | ||
2210 | GNUNET_MQ_handler_end ()); | 2002 | GNUNET_MQ_handler_end ()); |
2211 | 2003 | ||
2212 | 2004 | ||
diff --git a/src/nat/gnunet-service-nat.h b/src/nat/gnunet-service-nat.h new file mode 100644 index 000000000..96eb9f78b --- /dev/null +++ b/src/nat/gnunet-service-nat.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2016, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file nat/gnunet-service-nat.h | ||
23 | * @brief network address translation traversal service | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef GNUNET_SERVICE_NAT_H | ||
27 | #define GNUNET_SERVICE_NAT_H | ||
28 | |||
29 | /** | ||
30 | * Is UPnP enabled? #GNUNET_YES if enabled, #GNUNET_NO if disabled, | ||
31 | * #GNUNET_SYSERR if configuration enabled but binary is unavailable. | ||
32 | */ | ||
33 | extern int enable_upnp; | ||
34 | |||
35 | #endif | ||
diff --git a/src/nat/gnunet-service-nat_externalip.c b/src/nat/gnunet-service-nat_externalip.c new file mode 100644 index 000000000..979d2f0f5 --- /dev/null +++ b/src/nat/gnunet-service-nat_externalip.c | |||
@@ -0,0 +1,314 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009, 2015, 2016, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * Code to figure out what our external IPv4 address(es) might | ||
22 | * be (external IPv4s are what is seen on the rest of the Internet). | ||
23 | * | ||
24 | * This can be implemented using different methods, and we allow | ||
25 | * the main service to be notified about changes to what we believe | ||
26 | * is our external IPv4 address. | ||
27 | * | ||
28 | * Note that this is explicitly only about NATed systems; if one | ||
29 | * of our network interfaces has a global IP address this does | ||
30 | * not count as "external". | ||
31 | * | ||
32 | * TODO: | ||
33 | * - implement NEW logic for external IP detection based on traceroute! | ||
34 | * | ||
35 | * @file nat/gnunet-service-nat_externalip.c | ||
36 | * @brief Functions for monitoring external IPv4 addresses | ||
37 | * @author Christian Grothoff | ||
38 | */ | ||
39 | #include "platform.h" | ||
40 | #include <math.h> | ||
41 | #include "gnunet_util_lib.h" | ||
42 | #include "gnunet_protocols.h" | ||
43 | #include "gnunet_signatures.h" | ||
44 | #include "gnunet_statistics_service.h" | ||
45 | #include "gnunet_resolver_service.h" | ||
46 | #include "gnunet_nat_service.h" | ||
47 | #include "gnunet-service-nat.h" | ||
48 | #include "gnunet-service-nat_externalip.h" | ||
49 | #include "gnunet-service-nat_stun.h" | ||
50 | #include "gnunet-service-nat_mini.h" | ||
51 | #include "gnunet-service-nat_helper.h" | ||
52 | #include "nat.h" | ||
53 | #include <gcrypt.h> | ||
54 | |||
55 | |||
56 | /** | ||
57 | * How long do we wait until we re-try running `external-ip` if the | ||
58 | * command failed to terminate nicely? | ||
59 | */ | ||
60 | #define EXTERN_IP_RETRY_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | ||
61 | |||
62 | /** | ||
63 | * How long do we wait until we re-try running `external-ip` if the | ||
64 | * command failed (but terminated)? | ||
65 | */ | ||
66 | #define EXTERN_IP_RETRY_FAILURE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30) | ||
67 | |||
68 | /** | ||
69 | * How long do we wait until we re-try running `external-ip` if the | ||
70 | * command succeeded? | ||
71 | */ | ||
72 | #define EXTERN_IP_RETRY_SUCCESS GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Handle to monitor for external IP changes. | ||
77 | */ | ||
78 | struct GN_ExternalIPMonitor | ||
79 | { | ||
80 | /** | ||
81 | * Kept in DLL. | ||
82 | */ | ||
83 | struct GN_ExternalIPMonitor *next; | ||
84 | |||
85 | /** | ||
86 | * Kept in DLL. | ||
87 | */ | ||
88 | struct GN_ExternalIPMonitor *prev; | ||
89 | |||
90 | /** | ||
91 | * Function to call when we believe our external IPv4 address changed. | ||
92 | */ | ||
93 | GN_NotifyExternalIPv4Change cb; | ||
94 | |||
95 | /** | ||
96 | * Closure for @e cb. | ||
97 | */ | ||
98 | void *cb_cls; | ||
99 | |||
100 | }; | ||
101 | |||
102 | |||
103 | /** | ||
104 | * List of monitors, kept in DLL. | ||
105 | */ | ||
106 | static struct GN_ExternalIPMonitor *mon_head; | ||
107 | |||
108 | /** | ||
109 | * List of monitors, kept in DLL. | ||
110 | */ | ||
111 | static struct GN_ExternalIPMonitor *mon_tail; | ||
112 | |||
113 | /** | ||
114 | * Task run to obtain our external IP (if #enable_upnp is set | ||
115 | * and if we find we have a NATed IP address). | ||
116 | */ | ||
117 | static struct GNUNET_SCHEDULER_Task *probe_external_ip_task; | ||
118 | |||
119 | /** | ||
120 | * Handle to our operation to run `external-ip`. | ||
121 | */ | ||
122 | static struct GNUNET_NAT_ExternalHandle *probe_external_ip_op; | ||
123 | |||
124 | /** | ||
125 | * What is our external IP address as claimed by `external-ip`? | ||
126 | * 0 for unknown. | ||
127 | */ | ||
128 | static struct in_addr mini_external_ipv4; | ||
129 | |||
130 | |||
131 | /** | ||
132 | * Tell relevant clients about a change in our external | ||
133 | * IPv4 address. | ||
134 | * | ||
135 | * @param add #GNUNET_YES to add, #GNUNET_NO to remove | ||
136 | * @param v4 the external address that changed | ||
137 | */ | ||
138 | static void | ||
139 | notify_monitors_external_ipv4_change (int add, | ||
140 | const struct in_addr *v4) | ||
141 | { | ||
142 | for (struct GN_ExternalIPMonitor *mon = mon_head; | ||
143 | NULL != mon; | ||
144 | mon = mon->next) | ||
145 | mon->cb (mon->cb_cls, | ||
146 | v4, | ||
147 | add); | ||
148 | } | ||
149 | |||
150 | |||
151 | /** | ||
152 | * Task used to run `external-ip` to get our external IPv4 | ||
153 | * address and pass it to NATed clients if possible. | ||
154 | * | ||
155 | * @param cls NULL | ||
156 | */ | ||
157 | static void | ||
158 | run_external_ip (void *cls); | ||
159 | |||
160 | |||
161 | /** | ||
162 | * We learn our current external IP address. If it changed, | ||
163 | * notify all of our applicable clients. Also re-schedule | ||
164 | * #run_external_ip with an appropriate timeout. | ||
165 | * | ||
166 | * @param cls NULL | ||
167 | * @param addr the address, NULL on errors | ||
168 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
169 | */ | ||
170 | static void | ||
171 | handle_external_ip (void *cls, | ||
172 | const struct in_addr *addr, | ||
173 | enum GNUNET_NAT_StatusCode result) | ||
174 | { | ||
175 | char buf[INET_ADDRSTRLEN]; | ||
176 | |||
177 | probe_external_ip_op = NULL; | ||
178 | GNUNET_SCHEDULER_cancel (probe_external_ip_task); | ||
179 | probe_external_ip_task | ||
180 | = GNUNET_SCHEDULER_add_delayed ((NULL == addr) | ||
181 | ? EXTERN_IP_RETRY_FAILURE | ||
182 | : EXTERN_IP_RETRY_SUCCESS, | ||
183 | &run_external_ip, | ||
184 | NULL); | ||
185 | switch (result) | ||
186 | { | ||
187 | case GNUNET_NAT_ERROR_SUCCESS: | ||
188 | if (addr->s_addr == mini_external_ipv4.s_addr) | ||
189 | return; /* not change */ | ||
190 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
191 | "Our external IP is now %s\n", | ||
192 | inet_ntop (AF_INET, | ||
193 | addr, | ||
194 | buf, | ||
195 | sizeof (buf))); | ||
196 | if (0 != mini_external_ipv4.s_addr) | ||
197 | notify_monitors_external_ipv4_change (GNUNET_NO, | ||
198 | &mini_external_ipv4); | ||
199 | mini_external_ipv4 = *addr; | ||
200 | notify_monitors_external_ipv4_change (GNUNET_YES, | ||
201 | &mini_external_ipv4); | ||
202 | break; | ||
203 | default: | ||
204 | if (0 != mini_external_ipv4.s_addr) | ||
205 | notify_monitors_external_ipv4_change (GNUNET_NO, | ||
206 | &mini_external_ipv4); | ||
207 | mini_external_ipv4.s_addr = 0; | ||
208 | break; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | |||
213 | /** | ||
214 | * Task used to run `external-ip` to get our external IPv4 | ||
215 | * address and pass it to NATed clients if possible. | ||
216 | * | ||
217 | * @param cls NULL | ||
218 | */ | ||
219 | static void | ||
220 | run_external_ip (void *cls) | ||
221 | { | ||
222 | probe_external_ip_task | ||
223 | = GNUNET_SCHEDULER_add_delayed (EXTERN_IP_RETRY_TIMEOUT, | ||
224 | &run_external_ip, | ||
225 | NULL); | ||
226 | if (NULL != probe_external_ip_op) | ||
227 | { | ||
228 | GNUNET_NAT_mini_get_external_ipv4_cancel_ (probe_external_ip_op); | ||
229 | probe_external_ip_op = NULL; | ||
230 | } | ||
231 | probe_external_ip_op | ||
232 | = GNUNET_NAT_mini_get_external_ipv4_ (&handle_external_ip, | ||
233 | NULL); | ||
234 | } | ||
235 | |||
236 | |||
237 | /** | ||
238 | * We have changed our opinion about being NATed in the first | ||
239 | * place. Adapt our probing. | ||
240 | * | ||
241 | * @param have_nat #GNUNET_YES if we believe we are behind NAT | ||
242 | */ | ||
243 | void | ||
244 | GN_nat_status_changed (int have_nat) | ||
245 | { | ||
246 | if (GNUNET_YES != enable_upnp) | ||
247 | return; | ||
248 | if ( (GNUNET_YES == have_nat) && | ||
249 | (NULL == probe_external_ip_task) && | ||
250 | (NULL == probe_external_ip_op) ) | ||
251 | { | ||
252 | probe_external_ip_task | ||
253 | = GNUNET_SCHEDULER_add_now (&run_external_ip, | ||
254 | NULL); | ||
255 | return; | ||
256 | } | ||
257 | if (GNUNET_NO == have_nat) | ||
258 | { | ||
259 | if (NULL != probe_external_ip_task) | ||
260 | { | ||
261 | GNUNET_SCHEDULER_cancel (probe_external_ip_task); | ||
262 | probe_external_ip_task = NULL; | ||
263 | } | ||
264 | if (NULL != probe_external_ip_op) | ||
265 | { | ||
266 | GNUNET_NAT_mini_get_external_ipv4_cancel_ (probe_external_ip_op); | ||
267 | probe_external_ip_op = NULL; | ||
268 | } | ||
269 | } | ||
270 | } | ||
271 | |||
272 | |||
273 | /** | ||
274 | * Start monitoring external IPv4 addresses. | ||
275 | * | ||
276 | * @param cb function to call on changes | ||
277 | * @param cb_cls closure for @a cb | ||
278 | * @return handle to cancel | ||
279 | */ | ||
280 | struct GN_ExternalIPMonitor * | ||
281 | GN_external_ipv4_monitor_start (GN_NotifyExternalIPv4Change cb, | ||
282 | void *cb_cls) | ||
283 | { | ||
284 | struct GN_ExternalIPMonitor *mon; | ||
285 | |||
286 | mon = GNUNET_new (struct GN_ExternalIPMonitor); | ||
287 | mon->cb = cb; | ||
288 | mon->cb_cls = cb_cls; | ||
289 | GNUNET_CONTAINER_DLL_insert (mon_head, | ||
290 | mon_tail, | ||
291 | mon); | ||
292 | if (0 != mini_external_ipv4.s_addr) | ||
293 | cb (cb_cls, | ||
294 | &mini_external_ipv4, | ||
295 | GNUNET_YES); | ||
296 | return mon; | ||
297 | } | ||
298 | |||
299 | |||
300 | /** | ||
301 | * Stop calling monitor. | ||
302 | * | ||
303 | * @param mon monitor to call | ||
304 | */ | ||
305 | void | ||
306 | GN_external_ipv4_monitor_stop (struct GN_ExternalIPMonitor *mon) | ||
307 | { | ||
308 | GNUNET_CONTAINER_DLL_remove (mon_head, | ||
309 | mon_tail, | ||
310 | mon); | ||
311 | GNUNET_free (mon); | ||
312 | } | ||
313 | |||
314 | /* end of gnunet-service-nat_externalip.c */ | ||
diff --git a/src/nat/gnunet-service-nat_externalip.h b/src/nat/gnunet-service-nat_externalip.h new file mode 100644 index 000000000..31910555d --- /dev/null +++ b/src/nat/gnunet-service-nat_externalip.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009, 2015, 2016, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * Code to figure out what our external IPv4 address(es) might | ||
22 | * be (external IPv4s are what is seen on the rest of the Internet). | ||
23 | * | ||
24 | * This can be implemented using different methods, and we allow | ||
25 | * the main service to be notified about changes to what we believe | ||
26 | * is our external IPv4 address. | ||
27 | * | ||
28 | * Note that this is explicitly only about NATed systems; if one | ||
29 | * of our network interfaces has a global IP address this does | ||
30 | * not count as "external". | ||
31 | * | ||
32 | * @file nat/gnunet-service-nat_externalip.h | ||
33 | * @brief Functions for monitoring external IPv4 addresses | ||
34 | * @author Christian Grothoff | ||
35 | */ | ||
36 | #ifndef GNUNET_SERVICE_NAT_EXTERNALIP_H | ||
37 | #define GNUNET_SERVICE_NAT_EXTERNALIP_H | ||
38 | |||
39 | #include "platform.h" | ||
40 | |||
41 | |||
42 | /** | ||
43 | * We have changed our opinion about being NATed in the first | ||
44 | * place. Adapt our probing. | ||
45 | * | ||
46 | * @param have_nat #GNUNET_YES if we believe we are behind NAT | ||
47 | */ | ||
48 | void | ||
49 | GN_nat_status_changed (int have_nat); | ||
50 | |||
51 | |||
52 | /** | ||
53 | * Function we call when we believe our external IPv4 address changed. | ||
54 | * | ||
55 | * @param cls closure | ||
56 | * @param ip address to add/remove | ||
57 | * @param add_remove #GNUNET_YES to add, #GNUNET_NO to remove | ||
58 | */ | ||
59 | typedef void | ||
60 | (*GN_NotifyExternalIPv4Change)(void *cls, | ||
61 | const struct in_addr *ip, | ||
62 | int add_remove); | ||
63 | |||
64 | |||
65 | /** | ||
66 | * Handle to monitor for external IP changes. | ||
67 | */ | ||
68 | struct GN_ExternalIPMonitor; | ||
69 | |||
70 | |||
71 | /** | ||
72 | * Start monitoring external IPv4 addresses. | ||
73 | * | ||
74 | * @param cb function to call on changes | ||
75 | * @param cb_cls closure for @a cb | ||
76 | * @return handle to cancel | ||
77 | */ | ||
78 | struct GN_ExternalIPMonitor * | ||
79 | GN_external_ipv4_monitor_start (GN_NotifyExternalIPv4Change cb, | ||
80 | void *cb_cls); | ||
81 | |||
82 | |||
83 | /** | ||
84 | * Stop calling monitor. | ||
85 | * | ||
86 | * @param mon monitor to call | ||
87 | */ | ||
88 | void | ||
89 | GN_external_ipv4_monitor_stop (struct GN_ExternalIPMonitor *mon); | ||
90 | |||
91 | |||
92 | #endif | ||
diff --git a/src/nat/gnunet-service-nat_helper.c b/src/nat/gnunet-service-nat_helper.c index 7e5051d65..e91f63beb 100644 --- a/src/nat/gnunet-service-nat_helper.c +++ b/src/nat/gnunet-service-nat_helper.c | |||
@@ -49,7 +49,7 @@ struct HelperContext | |||
49 | * Closure for @e cb. | 49 | * Closure for @e cb. |
50 | */ | 50 | */ |
51 | void *cb_cls; | 51 | void *cb_cls; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * How long do we wait for restarting a crashed gnunet-helper-nat-server? | 54 | * How long do we wait for restarting a crashed gnunet-helper-nat-server? |
55 | */ | 55 | */ |
@@ -126,7 +126,7 @@ nat_server_read (void *cls) | |||
126 | memset (mybuf, | 126 | memset (mybuf, |
127 | 0, | 127 | 0, |
128 | sizeof (mybuf)); | 128 | sizeof (mybuf)); |
129 | bytes | 129 | bytes |
130 | = GNUNET_DISK_file_read (h->server_stdout_handle, | 130 | = GNUNET_DISK_file_read (h->server_stdout_handle, |
131 | mybuf, | 131 | mybuf, |
132 | sizeof (mybuf)); | 132 | sizeof (mybuf)); |
@@ -134,7 +134,7 @@ nat_server_read (void *cls) | |||
134 | { | 134 | { |
135 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 135 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
136 | "Finished reading from server stdout with code: %d\n", | 136 | "Finished reading from server stdout with code: %d\n", |
137 | bytes); | 137 | (int) bytes); |
138 | if (0 != GNUNET_OS_process_kill (h->server_proc, | 138 | if (0 != GNUNET_OS_process_kill (h->server_proc, |
139 | GNUNET_TERM_SIG)) | 139 | GNUNET_TERM_SIG)) |
140 | GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, | 140 | GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, |
@@ -185,7 +185,7 @@ nat_server_read (void *cls) | |||
185 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 185 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
186 | _("gnunet-helper-nat-server generated malformed address `%s'\n"), | 186 | _("gnunet-helper-nat-server generated malformed address `%s'\n"), |
187 | mybuf); | 187 | mybuf); |
188 | h->server_read_task | 188 | h->server_read_task |
189 | = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 189 | = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
190 | h->server_stdout_handle, | 190 | h->server_stdout_handle, |
191 | &nat_server_read, | 191 | &nat_server_read, |
@@ -199,7 +199,7 @@ nat_server_read (void *cls) | |||
199 | port); | 199 | port); |
200 | h->cb (h->cb_cls, | 200 | h->cb (h->cb_cls, |
201 | &sin_addr); | 201 | &sin_addr); |
202 | h->server_read_task | 202 | h->server_read_task |
203 | = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 203 | = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
204 | h->server_stdout_handle, | 204 | h->server_stdout_handle, |
205 | &nat_server_read, | 205 | &nat_server_read, |
@@ -219,9 +219,9 @@ restart_nat_server (void *cls) | |||
219 | struct HelperContext *h = cls; | 219 | struct HelperContext *h = cls; |
220 | char *binary; | 220 | char *binary; |
221 | char ia[INET_ADDRSTRLEN]; | 221 | char ia[INET_ADDRSTRLEN]; |
222 | 222 | ||
223 | h->server_read_task = NULL; | 223 | h->server_read_task = NULL; |
224 | h->server_stdout | 224 | h->server_stdout |
225 | = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, | 225 | = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, |
226 | GNUNET_NO, GNUNET_YES); | 226 | GNUNET_NO, GNUNET_YES); |
227 | if (NULL == h->server_stdout) | 227 | if (NULL == h->server_stdout) |
@@ -243,7 +243,7 @@ restart_nat_server (void *cls) | |||
243 | /* Start the server process */ | 243 | /* Start the server process */ |
244 | binary | 244 | binary |
245 | = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server"); | 245 | = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server"); |
246 | h->server_proc | 246 | h->server_proc |
247 | = GNUNET_OS_start_process (GNUNET_NO, | 247 | = GNUNET_OS_start_process (GNUNET_NO, |
248 | 0, | 248 | 0, |
249 | NULL, | 249 | NULL, |
@@ -267,10 +267,10 @@ restart_nat_server (void *cls) | |||
267 | /* Close the write end of the read pipe */ | 267 | /* Close the write end of the read pipe */ |
268 | GNUNET_DISK_pipe_close_end (h->server_stdout, | 268 | GNUNET_DISK_pipe_close_end (h->server_stdout, |
269 | GNUNET_DISK_PIPE_END_WRITE); | 269 | GNUNET_DISK_PIPE_END_WRITE); |
270 | h->server_stdout_handle | 270 | h->server_stdout_handle |
271 | = GNUNET_DISK_pipe_handle (h->server_stdout, | 271 | = GNUNET_DISK_pipe_handle (h->server_stdout, |
272 | GNUNET_DISK_PIPE_END_READ); | 272 | GNUNET_DISK_PIPE_END_READ); |
273 | h->server_read_task | 273 | h->server_read_task |
274 | = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 274 | = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
275 | h->server_stdout_handle, | 275 | h->server_stdout_handle, |
276 | &nat_server_read, | 276 | &nat_server_read, |
@@ -316,7 +316,7 @@ GN_start_gnunet_nat_server_ (const struct in_addr *internal_address, | |||
316 | */ | 316 | */ |
317 | void | 317 | void |
318 | GN_stop_gnunet_nat_server_ (struct HelperContext *h) | 318 | GN_stop_gnunet_nat_server_ (struct HelperContext *h) |
319 | { | 319 | { |
320 | if (NULL != h->server_read_task) | 320 | if (NULL != h->server_read_task) |
321 | { | 321 | { |
322 | GNUNET_SCHEDULER_cancel (h->server_read_task); | 322 | GNUNET_SCHEDULER_cancel (h->server_read_task); |
@@ -384,13 +384,13 @@ GN_request_connection_reversal (const struct in_addr *internal_address, | |||
384 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, | 384 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, |
385 | "inet_ntop"); | 385 | "inet_ntop"); |
386 | return GNUNET_SYSERR; | 386 | return GNUNET_SYSERR; |
387 | } | 387 | } |
388 | GNUNET_snprintf (port_as_string, | 388 | GNUNET_snprintf (port_as_string, |
389 | sizeof (port_as_string), | 389 | sizeof (port_as_string), |
390 | "%d", | 390 | "%d", |
391 | internal_port); | 391 | internal_port); |
392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
393 | _("Running gnunet-helper-nat-client %s %s %u\n"), | 393 | "Running gnunet-helper-nat-client %s %s %u\n", |
394 | intv4, | 394 | intv4, |
395 | remv4, | 395 | remv4, |
396 | internal_port); | 396 | internal_port); |
diff --git a/src/nat/gnunet-service-nat_mini.h b/src/nat/gnunet-service-nat_mini.h index 2c0dd3445..8a7af9bf1 100644 --- a/src/nat/gnunet-service-nat_mini.h +++ b/src/nat/gnunet-service-nat_mini.h | |||
@@ -55,7 +55,7 @@ struct GNUNET_NAT_ExternalHandle; | |||
55 | */ | 55 | */ |
56 | struct GNUNET_NAT_ExternalHandle * | 56 | struct GNUNET_NAT_ExternalHandle * |
57 | GNUNET_NAT_mini_get_external_ipv4_ (GNUNET_NAT_IPCallback cb, | 57 | GNUNET_NAT_mini_get_external_ipv4_ (GNUNET_NAT_IPCallback cb, |
58 | void *cb_cls); | 58 | void *cb_cls); |
59 | 59 | ||
60 | 60 | ||
61 | /** | 61 | /** |
diff --git a/src/nat/nat.c b/src/nat/nat.c deleted file mode 100644 index 08dd5dd1e..000000000 --- a/src/nat/nat.c +++ /dev/null | |||
@@ -1,2054 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009, 2010, 2011 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file nat/nat.c | ||
23 | * @brief Library handling UPnP and NAT-PMP port forwarding and | ||
24 | * external IP address retrieval | ||
25 | * @author Milan Bouchet-Valat | ||
26 | * @author Christian Grothoff | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_util_lib.h" | ||
30 | #include "gnunet_resolver_service.h" | ||
31 | #include "gnunet_nat_lib.h" | ||
32 | #include "nat.h" | ||
33 | |||
34 | #define LOG(kind,...) GNUNET_log_from (kind, "nat", __VA_ARGS__) | ||
35 | |||
36 | /** | ||
37 | * How often do we scan for changes in our IP address from our local | ||
38 | * interfaces? | ||
39 | */ | ||
40 | #define IFC_SCAN_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | ||
41 | |||
42 | /** | ||
43 | * How often do we scan for changes in how our hostname resolves? | ||
44 | */ | ||
45 | #define HOSTNAME_DNS_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 20) | ||
46 | |||
47 | |||
48 | /** | ||
49 | * How often do we scan for changes in how our external (dyndns) hostname resolves? | ||
50 | */ | ||
51 | #define DYNDNS_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 7) | ||
52 | |||
53 | /** | ||
54 | * How long until we give up trying to resolve our own hostname? | ||
55 | */ | ||
56 | #define HOSTNAME_RESOLVE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | ||
57 | |||
58 | |||
59 | /** | ||
60 | * How often do we check a STUN server ? | ||
61 | */ | ||
62 | #define STUN_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2) | ||
63 | |||
64 | |||
65 | /** | ||
66 | * Where did the given local address originate from? | ||
67 | * To be used for debugging as well as in the future | ||
68 | * to remove all addresses from a certain source when | ||
69 | * we reevaluate the source. | ||
70 | */ | ||
71 | enum LocalAddressSource | ||
72 | { | ||
73 | /** | ||
74 | * Address was obtained by DNS resolution of the external hostname | ||
75 | * given in the configuration (i.e. hole-punched DynDNS setup). | ||
76 | */ | ||
77 | LAL_EXTERNAL_IP, | ||
78 | |||
79 | /** | ||
80 | * Address was obtained by an external STUN server | ||
81 | */ | ||
82 | LAL_EXTERNAL_STUN_IP, | ||
83 | |||
84 | /** | ||
85 | * Address was obtained by DNS resolution of the external hostname | ||
86 | * given in the configuration (i.e. hole-punched DynDNS setup) | ||
87 | * during the previous iteration (see #3213). | ||
88 | */ | ||
89 | LAL_EXTERNAL_IP_OLD, | ||
90 | |||
91 | /** | ||
92 | * Address was obtained by looking up our own hostname in DNS. | ||
93 | */ | ||
94 | LAL_HOSTNAME_DNS, | ||
95 | |||
96 | /** | ||
97 | * Address was obtained by scanning our hosts's network interfaces | ||
98 | * and taking their address (no DNS involved). | ||
99 | */ | ||
100 | LAL_INTERFACE_ADDRESS, | ||
101 | |||
102 | /** | ||
103 | * Addresses we were explicitly bound to. | ||
104 | */ | ||
105 | LAL_BINDTO_ADDRESS, | ||
106 | |||
107 | /** | ||
108 | * Addresses from UPnP or PMP | ||
109 | */ | ||
110 | LAL_UPNP, | ||
111 | |||
112 | /** | ||
113 | * End of the list. | ||
114 | */ | ||
115 | LAL_END | ||
116 | }; | ||
117 | |||
118 | |||
119 | /** | ||
120 | * List of local addresses that we currently deem valid. Actual | ||
121 | * struct is followed by the 'struct sockaddr'. Note that the code | ||
122 | * intentionally makes no attempt to ensure that a particular address | ||
123 | * is only listed once (especially since it may come from different | ||
124 | * sources, and the source is an "internal" construct). | ||
125 | */ | ||
126 | struct LocalAddressList | ||
127 | { | ||
128 | /** | ||
129 | * This is a linked list. | ||
130 | */ | ||
131 | struct LocalAddressList *next; | ||
132 | |||
133 | /** | ||
134 | * Previous entry. | ||
135 | */ | ||
136 | struct LocalAddressList *prev; | ||
137 | |||
138 | /** | ||
139 | * Number of bytes of address that follow. | ||
140 | */ | ||
141 | socklen_t addrlen; | ||
142 | |||
143 | /** | ||
144 | * Origin of the local address. | ||
145 | */ | ||
146 | enum LocalAddressSource source; | ||
147 | }; | ||
148 | |||
149 | |||
150 | /** | ||
151 | * Handle for miniupnp-based NAT traversal actions. | ||
152 | */ | ||
153 | struct MiniList | ||
154 | { | ||
155 | |||
156 | /** | ||
157 | * Doubly-linked list. | ||
158 | */ | ||
159 | struct MiniList *next; | ||
160 | |||
161 | /** | ||
162 | * Doubly-linked list. | ||
163 | */ | ||
164 | struct MiniList *prev; | ||
165 | |||
166 | /** | ||
167 | * Handle to mini-action. | ||
168 | */ | ||
169 | struct GNUNET_NAT_MiniHandle *mini; | ||
170 | |||
171 | /** | ||
172 | * Local port number that was mapped. | ||
173 | */ | ||
174 | uint16_t port; | ||
175 | |||
176 | }; | ||
177 | |||
178 | |||
179 | /** | ||
180 | * List of STUN servers | ||
181 | */ | ||
182 | struct StunServerList | ||
183 | { | ||
184 | |||
185 | /** | ||
186 | * Doubly-linked list. | ||
187 | */ | ||
188 | struct StunServerList *next; | ||
189 | |||
190 | /** | ||
191 | * Doubly-linked list. | ||
192 | */ | ||
193 | struct StunServerList *prev; | ||
194 | |||
195 | /** | ||
196 | * Address | ||
197 | */ | ||
198 | char * address; | ||
199 | |||
200 | /** | ||
201 | * Server Port | ||
202 | */ | ||
203 | uint16_t port; | ||
204 | |||
205 | }; | ||
206 | |||
207 | |||
208 | /** | ||
209 | * Handle for active NAT registrations. | ||
210 | */ | ||
211 | struct GNUNET_NAT_Handle | ||
212 | { | ||
213 | |||
214 | /** | ||
215 | * Configuration to use. | ||
216 | */ | ||
217 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
218 | |||
219 | /** | ||
220 | * Function to call when we learn about a new address. | ||
221 | */ | ||
222 | GNUNET_NAT_AddressCallback address_callback; | ||
223 | |||
224 | /** | ||
225 | * Function to call when we notice another peer asking for | ||
226 | * connection reversal. | ||
227 | */ | ||
228 | GNUNET_NAT_ReversalCallback reversal_callback; | ||
229 | |||
230 | /** | ||
231 | * Closure for callbacks (@e address_callback and @e reversal_callback) | ||
232 | */ | ||
233 | void *callback_cls; | ||
234 | |||
235 | /** | ||
236 | * Handle for (DYN)DNS lookup of our external IP. | ||
237 | */ | ||
238 | struct GNUNET_RESOLVER_RequestHandle *ext_dns; | ||
239 | |||
240 | /** | ||
241 | * Handle for request of hostname resolution, non-NULL if pending. | ||
242 | */ | ||
243 | struct GNUNET_RESOLVER_RequestHandle *hostname_dns; | ||
244 | |||
245 | /** | ||
246 | * stdout pipe handle for the gnunet-helper-nat-server process | ||
247 | */ | ||
248 | struct GNUNET_DISK_PipeHandle *server_stdout; | ||
249 | |||
250 | /** | ||
251 | * stdout file handle (for reading) for the gnunet-helper-nat-server process | ||
252 | */ | ||
253 | const struct GNUNET_DISK_FileHandle *server_stdout_handle; | ||
254 | |||
255 | /** | ||
256 | * Linked list of currently valid addresses (head). | ||
257 | */ | ||
258 | struct LocalAddressList *lal_head; | ||
259 | |||
260 | /** | ||
261 | * Linked list of currently valid addresses (tail). | ||
262 | */ | ||
263 | struct LocalAddressList *lal_tail; | ||
264 | |||
265 | /** | ||
266 | * How long do we wait for restarting a crashed gnunet-helper-nat-server? | ||
267 | */ | ||
268 | struct GNUNET_TIME_Relative server_retry_delay; | ||
269 | |||
270 | /** | ||
271 | * ID of select gnunet-helper-nat-server stdout read task | ||
272 | */ | ||
273 | struct GNUNET_SCHEDULER_Task *server_read_task; | ||
274 | |||
275 | /** | ||
276 | * ID of interface IP-scan task | ||
277 | */ | ||
278 | struct GNUNET_SCHEDULER_Task *ifc_task; | ||
279 | |||
280 | /** | ||
281 | * ID of hostname DNS lookup task | ||
282 | */ | ||
283 | struct GNUNET_SCHEDULER_Task *hostname_task; | ||
284 | |||
285 | /** | ||
286 | * ID of DynDNS lookup task | ||
287 | */ | ||
288 | struct GNUNET_SCHEDULER_Task *dns_task; | ||
289 | |||
290 | /** | ||
291 | * Active STUN request, if any. | ||
292 | */ | ||
293 | struct GNUNET_NAT_STUN_Handle *stun_request; | ||
294 | |||
295 | /** | ||
296 | * How often do we scan for changes in our IP address from our local | ||
297 | * interfaces? | ||
298 | */ | ||
299 | struct GNUNET_TIME_Relative ifc_scan_frequency; | ||
300 | |||
301 | /** | ||
302 | * How often do we scan for changes in how our hostname resolves? | ||
303 | */ | ||
304 | struct GNUNET_TIME_Relative hostname_dns_frequency; | ||
305 | |||
306 | /** | ||
307 | * How often do we scan for changes in how our external (dyndns) hostname resolves? | ||
308 | */ | ||
309 | struct GNUNET_TIME_Relative dyndns_frequency; | ||
310 | |||
311 | /** | ||
312 | * The process id of the server process (if behind NAT) | ||
313 | */ | ||
314 | struct GNUNET_OS_Process *server_proc; | ||
315 | |||
316 | /** | ||
317 | * LAN address as passed by the caller (array). | ||
318 | */ | ||
319 | struct sockaddr **local_addrs; | ||
320 | |||
321 | /** | ||
322 | * Length of the @e local_addrs. | ||
323 | */ | ||
324 | socklen_t *local_addrlens; | ||
325 | |||
326 | /** | ||
327 | * List of handles for UPnP-traversal, one per local port (if | ||
328 | * not IPv6-only). | ||
329 | */ | ||
330 | struct MiniList *mini_head; | ||
331 | |||
332 | /** | ||
333 | * List of handles for UPnP-traversal, one per local port (if | ||
334 | * not IPv6-only). | ||
335 | */ | ||
336 | struct MiniList *mini_tail; | ||
337 | |||
338 | /** | ||
339 | * Number of entries in 'local_addrs' array. | ||
340 | */ | ||
341 | unsigned int num_local_addrs; | ||
342 | |||
343 | /** | ||
344 | * Our external address (according to config, UPnP may disagree...), | ||
345 | * in dotted decimal notation, IPv4-only. Or NULL if not known. | ||
346 | */ | ||
347 | char *external_address; | ||
348 | |||
349 | /** | ||
350 | * Presumably our internal address (according to config) | ||
351 | */ | ||
352 | char *internal_address; | ||
353 | |||
354 | /** | ||
355 | * Is this transport configured to be behind a NAT? | ||
356 | */ | ||
357 | int behind_nat; | ||
358 | |||
359 | /** | ||
360 | * Has the NAT been punched? (according to config) | ||
361 | */ | ||
362 | int nat_punched; | ||
363 | |||
364 | /** | ||
365 | * Is this transport configured to allow connections to NAT'd peers? | ||
366 | */ | ||
367 | int enable_nat_client; | ||
368 | |||
369 | /** | ||
370 | * Should we run the gnunet-helper-nat-server? | ||
371 | */ | ||
372 | int enable_nat_server; | ||
373 | |||
374 | /** | ||
375 | * Are we allowed to try UPnP/PMP for NAT traversal? | ||
376 | */ | ||
377 | int enable_upnp; | ||
378 | |||
379 | /** | ||
380 | * Should we use local addresses (loopback)? (according to config) | ||
381 | */ | ||
382 | int use_localaddresses; | ||
383 | |||
384 | /** | ||
385 | * Should we return local addresses to clients | ||
386 | */ | ||
387 | int return_localaddress; | ||
388 | |||
389 | /** | ||
390 | * Should we do a DNS lookup of our hostname to find out our own IP? | ||
391 | */ | ||
392 | int use_hostname; | ||
393 | |||
394 | /** | ||
395 | * Is using IPv6 disabled? | ||
396 | */ | ||
397 | int disable_ipv6; | ||
398 | |||
399 | /** | ||
400 | * Is this TCP or UDP? | ||
401 | */ | ||
402 | int is_tcp; | ||
403 | |||
404 | /** | ||
405 | * Port we advertise to the outside. | ||
406 | */ | ||
407 | uint16_t adv_port; | ||
408 | |||
409 | /** | ||
410 | * Should we use STUN ? | ||
411 | */ | ||
412 | int use_stun; | ||
413 | |||
414 | /** | ||
415 | * How often should we check STUN ? | ||
416 | */ | ||
417 | struct GNUNET_TIME_Relative stun_frequency; | ||
418 | |||
419 | /** | ||
420 | * STUN socket | ||
421 | */ | ||
422 | struct GNUNET_NETWORK_Handle* socket; | ||
423 | |||
424 | /* | ||
425 | * Am I waiting for a STUN response ? | ||
426 | */ | ||
427 | int waiting_stun; | ||
428 | |||
429 | /** | ||
430 | * STUN request task | ||
431 | */ | ||
432 | struct GNUNET_SCHEDULER_Task *stun_task; | ||
433 | |||
434 | /** | ||
435 | * Head of List of STUN servers | ||
436 | */ | ||
437 | struct StunServerList *stun_servers_head; | ||
438 | |||
439 | /** | ||
440 | * Tail of List of STUN servers | ||
441 | */ | ||
442 | struct StunServerList *stun_servers_tail; | ||
443 | |||
444 | /** | ||
445 | * Actual STUN Server | ||
446 | */ | ||
447 | struct StunServerList *actual_stun_server; | ||
448 | |||
449 | }; | ||
450 | |||
451 | |||
452 | /** | ||
453 | * Try to start the gnunet-helper-nat-server (if it is not | ||
454 | * already running). | ||
455 | * | ||
456 | * @param h handle to NAT | ||
457 | */ | ||
458 | static void | ||
459 | start_gnunet_nat_server (struct GNUNET_NAT_Handle *h); | ||
460 | |||
461 | |||
462 | /** | ||
463 | * Remove all addresses from the list of 'local' addresses | ||
464 | * that originated from the given source. | ||
465 | * | ||
466 | * @param h handle to NAT | ||
467 | * @param src source that identifies addresses to remove | ||
468 | */ | ||
469 | static void | ||
470 | remove_from_address_list_by_source (struct GNUNET_NAT_Handle *h, | ||
471 | enum LocalAddressSource src) | ||
472 | { | ||
473 | struct LocalAddressList *pos; | ||
474 | struct LocalAddressList *next; | ||
475 | |||
476 | next = h->lal_head; | ||
477 | while (NULL != (pos = next)) | ||
478 | { | ||
479 | next = pos->next; | ||
480 | if (pos->source != src) | ||
481 | continue; | ||
482 | GNUNET_CONTAINER_DLL_remove (h->lal_head, | ||
483 | h->lal_tail, | ||
484 | pos); | ||
485 | if (NULL != h->address_callback) | ||
486 | h->address_callback (h->callback_cls, | ||
487 | GNUNET_NO, | ||
488 | (const struct sockaddr *) &pos[1], | ||
489 | pos->addrlen); | ||
490 | GNUNET_free (pos); | ||
491 | } | ||
492 | } | ||
493 | |||
494 | |||
495 | /** | ||
496 | * Add the given address to the list of 'local' addresses, thereby | ||
497 | * making it a 'legal' address for this peer to have. | ||
498 | * | ||
499 | * @param h handle to NAT | ||
500 | * @param src where did the local address originate from? | ||
501 | * @param arg the address, some `struct sockaddr` | ||
502 | * @param arg_size number of bytes in @a arg | ||
503 | */ | ||
504 | static void | ||
505 | add_to_address_list_as_is (struct GNUNET_NAT_Handle *h, | ||
506 | enum LocalAddressSource src, | ||
507 | const struct sockaddr *arg, | ||
508 | socklen_t arg_size) | ||
509 | { | ||
510 | struct LocalAddressList *lal; | ||
511 | |||
512 | lal = GNUNET_malloc (sizeof (struct LocalAddressList) + arg_size); | ||
513 | GNUNET_memcpy (&lal[1], arg, arg_size); | ||
514 | lal->addrlen = arg_size; | ||
515 | lal->source = src; | ||
516 | GNUNET_CONTAINER_DLL_insert (h->lal_head, | ||
517 | h->lal_tail, | ||
518 | lal); | ||
519 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
520 | "Adding address `%s' from source %d\n", | ||
521 | GNUNET_a2s (arg, arg_size), | ||
522 | src); | ||
523 | if (NULL != h->address_callback) | ||
524 | h->address_callback (h->callback_cls, | ||
525 | GNUNET_YES, | ||
526 | arg, | ||
527 | arg_size); | ||
528 | } | ||
529 | |||
530 | |||
531 | /** | ||
532 | * Add the given address to the list of 'local' addresses, thereby | ||
533 | * making it a 'legal' address for this peer to have. Set the | ||
534 | * port number in the process to the advertised port and possibly | ||
535 | * also to zero (if we have the gnunet-helper-nat-server). | ||
536 | * | ||
537 | * @param h handle to NAT | ||
538 | * @param src where did the local address originate from? | ||
539 | * @param arg the address, some `struct sockaddr` | ||
540 | * @param arg_size number of bytes in @a arg | ||
541 | */ | ||
542 | static void | ||
543 | add_to_address_list (struct GNUNET_NAT_Handle *h, | ||
544 | enum LocalAddressSource src, | ||
545 | const struct sockaddr *arg, | ||
546 | socklen_t arg_size) | ||
547 | { | ||
548 | struct sockaddr_in s4; | ||
549 | const struct sockaddr_in *in4; | ||
550 | struct sockaddr_in6 s6; | ||
551 | const struct sockaddr_in6 *in6; | ||
552 | |||
553 | if (arg_size == sizeof (struct sockaddr_in)) | ||
554 | { | ||
555 | in4 = (const struct sockaddr_in *) arg; | ||
556 | s4 = *in4; | ||
557 | s4.sin_port = htons (h->adv_port); | ||
558 | add_to_address_list_as_is (h, src, (const struct sockaddr *) &s4, | ||
559 | sizeof (struct sockaddr_in)); | ||
560 | if (GNUNET_YES == h->enable_nat_server) | ||
561 | { | ||
562 | /* also add with PORT = 0 to indicate NAT server is enabled */ | ||
563 | s4.sin_port = htons (0); | ||
564 | add_to_address_list_as_is (h, src, (const struct sockaddr *) &s4, | ||
565 | sizeof (struct sockaddr_in)); | ||
566 | } | ||
567 | } | ||
568 | else if (arg_size == sizeof (struct sockaddr_in6)) | ||
569 | { | ||
570 | if (GNUNET_YES != h->disable_ipv6) | ||
571 | { | ||
572 | in6 = (const struct sockaddr_in6 *) arg; | ||
573 | s6 = *in6; | ||
574 | s6.sin6_port = htons (h->adv_port); | ||
575 | add_to_address_list_as_is (h, src, (const struct sockaddr *) &s6, | ||
576 | sizeof (struct sockaddr_in6)); | ||
577 | } | ||
578 | } | ||
579 | else | ||
580 | { | ||
581 | GNUNET_assert (0); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | |||
586 | /** | ||
587 | * Add the given IP address to the list of 'local' addresses, thereby | ||
588 | * making it a 'legal' address for this peer to have. | ||
589 | * | ||
590 | * @param h handle to NAT | ||
591 | * @param src where did the local address originate from? | ||
592 | * @param addr the address, some `struct in_addr` or `struct in6_addr` | ||
593 | * @param addrlen number of bytes in addr | ||
594 | */ | ||
595 | static void | ||
596 | add_ip_to_address_list (struct GNUNET_NAT_Handle *h, | ||
597 | enum LocalAddressSource src, | ||
598 | const void *addr, | ||
599 | socklen_t addrlen) | ||
600 | { | ||
601 | struct sockaddr_in s4; | ||
602 | const struct in_addr *in4; | ||
603 | struct sockaddr_in6 s6; | ||
604 | const struct in6_addr *in6; | ||
605 | |||
606 | if (addrlen == sizeof (struct in_addr)) | ||
607 | { | ||
608 | in4 = (const struct in_addr *) addr; | ||
609 | memset (&s4, 0, sizeof (s4)); | ||
610 | s4.sin_family = AF_INET; | ||
611 | s4.sin_port = 0; | ||
612 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
613 | s4.sin_len = (u_char) sizeof (struct sockaddr_in); | ||
614 | #endif | ||
615 | s4.sin_addr = *in4; | ||
616 | add_to_address_list (h, src, (const struct sockaddr *) &s4, | ||
617 | sizeof (struct sockaddr_in)); | ||
618 | if (GNUNET_YES == h->enable_nat_server) | ||
619 | { | ||
620 | /* also add with PORT = 0 to indicate NAT server is enabled */ | ||
621 | s4.sin_port = htons (0); | ||
622 | add_to_address_list (h, src, (const struct sockaddr *) &s4, | ||
623 | sizeof (struct sockaddr_in)); | ||
624 | |||
625 | } | ||
626 | } | ||
627 | else if (addrlen == sizeof (struct in6_addr)) | ||
628 | { | ||
629 | if (GNUNET_YES != h->disable_ipv6) | ||
630 | { | ||
631 | in6 = (const struct in6_addr *) addr; | ||
632 | memset (&s6, 0, sizeof (s6)); | ||
633 | s6.sin6_family = AF_INET6; | ||
634 | s6.sin6_port = htons (h->adv_port); | ||
635 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
636 | s6.sin6_len = (u_char) sizeof (struct sockaddr_in6); | ||
637 | #endif | ||
638 | s6.sin6_addr = *in6; | ||
639 | add_to_address_list (h, src, (const struct sockaddr *) &s6, | ||
640 | sizeof (struct sockaddr_in6)); | ||
641 | } | ||
642 | } | ||
643 | else | ||
644 | { | ||
645 | GNUNET_assert (0); | ||
646 | } | ||
647 | } | ||
648 | |||
649 | |||
650 | /** | ||
651 | * Task to do DNS lookup on our external hostname to | ||
652 | * get DynDNS-IP addresses. | ||
653 | * | ||
654 | * @param cls the NAT handle | ||
655 | */ | ||
656 | static void | ||
657 | resolve_dns (void *cls); | ||
658 | |||
659 | |||
660 | /** | ||
661 | * Our (external) hostname was resolved and the configuration says that | ||
662 | * the NAT was hole-punched. | ||
663 | * | ||
664 | * @param cls the `struct GNUNET_NAT_Handle` | ||
665 | * @param addr NULL on error, otherwise result of DNS lookup | ||
666 | * @param addrlen number of bytes in @a addr | ||
667 | */ | ||
668 | static void | ||
669 | process_external_ip (void *cls, | ||
670 | const struct sockaddr *addr, | ||
671 | socklen_t addrlen) | ||
672 | { | ||
673 | struct GNUNET_NAT_Handle *h = cls; | ||
674 | struct in_addr dummy; | ||
675 | |||
676 | if (NULL == addr) | ||
677 | { | ||
678 | h->ext_dns = NULL; | ||
679 | /* Current iteration is over, remove 'old' IPs now */ | ||
680 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
681 | "Purging old IPs for external address\n"); | ||
682 | remove_from_address_list_by_source (h, | ||
683 | LAL_EXTERNAL_IP_OLD); | ||
684 | if (1 == inet_pton (AF_INET, | ||
685 | h->external_address, | ||
686 | &dummy)) | ||
687 | { | ||
688 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
689 | "Got numeric IP for external address, not repeating lookup\n"); | ||
690 | return; /* repated lookup pointless: was numeric! */ | ||
691 | } | ||
692 | h->dns_task = | ||
693 | GNUNET_SCHEDULER_add_delayed (h->dyndns_frequency, | ||
694 | &resolve_dns, h); | ||
695 | return; | ||
696 | } | ||
697 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
698 | "Got IP `%s' for external address `%s'\n", | ||
699 | GNUNET_a2s (addr, | ||
700 | addrlen), | ||
701 | h->external_address); | ||
702 | add_to_address_list (h, | ||
703 | LAL_EXTERNAL_IP, | ||
704 | addr, | ||
705 | addrlen); | ||
706 | } | ||
707 | |||
708 | |||
709 | /** | ||
710 | * Task to do a lookup on our hostname for IP addresses. | ||
711 | * | ||
712 | * @param cls the NAT handle | ||
713 | */ | ||
714 | static void | ||
715 | resolve_hostname (void *cls); | ||
716 | |||
717 | |||
718 | /** | ||
719 | * Function called by the resolver for each address obtained from DNS | ||
720 | * for our own hostname. Add the addresses to the list of our IP | ||
721 | * addresses. | ||
722 | * | ||
723 | * @param cls closure | ||
724 | * @param addr one of the addresses of the host, NULL for the last address | ||
725 | * @param addrlen length of the @a addr | ||
726 | */ | ||
727 | static void | ||
728 | process_hostname_ip (void *cls, | ||
729 | const struct sockaddr *addr, | ||
730 | socklen_t addrlen) | ||
731 | { | ||
732 | struct GNUNET_NAT_Handle *h = cls; | ||
733 | |||
734 | if (NULL == addr) | ||
735 | { | ||
736 | h->hostname_dns = NULL; | ||
737 | h->hostname_task = | ||
738 | GNUNET_SCHEDULER_add_delayed (h->hostname_dns_frequency, | ||
739 | &resolve_hostname, | ||
740 | h); | ||
741 | return; | ||
742 | } | ||
743 | add_to_address_list (h, | ||
744 | LAL_HOSTNAME_DNS, | ||
745 | addr, | ||
746 | addrlen); | ||
747 | } | ||
748 | |||
749 | |||
750 | /** | ||
751 | * Length of the interface names returned from os_network.c. | ||
752 | * (in that file, hardcoded at 11). | ||
753 | */ | ||
754 | #define IF_NAME_LEN 11 | ||
755 | |||
756 | |||
757 | /** | ||
758 | * Add the IP of our network interface to the list of | ||
759 | * our IP addresses. | ||
760 | * | ||
761 | * @param cls the `struct GNUNET_NAT_Handle` | ||
762 | * @param name name of the interface | ||
763 | * @param isDefault do we think this may be our default interface | ||
764 | * @param addr address of the interface | ||
765 | * @param broadcast_addr the broadcast address (can be NULL for unknown or unassigned) | ||
766 | * @param netmask the network mask (can be NULL for unknown or unassigned)) | ||
767 | * @param addrlen number of bytes in @a addr and @a broadcast_addr | ||
768 | * @return #GNUNET_OK to continue iterating | ||
769 | */ | ||
770 | static int | ||
771 | process_interfaces (void *cls, | ||
772 | const char *name, | ||
773 | int isDefault, | ||
774 | const struct sockaddr *addr, | ||
775 | const struct sockaddr *broadcast_addr, | ||
776 | const struct sockaddr *netmask, | ||
777 | socklen_t addrlen) | ||
778 | { | ||
779 | const static struct in6_addr any6 = IN6ADDR_ANY_INIT; | ||
780 | struct GNUNET_NAT_Handle *h = cls; | ||
781 | const struct sockaddr_in *s4; | ||
782 | const struct sockaddr_in6 *s6; | ||
783 | const void *ip; | ||
784 | char buf[INET6_ADDRSTRLEN]; | ||
785 | unsigned int i; | ||
786 | int have_any; | ||
787 | char *tun_if; | ||
788 | |||
789 | /* skip virtual interfaces created by GNUnet-vpn */ | ||
790 | if (GNUNET_OK == | ||
791 | GNUNET_CONFIGURATION_get_value_string (h->cfg, | ||
792 | "vpn", | ||
793 | "IFNAME", | ||
794 | &tun_if)) | ||
795 | { | ||
796 | if (0 == strncasecmp (name, | ||
797 | tun_if, | ||
798 | IF_NAME_LEN)) | ||
799 | { | ||
800 | GNUNET_free (tun_if); | ||
801 | return GNUNET_OK; | ||
802 | } | ||
803 | GNUNET_free (tun_if); | ||
804 | } | ||
805 | /* skip virtual interfaces created by GNUnet-dns */ | ||
806 | if (GNUNET_OK == | ||
807 | GNUNET_CONFIGURATION_get_value_string (h->cfg, | ||
808 | "dns", | ||
809 | "IFNAME", | ||
810 | &tun_if)) | ||
811 | { | ||
812 | if (0 == strncasecmp (name, | ||
813 | tun_if, | ||
814 | IF_NAME_LEN)) | ||
815 | { | ||
816 | GNUNET_free (tun_if); | ||
817 | return GNUNET_OK; | ||
818 | } | ||
819 | GNUNET_free (tun_if); | ||
820 | } | ||
821 | /* skip virtual interfaces created by GNUnet-exit */ | ||
822 | if (GNUNET_OK == | ||
823 | GNUNET_CONFIGURATION_get_value_string (h->cfg, | ||
824 | "exit", | ||
825 | "TUN_IFNAME", | ||
826 | &tun_if)) | ||
827 | { | ||
828 | if (0 == strncasecmp (name, | ||
829 | tun_if, | ||
830 | IF_NAME_LEN)) | ||
831 | { | ||
832 | GNUNET_free (tun_if); | ||
833 | return GNUNET_OK; | ||
834 | } | ||
835 | GNUNET_free (tun_if); | ||
836 | } | ||
837 | |||
838 | switch (addr->sa_family) | ||
839 | { | ||
840 | case AF_INET: | ||
841 | /* check if we're bound to the "ANY" IP address */ | ||
842 | have_any = GNUNET_NO; | ||
843 | for (i=0;i<h->num_local_addrs;i++) | ||
844 | { | ||
845 | if (h->local_addrs[i]->sa_family != AF_INET) | ||
846 | continue; | ||
847 | #ifndef INADDR_ANY | ||
848 | #define INADDR_ANY 0 | ||
849 | #endif | ||
850 | if (INADDR_ANY == ((struct sockaddr_in*) h->local_addrs[i])->sin_addr.s_addr) | ||
851 | { | ||
852 | have_any = GNUNET_YES; | ||
853 | break; | ||
854 | } | ||
855 | } | ||
856 | if (GNUNET_NO == have_any) | ||
857 | return GNUNET_OK; /* not bound to IP 0.0.0.0 but to specific IP addresses, | ||
858 | do not use those from interfaces */ | ||
859 | s4 = (struct sockaddr_in *) addr; | ||
860 | ip = &s4->sin_addr; | ||
861 | |||
862 | /* Check if address is in 127.0.0.0/8 */ | ||
863 | uint32_t address = ntohl ((uint32_t) (s4->sin_addr.s_addr)); | ||
864 | uint32_t value = (address & 0xFF000000) ^ 0x7F000000; | ||
865 | |||
866 | if ((h->return_localaddress == GNUNET_NO) && (value == 0)) | ||
867 | { | ||
868 | return GNUNET_OK; | ||
869 | } | ||
870 | if ((GNUNET_YES == h->use_localaddresses) || (value != 0)) | ||
871 | { | ||
872 | add_ip_to_address_list (h, LAL_INTERFACE_ADDRESS, &s4->sin_addr, | ||
873 | sizeof (struct in_addr)); | ||
874 | } | ||
875 | break; | ||
876 | case AF_INET6: | ||
877 | /* check if we're bound to the "ANY" IP address */ | ||
878 | have_any = GNUNET_NO; | ||
879 | for (i=0;i<h->num_local_addrs;i++) | ||
880 | { | ||
881 | if (h->local_addrs[i]->sa_family != AF_INET6) | ||
882 | continue; | ||
883 | if (0 == memcmp (&any6, | ||
884 | &((struct sockaddr_in6*) h->local_addrs[i])->sin6_addr, | ||
885 | sizeof (struct in6_addr))) | ||
886 | { | ||
887 | have_any = GNUNET_YES; | ||
888 | break; | ||
889 | } | ||
890 | } | ||
891 | if (GNUNET_NO == have_any) | ||
892 | return GNUNET_OK; /* not bound to "ANY" IP (::0) but to specific IP addresses, | ||
893 | do not use those from interfaces */ | ||
894 | |||
895 | s6 = (struct sockaddr_in6 *) addr; | ||
896 | if (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *) addr)->sin6_addr)) | ||
897 | { | ||
898 | /* skip link local addresses */ | ||
899 | return GNUNET_OK; | ||
900 | } | ||
901 | if ((h->return_localaddress == GNUNET_NO) && | ||
902 | (IN6_IS_ADDR_LOOPBACK (&((struct sockaddr_in6 *) addr)->sin6_addr))) | ||
903 | { | ||
904 | return GNUNET_OK; | ||
905 | } | ||
906 | ip = &s6->sin6_addr; | ||
907 | if (GNUNET_YES == h->use_localaddresses) | ||
908 | { | ||
909 | add_ip_to_address_list (h, LAL_INTERFACE_ADDRESS, &s6->sin6_addr, | ||
910 | sizeof (struct in6_addr)); | ||
911 | } | ||
912 | break; | ||
913 | default: | ||
914 | GNUNET_break (0); | ||
915 | return GNUNET_OK; | ||
916 | } | ||
917 | if ( (h->internal_address == NULL) && | ||
918 | (h->server_proc == NULL) && | ||
919 | (h->server_read_task == NULL) && | ||
920 | (GNUNET_YES == isDefault) && | ||
921 | ( (addr->sa_family == AF_INET) || | ||
922 | (addr->sa_family == AF_INET6) ) ) | ||
923 | { | ||
924 | /* no internal address configured, but we found a "default" | ||
925 | * interface, try using that as our 'internal' address */ | ||
926 | h->internal_address = | ||
927 | GNUNET_strdup (inet_ntop (addr->sa_family, ip, buf, sizeof (buf))); | ||
928 | start_gnunet_nat_server (h); | ||
929 | } | ||
930 | return GNUNET_OK; | ||
931 | } | ||
932 | |||
933 | |||
934 | /** | ||
935 | * Task that restarts the gnunet-helper-nat-server process after a crash | ||
936 | * after a certain delay. | ||
937 | * | ||
938 | * @param cls the `struct GNUNET_NAT_Handle` | ||
939 | */ | ||
940 | static void | ||
941 | restart_nat_server (void *cls) | ||
942 | { | ||
943 | struct GNUNET_NAT_Handle *h = cls; | ||
944 | |||
945 | h->server_read_task = NULL; | ||
946 | start_gnunet_nat_server (h); | ||
947 | } | ||
948 | |||
949 | |||
950 | /** | ||
951 | * We have been notified that gnunet-helper-nat-server has written | ||
952 | * something to stdout. Handle the output, then reschedule this | ||
953 | * function to be called again once more is available. | ||
954 | * | ||
955 | * @param cls the NAT handle | ||
956 | */ | ||
957 | static void | ||
958 | nat_server_read (void *cls) | ||
959 | { | ||
960 | struct GNUNET_NAT_Handle *h = cls; | ||
961 | char mybuf[40]; | ||
962 | ssize_t bytes; | ||
963 | size_t i; | ||
964 | int port; | ||
965 | const char *port_start; | ||
966 | struct sockaddr_in sin_addr; | ||
967 | |||
968 | h->server_read_task = NULL; | ||
969 | memset (mybuf, 0, sizeof (mybuf)); | ||
970 | bytes = | ||
971 | GNUNET_DISK_file_read (h->server_stdout_handle, mybuf, sizeof (mybuf)); | ||
972 | if (bytes < 1) | ||
973 | { | ||
974 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
975 | "Finished reading from server stdout with code: %d\n", | ||
976 | bytes); | ||
977 | if (0 != GNUNET_OS_process_kill (h->server_proc, GNUNET_TERM_SIG)) | ||
978 | GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, "nat", "kill"); | ||
979 | GNUNET_OS_process_wait (h->server_proc); | ||
980 | GNUNET_OS_process_destroy (h->server_proc); | ||
981 | h->server_proc = NULL; | ||
982 | GNUNET_DISK_pipe_close (h->server_stdout); | ||
983 | h->server_stdout = NULL; | ||
984 | h->server_stdout_handle = NULL; | ||
985 | /* now try to restart it */ | ||
986 | h->server_retry_delay = GNUNET_TIME_STD_BACKOFF (h->server_retry_delay); | ||
987 | h->server_read_task = | ||
988 | GNUNET_SCHEDULER_add_delayed (h->server_retry_delay, | ||
989 | &restart_nat_server, h); | ||
990 | return; | ||
991 | } | ||
992 | |||
993 | port_start = NULL; | ||
994 | for (i = 0; i < sizeof (mybuf); i++) | ||
995 | { | ||
996 | if (mybuf[i] == '\n') | ||
997 | { | ||
998 | mybuf[i] = '\0'; | ||
999 | break; | ||
1000 | } | ||
1001 | if ((mybuf[i] == ':') && (i + 1 < sizeof (mybuf))) | ||
1002 | { | ||
1003 | mybuf[i] = '\0'; | ||
1004 | port_start = &mybuf[i + 1]; | ||
1005 | } | ||
1006 | } | ||
1007 | |||
1008 | /* construct socket address of sender */ | ||
1009 | memset (&sin_addr, 0, sizeof (sin_addr)); | ||
1010 | sin_addr.sin_family = AF_INET; | ||
1011 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1012 | sin_addr.sin_len = sizeof (sin_addr); | ||
1013 | #endif | ||
1014 | if ((NULL == port_start) || (1 != SSCANF (port_start, "%d", &port)) || | ||
1015 | (-1 == inet_pton (AF_INET, mybuf, &sin_addr.sin_addr))) | ||
1016 | { | ||
1017 | /* should we restart gnunet-helper-nat-server? */ | ||
1018 | LOG (GNUNET_ERROR_TYPE_WARNING, "nat", | ||
1019 | _("gnunet-helper-nat-server generated malformed address `%s'\n"), | ||
1020 | mybuf); | ||
1021 | h->server_read_task = | ||
1022 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
1023 | h->server_stdout_handle, | ||
1024 | &nat_server_read, h); | ||
1025 | return; | ||
1026 | } | ||
1027 | sin_addr.sin_port = htons ((uint16_t) port); | ||
1028 | LOG (GNUNET_ERROR_TYPE_DEBUG, "gnunet-helper-nat-server read: %s:%d\n", mybuf, | ||
1029 | port); | ||
1030 | h->reversal_callback (h->callback_cls, (const struct sockaddr *) &sin_addr, | ||
1031 | sizeof (sin_addr)); | ||
1032 | h->server_read_task = | ||
1033 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
1034 | h->server_stdout_handle, | ||
1035 | &nat_server_read, | ||
1036 | h); | ||
1037 | } | ||
1038 | |||
1039 | |||
1040 | /** | ||
1041 | * Try to start the gnunet-helper-nat-server (if it is not | ||
1042 | * already running). | ||
1043 | * | ||
1044 | * @param h handle to NAT | ||
1045 | */ | ||
1046 | static void | ||
1047 | start_gnunet_nat_server (struct GNUNET_NAT_Handle *h) | ||
1048 | { | ||
1049 | char *binary; | ||
1050 | |||
1051 | if ((h->behind_nat == GNUNET_YES) && (h->enable_nat_server == GNUNET_YES) && | ||
1052 | (h->internal_address != NULL) && | ||
1053 | (NULL != | ||
1054 | (h->server_stdout = | ||
1055 | GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES)))) | ||
1056 | { | ||
1057 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1058 | "Starting `%s' at `%s'\n", | ||
1059 | "gnunet-helper-nat-server", h->internal_address); | ||
1060 | /* Start the server process */ | ||
1061 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server"); | ||
1062 | h->server_proc = | ||
1063 | GNUNET_OS_start_process (GNUNET_NO, 0, NULL, h->server_stdout, NULL, | ||
1064 | binary, | ||
1065 | "gnunet-helper-nat-server", | ||
1066 | h->internal_address, NULL); | ||
1067 | GNUNET_free (binary); | ||
1068 | if (h->server_proc == NULL) | ||
1069 | { | ||
1070 | LOG (GNUNET_ERROR_TYPE_WARNING, "nat", _("Failed to start %s\n"), | ||
1071 | "gnunet-helper-nat-server"); | ||
1072 | GNUNET_DISK_pipe_close (h->server_stdout); | ||
1073 | h->server_stdout = NULL; | ||
1074 | } | ||
1075 | else | ||
1076 | { | ||
1077 | /* Close the write end of the read pipe */ | ||
1078 | GNUNET_DISK_pipe_close_end (h->server_stdout, GNUNET_DISK_PIPE_END_WRITE); | ||
1079 | h->server_stdout_handle = | ||
1080 | GNUNET_DISK_pipe_handle (h->server_stdout, GNUNET_DISK_PIPE_END_READ); | ||
1081 | h->server_read_task = | ||
1082 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
1083 | h->server_stdout_handle, | ||
1084 | &nat_server_read, h); | ||
1085 | } | ||
1086 | } | ||
1087 | } | ||
1088 | |||
1089 | |||
1090 | /** | ||
1091 | * Task to scan the local network interfaces for IP addresses. | ||
1092 | * | ||
1093 | * @param cls the NAT handle | ||
1094 | */ | ||
1095 | static void | ||
1096 | list_interfaces (void *cls) | ||
1097 | { | ||
1098 | struct GNUNET_NAT_Handle *h = cls; | ||
1099 | |||
1100 | h->ifc_task = NULL; | ||
1101 | remove_from_address_list_by_source (h, LAL_INTERFACE_ADDRESS); | ||
1102 | GNUNET_OS_network_interfaces_list (&process_interfaces, h); | ||
1103 | h->ifc_task = | ||
1104 | GNUNET_SCHEDULER_add_delayed (h->ifc_scan_frequency, | ||
1105 | &list_interfaces, h); | ||
1106 | } | ||
1107 | |||
1108 | |||
1109 | /** | ||
1110 | * Callback with the result from the STUN request. | ||
1111 | * | ||
1112 | * @param cls the NAT handle | ||
1113 | * @param result the status | ||
1114 | */ | ||
1115 | static void | ||
1116 | stun_request_callback (void *cls, | ||
1117 | enum GNUNET_NAT_StatusCode result) | ||
1118 | { | ||
1119 | struct GNUNET_NAT_Handle *h = cls; | ||
1120 | |||
1121 | h->stun_request = NULL; | ||
1122 | switch (result) | ||
1123 | { | ||
1124 | case GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR: | ||
1125 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1126 | "Failed to transmit STUN request\n"); | ||
1127 | break; | ||
1128 | case GNUNET_NAT_ERROR_NOT_ONLINE: | ||
1129 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1130 | "Failed to resolve STUN server (are we online?)\n"); | ||
1131 | break; | ||
1132 | case GNUNET_NAT_ERROR_SUCCESS: | ||
1133 | /* all good, STUN request active */ | ||
1134 | h->waiting_stun = GNUNET_YES; | ||
1135 | break; | ||
1136 | default: | ||
1137 | /* unexpected error code for STUN */ | ||
1138 | GNUNET_break (0); | ||
1139 | } | ||
1140 | } | ||
1141 | |||
1142 | |||
1143 | /** | ||
1144 | * CHECK if is a valid STUN packet sending to GNUNET_NAT_stun_handle_packet(). | ||
1145 | * It also check if it can handle the packet based on the NAT handler. | ||
1146 | * You don't need to call anything else to check if the packet is valid, | ||
1147 | * | ||
1148 | * @param cls the NAT handle | ||
1149 | * @param data packet | ||
1150 | * @param len packet length | ||
1151 | * @return #GNUNET_NO if it can't decode, #GNUNET_YES if is a packet | ||
1152 | */ | ||
1153 | int | ||
1154 | GNUNET_NAT_is_valid_stun_packet (void *cls, | ||
1155 | const void *data, | ||
1156 | size_t len) | ||
1157 | { | ||
1158 | struct GNUNET_NAT_Handle *h = cls; | ||
1159 | struct sockaddr_in answer; | ||
1160 | |||
1161 | /* We are not expecting a STUN message */ | ||
1162 | if (GNUNET_YES != h->waiting_stun) | ||
1163 | return GNUNET_NO; | ||
1164 | |||
1165 | /* We dont have STUN installed */ | ||
1166 | if (! h->use_stun) | ||
1167 | return GNUNET_NO; | ||
1168 | |||
1169 | /* Empty the answer structure */ | ||
1170 | memset (&answer, | ||
1171 | 0, | ||
1172 | sizeof(struct sockaddr_in)); | ||
1173 | |||
1174 | /* Lets handle the packet*/ | ||
1175 | if (GNUNET_NO == | ||
1176 | GNUNET_NAT_stun_handle_packet (data, | ||
1177 | len, | ||
1178 | &answer)) | ||
1179 | return GNUNET_NO; | ||
1180 | |||
1181 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1182 | "STUN server returned %s:%d\n", | ||
1183 | inet_ntoa (answer.sin_addr), | ||
1184 | ntohs (answer.sin_port)); | ||
1185 | /* Remove old IPs from previous STUN calls */ | ||
1186 | remove_from_address_list_by_source (h, | ||
1187 | LAL_EXTERNAL_STUN_IP); | ||
1188 | /* Add new IP from STUN packet */ | ||
1189 | add_to_address_list (h, | ||
1190 | LAL_EXTERNAL_STUN_IP, | ||
1191 | (const struct sockaddr *) &answer, | ||
1192 | sizeof (struct sockaddr_in)); | ||
1193 | h->waiting_stun = GNUNET_NO; | ||
1194 | return GNUNET_YES; | ||
1195 | } | ||
1196 | |||
1197 | |||
1198 | /** | ||
1199 | * Task to do a STUN request | ||
1200 | * | ||
1201 | * @param cls the NAT handle | ||
1202 | */ | ||
1203 | static void | ||
1204 | process_stun (void *cls) | ||
1205 | { | ||
1206 | struct GNUNET_NAT_Handle *h = cls; | ||
1207 | struct StunServerList *elem = h->actual_stun_server; | ||
1208 | |||
1209 | h->stun_task = NULL; | ||
1210 | /* Make the request */ | ||
1211 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1212 | "I will request the stun server %s:%i\n", | ||
1213 | elem->address, | ||
1214 | elem->port); | ||
1215 | if (NULL != h->stun_request) | ||
1216 | { | ||
1217 | GNUNET_NAT_stun_make_request_cancel (h->stun_request); | ||
1218 | h->stun_request = NULL; | ||
1219 | } | ||
1220 | h->waiting_stun = GNUNET_NO; | ||
1221 | h->stun_request | ||
1222 | = GNUNET_NAT_stun_make_request (elem->address, | ||
1223 | elem->port, | ||
1224 | h->socket, | ||
1225 | &stun_request_callback, | ||
1226 | h); | ||
1227 | if (NULL == h->stun_request) | ||
1228 | { | ||
1229 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1230 | "STUN request to %s:%i failed\n", | ||
1231 | elem->address, | ||
1232 | elem->port); | ||
1233 | } | ||
1234 | h->stun_task = | ||
1235 | GNUNET_SCHEDULER_add_delayed (h->stun_frequency, | ||
1236 | &process_stun, | ||
1237 | h); | ||
1238 | |||
1239 | /* Set actual Server*/ | ||
1240 | if (NULL != elem->next) | ||
1241 | { | ||
1242 | h->actual_stun_server = elem->next; | ||
1243 | } | ||
1244 | else | ||
1245 | { | ||
1246 | h->actual_stun_server = h->stun_servers_head; | ||
1247 | } | ||
1248 | } | ||
1249 | |||
1250 | |||
1251 | /** | ||
1252 | * Task to do a lookup on our hostname for IP addresses. | ||
1253 | * | ||
1254 | * @param cls the NAT handle | ||
1255 | */ | ||
1256 | static void | ||
1257 | resolve_hostname (void *cls) | ||
1258 | { | ||
1259 | struct GNUNET_NAT_Handle *h = cls; | ||
1260 | |||
1261 | h->hostname_task = NULL; | ||
1262 | remove_from_address_list_by_source (h, LAL_HOSTNAME_DNS); | ||
1263 | GNUNET_assert (NULL == h->hostname_dns); | ||
1264 | h->hostname_dns = | ||
1265 | GNUNET_RESOLVER_hostname_resolve (AF_UNSPEC, | ||
1266 | HOSTNAME_RESOLVE_TIMEOUT, | ||
1267 | &process_hostname_ip, | ||
1268 | h); | ||
1269 | } | ||
1270 | |||
1271 | |||
1272 | /** | ||
1273 | * Task to do DNS lookup on our external hostname to | ||
1274 | * get DynDNS-IP addresses. | ||
1275 | * | ||
1276 | * @param cls the NAT handle | ||
1277 | */ | ||
1278 | static void | ||
1279 | resolve_dns (void *cls) | ||
1280 | { | ||
1281 | struct GNUNET_NAT_Handle *h = cls; | ||
1282 | struct LocalAddressList *pos; | ||
1283 | |||
1284 | h->dns_task = NULL; | ||
1285 | for (pos = h->lal_head; NULL != pos; pos = pos->next) | ||
1286 | if (pos->source == LAL_EXTERNAL_IP) | ||
1287 | pos->source = LAL_EXTERNAL_IP_OLD; | ||
1288 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1289 | "Resolving external address `%s'\n", | ||
1290 | h->external_address); | ||
1291 | GNUNET_assert (NULL == h->ext_dns); | ||
1292 | h->ext_dns = | ||
1293 | GNUNET_RESOLVER_ip_get (h->external_address, | ||
1294 | AF_INET, | ||
1295 | GNUNET_TIME_UNIT_MINUTES, | ||
1296 | &process_external_ip, | ||
1297 | h); | ||
1298 | } | ||
1299 | |||
1300 | |||
1301 | /** | ||
1302 | * Add or remove UPnP-mapped addresses. | ||
1303 | * | ||
1304 | * @param cls the `struct GNUNET_NAT_Handle` | ||
1305 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | ||
1306 | * the previous (now invalid) one | ||
1307 | * @param addr either the previous or the new public IP address | ||
1308 | * @param addrlen actual lenght of @a addr | ||
1309 | * @param ret GNUNET_NAT_ERROR_SUCCESS on success, otherwise an error code | ||
1310 | */ | ||
1311 | static void | ||
1312 | upnp_add (void *cls, | ||
1313 | int add_remove, | ||
1314 | const struct sockaddr *addr, | ||
1315 | socklen_t addrlen, | ||
1316 | enum GNUNET_NAT_StatusCode ret) | ||
1317 | { | ||
1318 | struct GNUNET_NAT_Handle *h = cls; | ||
1319 | struct LocalAddressList *pos; | ||
1320 | struct LocalAddressList *next; | ||
1321 | |||
1322 | |||
1323 | if (GNUNET_NAT_ERROR_SUCCESS != ret) | ||
1324 | { | ||
1325 | /* Error while running upnp client */ | ||
1326 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1327 | _("Error while running upnp client:\n")); | ||
1328 | //FIXME: convert error code to string | ||
1329 | return; | ||
1330 | } | ||
1331 | |||
1332 | if (GNUNET_YES == add_remove) | ||
1333 | { | ||
1334 | add_to_address_list (h, | ||
1335 | LAL_UPNP, | ||
1336 | addr, | ||
1337 | addrlen); | ||
1338 | return; | ||
1339 | } | ||
1340 | else if (GNUNET_NO == add_remove) | ||
1341 | { | ||
1342 | /* remove address */ | ||
1343 | next = h->lal_head; | ||
1344 | while (NULL != (pos = next)) | ||
1345 | { | ||
1346 | next = pos->next; | ||
1347 | if ((pos->source != LAL_UPNP) || (pos->addrlen != addrlen) || | ||
1348 | (0 != memcmp (&pos[1], addr, addrlen))) | ||
1349 | continue; | ||
1350 | GNUNET_CONTAINER_DLL_remove (h->lal_head, | ||
1351 | h->lal_tail, | ||
1352 | pos); | ||
1353 | if (NULL != h->address_callback) | ||
1354 | h->address_callback (h->callback_cls, | ||
1355 | GNUNET_NO, | ||
1356 | (const struct sockaddr *) &pos[1], | ||
1357 | pos->addrlen); | ||
1358 | GNUNET_free (pos); | ||
1359 | return; /* only remove once */ | ||
1360 | } | ||
1361 | /* asked to remove address that does not exist */ | ||
1362 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1363 | "Asked to remove unkown address `%s'\n", | ||
1364 | GNUNET_a2s(addr, addrlen)); | ||
1365 | GNUNET_break (0); | ||
1366 | } | ||
1367 | else | ||
1368 | { | ||
1369 | |||
1370 | GNUNET_break (0); | ||
1371 | } | ||
1372 | } | ||
1373 | |||
1374 | |||
1375 | /** | ||
1376 | * Try to add a port mapping using UPnP. | ||
1377 | * | ||
1378 | * @param h overall NAT handle | ||
1379 | * @param port port to map with UPnP | ||
1380 | */ | ||
1381 | static void | ||
1382 | add_minis (struct GNUNET_NAT_Handle *h, | ||
1383 | uint16_t port) | ||
1384 | { | ||
1385 | struct MiniList *ml; | ||
1386 | |||
1387 | ml = h->mini_head; | ||
1388 | while (NULL != ml) | ||
1389 | { | ||
1390 | if (port == ml->port) | ||
1391 | return; /* already got this port */ | ||
1392 | ml = ml->next; | ||
1393 | } | ||
1394 | |||
1395 | ml = GNUNET_new (struct MiniList); | ||
1396 | ml->port = port; | ||
1397 | ml->mini = GNUNET_NAT_mini_map_start (port, h->is_tcp, &upnp_add, h); | ||
1398 | |||
1399 | if (NULL == ml->mini) | ||
1400 | { | ||
1401 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1402 | _("Failed to run upnp client for port %u\n"), ml->port); | ||
1403 | GNUNET_free (ml); | ||
1404 | return; | ||
1405 | } | ||
1406 | |||
1407 | GNUNET_CONTAINER_DLL_insert (h->mini_head, | ||
1408 | h->mini_tail, | ||
1409 | ml); | ||
1410 | } | ||
1411 | |||
1412 | |||
1413 | /** | ||
1414 | * Task to add addresses from original bind to set of valid addrs. | ||
1415 | * | ||
1416 | * @param h the NAT handle | ||
1417 | */ | ||
1418 | static void | ||
1419 | add_from_bind (struct GNUNET_NAT_Handle *h) | ||
1420 | { | ||
1421 | static struct in6_addr any = IN6ADDR_ANY_INIT; | ||
1422 | |||
1423 | unsigned int i; | ||
1424 | struct sockaddr *sa; | ||
1425 | const struct sockaddr_in *v4; | ||
1426 | |||
1427 | for (i = 0; i < h->num_local_addrs; i++) | ||
1428 | { | ||
1429 | sa = h->local_addrs[i]; | ||
1430 | switch (sa->sa_family) | ||
1431 | { | ||
1432 | case AF_INET: | ||
1433 | if (sizeof (struct sockaddr_in) != h->local_addrlens[i]) | ||
1434 | { | ||
1435 | GNUNET_break (0); | ||
1436 | break; | ||
1437 | } | ||
1438 | v4 = (const struct sockaddr_in *) sa; | ||
1439 | if (0 != v4->sin_addr.s_addr) | ||
1440 | add_to_address_list (h, | ||
1441 | LAL_BINDTO_ADDRESS, sa, | ||
1442 | sizeof (struct sockaddr_in)); | ||
1443 | if (h->enable_upnp) | ||
1444 | { | ||
1445 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1446 | "Running upnp client for address `%s'\n", | ||
1447 | GNUNET_a2s (sa,sizeof (struct sockaddr_in))); | ||
1448 | add_minis (h, ntohs (v4->sin_port)); | ||
1449 | } | ||
1450 | break; | ||
1451 | case AF_INET6: | ||
1452 | if (sizeof (struct sockaddr_in6) != h->local_addrlens[i]) | ||
1453 | { | ||
1454 | GNUNET_break (0); | ||
1455 | break; | ||
1456 | } | ||
1457 | if (0 != | ||
1458 | memcmp (&((const struct sockaddr_in6 *) sa)->sin6_addr, | ||
1459 | &any, | ||
1460 | sizeof (struct in6_addr))) | ||
1461 | add_to_address_list (h, | ||
1462 | LAL_BINDTO_ADDRESS, | ||
1463 | sa, | ||
1464 | sizeof (struct sockaddr_in6)); | ||
1465 | break; | ||
1466 | default: | ||
1467 | break; | ||
1468 | } | ||
1469 | } | ||
1470 | } | ||
1471 | |||
1472 | |||
1473 | /** | ||
1474 | * Attempt to enable port redirection and detect public IP address contacting | ||
1475 | * UPnP or NAT-PMP routers on the local network. Use addr to specify to which | ||
1476 | * of the local host's addresses should the external port be mapped. The port | ||
1477 | * is taken from the corresponding sockaddr_in[6] field. | ||
1478 | * | ||
1479 | * @param cfg configuration to use | ||
1480 | * @param is_tcp #GNUNET_YES for TCP, #GNUNET_NO for UDP | ||
1481 | * @param adv_port advertised port (port we are either bound to or that our OS | ||
1482 | * locally performs redirection from to our bound port). | ||
1483 | * @param num_addrs number of addresses in @a addrs | ||
1484 | * @param addrs the local addresses packets should be redirected to | ||
1485 | * @param addrlens actual lengths of the addresses | ||
1486 | * @param address_callback function to call everytime the public IP address changes | ||
1487 | * @param reversal_callback function to call if someone wants connection reversal from us | ||
1488 | * @param callback_cls closure for callbacks | ||
1489 | * @param sock used socket | ||
1490 | * @return NULL on error, otherwise handle that can be used to unregister | ||
1491 | */ | ||
1492 | struct GNUNET_NAT_Handle * | ||
1493 | GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
1494 | int is_tcp, | ||
1495 | uint16_t adv_port, | ||
1496 | unsigned int num_addrs, | ||
1497 | const struct sockaddr **addrs, | ||
1498 | const socklen_t *addrlens, | ||
1499 | GNUNET_NAT_AddressCallback address_callback, | ||
1500 | GNUNET_NAT_ReversalCallback reversal_callback, | ||
1501 | void *callback_cls, | ||
1502 | struct GNUNET_NETWORK_Handle *sock) | ||
1503 | { | ||
1504 | struct GNUNET_NAT_Handle *h; | ||
1505 | struct in_addr in_addr; | ||
1506 | unsigned int i; | ||
1507 | char *binary; | ||
1508 | |||
1509 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1510 | "Registered with NAT service at port %u with %u IP bound local addresses\n", | ||
1511 | (unsigned int) adv_port, num_addrs); | ||
1512 | h = GNUNET_new (struct GNUNET_NAT_Handle); | ||
1513 | h->server_retry_delay = GNUNET_TIME_UNIT_SECONDS; | ||
1514 | h->cfg = cfg; | ||
1515 | h->is_tcp = is_tcp; | ||
1516 | h->address_callback = address_callback; | ||
1517 | h->reversal_callback = reversal_callback; | ||
1518 | h->callback_cls = callback_cls; | ||
1519 | h->num_local_addrs = num_addrs; | ||
1520 | h->adv_port = adv_port; | ||
1521 | if (0 != num_addrs) | ||
1522 | { | ||
1523 | h->local_addrs = GNUNET_malloc (num_addrs * sizeof (struct sockaddr *)); | ||
1524 | h->local_addrlens = GNUNET_malloc (num_addrs * sizeof (socklen_t)); | ||
1525 | for (i = 0; i < num_addrs; i++) | ||
1526 | { | ||
1527 | GNUNET_assert (addrlens[i] > 0); | ||
1528 | GNUNET_assert (addrs[i] != NULL); | ||
1529 | h->local_addrlens[i] = addrlens[i]; | ||
1530 | h->local_addrs[i] = GNUNET_malloc (addrlens[i]); | ||
1531 | GNUNET_memcpy (h->local_addrs[i], addrs[i], addrlens[i]); | ||
1532 | } | ||
1533 | } | ||
1534 | if (GNUNET_OK == | ||
1535 | GNUNET_CONFIGURATION_have_value (cfg, "nat", "INTERNAL_ADDRESS")) | ||
1536 | { | ||
1537 | (void) GNUNET_CONFIGURATION_get_value_string (cfg, "nat", | ||
1538 | "INTERNAL_ADDRESS", | ||
1539 | &h->internal_address); | ||
1540 | } | ||
1541 | if ((h->internal_address != NULL) && | ||
1542 | (inet_pton (AF_INET, h->internal_address, &in_addr) != 1)) | ||
1543 | { | ||
1544 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, | ||
1545 | "nat", "INTERNAL_ADDRESS", | ||
1546 | _("malformed")); | ||
1547 | GNUNET_free (h->internal_address); | ||
1548 | h->internal_address = NULL; | ||
1549 | } | ||
1550 | |||
1551 | if (GNUNET_OK == | ||
1552 | GNUNET_CONFIGURATION_have_value (cfg, "nat", "EXTERNAL_ADDRESS")) | ||
1553 | { | ||
1554 | (void) GNUNET_CONFIGURATION_get_value_string (cfg, "nat", | ||
1555 | "EXTERNAL_ADDRESS", | ||
1556 | &h->external_address); | ||
1557 | } | ||
1558 | h->behind_nat = | ||
1559 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "BEHIND_NAT"); | ||
1560 | h->nat_punched = | ||
1561 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "PUNCHED_NAT"); | ||
1562 | h->enable_nat_client = | ||
1563 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "ENABLE_ICMP_CLIENT"); | ||
1564 | h->enable_nat_server = | ||
1565 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "ENABLE_ICMP_SERVER"); | ||
1566 | h->enable_upnp = | ||
1567 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "ENABLE_UPNP"); | ||
1568 | h->use_localaddresses = | ||
1569 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "USE_LOCALADDR"); | ||
1570 | h->return_localaddress = | ||
1571 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", | ||
1572 | "RETURN_LOCAL_ADDRESSES"); | ||
1573 | |||
1574 | h->use_hostname = | ||
1575 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "USE_HOSTNAME"); | ||
1576 | h->disable_ipv6 = | ||
1577 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "nat", "DISABLEV6"); | ||
1578 | if (GNUNET_OK != | ||
1579 | GNUNET_CONFIGURATION_get_value_time (cfg, "nat", "DYNDNS_FREQUENCY", | ||
1580 | &h->dyndns_frequency)) | ||
1581 | h->dyndns_frequency = DYNDNS_FREQUENCY; | ||
1582 | if (GNUNET_OK != | ||
1583 | GNUNET_CONFIGURATION_get_value_time (cfg, "nat", "IFC_SCAN_FREQUENCY", | ||
1584 | &h->ifc_scan_frequency)) | ||
1585 | h->ifc_scan_frequency = IFC_SCAN_FREQUENCY; | ||
1586 | if (GNUNET_OK != | ||
1587 | GNUNET_CONFIGURATION_get_value_time (cfg, "nat", "HOSTNAME_DNS_FREQUENCY", | ||
1588 | &h->hostname_dns_frequency)) | ||
1589 | h->hostname_dns_frequency = HOSTNAME_DNS_FREQUENCY; | ||
1590 | |||
1591 | if (NULL == reversal_callback) | ||
1592 | h->enable_nat_server = GNUNET_NO; | ||
1593 | |||
1594 | /* Check for UPnP client, disable immediately if not available */ | ||
1595 | if ( (GNUNET_YES == h->enable_upnp) && | ||
1596 | (GNUNET_SYSERR == | ||
1597 | GNUNET_OS_check_helper_binary ("upnpc", GNUNET_NO, NULL)) ) | ||
1598 | { | ||
1599 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1600 | _("UPnP enabled in configuration, but UPnP client `upnpc` command not found, disabling UPnP \n")); | ||
1601 | h->enable_upnp = GNUNET_NO; | ||
1602 | } | ||
1603 | |||
1604 | /* STUN */ | ||
1605 | h->use_stun = | ||
1606 | GNUNET_CONFIGURATION_get_value_yesno (cfg, | ||
1607 | "nat", | ||
1608 | "USE_STUN"); | ||
1609 | |||
1610 | if (GNUNET_OK != | ||
1611 | GNUNET_CONFIGURATION_get_value_time (cfg, | ||
1612 | "nat", | ||
1613 | "STUN_FREQUENCY", | ||
1614 | &h->stun_frequency)) | ||
1615 | h->stun_frequency = STUN_FREQUENCY; | ||
1616 | |||
1617 | |||
1618 | /* Check if NAT was hole-punched */ | ||
1619 | if ((NULL != h->address_callback) && | ||
1620 | (NULL != h->external_address) && | ||
1621 | (GNUNET_YES == h->nat_punched)) | ||
1622 | { | ||
1623 | h->dns_task = GNUNET_SCHEDULER_add_now (&resolve_dns, h); | ||
1624 | h->enable_nat_server = GNUNET_NO; | ||
1625 | h->enable_upnp = GNUNET_NO; | ||
1626 | h->use_stun = GNUNET_NO; | ||
1627 | } | ||
1628 | else | ||
1629 | { | ||
1630 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1631 | "No external IP address given to add to our list of addresses\n"); | ||
1632 | } | ||
1633 | |||
1634 | /* ENABLE STUN ONLY ON UDP */ | ||
1635 | if( (! is_tcp) && | ||
1636 | (NULL != sock) && | ||
1637 | h->use_stun) | ||
1638 | { | ||
1639 | char *stun_servers; | ||
1640 | size_t urls; | ||
1641 | ssize_t pos; | ||
1642 | size_t pos_port; | ||
1643 | |||
1644 | h->socket = sock; | ||
1645 | stun_servers = NULL; | ||
1646 | /* Lets process the servers*/ | ||
1647 | (void) GNUNET_CONFIGURATION_get_value_string (cfg, | ||
1648 | "nat", | ||
1649 | "STUN_SERVERS", | ||
1650 | &stun_servers); | ||
1651 | urls = 0; | ||
1652 | if ( (NULL != stun_servers) && | ||
1653 | (strlen (stun_servers) > 0) ) | ||
1654 | { | ||
1655 | pos_port = 0; | ||
1656 | for (pos = strlen (stun_servers) - 1; | ||
1657 | pos >= 0; | ||
1658 | pos--) | ||
1659 | { | ||
1660 | if (stun_servers[pos] == ':') | ||
1661 | { | ||
1662 | pos_port = pos + 1; | ||
1663 | stun_servers[pos] = '\0'; | ||
1664 | continue; | ||
1665 | } | ||
1666 | if ((stun_servers[pos] == ' ') || (0 == pos)) | ||
1667 | { | ||
1668 | struct StunServerList *ml; | ||
1669 | |||
1670 | /* Check if we do have a port */ | ||
1671 | if ((0 == pos_port) || (pos_port <= pos)) | ||
1672 | { | ||
1673 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1674 | "STUN server format mistake\n"); | ||
1675 | break; | ||
1676 | } | ||
1677 | urls++; | ||
1678 | ml = GNUNET_new (struct StunServerList); | ||
1679 | ml->port = atoi (&stun_servers[pos_port]); | ||
1680 | |||
1681 | /* Remove trailing space */ | ||
1682 | if (stun_servers[pos] == ' ') | ||
1683 | ml->address = GNUNET_strdup (&stun_servers[pos + 1]); | ||
1684 | else | ||
1685 | ml->address = GNUNET_strdup (&stun_servers[pos]); | ||
1686 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1687 | "Found STUN server %s:%i\n", | ||
1688 | ml->address, | ||
1689 | ml->port); | ||
1690 | GNUNET_CONTAINER_DLL_insert (h->stun_servers_head, | ||
1691 | h->stun_servers_tail, | ||
1692 | ml); | ||
1693 | stun_servers[pos] = '\0'; | ||
1694 | } | ||
1695 | } | ||
1696 | } | ||
1697 | if (0 == urls) | ||
1698 | { | ||
1699 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, | ||
1700 | "nat", | ||
1701 | "STUN_SERVERS"); | ||
1702 | } | ||
1703 | else | ||
1704 | { | ||
1705 | /* Set the actual STUN server*/ | ||
1706 | h->actual_stun_server = h->stun_servers_head; | ||
1707 | } | ||
1708 | h->stun_task = GNUNET_SCHEDULER_add_now (&process_stun, | ||
1709 | h); | ||
1710 | GNUNET_free_non_null (stun_servers); | ||
1711 | } | ||
1712 | |||
1713 | |||
1714 | /* Test for SUID binaries */ | ||
1715 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server"); | ||
1716 | if ( (GNUNET_YES == h->behind_nat) && | ||
1717 | (GNUNET_YES == h->enable_nat_server) && | ||
1718 | (GNUNET_YES != | ||
1719 | GNUNET_OS_check_helper_binary (binary, | ||
1720 | GNUNET_YES, | ||
1721 | "-d 127.0.0.1" ))) | ||
1722 | { | ||
1723 | // use localhost as source for that one udp-port, ok for testing | ||
1724 | h->enable_nat_server = GNUNET_NO; | ||
1725 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1726 | _("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), | ||
1727 | "gnunet-helper-nat-server"); | ||
1728 | } | ||
1729 | GNUNET_free (binary); | ||
1730 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-client"); | ||
1731 | if ((GNUNET_YES == h->enable_nat_client) && | ||
1732 | (GNUNET_YES != | ||
1733 | GNUNET_OS_check_helper_binary (binary, | ||
1734 | GNUNET_YES, | ||
1735 | "-d 127.0.0.1 127.0.0.2 42"))) /* none of these parameters are actually used in privilege testing mode */ | ||
1736 | { | ||
1737 | h->enable_nat_client = GNUNET_NO; | ||
1738 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1739 | _("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), | ||
1740 | "gnunet-helper-nat-client"); | ||
1741 | } | ||
1742 | GNUNET_free (binary); | ||
1743 | start_gnunet_nat_server (h); | ||
1744 | |||
1745 | /* FIXME: add support for UPnP, etc */ | ||
1746 | |||
1747 | if (NULL != h->address_callback) | ||
1748 | { | ||
1749 | h->ifc_task = GNUNET_SCHEDULER_add_now (&list_interfaces, | ||
1750 | h); | ||
1751 | if (GNUNET_YES == h->use_hostname) | ||
1752 | h->hostname_task = GNUNET_SCHEDULER_add_now (&resolve_hostname, | ||
1753 | h); | ||
1754 | } | ||
1755 | add_from_bind (h); | ||
1756 | |||
1757 | return h; | ||
1758 | } | ||
1759 | |||
1760 | |||
1761 | /** | ||
1762 | * Stop port redirection and public IP address detection for the given handle. | ||
1763 | * This frees the handle, after having sent the needed commands to close open ports. | ||
1764 | * | ||
1765 | * @param h the handle to stop | ||
1766 | */ | ||
1767 | void | ||
1768 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h) | ||
1769 | { | ||
1770 | unsigned int i; | ||
1771 | struct LocalAddressList *lal; | ||
1772 | struct MiniList *ml; | ||
1773 | struct StunServerList *ssl; | ||
1774 | |||
1775 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1776 | "NAT unregister called\n"); | ||
1777 | while (NULL != (ssl = h->stun_servers_head)) | ||
1778 | { | ||
1779 | GNUNET_CONTAINER_DLL_remove (h->stun_servers_head, | ||
1780 | h->stun_servers_tail, | ||
1781 | ssl); | ||
1782 | GNUNET_free (ssl->address); | ||
1783 | GNUNET_free (ssl); | ||
1784 | } | ||
1785 | while (NULL != (lal = h->lal_head)) | ||
1786 | { | ||
1787 | GNUNET_CONTAINER_DLL_remove (h->lal_head, | ||
1788 | h->lal_tail, | ||
1789 | lal); | ||
1790 | if (NULL != h->address_callback) | ||
1791 | h->address_callback (h->callback_cls, | ||
1792 | GNUNET_NO, | ||
1793 | (const struct sockaddr *) &lal[1], | ||
1794 | lal->addrlen); | ||
1795 | GNUNET_free (lal); | ||
1796 | } | ||
1797 | while (NULL != (ml = h->mini_head)) | ||
1798 | { | ||
1799 | GNUNET_CONTAINER_DLL_remove (h->mini_head, | ||
1800 | h->mini_tail, | ||
1801 | ml); | ||
1802 | if (NULL != ml->mini) | ||
1803 | GNUNET_NAT_mini_map_stop (ml->mini); | ||
1804 | GNUNET_free (ml); | ||
1805 | } | ||
1806 | if (NULL != h->ext_dns) | ||
1807 | { | ||
1808 | GNUNET_RESOLVER_request_cancel (h->ext_dns); | ||
1809 | h->ext_dns = NULL; | ||
1810 | } | ||
1811 | if (NULL != h->hostname_dns) | ||
1812 | { | ||
1813 | GNUNET_RESOLVER_request_cancel (h->hostname_dns); | ||
1814 | h->hostname_dns = NULL; | ||
1815 | } | ||
1816 | if (NULL != h->server_read_task) | ||
1817 | { | ||
1818 | GNUNET_SCHEDULER_cancel (h->server_read_task); | ||
1819 | h->server_read_task = NULL; | ||
1820 | } | ||
1821 | if (NULL != h->ifc_task) | ||
1822 | { | ||
1823 | GNUNET_SCHEDULER_cancel (h->ifc_task); | ||
1824 | h->ifc_task = NULL; | ||
1825 | } | ||
1826 | if (NULL != h->hostname_task) | ||
1827 | { | ||
1828 | GNUNET_SCHEDULER_cancel (h->hostname_task); | ||
1829 | h->hostname_task = NULL; | ||
1830 | } | ||
1831 | if (NULL != h->dns_task) | ||
1832 | { | ||
1833 | GNUNET_SCHEDULER_cancel (h->dns_task); | ||
1834 | h->dns_task = NULL; | ||
1835 | } | ||
1836 | if (NULL != h->stun_task) | ||
1837 | { | ||
1838 | GNUNET_SCHEDULER_cancel (h->stun_task); | ||
1839 | h->stun_task = NULL; | ||
1840 | } | ||
1841 | if (NULL != h->stun_request) | ||
1842 | { | ||
1843 | GNUNET_NAT_stun_make_request_cancel (h->stun_request); | ||
1844 | h->stun_request = NULL; | ||
1845 | } | ||
1846 | if (NULL != h->server_proc) | ||
1847 | { | ||
1848 | if (0 != GNUNET_OS_process_kill (h->server_proc, | ||
1849 | GNUNET_TERM_SIG)) | ||
1850 | GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, | ||
1851 | "nat", | ||
1852 | "kill"); | ||
1853 | GNUNET_OS_process_wait (h->server_proc); | ||
1854 | GNUNET_OS_process_destroy (h->server_proc); | ||
1855 | h->server_proc = NULL; | ||
1856 | GNUNET_DISK_pipe_close (h->server_stdout); | ||
1857 | h->server_stdout = NULL; | ||
1858 | h->server_stdout_handle = NULL; | ||
1859 | } | ||
1860 | if (NULL != h->server_stdout) | ||
1861 | { | ||
1862 | GNUNET_DISK_pipe_close (h->server_stdout); | ||
1863 | h->server_stdout = NULL; | ||
1864 | h->server_stdout_handle = NULL; | ||
1865 | } | ||
1866 | for (i = 0; i < h->num_local_addrs; i++) | ||
1867 | GNUNET_free (h->local_addrs[i]); | ||
1868 | GNUNET_free_non_null (h->local_addrs); | ||
1869 | GNUNET_free_non_null (h->local_addrlens); | ||
1870 | GNUNET_free_non_null (h->external_address); | ||
1871 | GNUNET_free_non_null (h->internal_address); | ||
1872 | GNUNET_free (h); | ||
1873 | } | ||
1874 | |||
1875 | |||
1876 | /** | ||
1877 | * We learned about a peer (possibly behind NAT) so run the | ||
1878 | * gnunet-helper-nat-client to send dummy ICMP responses to cause | ||
1879 | * that peer to connect to us (connection reversal). | ||
1880 | * | ||
1881 | * @param h handle (used for configuration) | ||
1882 | * @param sa the address of the peer (IPv4-only) | ||
1883 | * @return #GNUNET_SYSERR on error, #GNUNET_NO if nat client is disabled, | ||
1884 | * #GNUNET_OK otherwise | ||
1885 | */ | ||
1886 | int | ||
1887 | GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | ||
1888 | const struct sockaddr_in *sa) | ||
1889 | |||
1890 | |||
1891 | { | ||
1892 | char inet4[INET_ADDRSTRLEN]; | ||
1893 | char port_as_string[6]; | ||
1894 | struct GNUNET_OS_Process *proc; | ||
1895 | char *binary; | ||
1896 | |||
1897 | if (GNUNET_YES != h->enable_nat_client) | ||
1898 | return GNUNET_NO; /* not permitted / possible */ | ||
1899 | |||
1900 | if (h->internal_address == NULL) | ||
1901 | { | ||
1902 | LOG (GNUNET_ERROR_TYPE_WARNING, "nat", | ||
1903 | _("Internal IP address not known, cannot use ICMP NAT traversal method\n")); | ||
1904 | return GNUNET_SYSERR; | ||
1905 | } | ||
1906 | GNUNET_assert (sa->sin_family == AF_INET); | ||
1907 | if (NULL == inet_ntop (AF_INET, &sa->sin_addr, inet4, INET_ADDRSTRLEN)) | ||
1908 | { | ||
1909 | GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, | ||
1910 | "nat", | ||
1911 | "inet_ntop"); | ||
1912 | return GNUNET_SYSERR; | ||
1913 | } | ||
1914 | GNUNET_snprintf (port_as_string, | ||
1915 | sizeof (port_as_string), | ||
1916 | "%d", | ||
1917 | h->adv_port); | ||
1918 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1919 | _("Running gnunet-helper-nat-client %s %s %u\n"), | ||
1920 | h->internal_address, | ||
1921 | inet4, | ||
1922 | (unsigned int) h->adv_port); | ||
1923 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-client"); | ||
1924 | proc = | ||
1925 | GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL, NULL, | ||
1926 | binary, | ||
1927 | "gnunet-helper-nat-client", | ||
1928 | h->internal_address, | ||
1929 | inet4, port_as_string, NULL); | ||
1930 | GNUNET_free (binary); | ||
1931 | if (NULL == proc) | ||
1932 | return GNUNET_SYSERR; | ||
1933 | /* we know that the gnunet-helper-nat-client will terminate virtually | ||
1934 | * instantly */ | ||
1935 | GNUNET_OS_process_wait (proc); | ||
1936 | GNUNET_OS_process_destroy (proc); | ||
1937 | return GNUNET_OK; | ||
1938 | } | ||
1939 | |||
1940 | |||
1941 | /** | ||
1942 | * Test if the given address is (currently) a plausible IP address for this peer. | ||
1943 | * | ||
1944 | * @param h the handle returned by register | ||
1945 | * @param addr IP address to test (IPv4 or IPv6) | ||
1946 | * @param addrlen number of bytes in @a addr | ||
1947 | * @return #GNUNET_YES if the address is plausible, | ||
1948 | * #GNUNET_NO if the address is not plausible, | ||
1949 | * #GNUNET_SYSERR if the address is malformed | ||
1950 | */ | ||
1951 | int | ||
1952 | GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, | ||
1953 | const void *addr, | ||
1954 | socklen_t addrlen) | ||
1955 | { | ||
1956 | struct LocalAddressList *pos; | ||
1957 | const struct sockaddr_in *in4; | ||
1958 | const struct sockaddr_in6 *in6; | ||
1959 | char pbuf[INET6_ADDRSTRLEN+1]; | ||
1960 | |||
1961 | if ((addrlen != sizeof (struct in_addr)) && | ||
1962 | (addrlen != sizeof (struct in6_addr))) | ||
1963 | { | ||
1964 | GNUNET_break (0); | ||
1965 | return GNUNET_SYSERR; | ||
1966 | } | ||
1967 | for (pos = h->lal_head; NULL != pos; pos = pos->next) | ||
1968 | { | ||
1969 | if (pos->addrlen == sizeof (struct sockaddr_in)) | ||
1970 | { | ||
1971 | in4 = (struct sockaddr_in *) &pos[1]; | ||
1972 | if ((addrlen == sizeof (struct in_addr)) && | ||
1973 | (0 == memcmp (&in4->sin_addr, addr, sizeof (struct in_addr)))) | ||
1974 | return GNUNET_YES; | ||
1975 | } | ||
1976 | else if (pos->addrlen == sizeof (struct sockaddr_in6)) | ||
1977 | { | ||
1978 | in6 = (struct sockaddr_in6 *) &pos[1]; | ||
1979 | if ((addrlen == sizeof (struct in6_addr)) && | ||
1980 | (0 == memcmp (&in6->sin6_addr, addr, sizeof (struct in6_addr)))) | ||
1981 | return GNUNET_YES; | ||
1982 | } | ||
1983 | else | ||
1984 | { | ||
1985 | GNUNET_assert (0); | ||
1986 | } | ||
1987 | } | ||
1988 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1989 | "Asked to validate one of my addresses (%s) and validation failed!\n", | ||
1990 | inet_ntop ((addrlen == sizeof(struct in_addr)) | ||
1991 | ? AF_INET | ||
1992 | : AF_INET6, | ||
1993 | addr, | ||
1994 | pbuf, sizeof (pbuf))); | ||
1995 | return GNUNET_NO; | ||
1996 | } | ||
1997 | |||
1998 | /** | ||
1999 | * Converts enum GNUNET_NAT_StatusCode to a string | ||
2000 | * | ||
2001 | * @param err error code to resolve to a string | ||
2002 | * @return pointer to a static string containing the error code | ||
2003 | */ | ||
2004 | const char * | ||
2005 | GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err) | ||
2006 | { | ||
2007 | switch (err) | ||
2008 | { | ||
2009 | case GNUNET_NAT_ERROR_SUCCESS: | ||
2010 | return _ ("Operation Successful"); | ||
2011 | case GNUNET_NAT_ERROR_IPC_FAILURE: | ||
2012 | return _ ("Internal Failure (IPC, ...)"); | ||
2013 | case GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR: | ||
2014 | return _ ("Failure in network subsystem, check permissions."); | ||
2015 | case GNUNET_NAT_ERROR_TIMEOUT: | ||
2016 | return _ ("Encountered timeout while performing operation"); | ||
2017 | case GNUNET_NAT_ERROR_NOT_ONLINE: | ||
2018 | return _ ("detected that we are offline"); | ||
2019 | case GNUNET_NAT_ERROR_UPNPC_NOT_FOUND: | ||
2020 | return _ ("`upnpc` command not found"); | ||
2021 | case GNUNET_NAT_ERROR_UPNPC_FAILED: | ||
2022 | return _ ("Failed to run `upnpc` command"); | ||
2023 | case GNUNET_NAT_ERROR_UPNPC_TIMEOUT: | ||
2024 | return _ ("`upnpc' command took too long, process killed"); | ||
2025 | case GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED: | ||
2026 | return _ ("`upnpc' command failed to establish port mapping"); | ||
2027 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND: | ||
2028 | return _ ("`external-ip' command not found"); | ||
2029 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED: | ||
2030 | return _ ("Failed to run `external-ip` command"); | ||
2031 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID: | ||
2032 | return _ ("`external-ip' command output invalid"); | ||
2033 | case GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID: | ||
2034 | return _ ("no valid address was returned by `external-ip'"); | ||
2035 | case GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO: | ||
2036 | return _ ("Could not determine interface with internal/local network address"); | ||
2037 | case GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND: | ||
2038 | return _ ("No functioning gnunet-helper-nat-server installation found"); | ||
2039 | case GNUNET_NAT_ERROR_NAT_TEST_START_FAILED: | ||
2040 | return _ ("NAT test could not be initialized"); | ||
2041 | case GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT: | ||
2042 | return _ ("NAT test timeout reached"); | ||
2043 | case GNUNET_NAT_ERROR_NAT_REGISTER_FAILED: | ||
2044 | return _ ("could not register NAT"); | ||
2045 | case GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND: | ||
2046 | return _ ("No working gnunet-helper-nat-client installation found"); | ||
2047 | /* case: | ||
2048 | return _ ("");*/ | ||
2049 | default: | ||
2050 | return "unknown status code"; | ||
2051 | } | ||
2052 | } | ||
2053 | |||
2054 | /* end of nat.c */ | ||
diff --git a/src/nat/nat.conf.in b/src/nat/nat.conf.in index 304db3c15..87fe29d9c 100644 --- a/src/nat/nat.conf.in +++ b/src/nat/nat.conf.in | |||
@@ -9,42 +9,13 @@ UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-nat.sock | |||
9 | UNIX_MATCH_UID = YES | 9 | UNIX_MATCH_UID = YES |
10 | UNIX_MATCH_GID = YES | 10 | UNIX_MATCH_GID = YES |
11 | 11 | ||
12 | # Are we behind NAT? | ||
13 | BEHIND_NAT = NO | ||
14 | |||
15 | # Is the NAT hole-punched? | ||
16 | PUNCHED_NAT = NO | ||
17 | |||
18 | # Enable UPNP by default? | 12 | # Enable UPNP by default? |
19 | ENABLE_UPNP = NO | 13 | ENABLE_UPNP = YES |
20 | |||
21 | # Use addresses from the local network interfaces (inluding loopback, but also others) | ||
22 | USE_LOCALADDR = YES | ||
23 | |||
24 | # Use address obtained from a DNS lookup of our hostname | ||
25 | USE_HOSTNAME = NO | ||
26 | |||
27 | # External IP address of the NAT box (if known); IPv4 dotted-decimal ONLY at this time (should allow DynDNS!) | ||
28 | # normal interface IP address for non-NATed peers; | ||
29 | # possibly auto-detected (using UPnP) if possible if not specified | ||
30 | # EXTERNAL_ADDRESS = | ||
31 | |||
32 | # Should we use ICMP-based NAT traversal to try connect to NATed peers | ||
33 | # or, if we are behind NAT, to allow connections to us? | ||
34 | ENABLE_ICMP_CLIENT = NO | ||
35 | ENABLE_ICMP_SERVER = NO | ||
36 | |||
37 | # IP address of the interface connected to the NAT box; IPv4 dotted-decimal ONLY; | ||
38 | # normal interface IP address for non-NATed peers; | ||
39 | # likely auto-detected (via interface list) if not specified (!) | ||
40 | # INTERNAL_ADDRESS = | ||
41 | 14 | ||
42 | # Disable IPv6 support | 15 | # Disable IPv6 support |
16 | # FIXME: move entirely to transport plugins! | ||
43 | DISABLEV6 = NO | 17 | DISABLEV6 = NO |
44 | 18 | ||
45 | # Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8) | ||
46 | RETURN_LOCAL_ADDRESSES = NO | ||
47 | |||
48 | # How often do we query the DNS resolver | 19 | # How often do we query the DNS resolver |
49 | # for our hostname (to get our own IP) | 20 | # for our hostname (to get our own IP) |
50 | HOSTNAME_DNS_FREQUENCY = 20 min | 21 | HOSTNAME_DNS_FREQUENCY = 20 min |
@@ -67,8 +38,3 @@ STUN_SERVERS = stun.gnunet.org stun.services.mozilla.com:3478 stun.ekiga.net:347 | |||
67 | # After how long do we consider STUN data stale? | 38 | # After how long do we consider STUN data stale? |
68 | STUN_STALE = 60 min | 39 | STUN_STALE = 60 min |
69 | 40 | ||
70 | |||
71 | [gnunet-nat-server] | ||
72 | HOSTNAME = gnunet.org | ||
73 | PORT = 5724 | ||
74 | NOARMBIND = YES | ||
diff --git a/src/nat/nat.h b/src/nat/nat.h index af418c7c2..d34900bd1 100644 --- a/src/nat/nat.h +++ b/src/nat/nat.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | 30 | ||
31 | 31 | ||
32 | |||
32 | GNUNET_NETWORK_STRUCT_BEGIN | 33 | GNUNET_NETWORK_STRUCT_BEGIN |
33 | 34 | ||
34 | /** | 35 | /** |
@@ -111,10 +112,9 @@ struct GNUNET_NAT_RegisterMessage | |||
111 | 112 | ||
112 | /** | 113 | /** |
113 | * Number of bytes in the string that follow which | 114 | * Number of bytes in the string that follow which |
114 | * specify the hostname and port of a manually punched | 115 | * specifies a section name in the configuration. |
115 | * hole for this client. | ||
116 | */ | 116 | */ |
117 | uint16_t hole_external_len GNUNET_PACKED; | 117 | uint16_t str_len GNUNET_PACKED; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Number of addresses that this service is bound to that follow. | 120 | * Number of addresses that this service is bound to that follow. |
@@ -126,8 +126,7 @@ struct GNUNET_NAT_RegisterMessage | |||
126 | /* Followed by @e num_addrs addresses of type 'struct | 126 | /* Followed by @e num_addrs addresses of type 'struct |
127 | sockaddr' */ | 127 | sockaddr' */ |
128 | 128 | ||
129 | /* Followed by @e hole_external_len bytes giving a hostname | 129 | /* Followed by @e str_len section name to use for options */ |
130 | and port */ | ||
131 | 130 | ||
132 | }; | 131 | }; |
133 | 132 | ||
@@ -225,45 +224,6 @@ struct GNUNET_NAT_AddressChangeNotificationMessage | |||
225 | }; | 224 | }; |
226 | 225 | ||
227 | 226 | ||
228 | /** | ||
229 | * Client requesting automatic configuration. | ||
230 | */ | ||
231 | struct GNUNET_NAT_AutoconfigRequestMessage | ||
232 | { | ||
233 | /** | ||
234 | * Header with type #GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG | ||
235 | */ | ||
236 | struct GNUNET_MessageHeader header; | ||
237 | |||
238 | /* Followed by configuration (diff, serialized, compressed) */ | ||
239 | |||
240 | }; | ||
241 | |||
242 | |||
243 | /** | ||
244 | * Service responding with proposed configuration. | ||
245 | */ | ||
246 | struct GNUNET_NAT_AutoconfigResultMessage | ||
247 | { | ||
248 | /** | ||
249 | * Header with type #GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT | ||
250 | */ | ||
251 | struct GNUNET_MessageHeader header; | ||
252 | |||
253 | /** | ||
254 | * An `enum GNUNET_NAT_StatusCode` in NBO. | ||
255 | */ | ||
256 | int32_t status_code GNUNET_PACKED; | ||
257 | |||
258 | /** | ||
259 | * An `enum GNUNET_NAT_Type` in NBO. | ||
260 | */ | ||
261 | int32_t type GNUNET_PACKED; | ||
262 | |||
263 | /* Followed by configuration (diff, serialized, compressed) */ | ||
264 | }; | ||
265 | |||
266 | |||
267 | GNUNET_NETWORK_STRUCT_END | 227 | GNUNET_NETWORK_STRUCT_END |
268 | 228 | ||
269 | #endif | 229 | #endif |
diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c index e4dfc1629..eec5d3968 100644 --- a/src/nat/nat_api.c +++ b/src/nat/nat_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2007-2016 GNUnet e.V. | 3 | Copyright (C) 2007-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -343,7 +343,7 @@ do_connect (void *cls) | |||
343 | struct GNUNET_MQ_Envelope *env; | 343 | struct GNUNET_MQ_Envelope *env; |
344 | 344 | ||
345 | nh->reconnect_task = NULL; | 345 | nh->reconnect_task = NULL; |
346 | nh->mq = GNUNET_CLIENT_connecT (nh->cfg, | 346 | nh->mq = GNUNET_CLIENT_connect (nh->cfg, |
347 | "nat", | 347 | "nat", |
348 | handlers, | 348 | handlers, |
349 | &mq_error_handler, | 349 | &mq_error_handler, |
@@ -368,8 +368,8 @@ do_connect (void *cls) | |||
368 | * address_callback for any 'plausible' external address. | 368 | * address_callback for any 'plausible' external address. |
369 | * | 369 | * |
370 | * @param cfg configuration to use | 370 | * @param cfg configuration to use |
371 | * @param config_section name of the configuration section for optionsx | ||
371 | * @param proto protocol this is about, IPPROTO_TCP or IPPROTO_UDP | 372 | * @param proto protocol this is about, IPPROTO_TCP or IPPROTO_UDP |
372 | * @param hole_external hostname and port of manually punched hole in NAT, otherwise NULL (or empty string) | ||
373 | * @param num_addrs number of addresses in @a addrs | 373 | * @param num_addrs number of addresses in @a addrs |
374 | * @param addrs list of local addresses packets should be redirected to | 374 | * @param addrs list of local addresses packets should be redirected to |
375 | * @param addrlens actual lengths of the addresses in @a addrs | 375 | * @param addrlens actual lengths of the addresses in @a addrs |
@@ -381,8 +381,8 @@ do_connect (void *cls) | |||
381 | */ | 381 | */ |
382 | struct GNUNET_NAT_Handle * | 382 | struct GNUNET_NAT_Handle * |
383 | GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | 383 | GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, |
384 | const char *config_section, | ||
384 | uint8_t proto, | 385 | uint8_t proto, |
385 | const char *hole_external, | ||
386 | unsigned int num_addrs, | 386 | unsigned int num_addrs, |
387 | const struct sockaddr **addrs, | 387 | const struct sockaddr **addrs, |
388 | const socklen_t *addrlens, | 388 | const socklen_t *addrlens, |
@@ -393,17 +393,14 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
393 | struct GNUNET_NAT_Handle *nh; | 393 | struct GNUNET_NAT_Handle *nh; |
394 | struct GNUNET_NAT_RegisterMessage *rm; | 394 | struct GNUNET_NAT_RegisterMessage *rm; |
395 | size_t len; | 395 | size_t len; |
396 | size_t hole_external_len; | 396 | size_t str_len; |
397 | char *off; | 397 | char *off; |
398 | 398 | ||
399 | len = 0; | 399 | len = 0; |
400 | for (unsigned int i=0;i<num_addrs;i++) | 400 | for (unsigned int i=0;i<num_addrs;i++) |
401 | len += addrlens[i]; | 401 | len += addrlens[i]; |
402 | hole_external_len | 402 | str_len = strlen (config_section) + 1; |
403 | = (NULL == hole_external) | 403 | len += str_len; |
404 | ? 0 | ||
405 | : strlen (hole_external); | ||
406 | len += hole_external_len; | ||
407 | if ( (len > GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (*rm)) || | 404 | if ( (len > GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (*rm)) || |
408 | (num_addrs > UINT16_MAX) ) | 405 | (num_addrs > UINT16_MAX) ) |
409 | { | 406 | { |
@@ -419,7 +416,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
419 | if (NULL != reversal_callback) | 416 | if (NULL != reversal_callback) |
420 | rm->flags |= GNUNET_NAT_RF_REVERSAL; | 417 | rm->flags |= GNUNET_NAT_RF_REVERSAL; |
421 | rm->proto = proto; | 418 | rm->proto = proto; |
422 | rm->hole_external_len = htons (hole_external_len); | 419 | rm->str_len = htons (str_len); |
423 | rm->num_addrs = htons ((uint16_t) num_addrs); | 420 | rm->num_addrs = htons ((uint16_t) num_addrs); |
424 | off = (char *) &rm[1]; | 421 | off = (char *) &rm[1]; |
425 | for (unsigned int i=0;i<num_addrs;i++) | 422 | for (unsigned int i=0;i<num_addrs;i++) |
@@ -459,8 +456,8 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
459 | off += addrlens[i]; | 456 | off += addrlens[i]; |
460 | } | 457 | } |
461 | GNUNET_memcpy (off, | 458 | GNUNET_memcpy (off, |
462 | hole_external, | 459 | config_section, |
463 | hole_external_len); | 460 | str_len); |
464 | 461 | ||
465 | nh = GNUNET_new (struct GNUNET_NAT_Handle); | 462 | nh = GNUNET_new (struct GNUNET_NAT_Handle); |
466 | nh->reg = &rm->header; | 463 | nh->reg = &rm->header; |
@@ -681,6 +678,8 @@ GNUNET_NAT_request_reversal (struct GNUNET_NAT_Handle *nh, | |||
681 | 678 | ||
682 | if (NULL == nh->mq) | 679 | if (NULL == nh->mq) |
683 | return GNUNET_SYSERR; | 680 | return GNUNET_SYSERR; |
681 | GNUNET_break (AF_INET == local_sa->sin_family); | ||
682 | GNUNET_break (AF_INET == remote_sa->sin_family); | ||
684 | env = GNUNET_MQ_msg_extra (req, | 683 | env = GNUNET_MQ_msg_extra (req, |
685 | 2 * sizeof (struct sockaddr_in), | 684 | 2 * sizeof (struct sockaddr_in), |
686 | GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL); | 685 | GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL); |
@@ -710,249 +709,19 @@ GNUNET_NAT_request_reversal (struct GNUNET_NAT_Handle *nh, | |||
710 | void | 709 | void |
711 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh) | 710 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh) |
712 | { | 711 | { |
713 | GNUNET_MQ_destroy (nh->mq); | 712 | if (NULL != nh->mq) |
714 | GNUNET_free (nh->reg); | ||
715 | GNUNET_free (nh); | ||
716 | } | ||
717 | |||
718 | |||
719 | |||
720 | /** | ||
721 | * Handle to auto-configuration in progress. | ||
722 | */ | ||
723 | struct GNUNET_NAT_AutoHandle | ||
724 | { | ||
725 | |||
726 | /** | ||
727 | * Configuration we use. | ||
728 | */ | ||
729 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
730 | |||
731 | /** | ||
732 | * Message queue for communicating with the NAT service. | ||
733 | */ | ||
734 | struct GNUNET_MQ_Handle *mq; | ||
735 | |||
736 | /** | ||
737 | * Function called with the result from the autoconfiguration. | ||
738 | */ | ||
739 | GNUNET_NAT_AutoResultCallback arc; | ||
740 | |||
741 | /** | ||
742 | * Closure for @e arc. | ||
743 | */ | ||
744 | void *arc_cls; | ||
745 | |||
746 | }; | ||
747 | |||
748 | |||
749 | /** | ||
750 | * Converts `enum GNUNET_NAT_StatusCode` to string | ||
751 | * | ||
752 | * @param err error code to resolve to a string | ||
753 | * @return point to a static string containing the error code | ||
754 | */ | ||
755 | const char * | ||
756 | GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err) | ||
757 | { | ||
758 | switch (err) | ||
759 | { | ||
760 | case GNUNET_NAT_ERROR_SUCCESS: | ||
761 | return _ ("Operation Successful"); | ||
762 | case GNUNET_NAT_ERROR_IPC_FAILURE: | ||
763 | return _ ("IPC failure"); | ||
764 | case GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR: | ||
765 | return _ ("Failure in network subsystem, check permissions."); | ||
766 | case GNUNET_NAT_ERROR_TIMEOUT: | ||
767 | return _ ("Encountered timeout while performing operation"); | ||
768 | case GNUNET_NAT_ERROR_NOT_ONLINE: | ||
769 | return _ ("detected that we are offline"); | ||
770 | case GNUNET_NAT_ERROR_UPNPC_NOT_FOUND: | ||
771 | return _ ("`upnpc` command not found"); | ||
772 | case GNUNET_NAT_ERROR_UPNPC_FAILED: | ||
773 | return _ ("Failed to run `upnpc` command"); | ||
774 | case GNUNET_NAT_ERROR_UPNPC_TIMEOUT: | ||
775 | return _ ("`upnpc' command took too long, process killed"); | ||
776 | case GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED: | ||
777 | return _ ("`upnpc' command failed to establish port mapping"); | ||
778 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND: | ||
779 | return _ ("`external-ip' command not found"); | ||
780 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED: | ||
781 | return _ ("Failed to run `external-ip` command"); | ||
782 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID: | ||
783 | return _ ("`external-ip' command output invalid"); | ||
784 | case GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID: | ||
785 | return _ ("no valid address was returned by `external-ip'"); | ||
786 | case GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO: | ||
787 | return _ ("Could not determine interface with internal/local network address"); | ||
788 | case GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND: | ||
789 | return _ ("No functioning gnunet-helper-nat-server installation found"); | ||
790 | case GNUNET_NAT_ERROR_NAT_TEST_START_FAILED: | ||
791 | return _ ("NAT test could not be initialized"); | ||
792 | case GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT: | ||
793 | return _ ("NAT test timeout reached"); | ||
794 | case GNUNET_NAT_ERROR_NAT_REGISTER_FAILED: | ||
795 | return _ ("could not register NAT"); | ||
796 | case GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND: | ||
797 | return _ ("No working gnunet-helper-nat-client installation found"); | ||
798 | default: | ||
799 | return "unknown status code"; | ||
800 | } | ||
801 | } | ||
802 | |||
803 | |||
804 | /** | ||
805 | * Check result from autoconfiguration attempt. | ||
806 | * | ||
807 | * @param cls the `struct GNUNET_NAT_AutoHandle` | ||
808 | * @param res the result | ||
809 | * @return #GNUNET_OK if @a res is well-formed (always for now) | ||
810 | */ | ||
811 | static int | ||
812 | check_auto_result (void *cls, | ||
813 | const struct GNUNET_NAT_AutoconfigResultMessage *res) | ||
814 | { | ||
815 | return GNUNET_OK; | ||
816 | } | ||
817 | |||
818 | |||
819 | /** | ||
820 | * Handle result from autoconfiguration attempt. | ||
821 | * | ||
822 | * @param cls the `struct GNUNET_NAT_AutoHandle` | ||
823 | * @param res the result | ||
824 | */ | ||
825 | static void | ||
826 | handle_auto_result (void *cls, | ||
827 | const struct GNUNET_NAT_AutoconfigResultMessage *res) | ||
828 | { | ||
829 | struct GNUNET_NAT_AutoHandle *ah = cls; | ||
830 | size_t left; | ||
831 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
832 | enum GNUNET_NAT_Type type | ||
833 | = (enum GNUNET_NAT_Type) ntohl (res->type); | ||
834 | enum GNUNET_NAT_StatusCode status | ||
835 | = (enum GNUNET_NAT_StatusCode) ntohl (res->status_code); | ||
836 | |||
837 | left = ntohs (res->header.size) - sizeof (*res); | ||
838 | cfg = GNUNET_CONFIGURATION_create (); | ||
839 | if (GNUNET_OK != | ||
840 | GNUNET_CONFIGURATION_deserialize (cfg, | ||
841 | (const char *) &res[1], | ||
842 | left, | ||
843 | GNUNET_NO)) | ||
844 | { | ||
845 | GNUNET_break (0); | ||
846 | ah->arc (ah->arc_cls, | ||
847 | NULL, | ||
848 | GNUNET_NAT_ERROR_IPC_FAILURE, | ||
849 | type); | ||
850 | } | ||
851 | else | ||
852 | { | ||
853 | ah->arc (ah->arc_cls, | ||
854 | cfg, | ||
855 | status, | ||
856 | type); | ||
857 | } | ||
858 | GNUNET_CONFIGURATION_destroy (cfg); | ||
859 | GNUNET_NAT_autoconfig_cancel (ah); | ||
860 | } | ||
861 | |||
862 | |||
863 | /** | ||
864 | * Handle queue errors by reporting autoconfiguration failure. | ||
865 | * | ||
866 | * @param cls the `struct GNUNET_NAT_AutoHandle *` | ||
867 | * @param error details about the error | ||
868 | */ | ||
869 | static void | ||
870 | ah_error_handler (void *cls, | ||
871 | enum GNUNET_MQ_Error error) | ||
872 | { | ||
873 | struct GNUNET_NAT_AutoHandle *ah = cls; | ||
874 | |||
875 | ah->arc (ah->arc_cls, | ||
876 | NULL, | ||
877 | GNUNET_NAT_ERROR_IPC_FAILURE, | ||
878 | GNUNET_NAT_TYPE_UNKNOWN); | ||
879 | GNUNET_NAT_autoconfig_cancel (ah); | ||
880 | } | ||
881 | |||
882 | |||
883 | /** | ||
884 | * Start auto-configuration routine. The transport adapters should | ||
885 | * be stopped while this function is called. | ||
886 | * | ||
887 | * @param cfg initial configuration | ||
888 | * @param cb function to call with autoconfiguration result | ||
889 | * @param cb_cls closure for @a cb | ||
890 | * @return handle to cancel operation | ||
891 | */ | ||
892 | struct GNUNET_NAT_AutoHandle * | ||
893 | GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
894 | GNUNET_NAT_AutoResultCallback cb, | ||
895 | void *cb_cls) | ||
896 | { | ||
897 | struct GNUNET_NAT_AutoHandle *ah = GNUNET_new (struct GNUNET_NAT_AutoHandle); | ||
898 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
899 | GNUNET_MQ_hd_var_size (auto_result, | ||
900 | GNUNET_MESSAGE_TYPE_NAT_AUTO_CFG_RESULT, | ||
901 | struct GNUNET_NAT_AutoconfigResultMessage, | ||
902 | ah), | ||
903 | GNUNET_MQ_handler_end () | ||
904 | }; | ||
905 | struct GNUNET_MQ_Envelope *env; | ||
906 | struct GNUNET_NAT_AutoconfigRequestMessage *req; | ||
907 | char *buf; | ||
908 | size_t size; | ||
909 | |||
910 | buf = GNUNET_CONFIGURATION_serialize (cfg, | ||
911 | &size); | ||
912 | if (size > GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (*req)) | ||
913 | { | 713 | { |
914 | GNUNET_break (0); | 714 | GNUNET_MQ_destroy (nh->mq); |
915 | GNUNET_free (buf); | 715 | nh->mq = NULL; |
916 | GNUNET_free (ah); | ||
917 | return NULL; | ||
918 | } | 716 | } |
919 | ah->arc = cb; | 717 | if (NULL != nh->reconnect_task) |
920 | ah->arc_cls = cb_cls; | ||
921 | ah->mq = GNUNET_CLIENT_connecT (cfg, | ||
922 | "nat", | ||
923 | handlers, | ||
924 | &ah_error_handler, | ||
925 | ah); | ||
926 | if (NULL == ah->mq) | ||
927 | { | 718 | { |
928 | GNUNET_break (0); | 719 | GNUNET_SCHEDULER_cancel (nh->reconnect_task); |
929 | GNUNET_free (buf); | 720 | nh->reconnect_task = NULL; |
930 | GNUNET_free (ah); | ||
931 | return NULL; | ||
932 | } | 721 | } |
933 | env = GNUNET_MQ_msg_extra (req, | 722 | GNUNET_free (nh->reg); |
934 | size, | 723 | GNUNET_free (nh); |
935 | GNUNET_MESSAGE_TYPE_NAT_REQUEST_AUTO_CFG); | ||
936 | GNUNET_memcpy (&req[1], | ||
937 | buf, | ||
938 | size); | ||
939 | GNUNET_free (buf); | ||
940 | GNUNET_MQ_send (ah->mq, | ||
941 | env); | ||
942 | return ah; | ||
943 | } | 724 | } |
944 | 725 | ||
945 | 726 | ||
946 | /** | ||
947 | * Abort autoconfiguration. | ||
948 | * | ||
949 | * @param ah handle for operation to abort | ||
950 | */ | ||
951 | void | ||
952 | GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah) | ||
953 | { | ||
954 | GNUNET_MQ_destroy (ah->mq); | ||
955 | GNUNET_free (ah); | ||
956 | } | ||
957 | |||
958 | /* end of nat_api.c */ | 727 | /* end of nat_api.c */ |
diff --git a/src/nat/nat_api_stun.c b/src/nat/nat_api_stun.c index 7f2ef4eaf..b1309fb53 100644 --- a/src/nat/nat_api_stun.c +++ b/src/nat/nat_api_stun.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include "platform.h" | 38 | #include "platform.h" |
39 | #include "gnunet_util_lib.h" | 39 | #include "gnunet_util_lib.h" |
40 | #include "gnunet_resolver_service.h" | 40 | #include "gnunet_resolver_service.h" |
41 | #include "gnunet_nat_lib.h" | 41 | #include "gnunet_nat_service.h" |
42 | 42 | ||
43 | 43 | ||
44 | #include "nat_stun.h" | 44 | #include "nat_stun.h" |
@@ -74,7 +74,7 @@ struct GNUNET_NAT_STUN_Handle | |||
74 | /** | 74 | /** |
75 | * Function to call when a error occours | 75 | * Function to call when a error occours |
76 | */ | 76 | */ |
77 | GNUNET_NAT_STUN_ErrorCallback cb; | 77 | GNUNET_NAT_TestCallback cb; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Closure for @e cb. | 80 | * Closure for @e cb. |
@@ -199,7 +199,7 @@ stun_dns_callback (void *cls, | |||
199 | 199 | ||
200 | /** | 200 | /** |
201 | * Make Generic STUN request. Sends a generic stun request to the | 201 | * Make Generic STUN request. Sends a generic stun request to the |
202 | * server specified using the specified socket. | 202 | * server specified using the specified socket. |
203 | * | 203 | * |
204 | * @param server the address of the stun server | 204 | * @param server the address of the stun server |
205 | * @param port port of the stun server, in host byte order | 205 | * @param port port of the stun server, in host byte order |
@@ -212,7 +212,7 @@ struct GNUNET_NAT_STUN_Handle * | |||
212 | GNUNET_NAT_stun_make_request (const char *server, | 212 | GNUNET_NAT_stun_make_request (const char *server, |
213 | uint16_t port, | 213 | uint16_t port, |
214 | struct GNUNET_NETWORK_Handle *sock, | 214 | struct GNUNET_NETWORK_Handle *sock, |
215 | GNUNET_NAT_STUN_ErrorCallback cb, | 215 | GNUNET_NAT_TestCallback cb, |
216 | void *cb_cls) | 216 | void *cb_cls) |
217 | { | 217 | { |
218 | struct GNUNET_NAT_STUN_Handle *rh; | 218 | struct GNUNET_NAT_STUN_Handle *rh; |
diff --git a/src/nat/nat_mini.c b/src/nat/nat_mini.c deleted file mode 100644 index 915bcbdb6..000000000 --- a/src/nat/nat_mini.c +++ /dev/null | |||
@@ -1,712 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2011-2014 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file nat/nat_mini.c | ||
23 | * @brief functions for interaction with miniupnp; tested with miniupnpc 1.5 | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_nat_lib.h" | ||
29 | #include "nat.h" | ||
30 | |||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "nat", __VA_ARGS__) | ||
32 | |||
33 | /** | ||
34 | * How long do we give upnpc to create a mapping? | ||
35 | */ | ||
36 | #define MAP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) | ||
37 | |||
38 | /** | ||
39 | * How long do we give upnpc to remove a mapping? | ||
40 | */ | ||
41 | #define UNMAP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | ||
42 | |||
43 | /** | ||
44 | * How often do we check for changes in the mapping? | ||
45 | */ | ||
46 | #define MAP_REFRESH_FREQ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
47 | |||
48 | |||
49 | |||
50 | /** | ||
51 | * Opaque handle to cancel "GNUNET_NAT_mini_get_external_ipv4" operation. | ||
52 | */ | ||
53 | struct GNUNET_NAT_ExternalHandle | ||
54 | { | ||
55 | |||
56 | /** | ||
57 | * Function to call with the result. | ||
58 | */ | ||
59 | GNUNET_NAT_IPCallback cb; | ||
60 | |||
61 | /** | ||
62 | * Closure for @e cb. | ||
63 | */ | ||
64 | void *cb_cls; | ||
65 | |||
66 | /** | ||
67 | * Read task. | ||
68 | */ | ||
69 | struct GNUNET_SCHEDULER_Task * task; | ||
70 | |||
71 | /** | ||
72 | * Handle to 'external-ip' process. | ||
73 | */ | ||
74 | struct GNUNET_OS_Process *eip; | ||
75 | |||
76 | /** | ||
77 | * Handle to stdout pipe of 'external-ip'. | ||
78 | */ | ||
79 | struct GNUNET_DISK_PipeHandle *opipe; | ||
80 | |||
81 | /** | ||
82 | * Read handle of @e opipe. | ||
83 | */ | ||
84 | const struct GNUNET_DISK_FileHandle *r; | ||
85 | |||
86 | /** | ||
87 | * When should this operation time out? | ||
88 | */ | ||
89 | struct GNUNET_TIME_Absolute timeout; | ||
90 | |||
91 | /** | ||
92 | * Number of bytes in 'buf' that are valid. | ||
93 | */ | ||
94 | size_t off; | ||
95 | |||
96 | /** | ||
97 | * Destination of our read operation (output of 'external-ip'). | ||
98 | */ | ||
99 | char buf[17]; | ||
100 | |||
101 | /** | ||
102 | * Error code for better debugging and user feedback | ||
103 | */ | ||
104 | enum GNUNET_NAT_StatusCode ret; | ||
105 | }; | ||
106 | |||
107 | |||
108 | /** | ||
109 | * Read the output of 'external-ip' into buf. When complete, parse the | ||
110 | * address and call our callback. | ||
111 | * | ||
112 | * @param cls the `struct GNUNET_NAT_ExternalHandle` | ||
113 | */ | ||
114 | static void | ||
115 | read_external_ipv4 (void *cls) | ||
116 | { | ||
117 | struct GNUNET_NAT_ExternalHandle *eh = cls; | ||
118 | ssize_t ret; | ||
119 | struct in_addr addr; | ||
120 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
121 | |||
122 | eh->task = NULL; | ||
123 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
124 | if (GNUNET_YES == | ||
125 | GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, eh->r)) | ||
126 | { | ||
127 | ret = | ||
128 | GNUNET_DISK_file_read (eh->r, &eh->buf[eh->off], | ||
129 | sizeof (eh->buf) - eh->off); | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | eh->ret = GNUNET_NAT_ERROR_IPC_FAILURE; | ||
134 | ret = -1; /* error reading, timeout, etc. */ | ||
135 | } | ||
136 | if (ret > 0) | ||
137 | { | ||
138 | /* try to read more */ | ||
139 | eh->off += ret; | ||
140 | eh->task = | ||
141 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_absolute_get_remaining | ||
142 | (eh->timeout), eh->r, | ||
143 | &read_external_ipv4, eh); | ||
144 | return; | ||
145 | } | ||
146 | eh->ret = GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID; | ||
147 | if ((eh->off > 7) && (eh->buf[eh->off - 1] == '\n')) | ||
148 | { | ||
149 | eh->buf[eh->off - 1] = '\0'; | ||
150 | if (1 == inet_pton (AF_INET, eh->buf, &addr)) | ||
151 | { | ||
152 | if (0 != addr.s_addr) | ||
153 | eh->ret = GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID; /* got 0.0.0.0 */ | ||
154 | else | ||
155 | eh->ret = GNUNET_NAT_ERROR_SUCCESS; | ||
156 | } | ||
157 | } | ||
158 | eh->cb (eh->cb_cls, | ||
159 | (GNUNET_NAT_ERROR_SUCCESS == eh->ret) ? &addr : NULL, | ||
160 | eh->ret); | ||
161 | GNUNET_NAT_mini_get_external_ipv4_cancel (eh); | ||
162 | } | ||
163 | |||
164 | |||
165 | /** | ||
166 | * (Asynchronously) signal error invoking "external-ip" to client. | ||
167 | * | ||
168 | * @param cls the `struct GNUNET_NAT_ExternalHandle` (freed) | ||
169 | */ | ||
170 | static void | ||
171 | signal_external_ip_error (void *cls) | ||
172 | { | ||
173 | struct GNUNET_NAT_ExternalHandle *eh = cls; | ||
174 | |||
175 | eh->task = NULL; | ||
176 | eh->cb (eh->cb_cls, | ||
177 | NULL, | ||
178 | eh->ret); | ||
179 | GNUNET_free (eh); | ||
180 | } | ||
181 | |||
182 | |||
183 | /** | ||
184 | * Try to get the external IPv4 address of this peer. | ||
185 | * | ||
186 | * @param timeout when to fail | ||
187 | * @param cb function to call with result | ||
188 | * @param cb_cls closure for @a cb | ||
189 | * @return handle for cancellation (can only be used until @a cb is called), never NULL | ||
190 | */ | ||
191 | struct GNUNET_NAT_ExternalHandle * | ||
192 | GNUNET_NAT_mini_get_external_ipv4 (struct GNUNET_TIME_Relative timeout, | ||
193 | GNUNET_NAT_IPCallback cb, void *cb_cls) | ||
194 | { | ||
195 | struct GNUNET_NAT_ExternalHandle *eh; | ||
196 | |||
197 | eh = GNUNET_new (struct GNUNET_NAT_ExternalHandle); | ||
198 | eh->cb = cb; | ||
199 | eh->cb_cls = cb_cls; | ||
200 | eh->ret = GNUNET_NAT_ERROR_SUCCESS; | ||
201 | if (GNUNET_SYSERR == | ||
202 | GNUNET_OS_check_helper_binary ("external-ip", GNUNET_NO, NULL)) | ||
203 | { | ||
204 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
205 | _("`external-ip' command not found\n")); | ||
206 | eh->ret = GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND; | ||
207 | eh->task = GNUNET_SCHEDULER_add_now (&signal_external_ip_error, | ||
208 | eh); | ||
209 | return eh; | ||
210 | } | ||
211 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
212 | "Running `external-ip' to determine our external IP\n"); | ||
213 | eh->opipe = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); | ||
214 | if (NULL == eh->opipe) | ||
215 | { | ||
216 | eh->ret = GNUNET_NAT_ERROR_IPC_FAILURE; | ||
217 | eh->task = GNUNET_SCHEDULER_add_now (&signal_external_ip_error, | ||
218 | eh); | ||
219 | return eh; | ||
220 | } | ||
221 | eh->eip = | ||
222 | GNUNET_OS_start_process (GNUNET_NO, 0, NULL, eh->opipe, NULL, | ||
223 | "external-ip", "external-ip", | ||
224 | NULL); | ||
225 | if (NULL == eh->eip) | ||
226 | { | ||
227 | GNUNET_DISK_pipe_close (eh->opipe); | ||
228 | eh->ret = GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED; | ||
229 | eh->task = GNUNET_SCHEDULER_add_now (&signal_external_ip_error, | ||
230 | eh); | ||
231 | return eh; | ||
232 | } | ||
233 | GNUNET_DISK_pipe_close_end (eh->opipe, GNUNET_DISK_PIPE_END_WRITE); | ||
234 | eh->timeout = GNUNET_TIME_relative_to_absolute (timeout); | ||
235 | eh->r = GNUNET_DISK_pipe_handle (eh->opipe, GNUNET_DISK_PIPE_END_READ); | ||
236 | eh->task = | ||
237 | GNUNET_SCHEDULER_add_read_file (timeout, | ||
238 | eh->r, | ||
239 | &read_external_ipv4, eh); | ||
240 | return eh; | ||
241 | } | ||
242 | |||
243 | |||
244 | /** | ||
245 | * Cancel operation. | ||
246 | * | ||
247 | * @param eh operation to cancel | ||
248 | */ | ||
249 | void | ||
250 | GNUNET_NAT_mini_get_external_ipv4_cancel (struct GNUNET_NAT_ExternalHandle *eh) | ||
251 | { | ||
252 | if (NULL != eh->eip) | ||
253 | { | ||
254 | (void) GNUNET_OS_process_kill (eh->eip, SIGKILL); | ||
255 | GNUNET_OS_process_destroy (eh->eip); | ||
256 | } | ||
257 | if (NULL != eh->opipe) | ||
258 | GNUNET_DISK_pipe_close (eh->opipe); | ||
259 | if (NULL != eh->task) | ||
260 | GNUNET_SCHEDULER_cancel (eh->task); | ||
261 | GNUNET_free (eh); | ||
262 | } | ||
263 | |||
264 | |||
265 | /** | ||
266 | * Handle to a mapping created with upnpc. | ||
267 | */ | ||
268 | struct GNUNET_NAT_MiniHandle | ||
269 | { | ||
270 | |||
271 | /** | ||
272 | * Function to call on mapping changes. | ||
273 | */ | ||
274 | GNUNET_NAT_MiniAddressCallback ac; | ||
275 | |||
276 | /** | ||
277 | * Closure for @e ac. | ||
278 | */ | ||
279 | void *ac_cls; | ||
280 | |||
281 | /** | ||
282 | * Command used to install the map. | ||
283 | */ | ||
284 | struct GNUNET_OS_CommandHandle *map_cmd; | ||
285 | |||
286 | /** | ||
287 | * Command used to refresh our map information. | ||
288 | */ | ||
289 | struct GNUNET_OS_CommandHandle *refresh_cmd; | ||
290 | |||
291 | /** | ||
292 | * Command used to remove the mapping. | ||
293 | */ | ||
294 | struct GNUNET_OS_CommandHandle *unmap_cmd; | ||
295 | |||
296 | /** | ||
297 | * Our current external mapping (if we have one). | ||
298 | */ | ||
299 | struct sockaddr_in current_addr; | ||
300 | |||
301 | /** | ||
302 | * We check the mapping periodically to see if it | ||
303 | * still works. This task triggers the check. | ||
304 | */ | ||
305 | struct GNUNET_SCHEDULER_Task * refresh_task; | ||
306 | |||
307 | /** | ||
308 | * Are we mapping TCP or UDP? | ||
309 | */ | ||
310 | int is_tcp; | ||
311 | |||
312 | /** | ||
313 | * Did we succeed with creating a mapping? | ||
314 | */ | ||
315 | int did_map; | ||
316 | |||
317 | /** | ||
318 | * Did we find our mapping during refresh scan? | ||
319 | */ | ||
320 | int found; | ||
321 | |||
322 | /** | ||
323 | * Which port are we mapping? | ||
324 | */ | ||
325 | uint16_t port; | ||
326 | |||
327 | }; | ||
328 | |||
329 | |||
330 | /** | ||
331 | * Run "upnpc -l" to find out if our mapping changed. | ||
332 | * | ||
333 | * @param cls the `struct GNUNET_NAT_MiniHandle` | ||
334 | */ | ||
335 | static void | ||
336 | do_refresh (void *cls); | ||
337 | |||
338 | |||
339 | /** | ||
340 | * Process the output from the "upnpc -r" command. | ||
341 | * | ||
342 | * @param cls the `struct GNUNET_NAT_MiniHandle` | ||
343 | * @param line line of output, NULL at the end | ||
344 | */ | ||
345 | static void | ||
346 | process_map_output (void *cls, const char *line); | ||
347 | |||
348 | |||
349 | /** | ||
350 | * Run "upnpc -r" to map our internal port. | ||
351 | * | ||
352 | * @param mini our handle | ||
353 | */ | ||
354 | static void | ||
355 | run_upnpc_r (struct GNUNET_NAT_MiniHandle *mini) | ||
356 | { | ||
357 | char pstr[6]; | ||
358 | |||
359 | GNUNET_snprintf (pstr, | ||
360 | sizeof (pstr), | ||
361 | "%u", | ||
362 | (unsigned int) mini->port); | ||
363 | mini->map_cmd = | ||
364 | GNUNET_OS_command_run (&process_map_output, mini, MAP_TIMEOUT, | ||
365 | "upnpc", "upnpc", "-r", pstr, | ||
366 | mini->is_tcp ? "tcp" : "udp", NULL); | ||
367 | if (NULL == mini->map_cmd) | ||
368 | { | ||
369 | mini->ac (mini->ac_cls, | ||
370 | GNUNET_SYSERR, | ||
371 | NULL, 0, | ||
372 | GNUNET_NAT_ERROR_UPNPC_FAILED); | ||
373 | return; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | |||
378 | /** | ||
379 | * Process the output from "upnpc -l" to see if our | ||
380 | * external mapping changed. If so, do the notifications. | ||
381 | * | ||
382 | * @param cls the `struct GNUNET_NAT_MiniHandle` | ||
383 | * @param line line of output, NULL at the end | ||
384 | */ | ||
385 | static void | ||
386 | process_refresh_output (void *cls, const char *line) | ||
387 | { | ||
388 | struct GNUNET_NAT_MiniHandle *mini = cls; | ||
389 | char pstr[9]; | ||
390 | const char *s; | ||
391 | unsigned int nport; | ||
392 | struct in_addr exip; | ||
393 | |||
394 | if (NULL == line) | ||
395 | { | ||
396 | GNUNET_OS_command_stop (mini->refresh_cmd); | ||
397 | mini->refresh_cmd = NULL; | ||
398 | if (GNUNET_NO == mini->found) | ||
399 | { | ||
400 | /* mapping disappeared, try to re-create */ | ||
401 | if (GNUNET_YES == mini->did_map) | ||
402 | { | ||
403 | mini->ac (mini->ac_cls, | ||
404 | GNUNET_NO, | ||
405 | (const struct sockaddr *) &mini->current_addr, | ||
406 | sizeof (mini->current_addr), | ||
407 | GNUNET_NAT_ERROR_SUCCESS); | ||
408 | mini->did_map = GNUNET_NO; | ||
409 | } | ||
410 | run_upnpc_r (mini); | ||
411 | } | ||
412 | return; | ||
413 | } | ||
414 | if (!mini->did_map) | ||
415 | return; /* never mapped, won't find our mapping anyway */ | ||
416 | |||
417 | /* we're looking for output of the form: | ||
418 | * "ExternalIPAddress = 12.134.41.124" */ | ||
419 | |||
420 | s = strstr (line, "ExternalIPAddress = "); | ||
421 | if (NULL != s) | ||
422 | { | ||
423 | s += strlen ("ExternalIPAddress = "); | ||
424 | if (1 != inet_pton (AF_INET, s, &exip)) | ||
425 | return; /* skip */ | ||
426 | if (exip.s_addr == mini->current_addr.sin_addr.s_addr) | ||
427 | return; /* no change */ | ||
428 | /* update mapping */ | ||
429 | mini->ac (mini->ac_cls, GNUNET_NO, | ||
430 | (const struct sockaddr *) &mini->current_addr, | ||
431 | sizeof (mini->current_addr), | ||
432 | GNUNET_NAT_ERROR_SUCCESS); | ||
433 | mini->current_addr.sin_addr = exip; | ||
434 | mini->ac (mini->ac_cls, GNUNET_YES, | ||
435 | (const struct sockaddr *) &mini->current_addr, | ||
436 | sizeof (mini->current_addr), | ||
437 | GNUNET_NAT_ERROR_SUCCESS); | ||
438 | return; | ||
439 | } | ||
440 | /* | ||
441 | * we're looking for output of the form: | ||
442 | * | ||
443 | * "0 TCP 3000->192.168.2.150:3000 'libminiupnpc' ''" | ||
444 | * "1 UDP 3001->192.168.2.150:3001 'libminiupnpc' ''" | ||
445 | * | ||
446 | * the pattern we look for is: | ||
447 | * | ||
448 | * "%s TCP PORT->STRING:OURPORT *" or | ||
449 | * "%s UDP PORT->STRING:OURPORT *" | ||
450 | */ | ||
451 | GNUNET_snprintf (pstr, sizeof (pstr), ":%u ", mini->port); | ||
452 | if (NULL == (s = strstr (line, "->"))) | ||
453 | return; /* skip */ | ||
454 | if (NULL == strstr (s, pstr)) | ||
455 | return; /* skip */ | ||
456 | if (1 != | ||
457 | SSCANF (line, | ||
458 | (mini->is_tcp) ? "%*u TCP %u->%*s:%*u %*s" : | ||
459 | "%*u UDP %u->%*s:%*u %*s", &nport)) | ||
460 | return; /* skip */ | ||
461 | mini->found = GNUNET_YES; | ||
462 | if (nport == ntohs (mini->current_addr.sin_port)) | ||
463 | return; /* no change */ | ||
464 | |||
465 | /* external port changed, update mapping */ | ||
466 | mini->ac (mini->ac_cls, GNUNET_NO, | ||
467 | (const struct sockaddr *) &mini->current_addr, | ||
468 | sizeof (mini->current_addr), | ||
469 | GNUNET_NAT_ERROR_SUCCESS); | ||
470 | mini->current_addr.sin_port = htons ((uint16_t) nport); | ||
471 | mini->ac (mini->ac_cls, GNUNET_YES, | ||
472 | (const struct sockaddr *) &mini->current_addr, | ||
473 | sizeof (mini->current_addr), | ||
474 | GNUNET_NAT_ERROR_SUCCESS); | ||
475 | } | ||
476 | |||
477 | |||
478 | /** | ||
479 | * Run "upnpc -l" to find out if our mapping changed. | ||
480 | * | ||
481 | * @param cls the 'struct GNUNET_NAT_MiniHandle' | ||
482 | */ | ||
483 | static void | ||
484 | do_refresh (void *cls) | ||
485 | { | ||
486 | struct GNUNET_NAT_MiniHandle *mini = cls; | ||
487 | int ac; | ||
488 | |||
489 | mini->refresh_task = | ||
490 | GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, | ||
491 | &do_refresh, mini); | ||
492 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
493 | "Running `upnpc' to check if our mapping still exists\n"); | ||
494 | mini->found = GNUNET_NO; | ||
495 | ac = GNUNET_NO; | ||
496 | if (NULL != mini->map_cmd) | ||
497 | { | ||
498 | /* took way too long, abort it! */ | ||
499 | GNUNET_OS_command_stop (mini->map_cmd); | ||
500 | mini->map_cmd = NULL; | ||
501 | ac = GNUNET_YES; | ||
502 | } | ||
503 | if (NULL != mini->refresh_cmd) | ||
504 | { | ||
505 | /* took way too long, abort it! */ | ||
506 | GNUNET_OS_command_stop (mini->refresh_cmd); | ||
507 | mini->refresh_cmd = NULL; | ||
508 | ac = GNUNET_YES; | ||
509 | } | ||
510 | mini->refresh_cmd = | ||
511 | GNUNET_OS_command_run (&process_refresh_output, mini, MAP_TIMEOUT, | ||
512 | "upnpc", "upnpc", "-l", NULL); | ||
513 | if (GNUNET_YES == ac) | ||
514 | mini->ac (mini->ac_cls, | ||
515 | GNUNET_SYSERR, | ||
516 | NULL, 0, | ||
517 | GNUNET_NAT_ERROR_UPNPC_TIMEOUT); | ||
518 | } | ||
519 | |||
520 | |||
521 | /** | ||
522 | * Process the output from the 'upnpc -r' command. | ||
523 | * | ||
524 | * @param cls the `struct GNUNET_NAT_MiniHandle` | ||
525 | * @param line line of output, NULL at the end | ||
526 | */ | ||
527 | static void | ||
528 | process_map_output (void *cls, | ||
529 | const char *line) | ||
530 | { | ||
531 | struct GNUNET_NAT_MiniHandle *mini = cls; | ||
532 | const char *ipaddr; | ||
533 | char *ipa; | ||
534 | const char *pstr; | ||
535 | unsigned int port; | ||
536 | |||
537 | if (NULL == line) | ||
538 | { | ||
539 | GNUNET_OS_command_stop (mini->map_cmd); | ||
540 | mini->map_cmd = NULL; | ||
541 | if (GNUNET_YES != mini->did_map) | ||
542 | mini->ac (mini->ac_cls, | ||
543 | GNUNET_SYSERR, | ||
544 | NULL, 0, | ||
545 | GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED); | ||
546 | if (NULL == mini->refresh_task) | ||
547 | mini->refresh_task = | ||
548 | GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, | ||
549 | &do_refresh, | ||
550 | mini); | ||
551 | return; | ||
552 | } | ||
553 | /* | ||
554 | * The upnpc output we're after looks like this: | ||
555 | * | ||
556 | * "external 87.123.42.204:3000 TCP is redirected to internal 192.168.2.150:3000" | ||
557 | */ | ||
558 | if ((NULL == (ipaddr = strstr (line, " "))) || | ||
559 | (NULL == (pstr = strstr (ipaddr, ":"))) || | ||
560 | (1 != SSCANF (pstr + 1, "%u", &port))) | ||
561 | { | ||
562 | return; /* skip line */ | ||
563 | } | ||
564 | ipa = GNUNET_strdup (ipaddr + 1); | ||
565 | strstr (ipa, ":")[0] = '\0'; | ||
566 | if (1 != inet_pton (AF_INET, ipa, &mini->current_addr.sin_addr)) | ||
567 | { | ||
568 | GNUNET_free (ipa); | ||
569 | return; /* skip line */ | ||
570 | } | ||
571 | GNUNET_free (ipa); | ||
572 | |||
573 | mini->current_addr.sin_port = htons (port); | ||
574 | mini->current_addr.sin_family = AF_INET; | ||
575 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
576 | mini->current_addr.sin_len = sizeof (struct sockaddr_in); | ||
577 | #endif | ||
578 | mini->did_map = GNUNET_YES; | ||
579 | mini->ac (mini->ac_cls, GNUNET_YES, | ||
580 | (const struct sockaddr *) &mini->current_addr, | ||
581 | sizeof (mini->current_addr), | ||
582 | GNUNET_NAT_ERROR_SUCCESS); | ||
583 | } | ||
584 | |||
585 | |||
586 | /** | ||
587 | * Start mapping the given port using (mini)upnpc. This function | ||
588 | * should typically not be used directly (it is used within the | ||
589 | * general-purpose #GNUNET_NAT_register() code). However, it can be | ||
590 | * used if specifically UPnP-based NAT traversal is to be used or | ||
591 | * tested. | ||
592 | * | ||
593 | * @param port port to map | ||
594 | * @param is_tcp #GNUNET_YES to map TCP, #GNUNET_NO for UDP | ||
595 | * @param ac function to call with mapping result | ||
596 | * @param ac_cls closure for @a ac | ||
597 | * @return NULL on error (no 'upnpc' installed) | ||
598 | */ | ||
599 | struct GNUNET_NAT_MiniHandle * | ||
600 | GNUNET_NAT_mini_map_start (uint16_t port, | ||
601 | int is_tcp, | ||
602 | GNUNET_NAT_MiniAddressCallback ac, | ||
603 | void *ac_cls) | ||
604 | { | ||
605 | struct GNUNET_NAT_MiniHandle *ret; | ||
606 | |||
607 | if (GNUNET_SYSERR == | ||
608 | GNUNET_OS_check_helper_binary ("upnpc", GNUNET_NO, NULL)) | ||
609 | { | ||
610 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
611 | _("`upnpc' command not found\n")); | ||
612 | ac (ac_cls, | ||
613 | GNUNET_SYSERR, | ||
614 | NULL, 0, | ||
615 | GNUNET_NAT_ERROR_UPNPC_NOT_FOUND); | ||
616 | return NULL; | ||
617 | } | ||
618 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
619 | "Running `upnpc' to install mapping\n"); | ||
620 | ret = GNUNET_new (struct GNUNET_NAT_MiniHandle); | ||
621 | ret->ac = ac; | ||
622 | ret->ac_cls = ac_cls; | ||
623 | ret->is_tcp = is_tcp; | ||
624 | ret->port = port; | ||
625 | ret->refresh_task = | ||
626 | GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, | ||
627 | &do_refresh, | ||
628 | ret); | ||
629 | run_upnpc_r (ret); | ||
630 | return ret; | ||
631 | } | ||
632 | |||
633 | |||
634 | /** | ||
635 | * Process output from our 'unmap' command. | ||
636 | * | ||
637 | * @param cls the `struct GNUNET_NAT_MiniHandle` | ||
638 | * @param line line of output, NULL at the end | ||
639 | */ | ||
640 | static void | ||
641 | process_unmap_output (void *cls, const char *line) | ||
642 | { | ||
643 | struct GNUNET_NAT_MiniHandle *mini = cls; | ||
644 | |||
645 | if (NULL == line) | ||
646 | { | ||
647 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
648 | "UPnP unmap done\n"); | ||
649 | GNUNET_OS_command_stop (mini->unmap_cmd); | ||
650 | mini->unmap_cmd = NULL; | ||
651 | GNUNET_free (mini); | ||
652 | return; | ||
653 | } | ||
654 | /* we don't really care about the output... */ | ||
655 | } | ||
656 | |||
657 | |||
658 | /** | ||
659 | * Remove a mapping created with (mini)upnpc. Calling | ||
660 | * this function will give 'upnpc' 1s to remove tha mapping, | ||
661 | * so while this function is non-blocking, a task will be | ||
662 | * left with the scheduler for up to 1s past this call. | ||
663 | * | ||
664 | * @param mini the handle | ||
665 | */ | ||
666 | void | ||
667 | GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini) | ||
668 | { | ||
669 | char pstr[6]; | ||
670 | |||
671 | if (NULL != mini->refresh_task) | ||
672 | { | ||
673 | GNUNET_SCHEDULER_cancel (mini->refresh_task); | ||
674 | mini->refresh_task = NULL; | ||
675 | } | ||
676 | if (NULL != mini->refresh_cmd) | ||
677 | { | ||
678 | GNUNET_OS_command_stop (mini->refresh_cmd); | ||
679 | mini->refresh_cmd = NULL; | ||
680 | } | ||
681 | if (NULL != mini->map_cmd) | ||
682 | { | ||
683 | GNUNET_OS_command_stop (mini->map_cmd); | ||
684 | mini->map_cmd = NULL; | ||
685 | } | ||
686 | if (GNUNET_NO == mini->did_map) | ||
687 | { | ||
688 | GNUNET_free (mini); | ||
689 | return; | ||
690 | } | ||
691 | mini->ac (mini->ac_cls, GNUNET_NO, | ||
692 | (const struct sockaddr *) &mini->current_addr, | ||
693 | sizeof (mini->current_addr), | ||
694 | GNUNET_NAT_ERROR_SUCCESS); | ||
695 | /* Note: oddly enough, deletion uses the external port whereas | ||
696 | * addition uses the internal port; this rarely matters since they | ||
697 | * often are the same, but it might... */ | ||
698 | GNUNET_snprintf (pstr, | ||
699 | sizeof (pstr), | ||
700 | "%u", | ||
701 | (unsigned int) ntohs (mini->current_addr.sin_port)); | ||
702 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
703 | "Unmapping port %u with UPnP\n", | ||
704 | ntohs (mini->current_addr.sin_port)); | ||
705 | mini->unmap_cmd = | ||
706 | GNUNET_OS_command_run (&process_unmap_output, mini, UNMAP_TIMEOUT, | ||
707 | "upnpc", "upnpc", "-d", pstr, | ||
708 | mini->is_tcp ? "tcp" : "udp", NULL); | ||
709 | } | ||
710 | |||
711 | |||
712 | /* end of nat_mini.c */ | ||
diff --git a/src/nat/nat_stun.c b/src/nat/nat_stun.c deleted file mode 100644 index 62916ab84..000000000 --- a/src/nat/nat_stun.c +++ /dev/null | |||
@@ -1,439 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009, 2015 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * This code provides some support for doing STUN transactions. | ||
22 | * We send simplest possible packet ia REQUEST with BIND to a STUN server. | ||
23 | * | ||
24 | * All STUN packets start with a simple header made of a type, | ||
25 | * length (excluding the header) and a 16-byte random transaction id. | ||
26 | * Following the header we may have zero or more attributes, each | ||
27 | * structured as a type, length and a value (whose format depends | ||
28 | * on the type, but often contains addresses). | ||
29 | * Of course all fields are in network format. | ||
30 | * | ||
31 | * This code was based on ministun.c. | ||
32 | * | ||
33 | * @file nat/nat_stun.c | ||
34 | * @brief Functions for STUN functionality | ||
35 | * @author Bruno Souza Cabral | ||
36 | */ | ||
37 | |||
38 | #include "platform.h" | ||
39 | #include "gnunet_util_lib.h" | ||
40 | #include "gnunet_resolver_service.h" | ||
41 | #include "gnunet_nat_lib.h" | ||
42 | |||
43 | |||
44 | #include "nat_stun.h" | ||
45 | |||
46 | #define LOG(kind,...) GNUNET_log_from (kind, "stun", __VA_ARGS__) | ||
47 | |||
48 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) | ||
49 | |||
50 | |||
51 | /** | ||
52 | * Handle to a request given to the resolver. Can be used to cancel | ||
53 | * the request prior to the timeout or successful execution. Also | ||
54 | * used to track our internal state for the request. | ||
55 | */ | ||
56 | struct GNUNET_NAT_STUN_Handle | ||
57 | { | ||
58 | |||
59 | /** | ||
60 | * Handle to a pending DNS lookup request. | ||
61 | */ | ||
62 | struct GNUNET_RESOLVER_RequestHandle *dns_active; | ||
63 | |||
64 | /** | ||
65 | * Handle to the listen socket | ||
66 | */ | ||
67 | struct GNUNET_NETWORK_Handle *sock; | ||
68 | |||
69 | /** | ||
70 | * Stun server address | ||
71 | */ | ||
72 | char *stun_server; | ||
73 | |||
74 | /** | ||
75 | * Function to call when a error occours | ||
76 | */ | ||
77 | GNUNET_NAT_STUN_ErrorCallback cb; | ||
78 | |||
79 | /** | ||
80 | * Closure for @e cb. | ||
81 | */ | ||
82 | void *cb_cls; | ||
83 | |||
84 | /** | ||
85 | * Do we got a DNS resolution successfully? | ||
86 | */ | ||
87 | int dns_success; | ||
88 | |||
89 | /** | ||
90 | * STUN port | ||
91 | */ | ||
92 | uint16_t stun_port; | ||
93 | |||
94 | }; | ||
95 | |||
96 | |||
97 | /** | ||
98 | * here we store credentials extracted from a message | ||
99 | */ | ||
100 | struct StunState | ||
101 | { | ||
102 | uint16_t attr; | ||
103 | }; | ||
104 | |||
105 | |||
106 | /** | ||
107 | * Encode a class and method to a compatible STUN format | ||
108 | * | ||
109 | * @param msg_class class to be converted | ||
110 | * @param method method to be converted | ||
111 | * @return message in a STUN compatible format | ||
112 | */ | ||
113 | static int | ||
114 | encode_message (enum StunClasses msg_class, | ||
115 | enum StunMethods method) | ||
116 | { | ||
117 | return ((msg_class & 1) << 4) | ((msg_class & 2) << 7) | | ||
118 | (method & 0x000f) | ((method & 0x0070) << 1) | ((method & 0x0f800) << 2); | ||
119 | } | ||
120 | |||
121 | |||
122 | /** | ||
123 | * Fill the stun_header with a random request_id | ||
124 | * | ||
125 | * @param req, stun header to be filled | ||
126 | */ | ||
127 | static void | ||
128 | generate_request_id (struct stun_header *req) | ||
129 | { | ||
130 | unsigned int x; | ||
131 | |||
132 | req->magic = htonl(STUN_MAGIC_COOKIE); | ||
133 | for (x = 0; x < 3; x++) | ||
134 | req->id.id[x] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, | ||
135 | UINT32_MAX); | ||
136 | } | ||
137 | |||
138 | |||
139 | /** | ||
140 | * Extract the STUN_MAPPED_ADDRESS from the stun response. | ||
141 | * This is used as a callback for stun_handle_response | ||
142 | * when called from stun_request. | ||
143 | * | ||
144 | * @param st, pointer where we will set the type | ||
145 | * @param attr , received stun attribute | ||
146 | * @param arg , pointer to a sockaddr_in where we will set the reported IP and port | ||
147 | * @param magic , Magic cookie | ||
148 | * | ||
149 | * @return 0 on success, other value otherwise | ||
150 | */ | ||
151 | static int | ||
152 | stun_get_mapped (struct StunState *st, | ||
153 | struct stun_attr *attr, | ||
154 | struct sockaddr_in *arg, | ||
155 | unsigned int magic) | ||
156 | { | ||
157 | struct stun_addr *returned_addr = (struct stun_addr *)(attr + 1); | ||
158 | struct sockaddr_in *sa = (struct sockaddr_in *)arg; | ||
159 | unsigned short type = ntohs(attr->attr); | ||
160 | |||
161 | switch (type) | ||
162 | { | ||
163 | case STUN_MAPPED_ADDRESS: | ||
164 | if (st->attr == STUN_XOR_MAPPED_ADDRESS || | ||
165 | st->attr == STUN_MS_XOR_MAPPED_ADDRESS) | ||
166 | return 1; | ||
167 | magic = 0; | ||
168 | break; | ||
169 | case STUN_MS_XOR_MAPPED_ADDRESS: | ||
170 | if (st->attr == STUN_XOR_MAPPED_ADDRESS) | ||
171 | return 1; | ||
172 | break; | ||
173 | case STUN_XOR_MAPPED_ADDRESS: | ||
174 | break; | ||
175 | default: | ||
176 | return 1; | ||
177 | } | ||
178 | if ( (ntohs(attr->len) < 8) && | ||
179 | (returned_addr->family != 1) ) | ||
180 | { | ||
181 | return 1; | ||
182 | } | ||
183 | st->attr = type; | ||
184 | sa->sin_family = AF_INET; | ||
185 | sa->sin_port = returned_addr->port ^ htons(ntohl(magic) >> 16); | ||
186 | sa->sin_addr.s_addr = returned_addr->addr ^ magic; | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | |||
191 | /** | ||
192 | * Handle an incoming STUN message, Do some basic sanity checks on packet size and content, | ||
193 | * try to extract a bit of information, and possibly reply. | ||
194 | * At the moment this only processes BIND requests, and returns | ||
195 | * the externally visible address of the request. | ||
196 | * If a callback is specified, invoke it with the attribute. | ||
197 | * | ||
198 | * @param data the packet | ||
199 | * @param len the length of the packet in @a data | ||
200 | * @param[out] arg sockaddr_in where we will set our discovered address | ||
201 | * | ||
202 | * @return, #GNUNET_OK on OK, #GNUNET_NO if the packet is invalid (not a stun packet) | ||
203 | */ | ||
204 | int | ||
205 | GNUNET_NAT_stun_handle_packet (const void *data, | ||
206 | size_t len, | ||
207 | struct sockaddr_in *arg) | ||
208 | { | ||
209 | const struct stun_header *hdr = (const struct stun_header *)data; | ||
210 | struct stun_attr *attr; | ||
211 | struct StunState st; | ||
212 | int ret = GNUNET_OK; | ||
213 | uint32_t advertised_message_size; | ||
214 | uint32_t message_magic_cookie; | ||
215 | |||
216 | /* On entry, 'len' is the length of the udp payload. After the | ||
217 | * initial checks it becomes the size of unprocessed options, | ||
218 | * while 'data' is advanced accordingly. | ||
219 | */ | ||
220 | if (len < sizeof(struct stun_header)) | ||
221 | { | ||
222 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
223 | "STUN packet too short (only %d, wanting at least %d)\n", | ||
224 | (int) len, | ||
225 | (int) sizeof(struct stun_header)); | ||
226 | GNUNET_break_op (0); | ||
227 | return GNUNET_NO; | ||
228 | } | ||
229 | /* Skip header as it is already in hdr */ | ||
230 | len -= sizeof(struct stun_header); | ||
231 | data += sizeof(struct stun_header); | ||
232 | |||
233 | /* len as advertised in the message */ | ||
234 | advertised_message_size = ntohs(hdr->msglen); | ||
235 | |||
236 | message_magic_cookie = ntohl(hdr->magic); | ||
237 | /* Compare if the cookie match */ | ||
238 | if (STUN_MAGIC_COOKIE != message_magic_cookie) | ||
239 | { | ||
240 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
241 | "Invalid magic cookie \n"); | ||
242 | return GNUNET_NO; | ||
243 | } | ||
244 | |||
245 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
246 | "STUN Packet, msg %s (%04x), length: %d\n", | ||
247 | stun_msg2str(ntohs(hdr->msgtype)), | ||
248 | ntohs(hdr->msgtype), | ||
249 | advertised_message_size); | ||
250 | if (advertised_message_size > len) | ||
251 | { | ||
252 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
253 | "Scrambled STUN packet length (got %d, expecting %d)\n", | ||
254 | advertised_message_size, | ||
255 | (int)len); | ||
256 | return GNUNET_NO; | ||
257 | } | ||
258 | len = advertised_message_size; | ||
259 | memset (&st, 0, sizeof(st)); | ||
260 | |||
261 | while (len > 0) | ||
262 | { | ||
263 | if (len < sizeof(struct stun_attr)) | ||
264 | { | ||
265 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
266 | "Attribute too short (got %d, expecting %d)\n", | ||
267 | (int)len, | ||
268 | (int) sizeof(struct stun_attr)); | ||
269 | break; | ||
270 | } | ||
271 | attr = (struct stun_attr *)data; | ||
272 | |||
273 | /* compute total attribute length */ | ||
274 | advertised_message_size = ntohs(attr->len) + sizeof(struct stun_attr); | ||
275 | |||
276 | /* Check if we still have space in our buffer */ | ||
277 | if (advertised_message_size > len ) | ||
278 | { | ||
279 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
280 | "Inconsistent Attribute (length %d exceeds remaining msg len %d)\n", | ||
281 | advertised_message_size, | ||
282 | (int)len); | ||
283 | break; | ||
284 | } | ||
285 | stun_get_mapped (&st, | ||
286 | attr, | ||
287 | arg, | ||
288 | hdr->magic); | ||
289 | /* Clear attribute id: in case previous entry was a string, | ||
290 | * this will act as the terminator for the string. | ||
291 | */ | ||
292 | attr->attr = 0; | ||
293 | data += advertised_message_size; | ||
294 | len -= advertised_message_size; | ||
295 | ret = GNUNET_OK; | ||
296 | } | ||
297 | return ret; | ||
298 | } | ||
299 | |||
300 | |||
301 | /** | ||
302 | * Cancel active STUN request. Frees associated resources | ||
303 | * and ensures that the callback is no longer invoked. | ||
304 | * | ||
305 | * @param rh request to cancel | ||
306 | */ | ||
307 | void | ||
308 | GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh) | ||
309 | { | ||
310 | if (NULL != rh->dns_active) | ||
311 | { | ||
312 | GNUNET_RESOLVER_request_cancel (rh->dns_active); | ||
313 | rh->dns_active = NULL; | ||
314 | } | ||
315 | GNUNET_free (rh->stun_server); | ||
316 | GNUNET_free (rh); | ||
317 | } | ||
318 | |||
319 | |||
320 | /** | ||
321 | * Try to establish a connection given the specified address. | ||
322 | * | ||
323 | * @param cls our `struct GNUNET_NAT_STUN_Handle *` | ||
324 | * @param addr address to try, NULL for "last call" | ||
325 | * @param addrlen length of @a addr | ||
326 | */ | ||
327 | static void | ||
328 | stun_dns_callback (void *cls, | ||
329 | const struct sockaddr *addr, | ||
330 | socklen_t addrlen) | ||
331 | { | ||
332 | struct GNUNET_NAT_STUN_Handle *rh = cls; | ||
333 | struct stun_header *req; | ||
334 | uint8_t reqdata[1024]; | ||
335 | int reqlen; | ||
336 | struct sockaddr_in server; | ||
337 | |||
338 | if (NULL == addr) | ||
339 | { | ||
340 | rh->dns_active = NULL; | ||
341 | if (GNUNET_NO == rh->dns_success) | ||
342 | { | ||
343 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
344 | "Error resolving host %s\n", | ||
345 | rh->stun_server); | ||
346 | rh->cb (rh->cb_cls, | ||
347 | GNUNET_NAT_ERROR_NOT_ONLINE); | ||
348 | } | ||
349 | else if (GNUNET_SYSERR == rh->dns_success) | ||
350 | { | ||
351 | rh->cb (rh->cb_cls, | ||
352 | GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR); | ||
353 | } | ||
354 | else | ||
355 | { | ||
356 | rh->cb (rh->cb_cls, | ||
357 | GNUNET_NAT_ERROR_SUCCESS); | ||
358 | } | ||
359 | GNUNET_NAT_stun_make_request_cancel (rh); | ||
360 | return; | ||
361 | } | ||
362 | |||
363 | rh->dns_success = GNUNET_YES; | ||
364 | memset (&server,0, sizeof(server)); | ||
365 | server.sin_family = AF_INET; | ||
366 | server.sin_addr = ((struct sockaddr_in *)addr)->sin_addr; | ||
367 | server.sin_port = htons(rh->stun_port); | ||
368 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
369 | server.sin_len = (u_char) sizeof (struct sockaddr_in); | ||
370 | #endif | ||
371 | |||
372 | /*Craft the simplest possible STUN packet. A request binding*/ | ||
373 | req = (struct stun_header *)reqdata; | ||
374 | generate_request_id (req); | ||
375 | reqlen = 0; | ||
376 | req->msgtype = 0; | ||
377 | req->msglen = 0; | ||
378 | req->msglen = htons (reqlen); | ||
379 | req->msgtype = htons (encode_message (STUN_REQUEST, | ||
380 | STUN_BINDING)); | ||
381 | |||
382 | /* Send the packet */ | ||
383 | if (-1 == | ||
384 | GNUNET_NETWORK_socket_sendto (rh->sock, | ||
385 | req, | ||
386 | ntohs(req->msglen) + sizeof(*req), | ||
387 | (const struct sockaddr *) &server, | ||
388 | sizeof (server))) | ||
389 | { | ||
390 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, | ||
391 | "sendto"); | ||
392 | rh->dns_success = GNUNET_SYSERR; | ||
393 | return; | ||
394 | } | ||
395 | } | ||
396 | |||
397 | |||
398 | /** | ||
399 | * Make Generic STUN request. Sends a generic stun request to the | ||
400 | * server specified using the specified socket, possibly waiting for | ||
401 | * a reply and filling the 'reply' field with the externally visible | ||
402 | * address. | ||
403 | * | ||
404 | * @param server the address of the stun server | ||
405 | * @param port port of the stun server | ||
406 | * @param sock the socket used to send the request | ||
407 | * @param cb callback in case of error | ||
408 | * @param cb_cls closure for @a cb | ||
409 | * @return NULL on error | ||
410 | */ | ||
411 | struct GNUNET_NAT_STUN_Handle * | ||
412 | GNUNET_NAT_stun_make_request (const char *server, | ||
413 | uint16_t port, | ||
414 | struct GNUNET_NETWORK_Handle *sock, | ||
415 | GNUNET_NAT_STUN_ErrorCallback cb, | ||
416 | void *cb_cls) | ||
417 | { | ||
418 | struct GNUNET_NAT_STUN_Handle *rh; | ||
419 | |||
420 | rh = GNUNET_new (struct GNUNET_NAT_STUN_Handle); | ||
421 | rh->sock = sock; | ||
422 | rh->cb = cb; | ||
423 | rh->cb_cls = cb_cls; | ||
424 | rh->stun_server = GNUNET_strdup (server); | ||
425 | rh->stun_port = port; | ||
426 | rh->dns_success = GNUNET_NO; | ||
427 | rh->dns_active = GNUNET_RESOLVER_ip_get (rh->stun_server, | ||
428 | AF_INET, | ||
429 | TIMEOUT, | ||
430 | &stun_dns_callback, rh); | ||
431 | if (NULL == rh->dns_active) | ||
432 | { | ||
433 | GNUNET_NAT_stun_make_request_cancel (rh); | ||
434 | return NULL; | ||
435 | } | ||
436 | return rh; | ||
437 | } | ||
438 | |||
439 | /* end of nat_stun.c */ | ||
diff --git a/src/nse/.gitignore b/src/nse/.gitignore index 4e6257696..a2575673c 100644 --- a/src/nse/.gitignore +++ b/src/nse/.gitignore | |||
@@ -1,3 +1,5 @@ | |||
1 | gnunet-service-nse | 1 | gnunet-service-nse |
2 | gnunet-nse | 2 | gnunet-nse |
3 | gnunet-nse-profiler | 3 | gnunet-nse-profiler |
4 | test_nse_api | ||
5 | perf_kdf | ||
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 511f95514..4d54a740b 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -1346,7 +1346,7 @@ shutdown_task (void *cls) | |||
1346 | } | 1346 | } |
1347 | if (NULL != core_api) | 1347 | if (NULL != core_api) |
1348 | { | 1348 | { |
1349 | GNUNET_CORE_disconnecT (core_api); | 1349 | GNUNET_CORE_disconnect (core_api); |
1350 | core_api = NULL; | 1350 | core_api = NULL; |
1351 | } | 1351 | } |
1352 | if (NULL != stats) | 1352 | if (NULL != stats) |
@@ -1607,7 +1607,7 @@ run (void *cls, | |||
1607 | GNUNET_YES); | 1607 | GNUNET_YES); |
1608 | nc = GNUNET_notification_context_create (1); | 1608 | nc = GNUNET_notification_context_create (1); |
1609 | /* Connect to core service and register core handlers */ | 1609 | /* Connect to core service and register core handlers */ |
1610 | core_api = GNUNET_CORE_connecT (cfg, /* Main configuration */ | 1610 | core_api = GNUNET_CORE_connect (cfg, /* Main configuration */ |
1611 | NULL, /* Closure passed to functions */ | 1611 | NULL, /* Closure passed to functions */ |
1612 | &core_init, /* Call core_init once connected */ | 1612 | &core_init, /* Call core_init once connected */ |
1613 | &handle_core_connect, /* Handle connects */ | 1613 | &handle_core_connect, /* Handle connects */ |
diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c index cfe5482eb..d50b0214a 100644 --- a/src/nse/nse_api.c +++ b/src/nse/nse_api.c | |||
@@ -150,7 +150,7 @@ reconnect (void *cls) | |||
150 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 150 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
151 | "Connecting to network size estimation service.\n"); | 151 | "Connecting to network size estimation service.\n"); |
152 | GNUNET_assert (NULL == h->mq); | 152 | GNUNET_assert (NULL == h->mq); |
153 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 153 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
154 | "nse", | 154 | "nse", |
155 | handlers, | 155 | handlers, |
156 | &mq_error_handler, | 156 | &mq_error_handler, |
diff --git a/src/peerinfo-tool/.gitignore b/src/peerinfo-tool/.gitignore index dc2209862..d4ed4f801 100644 --- a/src/peerinfo-tool/.gitignore +++ b/src/peerinfo-tool/.gitignore | |||
@@ -1 +1,2 @@ | |||
1 | gnunet-peerinfo | 1 | gnunet-peerinfo |
2 | test_gnunet_peerinfo.py | ||
diff --git a/src/peerinfo-tool/Makefile.am b/src/peerinfo-tool/Makefile.am index f22380a9e..c79c3ac68 100644 --- a/src/peerinfo-tool/Makefile.am +++ b/src/peerinfo-tool/Makefile.am | |||
@@ -19,7 +19,6 @@ gnunet_peerinfo_SOURCES = \ | |||
19 | 19 | ||
20 | gnunet_peerinfo_LDADD = \ | 20 | gnunet_peerinfo_LDADD = \ |
21 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 21 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
22 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
23 | $(top_builddir)/src/transport/libgnunettransport.la \ | 22 | $(top_builddir)/src/transport/libgnunettransport.la \ |
24 | $(top_builddir)/src/hello/libgnunethello.la \ | 23 | $(top_builddir)/src/hello/libgnunethello.la \ |
25 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 24 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
diff --git a/src/peerinfo/.gitignore b/src/peerinfo/.gitignore index 950ed60a6..e2a79a211 100644 --- a/src/peerinfo/.gitignore +++ b/src/peerinfo/.gitignore | |||
@@ -1 +1,5 @@ | |||
1 | gnunet-service-peerinfo | 1 | gnunet-service-peerinfo |
2 | test_peerinfo_api | ||
3 | test_peerinfo_api_friend_only | ||
4 | test_peerinfo_api_notify_friend_only | ||
5 | test_peerinfo_shipped_hellos | ||
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 3080fb503..b75d4e291 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -462,7 +462,7 @@ reconnect (struct GNUNET_PEERINFO_Handle *h) | |||
462 | GNUNET_MQ_destroy (h->mq); | 462 | GNUNET_MQ_destroy (h->mq); |
463 | h->mq = NULL; | 463 | h->mq = NULL; |
464 | } | 464 | } |
465 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 465 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
466 | "peerinfo", | 466 | "peerinfo", |
467 | handlers, | 467 | handlers, |
468 | &mq_error_handler, | 468 | &mq_error_handler, |
@@ -557,7 +557,7 @@ GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic) | |||
557 | struct GNUNET_MQ_Envelope * | 557 | struct GNUNET_MQ_Envelope * |
558 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, | 558 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, |
559 | const struct GNUNET_HELLO_Message *hello, | 559 | const struct GNUNET_HELLO_Message *hello, |
560 | GNUNET_MQ_NotifyCallback cont, | 560 | GNUNET_SCHEDULER_TaskCallback cont, |
561 | void *cont_cls) | 561 | void *cont_cls) |
562 | { | 562 | { |
563 | struct GNUNET_MQ_Envelope *env; | 563 | struct GNUNET_MQ_Envelope *env; |
diff --git a/src/peerinfo/peerinfo_api_notify.c b/src/peerinfo/peerinfo_api_notify.c index e707a911e..ce226d96e 100644 --- a/src/peerinfo/peerinfo_api_notify.c +++ b/src/peerinfo/peerinfo_api_notify.c | |||
@@ -212,7 +212,7 @@ reconnect (void *cls) | |||
212 | struct NotifyMessage *nm; | 212 | struct NotifyMessage *nm; |
213 | 213 | ||
214 | nc->task = NULL; | 214 | nc->task = NULL; |
215 | nc->mq = GNUNET_CLIENT_connecT (nc->cfg, | 215 | nc->mq = GNUNET_CLIENT_connect (nc->cfg, |
216 | "peerinfo", | 216 | "peerinfo", |
217 | handlers, | 217 | handlers, |
218 | &mq_error_handler, | 218 | &mq_error_handler, |
diff --git a/src/peerstore/.gitignore b/src/peerstore/.gitignore index a07db8a36..33304d90b 100644 --- a/src/peerstore/.gitignore +++ b/src/peerstore/.gitignore | |||
@@ -1,2 +1,8 @@ | |||
1 | gnunet-service-peerstore | 1 | gnunet-service-peerstore |
2 | gnunet-peerstore | 2 | gnunet-peerstore |
3 | perf_peerstore_store | ||
4 | test_peerstore_api_iterate | ||
5 | test_peerstore_api_store | ||
6 | test_peerstore_api_sync | ||
7 | test_peerstore_api_watch | ||
8 | test_plugin_peerstore_sqlite | ||
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c index 47bf7775e..c9fcd17ab 100644 --- a/src/peerstore/peerstore_api.c +++ b/src/peerstore/peerstore_api.c | |||
@@ -829,7 +829,7 @@ reconnect (struct GNUNET_PEERSTORE_Handle *h) | |||
829 | GNUNET_MQ_destroy (h->mq); | 829 | GNUNET_MQ_destroy (h->mq); |
830 | h->mq = NULL; | 830 | h->mq = NULL; |
831 | } | 831 | } |
832 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 832 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
833 | "peerstore", | 833 | "peerstore", |
834 | mq_handlers, | 834 | mq_handlers, |
835 | &handle_client_error, | 835 | &handle_client_error, |
diff --git a/src/pq/.gitignore b/src/pq/.gitignore new file mode 100644 index 000000000..8de68ddc9 --- /dev/null +++ b/src/pq/.gitignore | |||
@@ -0,0 +1 @@ | |||
test_pq | |||
diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c index 9769bb853..c6544df3a 100644 --- a/src/psyc/psyc_api.c +++ b/src/psyc/psyc_api.c | |||
@@ -598,7 +598,7 @@ channel_disconnect (struct GNUNET_PSYC_Channel *chn, | |||
598 | struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (chn->mq); | 598 | struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (chn->mq); |
599 | if (NULL != env) | 599 | if (NULL != env) |
600 | { | 600 | { |
601 | GNUNET_MQ_notify_sent (env, (GNUNET_MQ_NotifyCallback) channel_cleanup, chn); | 601 | GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) channel_cleanup, chn); |
602 | } | 602 | } |
603 | else | 603 | else |
604 | { | 604 | { |
@@ -694,7 +694,7 @@ master_connect (struct GNUNET_PSYC_Master *mst) | |||
694 | GNUNET_MQ_handler_end () | 694 | GNUNET_MQ_handler_end () |
695 | }; | 695 | }; |
696 | 696 | ||
697 | chn->mq = GNUNET_CLIENT_connecT (chn->cfg, "psyc", | 697 | chn->mq = GNUNET_CLIENT_connect (chn->cfg, "psyc", |
698 | handlers, master_disconnected, mst); | 698 | handlers, master_disconnected, mst); |
699 | GNUNET_assert (NULL != chn->mq); | 699 | GNUNET_assert (NULL != chn->mq); |
700 | chn->tmit = GNUNET_PSYC_transmit_create (chn->mq); | 700 | chn->tmit = GNUNET_PSYC_transmit_create (chn->mq); |
@@ -993,7 +993,7 @@ slave_connect (struct GNUNET_PSYC_Slave *slv) | |||
993 | GNUNET_MQ_handler_end () | 993 | GNUNET_MQ_handler_end () |
994 | }; | 994 | }; |
995 | 995 | ||
996 | chn->mq = GNUNET_CLIENT_connecT (chn->cfg, "psyc", | 996 | chn->mq = GNUNET_CLIENT_connect (chn->cfg, "psyc", |
997 | handlers, slave_disconnected, slv); | 997 | handlers, slave_disconnected, slv); |
998 | GNUNET_assert (NULL != chn->mq); | 998 | GNUNET_assert (NULL != chn->mq); |
999 | chn->tmit = GNUNET_PSYC_transmit_create (chn->mq); | 999 | chn->tmit = GNUNET_PSYC_transmit_create (chn->mq); |
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c index 573a58d5c..10c92a878 100644 --- a/src/psycstore/gnunet-service-psycstore.c +++ b/src/psycstore/gnunet-service-psycstore.c | |||
@@ -198,8 +198,8 @@ send_fragment (void *cls, struct GNUNET_MULTICAST_MessageHeader *msg, | |||
198 | res->psycstore_flags = htonl (flags); | 198 | res->psycstore_flags = htonl (flags); |
199 | GNUNET_memcpy (&res[1], msg, msg_size); | 199 | GNUNET_memcpy (&res[1], msg, msg_size); |
200 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 200 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
201 | "Sending fragment %ld to client\n", | 201 | "Sending fragment %llu to client\n", |
202 | GNUNET_ntohll (msg->fragment_id)); | 202 | (unsigned long long) GNUNET_ntohll (msg->fragment_id)); |
203 | GNUNET_free (msg); | 203 | GNUNET_free (msg); |
204 | 204 | ||
205 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (sc->client), env); | 205 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (sc->client), env); |
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c index 480d594fc..40322662e 100644 --- a/src/psycstore/psycstore_api.c +++ b/src/psycstore/psycstore_api.c | |||
@@ -348,7 +348,7 @@ do_connect (struct GNUNET_PSYCSTORE_Handle *h) | |||
348 | 348 | ||
349 | h->op = GNUNET_OP_create (); | 349 | h->op = GNUNET_OP_create (); |
350 | GNUNET_assert (NULL == h->mq); | 350 | GNUNET_assert (NULL == h->mq); |
351 | h->mq = GNUNET_CLIENT_connecT (h->cfg, "psycstore", | 351 | h->mq = GNUNET_CLIENT_connect (h->cfg, "psycstore", |
352 | handlers, disconnected, h); | 352 | handlers, disconnected, h); |
353 | GNUNET_assert (NULL != h->mq); | 353 | GNUNET_assert (NULL != h->mq); |
354 | } | 354 | } |
diff --git a/src/regex/.gitignore b/src/regex/.gitignore index 014e54347..39dc89c88 100644 --- a/src/regex/.gitignore +++ b/src/regex/.gitignore | |||
@@ -3,3 +3,10 @@ gnunet-daemon-regexprofiler | |||
3 | gnunet-regex-profiler | 3 | gnunet-regex-profiler |
4 | gnunet-regex-simulation-profiler | 4 | gnunet-regex-simulation-profiler |
5 | gnunet-service-regex | 5 | gnunet-service-regex |
6 | test_graph.dot | ||
7 | test_regex_api | ||
8 | test_regex_eval_api | ||
9 | test_regex_graph_api | ||
10 | test_regex_integration | ||
11 | test_regex_iterate_api | ||
12 | test_regex_proofs | ||
diff --git a/src/regex/regex_api_announce.c b/src/regex/regex_api_announce.c index 8fded96d2..70bf34bc8 100644 --- a/src/regex/regex_api_announce.c +++ b/src/regex/regex_api_announce.c | |||
@@ -104,7 +104,7 @@ announce_reconnect (struct GNUNET_REGEX_Announcement *a) | |||
104 | struct AnnounceMessage *am; | 104 | struct AnnounceMessage *am; |
105 | size_t slen; | 105 | size_t slen; |
106 | 106 | ||
107 | a->mq = GNUNET_CLIENT_connecT (a->cfg, | 107 | a->mq = GNUNET_CLIENT_connect (a->cfg, |
108 | "regex", | 108 | "regex", |
109 | NULL, | 109 | NULL, |
110 | &announce_mq_error_handler, | 110 | &announce_mq_error_handler, |
diff --git a/src/regex/regex_api_search.c b/src/regex/regex_api_search.c index ff85f5748..b7a015f87 100644 --- a/src/regex/regex_api_search.c +++ b/src/regex/regex_api_search.c | |||
@@ -167,7 +167,7 @@ search_reconnect (struct GNUNET_REGEX_Search *s) | |||
167 | struct RegexSearchMessage *rsm; | 167 | struct RegexSearchMessage *rsm; |
168 | 168 | ||
169 | GNUNET_assert (NULL == s->mq); | 169 | GNUNET_assert (NULL == s->mq); |
170 | s->mq = GNUNET_CLIENT_connecT (s->cfg, | 170 | s->mq = GNUNET_CLIENT_connect (s->cfg, |
171 | "regex", | 171 | "regex", |
172 | handlers, | 172 | handlers, |
173 | &mq_error_handler, | 173 | &mq_error_handler, |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index ad3253548..2965808fa 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -670,7 +670,7 @@ shutdown_task (void *cls) | |||
670 | } | 670 | } |
671 | if (NULL != core_api) | 671 | if (NULL != core_api) |
672 | { | 672 | { |
673 | GNUNET_CORE_disconnecT (core_api); | 673 | GNUNET_CORE_disconnect (core_api); |
674 | core_api = NULL; | 674 | core_api = NULL; |
675 | } | 675 | } |
676 | if (NULL != stats) | 676 | if (NULL != stats) |
@@ -894,7 +894,7 @@ run (void *cls, | |||
894 | peers = GNUNET_CONTAINER_multipeermap_create (128, | 894 | peers = GNUNET_CONTAINER_multipeermap_create (128, |
895 | GNUNET_YES); | 895 | GNUNET_YES); |
896 | /* Connect to core service and register core handlers */ | 896 | /* Connect to core service and register core handlers */ |
897 | core_api = GNUNET_CORE_connecT (cfg, /* Main configuration */ | 897 | core_api = GNUNET_CORE_connect (cfg, /* Main configuration */ |
898 | NULL, /* Closure passed to functions */ | 898 | NULL, /* Closure passed to functions */ |
899 | &core_init, /* Call core_init once connected */ | 899 | &core_init, /* Call core_init once connected */ |
900 | &handle_core_connect, /* Handle connects */ | 900 | &handle_core_connect, /* Handle connects */ |
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 8c00ac2ae..fde0296a4 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -125,7 +125,7 @@ GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
125 | struct QueryMessage *qm; | 125 | struct QueryMessage *qm; |
126 | struct GNUNET_MQ_Envelope *env; | 126 | struct GNUNET_MQ_Envelope *env; |
127 | 127 | ||
128 | q->mq = GNUNET_CLIENT_connecT (cfg, | 128 | q->mq = GNUNET_CLIENT_connect (cfg, |
129 | "revocation", | 129 | "revocation", |
130 | handlers, | 130 | handlers, |
131 | &query_mq_error_handler, | 131 | &query_mq_error_handler, |
@@ -283,7 +283,7 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
283 | return NULL; | 283 | return NULL; |
284 | } | 284 | } |
285 | 285 | ||
286 | h->mq = GNUNET_CLIENT_connecT (cfg, | 286 | h->mq = GNUNET_CLIENT_connect (cfg, |
287 | "revocation", | 287 | "revocation", |
288 | handlers, | 288 | handlers, |
289 | &revocation_mq_error_handler, | 289 | &revocation_mq_error_handler, |
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index ba659d9d8..d3bbb879a 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c | |||
@@ -337,7 +337,7 @@ core_connect_adapter (void *cls, | |||
337 | struct TestPeer *me = cls; | 337 | struct TestPeer *me = cls; |
338 | 338 | ||
339 | me->cfg = cfg; | 339 | me->cfg = cfg; |
340 | me->ch = GNUNET_CORE_connecT (cfg, | 340 | me->ch = GNUNET_CORE_connect (cfg, |
341 | me, | 341 | me, |
342 | NULL, | 342 | NULL, |
343 | &connect_cb, | 343 | &connect_cb, |
@@ -356,7 +356,7 @@ core_disconnect_adapter (void *cls, | |||
356 | { | 356 | { |
357 | struct TestPeer *me = cls; | 357 | struct TestPeer *me = cls; |
358 | 358 | ||
359 | GNUNET_CORE_disconnecT (me->ch); | 359 | GNUNET_CORE_disconnect (me->ch); |
360 | me->ch = NULL; | 360 | me->ch = NULL; |
361 | } | 361 | } |
362 | 362 | ||
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c index 3d2f37359..504f28b92 100644 --- a/src/rps/rps_api.c +++ b/src/rps/rps_api.c | |||
@@ -286,7 +286,7 @@ reconnect (struct GNUNET_RPS_Handle *h) | |||
286 | 286 | ||
287 | if (NULL != h->mq) | 287 | if (NULL != h->mq) |
288 | GNUNET_MQ_destroy (h->mq); | 288 | GNUNET_MQ_destroy (h->mq); |
289 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 289 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
290 | "rps", | 290 | "rps", |
291 | mq_handlers, | 291 | mq_handlers, |
292 | &mq_error_handler, | 292 | &mq_error_handler, |
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c index 9606851c8..df9f8d196 100644 --- a/src/scalarproduct/scalarproduct_api.c +++ b/src/scalarproduct/scalarproduct_api.c | |||
@@ -256,7 +256,7 @@ GNUNET_SCALARPRODUCT_accept_computation (const struct GNUNET_CONFIGURATION_Handl | |||
256 | h->response_proc = &process_status_message; | 256 | h->response_proc = &process_status_message; |
257 | h->cfg = cfg; | 257 | h->cfg = cfg; |
258 | h->key = *session_key; | 258 | h->key = *session_key; |
259 | h->mq = GNUNET_CLIENT_connecT (cfg, | 259 | h->mq = GNUNET_CLIENT_connect (cfg, |
260 | "scalarproduct-bob", | 260 | "scalarproduct-bob", |
261 | handlers, | 261 | handlers, |
262 | &mq_error_handler, | 262 | &mq_error_handler, |
@@ -408,7 +408,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle | |||
408 | if (GNUNET_SYSERR == check_unique (elements, | 408 | if (GNUNET_SYSERR == check_unique (elements, |
409 | element_count)) | 409 | element_count)) |
410 | return NULL; | 410 | return NULL; |
411 | h->mq = GNUNET_CLIENT_connecT (cfg, | 411 | h->mq = GNUNET_CLIENT_connect (cfg, |
412 | "scalarproduct-alice", | 412 | "scalarproduct-alice", |
413 | handlers, | 413 | handlers, |
414 | &mq_error_handler, | 414 | &mq_error_handler, |
diff --git a/src/secretsharing/secretsharing_api.c b/src/secretsharing/secretsharing_api.c index 78167b671..85df66c13 100644 --- a/src/secretsharing/secretsharing_api.c +++ b/src/secretsharing/secretsharing_api.c | |||
@@ -261,7 +261,7 @@ GNUNET_SECRETSHARING_create_session (const struct GNUNET_CONFIGURATION_Handle *c | |||
261 | struct GNUNET_MQ_Envelope *ev; | 261 | struct GNUNET_MQ_Envelope *ev; |
262 | struct GNUNET_SECRETSHARING_CreateMessage *msg; | 262 | struct GNUNET_SECRETSHARING_CreateMessage *msg; |
263 | 263 | ||
264 | s->mq = GNUNET_CLIENT_connecT (cfg, | 264 | s->mq = GNUNET_CLIENT_connect (cfg, |
265 | "secretsharing", | 265 | "secretsharing", |
266 | mq_handlers, | 266 | mq_handlers, |
267 | &handle_session_client_error, | 267 | &handle_session_client_error, |
@@ -348,7 +348,7 @@ GNUNET_SECRETSHARING_decrypt (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
348 | 348 | ||
349 | s->decrypt_cb = decrypt_cb; | 349 | s->decrypt_cb = decrypt_cb; |
350 | s->decrypt_cls = decrypt_cb_cls; | 350 | s->decrypt_cls = decrypt_cb_cls; |
351 | s->mq = GNUNET_CLIENT_connecT (cfg, | 351 | s->mq = GNUNET_CLIENT_connect (cfg, |
352 | "secretsharing", | 352 | "secretsharing", |
353 | mq_handlers, | 353 | mq_handlers, |
354 | &handle_decrypt_client_error, | 354 | &handle_decrypt_client_error, |
diff --git a/src/set/Makefile.am b/src/set/Makefile.am index 0142b1729..4d990479c 100644 --- a/src/set/Makefile.am +++ b/src/set/Makefile.am | |||
@@ -16,11 +16,13 @@ if USE_COVERAGE | |||
16 | AM_CFLAGS = -fprofile-arcs -ftest-coverage | 16 | AM_CFLAGS = -fprofile-arcs -ftest-coverage |
17 | endif | 17 | endif |
18 | 18 | ||
19 | if HAVE_TESTING | ||
19 | bin_PROGRAMS = \ | 20 | bin_PROGRAMS = \ |
20 | gnunet-set-profiler | 21 | gnunet-set-profiler |
21 | 22 | ||
22 | noinst_PROGRAMS = \ | 23 | noinst_PROGRAMS = \ |
23 | gnunet-set-ibf-profiler | 24 | gnunet-set-ibf-profiler |
25 | endif | ||
24 | 26 | ||
25 | libexec_PROGRAMS = \ | 27 | libexec_PROGRAMS = \ |
26 | gnunet-service-set | 28 | gnunet-service-set |
diff --git a/src/set/set_api.c b/src/set/set_api.c index 7a33b86ea..7a7267a33 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c | |||
@@ -586,7 +586,7 @@ create_internal (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
586 | struct GNUNET_SET_CopyLazyConnectMessage *copy_msg; | 586 | struct GNUNET_SET_CopyLazyConnectMessage *copy_msg; |
587 | 587 | ||
588 | set->cfg = cfg; | 588 | set->cfg = cfg; |
589 | set->mq = GNUNET_CLIENT_connecT (cfg, | 589 | set->mq = GNUNET_CLIENT_connect (cfg, |
590 | "set", | 590 | "set", |
591 | mq_handlers, | 591 | mq_handlers, |
592 | &handle_client_set_error, | 592 | &handle_client_set_error, |
@@ -914,7 +914,7 @@ listen_connect (void *cls) | |||
914 | 914 | ||
915 | lh->reconnect_task = NULL; | 915 | lh->reconnect_task = NULL; |
916 | GNUNET_assert (NULL == lh->mq); | 916 | GNUNET_assert (NULL == lh->mq); |
917 | lh->mq = GNUNET_CLIENT_connecT (lh->cfg, | 917 | lh->mq = GNUNET_CLIENT_connect (lh->cfg, |
918 | "set", | 918 | "set", |
919 | mq_handlers, | 919 | mq_handlers, |
920 | &handle_client_listener_error, | 920 | &handle_client_listener_error, |
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index afd06028c..6d72ca552 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c | |||
@@ -360,7 +360,7 @@ notify_data (void *cls, uint16_t *data_size, void *data) | |||
360 | 360 | ||
361 | if (0 == tmit->size) | 361 | if (0 == tmit->size) |
362 | { | 362 | { |
363 | if (op_host_announce || op_host_assign || op_guest_talk) | 363 | if ((op_host_announce || op_host_assign || op_guest_talk) && !opt_follow) |
364 | { | 364 | { |
365 | exit_success (); | 365 | exit_success (); |
366 | } | 366 | } |
diff --git a/src/social/social_api.c b/src/social/social_api.c index f78cb9a85..a7fe0916f 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c | |||
@@ -893,7 +893,7 @@ handle_guest_enter_decision (void *cls, | |||
893 | struct GNUNET_SOCIAL_Guest *gst = cls; | 893 | struct GNUNET_SOCIAL_Guest *gst = cls; |
894 | 894 | ||
895 | struct GNUNET_PSYC_Message *pmsg = NULL; | 895 | struct GNUNET_PSYC_Message *pmsg = NULL; |
896 | if (ntohs (dcsn->header.size) <= sizeof (*dcsn) + sizeof (*pmsg)) | 896 | if (ntohs (dcsn->header.size) > sizeof (*dcsn)) |
897 | pmsg = (struct GNUNET_PSYC_Message *) GNUNET_MQ_extract_nested_mh (dcsn); | 897 | pmsg = (struct GNUNET_PSYC_Message *) GNUNET_MQ_extract_nested_mh (dcsn); |
898 | 898 | ||
899 | if (NULL != gst->entry_dcsn_cb) | 899 | if (NULL != gst->entry_dcsn_cb) |
@@ -1087,7 +1087,7 @@ place_disconnect (struct GNUNET_SOCIAL_Place *plc, | |||
1087 | struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq); | 1087 | struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq); |
1088 | if (NULL != env) | 1088 | if (NULL != env) |
1089 | { | 1089 | { |
1090 | GNUNET_MQ_notify_sent (env, (GNUNET_MQ_NotifyCallback) place_cleanup, plc); | 1090 | GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) place_cleanup, plc); |
1091 | } | 1091 | } |
1092 | else | 1092 | else |
1093 | { | 1093 | { |
@@ -1195,7 +1195,7 @@ host_connect (struct GNUNET_SOCIAL_Host *hst) | |||
1195 | GNUNET_MQ_handler_end () | 1195 | GNUNET_MQ_handler_end () |
1196 | }; | 1196 | }; |
1197 | 1197 | ||
1198 | plc->mq = GNUNET_CLIENT_connecT (plc->cfg, "social", | 1198 | plc->mq = GNUNET_CLIENT_connect (plc->cfg, "social", |
1199 | handlers, host_disconnected, hst); | 1199 | handlers, host_disconnected, hst); |
1200 | GNUNET_assert (NULL != plc->mq); | 1200 | GNUNET_assert (NULL != plc->mq); |
1201 | plc->tmit = GNUNET_PSYC_transmit_create (plc->mq); | 1201 | plc->tmit = GNUNET_PSYC_transmit_create (plc->mq); |
@@ -1697,7 +1697,7 @@ guest_connect (struct GNUNET_SOCIAL_Guest *gst) | |||
1697 | GNUNET_MQ_handler_end () | 1697 | GNUNET_MQ_handler_end () |
1698 | }; | 1698 | }; |
1699 | 1699 | ||
1700 | plc->mq = GNUNET_CLIENT_connecT (plc->cfg, "social", | 1700 | plc->mq = GNUNET_CLIENT_connect (plc->cfg, "social", |
1701 | handlers, guest_disconnected, gst); | 1701 | handlers, guest_disconnected, gst); |
1702 | GNUNET_assert (NULL != plc->mq); | 1702 | GNUNET_assert (NULL != plc->mq); |
1703 | plc->tmit = GNUNET_PSYC_transmit_create (plc->mq); | 1703 | plc->tmit = GNUNET_PSYC_transmit_create (plc->mq); |
@@ -2597,7 +2597,7 @@ app_connect (struct GNUNET_SOCIAL_App *app) | |||
2597 | GNUNET_MQ_handler_end () | 2597 | GNUNET_MQ_handler_end () |
2598 | }; | 2598 | }; |
2599 | 2599 | ||
2600 | app->mq = GNUNET_CLIENT_connecT (app->cfg, "social", | 2600 | app->mq = GNUNET_CLIENT_connect (app->cfg, "social", |
2601 | handlers, app_disconnected, app); | 2601 | handlers, app_disconnected, app); |
2602 | GNUNET_assert (NULL != app->mq); | 2602 | GNUNET_assert (NULL != app->mq); |
2603 | GNUNET_MQ_send_copy (app->mq, app->connect_env); | 2603 | GNUNET_MQ_send_copy (app->mq, app->connect_env); |
@@ -2701,7 +2701,7 @@ GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, | |||
2701 | struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (app->mq); | 2701 | struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (app->mq); |
2702 | if (NULL != env) | 2702 | if (NULL != env) |
2703 | { | 2703 | { |
2704 | GNUNET_MQ_notify_sent (env, (GNUNET_MQ_NotifyCallback) app_cleanup, app); | 2704 | GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) app_cleanup, app); |
2705 | } | 2705 | } |
2706 | else | 2706 | else |
2707 | { | 2707 | { |
diff --git a/src/statistics/.gitignore b/src/statistics/.gitignore index 55f015bce..f1f567149 100644 --- a/src/statistics/.gitignore +++ b/src/statistics/.gitignore | |||
@@ -1,2 +1,7 @@ | |||
1 | gnunet-statistics | 1 | gnunet-statistics |
2 | gnunet-service-statistics | 2 | gnunet-service-statistics |
3 | test_gnunet_statistics.py | ||
4 | test_statistics_api | ||
5 | test_statistics_api_loop | ||
6 | test_statistics_api_watch | ||
7 | test_statistics_api_watch_zero_value | ||
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index bfa2da3b4..ad4453b2a 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c | |||
@@ -678,7 +678,7 @@ try_connect (struct GNUNET_STATISTICS_Handle *h) | |||
678 | return GNUNET_NO; | 678 | return GNUNET_NO; |
679 | if (NULL != h->mq) | 679 | if (NULL != h->mq) |
680 | return GNUNET_YES; | 680 | return GNUNET_YES; |
681 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 681 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
682 | "statistics", | 682 | "statistics", |
683 | handlers, | 683 | handlers, |
684 | &mq_error_handler, | 684 | &mq_error_handler, |
diff --git a/src/template/.gitignore b/src/template/.gitignore index 6e6ad861c..8ac4bacb5 100644 --- a/src/template/.gitignore +++ b/src/template/.gitignore | |||
@@ -1,2 +1,3 @@ | |||
1 | gnunet-template | 1 | gnunet-template |
2 | gnunet-service-template | 2 | gnunet-service-template |
3 | test_template_api | ||
diff --git a/src/testbed-logger/.gitignore b/src/testbed-logger/.gitignore index eb2ed00b0..de0c2dcfe 100644 --- a/src/testbed-logger/.gitignore +++ b/src/testbed-logger/.gitignore | |||
@@ -1 +1,2 @@ | |||
1 | gnunet-service-testbed-logger | 1 | gnunet-service-testbed-logger |
2 | test_testbed_logger_api | ||
diff --git a/src/testbed-logger/testbed_logger_api.c b/src/testbed-logger/testbed_logger_api.c index 19a5d9b50..25494aed0 100644 --- a/src/testbed-logger/testbed_logger_api.c +++ b/src/testbed-logger/testbed_logger_api.c | |||
@@ -224,7 +224,7 @@ GNUNET_TESTBED_LOGGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
224 | struct GNUNET_TESTBED_LOGGER_Handle *h; | 224 | struct GNUNET_TESTBED_LOGGER_Handle *h; |
225 | 225 | ||
226 | h = GNUNET_new (struct GNUNET_TESTBED_LOGGER_Handle); | 226 | h = GNUNET_new (struct GNUNET_TESTBED_LOGGER_Handle); |
227 | h->mq = GNUNET_CLIENT_connecT (cfg, | 227 | h->mq = GNUNET_CLIENT_connect (cfg, |
228 | "testbed-logger", | 228 | "testbed-logger", |
229 | NULL, | 229 | NULL, |
230 | &mq_error_handler, | 230 | &mq_error_handler, |
diff --git a/src/testbed/.gitignore b/src/testbed/.gitignore index acffa9b91..f7cfb1e23 100644 --- a/src/testbed/.gitignore +++ b/src/testbed/.gitignore | |||
@@ -5,3 +5,33 @@ gnunet-daemon-testbed-blacklist | |||
5 | gnunet-daemon-testbed-underlay | 5 | gnunet-daemon-testbed-underlay |
6 | gnunet-helper-testbed | 6 | gnunet-helper-testbed |
7 | gnunet-service-testbed | 7 | gnunet-service-testbed |
8 | gnunet-service-test-barriers | ||
9 | test_gnunet_helper_testbed | ||
10 | test_testbed_api | ||
11 | test_testbed_api_2peers_1controller | ||
12 | test_testbed_api_3peers_3controllers | ||
13 | test_testbed_api_barriers | ||
14 | test_testbed_api_controllerlink | ||
15 | test_testbed_api_hosts | ||
16 | test_testbed_api_operations | ||
17 | test_testbed_api_peer_reconfiguration | ||
18 | test_testbed_api_peers_manage_services | ||
19 | test_testbed_api_sd | ||
20 | test_testbed_api_statistics | ||
21 | test_testbed_api_test | ||
22 | test_testbed_api_test_timeout | ||
23 | test_testbed_api_testbed_run | ||
24 | test_testbed_api_testbed_run_topology2dtorus | ||
25 | test_testbed_api_testbed_run_topologyclique | ||
26 | test_testbed_api_testbed_run_topologyfromfile | ||
27 | test_testbed_api_testbed_run_topologyline | ||
28 | test_testbed_api_testbed_run_topologyrandom | ||
29 | test_testbed_api_testbed_run_topologyring | ||
30 | test_testbed_api_testbed_run_topologyscalefree | ||
31 | test_testbed_api_testbed_run_topologysmallworld | ||
32 | test_testbed_api_testbed_run_topologysmallworldring | ||
33 | test_testbed_api_testbed_run_topologystar | ||
34 | test_testbed_api_testbed_run_waitforever | ||
35 | test_testbed_api_topology | ||
36 | test_testbed_api_topology_clique | ||
37 | test_testbed_underlay | ||
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c index b0e369c6a..6bc744ba8 100644 --- a/src/testbed/gnunet-service-testbed_connectionpool.c +++ b/src/testbed/gnunet-service-testbed_connectionpool.c | |||
@@ -623,12 +623,12 @@ core_peer_connect_cb (void *cls, | |||
623 | 623 | ||
624 | 624 | ||
625 | /** | 625 | /** |
626 | * Function called after #GNUNET_CORE_connecT() has succeeded (or failed | 626 | * Function called after #GNUNET_CORE_connect() has succeeded (or failed |
627 | * for good). Note that the private key of the peer is intentionally | 627 | * for good). Note that the private key of the peer is intentionally |
628 | * not exposed here; if you need it, your process should try to read | 628 | * not exposed here; if you need it, your process should try to read |
629 | * the private key file directly (which should work if you are | 629 | * the private key file directly (which should work if you are |
630 | * authorized...). Implementations of this function must not call | 630 | * authorized...). Implementations of this function must not call |
631 | * #GNUNET_CORE_disconnecT() (other than by scheduling a new task to | 631 | * #GNUNET_CORE_disconnect() (other than by scheduling a new task to |
632 | * do this later). | 632 | * do this later). |
633 | * | 633 | * |
634 | * @param cls the #PooledConnection object | 634 | * @param cls the #PooledConnection object |
@@ -675,7 +675,7 @@ opstart_get_handle_core (void *cls) | |||
675 | LOG_DEBUG ("Opening a CORE connection to peer %u\n", | 675 | LOG_DEBUG ("Opening a CORE connection to peer %u\n", |
676 | entry->index); | 676 | entry->index); |
677 | entry->handle_core | 677 | entry->handle_core |
678 | = GNUNET_CORE_connecT (entry->cfg, | 678 | = GNUNET_CORE_connect (entry->cfg, |
679 | entry, /* closure */ | 679 | entry, /* closure */ |
680 | &core_startup_cb, /* core startup notify */ | 680 | &core_startup_cb, /* core startup notify */ |
681 | &core_peer_connect_cb, /* peer connect notify */ | 681 | &core_peer_connect_cb, /* peer connect notify */ |
@@ -697,7 +697,7 @@ oprelease_get_handle_core (void *cls) | |||
697 | 697 | ||
698 | if (NULL == entry->handle_core) | 698 | if (NULL == entry->handle_core) |
699 | return; | 699 | return; |
700 | GNUNET_CORE_disconnecT (entry->handle_core); | 700 | GNUNET_CORE_disconnect (entry->handle_core); |
701 | entry->handle_core = NULL; | 701 | entry->handle_core = NULL; |
702 | GNUNET_free_non_null (entry->peer_identity); | 702 | GNUNET_free_non_null (entry->peer_identity); |
703 | entry->peer_identity = NULL; | 703 | entry->peer_identity = NULL; |
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index ae40948b3..0e0a5da9c 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -1646,7 +1646,7 @@ GNUNET_TESTBED_controller_connect (struct GNUNET_TESTBED_Host *host, | |||
1646 | controller->cc_cls = cc_cls; | 1646 | controller->cc_cls = cc_cls; |
1647 | controller->event_mask = event_mask; | 1647 | controller->event_mask = event_mask; |
1648 | controller->cfg = GNUNET_CONFIGURATION_dup (cfg); | 1648 | controller->cfg = GNUNET_CONFIGURATION_dup (cfg); |
1649 | controller->mq = GNUNET_CLIENT_connecT (controller->cfg, | 1649 | controller->mq = GNUNET_CLIENT_connect (controller->cfg, |
1650 | "testbed", | 1650 | "testbed", |
1651 | handlers, | 1651 | handlers, |
1652 | &mq_error_handler, | 1652 | &mq_error_handler, |
diff --git a/src/testbed/testbed_api_barriers.c b/src/testbed/testbed_api_barriers.c index 1679756a1..93698d4b7 100644 --- a/src/testbed/testbed_api_barriers.c +++ b/src/testbed/testbed_api_barriers.c | |||
@@ -215,7 +215,7 @@ GNUNET_TESTBED_barrier_wait (const char *name, | |||
215 | h->name = GNUNET_strdup (name); | 215 | h->name = GNUNET_strdup (name); |
216 | h->cb = cb; | 216 | h->cb = cb; |
217 | h->cb_cls = cb_cls; | 217 | h->cb_cls = cb_cls; |
218 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 218 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
219 | "testbed-barrier", | 219 | "testbed-barrier", |
220 | handlers, | 220 | handlers, |
221 | &mq_error_handler, | 221 | &mq_error_handler, |
diff --git a/src/testing/.gitignore b/src/testing/.gitignore index 212ed2ad3..f350da1f2 100644 --- a/src/testing/.gitignore +++ b/src/testing/.gitignore | |||
@@ -1,2 +1,7 @@ | |||
1 | list-keys | 1 | list-keys |
2 | gnunet-testing | 2 | gnunet-testing |
3 | test_testing_peerstartup | ||
4 | test_testing_peerstartup2 | ||
5 | test_testing_portreservation | ||
6 | test_testing_servicestartup | ||
7 | test_testing_sharedservices | ||
diff --git a/src/topology/.gitignore b/src/topology/.gitignore index 9ac8c7c47..cfa95ec7e 100644 --- a/src/topology/.gitignore +++ b/src/topology/.gitignore | |||
@@ -1 +1,2 @@ | |||
1 | gnunet-daemon-topology | 1 | gnunet-daemon-topology |
2 | test_gnunet_daemon_topology | ||
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 69f01e043..d48f07e71 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -902,7 +902,7 @@ process_peer (void *cls, | |||
902 | 902 | ||
903 | 903 | ||
904 | /** | 904 | /** |
905 | * Function called after #GNUNET_CORE_connecT has succeeded | 905 | * Function called after #GNUNET_CORE_connect has succeeded |
906 | * (or failed for good). | 906 | * (or failed for good). |
907 | * | 907 | * |
908 | * @param cls closure | 908 | * @param cls closure |
@@ -1101,7 +1101,7 @@ cleaning_task (void *cls) | |||
1101 | } | 1101 | } |
1102 | if (NULL != handle) | 1102 | if (NULL != handle) |
1103 | { | 1103 | { |
1104 | GNUNET_CORE_disconnecT (handle); | 1104 | GNUNET_CORE_disconnect (handle); |
1105 | handle = NULL; | 1105 | handle = NULL; |
1106 | } | 1106 | } |
1107 | whitelist_peers (); | 1107 | whitelist_peers (); |
@@ -1189,7 +1189,7 @@ run (void *cls, | |||
1189 | &blacklist_check, | 1189 | &blacklist_check, |
1190 | NULL); | 1190 | NULL); |
1191 | ats = GNUNET_ATS_connectivity_init (cfg); | 1191 | ats = GNUNET_ATS_connectivity_init (cfg); |
1192 | handle = GNUNET_CORE_connecT (cfg, | 1192 | handle = GNUNET_CORE_connect (cfg, |
1193 | NULL, | 1193 | NULL, |
1194 | &core_init, | 1194 | &core_init, |
1195 | &connect_notify, | 1195 | &connect_notify, |
diff --git a/src/transport/.gitignore b/src/transport/.gitignore index eab8d3146..d035b4011 100644 --- a/src/transport/.gitignore +++ b/src/transport/.gitignore | |||
@@ -7,3 +7,79 @@ gnunet-transport | |||
7 | gnunet-transport-certificate-creation | 7 | gnunet-transport-certificate-creation |
8 | gnunet-transport-profiler | 8 | gnunet-transport-profiler |
9 | gnunet-transport-wlan-receiver | 9 | gnunet-transport-wlan-receiver |
10 | https_cert_qutoa_p2.crt | ||
11 | https_key_quota_p2.key | ||
12 | test_http_common | ||
13 | test_plugin_bluetooth | ||
14 | test_plugin_http_client | ||
15 | test_plugin_http_server | ||
16 | test_plugin_https_client | ||
17 | test_plugin_https_server | ||
18 | test_plugin_tcp | ||
19 | test_plugin_udp | ||
20 | test_plugin_unix | ||
21 | test_plugin_wlan | ||
22 | test_quota_compliance_bluetooth | ||
23 | test_quota_compliance_bluetooth_asymmetric | ||
24 | test_quota_compliance_http | ||
25 | test_quota_compliance_http_asymmetric | ||
26 | test_quota_compliance_https | ||
27 | test_quota_compliance_https_asymmetric | ||
28 | test_quota_compliance_tcp | ||
29 | test_quota_compliance_tcp_asymmetric | ||
30 | test_quota_compliance_udp | ||
31 | test_quota_compliance_unix | ||
32 | test_quota_compliance_unix_asymmetric | ||
33 | test_quota_compliance_wlan | ||
34 | test_quota_compliance_wlan_asymmetric | ||
35 | test_transport_address_switch_http | ||
36 | test_transport_address_switch_https | ||
37 | test_transport_address_switch_tcp | ||
38 | test_transport_address_switch_udp | ||
39 | test_transport_api_blacklisting_tcp | ||
40 | test_transport_api_bluetooth | ||
41 | test_transport_api_disconnect_tcp | ||
42 | test_transport_api_http | ||
43 | test_transport_api_http_reverse | ||
44 | test_transport_api_https | ||
45 | test_transport_api_limited_sockets_tcp | ||
46 | test_transport_api_manipulation_cfg | ||
47 | test_transport_api_manipulation_recv_tcp | ||
48 | test_transport_api_manipulation_send_tcp | ||
49 | test_transport_api_monitor_peers | ||
50 | test_transport_api_multi | ||
51 | test_transport_api_reliability_bluetooth | ||
52 | test_transport_api_reliability_http | ||
53 | test_transport_api_reliability_http_xhr | ||
54 | test_transport_api_reliability_https | ||
55 | test_transport_api_reliability_https_xhr | ||
56 | test_transport_api_reliability_tcp | ||
57 | test_transport_api_reliability_tcp_nat | ||
58 | test_transport_api_reliability_udp | ||
59 | test_transport_api_reliability_unix | ||
60 | test_transport_api_reliability_wlan | ||
61 | test_transport_api_restart_1peer | ||
62 | test_transport_api_restart_2peers | ||
63 | test_transport_api_slow_ats | ||
64 | test_transport_api_tcp | ||
65 | test_transport_api_tcp_nat | ||
66 | test_transport_api_timeout_bluetooth | ||
67 | test_transport_api_timeout_http | ||
68 | test_transport_api_timeout_https | ||
69 | test_transport_api_timeout_tcp | ||
70 | test_transport_api_timeout_udp | ||
71 | test_transport_api_timeout_unix | ||
72 | test_transport_api_timeout_wlan | ||
73 | test_transport_api_udp | ||
74 | test_transport_api_udp_nat | ||
75 | test_transport_api_unix | ||
76 | test_transport_api_unix_abstract | ||
77 | test_transport_api_wlan | ||
78 | test_transport_blacklisting_inbound_bl_full | ||
79 | test_transport_blacklisting_inbound_bl_plugin | ||
80 | test_transport_blacklisting_multiple_plugins | ||
81 | test_transport_blacklisting_no_bl | ||
82 | test_transport_blacklisting_outbound_bl_full | ||
83 | test_transport_blacklisting_outbound_bl_plugin | ||
84 | test_transport_testing_restart | ||
85 | test_transport_testing_startstop | ||
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 9fb451383..0b523eecc 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -235,7 +235,6 @@ gnunet_transport_profiler_SOURCES = \ | |||
235 | gnunet-transport-profiler.c | 235 | gnunet-transport-profiler.c |
236 | gnunet_transport_profiler_LDADD = \ | 236 | gnunet_transport_profiler_LDADD = \ |
237 | libgnunettransport.la \ | 237 | libgnunettransport.la \ |
238 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
239 | $(top_builddir)/src/hello/libgnunethello.la \ | 238 | $(top_builddir)/src/hello/libgnunethello.la \ |
240 | $(top_builddir)/src/ats/libgnunetats.la \ | 239 | $(top_builddir)/src/ats/libgnunetats.la \ |
241 | $(top_builddir)/src/util/libgnunetutil.la \ | 240 | $(top_builddir)/src/util/libgnunetutil.la \ |
@@ -245,7 +244,6 @@ gnunet_transport_SOURCES = \ | |||
245 | gnunet-transport.c | 244 | gnunet-transport.c |
246 | gnunet_transport_LDADD = \ | 245 | gnunet_transport_LDADD = \ |
247 | libgnunettransport.la \ | 246 | libgnunettransport.la \ |
248 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
249 | $(top_builddir)/src/hello/libgnunethello.la \ | 247 | $(top_builddir)/src/hello/libgnunethello.la \ |
250 | $(top_builddir)/src/util/libgnunetutil.la \ | 248 | $(top_builddir)/src/util/libgnunetutil.la \ |
251 | $(GN_LIBINTL) | 249 | $(GN_LIBINTL) |
@@ -268,7 +266,6 @@ gnunet_service_transport_LDADD = \ | |||
268 | $(top_builddir)/src/ats/libgnunetats.la \ | 266 | $(top_builddir)/src/ats/libgnunetats.la \ |
269 | $(top_builddir)/src/hello/libgnunethello.la \ | 267 | $(top_builddir)/src/hello/libgnunethello.la \ |
270 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 268 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
271 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
272 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 269 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
273 | $(top_builddir)/src/util/libgnunetutil.la \ | 270 | $(top_builddir)/src/util/libgnunetutil.la \ |
274 | $(GN_GLPK) \ | 271 | $(GN_GLPK) \ |
@@ -299,7 +296,7 @@ libgnunet_plugin_transport_tcp_la_LIBADD = \ | |||
299 | $(top_builddir)/src/hello/libgnunethello.la \ | 296 | $(top_builddir)/src/hello/libgnunethello.la \ |
300 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 297 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
301 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 298 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
302 | $(top_builddir)/src/nat/libgnunetnat.la \ | 299 | $(top_builddir)/src/nat/libgnunetnatnew.la \ |
303 | $(top_builddir)/src/util/libgnunetutil.la \ | 300 | $(top_builddir)/src/util/libgnunetutil.la \ |
304 | $(LTLIBINTL) | 301 | $(LTLIBINTL) |
305 | libgnunet_plugin_transport_tcp_la_LDFLAGS = \ | 302 | libgnunet_plugin_transport_tcp_la_LDFLAGS = \ |
@@ -347,7 +344,7 @@ libgnunet_plugin_transport_udp_la_LIBADD = \ | |||
347 | $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \ | 344 | $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \ |
348 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 345 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
349 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 346 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
350 | $(top_builddir)/src/nat/libgnunetnat.la \ | 347 | $(top_builddir)/src/nat/libgnunetnatnew.la \ |
351 | $(top_builddir)/src/util/libgnunetutil.la \ | 348 | $(top_builddir)/src/util/libgnunetutil.la \ |
352 | $(LTLIBINTL) | 349 | $(LTLIBINTL) |
353 | libgnunet_plugin_transport_udp_la_LDFLAGS = \ | 350 | libgnunet_plugin_transport_udp_la_LDFLAGS = \ |
@@ -372,7 +369,6 @@ libgnunet_plugin_transport_http_client_la_LIBADD = \ | |||
372 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 369 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
373 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 370 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
374 | $(LIB_GNURL) \ | 371 | $(LIB_GNURL) \ |
375 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
376 | $(top_builddir)/src/util/libgnunetutil.la | 372 | $(top_builddir)/src/util/libgnunetutil.la |
377 | libgnunet_plugin_transport_http_client_la_LDFLAGS = \ | 373 | libgnunet_plugin_transport_http_client_la_LDFLAGS = \ |
378 | $(GN_PLUGIN_LDFLAGS) | 374 | $(GN_PLUGIN_LDFLAGS) |
@@ -388,7 +384,7 @@ libgnunet_plugin_transport_http_server_la_LIBADD = \ | |||
388 | $(top_builddir)/src/hello/libgnunethello.la \ | 384 | $(top_builddir)/src/hello/libgnunethello.la \ |
389 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 385 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
390 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 386 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
391 | $(top_builddir)/src/nat/libgnunetnat.la \ | 387 | $(top_builddir)/src/nat/libgnunetnatnew.la \ |
392 | $(top_builddir)/src/util/libgnunetutil.la | 388 | $(top_builddir)/src/util/libgnunetutil.la |
393 | libgnunet_plugin_transport_http_server_la_LDFLAGS = \ | 389 | libgnunet_plugin_transport_http_server_la_LDFLAGS = \ |
394 | $(GN_LIBMHD) \ | 390 | $(GN_LIBMHD) \ |
@@ -403,7 +399,6 @@ libgnunet_plugin_transport_https_client_la_LIBADD = \ | |||
403 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 399 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
404 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 400 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
405 | $(LIB_GNURL) \ | 401 | $(LIB_GNURL) \ |
406 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
407 | $(top_builddir)/src/util/libgnunetutil.la | 402 | $(top_builddir)/src/util/libgnunetutil.la |
408 | libgnunet_plugin_transport_https_client_la_LDFLAGS = \ | 403 | libgnunet_plugin_transport_https_client_la_LDFLAGS = \ |
409 | $(GN_PLUGIN_LDFLAGS) | 404 | $(GN_PLUGIN_LDFLAGS) |
@@ -419,7 +414,7 @@ libgnunet_plugin_transport_https_server_la_LIBADD = \ | |||
419 | $(top_builddir)/src/hello/libgnunethello.la \ | 414 | $(top_builddir)/src/hello/libgnunethello.la \ |
420 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 415 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
421 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 416 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
422 | $(top_builddir)/src/nat/libgnunetnat.la \ | 417 | $(top_builddir)/src/nat/libgnunetnatnew.la \ |
423 | $(top_builddir)/src/util/libgnunetutil.la | 418 | $(top_builddir)/src/util/libgnunetutil.la |
424 | libgnunet_plugin_transport_https_server_la_LDFLAGS = \ | 419 | libgnunet_plugin_transport_https_server_la_LDFLAGS = \ |
425 | $(GN_LIBMHD) \ | 420 | $(GN_LIBMHD) \ |
@@ -1176,7 +1171,6 @@ test_quota_compliance_wlan_asymmetric_LDADD = \ | |||
1176 | test_quota_compliance_bluetooth_SOURCES = \ | 1171 | test_quota_compliance_bluetooth_SOURCES = \ |
1177 | test_quota_compliance.c | 1172 | test_quota_compliance.c |
1178 | test_quota_compliance_bluetooth_LDADD = \ | 1173 | test_quota_compliance_bluetooth_LDADD = \ |
1179 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
1180 | libgnunettransport.la \ | 1174 | libgnunettransport.la \ |
1181 | $(top_builddir)/src/hello/libgnunethello.la \ | 1175 | $(top_builddir)/src/hello/libgnunethello.la \ |
1182 | $(top_builddir)/src/ats/libgnunetats.la \ | 1176 | $(top_builddir)/src/ats/libgnunetats.la \ |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index d82112e03..e1e4f56f8 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -2236,6 +2236,14 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message, | |||
2236 | scm = (const struct TransportSynMessage *) message; | 2236 | scm = (const struct TransportSynMessage *) message; |
2237 | GNUNET_break_op (0 == ntohl (scm->reserved)); | 2237 | GNUNET_break_op (0 == ntohl (scm->reserved)); |
2238 | ts = GNUNET_TIME_absolute_ntoh (scm->timestamp); | 2238 | ts = GNUNET_TIME_absolute_ntoh (scm->timestamp); |
2239 | if (0 == | ||
2240 | memcmp (&GST_my_identity, | ||
2241 | peer, | ||
2242 | sizeof (struct GNUNET_PeerIdentity))) | ||
2243 | { | ||
2244 | /* loopback connection-to-self, ignore */ | ||
2245 | return GNUNET_SYSERR; | ||
2246 | } | ||
2239 | n = lookup_neighbour (peer); | 2247 | n = lookup_neighbour (peer); |
2240 | if (NULL == n) | 2248 | if (NULL == n) |
2241 | { | 2249 | { |
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index e928cf660..fcfc94ac8 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2011-2014, 2016 GNUnet e.V. | 3 | Copyright (C) 2011-2014, 2016, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -23,9 +23,6 @@ | |||
23 | * @brief Tool to help configure, measure and control the transport subsystem. | 23 | * @brief Tool to help configure, measure and control the transport subsystem. |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @author Nathan Evans | 25 | * @author Nathan Evans |
26 | * | ||
27 | * This utility can be used to test if a transport mechanism for | ||
28 | * GNUnet is properly configured. | ||
29 | */ | 26 | */ |
30 | #include "platform.h" | 27 | #include "platform.h" |
31 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
@@ -33,13 +30,6 @@ | |||
33 | #include "gnunet_protocols.h" | 30 | #include "gnunet_protocols.h" |
34 | #include "gnunet_transport_service.h" | 31 | #include "gnunet_transport_service.h" |
35 | #include "gnunet_transport_core_service.h" | 32 | #include "gnunet_transport_core_service.h" |
36 | #include "gnunet_nat_lib.h" | ||
37 | |||
38 | /** | ||
39 | * How long do we wait for the NAT test to report success? | ||
40 | * Should match NAT_SERVER_TIMEOUT in 'nat_test.c'. | ||
41 | */ | ||
42 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20) | ||
43 | 33 | ||
44 | /** | 34 | /** |
45 | * Timeout for a name resolution | 35 | * Timeout for a name resolution |
@@ -172,49 +162,6 @@ struct PeerResolutionContext | |||
172 | 162 | ||
173 | 163 | ||
174 | /** | 164 | /** |
175 | * Context for a plugin test. | ||
176 | */ | ||
177 | struct TestContext | ||
178 | { | ||
179 | /** | ||
180 | * Previous in DLL | ||
181 | */ | ||
182 | struct TestContext *prev; | ||
183 | |||
184 | /** | ||
185 | * Next in DLL | ||
186 | */ | ||
187 | struct TestContext *next; | ||
188 | |||
189 | /** | ||
190 | * Handle to the active NAT test. | ||
191 | */ | ||
192 | struct GNUNET_NAT_Test *tst; | ||
193 | |||
194 | /** | ||
195 | * Task identifier for the timeout. | ||
196 | */ | ||
197 | struct GNUNET_SCHEDULER_Task * tsk; | ||
198 | |||
199 | /** | ||
200 | * Name of plugin under test. | ||
201 | */ | ||
202 | char *name; | ||
203 | |||
204 | /** | ||
205 | * Bound port | ||
206 | */ | ||
207 | unsigned long long bnd_port; | ||
208 | |||
209 | /** | ||
210 | * Advertised ports | ||
211 | */ | ||
212 | unsigned long long adv_port; | ||
213 | |||
214 | }; | ||
215 | |||
216 | |||
217 | /** | ||
218 | * Benchmarking block size in KB | 165 | * Benchmarking block size in KB |
219 | */ | 166 | */ |
220 | #define BLOCKSIZE 4 | 167 | #define BLOCKSIZE 4 |
@@ -265,11 +212,6 @@ static int iterate_connections; | |||
265 | static int iterate_all; | 212 | static int iterate_all; |
266 | 213 | ||
267 | /** | 214 | /** |
268 | * Option -t. | ||
269 | */ | ||
270 | static int test_configuration; | ||
271 | |||
272 | /** | ||
273 | * Option -c. | 215 | * Option -c. |
274 | */ | 216 | */ |
275 | static int monitor_connects; | 217 | static int monitor_connects; |
@@ -366,16 +308,6 @@ struct GNUNET_OS_Process *resolver; | |||
366 | static unsigned int address_resolutions; | 308 | static unsigned int address_resolutions; |
367 | 309 | ||
368 | /** | 310 | /** |
369 | * DLL for NAT Test Contexts: head | ||
370 | */ | ||
371 | static struct TestContext *head; | ||
372 | |||
373 | /** | ||
374 | * DLL for NAT Test Contexts: tail | ||
375 | */ | ||
376 | static struct TestContext *tail; | ||
377 | |||
378 | /** | ||
379 | * DLL: head of validation resolution entries | 311 | * DLL: head of validation resolution entries |
380 | */ | 312 | */ |
381 | static struct ValidationResolutionContext *vc_head; | 313 | static struct ValidationResolutionContext *vc_head; |
@@ -553,11 +485,13 @@ operation_timeout (void *cls) | |||
553 | _("Failed to resolve address for peer `%s'\n"), | 485 | _("Failed to resolve address for peer `%s'\n"), |
554 | GNUNET_i2s (&cur->addrcp->peer)); | 486 | GNUNET_i2s (&cur->addrcp->peer)); |
555 | 487 | ||
556 | GNUNET_CONTAINER_DLL_remove(rc_head, rc_tail, cur); | 488 | GNUNET_CONTAINER_DLL_remove(rc_head, |
489 | rc_tail, | ||
490 | cur); | ||
557 | GNUNET_TRANSPORT_address_to_string_cancel (cur->asc); | 491 | GNUNET_TRANSPORT_address_to_string_cancel (cur->asc); |
558 | GNUNET_free(cur->transport); | 492 | GNUNET_free (cur->transport); |
559 | GNUNET_free(cur->addrcp); | 493 | GNUNET_free (cur->addrcp); |
560 | GNUNET_free(cur); | 494 | GNUNET_free (cur); |
561 | 495 | ||
562 | } | 496 | } |
563 | FPRINTF (stdout, | 497 | FPRINTF (stdout, |
@@ -570,158 +504,6 @@ operation_timeout (void *cls) | |||
570 | } | 504 | } |
571 | 505 | ||
572 | 506 | ||
573 | static void | ||
574 | run_nat_test (void); | ||
575 | |||
576 | |||
577 | /** | ||
578 | * Display the result of the test. | ||
579 | * | ||
580 | * @param tc test context | ||
581 | * @param result #GNUNET_YES on success | ||
582 | */ | ||
583 | static void | ||
584 | display_test_result (struct TestContext *tc, | ||
585 | enum GNUNET_NAT_StatusCode result) | ||
586 | { | ||
587 | FPRINTF (stderr, | ||
588 | _("NAT plugin `%s' reports: %s\n"), | ||
589 | tc->name, | ||
590 | GNUNET_NAT_status2string (result)); | ||
591 | if (NULL != tc->tsk) | ||
592 | { | ||
593 | GNUNET_SCHEDULER_cancel (tc->tsk); | ||
594 | tc->tsk = NULL; | ||
595 | } | ||
596 | if (NULL != tc->tst) | ||
597 | { | ||
598 | GNUNET_NAT_test_stop (tc->tst); | ||
599 | tc->tst = NULL; | ||
600 | } | ||
601 | |||
602 | GNUNET_CONTAINER_DLL_remove (head, tail, tc); | ||
603 | GNUNET_free (tc->name); | ||
604 | GNUNET_free (tc); | ||
605 | |||
606 | if ((NULL == head) && (NULL != resolver)) | ||
607 | { | ||
608 | GNUNET_break (0 == GNUNET_OS_process_kill (resolver, | ||
609 | GNUNET_TERM_SIG)); | ||
610 | GNUNET_OS_process_destroy (resolver); | ||
611 | resolver = NULL; | ||
612 | } | ||
613 | if (NULL != head) | ||
614 | run_nat_test (); | ||
615 | } | ||
616 | |||
617 | |||
618 | /** | ||
619 | * Function called by NAT to report the outcome of the nat-test. | ||
620 | * Clean up and update GUI. | ||
621 | * | ||
622 | * @param cls test context | ||
623 | * @param result status code | ||
624 | */ | ||
625 | static void | ||
626 | result_callback (void *cls, | ||
627 | enum GNUNET_NAT_StatusCode result) | ||
628 | { | ||
629 | struct TestContext *tc = cls; | ||
630 | |||
631 | display_test_result (tc, | ||
632 | result); | ||
633 | } | ||
634 | |||
635 | |||
636 | static void | ||
637 | run_nat_test () | ||
638 | { | ||
639 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
640 | "Running test for plugin `%s' using bind port %u and advertised port %u \n", | ||
641 | head->name, | ||
642 | (uint16_t) head->bnd_port, | ||
643 | (uint16_t) head->adv_port); | ||
644 | |||
645 | head->tst = GNUNET_NAT_test_start (cfg, | ||
646 | (0 == strcasecmp (head->name, "udp")) | ||
647 | ? GNUNET_NO : GNUNET_YES, | ||
648 | (uint16_t) head->bnd_port, | ||
649 | (uint16_t) head->adv_port, | ||
650 | TIMEOUT, | ||
651 | &result_callback, head); | ||
652 | } | ||
653 | |||
654 | |||
655 | /** | ||
656 | * Test our plugin's configuration (NAT traversal, etc.). | ||
657 | * | ||
658 | * @param cfg configuration to test | ||
659 | */ | ||
660 | static void | ||
661 | do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
662 | { | ||
663 | char *plugins; | ||
664 | char *tok; | ||
665 | unsigned long long bnd_port; | ||
666 | unsigned long long adv_port; | ||
667 | struct TestContext *tc; | ||
668 | char *binary; | ||
669 | |||
670 | if (GNUNET_OK | ||
671 | != GNUNET_CONFIGURATION_get_value_string (cfg, "transport", "plugins", | ||
672 | &plugins)) | ||
673 | { | ||
674 | FPRINTF (stderr, "%s", _ | ||
675 | ("No transport plugins configured, peer will never communicate\n")); | ||
676 | ret = 4; | ||
677 | return; | ||
678 | } | ||
679 | |||
680 | for (tok = strtok (plugins, " "); tok != NULL ; tok = strtok (NULL, " ")) | ||
681 | { | ||
682 | char section[12 + strlen (tok)]; | ||
683 | GNUNET_snprintf (section, sizeof(section), "transport-%s", tok); | ||
684 | if (GNUNET_OK | ||
685 | != GNUNET_CONFIGURATION_get_value_number (cfg, section, "PORT", | ||
686 | &bnd_port)) | ||
687 | { | ||
688 | FPRINTF (stderr, | ||
689 | _("No port configured for plugin `%s', cannot test it\n"), tok); | ||
690 | continue; | ||
691 | } | ||
692 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, section, | ||
693 | "ADVERTISED_PORT", &adv_port)) | ||
694 | adv_port = bnd_port; | ||
695 | |||
696 | tc = GNUNET_new (struct TestContext); | ||
697 | tc->name = GNUNET_strdup (tok); | ||
698 | tc->adv_port = adv_port; | ||
699 | tc->bnd_port = bnd_port; | ||
700 | GNUNET_CONTAINER_DLL_insert_tail (head, tail, tc); | ||
701 | } | ||
702 | GNUNET_free(plugins); | ||
703 | |||
704 | if ((NULL != head) && (NULL == resolver)) | ||
705 | { | ||
706 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); | ||
707 | resolver = GNUNET_OS_start_process (GNUNET_YES, | ||
708 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
709 | NULL, NULL, NULL, | ||
710 | binary, | ||
711 | "gnunet-service-resolver", NULL); | ||
712 | if (NULL == resolver) | ||
713 | { | ||
714 | FPRINTF (stderr, _("Failed to start resolver!\n")); | ||
715 | return; | ||
716 | } | ||
717 | |||
718 | GNUNET_free(binary); | ||
719 | GNUNET_RESOLVER_connect (cfg); | ||
720 | run_nat_test (); | ||
721 | } | ||
722 | } | ||
723 | |||
724 | |||
725 | /** | 507 | /** |
726 | * Function called to notify a client about the socket | 508 | * Function called to notify a client about the socket |
727 | * begin ready to queue more data. Sends another message. | 509 | * begin ready to queue more data. Sends another message. |
@@ -1041,7 +823,9 @@ process_peer_string (void *cls, | |||
1041 | } | 823 | } |
1042 | GNUNET_free (rc->transport); | 824 | GNUNET_free (rc->transport); |
1043 | GNUNET_free (rc->addrcp); | 825 | GNUNET_free (rc->addrcp); |
1044 | GNUNET_CONTAINER_DLL_remove (rc_head, rc_tail, rc); | 826 | GNUNET_CONTAINER_DLL_remove (rc_head, |
827 | rc_tail, | ||
828 | rc); | ||
1045 | GNUNET_free (rc); | 829 | GNUNET_free (rc); |
1046 | if ((0 == address_resolutions) && (iterate_connections)) | 830 | if ((0 == address_resolutions) && (iterate_connections)) |
1047 | { | 831 | { |
@@ -1461,11 +1245,6 @@ run (void *cls, | |||
1461 | ret = 1; | 1245 | ret = 1; |
1462 | 1246 | ||
1463 | cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg; | 1247 | cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg; |
1464 | if (test_configuration) | ||
1465 | { | ||
1466 | do_test_configuration (cfg); | ||
1467 | return; | ||
1468 | } | ||
1469 | if ( (NULL != cpid) && | 1248 | if ( (NULL != cpid) && |
1470 | (GNUNET_OK != | 1249 | (GNUNET_OK != |
1471 | GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, | 1250 | GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, |
@@ -1691,9 +1470,6 @@ main (int argc, | |||
1691 | { 's', "send", NULL, gettext_noop | 1470 | { 's', "send", NULL, gettext_noop |
1692 | ("send data for benchmarking to the other peer (until CTRL-C)"), 0, | 1471 | ("send data for benchmarking to the other peer (until CTRL-C)"), 0, |
1693 | &GNUNET_GETOPT_set_one, &benchmark_send }, | 1472 | &GNUNET_GETOPT_set_one, &benchmark_send }, |
1694 | { 't', "test", NULL, | ||
1695 | gettext_noop ("test transport configuration (involves external server)"), | ||
1696 | 0, &GNUNET_GETOPT_set_one, &test_configuration }, | ||
1697 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 1473 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), |
1698 | GNUNET_GETOPT_OPTION_END | 1474 | GNUNET_GETOPT_OPTION_END |
1699 | }; | 1475 | }; |
@@ -1706,7 +1482,7 @@ main (int argc, | |||
1706 | gettext_noop ("Direct access to transport service."), | 1482 | gettext_noop ("Direct access to transport service."), |
1707 | options, | 1483 | options, |
1708 | &run, NULL); | 1484 | &run, NULL); |
1709 | GNUNET_free((void *) argv); | 1485 | GNUNET_free ((void *) argv); |
1710 | if (GNUNET_OK == res) | 1486 | if (GNUNET_OK == res) |
1711 | return ret; | 1487 | return ret; |
1712 | return 1; | 1488 | return 1; |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 5088f2e77..63c67b81c 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002-2014 GNUnet e.V. | 3 | Copyright (C) 2002-2014, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_statistics_service.h" | 30 | #include "gnunet_statistics_service.h" |
31 | #include "gnunet_transport_plugin.h" | 31 | #include "gnunet_transport_plugin.h" |
32 | #include "gnunet_nat_lib.h" | 32 | #include "gnunet_nat_service.h" |
33 | #include "plugin_transport_http_common.h" | 33 | #include "plugin_transport_http_common.h" |
34 | #include <microhttpd.h> | 34 | #include <microhttpd.h> |
35 | #include <regex.h> | 35 | #include <regex.h> |
@@ -2473,12 +2473,14 @@ server_remove_address (void *cls, | |||
2473 | * @param cls closure, the 'struct LocalAddrList' | 2473 | * @param cls closure, the 'struct LocalAddrList' |
2474 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | 2474 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean |
2475 | * the previous (now invalid) one | 2475 | * the previous (now invalid) one |
2476 | * @param ac address class the address belongs to | ||
2476 | * @param addr either the previous or the new public IP address | 2477 | * @param addr either the previous or the new public IP address |
2477 | * @param addrlen actual lenght of the address | 2478 | * @param addrlen actual lenght of the address |
2478 | */ | 2479 | */ |
2479 | static void | 2480 | static void |
2480 | server_nat_port_map_callback (void *cls, | 2481 | server_nat_port_map_callback (void *cls, |
2481 | int add_remove, | 2482 | int add_remove, |
2483 | enum GNUNET_NAT_AddressClass ac, | ||
2482 | const struct sockaddr *addr, | 2484 | const struct sockaddr *addr, |
2483 | socklen_t addrlen) | 2485 | socklen_t addrlen) |
2484 | { | 2486 | { |
@@ -2498,7 +2500,8 @@ server_nat_port_map_callback (void *cls, | |||
2498 | 2500 | ||
2499 | if ((NULL != plugin->server_addr_v4) && | 2501 | if ((NULL != plugin->server_addr_v4) && |
2500 | (0 != memcmp (&plugin->server_addr_v4->sin_addr, | 2502 | (0 != memcmp (&plugin->server_addr_v4->sin_addr, |
2501 | &s4->sin_addr, sizeof (struct in_addr)))) | 2503 | &s4->sin_addr, |
2504 | sizeof (struct in_addr)))) | ||
2502 | { | 2505 | { |
2503 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2506 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2504 | "Skipping address `%s' (not bindto address)\n", | 2507 | "Skipping address `%s' (not bindto address)\n", |
@@ -2754,14 +2757,16 @@ server_start_report_addresses (struct HTTP_Server_Plugin *plugin) | |||
2754 | return; | 2757 | return; |
2755 | } | 2758 | } |
2756 | 2759 | ||
2757 | plugin->nat = | 2760 | plugin->nat |
2758 | GNUNET_NAT_register (plugin->env->cfg, | 2761 | = GNUNET_NAT_register (plugin->env->cfg, |
2759 | GNUNET_YES, | 2762 | "transport-http_server", |
2760 | plugin->port, | 2763 | IPPROTO_TCP, |
2761 | (unsigned int) res, | 2764 | (unsigned int) res, |
2762 | (const struct sockaddr **) addrs, addrlens, | 2765 | (const struct sockaddr **) addrs, |
2763 | &server_nat_port_map_callback, NULL, | 2766 | addrlens, |
2764 | plugin, NULL); | 2767 | &server_nat_port_map_callback, |
2768 | NULL, | ||
2769 | plugin); | ||
2765 | while (res > 0) | 2770 | while (res > 0) |
2766 | { | 2771 | { |
2767 | res--; | 2772 | res--; |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 79c70138f..eca62a8ca 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "gnunet_hello_lib.h" | 26 | #include "gnunet_hello_lib.h" |
27 | #include "gnunet_constants.h" | 27 | #include "gnunet_constants.h" |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_nat_lib.h" | 29 | #include "gnunet_nat_service.h" |
30 | #include "gnunet_protocols.h" | 30 | #include "gnunet_protocols.h" |
31 | #include "gnunet_resolver_service.h" | 31 | #include "gnunet_resolver_service.h" |
32 | #include "gnunet_signatures.h" | 32 | #include "gnunet_signatures.h" |
@@ -945,13 +945,15 @@ notify_session_monitor (struct Plugin *plugin, | |||
945 | * @param cls closure, the `struct Plugin` | 945 | * @param cls closure, the `struct Plugin` |
946 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | 946 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean |
947 | * the previous (now invalid) one | 947 | * the previous (now invalid) one |
948 | * @param ac address class the address belongs to | ||
948 | * @param addr either the previous or the new public IP address | 949 | * @param addr either the previous or the new public IP address |
949 | * @param addrlen actual length of @a addr | 950 | * @param addrlen actual length of @a addr |
950 | */ | 951 | */ |
951 | static void | 952 | static void |
952 | tcp_nat_port_map_callback (void *cls, | 953 | tcp_nat_port_map_callback (void *cls, |
953 | int add_remove, | 954 | int add_remove, |
954 | const struct sockaddr *addr, | 955 | enum GNUNET_NAT_AddressClass ac, |
956 | const struct sockaddr *addr, | ||
955 | socklen_t addrlen) | 957 | socklen_t addrlen) |
956 | { | 958 | { |
957 | struct Plugin *plugin = cls; | 959 | struct Plugin *plugin = cls; |
@@ -961,10 +963,10 @@ tcp_nat_port_map_callback (void *cls, | |||
961 | void *arg; | 963 | void *arg; |
962 | size_t args; | 964 | size_t args; |
963 | 965 | ||
964 | LOG(GNUNET_ERROR_TYPE_INFO, | 966 | LOG (GNUNET_ERROR_TYPE_INFO, |
965 | "NAT notification to %s address `%s'\n", | 967 | "NAT notification to %s address `%s'\n", |
966 | (GNUNET_YES == add_remove) ? "add" : "remove", | 968 | (GNUNET_YES == add_remove) ? "add" : "remove", |
967 | GNUNET_a2s (addr, addrlen)); | 969 | GNUNET_a2s (addr, addrlen)); |
968 | /* convert 'addr' to our internal format */ | 970 | /* convert 'addr' to our internal format */ |
969 | switch (addr->sa_family) | 971 | switch (addr->sa_family) |
970 | { | 972 | { |
@@ -980,8 +982,9 @@ tcp_nat_port_map_callback (void *cls, | |||
980 | case AF_INET6: | 982 | case AF_INET6: |
981 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in6)); | 983 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in6)); |
982 | memset (&t6, 0, sizeof(t6)); | 984 | memset (&t6, 0, sizeof(t6)); |
983 | GNUNET_memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr, | 985 | GNUNET_memcpy (&t6.ipv6_addr, |
984 | sizeof(struct in6_addr)); | 986 | &((struct sockaddr_in6 *) addr)->sin6_addr, |
987 | sizeof(struct in6_addr)); | ||
985 | t6.options = htonl (plugin->myoptions); | 988 | t6.options = htonl (plugin->myoptions); |
986 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; | 989 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; |
987 | arg = &t6; | 990 | arg = &t6; |
@@ -993,11 +996,17 @@ tcp_nat_port_map_callback (void *cls, | |||
993 | } | 996 | } |
994 | /* modify our published address list */ | 997 | /* modify our published address list */ |
995 | GNUNET_assert ((args == sizeof (struct IPv4TcpAddress)) || | 998 | GNUNET_assert ((args == sizeof (struct IPv4TcpAddress)) || |
996 | (args == sizeof (struct IPv6TcpAddress))); | 999 | (args == sizeof (struct IPv6TcpAddress))); |
1000 | /* TODO: use 'ac' here in the future... */ | ||
997 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | 1001 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, |
998 | PLUGIN_NAME, arg, args, GNUNET_HELLO_ADDRESS_INFO_NONE); | 1002 | PLUGIN_NAME, |
999 | plugin->env->notify_address (plugin->env->cls, add_remove, address); | 1003 | arg, |
1000 | GNUNET_HELLO_address_free(address); | 1004 | args, |
1005 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
1006 | plugin->env->notify_address (plugin->env->cls, | ||
1007 | add_remove, | ||
1008 | address); | ||
1009 | GNUNET_HELLO_address_free (address); | ||
1001 | } | 1010 | } |
1002 | 1011 | ||
1003 | 1012 | ||
@@ -2068,6 +2077,8 @@ tcp_plugin_get_session (void *cls, | |||
2068 | GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, | 2077 | GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, |
2069 | &address->peer))) | 2078 | &address->peer))) |
2070 | { | 2079 | { |
2080 | struct sockaddr_in local_sa; | ||
2081 | |||
2071 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2082 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2072 | "Found valid IPv4 NAT address (creating session)!\n"); | 2083 | "Found valid IPv4 NAT address (creating session)!\n"); |
2073 | session = create_session (plugin, | 2084 | session = create_session (plugin, |
@@ -2085,23 +2096,29 @@ tcp_plugin_get_session (void *cls, | |||
2085 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 2096 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
2086 | 2097 | ||
2087 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2098 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2088 | "Created NAT WAIT connection to `%4s' at `%s'\n", | 2099 | "Created NAT WAIT connection to `%s' at `%s'\n", |
2089 | GNUNET_i2s (&session->target), | 2100 | GNUNET_i2s (&session->target), |
2090 | GNUNET_a2s (sb, sbs)); | 2101 | GNUNET_a2s (sb, sbs)); |
2091 | if (GNUNET_OK == GNUNET_NAT_run_client (plugin->nat, &a4)) | 2102 | memset (&local_sa, |
2092 | { | 2103 | 0, |
2104 | sizeof (local_sa)); | ||
2105 | local_sa.sin_family = AF_INET; | ||
2106 | local_sa.sin_port = htons (plugin->open_port); | ||
2107 | /* We leave sin_address at 0, let the kernel figure it out, | ||
2108 | even if our bind() is more specific. (May want to reconsider | ||
2109 | later.) */ | ||
2110 | if (GNUNET_OK == | ||
2111 | GNUNET_NAT_request_reversal (plugin->nat, | ||
2112 | &local_sa, | ||
2113 | &a4)) | ||
2093 | return session; | 2114 | return session; |
2094 | } | 2115 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2095 | else | 2116 | "Running NAT client for `%s' at `%s' failed\n", |
2096 | { | 2117 | GNUNET_i2s (&session->target), |
2097 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 2118 | GNUNET_a2s (sb, sbs)); |
2098 | "Running NAT client for `%4s' at `%s' failed\n", | 2119 | tcp_plugin_disconnect_session (plugin, |
2099 | GNUNET_i2s (&session->target), | 2120 | session); |
2100 | GNUNET_a2s (sb, sbs)); | 2121 | return NULL; |
2101 | tcp_plugin_disconnect_session (plugin, | ||
2102 | session); | ||
2103 | return NULL; | ||
2104 | } | ||
2105 | } | 2122 | } |
2106 | 2123 | ||
2107 | /* create new outbound session */ | 2124 | /* create new outbound session */ |
@@ -2396,27 +2413,6 @@ tcp_plugin_address_pretty_printer (void *cls, | |||
2396 | 2413 | ||
2397 | 2414 | ||
2398 | /** | 2415 | /** |
2399 | * Check if the given port is plausible (must be either our listen | ||
2400 | * port or our advertised port), or any port if we are behind NAT | ||
2401 | * and do not have a port open. If it is neither, we return | ||
2402 | * #GNUNET_SYSERR. | ||
2403 | * | ||
2404 | * @param plugin global variables | ||
2405 | * @param in_port port number to check | ||
2406 | * @return #GNUNET_OK if port is either open_port or adv_port | ||
2407 | */ | ||
2408 | static int | ||
2409 | check_port (struct Plugin *plugin, | ||
2410 | uint16_t in_port) | ||
2411 | { | ||
2412 | if ( (in_port == plugin->adv_port) || | ||
2413 | (in_port == plugin->open_port) ) | ||
2414 | return GNUNET_OK; | ||
2415 | return GNUNET_SYSERR; | ||
2416 | } | ||
2417 | |||
2418 | |||
2419 | /** | ||
2420 | * Function that will be called to check if a binary address for this | 2416 | * Function that will be called to check if a binary address for this |
2421 | * plugin is well-formed and corresponds to an address for THIS peer | 2417 | * plugin is well-formed and corresponds to an address for THIS peer |
2422 | * (as per our configuration). Naturally, if absolutely necessary, | 2418 | * (as per our configuration). Naturally, if absolutely necessary, |
@@ -2449,6 +2445,8 @@ tcp_plugin_check_address (void *cls, | |||
2449 | 2445 | ||
2450 | if (addrlen == sizeof(struct IPv4TcpAddress)) | 2446 | if (addrlen == sizeof(struct IPv4TcpAddress)) |
2451 | { | 2447 | { |
2448 | struct sockaddr_in s4; | ||
2449 | |||
2452 | v4 = (const struct IPv4TcpAddress *) addr; | 2450 | v4 = (const struct IPv4TcpAddress *) addr; |
2453 | if (0 != memcmp (&v4->options, | 2451 | if (0 != memcmp (&v4->options, |
2454 | &plugin->myoptions, | 2452 | &plugin->myoptions, |
@@ -2457,17 +2455,24 @@ tcp_plugin_check_address (void *cls, | |||
2457 | GNUNET_break (0); | 2455 | GNUNET_break (0); |
2458 | return GNUNET_SYSERR; | 2456 | return GNUNET_SYSERR; |
2459 | } | 2457 | } |
2460 | if (GNUNET_OK != check_port (plugin, | 2458 | memset (&s4, 0, sizeof (s4)); |
2461 | ntohs (v4->t4_port))) | 2459 | s4.sin_family = AF_INET; |
2462 | return GNUNET_SYSERR; | 2460 | #if HAVE_SOCKADDR_IN_SIN_LEN |
2461 | s4.sin_len = sizeof (s4); | ||
2462 | #endif | ||
2463 | s4.sin_port = v4->t4_port; | ||
2464 | s4.sin_addr.s_addr = v4->ipv4_addr; | ||
2465 | |||
2463 | if (GNUNET_OK != | 2466 | if (GNUNET_OK != |
2464 | GNUNET_NAT_test_address (plugin->nat, | 2467 | GNUNET_NAT_test_address (plugin->nat, |
2465 | &v4->ipv4_addr, | 2468 | &s4, |
2466 | sizeof (struct in_addr))) | 2469 | sizeof (struct sockaddr_in))) |
2467 | return GNUNET_SYSERR; | 2470 | return GNUNET_SYSERR; |
2468 | } | 2471 | } |
2469 | else | 2472 | else |
2470 | { | 2473 | { |
2474 | struct sockaddr_in6 s6; | ||
2475 | |||
2471 | v6 = (const struct IPv6TcpAddress *) addr; | 2476 | v6 = (const struct IPv6TcpAddress *) addr; |
2472 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | 2477 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) |
2473 | { | 2478 | { |
@@ -2481,13 +2486,18 @@ tcp_plugin_check_address (void *cls, | |||
2481 | GNUNET_break (0); | 2486 | GNUNET_break (0); |
2482 | return GNUNET_SYSERR; | 2487 | return GNUNET_SYSERR; |
2483 | } | 2488 | } |
2484 | if (GNUNET_OK != check_port (plugin, | 2489 | memset (&s6, 0, sizeof (s6)); |
2485 | ntohs (v6->t6_port))) | 2490 | s6.sin6_family = AF_INET6; |
2486 | return GNUNET_SYSERR; | 2491 | #if HAVE_SOCKADDR_IN_SIN_LEN |
2492 | s6.sin6_len = sizeof (s6); | ||
2493 | #endif | ||
2494 | s6.sin6_port = v6->t6_port; | ||
2495 | s6.sin6_addr = v6->ipv6_addr; | ||
2496 | |||
2487 | if (GNUNET_OK != | 2497 | if (GNUNET_OK != |
2488 | GNUNET_NAT_test_address (plugin->nat, | 2498 | GNUNET_NAT_test_address (plugin->nat, |
2489 | &v6->ipv6_addr, | 2499 | &s6, |
2490 | sizeof(struct in6_addr))) | 2500 | sizeof(struct sockaddr_in6))) |
2491 | return GNUNET_SYSERR; | 2501 | return GNUNET_SYSERR; |
2492 | } | 2502 | } |
2493 | return GNUNET_OK; | 2503 | return GNUNET_OK; |
@@ -3388,15 +3398,14 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3388 | GNUNET_a2s (addrs[ret], addrlens[ret])); | 3398 | GNUNET_a2s (addrs[ret], addrlens[ret])); |
3389 | plugin->nat | 3399 | plugin->nat |
3390 | = GNUNET_NAT_register (env->cfg, | 3400 | = GNUNET_NAT_register (env->cfg, |
3391 | GNUNET_YES, | 3401 | "transport-tcp", |
3392 | aport, | 3402 | IPPROTO_TCP, |
3393 | (unsigned int) ret_s, | 3403 | (unsigned int) ret_s, |
3394 | (const struct sockaddr **) addrs, | 3404 | (const struct sockaddr **) addrs, |
3395 | addrlens, | 3405 | addrlens, |
3396 | &tcp_nat_port_map_callback, | 3406 | &tcp_nat_port_map_callback, |
3397 | &try_connection_reversal, | 3407 | &try_connection_reversal, |
3398 | plugin, | 3408 | plugin); |
3399 | NULL); | ||
3400 | for (ret = ret_s -1; ret >= 0; ret--) | 3409 | for (ret = ret_s -1; ret >= 0; ret--) |
3401 | GNUNET_free (addrs[ret]); | 3410 | GNUNET_free (addrs[ret]); |
3402 | GNUNET_free_non_null (addrs); | 3411 | GNUNET_free_non_null (addrs); |
@@ -3405,15 +3414,14 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3405 | else | 3414 | else |
3406 | { | 3415 | { |
3407 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, | 3416 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, |
3408 | GNUNET_YES, | 3417 | "transport-tcp", |
3409 | 0, | 3418 | IPPROTO_TCP, |
3410 | 0, | 3419 | 0, |
3411 | NULL, | 3420 | NULL, |
3412 | NULL, | 3421 | NULL, |
3413 | NULL, | 3422 | NULL, |
3414 | &try_connection_reversal, | 3423 | &try_connection_reversal, |
3415 | plugin, | 3424 | plugin); |
3416 | NULL); | ||
3417 | } | 3425 | } |
3418 | api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions); | 3426 | api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions); |
3419 | api->cls = plugin; | 3427 | api->cls = plugin; |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 35ae92460..fd8493e5f 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -30,7 +30,7 @@ | |||
30 | #include "gnunet_hello_lib.h" | 30 | #include "gnunet_hello_lib.h" |
31 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
32 | #include "gnunet_fragmentation_lib.h" | 32 | #include "gnunet_fragmentation_lib.h" |
33 | #include "gnunet_nat_lib.h" | 33 | #include "gnunet_nat_service.h" |
34 | #include "gnunet_protocols.h" | 34 | #include "gnunet_protocols.h" |
35 | #include "gnunet_resolver_service.h" | 35 | #include "gnunet_resolver_service.h" |
36 | #include "gnunet_signatures.h" | 36 | #include "gnunet_signatures.h" |
@@ -1245,31 +1245,48 @@ udp_plugin_check_address (void *cls, | |||
1245 | 1245 | ||
1246 | if (sizeof(struct IPv4UdpAddress) == addrlen) | 1246 | if (sizeof(struct IPv4UdpAddress) == addrlen) |
1247 | { | 1247 | { |
1248 | struct sockaddr_in s4; | ||
1249 | |||
1248 | v4 = (const struct IPv4UdpAddress *) addr; | 1250 | v4 = (const struct IPv4UdpAddress *) addr; |
1249 | if (GNUNET_OK != check_port (plugin, | 1251 | if (GNUNET_OK != check_port (plugin, |
1250 | ntohs (v4->u4_port))) | 1252 | ntohs (v4->u4_port))) |
1251 | return GNUNET_SYSERR; | 1253 | return GNUNET_SYSERR; |
1254 | memset (&s4, 0, sizeof (s4)); | ||
1255 | s4.sin_family = AF_INET; | ||
1256 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1257 | s4.sin_len = sizeof (s4); | ||
1258 | #endif | ||
1259 | s4.sin_port = v4->u4_port; | ||
1260 | s4.sin_addr.s_addr = v4->ipv4_addr; | ||
1261 | |||
1252 | if (GNUNET_OK != | 1262 | if (GNUNET_OK != |
1253 | GNUNET_NAT_test_address (plugin->nat, | 1263 | GNUNET_NAT_test_address (plugin->nat, |
1254 | &v4->ipv4_addr, | 1264 | &s4, |
1255 | sizeof (struct in_addr))) | 1265 | sizeof (struct sockaddr_in))) |
1256 | return GNUNET_SYSERR; | 1266 | return GNUNET_SYSERR; |
1257 | } | 1267 | } |
1258 | else if (sizeof(struct IPv6UdpAddress) == addrlen) | 1268 | else if (sizeof(struct IPv6UdpAddress) == addrlen) |
1259 | { | 1269 | { |
1270 | struct sockaddr_in6 s6; | ||
1271 | |||
1260 | v6 = (const struct IPv6UdpAddress *) addr; | 1272 | v6 = (const struct IPv6UdpAddress *) addr; |
1261 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | 1273 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) |
1262 | { | 1274 | { |
1263 | GNUNET_break_op (0); | 1275 | GNUNET_break_op (0); |
1264 | return GNUNET_SYSERR; | 1276 | return GNUNET_SYSERR; |
1265 | } | 1277 | } |
1266 | if (GNUNET_OK != check_port (plugin, | 1278 | memset (&s6, 0, sizeof (s6)); |
1267 | ntohs (v6->u6_port))) | 1279 | s6.sin6_family = AF_INET6; |
1268 | return GNUNET_SYSERR; | 1280 | #if HAVE_SOCKADDR_IN_SIN_LEN |
1281 | s6.sin6_len = sizeof (s6); | ||
1282 | #endif | ||
1283 | s6.sin6_port = v6->u6_port; | ||
1284 | s6.sin6_addr = v6->ipv6_addr; | ||
1285 | |||
1269 | if (GNUNET_OK != | 1286 | if (GNUNET_OK != |
1270 | GNUNET_NAT_test_address (plugin->nat, | 1287 | GNUNET_NAT_test_address (plugin->nat, |
1271 | &v6->ipv6_addr, | 1288 | &s6, |
1272 | sizeof (struct in6_addr))) | 1289 | sizeof(struct sockaddr_in6))) |
1273 | return GNUNET_SYSERR; | 1290 | return GNUNET_SYSERR; |
1274 | } | 1291 | } |
1275 | else | 1292 | else |
@@ -1287,12 +1304,14 @@ udp_plugin_check_address (void *cls, | |||
1287 | * @param cls closure, the `struct Plugin` | 1304 | * @param cls closure, the `struct Plugin` |
1288 | * @param add_remove #GNUNET_YES to mean the new public IP address, | 1305 | * @param add_remove #GNUNET_YES to mean the new public IP address, |
1289 | * #GNUNET_NO to mean the previous (now invalid) one | 1306 | * #GNUNET_NO to mean the previous (now invalid) one |
1307 | * @param ac address class the address belongs to | ||
1290 | * @param addr either the previous or the new public IP address | 1308 | * @param addr either the previous or the new public IP address |
1291 | * @param addrlen actual length of the @a addr | 1309 | * @param addrlen actual length of the @a addr |
1292 | */ | 1310 | */ |
1293 | static void | 1311 | static void |
1294 | udp_nat_port_map_callback (void *cls, | 1312 | udp_nat_port_map_callback (void *cls, |
1295 | int add_remove, | 1313 | int add_remove, |
1314 | enum GNUNET_NAT_AddressClass ac, | ||
1296 | const struct sockaddr *addr, | 1315 | const struct sockaddr *addr, |
1297 | socklen_t addrlen) | 1316 | socklen_t addrlen) |
1298 | { | 1317 | { |
@@ -1359,6 +1378,7 @@ udp_nat_port_map_callback (void *cls, | |||
1359 | return; | 1378 | return; |
1360 | } | 1379 | } |
1361 | /* modify our published address list */ | 1380 | /* modify our published address list */ |
1381 | /* TODO: use 'ac' here in the future... */ | ||
1362 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | 1382 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, |
1363 | PLUGIN_NAME, | 1383 | PLUGIN_NAME, |
1364 | arg, | 1384 | arg, |
@@ -3032,8 +3052,7 @@ read_process_fragment (struct Plugin *plugin, | |||
3032 | msg)) | 3052 | msg)) |
3033 | { | 3053 | { |
3034 | /* keep this 'rc' from expiring */ | 3054 | /* keep this 'rc' from expiring */ |
3035 | GNUNET_CONTAINER_heap_update_cost (plugin->defrag_ctxs, | 3055 | GNUNET_CONTAINER_heap_update_cost (d_ctx->hnode, |
3036 | d_ctx->hnode, | ||
3037 | (GNUNET_CONTAINER_HeapCostType) now.abs_value_us); | 3056 | (GNUNET_CONTAINER_HeapCostType) now.abs_value_us); |
3038 | } | 3057 | } |
3039 | if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) > | 3058 | if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) > |
@@ -3082,7 +3101,7 @@ udp_select_read (struct Plugin *plugin, | |||
3082 | sizeof(addr)); | 3101 | sizeof(addr)); |
3083 | size = GNUNET_NETWORK_socket_recvfrom (rsock, | 3102 | size = GNUNET_NETWORK_socket_recvfrom (rsock, |
3084 | buf, | 3103 | buf, |
3085 | sizeof(buf), | 3104 | sizeof (buf), |
3086 | (struct sockaddr *) &addr, | 3105 | (struct sockaddr *) &addr, |
3087 | &fromlen); | 3106 | &fromlen); |
3088 | sa = (const struct sockaddr *) &addr; | 3107 | sa = (const struct sockaddr *) &addr; |
@@ -3111,9 +3130,12 @@ udp_select_read (struct Plugin *plugin, | |||
3111 | } | 3130 | } |
3112 | 3131 | ||
3113 | /* Check if this is a STUN packet */ | 3132 | /* Check if this is a STUN packet */ |
3114 | if (GNUNET_NAT_is_valid_stun_packet (plugin->nat, | 3133 | if (GNUNET_NO != |
3115 | (uint8_t *)buf, | 3134 | GNUNET_NAT_stun_handle_packet (plugin->nat, |
3116 | size)) | 3135 | (const struct sockaddr *) &addr, |
3136 | fromlen, | ||
3137 | buf, | ||
3138 | size)) | ||
3117 | return; /* was STUN, do not process further */ | 3139 | return; /* was STUN, do not process further */ |
3118 | 3140 | ||
3119 | if (size < sizeof(struct GNUNET_MessageHeader)) | 3141 | if (size < sizeof(struct GNUNET_MessageHeader)) |
@@ -3516,7 +3538,7 @@ udp_plugin_select_v4 (void *cls) | |||
3516 | { | 3538 | { |
3517 | struct Plugin *plugin = cls; | 3539 | struct Plugin *plugin = cls; |
3518 | const struct GNUNET_SCHEDULER_TaskContext *tc; | 3540 | const struct GNUNET_SCHEDULER_TaskContext *tc; |
3519 | 3541 | ||
3520 | plugin->select_task_v4 = NULL; | 3542 | plugin->select_task_v4 = NULL; |
3521 | if (NULL == plugin->sockv4) | 3543 | if (NULL == plugin->sockv4) |
3522 | return; | 3544 | return; |
@@ -3572,13 +3594,13 @@ udp_plugin_select_v6 (void *cls) | |||
3572 | * @param bind_v4 IPv4 address to bind to (can be NULL, for 'any') | 3594 | * @param bind_v4 IPv4 address to bind to (can be NULL, for 'any') |
3573 | * @return number of sockets that were successfully bound | 3595 | * @return number of sockets that were successfully bound |
3574 | */ | 3596 | */ |
3575 | static int | 3597 | static unsigned int |
3576 | setup_sockets (struct Plugin *plugin, | 3598 | setup_sockets (struct Plugin *plugin, |
3577 | const struct sockaddr_in6 *bind_v6, | 3599 | const struct sockaddr_in6 *bind_v6, |
3578 | const struct sockaddr_in *bind_v4) | 3600 | const struct sockaddr_in *bind_v4) |
3579 | { | 3601 | { |
3580 | int tries; | 3602 | int tries; |
3581 | int sockets_created = 0; | 3603 | unsigned int sockets_created = 0; |
3582 | struct sockaddr_in6 server_addrv6; | 3604 | struct sockaddr_in6 server_addrv6; |
3583 | struct sockaddr_in server_addrv4; | 3605 | struct sockaddr_in server_addrv4; |
3584 | const struct sockaddr *server_addr; | 3606 | const struct sockaddr *server_addr; |
@@ -3788,15 +3810,14 @@ setup_sockets (struct Plugin *plugin, | |||
3788 | schedule_select_v4 (plugin); | 3810 | schedule_select_v4 (plugin); |
3789 | schedule_select_v6 (plugin); | 3811 | schedule_select_v6 (plugin); |
3790 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, | 3812 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, |
3791 | GNUNET_NO, | 3813 | "transport-udp", |
3792 | plugin->port, | 3814 | IPPROTO_UDP, |
3793 | sockets_created, | 3815 | sockets_created, |
3794 | addrs, | 3816 | addrs, |
3795 | addrlens, | 3817 | addrlens, |
3796 | &udp_nat_port_map_callback, | 3818 | &udp_nat_port_map_callback, |
3797 | NULL, | 3819 | NULL, |
3798 | plugin, | 3820 | plugin); |
3799 | plugin->sockv4); | ||
3800 | return sockets_created; | 3821 | return sockets_created; |
3801 | } | 3822 | } |
3802 | 3823 | ||
@@ -3825,7 +3846,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
3825 | struct GNUNET_TIME_Relative interval; | 3846 | struct GNUNET_TIME_Relative interval; |
3826 | struct sockaddr_in server_addrv4; | 3847 | struct sockaddr_in server_addrv4; |
3827 | struct sockaddr_in6 server_addrv6; | 3848 | struct sockaddr_in6 server_addrv6; |
3828 | int res; | 3849 | unsigned int res; |
3829 | int have_bind4; | 3850 | int have_bind4; |
3830 | int have_bind6; | 3851 | int have_bind6; |
3831 | 3852 | ||
diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h index c6799ba74..152b16099 100644 --- a/src/transport/plugin_transport_udp.h +++ b/src/transport/plugin_transport_udp.h | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "gnunet_hello_lib.h" | 32 | #include "gnunet_hello_lib.h" |
33 | #include "gnunet_util_lib.h" | 33 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_fragmentation_lib.h" | 34 | #include "gnunet_fragmentation_lib.h" |
35 | #include "gnunet_nat_lib.h" | ||
36 | #include "gnunet_protocols.h" | 35 | #include "gnunet_protocols.h" |
37 | #include "gnunet_resolver_service.h" | 36 | #include "gnunet_resolver_service.h" |
38 | #include "gnunet_signatures.h" | 37 | #include "gnunet_signatures.h" |
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c index 8ef001ddb..a440830fd 100644 --- a/src/transport/plugin_transport_udp_broadcasting.c +++ b/src/transport/plugin_transport_udp_broadcasting.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include "gnunet_hello_lib.h" | 29 | #include "gnunet_hello_lib.h" |
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_fragmentation_lib.h" | 31 | #include "gnunet_fragmentation_lib.h" |
32 | #include "gnunet_nat_lib.h" | ||
33 | #include "gnunet_protocols.h" | 32 | #include "gnunet_protocols.h" |
34 | #include "gnunet_resolver_service.h" | 33 | #include "gnunet_resolver_service.h" |
35 | #include "gnunet_signatures.h" | 34 | #include "gnunet_signatures.h" |
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in index 95e3f9944..7b5413bbe 100644 --- a/src/transport/transport.conf.in +++ b/src/transport/transport.conf.in | |||
@@ -38,7 +38,17 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
38 | [transport-tcp] | 38 | [transport-tcp] |
39 | # Use 0 to ONLY advertise as a peer behind NAT (no port binding) | 39 | # Use 0 to ONLY advertise as a peer behind NAT (no port binding) |
40 | PORT = 2086 | 40 | PORT = 2086 |
41 | |||
42 | # Obsolete option, to be replaced by HOLE_EXTERNAL (soon) | ||
41 | ADVERTISED_PORT = 2086 | 43 | ADVERTISED_PORT = 2086 |
44 | |||
45 | # If we have a manually punched NAT, what is the external IP and port? | ||
46 | # Can use DNS names for DynDNS-based detection of external IP. | ||
47 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
48 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
49 | # Do not set if NAT is not manually punched. | ||
50 | # HOLE_EXTERNAL = AUTO:2086 | ||
51 | |||
42 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 52 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
43 | 53 | ||
44 | # Maximum number of open TCP connections allowed | 54 | # Maximum number of open TCP connections allowed |
@@ -55,6 +65,9 @@ MAX_CONNECTIONS = 128 | |||
55 | # Enable TCP stealth? | 65 | # Enable TCP stealth? |
56 | TCP_STEALTH = NO | 66 | TCP_STEALTH = NO |
57 | 67 | ||
68 | # Configuration for manually punched holes in NAT. | ||
69 | # HOLE_EXTERNAL = auto:2086 | ||
70 | |||
58 | [transport-udp] | 71 | [transport-udp] |
59 | # Use PORT = 0 to autodetect a port available | 72 | # Use PORT = 0 to autodetect a port available |
60 | PORT = 2086 | 73 | PORT = 2086 |
@@ -69,6 +82,14 @@ BROADCAST_INTERVAL = 30 s | |||
69 | MAX_BPS = 1000000 | 82 | MAX_BPS = 1000000 |
70 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 83 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
71 | 84 | ||
85 | # If we have a manually punched NAT, what is the external IP and port? | ||
86 | # Can use DNS names for DynDNS-based detection of external IP. | ||
87 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
88 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
89 | # Do not set if NAT is not manually punched. | ||
90 | # HOLE_EXTERNAL = AUTO:2086 | ||
91 | |||
92 | |||
72 | [transport-http_client] | 93 | [transport-http_client] |
73 | MAX_CONNECTIONS = 128 | 94 | MAX_CONNECTIONS = 128 |
74 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 95 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
@@ -92,13 +113,27 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
92 | [transport-http_server] | 113 | [transport-http_server] |
93 | #EXTERNAL_HOSTNAME = <your hostname/path> | 114 | #EXTERNAL_HOSTNAME = <your hostname/path> |
94 | PORT = 1080 | 115 | PORT = 1080 |
116 | |||
117 | # Obsolete option, to be replaced by HOLE_EXTERNAL (soon) | ||
95 | ADVERTISED_PORT = 1080 | 118 | ADVERTISED_PORT = 1080 |
119 | |||
120 | # If we have a manually punched NAT, what is the external IP and port? | ||
121 | # Can use DNS names for DynDNS-based detection of external IP. | ||
122 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
123 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
124 | # Do not set if NAT is not manually punched. | ||
125 | # HOLE_EXTERNAL = AUTO:2086 | ||
126 | |||
127 | |||
96 | MAX_CONNECTIONS = 128 | 128 | MAX_CONNECTIONS = 128 |
97 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 129 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
98 | 130 | ||
99 | # Enable TCP stealth? | 131 | # Enable TCP stealth? |
100 | TCP_STEALTH = NO | 132 | TCP_STEALTH = NO |
101 | 133 | ||
134 | # Configuration for manually punched holes in NAT. | ||
135 | # HOLE_EXTERNAL = auto:2086 | ||
136 | |||
102 | [transport-https_client] | 137 | [transport-https_client] |
103 | MAX_CONNECTIONS = 128 | 138 | MAX_CONNECTIONS = 128 |
104 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 139 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
@@ -130,7 +165,17 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
130 | # Does the external hostname use the same port? | 165 | # Does the external hostname use the same port? |
131 | # EXTERNAL_HOSTNAME_USE_PORT = YES | 166 | # EXTERNAL_HOSTNAME_USE_PORT = YES |
132 | PORT = 4433 | 167 | PORT = 4433 |
168 | |||
169 | # Obsolete option, to be replaced by HOLE_EXTERNAL (soon) | ||
133 | ADVERTISED_PORT = 4433 | 170 | ADVERTISED_PORT = 4433 |
171 | |||
172 | # If we have a manually punched NAT, what is the external IP and port? | ||
173 | # Can use DNS names for DynDNS-based detection of external IP. | ||
174 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
175 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
176 | # Do not set if NAT is not manually punched. | ||
177 | # HOLE_EXTERNAL = AUTO:2086 | ||
178 | |||
134 | CRYPTO_INIT = NORMAL | 179 | CRYPTO_INIT = NORMAL |
135 | KEY_FILE = $GNUNET_DATA_HOME/transport/https.key | 180 | KEY_FILE = $GNUNET_DATA_HOME/transport/https.key |
136 | CERT_FILE = $GNUNET_DATA_HOME/transport/https.cert | 181 | CERT_FILE = $GNUNET_DATA_HOME/transport/https.cert |
@@ -140,6 +185,10 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
140 | # Enable TCP stealth? | 185 | # Enable TCP stealth? |
141 | TCP_STEALTH = NO | 186 | TCP_STEALTH = NO |
142 | 187 | ||
188 | # Configuration for manually punched holes in NAT. | ||
189 | # HOLE_EXTERNAL = auto:2086 | ||
190 | |||
191 | |||
143 | [transport-wlan] | 192 | [transport-wlan] |
144 | # Name of the interface in monitor mode (typically monX) | 193 | # Name of the interface in monitor mode (typically monX) |
145 | INTERFACE = mon0 | 194 | INTERFACE = mon0 |
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c index fd30230f7..b9c72dcb3 100644 --- a/src/transport/transport_api_address_to_string.c +++ b/src/transport/transport_api_address_to_string.c | |||
@@ -210,7 +210,7 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf | |||
210 | } | 210 | } |
211 | alc->cb = aluc; | 211 | alc->cb = aluc; |
212 | alc->cb_cls = aluc_cls; | 212 | alc->cb_cls = aluc_cls; |
213 | alc->mq = GNUNET_CLIENT_connecT (cfg, | 213 | alc->mq = GNUNET_CLIENT_connect (cfg, |
214 | "transport", | 214 | "transport", |
215 | handlers, | 215 | handlers, |
216 | &mq_error_handler, | 216 | &mq_error_handler, |
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c index 4b758f9dc..7b1bf526e 100644 --- a/src/transport/transport_api_blacklist.c +++ b/src/transport/transport_api_blacklist.c | |||
@@ -132,7 +132,7 @@ reconnect (struct GNUNET_TRANSPORT_Blacklist *br) | |||
132 | 132 | ||
133 | if (NULL != br->mq) | 133 | if (NULL != br->mq) |
134 | GNUNET_MQ_destroy (br->mq); | 134 | GNUNET_MQ_destroy (br->mq); |
135 | br->mq = GNUNET_CLIENT_connecT (br->cfg, | 135 | br->mq = GNUNET_CLIENT_connect (br->cfg, |
136 | "transport", | 136 | "transport", |
137 | handlers, | 137 | handlers, |
138 | &mq_error_handler, | 138 | &mq_error_handler, |
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c index de18a140c..a693cb889 100644 --- a/src/transport/transport_api_core.c +++ b/src/transport/transport_api_core.c | |||
@@ -805,7 +805,7 @@ reconnect (void *cls) | |||
805 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 805 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
806 | "Connecting to transport service.\n"); | 806 | "Connecting to transport service.\n"); |
807 | GNUNET_assert (NULL == h->mq); | 807 | GNUNET_assert (NULL == h->mq); |
808 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 808 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
809 | "transport", | 809 | "transport", |
810 | handlers, | 810 | handlers, |
811 | &mq_error_handler, | 811 | &mq_error_handler, |
diff --git a/src/transport/transport_api_hello_get.c b/src/transport/transport_api_hello_get.c index 9c3a3e786..c53dd7a9a 100644 --- a/src/transport/transport_api_hello_get.c +++ b/src/transport/transport_api_hello_get.c | |||
@@ -182,7 +182,7 @@ reconnect (void *cls) | |||
182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
183 | "Connecting to transport service.\n"); | 183 | "Connecting to transport service.\n"); |
184 | GNUNET_assert (NULL == ghh->mq); | 184 | GNUNET_assert (NULL == ghh->mq); |
185 | ghh->mq = GNUNET_CLIENT_connecT (ghh->cfg, | 185 | ghh->mq = GNUNET_CLIENT_connect (ghh->cfg, |
186 | "transport", | 186 | "transport", |
187 | handlers, | 187 | handlers, |
188 | &mq_error_handler, | 188 | &mq_error_handler, |
diff --git a/src/transport/transport_api_manipulation.c b/src/transport/transport_api_manipulation.c index 6325354cb..fd5849a7e 100644 --- a/src/transport/transport_api_manipulation.c +++ b/src/transport/transport_api_manipulation.c | |||
@@ -121,7 +121,7 @@ reconnect (void *cls) | |||
121 | "Connecting to transport service.\n"); | 121 | "Connecting to transport service.\n"); |
122 | GNUNET_assert (NULL == h->mq); | 122 | GNUNET_assert (NULL == h->mq); |
123 | h->reconnecting = GNUNET_NO; | 123 | h->reconnecting = GNUNET_NO; |
124 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 124 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
125 | "transport", | 125 | "transport", |
126 | handlers, | 126 | handlers, |
127 | &mq_error_handler, | 127 | &mq_error_handler, |
diff --git a/src/transport/transport_api_monitor_peers.c b/src/transport/transport_api_monitor_peers.c index 345f2ad60..38e6e0d7c 100644 --- a/src/transport/transport_api_monitor_peers.c +++ b/src/transport/transport_api_monitor_peers.c | |||
@@ -360,7 +360,7 @@ do_peer_connect (void *cls) | |||
360 | struct GNUNET_MQ_Envelope *env; | 360 | struct GNUNET_MQ_Envelope *env; |
361 | 361 | ||
362 | pal_ctx->reconnect_task = NULL; | 362 | pal_ctx->reconnect_task = NULL; |
363 | pal_ctx->mq = GNUNET_CLIENT_connecT (pal_ctx->cfg, | 363 | pal_ctx->mq = GNUNET_CLIENT_connect (pal_ctx->cfg, |
364 | "transport", | 364 | "transport", |
365 | handlers, | 365 | handlers, |
366 | &mq_error_handler, | 366 | &mq_error_handler, |
diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c index 7547a3402..e81664c41 100644 --- a/src/transport/transport_api_monitor_plugins.c +++ b/src/transport/transport_api_monitor_plugins.c | |||
@@ -388,7 +388,7 @@ do_plugin_connect (void *cls) | |||
388 | struct GNUNET_MQ_Envelope *env; | 388 | struct GNUNET_MQ_Envelope *env; |
389 | 389 | ||
390 | pm->reconnect_task = NULL; | 390 | pm->reconnect_task = NULL; |
391 | pm->mq = GNUNET_CLIENT_connecT (pm->cfg, | 391 | pm->mq = GNUNET_CLIENT_connect (pm->cfg, |
392 | "transport", | 392 | "transport", |
393 | handlers, | 393 | handlers, |
394 | &mq_error_handler, | 394 | &mq_error_handler, |
diff --git a/src/transport/transport_api_offer_hello.c b/src/transport/transport_api_offer_hello.c index 951ab9ba4..e1dca14e3 100644 --- a/src/transport/transport_api_offer_hello.c +++ b/src/transport/transport_api_offer_hello.c | |||
@@ -104,7 +104,7 @@ GNUNET_TRANSPORT_offer_hello (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
104 | GNUNET_free (ohh); | 104 | GNUNET_free (ohh); |
105 | return NULL; | 105 | return NULL; |
106 | } | 106 | } |
107 | ohh->mq = GNUNET_CLIENT_connecT (cfg, | 107 | ohh->mq = GNUNET_CLIENT_connect (cfg, |
108 | "transport", | 108 | "transport", |
109 | NULL, | 109 | NULL, |
110 | NULL, | 110 | NULL, |
diff --git a/src/tun/.gitignore b/src/tun/.gitignore new file mode 100644 index 000000000..b26685596 --- /dev/null +++ b/src/tun/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | test_regex | ||
2 | test_tun | ||
diff --git a/src/util/.gitignore b/src/util/.gitignore index cbb349827..87b379746 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore | |||
@@ -7,3 +7,58 @@ gnunet-resolver | |||
7 | gnunet-scrypt | 7 | gnunet-scrypt |
8 | gnunet-service-resolver | 8 | gnunet-service-resolver |
9 | gnunet-uri | 9 | gnunet-uri |
10 | test_bio | ||
11 | test_client.nc | ||
12 | test_client_unix.nc | ||
13 | test_common_allocation | ||
14 | test_common_endian | ||
15 | test_common_logging | ||
16 | test_common_logging_runtime_loglevels | ||
17 | test_configuration | ||
18 | test_connection.nc | ||
19 | test_connection_addressing.nc | ||
20 | test_connection_receive_cancel.nc | ||
21 | test_connection_timeout.nc | ||
22 | test_connection_timeout_no_connect.nc | ||
23 | test_connection_transmit_cancel.nc | ||
24 | test_container_bloomfilter | ||
25 | test_container_heap | ||
26 | test_container_meta_data | ||
27 | test_container_multihashmap | ||
28 | test_container_multihashmap32 | ||
29 | test_container_multipeermap | ||
30 | test_crypto_crc | ||
31 | test_crypto_ecc_dlog | ||
32 | test_crypto_ecdh_eddsa | ||
33 | test_crypto_ecdhe | ||
34 | test_crypto_ecdsa | ||
35 | test_crypto_eddsa | ||
36 | test_crypto_hash | ||
37 | test_crypto_hash_context | ||
38 | test_crypto_hkdf | ||
39 | test_crypto_kdf | ||
40 | test_crypto_paillier | ||
41 | test_crypto_random | ||
42 | test_crypto_rsa | ||
43 | test_crypto_symmetric | ||
44 | test_disk | ||
45 | test_getopt | ||
46 | test_mq | ||
47 | test_os_network | ||
48 | test_os_start_process | ||
49 | test_peer | ||
50 | test_plugin | ||
51 | test_program | ||
52 | test_resolver_api.nc | ||
53 | test_scheduler | ||
54 | test_scheduler_delay | ||
55 | test_server.nc | ||
56 | test_server_disconnect.nc | ||
57 | test_server_mst_interrupt.nc | ||
58 | test_server_with_client.nc | ||
59 | test_server_with_client_unix | ||
60 | test_service | ||
61 | test_speedup | ||
62 | test_strings | ||
63 | test_strings_to_data | ||
64 | test_time | ||
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 65818640c..f49aee17f 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -59,7 +59,7 @@ test_common_logging_dummy_LDADD = \ | |||
59 | libgnunetutil_la_SOURCES = \ | 59 | libgnunetutil_la_SOURCES = \ |
60 | bandwidth.c \ | 60 | bandwidth.c \ |
61 | bio.c \ | 61 | bio.c \ |
62 | client_new.c \ | 62 | client.c \ |
63 | common_allocation.c \ | 63 | common_allocation.c \ |
64 | common_endian.c \ | 64 | common_endian.c \ |
65 | common_logging.c \ | 65 | common_logging.c \ |
@@ -70,6 +70,7 @@ libgnunetutil_la_SOURCES = \ | |||
70 | container_heap.c \ | 70 | container_heap.c \ |
71 | container_meta_data.c \ | 71 | container_meta_data.c \ |
72 | container_multihashmap.c \ | 72 | container_multihashmap.c \ |
73 | container_multishortmap.c \ | ||
73 | container_multipeermap.c \ | 74 | container_multipeermap.c \ |
74 | container_multihashmap32.c \ | 75 | container_multihashmap32.c \ |
75 | crypto_symmetric.c \ | 76 | crypto_symmetric.c \ |
diff --git a/src/util/client_new.c b/src/util/client.c index 337d06734..4fd971040 100644 --- a/src/util/client_new.c +++ b/src/util/client.c | |||
@@ -213,9 +213,6 @@ start_connect (void *cls); | |||
213 | static void | 213 | static void |
214 | connect_fail_continuation (struct ClientState *cstate) | 214 | connect_fail_continuation (struct ClientState *cstate) |
215 | { | 215 | { |
216 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
217 | "Failed to establish connection to `%s', no further addresses to try.\n", | ||
218 | cstate->service_name); | ||
219 | GNUNET_break (NULL == cstate->ap_head); | 216 | GNUNET_break (NULL == cstate->ap_head); |
220 | GNUNET_break (NULL == cstate->ap_tail); | 217 | GNUNET_break (NULL == cstate->ap_tail); |
221 | GNUNET_break (NULL == cstate->dns_active); | 218 | GNUNET_break (NULL == cstate->dns_active); |
@@ -225,6 +222,11 @@ connect_fail_continuation (struct ClientState *cstate) | |||
225 | // GNUNET_assert (NULL == cstate->proxy_handshake); | 222 | // GNUNET_assert (NULL == cstate->proxy_handshake); |
226 | 223 | ||
227 | cstate->back_off = GNUNET_TIME_STD_BACKOFF (cstate->back_off); | 224 | cstate->back_off = GNUNET_TIME_STD_BACKOFF (cstate->back_off); |
225 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
226 | "Failed to establish connection to `%s', no further addresses to try, will try again in %s.\n", | ||
227 | cstate->service_name, | ||
228 | GNUNET_STRINGS_relative_time_to_string (cstate->back_off, | ||
229 | GNUNET_YES)); | ||
228 | cstate->retry_task | 230 | cstate->retry_task |
229 | = GNUNET_SCHEDULER_add_delayed (cstate->back_off, | 231 | = GNUNET_SCHEDULER_add_delayed (cstate->back_off, |
230 | &start_connect, | 232 | &start_connect, |
@@ -271,7 +273,7 @@ transmit_ready (void *cls) | |||
271 | cstate->sock, | 273 | cstate->sock, |
272 | &transmit_ready, | 274 | &transmit_ready, |
273 | cstate); | 275 | cstate); |
274 | if (notify_in_flight) | 276 | if (notify_in_flight) |
275 | GNUNET_MQ_impl_send_in_flight (cstate->mq); | 277 | GNUNET_MQ_impl_send_in_flight (cstate->mq); |
276 | return; | 278 | return; |
277 | } | 279 | } |
@@ -583,7 +585,7 @@ try_connect_using_address (void *cls, | |||
583 | { | 585 | { |
584 | struct ClientState *cstate = cls; | 586 | struct ClientState *cstate = cls; |
585 | struct AddressProbe *ap; | 587 | struct AddressProbe *ap; |
586 | 588 | ||
587 | if (NULL == addr) | 589 | if (NULL == addr) |
588 | { | 590 | { |
589 | cstate->dns_active = NULL; | 591 | cstate->dns_active = NULL; |
@@ -739,7 +741,7 @@ start_connect (void *cls) | |||
739 | { | 741 | { |
740 | connect_success_continuation (cstate); | 742 | connect_success_continuation (cstate); |
741 | return; | 743 | return; |
742 | } | 744 | } |
743 | } | 745 | } |
744 | if ( (NULL == cstate->hostname) || | 746 | if ( (NULL == cstate->hostname) || |
745 | (0 == cstate->port) ) | 747 | (0 == cstate->port) ) |
@@ -821,7 +823,7 @@ connection_client_cancel_impl (struct GNUNET_MQ_Handle *mq, | |||
821 | * @return the message queue, NULL on error | 823 | * @return the message queue, NULL on error |
822 | */ | 824 | */ |
823 | struct GNUNET_MQ_Handle * | 825 | struct GNUNET_MQ_Handle * |
824 | GNUNET_CLIENT_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg, | 826 | GNUNET_CLIENT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
825 | const char *service_name, | 827 | const char *service_name, |
826 | const struct GNUNET_MQ_MessageHandler *handlers, | 828 | const struct GNUNET_MQ_MessageHandler *handlers, |
827 | GNUNET_MQ_ErrorHandler error_handler, | 829 | GNUNET_MQ_ErrorHandler error_handler, |
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 5989db00c..ce229826e 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -1153,6 +1153,29 @@ GNUNET_h2s (const struct GNUNET_HashCode * hc) | |||
1153 | 1153 | ||
1154 | 1154 | ||
1155 | /** | 1155 | /** |
1156 | * @ingroup logging | ||
1157 | * Convert a short hash value to a string (for printing debug messages). | ||
1158 | * This is one of the very few calls in the entire API that is | ||
1159 | * NOT reentrant! | ||
1160 | * | ||
1161 | * @param shc the hash code | ||
1162 | * @return string | ||
1163 | */ | ||
1164 | const char * | ||
1165 | GNUNET_sh2s (const struct GNUNET_ShortHashCode *shc) | ||
1166 | { | ||
1167 | static char buf[32]; | ||
1168 | |||
1169 | GNUNET_STRINGS_data_to_string (shc, | ||
1170 | sizeof (*shc), | ||
1171 | buf, | ||
1172 | sizeof (buf)); | ||
1173 | buf[6] = '\0'; | ||
1174 | return (const char *) buf; | ||
1175 | } | ||
1176 | |||
1177 | |||
1178 | /** | ||
1156 | * Convert a hash to a string (for printing debug messages). | 1179 | * Convert a hash to a string (for printing debug messages). |
1157 | * This is one of the very few calls in the entire API that is | 1180 | * This is one of the very few calls in the entire API that is |
1158 | * NOT reentrant! | 1181 | * NOT reentrant! |
diff --git a/src/util/container_heap.c b/src/util/container_heap.c index 4f82fb076..1ead5ec6d 100644 --- a/src/util/container_heap.c +++ b/src/util/container_heap.c | |||
@@ -541,36 +541,23 @@ GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node) | |||
541 | /** | 541 | /** |
542 | * Updates the cost of any node in the tree | 542 | * Updates the cost of any node in the tree |
543 | * | 543 | * |
544 | * @param heap heap to modify | ||
545 | * @param node node for which the cost is to be changed | 544 | * @param node node for which the cost is to be changed |
546 | * @param new_cost new cost for the node | 545 | * @param new_cost new cost for the node |
547 | */ | 546 | */ |
548 | void | 547 | void |
549 | GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, | 548 | GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_HeapNode *node, |
550 | struct GNUNET_CONTAINER_HeapNode *node, | ||
551 | GNUNET_CONTAINER_HeapCostType new_cost) | 549 | GNUNET_CONTAINER_HeapCostType new_cost) |
552 | { | 550 | { |
553 | #if EXTRA_CHECKS | 551 | struct GNUNET_CONTAINER_Heap *heap = node->heap; |
554 | GNUNET_assert (((heap->size == 0) && (heap->root == NULL)) || | 552 | |
555 | (heap->size == heap->root->tree_size + 1)); | ||
556 | CHECK (heap->root); | ||
557 | #endif | ||
558 | remove_node (node); | 553 | remove_node (node); |
559 | #if EXTRA_CHECKS | ||
560 | CHECK (heap->root); | ||
561 | GNUNET_assert (((heap->size == 1) && (heap->root == NULL)) || | ||
562 | (heap->size == heap->root->tree_size + 2)); | ||
563 | #endif | ||
564 | node->cost = new_cost; | 554 | node->cost = new_cost; |
565 | if (heap->root == NULL) | 555 | if (NULL == heap->root) |
566 | heap->root = node; | 556 | heap->root = node; |
567 | else | 557 | else |
568 | insert_node (heap, heap->root, node); | 558 | insert_node (heap, |
569 | #if EXTRA_CHECKS | 559 | heap->root, |
570 | CHECK (heap->root); | 560 | node); |
571 | GNUNET_assert (((heap->size == 0) && (heap->root == NULL)) || | ||
572 | (heap->size == heap->root->tree_size + 1)); | ||
573 | #endif | ||
574 | } | 561 | } |
575 | 562 | ||
576 | 563 | ||
diff --git a/src/util/container_multishortmap.c b/src/util/container_multishortmap.c new file mode 100644 index 000000000..5e8a47b09 --- /dev/null +++ b/src/util/container_multishortmap.c | |||
@@ -0,0 +1,965 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2008, 2012 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file util/container_multishortmap.c | ||
22 | * @brief hash map where the same key may be present multiple times | ||
23 | * @author Christian Grothoff | ||
24 | */ | ||
25 | |||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | |||
29 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | ||
30 | |||
31 | /** | ||
32 | * An entry in the hash map with the full key. | ||
33 | */ | ||
34 | struct BigMapEntry | ||
35 | { | ||
36 | |||
37 | /** | ||
38 | * Value of the entry. | ||
39 | */ | ||
40 | void *value; | ||
41 | |||
42 | /** | ||
43 | * If there is a hash collision, we create a linked list. | ||
44 | */ | ||
45 | struct BigMapEntry *next; | ||
46 | |||
47 | /** | ||
48 | * Key for the entry. | ||
49 | */ | ||
50 | struct GNUNET_ShortHashCode key; | ||
51 | |||
52 | }; | ||
53 | |||
54 | |||
55 | /** | ||
56 | * An entry in the hash map with just a pointer to the key. | ||
57 | */ | ||
58 | struct SmallMapEntry | ||
59 | { | ||
60 | |||
61 | /** | ||
62 | * Value of the entry. | ||
63 | */ | ||
64 | void *value; | ||
65 | |||
66 | /** | ||
67 | * If there is a hash collision, we create a linked list. | ||
68 | */ | ||
69 | struct SmallMapEntry *next; | ||
70 | |||
71 | /** | ||
72 | * Key for the entry. | ||
73 | */ | ||
74 | const struct GNUNET_ShortHashCode *key; | ||
75 | |||
76 | }; | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Entry in the map. | ||
81 | */ | ||
82 | union MapEntry | ||
83 | { | ||
84 | /** | ||
85 | * Variant used if map entries only contain a pointer to the key. | ||
86 | */ | ||
87 | struct SmallMapEntry *sme; | ||
88 | |||
89 | /** | ||
90 | * Variant used if map entries contain the full key. | ||
91 | */ | ||
92 | struct BigMapEntry *bme; | ||
93 | }; | ||
94 | |||
95 | |||
96 | /** | ||
97 | * Internal representation of the hash map. | ||
98 | */ | ||
99 | struct GNUNET_CONTAINER_MultiShortmap | ||
100 | { | ||
101 | /** | ||
102 | * All of our buckets. | ||
103 | */ | ||
104 | union MapEntry *map; | ||
105 | |||
106 | /** | ||
107 | * Number of entries in the map. | ||
108 | */ | ||
109 | unsigned int size; | ||
110 | |||
111 | /** | ||
112 | * Length of the "map" array. | ||
113 | */ | ||
114 | unsigned int map_length; | ||
115 | |||
116 | /** | ||
117 | * GNUNET_NO if the map entries are of type 'struct BigMapEntry', | ||
118 | * GNUNET_YES if the map entries are of type 'struct SmallMapEntry'. | ||
119 | */ | ||
120 | int use_small_entries; | ||
121 | |||
122 | /** | ||
123 | * Counts the destructive modifications (grow, remove) | ||
124 | * to the map, so that iterators can check if they are still valid. | ||
125 | */ | ||
126 | unsigned int modification_counter; | ||
127 | }; | ||
128 | |||
129 | |||
130 | /** | ||
131 | * Cursor into a multishortmap. | ||
132 | * Allows to enumerate elements asynchronously. | ||
133 | */ | ||
134 | struct GNUNET_CONTAINER_MultiShortmapIterator | ||
135 | { | ||
136 | /** | ||
137 | * Position in the bucket 'idx' | ||
138 | */ | ||
139 | union MapEntry me; | ||
140 | |||
141 | /** | ||
142 | * Current bucket index. | ||
143 | */ | ||
144 | unsigned int idx; | ||
145 | |||
146 | /** | ||
147 | * Modification counter as observed on the map when the iterator | ||
148 | * was created. | ||
149 | */ | ||
150 | unsigned int modification_counter; | ||
151 | |||
152 | /** | ||
153 | * Map that we are iterating over. | ||
154 | */ | ||
155 | const struct GNUNET_CONTAINER_MultiShortmap *map; | ||
156 | }; | ||
157 | |||
158 | |||
159 | /** | ||
160 | * Create a multi hash map. | ||
161 | * | ||
162 | * @param len initial size (map will grow as needed) | ||
163 | * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; | ||
164 | * GNUNET_YES means that on 'put', the 'key' does not have | ||
165 | * to be copied as the destination of the pointer is | ||
166 | * guaranteed to be life as long as the value is stored in | ||
167 | * the hashmap. This can significantly reduce memory | ||
168 | * consumption, but of course is also a recipie for | ||
169 | * heap corruption if the assumption is not true. Only | ||
170 | * use this if (1) memory use is important in this case and | ||
171 | * (2) you have triple-checked that the invariant holds | ||
172 | * @return NULL on error | ||
173 | */ | ||
174 | struct GNUNET_CONTAINER_MultiShortmap * | ||
175 | GNUNET_CONTAINER_multishortmap_create (unsigned int len, | ||
176 | int do_not_copy_keys) | ||
177 | { | ||
178 | struct GNUNET_CONTAINER_MultiShortmap *map; | ||
179 | |||
180 | GNUNET_assert (len > 0); | ||
181 | map = GNUNET_new (struct GNUNET_CONTAINER_MultiShortmap); | ||
182 | map->map = GNUNET_malloc (len * sizeof (union MapEntry)); | ||
183 | map->map_length = len; | ||
184 | map->use_small_entries = do_not_copy_keys; | ||
185 | return map; | ||
186 | } | ||
187 | |||
188 | |||
189 | /** | ||
190 | * Destroy a hash map. Will not free any values | ||
191 | * stored in the hash map! | ||
192 | * | ||
193 | * @param map the map | ||
194 | */ | ||
195 | void | ||
196 | GNUNET_CONTAINER_multishortmap_destroy (struct GNUNET_CONTAINER_MultiShortmap | ||
197 | *map) | ||
198 | { | ||
199 | unsigned int i; | ||
200 | union MapEntry me; | ||
201 | |||
202 | for (i = 0; i < map->map_length; i++) | ||
203 | { | ||
204 | me = map->map[i]; | ||
205 | if (map->use_small_entries) | ||
206 | { | ||
207 | struct SmallMapEntry *sme; | ||
208 | struct SmallMapEntry *nxt; | ||
209 | |||
210 | nxt = me.sme; | ||
211 | while (NULL != (sme = nxt)) | ||
212 | { | ||
213 | nxt = sme->next; | ||
214 | GNUNET_free (sme); | ||
215 | } | ||
216 | me.sme = NULL; | ||
217 | } | ||
218 | else | ||
219 | { | ||
220 | struct BigMapEntry *bme; | ||
221 | struct BigMapEntry *nxt; | ||
222 | |||
223 | nxt = me.bme; | ||
224 | while (NULL != (bme = nxt)) | ||
225 | { | ||
226 | nxt = bme->next; | ||
227 | GNUNET_free (bme); | ||
228 | } | ||
229 | me.bme = NULL; | ||
230 | } | ||
231 | } | ||
232 | GNUNET_free (map->map); | ||
233 | GNUNET_free (map); | ||
234 | } | ||
235 | |||
236 | |||
237 | /** | ||
238 | * Compute the index of the bucket for the given key. | ||
239 | * | ||
240 | * @param map hash map for which to compute the index | ||
241 | * @param key what key should the index be computed for | ||
242 | * @return offset into the "map" array of "map" | ||
243 | */ | ||
244 | static unsigned int | ||
245 | idx_of (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
246 | const struct GNUNET_ShortHashCode *key) | ||
247 | { | ||
248 | unsigned int kx; | ||
249 | |||
250 | GNUNET_assert (NULL != map); | ||
251 | GNUNET_memcpy (&kx, key, sizeof (kx)); | ||
252 | return kx % map->map_length; | ||
253 | } | ||
254 | |||
255 | |||
256 | /** | ||
257 | * Get the number of key-value pairs in the map. | ||
258 | * | ||
259 | * @param map the map | ||
260 | * @return the number of key value pairs | ||
261 | */ | ||
262 | unsigned int | ||
263 | GNUNET_CONTAINER_multishortmap_size (const struct GNUNET_CONTAINER_MultiShortmap *map) | ||
264 | { | ||
265 | return map->size; | ||
266 | } | ||
267 | |||
268 | |||
269 | /** | ||
270 | * Given a key find a value in the map matching the key. | ||
271 | * | ||
272 | * @param map the map | ||
273 | * @param key what to look for | ||
274 | * @return NULL if no value was found; note that | ||
275 | * this is indistinguishable from values that just | ||
276 | * happen to be NULL; use "contains" to test for | ||
277 | * key-value pairs with value NULL | ||
278 | */ | ||
279 | void * | ||
280 | GNUNET_CONTAINER_multishortmap_get (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
281 | const struct GNUNET_ShortHashCode *key) | ||
282 | { | ||
283 | union MapEntry me; | ||
284 | |||
285 | me = map->map[idx_of (map, key)]; | ||
286 | if (map->use_small_entries) | ||
287 | { | ||
288 | struct SmallMapEntry *sme; | ||
289 | |||
290 | for (sme = me.sme; NULL != sme; sme = sme->next) | ||
291 | if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
292 | return sme->value; | ||
293 | } | ||
294 | else | ||
295 | { | ||
296 | struct BigMapEntry *bme; | ||
297 | |||
298 | for (bme = me.bme; NULL != bme; bme = bme->next) | ||
299 | if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
300 | return bme->value; | ||
301 | } | ||
302 | return NULL; | ||
303 | } | ||
304 | |||
305 | |||
306 | /** | ||
307 | * Iterate over all entries in the map. | ||
308 | * | ||
309 | * @param map the map | ||
310 | * @param it function to call on each entry | ||
311 | * @param it_cls extra argument to @a it | ||
312 | * @return the number of key value pairs processed, | ||
313 | * #GNUNET_SYSERR if it aborted iteration | ||
314 | */ | ||
315 | int | ||
316 | GNUNET_CONTAINER_multishortmap_iterate (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
317 | GNUNET_CONTAINER_ShortmapIterator it, | ||
318 | void *it_cls) | ||
319 | { | ||
320 | int count; | ||
321 | unsigned int i; | ||
322 | union MapEntry me; | ||
323 | struct GNUNET_ShortHashCode kc; | ||
324 | |||
325 | count = 0; | ||
326 | GNUNET_assert (NULL != map); | ||
327 | for (i = 0; i < map->map_length; i++) | ||
328 | { | ||
329 | me = map->map[i]; | ||
330 | if (map->use_small_entries) | ||
331 | { | ||
332 | struct SmallMapEntry *sme; | ||
333 | struct SmallMapEntry *nxt; | ||
334 | |||
335 | nxt = me.sme; | ||
336 | while (NULL != (sme = nxt)) | ||
337 | { | ||
338 | nxt = sme->next; | ||
339 | if (NULL != it) | ||
340 | { | ||
341 | if (GNUNET_OK != it (it_cls, sme->key, sme->value)) | ||
342 | return GNUNET_SYSERR; | ||
343 | } | ||
344 | count++; | ||
345 | } | ||
346 | } | ||
347 | else | ||
348 | { | ||
349 | struct BigMapEntry *bme; | ||
350 | struct BigMapEntry *nxt; | ||
351 | |||
352 | nxt = me.bme; | ||
353 | while (NULL != (bme = nxt)) | ||
354 | { | ||
355 | nxt = bme->next; | ||
356 | if (NULL != it) | ||
357 | { | ||
358 | kc = bme->key; | ||
359 | if (GNUNET_OK != it (it_cls, &kc, bme->value)) | ||
360 | return GNUNET_SYSERR; | ||
361 | } | ||
362 | count++; | ||
363 | } | ||
364 | } | ||
365 | } | ||
366 | return count; | ||
367 | } | ||
368 | |||
369 | |||
370 | /** | ||
371 | * Remove the given key-value pair from the map. Note that if the | ||
372 | * key-value pair is in the map multiple times, only one of the pairs | ||
373 | * will be removed. | ||
374 | * | ||
375 | * @param map the map | ||
376 | * @param key key of the key-value pair | ||
377 | * @param value value of the key-value pair | ||
378 | * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair | ||
379 | * is not in the map | ||
380 | */ | ||
381 | int | ||
382 | GNUNET_CONTAINER_multishortmap_remove (struct GNUNET_CONTAINER_MultiShortmap *map, | ||
383 | const struct GNUNET_ShortHashCode *key, | ||
384 | const void *value) | ||
385 | { | ||
386 | union MapEntry me; | ||
387 | unsigned int i; | ||
388 | |||
389 | map->modification_counter++; | ||
390 | |||
391 | i = idx_of (map, key); | ||
392 | me = map->map[i]; | ||
393 | if (map->use_small_entries) | ||
394 | { | ||
395 | struct SmallMapEntry *sme; | ||
396 | struct SmallMapEntry *p; | ||
397 | |||
398 | p = NULL; | ||
399 | for (sme = me.sme; NULL != sme; sme = sme->next) | ||
400 | { | ||
401 | if ((0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) && | ||
402 | (value == sme->value)) | ||
403 | { | ||
404 | if (NULL == p) | ||
405 | map->map[i].sme = sme->next; | ||
406 | else | ||
407 | p->next = sme->next; | ||
408 | GNUNET_free (sme); | ||
409 | map->size--; | ||
410 | return GNUNET_YES; | ||
411 | } | ||
412 | p = sme; | ||
413 | } | ||
414 | } | ||
415 | else | ||
416 | { | ||
417 | struct BigMapEntry *bme; | ||
418 | struct BigMapEntry *p; | ||
419 | |||
420 | p = NULL; | ||
421 | for (bme = me.bme; NULL != bme; bme = bme->next) | ||
422 | { | ||
423 | if ((0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) && | ||
424 | (value == bme->value)) | ||
425 | { | ||
426 | if (NULL == p) | ||
427 | map->map[i].bme = bme->next; | ||
428 | else | ||
429 | p->next = bme->next; | ||
430 | GNUNET_free (bme); | ||
431 | map->size--; | ||
432 | return GNUNET_YES; | ||
433 | } | ||
434 | p = bme; | ||
435 | } | ||
436 | } | ||
437 | return GNUNET_NO; | ||
438 | } | ||
439 | |||
440 | |||
441 | /** | ||
442 | * Remove all entries for the given key from the map. | ||
443 | * Note that the values would not be "freed". | ||
444 | * | ||
445 | * @param map the map | ||
446 | * @param key identifies values to be removed | ||
447 | * @return number of values removed | ||
448 | */ | ||
449 | int | ||
450 | GNUNET_CONTAINER_multishortmap_remove_all (struct GNUNET_CONTAINER_MultiShortmap *map, | ||
451 | const struct GNUNET_ShortHashCode *key) | ||
452 | { | ||
453 | union MapEntry me; | ||
454 | unsigned int i; | ||
455 | int ret; | ||
456 | |||
457 | map->modification_counter++; | ||
458 | |||
459 | ret = 0; | ||
460 | i = idx_of (map, key); | ||
461 | me = map->map[i]; | ||
462 | if (map->use_small_entries) | ||
463 | { | ||
464 | struct SmallMapEntry *sme; | ||
465 | struct SmallMapEntry *p; | ||
466 | |||
467 | p = NULL; | ||
468 | sme = me.sme; | ||
469 | while (NULL != sme) | ||
470 | { | ||
471 | if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
472 | { | ||
473 | if (NULL == p) | ||
474 | map->map[i].sme = sme->next; | ||
475 | else | ||
476 | p->next = sme->next; | ||
477 | GNUNET_free (sme); | ||
478 | map->size--; | ||
479 | if (NULL == p) | ||
480 | sme = map->map[i].sme; | ||
481 | else | ||
482 | sme = p->next; | ||
483 | ret++; | ||
484 | } | ||
485 | else | ||
486 | { | ||
487 | p = sme; | ||
488 | sme = sme->next; | ||
489 | } | ||
490 | } | ||
491 | } | ||
492 | else | ||
493 | { | ||
494 | struct BigMapEntry *bme; | ||
495 | struct BigMapEntry *p; | ||
496 | |||
497 | p = NULL; | ||
498 | bme = me.bme; | ||
499 | while (NULL != bme) | ||
500 | { | ||
501 | if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
502 | { | ||
503 | if (NULL == p) | ||
504 | map->map[i].bme = bme->next; | ||
505 | else | ||
506 | p->next = bme->next; | ||
507 | GNUNET_free (bme); | ||
508 | map->size--; | ||
509 | if (NULL == p) | ||
510 | bme = map->map[i].bme; | ||
511 | else | ||
512 | bme = p->next; | ||
513 | ret++; | ||
514 | } | ||
515 | else | ||
516 | { | ||
517 | p = bme; | ||
518 | bme = bme->next; | ||
519 | } | ||
520 | } | ||
521 | } | ||
522 | return ret; | ||
523 | } | ||
524 | |||
525 | |||
526 | /** | ||
527 | * Check if the map contains any value under the given | ||
528 | * key (including values that are NULL). | ||
529 | * | ||
530 | * @param map the map | ||
531 | * @param key the key to test if a value exists for it | ||
532 | * @return #GNUNET_YES if such a value exists, | ||
533 | * #GNUNET_NO if not | ||
534 | */ | ||
535 | int | ||
536 | GNUNET_CONTAINER_multishortmap_contains (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
537 | const struct GNUNET_ShortHashCode *key) | ||
538 | { | ||
539 | union MapEntry me; | ||
540 | |||
541 | me = map->map[idx_of (map, key)]; | ||
542 | if (map->use_small_entries) | ||
543 | { | ||
544 | struct SmallMapEntry *sme; | ||
545 | |||
546 | for (sme = me.sme; NULL != sme; sme = sme->next) | ||
547 | if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
548 | return GNUNET_YES; | ||
549 | } | ||
550 | else | ||
551 | { | ||
552 | struct BigMapEntry *bme; | ||
553 | |||
554 | for (bme = me.bme; NULL != bme; bme = bme->next) | ||
555 | if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
556 | return GNUNET_YES; | ||
557 | } | ||
558 | return GNUNET_NO; | ||
559 | } | ||
560 | |||
561 | |||
562 | /** | ||
563 | * Check if the map contains the given value under the given | ||
564 | * key. | ||
565 | * | ||
566 | * @param map the map | ||
567 | * @param key the key to test if a value exists for it | ||
568 | * @param value value to test for | ||
569 | * @return #GNUNET_YES if such a value exists, | ||
570 | * #GNUNET_NO if not | ||
571 | */ | ||
572 | int | ||
573 | GNUNET_CONTAINER_multishortmap_contains_value (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
574 | const struct GNUNET_ShortHashCode *key, | ||
575 | const void *value) | ||
576 | { | ||
577 | union MapEntry me; | ||
578 | |||
579 | me = map->map[idx_of (map, key)]; | ||
580 | if (map->use_small_entries) | ||
581 | { | ||
582 | struct SmallMapEntry *sme; | ||
583 | |||
584 | for (sme = me.sme; NULL != sme; sme = sme->next) | ||
585 | if ( (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) && | ||
586 | (sme->value == value) ) | ||
587 | return GNUNET_YES; | ||
588 | } | ||
589 | else | ||
590 | { | ||
591 | struct BigMapEntry *bme; | ||
592 | |||
593 | for (bme = me.bme; NULL != bme; bme = bme->next) | ||
594 | if ( (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) && | ||
595 | (bme->value == value) ) | ||
596 | return GNUNET_YES; | ||
597 | } | ||
598 | return GNUNET_NO; | ||
599 | } | ||
600 | |||
601 | |||
602 | /** | ||
603 | * Grow the given map to a more appropriate size. | ||
604 | * | ||
605 | * @param map the hash map to grow | ||
606 | */ | ||
607 | static void | ||
608 | grow (struct GNUNET_CONTAINER_MultiShortmap *map) | ||
609 | { | ||
610 | union MapEntry *old_map; | ||
611 | union MapEntry *new_map; | ||
612 | unsigned int old_len; | ||
613 | unsigned int new_len; | ||
614 | unsigned int idx; | ||
615 | unsigned int i; | ||
616 | |||
617 | map->modification_counter++; | ||
618 | |||
619 | old_map = map->map; | ||
620 | old_len = map->map_length; | ||
621 | new_len = old_len * 2; | ||
622 | new_map = GNUNET_malloc (sizeof (union MapEntry) * new_len); | ||
623 | map->map_length = new_len; | ||
624 | map->map = new_map; | ||
625 | for (i = 0; i < old_len; i++) | ||
626 | { | ||
627 | if (map->use_small_entries) | ||
628 | { | ||
629 | struct SmallMapEntry *sme; | ||
630 | |||
631 | while (NULL != (sme = old_map[i].sme)) | ||
632 | { | ||
633 | old_map[i].sme = sme->next; | ||
634 | idx = idx_of (map, sme->key); | ||
635 | sme->next = new_map[idx].sme; | ||
636 | new_map[idx].sme = sme; | ||
637 | } | ||
638 | } | ||
639 | else | ||
640 | { | ||
641 | struct BigMapEntry *bme; | ||
642 | |||
643 | while (NULL != (bme = old_map[i].bme)) | ||
644 | { | ||
645 | old_map[i].bme = bme->next; | ||
646 | idx = idx_of (map, &bme->key); | ||
647 | bme->next = new_map[idx].bme; | ||
648 | new_map[idx].bme = bme; | ||
649 | } | ||
650 | } | ||
651 | } | ||
652 | GNUNET_free (old_map); | ||
653 | } | ||
654 | |||
655 | |||
656 | /** | ||
657 | * Store a key-value pair in the map. | ||
658 | * | ||
659 | * @param map the map | ||
660 | * @param key key to use | ||
661 | * @param value value to use | ||
662 | * @param opt options for put | ||
663 | * @return #GNUNET_OK on success, | ||
664 | * #GNUNET_NO if a value was replaced (with REPLACE) | ||
665 | * #GNUNET_SYSERR if GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the | ||
666 | * value already exists | ||
667 | */ | ||
668 | int | ||
669 | GNUNET_CONTAINER_multishortmap_put (struct GNUNET_CONTAINER_MultiShortmap *map, | ||
670 | const struct GNUNET_ShortHashCode *key, | ||
671 | void *value, | ||
672 | enum GNUNET_CONTAINER_MultiHashMapOption opt) | ||
673 | { | ||
674 | union MapEntry me; | ||
675 | unsigned int i; | ||
676 | |||
677 | i = idx_of (map, key); | ||
678 | if ((opt != GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE) && | ||
679 | (opt != GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
680 | { | ||
681 | me = map->map[i]; | ||
682 | if (map->use_small_entries) | ||
683 | { | ||
684 | struct SmallMapEntry *sme; | ||
685 | |||
686 | for (sme = me.sme; NULL != sme; sme = sme->next) | ||
687 | if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
688 | { | ||
689 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) | ||
690 | return GNUNET_SYSERR; | ||
691 | sme->value = value; | ||
692 | return GNUNET_NO; | ||
693 | } | ||
694 | } | ||
695 | else | ||
696 | { | ||
697 | struct BigMapEntry *bme; | ||
698 | |||
699 | for (bme = me.bme; NULL != bme; bme = bme->next) | ||
700 | if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
701 | { | ||
702 | if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) | ||
703 | return GNUNET_SYSERR; | ||
704 | bme->value = value; | ||
705 | return GNUNET_NO; | ||
706 | } | ||
707 | } | ||
708 | } | ||
709 | if (map->size / 3 >= map->map_length / 4) | ||
710 | { | ||
711 | grow (map); | ||
712 | i = idx_of (map, key); | ||
713 | } | ||
714 | if (map->use_small_entries) | ||
715 | { | ||
716 | struct SmallMapEntry *sme; | ||
717 | |||
718 | sme = GNUNET_new (struct SmallMapEntry); | ||
719 | sme->key = key; | ||
720 | sme->value = value; | ||
721 | sme->next = map->map[i].sme; | ||
722 | map->map[i].sme = sme; | ||
723 | } | ||
724 | else | ||
725 | { | ||
726 | struct BigMapEntry *bme; | ||
727 | |||
728 | bme = GNUNET_new (struct BigMapEntry); | ||
729 | bme->key = *key; | ||
730 | bme->value = value; | ||
731 | bme->next = map->map[i].bme; | ||
732 | map->map[i].bme = bme; | ||
733 | } | ||
734 | map->size++; | ||
735 | return GNUNET_OK; | ||
736 | } | ||
737 | |||
738 | |||
739 | /** | ||
740 | * Iterate over all entries in the map that match a particular key. | ||
741 | * | ||
742 | * @param map the map | ||
743 | * @param key key that the entries must correspond to | ||
744 | * @param it function to call on each entry | ||
745 | * @param it_cls extra argument to @a it | ||
746 | * @return the number of key value pairs processed, | ||
747 | * #GNUNET_SYSERR if it aborted iteration | ||
748 | */ | ||
749 | int | ||
750 | GNUNET_CONTAINER_multishortmap_get_multiple (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
751 | const struct GNUNET_ShortHashCode *key, | ||
752 | GNUNET_CONTAINER_ShortmapIterator it, | ||
753 | void *it_cls) | ||
754 | { | ||
755 | int count; | ||
756 | union MapEntry me; | ||
757 | |||
758 | count = 0; | ||
759 | me = map->map[idx_of (map, key)]; | ||
760 | if (map->use_small_entries) | ||
761 | { | ||
762 | struct SmallMapEntry *sme; | ||
763 | struct SmallMapEntry *nxt; | ||
764 | |||
765 | nxt = me.sme; | ||
766 | while (NULL != (sme = nxt)) | ||
767 | { | ||
768 | nxt = sme->next; | ||
769 | if (0 != memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
770 | continue; | ||
771 | if ((it != NULL) && (GNUNET_OK != it (it_cls, key, sme->value))) | ||
772 | return GNUNET_SYSERR; | ||
773 | count++; | ||
774 | } | ||
775 | } | ||
776 | else | ||
777 | { | ||
778 | struct BigMapEntry *bme; | ||
779 | struct BigMapEntry *nxt; | ||
780 | |||
781 | nxt = me.bme; | ||
782 | while (NULL != (bme = nxt)) | ||
783 | { | ||
784 | nxt = bme->next; | ||
785 | if (0 != memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) | ||
786 | continue; | ||
787 | if ((it != NULL) && (GNUNET_OK != it (it_cls, key, bme->value))) | ||
788 | return GNUNET_SYSERR; | ||
789 | count++; | ||
790 | } | ||
791 | } | ||
792 | return count; | ||
793 | } | ||
794 | |||
795 | |||
796 | /** | ||
797 | * @ingroup hashmap | ||
798 | * Call @a it on a random value from the map, or not at all | ||
799 | * if the map is empty. Note that this function has linear | ||
800 | * complexity (in the size of the map). | ||
801 | * | ||
802 | * @param map the map | ||
803 | * @param it function to call on a random entry | ||
804 | * @param it_cls extra argument to @a it | ||
805 | * @return the number of key value pairs processed, zero or one. | ||
806 | */ | ||
807 | unsigned int | ||
808 | GNUNET_CONTAINER_multishortmap_get_random (const struct GNUNET_CONTAINER_MultiShortmap *map, | ||
809 | GNUNET_CONTAINER_ShortmapIterator it, | ||
810 | void *it_cls) | ||
811 | { | ||
812 | unsigned int off; | ||
813 | unsigned int idx; | ||
814 | union MapEntry me; | ||
815 | |||
816 | if (0 == map->size) | ||
817 | return 0; | ||
818 | if (NULL == it) | ||
819 | return 1; | ||
820 | off = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, | ||
821 | map->size); | ||
822 | for (idx = 0; idx < map->map_length; idx++) | ||
823 | { | ||
824 | me = map->map[idx]; | ||
825 | if (map->use_small_entries) | ||
826 | { | ||
827 | struct SmallMapEntry *sme; | ||
828 | struct SmallMapEntry *nxt; | ||
829 | |||
830 | nxt = me.sme; | ||
831 | while (NULL != (sme = nxt)) | ||
832 | { | ||
833 | nxt = sme->next; | ||
834 | if (0 == off) | ||
835 | { | ||
836 | if (GNUNET_OK != it (it_cls, | ||
837 | sme->key, | ||
838 | sme->value)) | ||
839 | return GNUNET_SYSERR; | ||
840 | return 1; | ||
841 | } | ||
842 | off--; | ||
843 | } | ||
844 | } | ||
845 | else | ||
846 | { | ||
847 | struct BigMapEntry *bme; | ||
848 | struct BigMapEntry *nxt; | ||
849 | |||
850 | nxt = me.bme; | ||
851 | while (NULL != (bme = nxt)) | ||
852 | { | ||
853 | nxt = bme->next; | ||
854 | if (0 == off) | ||
855 | { | ||
856 | if (GNUNET_OK != it (it_cls, | ||
857 | &bme->key, bme->value)) | ||
858 | return GNUNET_SYSERR; | ||
859 | return 1; | ||
860 | } | ||
861 | off--; | ||
862 | } | ||
863 | } | ||
864 | } | ||
865 | GNUNET_break (0); | ||
866 | return GNUNET_SYSERR; | ||
867 | } | ||
868 | |||
869 | |||
870 | /** | ||
871 | * Create an iterator for a multishortmap. | ||
872 | * The iterator can be used to retrieve all the elements in the multishortmap | ||
873 | * one by one, without having to handle all elements at once (in contrast to | ||
874 | * #GNUNET_CONTAINER_multishortmap_iterate). Note that the iterator can not be | ||
875 | * used anymore if elements have been removed from 'map' after the creation of | ||
876 | * the iterator, or 'map' has been destroyed. Adding elements to 'map' may | ||
877 | * result in skipped or repeated elements. | ||
878 | * | ||
879 | * @param map the map to create an iterator for | ||
880 | * @return an iterator over the given multishortmap 'map' | ||
881 | */ | ||
882 | struct GNUNET_CONTAINER_MultiShortmapIterator * | ||
883 | GNUNET_CONTAINER_multishortmap_iterator_create (const struct GNUNET_CONTAINER_MultiShortmap *map) | ||
884 | { | ||
885 | struct GNUNET_CONTAINER_MultiShortmapIterator *iter; | ||
886 | |||
887 | iter = GNUNET_new (struct GNUNET_CONTAINER_MultiShortmapIterator); | ||
888 | iter->map = map; | ||
889 | iter->modification_counter = map->modification_counter; | ||
890 | iter->me = map->map[0]; | ||
891 | return iter; | ||
892 | } | ||
893 | |||
894 | |||
895 | /** | ||
896 | * Retrieve the next element from the hash map at the iterator's position. | ||
897 | * If there are no elements left, GNUNET_NO is returned, and 'key' and 'value' | ||
898 | * are not modified. | ||
899 | * This operation is only allowed if no elements have been removed from the | ||
900 | * multishortmap since the creation of 'iter', and the map has not been destroyed. | ||
901 | * Adding elements may result in repeating or skipping elements. | ||
902 | * | ||
903 | * @param iter the iterator to get the next element from | ||
904 | * @param key pointer to store the key in, can be NULL | ||
905 | * @param value pointer to store the value in, can be NULL | ||
906 | * @return #GNUNET_YES we returned an element, | ||
907 | * #GNUNET_NO if we are out of elements | ||
908 | */ | ||
909 | int | ||
910 | GNUNET_CONTAINER_multishortmap_iterator_next (struct GNUNET_CONTAINER_MultiShortmapIterator *iter, | ||
911 | struct GNUNET_ShortHashCode *key, | ||
912 | const void **value) | ||
913 | { | ||
914 | /* make sure the map has not been modified */ | ||
915 | GNUNET_assert (iter->modification_counter == iter->map->modification_counter); | ||
916 | |||
917 | /* look for the next entry, skipping empty buckets */ | ||
918 | while (1) | ||
919 | { | ||
920 | if (iter->idx >= iter->map->map_length) | ||
921 | return GNUNET_NO; | ||
922 | if (GNUNET_YES == iter->map->use_small_entries) | ||
923 | { | ||
924 | if (NULL != iter->me.sme) | ||
925 | { | ||
926 | if (NULL != key) | ||
927 | *key = *iter->me.sme->key; | ||
928 | if (NULL != value) | ||
929 | *value = iter->me.sme->value; | ||
930 | iter->me.sme = iter->me.sme->next; | ||
931 | return GNUNET_YES; | ||
932 | } | ||
933 | } | ||
934 | else | ||
935 | { | ||
936 | if (NULL != iter->me.bme) | ||
937 | { | ||
938 | if (NULL != key) | ||
939 | *key = iter->me.bme->key; | ||
940 | if (NULL != value) | ||
941 | *value = iter->me.bme->value; | ||
942 | iter->me.bme = iter->me.bme->next; | ||
943 | return GNUNET_YES; | ||
944 | } | ||
945 | } | ||
946 | iter->idx += 1; | ||
947 | if (iter->idx < iter->map->map_length) | ||
948 | iter->me = iter->map->map[iter->idx]; | ||
949 | } | ||
950 | } | ||
951 | |||
952 | |||
953 | /** | ||
954 | * Destroy a multishortmap iterator. | ||
955 | * | ||
956 | * @param iter the iterator to destroy | ||
957 | */ | ||
958 | void | ||
959 | GNUNET_CONTAINER_multishortmap_iterator_destroy (struct GNUNET_CONTAINER_MultiShortmapIterator *iter) | ||
960 | { | ||
961 | GNUNET_free (iter); | ||
962 | } | ||
963 | |||
964 | |||
965 | /* end of container_multishortmap.c */ | ||
diff --git a/src/util/mq.c b/src/util/mq.c index ae13ff601..985e86331 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -58,7 +58,7 @@ struct GNUNET_MQ_Envelope | |||
58 | /** | 58 | /** |
59 | * Called after the message was sent irrevocably. | 59 | * Called after the message was sent irrevocably. |
60 | */ | 60 | */ |
61 | GNUNET_MQ_NotifyCallback sent_cb; | 61 | GNUNET_SCHEDULER_TaskCallback sent_cb; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Closure for @e send_cb | 64 | * Closure for @e send_cb |
@@ -128,10 +128,10 @@ struct GNUNET_MQ_Handle | |||
128 | void *error_handler_cls; | 128 | void *error_handler_cls; |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * Task to asynchronously run #impl_send_continue(). | 131 | * Task to asynchronously run #impl_send_continue(). |
132 | */ | 132 | */ |
133 | struct GNUNET_SCHEDULER_Task *send_task; | 133 | struct GNUNET_SCHEDULER_Task *send_task; |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Linked list of messages pending to be sent | 136 | * Linked list of messages pending to be sent |
137 | */ | 137 | */ |
@@ -414,7 +414,7 @@ static void | |||
414 | impl_send_continue (void *cls) | 414 | impl_send_continue (void *cls) |
415 | { | 415 | { |
416 | struct GNUNET_MQ_Handle *mq = cls; | 416 | struct GNUNET_MQ_Handle *mq = cls; |
417 | 417 | ||
418 | mq->send_task = NULL; | 418 | mq->send_task = NULL; |
419 | /* call is only valid if we're actually currently sending | 419 | /* call is only valid if we're actually currently sending |
420 | * a message */ | 420 | * a message */ |
@@ -441,8 +441,8 @@ void | |||
441 | GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq) | 441 | GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq) |
442 | { | 442 | { |
443 | struct GNUNET_MQ_Envelope *current_envelope; | 443 | struct GNUNET_MQ_Envelope *current_envelope; |
444 | GNUNET_MQ_NotifyCallback cb; | 444 | GNUNET_SCHEDULER_TaskCallback cb; |
445 | 445 | ||
446 | GNUNET_assert (0 < mq->queue_length); | 446 | GNUNET_assert (0 < mq->queue_length); |
447 | mq->queue_length--; | 447 | mq->queue_length--; |
448 | mq->in_flight = GNUNET_NO; | 448 | mq->in_flight = GNUNET_NO; |
@@ -456,7 +456,7 @@ GNUNET_MQ_impl_send_continue (struct GNUNET_MQ_Handle *mq) | |||
456 | { | 456 | { |
457 | current_envelope->sent_cb = NULL; | 457 | current_envelope->sent_cb = NULL; |
458 | cb (current_envelope->sent_cls); | 458 | cb (current_envelope->sent_cls); |
459 | } | 459 | } |
460 | GNUNET_free (current_envelope); | 460 | GNUNET_free (current_envelope); |
461 | } | 461 | } |
462 | 462 | ||
@@ -475,8 +475,8 @@ void | |||
475 | GNUNET_MQ_impl_send_in_flight (struct GNUNET_MQ_Handle *mq) | 475 | GNUNET_MQ_impl_send_in_flight (struct GNUNET_MQ_Handle *mq) |
476 | { | 476 | { |
477 | struct GNUNET_MQ_Envelope *current_envelope; | 477 | struct GNUNET_MQ_Envelope *current_envelope; |
478 | GNUNET_MQ_NotifyCallback cb; | 478 | GNUNET_SCHEDULER_TaskCallback cb; |
479 | 479 | ||
480 | mq->in_flight = GNUNET_YES; | 480 | mq->in_flight = GNUNET_YES; |
481 | /* call is only valid if we're actually currently sending | 481 | /* call is only valid if we're actually currently sending |
482 | * a message */ | 482 | * a message */ |
@@ -812,7 +812,7 @@ GNUNET_MQ_assoc_remove (struct GNUNET_MQ_Handle *mq, | |||
812 | */ | 812 | */ |
813 | void | 813 | void |
814 | GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *mqm, | 814 | GNUNET_MQ_notify_sent (struct GNUNET_MQ_Envelope *mqm, |
815 | GNUNET_MQ_NotifyCallback cb, | 815 | GNUNET_SCHEDULER_TaskCallback cb, |
816 | void *cb_cls) | 816 | void *cb_cls) |
817 | { | 817 | { |
818 | mqm->sent_cb = cb; | 818 | mqm->sent_cb = cb; |
@@ -953,7 +953,7 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) | |||
953 | 953 | ||
954 | GNUNET_assert (NULL != mq); | 954 | GNUNET_assert (NULL != mq); |
955 | GNUNET_assert (NULL != mq->cancel_impl); | 955 | GNUNET_assert (NULL != mq->cancel_impl); |
956 | 956 | ||
957 | mq->evacuate_called = GNUNET_NO; | 957 | mq->evacuate_called = GNUNET_NO; |
958 | 958 | ||
959 | if (mq->current_envelope == ev) | 959 | if (mq->current_envelope == ev) |
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 481e99157..fdeaed006 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -735,7 +735,7 @@ reconnect_task (void *cls) | |||
735 | return; /* no work pending */ | 735 | return; /* no work pending */ |
736 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 736 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
737 | "Trying to connect to DNS service\n"); | 737 | "Trying to connect to DNS service\n"); |
738 | mq = GNUNET_CLIENT_connecT (resolver_cfg, | 738 | mq = GNUNET_CLIENT_connect (resolver_cfg, |
739 | "resolver", | 739 | "resolver", |
740 | handlers, | 740 | handlers, |
741 | &mq_error_handler, | 741 | &mq_error_handler, |
diff --git a/src/util/test_client.c b/src/util/test_client.c index aa4d84495..f60e5b7f7 100644 --- a/src/util/test_client.c +++ b/src/util/test_client.c | |||
@@ -98,12 +98,12 @@ task (void *cls, | |||
98 | 98 | ||
99 | /* test that ill-configured client fails instantly */ | 99 | /* test that ill-configured client fails instantly */ |
100 | GNUNET_assert (NULL == | 100 | GNUNET_assert (NULL == |
101 | GNUNET_CLIENT_connecT (cfg, | 101 | GNUNET_CLIENT_connect (cfg, |
102 | "invalid-service", | 102 | "invalid-service", |
103 | NULL, | 103 | NULL, |
104 | &mq_error_handler, | 104 | &mq_error_handler, |
105 | NULL)); | 105 | NULL)); |
106 | client_mq = GNUNET_CLIENT_connecT (cfg, | 106 | client_mq = GNUNET_CLIENT_connect (cfg, |
107 | "test_client", | 107 | "test_client", |
108 | chandlers, | 108 | chandlers, |
109 | &mq_error_handler, | 109 | &mq_error_handler, |
diff --git a/src/util/test_container_heap.c b/src/util/test_container_heap.c index f115159bf..82b0e9523 100644 --- a/src/util/test_container_heap.c +++ b/src/util/test_container_heap.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | 29 | ||
30 | static int | 30 | static int |
31 | iterator_callback (void *cls, struct GNUNET_CONTAINER_HeapNode *node, | 31 | iterator_callback (void *cls, |
32 | struct GNUNET_CONTAINER_HeapNode *node, | ||
32 | void *element, GNUNET_CONTAINER_HeapCostType cost) | 33 | void *element, GNUNET_CONTAINER_HeapCostType cost) |
33 | { | 34 | { |
34 | return GNUNET_OK; | 35 | return GNUNET_OK; |
@@ -93,12 +94,12 @@ check () | |||
93 | GNUNET_CONTAINER_heap_iterate (myHeap, &iterator_callback, NULL); | 94 | GNUNET_CONTAINER_heap_iterate (myHeap, &iterator_callback, NULL); |
94 | 95 | ||
95 | n3 = GNUNET_CONTAINER_heap_insert (myHeap, "15", 5); | 96 | n3 = GNUNET_CONTAINER_heap_insert (myHeap, "15", 5); |
96 | GNUNET_CONTAINER_heap_update_cost (myHeap, n3, 15); | 97 | GNUNET_CONTAINER_heap_update_cost (n3, 15); |
97 | GNUNET_assert (2 == GNUNET_CONTAINER_heap_get_size (myHeap)); | 98 | GNUNET_assert (2 == GNUNET_CONTAINER_heap_get_size (myHeap)); |
98 | GNUNET_CONTAINER_heap_iterate (myHeap, &iterator_callback, NULL); | 99 | GNUNET_CONTAINER_heap_iterate (myHeap, &iterator_callback, NULL); |
99 | 100 | ||
100 | n4 = GNUNET_CONTAINER_heap_insert (myHeap, "50", 50); | 101 | n4 = GNUNET_CONTAINER_heap_insert (myHeap, "50", 50); |
101 | GNUNET_CONTAINER_heap_update_cost (myHeap, n4, 50); | 102 | GNUNET_CONTAINER_heap_update_cost (n4, 50); |
102 | GNUNET_assert (3 == GNUNET_CONTAINER_heap_get_size (myHeap)); | 103 | GNUNET_assert (3 == GNUNET_CONTAINER_heap_get_size (myHeap)); |
103 | GNUNET_CONTAINER_heap_iterate (myHeap, &iterator_callback, NULL); | 104 | GNUNET_CONTAINER_heap_iterate (myHeap, &iterator_callback, NULL); |
104 | 105 | ||
@@ -109,7 +110,7 @@ check () | |||
109 | r = GNUNET_CONTAINER_heap_remove_root (myHeap); /* n1 */ | 110 | r = GNUNET_CONTAINER_heap_remove_root (myHeap); /* n1 */ |
110 | GNUNET_assert (NULL != r); | 111 | GNUNET_assert (NULL != r); |
111 | GNUNET_assert (0 == strcmp ("11", r)); | 112 | GNUNET_assert (0 == strcmp ("11", r)); |
112 | GNUNET_CONTAINER_heap_update_cost (myHeap, n6, 200); | 113 | GNUNET_CONTAINER_heap_update_cost (n6, 200); |
113 | GNUNET_CONTAINER_heap_remove_node (n3); | 114 | GNUNET_CONTAINER_heap_remove_node (n3); |
114 | r = GNUNET_CONTAINER_heap_remove_root (myHeap); /* n4 */ | 115 | r = GNUNET_CONTAINER_heap_remove_root (myHeap); /* n4 */ |
115 | GNUNET_assert (NULL != r); | 116 | GNUNET_assert (NULL != r); |
@@ -128,7 +129,7 @@ check () | |||
128 | myHeap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 129 | myHeap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
129 | 130 | ||
130 | n1 = GNUNET_CONTAINER_heap_insert (myHeap, "10", 10); | 131 | n1 = GNUNET_CONTAINER_heap_insert (myHeap, "10", 10); |
131 | GNUNET_CONTAINER_heap_update_cost (myHeap, n1, 15); | 132 | GNUNET_CONTAINER_heap_update_cost (n1, 15); |
132 | 133 | ||
133 | r = GNUNET_CONTAINER_heap_remove_node (n1); | 134 | r = GNUNET_CONTAINER_heap_remove_node (n1); |
134 | GNUNET_assert (NULL != r); | 135 | GNUNET_assert (NULL != r); |
@@ -213,7 +214,7 @@ check () | |||
213 | myHeap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX); | 214 | myHeap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX); |
214 | 215 | ||
215 | n1 = GNUNET_CONTAINER_heap_insert (myHeap, "10", 10); | 216 | n1 = GNUNET_CONTAINER_heap_insert (myHeap, "10", 10); |
216 | GNUNET_CONTAINER_heap_update_cost (myHeap, n1, 15); | 217 | GNUNET_CONTAINER_heap_update_cost (n1, 15); |
217 | 218 | ||
218 | GNUNET_assert (0 == nstrcmp ("10", GNUNET_CONTAINER_heap_remove_node (n1))); | 219 | GNUNET_assert (0 == nstrcmp ("10", GNUNET_CONTAINER_heap_remove_node (n1))); |
219 | 220 | ||
diff --git a/src/util/test_server.c b/src/util/test_server.c index eac45fc69..8003adbf4 100644 --- a/src/util/test_server.c +++ b/src/util/test_server.c | |||
@@ -267,7 +267,7 @@ task (void *cls) | |||
267 | "resolver", | 267 | "resolver", |
268 | "HOSTNAME", | 268 | "HOSTNAME", |
269 | "localhost"); | 269 | "localhost"); |
270 | mq = GNUNET_CLIENT_connecT (cfg, | 270 | mq = GNUNET_CLIENT_connect (cfg, |
271 | "test-server", | 271 | "test-server", |
272 | chandlers, | 272 | chandlers, |
273 | &mq_error_handler, | 273 | &mq_error_handler, |
diff --git a/src/util/test_server_disconnect.c b/src/util/test_server_disconnect.c index de9c4722d..c3d003e90 100644 --- a/src/util/test_server_disconnect.c +++ b/src/util/test_server_disconnect.c | |||
@@ -125,7 +125,7 @@ task (void *cls) | |||
125 | "localhost"); | 125 | "localhost"); |
126 | GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME", | 126 | GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME", |
127 | "localhost"); | 127 | "localhost"); |
128 | mq = GNUNET_CLIENT_connecT (cfg, | 128 | mq = GNUNET_CLIENT_connect (cfg, |
129 | "test-server", | 129 | "test-server", |
130 | NULL, | 130 | NULL, |
131 | NULL, | 131 | NULL, |
diff --git a/src/util/test_server_with_client.c b/src/util/test_server_with_client.c index 59f9b6afd..63bfda00c 100644 --- a/src/util/test_server_with_client.c +++ b/src/util/test_server_with_client.c | |||
@@ -166,7 +166,7 @@ task (void *cls) | |||
166 | GNUNET_CONFIGURATION_set_value_string (cfg, "test", "HOSTNAME", "localhost"); | 166 | GNUNET_CONFIGURATION_set_value_string (cfg, "test", "HOSTNAME", "localhost"); |
167 | GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME", | 167 | GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME", |
168 | "localhost"); | 168 | "localhost"); |
169 | mq = GNUNET_CLIENT_connecT (cfg, | 169 | mq = GNUNET_CLIENT_connect (cfg, |
170 | "test", | 170 | "test", |
171 | NULL, | 171 | NULL, |
172 | NULL, | 172 | NULL, |
diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c index ef48aabce..d240f1a88 100644 --- a/src/util/test_server_with_client_unix.c +++ b/src/util/test_server_with_client_unix.c | |||
@@ -144,7 +144,7 @@ task (void *cls) | |||
144 | GNUNET_CONFIGURATION_set_value_string (cfg, "test", "UNIXPATH", unixpath); | 144 | GNUNET_CONFIGURATION_set_value_string (cfg, "test", "UNIXPATH", unixpath); |
145 | GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME", | 145 | GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME", |
146 | "localhost"); | 146 | "localhost"); |
147 | mq = GNUNET_CLIENT_connecT (cfg, | 147 | mq = GNUNET_CLIENT_connect (cfg, |
148 | "test", | 148 | "test", |
149 | NULL, | 149 | NULL, |
150 | NULL, | 150 | NULL, |
diff --git a/src/util/test_service.c b/src/util/test_service.c index dc9d16ed9..d2136b42f 100644 --- a/src/util/test_service.c +++ b/src/util/test_service.c | |||
@@ -107,7 +107,7 @@ service_init (void *cls, | |||
107 | struct GNUNET_MQ_Envelope *env; | 107 | struct GNUNET_MQ_Envelope *env; |
108 | struct GNUNET_MessageHeader *msg; | 108 | struct GNUNET_MessageHeader *msg; |
109 | 109 | ||
110 | mq = GNUNET_CLIENT_connecT (cfg, | 110 | mq = GNUNET_CLIENT_connect (cfg, |
111 | service_name, | 111 | service_name, |
112 | NULL, | 112 | NULL, |
113 | NULL, | 113 | NULL, |
diff --git a/src/util/test_socks.c b/src/util/test_socks.c index 416f32f62..cb70f916f 100644 --- a/src/util/test_socks.c +++ b/src/util/test_socks.c | |||
@@ -160,7 +160,7 @@ task (void *cls) | |||
160 | handlers[0].callback_cls = cls; | 160 | handlers[0].callback_cls = cls; |
161 | handlers[1].callback_cls = cls; | 161 | handlers[1].callback_cls = cls; |
162 | GNUNET_SERVER_add_handlers (server, handlers); | 162 | GNUNET_SERVER_add_handlers (server, handlers); |
163 | mq = GNUNET_CLIENT_connecT (cfg, | 163 | mq = GNUNET_CLIENT_connect (cfg, |
164 | MYNAME, | 164 | MYNAME, |
165 | chandlers, | 165 | chandlers, |
166 | &mq_error_handler, | 166 | &mq_error_handler, |
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index 4c0978d5c..c66023c85 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -1129,8 +1129,7 @@ route_packet (struct DestinationEntry *destination, | |||
1129 | } | 1129 | } |
1130 | else | 1130 | else |
1131 | { | 1131 | { |
1132 | GNUNET_CONTAINER_heap_update_cost (channel_heap, | 1132 | GNUNET_CONTAINER_heap_update_cost (ts->heap_node, |
1133 | ts->heap_node, | ||
1134 | GNUNET_TIME_absolute_get ().abs_value_us); | 1133 | GNUNET_TIME_absolute_get ().abs_value_us); |
1135 | } | 1134 | } |
1136 | if (NULL == ts->channel) | 1135 | if (NULL == ts->channel) |
@@ -2062,8 +2061,7 @@ receive_icmp_back (void *cls, | |||
2062 | default: | 2061 | default: |
2063 | GNUNET_assert (0); | 2062 | GNUNET_assert (0); |
2064 | } | 2063 | } |
2065 | GNUNET_CONTAINER_heap_update_cost (channel_heap, | 2064 | GNUNET_CONTAINER_heap_update_cost (ts->heap_node, |
2066 | ts->heap_node, | ||
2067 | GNUNET_TIME_absolute_get ().abs_value_us); | 2065 | GNUNET_TIME_absolute_get ().abs_value_us); |
2068 | GNUNET_CADET_receive_done (channel); | 2066 | GNUNET_CADET_receive_done (channel); |
2069 | return GNUNET_OK; | 2067 | return GNUNET_OK; |
@@ -2218,8 +2216,7 @@ receive_udp_back (void *cls, | |||
2218 | default: | 2216 | default: |
2219 | GNUNET_assert (0); | 2217 | GNUNET_assert (0); |
2220 | } | 2218 | } |
2221 | GNUNET_CONTAINER_heap_update_cost (channel_heap, | 2219 | GNUNET_CONTAINER_heap_update_cost (ts->heap_node, |
2222 | ts->heap_node, | ||
2223 | GNUNET_TIME_absolute_get ().abs_value_us); | 2220 | GNUNET_TIME_absolute_get ().abs_value_us); |
2224 | GNUNET_CADET_receive_done (channel); | 2221 | GNUNET_CADET_receive_done (channel); |
2225 | return GNUNET_OK; | 2222 | return GNUNET_OK; |
@@ -2361,8 +2358,7 @@ receive_tcp_back (void *cls, | |||
2361 | } | 2358 | } |
2362 | break; | 2359 | break; |
2363 | } | 2360 | } |
2364 | GNUNET_CONTAINER_heap_update_cost (channel_heap, | 2361 | GNUNET_CONTAINER_heap_update_cost (ts->heap_node, |
2365 | ts->heap_node, | ||
2366 | GNUNET_TIME_absolute_get ().abs_value_us); | 2362 | GNUNET_TIME_absolute_get ().abs_value_us); |
2367 | GNUNET_CADET_receive_done (channel); | 2363 | GNUNET_CADET_receive_done (channel); |
2368 | return GNUNET_OK; | 2364 | return GNUNET_OK; |
diff --git a/src/vpn/vpn.conf.in b/src/vpn/vpn.conf.in index 000300084..585131554 100644 --- a/src/vpn/vpn.conf.in +++ b/src/vpn/vpn.conf.in | |||
@@ -6,7 +6,7 @@ BINARY = gnunet-service-vpn | |||
6 | ACCEPT_FROM = 127.0.0.1; | 6 | ACCEPT_FROM = 127.0.0.1; |
7 | ACCEPT_FROM6 = ::1; | 7 | ACCEPT_FROM6 = ::1; |
8 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn.sock | 8 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-vpn.sock |
9 | UNIX_MATCH_UID = YES | 9 | UNIX_MATCH_UID = NO |
10 | UNIX_MATCH_GID = YES | 10 | UNIX_MATCH_GID = YES |
11 | 11 | ||
12 | IPV6ADDR = 1234::1 | 12 | IPV6ADDR = 1234::1 |
diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c index 4add41ce4..bc77865a8 100644 --- a/src/vpn/vpn_api.c +++ b/src/vpn/vpn_api.c | |||
@@ -324,7 +324,7 @@ connect_task (void *cls) | |||
324 | struct GNUNET_VPN_RedirectionRequest *rr; | 324 | struct GNUNET_VPN_RedirectionRequest *rr; |
325 | 325 | ||
326 | vh->rt = NULL; | 326 | vh->rt = NULL; |
327 | vh->mq = GNUNET_CLIENT_connecT (vh->cfg, | 327 | vh->mq = GNUNET_CLIENT_connect (vh->cfg, |
328 | "vpn", | 328 | "vpn", |
329 | handlers, | 329 | handlers, |
330 | &mq_error_handler, | 330 | &mq_error_handler, |
diff --git a/src/zonemaster/.gitignore b/src/zonemaster/.gitignore new file mode 100644 index 000000000..1a0e22b66 --- /dev/null +++ b/src/zonemaster/.gitignore | |||
@@ -0,0 +1 @@ | |||
gnunet-service-zonemaster | |||
diff --git a/src/zonemaster/Makefile.am b/src/zonemaster/Makefile.am new file mode 100644 index 000000000..21f986498 --- /dev/null +++ b/src/zonemaster/Makefile.am | |||
@@ -0,0 +1,35 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | libexecdir= $(pkglibdir)/libexec/ | ||
9 | |||
10 | pkgcfg_DATA = \ | ||
11 | zonemaster.conf | ||
12 | |||
13 | if MINGW | ||
14 | WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols | ||
15 | endif | ||
16 | |||
17 | if USE_COVERAGE | ||
18 | AM_CFLAGS = --coverage -O0 | ||
19 | XLIBS = -lgcov | ||
20 | endif | ||
21 | |||
22 | libexec_PROGRAMS = \ | ||
23 | gnunet-service-zonemaster | ||
24 | |||
25 | gnunet_service_zonemaster_SOURCES = \ | ||
26 | gnunet-service-zonemaster.c | ||
27 | |||
28 | gnunet_service_zonemaster_LDADD = \ | ||
29 | $(top_builddir)/src/dht/libgnunetdht.la \ | ||
30 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | ||
31 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | ||
32 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
33 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ | ||
34 | $(GN_LIBINTL) | ||
35 | |||
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c new file mode 100644 index 000000000..08a09de34 --- /dev/null +++ b/src/zonemaster/gnunet-service-zonemaster.c | |||
@@ -0,0 +1,776 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2012, 2013, 2014, 2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file zonemaster/gnunet-service-zonemaster.c | ||
23 | * @brief publish records from namestore to GNUnet name system | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_dnsparser_lib.h" | ||
29 | #include "gnunet_dht_service.h" | ||
30 | #include "gnunet_namestore_service.h" | ||
31 | #include "gnunet_statistics_service.h" | ||
32 | #include "gnunet_namestore_plugin.h" | ||
33 | #include "gnunet_signatures.h" | ||
34 | |||
35 | |||
36 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | ||
37 | |||
38 | |||
39 | |||
40 | /** | ||
41 | * The initial interval in milliseconds btween puts in | ||
42 | * a zone iteration | ||
43 | */ | ||
44 | #define INITIAL_PUT_INTERVAL GNUNET_TIME_UNIT_MILLISECONDS | ||
45 | |||
46 | /** | ||
47 | * The lower bound for the zone iteration interval | ||
48 | */ | ||
49 | #define MINIMUM_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_SECONDS | ||
50 | |||
51 | /** | ||
52 | * The upper bound for the zone iteration interval | ||
53 | */ | ||
54 | #define MAXIMUM_ZONE_ITERATION_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | ||
55 | |||
56 | /** | ||
57 | * The default put interval for the zone iteration. In case | ||
58 | * no option is found | ||
59 | */ | ||
60 | #define DEFAULT_ZONE_PUBLISH_TIME_WINDOW GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) | ||
61 | |||
62 | /** | ||
63 | * The factor the current zone iteration interval is divided by for each | ||
64 | * additional new record | ||
65 | */ | ||
66 | #define LATE_ITERATION_SPEEDUP_FACTOR 2 | ||
67 | |||
68 | /** | ||
69 | * How long until a DHT PUT attempt should time out? | ||
70 | */ | ||
71 | #define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | ||
72 | |||
73 | /** | ||
74 | * What replication level do we use for DHT PUT operations? | ||
75 | */ | ||
76 | #define DHT_GNS_REPLICATION_LEVEL 5 | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Handle for DHT PUT activity triggered from the namestore monitor. | ||
81 | */ | ||
82 | struct MonitorActivity | ||
83 | { | ||
84 | /** | ||
85 | * Kept in a DLL. | ||
86 | */ | ||
87 | struct MonitorActivity *next; | ||
88 | |||
89 | /** | ||
90 | * Kept in a DLL. | ||
91 | */ | ||
92 | struct MonitorActivity *prev; | ||
93 | |||
94 | /** | ||
95 | * Handle for the DHT PUT operation. | ||
96 | */ | ||
97 | struct GNUNET_DHT_PutHandle *ph; | ||
98 | }; | ||
99 | |||
100 | |||
101 | /** | ||
102 | * Handle to the statistics service | ||
103 | */ | ||
104 | static struct GNUNET_STATISTICS_Handle *statistics; | ||
105 | |||
106 | /** | ||
107 | * Our handle to the DHT | ||
108 | */ | ||
109 | static struct GNUNET_DHT_Handle *dht_handle; | ||
110 | |||
111 | /** | ||
112 | * Active DHT put operation (or NULL) | ||
113 | */ | ||
114 | static struct GNUNET_DHT_PutHandle *active_put; | ||
115 | |||
116 | /** | ||
117 | * Our handle to the namestore service | ||
118 | */ | ||
119 | static struct GNUNET_NAMESTORE_Handle *namestore_handle; | ||
120 | |||
121 | /** | ||
122 | * Handle to iterate over our authoritative zone in namestore | ||
123 | */ | ||
124 | static struct GNUNET_NAMESTORE_ZoneIterator *namestore_iter; | ||
125 | |||
126 | /** | ||
127 | * Handle to monitor namestore changes to instant propagation. | ||
128 | */ | ||
129 | static struct GNUNET_NAMESTORE_ZoneMonitor *zmon; | ||
130 | |||
131 | /** | ||
132 | * Head of monitor activities; kept in a DLL. | ||
133 | */ | ||
134 | static struct MonitorActivity *ma_head; | ||
135 | |||
136 | /** | ||
137 | * Tail of monitor activities; kept in a DLL. | ||
138 | */ | ||
139 | static struct MonitorActivity *ma_tail; | ||
140 | |||
141 | /** | ||
142 | * Useful for zone update for DHT put | ||
143 | */ | ||
144 | static unsigned long long num_public_records; | ||
145 | |||
146 | /** | ||
147 | * Last seen record count | ||
148 | */ | ||
149 | static unsigned long long last_num_public_records; | ||
150 | |||
151 | /** | ||
152 | * Minimum relative expiration time of records seem during the current | ||
153 | * zone iteration. | ||
154 | */ | ||
155 | static struct GNUNET_TIME_Relative min_relative_record_time; | ||
156 | |||
157 | /** | ||
158 | * Zone iteration PUT interval. | ||
159 | */ | ||
160 | static struct GNUNET_TIME_Relative put_interval; | ||
161 | |||
162 | /** | ||
163 | * Default time window for zone iteration | ||
164 | */ | ||
165 | static struct GNUNET_TIME_Relative zone_publish_time_window_default; | ||
166 | |||
167 | /** | ||
168 | * Time window for zone iteration, adjusted based on relative record | ||
169 | * expiration times in our zone. | ||
170 | */ | ||
171 | static struct GNUNET_TIME_Relative zone_publish_time_window; | ||
172 | |||
173 | /** | ||
174 | * zone publish task | ||
175 | */ | ||
176 | static struct GNUNET_SCHEDULER_Task *zone_publish_task; | ||
177 | |||
178 | /** | ||
179 | * #GNUNET_YES if zone has never been published before | ||
180 | */ | ||
181 | static int first_zone_iteration; | ||
182 | |||
183 | /** | ||
184 | * Task run during shutdown. | ||
185 | * | ||
186 | * @param cls unused | ||
187 | * @param tc unused | ||
188 | */ | ||
189 | static void | ||
190 | shutdown_task (void *cls) | ||
191 | { | ||
192 | struct MonitorActivity *ma; | ||
193 | |||
194 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
195 | "Shutting down!\n"); | ||
196 | while (NULL != (ma = ma_head)) | ||
197 | { | ||
198 | GNUNET_DHT_put_cancel (ma->ph); | ||
199 | GNUNET_CONTAINER_DLL_remove (ma_head, | ||
200 | ma_tail, | ||
201 | ma); | ||
202 | GNUNET_free (ma); | ||
203 | } | ||
204 | if (NULL != statistics) | ||
205 | { | ||
206 | GNUNET_STATISTICS_destroy (statistics, | ||
207 | GNUNET_NO); | ||
208 | statistics = NULL; | ||
209 | } | ||
210 | if (NULL != zone_publish_task) | ||
211 | { | ||
212 | GNUNET_SCHEDULER_cancel (zone_publish_task); | ||
213 | zone_publish_task = NULL; | ||
214 | } | ||
215 | if (NULL != namestore_iter) | ||
216 | { | ||
217 | GNUNET_NAMESTORE_zone_iteration_stop (namestore_iter); | ||
218 | namestore_iter = NULL; | ||
219 | } | ||
220 | if (NULL != zmon) | ||
221 | { | ||
222 | GNUNET_NAMESTORE_zone_monitor_stop (zmon); | ||
223 | zmon = NULL; | ||
224 | } | ||
225 | if (NULL != namestore_handle) | ||
226 | { | ||
227 | GNUNET_NAMESTORE_disconnect (namestore_handle); | ||
228 | namestore_handle = NULL; | ||
229 | } | ||
230 | if (NULL != active_put) | ||
231 | { | ||
232 | GNUNET_DHT_put_cancel (active_put); | ||
233 | active_put = NULL; | ||
234 | } | ||
235 | if (NULL != dht_handle) | ||
236 | { | ||
237 | GNUNET_DHT_disconnect (dht_handle); | ||
238 | dht_handle = NULL; | ||
239 | } | ||
240 | } | ||
241 | |||
242 | |||
243 | /** | ||
244 | * Method called periodically that triggers iteration over authoritative records | ||
245 | * | ||
246 | * @param cls closure | ||
247 | */ | ||
248 | static void | ||
249 | publish_zone_dht_next (void *cls) | ||
250 | { | ||
251 | zone_publish_task = NULL; | ||
252 | GNUNET_assert (NULL != namestore_iter); | ||
253 | GNUNET_NAMESTORE_zone_iterator_next (namestore_iter); | ||
254 | } | ||
255 | |||
256 | |||
257 | /** | ||
258 | * Periodically iterate over our zone and store everything in dht | ||
259 | * | ||
260 | * @param cls NULL | ||
261 | */ | ||
262 | static void | ||
263 | publish_zone_dht_start (void *cls); | ||
264 | |||
265 | |||
266 | /** | ||
267 | * Continuation called from DHT once the PUT operation is done. | ||
268 | * | ||
269 | * @param cls closure, NULL if called from regular iteration, | ||
270 | * `struct MonitorActivity` if called from #handle_monitor_event. | ||
271 | * @param success #GNUNET_OK on success | ||
272 | */ | ||
273 | static void | ||
274 | dht_put_continuation (void *cls, | ||
275 | int success) | ||
276 | { | ||
277 | struct MonitorActivity *ma = cls; | ||
278 | struct GNUNET_TIME_Relative next_put_interval; | ||
279 | |||
280 | num_public_records++; | ||
281 | if (NULL == ma) | ||
282 | { | ||
283 | active_put = NULL; | ||
284 | if ( (num_public_records > last_num_public_records) && | ||
285 | (GNUNET_NO == first_zone_iteration) ) | ||
286 | { | ||
287 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
288 | "Last record count was lower than current record count. Reducing interval.\n"); | ||
289 | put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, | ||
290 | num_public_records); | ||
291 | next_put_interval = GNUNET_TIME_relative_divide (put_interval, | ||
292 | LATE_ITERATION_SPEEDUP_FACTOR); | ||
293 | } | ||
294 | else | ||
295 | next_put_interval = put_interval; | ||
296 | next_put_interval = GNUNET_TIME_relative_min (next_put_interval, | ||
297 | MAXIMUM_ZONE_ITERATION_INTERVAL); | ||
298 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
299 | "PUT complete, next PUT in %s!\n", | ||
300 | GNUNET_STRINGS_relative_time_to_string (next_put_interval, | ||
301 | GNUNET_YES)); | ||
302 | |||
303 | GNUNET_STATISTICS_set (statistics, | ||
304 | "Current zone iteration interval (ms)", | ||
305 | next_put_interval.rel_value_us / 1000LL, | ||
306 | GNUNET_NO); | ||
307 | GNUNET_assert (NULL == zone_publish_task); | ||
308 | zone_publish_task = GNUNET_SCHEDULER_add_delayed (next_put_interval, | ||
309 | &publish_zone_dht_next, | ||
310 | NULL); | ||
311 | } | ||
312 | else | ||
313 | { | ||
314 | GNUNET_CONTAINER_DLL_remove (ma_head, | ||
315 | ma_tail, | ||
316 | ma); | ||
317 | GNUNET_free (ma); | ||
318 | } | ||
319 | } | ||
320 | |||
321 | |||
322 | /** | ||
323 | * Convert namestore records from the internal format to that | ||
324 | * suitable for publication (removes private records, converts | ||
325 | * to absolute expiration time). | ||
326 | * | ||
327 | * @param rd input records | ||
328 | * @param rd_count size of the @a rd and @a rd_public arrays | ||
329 | * @param rd_public where to write the converted records | ||
330 | * @return number of records written to @a rd_public | ||
331 | */ | ||
332 | static unsigned int | ||
333 | convert_records_for_export (const struct GNUNET_GNSRECORD_Data *rd, | ||
334 | unsigned int rd_count, | ||
335 | struct GNUNET_GNSRECORD_Data *rd_public) | ||
336 | { | ||
337 | struct GNUNET_TIME_Absolute now; | ||
338 | unsigned int rd_public_count; | ||
339 | unsigned int i; | ||
340 | |||
341 | rd_public_count = 0; | ||
342 | now = GNUNET_TIME_absolute_get (); | ||
343 | for (i=0;i<rd_count;i++) | ||
344 | if (0 == (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE)) | ||
345 | { | ||
346 | rd_public[rd_public_count] = rd[i]; | ||
347 | if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | ||
348 | { | ||
349 | /* GNUNET_GNSRECORD_block_create will convert to absolute time; | ||
350 | we just need to adjust our iteration frequency */ | ||
351 | min_relative_record_time.rel_value_us = | ||
352 | GNUNET_MIN (rd_public[rd_public_count].expiration_time, | ||
353 | min_relative_record_time.rel_value_us); | ||
354 | } | ||
355 | else if (rd_public[rd_public_count].expiration_time < now.abs_value_us) | ||
356 | { | ||
357 | /* record already expired, skip it */ | ||
358 | continue; | ||
359 | } | ||
360 | rd_public_count++; | ||
361 | } | ||
362 | return rd_public_count; | ||
363 | } | ||
364 | |||
365 | |||
366 | /** | ||
367 | * Store GNS records in the DHT. | ||
368 | * | ||
369 | * @param key key of the zone | ||
370 | * @param label label to store under | ||
371 | * @param rd_public public record data | ||
372 | * @param rd_public_count number of records in @a rd_public | ||
373 | * @param pc_arg closure argument to pass to the #dht_put_continuation | ||
374 | * @return DHT PUT handle, NULL on error | ||
375 | */ | ||
376 | static struct GNUNET_DHT_PutHandle * | ||
377 | perform_dht_put (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | ||
378 | const char *label, | ||
379 | const struct GNUNET_GNSRECORD_Data *rd_public, | ||
380 | unsigned int rd_public_count, | ||
381 | void *pc_arg) | ||
382 | { | ||
383 | struct GNUNET_GNSRECORD_Block *block; | ||
384 | struct GNUNET_HashCode query; | ||
385 | struct GNUNET_TIME_Absolute expire; | ||
386 | size_t block_size; | ||
387 | struct GNUNET_DHT_PutHandle *ret; | ||
388 | |||
389 | expire = GNUNET_GNSRECORD_record_get_expiration_time (rd_public_count, | ||
390 | rd_public); | ||
391 | block = GNUNET_GNSRECORD_block_create (key, | ||
392 | expire, | ||
393 | label, | ||
394 | rd_public, | ||
395 | rd_public_count); | ||
396 | if (NULL == block) | ||
397 | return NULL; /* whoops */ | ||
398 | block_size = ntohl (block->purpose.size) | ||
399 | + sizeof (struct GNUNET_CRYPTO_EcdsaSignature) | ||
400 | + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); | ||
401 | GNUNET_GNSRECORD_query_from_private_key (key, | ||
402 | label, | ||
403 | &query); | ||
404 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
405 | "Storing %u record(s) for label `%s' in DHT with expiration `%s' under key %s\n", | ||
406 | rd_public_count, | ||
407 | label, | ||
408 | GNUNET_STRINGS_absolute_time_to_string (expire), | ||
409 | GNUNET_h2s (&query)); | ||
410 | ret = GNUNET_DHT_put (dht_handle, | ||
411 | &query, | ||
412 | DHT_GNS_REPLICATION_LEVEL, | ||
413 | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, | ||
414 | GNUNET_BLOCK_TYPE_GNS_NAMERECORD, | ||
415 | block_size, | ||
416 | block, | ||
417 | expire, | ||
418 | &dht_put_continuation, | ||
419 | pc_arg); | ||
420 | GNUNET_free (block); | ||
421 | return ret; | ||
422 | } | ||
423 | |||
424 | |||
425 | /** | ||
426 | * We encountered an error in our zone iteration. | ||
427 | */ | ||
428 | static void | ||
429 | zone_iteration_error (void *cls) | ||
430 | { | ||
431 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
432 | "Got disconnected from namestore database, retrying.\n"); | ||
433 | namestore_iter = NULL; | ||
434 | /* We end up here on error/disconnect/shutdown, so potentially | ||
435 | while a zone publish task or a DHT put is still running; hence | ||
436 | we need to cancel those. */ | ||
437 | if (NULL != zone_publish_task) | ||
438 | { | ||
439 | GNUNET_SCHEDULER_cancel (zone_publish_task); | ||
440 | zone_publish_task = NULL; | ||
441 | } | ||
442 | if (NULL != active_put) | ||
443 | { | ||
444 | GNUNET_DHT_put_cancel (active_put); | ||
445 | active_put = NULL; | ||
446 | } | ||
447 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | ||
448 | NULL); | ||
449 | } | ||
450 | |||
451 | |||
452 | /** | ||
453 | * Zone iteration is completed. | ||
454 | */ | ||
455 | static void | ||
456 | zone_iteration_finished (void *cls) | ||
457 | { | ||
458 | /* we're done with one iteration, calculate when to do the next one */ | ||
459 | namestore_iter = NULL; | ||
460 | last_num_public_records = num_public_records; | ||
461 | first_zone_iteration = GNUNET_NO; | ||
462 | if (0 == num_public_records) | ||
463 | { | ||
464 | /** | ||
465 | * If no records are known (startup) or none present | ||
466 | * we can safely set the interval to the value for a single | ||
467 | * record | ||
468 | */ | ||
469 | put_interval = zone_publish_time_window; | ||
470 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | ||
471 | "No records in namestore database.\n"); | ||
472 | } | ||
473 | else | ||
474 | { | ||
475 | /* If records are present, next publication is based on the minimum | ||
476 | * relative expiration time of the records published divided by 4 | ||
477 | */ | ||
478 | zone_publish_time_window | ||
479 | = GNUNET_TIME_relative_min (GNUNET_TIME_relative_divide (min_relative_record_time, 4), | ||
480 | zone_publish_time_window_default); | ||
481 | put_interval = GNUNET_TIME_relative_divide (zone_publish_time_window, | ||
482 | num_public_records); | ||
483 | } | ||
484 | /* reset for next iteration */ | ||
485 | min_relative_record_time = GNUNET_TIME_UNIT_FOREVER_REL; | ||
486 | put_interval = GNUNET_TIME_relative_max (MINIMUM_ZONE_ITERATION_INTERVAL, | ||
487 | put_interval); | ||
488 | put_interval = GNUNET_TIME_relative_min (put_interval, | ||
489 | MAXIMUM_ZONE_ITERATION_INTERVAL); | ||
490 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
491 | "Zone iteration finished. Adjusted zone iteration interval to %s\n", | ||
492 | GNUNET_STRINGS_relative_time_to_string (put_interval, | ||
493 | GNUNET_YES)); | ||
494 | GNUNET_STATISTICS_set (statistics, | ||
495 | "Current zone iteration interval (in ms)", | ||
496 | put_interval.rel_value_us / 1000LL, | ||
497 | GNUNET_NO); | ||
498 | GNUNET_STATISTICS_update (statistics, | ||
499 | "Number of zone iterations", | ||
500 | 1, | ||
501 | GNUNET_NO); | ||
502 | GNUNET_STATISTICS_set (statistics, | ||
503 | "Number of public records in DHT", | ||
504 | last_num_public_records, | ||
505 | GNUNET_NO); | ||
506 | GNUNET_assert (NULL == zone_publish_task); | ||
507 | if (0 == num_public_records) | ||
508 | zone_publish_task = GNUNET_SCHEDULER_add_delayed (put_interval, | ||
509 | &publish_zone_dht_start, | ||
510 | NULL); | ||
511 | else | ||
512 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | ||
513 | NULL); | ||
514 | } | ||
515 | |||
516 | |||
517 | /** | ||
518 | * Function used to put all records successively into the DHT. | ||
519 | * | ||
520 | * @param cls the closure (NULL) | ||
521 | * @param key the private key of the authority (ours) | ||
522 | * @param label the name of the records, NULL once the iteration is done | ||
523 | * @param rd_count the number of records in @a rd | ||
524 | * @param rd the record data | ||
525 | */ | ||
526 | static void | ||
527 | put_gns_record (void *cls, | ||
528 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | ||
529 | const char *label, | ||
530 | unsigned int rd_count, | ||
531 | const struct GNUNET_GNSRECORD_Data *rd) | ||
532 | { | ||
533 | struct GNUNET_GNSRECORD_Data rd_public[rd_count]; | ||
534 | unsigned int rd_public_count; | ||
535 | |||
536 | rd_public_count = convert_records_for_export (rd, | ||
537 | rd_count, | ||
538 | rd_public); | ||
539 | |||
540 | if (0 == rd_public_count) | ||
541 | { | ||
542 | GNUNET_assert (NULL == zone_publish_task); | ||
543 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
544 | "Record set empty, moving to next record set\n"); | ||
545 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_next, | ||
546 | NULL); | ||
547 | return; | ||
548 | } | ||
549 | /* We got a set of records to publish */ | ||
550 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
551 | "Starting DHT PUT\n"); | ||
552 | active_put = perform_dht_put (key, | ||
553 | label, | ||
554 | rd_public, | ||
555 | rd_public_count, | ||
556 | NULL); | ||
557 | if (NULL == active_put) | ||
558 | { | ||
559 | GNUNET_break (0); | ||
560 | dht_put_continuation (NULL, GNUNET_NO); | ||
561 | } | ||
562 | } | ||
563 | |||
564 | |||
565 | /** | ||
566 | * Periodically iterate over all zones and store everything in DHT | ||
567 | * | ||
568 | * @param cls NULL | ||
569 | */ | ||
570 | static void | ||
571 | publish_zone_dht_start (void *cls) | ||
572 | { | ||
573 | zone_publish_task = NULL; | ||
574 | |||
575 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
576 | "Starting DHT zone update!\n"); | ||
577 | /* start counting again */ | ||
578 | num_public_records = 0; | ||
579 | GNUNET_assert (NULL == namestore_iter); | ||
580 | namestore_iter | ||
581 | = GNUNET_NAMESTORE_zone_iteration_start (namestore_handle, | ||
582 | NULL, /* All zones */ | ||
583 | &zone_iteration_error, | ||
584 | NULL, | ||
585 | &put_gns_record, | ||
586 | NULL, | ||
587 | &zone_iteration_finished, | ||
588 | NULL); | ||
589 | } | ||
590 | |||
591 | |||
592 | /** | ||
593 | * Process a record that was stored in the namestore | ||
594 | * (invoked by the monitor). | ||
595 | * | ||
596 | * @param cls closure, NULL | ||
597 | * @param zone private key of the zone; NULL on disconnect | ||
598 | * @param label label of the records; NULL on disconnect | ||
599 | * @param rd_count number of entries in @a rd array, 0 if label was deleted | ||
600 | * @param rd array of records with data to store | ||
601 | */ | ||
602 | static void | ||
603 | handle_monitor_event (void *cls, | ||
604 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | ||
605 | const char *label, | ||
606 | unsigned int rd_count, | ||
607 | const struct GNUNET_GNSRECORD_Data *rd) | ||
608 | { | ||
609 | struct GNUNET_GNSRECORD_Data rd_public[rd_count]; | ||
610 | unsigned int rd_public_count; | ||
611 | struct MonitorActivity *ma; | ||
612 | |||
613 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
614 | "Received %u records for label `%s' via namestore monitor\n", | ||
615 | rd_count, | ||
616 | label); | ||
617 | /* filter out records that are not public, and convert to | ||
618 | absolute expiration time. */ | ||
619 | rd_public_count = convert_records_for_export (rd, | ||
620 | rd_count, | ||
621 | rd_public); | ||
622 | if (0 == rd_public_count) | ||
623 | return; /* nothing to do */ | ||
624 | ma = GNUNET_new (struct MonitorActivity); | ||
625 | ma->ph = perform_dht_put (zone, | ||
626 | label, | ||
627 | rd, | ||
628 | rd_count, | ||
629 | ma); | ||
630 | if (NULL == ma->ph) | ||
631 | { | ||
632 | /* PUT failed, do not remember operation */ | ||
633 | GNUNET_free (ma); | ||
634 | return; | ||
635 | } | ||
636 | GNUNET_CONTAINER_DLL_insert (ma_head, | ||
637 | ma_tail, | ||
638 | ma); | ||
639 | } | ||
640 | |||
641 | |||
642 | /** | ||
643 | * The zone monitor is now in SYNC with the current state of the | ||
644 | * name store. Start to perform periodic iterations. | ||
645 | * | ||
646 | * @param cls NULL | ||
647 | */ | ||
648 | static void | ||
649 | monitor_sync_event (void *cls) | ||
650 | { | ||
651 | GNUNET_assert (NULL == zone_publish_task); | ||
652 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | ||
653 | NULL); | ||
654 | } | ||
655 | |||
656 | |||
657 | /** | ||
658 | * The zone monitor is now in SYNC with the current state of the | ||
659 | * name store. Start to perform periodic iterations. | ||
660 | * | ||
661 | * @param cls NULL | ||
662 | */ | ||
663 | static void | ||
664 | handle_monitor_error (void *cls) | ||
665 | { | ||
666 | if (NULL != zone_publish_task) | ||
667 | { | ||
668 | GNUNET_SCHEDULER_cancel (zone_publish_task); | ||
669 | zone_publish_task = NULL; | ||
670 | } | ||
671 | if (NULL != namestore_iter) | ||
672 | { | ||
673 | GNUNET_NAMESTORE_zone_iteration_stop (namestore_iter); | ||
674 | namestore_iter = NULL; | ||
675 | } | ||
676 | if (NULL != active_put) | ||
677 | { | ||
678 | GNUNET_DHT_put_cancel (active_put); | ||
679 | active_put = NULL; | ||
680 | } | ||
681 | zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, | ||
682 | NULL); | ||
683 | } | ||
684 | |||
685 | |||
686 | /** | ||
687 | * Performe zonemaster duties: watch namestore, publish records. | ||
688 | * | ||
689 | * @param cls closure | ||
690 | * @param server the initialized server | ||
691 | * @param c configuration to use | ||
692 | */ | ||
693 | static void | ||
694 | run (void *cls, | ||
695 | const struct GNUNET_CONFIGURATION_Handle *c, | ||
696 | struct GNUNET_SERVICE_Handle *service) | ||
697 | { | ||
698 | unsigned long long max_parallel_bg_queries = 128; | ||
699 | |||
700 | min_relative_record_time = GNUNET_TIME_UNIT_FOREVER_REL; | ||
701 | namestore_handle = GNUNET_NAMESTORE_connect (c); | ||
702 | if (NULL == namestore_handle) | ||
703 | { | ||
704 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
705 | _("Failed to connect to the namestore!\n")); | ||
706 | GNUNET_SCHEDULER_shutdown (); | ||
707 | return; | ||
708 | } | ||
709 | |||
710 | put_interval = INITIAL_PUT_INTERVAL; | ||
711 | zone_publish_time_window_default = DEFAULT_ZONE_PUBLISH_TIME_WINDOW; | ||
712 | if (GNUNET_OK == | ||
713 | GNUNET_CONFIGURATION_get_value_time (c, | ||
714 | "zonemaster", | ||
715 | "ZONE_PUBLISH_TIME_WINDOW", | ||
716 | &zone_publish_time_window_default)) | ||
717 | { | ||
718 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
719 | "Time window for zone iteration: %s\n", | ||
720 | GNUNET_STRINGS_relative_time_to_string (zone_publish_time_window, | ||
721 | GNUNET_YES)); | ||
722 | } | ||
723 | zone_publish_time_window = zone_publish_time_window_default; | ||
724 | if (GNUNET_OK == | ||
725 | GNUNET_CONFIGURATION_get_value_number (c, | ||
726 | "zonemaster", | ||
727 | "MAX_PARALLEL_BACKGROUND_QUERIES", | ||
728 | &max_parallel_bg_queries)) | ||
729 | { | ||
730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
731 | "Number of allowed parallel background queries: %llu\n", | ||
732 | max_parallel_bg_queries); | ||
733 | } | ||
734 | if (0 == max_parallel_bg_queries) | ||
735 | max_parallel_bg_queries = 1; | ||
736 | dht_handle = GNUNET_DHT_connect (c, | ||
737 | (unsigned int) max_parallel_bg_queries); | ||
738 | if (NULL == dht_handle) | ||
739 | { | ||
740 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
741 | _("Could not connect to DHT!\n")); | ||
742 | GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | ||
743 | return; | ||
744 | } | ||
745 | |||
746 | /* Schedule periodic put for our records. */ | ||
747 | first_zone_iteration = GNUNET_YES;\ | ||
748 | statistics = GNUNET_STATISTICS_create ("zonemaster", c); | ||
749 | zmon = GNUNET_NAMESTORE_zone_monitor_start (c, | ||
750 | NULL, | ||
751 | GNUNET_NO, | ||
752 | &handle_monitor_error, | ||
753 | NULL, | ||
754 | &handle_monitor_event, | ||
755 | NULL, | ||
756 | &monitor_sync_event, | ||
757 | NULL); | ||
758 | GNUNET_break (NULL != zmon); | ||
759 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | ||
760 | } | ||
761 | |||
762 | |||
763 | /** | ||
764 | * Define "main" method using service macro. | ||
765 | */ | ||
766 | GNUNET_SERVICE_MAIN | ||
767 | ("zonemaster", | ||
768 | GNUNET_SERVICE_OPTION_NONE, | ||
769 | &run, | ||
770 | NULL, | ||
771 | NULL, | ||
772 | NULL, | ||
773 | GNUNET_MQ_handler_end()); | ||
774 | |||
775 | |||
776 | /* end of gnunet-service-zonemaster.c */ | ||
diff --git a/src/zonemaster/zonemaster.conf.in b/src/zonemaster/zonemaster.conf.in new file mode 100644 index 000000000..871eb9c8f --- /dev/null +++ b/src/zonemaster/zonemaster.conf.in | |||
@@ -0,0 +1,25 @@ | |||
1 | [zonemaster] | ||
2 | AUTOSTART = @AUTOSTART@ | ||
3 | FORCESTART = YES | ||
4 | HOSTNAME = localhost | ||
5 | BINARY = gnunet-service-zonemaster | ||
6 | UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-zonemaster.sock | ||
7 | @JAVAPORT@PORT = 2123 | ||
8 | |||
9 | # Do we require users that want to access GNS to run this process | ||
10 | # (usually not a good idea) | ||
11 | UNIX_MATCH_UID = NO | ||
12 | |||
13 | # Do we require users that want to access GNS to be in the 'gnunet' group? | ||
14 | UNIX_MATCH_GID = NO | ||
15 | |||
16 | # How many queries is GNS allowed to perform in the background at the same time? | ||
17 | MAX_PARALLEL_BACKGROUND_QUERIES = 1000 | ||
18 | |||
19 | # How frequently do we try to publish our full zone? | ||
20 | ZONE_PUBLISH_TIME_WINDOW = 4 h | ||
21 | |||
22 | # Using caching or always ask DHT | ||
23 | # USE_CACHE = YES | ||
24 | |||
25 | # PREFIX = valgrind --leak-check=full --track-origins=yes | ||