4
* Copyright (C) 2013 Robert Boisvert
6
* This file is part of the mohqueue module for sip-router, a free SIP server.
8
* The mohqueue module is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version
13
* The mohqueue module is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
#include "../rr/api.h"
32
#include "../../data_lump.h"
33
#include "../../data_lump_rpl.h"
34
#include "../../dprint.h"
35
#include "../../dset.h"
36
#include "../../flags.h"
37
#include "../../hashes.h"
38
#include "../../locking.h"
39
#include "../../lvalue.h"
40
#include "../../mod_fix.h"
41
#include "../../sr_module.h"
42
#include "../../str.h"
44
#include "../../lib/kcore/cmpapi.h"
45
#include "../../lib/kmi/mi.h"
46
#include "../../lib/srdb1/db.h"
47
#include "../../mem/mem.h"
48
#include "../../mem/shm_mem.h"
49
#include "../../modules/sl/sl.h"
50
#include "../../modules/tm/tm_load.h"
51
#include "../../parser/hf.h"
52
#include "../../parser/msg_parser.h"
53
#include "../../parser/contact/parse_contact.h"
54
#include "../../parser/parse_expires.h"
55
#include "../../parser/parse_from.h"
56
#include "../../parser/sdp/sdp.h"
58
/* convenience macros */
59
#define MOHQ_STRUCT_PTR_OFFSET( struct1, cast1, offset1 ) \
60
(cast1)(struct1) + (offset1)
62
#define MOHQ_STR_COPY( str1, str2 ) \
63
memcpy((str1)->s, (str2)->s, (str2)->len ); \
64
(str1)->len = (str2)->len;
66
#define MOHQ_STR_APPEND( str1, str2 ) \
67
memcpy((str1)->s + (str1)->len, (str2)->s, (str2)->len); \
68
(str1)->len += (str2)->len;
70
#define MOHQ_STR_APPEND_L( str1, str1_lim, s2, s2_len ) \
71
if ((str1)->len + (s2_len) >= (str1_lim)) { \
72
LM_ERR( "Failed to append to str: too long" ); \
74
MOHQ_STR_APPEND((str1), (s2), (s2_len)); \
75
(str1_lim) -= (s2_len); \
78
#define MOHQ_STR_COPY_CSTR( str1, cstr1 ) \
79
memcpy((str1)->s + (str1)->len, (cstr1), strlen((cstr1))); \
80
(str1)->len += strlen((cstr1));
82
#define MOHQ_STR_APPEND_CSTR( str1, cstr1 ) \
83
MOHQ_STR_COPY_CSTR((str1), (cstr1))
85
#define MOHQ_STR_APPEND_CSTR_L( str1, str1_lim, cstr1 ) \
86
if ((str1)->len + strlen(cstr1) >= (str1_lim)) { \
87
LM_ERR( "Failed to append to str: too long" ); \
89
MOHQ_STR_APPEND_CSTR((str1), (cstr1)); \
92
/* STR_EQ assumes we're not using str pointers, which is obnoxious */
93
#define MOHQ_STR_EQ( str1, str2 ) \
94
(((str1)->len == (str2)->len) && \
95
memcmp((str1)->s, (str2)->s, (str1)->len) == 0)
97
#define MOHQ_STR_EMPTY( str1 ) \
98
(((str1) != NULL && ((str1)->s == NULL || (str1)->len <= 0 )) \
101
#define MOHQ_HEADER_EMPTY( hdr1 ) \
102
((hdr1) == NULL || MOHQ_STR_EMPTY( &(hdr1)->body ))
104
#endif /* MOHQ_COMMON_H */
b'\\ No newline at end of file'