Xively Official / mbed-libxively-5d6fdd4

Dependents:   xively-jumpstart-demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers connection.h Source File

connection.h

Go to the documentation of this file.
00001 // Copyright (c) 2003-2013, LogMeIn, Inc. All rights reserved.
00002 // This is part of Xively C library, it is under the BSD 3-Clause license.
00003 
00004 /**
00005  * \file    connection.h
00006  * \author  Olgierd Humenczuk
00007  * \brief   Defines `connection_t`, which is used by the _communication layer_
00008  *
00009  *    It is designed to abstract from implementation- and/or platform- specific
00010  *    ways of storing connection info, such as host and port, as well as simple
00011  *    statistics counters. It also provides arbitary pointer to implementation's
00012  *    own strucutre.
00013  */
00014 
00015 #ifndef __CONNECTION_H__
00016 #define __CONNECTION_H__
00017 
00018 #include "stdlib.h"
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 /**
00025  * \brief   _The connection structure_ - holds data needed for further processing
00026  *          and error handling
00027  * 
00028  * It also contain `layer_specific` field which should point at the platform's
00029  * structure, according to the implementation of that specific _communication_
00030  * _layer_ and other implementation don't need to care about what that is.
00031  *
00032  * The purpose of that class is to give the abstract interface of a connection
00033  * that can be easly used with the `comm_layer_t` interface, so that it's possible
00034  * to send/receive data to/from the server through different communication layer
00035  * using the same interface.
00036  */
00037 typedef struct {
00038     void    *layer_specific; //!< here the layer can hide some layer specific data
00039     char    *address;        //!< here we store server's address
00040     int      port;           //!< here we store server's port
00041     size_t   bytes_sent;     //!< the data sent counter, just for testing and statistics
00042     size_t   bytes_received; //!< the data receive counter, just for tests and statistics
00043 } connection_t;
00044 
00045 #ifdef __cplusplus
00046 }
00047 #endif
00048 
00049 #endif // __CONNECTION_H__