Пример #1
0
int main(int argc, char *argv[])
{
    if(argc < 5)
    {
        printf("Usage: FlowGen2 device flow_rate durarion packet_rate\t");
        return 1;
    }
    char * device = argv[1];
    unsigned int flow_rate = atoi(argv[2]);
    double duration = atof(argv[3]);
    unsigned int packet_rate = atoi(argv[4]);
    headers_pool pool;
    FlowGen flow_generator(pool,flow_rate,duration);
    PacketGen packet_generator(pool,device,packet_rate);
    PktNDumper pkt_dumper(packet_generator);
    std::thread flow_gen_thr(&FlowGen::start,&flow_generator);
    std::thread pkt_gen_thr(&PacketGen::start,&packet_generator);
    std::thread pkt_dump_thr(&PktNDumper::start,&pkt_dumper);
//    flow_gen_thr.detach();
//    pkt_gen_thr.detach();

    flow_gen_thr.join();
    pkt_gen_thr.join();
    pkt_dump_thr.join();
//    getchar();
//    flow_generator.stop();
//    packet_generator.stop();
}
Пример #2
0
void packet()
{
  read_position = 1;
  if(uart_string[read_position] == 'h')
  {
    uart_send_pgm_string(pghelp);
  }
  else
#if testing == 1
  if(uart_string[read_position] == 'g')
  {
    read_position++;
    packet_generator();
  }
  else
#endif
  {
    uart_send_pgm_string(pghelp);
  }
  read_position = 0;
}