Browse code

path: exported functions to kemi interface

Daniel-Constantin Mierla authored on 07/05/2017 06:22:57
Showing 3 changed files
... ...
@@ -151,7 +151,7 @@ out1:
151 151
 /*! \brief
152 152
  * Prepend own uri to Path header
153 153
  */
154
-int add_path(struct sip_msg* _msg, char* _a, char* _b)
154
+int ki_add_path(struct sip_msg* _msg)
155 155
 {
156 156
 	str user = {0,0};
157 157
 	int ret;
... ...
@@ -179,6 +179,11 @@ int add_path(struct sip_msg* _msg, char* _a, char* _b)
179 179
 	return ret;
180 180
 }
181 181
 
182
+int add_path(sip_msg_t* _msg, char* _a, char* _b)
183
+{
184
+	return ki_add_path(_msg);
185
+}
186
+
182 187
 /*! \brief
183 188
  * Prepend own uri to Path header and take care of given
184 189
  * user.
... ...
@@ -196,6 +201,25 @@ int add_path_usr(struct sip_msg* _msg, char* _usr, char* _parms)
196 201
 	return prepend_path(_msg, &user, PATH_PARAM_NONE, &parms);
197 202
 }
198 203
 
204
+/*! \brief
205
+ * Prepend own uri to Path header and take care of given
206
+ * user.
207
+ */
208
+int ki_add_path_user(sip_msg_t* _msg, str* _user)
209
+{
210
+	str parms = {0,0};
211
+	return prepend_path(_msg, _user, PATH_PARAM_NONE, &parms);
212
+}
213
+
214
+/*! \brief
215
+ * Prepend own uri to Path header and take care of given
216
+ * user.
217
+ */
218
+int ki_add_path_user_params(sip_msg_t* _msg, str* _user, str* _params)
219
+{
220
+	return prepend_path(_msg, _user, PATH_PARAM_NONE, _params);
221
+}
222
+
199 223
 /*! \brief
200 224
  * Prepend own uri to Path header and append received address as
201 225
  * "received"-param to that uri.
... ...
@@ -205,6 +229,15 @@ int add_path_received(struct sip_msg* _msg, char* _a, char* _b)
205 229
 	return prepend_path(_msg, NULL, PATH_PARAM_RECEIVED, NULL);
206 230
 }
207 231
 
232
+/*! \brief
233
+ * Prepend own uri to Path header and append received address as
234
+ * "received"-param to that uri.
235
+ */
236
+int ki_add_path_received(sip_msg_t* _msg)
237
+{
238
+	return prepend_path(_msg, NULL, PATH_PARAM_RECEIVED, NULL);
239
+}
240
+
208 241
 /*! \brief
209 242
  * Prepend own uri to Path header and append received address as
210 243
  * "received"-param to that uri and take care of given user.
... ...
@@ -222,6 +255,26 @@ int add_path_received_usr(struct sip_msg* _msg, char* _usr, char* _parms)
222 255
 	return prepend_path(_msg, &user, PATH_PARAM_RECEIVED, &parms);
223 256
 }
224 257
 
258
+/*! \brief
259
+ * Prepend own uri to Path header and append received address as
260
+ * "received"-param to that uri and take care of given user.
261
+ */
262
+int ki_add_path_received_user(sip_msg_t* _msg, str* _user)
263
+{
264
+	str parms = {0,0};
265
+	return prepend_path(_msg, _user, PATH_PARAM_RECEIVED, &parms);
266
+}
267
+
268
+/*! \brief
269
+ * Prepend own uri to Path header and append received address as
270
+ * "received"-param to that uri and take care of given user.
271
+ */
272
+int ki_add_path_received_user_params(sip_msg_t* _msg, str* _user, str* _params)
273
+{
274
+
275
+	return prepend_path(_msg, _user, PATH_PARAM_RECEIVED, _params);
276
+}
277
+
225 278
 /*! \brief
226 279
  * rr callback
227 280
  */
... ...
@@ -42,24 +42,34 @@
42 42
  */
43 43
 int add_path(struct sip_msg* _msg, char* _a, char* _b);
44 44
 
45
+int ki_add_path(struct sip_msg* _msg);
46
+
45 47
 /*
46 48
  * Prepend own uri to Path header and take care of given
47 49
  * user.
48 50
  */
49 51
 int add_path_usr(struct sip_msg* _msg, char* _a, char* _b);
50 52
 
53
+int ki_add_path_user(sip_msg_t* _msg, str* _user);
54
+int ki_add_path_user_params(sip_msg_t* _msg, str* _user, str* _params);
55
+
51 56
 /*
52 57
  * Prepend own uri to Path header and append received address as
53 58
  * "received"-param to that uri.
54 59
  */
55 60
 int add_path_received(struct sip_msg* _msg, char* _a, char* _b);
56 61
 
62
+int ki_add_path_received(struct sip_msg* _msg);
63
+
57 64
 /*
58 65
  * Prepend own uri to Path header and append received address as
59 66
  * "received"-param to that uri and take care of given user.
60 67
  */
61 68
 int add_path_received_usr(struct sip_msg* _msg, char* _a, char* _b);
62 69
 
70
+int ki_add_path_received_user(sip_msg_t* _msg, str* _user);
71
+int ki_add_path_received_user_params(sip_msg_t* _msg, str* _user, str* _params);
72
+
63 73
 /*
64 74
  * rr callback for setting dst-uri
65 75
  */
... ...
@@ -52,6 +52,7 @@
52 52
 #include "../../core/sr_module.h"
53 53
 #include "../../core/mem/mem.h"
54 54
 #include "../../core/mod_fix.h"
55
+#include "../../core/kemi.h"
55 56
 #include "../outbound/api.h"
56 57
 #include "../rr/api.h"
57 58
 
... ...
@@ -150,3 +151,51 @@ static int mod_init(void)
150 151
 	
151 152
 	return 0;
152 153
 }
154
+
155
+/**
156
+ *
157
+ */
158
+/* clang-format off */
159
+static sr_kemi_t sr_kemi_path_exports[] = {
160
+	{ str_init("path"), str_init("add_path"),
161
+		SR_KEMIP_INT, ki_add_path,
162
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
163
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
164
+	},
165
+	{ str_init("path"), str_init("add_path_user"),
166
+		SR_KEMIP_INT, ki_add_path_user,
167
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
168
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
169
+	},
170
+	{ str_init("path"), str_init("add_path_user_params"),
171
+		SR_KEMIP_INT, ki_add_path_user_params,
172
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
173
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
174
+	},
175
+	{ str_init("path"), str_init("add_path_received"),
176
+		SR_KEMIP_INT, ki_add_path_received,
177
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
178
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
179
+	},
180
+	{ str_init("path"), str_init("add_path_received_user"),
181
+		SR_KEMIP_INT, ki_add_path_received_user,
182
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
183
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
184
+	},
185
+	{ str_init("path"), str_init("add_path_received_user_params"),
186
+		SR_KEMIP_INT, ki_add_path_received_user_params,
187
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
188
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
189
+	},
190
+	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
191
+};
192
+/* clang-format on */
193
+
194
+/**
195
+ *
196
+ */
197
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
198
+{
199
+	sr_kemi_modules_add(sr_kemi_path_exports);
200
+	return 0;
201
+}
153 202
\ No newline at end of file