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>A socket approach is used to make the transfer less dependent on both
31 client and connection manager knowing the same protocols. As an example,
32 when browsing an SMB share in a file manager, one selects "Send file"
33 and chooses a contact. Instead of passing a URL which would then require
34 the connection manager to connect to the SMB share itself, the client
35 passes a stream from which the connection manager reads, requiring no
36 further connection to the share. It also allows connection managers to
37 be more restricted in their access to the system, allowing tighter
38 security policies with eg SElinux, or more flexible deployments which
39 cross user or system boundaries.</p>
41 <p>If the connection manager relies on a library using file path only for
42 file transfers, it can use the Socket_Address_Type_Local_Path
43 <tp:type>Socket_Address_Type</tp:type>. In that case the file will be
44 read and written directly by the CM.</p>
46 <p>The Telepathy client should connect to the socket or address that
47 the connection manager has set up and provided back to the clients
48 through the two methods.</p>
50 <ul><li>In order to send a file, one should request a FileTransfer
51 channel for a contact, including at least the mandatory properties
52 (<tp:member-ref>Filename</tp:member-ref>,
53 <tp:member-ref>Size</tp:member-ref> and <tp:member-ref>ContentType</tp:member-ref>).
55 call <tp:member-ref>ProvideFile</tp:member-ref> to configure the socket that
56 will be used to transfer the file.</li>
58 <li>In order to receive an incoming file transfer, one should call
59 <tp:member-ref>AcceptFile</tp:member-ref> and then wait until the state
60 changes to Open. When the receiver wants to resume a transfer, the Offset
61 argument should be should be set to a non-zero value when calling
62 <tp:member-ref>AcceptFile</tp:member-ref>.</li>
64 <li>Once the offset has been negotiated, the
65 <tp:member-ref>InitialOffsetDefined</tp:member-ref> signal
66 is emitted and the <tp:member-ref>InitialOffset</tp:member-ref> property
67 is defined. The <tp:member-ref>InitialOffsetDefined</tp:member-ref>
68 signal is emitted before channel becomes Open.
69 The receiver MUST check the value of
70 <tp:member-ref>InitialOffset</tp:member-ref> for a difference in offset
71 from the requested value in AcceptFile.</li>
73 <li>When the state changes to Open, Clients can start the transfer of the
74 file using the offset previously announced.
77 <p>If something goes wrong with the transfer,
78 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel.Close</tp:dbus-ref>
79 should be called on the channel.</p>
81 <p>The File channel type may be requested for handles of type
82 HANDLE_TYPE_CONTACT. If the channel is requested for any other
83 handle type then the behaviour is undefined.</p>
86 <property name="State" type="u" tp:type="File_Transfer_State"
87 access="read" tp:name-for-bindings="State">
88 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
89 <p>The state of the file transfer as described by the
90 File_Transfer_State enum.</p>
94 <property name="ContentType" type="s" access="read"
95 tp:name-for-bindings="Content_Type">
96 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
97 <p>The file's MIME type. This cannot change once the channel has
100 <p>This property is mandatory when requesting the channel with the
101 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
102 method. Protocols which do not have a content-type property with file
103 transfers should set this value to application/octet-stream.</p>
107 <property name="Filename" type="s" access="read"
108 tp:name-for-bindings="Filename">
109 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
110 <p>The name of the file on the sender's side. This is therefore given
111 as a suggested filename for the receiver. This cannot change
112 once the channel has been created.</p>
114 <p>This property should be the basename of the file being sent. For example,
115 if the sender sends the file /home/user/monkey.pdf then this property should
116 be set to monkey.pdf.</p>
118 <p>This property is mandatory when requesting the channel with the
119 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
120 method. This property cannot be empty and MUST be set to a sensible value.</p>
124 <property name="Size" type="t" access="read"
125 tp:name-for-bindings="Size">
126 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
127 <p>The size of the file. If this property is set, then the file
128 transfer is guaranteed to be this size. This cannot change once
129 the channel has been created.</p>
131 <p>When you are creating a channel with this property, its value
132 MUST be accurate and in bytes. However, when receiving a file, this
133 property still MUST be in bytes but might not be entirely accurate
136 <p>This property is mandatory when requesting the channel with the
137 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
138 method. If this information isn't provided in the protocol, connection managers MUST set it
143 <property name="ContentHashType" type="u" tp:type="File_Hash_Type"
144 access="read" tp:name-for-bindings="Content_Hash_Type">
145 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
146 <p>The type of the <tp:member-ref>ContentHash</tp:member-ref> property.</p>
148 <p>This property is optional when requesting the channel with the
149 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
150 method. However, if you wish to include the <tp:member-ref>ContentHash</tp:member-ref>
151 property you MUST also include this property. If you omit this property from a
152 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
153 method call then its value will be assumed to be File_Hash_Type_None.</p>
157 <property name="ContentHash" type="s" access="read"
158 tp:name-for-bindings="Content_Hash">
159 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
160 <p>Hash of the contents of the file transfer, of type described
161 in the value of the <tp:member-ref>ContentHashType</tp:member-ref>
164 <p>This property is optional when requesting the channel with the
165 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
166 method. Its value MUST correspond to the appropriate type of the
167 <tp:member-ref>ContentHashType</tp:member-ref> property. If the
168 ContentHashType property is not set, or set to File_Hash_Type_None,
169 then this property will not even be looked at.</p>
173 <property name="Description" type="s" access="read"
174 tp:name-for-bindings="Description">
175 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
176 <p>Description of the file transfer. This cannot change once the
177 channel has been created.</p>
179 <p>This property is optional when requesting the channel with the
180 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
181 method. If this property was not provided by the remote party, connection managers MUST set it to
182 the empty string.</p>
186 <property name="Date" type="t" access="read"
187 tp:type="Unix_Timestamp64" tp:name-for-bindings="Date">
188 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
189 <p>The last modification time of the file being transferred. This
190 cannot change once the channel has been created</p>
192 <p>This property is optional when requesting the channel with the
193 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
198 <property name="AvailableSocketTypes" type="a{uau}"
199 tp:type="Supported_Socket_Map" access="read"
200 tp:name-for-bindings="Available_Socket_Types">
201 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
202 <p>A mapping from address types (members of Socket_Address_Type) to
203 arrays of access-control type (members of Socket_Access_Control)
204 that the connection manager supports for sockets with that
205 address type. For simplicity, if a CM supports offering a
206 particular type of file transfer, it is assumed to support accepting
209 <p>A typical value for a host that supports only Unix sockets:</p>
213 Socket_Address_Type_Unix:
214 [Socket_Access_Control_Localhost, Socket_Access_Control_Credentials]
215 Socket_Address_Type_Abstract_Unix:
216 [Socket_Access_Control_Localhost, Socket_Access_Control_Credentials]
222 <property name="TransferredBytes" type="t" access="read"
223 tp:name-for-bindings="Transferred_Bytes">
224 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
225 <p>The number of bytes that have been transferred at the time of
226 requesting the property. This will be updated as the file transfer
231 <property name="InitialOffset" type="t" access="read"
232 tp:name-for-bindings="Initial_Offset">
233 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
234 <p>The offset in bytes from where the file should be sent. This MUST
235 be respected by both the receiver and the sender after the state
236 becomes Open, but before any data is sent or received. Until the
237 <tp:member-ref>InitialOffsetDefined</tp:member-ref> signal
238 is emitted, this property is undefined.</p>
240 <p>Before setting the <tp:member-ref>State</tp:member-ref> property to
241 Open, the connection manager MUST set the InitialOffset property,
244 <p>This property MUST NOT change after the state of the transfer has
249 <tp:enum name="File_Transfer_State" type="u">
250 <tp:enumvalue suffix="None" value="0">
252 An invalid state type used as a null value. This value MUST NOT
253 appear in the State property.
256 <tp:enumvalue suffix="Pending" value="1">
258 The file transfer is waiting to be accepted/closed by the receiver.
259 The receiver has to call <tp:member-ref>AcceptFile</tp:member-ref>,
260 then wait for the state to change to Open and check the offset value.
263 <tp:enumvalue suffix="Accepted" value="2">
265 The receiver has accepted the transfer. The sender now has to
266 call <tp:member-ref>ProvideFile</tp:member-ref> to actually start the transfer.
267 The receiver should now wait for the state to change to Open
268 and check the offset value.
271 <tp:enumvalue suffix="Open" value="3">
273 The file transfer is open for traffic.
276 <tp:enumvalue suffix="Completed" value="4">
278 The file transfer has been completed successfully.
281 <tp:enumvalue suffix="Cancelled" value="5">
283 The file transfer has been cancelled.
288 <tp:enum name="File_Transfer_State_Change_Reason" type="u">
289 <tp:enumvalue suffix="None" value="0">
291 No reason was specified.
294 <tp:enumvalue suffix="Requested" value="1">
296 The change in state was requested.
299 <tp:enumvalue suffix="Local_Stopped" value="2">
301 The file transfer was cancelled by the local user.
304 <tp:enumvalue suffix="Remote_Stopped" value="3">
306 The file transfer was cancelled by the remote user.
309 <tp:enumvalue suffix="Local_Error" value="4">
311 The file transfer was cancelled because of a local error.
314 <tp:enumvalue suffix="Remote_Error" value="5">
316 The file transfer was cancelled because of a remote error.
321 <tp:enum name="File_Hash_Type" type="u">
322 <tp:enumvalue suffix="None" value="0">
327 <tp:enumvalue suffix="MD5" value="1">
329 MD5 digest as a string of 32 ASCII hex digits.
332 <tp:enumvalue suffix="SHA1" value="2">
334 SHA1 digest as a string of ASCII hex digits.
337 <tp:enumvalue suffix="SHA256" value="3">
339 SHA256 digest as a string of ASCII hex digits.
344 <method name="AcceptFile" tp:name-for-bindings="Accept_File">
346 Accept a file transfer that's in the Pending state. The file
347 transfer's state becomes Accepted after this method is called.
348 At this point the client can connect to the socket. CM MUST emit
349 <tp:member-ref>InitialOffsetDefined</tp:member-ref> and change
350 the state to Open before writing to the socket.
351 Then <tp:member-ref>InitialOffset</tp:member-ref> should be respected in case
352 its value differs from the offset that was specified as an argument
355 <arg direction="in" name="Address_Type" type="u" tp:type="Socket_Address_Type">
357 The type of address the connection manager should listen on.
360 <arg direction="in" name="Access_Control" type="u" tp:type="Socket_Access_Control">
362 The type of access control the connection manager should apply to
366 <arg direction="in" name="Access_Control_Param" type="v">
368 A parameter for the access control type, to be interpreted as
369 specified in the documentation for the Socket_Access_Control enum.
372 <arg direction="in" name="Offset" type="t">
374 The desired offset in bytes where the file transfer should start.
375 The offset is taken from the beginning of the file. Specifying an
376 offset of zero will start the transfer from the beginning of the
377 file. The offset that is actually given in the
378 <tp:member-ref>InitialOffset</tp:member-ref> property can differ
379 from this argument where the requested offset is not supported.
380 (For example, some protocols do not support offsets at all so
381 the InitialOffset property will always be 0.)
384 <arg direction="out" name="Address" type="v">
386 The address on which the connection manager will listen for
387 connections for this file transfer.
392 <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented">
394 The given address type or access-control mechanism is not supported.
397 <tp:error name="org.freedesktop.Telepathy.Error.NetworkError"/>
398 <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
400 Your address type, access control, access control parameter,
401 offset, or a combination of all four is invalid.
403 <tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
405 The file transfer is not in the Pending state, there isn't
406 or there is a local error with acquiring a socket.
409 </tp:possible-errors>
412 <method name="ProvideFile" tp:name-for-bindings="Provide_File">
414 Provide the file for an outgoing file transfer which has been offered.
415 Opens a socket that the client can use to provide a file to the connection manager.
416 The channel MUST have been requested, and will change state
417 to Open when this method is called if its state was Accepted.
419 <arg direction="in" name="Address_Type" type="u" tp:type="Socket_Address_Type">
421 The type of address the connection manager should listen on.
424 <arg direction="in" name="Access_Control" type="u" tp:type="Socket_Access_Control">
426 The type of access control the connection manager should apply to
430 <arg direction="in" name="Access_Control_Param" type="v">
432 A parameter for the access control type, to be interpreted as
433 specified in the documentation for the Socket_Access_Control enum.
436 <arg direction="out" name="Address" type="v">
438 The address on which the connection manager will listen for
439 connections for this file transfer.
444 <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented">
446 The given address type or access-control mechanism is not supported.
449 <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
451 Your address type, access control, access control parameter, or
452 a combination of all three is invalid.
454 <tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
456 Channel is not an outgoing transfer, ProvideFile has already been called,
457 or there was a local error acquiring the socket.
460 </tp:possible-errors>
463 <signal name="FileTransferStateChanged"
464 tp:name-for-bindings="File_Transfer_State_Changed">
466 Emitted when the state of a file transfer changes.
468 <arg name="State" type="u" tp:type="File_Transfer_State">
470 The new state of the file transfer; see the File_Transfer_State enumeration.
473 <arg name="Reason" type="u" tp:type="File_Transfer_State_Change_Reason">
475 The reason for the state change; see the File_Transfer_State_Change_Reason
477 The value will always be File_Transfer_State_Change_Reason_None, except
478 when changing state to cancelled.
483 <signal name="TransferredBytesChanged"
484 tp:name-for-bindings="Transferred_Bytes_Changed">
486 Emitted when the number of transferred bytes changes. This will not be
487 signalled with every single byte change. Instead, the most frequent
488 this signal will be emitted is once a second. This should be
489 sufficient, and the <tp:member-ref>TransferredBytes</tp:member-ref>
490 property SHOULD NOT be polled.
492 <arg name="Count" type="t">
494 The number of already transferred bytes.
499 <signal name="InitialOffsetDefined"
500 tp:name-for-bindings="Initial_Offset_Defined">
502 Emitted when the value of the <tp:member-ref>InitialOffset</tp:member-ref>
503 property has been negotiated. This signal MUST be emitted before the channel
504 becomes Open and clients have to use this offset when transferring the
507 <arg name="InitialOffset" type="t">
509 The value of the <tp:member-ref>InitialOffset</tp:member-ref> property.
517 <!-- vim:set sw=2 sts=2 et ft=xml: -->