summaryrefslogtreecommitdiff
path: root/spec/Channel.xml
blob: 5bb9241f5e292e24ae05f4af77a49fa501eabf65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?xml version="1.0" ?>
<node name="/Channel" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
  <tp:copyright>Copyright © 2011 Intel Corp.</tp:copyright>
  <tp:license xmlns="http://www.w3.org/1999/xhtml">
    <p>This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.</p>

<p>This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.</p>

<p>You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</p>
  </tp:license>
  <interface name="org.freedesktop.ytstenut.xpmn.Channel">
    <tp:requires interface="org.freedesktop.Telepathy.Channel"/>

    <tp:simple-type name="Message_Body" type="s" array-name="Message_Body">
      <tp:docstring>
        The UTF-8 encoded XML body of a Ytstenut message.
      </tp:docstring>
    </tp:simple-type>

    <tp:mapping name="Message_Attrs" array-name="Message_Attrs_List">
      <tp:member type="s" name="Name">
        <tp:docstring>The name of the attribute.</tp:docstring>
      </tp:member>
      <tp:member type="s" name="Value">
        <tp:docstring>The value of the attribute.</tp:docstring>
      </tp:member>
      <tp:docstring>
        A list of attributes present on a Ytstenut message.
      </tp:docstring>
    </tp:mapping>

    <property name="RequestType" access="read" tp:type="Request_Type"
      tp:name-for-bindings="Request_Type" type="u"
      tp:immutable='yes' tp:requestable='yes'>
      <tp:docstring>
        The &lt;iq&gt; type of the request message.
      </tp:docstring>
    </property>

    <property name="RequestAttributes" access="read" tp:type="Message_Attrs"
      tp:name-for-bindings="Request_Attributes" type="a{ss}"
      tp:immutable='yes' tp:requestable='yes'>
      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
        <p>The attributes present on the Ytstenut request message.</p>
        <p>The exact attributes specified depend on the type and intent of
          the Ytstenut message being sent. Some examples are the
          <tt>capability</tt>, <tt>activity</tt> or <tt>time</tt> attributes.
          For more details see the Ytstenut specification.</p>
      </tp:docstring>
    </property>

    <property name="RequestBody" access="read" tp:type="Message_Body"
      tp:name-for-bindings="Request_Body" type="s"
      tp:immutable='yes' tp:requestable='yes'>
      <tp:docstring>
        The UTF-8 encoded XML body of the Ytstenut request message. The
          top level element must have the name 'message' and be of the namespace
          'urn:ytstenut:message'. Any attributes in the
          <tp:member-ref>RequestAttributes</tp:member-ref> property will
          override any attributes of the same names on the top level element. If
          an empty string is used as the
          <tp:member-ref>RequestBody</tp:member-ref> then a default body will be
          used instead.
      </tp:docstring>
    </property>

    <property name="TargetService" access="read"
      tp:name-for-bindings="Target_Service" type="s"
      tp:immutable='yes' tp:requestable='yes'>
      <tp:docstring>
        The name of the target Ytstenut service that this channel is targetted
        at.
      </tp:docstring>
    </property>

    <property name="InitiatorService" access="read"
      tp:name-for-bindings="Initiator_Service" type="s"
      tp:immutable='yes' tp:requestable='yes'>
      <tp:docstring>
        The name of the Ytstenut service which initiated this channel.
      </tp:docstring>
    </property>

    <signal name="Replied" tp:name-for-bindings="Replied">
      <arg name="Attributes" type="a{ss}" tp:type="Message_Attrs">
        <tp:docstring>
          The attributes present on the Ytstenut result message.
        </tp:docstring>
      </arg>
      <arg name="Body" type="s" tp:type="Message_Body">
        <tp:docstring>
          The UTF-8 encoded XML body of the Ytstenut result message, including
          the attributes in the 'Attributes' argument.
        </tp:docstring>
      </arg>
      <tp:docstring>
        This signal is emitted when a &lt;iq type='result'&gt; is received in
        response to a request sent on this channel. This signal is only
        emitted on the initiating side of the channel.
      </tp:docstring>
    </signal>

    <signal name="Failed" tp:name-for-bindings="Failed">
      <arg name="ErrorType" tp:type="Error_Type"
        tp:name-for-bindings="Error_Type" type="u">
        <tp:docstring>
          The type of error which defines the appropriate action to take.
        </tp:docstring>
      </arg>
      <arg name="StanzaErrorName" type="s"
        tp:name-for-bindings="Stanza_Error_Name">
        <tp:docstring>
          The name of the specific error.
        </tp:docstring>
      </arg>
      <arg name="YtstenutErrorName" type="s"
        tp:name-for-bindings="Ytstenut_Error_Name">
        <tp:docstring>
          A more detailed Ytstenut error name.
        </tp:docstring>
      </arg>
      <arg name="Text" type="s" tp:name-for-bindings="Text">
        <tp:docstring>
          Textual details of the error.
        </tp:docstring>
      </arg>
      <tp:docstring>
        This signal is emitted when a error is received. This signal is only
        emitted on the initiating side of the channel.
      </tp:docstring>
    </signal>

    <method name="Request" tp:name-for-bindings="Request">
      <tp:docstring>
        Send the Ytstenut request (represented by the
        <tp:member-ref>RequestType</tp:member-ref>,
        <tp:member-ref>RequestAttributes</tp:member-ref> and
        <tp:member-ref>RequestBody</tp:member-ref>) properties to the other
        side of this channel.
      </tp:docstring>
    </method>

    <method name="Reply" tp:name-for-bindings="Reply">
      <arg direction="in" name="Attributes" type="a{ss}"
        tp:type="Message_Attrs">
        <tp:docstring>
          The attributes to set on the Ytstenut reply message.
        </tp:docstring>
      </arg>
      <arg direction="in" name="Body" tp:type="Message_Body" type="s">
        <tp:docstring>
          Optional UTF-8 encoded XML body of the Ytstenut reply
          message. The top level element must have the name 'message'
          and be of the namespace 'urn:ytstenut:message'. Any
          attributes in the Attributes argument will override any
          attributes of the same names on the top level element. If an
          empty string is used as the 'Body' then a default body will
          be created instead.
        </tp:docstring>
      </arg>
      <tp:docstring>
        Send an &lt;iq&gt; result to the Ytstenut request.
      </tp:docstring>
    </method>

    <method name="Fail" tp:name-for-bindings="Fail">
      <arg name="ErrorType" tp:type="Error_Type" direction="in"
        tp:name-for-bindings="Error_Type" type="u">
        <tp:docstring>
          The type of error which defines the appropriate action to take.
        </tp:docstring>
      </arg>
      <arg name="StanzaErrorName" type="s" direction="in"
        tp:name-for-bindings="Stanza_Error_Name">
        <tp:docstring>
          The name of the specific error.
        </tp:docstring>
      </arg>
      <arg name="YtstenutErrorName" type="s" direction="in"
        tp:name-for-bindings="Ytstenut_Error_Name">
        <tp:docstring>
          A more detailed Ytstenut error name.
        </tp:docstring>
      </arg>
      <arg name="Text" type="s" tp:name-for-bindings="Text" direction="in">
        <tp:docstring>
          Textual details of the error.
        </tp:docstring>
      </arg>
    </method>

    <tp:enum name="Request_Type" type="u">
      <tp:enumvalue suffix="Get" value="1">
        <tp:docstring>The iq request is of type 'get'</tp:docstring>
      </tp:enumvalue>
      <tp:enumvalue suffix="Set" value="2">
        <tp:docstring>The iq request is of type 'set'</tp:docstring>
      </tp:enumvalue>
    </tp:enum>

    <tp:enum name="Reply_Type" type="u">
      <tp:enumvalue suffix="Result" value="1">
        <tp:docstring>The iq reply is of type 'result'</tp:docstring>
      </tp:enumvalue>
      <tp:enumvalue suffix="Error" value="2">
        <tp:docstring>The iq reply is of type 'error'</tp:docstring>
      </tp:enumvalue>
    </tp:enum>

    <tp:enum name="Error_Type" type="u">
      <tp:enumvalue suffix="Cancel" value="1">
        <tp:docstring>Do not retry (the error is unrecoverable)</tp:docstring>
      </tp:enumvalue>
      <tp:enumvalue suffix="Continue" value="2">
        <tp:docstring>Proceed (the condition was only a warning)</tp:docstring>
      </tp:enumvalue>
      <tp:enumvalue suffix="Modify" value="3">
        <tp:docstring>Retry after changing the data sent</tp:docstring>
      </tp:enumvalue>
      <tp:enumvalue suffix="Auth" value="4">
        <tp:docstring>Retry after providing credentials</tp:docstring>
      </tp:enumvalue>
      <tp:enumvalue suffix="Wait" value="5">
        <tp:docstring>Retry after waiting (the error is temporary)</tp:docstring>
      </tp:enumvalue>
    </tp:enum>

    <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
      <p>This channel represents Ytstenut commands being sent to or from a
      remote service.</p>
      <p>To send a command to a remote service, request a channel of
      this type, specifying TargetHandleType as Contact, the TargetID
      of the target contact (which may be the local user's own JID),
      plus the <tp:member-ref>InitiatorService</tp:member-ref>,
      <tp:member-ref>TargetService</tp:member-ref>,
      <tp:member-ref>RequestType</tp:member-ref>,
      <tp:member-ref>RequestAttributes</tp:member-ref>,
      and (optionally) <tp:member-ref>RequestBody</tp:member-ref> properties.
      Connect to the <tp:member-ref>Replied</tp:member-ref> and
      <tp:member-ref>Failed</tp:member-ref> signals on the resulting channel,
      and then call <tp:member-ref>Request</tp:member-ref>; one of the two
      signals will be emitted when the target replies, after which point the
      channel may be closed.</p>
      <p>Services which handle incoming commands should have an entry in
      HandlerChannelFilter as follows:</p>
      <pre>
      { ChannelType: ...,
        TargetHandleType: Contact,
        TargetService: com.example.myservice
      }</pre>
      <p>Upon being handed an incoming channel, the handler should process the
      request and call one of <tp:member-ref>Reply</tp:member-ref> or
      <tp:member-ref>Fail</tp:member-ref>, after which point it may close the
      channel.</p>
    </tp:docstring>

  </interface>
</node>