From 18a2dbfb20e6c43987c65789a29ebfcb75dedaf8 Mon Sep 17 00:00:00 2001 From: Peter M. Groen Date: Tue, 19 Apr 2022 18:14:28 +0200 Subject: [PATCH] Fixed paths --- examples/linux/canrecv.cpp | 55 ++++++++----------------------------------------------- examples/linux/cantime.cpp | 60 +++++++++--------------------------------------------------- examples/tcp/tcp6echo.cpp | 50 ++++++-------------------------------------------- examples/tcp/tcp6echosvr.cpp | 58 ++++++++-------------------------------------------------- examples/tcp/tcpecho.cpp | 50 ++++++-------------------------------------------- examples/tcp/tcpechomt.cpp | 52 +++++++--------------------------------------------- examples/tcp/tcpechosvr.cpp | 58 ++++++++-------------------------------------------------- examples/tcp/tcpechotest.cpp | 50 ++++++-------------------------------------------- examples/udp/udp6echo.cpp | 46 ++++------------------------------------------ examples/udp/udpecho.cpp | 46 ++++------------------------------------------ examples/udp/udpechosvr.cpp | 63 +++++++-------------------------------------------------------- examples/unix/undgramecho.cpp | 48 +++++------------------------------------------- examples/unix/undgramechosvr.cpp | 63 +++++++-------------------------------------------------------- examples/unix/unecho.cpp | 50 ++++++-------------------------------------------- examples/unix/unechosvr.cpp | 56 +++++++------------------------------------------------- examples/unix/unechotest.cpp | 50 ++++++-------------------------------------------- include/socket-cpp/tcp_acceptor.h | 22 +++++++++------------- include/socket-cpp/tcp_connector.h | 20 ++++++-------------- include/socket-cpp/tcp_socket.h | 22 +++++++++------------- include/socket-cpp/udp6_socket.h | 67 +++++++++---------------------------------------------------------- include/socket-cpp/udp_socket.h | 20 +++++++++----------- include/socket-cpp/unix_acceptor.h | 19 +++++++++---------- include/socket-cpp/unix_address.h | 67 +++++++++---------------------------------------------------------- include/socket-cpp/unix_connector.h | 19 +++++++++---------- include/socket-cpp/unix_dgram_socket.h | 20 +++++++++----------- include/socket-cpp/unix_stream_socket.h | 20 +++++++++----------- 26 files changed, 191 insertions(+), 960 deletions(-) diff --git a/examples/linux/canrecv.cpp b/examples/linux/canrecv.cpp index 02675c4..9c09a46 100644 --- a/examples/linux/canrecv.cpp +++ b/examples/linux/canrecv.cpp @@ -1,50 +1,11 @@ -// canrecv.cpp -// -// Linux SoxketCAN reader example. -// -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2021 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include #include #include #include -#include "sockpp/can_socket.h" -#include "sockpp/can_frame.h" -#include "sockpp/version.h" +#include "socket-cpp/can_socket.h" +#include "socket-cpp/can_frame.h" +#include "socket-cpp/version.h" #include #include @@ -59,15 +20,15 @@ using sysclock = chrono::system_clock; int main(int argc, char* argv[]) { cout << "Sample SocketCAN writer for 'sockpp' " - << sockpp::SOCKPP_VERSION << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << endl; string canIface = (argc > 1) ? argv[1] : "can0"; canid_t canID = (argc > 2) ? atoi(argv[2]) : 0x20; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; - sockpp::can_address addr(canIface); - sockpp::can_socket sock(addr); + osdev::components::socket-cpp::can_address addr(canIface); + osdev::components::socket-cpp::can_socket sock(addr); if (!sock) { cerr << "Error binding to the CAN interface " << canIface << "\n\t" @@ -82,7 +43,7 @@ int main(int argc, char* argv[]) cout << setfill('0'); while (true) { - sockpp::can_frame frame; + osdev::components::socket-cpp::can_frame frame; sock.recv(&frame); auto t = sock.last_frame_timestamp(); diff --git a/examples/linux/cantime.cpp b/examples/linux/cantime.cpp index 91dcfa3..79b0ffa 100644 --- a/examples/linux/cantime.cpp +++ b/examples/linux/cantime.cpp @@ -1,52 +1,10 @@ -// cantime.cpp -// -// Linux SoxketCAN writer example. -// -// This writes the 1-sec, 32-bit, Linux time_t value to the CAN bus each -// time it ticks. This is a simple (though not overly precise) way to -// synchronize the time for nodes on the bus -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2021 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include #include #include -#include "sockpp/can_socket.h" -#include "sockpp/can_frame.h" -#include "sockpp/version.h" +#include "socket-cpp/can_socket.h" +#include "socket-cpp/can_frame.h" +#include "socket-cpp/version.h" #include #include @@ -60,16 +18,16 @@ using sysclock = chrono::system_clock; int main(int argc, char* argv[]) { - cout << "Sample SocketCAN writer for 'sockpp' " - << sockpp::SOCKPP_VERSION << endl; + cout << "Sample SocketCAN writer for 'Socket-Cpp' " + << osdev::components::socket-cpp::SOCKPP_VERSION << endl; string canIface = (argc > 1) ? argv[1] : "can0"; canid_t canID = (argc > 2) ? atoi(argv[2]) : 0x20; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; - sockpp::can_address addr(canIface); - sockpp::can_socket sock(addr); + osdev::components::socket-cpp::can_address addr(canIface); + osdev::components::socket-cpp::can_socket sock(addr); if (!sock) { cerr << "Error binding to the CAN interface " << canIface << "\n\t" @@ -90,7 +48,7 @@ int main(int argc, char* argv[]) // Write the time to the CAN bus as a 32-bit int auto nt = uint32_t(t); - sockpp::can_frame frame { canID, &nt, sizeof(nt) }; + osdev::components::socket-cpp::can_frame frame { canID, &nt, sizeof(nt) }; sock.send(frame); } diff --git a/examples/tcp/tcp6echo.cpp b/examples/tcp/tcp6echo.cpp index db045ef..2dd9f4e 100644 --- a/examples/tcp/tcp6echo.cpp +++ b/examples/tcp/tcp6echo.cpp @@ -1,45 +1,7 @@ -// tcpecho.cpp -// -// Simple TCP echo client -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include -#include "sockpp/tcp6_connector.h" -#include "sockpp/version.h" +#include "socket-cpp/tcp6_connector.h" +#include "socket-cpp/version.h" using namespace std; using namespace std::chrono; @@ -49,20 +11,20 @@ using namespace std::chrono; int main(int argc, char* argv[]) { cout << "Sample IPv6 TCP echo client for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; std::string host = (argc > 1) ? argv[1] : "::1"; in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; // Implicitly creates an inet6_address from {host,port} // and then tries the connection. - sockpp::tcp6_connector conn({host, port}); + osdev::components::socket-cpp::tcp6_connector conn({host, port}); if (!conn) { cerr << "Error connecting to server at " - << sockpp::inet6_address(host, port) + << osdev::components::socket-cpp::inet6_address(host, port) << "\n\t" << conn.last_error_str() << endl; return 1; } diff --git a/examples/tcp/tcp6echosvr.cpp b/examples/tcp/tcp6echosvr.cpp index 8352207..6633134 100644 --- a/examples/tcp/tcp6echosvr.cpp +++ b/examples/tcp/tcp6echosvr.cpp @@ -1,49 +1,7 @@ -// tcp6echosvr.cpp -// -// A multi-threaded TCP v6 echo server for sockpp library. -// This is a simple thread-per-connection TCP server for IPv6. -// -// USAGE: -// tcp6echosvr [port] -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include -#include "sockpp/tcp6_acceptor.h" -#include "sockpp/version.h" +#include "socket-cpp/tcp6_acceptor.h" +#include "socket-cpp/version.h" using namespace std; @@ -52,7 +10,7 @@ using namespace std; // Ownership of the socket object is transferred to the thread, so when this // function exits, the socket is automatically closed. -void run_echo(sockpp::tcp6_socket sock) +void run_echo(osdev::components::socket-cpp::tcp6_socket sock) { ssize_t n; char buf[512]; @@ -71,12 +29,12 @@ void run_echo(sockpp::tcp6_socket sock) int main(int argc, char* argv[]) { cout << "Sample IPv6 TCP echo server for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; in_port_t port = (argc > 1) ? atoi(argv[1]) : 12345; - sockpp::socket_initializer sockInit; - sockpp::tcp6_acceptor acc(port); + osdev::components::socket-cpp::socket_initializer sockInit; + osdev::components::socket-cpp::tcp6_acceptor acc(port); if (!acc) { cerr << "Error creating the acceptor: " << acc.last_error_str() << endl; @@ -85,10 +43,10 @@ int main(int argc, char* argv[]) cout << "Awaiting connections on port " << port << "..." << endl; while (true) { - sockpp::inet6_address peer; + osdev::components::socket-cpp::inet6_address peer; // Accept a new client connection - sockpp::tcp6_socket sock = acc.accept(&peer); + osdev::components::socket-cpp::tcp6_socket sock = acc.accept(&peer); cout << "Received a connection request from " << peer << endl; if (!sock) { diff --git a/examples/tcp/tcpecho.cpp b/examples/tcp/tcpecho.cpp index 03e0df8..e6abcb8 100644 --- a/examples/tcp/tcpecho.cpp +++ b/examples/tcp/tcpecho.cpp @@ -1,45 +1,7 @@ -// tcpecho.cpp -// -// Simple TCP echo client -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include -#include "sockpp/tcp_connector.h" -#include "sockpp/version.h" +#include "socket-cpp/tcp_connector.h" +#include "socket-cpp/version.h" using namespace std; using namespace std::chrono; @@ -47,20 +9,20 @@ using namespace std::chrono; int main(int argc, char* argv[]) { cout << "Sample TCP echo client for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; string host = (argc > 1) ? argv[1] : "localhost"; in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; // Implicitly creates an inet_address from {host,port} // and then tries the connection. - sockpp::tcp_connector conn({host, port}); + osdev::components::socket-cpp::tcp_connector conn({host, port}); if (!conn) { cerr << "Error connecting to server at " - << sockpp::inet_address(host, port) + << osdev::components::socket-cpp::inet_address(host, port) << "\n\t" << conn.last_error_str() << endl; return 1; } diff --git a/examples/tcp/tcpechomt.cpp b/examples/tcp/tcpechomt.cpp index a739534..ddf4721 100644 --- a/examples/tcp/tcpechomt.cpp +++ b/examples/tcp/tcpechomt.cpp @@ -1,46 +1,8 @@ -// tcpechomt.cpp -// -// TCP echo client that uses separate read and write threads. -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include #include -#include "sockpp/tcp_connector.h" -#include "sockpp/version.h" +#include "socket-cpp/tcp_connector.h" +#include "socket-cpp/version.h" using namespace std; @@ -49,7 +11,7 @@ using namespace std; // server and writing them to the console. When the main (write) thread // shuts down the socket, we exit. -void read_thr(sockpp::tcp_socket rdSock) +void read_thr(osdev::components::socket-cpp::tcp_socket rdSock) { char buf[512]; ssize_t n; @@ -71,20 +33,20 @@ void read_thr(sockpp::tcp_socket rdSock) int main(int argc, char* argv[]) { cout << "Sample multi-threaded TCP echo client for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; string host = (argc > 1) ? argv[1] : "localhost"; in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; // Implicitly creates an inet_address from {host,port} // and then tries the connection. - sockpp::tcp_connector conn({host, port}); + osdev::components::socket-cpp::tcp_connector conn({host, port}); if (!conn) { cerr << "Error connecting to server at " - << sockpp::inet_address(host, port) + << osdev::components::socket-cpp::inet_address(host, port) << "\n\t" << conn.last_error_str() << endl; return 1; } diff --git a/examples/tcp/tcpechosvr.cpp b/examples/tcp/tcpechosvr.cpp index 1b7861f..e83403b 100644 --- a/examples/tcp/tcpechosvr.cpp +++ b/examples/tcp/tcpechosvr.cpp @@ -1,49 +1,7 @@ -// tcpechosvr.cpp -// -// A multi-threaded TCP echo server for sockpp library. -// This is a simple thread-per-connection TCP server. -// -// USAGE: -// tcpechosvr [port] -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include -#include "sockpp/tcp_acceptor.h" -#include "sockpp/version.h" +#include "socket-cpp/tcp_acceptor.h" +#include "socket-cpp/version.h" using namespace std; @@ -52,7 +10,7 @@ using namespace std; // Ownership of the socket object is transferred to the thread, so when this // function exits, the socket is automatically closed. -void run_echo(sockpp::tcp_socket sock) +void run_echo(osdev::components::socket-cpp::tcp_socket sock) { ssize_t n; char buf[512]; @@ -71,13 +29,13 @@ void run_echo(sockpp::tcp_socket sock) int main(int argc, char* argv[]) { cout << "Sample TCP echo server for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; in_port_t port = (argc > 1) ? atoi(argv[1]) : 12345; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; - sockpp::tcp_acceptor acc(port); + osdev::components::socket-cpp::tcp_acceptor acc(port); if (!acc) { cerr << "Error creating the acceptor: " << acc.last_error_str() << endl; @@ -87,10 +45,10 @@ int main(int argc, char* argv[]) cout << "Awaiting connections on port " << port << "..." << endl; while (true) { - sockpp::inet_address peer; + osdev::components::socket-cpp::inet_address peer; // Accept a new client connection - sockpp::tcp_socket sock = acc.accept(&peer); + osdev::components::socket-cpp::tcp_socket sock = acc.accept(&peer); cout << "Received a connection request from " << peer << endl; if (!sock) { diff --git a/examples/tcp/tcpechotest.cpp b/examples/tcp/tcpechotest.cpp index 9c2117f..6800a57 100644 --- a/examples/tcp/tcpechotest.cpp +++ b/examples/tcp/tcpechotest.cpp @@ -1,47 +1,9 @@ -// tcpechotest.cpp -// -// TCP echo timing client. -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2020 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include #include #include -#include "sockpp/tcp_connector.h" -#include "sockpp/version.h" +#include "socket-cpp/tcp_connector.h" +#include "socket-cpp/version.h" using namespace std; using namespace std::chrono; @@ -56,7 +18,7 @@ using fpsec = std::chrono::duration; int main(int argc, char* argv[]) { cout << "Unix-domain echo timing test client for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; string host = (argc > 1) ? argv[1] : "localhost"; in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345; @@ -64,15 +26,15 @@ int main(int argc, char* argv[]) size_t n = (argc > 3) ? size_t(atoll(argv[3])) : DFLT_N; size_t sz = (argc > 4) ? size_t(atoll(argv[4])) : DFLT_SZ; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; auto t_start = high_resolution_clock::now(); - sockpp::tcp_connector conn({host, port}); + osdev::components::socket-cpp::tcp_connector conn({host, port}); if (!conn) { cerr << "Error connecting to server at " - << sockpp::inet_address(host, port) + << osdev::components::socket-cpp::inet_address(host, port) << "\n\t" << conn.last_error_str() << endl; return 1; } diff --git a/examples/udp/udp6echo.cpp b/examples/udp/udp6echo.cpp index 224576a..d39c6ca 100644 --- a/examples/udp/udp6echo.cpp +++ b/examples/udp/udp6echo.cpp @@ -1,41 +1,3 @@ -// udp6echo.cpp -// -// Simple UDP v6 echo client -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include #include "sockpp/udp6_socket.h" @@ -48,16 +10,16 @@ using namespace std; int main(int argc, char* argv[]) { cout << "Sample IPv6 UDP echo client for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; string host = (argc > 1) ? argv[1] : "localhost"; in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; - sockpp::udp6_socket sock; + osdev::components::socket-cpp::udp6_socket sock; - if (!sock.connect(sockpp::inet6_address(host, port))) { + if (!sock.connect(osdev::components::socket-cpp::inet6_address(host, port))) { cerr << "Error connecting to server at " << host << ":" << port << "\n\t" << sock.last_error_str() << endl; return 1; diff --git a/examples/udp/udpecho.cpp b/examples/udp/udpecho.cpp index e3fd3e7..1bc01f8 100644 --- a/examples/udp/udpecho.cpp +++ b/examples/udp/udpecho.cpp @@ -1,41 +1,3 @@ -// udpecho.cpp -// -// Simple UDP v4 echo client -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include #include "sockpp/udp_socket.h" @@ -48,16 +10,16 @@ using namespace std; int main(int argc, char* argv[]) { cout << "Sample UDP echo client for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; string host = (argc > 1) ? argv[1] : "localhost"; in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; - sockpp::udp_socket sock; + osdev::components::socket-cpp::udp_socket sock; - if (!sock.connect(sockpp::inet_address(host, port))) { + if (!sock.connect(osdev::components::socket-cpp::inet_address(host, port))) { cerr << "Error connecting to server at " << host << ":" << port << "\n\t" << sock.last_error_str() << endl; return 1; diff --git a/examples/udp/udpechosvr.cpp b/examples/udp/udpechosvr.cpp index b3cf3f6..eecd3dc 100644 --- a/examples/udp/udpechosvr.cpp +++ b/examples/udp/udpechosvr.cpp @@ -1,52 +1,3 @@ -// udpechosvr.cpp -// -// A simple multi-threaded TCP/IP UDP echo server for sockpp library. -// -// This runs a UDP echo server for both IPv4 and IPv6, each in a separate -// thread. They both use the same port number, either as provided by the user -// on the command line, or defaulting to 12345. -// -// USAGE: -// uspechosvr [port] -// -// You can test with a netcat client, like: -// $ nc -u localhost 12345 # IPv4 -// $ nc -6u localhost 12345 # IPv6 -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include #include "sockpp/udp_socket.h" @@ -82,36 +33,36 @@ void run_echo(UDPSOCK sock) int main(int argc, char* argv[]) { cout << "Sample UDP echo server for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; in_port_t port = (argc > 1) ? atoi(argv[1]) : 12345; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; - sockpp::udp_socket udpsock; + osdev::components::socket-cpp::udp_socket udpsock; if (!udpsock) { cerr << "Error creating the UDP v4 socket: " << udpsock.last_error_str() << endl; return 1; } - if (!udpsock.bind(sockpp::inet_address("localhost", port))) { + if (!udpsock.bind(osdev::components::socket-cpp::inet_address("localhost", port))) { cerr << "Error binding the UDP v4 socket: " << udpsock.last_error_str() << endl; return 1; } - sockpp::udp6_socket udp6sock; + osdev::components::socket-cpp::udp6_socket udp6sock; if (!udp6sock) { cerr << "Error creating the UDP v6 socket: " << udp6sock.last_error_str() << endl; return 1; } - if (!udp6sock.bind(sockpp::inet6_address("localhost", port))) { + if (!udp6sock.bind(osdev::components::socket-cpp::inet6_address("localhost", port))) { cerr << "Error binding the UDP v6 socket: " << udp6sock.last_error_str() << endl; return 1; } // Spin up a thread to run the IPv4 socket. - thread thr(run_echo, std::move(udpsock)); + thread thr(run_echo, std::move(udpsock)); thr.detach(); // Run the IPv6 socket in this thread. (Call doesn't return) diff --git a/examples/unix/undgramecho.cpp b/examples/unix/undgramecho.cpp index 9fc4a17..a24fe25 100644 --- a/examples/unix/undgramecho.cpp +++ b/examples/unix/undgramecho.cpp @@ -1,44 +1,6 @@ -// udpecho.cpp -// -// Simple Unix-domain UDP echo client -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include -#include "sockpp/unix_dgram_socket.h" +#include "socket-cpp/unix_dgram_socket.h" using namespace std; @@ -46,17 +8,17 @@ using namespace std; int main(int argc, char* argv[]) { - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; string cliAddr { "/tmp/undgramecho.sock" }, svrAddr { "/tmp/undgramechosvr.sock" }; - sockpp::unix_dgram_socket sock; + osdev::components::socket-cpp::unix_dgram_socket sock; // A Unix-domain UDP client needs to bind to its own address // before it can send or receive packets - if (!sock.bind(sockpp::unix_address(cliAddr))) { + if (!sock.bind(osdev::components::socket-cpp::unix_address(cliAddr))) { cerr << "Error connecting to client address at '" << cliAddr << "'" << "\n\t" << sock.last_error_str() << endl; return 1; @@ -65,7 +27,7 @@ int main(int argc, char* argv[]) // "Connect" to the server address. This is a convenience to set the // default 'send_to' address, as there is no real connection. - if (!sock.connect(sockpp::unix_address(svrAddr))) { + if (!sock.connect(osdev::components::socket-cpp::unix_address(svrAddr))) { cerr << "Error connecting to server at '" << svrAddr << "'" << "\n\t" << sock.last_error_str() << endl; return 1; diff --git a/examples/unix/undgramechosvr.cpp b/examples/unix/undgramechosvr.cpp index fed3643..30a3c36 100644 --- a/examples/unix/undgramechosvr.cpp +++ b/examples/unix/undgramechosvr.cpp @@ -1,55 +1,6 @@ -// undgramechosvr.cpp -// -// A simple multi-threaded TCP/IP UDP echo server for sockpp library. -// -// This runs a UDP echo server for both IPv4 and IPv6, each in a separate -// thread. They both use the same port number, either as provided by the user -// on the command line, or defaulting to 12345. -// -// USAGE: -// undgramechosvr [port] -// -// You can test with a netcat client, like: -// $ nc -u localhost 12345 # IPv4 -// $ nc -6u localhost 12345 # IPv6 -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include -#include "sockpp/unix_dgram_socket.h" -#include "sockpp/version.h" +#include "socket-cpp/unix_dgram_socket.h" +#include "socket-cpp/version.h" using namespace std; @@ -60,17 +11,17 @@ using namespace std; int main(int argc, char* argv[]) { cout << "Sample Unix-domain datagram echo server for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; - sockpp::unix_dgram_socket sock; + osdev::components::socket-cpp::unix_dgram_socket sock; if (!sock) { cerr << "Error creating the socket: " << sock.last_error_str() << endl; return 1; } - if (!sock.bind(sockpp::unix_address("/tmp/undgramechosvr.sock"))) { + if (!sock.bind(osdev::components::socket-cpp::unix_address("/tmp/undgramechosvr.sock"))) { cerr << "Error binding the socket: " << sock.last_error_str() << endl; return 1; } @@ -79,7 +30,7 @@ int main(int argc, char* argv[]) ssize_t n; char buf[512]; - sockpp::unix_address srcAddr; + osdev::components::socket-cpp::unix_address srcAddr; cout << "Awaiting packets on: '" << sock.address() << "'" << endl; diff --git a/examples/unix/unecho.cpp b/examples/unix/unecho.cpp index 5d1661c..fca2fee 100644 --- a/examples/unix/unecho.cpp +++ b/examples/unix/unecho.cpp @@ -1,45 +1,7 @@ -// unecho.cpp -// -// Simple Unix-domain echo client -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include -#include "sockpp/unix_connector.h" -#include "sockpp/version.h" +#include "socket-cpp/unix_connector.h" +#include "socket-cpp/version.h" using namespace std; @@ -48,15 +10,15 @@ using namespace std; int main(int argc, char* argv[]) { cout << "Sample Unix-domain echo client for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; string path = (argc > 1) ? argv[1] : "/tmp/unechosvr.sock"; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; - sockpp::unix_connector conn; + osdev::components::socket-cpp::unix_connector conn; - bool ok = conn.connect(sockpp::unix_address(path)); + bool ok = conn.connect(osdev::components::socket-cpp::unix_address(path)); if (!ok) { cerr << "Error connecting to UNIX socket at " << path << "\n\t" << conn.last_error_str() << endl; diff --git a/examples/unix/unechosvr.cpp b/examples/unix/unechosvr.cpp index ba5448b..9284be6 100644 --- a/examples/unix/unechosvr.cpp +++ b/examples/unix/unechosvr.cpp @@ -1,49 +1,7 @@ -// unechosvr.cpp -// -// A multi-threaded UNIX-domain echo server for sockpp library. -// This is a simple thread-per-connection UNIX server. -// -// USAGE: -// unechosvr [path] -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include -#include "sockpp/unix_acceptor.h" -#include "sockpp/version.h" +#include "socket-cpp/unix_acceptor.h" +#include "socket-cpp/version.h" using namespace std; @@ -52,7 +10,7 @@ using namespace std; // Ownership of the socket object is transferred to the thread, so when this // function exits, the socket is automatically closed. -void run_echo(sockpp::unix_socket sock) +void run_echo(osdev::components::socket-cpp::unix_socket sock) { int n; char buf[512]; @@ -71,7 +29,7 @@ void run_echo(sockpp::unix_socket sock) int main(int argc, char* argv[]) { cout << "Sample Unix-domain echo server for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; string path = "/tmp/unechosvr.sock"; @@ -79,10 +37,10 @@ int main(int argc, char* argv[]) path = argv[1]; } - sockpp::socket_initializer sockInit; - sockpp::unix_acceptor acc; + osdev::components::socket-cpp::socket_initializer sockInit; + osdev::components::socket-cpp::unix_acceptor acc; - bool ok = acc.open(sockpp::unix_address(path)); + bool ok = acc.open(osdev::components::socket-cpp::unix_address(path)); if (!ok) { cerr << "Error creating the acceptor: " << acc.last_error_str() << endl; diff --git a/examples/unix/unechotest.cpp b/examples/unix/unechotest.cpp index a0c1d98..65249ff 100644 --- a/examples/unix/unechotest.cpp +++ b/examples/unix/unechotest.cpp @@ -1,47 +1,9 @@ -// unechotest.cpp -// -// Unix-domain echo timing test client -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2020 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - #include #include #include #include -#include "sockpp/unix_connector.h" -#include "sockpp/version.h" +#include "socket-cpp/unix_connector.h" +#include "socket-cpp/version.h" using namespace std; using namespace std::chrono; @@ -56,18 +18,18 @@ using fpsec = std::chrono::duration; int main(int argc, char* argv[]) { cout << "Unix-domain echo timing test client for 'sockpp' " - << sockpp::SOCKPP_VERSION << '\n' << endl; + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl; string path = (argc > 1) ? argv[1] : "/tmp/unechosvr.sock"; size_t n = (argc > 2) ? size_t(atoll(argv[2])) : DFLT_N; size_t sz = (argc > 3) ? size_t(atoll(argv[3])) : DFLT_SZ; - sockpp::socket_initializer sockInit; + osdev::components::socket-cpp::socket_initializer sockInit; auto t_start = high_resolution_clock::now(); - sockpp::unix_connector conn; + osdev::components::socket-cpp::unix_connector conn; - bool ok = conn.connect(sockpp::unix_address(path)); + bool ok = conn.connect(osdev::components::socket-cpp::unix_address(path)); if (!ok) { cerr << "Error connecting to UNIX socket at " << path << "\n\t" << conn.last_error_str() << endl; diff --git a/include/socket-cpp/tcp_acceptor.h b/include/socket-cpp/tcp_acceptor.h index 2694b67..a5dbf3a 100644 --- a/include/socket-cpp/tcp_acceptor.h +++ b/include/socket-cpp/tcp_acceptor.h @@ -1,13 +1,11 @@ +#pragma once -#ifndef __sockpp_tcp_acceptor_h -#define __sockpp_tcp_acceptor_h +#include "socket-cpp/acceptor.h" +#include "socket-cpp/tcp_socket.h" -#include "sockpp/acceptor.h" -#include "sockpp/tcp_socket.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /// Class for creating a TCP server. /// Objects of this class bind and listen on TCP ports for incoming @@ -18,9 +16,7 @@ namespace sockpp { using tcp_acceptor = acceptor_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -}; - -#endif // __sockpp_tcp_acceptor_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/tcp_connector.h b/include/socket-cpp/tcp_connector.h index 1909f66..7108311 100644 --- a/include/socket-cpp/tcp_connector.h +++ b/include/socket-cpp/tcp_connector.h @@ -1,20 +1,12 @@ +#pragma once - -#ifndef __sockpp_tcp_connector_h -#define __sockpp_tcp_connector_h - -#include "sockpp/connector.h" -#include "sockpp/tcp_socket.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +#include "socket-cpp/connector.h" +#include "socket-cpp/tcp_socket.h" /** IPv4 active, connector (client) socket. */ using tcp_connector = connector_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -}; +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev -#endif // __sockpp_tcp_connector_h diff --git a/include/socket-cpp/tcp_socket.h b/include/socket-cpp/tcp_socket.h index a959809..4e76500 100644 --- a/include/socket-cpp/tcp_socket.h +++ b/include/socket-cpp/tcp_socket.h @@ -1,20 +1,16 @@ +#pragma once -#ifndef __sockpp_tcp_socket_h -#define __sockpp_tcp_socket_h +#include "socket-cpp/stream_socket.h" +#include "socket-cpp/inet_address.h" -#include "sockpp/stream_socket.h" -#include "sockpp/inet_address.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** IPv4 streaming TCP socket */ using tcp_socket = stream_socket_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_tcp_socket_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/udp6_socket.h b/include/socket-cpp/udp6_socket.h index 5c294c5..77e5c0d 100644 --- a/include/socket-cpp/udp6_socket.h +++ b/include/socket-cpp/udp6_socket.h @@ -1,65 +1,16 @@ -/** - * @file udp6_socket.h - * - * Class (typedef) for UDP v6 socket. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date August 2019 - */ +#pragma once -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- +#include "socket-cpp/datagram_socket.h" +#include "socket-cpp/inet6_address.h" -#ifndef __sockpp_udp6_socket_h -#define __sockpp_udp6_socket_h - -#include "sockpp/datagram_socket.h" -#include "sockpp/inet6_address.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** UDP datagram socket type for IPv6 */ using udp6_socket = datagram_socket_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_udp6_socket_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/udp_socket.h b/include/socket-cpp/udp_socket.h index cb877d0..52391cd 100644 --- a/include/socket-cpp/udp_socket.h +++ b/include/socket-cpp/udp_socket.h @@ -1,18 +1,16 @@ +#pragma once +#include "socket-cpp/datagram_socket.h" +#include "socket-cpp/inet_address.h" -#include "sockpp/datagram_socket.h" -#include "sockpp/inet_address.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** UDP datagram socket type for IPv4 */ using udp_socket = datagram_socket_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_udp_socket_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/unix_acceptor.h b/include/socket-cpp/unix_acceptor.h index 5d66bbe..c194052 100644 --- a/include/socket-cpp/unix_acceptor.h +++ b/include/socket-cpp/unix_acceptor.h @@ -1,10 +1,11 @@ +#pragma once -#include "sockpp/acceptor.h" -#include "sockpp/unix_stream_socket.h" +#include "socket-cpp/acceptor.h" +#include "socket-cpp/unix_stream_socket.h" -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /// Class for creating a Unix-domain server. /// Objects of this class bind and listen on Unix-domain ports for @@ -61,9 +62,7 @@ public: unix_socket accept() { return unix_socket(base::accept()); } }; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -}; - -#endif // __sockpp_unix_acceptor_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/unix_address.h b/include/socket-cpp/unix_address.h index 30e8de7..9838a93 100644 --- a/include/socket-cpp/unix_address.h +++ b/include/socket-cpp/unix_address.h @@ -1,62 +1,15 @@ -/** - * @file unix_address.h - * - * Class for a UNIX-domain socket address. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date February 2014 - */ - -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#ifndef __sockpp_unix_addr_h -#define __sockpp_unix_addr_h +#pragma once -#include "sockpp/platform.h" -#include "sockpp/sock_address.h" +#include "socket-cpp/platform.h" +#include "socket-cpp/sock_address.h" #include #include #include #include -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** * Class that represents a UNIX domain address. @@ -184,9 +137,7 @@ public: */ std::ostream& operator<<(std::ostream& os, const unix_address& addr); -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_unix_addr_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/unix_connector.h b/include/socket-cpp/unix_connector.h index f61b178..e32098a 100644 --- a/include/socket-cpp/unix_connector.h +++ b/include/socket-cpp/unix_connector.h @@ -1,17 +1,16 @@ +#pragma once -#include "sockpp/connector.h" -#include "sockpp/unix_stream_socket.h" +#include "socket-cpp/connector.h" +#include "socket-cpp/unix_stream_socket.h" -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** Unix-domain active connector socket. */ using unix_connector = connector_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -}; - -#endif // __sockpp_unix_connector_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/unix_dgram_socket.h b/include/socket-cpp/unix_dgram_socket.h index 1425410..6facb38 100644 --- a/include/socket-cpp/unix_dgram_socket.h +++ b/include/socket-cpp/unix_dgram_socket.h @@ -1,11 +1,11 @@ +#pragma once +#include "socket-cpp/datagram_socket.h" +#include "socket-cpp/unix_address.h" -#include "sockpp/datagram_socket.h" -#include "sockpp/unix_address.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** Unix-domain datagram socket */ using unix_datagram_socket = datagram_socket_tmpl; @@ -13,9 +13,7 @@ using unix_datagram_socket = datagram_socket_tmpl; /** Unix-domain datagram socket (same as `unix_datagram_socket`) */ using unix_dgram_socket = unix_datagram_socket; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_unix_dgram_socket_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/unix_stream_socket.h b/include/socket-cpp/unix_stream_socket.h index 2d8c6c9..1144188 100644 --- a/include/socket-cpp/unix_stream_socket.h +++ b/include/socket-cpp/unix_stream_socket.h @@ -1,11 +1,11 @@ +$pragma once +#include "socket-cpp/stream_socket.h" +#include "socket-cpp/unix_address.h" -#include "sockpp/stream_socket.h" -#include "sockpp/unix_address.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** Streaming Unix-domain socket */ using unix_stream_socket = stream_socket_tmpl; @@ -13,9 +13,7 @@ using unix_stream_socket = stream_socket_tmpl; /** Streaming Unix-domain socket (same as a `unix_stream_socket` */ using unix_socket = unix_stream_socket; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_unix_stream_socket_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev -- libgit2 0.21.4