test

Fork of mbed-libxively-6eca970 by Xively Official

Committer:
xively
Date:
Wed Jun 26 10:40:43 2013 +0000
Revision:
0:82702e998d3f
libxively v0.1.1-rc0 (34c8b32)

Who changed what in which revision?

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