[Standards-JIG] JEP-0079 (AMP): conditions reversed?

Tijl Houtbeckers thoutbeckers at splendo.com
Tue May 31 21:24:19 UTC 2005


On Tue, 31 May 2005 22:50:31 +0200, Peter Saint-Andre <stpeter at jabber.org>  
wrote:

> On Tue, May 31, 2005 at 12:57:16PM +0200, Ralph Meijer wrote:
>
>>     Example 10. Sending a message for reliable data transport
>>
>>     <message to='francisco at hamlet.lit/pda'
>>              from='bernardo at hamlet.lit/elsinore'
>>              id='ibb1'>
>>       <data xmlns='http://jabber.org/protocol/ibb' sid='mySID' seq='0'>
>>         qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ
>>         WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu
>>         IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P
>>         AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH
>>         kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA
>>       </data>
>>       <amp xmlns='http://jabber.org/protocol/amp' per-hop='true'>
>>         <rule condition='expire-at' value='2004-09-10T08:33:14Z'
>>     action='error'/>
>>         <rule condition='match-resource' value='exact' action='error'/>
>>       </amp>
>>     </message>
>>
>>     In the above case, the sender would receive an error reply if the
>>     message could not be delivered specifically to
>>     "francisco at hamlet.lit/pda" within 500 seconds.
>>
>>     Example 11. Failed reliable data transport message
>>
>>     <message from='hamlet.lit'
>>              to='bernardo at hamlet.lit/elsinore'
>>              id='ibb1'>
>>       <data xmlns='http://jabber.org/protocol/ibb' sid='mySID' seq='0'>
>>         qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ
>>         WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu
>>         IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P
>>         AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH
>>         kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA
>>       </data>
>>       <amp xmlns='http://jabber.org/protocol/amp'
>>           from='bernardo at hamlet.lit/elsinore'
>>           to='francisco at hamlet.lit/pda'>
>>         <rule condition='match-resource' value='exact' action='error'/>
>>       </amp>
>>       <error type='modify' code='500'>
>>         <undefined-condition  
>> xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
>>         <failed-rules xmlns='http://jabber.org/protocol/amp#errors'>
>>           <rule condition='match-resource' value='exact'  
>> action='error'/>
>>         </failed-rules>
>>       </error>
>>     </message>
>>
>> As I see it, the condition match-resource, using the value 'exact',
>> would only match if the resource *did* match. So, if it could be
>> delivered, the message would get dropped?
>
> We probably need more narrative text to explain these examples.
>
> In Example 10, the sender specified two rules:
>
>   1. Deliver the message by 2004-09-10T08:33:14Z, but if you can't then
>      send me an error report:
>
>      <rule condition='expire-at'
>            value='2004-09-10T08:33:14Z'
>            action='error'/>
>
>   2. Deliver the message only to <francisco at hamlet.lit/pda>, but if you
>      can't then send me an error report:
>
>      <rule condition='match-resource'
>            value='exact'
>            action='error'/>

So what if I want to get a notification when I send a message to a  
specific resource?
If we ASSUME that your example is still correct then,

<rule condition='match-resource'
	value='exact'
	action='notify'/>

would get me a notification is the message does NOT arrive at the exact  
resource, which isn't very intutive either. In any case, after reading it  
a few times (back when I posted about this) it's clear that the JEP  
currently works as follows: once a condition is met (in this case the  
resources match exactly) the rule is "triggered", and the action is  
executed.

So Ralph is right in stating the example is wrong (and it's still wrong  
the way you put it here), though rather than changing the JEP you should  
use "other" instead of "exact".

To quote section 3.3.3:

"The condition is met [ed. thus the action is triggered*] if the resource  
for the actual destination JID matches the specified destination JID using  
the above rules. For instance, if a message is intended for  
"romeo at montague.net/work" with the "match-resource" condition of "other",  
the condition is met if the message can be immediately delivered only to  
"romeo at montague.net/home"."

* Section 2.2: "If a condition is met, execute that rule's action"


>
>> Also, what happens in the case when the default action is offline
>> storage? Does the resource still match?
>
> Let's say that the sender in Example 10 wanted the message to be
> delivered only to that exact resource, otherwise the message is to be
> dropped. The rule would specify a condition of "deliver", a value of
> "direct", and an action of "drop":
>
>      <rule condition='deliver'
>            value='direct'
>            action='drop'/>
>
> Which means: deliver the message directly to the 'to' address, otherwise
> drop it. It doesn't mean "if you can deliver the message directly to
> that address, then drop the message" -- that wouldn't make any sense.
> ;-)


section 3.3.1:

"This condition is met based on what the processor is able to do with the  
message at the moment of receipt. To correctly process this condition, a  
processor first determines if the message can be delivered immediately to  
the intended resource or further dispatched to another hop. ***If so and  
the contents are "direct", the condition is met.***" (my emphasis)


So it does mean "if you can deliver the message directly to that address,  
then drop the message". Which I agree is senseless in any case I can think  
of, however just because you CAN shouldn't mean you SHOULD make such a  
rule ;)

In fact this would work pretty well:

<rule condition='deliver'
             value='store'
             action='drop'/>

Except you'll also need to include "none" "gateway" and "forwarded" if you  
don't want your message to be. Which makes your packet a bit bigger, yes.  
But think about, what if it WOULD be true what PSA is saying? Then:

<rule condition='deliver'
             value='forward'
             action='drop'/>

This would mean, drop my packet UNLESS it is forwarded. Which is equally  
senseless. However as the JEP currently works this would drop the message  
if it's going to be forwarded, which actually makes some sense. So does  
taking PSA's example and changing the action from "drop" to "notify":

> <rule condition='deliver'
>            value='direct'
>            action='notify'/>

You'll get a notification is the message is delivered directly. Also not  
that silly any more.

BTW, I also note that the security considerations (section 3.5) should be  
updated to mention match-resource, since this too can bypass presence  
subscriptions. If I send:

<rule condition='match-resource'
	value='other'
	action='error'/>

this will tell me the resource I send a message to is offline or online,  
they'll receive a message though if they are, but not all client display  
empty messages for example.






More information about the Standards mailing list