2 <node name="/Channel_Type_File_Transfer" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
4 Copyright (C) 2008 Collabora Limited
6 <tp:license xmlns="http://www.w3.org/1999/xhtml">
7 <p>This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.</p>
12 <p>This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.</p>
17 <p>You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</p>
21 <interface name="org.freedesktop.Telepathy.Channel.Type.FileTransfer.DRAFT"
22 tp:causes-havoc="experimental">
23 <tp:requires interface="org.freedesktop.Telepathy.Channel"/>
24 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
25 <p>A channel type for files offered for transferring. The
26 transmission of data between contacts is achieved by reading from
27 or writing to a socket. The type of the socket (local Unix, IPv4,
28 etc.) is decided on when the file transfer is offered or accepted.</p>
30 <p>The Telepathy client should connect to the socket or address that
31 the connection manager has set up and provided back to the clients
32 through the two methods.</p>
34 <ul><li>In order to send a file, one should request a FileTransfer
35 channel for a contact, and fill the mandatory properties
36 (<tp:member-ref>Filename</tp:member-ref>, and
37 <tp:member-ref>Size</tp:member-ref>). After these are set, one should
38 call <tp:member-ref>OfferFile</tp:member-ref> to offer the transfer to
41 <li>In order to receive an incoming file transfer, one should call
42 <tp:member-ref>AcceptFile</tp:member-ref> and then wait until the state
43 changes to Open. If the receiver is resuming a transfer then he or she
44 should set a non-zero Offset argument when calling
45 <tp:member-ref>AcceptFile</tp:member-ref>. When the state changes to Open,
46 the receiver must check the <tp:member-ref>InitialOffset</tp:member-ref>
47 property for a difference in offset from the requested value in
50 <p>If something goes wrong with the transfer,
51 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel.Close</tp:dbus-ref>
52 should be called on the channel.</p>
54 <p>The File channel type may be requested for handles of type
55 HANDLE_TYPE_CONTACT. If the channel is requested for any other
56 handle type then the behaviour is undefined.</p>
59 <property name="State" type="u" tp:type="File_Transfer_State"
60 access="read" tp:name-for-bindings="State">
61 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
62 <p>The state of the file transfer as described by the
63 File_Transfer_State enum.</p>
67 <property name="ContentType" type="s" access="read"
68 tp:name-for-bindings="Content_Type">
69 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
70 <p>The file's MIME type. This cannot change once the channel has
73 <p>This property is mandatory when requesting the channel with the
74 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
75 method. Protocols which do not have a content-type property with file
76 transfers should set this value to application/octet-stream.</p>
80 <property name="Filename" type="s" access="read"
81 tp:name-for-bindings="Filename">
82 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
83 <p>The name of the file on the sender's side. This is therefore given
84 as a suggested filename for the receiver. This cannot change
85 once the channel has been created.</p>
87 <p>This property should be the basename of the file being sent. For example,
88 if the sender sends the file /home/user/monkey.pdf then this property should
89 be set to monkey.pdf.</p>
91 <p>This property is mandatory when requesting the channel with the
92 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
93 method. This property cannot be empty and must be set to a sensible value.</p>
97 <property name="Size" type="t" access="read"
98 tp:name-for-bindings="Size">
99 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
100 <p>The size of the file. If this property is set, then the file
101 transfer is guaranteed to be this size. This cannot change once
102 the channel has been created.</p>
104 <p>When you are creating a channel with this property, its value
105 MUST be accurate and in bytes. However, when receiving a file, this
106 property still must be in bytes but might not be entirely accurate
109 <p>This property is mandatory when requesting the channel with the
110 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
111 method. If this property is UINT64_MAX, then its value is
116 <property name="ContentHashType" type="u" tp:type="File_Hash_Type"
117 access="read" tp:name-for-bindings="Content_Hash_Type">
118 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
119 <p>The type of the <tp:member-ref>ContentHash</tp:member-ref> property.</p>
121 <p>This property is optional when requesting the channel with the
122 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
123 method. However, if you wish to include the <tp:member-ref>ContentHash</tp:member-ref>
124 property you MUST also include this property. If you omit this property from a
125 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
126 method call then its value will be assumed to be File_Hash_Type_None.</p>
130 <property name="ContentHash" type="s" access="read"
131 tp:name-for-bindings="Content_Hash">
132 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
133 <p>Hash of the contents of the file transfer, of type described
134 in the value of the <tp:member-ref>ContentHashType</tp:member-ref>
137 <p>This property is optional when requesting the channel with the
138 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
139 method. Its value MUST correspond to the appropriate type of the
140 <tp:member-ref>ContentHashType</tp:member-ref> property. If the
141 ContentHashType property is not set, or set to File_Hash_Type_None,
142 then this property will not even be looked at.</p>
146 <property name="Description" type="s" access="read"
147 tp:name-for-bindings="Description">
148 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
149 <p>Description of the file transfer. This cannot change once the
150 channel has been created.</p>
152 <p>This property is optional when requesting the channel with the
153 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
154 method. If this property is an empty string, then its value is
159 <property name="Date" type="t" access="read"
160 tp:type="Unix_Timestamp64" tp:name-for-bindings="Date">
161 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
162 <p>The last modification time of the file being transferred. This
163 cannot change once the channel has been created</p>
165 <p>This property is optional when requesting the channel with the
166 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
171 <property name="AvailableSocketTypes" type="a{uau}"
172 tp:type="Supported_Socket_Map" access="read"
173 tp:name-for-bindings="Available_Socket_Types">
174 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
175 <p>A mapping from address types (members of Socket_Address_Type) to
176 arrays of access-control type (members of Socket_Access_Control)
177 that the connection manager supports for sockets with that
178 address type. For simplicity, if a CM supports offering a
179 particular type of file transfer, it is assumed to support accepting
182 <p>A typical value for a host that supports only Unix sockets:</p>
186 Socket_Address_Type_Unix:
187 [Socket_Access_Control_Localhost, Socket_Access_Control_Credentials]
188 Socket_Address_Type_Abstract_Unix:
189 [Socket_Access_Control_Localhost, Socket_Access_Control_Credentials]
195 <property name="TransferredBytes" type="t" access="read"
196 tp:name-for-bindings="Transferred_Bytes">
197 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
198 <p>The number of bytes that have been transferred at the time of
199 requesting the property. This will be updated as the file transfer
204 <property name="InitialOffset" type="t" access="read"
205 tp:name-for-bindings="Initial_Offset">
206 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
207 <p>The offset in bytes from where the file should be sent. This MUST
208 be checked by both the receiver and the sender after the state
209 becomes Open, but before any data is sent or received. Until the
210 state changes to Open, this property is undefined.</p>
212 <p>Before setting the <tp:member-ref>State</tp:member-ref> property to
213 Open, the connection manager MUST set the InitialOffset property,
216 <p>This property MUST NOT change after the state of the transfer has
221 <tp:enum name="File_Transfer_State" type="u">
222 <tp:enumvalue suffix="None" value="0">
224 An invalid state type used as a null value. This value MUST NOT
225 appear in the State property.
228 <tp:enumvalue suffix="Not_Offered" value="1">
230 The transfer is waiting for the local client to call the OfferFile
231 method, in order to offer a file to be transferred.
234 <tp:enumvalue suffix="Accepted" value="2">
236 The client has accepted the incoming file transfer, but the transfer
237 is not open. The client should now wait for the state to change to Open
238 and check the offset value.
241 <tp:enumvalue suffix="Local_Pending" value="3">
243 The file transfer is waiting to be accepted/closed locally.
246 <tp:enumvalue suffix="Remote_Pending" value="4">
248 The file transfer is waiting to be accepted/closed remotely.
251 <tp:enumvalue suffix="Open" value="5">
253 The file transfer is open for traffic.
256 <tp:enumvalue suffix="Completed" value="6">
258 The file transfer has been completed successfully.
261 <tp:enumvalue suffix="Cancelled" value="7">
263 The file transfer has been cancelled.
268 <tp:enum name="File_Transfer_State_Change_Reason" type="u">
269 <tp:enumvalue suffix="None" value="0">
271 No reason was specified.
274 <tp:enumvalue suffix="Requested" value="1">
276 The change in state was requested.
279 <tp:enumvalue suffix="Local_Stopped" value="1">
281 The file transfer was cancelled by the local user.
284 <tp:enumvalue suffix="Remote_Stopped" value="2">
286 The file transfer was cancelled by the remote user.
289 <tp:enumvalue suffix="Local_Error" value="3">
291 The file transfer was cancelled because of a local error.
294 <tp:enumvalue suffix="Remote_Error" value="4">
296 The file transfer was cancelled because of a remote error.
301 <tp:enum name="File_Hash_Type" type="u">
302 <tp:enumvalue suffix="None" value="0">
307 <tp:enumvalue suffix="MD5" value="1">
309 MD5 digest as a string of 32 ASCII hex digits.
312 <tp:enumvalue suffix="SHA1" value="2">
314 SHA1 digest as a string of ASCII hex digits.
317 <tp:enumvalue suffix="SHA256" value="3">
319 SHA256 digest as a string of ASCII hex digits.
324 <method name="AcceptFile" tp:name-for-bindings="Accept_File">
326 Accept a file transfer that's in the Local_Pending state. The file
327 transfer's state becomes Accepted after this method is called. At this
328 point, the receiver must wait for the state to change to Open, and then
329 <tp:member-ref>InitialOffset</tp:member-ref> should be checked in case
330 its value differs from the offset that was specified as an argument
333 <arg direction="in" name="Address_Type" type="u" tp:type="Socket_Address_Type">
335 The type of address the connection manager should listen on.
338 <arg direction="in" name="Access_Control" type="u" tp:type="Socket_Access_Control">
340 The type of access control the connection manager should apply to
344 <arg direction="in" name="Access_Control_Param" type="v">
346 A parameter for the access control type, to be interpreted as
347 specified in the documentation for the Socket_Access_Control enum.
350 <arg direction="in" name="Offset" type="t">
352 The desired offset in bytes where the file transfer should start.
353 The offset is taken from the beginning of the file. Specifying an
354 offset of zero will start the transfer from the beginning of the
355 file. The offset that is actually given in the
356 <tp:member-ref>InitialOffset</tp:member-ref> property can differ
357 from this argument where the requested offset is not supported.
358 (For example, some protocols do not support offsets at all so
359 the InitialOffset property will always be 0.)
362 <arg direction="out" name="Address" type="v">
364 The address on which the connection manager will listen for
365 connections for this file transfer.
370 <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented">
372 The given address type or access-control mechanism is not supported.
375 <tp:error name="org.freedesktop.Telepathy.Error.NetworkError"/>
376 <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
378 Your address type, access control, access control parameter,
379 offset, or a combination of all four is invalid.
381 <tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
383 The file transfer is not in the Local_Pending state, there isn't
384 or there is a local error with acquiring a socket.
387 </tp:possible-errors>
390 <method name="OfferFile" tp:name-for-bindings="Offer_File">
392 Offer a file transfer that's in the Not_Offered state. Open a socket
393 that the client can use to provide a file to the connection manager.
394 The channel MUST be in the Not_Offered state, and will change state
395 to Remote_Pending when this method is called.
397 <arg direction="in" name="Address_Type" type="u" tp:type="Socket_Address_Type">
399 The type of address the connection manager should listen on.
402 <arg direction="in" name="Access_Control" type="u" tp:type="Socket_Access_Control">
404 The type of access control the connection manager should apply to
408 <arg direction="in" name="Access_Control_Param" type="v">
410 A parameter for the access control type, to be interpreted as
411 specified in the documentation for the Socket_Access_Control enum.
414 <arg direction="out" name="Address" type="v">
416 The address on which the connection manager will listen for
417 connections for this file transfer.
422 <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented">
424 The given address type or access-control mechanism is not supported.
427 <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
429 Your address type, access control, access control parameter, or
430 a combination of all three is invalid.
432 <tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
434 The file transfer is not in the Not_Offered state, there isn't
435 enough information for the transfer to start, or a local error
436 with acquiring a socket.
439 </tp:possible-errors>
442 <signal name="FileTransferStateChanged"
443 tp:name-for-bindings="File_Transfer_State_Changed">
445 Emitted when the state of a file transfer changes.
447 <arg name="State" type="u" tp:type="File_Transfer_State">
449 The new state of the file transfer; see the File_Transfer_State enumeration.
452 <arg name="Reason" type="u" tp:type="File_Transfer_State_Change_Reason">
454 The reason for the state change; see the File_Transfer_State_Change_Reason
456 The value will always be File_Transfer_State_Change_Reason_None, except
457 when changing state to cancelled.
462 <signal name="TransferredBytesChanged"
463 tp:name-for-bindings="Transferred_Bytes_Changed">
465 Emitted when the number of transferred bytes changes. This will not be
466 signalled with every single byte change. Instead, the most frequent
467 this signal will be emitted is once a second. This should be
468 sufficient, and the <tp:member-ref>TransferredBytes</tp:member-ref>
469 property SHOULD NOT be polled.
471 <arg name="Count" type="t">
473 The number of already transferred bytes.
480 <!-- vim:set sw=2 sts=2 et ft=xml: -->