[NEW] USRLOC internal API extended

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[NEW] USRLOC internal API extended

Bogdan-Andrei Iancu
Hi,

Following some discussion with John Khvatov on the devel list (see
http://lists.opensips.org/pipermail/devel/2009-April/003018.html), the
internal API provided by USRLOC was extended with  new functions for
providing a controlled way of accessing (from other modules) the usrloc
data structures.

The algorithm is:

1) use get_next_udomain(udomain *) for iterating through all the
domains; if the param is NULL, it will return the first udomain;
otherwise the next following udomain.

2) for each udomain, use udomain->size to see the hash table size...and
for each hash entry do:
    a) lock_ulslot(udomain, slot)
    b) get_next_urecord(udomain, entry_id, urecord*) - iterates through
the all urecords from the hash entry
    c) unlock_ulslot(udomain, slot)


The new functions are:

- lock_ulslot / unlock_ulsloti(udomain*, slot) - to lock a specific slot
of the domain hash table

- get_next_udomain (udomain*) - returns the first udomain in input
paramis NULL or the next udomain

- get_next_urecord (udomain*, slot, urecord*) - returns the next urecord
(after given input urecord, or first urecord if input is NULL) from the
udomain hash table slot.


Regards,
Bogdan

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel