Xively C library
Dependents: xively-jumpstart-demo
This is Xively C library, the code lives on GitHub.
See our example program and the tutorial, documentation can bee found here.
src/libxively/connection.h@0:53753690a8bf, 2013-05-13 (annotated)
- Committer:
- xively
- Date:
- Mon May 13 19:28:22 2013 +0000
- Revision:
- 0:53753690a8bf
libxively v0.1.1-rc0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xively | 0:53753690a8bf | 1 | // Copyright (c) 2003-2013, LogMeIn, Inc. All rights reserved. |
xively | 0:53753690a8bf | 2 | // This is part of Xively C library, it is under the BSD 3-Clause license. |
xively | 0:53753690a8bf | 3 | |
xively | 0:53753690a8bf | 4 | /** |
xively | 0:53753690a8bf | 5 | * \file connection.h |
xively | 0:53753690a8bf | 6 | * \author Olgierd Humenczuk |
xively | 0:53753690a8bf | 7 | * \brief Defines `connection_t`, which is used by the _communication layer_ |
xively | 0:53753690a8bf | 8 | * |
xively | 0:53753690a8bf | 9 | * It is designed to abstract from implementation- and/or platform- specific |
xively | 0:53753690a8bf | 10 | * ways of storing connection info, such as host and port, as well as simple |
xively | 0:53753690a8bf | 11 | * statistics counters. It also provides arbitary pointer to implementation's |
xively | 0:53753690a8bf | 12 | * own strucutre. |
xively | 0:53753690a8bf | 13 | */ |
xively | 0:53753690a8bf | 14 | |
xively | 0:53753690a8bf | 15 | #ifndef __CONNECTION_H__ |
xively | 0:53753690a8bf | 16 | #define __CONNECTION_H__ |
xively | 0:53753690a8bf | 17 | |
xively | 0:53753690a8bf | 18 | #include "stdlib.h" |
xively | 0:53753690a8bf | 19 | |
xively | 0:53753690a8bf | 20 | #ifdef __cplusplus |
xively | 0:53753690a8bf | 21 | extern "C" { |
xively | 0:53753690a8bf | 22 | #endif |
xively | 0:53753690a8bf | 23 | |
xively | 0:53753690a8bf | 24 | /** |
xively | 0:53753690a8bf | 25 | * \brief _The connection structure_ - holds data needed for further processing |
xively | 0:53753690a8bf | 26 | * and error handling |
xively | 0:53753690a8bf | 27 | * |
xively | 0:53753690a8bf | 28 | * It also contain `layer_specific` field which should point at the platform's |
xively | 0:53753690a8bf | 29 | * structure, according to the implementation of that specific _communication_ |
xively | 0:53753690a8bf | 30 | * _layer_ and other implementation don't need to care about what that is. |
xively | 0:53753690a8bf | 31 | * |
xively | 0:53753690a8bf | 32 | * The purpose of that class is to give the abstract interface of a connection |
xively | 0:53753690a8bf | 33 | * that can be easly used with the `comm_layer_t` interface, so that it's possible |
xively | 0:53753690a8bf | 34 | * to send/receive data to/from the server through different communication layer |
xively | 0:53753690a8bf | 35 | * using the same interface. |
xively | 0:53753690a8bf | 36 | */ |
xively | 0:53753690a8bf | 37 | typedef struct { |
xively | 0:53753690a8bf | 38 | void *layer_specific; //!< here the layer can hide some layer specific data |
xively | 0:53753690a8bf | 39 | char *address; //!< here we store server's address |
xively | 0:53753690a8bf | 40 | int port; //!< here we store server's port |
xively | 0:53753690a8bf | 41 | size_t bytes_sent; //!< the data sent counter, just for testing and statistics |
xively | 0:53753690a8bf | 42 | size_t bytes_received; //!< the data receive counter, just for tests and statistics |
xively | 0:53753690a8bf | 43 | } connection_t; |
xively | 0:53753690a8bf | 44 | |
xively | 0:53753690a8bf | 45 | #ifdef __cplusplus |
xively | 0:53753690a8bf | 46 | } |
xively | 0:53753690a8bf | 47 | #endif |
xively | 0:53753690a8bf | 48 | |
xively | 0:53753690a8bf | 49 | #endif // __CONNECTION_H__ |