diff options
author | 2015-10-20 05:39:14 +0300 | |
---|---|---|
committer | 2015-10-20 05:39:14 +0300 | |
commit | cf753587ffb7b89cff1863c74ca334b8c41fd0c0 (patch) | |
tree | f9d8bd9e67cb93306e93041f11f5e4124a6e151a /src/tuple_gen.cpp | |
parent | d09df99769f67819c64a7a025dbdcd39811c7b44 (diff) | |
parent | 51ad078182d17b42a36c239c3c21381eeb3eec85 (diff) |
Merge branch 'master' into master-demo +
working demo of loading a YAML, and attaching it to server
Diffstat (limited to 'src/tuple_gen.cpp')
-rwxr-xr-x | src/tuple_gen.cpp | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/src/tuple_gen.cpp b/src/tuple_gen.cpp index e408f275..3c05cf05 100755 --- a/src/tuple_gen.cpp +++ b/src/tuple_gen.cpp @@ -57,7 +57,7 @@ void CClientPool::Create(IP_DIST_t dist_value, uint32_t max_ip, double l_flow, double t_cps, - CFlowGenList* fl_list, + CFlowGenListMac* mac_info, bool has_mac_map, uint16_t tcp_aging, uint16_t udp_aging) { @@ -65,10 +65,10 @@ void CClientPool::Create(IP_DIST_t dist_value, set_dist(dist_value); uint32_t total_ip = max_ip - min_ip +1; uint32_t avail_ip = total_ip; - if (has_mac_map && (fl_list!=NULL)) { + if (has_mac_map && (mac_info!=NULL)) { for(int idx=0;idx<total_ip;idx++){ mac_addr_align_t *mac_adr = NULL; - mac_adr = get_mac_addr_by_ip(fl_list, min_ip+idx); + mac_adr = mac_info->get_mac_addr_by_ip(min_ip+idx); if (mac_adr == NULL) { avail_ip--; } @@ -86,7 +86,7 @@ void CClientPool::Create(IP_DIST_t dist_value, if (has_mac_map) { for(int idx=0;idx<total_ip;idx++){ mac_addr_align_t *mac_adr = NULL; - mac_adr = get_mac_addr_by_ip(fl_list, min_ip+idx); + mac_adr = mac_info->get_mac_addr_by_ip( min_ip+idx); if (mac_adr != NULL) { m_ip_info[idx] = new CClientInfoL(has_mac_map); m_ip_info[idx]->set_ip(min_ip+idx); @@ -103,7 +103,7 @@ void CClientPool::Create(IP_DIST_t dist_value, if (has_mac_map) { for(int idx=0;idx<total_ip;idx++){ mac_addr_align_t *mac_adr = NULL; - mac_adr = get_mac_addr_by_ip(fl_list, min_ip+idx); + mac_adr = mac_info->get_mac_addr_by_ip(min_ip+idx); if (mac_adr != NULL) { m_ip_info[idx] = new CClientInfo(has_mac_map); m_ip_info[idx]->set_ip(min_ip+idx); @@ -123,20 +123,19 @@ void CClientPool::Create(IP_DIST_t dist_value, CreateBase(); } -void delay(int msec); bool CTupleGeneratorSmart::add_client_pool(IP_DIST_t client_dist, uint32_t min_client, uint32_t max_client, double l_flow, double t_cps, - CFlowGenList* fl_list, + CFlowGenListMac* mac_info, uint16_t tcp_aging, uint16_t udp_aging){ assert(max_client>=min_client); CClientPool* pool = new CClientPool(); pool->Create(client_dist, min_client, max_client, - l_flow, t_cps, fl_list, has_mac_mapping, + l_flow, t_cps, mac_info, m_has_mac_mapping, tcp_aging, udp_aging); m_client_pool.push_back(pool); @@ -171,13 +170,13 @@ bool CTupleGeneratorSmart::Create(uint32_t _id, m_thread_id = thread_id; m_id = _id; m_was_init=true; - has_mac_mapping = has_mac; + m_has_mac_mapping = has_mac; return(true); } void CTupleGeneratorSmart::Delete(){ m_was_init=false; - has_mac_mapping = false; + m_has_mac_mapping = false; for (int idx=0;idx<m_client_pool.size();idx++) { m_client_pool[idx]->Delete(); @@ -246,30 +245,12 @@ void operator >> (const YAML::Node& node, CTupleGenPoolYaml & fi) { fi.m_tcp_aging_sec = 0; fi.m_udp_aging_sec = 0; fi.m_dual_interface_mask = 0; - try { - utl_yaml_read_uint32(node,"clients_per_gb",fi.m_number_of_clients_per_gb); - } catch ( const std::exception& e ) { - ;} - try { - utl_yaml_read_uint32(node,"min_clients",fi.m_min_clients); - } catch ( const std::exception& e ) { - ;} - try { - utl_yaml_read_ip_addr(node,"dual_port_mask",fi.m_dual_interface_mask); - } catch ( const std::exception& e ) { - ;} - try { - utl_yaml_read_uint16(node,"tcp_aging",fi.m_tcp_aging_sec); - } catch ( const std::exception& e ) { - ;} - try { - utl_yaml_read_uint16(node,"udp_aging",fi.m_udp_aging_sec); - } catch ( const std::exception& e ) { - ;} - try { - node["track_ports"] >> fi.m_is_bundling; - } catch ( const std::exception& e ) { - ;} + utl_yaml_read_uint32(node,"clients_per_gb",fi.m_number_of_clients_per_gb); + utl_yaml_read_uint32(node,"min_clients",fi.m_min_clients); + utl_yaml_read_ip_addr(node,"dual_port_mask",fi.m_dual_interface_mask); + utl_yaml_read_uint16(node,"tcp_aging",fi.m_tcp_aging_sec); + utl_yaml_read_uint16(node,"udp_aging",fi.m_udp_aging_sec); + utl_yaml_read_bool(node,"track_ports",fi.m_is_bundling); } void copy_global_pool_para(CTupleGenPoolYaml & src, CTupleGenPoolYaml & dst) { if (src.m_number_of_clients_per_gb == 0) |