Commit 18a2dbfb20e6c43987c65789a29ebfcb75dedaf8

Authored by Peter M. Groen
1 parent ea9eaf95

Fixed paths

examples/linux/canrecv.cpp
1   -// canrecv.cpp
2   -//
3   -// Linux SoxketCAN reader example.
4   -//
5   -//
6   -// --------------------------------------------------------------------------
7   -// This file is part of the "sockpp" C++ socket library.
8   -//
9   -// Copyright (c) 2021 Frank Pagliughi
10   -// All rights reserved.
11   -//
12   -// Redistribution and use in source and binary forms, with or without
13   -// modification, are permitted provided that the following conditions are
14   -// met:
15   -//
16   -// 1. Redistributions of source code must retain the above copyright notice,
17   -// this list of conditions and the following disclaimer.
18   -//
19   -// 2. Redistributions in binary form must reproduce the above copyright
20   -// notice, this list of conditions and the following disclaimer in the
21   -// documentation and/or other materials provided with the distribution.
22   -//
23   -// 3. Neither the name of the copyright holder nor the names of its
24   -// contributors may be used to endorse or promote products derived from this
25   -// software without specific prior written permission.
26   -//
27   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
28   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
31   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38   -// --------------------------------------------------------------------------
39   -
40 1 #include <iostream>
41 2 #include <iomanip>
42 3 #include <string>
43 4 #include <chrono>
44 5 #include <thread>
45   -#include "sockpp/can_socket.h"
46   -#include "sockpp/can_frame.h"
47   -#include "sockpp/version.h"
  6 +#include "socket-cpp/can_socket.h"
  7 +#include "socket-cpp/can_frame.h"
  8 +#include "socket-cpp/version.h"
48 9  
49 10 #include <net/if.h>
50 11 #include <sys/ioctl.h>
... ... @@ -59,15 +20,15 @@ using sysclock = chrono::system_clock;
59 20 int main(int argc, char* argv[])
60 21 {
61 22 cout << "Sample SocketCAN writer for 'sockpp' "
62   - << sockpp::SOCKPP_VERSION << endl;
  23 + << osdev::components::socket-cpp::SOCKPP_VERSION << endl;
63 24  
64 25 string canIface = (argc > 1) ? argv[1] : "can0";
65 26 canid_t canID = (argc > 2) ? atoi(argv[2]) : 0x20;
66 27  
67   - sockpp::socket_initializer sockInit;
  28 + osdev::components::socket-cpp::socket_initializer sockInit;
68 29  
69   - sockpp::can_address addr(canIface);
70   - sockpp::can_socket sock(addr);
  30 + osdev::components::socket-cpp::can_address addr(canIface);
  31 + osdev::components::socket-cpp::can_socket sock(addr);
71 32  
72 33 if (!sock) {
73 34 cerr << "Error binding to the CAN interface " << canIface << "\n\t"
... ... @@ -82,7 +43,7 @@ int main(int argc, char* argv[])
82 43 cout << setfill('0');
83 44  
84 45 while (true) {
85   - sockpp::can_frame frame;
  46 + osdev::components::socket-cpp::can_frame frame;
86 47 sock.recv(&frame);
87 48 auto t = sock.last_frame_timestamp();
88 49  
... ...
examples/linux/cantime.cpp
1   -// cantime.cpp
2   -//
3   -// Linux SoxketCAN writer example.
4   -//
5   -// This writes the 1-sec, 32-bit, Linux time_t value to the CAN bus each
6   -// time it ticks. This is a simple (though not overly precise) way to
7   -// synchronize the time for nodes on the bus
8   -//
9   -// --------------------------------------------------------------------------
10   -// This file is part of the "sockpp" C++ socket library.
11   -//
12   -// Copyright (c) 2021 Frank Pagliughi
13   -// All rights reserved.
14   -//
15   -// Redistribution and use in source and binary forms, with or without
16   -// modification, are permitted provided that the following conditions are
17   -// met:
18   -//
19   -// 1. Redistributions of source code must retain the above copyright notice,
20   -// this list of conditions and the following disclaimer.
21   -//
22   -// 2. Redistributions in binary form must reproduce the above copyright
23   -// notice, this list of conditions and the following disclaimer in the
24   -// documentation and/or other materials provided with the distribution.
25   -//
26   -// 3. Neither the name of the copyright holder nor the names of its
27   -// contributors may be used to endorse or promote products derived from this
28   -// software without specific prior written permission.
29   -//
30   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
31   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
34   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41   -// --------------------------------------------------------------------------
42   -
43 1 #include <iostream>
44 2 #include <string>
45 3 #include <chrono>
46 4 #include <thread>
47   -#include "sockpp/can_socket.h"
48   -#include "sockpp/can_frame.h"
49   -#include "sockpp/version.h"
  5 +#include "socket-cpp/can_socket.h"
  6 +#include "socket-cpp/can_frame.h"
  7 +#include "socket-cpp/version.h"
50 8  
51 9 #include <net/if.h>
52 10 #include <sys/ioctl.h>
... ... @@ -60,16 +18,16 @@ using sysclock = chrono::system_clock;
60 18  
61 19 int main(int argc, char* argv[])
62 20 {
63   - cout << "Sample SocketCAN writer for 'sockpp' "
64   - << sockpp::SOCKPP_VERSION << endl;
  21 + cout << "Sample SocketCAN writer for 'Socket-Cpp' "
  22 + << osdev::components::socket-cpp::SOCKPP_VERSION << endl;
65 23  
66 24 string canIface = (argc > 1) ? argv[1] : "can0";
67 25 canid_t canID = (argc > 2) ? atoi(argv[2]) : 0x20;
68 26  
69   - sockpp::socket_initializer sockInit;
  27 + osdev::components::socket-cpp::socket_initializer sockInit;
70 28  
71   - sockpp::can_address addr(canIface);
72   - sockpp::can_socket sock(addr);
  29 + osdev::components::socket-cpp::can_address addr(canIface);
  30 + osdev::components::socket-cpp::can_socket sock(addr);
73 31  
74 32 if (!sock) {
75 33 cerr << "Error binding to the CAN interface " << canIface << "\n\t"
... ... @@ -90,7 +48,7 @@ int main(int argc, char* argv[])
90 48 // Write the time to the CAN bus as a 32-bit int
91 49 auto nt = uint32_t(t);
92 50  
93   - sockpp::can_frame frame { canID, &nt, sizeof(nt) };
  51 + osdev::components::socket-cpp::can_frame frame { canID, &nt, sizeof(nt) };
94 52 sock.send(frame);
95 53 }
96 54  
... ...
examples/tcp/tcp6echo.cpp
1   -// tcpecho.cpp
2   -//
3   -// Simple TCP echo client
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2014-2017 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41   -#include "sockpp/tcp6_connector.h"
42   -#include "sockpp/version.h"
  3 +#include "socket-cpp/tcp6_connector.h"
  4 +#include "socket-cpp/version.h"
43 5  
44 6 using namespace std;
45 7 using namespace std::chrono;
... ... @@ -49,20 +11,20 @@ using namespace std::chrono;
49 11 int main(int argc, char* argv[])
50 12 {
51 13 cout << "Sample IPv6 TCP echo client for 'sockpp' "
52   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  14 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
53 15  
54 16 std::string host = (argc > 1) ? argv[1] : "::1";
55 17 in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345;
56 18  
57   - sockpp::socket_initializer sockInit;
  19 + osdev::components::socket-cpp::socket_initializer sockInit;
58 20  
59 21 // Implicitly creates an inet6_address from {host,port}
60 22 // and then tries the connection.
61 23  
62   - sockpp::tcp6_connector conn({host, port});
  24 + osdev::components::socket-cpp::tcp6_connector conn({host, port});
63 25 if (!conn) {
64 26 cerr << "Error connecting to server at "
65   - << sockpp::inet6_address(host, port)
  27 + << osdev::components::socket-cpp::inet6_address(host, port)
66 28 << "\n\t" << conn.last_error_str() << endl;
67 29 return 1;
68 30 }
... ...
examples/tcp/tcp6echosvr.cpp
1   -// tcp6echosvr.cpp
2   -//
3   -// A multi-threaded TCP v6 echo server for sockpp library.
4   -// This is a simple thread-per-connection TCP server for IPv6.
5   -//
6   -// USAGE:
7   -// tcp6echosvr [port]
8   -//
9   -// --------------------------------------------------------------------------
10   -// This file is part of the "sockpp" C++ socket library.
11   -//
12   -// Copyright (c) 2019 Frank Pagliughi
13   -// All rights reserved.
14   -//
15   -// Redistribution and use in source and binary forms, with or without
16   -// modification, are permitted provided that the following conditions are
17   -// met:
18   -//
19   -// 1. Redistributions of source code must retain the above copyright notice,
20   -// this list of conditions and the following disclaimer.
21   -//
22   -// 2. Redistributions in binary form must reproduce the above copyright
23   -// notice, this list of conditions and the following disclaimer in the
24   -// documentation and/or other materials provided with the distribution.
25   -//
26   -// 3. Neither the name of the copyright holder nor the names of its
27   -// contributors may be used to endorse or promote products derived from this
28   -// software without specific prior written permission.
29   -//
30   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
31   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
34   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41   -// --------------------------------------------------------------------------
42   -
43 1 #include <iostream>
44 2 #include <thread>
45   -#include "sockpp/tcp6_acceptor.h"
46   -#include "sockpp/version.h"
  3 +#include "socket-cpp/tcp6_acceptor.h"
  4 +#include "socket-cpp/version.h"
47 5  
48 6 using namespace std;
49 7  
... ... @@ -52,7 +10,7 @@ using namespace std;
52 10 // Ownership of the socket object is transferred to the thread, so when this
53 11 // function exits, the socket is automatically closed.
54 12  
55   -void run_echo(sockpp::tcp6_socket sock)
  13 +void run_echo(osdev::components::socket-cpp::tcp6_socket sock)
56 14 {
57 15 ssize_t n;
58 16 char buf[512];
... ... @@ -71,12 +29,12 @@ void run_echo(sockpp::tcp6_socket sock)
71 29 int main(int argc, char* argv[])
72 30 {
73 31 cout << "Sample IPv6 TCP echo server for 'sockpp' "
74   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  32 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
75 33  
76 34 in_port_t port = (argc > 1) ? atoi(argv[1]) : 12345;
77 35  
78   - sockpp::socket_initializer sockInit;
79   - sockpp::tcp6_acceptor acc(port);
  36 + osdev::components::socket-cpp::socket_initializer sockInit;
  37 + osdev::components::socket-cpp::tcp6_acceptor acc(port);
80 38  
81 39 if (!acc) {
82 40 cerr << "Error creating the acceptor: " << acc.last_error_str() << endl;
... ... @@ -85,10 +43,10 @@ int main(int argc, char* argv[])
85 43 cout << "Awaiting connections on port " << port << "..." << endl;
86 44  
87 45 while (true) {
88   - sockpp::inet6_address peer;
  46 + osdev::components::socket-cpp::inet6_address peer;
89 47  
90 48 // Accept a new client connection
91   - sockpp::tcp6_socket sock = acc.accept(&peer);
  49 + osdev::components::socket-cpp::tcp6_socket sock = acc.accept(&peer);
92 50 cout << "Received a connection request from " << peer << endl;
93 51  
94 52 if (!sock) {
... ...
examples/tcp/tcpecho.cpp
1   -// tcpecho.cpp
2   -//
3   -// Simple TCP echo client
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2014-2017 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41   -#include "sockpp/tcp_connector.h"
42   -#include "sockpp/version.h"
  3 +#include "socket-cpp/tcp_connector.h"
  4 +#include "socket-cpp/version.h"
43 5  
44 6 using namespace std;
45 7 using namespace std::chrono;
... ... @@ -47,20 +9,20 @@ using namespace std::chrono;
47 9 int main(int argc, char* argv[])
48 10 {
49 11 cout << "Sample TCP echo client for 'sockpp' "
50   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  12 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
51 13  
52 14 string host = (argc > 1) ? argv[1] : "localhost";
53 15 in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345;
54 16  
55   - sockpp::socket_initializer sockInit;
  17 + osdev::components::socket-cpp::socket_initializer sockInit;
56 18  
57 19 // Implicitly creates an inet_address from {host,port}
58 20 // and then tries the connection.
59 21  
60   - sockpp::tcp_connector conn({host, port});
  22 + osdev::components::socket-cpp::tcp_connector conn({host, port});
61 23 if (!conn) {
62 24 cerr << "Error connecting to server at "
63   - << sockpp::inet_address(host, port)
  25 + << osdev::components::socket-cpp::inet_address(host, port)
64 26 << "\n\t" << conn.last_error_str() << endl;
65 27 return 1;
66 28 }
... ...
examples/tcp/tcpechomt.cpp
1   -// tcpechomt.cpp
2   -//
3   -// TCP echo client that uses separate read and write threads.
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2014-2017 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41 3 #include <thread>
42   -#include "sockpp/tcp_connector.h"
43   -#include "sockpp/version.h"
  4 +#include "socket-cpp/tcp_connector.h"
  5 +#include "socket-cpp/version.h"
44 6  
45 7 using namespace std;
46 8  
... ... @@ -49,7 +11,7 @@ using namespace std;
49 11 // server and writing them to the console. When the main (write) thread
50 12 // shuts down the socket, we exit.
51 13  
52   -void read_thr(sockpp::tcp_socket rdSock)
  14 +void read_thr(osdev::components::socket-cpp::tcp_socket rdSock)
53 15 {
54 16 char buf[512];
55 17 ssize_t n;
... ... @@ -71,20 +33,20 @@ void read_thr(sockpp::tcp_socket rdSock)
71 33 int main(int argc, char* argv[])
72 34 {
73 35 cout << "Sample multi-threaded TCP echo client for 'sockpp' "
74   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  36 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
75 37  
76 38 string host = (argc > 1) ? argv[1] : "localhost";
77 39 in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345;
78 40  
79   - sockpp::socket_initializer sockInit;
  41 + osdev::components::socket-cpp::socket_initializer sockInit;
80 42  
81 43 // Implicitly creates an inet_address from {host,port}
82 44 // and then tries the connection.
83 45  
84   - sockpp::tcp_connector conn({host, port});
  46 + osdev::components::socket-cpp::tcp_connector conn({host, port});
85 47 if (!conn) {
86 48 cerr << "Error connecting to server at "
87   - << sockpp::inet_address(host, port)
  49 + << osdev::components::socket-cpp::inet_address(host, port)
88 50 << "\n\t" << conn.last_error_str() << endl;
89 51 return 1;
90 52 }
... ...
examples/tcp/tcpechosvr.cpp
1   -// tcpechosvr.cpp
2   -//
3   -// A multi-threaded TCP echo server for sockpp library.
4   -// This is a simple thread-per-connection TCP server.
5   -//
6   -// USAGE:
7   -// tcpechosvr [port]
8   -//
9   -// --------------------------------------------------------------------------
10   -// This file is part of the "sockpp" C++ socket library.
11   -//
12   -// Copyright (c) 2014-2017 Frank Pagliughi
13   -// All rights reserved.
14   -//
15   -// Redistribution and use in source and binary forms, with or without
16   -// modification, are permitted provided that the following conditions are
17   -// met:
18   -//
19   -// 1. Redistributions of source code must retain the above copyright notice,
20   -// this list of conditions and the following disclaimer.
21   -//
22   -// 2. Redistributions in binary form must reproduce the above copyright
23   -// notice, this list of conditions and the following disclaimer in the
24   -// documentation and/or other materials provided with the distribution.
25   -//
26   -// 3. Neither the name of the copyright holder nor the names of its
27   -// contributors may be used to endorse or promote products derived from this
28   -// software without specific prior written permission.
29   -//
30   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
31   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
34   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41   -// --------------------------------------------------------------------------
42   -
43 1 #include <iostream>
44 2 #include <thread>
45   -#include "sockpp/tcp_acceptor.h"
46   -#include "sockpp/version.h"
  3 +#include "socket-cpp/tcp_acceptor.h"
  4 +#include "socket-cpp/version.h"
47 5  
48 6 using namespace std;
49 7  
... ... @@ -52,7 +10,7 @@ using namespace std;
52 10 // Ownership of the socket object is transferred to the thread, so when this
53 11 // function exits, the socket is automatically closed.
54 12  
55   -void run_echo(sockpp::tcp_socket sock)
  13 +void run_echo(osdev::components::socket-cpp::tcp_socket sock)
56 14 {
57 15 ssize_t n;
58 16 char buf[512];
... ... @@ -71,13 +29,13 @@ void run_echo(sockpp::tcp_socket sock)
71 29 int main(int argc, char* argv[])
72 30 {
73 31 cout << "Sample TCP echo server for 'sockpp' "
74   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  32 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
75 33  
76 34 in_port_t port = (argc > 1) ? atoi(argv[1]) : 12345;
77 35  
78   - sockpp::socket_initializer sockInit;
  36 + osdev::components::socket-cpp::socket_initializer sockInit;
79 37  
80   - sockpp::tcp_acceptor acc(port);
  38 + osdev::components::socket-cpp::tcp_acceptor acc(port);
81 39  
82 40 if (!acc) {
83 41 cerr << "Error creating the acceptor: " << acc.last_error_str() << endl;
... ... @@ -87,10 +45,10 @@ int main(int argc, char* argv[])
87 45 cout << "Awaiting connections on port " << port << "..." << endl;
88 46  
89 47 while (true) {
90   - sockpp::inet_address peer;
  48 + osdev::components::socket-cpp::inet_address peer;
91 49  
92 50 // Accept a new client connection
93   - sockpp::tcp_socket sock = acc.accept(&peer);
  51 + osdev::components::socket-cpp::tcp_socket sock = acc.accept(&peer);
94 52 cout << "Received a connection request from " << peer << endl;
95 53  
96 54 if (!sock) {
... ...
examples/tcp/tcpechotest.cpp
1   -// tcpechotest.cpp
2   -//
3   -// TCP echo timing client.
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2020 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41 3 #include <chrono>
42 4 #include <random>
43   -#include "sockpp/tcp_connector.h"
44   -#include "sockpp/version.h"
  5 +#include "socket-cpp/tcp_connector.h"
  6 +#include "socket-cpp/version.h"
45 7  
46 8 using namespace std;
47 9 using namespace std::chrono;
... ... @@ -56,7 +18,7 @@ using fpsec = std::chrono::duration&lt;double, std::chrono::seconds::period&gt;;
56 18 int main(int argc, char* argv[])
57 19 {
58 20 cout << "Unix-domain echo timing test client for 'sockpp' "
59   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  21 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
60 22  
61 23 string host = (argc > 1) ? argv[1] : "localhost";
62 24 in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345;
... ... @@ -64,15 +26,15 @@ int main(int argc, char* argv[])
64 26 size_t n = (argc > 3) ? size_t(atoll(argv[3])) : DFLT_N;
65 27 size_t sz = (argc > 4) ? size_t(atoll(argv[4])) : DFLT_SZ;
66 28  
67   - sockpp::socket_initializer sockInit;
  29 + osdev::components::socket-cpp::socket_initializer sockInit;
68 30  
69 31 auto t_start = high_resolution_clock::now();
70 32  
71 33  
72   - sockpp::tcp_connector conn({host, port});
  34 + osdev::components::socket-cpp::tcp_connector conn({host, port});
73 35 if (!conn) {
74 36 cerr << "Error connecting to server at "
75   - << sockpp::inet_address(host, port)
  37 + << osdev::components::socket-cpp::inet_address(host, port)
76 38 << "\n\t" << conn.last_error_str() << endl;
77 39 return 1;
78 40 }
... ...
examples/udp/udp6echo.cpp
1   -// udp6echo.cpp
2   -//
3   -// Simple UDP v6 echo client
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2019 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41 3 #include "sockpp/udp6_socket.h"
... ... @@ -48,16 +10,16 @@ using namespace std;
48 10 int main(int argc, char* argv[])
49 11 {
50 12 cout << "Sample IPv6 UDP echo client for 'sockpp' "
51   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  13 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
52 14  
53 15 string host = (argc > 1) ? argv[1] : "localhost";
54 16 in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345;
55 17  
56   - sockpp::socket_initializer sockInit;
  18 + osdev::components::socket-cpp::socket_initializer sockInit;
57 19  
58   - sockpp::udp6_socket sock;
  20 + osdev::components::socket-cpp::udp6_socket sock;
59 21  
60   - if (!sock.connect(sockpp::inet6_address(host, port))) {
  22 + if (!sock.connect(osdev::components::socket-cpp::inet6_address(host, port))) {
61 23 cerr << "Error connecting to server at " << host << ":" << port
62 24 << "\n\t" << sock.last_error_str() << endl;
63 25 return 1;
... ...
examples/udp/udpecho.cpp
1   -// udpecho.cpp
2   -//
3   -// Simple UDP v4 echo client
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2019 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41 3 #include "sockpp/udp_socket.h"
... ... @@ -48,16 +10,16 @@ using namespace std;
48 10 int main(int argc, char* argv[])
49 11 {
50 12 cout << "Sample UDP echo client for 'sockpp' "
51   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  13 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
52 14  
53 15 string host = (argc > 1) ? argv[1] : "localhost";
54 16 in_port_t port = (argc > 2) ? atoi(argv[2]) : 12345;
55 17  
56   - sockpp::socket_initializer sockInit;
  18 + osdev::components::socket-cpp::socket_initializer sockInit;
57 19  
58   - sockpp::udp_socket sock;
  20 + osdev::components::socket-cpp::udp_socket sock;
59 21  
60   - if (!sock.connect(sockpp::inet_address(host, port))) {
  22 + if (!sock.connect(osdev::components::socket-cpp::inet_address(host, port))) {
61 23 cerr << "Error connecting to server at " << host << ":" << port
62 24 << "\n\t" << sock.last_error_str() << endl;
63 25 return 1;
... ...
examples/udp/udpechosvr.cpp
1   -// udpechosvr.cpp
2   -//
3   -// A simple multi-threaded TCP/IP UDP echo server for sockpp library.
4   -//
5   -// This runs a UDP echo server for both IPv4 and IPv6, each in a separate
6   -// thread. They both use the same port number, either as provided by the user
7   -// on the command line, or defaulting to 12345.
8   -//
9   -// USAGE:
10   -// uspechosvr [port]
11   -//
12   -// You can test with a netcat client, like:
13   -// $ nc -u localhost 12345 # IPv4
14   -// $ nc -6u localhost 12345 # IPv6
15   -//
16   -// --------------------------------------------------------------------------
17   -// This file is part of the "sockpp" C++ socket library.
18   -//
19   -// Copyright (c) 2019 Frank Pagliughi
20   -// All rights reserved.
21   -//
22   -// Redistribution and use in source and binary forms, with or without
23   -// modification, are permitted provided that the following conditions are
24   -// met:
25   -//
26   -// 1. Redistributions of source code must retain the above copyright notice,
27   -// this list of conditions and the following disclaimer.
28   -//
29   -// 2. Redistributions in binary form must reproduce the above copyright
30   -// notice, this list of conditions and the following disclaimer in the
31   -// documentation and/or other materials provided with the distribution.
32   -//
33   -// 3. Neither the name of the copyright holder nor the names of its
34   -// contributors may be used to endorse or promote products derived from this
35   -// software without specific prior written permission.
36   -//
37   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
38   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
39   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
41   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
42   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
43   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
44   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
45   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
46   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
47   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48   -// --------------------------------------------------------------------------
49   -
50 1 #include <iostream>
51 2 #include <thread>
52 3 #include "sockpp/udp_socket.h"
... ... @@ -82,36 +33,36 @@ void run_echo(UDPSOCK sock)
82 33 int main(int argc, char* argv[])
83 34 {
84 35 cout << "Sample UDP echo server for 'sockpp' "
85   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  36 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
86 37  
87 38 in_port_t port = (argc > 1) ? atoi(argv[1]) : 12345;
88 39  
89   - sockpp::socket_initializer sockInit;
  40 + osdev::components::socket-cpp::socket_initializer sockInit;
90 41  
91   - sockpp::udp_socket udpsock;
  42 + osdev::components::socket-cpp::udp_socket udpsock;
92 43 if (!udpsock) {
93 44 cerr << "Error creating the UDP v4 socket: " << udpsock.last_error_str() << endl;
94 45 return 1;
95 46 }
96 47  
97   - if (!udpsock.bind(sockpp::inet_address("localhost", port))) {
  48 + if (!udpsock.bind(osdev::components::socket-cpp::inet_address("localhost", port))) {
98 49 cerr << "Error binding the UDP v4 socket: " << udpsock.last_error_str() << endl;
99 50 return 1;
100 51 }
101 52  
102   - sockpp::udp6_socket udp6sock;
  53 + osdev::components::socket-cpp::udp6_socket udp6sock;
103 54 if (!udp6sock) {
104 55 cerr << "Error creating the UDP v6 socket: " << udp6sock.last_error_str() << endl;
105 56 return 1;
106 57 }
107 58  
108   - if (!udp6sock.bind(sockpp::inet6_address("localhost", port))) {
  59 + if (!udp6sock.bind(osdev::components::socket-cpp::inet6_address("localhost", port))) {
109 60 cerr << "Error binding the UDP v6 socket: " << udp6sock.last_error_str() << endl;
110 61 return 1;
111 62 }
112 63  
113 64 // Spin up a thread to run the IPv4 socket.
114   - thread thr(run_echo<sockpp::udp_socket>, std::move(udpsock));
  65 + thread thr(run_echo<osdev::components::socket-cpp::udp_socket>, std::move(udpsock));
115 66 thr.detach();
116 67  
117 68 // Run the IPv6 socket in this thread. (Call doesn't return)
... ...
examples/unix/undgramecho.cpp
1   -// udpecho.cpp
2   -//
3   -// Simple Unix-domain UDP echo client
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2019 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41   -#include "sockpp/unix_dgram_socket.h"
  3 +#include "socket-cpp/unix_dgram_socket.h"
42 4  
43 5 using namespace std;
44 6  
... ... @@ -46,17 +8,17 @@ using namespace std;
46 8  
47 9 int main(int argc, char* argv[])
48 10 {
49   - sockpp::socket_initializer sockInit;
  11 + osdev::components::socket-cpp::socket_initializer sockInit;
50 12  
51 13 string cliAddr { "/tmp/undgramecho.sock" },
52 14 svrAddr { "/tmp/undgramechosvr.sock" };
53 15  
54   - sockpp::unix_dgram_socket sock;
  16 + osdev::components::socket-cpp::unix_dgram_socket sock;
55 17  
56 18 // A Unix-domain UDP client needs to bind to its own address
57 19 // before it can send or receive packets
58 20  
59   - if (!sock.bind(sockpp::unix_address(cliAddr))) {
  21 + if (!sock.bind(osdev::components::socket-cpp::unix_address(cliAddr))) {
60 22 cerr << "Error connecting to client address at '" << cliAddr << "'"
61 23 << "\n\t" << sock.last_error_str() << endl;
62 24 return 1;
... ... @@ -65,7 +27,7 @@ int main(int argc, char* argv[])
65 27 // "Connect" to the server address. This is a convenience to set the
66 28 // default 'send_to' address, as there is no real connection.
67 29  
68   - if (!sock.connect(sockpp::unix_address(svrAddr))) {
  30 + if (!sock.connect(osdev::components::socket-cpp::unix_address(svrAddr))) {
69 31 cerr << "Error connecting to server at '" << svrAddr << "'"
70 32 << "\n\t" << sock.last_error_str() << endl;
71 33 return 1;
... ...
examples/unix/undgramechosvr.cpp
1   -// undgramechosvr.cpp
2   -//
3   -// A simple multi-threaded TCP/IP UDP echo server for sockpp library.
4   -//
5   -// This runs a UDP echo server for both IPv4 and IPv6, each in a separate
6   -// thread. They both use the same port number, either as provided by the user
7   -// on the command line, or defaulting to 12345.
8   -//
9   -// USAGE:
10   -// undgramechosvr [port]
11   -//
12   -// You can test with a netcat client, like:
13   -// $ nc -u localhost 12345 # IPv4
14   -// $ nc -6u localhost 12345 # IPv6
15   -//
16   -// --------------------------------------------------------------------------
17   -// This file is part of the "sockpp" C++ socket library.
18   -//
19   -// Copyright (c) 2019 Frank Pagliughi
20   -// All rights reserved.
21   -//
22   -// Redistribution and use in source and binary forms, with or without
23   -// modification, are permitted provided that the following conditions are
24   -// met:
25   -//
26   -// 1. Redistributions of source code must retain the above copyright notice,
27   -// this list of conditions and the following disclaimer.
28   -//
29   -// 2. Redistributions in binary form must reproduce the above copyright
30   -// notice, this list of conditions and the following disclaimer in the
31   -// documentation and/or other materials provided with the distribution.
32   -//
33   -// 3. Neither the name of the copyright holder nor the names of its
34   -// contributors may be used to endorse or promote products derived from this
35   -// software without specific prior written permission.
36   -//
37   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
38   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
39   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
41   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
42   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
43   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
44   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
45   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
46   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
47   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48   -// --------------------------------------------------------------------------
49   -
50 1 #include <iostream>
51   -#include "sockpp/unix_dgram_socket.h"
52   -#include "sockpp/version.h"
  2 +#include "socket-cpp/unix_dgram_socket.h"
  3 +#include "socket-cpp/version.h"
53 4  
54 5 using namespace std;
55 6  
... ... @@ -60,17 +11,17 @@ using namespace std;
60 11 int main(int argc, char* argv[])
61 12 {
62 13 cout << "Sample Unix-domain datagram echo server for 'sockpp' "
63   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  14 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
64 15  
65   - sockpp::socket_initializer sockInit;
  16 + osdev::components::socket-cpp::socket_initializer sockInit;
66 17  
67   - sockpp::unix_dgram_socket sock;
  18 + osdev::components::socket-cpp::unix_dgram_socket sock;
68 19 if (!sock) {
69 20 cerr << "Error creating the socket: " << sock.last_error_str() << endl;
70 21 return 1;
71 22 }
72 23  
73   - if (!sock.bind(sockpp::unix_address("/tmp/undgramechosvr.sock"))) {
  24 + if (!sock.bind(osdev::components::socket-cpp::unix_address("/tmp/undgramechosvr.sock"))) {
74 25 cerr << "Error binding the socket: " << sock.last_error_str() << endl;
75 26 return 1;
76 27 }
... ... @@ -79,7 +30,7 @@ int main(int argc, char* argv[])
79 30 ssize_t n;
80 31 char buf[512];
81 32  
82   - sockpp::unix_address srcAddr;
  33 + osdev::components::socket-cpp::unix_address srcAddr;
83 34  
84 35 cout << "Awaiting packets on: '" << sock.address() << "'" << endl;
85 36  
... ...
examples/unix/unecho.cpp
1   -// unecho.cpp
2   -//
3   -// Simple Unix-domain echo client
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2014-2017 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41   -#include "sockpp/unix_connector.h"
42   -#include "sockpp/version.h"
  3 +#include "socket-cpp/unix_connector.h"
  4 +#include "socket-cpp/version.h"
43 5  
44 6 using namespace std;
45 7  
... ... @@ -48,15 +10,15 @@ using namespace std;
48 10 int main(int argc, char* argv[])
49 11 {
50 12 cout << "Sample Unix-domain echo client for 'sockpp' "
51   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  13 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
52 14  
53 15 string path = (argc > 1) ? argv[1] : "/tmp/unechosvr.sock";
54 16  
55   - sockpp::socket_initializer sockInit;
  17 + osdev::components::socket-cpp::socket_initializer sockInit;
56 18  
57   - sockpp::unix_connector conn;
  19 + osdev::components::socket-cpp::unix_connector conn;
58 20  
59   - bool ok = conn.connect(sockpp::unix_address(path));
  21 + bool ok = conn.connect(osdev::components::socket-cpp::unix_address(path));
60 22 if (!ok) {
61 23 cerr << "Error connecting to UNIX socket at " << path
62 24 << "\n\t" << conn.last_error_str() << endl;
... ...
examples/unix/unechosvr.cpp
1   -// unechosvr.cpp
2   -//
3   -// A multi-threaded UNIX-domain echo server for sockpp library.
4   -// This is a simple thread-per-connection UNIX server.
5   -//
6   -// USAGE:
7   -// unechosvr [path]
8   -//
9   -// --------------------------------------------------------------------------
10   -// This file is part of the "sockpp" C++ socket library.
11   -//
12   -// Copyright (c) 2014-2017 Frank Pagliughi
13   -// All rights reserved.
14   -//
15   -// Redistribution and use in source and binary forms, with or without
16   -// modification, are permitted provided that the following conditions are
17   -// met:
18   -//
19   -// 1. Redistributions of source code must retain the above copyright notice,
20   -// this list of conditions and the following disclaimer.
21   -//
22   -// 2. Redistributions in binary form must reproduce the above copyright
23   -// notice, this list of conditions and the following disclaimer in the
24   -// documentation and/or other materials provided with the distribution.
25   -//
26   -// 3. Neither the name of the copyright holder nor the names of its
27   -// contributors may be used to endorse or promote products derived from this
28   -// software without specific prior written permission.
29   -//
30   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
31   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
34   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41   -// --------------------------------------------------------------------------
42   -
43 1 #include <iostream>
44 2 #include <thread>
45   -#include "sockpp/unix_acceptor.h"
46   -#include "sockpp/version.h"
  3 +#include "socket-cpp/unix_acceptor.h"
  4 +#include "socket-cpp/version.h"
47 5  
48 6 using namespace std;
49 7  
... ... @@ -52,7 +10,7 @@ using namespace std;
52 10 // Ownership of the socket object is transferred to the thread, so when this
53 11 // function exits, the socket is automatically closed.
54 12  
55   -void run_echo(sockpp::unix_socket sock)
  13 +void run_echo(osdev::components::socket-cpp::unix_socket sock)
56 14 {
57 15 int n;
58 16 char buf[512];
... ... @@ -71,7 +29,7 @@ void run_echo(sockpp::unix_socket sock)
71 29 int main(int argc, char* argv[])
72 30 {
73 31 cout << "Sample Unix-domain echo server for 'sockpp' "
74   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  32 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
75 33  
76 34 string path = "/tmp/unechosvr.sock";
77 35  
... ... @@ -79,10 +37,10 @@ int main(int argc, char* argv[])
79 37 path = argv[1];
80 38 }
81 39  
82   - sockpp::socket_initializer sockInit;
83   - sockpp::unix_acceptor acc;
  40 + osdev::components::socket-cpp::socket_initializer sockInit;
  41 + osdev::components::socket-cpp::unix_acceptor acc;
84 42  
85   - bool ok = acc.open(sockpp::unix_address(path));
  43 + bool ok = acc.open(osdev::components::socket-cpp::unix_address(path));
86 44  
87 45 if (!ok) {
88 46 cerr << "Error creating the acceptor: " << acc.last_error_str() << endl;
... ...
examples/unix/unechotest.cpp
1   -// unechotest.cpp
2   -//
3   -// Unix-domain echo timing test client
4   -//
5   -// --------------------------------------------------------------------------
6   -// This file is part of the "sockpp" C++ socket library.
7   -//
8   -// Copyright (c) 2020 Frank Pagliughi
9   -// All rights reserved.
10   -//
11   -// Redistribution and use in source and binary forms, with or without
12   -// modification, are permitted provided that the following conditions are
13   -// met:
14   -//
15   -// 1. Redistributions of source code must retain the above copyright notice,
16   -// this list of conditions and the following disclaimer.
17   -//
18   -// 2. Redistributions in binary form must reproduce the above copyright
19   -// notice, this list of conditions and the following disclaimer in the
20   -// documentation and/or other materials provided with the distribution.
21   -//
22   -// 3. Neither the name of the copyright holder nor the names of its
23   -// contributors may be used to endorse or promote products derived from this
24   -// software without specific prior written permission.
25   -//
26   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
27   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   -// --------------------------------------------------------------------------
38   -
39 1 #include <iostream>
40 2 #include <string>
41 3 #include <chrono>
42 4 #include <random>
43   -#include "sockpp/unix_connector.h"
44   -#include "sockpp/version.h"
  5 +#include "socket-cpp/unix_connector.h"
  6 +#include "socket-cpp/version.h"
45 7  
46 8 using namespace std;
47 9 using namespace std::chrono;
... ... @@ -56,18 +18,18 @@ using fpsec = std::chrono::duration&lt;double, std::chrono::seconds::period&gt;;
56 18 int main(int argc, char* argv[])
57 19 {
58 20 cout << "Unix-domain echo timing test client for 'sockpp' "
59   - << sockpp::SOCKPP_VERSION << '\n' << endl;
  21 + << osdev::components::socket-cpp::SOCKPP_VERSION << '\n' << endl;
60 22  
61 23 string path = (argc > 1) ? argv[1] : "/tmp/unechosvr.sock";
62 24 size_t n = (argc > 2) ? size_t(atoll(argv[2])) : DFLT_N;
63 25 size_t sz = (argc > 3) ? size_t(atoll(argv[3])) : DFLT_SZ;
64 26  
65   - sockpp::socket_initializer sockInit;
  27 + osdev::components::socket-cpp::socket_initializer sockInit;
66 28  
67 29 auto t_start = high_resolution_clock::now();
68   - sockpp::unix_connector conn;
  30 + osdev::components::socket-cpp::unix_connector conn;
69 31  
70   - bool ok = conn.connect(sockpp::unix_address(path));
  32 + bool ok = conn.connect(osdev::components::socket-cpp::unix_address(path));
71 33 if (!ok) {
72 34 cerr << "Error connecting to UNIX socket at " << path
73 35 << "\n\t" << conn.last_error_str() << endl;
... ...
include/socket-cpp/tcp_acceptor.h
  1 +#pragma once
1 2  
2   -#ifndef __sockpp_tcp_acceptor_h
3   -#define __sockpp_tcp_acceptor_h
  3 +#include "socket-cpp/acceptor.h"
  4 +#include "socket-cpp/tcp_socket.h"
4 5  
5   -#include "sockpp/acceptor.h"
6   -#include "sockpp/tcp_socket.h"
7   -
8   -namespace sockpp {
9   -
10   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
11 9  
12 10 /// Class for creating a TCP server.
13 11 /// Objects of this class bind and listen on TCP ports for incoming
... ... @@ -18,9 +16,7 @@ namespace sockpp {
18 16  
19 17 using tcp_acceptor = acceptor_tmpl<tcp_socket>;
20 18  
21   -/////////////////////////////////////////////////////////////////////////////
22   -// end namespace sockpp
23   -};
24   -
25   -#endif // __sockpp_tcp_acceptor_h
  19 +} // End namespace socket-cpp
  20 +} // End namespace components
  21 +} // End namespace osdev
26 22  
... ...
include/socket-cpp/tcp_connector.h
  1 +#pragma once
1 2  
2   -
3   -#ifndef __sockpp_tcp_connector_h
4   -#define __sockpp_tcp_connector_h
5   -
6   -#include "sockpp/connector.h"
7   -#include "sockpp/tcp_socket.h"
8   -
9   -namespace sockpp {
10   -
11   -/////////////////////////////////////////////////////////////////////////////
  3 +#include "socket-cpp/connector.h"
  4 +#include "socket-cpp/tcp_socket.h"
12 5  
13 6 /** IPv4 active, connector (client) socket. */
14 7 using tcp_connector = connector_tmpl<tcp_socket>;
15 8  
16   -/////////////////////////////////////////////////////////////////////////////
17   -// end namespace sockpp
18   -};
  9 +} // End namespace socket-cpp
  10 +} // End namespace components
  11 +} // End namespace osdev
19 12  
20   -#endif // __sockpp_tcp_connector_h
... ...
include/socket-cpp/tcp_socket.h
  1 +#pragma once
1 2  
2   -#ifndef __sockpp_tcp_socket_h
3   -#define __sockpp_tcp_socket_h
  3 +#include "socket-cpp/stream_socket.h"
  4 +#include "socket-cpp/inet_address.h"
4 5  
5   -#include "sockpp/stream_socket.h"
6   -#include "sockpp/inet_address.h"
7   -
8   -namespace sockpp {
9   -
10   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
11 9  
12 10 /** IPv4 streaming TCP socket */
13 11 using tcp_socket = stream_socket_tmpl<inet_address>;
14 12  
15   -/////////////////////////////////////////////////////////////////////////////
16   -// end namespace sockpp
17   -}
18   -
19   -#endif // __sockpp_tcp_socket_h
  13 +} // End namespace socket-cpp
  14 +} // End namespace components
  15 +} // End namespace osdev
20 16  
... ...
include/socket-cpp/udp6_socket.h
1   -/**
2   - * @file udp6_socket.h
3   - *
4   - * Class (typedef) for UDP v6 socket.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date August 2019
11   - */
  1 +#pragma once
12 2  
13   -// --------------------------------------------------------------------------
14   -// This file is part of the "sockpp" C++ socket library.
15   -//
16   -// Copyright (c) 2019 Frank Pagliughi
17   -// All rights reserved.
18   -//
19   -// Redistribution and use in source and binary forms, with or without
20   -// modification, are permitted provided that the following conditions are
21   -// met:
22   -//
23   -// 1. Redistributions of source code must retain the above copyright notice,
24   -// this list of conditions and the following disclaimer.
25   -//
26   -// 2. Redistributions in binary form must reproduce the above copyright
27   -// notice, this list of conditions and the following disclaimer in the
28   -// documentation and/or other materials provided with the distribution.
29   -//
30   -// 3. Neither the name of the copyright holder nor the names of its
31   -// contributors may be used to endorse or promote products derived from this
32   -// software without specific prior written permission.
33   -//
34   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
35   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
36   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
37   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
38   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45   -// --------------------------------------------------------------------------
  3 +#include "socket-cpp/datagram_socket.h"
  4 +#include "socket-cpp/inet6_address.h"
46 5  
47   -#ifndef __sockpp_udp6_socket_h
48   -#define __sockpp_udp6_socket_h
49   -
50   -#include "sockpp/datagram_socket.h"
51   -#include "sockpp/inet6_address.h"
52   -
53   -namespace sockpp {
54   -
55   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
56 9  
57 10 /** UDP datagram socket type for IPv6 */
58 11 using udp6_socket = datagram_socket_tmpl<inet6_address>;
59 12  
60   -/////////////////////////////////////////////////////////////////////////////
61   -// end namespace sockpp
62   -}
63   -
64   -#endif // __sockpp_udp6_socket_h
  13 +} // End namespace socket-cpp
  14 +} // End namespace components
  15 +} // End namespace osdev
65 16  
... ...
include/socket-cpp/udp_socket.h
  1 +#pragma once
1 2  
  3 +#include "socket-cpp/datagram_socket.h"
  4 +#include "socket-cpp/inet_address.h"
2 5  
3   -#include "sockpp/datagram_socket.h"
4   -#include "sockpp/inet_address.h"
5   -
6   -namespace sockpp {
7   -
8   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
9 9  
10 10 /** UDP datagram socket type for IPv4 */
11 11 using udp_socket = datagram_socket_tmpl<inet_address>;
12 12  
13   -/////////////////////////////////////////////////////////////////////////////
14   -// end namespace sockpp
15   -}
16   -
17   -#endif // __sockpp_udp_socket_h
  13 +} // End namespace socket-cpp
  14 +} // End namespace components
  15 +} // End namespace osdev
18 16  
... ...
include/socket-cpp/unix_acceptor.h
  1 +#pragma once
1 2  
2   -#include "sockpp/acceptor.h"
3   -#include "sockpp/unix_stream_socket.h"
  3 +#include "socket-cpp/acceptor.h"
  4 +#include "socket-cpp/unix_stream_socket.h"
4 5  
5   -namespace sockpp {
6   -
7   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
8 9  
9 10 /// Class for creating a Unix-domain server.
10 11 /// Objects of this class bind and listen on Unix-domain ports for
... ... @@ -61,9 +62,7 @@ public:
61 62 unix_socket accept() { return unix_socket(base::accept()); }
62 63 };
63 64  
64   -/////////////////////////////////////////////////////////////////////////////
65   -// end namespace sockpp
66   -};
67   -
68   -#endif // __sockpp_unix_acceptor_h
  65 +} // End namespace socket-cpp
  66 +} // End namespace components
  67 +} // End namespace osdev
69 68  
... ...
include/socket-cpp/unix_address.h
1   -/**
2   - * @file unix_address.h
3   - *
4   - * Class for a UNIX-domain socket address.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date February 2014
11   - */
12   -
13   -// --------------------------------------------------------------------------
14   -// This file is part of the "sockpp" C++ socket library.
15   -//
16   -// Copyright (c) 2014-2017 Frank Pagliughi
17   -// All rights reserved.
18   -//
19   -// Redistribution and use in source and binary forms, with or without
20   -// modification, are permitted provided that the following conditions are
21   -// met:
22   -//
23   -// 1. Redistributions of source code must retain the above copyright notice,
24   -// this list of conditions and the following disclaimer.
25   -//
26   -// 2. Redistributions in binary form must reproduce the above copyright
27   -// notice, this list of conditions and the following disclaimer in the
28   -// documentation and/or other materials provided with the distribution.
29   -//
30   -// 3. Neither the name of the copyright holder nor the names of its
31   -// contributors may be used to endorse or promote products derived from this
32   -// software without specific prior written permission.
33   -//
34   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
35   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
36   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
37   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
38   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45   -// --------------------------------------------------------------------------
46   -
47   -#ifndef __sockpp_unix_addr_h
48   -#define __sockpp_unix_addr_h
  1 +#pragma once
49 2  
50   -#include "sockpp/platform.h"
51   -#include "sockpp/sock_address.h"
  3 +#include "socket-cpp/platform.h"
  4 +#include "socket-cpp/sock_address.h"
52 5 #include <iostream>
53 6 #include <string>
54 7 #include <cstring>
55 8 #include <sys/un.h>
56 9  
57   -namespace sockpp {
58   -
59   -/////////////////////////////////////////////////////////////////////////////
  10 +namespace osdev {
  11 +namespace components {
  12 +namespace socket-cpp {
60 13  
61 14 /**
62 15 * Class that represents a UNIX domain address.
... ... @@ -184,9 +137,7 @@ public:
184 137 */
185 138 std::ostream& operator<<(std::ostream& os, const unix_address& addr);
186 139  
187   -/////////////////////////////////////////////////////////////////////////////
188   -// end namespace sockpp
189   -}
190   -
191   -#endif // __sockpp_unix_addr_h
  140 +} // End namespace socket-cpp
  141 +} // End namespace components
  142 +} // End namespace osdev
192 143  
... ...
include/socket-cpp/unix_connector.h
  1 +#pragma once
1 2  
2   -#include "sockpp/connector.h"
3   -#include "sockpp/unix_stream_socket.h"
  3 +#include "socket-cpp/connector.h"
  4 +#include "socket-cpp/unix_stream_socket.h"
4 5  
5   -namespace sockpp {
6   -
7   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
8 9  
9 10 /** Unix-domain active connector socket. */
10 11 using unix_connector = connector_tmpl<unix_socket, unix_address>;
11 12  
12   -/////////////////////////////////////////////////////////////////////////////
13   -// end namespace sockpp
14   -};
15   -
16   -#endif // __sockpp_unix_connector_h
  13 +} // End namespace socket-cpp
  14 +} // End namespace components
  15 +} // End namespace osdev
17 16  
... ...
include/socket-cpp/unix_dgram_socket.h
  1 +#pragma once
1 2  
  3 +#include "socket-cpp/datagram_socket.h"
  4 +#include "socket-cpp/unix_address.h"
2 5  
3   -#include "sockpp/datagram_socket.h"
4   -#include "sockpp/unix_address.h"
5   -
6   -namespace sockpp {
7   -
8   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
9 9  
10 10 /** Unix-domain datagram socket */
11 11 using unix_datagram_socket = datagram_socket_tmpl<unix_address>;
... ... @@ -13,9 +13,7 @@ using unix_datagram_socket = datagram_socket_tmpl&lt;unix_address&gt;;
13 13 /** Unix-domain datagram socket (same as `unix_datagram_socket`) */
14 14 using unix_dgram_socket = unix_datagram_socket;
15 15  
16   -/////////////////////////////////////////////////////////////////////////////
17   -// end namespace sockpp
18   -}
19   -
20   -#endif // __sockpp_unix_dgram_socket_h
  16 +} // End namespace socket-cpp
  17 +} // End namespace components
  18 +} // End namespace osdev
21 19  
... ...
include/socket-cpp/unix_stream_socket.h
  1 +$pragma once
1 2  
  3 +#include "socket-cpp/stream_socket.h"
  4 +#include "socket-cpp/unix_address.h"
2 5  
3   -#include "sockpp/stream_socket.h"
4   -#include "sockpp/unix_address.h"
5   -
6   -namespace sockpp {
7   -
8   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
9 9  
10 10 /** Streaming Unix-domain socket */
11 11 using unix_stream_socket = stream_socket_tmpl<unix_address>;
... ... @@ -13,9 +13,7 @@ using unix_stream_socket = stream_socket_tmpl&lt;unix_address&gt;;
13 13 /** Streaming Unix-domain socket (same as a `unix_stream_socket` */
14 14 using unix_socket = unix_stream_socket;
15 15  
16   -/////////////////////////////////////////////////////////////////////////////
17   -// end namespace sockpp
18   -}
19   -
20   -#endif // __sockpp_unix_stream_socket_h
  16 +} // End namespace socket-cpp
  17 +} // End namespace components
  18 +} // End namespace osdev
21 19  
... ...