27 #ifndef __CORSARO_GEO_H
28 #define __CORSARO_GEO_H
99 struct corsaro_geo_record *
next;
146 khash_t(corsaro_geo_rechash) *all_records;
192 uint32_t addr, uint8_t mask,
uint32_t id
A unique ID for this record (used to join the Blocks and Locations Files)
void * state
Pointer to a instance-specific state object.
struct corsaro_geo_record corsaro_geo_record_t
Structure which contains a geolocation record.
Structure which represents a geolocation datastructure.
char * conn_speed
Connection Speed/Type.
Default Geolocation data-structure.
const char * corsaro_geo_get_maxmind_iso2(int country_id)
Get the ISO-3166-1 2 character country code for the given maxmind country id.
int corsaro_geo_get_maxmind_iso3_list(const char ***countries)
Get a list of all possible ISO-3166-1 3 character country codes that maxmind uses.
corsaro_geo_provider_default
Should this provider be set to be the default geolocation result provider.
void corsaro_geo_free_provider(corsaro_t *corsaro, corsaro_geo_provider_t *provider)
Free the given geolocation provider object.
int corsaro_geo_get_maxmind_country_name_list(const char ***countries)
Get a list of all possible country names that maxmind uses.
int corsaro_geo_get_maxmind_iso2_list(const char ***countries)
Get a list of all possible ISO-3166-1 2 character country codes that maxmind uses.
corsaro_geo_provider_t * corsaro_geo_get_by_id(corsaro_t *corsaro, corsaro_geo_provider_id_t id)
Retrieve the provider object for the given provider ID.
Geolocation data from Net Acuity Edge.
const char * corsaro_geo_get_provider_name(corsaro_geo_provider_id_t id)
Get the provider name for the given ID.
struct corsaro_geo_provider corsaro_geo_provider_t
Structure which represents a geolocation provider.
This provider should be the default geolocation result.
void corsaro_geo_provider_add_record(corsaro_geo_provider_t *provider, corsaro_geo_record_t *record)
Add the given geolocation record to the head of the given geolocation provider object.
const char * corsaro_geo_get_maxmind_continent(int country_id)
Get the continent code for the given maxmind country id.
struct corsaro_geo_datastructure corsaro_geo_datastructure_t
Structure which represents a geolocation datastructure.
Structure which represents a geolocation provider.
corsaro_geo_record_t * corsaro_geo_provider_lookup_record(corsaro_t *corsaro, corsaro_geo_provider_t *provider, uint32_t addr)
Look up the given address in the provider's datastructure.
Highest numbered geolocation provider ID.
void corsaro_geo_dump_record(corsaro_geo_record_t *record)
Dump the given geolocation record to stdout (for debugging)
corsaro_geo_record_t * records
The list of records which contain the results of geolocation using this provider. ...
khash_t(corsaro_geo_rechash)*all_records
A hash of id => record for all allocated records of this provider.
const char * name
The name of the provider.
struct corsaro_geo_datastructure * ds
The datastructure that will be used to perform pfx => record lookups.
int corsaro_geo_get_maxmind_country_continent_list(const char ***continents)
Get a mapping of continent codes that maxmind uses.
int asn_cnt
Number of ASNs in the asn array.
int corsaro_geo_provider_clear(corsaro_geo_provider_t *provider)
Remove all the existing records from the given geolocation provider.
corsaro_geo_record_t * corsaro_geo_next_record(corsaro_geo_provider_t *provider, corsaro_geo_record_t *record)
Retrieve the next geolocation provider record in the list.
enum corsaro_geo_provider_default corsaro_geo_provider_default_t
Should this provider be set to be the default geolocation result provider.
corsaro_geo_provider_id
A unique identifier for each geolocation provider that corsaro supports.
static corsaro_in_record_t * record
A pointer to a corsaro record.
uint32_t asn_ip_cnt
Number of IP addresses that this ASN (or ASN group) 'owns'.
double latitude
Latitude of the city.
double longitude
Longitude of the city.
Geolocation data from Maxmind (Geo or GeoLite)
static corsaro_t * corsaro
A pointer to the instance of corsaro that we will drive.
corsaro_geo_record_t * corsaro_geo_get_record(corsaro_geo_provider_t *provider, uint32_t id)
Get the geolocation record for the given id.
corsaro_geo_provider_t * corsaro_geo_get_default(corsaro_t *corsaro)
Retrieve the provider object for the default geolocation provider.
corsaro_geo_provider_t * corsaro_geo_init_provider(corsaro_t *corsaro, corsaro_geo_provider_id_t provider_id, corsaro_geo_datastructure_id_t ds_id, corsaro_geo_provider_default_t set_default)
Allocate a geolocation provider object in the packet state.
char * name
The name of this datastructure.
Highest numbered datastructure ID.
corsaro_geo_datastructure_id_t id
The ID of this datastructure.
void(* free)(struct corsaro_geo_datastructure *ds)
Pointer to free function.
uint32_t area_code
Area code.
corsaro_geo_provider_id_t id
The ID of the provider.
char * post_code
String which contains the postal code.
int corsaro_geo_provider_associate_record(corsaro_t *corsaro, corsaro_geo_provider_t *provider, uint32_t addr, uint8_t mask, corsaro_geo_record_t *record)
Register a new prefix to record mapping for the given provider.
Structure which contains a geolocation record.
corsaro_geo_datastructure_id
A unique identifier for each geolocation datastructure that corsaro supports.
uint32_t * asn
Array of Autonomous System Numbers.
struct corsaro_geo_record * next
The next record in the list.
uint32_t metro_code
Metro code.
int continent_code
Continent Code.
const char * corsaro_geo_get_maxmind_country_name(int country_id)
Get the country name for the given maxmind country id.
corsaro_geo_provider_t * corsaro_geo_get_by_name(corsaro_t *corsaro, const char *name)
Retrieve the provider object for the given provider name.
int corsaro_geo_get_all_records(corsaro_geo_provider_t *provider, corsaro_geo_record_t ***records)
Get an array of all the geolocation records registered with the given provider.
enum corsaro_geo_datastructure_id corsaro_geo_datastructure_id_t
A unique identifier for each geolocation datastructure that corsaro supports.
This provider should not be the default geolocation result.
int(* add_prefix)(corsaro_t *corsaro, struct corsaro_geo_datastructure *ds, uint32_t addr, uint8_t mask, corsaro_geo_record_t *record)
Pointer to add prefix function.
char * city
String which contains the city name.
enum corsaro_geo_provider_id corsaro_geo_provider_id_t
A unique identifier for each geolocation provider that corsaro supports.
int(* init)(corsaro_t *corsaro, struct corsaro_geo_datastructure *ds)
Pointer to init function.
const char * corsaro_geo_get_maxmind_iso3(int country_id)
Get the ISO-3166-1 3 character country code for the given maxmind country id.
corsaro_geo_record_t * corsaro_geo_init_record(corsaro_geo_provider_t *provider, uint32_t id)
Allocate an empty geolocation record for the given id.
const char ** corsaro_geo_get_provider_names()
Get an array of provider names.
'Geolocation' data from CAIDA pfx2as
Header file dealing with the internal corsaro functions.