aboutsummaryrefslogtreecommitdiffstats
path: root/src/libdash/include/IConnection.h
blob: 4150d562871d5a487fd746039fa3637491a591a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
 *  @class      dash::network::IConnection
 *  @brief      The connection interface can be used to enable the download of segments through external connections.
 *  @details    This interface enables the extension of libdash to download segment through, e.g., SPDY, CCN etc.
 *  @see        dash::network::IChunk
 *
 *  @author     bitmovin Softwareentwicklung OG \n
 *              Email: libdash-dev@vicky.bitmovin.net
 *  @version    2.1
 *  @date       2013
 *  @copyright  bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
 *              This source code and its use and distribution, is subject to the terms
 *              and conditions of the applicable license agreement.
 */

#ifndef ICONNECTION_H_
#define ICONNECTION_H_

#include "config.h"

#include "IChunk.h"
#include "IDASHMetrics.h"

namespace dash
{
    namespace network
    {
        class IConnection : public virtual dash::metrics::IDASHMetrics
        {
            public:
                virtual ~IConnection(){}

                /**
                 *  This function should read a block of bytes from the specified chunk.
                 *  @param      data    pointer to a block of memory
                 *  @param      len     size of the memory block that can be used by the method
                 *  @param      chunk   the dash::network::IChunk object from which data should be read
                 *  @return     amount of data that has been read
                 */
                virtual int Read (uint8_t *data, size_t len, IChunk *chunk)  = 0;

                /**
                 *  This function should peek a block of bytes from the specified chunk.
                 *  @param      data    pointer to a block of memory
                 *  @param      len     size of the memory block that can be used by the method
                 *  @param      chunk   the dash::network::IChunk object from which data should be peeked
                 *  @return     amount of data that has been peeked
                 */
                virtual int Peek (uint8_t *data, size_t len, IChunk *chunk)  = 0;

                /**
                *  This function should get the average speed of download for the specified chunk.
                *  It should be called after the whole chunk has been downloaded.
                *  @return     average speed of download in bps.
                */
                virtual double GetAverageDownloadingSpeed ()				= 0;

                /**
                *  This function should get the time taken for the download of the specified chunk.
                *  It should be called after the whole chunk has been downloaded.
                *  @return     average time of download in seconds.
                */
                virtual double GetDownloadingTime ()				= 0;

        };
    }
}

#endif /* ICONNECTION_H_ */