Skip to content

Commit

Permalink
Removed the ip tests since these were against the addr.cpp/h and now …
Browse files Browse the repository at this point in the history
…we use libaddr instead.

Retired the add.cpp/h from libsnapwebsites as we use libaddr instead.
Removed a copy of snap_listen_thread.cpp, we don't use these because we have snap_communicator now.
  • Loading branch information
AlexisWilke committed Jun 8, 2018
1 parent d56ba6d commit 750cd14
Show file tree
Hide file tree
Showing 6 changed files with 1,411 additions and 111 deletions.
68 changes: 68 additions & 0 deletions archive/snapwebsites/libsnapwebsites/ip/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# File:
# libsnapwebsites/tests/ip/CMakeLists.txt
#
# Description:
#
# Documentation:
# See the CMake documentation.
#
# License:
# Copyright (c) 2011-2018 Made to Order Software Corp. All Rights Reserved
#
# https://snapwebsites.org/
# contact@m2osw.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

project(ip_test)

include_directories(
SYSTEM
${MAGIC_INCLUDE_DIRS}
${LOG4CPLUS_INCLUDE_DIRS}
${LIBPROCPS_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
)

include_directories(
${LIBTLD_INCLUDE_DIRS}
${snapwebsites_SOURCE_DIR}
)

add_executable( ${PROJECT_NAME}
ip_test.cpp
)

target_link_libraries( ${PROJECT_NAME}
${ADVGETOPT_LIBRARIES}
${LIBEXCEPT_LIBRARIES}
${LIBTLD_LIBRARIES}
${LOG4CPLUS_LIBRARIES}
${QT_LIBRARIES}
${AS2JS_LIBRARIES}
${QTSERIALIZATION_LIBRARIES}
${MAGIC_LIBRARIES}
${LIBPROCPS_LIBRARIES}
${OPENSSL_LIBRARIES}
${UUID}
pthread
dl
snapwebsites
libdbproxy
)

# vim: ts=4 sw=4 et nocindent
27 changes: 27 additions & 0 deletions archive/snapwebsites/libsnapwebsites/ip/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

IP / Address related Tests
==========================

The tests defined in this folder will test objects related to IP or address
handling.


IP Test
=======

This test prints out the list of local addresses as returned by:

addr::get_local_addresses();

It is not an automatic test in that it prints out the results which you
have to verify by hand.



# Bugs

Submit bug reports and patches on
[github](https://github.com/m2osw/snapwebsites/issues).


_This file is part of the [snapcpp project](https://snapwebsites.org/)._
78 changes: 78 additions & 0 deletions archive/snapwebsites/libsnapwebsites/ip/ip_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Snap Websites Server -- manage the snapbackend settings
// Copyright (c) 2016-2018 Made to Order Software Corp. All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#include "snapwebsites/addr.h"
#include "snapwebsites/not_used.h"

#include <iostream>

using namespace snap;
using namespace snap_addr;
using namespace std;

int main( int argc, char *argv[] )
{
NOTUSED(argc);
NOTUSED(argv);

try
{
addr::vector_t address_list( addr::get_local_addresses() );

for( const auto& addr : address_list )
{
cout << "Interface name: " << addr.get_iface_name() << endl;

cout << "Network type: ";
switch( addr.get_network_type() )
{
case addr::network_type_t::NETWORK_TYPE_UNDEFINED : cout << "Undefined"; break;
case addr::network_type_t::NETWORK_TYPE_PRIVATE : cout << "Private"; break;
case addr::network_type_t::NETWORK_TYPE_CARRIER : cout << "Carrier"; break;
case addr::network_type_t::NETWORK_TYPE_LINK_LOCAL : cout << "Local Link"; break;
case addr::network_type_t::NETWORK_TYPE_MULTICAST : cout << "Multicast"; break;
case addr::network_type_t::NETWORK_TYPE_LOOPBACK : cout << "Loopback"; break;
case addr::network_type_t::NETWORK_TYPE_ANY : cout << "Any"; break;
case addr::network_type_t::NETWORK_TYPE_UNKNOWN : cout << "Unknown"; break;
}
cout << endl;

std::string const ip_string( addr.get_ipv4or6_string() );
cout << "IP address: " << ip_string;

if( addr.is_ipv4() )
{
cout << " (ipv4)";
}
else
{
cout << " (ipv6)";
}
cout << endl << endl;
}

return 0;
}
catch(snap::snap_exception const & e)
{
std::cerr << "error: a Snap! exception occurred. " << e.what() << std::endl;
}

return 1;
}

// vim: ts=4 sw=4 et
111 changes: 0 additions & 111 deletions archive/snapwebsites/libsnapwebsites/src/snap_listen_thread.cpp

This file was deleted.

Loading

0 comments on commit 750cd14

Please sign in to comment.