~ubuntu-branches/debian/sid/kamailio/sid

« back to all changes in this revision

Viewing changes to modules/mohqueue/mohq_common.h

  • Committer: Package Import Robot
  • Author(s): Victor Seva
  • Date: 2014-01-06 11:47:13 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140106114713-t8xidp4arzrnyeya
Tags: 4.1.1-1
* New upstream release
* debian/patches:
  - add upstream fixes
* Added tls outbound websocket autheph dnssec modules
  - openssl exception added to their license
* removing sparc and ia64 from supported archs
  for mono module (Closes: #728915)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id$
 
3
 *
 
4
 * Copyright (C) 2013 Robert Boisvert
 
5
 *
 
6
 * This file is part of the mohqueue module for sip-router, a free SIP server.
 
7
 *
 
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
 
12
 *
 
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.
 
17
 *
 
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
 
21
 *
 
22
 */
 
23
 
 
24
#ifndef MOHQ_COMMON_H
 
25
#define MOHQ_COMMON_H
 
26
 
 
27
#include <assert.h>
 
28
#include <sys/stat.h>
 
29
 
 
30
#include "../rr/api.h"
 
31
 
 
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"
 
43
 
 
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"
 
57
 
 
58
/* convenience macros */
 
59
#define MOHQ_STRUCT_PTR_OFFSET( struct1, cast1, offset1 ) \
 
60
        (cast1)(struct1) + (offset1)
 
61
        
 
62
#define MOHQ_STR_COPY( str1, str2 ) \
 
63
        memcpy((str1)->s, (str2)->s, (str2)->len ); \
 
64
        (str1)->len = (str2)->len;
 
65
 
 
66
#define MOHQ_STR_APPEND( str1, str2 ) \
 
67
        memcpy((str1)->s + (str1)->len, (str2)->s, (str2)->len); \
 
68
        (str1)->len += (str2)->len;
 
69
 
 
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" ); \
 
73
        } else { \
 
74
            MOHQ_STR_APPEND((str1), (s2), (s2_len)); \
 
75
            (str1_lim) -= (s2_len); \
 
76
        }
 
77
 
 
78
#define MOHQ_STR_COPY_CSTR( str1, cstr1 ) \
 
79
        memcpy((str1)->s + (str1)->len, (cstr1), strlen((cstr1))); \
 
80
        (str1)->len += strlen((cstr1));
 
81
 
 
82
#define MOHQ_STR_APPEND_CSTR( str1, cstr1 ) \
 
83
        MOHQ_STR_COPY_CSTR((str1), (cstr1))
 
84
 
 
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" ); \
 
88
        } else { \
 
89
            MOHQ_STR_APPEND_CSTR((str1), (cstr1)); \
 
90
        }
 
91
 
 
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)
 
96
 
 
97
#define MOHQ_STR_EMPTY( str1 ) \
 
98
        (((str1) != NULL && ((str1)->s == NULL || (str1)->len <= 0 )) \
 
99
                || (str1) == NULL )
 
100
 
 
101
#define MOHQ_HEADER_EMPTY( hdr1 ) \
 
102
        ((hdr1) == NULL || MOHQ_STR_EMPTY( &(hdr1)->body ))
 
103
 
 
104
#endif /* MOHQ_COMMON_H */
 
 
b'\\ No newline at end of file'