SST/macro
network_message.h
Go to the documentation of this file.
1 #ifndef sstmac_hardware_network_NETWORK_MESSAGE_H
2 #define sstmac_hardware_network_NETWORK_MESSAGE_H
3 
9 
10 namespace sstmac {
11 namespace hw {
12 
14  public message,
15  public serializable_type<network_message>
16 {
18 
19  public:
20  typedef enum {
21  RDMA_GET_FAILED,
22  RDMA_GET_REQ_TO_RSP,
23  NVRAM_GET_REQ_TO_RSP
24  } nic_event_t;
25 
26  typedef enum {
40  } type_t;
41 
42  public:
47  sw::task_id src,
48  sw::task_id dst,
49  long payload_bytes);
50 
51  network_message(sw::app_id aid, long payload_bytes);
52 
53  network_message(); //for serialization
54 
55  virtual std::string
56  to_string() const {
57  return "network message";
58  }
59 
60  virtual ~network_message() {}
61 
62  static const char*
63  tostr(nic_event_t mut);
64 
65  static const char*
66  tostr(type_t ty);
67 
68  bool
69  is_metadata() const;
70 
71  virtual network_message*
74  clone_into(cln);
75  return cln;
76  }
77 
78  virtual void
79  nic_reverse(type_t newtype);
80 
81  bool
82  is_nic_ack() const;
83 
84  node_id
85  toaddr() const {
86  return toaddr_;
87  }
88 
89  virtual void
90  put_on_wire();
91 
92  node_id
93  fromaddr() const {
94  return fromaddr_;
95  }
96 
97  void
99  toaddr_ = addr;
100  }
101 
102  void
104  fromaddr_ = addr;
105  }
106 
107  void
108  set_needs_ack(bool n) {
109  needs_ack_ = n;
110  }
111 
112  virtual bool
113  needs_ack() const {
114  //only paylods get acked
115  return needs_ack_ && type_ >= payload;
116  }
117 
118  virtual void
120 
121  void
122  convert_to_ack();
123 
124  void
125  set_net_id(const network_id& id) {
126  net_id_ = id;
127  }
128 
129  network_id
130  net_id() const {
131  return net_id_;
132  }
133 
134  uint64_t
135  unique_id() const {
136  return uint64_t(net_id_);
137  }
138 
140  source_task() const {
141  return src_task_;
142  }
143 
144  sw::app_id
145  aid() const {
146  return aid_;
147  }
148 
150  dest_task() const {
151  return dest_task_;
152  }
153 
154  type_t
155  type() const {
156  return type_;
157  }
158 
159  void
161  type_ = ty;
162  }
163 
164  virtual void
165  reverse();
166 
167  long
168  byte_length() const;
169 
171 
173 
174  protected:
175  void
176  clone_into(network_message* cln) const;
177 
178  protected:
179  int app_id_; // which application this packet belongs to
180  int flow_id_; // which flow within the application this packet is from
181 
183 
185 
187 
189 
191 
192  long bytes_;
193 
195 
196 };
197 
198 }
199 }
200 #endif // NETWORK_MESSAGE_H
A class describing an event.
Definition: sst_message.h:42
sw::task_id dest_task() const
void set_toaddr(node_id addr)
#define ImplementSerializableDefaultConstructor(obj)
Definition: serializable.h:58
virtual std::string to_string() const
sw::task_id source_task() const
virtual bool needs_ack() const
int task_id
Definition: task_id.h:20
void clone_into(network_message *cln) const
virtual network_message * clone_injection_ack() const
void set_net_id(const network_id &id)
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:33
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
virtual void nic_reverse(type_t newtype)
network_id net_id() const
long byte_length() const
Virtual function to return size.
endpoint_id node_id
Definition: node_address.h:20
virtual void serialize_order(serializer &ser)
int app_id
Definition: app_id.h:20
void set_fromaddr(node_id addr)
static const char * tostr(nic_event_t mut)