Commit ea9eaf951302a677a9a3a345ee2bb26dd4177e65

Authored by Peter M. Groen
1 parent 48b4c725

Fixed Headers

include/socket-cpp/acceptor.h
... ... @@ -60,13 +60,15 @@ public:
60 60 acceptor(const sock_address& addr, int queSize=DFLT_QUE_SIZE) {
61 61 open(addr, queSize);
62 62 }
63   - /**
  63 +
  64 + /**
64 65 * Move constructor.
65 66 * Creates an acceptor by moving the other acceptor to this one.
66 67 * @param acc Another acceptor
67 68 */
68 69 acceptor(acceptor&& acc) : base(std::move(acc)) {}
69   - /**
  70 +
  71 + /**
70 72 * Creates an unbound acceptor socket with an open OS socket handle.
71 73 * An application would need to manually bind and listen to this
72 74 * acceptor to get incoming connections.
... ... @@ -74,7 +76,8 @@ public:
74 76 * @return An open, but unbound acceptor socket.
75 77 */
76 78 static acceptor create(int domain);
77   - /**
  79 +
  80 + /**
78 81 * Move assignment.
79 82 * @param rhs The other socket to move into this one.
80 83 * @return A reference to this object.
... ... @@ -83,7 +86,8 @@ public:
83 86 base::operator=(std::move(rhs));
84 87 return *this;
85 88 }
86   - /**
  89 +
  90 + /**
87 91 * Sets the socket listening on the address to which it is bound.
88 92 * @param queSize The listener queue size.
89 93 * @return @em true on success, @em false on error
... ... @@ -91,7 +95,8 @@ public:
91 95 bool listen(int queSize=DFLT_QUE_SIZE) {
92 96 return check_ret_bool(::listen(handle(), queSize));
93 97 };
94   - /**
  98 +
  99 + /**
95 100 * Opens the acceptor socket, binds it to the specified address, and starts
96 101 * listening.
97 102 * @param addr The address to which this server should be bound.
... ... @@ -102,7 +107,8 @@ public:
102 107 * @return @em true on success, @em false on error
103 108 */
104 109 bool open(const sock_address& addr, int queSize=DFLT_QUE_SIZE, bool reuseSock=true);
105   - /**
  110 +
  111 + /**
106 112 * Accepts an incoming TCP connection and gets the address of the client.
107 113 * @param clientAddr Pointer to the variable that will get the
108 114 * address of a client when it connects.
... ...
include/socket-cpp/socket.h
1   -/**
2   - * @file socket.h
3   - *
4   - * Classes for TCP & UDP socket.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date December 2014
11   - */
12   -
13   -// --------------------------------------------------------------------------
14   -// This file is part of the "sockpp" C++ socket library.
15   -//
16   -// Copyright (c) 2014-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   -// --------------------------------------------------------------------------
  1 +#pragma once
46 2  
47   -#ifndef __sockpp_socket_h
48   -#define __sockpp_socket_h
49   -
50   -#include "sockpp/sock_address.h"
  3 +#include "socket-cpp/sock_address.h"
51 4 #include <chrono>
52 5 #include <string>
53 6 #include <tuple>
54 7  
55   -namespace sockpp {
56   -
57   -/////////////////////////////////////////////////////////////////////////////
  8 +namespace osdev {
  9 +namespace components {
  10 +namespace socket-cpp {
58 11  
59 12 #if !defined(SOCKPP_SOCKET_T_DEFINED)
60 13 typedef int socket_t; ///< The OS socket handle
... ... @@ -488,8 +441,6 @@ public:
488 441 bool close();
489 442 };
490 443  
491   -/////////////////////////////////////////////////////////////////////////////
492   -
493 444 /**
494 445 * RAII class to initialize and then shut down the library.
495 446 * A single object of this class can be declared before any other classes in
... ... @@ -507,9 +458,6 @@ public:
507 458 ~socket_initializer() { socket::destroy(); }
508 459 };
509 460  
510   -/////////////////////////////////////////////////////////////////////////////
511   -// end namespace sockpp
512   -}
513   -
514   -#endif // __sockpp_socket_h
515   -
  461 +} // End namespace socket-cpp
  462 +} // End namespace components
  463 +} // End namespace osdev
... ...
include/socket-cpp/stream_socket.h
1   -/**
2   - * @file stream_socket.h
3   - *
4   - * Classes for stream sockets.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date December 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_stream_socket_h
48   -#define __sockpp_stream_socket_h
  1 +#pragma once
49 2  
50   -#include "sockpp/socket.h"
  3 +#include "socket-cpp/socket.h"
51 4 #include <vector>
52 5  
53   -namespace sockpp {
54   -
55   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
56 9  
57 10 /**
58 11 * Base class for streaming sockets, such as TCP and Unix Domain.
... ... @@ -324,9 +277,7 @@ public:
324 277 addr_t peer_address() const { return addr_t(socket::peer_address()); }
325 278 };
326 279  
327   -/////////////////////////////////////////////////////////////////////////////
328   -// end namespace sockpp
329   -}
330   -
331   -#endif // __sockpp_socket_h
  280 +} // End namespace socket-cpp
  281 +} // End namespace components
  282 +} // End namespace osdev
332 283  
... ...
include/socket-cpp/tcp6_acceptor.h
1   -/// @file tcp6_acceptor.h
2   -///
3   -/// Class for a TCP v6 server to accept incoming connections.
4   -///
5   -/// @author Frank Pagliughi
6   -/// @author SoRo Systems, Inc.
7   -/// @author www.sorosys.com
8   -///
9   -/// @date May 2019
  1 +#pragma once
10 2  
11   -// --------------------------------------------------------------------------
12   -// This file is part of the "sockpp" C++ socket library.
13   -//
14   -// Copyright (c) 2019 Frank Pagliughi
15   -// All rights reserved.
16   -//
17   -// Redistribution and use in source and binary forms, with or without
18   -// modification, are permitted provided that the following conditions are
19   -// met:
20   -//
21   -// 1. Redistributions of source code must retain the above copyright notice,
22   -// this list of conditions and the following disclaimer.
23   -//
24   -// 2. Redistributions in binary form must reproduce the above copyright
25   -// notice, this list of conditions and the following disclaimer in the
26   -// documentation and/or other materials provided with the distribution.
27   -//
28   -// 3. Neither the name of the copyright holder nor the names of its
29   -// contributors may be used to endorse or promote products derived from this
30   -// software without specific prior written permission.
31   -//
32   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
33   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
34   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
36   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43   -// --------------------------------------------------------------------------
  3 +#include "socket-cpp/acceptor.h"
  4 +#include "socket-cpp/tcp6_socket.h"
44 5  
45   -#ifndef __sockpp_tcp6_acceptor_h
46   -#define __sockpp_tcp6_acceptor_h
47   -
48   -#include "sockpp/acceptor.h"
49   -#include "sockpp/tcp6_socket.h"
50   -
51   -namespace sockpp {
52   -
53   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
54 9  
55 10 /// Class for creating a TCP v6 server.
56 11 /// Objects of this class bind and listen on TCP ports for incoming
... ... @@ -61,9 +16,6 @@ namespace sockpp {
61 16  
62 17 using tcp6_acceptor = acceptor_tmpl<tcp6_socket>;
63 18  
64   -/////////////////////////////////////////////////////////////////////////////
65   -// end namespace sockpp
66   -};
67   -
68   -#endif // __sockpp_tcp_acceptor_h
69   -
  19 +} // End namespace socket-cpp
  20 +} // End namespace components
  21 +} // End namespace osdev
... ...
include/socket-cpp/tcp6_connector.h
1   -/**
2   - * @file tcp6_connector.h
3   - *
4   - * Class for creating client-side TCP connections
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date May 2019
11   - */
  1 +#pragma once
12 2  
13   -// --------------------------------------------------------------------------
14   -// This file is part of the "sockpp" C++ socket library.
15   -//
16   -// Copyright (c) 2014-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/connector.h"
  4 +#include "socket-cpp/tcp6_socket.h"
46 5  
47   -
48   -#ifndef __sockpp_tcp6_connector_h
49   -#define __sockpp_tcp6_connector_h
50   -
51   -#include "sockpp/connector.h"
52   -#include "sockpp/tcp6_socket.h"
53   -
54   -namespace sockpp {
55   -
56   -/////////////////////////////////////////////////////////////////////////////
  6 +namespace osdev {
  7 +namespace components {
  8 +namespace socket-cpp {
57 9  
58 10 /** IPv6 active, connector (client) socket. */
59 11 using tcp6_connector = connector_tmpl<tcp6_socket>;
60 12  
61   -/////////////////////////////////////////////////////////////////////////////
62   -// end namespace sockpp
63   -}
64   -
65   -#endif // __sockpp_tcp6_connector_h
  13 +} // End namespace socket-cpp
  14 +} // End namespace components
  15 +} // End namespace osdev
66 16  
... ...
include/socket-cpp/tcp6_socket.h
1   -/**
2   - * @file tcp6_socket.h
3   - *
4   - * Class (typedef) for IPv6 TCP 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/stream_socket.h"
  4 +#include "socket-cpp/inet6_address.h"
46 5  
47   -#ifndef __sockpp_tcp6_socket_h
48   -#define __sockpp_tcp6_socket_h
49   -
50   -#include "sockpp/stream_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 /** IPv6 streaming TCP socket */
58 11 using tcp6_socket = stream_socket_tmpl<inet6_address>;
59 12  
60   -/////////////////////////////////////////////////////////////////////////////
61   -// end namespace sockpp
62   -}
63   -
64   -#endif // __sockpp_tcp6_socket_h
65   -
  13 +} // End namespace socket-cpp
  14 +} // End namespace components
  15 +} // End namespace osdev
... ...
include/socket-cpp/tcp_acceptor.h
1   -/// @file tcp_acceptor.h
2   -///
3   -/// Class for a TCP server to accept incoming connections.
4   -///
5   -/// @author Frank Pagliughi
6   -/// @author SoRo Systems, Inc.
7   -/// @author www.sorosys.com
8   -///
9   -/// @date December 2014
10   -
11   -// --------------------------------------------------------------------------
12   -// This file is part of the "sockpp" C++ socket library.
13   -//
14   -// Copyright (c) 2014-2019 Frank Pagliughi
15   -// All rights reserved.
16   -//
17   -// Redistribution and use in source and binary forms, with or without
18   -// modification, are permitted provided that the following conditions are
19   -// met:
20   -//
21   -// 1. Redistributions of source code must retain the above copyright notice,
22   -// this list of conditions and the following disclaimer.
23   -//
24   -// 2. Redistributions in binary form must reproduce the above copyright
25   -// notice, this list of conditions and the following disclaimer in the
26   -// documentation and/or other materials provided with the distribution.
27   -//
28   -// 3. Neither the name of the copyright holder nor the names of its
29   -// contributors may be used to endorse or promote products derived from this
30   -// software without specific prior written permission.
31   -//
32   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
33   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
34   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
36   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43   -// --------------------------------------------------------------------------
44 1  
45 2 #ifndef __sockpp_tcp_acceptor_h
46 3 #define __sockpp_tcp_acceptor_h
... ...
include/socket-cpp/tcp_connector.h
1   -/**
2   - * @file tcp_connector.h
3   - *
4   - * Class for creating client-side TCP connections
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date December 2014
11   - */
12   -
13   -// --------------------------------------------------------------------------
14   -// This file is part of the "sockpp" C++ socket library.
15   -//
16   -// Copyright (c) 2014-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   -// --------------------------------------------------------------------------
46 1  
47 2  
48 3 #ifndef __sockpp_tcp_connector_h
... ...
include/socket-cpp/tcp_socket.h
1   -/**
2   - * @file tcp_socket.h
3   - *
4   - * Class (typedef) for IPv4 TCP socket.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date August 2019
11   - */
12   -
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   -// --------------------------------------------------------------------------
46 1  
47 2 #ifndef __sockpp_tcp_socket_h
48 3 #define __sockpp_tcp_socket_h
... ...
include/socket-cpp/udp_socket.h
1   -/**
2   - * @file udp_socket.h
3   - *
4   - * Class (typedef) for UDP v4 socket.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date August 2019
11   - */
12 1  
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   -// --------------------------------------------------------------------------
46   -
47   -#ifndef __sockpp_udp_socket_h
48   -#define __sockpp_udp_socket_h
49 2  
50 3 #include "sockpp/datagram_socket.h"
51 4 #include "sockpp/inet_address.h"
... ...
include/socket-cpp/unix_acceptor.h
1   -/// @file unix_acceptor.h
2   -///
3   -/// Class for a TCP server to accept incoming connections.
4   -///
5   -/// @author Frank Pagliughi
6   -/// @author SoRo Systems, Inc.
7   -/// @author www.sorosys.com
8   -///
9   -/// @date December 2014
10   -
11   -// --------------------------------------------------------------------------
12   -// This file is part of the "sockpp" C++ socket library.
13   -//
14   -// Copyright (c) 2014-2017 Frank Pagliughi
15   -// All rights reserved.
16   -//
17   -// Redistribution and use in source and binary forms, with or without
18   -// modification, are permitted provided that the following conditions are
19   -// met:
20   -//
21   -// 1. Redistributions of source code must retain the above copyright notice,
22   -// this list of conditions and the following disclaimer.
23   -//
24   -// 2. Redistributions in binary form must reproduce the above copyright
25   -// notice, this list of conditions and the following disclaimer in the
26   -// documentation and/or other materials provided with the distribution.
27   -//
28   -// 3. Neither the name of the copyright holder nor the names of its
29   -// contributors may be used to endorse or promote products derived from this
30   -// software without specific prior written permission.
31   -//
32   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
33   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
34   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
36   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43   -// --------------------------------------------------------------------------
44   -
45   -#ifndef __sockpp_unix_acceptor_h
46   -#define __sockpp_unix_acceptor_h
47 1  
48 2 #include "sockpp/acceptor.h"
49 3 #include "sockpp/unix_stream_socket.h"
... ...
include/socket-cpp/unix_connector.h
1   -/**
2   - * @file unix_connector.h
3   - *
4   - * Class for creating client-side UNIX-domain socket connections.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date December 2018
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_connector_h
48   -#define __sockpp_unix_connector_h
49 1  
50 2 #include "sockpp/connector.h"
51 3 #include "sockpp/unix_stream_socket.h"
... ...
include/socket-cpp/unix_dgram_socket.h
1   -/**
2   - * @file unix_dgram_socket.h
3   - *
4   - * Class (typedef) for Unix-domain UDP socket.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date August 2019
11   - */
12 1  
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   -// --------------------------------------------------------------------------
46   -
47   -#ifndef __sockpp_unix_dgram_socket_h
48   -#define __sockpp_unix_dgram_socket_h
49 2  
50 3 #include "sockpp/datagram_socket.h"
51 4 #include "sockpp/unix_address.h"
... ...
include/socket-cpp/unix_stream_socket.h
1   -/**
2   - * @file unix_stream_socket.h
3   - *
4   - * Class (typedef) for Unix-domain streaming socket.
5   - *
6   - * @author Frank Pagliughi
7   - * @author SoRo Systems, Inc.
8   - * @author www.sorosys.com
9   - *
10   - * @date August 2019
11   - */
12 1  
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   -// --------------------------------------------------------------------------
46   -
47   -#ifndef __sockpp_unix_stream_socket_h
48   -#define __sockpp_unix_stream_socket_h
49 2  
50 3 #include "sockpp/stream_socket.h"
51 4 #include "sockpp/unix_address.h"
... ...
src/acceptor.cpp
1 1 #include <cstring>
2   -#include "sockpp/acceptor.h"
  2 +#include "socket-cpp/acceptor.h"
3 3  
4 4 using namespace std;
5   -
6   -namespace sockpp {
7   -
8   -/////////////////////////////////////////////////////////////////////////////
  5 +using namespace osdev::components::socket-cpp;
9 6  
10 7 acceptor acceptor::create(int domain)
11 8 {
... ... @@ -68,7 +65,4 @@ stream_socket acceptor::accept(sock_address* clientAddr /*=nullptr*/)
68 65 return stream_socket(s);
69 66 }
70 67  
71   -/////////////////////////////////////////////////////////////////////////////
72   -// end namespace sockpp
73   -}
74 68  
... ...
src/connector.cpp
1   -#include "sockpp/connector.h"
  1 +#include "socket-cpp/connector.h"
2 2  
3   -namespace sockpp {
  3 +using namespace osdev::components::socket-cpp;
4 4  
5   -bool connector::connect(const sock_address& addr)
  5 +bool connector::connect( const sock_address& addr )
6 6 {
7 7 sa_family_t domain = addr.family();
8 8 socket_t h = create_handle(domain);
... ... @@ -19,5 +19,3 @@ bool connector::connect(const sock_address&amp; addr)
19 19 return true;
20 20 }
21 21  
22   -}
23   -
... ...
src/datagram_socket.cpp
1   -#include "sockpp/datagram_socket.h"
2   -#include "sockpp/exception.h"
  1 +#include "socket-cpp/datagram_socket.h"
  2 +#include "socket-cpp/exception.h"
3 3 #include <algorithm>
4 4  
5 5 using namespace std::chrono;
6   -
7   -namespace sockpp {
  6 +using namespace osdev::components::socket-cpp;
8 7  
9 8 datagram_socket::datagram_socket(const sock_address& addr)
10 9 {
... ... @@ -33,6 +32,3 @@ ssize_t datagram_socket::recv_from(void* buf, size_t n, int flags,
33 32 #endif
34 33 }
35 34  
36   -
37   -}
38   -
... ...
src/exception.cpp
1   -#include "sockpp/exception.h"
2   -#include "sockpp/platform.h"
  1 +#include "socket-cpp/exception.h"
  2 +#include "socket-cpp/platform.h"
3 3 #include <cstring>
4 4  
5 5 // Used to explicitly ignore the returned value of a function call.
6 6 #define ignore_result(x) if (x) {}
7 7  
8 8 using namespace std;
9   -
10   -namespace sockpp {
  9 +using namespace osdev::components::socket-cpp;
11 10  
12 11 sys_error::sys_error(int err) : runtime_error(error_str(err)), errno_(err)
13 12 {
... ... @@ -46,5 +45,3 @@ getaddrinfo_error::getaddrinfo_error(int err, const string&amp; hostname)
46 45 {
47 46 }
48 47  
49   -}
50   -
... ...
src/inet6_address.cpp
1   -#include "sockpp/inet6_address.h"
2   -#include "sockpp/exception.h"
  1 +#include "socket-cpp/inet6_address.h"
  2 +#include "socket-cpp/exception.h"
3 3  
4 4 using namespace std;
5   -
6   -namespace sockpp {
  5 +using namespace osdev::components::socket-cpp;
7 6  
8 7 bool inet6_address::is_set() const
9 8 {
... ... @@ -76,5 +75,3 @@ ostream&amp; operator&lt;&lt;(ostream&amp; os, const inet6_address&amp; addr)
76 75 return os;
77 76 }
78 77  
79   -}
80   -
... ...
src/inet_address.cpp
1   -#include "sockpp/inet_address.h"
2   -#include "sockpp/exception.h"
  1 +#include "socket-cpp/inet_address.h"
  2 +#include "socket-cpp/exception.h"
3 3  
4 4 using namespace std;
5   -
6   -namespace sockpp {
  5 +using namespace osdev::components::socket-cpp;
7 6  
8 7 bool inet_address::is_set() const
9 8 {
... ... @@ -72,4 +71,3 @@ ostream&amp; operator&lt;&lt;(ostream&amp; os, const inet_address&amp; addr)
72 71 return os;
73 72 }
74 73  
75   -}
... ...
src/linux/can_address.cpp
1   -// can_address.cpp
2   -//
3   -// --------------------------------------------------------------------------
4   -// This file is part of the "sockpp" C++ socket library.
5   -//
6   -// Copyright (c) 2014-2021 Frank Pagliughi
7   -// All rights reserved.
8   -//
9   -// Redistribution and use in source and binary forms, with or without
10   -// modification, are permitted provided that the following conditions are
11   -// met:
12   -//
13   -// 1. Redistributions of source code must retain the above copyright notice,
14   -// this list of conditions and the following disclaimer.
15   -//
16   -// 2. Redistributions in binary form must reproduce the above copyright
17   -// notice, this list of conditions and the following disclaimer in the
18   -// documentation and/or other materials provided with the distribution.
19   -//
20   -// 3. Neither the name of the copyright holder nor the names of its
21   -// contributors may be used to endorse or promote products derived from this
22   -// software without specific prior written permission.
23   -//
24   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35   -// --------------------------------------------------------------------------
36   -
37   -#include "sockpp/can_address.h"
38   -#include "sockpp/socket.h"
  1 +#include "socket-cpp/can_address.h"
  2 +#include "socket-cpp/socket.h"
39 3 #include <cstring>
40 4 #include <stdexcept>
41 5 #include <sys/ioctl.h>
42 6 #include <net/if.h>
43 7  
44 8 using namespace std;
45   -
46   -namespace sockpp {
47   -
48   -/////////////////////////////////////////////////////////////////////////////
  9 +using namespace osdev::components::socket-cpp;
49 10  
50 11 constexpr sa_family_t can_address::ADDRESS_FAMILY;
51 12  
... ... @@ -90,15 +51,9 @@ string can_address::iface() const
90 51 return string(iface ? iface : "unknown");
91 52 }
92 53  
93   -
94   -// --------------------------------------------------------------------------
95   -
96 54 ostream& operator<<(ostream& os, const can_address& addr)
97 55 {
98 56 os << "can:" << addr.iface();
99 57 return os;
100 58 }
101 59  
102   -/////////////////////////////////////////////////////////////////////////////
103   -// End namespace sockpp
104   -}
... ...
src/linux/can_socket.cpp
1   -// can_socket.cpp
2   -//
3   -// --------------------------------------------------------------------------
4   -// This file is part of the "sockpp" C++ socket library.
5   -//
6   -// Copyright (c) 2021 Frank Pagliughi
7   -// All rights reserved.
8   -//
9   -// Redistribution and use in source and binary forms, with or without
10   -// modification, are permitted provided that the following conditions are
11   -// met:
12   -//
13   -// 1. Redistributions of source code must retain the above copyright notice,
14   -// this list of conditions and the following disclaimer.
15   -//
16   -// 2. Redistributions in binary form must reproduce the above copyright
17   -// notice, this list of conditions and the following disclaimer in the
18   -// documentation and/or other materials provided with the distribution.
19   -//
20   -// 3. Neither the name of the copyright holder nor the names of its
21   -// contributors may be used to endorse or promote products derived from this
22   -// software without specific prior written permission.
23   -//
24   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35   -// --------------------------------------------------------------------------
36   -
37   -#include "sockpp/can_socket.h"
38   -#include "sockpp/socket.h"
  1 +#include "socket-cpp/can_socket.h"
  2 +#include "socket-cpp/socket.h"
39 3 #include <sys/ioctl.h>
40 4  
41 5 using namespace std;
42 6 using namespace std::chrono;
43   -
44   -namespace sockpp {
45   -
46   -/////////////////////////////////////////////////////////////////////////////
  7 +using namespace osdev::components::socket-cpp;
47 8  
48 9 can_socket::can_socket(const can_address& addr)
49 10 {
50   - socket_t h = create_handle(SOCK_RAW, CAN_RAW);
  11 + socket_t socketHandle = create_handle( SOCK_RAW, CAN_RAW );
51 12  
52   - if (check_socket_bool(h)) {
53   - reset(h);
54   - bind(addr);
  13 + if ( check_socket_bool( socketHandle ) )
  14 + {
  15 + reset( socketHandle );
  16 + bind( addr );
55 17 }
56 18 }
57 19  
... ... @@ -87,6 +49,3 @@ ssize_t can_socket::recv_from(can_frame *frame, int flags,
87 49 flags, p, &len));
88 50 }
89 51  
90   -/////////////////////////////////////////////////////////////////////////////
91   -// End namespace sockpp
92   -}
... ...
src/socket.cpp
1   -#include "sockpp/socket.h"
2   -#include "sockpp/exception.h"
  1 +#include "socket-cpp/socket.h"
  2 +#include "socket-cpp/exception.h"
3 3 #include <algorithm>
4 4 #include <cstring>
5 5 #include <fcntl.h>
... ... @@ -8,8 +8,7 @@
8 8 #define ignore_result(x) if (x) {}
9 9  
10 10 using namespace std::chrono;
11   -
12   -namespace sockpp {
  11 +using namespace osdev::components::socket-cpp;
13 12  
14 13 timeval to_timeval(const microseconds& dur)
15 14 {
... ... @@ -227,5 +226,3 @@ bool socket::close()
227 226 return true;
228 227 }
229 228  
230   -}
231   -
... ...
src/stream_socket.cpp
... ... @@ -4,8 +4,7 @@
4 4 #include <memory>
5 5  
6 6 using namespace std::chrono;
7   -
8   -namespace socket-cpp {
  7 +using namespace osdev::components::socket-cpp;
9 8  
10 9 stream_socket stream_socket::create(int domain, int protocol /*=0*/)
11 10 {
... ... @@ -148,5 +147,3 @@ bool stream_socket::write_timeout(const microseconds&amp; to)
148 147 return set_option(SOL_SOCKET, SO_SNDTIMEO, tv);
149 148 }
150 149  
151   -}
152   -
... ...
src/unix/unix_address.cpp
1   -// unix_address.cpp
2   -//
3   -// --------------------------------------------------------------------------
4   -// This file is part of the "sockpp" C++ socket library.
5   -//
6   -// Copyright (c) 2014-2017 Frank Pagliughi
7   -// All rights reserved.
8   -//
9   -// Redistribution and use in source and binary forms, with or without
10   -// modification, are permitted provided that the following conditions are
11   -// met:
12   -//
13   -// 1. Redistributions of source code must retain the above copyright notice,
14   -// this list of conditions and the following disclaimer.
15   -//
16   -// 2. Redistributions in binary form must reproduce the above copyright
17   -// notice, this list of conditions and the following disclaimer in the
18   -// documentation and/or other materials provided with the distribution.
19   -//
20   -// 3. Neither the name of the copyright holder nor the names of its
21   -// contributors may be used to endorse or promote products derived from this
22   -// software without specific prior written permission.
23   -//
24   -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25   -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26   -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27   -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28   -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29   -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30   -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31   -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32   -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33   -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34   -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35   -// --------------------------------------------------------------------------
36   -
37   -#include "sockpp/unix_address.h"
  1 +#include "socket-cpp/unix_address.h"
38 2 #include <cstring>
39 3 #include <stdexcept>
40 4  
41 5 using namespace std;
42   -
43   -namespace sockpp {
44   -
45   -/////////////////////////////////////////////////////////////////////////////
  6 +using namespace osdev::components::socket-cpp;
46 7  
47 8 constexpr sa_family_t unix_address::ADDRESS_FAMILY;
48 9 constexpr size_t unix_address::MAX_PATH_NAME;
... ... @@ -74,6 +35,3 @@ ostream&amp; operator&lt;&lt;(ostream&amp; os, const unix_address&amp; addr)
74 35 return os;
75 36 }
76 37  
77   -/////////////////////////////////////////////////////////////////////////////
78   -// End namespace sockpp
79   -}
... ...