Ejemplo n.º 1
0
uint32_t searchHash( Hash *hash, uint32_t src ) {


	int i;
	uint32_t key= src;
	
	if( NULL == hash ) {
		return 0;
	}
	
	HASH_GET_KEY( key );	
	
	if( src == hash->entrys[key].src ) {
		return hash->entrys[key].dst;
	}
	
	for( i= 0; i < hash->entrys[key].childrenc; ++i ) {
	
		if( src == hash->entrys[key].children[i].src ) {
			return hash->entrys[key].children[i].dst;
		}
	}
	
	
	return 0;
}
Ejemplo n.º 2
0
void addHash( Hash *hash, uint32_t src, uint32_t dst ) {


	uint32_t key= src;
	
	HASH_GET_KEY( key );	
	
	/* free entry */
	if( 0 == hash->entrys[key].src ) {
		
		hash->entrys[key].src= src;
		hash->entrys[key].dst= dst;
		
	} else {
	
		hash->entrys[key].children= (SubEntry*) realloc(
			hash->entrys[key].children, sizeof( SubEntry ) *
			(hash->entrys[key].childrenc + 1) );
		
		hash->entrys[key].children[hash->entrys[key].childrenc].src= src;
		hash->entrys[key].children[hash->entrys[key].childrenc].dst= dst;
		
		++hash->entrys[key].childrenc;
	}
	
	
}
Ejemplo n.º 3
0
mapInfoProcessT *hash_search( mapInfoProcessT *hash, uint32_t process)
{
  uint32_t hashkey = process;

  HASH_GET_KEY( hashkey );

  if( hash[hashkey].process == process )
  {
    return &(hash[hashkey]);
  }
  else
  {
    return search_inner( hash[hashkey].next, process );
  }
  return NULL;
}
Ejemplo n.º 4
0
mapInfoProcessT *hash_add( mapInfoProcessT *hash, uint32_t process)
{
  uint32_t hashkey = process;

  HASH_GET_KEY( hashkey );

  if( hash[hashkey].process == (uint32_t)-1 )
  {
    hash[hashkey].process = process;
    return &(hash[hashkey]);
  }
  else
  {
    return add_inner( &(hash[hashkey].next), process );
  }
}
Ejemplo n.º 5
0
streaminfoT* hash_search( hashtabT *hash, uint32_t entry) {

	int i;
	uint32_t hashkey = entry;
	
	HASH_GET_KEY( hashkey );
	
	if ( hash[hashkey].entry.streamid == entry ) {
		return &hash[hashkey].entry;
	} else {
		for( i = 0; i < hash[hashkey].entryvecsize; i++ ) {
		
			if ( hash[hashkey].p_entryvec[i].streamid == entry )
				return &(hash[hashkey].p_entryvec[i]);
		}
	}
	
	return NULL;
}
Ejemplo n.º 6
0
void hash_add( hashtabT *hash, uint32_t entry ) {

	uint32_t hashkey = entry;
	
	HASH_GET_KEY( hashkey );
	
	if ( hash[hashkey].entryvecsize == -1 ) {
	
		hash[hashkey].entry.streamid = entry;
		
		hash[hashkey].entry.ticksPerSecond= 0;
		hash[hashkey].entry.functions= NULL;
		hash[hashkey].entry.nfunctions= 0;
		hash[hashkey].entry.sfunctions= 0;
		hash[hashkey].entry.functiongroups= NULL;
		hash[hashkey].entry.nfunctiongroups= 0;
		hash[hashkey].entry.sfunctiongroups= 0;
		
		hash[hashkey].entryvecsize = 0;
	
	} else { /* realloc the entryvector and insert the new entry */
	
		hash[hashkey].p_entryvec = (streaminfoT *) realloc( hash[hashkey].p_entryvec,
			sizeof( streaminfoT ) * ( hash[hashkey].entryvecsize + 1) );
			
		hash[hashkey].p_entryvec[hash[hashkey].entryvecsize].streamid = entry;;
		
		hash[hashkey].p_entryvec[hash[hashkey].entryvecsize].ticksPerSecond= 0;
		hash[hashkey].p_entryvec[hash[hashkey].entryvecsize].functions= NULL;
		hash[hashkey].p_entryvec[hash[hashkey].entryvecsize].nfunctions= 0;
		hash[hashkey].p_entryvec[hash[hashkey].entryvecsize].sfunctions= 0;
		hash[hashkey].p_entryvec[hash[hashkey].entryvecsize].functiongroups= NULL;
		hash[hashkey].p_entryvec[hash[hashkey].entryvecsize].nfunctiongroups= 0;
		hash[hashkey].p_entryvec[hash[hashkey].entryvecsize].sfunctiongroups= 0;
		
		hash[hashkey].entryvecsize++;
		
	}
}