char* string;
char country_code[3];
uint32_t asn;
+ enum loc_network_flags flags;
// Index of the AS we are looking at
unsigned int as_index;
clock_t end = clock();
- INFO(db->ctx, "Opened database in %.8fs\n",
- (double)(end - start) / CLOCKS_PER_SEC);
+ INFO(db->ctx, "Opened database in %.4fms\n",
+ (double)(end - start) / CLOCKS_PER_SEC * 1000);
return 0;
}
clock_t end = clock();
// Log how fast this has been
- DEBUG(db->ctx, "Found AS%u in %.8fs\n", as_number,
- (double)(end - start) / CLOCKS_PER_SEC);
+ DEBUG(db->ctx, "Found AS%u in %.4fms\n", as_number,
+ (double)(end - start) / CLOCKS_PER_SEC * 1000);
return 0;
}
clock_t end = clock();
// Log how fast this has been
- DEBUG(db->ctx, "Executed network search in %.8fs\n",
- (double)(end - start) / CLOCKS_PER_SEC);
+ DEBUG(db->ctx, "Executed network search in %.4fms\n",
+ (double)(end - start) / CLOCKS_PER_SEC * 1000);
return r;
}
return 0;
}
+LOC_EXPORT int loc_database_enumerator_set_flag(
+ struct loc_database_enumerator* enumerator, enum loc_network_flags flag) {
+ enumerator->flags |= flag;
+
+ return 0;
+}
+
LOC_EXPORT int loc_database_enumerator_next_as(
struct loc_database_enumerator* enumerator, struct loc_as** as) {
*as = NULL;
// No match
loc_as_unref(*as);
+ *as = NULL;
}
// Reset the index
continue;
}
+ // Skip if flags do not match
+ if (enumerator->flags &&
+ !loc_network_match_flag(*network, enumerator->flags)) {
+ loc_network_unref(*network);
+ *network = NULL;
+ }
+
return 0;
}
}