liblightify
|
Typedefs | |
typedef int(* | write_to_socket_fn) (struct lightify_ctx *ctx, unsigned char *msg, size_t size) |
typedef int(* | read_from_socket_fn) (struct lightify_ctx *ctx, unsigned char *msg, size_t size) |
Functions | |
int | lightify_skt_setfd (struct lightify_ctx *ctx, int socket) |
int | lightify_skt_getfd (struct lightify_ctx *ctx) |
int | lightify_skt_setiotimeout (struct lightify_ctx *ctx, struct timeval tv) |
struct timeval | lightify_skt_getiotimeout (struct lightify_ctx *ctx) |
typedef int(* read_from_socket_fn) (struct lightify_ctx *ctx, unsigned char *msg, size_t size) |
callback to roll your own I/O: Reading
if the default is overriden, this function is called whenever the library wants to read from the gateway.
ctx | library context |
msg | where to place the received bytes |
size | how much to read. Do not read more than this! |
Definition at line 167 of file liblightify.h.
typedef int(* write_to_socket_fn) (struct lightify_ctx *ctx, unsigned char *msg, size_t size) |
callback to roll your own I/O: Writing
if the default function is overriden, this function is called whenever the library wants to talk to the gateway.
ctx | library context |
msg | what to write |
size | how much to write |
Definition at line 149 of file liblightify.h.
int lightify_skt_getfd | ( | struct lightify_ctx * | ctx | ) |
get the socket fd to be used for communication.
ctx |
struct timeval lightify_skt_getiotimeout | ( | struct lightify_ctx * | ctx | ) |
Get the current timeout set.
ctx |
int lightify_skt_setfd | ( | struct lightify_ctx * | ctx, |
int | socket | ||
) |
set the socket fd to be used for communication.
When using the default I/O functions read_from_socket() and write_to_socket(), the lib expects a ready-to-use socket supplied by the application. It is safe to use non-blocking I/O.
To unset the fd, pass -1.
ctx | contect |
socket | file descriptor to be used or -1 to unset |
int lightify_skt_setiotimeout | ( | struct lightify_ctx * | ctx, |
struct timeval | tv | ||
) |
set timeout to be used for socket communication.
ctx | library context |
tv | timout to be used |