本文整理汇总了C++中NetworkInterface::get_id方法的典型用法代码示例。如果您正苦于以下问题:C++ NetworkInterface::get_id方法的具体用法?C++ NetworkInterface::get_id怎么用?C++ NetworkInterface::get_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkInterface
的用法示例。
在下文中一共展示了NetworkInterface::get_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadData
int HistoricalInterface::loadData() {
time_t actual_epoch, adjust_to_epoch;
int ret_state = CONST_HISTORICAL_OK;
NetworkInterface * iface = ntop->getInterfaceById(interface_id);
if((iface != NULL) && (from_epoch != 0) && (to_epoch != 0)) {
u_int8_t iface_dump_id;
iface_dump_id = iface->get_id();
actual_epoch = from_epoch;
adjust_to_epoch = to_epoch - 300; // Adjust to epoch each file contains 5 minute of data
while (actual_epoch <= adjust_to_epoch && isRunning()) {
char path[MAX_PATH];
char db_path[MAX_PATH];
memset(path, 0, sizeof(path));
memset(db_path, 0, sizeof(db_path));
strftime(path, sizeof(path), "%Y/%m/%d/%H/%M", localtime(&actual_epoch));
snprintf(db_path, sizeof(db_path), "%s/%u/flows/%s.sqlite",
ntop->get_working_dir(), iface_dump_id , path);
loadData(db_path);
num_historicals++;
actual_epoch += 300; // 5 minute steps
}
}
on_load = false;
return ret_state;
}
示例2: getInterfaceIdByName
int Ntop::getInterfaceIdByName(char *name) {
/* This method accepts both interface names or Ids */
u_int if_id = atoi(name);
char str[8];
snprintf(str, sizeof(str), "%u", if_id);
if(strcmp(name, str) == 0) {
/* name is a number */
NetworkInterface *iface = getInterfaceById(if_id);
if(iface != NULL)
return(iface->get_id());
else
return(-1);
}
for(int i=0; i<num_defined_interfaces; i++) {
if(strcmp(iface[i]->get_name(), name) == 0) {
return(iface[i]->get_id());
}
}
return(-1);
}