本文整理汇总了C++中GeoIP_delete函数的典型用法代码示例。如果您正苦于以下问题:C++ GeoIP_delete函数的具体用法?C++ GeoIP_delete怎么用?C++ GeoIP_delete使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GeoIP_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: geoip_init
/** Initialize GeoIP global states.
*/
void geoip_init(void)
{
#ifdef USE_GEOIP
if (gi4 != NULL)
GeoIP_delete(gi4);
if (gi6 != NULL)
GeoIP_delete(gi6);
gi4 = NULL;
gi6 = NULL;
#endif /* USE_GEOIP */
if (!feature_bool(FEAT_GEOIP_ENABLE))
return;
#ifdef USE_GEOIP
/* Load IPv4 GeoIP database */
if (feature_str(FEAT_GEOIP_FILE)) {
gi4 = GeoIP_open(feature_str(FEAT_GEOIP_FILE), GEOIP_STANDARD);
}
/* Try to load GeoIP.dat from lib/ if FEAT_GEOIP_FILE was not loaded. */
if (gi4 == NULL)
gi4 = GeoIP_open_type(GEOIP_COUNTRY_EDITION, GEOIP_STANDARD);
/* Load IPv6 GeoIP database */
if (feature_str(FEAT_GEOIP_IPV6_FILE)) {
gi6 = GeoIP_open(feature_str(FEAT_GEOIP_IPV6_FILE), GEOIP_STANDARD);
}
/* Try to load GeoIPv6.dat from lib/ if FEAT_GEOIP_IPV6_FILE was not loaded. */
if (gi6 == NULL)
gi6 = GeoIP_open_type(GEOIP_COUNTRY_EDITION_V6, GEOIP_STANDARD);
#endif /* USE_GEOIP */
}
示例2: signal_rehash
VOIDSIG signal_rehash(int signum)
{
#ifdef POSIX_SIGNALS
struct sigaction act;
#endif
#ifdef SIGHUP
if (signum == SIGHUP) {
#endif
Dadmin *a;
int i;
alog(LOG_NORMAL,
"Received SIGHUP: Saving Databases & Rehash Configuration");
if (initconf(denora->config, 1, mainconf) == -1) {
denora->qmsg = calloc(50, 1);
if (!denora->qmsg) {
denora->qmsg = sstrdup(langstr(ALOG_ERR_REHASH_NO_MEM));
} else {
ircsnprintf(denora->qmsg, sizeof(denora->qmsg), "%s",
langstr(ALOG_ERR_REHASH));
}
denora->quitting = 1;
send_event(EVENT_SIGNAL, 2, "SIGHUP", denora->qmsg);
} else {
/* Remove all config file admins from admin struct before re-reading config file */
for (i = 0; i < 1024; i++) {
for (a = adminlists[i]; a; a = a->next) {
if (a->configfile) {
free_admin(a);
}
break;
}
}
merge_confs();
}
/* Reload GeoIP db files */
if (gi) {
GeoIP_delete(gi);
}
if (gi_v6) {
GeoIP_delete(gi_v6);
}
gi = GeoIP_new(GEOIP_STANDARD);
gi_v6 = GeoIP_open_type(GEOIP_COUNTRY_EDITION_V6, GEOIP_STANDARD);
#ifdef POSIX_SIGNALS
act.sa_handler = signal_rehash;
act.sa_flags = 0;
(void) sigemptyset(&act.sa_mask);
(void) sigaddset(&act.sa_mask, SIGHUP);
(void) sigaction(SIGHUP, &act, NULL);
#else
# ifndef _WIN32
(void) signal(SIGHUP, signal_rehash); /* sysV -argv */
# endif
#endif
#ifdef SIGHUP
}
#endif
}
示例3: esgf_geolookup
int
esgf_geolookup (char *hostname, struct geo_output_struct *geo_output)
{
char *db_info;
GeoIP *gi;
int i, ret_code;
char *custom_directory = NULL;
char *custom_file = NULL;
char geoipdat[1024] = { '\0' };
sprintf (geoipdat, "%s/share/GeoIP/%s", GEOIP_DATA_PATH, GEOIPIDATABASE);
pmesg(LOG_DEBUG,__FILE__,__LINE__,"Loading GeoLiteCity from %s...\n",geoipdat);
if (gi = GeoIP_open (geoipdat, GEOIP_STANDARD))
{
i = GeoIP_database_edition (gi);
pmesg(LOG_DEBUG,__FILE__,__LINE__," GeoIP database found [Ok]\n");
if (ret_code = geoiplookup (gi, hostname, i, geo_output))
{
GeoIP_delete (gi);
return ret_code;
}
}
else
{
pmesg(LOG_ERROR,__FILE__,__LINE__,"%s not available, skipping.Please check ! [Exit]\n",geoipdat);
GeoIP_delete (gi);
return (-4);
}
GeoIP_delete (gi);
pmesg(LOG_DEBUG,__FILE__,__LINE__,"Geoiplookup ok [code=%d]\n", ret_code);
return 0;
}
示例4: GeoIP_delete
~ModuleGeoIP()
{
if (ipv4db)
GeoIP_delete(ipv4db);
if (ipv6db)
GeoIP_delete(ipv6db);
}
示例5:
Geolocation::~Geolocation() {
#ifdef HAVE_GEOIP
if(geo_ip_asn_db != NULL) GeoIP_delete(geo_ip_asn_db);
if(geo_ip_asn_db_v6 != NULL) GeoIP_delete(geo_ip_asn_db_v6);
if(geo_ip_city_db != NULL) GeoIP_delete(geo_ip_city_db);
if(geo_ip_city_db_v6 != NULL) GeoIP_delete(geo_ip_city_db_v6);
#endif
}
示例6: ipdata_dbfree
void ipdata_dbfree(db_t *dbp)
{
if(!dbp) return;
if(dbp->citygp) GeoIP_delete(dbp->citygp);
if(dbp->asgp) GeoIP_delete(dbp->asgp);
free(dbp);
}
示例7: GeoIP_delete
IpToGeo::~IpToGeo()
{
if (m_pLocation)
GeoIP_delete(m_pLocation);
if (m_pOrg)
GeoIP_delete(m_pOrg);
if (m_pIsp)
GeoIP_delete(m_pIsp);
if (m_pNetspeed)
GeoIP_delete(m_pNetspeed);
}
示例8: free_databases
/**
* Manage the GeoIP databases at startup and exit.
*
* We try to open each database one by one. Failing to open one of them is
* not fatal because some of them may just not be installed on the system
* (for example the Organization db). In that case, all request for an
* organization name will return the unknownCountry code.
*/
static void free_databases(void* ptr)
{
struct GeoIP_databases* db = (struct GeoIP_databases*)ptr;
if (db->country)
GeoIP_delete(db->country);
if (db->org)
GeoIP_delete(db->org);
if (db->region)
GeoIP_delete(db->region);
free(ptr);
}
示例9: ngx_http_geoip_cleanup
static void
ngx_http_geoip_cleanup(void *data)
{
ngx_http_geoip_conf_t *gcf = data;
if (gcf->country) {
GeoIP_delete(gcf->country);
}
if (gcf->city) {
GeoIP_delete(gcf->city);
}
}
示例10: main
int main(int argc, char *argv[])
{
FILE *f;
GeoIP *gi;
char *org;
char host[50];
gi = GeoIP_open("../data/GeoIPISP.dat", GEOIP_STANDARD);
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
exit(1);
}
f = fopen("isp_test.txt", "r");
if (f == NULL) {
fprintf(stderr, "Error opening isp_test.txt\n");
exit(1);
}
while (fscanf(f, "%s", host) != EOF) {
org = GeoIP_org_by_name(gi, (const char *)host);
if (org != NULL) {
printf("%s\t%s\n", host, _mk_NA(org));
free(org);
}
}
fclose(f);
GeoIP_delete(gi);
return 0;
}
示例11: closeAll
void closeAll(char * error){
if(statfp != NULL)
fclose(statfp);
if(handle != NULL)
pcap_close(handle);
if(mysql != NULL){
mysql_query(mysql,"COMMIT;");
mysql_close(mysql);
}
if(geoip != NULL)
GeoIP_delete(geoip);
if(error != NULL)
printf("\n%s",error);
if(handle != NULL)
pcap_stats(handle,&pcapstat);
printf("\n\n(Flow) Packet processed:%u\n",procPackets);
printf("Discarded packet by pcap: %u\n",pcapstat.ps_drop);
printf("Discarded ipv6 packets:%u\n",discPackets);
printf("Total local bytes (discarded): %llu (%.2lf GB)\n",discLocBytes,(double)(discLocBytes)/1000000000);
printf("Analysis ended at: %u\n",time(NULL));
fflush(stdout);
fflush(stderr);
if(error != NULL)
exit(1);
exit(0);
}
示例12: GeoIP_delete
ConnectionManager::~ConnectionManager ()
{
GeoIP_delete(_geoIp);
if (_rsa != 0) {
RSA_free(_rsa);
}
}
示例13: GeoIP_GeoIP_dealloc
static void
GeoIP_GeoIP_dealloc(PyObject* self)
{
GeoIP_GeoIPObject* GeoIP = (GeoIP_GeoIPObject*)self;
GeoIP_delete(GeoIP->gi);
PyObject_Del(self);
}
示例14: GeoIP_delete
void CIP2Country::Disable()
{
if (m_geoip) {
GeoIP_delete(m_geoip);
m_geoip = NULL;
}
}
示例15: geoip_done
void geoip_done(void) {
if (gi) {
GeoIP_delete(gi);
}
g_free(flags);
}