Ignore:
Timestamp:
Jan 30, 2006 6:40:05 PM (18 years ago)
Author:
bennylp
Message:

Finished implementation of UA layer (to be tested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/hash.h

    r66 r127  
    4646 
    4747/** 
     48 * This indicates the size of of each hash entry. 
     49 */ 
     50#define PJ_HASH_ENTRY_SIZE      (3*sizeof(void*) + 2*sizeof(pj_uint32_t)) 
     51 
     52/** 
    4853 * This is the function that is used by the hash table to calculate hash value 
    4954 * of the specified key. 
     
    9398 * @param keylen    the length of the key, or PJ_HASH_KEY_STRING to use the 
    9499 *                  string length of the key. 
     100 * @param hval      if this argument is not NULL and the value is not zero, 
     101 *                  the value will be used as the computed hash value. If 
     102 *                  the argument is not NULL and the value is zero, it will 
     103 *                  be filled with the computed hash upon return. 
    95104 * 
    96105 * @return the value associated with the key, or NULL if the key is not found. 
    97106 */ 
    98107PJ_DECL(void *) pj_hash_get( pj_hash_table_t *ht, 
    99                              const void *key, unsigned keylen ); 
    100  
    101  
    102 /** 
    103  * Associate/disassociate a value with the specified key. 
     108                             const void *key, unsigned keylen, 
     109                             pj_uint32_t *hval ); 
     110 
     111 
     112/** 
     113 * Associate/disassociate a value with the specified key. If value is not 
     114 * NULL and entry already exists, the entry's value will be overwritten. 
     115 * If value is not NULL and entry does not exist, a new one will be created 
     116 * with the specified pool. Otherwise if value is NULL, entry will be 
     117 * deleted if it exists. 
    104118 * 
    105119 * @param pool      the pool to allocate the new entry if a new entry has to be 
     
    109123 * @param keylen    the length of the key, or PJ_HASH_KEY_STRING to use the  
    110124 *                  string length of the key. 
     125 * @param hval      if the value is not zero, then the hash table will use 
     126 *                  this value to search the entry's index, otherwise it will 
     127 *                  compute the key. This value can be obtained when calling 
     128 *                  #pj_hash_get(). 
    111129 * @param value     value to be associated, or NULL to delete the entry with 
    112130 *                  the specified key. 
    113131 */ 
    114132PJ_DECL(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, 
    115                            const void *key, unsigned keylen, 
     133                           const void *key, unsigned keylen, pj_uint32_t hval, 
    116134                           void *value ); 
     135 
     136 
     137/** 
     138 * Associate/disassociate a value with the specified key. This function works 
     139 * like #pj_hash_set(), except that it doesn't use pool (hence the np -- no  
     140 * pool suffix). If new entry needs to be allocated, it will use the entry_buf. 
     141 * 
     142 * @param ht        the hash table. 
     143 * @param key       the key. 
     144 * @param keylen    the length of the key, or PJ_HASH_KEY_STRING to use the  
     145 *                  string length of the key. 
     146 * @param hval      if the value is not zero, then the hash table will use 
     147 *                  this value to search the entry's index, otherwise it will 
     148 *                  compute the key. This value can be obtained when calling 
     149 *                  #pj_hash_get(). 
     150 * @param entry_buf Pointer to buffer which will be used for the new entry, 
     151 *                  when one needs to be created. The buffer must be at least 
     152 *                  PJ_HASH_ENTRY_SIZE long, and the first PJ_HASH_ENTRY_SIZE 
     153 *                  bytes of the buffer will be used by the hash table. 
     154 *                  Application may use the remaining portion of the buffer 
     155 *                  for its own purpose. 
     156 * @param value     value to be associated, or NULL to delete the entry with 
     157 *                  the specified key. 
     158 */ 
     159PJ_DECL(void) pj_hash_set_np(pj_hash_table_t *ht, 
     160                             const void *key, unsigned keylen,  
     161                             pj_uint32_t hval, void *entry_buf, void *value); 
    117162 
    118163/** 
Note: See TracChangeset for help on using the changeset viewer.