publish final code
Fork of Pubnub_c_core by
pubnub_timers.h@0:d13755cfb705, 2016-11-10 (annotated)
- Committer:
- sveljko
- Date:
- Thu Nov 10 22:20:11 2016 +0000
- Revision:
- 0:d13755cfb705
Initial commit of Pubnub C-core
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sveljko | 0:d13755cfb705 | 1 | /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ |
sveljko | 0:d13755cfb705 | 2 | #if !defined INC_PUBNUB_TIMERS_IO |
sveljko | 0:d13755cfb705 | 3 | #define INC_PUBNUB_TIMERS_IO |
sveljko | 0:d13755cfb705 | 4 | |
sveljko | 0:d13755cfb705 | 5 | |
sveljko | 0:d13755cfb705 | 6 | #include "pubnub_api_types.h" |
sveljko | 0:d13755cfb705 | 7 | |
sveljko | 0:d13755cfb705 | 8 | |
sveljko | 0:d13755cfb705 | 9 | /** @file pubnub_timers.h |
sveljko | 0:d13755cfb705 | 10 | This is the "Timer" API of the Pubnub client library. |
sveljko | 0:d13755cfb705 | 11 | Functions here influence the way that Pubnub client library |
sveljko | 0:d13755cfb705 | 12 | works with lower levels (the TCP/IP stack) with respect to |
sveljko | 0:d13755cfb705 | 13 | how much will an operation be waited upon to complete. |
sveljko | 0:d13755cfb705 | 14 | |
sveljko | 0:d13755cfb705 | 15 | It is available in most platforms, but the exact way it behaves |
sveljko | 0:d13755cfb705 | 16 | may have noticable differences. In general, the actual timeout |
sveljko | 0:d13755cfb705 | 17 | will be _at_ _least_ as the specified by the user, but, it may |
sveljko | 0:d13755cfb705 | 18 | actually be more. |
sveljko | 0:d13755cfb705 | 19 | */ |
sveljko | 0:d13755cfb705 | 20 | |
sveljko | 0:d13755cfb705 | 21 | |
sveljko | 0:d13755cfb705 | 22 | /** The Pubnub default timeout on subscribe transaction, in milliseconds */ |
sveljko | 0:d13755cfb705 | 23 | #define PUBNUB_DEFAULT_SUBSCRIBE_TIMEOUT 310000 |
sveljko | 0:d13755cfb705 | 24 | |
sveljko | 0:d13755cfb705 | 25 | /** The Pubnub default timeout on non-subscribe transactions, in milliseconds */ |
sveljko | 0:d13755cfb705 | 26 | #define PUBNUB_DEFAULT_NON_SUBSCRIBE_TIMEOUT 10000 |
sveljko | 0:d13755cfb705 | 27 | |
sveljko | 0:d13755cfb705 | 28 | |
sveljko | 0:d13755cfb705 | 29 | /** Sets the transaction timeout for the context. This will be |
sveljko | 0:d13755cfb705 | 30 | used for all subsequent transactions. If a transactions is ongoing |
sveljko | 0:d13755cfb705 | 31 | and its timeout can be changed, it will be, but if it can't, that |
sveljko | 0:d13755cfb705 | 32 | would not be reported as an error. |
sveljko | 0:d13755cfb705 | 33 | |
sveljko | 0:d13755cfb705 | 34 | Pubnub SDKs, in general, distinguish the "subscribe" timeout and |
sveljko | 0:d13755cfb705 | 35 | other transactions, but, C-core doesn't, to save space, as most |
sveljko | 0:d13755cfb705 | 36 | contexts are either used for subscribe or for other transactions. |
sveljko | 0:d13755cfb705 | 37 | |
sveljko | 0:d13755cfb705 | 38 | If timer support is available, pubnub_init() will set a default timeout, |
sveljko | 0:d13755cfb705 | 39 | which is configurable at compile time. So, if the default timeout is |
sveljko | 0:d13755cfb705 | 40 | fine with you, you don't have to call this function. |
sveljko | 0:d13755cfb705 | 41 | |
sveljko | 0:d13755cfb705 | 42 | @pre Call this after pubnub_init() on the context |
sveljko | 0:d13755cfb705 | 43 | @pre duration_ms > 0 |
sveljko | 0:d13755cfb705 | 44 | @param p The Context to set transaction timeout for |
sveljko | 0:d13755cfb705 | 45 | @param duration_ms Duration of the timeout, in milliseconds |
sveljko | 0:d13755cfb705 | 46 | |
sveljko | 0:d13755cfb705 | 47 | @return 0: OK, otherwise: error, timers not supported |
sveljko | 0:d13755cfb705 | 48 | */ |
sveljko | 0:d13755cfb705 | 49 | int pubnub_set_transaction_timeout(pubnub_t *p, int duration_ms); |
sveljko | 0:d13755cfb705 | 50 | |
sveljko | 0:d13755cfb705 | 51 | /** Returns the current transaction timeout for the context. |
sveljko | 0:d13755cfb705 | 52 | |
sveljko | 0:d13755cfb705 | 53 | @pre Call this after pubnub_init() on the context |
sveljko | 0:d13755cfb705 | 54 | @param p The Context for which to get the transaction timeout |
sveljko | 0:d13755cfb705 | 55 | @return Current transaction timeout, in milliseconds (should |
sveljko | 0:d13755cfb705 | 56 | always be > 0) |
sveljko | 0:d13755cfb705 | 57 | */ |
sveljko | 0:d13755cfb705 | 58 | int pubnub_transaction_timeout_get(pubnub_t *p); |
sveljko | 0:d13755cfb705 | 59 | |
sveljko | 0:d13755cfb705 | 60 | #endif /* defined INC_PUBNUB_TIMERS_IO */ |