summaryrefslogtreecommitdiff
path: root/pjlib/include
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2012-07-18 07:52:33 +0000
committerLiong Sauw Ming <ming@teluu.com>2012-07-18 07:52:33 +0000
commitc1eabb7ee738b17cf6fd66e761a9269cb7582434 (patch)
treed23bc2d4b3616f8ff55fb193b4a44d452e34e152 /pjlib/include
parentbf66ba19d4ad1a3ccfd3e8a5e68c62b82a56a037 (diff)
Fixed #1556: Fix From/To tag and Via branch comparison to be case insensitive
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4208 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include')
-rw-r--r--pjlib/include/pj/guid.h19
-rw-r--r--pjlib/include/pj/hash.h38
2 files changed, 55 insertions, 2 deletions
diff --git a/pjlib/include/pj/guid.h b/pjlib/include/pj/guid.h
index 96a5849e..7b24dd51 100644
--- a/pjlib/include/pj/guid.h
+++ b/pjlib/include/pj/guid.h
@@ -83,6 +83,17 @@ PJ_DECL(unsigned) pj_GUID_STRING_LENGTH(void);
PJ_DECL(pj_str_t*) pj_generate_unique_string(pj_str_t *str);
/**
+ * Create a globally unique string in lowercase, which length is
+ * PJ_GUID_STRING_LENGTH characters. Caller is responsible for preallocating
+ * the storage used in the string.
+ *
+ * @param str The string to store the result.
+ *
+ * @return The string.
+ */
+PJ_DECL(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str);
+
+/**
* Generate a unique string.
*
* @param pool Pool to allocate memory from.
@@ -90,6 +101,14 @@ PJ_DECL(pj_str_t*) pj_generate_unique_string(pj_str_t *str);
*/
PJ_DECL(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str);
+/**
+ * Generate a unique string in lowercase.
+ *
+ * @param pool Pool to allocate memory from.
+ * @param str The string.
+ */
+PJ_DECL(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str);
+
/**
* @}
diff --git a/pjlib/include/pj/hash.h b/pjlib/include/pj/hash.h
index 7b9f6df3..35c34137 100644
--- a/pjlib/include/pj/hash.h
+++ b/pjlib/include/pj/hash.h
@@ -75,8 +75,8 @@ PJ_DECL(pj_uint32_t) pj_hash_calc(pj_uint32_t hval,
* string is stored in \c result.
*
* @param hval The initial hash value, normally zero.
- * @param result Buffer to store the result, which must be enough to hold
- * the string.
+ * @param result Optional. Buffer to store the result, which must be enough
+ * to hold the string.
* @param key The input key to be converted and calculated.
*
* @return The hash value.
@@ -116,6 +116,17 @@ PJ_DECL(void *) pj_hash_get( pj_hash_table_t *ht,
/**
+ * Variant of #pj_hash_get() with the key being converted to lowercase when
+ * calculating the hash value.
+ *
+ * @see pj_hash_get()
+ */
+PJ_DECL(void *) pj_hash_get_lower( pj_hash_table_t *ht,
+ const void *key, unsigned keylen,
+ pj_uint32_t *hval );
+
+
+/**
* Associate/disassociate a value with the specified key. If value is not
* NULL and entry already exists, the entry's value will be overwritten.
* If value is not NULL and entry does not exist, a new one will be created
@@ -142,6 +153,17 @@ PJ_DECL(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht,
/**
+ * Variant of #pj_hash_set() with the key being converted to lowercase when
+ * calculating the hash value.
+ *
+ * @see pj_hash_set()
+ */
+PJ_DECL(void) pj_hash_set_lower( pj_pool_t *pool, pj_hash_table_t *ht,
+ const void *key, unsigned keylen,
+ pj_uint32_t hval, void *value );
+
+
+/**
* Associate/disassociate a value with the specified key. This function works
* like #pj_hash_set(), except that it doesn't use pool (hence the np -- no
* pool suffix). If new entry needs to be allocated, it will use the entry_buf.
@@ -165,6 +187,18 @@ PJ_DECL(void) pj_hash_set_np(pj_hash_table_t *ht,
void *value);
/**
+ * Variant of #pj_hash_set_np() with the key being converted to lowercase
+ * when calculating the hash value.
+ *
+ * @see pj_hash_set_np()
+ */
+PJ_DECL(void) pj_hash_set_np_lower(pj_hash_table_t *ht,
+ const void *key, unsigned keylen,
+ pj_uint32_t hval,
+ pj_hash_entry_buf entry_buf,
+ void *value);
+
+/**
* Get the total number of entries in the hash table.
*
* @param ht the hash table.