- new api call including a content-type argument implemented as new
function - required to resolve geolocation url using POST (#2641)
- Note: not sure if this is the most elegant solution, but it helps
to avoid backward compatibility issues
... | ... |
@@ -37,6 +37,8 @@ typedef int (*httpcapi_httpconnect_f)(struct sip_msg *msg, |
37 | 37 |
const char *contenttype, const str *_post); |
38 | 38 |
typedef int (*httpcapi_httpquery_f)( |
39 | 39 |
struct sip_msg *_m, char *_url, str *_dst, char *_post, char *_hdrs); |
40 |
+typedef int (*httpcapi_httpquery_c_f)( |
|
41 |
+ struct sip_msg *_m, char *_url, str *_dst, char *_post, char *_ctype, char *_hdrs); |
|
40 | 42 |
typedef int (*httpcapi_curlcon_exists_f)(str *_name); |
41 | 43 |
typedef char *(*httpcapi_res_content_type_f)(const str *_name); |
42 | 44 |
|
... | ... |
@@ -45,6 +47,7 @@ typedef struct httpc_api |
45 | 47 |
{ |
46 | 48 |
httpcapi_httpconnect_f http_connect; |
47 | 49 |
httpcapi_httpquery_f http_client_query; |
50 |
+ httpcapi_httpquery_c_f http_client_query_c; |
|
48 | 51 |
httpcapi_curlcon_exists_f http_connection_exists; |
49 | 52 |
httpcapi_res_content_type_f http_get_content_type; |
50 | 53 |
} httpc_api_t; |
... | ... |
@@ -32,19 +32,21 @@ |
32 | 32 |
#include "functions.h" |
33 | 33 |
#include "curlcon.h" |
34 | 34 |
|
35 |
-typedef int (*httpcapi_httpconnect_f)(struct sip_msg *msg, const str *connection, |
|
36 |
- const str* _url, str* _result, const char *contenttype, const str* _post); |
|
37 |
-typedef int (*httpcapi_httpquery_f)(struct sip_msg* _m, char* _url, str* _dst, |
|
38 |
- char* _post, char* _hdrs); |
|
39 |
-typedef int (*httpcapi_curlcon_exists_f)(str* _name); |
|
40 |
-typedef char * (*httpcapi_res_content_type_f)(const str* _name); |
|
35 |
+typedef int (*httpcapi_httpconnect_f)(struct sip_msg *msg, |
|
36 |
+ const str *connection, const str *_url, str *_result, |
|
37 |
+ const char *contenttype, const str *_post); |
|
38 |
+typedef int (*httpcapi_httpquery_f)( |
|
39 |
+ struct sip_msg *_m, char *_url, str *_dst, char *_post, char *_hdrs); |
|
40 |
+typedef int (*httpcapi_curlcon_exists_f)(str *_name); |
|
41 |
+typedef char *(*httpcapi_res_content_type_f)(const str *_name); |
|
41 | 42 |
|
42 | 43 |
|
43 |
-typedef struct httpc_api { |
|
44 |
- httpcapi_httpconnect_f http_connect; |
|
45 |
- httpcapi_httpquery_f http_client_query; |
|
46 |
- httpcapi_curlcon_exists_f http_connection_exists; |
|
47 |
- httpcapi_res_content_type_f http_get_content_type; |
|
44 |
+typedef struct httpc_api |
|
45 |
+{ |
|
46 |
+ httpcapi_httpconnect_f http_connect; |
|
47 |
+ httpcapi_httpquery_f http_client_query; |
|
48 |
+ httpcapi_curlcon_exists_f http_connection_exists; |
|
49 |
+ httpcapi_res_content_type_f http_get_content_type; |
|
48 | 50 |
} httpc_api_t; |
49 | 51 |
|
50 | 52 |
typedef int (*bind_httpc_api_f)(httpc_api_t *api); |
... | ... |
@@ -62,8 +64,7 @@ static inline int httpc_load_api(httpc_api_t *api) |
62 | 64 |
LM_ERR("cannot find bind_http_client\n"); |
63 | 65 |
return -1; |
64 | 66 |
} |
65 |
- if (bindhttpc(api) < 0) |
|
66 |
- { |
|
67 |
+ if(bindhttpc(api) < 0) { |
|
67 | 68 |
LM_ERR("cannot bind http_client api\n"); |
68 | 69 |
return -1; |
69 | 70 |
} |
- lost from removed http_query() in utils
... | ... |
@@ -32,15 +32,17 @@ |
32 | 32 |
#include "functions.h" |
33 | 33 |
#include "curlcon.h" |
34 | 34 |
|
35 |
-typedef int (*httpcapi_httpconnect_f)(struct sip_msg *msg, const str *connection, const str* _url, str* _result, const char *contenttype, const str* _post); |
|
36 |
-typedef int (*httpcapi_httpquery_f)(struct sip_msg* _m, char* _url, str* _dst, char* _post); |
|
35 |
+typedef int (*httpcapi_httpconnect_f)(struct sip_msg *msg, const str *connection, |
|
36 |
+ const str* _url, str* _result, const char *contenttype, const str* _post); |
|
37 |
+typedef int (*httpcapi_httpquery_f)(struct sip_msg* _m, char* _url, str* _dst, |
|
38 |
+ char* _post, char* _hdrs); |
|
37 | 39 |
typedef int (*httpcapi_curlcon_exists_f)(str* _name); |
38 | 40 |
typedef char * (*httpcapi_res_content_type_f)(const str* _name); |
39 | 41 |
|
40 | 42 |
|
41 | 43 |
typedef struct httpc_api { |
42 | 44 |
httpcapi_httpconnect_f http_connect; |
43 |
- httpcapi_httpquery_f http_query; |
|
45 |
+ httpcapi_httpquery_f http_client_query; |
|
44 | 46 |
httpcapi_curlcon_exists_f http_connection_exists; |
45 | 47 |
httpcapi_res_content_type_f http_get_content_type; |
46 | 48 |
} httpc_api_t; |
- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,71 @@ |
1 |
+/* |
|
2 |
+ * Copyright (C) 2015 Hugh Waite |
|
3 |
+ * |
|
4 |
+ * This file is part of Kamailio, a free SIP server. |
|
5 |
+ * |
|
6 |
+ * Kamailio is free software; you can redistribute it and/or modify |
|
7 |
+ * it under the terms of the GNU General Public License as published by |
|
8 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
9 |
+ * (at your option) any later version |
|
10 |
+ * |
|
11 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
+ * GNU General Public License for more details. |
|
15 |
+ * |
|
16 |
+ * You should have received a copy of the GNU General Public License |
|
17 |
+ * along with this program; if not, write to the Free Software |
|
18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 |
+ * |
|
20 |
+ */ |
|
21 |
+ |
|
22 |
+/*! |
|
23 |
+ * \file |
|
24 |
+ * \brief Kamailio http_client :: Core API include file |
|
25 |
+ * \ingroup http_client |
|
26 |
+ * Module: \ref http_client |
|
27 |
+ */ |
|
28 |
+#ifndef _CURL_API_H_ |
|
29 |
+#define _CURL_API_H_ |
|
30 |
+ |
|
31 |
+#include "../../sr_module.h" |
|
32 |
+#include "functions.h" |
|
33 |
+#include "curlcon.h" |
|
34 |
+ |
|
35 |
+typedef int (*httpcapi_httpconnect_f)(struct sip_msg *msg, const str *connection, const str* _url, str* _result, const char *contenttype, const str* _post); |
|
36 |
+typedef int (*httpcapi_httpquery_f)(struct sip_msg* _m, char* _url, str* _dst, char* _post); |
|
37 |
+typedef int (*httpcapi_curlcon_exists_f)(str* _name); |
|
38 |
+typedef char * (*httpcapi_res_content_type_f)(const str* _name); |
|
39 |
+ |
|
40 |
+ |
|
41 |
+typedef struct httpc_api { |
|
42 |
+ httpcapi_httpconnect_f http_connect; |
|
43 |
+ httpcapi_httpquery_f http_query; |
|
44 |
+ httpcapi_curlcon_exists_f http_connection_exists; |
|
45 |
+ httpcapi_res_content_type_f http_get_content_type; |
|
46 |
+} httpc_api_t; |
|
47 |
+ |
|
48 |
+typedef int (*bind_httpc_api_f)(httpc_api_t *api); |
|
49 |
+int bind_httpc_api(httpc_api_t *api); |
|
50 |
+ |
|
51 |
+/** |
|
52 |
+ * @brief Load the http_client API |
|
53 |
+ */ |
|
54 |
+static inline int httpc_load_api(httpc_api_t *api) |
|
55 |
+{ |
|
56 |
+ bind_httpc_api_f bindhttpc; |
|
57 |
+ |
|
58 |
+ bindhttpc = (bind_httpc_api_f)find_export("bind_http_client", 0, 0); |
|
59 |
+ if(bindhttpc == 0) { |
|
60 |
+ LM_ERR("cannot find bind_http_client\n"); |
|
61 |
+ return -1; |
|
62 |
+ } |
|
63 |
+ if (bindhttpc(api) < 0) |
|
64 |
+ { |
|
65 |
+ LM_ERR("cannot bind http_client api\n"); |
|
66 |
+ return -1; |
|
67 |
+ } |
|
68 |
+ return 0; |
|
69 |
+} |
|
70 |
+ |
|
71 |
+#endif |