--- /dev/null
+/*
+ The software in this package is distributed under the GNU General
+ Public License version 2 (with a special exception described below).
+
+ A copy of GNU General Public License (GPL) is included in this distribution,
+ in the file COPYING.GPL.
+
+ As a special exception, if other files instantiate templates or use macros
+ or inline functions from this file, or you compile this file and link it
+ with other works to produce a work based on this file, this file
+ does not by itself cause the resulting work to be covered
+ by the GNU General Public License.
+
+ However the source code for this file must still be made available
+ in accordance with section (3) of the GNU General Public License.
+
+ This exception does not invalidate any other reasons why a work based
+ on this file might be covered by the GNU General Public License.
+ */
+
+#include "config/option/sourcenetworkinterfaceoption.h"
+
+#include <logfunc.hpp>
+
+using namespace std;
+using boost::program_options::value;
+using boost::program_options::variables_map;
+using I2n::Logger::GlobalLogger;
+
+//-----------------------------------------------------------------------------
+// SourceNetworkInterfaceOption
+//-----------------------------------------------------------------------------
+
+SourceNetworkInterfaceOption::SourceNetworkInterfaceOption() :
+ ConfigurationOption(
+ "source-network-interface",
+ value<string>(),
+ "The network interface from where the packets will be received and originated"
+ )
+{
+}
+
+SourceNetworkInterfaceOption::~SourceNetworkInterfaceOption()
+{
+}
+
+bool SourceNetworkInterfaceOption::validate( const variables_map& vm ) const
+{
+ // TODO validate if it is a valid interface
+ bool is_valid = ( vm.count( get_command_string() ) > 0 );
+
+ return is_valid;
+}
+
+bool SourceNetworkInterfaceOption::parse(
+ const variables_map& vm,
+ Configuration *configuration
+) const
+{
+ // source-network-interface
+ if ( vm.count( get_command_string() ) > 0 )
+ {
+ string source_network_interface = vm[ get_command_string() ].as<string> ();
+ configuration->set_source_network_interface( source_network_interface );
+
+ GlobalLogger.info() << get_command_string() << "="
+ << source_network_interface << endl;
+
+ return true;
+ }
+
+ return false;
+}
--- /dev/null
+/*
+ The software in this package is distributed under the GNU General
+ Public License version 2 (with a special exception described below).
+
+ A copy of GNU General Public License (GPL) is included in this distribution,
+ in the file COPYING.GPL.
+
+ As a special exception, if other files instantiate templates or use macros
+ or inline functions from this file, or you compile this file and link it
+ with other works to produce a work based on this file, this file
+ does not by itself cause the resulting work to be covered
+ by the GNU General Public License.
+
+ However the source code for this file must still be made available
+ in accordance with section (3) of the GNU General Public License.
+
+ This exception does not invalidate any other reasons why a work based
+ on this file might be covered by the GNU General Public License.
+ */
+
+#ifndef SOURCE_NETWORK_INTERFACE_OPTION_H
+#define SOURCE_NETWORK_INTERFACE_OPTION_H
+
+#include <boost/program_options.hpp>
+
+#include "config/option/configurationoption.h"
+
+//-----------------------------------------------------------------------------
+// SourceNetworkInterfaceOption
+//-----------------------------------------------------------------------------
+
+/**
+ * @brief This class represents the "source-network-interface" configuration
+ * option.
+ */
+class SourceNetworkInterfaceOption : public ConfigurationOption
+{
+public:
+ SourceNetworkInterfaceOption();
+ virtual ~SourceNetworkInterfaceOption();
+
+ virtual bool validate(
+ const boost::program_options::variables_map &vm
+ ) const;
+
+ virtual bool parse(
+ const boost::program_options::variables_map &vm,
+ Configuration *configuration
+ ) const;
+
+};
+
+#endif // SOURCE_NETWORK_INTERFACE_OPTION_H