SST/macro
sdn_router.h
Go to the documentation of this file.
1 /*
2  * This file is part of SST/macroscale:
3  * The macroscale architecture simulator from the SST suite.
4  * Copyright (c) 2009 Sandia Corporation.
5  * This software is distributed under the BSD License.
6  * Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7  * the U.S. Government retains certain rights in this software.
8  * For more information, see the LICENSE file in the top
9  * SST/macroscale directory.
10  */
11 
12 #ifndef SSTMAC_HARDWARE_NETWORK_SWTICHES_ROUTING_FATTREESDNROUTER_H_INCLUDED
13 #define SSTMAC_HARDWARE_NETWORK_SWTICHES_ROUTING_FATTREESDNROUTER_H_INCLUDED
14 
17 
18 #include <vector>
19 
20 namespace sstmac {
21 namespace hw {
22 
23 /**
24  * @brief The sdn_router class
25  * Router encapsulating the special routing computations that must occur on
26  * a fat tree topology.
27  */
28 class sdn_router :
29  public structured_router
30 {
31  public:
32  virtual ~sdn_router();
33 
35  structured_router(routing::minimal)
36  {}
37 
38  virtual std::string
39  to_string() const {
40  return "sdnrouter";
41  }
42 
43  // some subset of Packet
44  struct Match_Fields{
45  int flow_id;
46  int src;
47  int dst;
48 
49  bool operator==(const Match_Fields & mf) const {
50  return ((flow_id == mf.flow_id) &&
51  (src == mf.src) &&
52  (dst == mf.dst));
53  }
54  };
55 
56  typedef void * Action; // functor/std::function/lambda
57  typedef std::pair <Match_Fields, std::vector <Action> > Entry; // a single entry with its set of actions
58  typedef std::vector <Entry> SDN_Table; // a single table of multiple matching patterns and associated actions
59 
60  // add entry to table
61  void
62  add_entry(const int table_id,
63  const Match_Fields & match,
64  const std::vector <Action> & actions);
65 
66  // add entry to table
67  void
68  add_entry(const int table_id,
69  const Entry & entry);
70 
71  // no delete/remove functions provided
72 
73  private:
74  Match_Fields *
75  get_packet_metadata(packet * pkt) const;
76 
77  public:
78  virtual void
79  route(packet* pkt);
80 
81  protected:
83  structured_router(algo){}
84 
85  private:
86  std::vector <SDN_Table> tables; // flow tables
87 };
88 
89 }
90 }
91 #endif
The sdn_router class Router encapsulating the special routing computations that must occur on a fat t...
Definition: sdn_router.h:28
virtual std::string to_string() const
Definition: sdn_router.h:39
void add_entry(const int table_id, const Match_Fields &match, const std::vector< Action > &actions)
virtual void route(packet *pkt)
The structured_router class Implements a router that computes path on-the-fly using the geometry of t...
sdn_router(routing::algorithm_t algo)
Definition: sdn_router.h:82
std::pair< Match_Fields, std::vector< Action > > Entry
Definition: sdn_router.h:57
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
std::vector< SDN_Table > tables
Definition: sdn_router.h:86
bool operator==(const Match_Fields &mf) const
Definition: sdn_router.h:49
std::vector< Entry > SDN_Table
Definition: sdn_router.h:58
Match_Fields * get_packet_metadata(packet *pkt) const