1 /* 2 * whois.h 3 * Layer Four Traceroute 4 * 5 * This file is part of LFT. 6 * 7 * The LFT software provided in this Distribution is 8 * Copyright 2007 VOSTROM Holdings, Inc. 9 * 10 * The full text of our legal notices is contained in the file called 11 * COPYING, included with this Distribution. 12 * 13 */ 14 15 #ifndef WHOIS_H 16 #define WHOIS_H 17 18 struct ip_list_array { 19 struct in_addr ipaddr[1024]; 20 int asn[1024]; 21 char netName[1024][32]; 22 char orgName[1024][100]; 23 char application[1024]; 24 int numItems; 25 }; 26 27 struct ext_ip_list_array { 28 struct in_addr ipaddr[1024]; 29 int asn[1024]; 30 char prefix[1024][20]; 31 char netName[1024][32]; 32 char orgName[1024][100]; 33 char application[1024]; 34 double latitude[1024]; 35 double longitude[1024]; 36 char country[1024][50]; 37 char state[1024][50]; 38 char city[1024][50]; 39 char asOrgNameSource[1024][100]; 40 char orgNameSource[1024][100]; 41 char netNameSource[1024][100]; 42 int geoavailable; 43 int numItems; 44 }; 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 typedef struct _whoissessionparams 49 { 50 int w_noisy; /* Don't show debug msgs by default */ 51 char pw_serv[256]; /* User can specify his own pwhois server */ 52 char consolidated_asn[256]; /* ASN returned from pwhois */ 53 char consolidated_asp[256]; /* AS-PATH returned from pwhois */ 54 char consolidated_route[256]; /* Prefix returned from pwhois */ 55 char consolidated_orgname[256]; /* OrgName returned from pwhois */ 56 char consolidated_netname[256]; /* NetName returned from pwhois */ 57 char tbuf[128]; 58 time_t tval; 59 void * logprintfCookie; 60 }whois_session_params; 61 62 /* must be called BEFORE making any queries */ 63 whois_session_params * w_init(void); 64 whois_session_params * w_reinit(whois_session_params * wsess); 65 void w_close(whois_session_params * wsess); 66 67 /* return the origin-asn according to the RADB in "3356" format */ 68 int w_lookup_as(whois_session_params * wsess, char *); 69 70 /* return the origin-asn according to Cyrmu in "3356" format */ 71 int w_lookup_as_cymru(whois_session_params * wsess, char *); 72 73 /* return the origin-asn according to the RIPE RIS in "3356" format */ 74 int w_lookup_as_riswhois(whois_session_params * wsess, char *); 75 76 /* return the origin-asn according to pwhois in "3356" format */ 77 int w_lookup_as_pwhois(whois_session_params * wsess, char *); 78 79 /* return the network name from the registrar in a string */ 80 char *w_lookup_netname(whois_session_params * wsess, char *); 81 82 /* return the organization name from the registrar in a string */ 83 char *w_lookup_orgname(whois_session_params * wsess, char *); 84 85 /* return a pointer to an ip_list_array (see above) containing 86 an 'asn' to each corresponding 'ipaddr' according to Cymru */ 87 int w_lookup_as_cymru_bulk(whois_session_params * wsess, struct ip_list_array*); 88 89 /* return a pointer to an ip_list_array (see above) containing 90 all ip_list_array vars to each corresponding 'ipaddr' according to pwhois */ 91 int w_lookup_all_pwhois_bulk(whois_session_params * wsess, struct ip_list_array*); 92 int w_lookup_all_pwhois_bulk_ext(whois_session_params * wsess, struct ext_ip_list_array *iplist); 93 94 /* return a pointer to an ip_list_array (see above) containing 95 all ip_list_array vars to each corresponding 'ipaddr' according to RIS whois */ 96 int w_lookup_all_riswhois_bulk(whois_session_params * wsess, struct ip_list_array*); 97 98 int w_lookup_all_pwhois(whois_session_params * wsess, char *addr); 99 int w_lookup_all_riswhois(whois_session_params * wsess, char *addr); 100 101 #ifdef __cplusplus 102 } 103 #endif 104 105 #endif 106