This is the PAL (Platform Adaptation Layer) for the Pubnub C-core library.

Dependencies:   Pubnub_c_core

Dependents:   Pubnub_mbed2_sync

Committer:
sveljko
Date:
Tue Dec 06 10:22:54 2016 +0000
Revision:
3:be58f6801809
Parent:
0:389a44951c54
Update doc for srand_from_pubnub_time()

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sveljko 0:389a44951c54 1 /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */
sveljko 0:389a44951c54 2 #if !defined INC_PUBNUB_INTERNAL
sveljko 0:389a44951c54 3 #define INC_PUBNUB_INTERNAL
sveljko 0:389a44951c54 4
sveljko 0:389a44951c54 5
sveljko 0:389a44951c54 6 /* This is support for mbed 2 socket interface.
sveljko 0:389a44951c54 7 mbed 5 has a significantly different socket interface.
sveljko 0:389a44951c54 8 */
sveljko 0:389a44951c54 9
sveljko 0:389a44951c54 10 #include <TCPSocketConnection.h>
sveljko 0:389a44951c54 11
sveljko 0:389a44951c54 12
sveljko 0:389a44951c54 13 typedef TCPSocketConnection* pb_socket_t;
sveljko 0:389a44951c54 14
sveljko 0:389a44951c54 15 #define socket_close(socket) (socket)->close()
sveljko 0:389a44951c54 16 #define socket_send(socket, buf, len, flags) (socket)->send((buf), (len))
sveljko 0:389a44951c54 17 #define socket_recv(socket, buf, len, flags) (socket)->receive((buf), (len))
sveljko 0:389a44951c54 18
sveljko 0:389a44951c54 19 #define socket_would_block() 0
sveljko 0:389a44951c54 20
sveljko 0:389a44951c54 21 #define socket_timed_out() 0
sveljko 0:389a44951c54 22
sveljko 0:389a44951c54 23 #define socket_platform_init() 0
sveljko 0:389a44951c54 24
sveljko 0:389a44951c54 25 #define SOCKET_INVALID NULL
sveljko 0:389a44951c54 26 #define SOCKET_ERROR -1
sveljko 0:389a44951c54 27
sveljko 0:389a44951c54 28 #define socket_is_connected(socket) (socket)->is_connected()
sveljko 0:389a44951c54 29
sveljko 0:389a44951c54 30 #define socket_set_rcv_timeout(socket, milliseconds) int dont_call_me_under_mbed_2[-1]
sveljko 0:389a44951c54 31
sveljko 0:389a44951c54 32
sveljko 0:389a44951c54 33 /** The Pubnub mbed 2 context */
sveljko 0:389a44951c54 34 struct pubnub_pal {
sveljko 0:389a44951c54 35 /** This is actually just a pointer. We need it to emulate the
sveljko 0:389a44951c54 36 BSD sockets for which socket is a handle (a sort of a pointer)
sveljko 0:389a44951c54 37 and you can write some value into it, like #SOCKET_INVALID.
sveljko 0:389a44951c54 38 */
sveljko 0:389a44951c54 39 pb_socket_t socket;
sveljko 0:389a44951c54 40
sveljko 0:389a44951c54 41 /** This is the real socket object, to which the #socket
sveljko 0:389a44951c54 42 points to when it's valid.
sveljko 0:389a44951c54 43 */
sveljko 0:389a44951c54 44 TCPSocketConnection socket_object;
sveljko 0:389a44951c54 45 };
sveljko 0:389a44951c54 46
sveljko 0:389a44951c54 47
sveljko 0:389a44951c54 48 /** On mbed2, one can set I/O to be blocking or non-blocking, though
sveljko 0:389a44951c54 49 how that actually works depends on the actual hardware and the
sveljko 0:389a44951c54 50 "driver".
sveljko 0:389a44951c54 51 */
sveljko 0:389a44951c54 52 #define PUBNUB_BLOCKING_IO_SETTABLE 1
sveljko 0:389a44951c54 53
sveljko 0:389a44951c54 54
sveljko 0:389a44951c54 55 #define PUBNUB_TIMERS_API 1
sveljko 0:389a44951c54 56
sveljko 0:389a44951c54 57
sveljko 0:389a44951c54 58
sveljko 0:389a44951c54 59 #include "pubnub_internal_common.h"
sveljko 0:389a44951c54 60
sveljko 0:389a44951c54 61
sveljko 0:389a44951c54 62
sveljko 0:389a44951c54 63 #endif /* !defined INC_PUBNUB_INTERNAL */