libcyberradio  22.01.24
SimpleIpSetup.h
1 /***************************************************************************
2  * \file SimpleIpSetup.h
3  * \brief Defines a simple 1Gig data for NDR-class radios without 10Gig
4  * ports.
5  * \author DA
6  * \author NH
7  * \author MN
8  * \copyright (c) 2017 CyberRadio Solutions, Inc. All rights reserved.
9  *
10  ***************************************************************************/
11 
12 #ifndef INCLUDED_LIBCYBERRADIO_DRIVER_SIMPLEIPSETUP_H
13 #define INCLUDED_LIBCYBERRADIO_DRIVER_SIMPLEIPSETUP_H
14 
15 #include "LibCyberRadio/Driver/Configurable.h"
16 #include "LibCyberRadio/Common/BasicDict.h"
17 #include "LibCyberRadio/Common/BasicList.h"
18 #include <string>
19 
20 
24 namespace LibCyberRadio
25 {
29  namespace Driver
30  {
31  // Forward declaration for RadioHandler object
32  class RadioHandler;
33 
46  class SimpleIpSetup : public Configurable
47  {
48  public:
59  SimpleIpSetup(const std::string& name = "SIMPLEIPSETUP",
60  RadioHandler* parent = NULL,
61  bool debug = false,
62  const std::string& sourceIP = "0.0.0.0",
63  const std::string& destIP = "0.0.0.0",
64  const std::string& destMAC = "00:00:00:00:00:00");
68  virtual ~SimpleIpSetup();
73  SimpleIpSetup(const SimpleIpSetup& other);
79  virtual SimpleIpSetup& operator=(const SimpleIpSetup& other);
80  // Configurable interface
87  virtual bool setConfiguration(ConfigurationDict& cfg);
91  virtual void queryConfiguration();
92  // SimpleIpSetup extensions
97  virtual std::string getSourceMAC() const;
102  virtual std::string getSourceIP() const;
108  virtual bool setSourceIP(const std::string& ipAddr);
113  virtual std::string getDestMACAddress() const;
118  virtual std::string getDestIPAddress() const;
124  virtual bool setDestMACAddress(const std::string& macAddr);
130  virtual bool setDestIPAddress(const std::string& ipAddr);
131 
132  protected:
133  // Configurable interface
138  virtual void initConfigurationDict();
142  virtual void updateConfigurationDict();
143  // SimpleIpSetup extensions
152  virtual bool executeSourceMACQuery(std::string& macAddr);
161  virtual bool executeSourceIPQuery(std::string& ipAddr);
167  virtual bool executeSourceIPCommand(std::string& ipAddr);
176  virtual bool executeDestIPQuery(std::string& ipAddr);
182  virtual bool executeDestIPCommand(std::string& ipAddr);
191  virtual bool executeDestMACQuery(std::string& macAddr);
197  virtual bool executeDestMACCommand(std::string& macAddr);
198 
199  protected:
200  // Parent radio handler object
201  RadioHandler* _parent;
202  // Source IP address
203  std::string _sourceIP;
204  // Source MAC address
205  std::string _sourceMAC;
206  // Destination IP address
207  std::string _destIP;
208  // Destination MAC address
209  std::string _destMAC;
210 
211  }; /* class SimpleIpSetup */
212 
216  typedef BASIC_DICT_CONTAINER<int, SimpleIpSetup*> SimpleIpSetupDict;
217 
218  } /* namespace Driver */
219 
220 } /* namespace LibCyberRadio */
221 
222 #endif /* INCLUDED_LIBCYBERRADIO_DRIVER_SIMPLEIPSETUP_H */
virtual std::string getSourceIP() const
Gets the source IP address.
virtual bool executeDestMACQuery(std::string &macAddr)
Executes the destination MAC query command.
virtual bool setConfiguration(ConfigurationDict &cfg)
Sets the configuration dictionary for this object.
virtual bool setDestMACAddress(const std::string &macAddr)
Sets the destination MAC address.
virtual SimpleIpSetup & operator=(const SimpleIpSetup &other)
Assignment operator for SimpleIpSetup objects.
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
virtual bool setSourceIP(const std::string &ipAddr)
Sets the source IP address.
virtual bool executeDestIPCommand(std::string &ipAddr)
Executes the destination IP set command.
SimpleIpSetup(const std::string &name="SIMPLEIPSETUP", RadioHandler *parent=NULL, bool debug=false, const std::string &sourceIP="0.0.0.0", const std::string &destIP="0.0.0.0", const std::string &destMAC="00:00:00:00:00:00")
Constructs a SimpleIpSetup object.
Generic radio handler class.
Definition: RadioHandler.h:54
virtual int debug(const char *format,...)
Outputs debug information.
Definition: Debuggable.cpp:95
virtual std::string getDestIPAddress() const
Gets the destination IP address.
virtual std::string getDestMACAddress() const
Gets the destination MAC address.
virtual std::string getSourceMAC() const
Gets the source MAC address.
Defines functionality for LibCyberRadio applications.
Definition: App.h:23
virtual bool executeDestIPQuery(std::string &ipAddr)
Executes the destination IP query command.
A configuration dictionary.
Definition: Configurable.h:51
virtual bool executeSourceMACQuery(std::string &macAddr)
Executes the source MAC query command.
virtual void updateConfigurationDict()
Updates the configuration dictionary from object settings.
BASIC_DICT_CONTAINER< int, SimpleIpSetup * > SimpleIpSetupDict
A dictionary of data ports, keyed by index.
Simple IP setup class for radios without 10GigE data ports.
Definition: SimpleIpSetup.h:46
virtual bool executeSourceIPCommand(std::string &ipAddr)
Executes the source IP set command.
virtual bool executeDestMACCommand(std::string &macAddr)
Executes the destination MAC set command.
virtual void queryConfiguration()
Tells the object to create its configuration dictionary.
Base configurable object class.
Definition: Configurable.h:79
virtual bool setDestIPAddress(const std::string &ipAddr)
Sets the destination IP address.
virtual ~SimpleIpSetup()
Destroys a SimpleIpSetup object.
virtual bool executeSourceIPQuery(std::string &ipAddr)
Executes the source IP query command.