فهرست منبع

htable: renamed the new functions to match on name or value of items

Daniel-Constantin Mierla 6 سال پیش
والد
کامیت
9c595cb6b1
3فایلهای تغییر یافته به همراه22 افزوده شده و 22 حذف شده
  1. 1 1
      src/modules/htable/ht_api.c
  2. 1 1
      src/modules/htable/ht_api.h
  3. 20 20
      src/modules/htable/htable.c

+ 1 - 1
src/modules/htable/ht_api.c

@@ -1337,7 +1337,7 @@ int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op)
 	return 0;
 }
 
-int ht_has_cell_op_str(str *sre, ht_t *ht, int mode, int op)
+int ht_match_cell_op_str(str *sre, ht_t *ht, int mode, int op)
 {
 	ht_cell_t *it;
 	str sm;

+ 1 - 1
src/modules/htable/ht_api.h

@@ -122,7 +122,7 @@ int ht_reset_content(ht_t *ht);
 #define HT_RM_OP_SW	3
 #define HT_RM_OP_RE	4
 int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op);
-int ht_has_cell_op_str(str *sre, ht_t *ht, int mode, int op);
+int ht_match_cell_op_str(str *sre, ht_t *ht, int mode, int op);
 
 void ht_iterator_init(void);
 int ht_iterator_start(str *iname, str *hname);

+ 20 - 20
src/modules/htable/htable.c

@@ -72,8 +72,8 @@ static int ht_rm_name_re(struct sip_msg* msg, char* key, char* foo);
 static int ht_rm_value_re(struct sip_msg* msg, char* key, char* foo);
 static int w_ht_rm_name(struct sip_msg* msg, char* hname, char* op, char *val);
 static int w_ht_rm_value(struct sip_msg* msg, char* hname, char* op, char *val);
-static int w_ht_has_name(struct sip_msg* msg, char* hname, char* op, char *val);
-static int w_ht_has_str_value(struct sip_msg* msg, char* hname, char* op, char *val);
+static int w_ht_match_name(struct sip_msg* msg, char* hname, char* op, char *val);
+static int w_ht_match_str_value(struct sip_msg* msg, char* hname, char* op, char *val);
 static int w_ht_slot_lock(struct sip_msg* msg, char* key, char* foo);
 static int w_ht_slot_unlock(struct sip_msg* msg, char* key, char* foo);
 static int ht_reset(struct sip_msg* msg, char* htname, char* foo);
@@ -120,9 +120,9 @@ static cmd_export_t cmds[]={
 		ANY_ROUTE},
 	{"sht_rm_value", (cmd_function)w_ht_rm_value,  3, fixup_spve_all, 0,
 		ANY_ROUTE},
-	{"sht_has_name",  (cmd_function)w_ht_has_name,   3, fixup_spve_all, 0,
+	{"sht_match_name",  (cmd_function)w_ht_match_name,   3, fixup_spve_all, 0,
 		ANY_ROUTE},
-	{"sht_has_str_value", (cmd_function)w_ht_has_str_value,  3, fixup_spve_all, 0,
+	{"sht_match_str_value", (cmd_function)w_ht_match_str_value,  3, fixup_spve_all, 0,
 		ANY_ROUTE},
 	{"sht_lock",        (cmd_function)w_ht_slot_lock,    1, fixup_ht_key, 0,
 		ANY_ROUTE},
@@ -583,7 +583,7 @@ static int w_ht_rm(sip_msg_t* msg, char* htname, char* itname)
 	return ki_ht_rm(msg, &shtname, &sitname);
 }
 
-static int ht_has_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
+static int ht_match_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
 		int mkey)
 {
 	ht_t *ht;
@@ -609,7 +609,7 @@ static int ht_has_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
 				LM_WARN("unsupported match operator: %.*s\n", op->len, op->s);
 				return -1;
 			}
-			if(ht_has_cell_op_str(val, ht, mkey, vop)<0) {
+			if(ht_match_cell_op_str(val, ht, mkey, vop)<0) {
 				return -1;
 			}
 			return 1;
@@ -619,7 +619,7 @@ static int ht_has_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
 	}
 }
 
-static int w_ht_has_str_items(sip_msg_t* msg, char* hname, char* op, char *val,
+static int w_ht_match_str_items(sip_msg_t* msg, char* hname, char* op, char *val,
 		int mkey)
 {
 	str sname;
@@ -639,28 +639,28 @@ static int w_ht_has_str_items(sip_msg_t* msg, char* hname, char* op, char *val,
 		return -1;
 	}
 
-	return ht_has_str_items(msg, &sname, &sop, &sval, mkey);
+	return ht_match_str_items(msg, &sname, &sop, &sval, mkey);
 }
 
-static int w_ht_has_name(sip_msg_t* msg, char* hname, char* op, char *val)
+static int w_ht_match_name(sip_msg_t* msg, char* hname, char* op, char *val)
 {
-	return w_ht_has_str_items(msg, hname, op, val, 0);
+	return w_ht_match_str_items(msg, hname, op, val, 0);
 }
 
-static int w_ht_has_str_value(sip_msg_t* msg, char* hname, char* op, char *val)
+static int w_ht_match_str_value(sip_msg_t* msg, char* hname, char* op, char *val)
 {
-	return w_ht_has_str_items(msg, hname, op, val, 1);
+	return w_ht_match_str_items(msg, hname, op, val, 1);
 }
 
-static int ki_ht_has_name(sip_msg_t* msg, str* sname, str* sop, str *sval)
+static int ki_ht_match_name(sip_msg_t* msg, str* sname, str* sop, str *sval)
 {
-	return ht_has_str_items(msg, sname, sop, sval, 0);
+	return ht_match_str_items(msg, sname, sop, sval, 0);
 
 }
 
-static int ki_ht_has_str_value(sip_msg_t* msg, str* sname, str* sop, str *sval)
+static int ki_ht_match_str_value(sip_msg_t* msg, str* sname, str* sop, str *sval)
 {
-	return ht_has_str_items(msg, sname, sop, sval, 1);
+	return ht_match_str_items(msg, sname, sop, sval, 1);
 }
 
 static int ht_reset_by_name(str *hname)
@@ -1761,13 +1761,13 @@ static sr_kemi_t sr_kemi_htable_exports[] = {
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
-	{ str_init("htable"), str_init("sht_has_name"),
-		SR_KEMIP_INT, ki_ht_has_name,
+	{ str_init("htable"), str_init("sht_match_name"),
+		SR_KEMIP_INT, ki_ht_match_name,
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
-	{ str_init("htable"), str_init("sht_has_str_value"),
-		SR_KEMIP_INT, ki_ht_has_str_value,
+	{ str_init("htable"), str_init("sht_match_str_value"),
+		SR_KEMIP_INT, ki_ht_match_str_value,
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},