pjlib - How do I enum all keys in a pjsip hashtable?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, peteryzwei. I got it. I just wanna make sure whether there is some APIs I missed which can get the keys of pj hashtable. Actually, I don't wanna change the source codes of pjsip cause this brings additional code "merge" works while upgrading.
Anyway, thanks a lot.

--
Best Regards
Super



At 2011-05-24 20:34:55?peteryzwei <peteryzwei at yahoo.com> wrote:

Super,
  since pj_hash_entry is defined in hash.c, the key is opaque to the caller. To get around this, I suggest adding the following function to hash.c and updating hash.h.

//hash.c
//get the key from the iterator. keyBuf MUST be big enough to hold the key.
pj_uint32 getKey(pj_hash_iterator_t *iterator, char *keyBuf) {
  memcpy(keyBuf, iterator->entry->key, iterator->entry->keylen);
  return iterator->entry->keylen;
}

//hash.h
pj_uint32 getKey(pj_hash_iterator_t *iterator, char *keyBuf);

--- OnMon, 5/23/11, ??<super119 at vip.126.com> wrote:

From: ?? <super119@xxxxxxxxxxx>
Subject: Re: pjlib - How do I enum all keys in a pjsip hashtable?
To: "pjsip list" <pjsip at lists.pjsip.org>
Date: Monday, May 23, 2011, 9:27 PM


Thanks, peteryzwei. But pj_hash_first/pj_hash_next/pj_hash_this can only enum values in the hashtable. I wanna checkout all keys. Any other suggestions?

--
Best Regards
Super



At 2011-05-24 05:28:31?peteryzwei <peteryzwei at yahoo.com> wrote:

Use pj_hash_first() to get an iterator then use pj_hash_next() with iterator as input.


--- OnMon, 5/23/11, ??<super119 at vip.126.com> wrote:

From: ?? <super119@xxxxxxxxxxx>
Subject: pjlib - How do I enum all keys in a pjsip hashtable?
To:pjsip at lists.pjsip.org
Date: Monday, May 23, 2011, 6:12 AM


Hi, all:
    How can I enum all keys in a pjsip hashtable? I didn't find such functions in pjlib hashtable's manual. And I tried to get keys directly from pj_hash_entry, but the "keys" member is not open to the outside. So, how can I do this?
     Thanks a lot.


--
Best Regards
Super




-----Inline Attachment Follows-----


_______________________________________________
Visit our blog:http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org





-----Inline Attachment Follows-----


_______________________________________________
Visit our blog:http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20110525/4ea2b1cf/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux