• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GeoIP_delete函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GeoIP_delete函数的典型用法代码示例。如果您正苦于以下问题:C++ GeoIP_delete函数的具体用法?C++ GeoIP_delete怎么用?C++ GeoIP_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GeoIP_delete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 */
}
开发者ID:NX-Andro,项目名称:nefarious2,代码行数:36,代码来源:ircd_geoip.c


示例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
}
开发者ID:wodim,项目名称:irc-hispano,代码行数:60,代码来源:signals.c


示例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;
}
开发者ID:ESGF,项目名称:esgf-dashboard,代码行数:34,代码来源:libiplookup.c


示例4: GeoIP_delete

	~ModuleGeoIP()
	{
		if (ipv4db)
			GeoIP_delete(ipv4db);

		if (ipv6db)
			GeoIP_delete(ipv6db);
	}
开发者ID:Adam-,项目名称:inspircd,代码行数:8,代码来源:m_geoip.cpp


示例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
}
开发者ID:LukeInkster,项目名称:LuaCorpus,代码行数:8,代码来源:Geolocation.cpp


示例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);
}
开发者ID:protoben,项目名称:geotrace,代码行数:9,代码来源:ipdata.c


示例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);
}
开发者ID:creativeprogramming,项目名称:openlitespeed,代码行数:11,代码来源:iptogeo.cpp


示例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);
}
开发者ID:flecoz,项目名称:geoip-vmod,代码行数:20,代码来源:vmod_geoip.c


示例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);
    }
}
开发者ID:Deelight-fr,项目名称:Zimbra-1,代码行数:13,代码来源:ngx_http_geoip_module.c


示例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;
}
开发者ID:Anshumakkar,项目名称:resiprocate,代码行数:35,代码来源:test-geoip-isp.c


示例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);
}
开发者ID:steguerrini,项目名称:AnalyzER,代码行数:29,代码来源:analyzer2.c


示例12: GeoIP_delete

ConnectionManager::~ConnectionManager ()
{
    GeoIP_delete(_geoIp);
    if (_rsa != 0) {
        RSA_free(_rsa);
    }
}
开发者ID:ey6es,项目名称:witgap,代码行数:7,代码来源:ConnectionManager.cpp


示例13: GeoIP_GeoIP_dealloc

static void
GeoIP_GeoIP_dealloc(PyObject* self)
{
  GeoIP_GeoIPObject* GeoIP = (GeoIP_GeoIPObject*)self;
  GeoIP_delete(GeoIP->gi);
  PyObject_Del(self);
}
开发者ID:appneta,项目名称:maxmind-geoip,代码行数:7,代码来源:py_GeoIP.c


示例14: GeoIP_delete

void CIP2Country::Disable()
{
	if (m_geoip) {
		GeoIP_delete(m_geoip);
		m_geoip = NULL;
	}
}
开发者ID:geekt,项目名称:amule,代码行数:7,代码来源:IP2Country.cpp


示例15: geoip_done

void geoip_done(void) {
	if (gi) {
		GeoIP_delete(gi);
	}

	g_free(flags);
}
开发者ID:zturtleman,项目名称:xqf,代码行数:7,代码来源:country-filter.c


示例16: geoip_destroy_pv

void geoip_destroy_pv(void)
{
	if(_handle_GeoIP!=NULL)
	{
		GeoIP_delete(_handle_GeoIP);
		_handle_GeoIP=NULL;
	}
}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:8,代码来源:geoip_pv.c


示例17: GeoIP_delete

void CslGeoIP::Unload()
{
    if (g_geoIP)
    {
        GeoIP_delete(g_geoIP);
        g_geoIP = NULL;
    }
}
开发者ID:aurhat,项目名称:cubelister,代码行数:8,代码来源:CslGeoIP.cpp


示例18: house_keeping

static void
house_keeping (void)
{
#ifdef TCB_MEMHASH
  /* free malloc'd int values on the agent list */
  if (conf.list_agents)
    free_agent_list ();
#endif

  /* REVERSE DNS THREAD */
  pthread_mutex_lock (&gdns_thread.mutex);
  /* kill dns pthread */
  active_gdns = 0;
  free_holder (&holder);
  gdns_free_queue ();

  /* free uniqmap */
#if defined(TCB_BTREE) || defined(TCB_MEMHASH)
  /*for (module = 0; module < TOTAL_MODULES; module++) { */
  /*free_db_key (get_storage_metric (module, MTRC_UNIQMAP)); */
  /*} */
#endif
  free_storage ();

  pthread_mutex_unlock (&gdns_thread.mutex);

  /* DASHBOARD */
  if (dash && !conf.output_html) {
    free_dashboard (dash);
    reset_find ();
  }

  /* GEOLOCATION */
#ifdef HAVE_LIBGEOIP
  if (geo_location_data != NULL)
    GeoIP_delete (geo_location_data);
#endif

  /* LOGGER */
  free (logger);

  /* INVALID REQUESTS */
  if (conf.invalid_requests_log) {
    LOG_DEBUG (("Closing invalid requests log.\n"));
    invalid_log_close ();
  }

  /* CONFIGURATION */
  if (conf.debug_log) {
    LOG_DEBUG (("Bye.\n"));
    dbg_log_close ();
  }

  /* free colors */
  free_color_lists ();
  /* free cmd arguments */
  free_cmd_args ();
}
开发者ID:lNobodyl,项目名称:goaccess,代码行数:58,代码来源:goaccess.c


示例19: geoip_database_file_dir_param1

static ib_status_t geoip_database_file_dir_param1(ib_cfgparser_t *cp,
        const char *name,
        const char *p1,
        void *cbdata)
{
    IB_FTRACE_INIT();

    assert(cp!=NULL);
    assert(name!=NULL);
    assert(p1!=NULL);

    ib_status_t rc;
    size_t p1_len = strlen(p1);
    size_t p1_unescaped_len;
    char *p1_unescaped = malloc(p1_len+1);

    if ( p1_unescaped == NULL ) {
        IB_FTRACE_RET_STATUS(IB_EALLOC);
    }

    rc = ib_util_unescape_string(p1_unescaped,
                                 &p1_unescaped_len,
                                 p1,
                                 p1_len,
                                 IB_UTIL_UNESCAPE_NULTERMINATE |
                                 IB_UTIL_UNESCAPE_NONULL);

    if (rc != IB_OK ) {
        const char *msg = ( rc == IB_EBADVAL )?
                          "GeoIP Database File \"%s\" contains nulls." :
                          "GeoIP Database File \"%s\" is an invalid string.";

        ib_log_debug(cp->ib, msg, p1);
        free(p1_unescaped);
        IB_FTRACE_RET_STATUS(rc);
    }

    if (geoip_db != NULL)
    {
        GeoIP_delete(geoip_db);
        geoip_db = NULL;
    }

    IB_FTRACE_MSG("Initializing custom GeoIP database...");
    IB_FTRACE_MSG(p1_unescaped);

    geoip_db = GeoIP_open(p1_unescaped, GEOIP_MMAP_CACHE);

    free(p1_unescaped);

    if (geoip_db == NULL)
    {
        IB_FTRACE_MSG("Failed to initialize GeoIP database.");
        IB_FTRACE_RET_STATUS(IB_EUNKNOWN);
    }

    IB_FTRACE_RET_STATUS(IB_OK);
}
开发者ID:loveshell,项目名称:ironbee,代码行数:58,代码来源:geoip.c


示例20: geoip_child_init

static void geoip_child_init(apr_pool_t * p, server_rec * s)
{
    geoip_server_config_rec *cfg;
    int i, flags;

    cfg = (geoip_server_config_rec *)
        ap_get_module_config(s->module_config, &geoip_module);

    if (cfg->gips) {
        if (cfg->GeoIPFilenames != NULL) {
            for (i = 0; i < cfg->numGeoIPFiles; i++) {
                flags =
                    (cfg->GeoIPFlags2[i] ==
                     GEOIP_UNKNOWN) ? cfg->GeoIPFlags : cfg->GeoIPFlags2[i];
                if (flags & (GEOIP_MEMORY_CACHE | GEOIP_MMAP_CACHE))
                    continue;
                if (cfg->gips[i]) {
                    GeoIP_delete(cfg->gips[i]);
                }
                cfg->gips[i] = GeoIP_open(cfg->GeoIPFilenames[i], flags);

                if (cfg->gips[i]) {
                    if (cfg->GeoIPEnableUTF8) {
                        GeoIP_set_charset(cfg->gips[i], GEOIP_CHARSET_UTF8);
                    }
                } else {
                    ap_log_error(APLOG_MARK, APLOG_ERR, 0,
                                 s,
                                 "[mod_geoip]: Error while opening data file %s",
                                 cfg->GeoIPFilenames[i]);
                    continue;
                }
            }
        } else {
            if (cfg->gips[0])
                GeoIP_delete(cfg->gips[0]);
            cfg->gips[0] = GeoIP_new(GEOIP_STANDARD);
            if (!cfg->gips[0]) {
                ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
                             "[mod_geoip]: Error while opening data file");
            }
            cfg->numGeoIPFiles = 1;
        }
    }
}
开发者ID:JangByunUk,项目名称:geoip-api-mod_geoip2,代码行数:45,代码来源:mod_geoip.c



注:本文中的GeoIP_delete函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GeoIP_open函数代码示例发布时间:2022-05-30
下一篇:
C++ GenerateWhereStr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap