diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/fwd.hpp | 4 | ||||
-rw-r--r-- | src/net/ip.cpp | 4 | ||||
-rw-r--r-- | src/net/ip.hpp | 4 | ||||
-rw-r--r-- | src/net/ip.py | 2 | ||||
-rw-r--r-- | src/net/ip_test.cpp | 3 | ||||
-rw-r--r-- | src/net/packets.cpp | 4 | ||||
-rw-r--r-- | src/net/packets.hpp | 4 | ||||
-rw-r--r-- | src/net/socket.cpp | 4 | ||||
-rw-r--r-- | src/net/socket.hpp | 4 | ||||
-rw-r--r-- | src/net/timer.cpp | 4 | ||||
-rw-r--r-- | src/net/timer.hpp | 4 | ||||
-rw-r--r-- | src/net/timer.t.hpp | 4 |
12 files changed, 44 insertions, 1 deletions
diff --git a/src/net/fwd.hpp b/src/net/fwd.hpp index 109aeed..2438ccf 100644 --- a/src/net/fwd.hpp +++ b/src/net/fwd.hpp @@ -21,6 +21,9 @@ # include "../sanity.hpp" + +namespace tmwa +{ class Session; class IP4Address; @@ -28,5 +31,6 @@ class IP4Address; class TimerData; enum class RecvResult; +} // namespace tmwa #endif // TMWA_NET_FWD_HPP diff --git a/src/net/ip.cpp b/src/net/ip.cpp index 591faab..bfc2028 100644 --- a/src/net/ip.cpp +++ b/src/net/ip.cpp @@ -27,6 +27,9 @@ #include "../poison.hpp" + +namespace tmwa +{ bool extract(XString str, IP4Address *rv) { if (str.endswith('.')) @@ -114,3 +117,4 @@ VString<31> convert_for_printf(IP4Mask a) return STRNPRINTF(32, "%s/%s"_fmt, a.addr(), a.mask()); } +} // namespace tmwa diff --git a/src/net/ip.hpp b/src/net/ip.hpp index 42a4689..9afc691 100644 --- a/src/net/ip.hpp +++ b/src/net/ip.hpp @@ -28,6 +28,9 @@ # include "../strings/fwd.hpp" + +namespace tmwa +{ // TODO - in the long run ports belong here also // and of course, IPv6 stuff. // But what about unix socket addresses? @@ -161,5 +164,6 @@ VString<31> convert_for_printf(IP4Mask m); bool extract(XString str, IP4Address *iv); bool extract(XString str, IP4Mask *iv); +} // namespace tmwa #endif // TMWA_NET_IP_HPP diff --git a/src/net/ip.py b/src/net/ip.py index e6a8183..bcf90a2 100644 --- a/src/net/ip.py +++ b/src/net/ip.py @@ -2,7 +2,7 @@ class IP4Address(object): ''' print an IP4Address ''' __slots__ = ('_value') - name = 'IP4Address' + name = 'tmwa::IP4Address' enabled = True def __init__(self, value): diff --git a/src/net/ip_test.cpp b/src/net/ip_test.cpp index 9058804..c2095ee 100644 --- a/src/net/ip_test.cpp +++ b/src/net/ip_test.cpp @@ -28,6 +28,8 @@ #include "../poison.hpp" +namespace tmwa +{ #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" #define CB(X) (std::integral_constant<bool, (X)>::value) @@ -356,3 +358,4 @@ TEST(ip4mask, cover) EXPECT_FALSE(m.covers(IP4Address({88, 56, 72, 0}))); EXPECT_FALSE(m.covers(IP4Address({88, 56, 72, 255}))); } +} // namespace tmwa diff --git a/src/net/packets.cpp b/src/net/packets.cpp index fbec8c4..3cba856 100644 --- a/src/net/packets.cpp +++ b/src/net/packets.cpp @@ -23,6 +23,9 @@ #include "../poison.hpp" + +namespace tmwa +{ size_t packet_avail(Session *s) { return s->rdata_size - s->rdata_pos; @@ -100,3 +103,4 @@ void packet_dump(io::WriteFile& logfp, Session *s) } FPRINTF(logfp, "\n"_fmt); } +} // namespace tmwa diff --git a/src/net/packets.hpp b/src/net/packets.hpp index 9cfb1da..e025a63 100644 --- a/src/net/packets.hpp +++ b/src/net/packets.hpp @@ -34,6 +34,9 @@ # include "socket.hpp" + +namespace tmwa +{ struct Buffer { std::vector<Byte> bytes; @@ -580,5 +583,6 @@ RecvResult recv_packet_repeatonly(Session *s, AString& repeat) Packet_Head<id> head; return recv_vpacket<id, 4, repeatsize>(s, head, repeat); } +} // namespace tmwa #endif // TMWA_NET_PACKETS_HPP diff --git a/src/net/socket.cpp b/src/net/socket.cpp index 6e523de..548d3c6 100644 --- a/src/net/socket.cpp +++ b/src/net/socket.cpp @@ -42,6 +42,9 @@ #include "../poison.hpp" + +namespace tmwa +{ static io::FD_Set readfds; static @@ -485,3 +488,4 @@ void do_parsepacket(void) RFIFOFLUSH(s); } } +} // namespace tmwa diff --git a/src/net/socket.hpp b/src/net/socket.hpp index 2b60ac6..64eaf1a 100644 --- a/src/net/socket.hpp +++ b/src/net/socket.hpp @@ -44,6 +44,9 @@ # include "ip.hpp" # include "timer.t.hpp" + +namespace tmwa +{ struct SessionData { }; @@ -172,5 +175,6 @@ void realloc_fifo(Session *s, size_t rfifo_size, size_t wfifo_size); void do_sendrecv(interval_t next); /// Call the parser function for every socket that has read data void do_parsepacket(void); +} // namespace tmwa #endif // TMWA_NET_SOCKET_HPP diff --git a/src/net/timer.cpp b/src/net/timer.cpp index 64077c6..8d03c17 100644 --- a/src/net/timer.cpp +++ b/src/net/timer.cpp @@ -32,6 +32,9 @@ #include "../poison.hpp" + +namespace tmwa +{ struct TimerData { /// This will be reset on call, to avoid problems. @@ -215,3 +218,4 @@ bool has_timers() { return !timer_heap.empty(); } +} // namespace tmwa diff --git a/src/net/timer.hpp b/src/net/timer.hpp index 8fd383d..beda3bf 100644 --- a/src/net/timer.hpp +++ b/src/net/timer.hpp @@ -27,6 +27,9 @@ # include "../strings/fwd.hpp" + +namespace tmwa +{ // updated automatically when using milli_clock::now() // which is done only by core.cpp extern tick_t gettick_cache; @@ -46,5 +49,6 @@ tick_t file_modified(ZString name); /// Check if there are any events at all scheduled. bool has_timers(); +} // namespace tmwa #endif // TMWA_NET_TIMER_HPP diff --git a/src/net/timer.t.hpp b/src/net/timer.t.hpp index 0ed8987..5961f51 100644 --- a/src/net/timer.t.hpp +++ b/src/net/timer.t.hpp @@ -32,6 +32,9 @@ # include "../generic/dumb_ptr.hpp" + +namespace tmwa +{ /// An implementation of the C++ "clock" concept, exposing /// durations in milliseconds. class milli_clock @@ -137,5 +140,6 @@ public: /// Check if there is no connected timer. bool operator !() { return !td; } }; +} // namespace tmwa #endif // TMWA_NET_TIMER_T_HPP |