/work/testing/support/src/network.cc
Line | Count | Source |
1 | | #include "../public/network.hh" |
2 | | |
3 | | namespace tox::test { |
4 | | |
5 | 2.45k | NetworkSystem::~NetworkSystem() = default; |
6 | | |
7 | | IP make_ip(uint32_t ipv4) |
8 | 4.90k | { |
9 | 4.90k | IP ip; |
10 | 4.90k | ip_init(&ip, false); |
11 | 4.90k | ip.ip.v4.uint32 = net_htonl(ipv4); |
12 | 4.90k | return ip; |
13 | 4.90k | } |
14 | | |
15 | | IP make_node_ip(uint32_t node_id) |
16 | 4.90k | { |
17 | | // Use 20.x.y.z range: 20. (id >> 16) . (id >> 8) . (id & 0xFF) |
18 | 4.90k | return make_ip(0x14000000 | (node_id & 0x00FFFFFF)); |
19 | 4.90k | } |
20 | | |
21 | | } // namespace tox::test |