|
1 #ifndef __JINGLEFT_H__ |
|
2 #define __JINGLEFT_H__ 1 |
|
3 |
|
4 /** |
|
5 * \file filetransfer.h |
|
6 * \brief The main file of app-module to the file transfer XEP 234 |
|
7 * \author Nicolas Cornu |
|
8 * \version 0.1 |
|
9 */ |
|
10 |
|
11 #define NS_JINGLE_APP_FT "urn:xmpp:jingle:apps:file-transfer:1" |
|
12 #define NS_JINGLE_APP_FT_INFO "urn:xmpp:jingle:apps:file-transfer:info:1" |
|
13 #define NS_SI_FT "http://jabber.org/protocol/si/profile/file-transfer" |
|
14 #define JINGLE_FT_SIZE_READ 2048 |
|
15 |
|
16 /** |
|
17 * \enum JingleFTType |
|
18 * \brief type of the content |
|
19 */ |
|
20 typedef enum { |
|
21 JINGLE_FT_OFFER, |
|
22 JINGLE_FT_REQUEST, |
|
23 } JingleFTType; |
|
24 |
|
25 /** |
|
26 * \enum JingleFTDirection |
|
27 * \brief Direction of the file |
|
28 */ |
|
29 typedef enum { |
|
30 JINGLE_FT_INCOMING, /*!< We download the file */ |
|
31 JINGLE_FT_OUTGOING /*!< We upload the file */ |
|
32 } JingleFTDirection; |
|
33 |
|
34 /** |
|
35 * \enum JingleFTState |
|
36 * \brief state of the file |
|
37 */ |
|
38 typedef enum { |
|
39 JINGLE_FT_PENDING, /*!< The file isn't yet accepted by the both parts */ |
|
40 JINGLE_FT_STARTING, /*!< The file is transfering */ |
|
41 JINGLE_FT_ENDING, /*!< The file has been transfered */ |
|
42 JINGLE_FT_REJECT, /*!< The transfer has been refused */ |
|
43 JINGLE_FT_ERROR /*!< And error occured during the transfer */ |
|
44 } JingleFTState; |
|
45 |
|
46 /** |
|
47 * \struct JingleFT |
|
48 * \brief represent the file transfer himself |
|
49 */ |
|
50 typedef struct { |
|
51 /** |
|
52 * the last modification of the file, optional |
|
53 */ |
|
54 time_t date; |
|
55 |
|
56 /** |
|
57 * MD5 hash of the file, optional |
|
58 */ |
|
59 gchar *hash; |
|
60 |
|
61 /** |
|
62 * the name of the file that the sender wishes to send |
|
63 */ |
|
64 gchar *name; |
|
65 |
|
66 /** |
|
67 * the size, in bytes, of the data to be sent |
|
68 */ |
|
69 guint64 size; |
|
70 |
|
71 /** |
|
72 * Data already send/receive |
|
73 */ |
|
74 guint64 transmit; |
|
75 |
|
76 /** |
|
77 * descriptor to the output file |
|
78 */ |
|
79 GIOChannel *outfile; |
|
80 |
|
81 /** |
|
82 * Is it an offer or a request ? |
|
83 */ |
|
84 JingleFTType type; |
|
85 |
|
86 /** |
|
87 * Is it if the file is incoming or outgoing |
|
88 */ |
|
89 JingleFTDirection dir; |
|
90 |
|
91 /** |
|
92 * The state of the file (PENDING, STARTING, ...) |
|
93 */ |
|
94 JingleFTState state; |
|
95 |
|
96 /** |
|
97 * A little description of the transfer |
|
98 */ |
|
99 gchar *desc; |
|
100 |
|
101 /** |
|
102 * Where we compute the hash |
|
103 */ |
|
104 GChecksum *md5; |
|
105 |
|
106 } JingleFT; |
|
107 |
|
108 /** |
|
109 * \struct JingleFTInfo |
|
110 * \brief contain only a link to the gconstpointer |
|
111 * |
|
112 * We keep localy a list of all the files transfered to print infos |
|
113 * |
|
114 */ |
|
115 typedef struct { |
|
116 /** |
|
117 * An index. Not use now, but will in the futur to cancel a transfer. |
|
118 */ |
|
119 int index; |
|
120 |
|
121 /** |
|
122 * The link to the JingleFT in the session. |
|
123 */ |
|
124 JingleFT *jft; |
|
125 } JingleFTInfo; |
|
126 #endif |