diff --git a/include/socket-cpp/acceptor.h b/include/socket-cpp/acceptor.h index 30e6753..c980011 100644 --- a/include/socket-cpp/acceptor.h +++ b/include/socket-cpp/acceptor.h @@ -60,13 +60,15 @@ public: acceptor(const sock_address& addr, int queSize=DFLT_QUE_SIZE) { open(addr, queSize); } - /** + + /** * Move constructor. * Creates an acceptor by moving the other acceptor to this one. * @param acc Another acceptor */ acceptor(acceptor&& acc) : base(std::move(acc)) {} - /** + + /** * Creates an unbound acceptor socket with an open OS socket handle. * An application would need to manually bind and listen to this * acceptor to get incoming connections. @@ -74,7 +76,8 @@ public: * @return An open, but unbound acceptor socket. */ static acceptor create(int domain); - /** + + /** * Move assignment. * @param rhs The other socket to move into this one. * @return A reference to this object. @@ -83,7 +86,8 @@ public: base::operator=(std::move(rhs)); return *this; } - /** + + /** * Sets the socket listening on the address to which it is bound. * @param queSize The listener queue size. * @return @em true on success, @em false on error @@ -91,7 +95,8 @@ public: bool listen(int queSize=DFLT_QUE_SIZE) { return check_ret_bool(::listen(handle(), queSize)); }; - /** + + /** * Opens the acceptor socket, binds it to the specified address, and starts * listening. * @param addr The address to which this server should be bound. @@ -102,7 +107,8 @@ public: * @return @em true on success, @em false on error */ bool open(const sock_address& addr, int queSize=DFLT_QUE_SIZE, bool reuseSock=true); - /** + + /** * Accepts an incoming TCP connection and gets the address of the client. * @param clientAddr Pointer to the variable that will get the * address of a client when it connects. diff --git a/include/socket-cpp/socket.h b/include/socket-cpp/socket.h index f1a2a82..c6e7d69 100644 --- a/include/socket-cpp/socket.h +++ b/include/socket-cpp/socket.h @@ -1,60 +1,13 @@ -/** - * @file socket.h - * - * Classes for TCP & UDP socket. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date December 2014 - */ - -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- +#pragma once -#ifndef __sockpp_socket_h -#define __sockpp_socket_h - -#include "sockpp/sock_address.h" +#include "socket-cpp/sock_address.h" #include #include #include -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { #if !defined(SOCKPP_SOCKET_T_DEFINED) typedef int socket_t; ///< The OS socket handle @@ -488,8 +441,6 @@ public: bool close(); }; -///////////////////////////////////////////////////////////////////////////// - /** * RAII class to initialize and then shut down the library. * A single object of this class can be declared before any other classes in @@ -507,9 +458,6 @@ public: ~socket_initializer() { socket::destroy(); } }; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_socket_h - +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/stream_socket.h b/include/socket-cpp/stream_socket.h index e0722d2..b4778cd 100644 --- a/include/socket-cpp/stream_socket.h +++ b/include/socket-cpp/stream_socket.h @@ -1,58 +1,11 @@ -/** - * @file stream_socket.h - * - * Classes for stream sockets. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date December 2014 - */ - -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#ifndef __sockpp_stream_socket_h -#define __sockpp_stream_socket_h +#pragma once -#include "sockpp/socket.h" +#include "socket-cpp/socket.h" #include -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** * Base class for streaming sockets, such as TCP and Unix Domain. @@ -324,9 +277,7 @@ public: addr_t peer_address() const { return addr_t(socket::peer_address()); } }; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_socket_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/tcp6_acceptor.h b/include/socket-cpp/tcp6_acceptor.h index 230d83a..7a6a23e 100644 --- a/include/socket-cpp/tcp6_acceptor.h +++ b/include/socket-cpp/tcp6_acceptor.h @@ -1,56 +1,11 @@ -/// @file tcp6_acceptor.h -/// -/// Class for a TCP v6 server to accept incoming connections. -/// -/// @author Frank Pagliughi -/// @author SoRo Systems, Inc. -/// @author www.sorosys.com -/// -/// @date May 2019 +#pragma once -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- +#include "socket-cpp/acceptor.h" +#include "socket-cpp/tcp6_socket.h" -#ifndef __sockpp_tcp6_acceptor_h -#define __sockpp_tcp6_acceptor_h - -#include "sockpp/acceptor.h" -#include "sockpp/tcp6_socket.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /// Class for creating a TCP v6 server. /// Objects of this class bind and listen on TCP ports for incoming @@ -61,9 +16,6 @@ namespace sockpp { using tcp6_acceptor = acceptor_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -}; - -#endif // __sockpp_tcp_acceptor_h - +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/tcp6_connector.h b/include/socket-cpp/tcp6_connector.h index 3c37980..9f5b2af 100644 --- a/include/socket-cpp/tcp6_connector.h +++ b/include/socket-cpp/tcp6_connector.h @@ -1,66 +1,16 @@ -/** - * @file tcp6_connector.h - * - * Class for creating client-side TCP connections - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date May 2019 - */ +#pragma once -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- +#include "socket-cpp/connector.h" +#include "socket-cpp/tcp6_socket.h" - -#ifndef __sockpp_tcp6_connector_h -#define __sockpp_tcp6_connector_h - -#include "sockpp/connector.h" -#include "sockpp/tcp6_socket.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** IPv6 active, connector (client) socket. */ using tcp6_connector = connector_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_tcp6_connector_h +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/tcp6_socket.h b/include/socket-cpp/tcp6_socket.h index 04ab99b..ed73ce0 100644 --- a/include/socket-cpp/tcp6_socket.h +++ b/include/socket-cpp/tcp6_socket.h @@ -1,65 +1,15 @@ -/** - * @file tcp6_socket.h - * - * Class (typedef) for IPv6 TCP socket. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date August 2019 - */ +#pragma once -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- +#include "socket-cpp/stream_socket.h" +#include "socket-cpp/inet6_address.h" -#ifndef __sockpp_tcp6_socket_h -#define __sockpp_tcp6_socket_h - -#include "sockpp/stream_socket.h" -#include "sockpp/inet6_address.h" - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +namespace osdev { +namespace components { +namespace socket-cpp { /** IPv6 streaming TCP socket */ using tcp6_socket = stream_socket_tmpl; -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} - -#endif // __sockpp_tcp6_socket_h - +} // End namespace socket-cpp +} // End namespace components +} // End namespace osdev diff --git a/include/socket-cpp/tcp_acceptor.h b/include/socket-cpp/tcp_acceptor.h index cfd78e4..2694b67 100644 --- a/include/socket-cpp/tcp_acceptor.h +++ b/include/socket-cpp/tcp_acceptor.h @@ -1,46 +1,3 @@ -/// @file tcp_acceptor.h -/// -/// Class for a TCP server to accept incoming connections. -/// -/// @author Frank Pagliughi -/// @author SoRo Systems, Inc. -/// @author www.sorosys.com -/// -/// @date December 2014 - -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- #ifndef __sockpp_tcp_acceptor_h #define __sockpp_tcp_acceptor_h diff --git a/include/socket-cpp/tcp_connector.h b/include/socket-cpp/tcp_connector.h index c5088b0..1909f66 100644 --- a/include/socket-cpp/tcp_connector.h +++ b/include/socket-cpp/tcp_connector.h @@ -1,48 +1,3 @@ -/** - * @file tcp_connector.h - * - * Class for creating client-side TCP connections - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date December 2014 - */ - -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- #ifndef __sockpp_tcp_connector_h diff --git a/include/socket-cpp/tcp_socket.h b/include/socket-cpp/tcp_socket.h index 6f1cf64..a959809 100644 --- a/include/socket-cpp/tcp_socket.h +++ b/include/socket-cpp/tcp_socket.h @@ -1,48 +1,3 @@ -/** - * @file tcp_socket.h - * - * Class (typedef) for IPv4 TCP socket. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date August 2019 - */ - -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- #ifndef __sockpp_tcp_socket_h #define __sockpp_tcp_socket_h diff --git a/include/socket-cpp/udp_socket.h b/include/socket-cpp/udp_socket.h index c63f299..cb877d0 100644 --- a/include/socket-cpp/udp_socket.h +++ b/include/socket-cpp/udp_socket.h @@ -1,51 +1,4 @@ -/** - * @file udp_socket.h - * - * Class (typedef) for UDP v4 socket. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date August 2019 - */ -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#ifndef __sockpp_udp_socket_h -#define __sockpp_udp_socket_h #include "sockpp/datagram_socket.h" #include "sockpp/inet_address.h" diff --git a/include/socket-cpp/unix_acceptor.h b/include/socket-cpp/unix_acceptor.h index 5bcc067..5d66bbe 100644 --- a/include/socket-cpp/unix_acceptor.h +++ b/include/socket-cpp/unix_acceptor.h @@ -1,49 +1,3 @@ -/// @file unix_acceptor.h -/// -/// Class for a TCP server to accept incoming connections. -/// -/// @author Frank Pagliughi -/// @author SoRo Systems, Inc. -/// @author www.sorosys.com -/// -/// @date December 2014 - -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#ifndef __sockpp_unix_acceptor_h -#define __sockpp_unix_acceptor_h #include "sockpp/acceptor.h" #include "sockpp/unix_stream_socket.h" diff --git a/include/socket-cpp/unix_connector.h b/include/socket-cpp/unix_connector.h index 8777d6f..f61b178 100644 --- a/include/socket-cpp/unix_connector.h +++ b/include/socket-cpp/unix_connector.h @@ -1,51 +1,3 @@ -/** - * @file unix_connector.h - * - * Class for creating client-side UNIX-domain socket connections. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date December 2018 - */ - -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#ifndef __sockpp_unix_connector_h -#define __sockpp_unix_connector_h #include "sockpp/connector.h" #include "sockpp/unix_stream_socket.h" diff --git a/include/socket-cpp/unix_dgram_socket.h b/include/socket-cpp/unix_dgram_socket.h index da171a2..1425410 100644 --- a/include/socket-cpp/unix_dgram_socket.h +++ b/include/socket-cpp/unix_dgram_socket.h @@ -1,51 +1,4 @@ -/** - * @file unix_dgram_socket.h - * - * Class (typedef) for Unix-domain UDP socket. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date August 2019 - */ -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#ifndef __sockpp_unix_dgram_socket_h -#define __sockpp_unix_dgram_socket_h #include "sockpp/datagram_socket.h" #include "sockpp/unix_address.h" diff --git a/include/socket-cpp/unix_stream_socket.h b/include/socket-cpp/unix_stream_socket.h index fa3863c..2d8c6c9 100644 --- a/include/socket-cpp/unix_stream_socket.h +++ b/include/socket-cpp/unix_stream_socket.h @@ -1,51 +1,4 @@ -/** - * @file unix_stream_socket.h - * - * Class (typedef) for Unix-domain streaming socket. - * - * @author Frank Pagliughi - * @author SoRo Systems, Inc. - * @author www.sorosys.com - * - * @date August 2019 - */ -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2019 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#ifndef __sockpp_unix_stream_socket_h -#define __sockpp_unix_stream_socket_h #include "sockpp/stream_socket.h" #include "sockpp/unix_address.h" diff --git a/src/acceptor.cpp b/src/acceptor.cpp index 7d119d7..80b337e 100644 --- a/src/acceptor.cpp +++ b/src/acceptor.cpp @@ -1,11 +1,8 @@ #include -#include "sockpp/acceptor.h" +#include "socket-cpp/acceptor.h" using namespace std; - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +using namespace osdev::components::socket-cpp; acceptor acceptor::create(int domain) { @@ -68,7 +65,4 @@ stream_socket acceptor::accept(sock_address* clientAddr /*=nullptr*/) return stream_socket(s); } -///////////////////////////////////////////////////////////////////////////// -// end namespace sockpp -} diff --git a/src/connector.cpp b/src/connector.cpp index dbe57dd..c627896 100644 --- a/src/connector.cpp +++ b/src/connector.cpp @@ -1,8 +1,8 @@ -#include "sockpp/connector.h" +#include "socket-cpp/connector.h" -namespace sockpp { +using namespace osdev::components::socket-cpp; -bool connector::connect(const sock_address& addr) +bool connector::connect( const sock_address& addr ) { sa_family_t domain = addr.family(); socket_t h = create_handle(domain); @@ -19,5 +19,3 @@ bool connector::connect(const sock_address& addr) return true; } -} - diff --git a/src/datagram_socket.cpp b/src/datagram_socket.cpp index 41cf832..ddcb946 100644 --- a/src/datagram_socket.cpp +++ b/src/datagram_socket.cpp @@ -1,10 +1,9 @@ -#include "sockpp/datagram_socket.h" -#include "sockpp/exception.h" +#include "socket-cpp/datagram_socket.h" +#include "socket-cpp/exception.h" #include using namespace std::chrono; - -namespace sockpp { +using namespace osdev::components::socket-cpp; datagram_socket::datagram_socket(const sock_address& addr) { @@ -33,6 +32,3 @@ ssize_t datagram_socket::recv_from(void* buf, size_t n, int flags, #endif } - -} - diff --git a/src/exception.cpp b/src/exception.cpp index 7a5b37a..2a7b46a 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -1,13 +1,12 @@ -#include "sockpp/exception.h" -#include "sockpp/platform.h" +#include "socket-cpp/exception.h" +#include "socket-cpp/platform.h" #include // Used to explicitly ignore the returned value of a function call. #define ignore_result(x) if (x) {} using namespace std; - -namespace sockpp { +using namespace osdev::components::socket-cpp; sys_error::sys_error(int err) : runtime_error(error_str(err)), errno_(err) { @@ -46,5 +45,3 @@ getaddrinfo_error::getaddrinfo_error(int err, const string& hostname) { } -} - diff --git a/src/inet6_address.cpp b/src/inet6_address.cpp index 64c7ff8..e940e59 100644 --- a/src/inet6_address.cpp +++ b/src/inet6_address.cpp @@ -1,9 +1,8 @@ -#include "sockpp/inet6_address.h" -#include "sockpp/exception.h" +#include "socket-cpp/inet6_address.h" +#include "socket-cpp/exception.h" using namespace std; - -namespace sockpp { +using namespace osdev::components::socket-cpp; bool inet6_address::is_set() const { @@ -76,5 +75,3 @@ ostream& operator<<(ostream& os, const inet6_address& addr) return os; } -} - diff --git a/src/inet_address.cpp b/src/inet_address.cpp index d14382a..fd95d8c 100644 --- a/src/inet_address.cpp +++ b/src/inet_address.cpp @@ -1,9 +1,8 @@ -#include "sockpp/inet_address.h" -#include "sockpp/exception.h" +#include "socket-cpp/inet_address.h" +#include "socket-cpp/exception.h" using namespace std; - -namespace sockpp { +using namespace osdev::components::socket-cpp; bool inet_address::is_set() const { @@ -72,4 +71,3 @@ ostream& operator<<(ostream& os, const inet_address& addr) return os; } -} diff --git a/src/linux/can_address.cpp b/src/linux/can_address.cpp index 7d24064..33865f7 100644 --- a/src/linux/can_address.cpp +++ b/src/linux/can_address.cpp @@ -1,51 +1,12 @@ -// can_address.cpp -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2021 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#include "sockpp/can_address.h" -#include "sockpp/socket.h" +#include "socket-cpp/can_address.h" +#include "socket-cpp/socket.h" #include #include #include #include using namespace std; - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +using namespace osdev::components::socket-cpp; constexpr sa_family_t can_address::ADDRESS_FAMILY; @@ -90,15 +51,9 @@ string can_address::iface() const return string(iface ? iface : "unknown"); } - -// -------------------------------------------------------------------------- - ostream& operator<<(ostream& os, const can_address& addr) { os << "can:" << addr.iface(); return os; } -///////////////////////////////////////////////////////////////////////////// -// End namespace sockpp -} diff --git a/src/linux/can_socket.cpp b/src/linux/can_socket.cpp index dc7e699..c081fdd 100644 --- a/src/linux/can_socket.cpp +++ b/src/linux/can_socket.cpp @@ -1,57 +1,19 @@ -// can_socket.cpp -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2021 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#include "sockpp/can_socket.h" -#include "sockpp/socket.h" +#include "socket-cpp/can_socket.h" +#include "socket-cpp/socket.h" #include using namespace std; using namespace std::chrono; - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +using namespace osdev::components::socket-cpp; can_socket::can_socket(const can_address& addr) { - socket_t h = create_handle(SOCK_RAW, CAN_RAW); + socket_t socketHandle = create_handle( SOCK_RAW, CAN_RAW ); - if (check_socket_bool(h)) { - reset(h); - bind(addr); + if ( check_socket_bool( socketHandle ) ) + { + reset( socketHandle ); + bind( addr ); } } @@ -87,6 +49,3 @@ ssize_t can_socket::recv_from(can_frame *frame, int flags, flags, p, &len)); } -///////////////////////////////////////////////////////////////////////////// -// End namespace sockpp -} diff --git a/src/socket.cpp b/src/socket.cpp index e055aef..6c034f3 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -1,5 +1,5 @@ -#include "sockpp/socket.h" -#include "sockpp/exception.h" +#include "socket-cpp/socket.h" +#include "socket-cpp/exception.h" #include #include #include @@ -8,8 +8,7 @@ #define ignore_result(x) if (x) {} using namespace std::chrono; - -namespace sockpp { +using namespace osdev::components::socket-cpp; timeval to_timeval(const microseconds& dur) { @@ -227,5 +226,3 @@ bool socket::close() return true; } -} - diff --git a/src/stream_socket.cpp b/src/stream_socket.cpp index 6840afd..6c93f47 100644 --- a/src/stream_socket.cpp +++ b/src/stream_socket.cpp @@ -4,8 +4,7 @@ #include using namespace std::chrono; - -namespace socket-cpp { +using namespace osdev::components::socket-cpp; stream_socket stream_socket::create(int domain, int protocol /*=0*/) { @@ -148,5 +147,3 @@ bool stream_socket::write_timeout(const microseconds& to) return set_option(SOL_SOCKET, SO_SNDTIMEO, tv); } -} - diff --git a/src/unix/unix_address.cpp b/src/unix/unix_address.cpp index a4088ed..497ce5a 100644 --- a/src/unix/unix_address.cpp +++ b/src/unix/unix_address.cpp @@ -1,48 +1,9 @@ -// unix_address.cpp -// -// -------------------------------------------------------------------------- -// This file is part of the "sockpp" C++ socket library. -// -// Copyright (c) 2014-2017 Frank Pagliughi -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -------------------------------------------------------------------------- - -#include "sockpp/unix_address.h" +#include "socket-cpp/unix_address.h" #include #include using namespace std; - -namespace sockpp { - -///////////////////////////////////////////////////////////////////////////// +using namespace osdev::components::socket-cpp; constexpr sa_family_t unix_address::ADDRESS_FAMILY; constexpr size_t unix_address::MAX_PATH_NAME; @@ -74,6 +35,3 @@ ostream& operator<<(ostream& os, const unix_address& addr) return os; } -///////////////////////////////////////////////////////////////////////////// -// End namespace sockpp -}