Kannel: Open Source WAP and SMS gateway  svn-r5262
dlr_spool.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  * gw/dlr_spool.c
59  *
60  * Implementation of handling delivery reports (DLRs) in a spool directory.
61  * This ensures we have disk persistence of the temporary DLR data, but also
62  * doesn't force users to use third party RDMS systems for the storage.
63  *
64  * Stipe Tolj <stolj at kannel dot org>
65  */
66 
67 #include <unistd.h>
68 #include <sys/types.h>
69 #include <sys/stat.h>
70 #include <fcntl.h>
71 #include <dirent.h>
72 #include <errno.h>
73 
74 #include "gwlib/gwlib.h"
75 #include "dlr_p.h"
76 #include "sms.h"
77 #include "bb_store.h"
78 
79 #ifdef HAVE_NFTW
80 #include <ftw.h>
81 #endif
82 
83 /* some standard constant for the hash functions */
84 #define MD5_DIGEST_LEN 32
85 #define SHA1_DIGEST_LEN 40
86 #ifdef HAVE_LIBSSL
87 # define OUR_DIGEST_LEN SHA1_DIGEST_LEN
88 #else
89 # define OUR_DIGEST_LEN MD5_DIGEST_LEN
90 #endif
91 
92 /* how much sub-directories will we allow? */
93 #define MAX_DIRS 100
94 
95 /*
96  * Define this macro in order to get verified counter
97  * values while start-up. This will decrease start-up performance,
98  * especially for large scale DLR spools
99  */
100 /*
101 #define VERIFIED 1
102 */
103 
104 /*
105  * Our DLR spool location.
106  */
107 static Octstr *spool_dir = NULL;
108 
109 /*
110  * Internal counter keeping track of how many items we have.
111  */
112 static Counter *counter;
113 
114 
115 /********************************************************************
116  * Hashing functions.
117  */
118 
119 /*
120  * Calculates a SHA1 hash digest, if openssl library was available
121  * on the system, or a less secure MD5 hash digest.
122  */
124 {
125 #ifdef HAVE_LIBSSL
126  /* use openssl's SHA1 */
127  unsigned char hash[20];
128  Octstr *ret;
129 
130  memset(hash, 0, sizeof(hash));
131 
132  SHA1((const unsigned char *)octstr_get_cstr(os), octstr_len(os), hash);
133 
134  ret = octstr_create_from_data((const char*)hash, sizeof(hash));
135  octstr_binary_to_hex(ret, 0);
136  return ret;
137 #else
138  /* fallback to our own MD5 if we don't have openssl available */
139  return md5digest(os);
140 #endif
141 }
142 
143 
144 /********************************************************************
145  * Disk IO operations.
146  */
147 
148 /*
149  * This callback function for use with for_each_file() will really
150  * try to load the DLR message file from the DLR spool and try to
151  * unpack it. This ensures we get a real accurate counter value at
152  * startup time.
153  */
154 #ifdef VERIFIED
155 #ifdef HAVE_NFTW
156 static int verified_file(const char *filename, const struct stat *sb, int tflag, struct FTW *ftwbuf)
157 {
158  Octstr *os;
159  Msg *msg;
160 
161  /* we need to check here if we have a regular file. */
162  if (tflag != FTW_F)
163  return 0;
164 #else
165 static int verified_file(const char *filename, const struct stat *sb, int tflag, void *ftwbuf)
166 {
167  Octstr *os;
168  Msg *msg;
169 #endif
170 
171  if ((os = octstr_read_file(filename)) == NULL) {
172  return -1;
173  }
174 
175  if ((msg = store_msg_unpack(os)) == NULL) {
176  error(0, "Could not unpack DLR message `%s'", filename);
177  octstr_destroy(os);
178  return -1;
179  }
180 
181  /* we could load and unpack, so this is verified */
182  counter_increase(counter);
183  octstr_destroy(os);
184  msg_destroy(msg);
185 
186  return 0;
187 }
188 #endif
189 
190 
191 /*
192  * This callback function for use with for_each_file() will be more
193  * optimistic and simply account and file occurrences, without trying
194  * to load and unpack the DLR message. This is less accurate, but
195  * faster for very large DLR spools.
196  */
197 #ifdef HAVE_NFTW
198 static int non_verified_file(const char *filename, const struct stat *sb, int tflag, struct FTW *ftwbuf)
199 {
200  /* we need to check here if we have a regular file. */
201  if (tflag != FTW_F)
202  return 0;
203 #else
204 static int non_verified_file(const char *filename, const struct stat *sb, int tflag, void *ftwbuf)
205 {
206 #endif
207 
208  counter_increase(counter);
209 
210  return 0;
211 }
212 
213 /*
214  * This callback function for use with for_each_file() will unlink
215  * the file, and hence removing all regular files within the DLR spool.
216  */
217 #ifdef HAVE_NFTW
218 static int unlink_file(const char *filename, const struct stat *sb, int tflag, struct FTW *ftwbuf)
219 {
220  /* we need to check here if we have a regular file. */
221  if (tflag != FTW_F)
222  return 0;
223 #else
224 static int unlink_file(const char *filename, const struct stat *sb, int tflag, void *ftwbuf)
225 {
226 #endif
227 
228  /* remove the file from the file system */
229  if (unlink(filename) == -1) {
230  error(errno, "Could not unlink file `%s'.", filename);
231  }
232 
233  return 0;
234 }
235 
236 
237 /*
238  * The function traverses a directory structure and calls a callback
239  * function for each regular file within that directory structure.
240  */
241 #ifdef HAVE_NFTW
242 static int for_each_file(const Octstr *dir_s, int ignore_err,
243  int(*cb)(const char *, const struct stat *, int, struct FTW *))
244 {
245  int ret;
246 
247  ret = nftw(octstr_get_cstr(dir_s), cb, 20, FTW_PHYS);
248 
249  return ret;
250 }
251 #else
252 static int for_each_file(const Octstr *dir_s, int ignore_err,
253  int(*cb)(const char *, const struct stat *, int, void *))
254 {
255  DIR *dir;
256  struct dirent *ent;
257  int ret = 0;
258 #ifndef _DIRENT_HAVE_D_TYPE
259  struct stat stat;
260 #endif
261 
262  if ((dir = opendir(octstr_get_cstr(dir_s))) == NULL) {
263  error(errno, "Could not open directory `%s'", octstr_get_cstr(dir_s));
264  return -1;
265  }
266  while ((ent = readdir(dir)) != NULL) {
267  Octstr *filename;
268  if (!(strcmp((char*)ent->d_name, "." ) != 0 && strcmp((char*)ent->d_name, ".." ) != 0))
269  continue;
270  filename = octstr_format("%S/%s", dir_s, ent->d_name);
271 #ifdef _DIRENT_HAVE_D_TYPE
272  if (ent->d_type == DT_DIR && for_each_file(filename, ignore_err, cb) == -1) {
273  ret = -1;
274  } else if (ent->d_type == DT_REG && cb != NULL) {
275  cb(octstr_get_cstr(filename), NULL, 0, NULL);
276  }
277 #else
278  if (lstat(octstr_get_cstr(filename), &stat) == -1) {
279  if (!ignore_err)
280  error(errno, "Could not get stat for `%s'", octstr_get_cstr(filename));
281  ret = -1;
282  } else if (S_ISDIR(stat.st_mode) && for_each_file(filename, ignore_err, cb) == -1) {
283  ret = -1;
284  } else if (S_ISREG(stat.st_mode) && cb != NULL)
285  cb(octstr_get_cstr(filename), &stat, 0, NULL);
286 #endif
287  octstr_destroy(filename);
288  if (ret == -1 && ignore_err)
289  ret = 0;
290  else if (ret == -1)
291  break;
292  }
293  closedir(dir);
294 
295  return ret;
296 }
297 #endif
298 
299 
300 static Octstr *get_msg_filename(const Octstr *dir_s, const Octstr *hash, const Octstr *dst)
301 {
302  Octstr *ret;
303  DIR *dir;
304  struct dirent *ent;
305 
306  if ((dir = opendir(octstr_get_cstr(dir_s))) == NULL) {
307  error(errno, "Could not open directory `%s'", octstr_get_cstr(dir_s));
308  return NULL;
309  }
310 
311  while ((ent = readdir(dir)) != NULL) {
312  Octstr *fname = octstr_create((char*)ent->d_name);
313 
314  if (octstr_ncompare(fname, hash, OUR_DIGEST_LEN) == 0) {
315  Octstr *addr;
316  long addr_len, pos;
317 
318  /* this is a candidate */
319  if (dst == NULL)
320  goto found;
321 
322  /* check for the destination address suffix part */
323  if ((addr_len = (octstr_len(fname) - OUR_DIGEST_LEN)) < 0 ||
324  (pos = (addr_len - octstr_len(dst))) < 0) {
325  octstr_destroy(fname);
326  continue;
327  }
328  addr = octstr_copy(fname, OUR_DIGEST_LEN, addr_len);
329 
330  /* if not found, then bail out*/
331  if (octstr_search(addr, dst, pos) == -1) {
332  octstr_destroy(addr);
333  octstr_destroy(fname);
334  continue;
335  }
336  octstr_destroy(addr);
337 found:
338  /* found it */
339  closedir(dir);
340  ret = octstr_format("%S/%S", dir_s, fname);
341  octstr_destroy(fname);
342  return ret;
343  }
344  octstr_destroy(fname);
345  }
346  closedir(dir);
347 
348  return NULL;
349 }
350 
351 static Octstr *get_msg_surrogate(const Octstr *dir_s, const Octstr *hash,
352  const Octstr *dst, Octstr **filename)
353 {
354  /* get our msg filename */
355  if ((*filename = get_msg_filename(dir_s, hash, dst)) == NULL)
356  return NULL;
357 
358  return octstr_read_file(octstr_get_cstr(*filename));
359 }
360 
361 
362 /********************************************************************
363  * Implementation of the DLR handle functions.
364  */
365 
366 /*
367  * Adds a struct dlr_entry to the spool directory.
368  */
369 static void dlr_spool_add(struct dlr_entry *dlr)
370 {
371  Msg *msg;
372  Octstr *os, *hash, *dir, *filename;
373  int fd;
374  size_t wrc;
375 
376 #define MAP(to, from) \
377  to = from; \
378  from = NULL;
379 
380  /* create a common message structure to contain our values */
381  msg = msg_create(sms);
382  msg->sms.sms_type = report_mt;
383  MAP(msg->sms.smsc_id, dlr->smsc);
384  MAP(msg->sms.foreign_id, dlr->timestamp);
385  MAP(msg->sms.sender, dlr->source);
386  MAP(msg->sms.receiver, dlr->destination);
387  MAP(msg->sms.service, dlr->service);
388  MAP(msg->sms.dlr_url, dlr->url);
389  MAP(msg->sms.boxc_id, dlr->boxc_id);
390  msg->sms.dlr_mask = dlr->mask;
391 
392  /* we got all values, destroy the structure now */
393  dlr_entry_destroy(dlr);
394 
395  /* create hash value */
396  os = octstr_duplicate(msg->sms.smsc_id);
397  octstr_append(os, msg->sms.foreign_id);
398  hash = our_hash_func(os);
399  octstr_destroy(os);
400 
401  /* target directory */
402  dir = octstr_format("%S/%ld", spool_dir, octstr_hash_key(hash) % MAX_DIRS);
403  if (mkdir(octstr_get_cstr(dir), S_IRUSR|S_IWUSR|S_IXUSR) == -1 && errno != EEXIST) {
404  error(errno, "Could not create directory `%s'.", octstr_get_cstr(dir));
405  octstr_destroy(dir);
406  octstr_destroy(hash);
407  return;
408  }
409 
410  /*
411  * Now also add the hex value of the destination.
412  * This will be the part we look later into while
413  * DLR resolving.
414  */
415  os = octstr_duplicate(msg->sms.receiver);
416  octstr_binary_to_hex(os, 0);
417  octstr_append(hash, os);
418  octstr_destroy(os);
419 
420  /* target file */
421  filename = octstr_format("%S/%S", dir, hash);
422  octstr_destroy(dir);
423  octstr_destroy(hash);
424  if ((fd = open(octstr_get_cstr(filename), O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR)) == -1) {
425  error(errno, "Could not open file `%s'.", octstr_get_cstr(filename));
426  octstr_destroy(filename);
427  return;
428  }
429 
430  /* pack and write content to file */
431  os = store_msg_pack(msg);
432  msg_destroy(msg);
433  for (wrc = 0; wrc < octstr_len(os); ) {
434  size_t rc = write(fd, octstr_get_cstr(os) + wrc, octstr_len(os) - wrc);
435  if (rc == -1) {
436  /* remove file */
437  error(errno, "Could not write DLR message to `%s'.", octstr_get_cstr(filename));
438  close(fd);
439  if (unlink(octstr_get_cstr(filename)) == -1)
440  error(errno, "Oops, Could not remove failed file `%s'.", octstr_get_cstr(filename));
441  octstr_destroy(os);
442  octstr_destroy(filename);
443  return;
444  }
445  wrc += rc;
446  }
447  close(fd);
448  counter_increase(counter);
449  octstr_destroy(filename);
450  octstr_destroy(os);
451 }
452 
453 
454 /*
455  * Find matching entry in our spool and return the dlr_entry.
456  */
457 static struct dlr_entry *dlr_spool_get(const Octstr *smsc, const Octstr *ts, const Octstr *dst)
458 {
459  struct dlr_entry *ret = NULL;
460  Octstr *os, *hash, *dir, *filename = NULL;
461  Msg *msg;
462 
463  /* determine target dir and filename via hash */
464  os = octstr_duplicate(smsc);
465  octstr_append(os, ts);
466  hash = our_hash_func(os);
467  octstr_destroy(os);
468 
469  /* determine target dir */
470  dir = octstr_format("%S/%ld", spool_dir, octstr_hash_key(hash) % MAX_DIRS);
471 
472  /* get content of msg surrogate */
473  os = get_msg_surrogate(dir, hash, dst, &filename);
474  octstr_destroy(dir);
475  octstr_destroy(hash);
476 
477  /* if there was no content */
478  if (os == NULL) {
479  octstr_destroy(filename);
480  return NULL;
481  }
482 
483  /* unpack */
484  if ((msg = store_msg_unpack(os)) == NULL) {
485  octstr_destroy(os);
486  error(0, "Could not unpack DLR message `%s'", octstr_get_cstr(filename));
487  octstr_destroy(filename);
488  return ret;
489  }
490 
491  octstr_destroy(os);
492  octstr_destroy(filename);
493 
494 #define MAP(to, from) \
495  to = from; \
496  from = NULL;
497 
498  /* map values to a struct dlr_entry */
499  ret = dlr_entry_create();
500  MAP(ret->smsc, msg->sms.smsc_id);
501  MAP(ret->timestamp, msg->sms.foreign_id);
502  MAP(ret->source, msg->sms.sender);
503  MAP(ret->destination, msg->sms.receiver);
504  MAP(ret->service, msg->sms.service);
505  MAP(ret->url, msg->sms.dlr_url);
506  MAP(ret->boxc_id, msg->sms.boxc_id);
507  ret->mask = msg->sms.dlr_mask;
508 
509  msg_destroy(msg);
510 
511  return ret;
512 }
513 
514 
515 /*
516  * Remove matching entry from the spool.
517  */
518 static void dlr_spool_remove(const Octstr *smsc, const Octstr *ts, const Octstr *dst)
519 {
520  Octstr *os, *hash, *dir, *filename;
521 
522  /* determine target dir and filename via hash */
523  os = octstr_duplicate(smsc);
524  octstr_append(os, ts);
525  hash = our_hash_func(os);
526  octstr_destroy(os);
527 
528  /* determine target dir */
529  dir = octstr_format("%S/%ld", spool_dir, octstr_hash_key(hash) % MAX_DIRS);
530 
531  /* get msg surrogate filename */
532  filename = get_msg_filename(dir, hash, dst);
533  octstr_destroy(dir);
534  octstr_destroy(hash);
535 
536  /* if there was no filename, then we didn't find it */
537  if (filename == NULL) {
538  return;
539  }
540 
541  /* remove the file from the file system */
542  if (unlink(octstr_get_cstr(filename)) == -1) {
543  error(errno, "Could not unlink file `%s'.", octstr_get_cstr(filename));
544  octstr_destroy(filename);
545  return;
546  }
547 
548  counter_decrease(counter);
549  octstr_destroy(filename);
550 }
551 
552 
553 /*
554  * Destroy data structures of the module.
555  */
556 static void dlr_spool_shutdown()
557 {
558  counter_destroy(counter);
559  octstr_destroy(spool_dir);
560 }
561 
562 
563 /*
564  * Get count of DLR messages within the spool.
565  */
566 static long dlr_spool_messages(void)
567 {
568  return counter_value(counter);
569 }
570 
571 
572 /*
573  * Flush all DLR messages out of the spool, removing all.
574  */
575 static void dlr_spool_flush(void)
576 {
577  for_each_file(spool_dir, 1, unlink_file);
578  counter_set(counter, 0);
579 }
580 
581 
582 /********************************************************************
583  * DLR storage handle definition and init function.
584  */
585 
586 static struct dlr_storage handles = {
587  .type = "spool",
588  .dlr_add = dlr_spool_add,
589  .dlr_get = dlr_spool_get,
590  .dlr_remove = dlr_spool_remove,
591  .dlr_shutdown = dlr_spool_shutdown,
592  .dlr_messages = dlr_spool_messages,
593  .dlr_flush = dlr_spool_flush
594 };
595 
596 
597 /*
598  * Initialize dlr_waiting_list and return out storage handles.
599  */
601 {
602  CfgGroup *grp;
603 
604  if (!(grp = cfg_get_single_group(cfg, octstr_imm("core"))))
605  panic(0, "DLR: spool: group 'core' is not specified!");
606 
607  if (!(spool_dir = cfg_get(grp, octstr_imm("dlr-spool"))))
608  panic(0, "DLR: spool: directive 'dlr-spool' is not specified!");
609 
610 #ifdef HAVE_LIBSSL
611  OpenSSL_add_all_digests();
612 #endif
613 
614  counter = counter_create();
615 
616  /* we need to traverse the DLR spool to determine how
617  * many entries we have. */
618 #ifdef VERIFIED
619  for_each_file(spool_dir, 1, verified_file);
620 #else
621  for_each_file(spool_dir, 1, non_verified_file);
622 #endif
623 
624  return &handles;
625 }
void error(int err, const char *fmt,...)
Definition: log.c:648
const char * type
Definition: dlr_p.h:112
Octstr * url
Definition: dlr_p.h:84
static Octstr * spool_dir
Definition: dlr_spool.c:107
void counter_destroy(Counter *counter)
Definition: counter.c:110
Octstr * service
Definition: dlr_p.h:83
static Octstr * our_hash_func(Octstr *os)
Definition: dlr_spool.c:123
void octstr_append(Octstr *ostr1, const Octstr *ostr2)
Definition: octstr.c:1502
struct dlr_entry * dlr_entry_create(void)
Definition: dlr.c:103
Octstr * boxc_id
Definition: dlr_p.h:85
static Counter * counter
Definition: dlr_spool.c:112
long octstr_search(const Octstr *haystack, const Octstr *needle, long pos)
Definition: octstr.c:1068
#define cfg_get(grp, varname)
Definition: cfg.h:86
unsigned long counter_set(Counter *counter, unsigned long n)
Definition: counter.c:167
#define msg_create(type)
Definition: msg.h:136
unsigned long counter_decrease(Counter *counter)
Definition: counter.c:155
Msg *(* store_msg_unpack)(Octstr *os)
Definition: bb_store.c:78
static void dlr_spool_shutdown()
Definition: dlr_spool.c:556
Definition: msg.h:110
static Cfg * cfg
Definition: opensmppbox.c:95
static int for_each_file(const Octstr *dir_s, int ignore_err, int(*cb)(const char *, const struct stat *, int, void *))
Definition: dlr_spool.c:252
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
#define octstr_copy(ostr, from, len)
Definition: octstr.h:178
void octstr_binary_to_hex(Octstr *ostr, int uppercase)
Definition: octstr.c:463
unsigned long counter_increase(Counter *counter)
Definition: counter.c:123
static struct pid_list * found
static struct dlr_storage handles
Definition: dlr_spool.c:586
Octstr * octstr_imm(const char *cstr)
Definition: octstr.c:281
Definition: msg.h:79
Definition: cfg.c:164
Counter * counter_create(void)
Definition: counter.c:94
static Octstr * get_msg_surrogate(const Octstr *dir_s, const Octstr *hash, const Octstr *dst, Octstr **filename)
Definition: dlr_spool.c:351
static void dlr_spool_flush(void)
Definition: dlr_spool.c:575
Octstr * source
Definition: dlr_p.h:81
int octstr_ncompare(const Octstr *ostr1, const Octstr *ostr2, long n)
Definition: octstr.c:950
#define octstr_duplicate(ostr)
Definition: octstr.h:187
static long dlr_spool_messages(void)
Definition: dlr_spool.c:566
static void dlr_spool_remove(const Octstr *smsc, const Octstr *ts, const Octstr *dst)
Definition: dlr_spool.c:518
void msg_destroy(Msg *msg)
Definition: msg.c:132
#define MAX_DIRS
Definition: dlr_spool.c:93
Octstr * timestamp
Definition: dlr_p.h:80
unsigned long octstr_hash_key(Octstr *ostr)
Definition: octstr.c:2521
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2462
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:322
char filename[FILENAME_MAX+1]
Definition: log.c:171
#define octstr_create(cstr)
Definition: octstr.h:125
unsigned long counter_value(Counter *counter)
Definition: counter.c:145
Octstr *(* store_msg_pack)(Msg *msg)
Definition: bb_store.c:77
struct dlr_storage * dlr_init_spool(Cfg *cfg)
Definition: dlr_spool.c:600
Octstr * octstr_read_file(const char *filename)
Definition: octstr.c:1546
static void dlr_spool_add(struct dlr_entry *dlr)
Definition: dlr_spool.c:369
long octstr_len(const Octstr *ostr)
Definition: octstr.c:340
Octstr * destination
Definition: dlr_p.h:82
Definition: octstr.c:118
#define MAP(to, from)
void dlr_entry_destroy(struct dlr_entry *dlr)
Definition: dlr.c:142
#define panic
Definition: log.h:87
Definition: cfg.c:73
static struct dlr_entry * dlr_spool_get(const Octstr *smsc, const Octstr *ts, const Octstr *dst)
Definition: dlr_spool.c:457
Definition: dlr_p.h:78
static Octstr * get_msg_filename(const Octstr *dir_s, const Octstr *hash, const Octstr *dst)
Definition: dlr_spool.c:300
Octstr * smsc
Definition: dlr_p.h:79
static int unlink_file(const char *filename, const struct stat *sb, int tflag, void *ftwbuf)
Definition: dlr_spool.c:224
int mask
Definition: dlr_p.h:86
CfgGroup * cfg_get_single_group(Cfg *cfg, Octstr *name)
Definition: cfg.c:636
#define octstr_create_from_data(data, len)
Definition: octstr.h:134
static int non_verified_file(const char *filename, const struct stat *sb, int tflag, void *ftwbuf)
Definition: dlr_spool.c:204
static XMLRPCDocument * msg
Definition: test_xmlrpc.c:86
#define OUR_DIGEST_LEN
Definition: dlr_spool.c:89
Octstr * md5digest(Octstr *data)
Definition: md5.c:406
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.