Esempio n. 1
0
connection::connection(packet p) {
  this->src_addr         = p.src_addr(); 
  this->dst_addr         = p.dst_addr();
  this->src_port         = p.src_port(); 
  this->dst_port         = p.dst_port();
  this->connection_reset = p.rst();
  this->start_time = p.ts_milli() + p.ts_sec()*1000000;
  this->change_state(std::shared_ptr<s0f0>(new s0f0));
  //this->recv_packet(p);
}
Esempio n. 2
0
void connection::recv_packet(packet p) {
  using namespace std;
  assert(this->check_packet(p));

  this->window_sizes.push_back(p.window_size());

  this->do_packet_calculation(p);

  this->do_byte_calculation(p);

  this->do_rtt_calculation(p);

  if (p.rst()) {
    this->connection_reset = true;
    this->change_state(std::shared_ptr<reset>(new reset));
  } 

  this->state->recv_packet(p, this);
}