-
Notifications
You must be signed in to change notification settings - Fork 56
/
pubnub_config.h
115 lines (93 loc) · 3.94 KB
/
pubnub_config.h
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */
#if !defined INC_PUBNUB_CONFIG
#define INC_PUBNUB_CONFIG
/* -- Next few definitions can be tweaked by the user, but with care -- */
/** Maximum number of PubNub contexts. It is used only if the
* contexts are statically allocated.
* A context is used to publish messages or subscribe to (get) them.
*
* Doesn't make much sense to have less than 1. :)
* OTOH, don't put too many, as each context takes (for our purposes)
* a significant amount of memory - app. 128 + @ref PUBNUB_BUF_MAXLEN +
* @ref PUBNUB_REPLY_MAXLEN bytes.
*
* A typical configuration may consist of a single pubnub context for
* channel subscription and another pubnub context that will periodically
* publish messages about device status (with timeout lower than message
* generation frequency).
*
* Another typical setup may have a single subscription context and
* maintain a pool of contexts for each publish call triggered by an
* external event (e.g. a button push).
*
* Of course, there is nothing wrong with having just one context, but
* you can't publish and subscribe at the same time on the same context.
* This isn't as bad as it sounds, but may be a source of headaches
* (lost messages, etc).
*/
#define PUBNUB_CTX_MAX 2
/** Maximum length of the HTTP buffer. This is a major component of
* the memory size of the whole pubnub context, but it is also an
* upper bound on URL-encoded form of published message, so if you
* need to construct big messages, you may need to raise this. */
#define PUBNUB_BUF_MAXLEN 1024
/** Set to 0 to use a static buffer and then set its size via
#PUBNUB_REPLY_MAXLEN. Set to anything !=0 to use a dynamic
buffer, that is, dynamically try to allocate as much memory as
needed for the buffer.
*/
#define PUBNUB_DYNAMIC_REPLY_BUFFER 1
#if !PUBNUB_DYNAMIC_REPLY_BUFFER
/** Maximum length of the HTTP reply when using a static buffer. The
* other major component of the memory size of the PubNub context,
* beside #PUBNUB_BUF_MAXLEN. Replies of API calls longer than this
* will be discarded and an error will be reported. Specifically, this
* may cause lost messages returned by subscribe if too many too large
* messages got queued on the Pubnub server. */
#define PUBNUB_REPLY_MAXLEN 2048
#endif
/** This is the URL of the Pubnub server. Change only for testing
purposes.
*/
#define PUBNUB_ORIGIN "pubsub.pubnub.com"
/** Set to 0 to disable changing the origin from the default
#PUBNUB_ORIGIN. Set to anything != 0 to enable changing the
origin (per context).
*/
#define PUBNUB_ORIGIN_SETTABLE 1
/** Duration of the transaction timeout set during context initialization,
in milliseconds. Timeout duration in the context can be changed by the
user after initialization.
*/
#define PUBNUB_DEFAULT_TRANSACTION_TIMER 310000
/** Mininmal duration of the transaction timer, in milliseconds. You
* can't set less than this.
*/
#define PUBNUB_MIN_TRANSACTION_TIMER 10000
#define PUBNUB_HAVE_SHA1 0
#if !defined(PUBNUB_PROXY_API)
/** If true (!=0), enable support for (HTTP/S) proxy */
#define PUBNUB_PROXY_API 1
#endif
/** The maximum length (in characters) of the host name of the proxy
that will be saved in the Pubnub context.
*/
#define PUBNUB_MAX_PROXY_HOSTNAME_LENGTH 63
/** If true (!=0), enable support for message encryption/decryption */
#define PUBNUB_CRYPTO_API 0
#if !defined(PUBNUB_ONLY_PUBSUB)
/** If true (!=0), will enable only publish and subscribe. All
other transactions will fail.
For use in embedded systems and, in general, when you know
you won't be needing anything but publish and subscribe,
to reduce the memory footprint.
*/
#define PUBNUB_ONLY_PUBSUB_API 0
#endif
#ifndef PUBNUB_USE_SSL
/** If true (!=0), will enable SSL/TLS support. If false (==0), will
disable SSL/TLS support. If not defined, will enable SSL/TLS
support. */
#define PUBNUB_USE_SSL 1
#endif
#endif /* !defined INC_PUBNUB_CONFIG */