Browse Source

Kamailio compatiblity: function to set/get all branch flags

Jan Janak 16 years ago
parent
commit
5a68f95d10
2 changed files with 41 additions and 0 deletions
  1. 19 0
      dset.c
  2. 22 0
      dset.h

+ 19 - 0
dset.c

@@ -126,6 +126,25 @@ int resetbflag(unsigned int branch, flag_t flag)
 }
 }
 
 
 
 
+int getbflags(flag_t* res, unsigned int branch)
+{
+	flag_t* flags;
+	if (res == NULL) return -1;
+	if ((flags = get_bflags_ptr(branch)) == NULL) return -1;
+	*res = *flags;
+	return 1;
+}
+
+
+int setbflagsval(unsigned int branch, flag_t val)
+{
+	flag_t* flags;
+	if ((flags = get_bflags_ptr(branch)) == NULL) return -1;
+	*flags = val;
+	return 1;
+}
+
+
 /*
 /*
  * Initialize the branch iterator, the next
  * Initialize the branch iterator, the next
  * call to next_branch will return the first
  * call to next_branch will return the first

+ 22 - 0
dset.h

@@ -121,4 +121,26 @@ int resetbflag(unsigned int branch, flag_t flag);
  */
  */
 int isbflagset(unsigned int branch, flag_t flag);
 int isbflagset(unsigned int branch, flag_t flag);
 
 
+/**
+ * Get the value of all branch flags for a branch
+ *
+ * This function returns the value of all branch flags
+ * combined in a single variable.
+ * @param res A pointer to a variable to store the result
+ * @param branch Number of the branch (0 for the main Request-URI branch)
+ * @return 1 on success, -1 on failure
+ */
+int getbflags(flag_t* res, unsigned int branch);
+
+/**
+ * Set the value of all branch flags at once for a given branch.
+ *
+ * This function sets the value of all branch flags for a given
+ * branch at once.
+ * @param branch Number of the branch (0 for the main Request-URI branch)
+ * @param val All branch flags combined into a single variable
+ * @return 1 on success, -1 on failure
+ */
+int setbflagsval(unsigned int branch, flag_t val);
+
 #endif /* _DSET_H */
 #endif /* _DSET_H */