RTS API Documentation  1.10.11
xswitch.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2020-2023, Seven Du <dujinfang@gmail.com>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Seven Du <dujinfang@gmail.com>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Seven Du <dujinfang@gmail.com>
27  *
28  * xswitch.h -- xswitch functions header
29  *
30  */
31 
32 #ifndef FREESWITCH_XSWITCH_H
33 #define FREESWITCH_XSWITCH_H
34 
35 #include <switch.h>
36 #include <switch_curl.h>
37 
39 
40 #define XSWITCH_CM_GET 0
41 #define XSWITCH_CM_POST 1
42 
43 typedef struct http_data_s {
46  char *content_type;
47  int err;
48  long code;
52 } http_data_t;
53 
54 SWITCH_DECLARE(http_data_t *) xswitch_http_post(const char *url, const char *data, switch_memory_pool_t *pool);
56 SWITCH_DECLARE(http_data_t *) xswitch_http_request(int method, const char *url, const void *data, size_t datalen, switch_curl_slist_t *headers,
57  switch_memory_pool_t *pool, int curl_connect_timeout, int curl_timeout);
58 
60 #endif
61 /* For Emacs:
62  * Local Variables:
63  * mode:c
64  * indent-tabs-mode:t
65  * tab-width:4
66  * c-basic-offset:4
67  * End:
68  * For VIM:
69  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
70  */
http_data_t * xswitch_http_post(const char *url, const char *data, switch_memory_pool_t *pool)
Definition: xswitch.c:66
switch_curl_slist_t * headers
Definition: xswitch.h:50
#define SWITCH_END_EXTERN_C
Definition: switch.h:43
switch_CURLcode perform_code
Definition: xswitch.h:51
switch_size_t body_size
Definition: xswitch.h:49
long code
Definition: xswitch.h:48
http_data_t * xswitch_http_get(const char *url, switch_memory_pool_t *pool)
Definition: xswitch.c:71
switch_buffer_t * body_buffer
Definition: xswitch.h:44
http_data_t * xswitch_http_request(int method, const char *url, const void *data, size_t datalen, switch_curl_slist_t *headers, switch_memory_pool_t *pool, int curl_connect_timeout, int curl_timeout)
Definition: xswitch.c:77
int err
Definition: xswitch.h:47
struct http_data_s http_data_t
int switch_CURLcode
Definition: switch_curl.h:40
uintptr_t switch_size_t
struct curl_slist switch_curl_slist_t
Definition: switch_curl.h:38
char * content_type
Definition: xswitch.h:46
Main Library Header.
#define SWITCH_DECLARE(type)
struct fspr_pool_t switch_memory_pool_t
switch_memory_pool_t * pool
Definition: xswitch.h:45
#define SWITCH_BEGIN_EXTERN_C
Definition: switch.h:42