Skip to content
Browse files

Build system modified to find libraries and compile depending on avil…

…able libraries. Also added template for netlink driver.
  • Loading branch information...
1 parent c4f3f1f commit 6ff4cc43a8c66b9eb635a6d4d7c5668941ddcb6b @sh0 committed
View
3 CMakeLists.txt
@@ -33,9 +33,12 @@ INCLUDE(airown-helpers)
INCLUDE(airown-libs-general)
INCLUDE(airown-libs-glib)
INCLUDE(airown-libs-openssl)
+INCLUDE(airown-libs-pcap)
INCLUDE(airown-libs-lorcon)
+INCLUDE(airown-libs-netlink)
INCLUDE(airown-libs-libnet)
INCLUDE(airown-libs-ncurses)
+MESSAGE(STATUS "################################################")
# Config files
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}")
View
4 cmake/airown-libs-glib.cmake
@@ -6,11 +6,11 @@ IF (NOT GLIB_CHECKED)
# Messages
MESSAGE(STATUS "################################################")
- MESSAGE(STATUS "Checking for GLib")
+ MESSAGE(STATUS "Checking for GLIB (glib-2.0, gthread-2.0)")
# Find
PKG_CHECK_MODULES(GLIB glib-2.0 gthread-2.0)
- PRINT_LIBRARY_INFO("GLib" GLIB_FOUND "${GLIB_CFLAGS}" "${GLIB_LDFLAGS}")
+ PRINT_LIBRARY_INFO("GLIB" GLIB_FOUND "${GLIB_CFLAGS}" "${GLIB_LDFLAGS}")
# Set as checked
SET(GLIB_CHECKED 1)
View
19 cmake/airown-libs-libnet.cmake
@@ -6,14 +6,21 @@ IF (NOT LIBNET_CHECKED)
# Messages
MESSAGE(STATUS "################################################")
- MESSAGE(STATUS "Checking for libnet")
+ MESSAGE(STATUS "Checking for LIBNET (libnet)")
# Find
- #PKG_CHECK_MODULES(LIBNET libnet)
- SET(LIBNET_FOUND 1)
- SET(LIBNET_CFLAGS "")
- SET(LIBNET_LDFLAGS "-lnet")
- PRINT_LIBRARY_INFO("Libnet" LIBNET_FOUND "${LIBNET_CFLAGS}" "${LIBNET_LDFLAGS}" FATAL_ERROR)
+ FIND_PATH(LIBNET_INCLUDE_DIR NAMES libnet.h PATH_SUFFIXES libnet)
+ FIND_LIBRARY(LIBNET_LIBRARY NAMES net)
+
+ # Result
+ IF (LIBNET_INCLUDE_DIR AND LIBNET_LIBRARY)
+ SET(LIBNET_FOUND 1)
+ ENDIF (LIBNET_INCLUDE_DIR AND LIBNET_LIBRARY)
+
+ # Compiler
+ SET(LIBNET_CFLAGS "-I${LIBNET_INCLUDE_DIR}")
+ SET(LIBNET_LDFLAGS "${LIBNET_LIBRARY}")
+ PRINT_LIBRARY_INFO("LIBNET" LIBNET_FOUND "${LIBNET_CFLAGS}" "${LIBNET_LDFLAGS}" FATAL_ERROR)
# Set as checked
SET(LIBNET_CHECKED 1)
View
17 cmake/airown-libs-lorcon.cmake
@@ -6,13 +6,20 @@ IF (NOT LORCON_CHECKED)
# Messages
MESSAGE(STATUS "################################################")
- MESSAGE(STATUS "Checking for LORCON")
+ MESSAGE(STATUS "Checking for LORCON (liborcon)")
# Find
- #PKG_CHECK_MODULES(LORCON lorcon)
- SET(LORCON_FOUND 1)
- SET(LORCON_CFLAGS "-I/usr/include/lorcon2")
- SET(LORCON_LDFLAGS "-lorcon2")
+ FIND_PATH(LORCON_INCLUDE_DIR NAMES lorcon.h PATH_SUFFIXES lorcon lorcon2)
+ FIND_LIBRARY(LORCON_LIBRARY NAMES orcon2)
+
+ # Result
+ IF (LORCON_INCLUDE_DIR AND LORCON_LIBRARY)
+ SET(LORCON_FOUND 1)
+ ENDIF (LORCON_INCLUDE_DIR AND LORCON_LIBRARY)
+
+ # Compiler
+ SET(LORCON_CFLAGS "-I${LORCON_INCLUDE_DIR}")
+ SET(LORCON_LDFLAGS "${LORCON_LIBRARY}")
PRINT_LIBRARY_INFO("LORCON" LORCON_FOUND "${LORCON_CFLAGS}" "${LORCON_LDFLAGS}" FATAL_ERROR)
# Set as checked
View
24 cmake/airown-libs-ncurses.cmake
@@ -6,24 +6,20 @@ IF (NOT NCURSES_CHECKED)
# Messages
MESSAGE(STATUS "################################################")
- MESSAGE(STATUS "Checking for ncurses")
+ MESSAGE(STATUS "Checking for NCURSES (libncurses)")
# Find
- FIND_LIBRARY(CURSES_NCURSES_LIBRARY NAMES ncurses)
-
- GET_FILENAME_COMPONENT(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
- GET_FILENAME_COMPONENT(_cursesParentDir "${_cursesLibDir}" PATH)
-
- FIND_FILE(CURSES_HAVE_NCURSES_H ncurses.h)
- FIND_FILE(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h)
- FIND_FILE(CURSES_HAVE_NCURSES_CURSES_H ncurses/curses.h)
+ FIND_PATH(NCURSES_INCLUDE_DIR NAMES ncurses.h PATH_SUFFIXES ncurses)
+ FIND_LIBRARY(NCURSES_LIBRARY NAMES ncurses)
- FIND_PATH(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h ncurses/curses.h)
- FIND_PATH(CURSES_NCURSES_INCLUDE_PATH curses.h HINTS "${_cursesParentDir}/include")
+ # Result
+ IF (NCURSES_INCLUDE_DIR AND NCURSES_LIBRARY)
+ SET(NCURSES_FOUND 1)
+ ENDIF (NCURSES_INCLUDE_DIR AND NCURSES_LIBRARY)
- SET(NCURSES_FOUND CURSES_NCURSES_INCLUDE_PATH)
- SET(NCURSES_CFLAGS "-I${CURSES_NCURSES_INCLUDE_PATH}")
- SET(NCURSES_LDFLAGS "${CURSES_NCURSES_LIBRARY}")
+ # Compiler
+ SET(NCURSES_CFLAGS "-I${NCURSES_INCLUDE_DIR}")
+ SET(NCURSES_LDFLAGS "${NCURSES_LIBRARY}")
PRINT_LIBRARY_INFO("NCURSES" NCURSES_FOUND "${NCURSES_CFLAGS}" "${NCURSES_LDFLAGS}" FATAL_ERROR)
# Set as checked
View
19 cmake/airown-libs-netlink.cmake
@@ -0,0 +1,19 @@
+################################################################################
+### Netlink ####################################################################
+################################################################################
+
+IF (NOT NETLINK_CHECKED)
+
+ # Messages
+ MESSAGE(STATUS "################################################")
+ MESSAGE(STATUS "Checking for NETLINK (libnl-1)")
+
+ # Find
+ PKG_CHECK_MODULES(NETLINK libnl-1)
+ PRINT_LIBRARY_INFO("NETLINK" NETLINK_FOUND "${NETLINK_CFLAGS}" "${NETLINK_LDFLAGS}")
+
+ # Set as checked
+ SET(NETLINK_CHECKED 1)
+
+ENDIF (NOT NETLINK_CHECKED)
+
View
2 cmake/airown-libs-openssl.cmake
@@ -6,7 +6,7 @@ IF (NOT OPENSSL_CHECKED)
# Messages
MESSAGE(STATUS "################################################")
- MESSAGE(STATUS "Checking for OpenSSL")
+ MESSAGE(STATUS "Checking for OPENSSL")
# Find
PKG_CHECK_MODULES(OPENSSL openssl)
View
29 cmake/airown-libs-pcap.cmake
@@ -0,0 +1,29 @@
+################################################################################
+### Pcap #######################################################################
+################################################################################
+
+IF (NOT PCAP_CHECKED)
+
+ # Messages
+ MESSAGE(STATUS "################################################")
+ MESSAGE(STATUS "Checking for PCAP (libpcap)")
+
+ # Find
+ FIND_PATH(PCAP_INCLUDE_DIR NAMES pcap.h PATH_SUFFIXES pcap)
+ FIND_LIBRARY(PCAP_LIBRARY NAMES pcap)
+
+ # Result
+ IF (PCAP_INCLUDE_DIR AND PCAP_LIBRARY)
+ SET(PCAP_FOUND 1)
+ ENDIF (PCAP_INCLUDE_DIR AND PCAP_LIBRARY)
+
+ # Compiler
+ SET(PCAP_CFLAGS "-I${PCAP_INCLUDE_DIR}")
+ SET(PCAP_LDFLAGS "${PCAP_LIBRARY}")
+ PRINT_LIBRARY_INFO("PCAP" PCAP_FOUND "${PCAP_CFLAGS}" "${PCAP_LDFLAGS}" FATAL_ERROR)
+
+ # Set as checked
+ SET(PCAP_CHECKED 1)
+
+ENDIF (NOT PCAP_CHECKED)
+
View
4 src/CMakeLists.txt
@@ -4,11 +4,11 @@
# Includes
SET(AIROWN_CFLAGS_INT "-Wall -O2 -g")
-SET(AIROWN_CFLAGS_EXT "${GLIB_CFLAGS} ${OPENSSL_CFLAGS} ${LORCON_CFLAGS} ${LIBNET_CFLAGS} ${NCURSES_CFLAGS}")
+SET(AIROWN_CFLAGS_EXT "${GLIB_CFLAGS} ${OPENSSL_CFLAGS} ${PCAP_CFLAGS} ${LORCON_CFLAGS} ${NETLINK_CFLAGS} ${LIBNET_CFLAGS} ${NCURSES_CFLAGS}")
# Libraries
SET(AIROWN_LINK_INT "")
-SET(AIROWN_LINK_EXT "${GLIB_LDFLAGS} ${OPENSSL_LDFLAGS} ${LORCON_LDFLAGS} ${LIBNET_LDFLAGS} ${NCURSES_LDFLAGS}")
+SET(AIROWN_LINK_EXT "${GLIB_LDFLAGS} ${OPENSSL_LDFLAGS} ${PCAP_LDFLAGS} ${LORCON_LDFLAGS} ${NETLINK_LDFLAGS} ${LIBNET_LDFLAGS} ${NCURSES_LDFLAGS}")
# Sources
FILE(GLOB AIROWN_SRC ${AIROWN_SRC_DIR}/*.cpp)
View
5 src/ao_cmake.h.in
@@ -24,5 +24,10 @@
// Version
#define AO_VERSION "@VERSION@"
+// Libraries
+#cmakedefine PCAP_FOUND
+#cmakedefine LORCON_FOUND
+#cmakedefine NETLINK_FOUND
+
#endif
View
168 src/ao_context.cpp
@@ -69,85 +69,137 @@ bool c_context::init(
// RX driver and mode
if (!g_strcmp0(conf_drv_rx, "pcap")) {
- m_rx_type = DRIVER_PCAP;
- if (!g_strcmp0(conf_mode_rx, "file")) {
- m_rx_mode = PCAP_MODE_FILE;
- } else if (!g_strcmp0(conf_mode_rx, "dev")) {
- m_rx_mode = PCAP_MODE_DEV;
- } else {
- g_critical("[sys] driver pcap does not support rx mode %s, please use either \"file\" or \"dev\"!", conf_mode_rx);
+ #ifdef PCAP_FOUND
+ m_rx_type = DRIVER_PCAP;
+ if (!g_strcmp0(conf_mode_rx, "file")) {
+ m_rx_mode = PCAP_MODE_FILE;
+ } else if (!g_strcmp0(conf_mode_rx, "dev")) {
+ m_rx_mode = PCAP_MODE_DEV;
+ } else {
+ g_critical("[sys] driver pcap does not support rx mode %s, please use either \"file\" or \"dev\"!", conf_mode_rx);
+ goto err_drv_find;
+ }
+ #else
+ g_critical("[sys] pcap driver not enabled in this build, choose another driver or rebuild airown!");
goto err_drv_find;
- }
+ #endif
} else if (!g_strcmp0(conf_drv_rx, "lorcon")) {
- m_rx_type = DRIVER_LORCON;
- if (g_strcmp0(conf_mode_rx, "dev")) {
- g_critical("[sys] driver lorcon does not support rx mode %s, please use \"dev\"!", conf_mode_rx);
+ #ifdef LORCON_FOUND
+ m_rx_type = DRIVER_LORCON;
+ if (g_strcmp0(conf_mode_rx, "dev")) {
+ g_critical("[sys] driver lorcon does not support rx mode %s, please use \"dev\"!", conf_mode_rx);
+ goto err_drv_find;
+ }
+ #else
+ g_critical("[sys] lorcon driver not enabled in this build, choose another driver or rebuild airown!");
goto err_drv_find;
- }
+ #endif
+ } else if (!g_strcmp0(conf_drv_rx, "netlink")) {
+ #ifdef NETLINK_FOUND
+ m_rx_type = DRIVER_NETLINK;
+ if (g_strcmp0(conf_mode_rx, "dev")) {
+ g_critical("[sys] driver netlink does not support rx mode %s, please use \"dev\"!", conf_mode_rx);
+ goto err_drv_find;
+ }
+ #else
+ g_critical("[sys] netlink driver not enabled in this build, choose another driver or rebuild airown!");
+ goto err_drv_find;
+ #endif
}
// TX driver and mode
if (!g_strcmp0(conf_drv_tx, "pcap")) {
- m_tx_type = DRIVER_PCAP;
- if (!g_strcmp0(conf_mode_tx, "file")) {
- m_tx_mode = PCAP_MODE_FILE;
- } else {
- g_critical("[sys] driver pcap does not support tx mode %s, please use \"file\"!", conf_mode_tx);
+ #ifdef PCAP_FOUND
+ m_tx_type = DRIVER_PCAP;
+ if (!g_strcmp0(conf_mode_tx, "file")) {
+ m_tx_mode = PCAP_MODE_FILE;
+ } else {
+ g_critical("[sys] driver pcap does not support tx mode %s, please use \"file\"!", conf_mode_tx);
+ goto err_drv_find;
+ }
+ #else
+ g_critical("[sys] pcap driver not enabled in this build, choose another driver or rebuild airown!");
goto err_drv_find;
- }
+ #endif
} else if (!g_strcmp0(conf_drv_tx, "lorcon")) {
- m_tx_type = DRIVER_LORCON;
- if (g_strcmp0(conf_mode_tx, "dev")) {
- g_critical("[sys] driver lorcon does not support tx mode %s, please use \"dev\"!", conf_mode_tx);
+ #ifdef LORCON_FOUND
+ m_tx_type = DRIVER_LORCON;
+ if (g_strcmp0(conf_mode_tx, "dev")) {
+ g_critical("[sys] driver lorcon does not support tx mode %s, please use \"dev\"!", conf_mode_tx);
+ goto err_drv_find;
+ }
+ #else
+ g_critical("[sys] lorcon driver not enabled in this build, choose another driver or rebuild airown!");
goto err_drv_find;
- }
+ #endif
+ } else if (!g_strcmp0(conf_drv_tx, "netlink")) {
+ #ifdef NETLINK_FOUND
+ m_tx_type = DRIVER_NETLINK;
+ if (g_strcmp0(conf_mode_tx, "dev")) {
+ g_critical("[sys] driver netlink does not support tx mode %s, please use \"dev\"!", conf_mode_tx);
+ goto err_drv_find;
+ }
+ #else
+ g_critical("[sys] netlink driver not enabled in this build, choose another driver or rebuild airown!");
+ goto err_drv_find;
+ #endif
}
// Check drivers
if (m_rx_type == DRIVER_NONE && m_tx_type == DRIVER_NONE) {
- g_critical("[sys] unable to find capture driver %s! please use either pcap or lorcon!", conf_drv_rx);
+ g_critical("[sys] no specified rx or tx drivers found! rx_drv=%s, tx_drv=%s", conf_drv_rx, conf_drv_tx);
goto err_drv_find;
}
// Pcap
- if (m_rx_type == DRIVER_PCAP || m_tx_type == DRIVER_PCAP) {
- if (m_rx_type == DRIVER_PCAP && m_tx_type == DRIVER_PCAP) {
- m_tx_drv = m_rx_drv = new c_drv_pcap(conf_dev_rx, m_rx_mode, conf_dev_tx, m_tx_mode);
- if (!m_rx_drv->init())
- goto err_drv_init;
- } else if (m_rx_type == DRIVER_PCAP) {
- m_rx_drv = new c_drv_pcap(conf_dev_rx, m_rx_mode, conf_dev_tx, m_tx_mode);
- if (!m_rx_drv->init())
- goto err_drv_init;
- } else if (m_tx_type == DRIVER_PCAP) {
- m_tx_drv = new c_drv_pcap(conf_dev_rx, m_rx_mode, conf_dev_tx, m_tx_mode);
- if (!m_tx_drv->init())
- goto err_drv_init;
+ #ifdef PCAP_FOUND
+ if (m_rx_type == DRIVER_PCAP || m_tx_type == DRIVER_PCAP) {
+ if (m_rx_type == DRIVER_PCAP && m_tx_type == DRIVER_PCAP) {
+ m_tx_drv = m_rx_drv = new c_drv_pcap(conf_dev_rx, m_rx_mode, conf_dev_tx, m_tx_mode);
+ if (!m_rx_drv->init())
+ goto err_drv_init;
+ } else if (m_rx_type == DRIVER_PCAP) {
+ m_rx_drv = new c_drv_pcap(conf_dev_rx, m_rx_mode, conf_dev_tx, m_tx_mode);
+ if (!m_rx_drv->init())
+ goto err_drv_init;
+ } else if (m_tx_type == DRIVER_PCAP) {
+ m_tx_drv = new c_drv_pcap(conf_dev_rx, m_rx_mode, conf_dev_tx, m_tx_mode);
+ if (!m_tx_drv->init())
+ goto err_drv_init;
+ }
}
- }
+ #endif
- if (m_rx_type == DRIVER_LORCON || m_tx_type == DRIVER_LORCON) {
- if (m_rx_type == DRIVER_LORCON && m_tx_type == DRIVER_LORCON && !g_strcmp0(conf_dev_rx, conf_dev_tx)) {
- m_tx_drv = m_rx_drv = new c_drv_lorcon(conf_dev_rx, NULL, 0);
- if (!m_rx_drv->init())
- goto err_drv_init;
- } else if (m_rx_type == DRIVER_LORCON && m_tx_type == DRIVER_LORCON) {
- m_rx_drv = new c_drv_lorcon(conf_dev_rx, NULL, 0);
- if (!m_rx_drv->init())
- goto err_drv_init;
- m_tx_drv = new c_drv_lorcon(conf_dev_tx, NULL, 0);
- if (!m_tx_drv->init())
- goto err_drv_init;
- } else if (m_rx_type == DRIVER_LORCON) {
- m_rx_drv = new c_drv_lorcon(conf_dev_rx, NULL, 0);
- if (!m_rx_drv->init())
- goto err_drv_init;
- } else if (m_tx_type == DRIVER_LORCON) {
- m_tx_drv = new c_drv_lorcon(conf_dev_tx, NULL, 0);
- if (!m_tx_drv->init())
- goto err_drv_init;
+ // Lorcon
+ #ifdef LORCON_FOUND
+ if (m_rx_type == DRIVER_LORCON || m_tx_type == DRIVER_LORCON) {
+ if (m_rx_type == DRIVER_LORCON && m_tx_type == DRIVER_LORCON && !g_strcmp0(conf_dev_rx, conf_dev_tx)) {
+ m_tx_drv = m_rx_drv = new c_drv_lorcon(conf_dev_rx, NULL, 0);
+ if (!m_rx_drv->init())
+ goto err_drv_init;
+ } else if (m_rx_type == DRIVER_LORCON && m_tx_type == DRIVER_LORCON) {
+ m_rx_drv = new c_drv_lorcon(conf_dev_rx, NULL, 0);
+ if (!m_rx_drv->init())
+ goto err_drv_init;
+ m_tx_drv = new c_drv_lorcon(conf_dev_tx, NULL, 0);
+ if (!m_tx_drv->init())
+ goto err_drv_init;
+ } else if (m_rx_type == DRIVER_LORCON) {
+ m_rx_drv = new c_drv_lorcon(conf_dev_rx, NULL, 0);
+ if (!m_rx_drv->init())
+ goto err_drv_init;
+ } else if (m_tx_type == DRIVER_LORCON) {
+ m_tx_drv = new c_drv_lorcon(conf_dev_tx, NULL, 0);
+ if (!m_tx_drv->init())
+ goto err_drv_init;
+ }
}
- }
+ #endif
+
+ // Netlink
+ #ifdef NETLINK_FOUND
+
+ #endif
/*
// Libnet
View
4 src/ao_context.h
@@ -29,6 +29,7 @@
#include "drv_lorcon.h"
#include "drv_pcap.h"
+#include "drv_nl.h"
// Context class
class c_context {
@@ -63,7 +64,8 @@ class c_context {
typedef enum {
DRIVER_NONE = 0,
DRIVER_PCAP,
- DRIVER_LORCON
+ DRIVER_LORCON,
+ DRIVER_NETLINK
} en_driver;
c_drv* m_rx_drv;
en_driver m_rx_type;
View
21 src/ao_main.cpp
@@ -51,11 +51,11 @@ int main(int argc, char* argv[])
const gchar* cmd_mode_tx = "file";
const gchar* cmd_dev_tx = "test-tx.pcap";
GOptionEntry cmd_entry_main[] = {
- { "rx-drv", '\0', 0, G_OPTION_ARG_STRING, &cmd_drv_rx, "RX driver (pcap / lorcon)" },
- { "rx-mode", '\0', 0, G_OPTION_ARG_STRING, &cmd_mode_rx, "RX mode (hw / file)" },
+ { "rx-drv", '\0', 0, G_OPTION_ARG_STRING, &cmd_drv_rx, "RX driver" },
+ { "rx-mode", '\0', 0, G_OPTION_ARG_STRING, &cmd_mode_rx, "RX mode (dev / file)" },
{ "rx-dev", '\0', 0, G_OPTION_ARG_STRING, &cmd_dev_rx, "RX device (wlan0 / eth0 / file.pcap)" },
- { "tx-drv", '\0', 0, G_OPTION_ARG_STRING, &cmd_drv_tx, "TX driver (pcap / lorcon)" },
- { "tx-mode", '\0', 0, G_OPTION_ARG_STRING, &cmd_mode_tx, "TX mode (hw / file)" },
+ { "tx-drv", '\0', 0, G_OPTION_ARG_STRING, &cmd_drv_tx, "TX driver" },
+ { "tx-mode", '\0', 0, G_OPTION_ARG_STRING, &cmd_mode_tx, "TX mode (dev / file)" },
{ "tx-dev", '\0', 0, G_OPTION_ARG_STRING, &cmd_dev_tx, "TX device (wlan0 / eth0 / file.pcap)" },
{ NULL }
};
@@ -66,7 +66,18 @@ int main(int argc, char* argv[])
cmd_ctx = g_option_context_new("- packet injection tool");
g_option_context_add_main_entries(cmd_ctx, cmd_entry_main, NULL);
- //g_option_context_set_description(cmd_ctx, "");
+ g_option_context_set_description(cmd_ctx,
+ "Supported drivers:\n"
+ #ifdef PCAP_FOUND
+ " * pcap\n"
+ #endif
+ #ifdef LORCON_FOUND
+ " * lorcon\n"
+ #endif
+ #ifdef NETLINK_FOUND
+ " * netlink\n"
+ #endif
+ );
if (!g_option_context_parse(cmd_ctx, &argc, &argv, &cmd_error)) {
g_message("Option parsing failed: %s", cmd_error->message);
View
5 src/drv_lorcon.cpp
@@ -23,6 +23,9 @@
#include "drv_lorcon.h"
#include "pck_main.h"
+// Enable check
+#ifdef LORCON_FOUND
+
// Constructor and destructor
c_drv_lorcon::c_drv_lorcon(const gchar* dev, const gchar* drv, guint chan)
{
@@ -348,3 +351,5 @@ void c_drv_lorcon::f_delete_pck(gpointer data)
g_free(pck);
}
+#endif
+
View
6 src/drv_lorcon.h
@@ -25,6 +25,9 @@
#include "ao_config.h"
#include "drv_main.h"
+// Enable check
+#ifdef LORCON_FOUND
+
// Ext inc
#define protected protected_c
extern "C" {
@@ -85,5 +88,6 @@ class c_drv_lorcon : public c_drv {
static void f_delete_pck(gpointer data);
};
-#endif
+#endif // LORCON_FOUND
+#endif // H_DRV_LORCON
View
73 src/drv_nl.cpp
@@ -0,0 +1,73 @@
+/*
+ * Airown - Driver - 802.11 netlink
+ *
+ * Copyright (C) 2011 sh0 <sh0@yutani.ee>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+// Int inc
+#include "ao_config.h"
+#include "drv_nl.h"
+
+// Enable check
+#ifdef NETLINK_FOUND
+
+// Constructor and destructor
+c_drv_netlink::c_drv_netlink(const gchar* dev)
+{
+
+}
+
+c_drv_netlink::~c_drv_netlink()
+{
+
+}
+
+// Init and end
+bool c_drv_netlink::init()
+{
+ return false;
+}
+
+void c_drv_netlink::end()
+{
+
+}
+
+// Output
+void c_drv_netlink::help()
+{
+
+}
+
+const gchar* c_drv_netlink::name()
+{
+ return NULL;
+}
+
+// Packets
+st_pck_drv* c_drv_netlink::pck_rx()
+{
+ return NULL;
+}
+
+void c_drv_netlink::pck_tx(st_pck_drv* data)
+{
+
+}
+
+#endif
+
View
83 src/drv_nl.h
@@ -0,0 +1,83 @@
+/*
+ * Airown - Driver - 802.11 netlink
+ *
+ * Copyright (C) 2011 sh0 <sh0@yutani.ee>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef H_DRV_NL
+#define H_DRV_NL
+
+// Int inc
+#include "ao_config.h"
+#include "drv_main.h"
+#include "pck_main.h"
+
+// Enable check
+#ifdef NETLINK_FOUND
+
+// Driver class
+class c_drv_netlink : public c_drv {
+ public:
+ // Constructor and destructor
+ c_drv_netlink(const gchar* dev);
+ ~c_drv_netlink();
+
+ // Init and end
+ bool init();
+ void end();
+
+ // Output
+ void help();
+ const gchar* name();
+
+ // Packets
+ st_pck_drv* pck_rx();
+ void pck_tx(st_pck_drv* data);
+
+ private:
+ // Active
+ bool m_active;
+
+ // Info
+ gchar* m_info_dev;
+ gchar* m_info_drv;
+ guint m_info_chan;
+
+ // Netlink
+
+ guint m_mtu;
+ gint m_chan;
+
+ // Thread
+ GThread* m_thr_thread;
+ GMutex* m_thr_mutex;
+ GCond* m_thr_cond;
+ bool m_thr_run;
+ bool m_thr_dead;
+
+ // Queues
+ GAsyncQueue* m_queue_rx;
+ GAsyncQueue* m_queue_tx;
+
+ // Loop functions
+ static gpointer f_loop(gpointer user);
+ static void f_delete_pck(gpointer data);
+};
+
+#endif // NETLINK_FOUND
+#endif // H_DRV_NL
+
View
5 src/drv_pcap.cpp
@@ -22,6 +22,9 @@
#include "ao_config.h"
#include "drv_pcap.h"
+// Enable check
+#ifdef PCAP_FOUND
+
// Constructor and destructor
c_drv_pcap::c_drv_pcap(const gchar* dev_rx, guint mode_rx, const gchar* dev_tx, guint mode_tx)
{
@@ -383,3 +386,5 @@ void c_drv_pcap::f_delete_pck(gpointer data)
g_free(pck);
}
+#endif
+
View
6 src/drv_pcap.h
@@ -26,6 +26,9 @@
#include "drv_main.h"
#include "pck_main.h"
+// Enable check
+#ifdef PCAP_FOUND
+
// Ext inc
#include <pcap.h>
@@ -96,5 +99,6 @@ class c_drv_pcap : public c_drv {
static void f_delete_pck(gpointer data);
};
-#endif
+#endif // PCAP_FOUND
+#endif // H_DRV_PCAP

0 comments on commit 6ff4cc4

Please sign in to comment.
Something went wrong with that request. Please try again.