libaria2cpp 0.2.0
Basic CPP library to connect to an ARIA2 daemon via the RPC interface.
ariadefs.h
1#ifndef ARIADEFS_H_
2#define ARIADEFS_H_
3#include <vector>
4#include <string>
5#include <jsonrpccpp/client/connectors/httpclient.h>
6
7
8using stringList = std::vector<std::string>;
9using namespace jsonrpc;
10
12using stringList = std::vector<std::string>;
13
14struct File
15{
17 std::string fileName;
19 std::string path;
21 size_t length;
24};
25
26
27enum class Status {
28 Active,
29 Waiting,
30 Error,
31 Paused,
32 Removed,
33 Complete,
34 Unknown
35};
36
37using filelist = std::vector<File>;
38
40{
55};
56
57struct Version
58{
60 std::string version;
62 stringList enabledFeatures;
63};
64
65enum class URIStatus {
66 used,
67 waiting
68};
69
70struct URI
71{
73 std::string uri;
75 URIStatus status;
76};
77
79{
80 /* Original URI. */
81 std::string uri;
82 /* This is the URI currently used for downloading. If
83 redirection is involved, currentUri and uri may
84 differ. */
85 std::string currentUri;
86 /* Download speed (byte/sec) */
87 int downloadSpeed;
88};
89
90struct Peer
91{
92 /* Percent-encoded peer ID.*/
93 std::string peerId;
94 /* IP address of the peer. */
95 std::string ip;
96 /* Port number of the peer. */
97 int port;
98 /* Hexadecimal representation of the download progress of
99 the peer. The highest bit corresponds to the piece at in‐
100 dex 0. Set bits indicate the piece is available and unset
101 bits indicate the piece is missing. Any spare bits at the
102 end are set to zero. */
103 std::string bitfield;
104 /* true if aria2 is choking the peer. Otherwise false. */
105 bool amChoking;
106 /* true if the peer is choking aria2. Otherwise false. */
107 bool peerChoking;
108 /* Download speed (byte/sec) that this client obtains from
109 the peer. */
110 int downloadSpeed;
111 /* Upload speed(byte/sec) that this client uploads to the
112 peer. */
113 int uploadSpeed;
114 /* true if this peer is a seeder. Otherwise false. */
115 bool seeder;
116};
117
119{
120 int fileIndex;
121 std::vector<ServerInfo> servers;
122};
123
124#endif //ARIADEFS_H_
Definition: ariadefs.h:15
size_t completedLength
Definition: ariadefs.h:23
size_t length
Definition: ariadefs.h:21
std::string fileName
Definition: ariadefs.h:17
std::string path
Definition: ariadefs.h:19
Definition: ariadefs.h:40
int numStoppedTotal
Definition: ariadefs.h:54
int numWaiting
Definition: ariadefs.h:48
int numStopped
Definition: ariadefs.h:51
float uploadSpeed
Definition: ariadefs.h:44
float downloadSpeed
Definition: ariadefs.h:42
int numActive
Definition: ariadefs.h:46
Definition: ariadefs.h:91
Definition: ariadefs.h:79
Definition: ariadefs.h:119
Definition: ariadefs.h:71
std::string uri
Definition: ariadefs.h:73
URIStatus status
Definition: ariadefs.h:75
Definition: ariadefs.h:58
std::string version
Definition: ariadefs.h:60
stringList enabledFeatures
Definition: ariadefs.h:62