Skip to content

Commit 100c64a

Browse files
committed
net: document enum Network
1 parent 1148f3d commit 100c64a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/netaddress.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,36 @@
1616
#include <string>
1717
#include <vector>
1818

19+
/**
20+
* A network type.
21+
* @note An address may belong to more than one network, for example `10.0.0.1`
22+
* belongs to both `NET_UNROUTABLE` and `NET_IPV4`.
23+
* Keep these sequential starting from 0 and `NET_MAX` as the last entry.
24+
* We have loops like `for (int i = 0; i < NET_MAX; i++)` that expect to iterate
25+
* over all enum values and also `GetExtNetwork()` "extends" this enum by
26+
* introducing standalone constants starting from `NET_MAX`.
27+
*/
1928
enum Network
2029
{
30+
/// Addresses from these networks are not publicly routable on the global Internet.
2131
NET_UNROUTABLE = 0,
32+
33+
/// IPv4
2234
NET_IPV4,
35+
36+
/// IPv6
2337
NET_IPV6,
38+
39+
/// TORv2
2440
NET_ONION,
41+
42+
/// A set of dummy addresses that map a name to an IPv6 address. These
43+
/// addresses belong to RFC4193's fc00::/7 subnet (unique-local addresses).
44+
/// We use them to map a string or FQDN to an IPv6 address in CAddrMan to
45+
/// keep track of which DNS seeds were used.
2546
NET_INTERNAL,
2647

48+
/// Dummy value to indicate the number of NET_* constants.
2749
NET_MAX,
2850
};
2951

0 commit comments

Comments
 (0)