49        : TclClass(
"Module/UW/MULTI_DESTINATION")
 
 
 
   69    , switch_mode_(UW_MANUAL_SWITCH)
 
 
   84        if (strcasecmp(argv[1], 
"setAutomaticSwitch") == 0) {
 
   87        } 
else if (strcasecmp(argv[1], 
"setManualSwitch") == 0) {
 
   91    } 
else if (argc == 3) {
 
   92        if (strcasecmp(argv[1], 
"setManualLowerlId") == 0) {
 
   95        } 
else if (strcasecmp(argv[1], 
"setDefaultLowerId") == 0) {
 
   99    } 
else if (argc == 4) {
 
  102        if (strcasecmp(argv[1], 
"addLayer") == 0) {
 
  103            if (atoi(argv[2]) < 0) {
 
  104                std::cerr << 
"UwMultiDestination::command. "  
  105                    <<
"Error, negative IP address" << std::endl;
 
  108                IP_range range(atoi(argv[2]), atoi(argv[2]));
 
  109                if (!
addLayer(range, atoi(argv[3]))) {
 
  110                    std::cerr << 
"UwMultiDestination::command. "  
  111                        <<
"Error, overlapping IP ranges" << std::endl;
 
  120    } 
else if (argc == 5) {
 
  122        if (strcasecmp(argv[1], 
"addLayer") == 0) {
 
  123            if (atoi(argv[2]) < 0 || atoi(argv[3]) < atoi(argv[2])) {
 
  124                std::cerr << 
"UwMultiDestination::command. "  
  125                    <<
"Wrong IP address range" << std::endl;
 
  128                IP_range range(atoi(argv[2]),atoi(argv[3]));
 
  129                if (!
addLayer(range, atoi(argv[4]))) {
 
  130                    std::cerr << 
"UwMultiDestination::command. "  
  131                        <<
"Error, overlapping IP ranges" << std::endl;
 
  140    return Module::command(argc, argv);
 
 
  164    hdr_cmn *ch = HDR_CMN(p);
 
  165    if (ch->direction() == hdr_cmn::UP) {
 
 
  190    int dest_addr = ih->
daddr();
 
  193        if (it->second.isInRange(dest_addr)) {
 
 
  205        if (it->second.overlappingRange(range)) {
 
 
Class that represents the binding with the tcl configuration script.
TclObject * create(int, const char *const *)
Creates the TCL object needed for the tcl language interpretation.
UwMultiDestinationClass()
Constructor of the class.
Class used to represents the UwMultiDestination layer of a node.
UwMultiDestination()
Constructor of UwMultiDestination class.
int default_lower_id
Maps a layer id into an IP_range.
std::list< layer_IPrange > layer_list
int lower_id_active_
Id of the current lower layer active.
@ UW_AUTOMATIC_SWITCH
State to switch-mode automatically.
@ UW_MANUAL_SWITCH
State to switch-mode manually.
virtual void recvFromUpperLayers(Packet *p)
Default lower id to use if dest adress is not found in the considered IP ranges.
static int const layer_not_exist
This constant is returned when a searched layer does not exist>
int debug_
Flag to activate debug verbosity.
virtual bool checkNotOverlap(IP_range range)
return true if there is not overlap between the new range and the previous rnage in the list
Mode switch_mode_
Current switch mode (either AUTOMATIC or MANUAL).
virtual int command(int, const char *const *)
TCL command interpreter.
virtual void recv(Packet *p)
recv method.
virtual bool addLayer(IP_range range, int id)
Add a layer in the layer map if the IP range is valide, i.e., if the range doesn't overlap with an ex...
virtual int getDestinationLayer(Packet *p)
Return the best layer to forward the packet when the system works in AUTOMATIC_MODE.
hdr_uwip describes UWIP packets.
uint8_t & daddr()
Reference to the daddr_ variable.
UwMultiDestinationClass class_multi_destination
Definition of UwMultiDestination class.
std::pair< int, IP_range > layer_IPrange