Subject: [Anima-signaling] Consolidated GRASP examples

From: Brian E Carpenter <[email-masked]>
Date: Fri, 21 Oct 2016 14:18:48 +1300

Here are the examples I've generated, with a little text, for the
proposed appendix in the GRAFT draft.

OK? Carsten, do you have any better ideas of how to present examples?

Thanks
    Brian

This appendix shows a number of example GRASP messages conforming to the CDDL syntax given
in section XXX. Each message is shown three times in the following formats:

1) CBOR diagnostic notation.
2) Similar, but showing the names of the constants.
3) Hexadecimal version of the wire format.

Discovery example

The initiator multicasts a discovery message:

[1, 13948744, h'20010db8f000baaa28ccdc4c97036781', ["EX1", 2, 2, 0]]
[M_DISCOVERY, 13948744, h'20010db8f000baaa28ccdc4c97036781', ["EX1", F_SYNCH, 2, 0]]
h'84011a00d4d7485020010db8f000baaa28ccdc4c970367818463455831020200'

A peer responds:

[2, 13948744, h'20010db8f000baaa28ccdc4c97036781', 60000, [103, h'20010db8f000baaaf000baaaf000baaa', 6, 49443]]
[M_RESPONSE, 13948744, h'20010db8f000baaa28ccdc4c97036781', 60000, [O_IPv6_LOCATOR, h'20010db8f000baaaf000baaaf000baaa',
IPPROTO_TCP, 49443]]
h'85021a00d4d7485020010db8f000baaa28ccdc4c9703678119ea608418675020010db8f000baaaf000baaaf000baaa0619c123'

Flood example

The initiator multicasts a flood message. There is no response:

[9, 3504974, h'20010db8f000baaa28ccdc4c97036781', 10000, [], ["EX1", 2, 2, ["Example 1 value=", 100]]]
[M_FLOOD, 3504974, h'20010db8f000baaa28ccdc4c97036781', 10000, [], ["EX1", F_SYNCH, 2, ["Example 1 value=", 100]]]
h'86091a00357b4e5020010db8f000baaa28ccdc4c97036781192710808463455831020282704578616d706c6520312076616c75653d1864'

Synchronization example

The initiator unicasts a request:

[4, 4038926, ["EX2", 2, 5, 0]]
[M_REQ_SYN, 4038926, ["EX2", F_SYNCH, 5, 0]]
h'83041a003da10e8463455832020500'

The peer responds:

[8, 4038926, ["EX2", 2, 5, ["Example 2 value=", 200]]]
[M_SYNCH, 4038926, ["EX2", F_SYNCH, 5, ["Example 2 value=", 200]]]
h'83081a003da10e8463455832020582704578616d706c6520322076616c75653d18c8'

Negotiation example (simple)

The initiator unicasts a request:

[3, 802813, ["EX3", 1, 6, ["NZD", 47]]]
[M_REQ_NEG, 802813, ["EX3", 1, 6, ["NZD", 47]]]
h'83031a000c3ffd8463455833010682634e5a44182f'

The peer responds with immediate acceptance:

[6, 802813, [101]]
[M_END , 802813, [O_ACCEPT]]
h'83061a000c3ffd811865'

Negotiation example (not so simple)

The initiator unicasts a request:

[3, 13767778, ["EX3", 1, 6, ["NZD", 410]]]
[M_REQ_NEG, 13767778, ["EX3", F_NEG, 6, ["NZD", 410]]]
h'83031a00d214628463455833010682634e5a4419019a'

The responder starts to negotiate (making an offer):

[5, 13767778, ["EX3", 1, 6, ["NZD", 80]]]
[M_NEGOTIATE, 13767778, ["EX3", F_NEG, 6, ["NZD", 80]]]
h'83051a00d214628463455833010682634e5a441850'

The initiator continues to negotiate (reducing its request):

[5, 13767778, ["EX3", 1, 5, ["NZD", 307]]]
[M_NEGOTIATE, 13767778, ["EX3", F_NEG, 5, ["NZD", 307]]]
h'83051a00d214628463455833010582634e5a44190133'

The responder asks for more time:

[7, 13767778, 34965]
[M_WAIT, 13767778, 34965]
h'83071a00d21462198895'

The responder continues to negotiate (increasing its offer):

[5, 13767778, ["EX3", 1, 4, ["NZD", 120]]]
[M_NEGOTIATE, 13767778, ["EX3", F_NEG, 4, ["NZD", 120]]]
h'83051a00d214628463455833010482634e5a441878'

The initiator continues to negotiate (reducing its request):

[5, 13767778, ["EX3", 1, 3, ["NZD", 246]]]
[M_NEGOTIATE, 13767778, ["EX3", F_NEG, 3, ["NZD", 246]]]
h'83051a00d214628463455833010382634e5a4418f6'

The responder refuses to negotiate further:

[6, 13767778, [102, "Insufficient funds"]]
[M_END , 13767778, [O_DECLINE, "Insufficient funds"]]
h'83061a00d2146282186672496e73756666696369656e742066756e6473'

This negotiation has failed.

(end)