first classes

This commit is contained in:
stubbfel
2016-11-21 01:02:46 +01:00
commit ce12764a4b
14 changed files with 227 additions and 0 deletions

67
.gitignore vendored Normal file
View File

@@ -0,0 +1,67 @@
# Created by https://www.gitignore.io/api/c++,linux,codeblocks
# project
test
projectfiles
### C++ ###
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### CodeBlocks ###
# specific to CodeBlocks IDE
*.cbp
*.layout
*.depend
# generated directories
bin/
obj/

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "lib/libtins"]
path = lib/libtins
url = git@github.com:stubbfel/libtins.git

25
CMakeLists.txt Normal file
View File

@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 2.4.2)
if (CMAKE_VERSION VERSION_LESS "3.1")
set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
else ()
set (CMAKE_CXX_STANDARD 11)
endif ()
project (1261nat)
SET(BUILD_SHARED_LIBS ON)
SET(LIBTINS_BUILD_SHARED OFF CACHE BOOL "test")
SET(LIBTINS_ENABLE_CXX11 ON CACHE BOOL "test2")
SET(LIBTINS_ENABLE_WPA2 OFF CACHE BOOL "test3")
SET(LIBTINS_ENABLE_DOT11 OFF CACHE BOOL "test4")
SET(HAVE_PCAP_IMMEDIATE_MODE ON CACHE BOOL "test5")
SET(LIBTINS_ENABLE_ACK_TRACKER OFF CACHE BOOL "test6")
SET(LIBTINS_ENABLE_WPA2_CALLBACKS OFF CACHE BOOL "test7")
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/lib/src/libtins/cmake/Modules)
SET(PCAP_ROOT_DIR /usr/ CACHE PATH "test14")
SET(PCAP_LIBRARY /usr/lib64/libpcap.so CACHE FILEPATH "test14")
ADD_SUBDIRECTORY(lib/libtins)
INCLUDE_DIRECTORIES(lib/libtins/include)
file(GLOB_RECURSE 1261nat_src_files "src/*.h" "src/*.cpp")
add_executable(1261nat ${1261nat_src_files} )
target_link_libraries (1261nat tins)

View File

@@ -0,0 +1,17 @@
#!/bin/bash
CURRENT_DIR="$(pwd)"
cd "$(dirname "$0")" || exit
PROJECT_NAME="$(basename "$(dirname "$(pwd)")")"
PROJECT_PATH="../projectfiles/codeblock/$PROJECT_NAME"
mkdir -p "$PROJECT_PATH"
cd "$PROJECT_PATH" || exit
cmake ../../../ -G "CodeBlocks - Unix Makefiles"
if [ -d "../../../test" ]; then
TEST_PROJECT_PATH="../test-$PROJECT_NAME"
mkdir -p "$TEST_PROJECT_PATH"
cd "$TEST_PROJECT_PATH" || exit
cmake ../../../test -G "CodeBlocks - Unix Makefiles"
fi
cd $CURRENT_DIR || exit

1
lib/libtins Submodule

Submodule lib/libtins added at a61a361eb1

View File

@@ -0,0 +1,11 @@
#include "AbstractNetworkInterfaceCard.h"
AbstractNetworkInterfaceCard::AbstractNetworkInterfaceCard()
{
//ctor
}
AbstractNetworkInterfaceCard::~AbstractNetworkInterfaceCard()
{
//dtor
}

View File

@@ -0,0 +1,21 @@
#ifndef ABSTRACTNETWORKINTERFACECARD_H
#define ABSTRACTNETWORKINTERFACECARD_H
#include "AbstractPacketHandler_t.h"
#include "AbstractRouter_t.h"
class AbstractNetworkInterfaceCard
{
public:
void sendPacket(/*const Tins::Pdu & pdu*/);
void startListen();
void stopListen();
protected:
AbstractNetworkInterfaceCard();
virtual ~AbstractNetworkInterfaceCard();
private:
SPtrAbstractPacketHandlerList handlerList;
SPtrAbstractRouter router;
};
#endif // ABSTRACTNETWORKINTERFACECARD_H

View File

@@ -0,0 +1,11 @@
#include "AbstractPacketHandler.h"
AbstractPacketHandler::AbstractPacketHandler()
{
//ctor
}
AbstractPacketHandler::~AbstractPacketHandler()
{
//dtor
}

View File

@@ -0,0 +1,16 @@
#ifndef ABSTRACTPACKETHANDLER_H
#define ABSTRACTPACKETHANDLER_H
class AbstractPacketHandler
{
public:
protected:
AbstractPacketHandler();
virtual ~AbstractPacketHandler();
private:
};
#endif // ABSTRACTPACKETHANDLER_H

View File

@@ -0,0 +1,11 @@
#ifndef ABSTRACTPACKETHANDLER_T_H_INCLUDED
#define ABSTRACTPACKETHANDLER_T_H_INCLUDED
#include <list>
#include <memory>
class AbstractPacketHandler;
typedef std::shared_ptr<AbstractPacketHandler> SPtrAbstractPacketHandler;
typedef std::list<SPtrAbstractPacketHandler> SPtrAbstractPacketHandlerList;
#endif // ABSTRACTPACKETHANDLER_T_H_INCLUDED

11
src/AbstractRouter.cpp Normal file
View File

@@ -0,0 +1,11 @@
#include "AbstractRouter.h"
AbstractRouter::AbstractRouter()
{
//ctor
}
AbstractRouter::~AbstractRouter()
{
//dtor
}

16
src/AbstractRouter.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef ABSTRACTROUTER_H
#define ABSTRACTROUTER_H
class AbstractRouter
{
public:
protected:
AbstractRouter();
virtual ~AbstractRouter();
private:
};
#endif // ABSTRACTROUTER_H

9
src/AbstractRouter_t.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef ABSTRACTROUTER_T_H_INCLUDED
#define ABSTRACTROUTER_T_H_INCLUDED
#include <memory>
class AbstractRouter;
typedef std::shared_ptr<AbstractRouter> SPtrAbstractRouter;
#endif // ABSTRACTROUTER_T_H_INCLUDED

8
src/Main.cpp Normal file
View File

@@ -0,0 +1,8 @@
#include <stdio.h>
int main(void)
{
printf("Hello, World\n");
return 0;
}