Пример #1
0
void snmp_bc_close(void *hnd)
{
        struct oh_handler_state *handle = (struct oh_handler_state *)hnd;
        oh_sel_close(handle->selcache);

	if (is_simulator()) {
		sim_close();
	}
	else {
		struct snmp_bc_hnd *custom_handle = (struct snmp_bc_hnd *)handle->data;

		/* Should we free handle->config? */
		/* windows32 specific net-snmp cleanup (is a noop on unix) */
		snmp_close(custom_handle->ss);
		SOCK_CLEANUP;
	}

	/* Cleanup event2hpi hash table */
	event2hpi_hash_free(handle);

	/* Cleanup str2event hash table */
	str2event_use_count--;
	if (str2event_use_count == 0) 
		str2event_hash_free();

}
Пример #2
0
void oh_cleanup_domain(void)
{
        data_access_lock();

        while(global_domain_list) {
                struct oh_domain *d = (struct oh_domain *)global_domain_list->data;
                global_domain_list = g_slist_remove(global_domain_list, d);

                if (d->sel)
                        oh_sel_close(d->sel);

                free(d);
        }

        data_access_unlock();
}
Пример #3
0
void snmp_bc_close(void *hnd)
{
    struct oh_handler_state *handle = (struct oh_handler_state *)hnd;
    struct snmp_bc_hnd *custom_handle =
        (struct snmp_bc_hnd *)handle->data;

    oh_sel_close(handle->selcache);
    snmp_close(custom_handle->ss);
    /* Should we free handle->config? */

    /* windows32 specific net-snmp cleanup (is a noop on unix) */
    SOCK_CLEANUP;

    /* Cleanup str2event hash table */
    str2event_hash_free();

    /* Cleanup event2hpi hash table */
    event2hpi_hash_free();
}
Пример #4
0
/**
 * main: SEL test
 * 
 * This test tests creates an SEL and adds five events.
 * It then save the SEL to a file.
 * 
 * Return value: 0 on success, 1 on failure
 **/
int main(int argc, char **argv) 
{
        oh_sel *sel;
        int x;
        SaErrorT retc;
        
        /* create the SEL */
        sel = oh_sel_create();
        
        if(sel == NULL) {
                dbg("ERROR: sel == NULL.");
                return 1;
        }

        /* add a multiple events */
        for (x = 0; x < 5; x++) {
                retc = add_event(sel, x);
                if (retc != SA_OK) {
                        dbg("ERROR: add_event failed.");
                        return 1;
                }
        }

        /* save the SEL */
        retc = oh_sel_map_to_file(sel, "./selTest.data");
        if (retc != SA_OK) {
                dbg("ERROR: oh_sel_map_to_file failed.");
                return 1;
        }

        /* close the sel */
        retc = oh_sel_close(sel);
        if (retc != SA_OK) {
                dbg("ERROR: oh_sel_close failed.");
                return 1;
        }

        
        return 0;
}
Пример #5
0
/**
 * main: SEL test
 * 
 * This test tests creates an SEL and adds five events.
 * It then save the SEL to a file.
 * 
 * Return value: 0 on success, 1 on failure
 **/
int main(int argc, char **argv) 
{
        oh_sel *sel;
        SaErrorT retc;
        
        /* create the SEL */
        sel = oh_sel_create(OH_SELTEST_MAX_ENTRIES);
        
        if(sel == NULL) {
                dbg("ERROR: sel == NULL.");
                return 1;
        }

        /* get SEL from file with invalid filename */
        retc = oh_sel_map_from_file(sel, NULL);
        if (retc != SA_ERR_HPI_INVALID_PARAMS) {
                dbg("ERROR: oh_sel_map_from_file failed with invalid filename.");
                return 1;
        }

        /* get SEL from file */
        retc = oh_sel_map_from_file(sel, "./selTest.data");
        if (retc != SA_OK) {
                dbg("ERROR: oh_sel_map_from_file failed.");
                return 1;
        }

        /* check out the SEL */
        if(sel->enabled != TRUE) {
                dbg("ERROR: sel->enabled invalid.");
                return 1;
        }
        
        if(sel->overflow != FALSE) {
                dbg("ERROR: sel->overflow invalid.");
                return 1;
        }
        
        if(sel->deletesupported != FALSE) {
                dbg("ERROR: sel->deletesupported invalid.");
                return 1;
        }
        
        if(sel->lastUpdate == SAHPI_TIME_UNSPECIFIED) {
                dbg("ERROR: sel->lastUpdate invalid.");
                return 1;
        }
        
        if(sel->offset != 0) {
                dbg("ERROR: sel->offset invalid.");
                return 1;
        }
        
        /* note: if sel_test_003.c changes this test may need to change */
        if(sel->nextId < OH_SELTEST_MAX_ENTRIES) {
                dbg("ERROR: sel->nextId invalid.");
                return 1;
        }
        
        if(sel->maxsize != OH_SELTEST_MAX_ENTRIES) {
                dbg("ERROR: sel->maxsize invalid.");
                return 1;
        }
        
        if(sel->selentries == NULL) {
                dbg("ERROR: sel->selentries invalid.");
                return 1;
        }

        /* close the sel */
        retc = oh_sel_close(sel);
        if (retc != SA_OK) {
                dbg("ERROR: oh_sel_close failed.");
                return 1;
        }

        
        return 0;
}