author | Nicolas Cornu <nicolas.cornu@ensi-bourges.fr> |
Mon, 16 Aug 2010 23:36:49 +0200 | |
changeset 138 | dde8eaf7ff2c |
parent 133 | 361d8577ebd1 |
permissions | -rw-r--r-- |
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
1 |
#ifndef __JINGLEFT_H__ |
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
2 |
#define __JINGLEFT_H__ 1 |
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
3 |
|
138 | 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 |
||
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
11 |
#define NS_JINGLE_APP_FT "urn:xmpp:jingle:apps:file-transfer:1" |
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
12 |
#define NS_JINGLE_APP_FT_INFO "urn:xmpp:jingle:apps:file-transfer:info:1" |
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
13 |
#define NS_SI_FT "http://jabber.org/protocol/si/profile/file-transfer" |
123
58bd57666ef9
Add a end function to transport
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
102
diff
changeset
|
14 |
#define JINGLE_FT_SIZE_READ 2048 |
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
15 |
|
138 | 16 |
/** |
17 |
* \enum JingleFTType |
|
18 |
* \brief type of the content |
|
19 |
*/ |
|
71 | 20 |
typedef enum { |
21 |
JINGLE_FT_OFFER, |
|
22 |
JINGLE_FT_REQUEST, |
|
23 |
} JingleFTType; |
|
24 |
||
138 | 25 |
/** |
26 |
* \enum JingleFTDirection |
|
27 |
* \brief Direction of the file |
|
28 |
*/ |
|
131
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
29 |
typedef enum { |
138 | 30 |
JINGLE_FT_INCOMING, /*!< We download the file */ |
31 |
JINGLE_FT_OUTGOING /*!< We upload the file */ |
|
131
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
32 |
} JingleFTDirection; |
133
361d8577ebd1
Change the way IBB work
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
131
diff
changeset
|
33 |
|
138 | 34 |
/** |
35 |
* \enum JingleFTState |
|
36 |
* \brief state of the file |
|
37 |
*/ |
|
133
361d8577ebd1
Change the way IBB work
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
131
diff
changeset
|
38 |
typedef enum { |
138 | 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 */ |
|
133
361d8577ebd1
Change the way IBB work
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
131
diff
changeset
|
44 |
} JingleFTState; |
361d8577ebd1
Change the way IBB work
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
131
diff
changeset
|
45 |
|
138 | 46 |
/** |
47 |
* \struct JingleFT |
|
48 |
* \brief represent the file transfer himself |
|
49 |
*/ |
|
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
50 |
typedef struct { |
138 | 51 |
/** |
52 |
* the last modification of the file, optional |
|
53 |
*/ |
|
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
54 |
time_t date; |
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
55 |
|
138 | 56 |
/** |
57 |
* MD5 hash of the file, optional |
|
58 |
*/ |
|
53
64a47491c068
Add a function to handle incoming data in the filetransfert module.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
49
diff
changeset
|
59 |
gchar *hash; |
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
60 |
|
138 | 61 |
/** |
62 |
* the name of the file that the sender wishes to send |
|
63 |
*/ |
|
53
64a47491c068
Add a function to handle incoming data in the filetransfert module.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
49
diff
changeset
|
64 |
gchar *name; |
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
65 |
|
138 | 66 |
/** |
67 |
* the size, in bytes, of the data to be sent |
|
68 |
*/ |
|
88
8b12ebd75c1a
Change the size to an guint64 and use the G_GUINT64_FORMAT.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
71
diff
changeset
|
69 |
guint64 size; |
53
64a47491c068
Add a function to handle incoming data in the filetransfert module.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
49
diff
changeset
|
70 |
|
138 | 71 |
/** |
72 |
* Data already send/receive |
|
73 |
*/ |
|
127
02dde03e219b
remove xmlns() in transports
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
123
diff
changeset
|
74 |
guint64 transmit; |
02dde03e219b
remove xmlns() in transports
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
123
diff
changeset
|
75 |
|
138 | 76 |
/** |
77 |
* descriptor to the output file |
|
78 |
*/ |
|
53
64a47491c068
Add a function to handle incoming data in the filetransfert module.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
49
diff
changeset
|
79 |
GIOChannel *outfile; |
71 | 80 |
|
138 | 81 |
/** |
82 |
* Is it an offer or a request ? |
|
83 |
*/ |
|
71 | 84 |
JingleFTType type; |
85 |
||
138 | 86 |
/** |
87 |
* Is it if the file is incoming or outgoing |
|
88 |
*/ |
|
131
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
89 |
JingleFTDirection dir; |
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
90 |
|
138 | 91 |
/** |
92 |
* The state of the file (PENDING, STARTING, ...) |
|
93 |
*/ |
|
133
361d8577ebd1
Change the way IBB work
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
131
diff
changeset
|
94 |
JingleFTState state; |
361d8577ebd1
Change the way IBB work
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
131
diff
changeset
|
95 |
|
138 | 96 |
/** |
97 |
* A little description of the transfer |
|
98 |
*/ |
|
71 | 99 |
gchar *desc; |
100 |
||
138 | 101 |
/** |
102 |
* Where we compute the hash |
|
103 |
*/ |
|
102 | 104 |
GChecksum *md5; |
105 |
||
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
106 |
} JingleFT; |
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
107 |
|
138 | 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 |
*/ |
|
131
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
115 |
typedef struct { |
138 | 116 |
/** |
117 |
* An index. Not use now, but will in the futur to cancel a transfer. |
|
118 |
*/ |
|
131
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
119 |
int index; |
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
120 |
|
138 | 121 |
/** |
122 |
* The link to the JingleFT in the session. |
|
123 |
*/ |
|
131
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
124 |
JingleFT *jft; |
943c3f938cb4
JFT: add a command info
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
127
diff
changeset
|
125 |
} JingleFTInfo; |
21
147f131382dd
Some sessions management code.
Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
parents:
diff
changeset
|
126 |
#endif |