File: opensips_json_c_helper.h

package info (click to toggle)
opensips 2.2.2-3.1
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 31,160 kB
  • sloc: ansic: 334,348; xml: 91,231; perl: 6,659; sh: 5,148; sql: 4,175; makefile: 3,167; yacc: 2,499; python: 1,197; cpp: 611; php: 573
file content (70 lines) | stat: -rw-r--r-- 2,313 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * Copyright (C) 2017 Björn Esser <besser82@fedoraproject.org>
 *
 * This file is part of opensips, a free SIP server.
 *
 * opensips is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * opensips is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *
 * History:
 * ---------
 *  2017-12-12 first version (besser82)
 */

#ifndef OPENSIPS_JSON_C_HELPER_H
#define OPENSIPS_JSON_C_HELPER_H

// If those are not defined, we assume to build against json-c v0.9.
// Starting with v0.11 there is json_c_version.h, which we prefer
// anyways, so there are no regressions in this case.  Everything
// conditionalized for v0.10 or later doesn't produce any fallout,
// when we are asuming v0.9 and building against v0.10.
#ifndef JSON_PKG_MAJOR
#define JSON_PKG_MAJOR	0
#endif
#ifndef JSON_PKG_MINOR
#define JSON_PKG_MINOR	9
#endif
#ifndef JSON_PKG_MICRO
#define JSON_PKG_MICRO	0
#endif

// json.h automatically includes json_c_version.h, if available.
#include <json.h>

// We prefer JSON_C_VERSION_NUM defined in json_c_version.h.  If it is
// not defined, we construct it the same way from our JSON_PKG_* defines.
#ifndef JSON_C_VERSION_NUM
#define JSON_C_VERSION_NUM (JSON_PKG_MAJOR << 16) | \
			   (JSON_PKG_MINOR << 8)  | \
			    JSON_PKG_MICRO
#endif

// Macros for checking specific versions.
#define JSON_C_VER_010 (10 << 8)
#define JSON_C_VER_013 (13 << 8)

// json_object_private.h is gone and not needed anymore in json-c v0.13+.
#if JSON_C_VERSION_NUM < JSON_C_VER_013
#include <json_object_private.h>
#endif

// Newer versions of json-c define this in their headers, so we prefer
// their definition in that case.
#ifndef JSON_FILE_BUF_SIZE
#define JSON_FILE_BUF_SIZE 4096
#endif

#endif // OPENSIPS_JSON_C_HELPER_H