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 transferring files. 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>The Telepathy client should connect to the socket or address that
42 the connection manager has set up and provided back to the clients
43 through the two methods.</p>
45 <ul><li>In order to send a file, one should request a FileTransfer
46 channel for a contact, including at least the mandatory properties
47 (<tp:member-ref>Filename</tp:member-ref>,
48 <tp:member-ref>Size</tp:member-ref> and <tp:member-ref>ContentType</tp:member-ref>).
50 call <tp:member-ref>ProvideFile</tp:member-ref> to configure the socket that
51 will be used to transfer the file.</li>
53 <li>In order to receive an incoming file transfer, one should call
54 <tp:member-ref>AcceptFile</tp:member-ref> and then wait until the state
55 changes to Open. When the receiver wants to resume a transfer, the Offset
56 argument should be should be set to a non-zero value when calling
57 <tp:member-ref>AcceptFile</tp:member-ref>.</li>
59 <li>Once the offset has been negotiated, the
60 <tp:member-ref>InitialOffsetDefined</tp:member-ref> signal
61 is emitted and the <tp:member-ref>InitialOffset</tp:member-ref> property
62 is defined. The <tp:member-ref>InitialOffsetDefined</tp:member-ref>
63 signal is emitted before channel becomes Open.
64 The receiver MUST check the value of
65 <tp:member-ref>InitialOffset</tp:member-ref> for a difference in offset
66 from the requested value in AcceptFile.</li>
68 <li>When the state changes to Open, Clients can start the transfer of the
69 file using the offset previously announced.
72 <p>If something goes wrong with the transfer,
73 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel.Close</tp:dbus-ref>
74 should be called on the channel.</p>
76 <p>The File channel type may be requested for handles of type
77 HANDLE_TYPE_CONTACT. If the channel is requested for any other
78 handle type then the behaviour is undefined.</p>
81 <property name="State" type="u" tp:type="File_Transfer_State"
82 access="read" tp:name-for-bindings="State">
83 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
84 <p>The state of the file transfer as described by the
85 File_Transfer_State enum.</p>
89 <property name="ContentType" type="s" access="read"
90 tp:name-for-bindings="Content_Type">
91 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
92 <p>The file's MIME type. This cannot change once the channel has
95 <p>This property is mandatory when requesting the channel with the
96 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
97 method. Protocols which do not have a content-type property with file
98 transfers should set this value to application/octet-stream.</p>
102 <property name="Filename" type="s" access="read"
103 tp:name-for-bindings="Filename">
104 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
105 <p>The name of the file on the sender's side. This is therefore given
106 as a suggested filename for the receiver. This cannot change
107 once the channel has been created.</p>
109 <p>This property should be the basename of the file being sent. For example,
110 if the sender sends the file /home/user/monkey.pdf then this property should
111 be set to monkey.pdf.</p>
113 <p>This property is mandatory when requesting the channel with the
114 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
115 method. This property cannot be empty and MUST be set to a sensible value.</p>
119 <property name="Size" type="t" access="read"
120 tp:name-for-bindings="Size">
121 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
122 <p>The size of the file. If this property is set, then the file
123 transfer is guaranteed to be this size. This cannot change once
124 the channel has been created.</p>
126 <p>When you are creating a channel with this property, its value
127 MUST be accurate and in bytes. However, when receiving a file, this
128 property still MUST be in bytes but might not be entirely accurate
131 <p>This property is mandatory when requesting the channel with the
132 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
133 method. If this information isn't provided in the protocol, connection managers MUST set it
138 <property name="ContentHashType" type="u" tp:type="File_Hash_Type"
139 access="read" tp:name-for-bindings="Content_Hash_Type">
140 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
141 <p>The type of the <tp:member-ref>ContentHash</tp:member-ref> property.</p>
143 <p>This property is optional when requesting the channel with the
144 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
145 method. However, if you wish to include the <tp:member-ref>ContentHash</tp:member-ref>
146 property you MUST also include this property. If you omit this property from a
147 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
148 method call then its value will be assumed to be File_Hash_Type_None.</p>
152 <property name="ContentHash" type="s" access="read"
153 tp:name-for-bindings="Content_Hash">
154 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
155 <p>Hash of the contents of the file transfer, of type described
156 in the value of the <tp:member-ref>ContentHashType</tp:member-ref>
159 <p>This property is optional when requesting the channel with the
160 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
161 method. Its value MUST correspond to the appropriate type of the
162 <tp:member-ref>ContentHashType</tp:member-ref> property. If the
163 ContentHashType property is not set, or set to File_Hash_Type_None,
164 then this property will not even be looked at.</p>
168 <property name="Description" type="s" access="read"
169 tp:name-for-bindings="Description">
170 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
171 <p>Description of the file transfer. This cannot change once the
172 channel has been created.</p>
174 <p>This property is optional when requesting the channel with the
175 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
176 method. If this property was not provided by the remote party, connection managers MUST set it to
177 the empty string.</p>
181 <property name="Date" type="t" access="read"
182 tp:type="Unix_Timestamp64" tp:name-for-bindings="Date">
183 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
184 <p>The last modification time of the file being transferred. This
185 cannot change once the channel has been created</p>
187 <p>This property is optional when requesting the channel with the
188 <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref>
193 <property name="AvailableSocketTypes" type="a{uau}"
194 tp:type="Supported_Socket_Map" access="read"
195 tp:name-for-bindings="Available_Socket_Types">
196 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
197 <p>A mapping from address types (members of Socket_Address_Type) to
198 arrays of access-control type (members of Socket_Access_Control)
199 that the connection manager supports for sockets with that
200 address type. For simplicity, if a CM supports offering a
201 particular type of file transfer, it is assumed to support accepting
202 it. Connection Managers MUST support at least Socket_Address_Type_IPv4.</p>
204 <p>A typical value for a host without IPv6 support:</p>
208 Socket_Address_Type_IPv4:
209 [Socket_Access_Control_Localhost, Socket_Access_Control_Port,
210 Socket_Access_Control_Netmask],
211 Socket_Address_Type_Unix:
212 [Socket_Access_Control_Localhost, Socket_Access_Control_Credentials]
218 <property name="TransferredBytes" type="t" access="read"
219 tp:name-for-bindings="Transferred_Bytes">
220 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
221 <p>The number of bytes that have been transferred at the time of
222 requesting the property. This will be updated as the file transfer
227 <property name="InitialOffset" type="t" access="read"
228 tp:name-for-bindings="Initial_Offset">
229 <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
230 <p>The offset in bytes from where the file should be sent. This MUST
231 be respected by both the receiver and the sender after the state
232 becomes Open, but before any data is sent or received. Until the
233 <tp:member-ref>InitialOffsetDefined</tp:member-ref> signal
234 is emitted, this property is undefined.</p>
236 <p>Before setting the <tp:member-ref>State</tp:member-ref> property to
237 Open, the connection manager MUST set the InitialOffset property,
240 <p>This property MUST NOT change after the state of the transfer has
245 <tp:enum name="File_Transfer_State" type="u">
246 <tp:enumvalue suffix="None" value="0">
248 An invalid state type used as a null value. This value MUST NOT
249 appear in the State property.
252 <tp:enumvalue suffix="Pending" value="1">
254 The file transfer is waiting to be accepted/closed by the receiver.
255 The receiver has to call <tp:member-ref>AcceptFile</tp:member-ref>,
256 then wait for the state to change to Open and check the offset value.
259 <tp:enumvalue suffix="Accepted" value="2">
261 The receiver has accepted the transfer. The sender now has to
262 call <tp:member-ref>ProvideFile</tp:member-ref> to actually start the transfer.
263 The receiver should now wait for the state to change to Open
264 and check the offset value.
267 <tp:enumvalue suffix="Open" value="3">
269 The file transfer is open for traffic.
272 <tp:enumvalue suffix="Completed" value="4">
274 The file transfer has been completed successfully.
277 <tp:enumvalue suffix="Cancelled" value="5">
279 The file transfer has been cancelled.
284 <tp:enum name="File_Transfer_State_Change_Reason" type="u">
285 <tp:enumvalue suffix="None" value="0">
287 No reason was specified.
290 <tp:enumvalue suffix="Requested" value="1">
292 The change in state was requested.
295 <tp:enumvalue suffix="Local_Stopped" value="2">
297 The file transfer was cancelled by the local user.
300 <tp:enumvalue suffix="Remote_Stopped" value="3">
302 The file transfer was cancelled by the remote user.
305 <tp:enumvalue suffix="Local_Error" value="4">
307 The file transfer was cancelled because of a local error.
310 <tp:enumvalue suffix="Remote_Error" value="5">
312 The file transfer was cancelled because of a remote error.
317 <tp:enum name="File_Hash_Type" type="u">
318 <tp:enumvalue suffix="None" value="0">
323 <tp:enumvalue suffix="MD5" value="1">
325 MD5 digest as a string of 32 ASCII hex digits.
328 <tp:enumvalue suffix="SHA1" value="2">
330 SHA1 digest as a string of ASCII hex digits.
333 <tp:enumvalue suffix="SHA256" value="3">
335 SHA256 digest as a string of ASCII hex digits.
340 <method name="AcceptFile" tp:name-for-bindings="Accept_File">
342 Accept a file transfer that's in the Pending state. The file
343 transfer's state becomes Accepted after this method is called.
344 At this point the client can connect to the socket. CM MUST emit
345 <tp:member-ref>InitialOffsetDefined</tp:member-ref> and change
346 the state to Open before writing to the socket.
347 Then <tp:member-ref>InitialOffset</tp:member-ref> should be respected in case
348 its value differs from the offset that was specified as an argument
351 <arg direction="in" name="Address_Type" type="u" tp:type="Socket_Address_Type">
353 The type of address the connection manager should listen on.
356 <arg direction="in" name="Access_Control" type="u" tp:type="Socket_Access_Control">
358 The type of access control the connection manager should apply to
362 <arg direction="in" name="Access_Control_Param" type="v">
364 A parameter for the access control type, to be interpreted as
365 specified in the documentation for the Socket_Access_Control enum.
368 <arg direction="in" name="Offset" type="t">
370 The desired offset in bytes where the file transfer should start.
371 The offset is taken from the beginning of the file. Specifying an
372 offset of zero will start the transfer from the beginning of the
373 file. The offset that is actually given in the
374 <tp:member-ref>InitialOffset</tp:member-ref> property can differ
375 from this argument where the requested offset is not supported.
376 (For example, some protocols do not support offsets at all so
377 the InitialOffset property will always be 0.)
380 <arg direction="out" name="Address" type="v">
382 The address on which the connection manager will listen for
383 connections for this file transfer.
388 <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented">
390 The given address type or access-control mechanism is not supported.
393 <tp:error name="org.freedesktop.Telepathy.Error.NetworkError"/>
394 <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
396 Your address type, access control, access control parameter,
397 offset, or a combination of all four is invalid.
399 <tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
401 The file transfer is not in the Pending state, there isn't
402 or there is a local error with acquiring a socket.
405 </tp:possible-errors>
408 <method name="ProvideFile" tp:name-for-bindings="Provide_File">
410 Provide the file for an outgoing file transfer which has been offered.
411 Opens a socket that the client can use to provide a file to the connection manager.
412 The channel MUST have been requested, and will change state
413 to Open when this method is called if its state was Accepted.
415 <arg direction="in" name="Address_Type" type="u" tp:type="Socket_Address_Type">
417 The type of address the connection manager should listen on.
420 <arg direction="in" name="Access_Control" type="u" tp:type="Socket_Access_Control">
422 The type of access control the connection manager should apply to
426 <arg direction="in" name="Access_Control_Param" type="v">
428 A parameter for the access control type, to be interpreted as
429 specified in the documentation for the Socket_Access_Control enum.
432 <arg direction="out" name="Address" type="v">
434 The address on which the connection manager will listen for
435 connections for this file transfer.
440 <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented">
442 The given address type or access-control mechanism is not supported.
445 <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
447 Your address type, access control, access control parameter, or
448 a combination of all three is invalid.
450 <tp:error name="org.freedesktop.Telepathy.Error.NotAvailable">
452 Channel is not an outgoing transfer, ProvideFile has already been called,
453 or there was a local error acquiring the socket.
456 </tp:possible-errors>
459 <signal name="FileTransferStateChanged"
460 tp:name-for-bindings="File_Transfer_State_Changed">
462 Emitted when the state of a file transfer changes.
464 <arg name="State" type="u" tp:type="File_Transfer_State">
466 The new state of the file transfer; see the File_Transfer_State enumeration.
469 <arg name="Reason" type="u" tp:type="File_Transfer_State_Change_Reason">
471 The reason for the state change; see the File_Transfer_State_Change_Reason
473 The value will always be File_Transfer_State_Change_Reason_None, except
474 when changing state to cancelled.
479 <signal name="TransferredBytesChanged"
480 tp:name-for-bindings="Transferred_Bytes_Changed">
482 Emitted when the number of transferred bytes changes. This will not be
483 signalled with every single byte change. Instead, the most frequent
484 this signal will be emitted is once a second. This should be
485 sufficient, and the <tp:member-ref>TransferredBytes</tp:member-ref>
486 property SHOULD NOT be polled.
488 <arg name="Count" type="t">
490 The number of already transferred bytes.
495 <signal name="InitialOffsetDefined"
496 tp:name-for-bindings="Initial_Offset_Defined">
498 Emitted when the value of the <tp:member-ref>InitialOffset</tp:member-ref>
499 property has been negotiated. This signal MUST be emitted before the channel
500 becomes Open and clients have to use this offset when transferring the
503 <arg name="InitialOffset" type="t">
505 The value of the <tp:member-ref>InitialOffset</tp:member-ref> property.
513 <!-- vim:set sw=2 sts=2 et ft=xml: -->