示例#1
0
static list_t *
set_vendor_namespaces(void) 
{
  hscan_t hs;
  hnode_t *hn;
  int i;

  list_t *l = list_create(LISTCOUNT_T_MAX);
  for (i = 0; CimResource_Namespaces[i].ns != NULL; i++) {
    WsSupportedNamespaces *ns =
          (WsSupportedNamespaces *)u_malloc(sizeof(WsSupportedNamespaces));
    ns->class_prefix = CimResource_Namespaces[i].class_prefix;
    ns->ns = (char*) CimResource_Namespaces[i].ns;
    lnode_t *node = lnode_create(ns);
    list_append(l, node);
  }

  if (vendor_namespaces && hash_count(vendor_namespaces) > 0 ) {
    hash_scan_begin(&hs, vendor_namespaces);
    while ((hn = hash_scan_next(&hs))) {
      WsSupportedNamespaces *ns =
           (WsSupportedNamespaces *)u_malloc(sizeof(WsSupportedNamespaces));
      ns->class_prefix = (char*)hnode_getkey(hn);
      ns->ns = (char*) hnode_get(hn);
      lnode_t *node = lnode_create(ns);
      list_append(l, node);
    }
  }
  return l;
}
示例#2
0
void
wsmc_add_selector_from_uri(WsXmlDocH doc,
		const char *resource_uri)
{
	u_uri_t        *uri;
	WsXmlNodeH      header = ws_xml_get_soap_header(doc);
	hash_t         *query;
	hnode_t        *hn;
	hscan_t         hs;

	if (resource_uri != NULL) {
		if (u_uri_parse((const char *) resource_uri, &uri) != 0)
			return;
		else if (!uri->query)
			goto cleanup;
	}

	query = u_parse_query(uri->query);
	hash_scan_begin(&hs, query);
	while ((hn = hash_scan_next(&hs))) {
		wsman_add_selector(header,
				(char *) hnode_getkey(hn),
				(char *) hnode_get(hn));
		debug("key=%s value=%s", (char *) hnode_getkey(hn),
				(char *) hnode_get(hn));
	}
	hash_free_nodes(query);
	hash_destroy(query);
cleanup:
	if (uri) {
		u_uri_free(uri);
	}
}
示例#3
0
/**
 * Base class implementation of destructor.
 *
 * @param _this This instance
 */
void CDlpObject_Destructor(CDlpObject* _this)
{
  SWord*   lpWord;
  hnode_t* hn;
  hscan_t  hs;

  DEBUGMSG(-1,"CDlpObject_Destructor for '%s'",_this->m_lpInstanceName,0,0);

  /* Detach external instances */
  hash_scan_begin(&hs,_this->m_lpDictionary);
  while ((hn = hash_scan_next(&hs))!=NULL)
  {
    DLPASSERT((lpWord = (SWord*)hnode_get(hn))!=NULL); /* NULL entry in dictionary */

    if
    (
      lpWord->nWordType == WL_TYPE_FIELD &&
      lpWord->ex.fld.nType == T_INSTANCE
    )
    {
      CHECK_IPTR(*(CDlpObject**)lpWord->lpData,lpWord->ex.fld.nISerialNum);
      if (CDlpObject_GetParent(*(CDlpObject**)lpWord->lpData)!=_this)
        *(CDlpObject**)lpWord->lpData = NULL;
    }
  }

#ifndef __NORTTI
  /* Clear words */
  if(NOK(CDlpObject_UnregisterAllWords(_this)) )
    IERROR(_this,ERR_DESTROY," Error while UnregisterAllWords of instance %s !",
      _this->m_lpInstanceName,0);
  /* Clear operators */
  if(NOK(CDlpObject_UnregisterAllOperators(_this)) )
    IERROR(_this,ERR_DESTROY," Error while UnregisterAllOperators of instance %s !",
      _this->m_lpInstanceName,0);
#endif

  /* Destroy dictionaries */
  if(!hash_isempty(_this->m_lpObsIds))
    IERROR(_this,ERR_DESTROY,
      " Destructor of instance '%s': hash 'ObsIds' not empty !",
      _this->m_lpInstanceName,0);
  if(!hash_isempty(_this->m_lpDictionary))
    IERROR(_this,ERR_DESTROY,
      " Destructor of instance '%s': hash 'Dictionary' not empty !",
      _this->m_lpInstanceName,0);
  if(!hash_isempty(_this->m_lpOpDict))
    IERROR(_this,ERR_DESTROY,
      " Destructor of instance '%s': hash 'OpDict' not empty !",
      _this->m_lpInstanceName,0);

  hash_destroy(_this->m_lpObsIds    );
  hash_destroy(_this->m_lpDictionary);
  hash_destroy(_this->m_lpOpDict);

#ifdef __cplusplus
  /* Unregister */
  dlp_xalloc_unregister_object(_this);
#endif
}
示例#4
0
CP_C_API void cp_unregister_ploader(cp_context_t *ctx, cp_plugin_loader_t *loader) {
	hnode_t *hnode;
	
	CHECK_NOT_NULL(ctx);
	CHECK_NOT_NULL(loader);

	cpi_lock_context(ctx);
	cpi_check_invocation(ctx, CPI_CF_ANY, __func__);
	hnode = hash_lookup(ctx->env->loaders_to_plugins, loader);
	if (hnode != NULL) {
		hash_t *loader_plugins = hnode_get(hnode);

		// Uninstall all plug-ins loaded by the loader
		while (!hash_isempty(loader_plugins)) {
			hscan_t hscan;
			hnode_t *hnode2;
			cp_status_t status;
	
			hash_scan_begin(&hscan, loader_plugins);
			hnode2 = hash_scan_next(&hscan);
			assert(hnode2 != NULL);
			status = cp_uninstall_plugin(ctx, hnode_getkey(hnode2));
			assert(status == CP_OK);
		}
		hash_delete_free(ctx->env->loaders_to_plugins, hnode);
		assert(hash_isempty(loader_plugins));
		hash_destroy(loader_plugins);
		cpi_debugf(ctx, N_("The plug-in loader %p was unregistered."), (void *) loader);
	}
	cpi_unlock_context(ctx);
}
示例#5
0
CP_C_API void cp_unregister_ploaders(cp_context_t *ctx) {
	int found;

	CHECK_NOT_NULL(ctx);
	
	cpi_lock_context(ctx);
	cpi_check_invocation(ctx, CPI_CF_ANY, __func__);
	do {
		hscan_t hscan;
		hnode_t *hnode;
		
		hash_scan_begin(&hscan, ctx->env->loaders_to_plugins);
		do {
			hnode = hash_scan_next(&hscan);
		} while (hnode != NULL && hnode_getkey(hnode) == ctx->env->local_loader);
		if (hnode != NULL) {
			cp_plugin_loader_t *loader = (cp_plugin_loader_t *) hnode_getkey(hnode);
			cp_unregister_ploader(ctx, loader);
			found = 1;
		} else {
			found = 0;
		}
	} while (found);
	cpi_unlock_context(ctx);
	
}
示例#6
0
 epr_t *epr_from_string(const char* str)
 {
 	char *p;
	char *uri;
	hash_t *selectors;
	hash_t *selectors_new;
	hnode_t        *hn;
	hscan_t         hs;
	selector_entry *entry;
	epr_t *epr;

	p = strchr(str, '?');
	uri = u_strndup(str, p - str);
	selectors = u_parse_query(p + 1);
	selectors_new = hash_create2(HASHCOUNT_T_MAX, 0, 0);

	hash_scan_begin(&hs, selectors);
	while ((hn = hash_scan_next(&hs))) {
		entry = u_malloc(sizeof(selector_entry));
		entry->type = 0;
		entry->entry.text = (char *)hnode_get(hn);
		hash_alloc_insert(selectors_new, hnode_getkey(hn), entry);
	}

	epr = epr_create(uri, selectors_new, NULL);
	hash_free(selectors_new);
	hash_free(selectors);
	u_free(uri);
	return epr;
 }
示例#7
0
static void
wsmc_set_put_prop(WsXmlDocH get_response,
		WsXmlDocH put_request,
		client_opt_t *options)
{
	WsXmlNodeH      resource_node;
	char           *ns_uri;
	hscan_t         hs;
	hnode_t        *hn;
	WsXmlNodeH      get_body = ws_xml_get_soap_body(get_response);
	WsXmlNodeH      put_body = ws_xml_get_soap_body(put_request);

	ws_xml_copy_node(ws_xml_get_child(get_body, 0, NULL, NULL), put_body);
	resource_node = ws_xml_get_child(put_body, 0, NULL, NULL);
	ns_uri = ws_xml_get_node_name_ns_uri(resource_node);

	if (!options->properties) {
		return;
	}
	hash_scan_begin(&hs, options->properties);
	while ((hn = hash_scan_next(&hs))) {
		WsXmlNodeH      n = ws_xml_get_child(resource_node, 0,
				ns_uri, (char *) hnode_getkey(hn));
		ws_xml_set_node_text(n, (char *) hnode_get(hn));
	}
}
示例#8
0
int
main(int argc, char *argv[])
{
    hash_t *htab;
    hnode_t *hnp, *hnp1;
    char *line;
    ca_o ca, pca;
    int i;
    unsigned long phash = 0;

    htab = hash_create(argc, (hash_comp_t) hash_comp_test, hash_fun_test);

    //printf("key width = %lu\n", HASH_VAL_T_MAX);

    for (i = 1; i < argc; i++) {
        line = argv[i];
        ca = ca_new(line);
        ca->ca_phash = phash;
        phash = ca->ca_hash;

        if (! hash_lookup(htab, (void *)ca->ca_hash)) {
            hnp = hnode_create(ca);
            hash_insert(htab, hnp, (void *)ca->ca_hash);
            printf("%s [%lu.%lu]\n", ca->ca_line, ca->ca_phash, ca->ca_hash);
        } else {
            printf("%s present\n", line);
        }
    }

    hscan_t hscan;
    hash_scan_begin(&hscan, htab);
    for (hnp = hash_scan_next(&hscan); hnp; hnp = hash_scan_next(&hscan)) {
        ca = (ca_o)hnode_get(hnp);
        printf("%s [%lu.%lu]\n", ca->ca_line, ca->ca_phash, ca->ca_hash);
        if ((hnp1 = hash_lookup(htab, (void *)ca->ca_phash))) {
            pca = (ca_o)hnode_get(hnp1);
            printf("parent of %s is %s\n", ca->ca_line, pca->ca_line);
        } else {
            printf("%s [%lu.%lu] has no parent\n",
                   ca->ca_line, ca->ca_phash, ca->ca_hash);
        }
        //hash_scan_delete(htab, hnp);
        //hnode_destroy(hnp);
    }

    return 0;
}
示例#9
0
static void printhash( hash_t *hash ){
  hscan_t hs;
  hnode_t *hn;

  hash_scan_begin(&hs, hash);
  while ((hn = hash_scan_next(&hs)))
    printf("%s\t%s\n", (char*) hnode_getkey(hn),
	   (char*) hnode_get(hn));
}
示例#10
0
void hash_free_nodes(hash_t *hash)
{
    hscan_t hs;
    hnode_t *node;
    hash_scan_begin(&hs, hash);
    while ((node = hash_scan_next(&hs))) {
        hash_scan_delete(hash, node);
        hash->freenode(node, hash->context);
    }
    hash->nodecount = 0;
    clear_table(hash);
}
示例#11
0
/// Breaks up the aggregation and uploads each piece separately.
/// Audit groups do not nest. Therefore, when we see an aggregating
/// cmd while already within an audit group, the "outer" group becomes
/// invalid. This method traverses an audit group, publishes each of
/// its audits individually, and destroys the group, thus clearing
/// the way for the "inner" group to take over.
/// @param[in] ldr      the leader object pointer
/// @param[in] process  a function pointer to the publishing callback
void
ca_disband(ca_o ldr, void (*process) (ca_o))
{
    hnode_t *hnp;
    ck_o ck;
    ca_o sub;
    hscan_t hscan;

    _ca_verbosity_ag(ldr, "DISBANDING", NULL);

    hash_scan_begin(&hscan, ldr->ca_group_hash);
    for (hnp = hash_scan_next(&hscan); hnp; hnp = hash_scan_next(&hscan)) {
        ck = (ck_o)hnode_getkey(hnp);
        sub = (ca_o)hnode_get(hnp);
        if (ca_get_closed(sub)) {
            _ca_verbosity_ag(sub, "PROCESSING", NULL);
            ca_coalesce(sub);
            process(sub);
        } else {
            _ca_verbosity_ag(sub, "RELEASING", NULL);
        }
        ca_set_leader(sub, NULL);
        hash_scan_delete(ldr->ca_group_hash, hnp);
        hnode_destroy(hnp);
        ck_destroy(ck);
    }

    if (ca_get_closed(ldr)) {
        _ca_verbosity_ag(ldr, "PROCESSING", NULL);
        ca_coalesce(ldr);
        process(ldr);
    } else {
        _ca_verbosity_ag(ldr, "RELEASING", NULL);
    }

    hash_destroy(ldr->ca_group_hash);
    ldr->ca_group_hash = NULL;
    ca_set_leader(ldr, NULL);
}
示例#12
0
/// Returns the number of pending (not yet closed) audits in the group.
/// @param[in] ca       the object pointer
/// @return the number of pending audits
int
ca_get_pending(ca_o ca)
{
    int pending = 0;

    if (ca->ca_group_hash) {
        hscan_t hscan;
        hnode_t *hnp;

        hash_scan_begin(&hscan, ca->ca_group_hash);
        for (hnp = hash_scan_next(&hscan); hnp; hnp = hash_scan_next(&hscan)) {
            ca_o sub;

            sub = (ca_o)hnode_get(hnp);
            if (!ca_get_closed(sub)) {
                pending++;
            }
        }
    }

    return pending;
}
示例#13
0
/// For debugging support - dumps contents of a CA to stderr
/// @param[in] ca       the object pointer
/*static*/ void
ca_dump(ca_o ca)
{
    CCS hdr;
    CCS stars = "******************************************************\n";
    CCS subsep = "@@@@@@@@@@@\n";

    assert(ca);

    fputs(stars, stderr);

    hdr = ca_format_header(ca);
    fputs(hdr, stderr);
    putil_free(hdr);

    if (ca->ca_raw_pa_dict) {
        (void)ca_foreach_raw_pa(ca, _ca_dump_pa, "RAW: ");
    }

    if (ca->ca_cooked_pa_dict) {
        (void)ca_foreach_cooked_pa(ca, _ca_dump_pa, "COOKED: ");
    }

    if (ca->ca_group_hash) {
        hscan_t hscan;
        hnode_t *hnp;

        hash_scan_begin(&hscan, ca->ca_group_hash);
        for (hnp = hash_scan_next(&hscan); hnp; hnp = hash_scan_next(&hscan)) {
            ca_o sub;

            fputs(subsep, stderr);
            sub = (ca_o)hnode_get(hnp);
            ca_dump(sub);
        }
    }

    fputs(stars, stderr);
}
示例#14
0
static void printcfg( CamConfig *ccfg ){
  hscan_t hs;
  hnode_t *hn;

  hash_scan_begin(&hs, ccfg->mainhash);
  while ((hn = hash_scan_next(&hs))){
    CamConfigSection *sec;

    sec = hnode_get( hn );
    printf("-------%s--------\n", sec->section_name );
    printhash( sec->entryhash );
  }
}
示例#15
0
void unload_modules( void )
{
	Module *mod_ptr;
	hscan_t ms;
	hnode_t *node;

	/* Walk through hash list unloading each module */
	hash_scan_begin( &ms, modulehash );
	while( ( node = hash_scan_next( &ms ) ) != NULL ) {
		mod_ptr = hnode_get( node );
		unload_module( mod_ptr->info->name, NULL );
	}
}
示例#16
0
/// Finish off the CA by formatting it and sending it off.
/// @param[in] ca       the object pointer
/// @param[in] process  a function pointer to the publishing callback
void
ca_publish(ca_o ca, void (*process) (ca_o))
{
    _ca_verbosity_ag(ca, "BUNDLING", NULL);

    // Combine the textual command lines of the subcommands for record keeping.
    if (ca->ca_group_hash) {
        hscan_t hscan;
        hnode_t *hnp;
        ck_o ck;
        ca_o sub;

        hash_scan_begin(&hscan, ca->ca_group_hash);
        for (hnp = hash_scan_next(&hscan); hnp; hnp = hash_scan_next(&hscan)) {
            ck = (ck_o)hnode_getkey(hnp);
            sub = (ca_o)hnode_get(hnp);
            if (sub != ca) {
                _ca_verbosity_ag(sub, "MERGING", NULL);
                ca_merge(ca, sub);
                ca_set_processed(sub, 1);
            }
            hash_scan_delete(ca->ca_group_hash, hnp);
            hnode_destroy(hnp);
            ck_destroy(ck);
        }

        hash_destroy(ca->ca_group_hash);
        ca->ca_group_hash = NULL;
    }

    // Merge all PAs in subcommands in with the PA set of the leader.
    // Must be done before serializing for upload but after subcmds
    // are merged in.
    ca_coalesce(ca);

    // The sub CAs have now been sucked dry. Publish the fully merged leader.
    process(ca);
}
示例#17
0
void SynchAllModules( void )
{
	Module *module_ptr;
	hscan_t ms;
	hnode_t *node;

	SET_SEGV_LOCATION();
	hash_scan_begin( &ms, modulehash );
	while( ( node = hash_scan_next( &ms ) ) != NULL ) {
		module_ptr = hnode_get( node );
		if( SynchModule( module_ptr ) != NS_SUCCESS ) {
			unload_module( module_ptr->info->name, NULL );
		}
	}
}
示例#18
0
void CGEN_PRIVATE CFst_Cps_HashPrint(CFst* _this)
{
  hscan_t  hs;
  hnode_t* hn;
  FST_ITYPE nS;

  printf("\n -- CFst_Cps_HashPrint: %ld entries --",(long)hash_count((hash_t*)_this->m_lpCpsHash));
  hash_scan_begin(&hs,(hash_t*)_this->m_lpCpsHash);
  while ((hn = hash_scan_next(&hs))!=NULL)
  {
  	nS = (FST_ITYPE)((int)((UINT64)hnode_get(hn)&0xffffffff));
  	printf("\n   %ld",nS);
  }
  printf("\n -------------------------------------");

}
示例#19
0
void
wsmc_add_selector_from_options(WsXmlDocH doc, client_opt_t *options)
{
	WsXmlNodeH      header;
	hnode_t        *hn;
	hscan_t         hs;
	if (!options->selectors || hash_count(options->selectors) == 0)
		return;
	header = ws_xml_get_soap_header(doc);
	hash_scan_begin(&hs, options->selectors);
	while ((hn = hash_scan_next(&hs))) {
		wsman_add_selector(header,
				(char *) hnode_getkey(hn), (char *) hnode_get(hn));
		debug("key = %s value=%s",
				(char *) hnode_getkey(hn), (char *) hnode_get(hn));
	}
}
示例#20
0
static int AccessList( const CmdParams *cmdparams )
{
	hscan_t accessscan;
	hnode_t *node;
	AccessEntry *access;

	SET_SEGV_LOCATION();	
	irc_prefmsg( NULL, cmdparams->source, "Access List (%d):", ( int )hash_count( accesshash ) );
	hash_scan_begin( &accessscan, accesshash );
	while( ( node = hash_scan_next( &accessscan ) ) != NULL) 
	{
		access = hnode_get( node );
		irc_prefmsg( NULL, cmdparams->source, "%s %s (%d)", access->nick, access->mask, access->level );
	}
	irc_prefmsg( NULL, cmdparams->source, "End of list." );
	return NS_SUCCESS;
}
示例#21
0
文件: helpers.c 项目: juergh/dash-sdk
/* convert openwsman hash_t* to hash VALUE (string pairs) */
static VALUE
hash2value( hash_t *hash )
{
    VALUE v;
    hnode_t *node;
    hscan_t ptr;
  
    if (!hash) return Qnil;

    hash_scan_begin( &ptr, hash );

    v = rb_hash_new();
    while ((node = hash_scan_next( &ptr )) ) {
	rb_hash_aset( v, makestring( hnode_getkey( node ) ), makestring( hnode_get( node ) ) );
    }
    return v;
}
示例#22
0
epr_t *epr_create(const char *uri, hash_t * selectors, const char *address)
{
	epr_t *epr = NULL;
	epr = u_malloc(sizeof(epr_t));
	if (address == NULL)
		epr->address = u_strdup(WSA_TO_ANONYMOUS);
	else
		epr->address = u_strdup(address);

	epr->refparams.uri = u_strdup(uri);

	if (selectors) {
		hnode_t        *hn;
		hscan_t         hs;
		Selector *p;
		selector_entry *entry;
		epr->refparams.selectorset.count = hash_count(selectors);
		epr->refparams.selectorset.selectors = u_malloc(sizeof(Selector)*
			epr->refparams.selectorset.count);

		p = epr->refparams.selectorset.selectors;
		hash_scan_begin(&hs, selectors);
		while ((hn = hash_scan_next(&hs))) {
			p->name = u_strdup((char *)hnode_getkey(hn));
			entry = (selector_entry *)hnode_get(hn);
			if(entry->type == 0) {
				p->type = 0;
				p->value = u_strdup(entry->entry.text);
				debug("key = %s value=%s",
					(char *) hnode_getkey(hn), p->value);
			}
			else {
				p->type = 1;
				p->value = (char *)epr_copy(entry->entry.eprp);
				debug("key = %s value=%p(nested epr)",
					(char *) hnode_getkey(hn), p->value);
			}
			p++;
		}
	} else {
		epr->refparams.selectorset.count  = 0;
		epr->refparams.selectorset.selectors  = NULL;
	}
	return epr;
}
示例#23
0
void camconfig_dest( CamConfig *ccfg ){
  hscan_t hs;
  hnode_t *node;

  hash_scan_begin( &hs, ccfg->mainhash );
  while( (node = hash_scan_next( &hs ))) {
    char *key;
    CamConfigSection *val;

    key = hnode_getkey( node );
    val = hnode_get( node );
    hash_scan_delete( ccfg->mainhash, node );
    ccfg->mainhash->freenode( node, ccfg->mainhash->context );
    free( key );
    section_dest( val );
  }
  hash_destroy( ccfg->mainhash );
  free( ccfg );
}
示例#24
0
static
void section_dest( CamConfigSection *section ){
  hscan_t hs;
  hnode_t *node;

  hash_scan_begin( &hs, section->entryhash );
  while( (node = hash_scan_next( &hs ))) {
    char *key, *val;

    key = hnode_getkey( node );
    val = hnode_get( node );
    hash_scan_delete( section->entryhash, node );
    section->entryhash->freenode( node, section->entryhash->context );
    free( key );
    free( val );
  }
  hash_destroy( section->entryhash );
  free( section );
}
示例#25
0
int ProcessModuleList( const ModuleListHandler handler, void *v )
{
	Module *module_ptr;
	hscan_t ms;
	hnode_t *node;
	int ret = 0;

/*	SET_SEGV_LOCATION(); */

	hash_scan_begin( &ms, modulehash );
	while( ( node = hash_scan_next( &ms ) ) != NULL )
	{
		module_ptr = hnode_get( node );
		ret = handler( module_ptr, v );
		if( ret != 0 )
			break;
	}
	return ret;
}
static
char * get_cim_indication_namespace(WsSubscribeInfo *subsInfo, char *classname) {
	hscan_t hs;
	hnode_t *hn;
	char *sub;
	if (strstr(subsInfo->uri, XML_NS_CIM_CLASS) != NULL) {
	   	return u_strdup(subsInfo->uri);
	}
	hash_t *namespaces = subsInfo->vendor_namespaces;
	if (namespaces) {
		hash_scan_begin(&hs, namespaces);
		while ((hn = hash_scan_next(&hs))) {
			debug("namespace=%s", (char *) hnode_get(hn));
			if ((sub =  strstr(classname, (char *) hnode_getkey(hn)))) {
				return u_strdup((char *)hnode_get(hn));
			}
		}
	}
	return NULL;
}
示例#27
0
int ModFini( void )
{
	hscan_t accessscan;
	hnode_t *node;
	AccessEntry *access;

	del_services_cmd_list( extauth_commands );


	hash_scan_begin( &accessscan, accesshash );
	while( ( node = hash_scan_next( &accessscan ) ) != NULL) 
	{
		access = hnode_get( node );
		ns_free (access);
		hash_scan_delete_destroy_node(accesshash, node);
	}
	hash_destroy(accesshash);

	return NS_SUCCESS;
}
示例#28
0
文件: ekhtml.c 项目: hilbix/ekhtml
void ekhtml_parser_destroy(ekhtml_parser_t *ekparser){
    hnode_t *hn;
    hscan_t hs;

    hash_scan_begin(&hs, ekparser->startendcb);
    while((hn = hash_scan_next(&hs))){
        ekhtml_string_t *key = (ekhtml_string_t *)hnode_getkey(hn);
        ekhtml_tag_container *cont = hnode_get(hn);

        hash_scan_delfree(ekparser->startendcb, hn);
        free((char *)key->str);
        free(key);
        free(cont);
    }
    
    hash_destroy(ekparser->startendcb);
    ekhtml_parser_starttag_cleanup(ekparser);
    free(ekparser->buf);
    free(ekparser);
}
示例#29
0
/* @brief Rotate the log files if they have been opened longer than the pre-defined time
 * 
 * Runs through all active opened logfiles only
 */
int ls_rotate_logs( void *userptr ) 
{
	hscan_t hs;
	hnode_t *hn;
	ChannelLog *cl;
	
	/* if Logage is 0, just bail out */
	if( LogServ.maxopentime <= 0 ) {
		return NS_SUCCESS;
	}

	/* scan through the log files */
	hash_scan_begin( &hs, lschannelhash );
	while( ( hn = hash_scan_next( &hs ) ) != NULL ) {
		cl = hnode_get( hn );
		/* if the log has been opened more than X, then rotate */
		if( ( cl->logfile ) &&( ( me.now - cl->ts_open ) > LogServ.maxopentime ) ) {
			ls_switch_file( cl );
		}
	}
	return NS_SUCCESS;
}
示例#30
0
void ls_close_logs( void )
{
	hscan_t hs;
	hnode_t *hn;
	ChannelLog *cl;
	
	/* scan through the log files */
	hash_scan_begin( &hs, lschannelhash );
	while( ( hn = hash_scan_next( &hs ) ) != NULL )
	{
		cl = hnode_get( hn );
		ls_close_log( cl );
		if( cl->c )
		{
			ClearChannelModValue( cl->c );
			cl->c = NULL;
		}
		/* delete from the hash */
		hash_scan_delete_destroy_node( lschannelhash, hn );
		ns_free( cl );
	}
}