Kannel: Open Source WAP and SMS gateway  svn-r5335
smsc_http.c
Go to the documentation of this file.
1 /* ====================================================================
2  * The Kannel Software License, Version 1.0
3  *
4  * Copyright (c) 2001-2018 Kannel Group
5  * Copyright (c) 1998-2001 WapIT Ltd.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Kannel Group (http://www.kannel.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Kannel" and "Kannel Group" must not be used to
28  * endorse or promote products derived from this software without
29  * prior written permission. For written permission, please
30  * contact org@kannel.org.
31  *
32  * 5. Products derived from this software may not be called "Kannel",
33  * nor may "Kannel" appear in their name, without prior written
34  * permission of the Kannel Group.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS
40  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
41  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Kannel Group. For more information on
51  * the Kannel Group, please see <http://www.kannel.org/>.
52  *
53  * Portions of this software are based upon software originally written at
54  * WapIT Ltd., Helsinki, Finland for the Kannel project.
55  */
56 
57 /*
58  * smsc_http.c - interface to various HTTP based content/SMS gateways
59  *
60  * HTTP based "SMSC Connection" is meant for gateway connections,
61  * and has following features:
62  *
63  * o Kannel listens to certain (HTTP server) port for MO SMS messages.
64  * The exact format of these HTTP calls are defined by type of HTTP based
65  * connection. Kannel replies to these messages as ACK, but does not
66  * support immediate reply. Thus, if Kannel is linked to another Kannel,
67  * only 'max-messages = 0' services are practically supported - any
68  * replies must be done with SMS PUSH (sendsms)
69  *
70  * o For MT messages, Kannel does HTTP GET or POST to given address, in format
71  * defined by type of HTTP based protocol
72  *
73  * The 'type' of requests and replies are defined by 'system-type' variable.
74  * The only type of HTTP requests currently supported are basic Kannel.
75  * If new support is added, smsc_http_create is modified accordingly and new
76  * functions added.
77  *
78  *
79  * KANNEL->KANNEL linking: (UDH not supported in MO messages)
80  *
81  *****
82  * FOR CLIENT/END-POINT KANNEL:
83  *
84  * group = smsc
85  * smsc = http
86  * system-type = kannel
87  * port = NNN
88  * smsc-username = XXX
89  * smsc-password = YYY
90  * send-url = "server.host:PORT"
91  *
92  *****
93  * FOR SERVER/RELAY KANNEL:
94  *
95  * group = smsbox
96  * sendsms-port = PORT
97  * ...
98  *
99  * group = sms-service
100  * keyword = ...
101  * url = "client.host:NNN/sms?user=XXX&pass=YYY&from=%p&to=%P&text=%a"
102  * max-messages = 0
103  *
104  * group = send-sms
105  * username = XXX
106  * password = YYY
107  *
108  * Kalle Marjola for Project Kannel 2001
109  * Stipe Tolj <st@tolj.org>
110  * Alexander Malysh <amalysh at kannel.org>
111  * Tobias Weber <weber@wapme.de>
112  */
113 
114 #include <sys/types.h>
115 #include <sys/socket.h>
116 #include <unistd.h>
117 #include <errno.h>
118 #include <time.h>
119 #include <limits.h>
120 
121 #include "gwlib/gwlib.h"
122 #include "smscconn.h"
123 #include "smscconn_p.h"
124 #include "bb_smscconn_cb.h"
125 #include "msg.h"
126 #include "sms.h"
127 #include "dlr.h"
128 #include "urltrans.h"
129 #include "meta_data.h"
130 
131 #include "smsc_http_p.h"
132 
133 #define DEFAULT_CHARSET "UTF-8"
134 #define DEFAULT_UCS2_CHARSET "UTF-16BE"
135 
137 {
138  if (conndata == NULL)
139  return;
140  if (conndata->http_ref)
153 
154  gw_free(conndata);
155 }
156 
157 
158 /*
159  * Thread to listen to HTTP requests from SMSC entity
160  */
161 static void httpsmsc_receiver(void *arg)
162 {
163  SMSCConn *conn = arg;
164  ConnData *conndata = conn->data;
166  Octstr *ip, *url, *body;
167  List *headers, *cgivars;
168 
169  /* Make sure we log into our own log-file if defined */
170  log_thread_to(conn->log_idx);
171 
172  while (conndata->shutdown == 0) {
173  /* reset */
174  ip = url = body = NULL;
175  headers = cgivars = NULL;
176 
177  /* XXX if conn->is_stopped, do not receive new messages.. */
178 
180  &headers, &body, &cgivars);
181  if (client == NULL)
182  break;
183 
184  if (cgivars != NULL) {
185  octstr_append_char(url, '?');
186  http_cgivar_dump_into(cgivars, url);
187  }
188 
189  debug("smsc.http", 0, "HTTP[%s]: Got request `%s'",
191 
192  if (connect_denied(conndata->allow_ip, ip)) {
193  info(0, "HTTP[%s]: Connection `%s' tried from denied "
194  "host %s, ignored", octstr_get_cstr(conn->id),
197  } else
198  conndata->callbacks->receive_sms(conn, client, headers, body, cgivars);
199 
200  debug("smsc.http", 0, "HTTP[%s]: Destroying client information",
201  octstr_get_cstr(conn->id));
203  octstr_destroy(ip);
204  octstr_destroy(body);
205  http_destroy_headers(headers);
206  http_destroy_cgiargs(cgivars);
207  }
208  debug("smsc.http", 0, "HTTP[%s]: httpsmsc_receiver dying",
209  octstr_get_cstr(conn->id));
210 
211  conndata->shutdown = 1;
213 
214  /* unblock http_receive_result() if there are no open sends */
215  if (counter_value(conndata->open_sends) == 0)
217 
218  if (conndata->sender_thread != -1) {
221  }
222  if (conndata->send_cb_thread != -1) {
225  }
226 
227  mutex_lock(conn->flow_mutex);
228  conn->status = SMSCCONN_DEAD;
229  mutex_unlock(conn->flow_mutex);
230 
231  if (conndata->callbacks != NULL && conndata->callbacks->destroy != NULL)
232  conndata->callbacks->destroy(conn);
233  conn->data = NULL;
236 }
237 
238 
239 /*
240  * Thread to send queued messages
241  */
242 static void httpsmsc_sender(void *arg)
243 {
244  SMSCConn *conn = arg;
245  ConnData *conndata = conn->data;
246  Msg *msg;
247  double delay = 0;
248 
249  /* Make sure we log into our own log-file if defined */
250  log_thread_to(conn->log_idx);
251 
252  if (conn->throughput) {
253  delay = 1.0 / conn->throughput;
254  }
255 
256  while (conndata->shutdown == 0) {
257  /* check if we can send ; otherwise block on semaphore */
260 
261  if (conndata->shutdown) {
264  break;
265  }
266 
268  if (msg == NULL)
269  break;
270 
271  /* obey throughput speed limit, if any */
272  if (conn->throughput > 0) {
274  }
276  if (conndata->callbacks->send_sms(conn, msg) == -1) {
280  }
281  }
282 
283  /* put outstanding sends back into global queue */
286 
287  /* if there no receiver shutdown */
288  if (conndata->port <= 0) {
289  /* unblock http_receive_result() if there are no open sends */
290  if (counter_value(conndata->open_sends) == 0)
292 
293  if (conndata->send_cb_thread != -1) {
296  }
297  mutex_lock(conn->flow_mutex);
298  conn->status = SMSCCONN_DEAD;
299  mutex_unlock(conn->flow_mutex);
300 
301  if (conndata->callbacks != NULL && conndata->callbacks->destroy != NULL)
302  conndata->callbacks->destroy(conn);
303  conn->data = NULL;
306  }
307 }
308 
309 /*
310  * Thread to handle finished sendings
311  */
312 static void httpsmsc_send_cb(void *arg)
313 {
314  SMSCConn *conn = arg;
315  ConnData *conndata = conn->data;
316  Msg *msg;
317  int status;
318  List *headers;
319  Octstr *final_url, *body;
320 
321  /* Make sure we log into our own log-file if defined */
322  log_thread_to(conn->log_idx);
323 
325 
327  &final_url, &headers, &body);
328 
329  if (msg == NULL)
330  break; /* they told us to die, by unlocking */
331 
335 
336  /* Handle various states here. */
337 
338  /* request failed and we are not in shutdown mode */
339  if (status == -1 && conndata->shutdown == 0) {
340  error(0, "HTTP[%s]: Couldn't connect to SMS center."
341  "(retrying in %ld seconds) %ld.",
343  mutex_lock(conn->flow_mutex);
345  mutex_unlock(conn->flow_mutex);
346  /* XXX how should we know whether it's temp. error ?? */
348  /*
349  * Just sleep reconnect delay and set conn to ACTIVE again;
350  * otherwise if no pending request are here, we leave conn in
351  * RECONNECTING state for ever and no routing (trials) take place.
352  */
353  if (counter_value(conndata->open_sends) == 0) {
355  /* and now enable routing again */
356  mutex_lock(conn->flow_mutex);
357  conn->status = SMSCCONN_ACTIVE;
358  time(&conn->connect_time);
359  mutex_unlock(conn->flow_mutex);
360  /* tell bearerbox core that we are connected again */
361  bb_smscconn_connected(conn);
362  }
363  continue;
364  }
365  /* request failed and we *are* in shutdown mode, drop the message */
366  else if (status == -1 && conndata->shutdown == 1) {
368  }
369  /* request succeeded */
370  else {
371  /* we received a response, so this link is considered online again */
372  if (conn->status != SMSCCONN_ACTIVE) {
373  mutex_lock(conn->flow_mutex);
374  conn->status = SMSCCONN_ACTIVE;
375  time(&conn->connect_time);
376  mutex_unlock(conn->flow_mutex);
377  /* tell bearerbox core that we are connected again */
378  bb_smscconn_connected(conn);
379  }
380  conndata->callbacks->parse_reply(conn, msg, status, headers, body);
381  }
382 
383  http_destroy_headers(headers);
384  octstr_destroy(final_url);
385  octstr_destroy(body);
386  }
387  debug("smsc.http", 0, "HTTP[%s]: httpsmsc_send_cb dying",
388  octstr_get_cstr(conn->id));
389  conndata->shutdown = 1;
390 
392  warning(0, "HTTP[%s]: Shutdown while <%ld> requests are pending.",
394  }
395 }
396 
397 
398 /*-----------------------------------------------------------------
399  * functions to implement various smscconn operations
400  */
401 
402 static int httpsmsc_send(SMSCConn *conn, Msg *msg)
403 {
404  ConnData *conndata = conn->data;
405  Msg *sms;
406 
407 
408  /* don't crash if no send_sms handle defined */
409  if (!conndata || !conndata->callbacks->send_sms)
410  return -1;
411 
412  sms = msg_duplicate(msg);
413  /* convert character encoding if required */
414  if (conndata->alt_charset) {
415  /*
416  * Converted now to the target character set based on the
417  * one we got in the msg, which is either UTF-8 (our normal
418  * inter-box encoding), but may also be UCS-2, so beware.
419  * In addition, IF we convert to an "extra" encoding here
420  * we also revert the .coding vaue to DC_UNDEF, in order
421  * that all API specific code doesn't indicate an encoding
422  * which is no longer inside the payload here.
423  */
424  if (sms->sms.coding == DC_7BIT) {
425  if (charset_convert(sms->sms.msgdata, DEFAULT_CHARSET,
427  sms->sms.coding = DC_UNDEF;
428  } else {
429  error(0, "Failed to convert msgdata from charset <%s> to <%s>, will send as is.",
431  }
432  }
433  else if (sms->sms.coding == DC_UCS2) {
434  if (charset_convert(sms->sms.msgdata, DEFAULT_UCS2_CHARSET,
436  sms->sms.coding = DC_UNDEF;
437  } else {
438  error(0, "Failed to convert msgdata from charset <%s> to <%s>, will send as is.",
440  }
441  }
442  }
443 
445 
446  return 0;
447 }
448 
449 
450 static long httpsmsc_queued(SMSCConn *conn)
451 {
452  ConnData *conndata = conn->data;
453 
454  conn->load = (conndata ? (conn->status != SMSCCONN_DEAD ?
455  gwlist_len(conndata->msg_to_send) : 0) : 0);
456 
457  return conn->load;
458 }
459 
460 
461 static int httpsmsc_shutdown(SMSCConn *conn, int finish_sending)
462 {
463  ConnData *conndata = conn->data;
464 
465  if (conndata == NULL)
466  return 0;
467 
468  debug("httpsmsc_shutdown", 0, "HTTP[%s]: Shutting down",
469  octstr_get_cstr(conn->id));
470 
471  mutex_lock(conn->flow_mutex);
473 
474  conndata->shutdown = 1;
475 
476  if (conndata->port > 0)
479  if (conndata->receive_thread != -1)
481  if (conndata->sender_thread != -1)
483  mutex_unlock(conn->flow_mutex);
484 
485  return 0;
486 }
487 
488 
490 {
491  ConnData *conndata = NULL;
492  Octstr *type = NULL, *callbackname = NULL;
493  int ssl = 0; /* indicate if SSL-enabled server should be used */
494  long max_ps;
495 
496  if ((type = cfg_get(cfg, octstr_imm("system-type"))) == NULL) {
497  error(0, "HTTP[%s]: 'system-type' missing in smsc 'http' record.",
498  octstr_get_cstr(conn->id));
500  return -1;
501  }
502 
503  conndata = gw_malloc(sizeof(ConnData));
504  /* reset conndata */
505  memset(conndata, 0, sizeof(ConnData));
506 
507  conn->data = conndata;
508  conndata->http_ref = NULL;
509  conndata->data = NULL;
510 
511  if (cfg_get_integer(&conndata->port, cfg, octstr_imm("port")) == -1) {
512  warning(0, "HTTP[%s]: 'port' not set in smsc 'http' group.",
513  octstr_get_cstr(conn->id));
514  conndata->port = -1;
515  }
516 
517  conndata->allow_ip = cfg_get(cfg, octstr_imm("connect-allow-ip"));
518  conndata->send_url = cfg_get(cfg, octstr_imm("send-url"));
519  conndata->username = cfg_get(cfg, octstr_imm("smsc-username"));
520  conndata->password = cfg_get(cfg, octstr_imm("smsc-password"));
521  conndata->system_id = cfg_get(cfg, octstr_imm("system-id"));
522  cfg_get_bool(&conndata->no_sender, cfg, octstr_imm("no-sender"));
523  cfg_get_bool(&conndata->no_coding, cfg, octstr_imm("no-coding"));
524  cfg_get_bool(&conndata->no_sep, cfg, octstr_imm("no-sep"));
525  cfg_get_bool(&conndata->mobile_originated, cfg, octstr_imm("mobile-originated"));
526  cfg_get_bool(&ssl, cfg, octstr_imm("use-ssl"));
527  conndata->dlr_url = cfg_get(cfg, octstr_imm("dlr-url"));
528  conndata->alt_charset = cfg_get(cfg, octstr_imm("alt-charset"));
529  cfg_get_bool(&conndata->use_post, cfg, octstr_imm("use-post"));
530 
531  if (cfg_get_integer(&max_ps, cfg, octstr_imm("max-pending-submits")) == -1 || max_ps < 1)
532  max_ps = 10;
534 
535  if (conndata->port <= 0 && conndata->send_url == NULL) {
536  error(0, "HTTP[%s]: Sender and receiver disabled. Dummy SMSC not allowed.",
537  octstr_get_cstr(conn->id));
538  goto error;
539  }
540  if (conndata->send_url == NULL) {
541  error(0, "HTTP[%s]: Sending not allowed. No 'send-url' specified.",
542  octstr_get_cstr(conn->id));
543  goto error;
544  }
545 
546  /* callback struct is always in the format: smsc_http_XXX_callback where XXX is our type */
547  callbackname = octstr_format("smsc_http_%S_callback", type);
548  /* try to find the struct */
549  if (gw_dlopen_get_symbol(NULL, octstr_get_cstr(callbackname), (void**)&conndata->callbacks) == -1 || conndata->callbacks == NULL) {
550  error(0, "HTTP[%s]: system-type '%s' unknown smsc 'http' record.",
552  goto error;
553  }
554 
555  if (conndata->callbacks != NULL && conndata->callbacks->init != NULL && conndata->callbacks->init(conn, cfg)) {
556  error(0, "HTTP[%s]: submodule '%s' init failed.", octstr_get_cstr(conn->id), octstr_get_cstr(type));
557  goto error;
558  }
559 
564 
565  conn->name = octstr_format("HTTP%s:%S:%d", (ssl?"S":""), type, conndata->port);
566 
567  if (conndata->send_url != NULL) {
568  conn->status = SMSCCONN_ACTIVE;
569  } else {
571  }
572 
573  conn->connect_time = time(NULL);
574 
575  conn->shutdown = httpsmsc_shutdown;
576  conn->queued = httpsmsc_queued;
577  conn->send_msg = httpsmsc_send;
578 
579  conndata->shutdown = 0;
580 
581  /* start receiver thread */
582  if (conndata->port > 0) {
583  if (http_open_port(conndata->port, ssl) == -1)
584  goto error;
586  goto error;
587  } else
588  conndata->receive_thread = -1;
589 
590  /* start sender threads */
591  if (conndata->send_url) {
592  if ((conndata->send_cb_thread =
593  gwthread_create(httpsmsc_send_cb, conn)) == -1)
594  goto error;
595  if ((conndata->sender_thread =
596  gwthread_create(httpsmsc_sender, conn)) == -1)
597  goto error;
598  }
599  else {
601  }
602 
603  info(0, "HTTP[%s]: Initiated and ready", octstr_get_cstr(conn->id));
604 
605  octstr_destroy(callbackname);
607  return 0;
608 
609 error:
610  error(0, "HTTP[%s]: Failed to create HTTP SMSC connection",
611  octstr_get_cstr(conn->id));
612 
613  if (conndata->callbacks != NULL && conndata->callbacks->destroy != NULL)
614  conndata->callbacks->destroy(conn);
615  conn->data = NULL;
618  conn->status = SMSCCONN_DEAD;
619  octstr_destroy(callbackname);
621  return -1;
622 }
623 
Octstr * name
Definition: smscconn_p.h:173
void error(int err, const char *fmt,...)
Definition: log.c:648
void info(int err, const char *fmt,...)
Definition: log.c:672
Octstr * dlr_url
Definition: smsc_http_p.h:94
void * data
Definition: smsc_http_p.h:114
#define DEFAULT_CHARSET
Definition: smsc_http.c:133
Msg * msg_duplicate(Msg *msg)
Definition: msg.c:111
void bb_smscconn_connected(SMSCConn *conn)
Definition: bb_smscconn.c:192
static void httpsmsc_receiver(void *arg)
Definition: smsc_http.c:161
static void conndata_destroy(ConnData *conndata)
Definition: smsc_http.c:136
Octstr * alt_charset
Definition: smsc_http_p.h:103
long receive_thread
Definition: smsc_http_p.h:87
int gw_dlopen_get_symbol(const char *lib_path, const char *name, void **result)
Definition: gw-dlopen.c:70
int(* send_sms)(SMSCConn *conn, Msg *msg)
Definition: smsc_http_p.h:76
int ssl
void http_caller_signal_shutdown(HTTPCaller *caller)
Definition: http.c:913
void counter_destroy(Counter *counter)
Definition: counter.c:110
#define mutex_unlock(m)
Definition: thread.h:136
void http_close_client(HTTPClient *client)
Definition: http.c:2758
void bb_smscconn_killed(void)
Definition: bb_smscconn.c:199
int no_sep
Definition: smsc_http_p.h:101
void semaphore_destroy(Semaphore *semaphore)
Definition: gw-semaphore.c:104
void gwlist_produce(List *list, void *item)
Definition: list.c:411
Octstr * id
Definition: smscconn_p.h:174
void gwthread_join(long thread)
long gwlist_len(List *list)
Definition: list.c:166
void * data
Definition: smscconn_p.h:250
static void client(int port)
Definition: test_udp.c:77
HTTPCaller * http_ref
Definition: smsc_http_p.h:86
void octstr_append_char(Octstr *ostr, int ch)
Definition: octstr.c:1517
int log_idx
Definition: smscconn_p.h:197
int type
Definition: smsc_cimd2.c:215
Octstr * allow_ip
Definition: smsc_http_p.h:92
#define cfg_get(grp, varname)
Definition: cfg.h:86
void(* parse_reply)(SMSCConn *conn, Msg *msg, int status, List *headers, Octstr *body)
Definition: smsc_http_p.h:77
Octstr * system_id
Definition: smsc_http_p.h:107
unsigned long counter_decrease(Counter *counter)
Definition: counter.c:155
static Cfg * cfg
Definition: opensmppbox.c:95
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
int smsc_http_create(SMSCConn *conn, CfgGroup *cfg)
Definition: smsc_http.c:489
void(* destroy)(SMSCConn *conn)
Definition: smsc_http_p.h:75
unsigned long counter_increase(Counter *counter)
Definition: counter.c:123
int connect_denied(Octstr *allow_ip, Octstr *ip)
Definition: utils.c:833
long reconnect_delay
Definition: smscconn_p.h:199
void log_thread_to(int idx)
Definition: log.c:759
void semaphore_down(Semaphore *semaphore)
Definition: gw-semaphore.c:132
smscconn_killed_t why_killed
Definition: smscconn_p.h:153
void http_destroy_headers(List *headers)
Definition: http.c:2879
volatile int shutdown
Definition: smsc_http_p.h:90
void http_destroy_cgiargs(List *args)
Definition: http.c:2818
long port
Definition: smsc_http_p.h:91
Octstr * octstr_imm(const char *cstr)
Definition: octstr.c:283
Counter * open_sends
Definition: smsc_http_p.h:95
Definition: msg.h:79
int no_coding
Definition: smsc_http_p.h:100
List * msg_to_send
Definition: smsc_http_p.h:104
Counter * counter_create(void)
Definition: counter.c:94
void * gwlist_extract_first(List *list)
Definition: list.c:305
HTTPClient * http_accept_request(int port, Octstr **client_ip, Octstr **url, List **headers, Octstr **body, List **cgivars)
Definition: http.c:2571
void http_close_port(int port)
Definition: http.c:2515
void gwlist_remove_producer(List *list)
Definition: list.c:401
static void httpsmsc_send_cb(void *arg)
Definition: smsc_http.c:312
time_t connect_time
Definition: smscconn_p.h:155
double throughput
Definition: smscconn_p.h:203
Mutex * flow_mutex
Definition: smscconn_p.h:157
static double delay
Definition: mtbatch.c:99
long sender_thread
Definition: smsc_http_p.h:89
void warning(int err, const char *fmt,...)
Definition: log.c:660
void http_cgivar_dump_into(List *cgiargs, Octstr *os)
Definition: http.c:3459
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define gwthread_create(func, arg)
Definition: gwthread.h:90
unsigned long counter_value(Counter *counter)
Definition: counter.c:145
void gwthread_sleep(double seconds)
#define DEFAULT_UCS2_CHARSET
Definition: smsc_http.c:134
int no_sender
Definition: smsc_http_p.h:99
static int httpsmsc_shutdown(SMSCConn *conn, int finish_sending)
Definition: smsc_http.c:461
int http_open_port(int port, int ssl)
Definition: http.c:2509
Semaphore * max_pending_sends
Definition: smsc_http_p.h:96
#define http_receive_result(caller, status, final_url, headers, body)
Definition: http.h:394
void semaphore_up(Semaphore *semaphore)
Definition: gw-semaphore.c:118
int cfg_get_bool(int *n, CfgGroup *grp, Octstr *varname)
Definition: cfg.c:759
int(* init)(SMSCConn *conn, CfgGroup *cfg)
Definition: smsc_http_p.h:74
Definition: octstr.c:118
void * gwlist_consume(List *list)
Definition: list.c:427
static long httpsmsc_queued(SMSCConn *conn)
Definition: smsc_http.c:450
int(* shutdown)(SMSCConn *conn, int finish_sending)
Definition: smscconn_p.h:230
Octstr * password
Definition: smsc_http_p.h:98
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:726
int cfg_get_integer(long *n, CfgGroup *grp, Octstr *varname)
Definition: cfg.c:742
void gwthread_wakeup(long thread)
Definition: cfg.c:73
smscconn_status_t status
Definition: smscconn_p.h:151
HTTPCaller * http_caller_create(void)
Definition: http.c:897
#define gwlist_create()
Definition: list.h:136
long(* queued)(SMSCConn *conn)
Definition: smscconn_p.h:241
int(* send_msg)(SMSCConn *conn, Msg *msg)
Definition: smscconn_p.h:236
Octstr * username
Definition: smsc_http_p.h:97
static int httpsmsc_send(SMSCConn *conn, Msg *msg)
Definition: smsc_http.c:402
void bb_smscconn_send_failed(SMSCConn *conn, Msg *sms, int reason, Octstr *reply)
Definition: bb_smscconn.c:329
void http_caller_destroy(HTTPCaller *caller)
Definition: http.c:907
#define DC_UNDEF
Definition: sms.h:109
Octstr * send_url
Definition: smsc_http_p.h:93
void gwlist_add_producer(List *list)
Definition: list.c:383
void(* receive_sms)(SMSCConn *conn, HTTPClient *client, List *headers, Octstr *body, List *cgivars)
Definition: smsc_http_p.h:78
static void httpsmsc_sender(void *arg)
Definition: smsc_http.c:242
static Octstr * url
Definition: test_xmlrpc.c:84
#define mutex_lock(m)
Definition: thread.h:130
struct smsc_http_fn_callbacks * callbacks
Definition: smsc_http_p.h:111
Semaphore * semaphore_create(long n)
Definition: gw-semaphore.c:81
Definition: list.c:102
static XMLRPCDocument * msg
Definition: test_xmlrpc.c:86
long send_cb_thread
Definition: smsc_http_p.h:88
#define DC_UCS2
Definition: sms.h:112
int charset_convert(Octstr *string, char *charset_from, char *charset_to)
Definition: charset.c:589
#define DC_7BIT
Definition: sms.h:110
int use_post
Definition: smsc_http_p.h:102
int load
Definition: smscconn_p.h:152
int mobile_originated
Definition: smsc_http_p.h:108
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)
Definition: list.c:145
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.