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