Licensing Information

Open Source Used In Cisco FXOS 1.1(4) 963
{
tdb_off offset, rec_ptr;
/* find the top of the hash chain */
offset = tdb_hash_top(tdb, hash);
/* read in the hash top */
if (ofs_read(tdb, offset, &rec_ptr) == -1)
return 0;
/* keep looking until we find the right record */
while (rec_ptr) {
if (rec_read(tdb, rec_ptr, rec) == -1)
return 0;
if (hash == rec->full_hash && key.dsize == rec->key_len) {
char *k;
/* a very likely hit - read the key */
k = tdb_alloc_read(tdb, rec_ptr + sizeof(*rec),
 rec->key_len);
if (!k)
return 0;
if (memcmp(key.dptr, k, key.dsize) == 0) {
free(k);
return rec_ptr;
}
free(k);
}
/* move to the next record */
rec_ptr = rec->next;
}
return 0;
}
/*
return an error string for the last tdb error
*/
char *tdb_error(TDB_CONTEXT *tdb)
{
int i;
static struct {
enum TDB_ERROR ecode;
char *estring;
} emap[] = {
{TDB_SUCCESS, "Success"},