dsdp/tm/tcf_0_3_x/org.eclipse.tm.tcf.docs/TCF Specification.html
author duane.cawthron@nokia.com
Mon, 17 Aug 2009 16:02:00 -0500
changeset 70 11a6943ebeb2
permissions -rw-r--r--
add dsdp/tm/tcf_0_3_x
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
70
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     2
<html>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     3
<head>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     4
    <title>Target Communication Framework Specification</title>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     5
</head>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     6
<body lang='EN-US'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     7
  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     8
<h1>Target Communication Framework Specification</h1>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
     9
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    10
<p>Copyright (c) 2007, 2008 Wind River Systems, Inc. Made available under the EPL v1.0
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    11
<p>Direct comments, questions to the <a href="mailto:dsdp-tcf-dev@eclipse.org">dsdp-tcf-dev@eclipse.org</a> mailing list
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    12
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    13
<h1>Table of Contents</h1>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    14
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    15
<ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    16
    <li><a href='#VersionHistory'>Version History</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    17
    <li><a href='#Overview'>Overview</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    18
    <ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    19
        <li><a href='#Goals'>Goals</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    20
        <li><a href='#Definitions'>Definitions</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    21
        <li><a href='#Requirements'>Requirements</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    22
        <li><a href='#Syntax'>Syntax Rules Notation</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    23
    </ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    24
    <li><a href='#Design'>Framework Software Design Considerations</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    25
    <ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    26
        <li><a href='#Concurrency'>Concurrency</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    27
        <li><a href='#Reflection'>Reflection</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    28
        <li><a href='#Ordering'>Message ordering</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    29
    </ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    30
    <li><a href='#Transport'>Transport Layer</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    31
    <li><a href='#Protocol'>Communication Protocol</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    32
    <ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    33
        <li><a href='#ProtocolCommands'>Commands</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    34
        <li><a href='#ProtocolResults'>Results</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    35
        <li><a href='#ProtocolEvents'>Events</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    36
        <li><a href='#ProtocolFlowControl'>Flow Control</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    37
        <li><a href='#ProtocolExamples'>Examples</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    38
    </ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    39
    <li><a href='#API'>API</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    40
    <li><a href='#JSON'>JSON - Preferred Marshaling</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    41
    <ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    42
        <li><a href='#JSONExamples'>JSON - Examples</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    43
    </ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    44
    <li><a href='#Locator'>Locator Service</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    45
    <ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    46
        <li><a href='#LocatorPeer'>Peer Attributes</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    47
        <li><a href='#LocatorCommands'>Locator Service Commands</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    48
        <li><a href='#LocatorEvents'>Locator Service Events</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    49
        <li><a href='#LocatorAPI'>Locator Service API</a>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    50
    </ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    51
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    52
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    53
<h2><a name='VersionHistory'>Version History</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    54
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    55
<table border=1 cellpadding=8>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    56
    <tr>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    57
        <th>Version
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    58
        <th>Date
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    59
        <th>Change
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    60
    <tr>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    61
        <td>0.1
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    62
        <td>2008-01-10
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    63
        <td>Initial contribution
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    64
    <tr>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    65
        <td>1.0
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    66
        <td>2008-05-06
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    67
        <td>Approved
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    68
    <tr>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    69
        <td>1.1
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    70
        <td>2009-03-04
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    71
        <td>Added N message
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    72
</table>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    73
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    74
<h1><a name='Overview'>Overview</a></h1>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    75
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    76
<p>Today almost every device software development tool on the market has its own method
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    77
of communication with target system. Communication methods often require individual setup,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    78
configuration and maintenance, impose unnecessary limitations.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    79
Target Communication Framework goal is to establish common ground in
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    80
the area of communication protocols between development tools and embedded devices.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    81
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    82
<p>The goal is a single protocol used to communicate between all tools and targets:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    83
<p><img src='TCF Specification Image1.png'></p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    84
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    85
<h2><a name='Goals'>Goals</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    86
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    87
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    88
    <li>Universal, simple, lightweight, vendor agnostic framework for tools and targets
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    89
    to communicate for purpose of debugging, profiling, code patching and other device
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    90
    software development needs.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    91
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    92
    <li>Single configuration per target (not per tool per target as today in most cases),
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    93
    or no configuration when possible.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    94
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    95
    <li>Minimal overhead and footprint on target side.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    96
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    97
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    98
<h2><a name='Definitions'>Definitions</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
    99
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   100
<dl>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   101
<dt><b>Peer:</b> <dd>communication endpoint. Both hosts and targets are called peers. A
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   102
peer can act as a client or a server depending on services it implements.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   103
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   104
<dt><b>Service:</b> <dd>group of related commands, events and semantic define a service.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   105
A service can be discovered, added or removed as a group at communication endpoint.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   106
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   107
<dt><b>Message:</b> <dd>a packet of data, formatted according to framework specification
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   108
and transmitted over communication channel.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   109
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   110
<dt><b>Channel:</b> <dd>communication link connecting two endpoints (peers).  A single
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   111
channel may be used to communicate with multiple services.  Multiple channels may
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   112
be used to connect the same peers, however no command or event ordering is guaranteed
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   113
across channels.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   114
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   115
<dt><b>Command:</b> <dd>command is a message sent to remote peer in order to request some
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   116
predefined action there.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   117
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   118
<dt><b>Result:</b> <dd>result is a message sent as a response to a command.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   119
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   120
<dt><b>Event:</b> <dd>event is a message sent to all interested parties in order to notify
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   121
them about state changes.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   122
</dl>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   123
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   124
<h2><a name='Requirements'>Requirements</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   125
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   126
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   127
    <li>Simple and extensible protocol.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   128
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   129
    <li>Small footprint on the target.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   130
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   131
    <li>Fully asynchronous, message based communication.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   132
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   133
    <li>Two ways of message routing:
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   134
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   135
    <ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   136
        <li>Point to point request/response (command/result) communication.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   137
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   138
        <li>Subscription based broadcast of notifications (events).
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   139
    </ul> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   140
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   141
    <li>Full duplex, symmetric communication: both host and target should be able to send
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   142
    commands and events at same time, though ability to establish communication channel
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   143
    can be limited to host only.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   144
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   145
    <li>For each communication channel between two peers, the framework should preserve
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   146
    order of commands, results and events.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   147
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   148
    <li>Support for slow and high latency connections.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   149
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   150
    <li>Transport protocol agnostic. The framework should work well, at least, on top
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   151
    of: TCP/IP, UDP, USB, RS232 and JTAG.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   152
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   153
    <li>The framework should support multiplexing, that is, single target device shared
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   154
    between multiple tools at same time. To reduce footprint on the target, multiplexing
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   155
    can be implemented on host if needed.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   156
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   157
    <li>Dynamic discovery of participating targets and hosts. No configuration when possible.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   158
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   159
    <li>Dynamic discovery of available services (high level protocols, command sets).
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   160
    Clients can query for available services.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   161
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   162
    <li>Services can be added and removed dynamically.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   163
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   164
    <li>Framework should define a set of common high level interfaces (services).  For
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   165
    example: flow control, memory access, registers access, up-load mechanism, kernel
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   166
    awareness, run control, target file system, console, flash programming. Implementation
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   167
    of these interfaces is optional, but if provided it will support much wider compatibility
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   168
    with various tools.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   169
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   170
    <li>Framework should be layered in such a way so it is possible to use different transport
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   171
    medias (e.g. TCP/IP, RS232, USB, etc) without any changes to individual services. 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   172
    In other words, transport implementation should be services agnostic, and services
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   173
    implementation should be transport agnostic.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   174
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   175
    <li>Each service defines how marshalling is done for command, result and event arguments.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   176
    This allows existing target agents to remain unchanged.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   177
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   178
    <li>Framework should define a preferred marshalling mechanism that new services can
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   179
    use.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   180
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   181
    <li>The definition of services (groups of related commands and events) is separate
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   182
    from the definition of the framework itself.  The framework provides unified communication
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   183
    mechanism, while services use it to communicate with its clients.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   184
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   185
    <li>Anybody (including 3rd parties) can add services without having to modify communication
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   186
    protocol or framework software.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   187
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   188
    <li>The framework should support tunneling through a proxy. Proxy may be used, for
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   189
    example:
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   190
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   191
    <ul type='circle'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   192
        <li>to bridge different transport protocols, like TCP and RS232; 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   193
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   194
        <li>to make a RS232 or USB target connection accessible from multiple hosts; 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   195
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   196
        <li>to access targets behind firewalls or otherwise not directly accessible
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   197
    </ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   198
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   199
    <li>A proxy should be able to provide services in addition to those implemented by
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   200
    a target. Such distribution of services allows target services to be implemented on
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   201
    a host, thereby reducing the footprint on the target. For example, debug information,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   202
    stack back trace or OS awareness can be implemented by a proxy on a host. To provide
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   203
    this functionality, proxy services would typically use low-level target services,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   204
    like memory access.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   205
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   206
    <li>Supports of concurrent requests. Maximum number of concurrent requests (window
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   207
    size) can be limited on target side. Simple agents only have to support window size
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   208
    of 1. Framework should maintain a queue of additional requests, so tools don't need
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   209
    to know the window size. This may only be relevant for certain transport protocols
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   210
    e.g. UDP.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   211
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   212
    <li>Events can be broadcasted at any time, i.e. no polling should be required.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   213
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   214
    <li>Protocol should support a standard mechanism of sending data larger than MTU.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   215
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   216
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   217
<h2><a name='Syntax'>Syntax Rules Notation</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   218
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   219
<p>Format of the protocol messages is defined by syntax rules. Syntax is described
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   220
using a simple variant of Backus-Naur Form. In particular:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   221
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   222
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   223
    <li>Italic lower case words in a courier font, enclosed into angular brackets, are
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   224
    used to denote syntactic categories, for example: <b><i><font face="Courier New" size=2 color=#333399>&lt;token&gt;.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   225
    </font></i></b>Category name can be followed by colon and a text, which explains semantics
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   226
    of the category, for example: <b><i><font face="Courier New" size=2 color=#333399>&lt;int:
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   227
    error code&gt;</font></i></b> has same meaning as <b><i><font face="Courier New" size=2 color=#333399>&lt;int&gt;</font></i></b>,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   228
    but denotes that the integer number used to indicate an &ldquo;error code&rdquo;.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   229
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   230
    <li>A syntax rule consists of a category designation followed by one or more syntax
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   231
    definitions for the category. The category name and each definition are placed on
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   232
    separate lines, bullets are used to denote definitions, for example:
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   233
        <pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   234
        <i>&lt;chars&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   235
            &rArr; <i>&lt;char&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   236
            &rArr; <i>&lt;chars&gt; &lt;char&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   237
        </font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   238
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   239
    <li>Spaces are added for readability only and they are not part of the syntax.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   240
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   241
    <li>All text in the category definition, other then categories and spaces, is UTF-8
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   242
    based representation of a message bytes.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   243
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   244
    <li>The symbol &lsquo;&bull;&rsquo; designates a zero byte. 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   245
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   246
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   247
<h1><a name='Design'>Framework Software Design Considerations</a></h1>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   248
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   249
<p>The framework will be packaged, distributed and installed on a host as separate
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   250
product. It should be installed as system service and require no configuration for
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   251
most common case &ndash; target connected over TCP or UDP on a local network. For more complicated
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   252
setup, framework should have easily accessible and user friendly GUI with all relevant
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   253
configuration options.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   254
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   255
<p>Framework should use a dynamic discovery protocol to locate targets and other hosts
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   256
running instances of the framework when possible, and maintain a dynamic list of available
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   257
communication endpoints, as well as lists of services available at each endpoint.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   258
Host discovery is needed to locate hosts able to proxy communications for targets,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   259
which are not accessible otherwise - for example, targets connected with RS232 or
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   260
JTAG to a remote host. It should also be possible to add target configuration manually.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   261
Development tools will access this data through the Locator Service API and use it,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   262
for example, to present a user a list of available targets that have capabilities
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   263
needed by a particular tool.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   264
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   265
<p>Framework should provide software libraries to be used by tools and target agents
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   266
developers. The libraries should be available at least for ANSI C and Java. On host
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   267
side, at least Windows, Solaris and Linux must be supported. Libraries will provide
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   268
APIs for low-level communication protocol, Locator Service, preferred marshaling and
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   269
predefined common services.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   270
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   271
<p>The proposed target communication protocol is text-based. It allows extensions,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   272
which define messages with blocks of binary data, but it is not a recommended data
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   273
formatting, and its usage is supposed to be limited. Text-based protocols have both
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   274
advantages and disadvantages in compare with binary protocols.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   275
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   276
<p>Advantages:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   277
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   278
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   279
    <li>The software for text-based protocols is easier to develop and debug since they
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   280
    use a relatively human-friendly communication.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   281
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   282
    <li>It is possible to use huge selection of existing tools and library routines to
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   283
    view, edit, validate, and transform text-based data.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   284
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   285
    <li>Text based definition is in line with current trend in Internet protocols: most
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   286
    popular protocols such as SMTP and HTTP are text-based.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   287
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   288
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   289
<p>Disadvantages:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   290
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   291
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   292
    <li>Text-based protocols usually need more bytes to store numerical data than binary
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   293
    protocols do.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   294
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   295
    <li>Parsing of text-based data is not efficient compared to parsing of binary data
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   296
    since text-based data is usually not stored in a way similar to how it is stored in
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   297
    computer memory.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   298
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   299
    <li>It is seldom possible to read only part of a text-based message since the exact
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   300
    byte offset to a data item is generally not known.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   301
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   302
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   303
<p>A possible alternative to consider is binary, variable length encoding like BaseStream.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   304
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   305
<h2><a name='Concurrency'>Concurrency</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   306
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   307
<p>Concurrent asynchronous communication is much faster then synchronous, because
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   308
it alleviates communication channel latency and allows better bandwidth utilization.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   309
But it also requires proper design of framework software. Concurrency, in general,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   310
implies multithreading. However, systems developed with global multithreading, are
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   311
often unreliable and prone to different kinds of thread synchronization problems,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   312
which are often very difficult to locate and resolve. We therefore strongly recommend
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   313
that the software is designed to follow the compartment threading model, which simplifies
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   314
thread synchronization and promotes reliable software design. In this model each thread
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   315
execution path is strictly contained in predefined subset of code (compartment), and
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   316
no code, except for reentrant libraries, is executed by multiple threads. Each compartment
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   317
has a message queue and other threads communicate with the compartment thread by posting
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   318
messages to the queue.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   319
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   320
<p>Framework APIs are designed to be compatible with the compartment threading model.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   321
Hence the API functions do not contain any thread synchronization primitives to protect
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   322
against multiple threads using the functions. All framework APIs belong to a single
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   323
compartment and should be used by a single thread. The same thread is used to dispatch
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   324
events and command results. Concurrency is achieved by declaring API functions to
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   325
be asynchronous. Asynchronous functions do not have any return value, and returns
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   326
immediately, most of the time before the intended job is done. They take additional
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   327
arguments to specify a callback function and callback data. In object-oriented languages
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   328
such as Java, this is typically done by a single callback object argument containing
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   329
both the data and the function.  The result listener is called asynchronously when
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   330
the job is done. This approach is commonly known as asynchronous<b>, </b>event-driven<b>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   331
</b>or<b> </b>callback-based<b> </b>programming<b>.</b></p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   332
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   333
<p>One important characteristic of an asynchronous code is that the methods defined
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   334
by the user will often be called from within the framework itself, rather than from
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   335
the user's application code. The framework often plays the role of the main program
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   336
in coordinating and sequencing application activity. This phenomenon is called Inversion
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   337
of Control (also known as the Hollywood Principle - "Don't call us, we'll call you").</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   338
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   339
<h2><a name='Reflection'>Reflection</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   340
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   341
<p>Communication between development tools and embedded devices must allow a host
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   342
to collect target side data and build a reflection of target state. Reflection is
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   343
usually incomplete &ndash; a subset of all remote data. Reflection is always delayed &ndash; it
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   344
represents a remote peer state in the past. Reflection can be updated by polling for
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   345
data changes or by listening to events (event is communication message that is sent
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   346
asynchronously by a peer to notify others about state change). Reflection is correct
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   347
if it represents a state that actually did happen on remote peer.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   348
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   349
<p>Reflection is coherent if it is exactly equal to subset of peer state at a single
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   350
moment of time and that moment of time is not too far in the past. Non-coherent reflection
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   351
can have parts of data representing peer state at different moments of time. Coherent
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   352
reflection is more valuable for a user, because non-coherent reflection can have logically
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   353
conflicting data if that data was collected at different time.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   354
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   355
<p>Traditionally, debuggers would ensure coherence of state reflection by collecting
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   356
data only while target is suspended, and flushing all (or most) reflection data (reducing
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   357
observed subset to zero) when target is resumed. This approach does not work well
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   358
for multithreaded, multicore or real time targets. Maintaining correctness and coherence
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   359
of a non-empty reflection while target is running requires additional support from
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   360
target agent, communication software and debugger itself.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   361
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   362
<p>Since remote peer state is changing over time, coherent reflection can be built
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   363
only if:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   364
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   365
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   366
    <li>Observed subset of state is properly selected and dynamically re-selected. Observing
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   367
    too much can overflow communication channel. Observing too little has little value
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   368
    for a user.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   369
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   370
    <li>Observer is listening to all relevant events.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   371
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   372
    <li>Events are coming in exactly same order as corresponding changes happen.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   373
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   374
    <li>Events are properly ordered relative to other messages that carry state data.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   375
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   376
    <li>All changes in observed subset of peer state are reported by events.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   377
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   378
    <li>All event messages must either contain a complete description of a change or they
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   379
    all should not contain any state data at all. If client is getting some data from
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   380
    events and required to retrieve new values of other changed data by using other means
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   381
    (commands), the reflection will not be coherent at least until such retrieval is complete.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   382
    And if such periods of data retrieval overlap, the reflection will never be coherent.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   383
    Sending deltas with events is usually more efficient then using data retrieval commands
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   384
    to update reflection.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   385
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   386
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   387
<h2><a name='Ordering'>Message ordering</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   388
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   389
<p>The transmission order of commands, results and events is important, it coveys
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   390
valuable information about target state transitions and it should be preserved when
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   391
possible. Consider an example:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   392
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   393
<p>Client transmits: </p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   394
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   395
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   396
    Command X=2
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   397
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   398
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   399
<p>Then, as result of some activity of another client or the target itself, X is assigned
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   400
value 3.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   401
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   402
<p>Target transmits:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   403
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   404
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   405
    Event X=3
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   406
    Result X=2
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   407
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   408
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   409
<p>Now client has to show value of X to a user. If the order of messages is preserved,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   410
the client will know that command was executed <i>after</i> X was assigned 3, the
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   411
last message contains last known value of X and 2 is the correct value to show. If
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   412
the target is allowed to transmit events and results in arbitrary order, the client
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   413
will have no clue what to show &ndash; 2 or 3. In fact, the client will have to make a tough
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   414
decision about each message it receives: either trust message data as correct last
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   415
known target state, or assume the message came in out-of-order and ignore it, or re-request
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   416
the information from the target.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   417
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   418
<p>Note that re-requesting data from the target, in general, does not solve the problem
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   419
of interpretation of messages when order is not preserved. For example, after sending
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   420
a request to read value of X, X could change at about the same time, and client could
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   421
receive:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   422
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   423
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   424
    Event X=2
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   425
    Result X=3
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   426
    Event X=4
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   427
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   428
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   429
<p>If order is not preserved, it is still impossible to tell which value of X is the
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   430
last one. A client could assume value of X unknown every time it receives a notification
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   431
of X change, and then re-request the data again. But this is expensive and, if events
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   432
coming in frequently, client can end up in infinite loop re-requesting the data again
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   433
and again, and it will never have trustworthy data about current target state.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   434
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   435
<p>Developers should be careful when using multithreading or multiple queues in software
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   436
design &ndash; it can easily cause message reordering.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   437
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   438
<p>The framework itself is required to preserve message order. However, if for whatever
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   439
reason a target agent cannot preserve message order, the result will be that clients
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   440
of the service can receive messages in the wrong order. When this is the case it should
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   441
be well documented, so tools developers are aware and can make the best of the situation.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   442
In most cases it will not cause any trouble, but there is no perfect way to restore
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   443
actual sequence of events and maintain data coherency after ordering was lost, and
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   444
in some cases it can severely impact tool functionality and user experience.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   445
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   446
<h1><a name='Transport'>Transport Layer</a></h1>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   447
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   448
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   449
<p>Tools are required to be transport protocol agnostic, so most of the layer functionality
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   450
is used internally by framework and is not exposed to clients. This layer maintains
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   451
a collection of transport protocol handlers. Each handler is designed to provide:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   452
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   453
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   454
    <li>Enumeration of available peers, including both automatically discovered and manually
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   455
    configured peers. Handler fires notification events when peers are added or removed.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   456
    Enumeration can be implemented by scanning JTAG chain, by broadcasting special UDP
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   457
    packet and waiting for responses, by communicating with ICE hardware, or by any other
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   458
    suitable means.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   459
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   460
    <li>Bidirectional point-to-point communication of data packets. Packets are arrays
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   461
    of bytes of arbitrary size.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   462
    Transport handler and underlying protocol are responsible for adding all necessary
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   463
    control data, headers, error checking bits, addresses, fragmentation/defragmentation,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   464
    flow control, transmission retries and whatever necessary to ensure lossless, order-preserving
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   465
    delivery of packets.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   466
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   467
    <li>Configuration UI should allow user to inspect and modify properties of both manually
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   468
    configured and automatically discovered peers, setup new peers, view connections status
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   469
    and statistics.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   470
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   471
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   472
<p>Existing service discovery protocols can be used together with the framework, for
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   473
example:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   474
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   475
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   476
    <li>Zero Configuration Networking (Zeroconf), see <a href='http://www.zeroconf.org/'>http://www.zeroconf.org</a>;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   477
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   478
    <li>Service Location Protocol (SLP), developed by the IETF;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   479
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   480
    <li>Jini, which is Sun's Java-base approach to service discovery, see <a href='http://www.sun.com/jini'>http://www.sun.com/jini</a>;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   481
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   482
    <li>Salutation, developed by an open industry consortium, called the Salutation Consortium;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   483
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   484
    <li>Microsoft's Universal Plug and Play (UPnP), see <a href='http://www.upnp.org/'>http://www.upnp.org</a>;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   485
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   486
    <li>Bluetooth Service Discovery Protocol (SDP).
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   487
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   488
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   489
<p>Service discovery protocols, as well as transport protocols will be supported by
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   490
framework plug-ins, they are not part of framework code itself, and they can be developed
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   491
by 3rd parties. Note that existing discovery protocols define term &ldquo;service&rdquo; differently
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   492
- as an independent communication endpoint (usually a TCP/IP port). In this document
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   493
it is called &ldquo;peer&rdquo; (host, target, communication endpoint), and a peer can provide
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   494
multiple services over single communication channel.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   495
  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   496
<p>Using of standard discovery protocols should be optional, because it can potentially
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   497
cause conflict or interference between development tools and application being developed
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   498
over a use of same standard protocol &ndash; devices software often includes implementation
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   499
of service discovery protocols as part of application code to support their main functions.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   500
</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   501
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   502
<h1><a name='Protocol'>Communication Protocol</a></h1>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   503
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   504
<p>The communication protocol defines data packets properties and roles common for
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   505
all services. The communication protocol API provides functions for opening and /closing
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   506
of the communication channel for a particular peer, and for sending and receiving
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   507
data packets. The protocol define contents of a part of a packet, the rest of the
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   508
packet is treated as array of bytes at this level. The communication protocol implementation
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   509
also provides:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   510
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   511
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   512
    <li>Multiplexing &ndash; opening multiple channels per peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   513
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   514
    <li>Proxy &ndash; packet forwarding in behalf of other hosts.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   515
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   516
  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   517
<p>Protocol defines three packet types: commands (requests), results (responses),
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   518
and events. Each packet consists of several protocol defined control fields followed
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   519
by byte array of data. Binary representation of control fields is a sequence of zero
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   520
terminated ASCII strings. Format of data array depends on a service. We recommend
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   521
using framework preferred marshaling for data formatting.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   522
  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   523
<p>Syntax:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   524
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   525
<i>&lt;message&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   526
    &rArr; <i>&lt;command&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   527
    &rArr; <i>&lt;result&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   528
    &rArr; <i>&lt;event&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   529
    &rArr; <i>&lt;flow control message&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   530
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   531
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   532
<h2><a name='ProtocolCommands'>Commands</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   533
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   534
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   535
<i>&lt;command&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   536
    &rArr; C &bull; <i>&lt;token&gt; </i>&bull; <i>&lt;service name&gt; </i>&bull; <i>&lt;command name&gt; </i>&bull; <i>&lt;byte array: arguments&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   537
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   538
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   539
<p>Command packets start with string &ldquo;C&rdquo;.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   540
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   541
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   542
<i>&lt;token&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   543
    &rArr; <i>&lt;chars&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   544
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   545
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   546
<p>Token is unique string generated by framework for each command. It is used to match
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   547
results to commands.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   548
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   549
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   550
<i>&lt;service name&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   551
    &rArr; <i>&lt;chars&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   552
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   553
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   554
<p>Service name is used to identify a service that handles the command, it is same
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   555
string as returned by Service.getName().</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   556
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   557
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   558
<i>&lt;command name&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   559
    &rArr; <i>&lt;chars&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   560
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   561
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   562
<p>Command name interpretation depends on a service.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   563
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   564
<p>A command should always be answered with result packed. Result does not have to
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   565
be positive &ndash; it can include an error code, or it can be special "N" result that indicates that command was not recognized,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   566
but there always must be one. Since client
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   567
cannot detect that a response is missing, if for some reasons peer is not able to
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   568
answer a command, it should consider such situation a fatal communication error and
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   569
it must shutdown the communication channel. It is not necessary to wait for result
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   570
before sending next command. In fact, sending multiple commands in a burst can greatly
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   571
improve performance, especially when connection has high latency. At the same time,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   572
clients should be carefully designed to avoid flooding the communication channel with
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   573
unlimited number of requests, since this will use resources in forms of memory to
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   574
store the requests and time to process them.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   575
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   576
<h2><a name='ProtocolResults'>Results</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   577
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   578
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   579
<i>&lt;result&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   580
    &rArr; N &bull; <i>&lt;token&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   581
    &rArr; R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;byte array: result data&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   582
    &rArr; P &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;byte array: progress data&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   583
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   584
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   585
<p>Result packets start with string &ldquo;P&rdquo; for intermediate result, &ldquo;R&rdquo; for final
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   586
result, and &ldquo;N&rdquo; if command is not recognized. Receiving of &ldquo;R&rdquo; or &ldquo;N&rdquo; result concludes execution of corresponding command.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   587
There should be exactly one &ldquo;R&rdquo; or &ldquo;N&rdquo; result for each command. In addition, command execution can produce any number of
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   588
intermediate &ldquo;P&rdquo; results. &ldquo;P&rdquo; results can be sent before &ldquo;R&rdquo;, and it can serve, for
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   589
example, as command execution progress report when execution takes long time.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   590
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   591
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   592
<i>&lt;token&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   593
    &rArr; <i>&lt;chars&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   594
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   595
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   596
<p>Token should match token field of one of the pending commands that produced the result.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   597
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   598
<h2><a name='ProtocolEvents'>Events</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   599
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   600
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   601
<i>&lt;event&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   602
    &rArr; E &bull; <i>&lt;service name&gt;</i> &bull; <i>&lt;event name&gt;</i> &bull; <i>&lt;byte array: event data&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   603
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   604
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   605
<p>Event packets start with string &ldquo;E&rdquo;.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   606
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   607
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   608
<i>&lt;service name&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   609
    &rArr; <i>&lt;chars&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   610
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   611
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   612
<p>Service name identifies a service that fired event, same string as returned by
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   613
Service.getName().</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   614
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   615
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   616
<i>&lt;event name&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   617
    &rArr; <i>&lt;chars&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   618
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   619
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   620
<p>Event name meaning depends on a service.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   621
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   622
<p>Events are used to notify clients about changes in peer state. Services should
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   623
provide sufficient variety of events for clients to track remote peer state without
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   624
too much of polling. Clients, interested in a particular aspect of the target state,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   625
should have a &ldquo;reflection&rdquo; (or &ldquo;model&rdquo;) of that state and update the reflection by
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   626
listening for relevant events. If a service implements a command that changes a particular
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   627
aspect of peers state, then, normally, it should also generate notifications event
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   628
when that same part of the state changes and it should provide a command to retrieve
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   629
current value of the state &ndash; to be used by clients to initialize the reflection. Service
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   630
events are defined statically, together with commands. The framework does not do any
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   631
event processing besides delivering them to clients, however a service can define
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   632
additional event related functionality if necessary, for example, commands for event
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   633
filtering, enabling, disabling, registration, etc. Care should be taken when designing
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   634
events for a service - if events are sent too frequently, they will cause flooding
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   635
of the communication channels and degrade performance. However, too few events will
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   636
force clients to poll for changes and can also degrade performance. A balanced approach
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   637
is the best.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   638
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   639
<h2><a name='ProtocolFlowControl'>Flow Control</a> </h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   640
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   641
<p>It often happens that one side of communication channel produces messages faster
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   642
then they can be transmitted over the channel or can be consumed by another side.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   643
This will cause channel traffic congestion (flooding). Framework will deal with the
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   644
problem and slow down transmitting side by blocking execution inside sendEvent(),
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   645
sendCommand() and sendResult() functions when message buffers are full. However, in
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   646
many cases, it is not the best way to handle congestion. For example, it can make
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   647
a tool UI appear locked for prolonged time or it can break target software if it is
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   648
designed to work in real time. Clients can use flow control events to implement advanced
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   649
techniques to handle traffic congestion, for example, message coalescing, switching
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   650
to less detailed messages, etc.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   651
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   652
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   653
<i>&lt;flow control message&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   654
    &rArr; F &bull; <i>&lt;int: traffic congestion level&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   655
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   656
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   657
<p>Traffic congestion level value is in range &ndash;100..100, where &ndash;100 means no pending
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   658
messages (no traffic), 0 means optimal load, and positive numbers
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   659
indicate level of congestion. When a peer receives flow control message with congestion level > 0
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   660
it should try to reduce its transmition speed.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   661
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   662
<h2><a name='ProtocolExamples'>Message Examples</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   663
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   664
<p>Examples use simplified command arguments and result data. See service description
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   665
for actual data formats.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   666
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   667
<p>Executing <b><i>suspend</i></b> command from <b><i>RunControl</i></b> service:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   668
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   669
<p>&nbsp;</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   670
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   671
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   672
Send   :      C 1 RunControl suspend &ldquo;Thread1&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   673
Receive:      E RunControl suspended &ldquo;Thread1&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   674
Receive:      R 1 &ldquo;Success&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   675
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   676
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   677
<p>Same command, but target was already suspended:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   678
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   679
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   680
Receive:      E RunControl suspended &ldquo;Thread1&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   681
&hellip;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   682
Send   :      C 2 RunControl suspend &ldquo;Thread1&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   683
Receive:      R 2 &ldquo;Already suspended&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   684
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   685
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   686
<p>Same command, but target was suspended (by another client) after sending the command,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   687
but before command was executed: </p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   688
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   689
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   690
Receive:      E RunControl running &ldquo;Thread1&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   691
&hellip;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   692
Send   :      C 3 RunControl suspend &ldquo;Thread1&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   693
Receive:      E RunControl suspended &ldquo;Thread1&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   694
Receive:      R 3 &ldquo;Already suspended&rdquo;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   695
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   696
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   697
<h2><a name='API'>Framework API</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   698
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   699
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   700
<font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   701
 * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   702
 * Class Protocol provides static methods to access Target Communication Framework root objects:
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   703
 * 1. the framework event queue and dispatch thread;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   704
 * 2. local instance of Locator service, which maintains a list of available targets;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   705
 * 3. list of open communication channels.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   706
 */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   707
<font color=#7F0055>public class</font> Protocol {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   708
     
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   709
    <font color=#7F0055>private static</font> IEventQueue <i>event_queue</i>;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   710
     
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   711
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   712
     * Before TCF can be used it should be given an object implementing IEventQueue interface.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   713
     * The implementation maintains a queue of objects implementing Runnable interface and
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   714
     * executes <code>run</code> methods of that objects in a sequence by a single thread.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   715
     * The thread in referred as TCF event dispatch thread. Objects in the queue are called TCF events.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   716
     * Executing <code>run</code> method of an event is also called dispatching of event.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   717
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   718
     * Only few methods in TCF APIs are thread safe - can be invoked from any thread.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   719
     * If a method description does not say "can be invoked from any thread" explicitly -  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   720
     * the method must be invoked from TCF event dispatch thread. All TCF listeners are
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   721
     * invoked from the dispatch thread.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   722
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   723
     * <font color=#7F9FBF>@param</font> event_queue - IEventQueue implementation.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   724
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   725
    <font color=#7F0055>public static void</font> setEventQueue(IEventQueue event_queue);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   726
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   727
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   728
     * <font color=#7F9FBF>@return</font> instance of IEventQueue that should be used for TCF events.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   729
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   730
    <font color=#7F0055>public static</font> IEventQueue getEventQueue();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   731
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   732
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   733
     * Returns true if the calling thread is TCF dispatch thread.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   734
     * Use this call to ensure that a given task is being executed (or not being)
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   735
     * on dispatch thread.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   736
     * This method is thread-safe.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   737
     *
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   738
     * <font color=#7F9FBF>@return</font> true if running on the dispatch thread.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   739
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   740
    <font color=#7F0055>public static boolean</font> isDispatchThread();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   741
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   742
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   743
     * Causes runnable to have its run
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   744
     * method called in the dispatch thread of the framework.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   745
     * Runnables are dispatched in same order as queued.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   746
     * If invokeLater is called from the dispatching thread
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   747
     * the <i>runnable.run()</i> will still be deferred until
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   748
     * all pending events have been processed.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   749
     *
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   750
     * This method can be invoked from any thread.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   751
     *
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   752
     * <font color=#7F9FBF>@param runnable</font> the Runnable whose run
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   753
     * method should be executed asynchronously.</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   754
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   755
    <font color=#7F0055>public static void</font> invokeLater(Runnable runnable);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   756
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   757
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   758
     * Causes runnable to have its run
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   759
     * method called in the dispatch thread of the framework.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   760
     * Calling thread is suspended util the method is executed.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   761
     * This method is thread-safe.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   762
     *
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   763
     * <font color=#7F9FBF>@param runnable</font> the Runnable whose run
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   764
     * method should be executed on dispatch thread.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   765
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   766
    <font color=#7F0055>public static void</font> invokeAndWait(Runnable runnable)
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   767
        <font color=#7F0055>throws</font> InterruptedException;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   768
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   769
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   770
     * Get instance of the framework locator service.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   771
     * The service can be used to discover available remote peers.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   772
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   773
     * @return instance of ILocator.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   774
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   775
    <font color=#7F0055>public static</font> ILocator getLocator();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   776
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   777
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   778
     * Return an array of all open channels.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   779
     * @return an array of IChannel
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   780
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   781
    <font color=#7F0055>public static</font> IChannel[] getOpenChannels();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   782
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   783
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   784
     * Interface to be implemented by clients willing to be notified when
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   785
     * new TCF communication channel is opened.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   786
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   787
    <font color=#7F0055>public interface</font> ChannelOpenListener {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   788
        <font color=#7F0055>public void</font> onChannelOpen(IChannel channel);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   789
    }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   790
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   791
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   792
     * Add a listener that will be notified when new channel is opened.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   793
     * @param listener
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   794
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   795
    <font color=#7F0055>public static void</font> addChannelOpenListener(ChannelOpenListener listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   796
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   797
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   798
     * Remove channel opening listener.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   799
     * @param listener
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   800
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   801
    <font color=#7F0055>public static void</font> removeChannelOpenListener(ChannelOpenListener listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   802
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   803
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   804
     * Transmit TCF event message.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   805
     * The message is sent to all open communication channels &ndash; broadcasted.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   806
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   807
    <font color=#7F0055>public static void</font> sendEvent(String service, String name, byte[] data);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   808
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   809
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   810
     * Call back after TCF messages sent by this host up to this moment are delivered
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   811
     * to their intended target. This method is intended for synchronization of messages
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   812
     * across multiple channels.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   813
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   814
     * Note: Cross channel synchronization can reduce performance and throughput.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   815
     * Most clients don't need cross channel synchronization and should not call this method. 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   816
     *  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   817
     * @param done will be executed by dispatch thread after communication 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   818
     * messages are delivered to corresponding targets.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   819
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   820
    <font color=#7F0055>public static void</font> sync(Runnable done);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   821
}
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   822
  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   823
<font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   824
 * IChannel represents communication link connecting two endpoints (peers).
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   825
 * The channel asynchroniously transmits messages: commands, results and events.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   826
 * A single channel may be used to communicate with multiple services.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   827
 * Multiple channels may be used to connect the same peers, however no command or event
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   828
 * ordering is guaranteed across channels.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   829
 */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   830
<font color=#7F0055>public interface</font> IChannel {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   831
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   832
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   833
     * Channel state IDs
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   834
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   835
    <font color=#7F0055>static final</font> int
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   836
        <i><font color=#0000C0>STATE_OPENNING</font></i> = 0,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   837
        <i><font color=#0000C0>STATE_OPEN</font></i> = 1,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   838
        <i><font color=#0000C0>STATE_CLOSED</font></i> = 2;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   839
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   840
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   841
     * <font color=#7F9FBF>@return</font> channel current state, see STATE_*
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   842
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   843
    int getState();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   844
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   845
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   846
     * Send command message to remote peer for execution. Commands can be queued
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   847
     * locally before transmission. Sending commands too fast can fill up
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   848
     * communication channel buffers. Calling thread will be blocked until
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   849
     * enough buffer space is freed up by transmitting pending messages.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   850
     * <font color=#7F9FBF>@param</font> service - a remote service that will be sent the command
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   851
     * <font color=#7F9FBF>@param</font> name - command name
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   852
     * <font color=#7F9FBF>@param</font> args - command arguments encoded into array of bytes
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   853
     * <font color=#7F9FBF>@param</font> done - call back object
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   854
     * <font color=#7F9FBF>@return</font> pending command handle 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   855
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   856
    IToken sendCommand(IService service, String name, <font color=#7F0055>byte</font>[] args,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   857
        ICommandListener done);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   858
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   859
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   860
     * Command listener interface. Clients implement this interface
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   861
     * to receive command results.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   862
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   863
    <font color=#7F0055>interface</font> ICommandListener {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   864
        
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   865
        <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   866
         * Called when progress message (intermediate result) is received
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   867
         * from remote peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   868
         * <font color=#7F9FBF>@param</font> token - command handle
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   869
         * <font color=#7F9FBF>@param</font> data - progress message arguments encoded into array of bytes
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   870
         */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   871
        <font color=#7F0055>void</font> progress(<font color=#7F0055>byte</font>[] data);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   872
        
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   873
        <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   874
         * Called when command result received from remote peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   875
         * <font color=#7F9FBF>@param</font> token - command handle
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   876
         * <font color=#7F9FBF>@param</font> data - command result message arguments encoded into array of bytes
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   877
         */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   878
        <font color=#7F0055>void</font> result(<font color=#7F0055>byte</font>[] data);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   879
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   880
        <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   881
         * Called when communication channel was closed while command was waiting for result.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   882
         * <font color=#7F9FBF>@param</font> token - command handle
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   883
         * <font color=#7F9FBF>@param</font> error - exception that forced the channel to close
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   884
         */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   885
        <font color=#7F0055>void</font> terminated(IToken token, Exception error);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   886
    }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   887
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   888
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   889
     * Send result message to remote peer. Messages can be queued locally before
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   890
     * transmission. Sending messages too fast can fill up communication channel
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   891
     * buffers. Calling thread will be blocked until enough buffer space is
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   892
     * freed up by transmitting pending messages.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   893
     * <font color=#7F9FBF>@param</font> token - command handle
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   894
     * <font color=#7F9FBF>@param</font> results - result message arguments encoded into array of bytes
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   895
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   896
    <font color=#7F0055>void</font> sendResult(IToken token, <font color=#7F0055>byte</font>[] results);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   897
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   898
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   899
     * Get current level of outbound traffic congestion.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   900
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   901
     * <font color=#7F9FBF>@return</font> integer value in range &ndash;100..100, where &ndash;100 means no pending
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   902
     * messages (no traffic), 0 means optimal load, and positive numbers
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   903
     * indicate level of congestion.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   904
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   905
     * Note: in-bound traffic congestion is detected by framework and reported to
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   906
     * remote peer without client needed to be involved. Clients willing to provide
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   907
     * additional data about local congestion should register itself using
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   908
     * Protocol.addCongestionMonitor().
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   909
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   910
    int getCongestion();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   911
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   912
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   913
     * Channel listener interface.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   914
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   915
    <font color=#7F0055>interface</font> IChannelListener {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   916
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   917
        <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   918
         * Called when a channel is opened.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   919
         */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   920
        <font color=#7F0055>void</font> onChannelOpened();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   921
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   922
        <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   923
         * Called when channel closed. If it is closed because of an error,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   924
         * ‘error’ parameter will describe the error. ‘error’ is null if channel
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   925
         * is closed normally by calling Channel.close().
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   926
         * <font color=#7F9FBF>@param</font> error - channel exception or null
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   927
         */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   928
        <font color=#7F0055>void</font> onChannelClosed(Throwable error);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   929
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   930
        <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   931
         * Notifies listeners about congestion level changes. When level &gt; 0
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   932
         * client should delay sending more messages.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   933
         * <font color=#7F9FBF>@param</font> level - current congestion level
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   934
         */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   935
        <font color=#7F0055>void</font> congestionLevel(int level);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   936
    }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   937
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   938
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   939
     * Subscribe a channel listener. The listener will be notified about changes of
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   940
     * outbound traffic congestion level.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   941
     * <font color=#7F9FBF>@param</font> listener - channel listener implementation
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   942
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   943
    <font color=#7F0055>void</font> addChannelListener(IChannelListener listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   944
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   945
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   946
     * Remove a channel listener.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   947
     * <font color=#7F9FBF>@param</font> listener - channel listener implementation
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   948
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   949
    <font color=#7F0055>void</font> removeChannelListener(IChannelListener listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   950
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   951
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   952
     * Command server interface.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   953
     * This interface is to be implemented by service providers.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   954
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   955
    <font color=#7F0055>interface</font> ICommandServer {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   956
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   957
        <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   958
         * Called every time a command is received from remote peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   959
         * <font color=#7F9FBF>@param</font> token - command handle
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   960
         * <font color=#7F9FBF>@param</font> name - command name
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   961
         * <font color=#7F9FBF>@param</font> data - command arguments encoded into array of bytes
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   962
         */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   963
        <font color=#7F0055>void</font> command(IToken token, String name, <font color=#7F0055>byte</font>[] data);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   964
    }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   965
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   966
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   967
     * Subscribe a command server. The server will be notified about command
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   968
     * messages received through this channel for given service.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   969
     * <font color=#7F9FBF>@param</font> service - local service implementation
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   970
     * <font color=#7F9FBF>@param</font> server - implementation of service commands listener 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   971
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   972
    <font color=#7F0055>void</font> addCommandServer(IService service, ICommandServer listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   973
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   974
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   975
     * Remove a command server.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   976
     * <font color=#7F9FBF>@param</font> service - local service implementation
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   977
     * <font color=#7F9FBF>@param</font> server - implementation of service commands listener 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   978
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   979
    <font color=#7F0055>void</font> removeCommandServer(IService service, ICommandServer listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   980
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   981
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   982
     * A generic interface for service event listener.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   983
     * Services usually define a service specific event listener interface,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   984
     * which is implemented using this generic listener.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   985
     * Service clients should use service specific listener interface,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   986
     * unless no such interface is defined.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   987
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   988
    <font color=#7F0055>interface</font> IEventListener {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   989
        <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   990
         * Called when service event message is received
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   991
         * <font color=#7F9FBF>@param</font> name - event name
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   992
         * <font color=#7F9FBF>@param</font> data - event arguments encode as array of bytes
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   993
         */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   994
        <font color=#7F0055>void</font> event(String name, <font color=#7F0055>byte</font>[] data);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   995
    }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   996
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   997
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   998
     * Subscribe an event message listener for given service.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
   999
     * <font color=#7F9FBF>@param</font> service - remote service proxy
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1000
     * <font color=#7F9FBF>@param</font> server - implementation of service event listener 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1001
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1002
    <font color=#7F0055>void</font> addEventListener(IService service, IEventListener listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1003
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1004
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1005
     * Unsubscribe an event message listener for given service.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1006
     * <font color=#7F9FBF>@param</font> service - remote service proxy
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1007
     * <font color=#7F9FBF>@param</font> server - implementation of service event listener 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1008
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1009
    <font color=#7F0055>void</font> removeEventListener(IService service, IEventListener listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1010
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1011
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1012
     * <font color=#7F9FBF>@return</font> IPeer object representing local endpoint of communication channel.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1013
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1014
    IPeer getLocalPeer();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1015
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1016
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1017
     * <font color=#7F9FBF>@return</font> IPeer object representing remote endpoint of communication channel.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1018
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1019
    IPeer getRemotePeer();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1020
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1021
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1022
     * <font color=#7F9FBF>@return</font> collection of services available on local peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1023
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1024
    Collection&lt;String> getLocalServices();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1025
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1026
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1027
     * <font color=#7F9FBF>@return</font> an object representing a service from local peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1028
     * Return null if the service is not available.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1029
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1030
    IService getLocalService(String service_name);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1031
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1032
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1033
     * <font color=#7F9FBF>@return</font> an object representing a service from local peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1034
     * Service object should implement given interface.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1035
     * Return null if implementation of the interface is not available.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1036
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1037
    &lt;V <font color=#7F0055>extends</font> IService> V getLocalService(Class&lt;V> service_interface);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1038
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1039
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1040
     * <font color=#7F9FBF>@return</font> collection of services available on remote peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1041
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1042
    Collection&lt;String> getRemoteServices();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1043
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1044
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1045
     * <font color=#7F9FBF>@return</font> an object (proxy) representing a service from remote peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1046
     * Return null if the service is not available.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1047
     * Return an instance of GenericProxy if 'service_name' is not a standard TCF service.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1048
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1049
    IService getRemoteService(String service_name);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1050
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1051
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1052
     * <font color=#7F9FBF>@return</font> an object (proxy) representing a service from remote peer,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1053
     * which implements given interface.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1054
     * Return null if implementation of the interface is not available.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1055
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1056
    &lt;V <font color=#7F0055>extends</font> IService> V getRemoteService(Class&lt;V> service_interface);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1057
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1058
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1059
     * Install a service proxy object on this channel.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1060
     * This method can be called only from channel open call-back.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1061
     * It allows a client to extends TCF by adding proxy objects for non-standard services.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1062
     * Client, wishing to become service proxy provider, should register itself
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1063
     * using either Protocol.addChannelOpenListener() or IChannel.addChannelListener().
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1064
     * It is not allowed to register more then one proxy for a given service interface.   
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1065
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1066
    &lt;V <font color=#7F0055>extends</font> IService&gt; <font color=#7F0055>void</font> setServiceProxy(Class&lt;V&gt; service_interface, IService service_proxy);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1067
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1068
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1069
     * Close communication channel.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1070
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1071
    <font color=#7F0055>void</font> close();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1072
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1073
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1074
     * Close channel in case of communication error.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1075
     * <font color=#7F9FBF>@param error</font> - cause of channel termination
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1076
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1077
    <font color=#7F0055>void</font> terminate(Throwable error);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1078
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1079
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1080
     * Redirect this channel to given peer using this channel remote peer locator service as a proxy.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1081
     * <font color=#7F9FBF>@param peer_</font> - peer that will become new remote communication endpoint of this channel
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1082
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1083
    <font color=#7F0055>void</font> redirect(IPeer peer);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1084
}
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1085
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1086
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1087
<font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1088
 * Object implemeting IToken interface is created by framework for every
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1089
 * command sent over communication channel. It is used to match command to its
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1090
 * results, and also can be used to cancel commands.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1091
 */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1092
<font color=#7F0055>public</font> interface IToken {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1093
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1094
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1095
     * Try to cancel a command associated with given token. A command can be
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1096
     * canceled by this method only if it was not transmitted yet to remote peer
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1097
     * for execution. Successfully canceled command does not produce any result
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1098
     * messages.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1099
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1100
     * <font color=#7F9FBF>@return</font> true if successful.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1101
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1102
    <font color=#7F0055>boolean</font> cancel();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1103
}
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1104
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1105
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1106
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1107
<h1><a name='JSON'>Preferred Marshaling</a></h1>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1108
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1109
<p>TCF messages data format is service specific. Since services specifications are
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1110
separate from protocol specification, a service designer can choose any data format that
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1111
suits the service requirements best. However, to promote better compatibility and to
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1112
simplify service design and implementation, we recommend to use <b>JSON</b> for data formatting.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1113
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1114
<p><b>JSON</b> (pronounced like the
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1115
English given name <i>Jason</i>), which stands for "<b>J</b>ava<b>S</b>cript <b>O</b>bject
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1116
<b>N</b>otation", is a lightweight, text-based, language-independent computer data
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1117
interchange format. <b>JSON</b> is a subset of the object literal notation of JavaScript
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1118
but its use does not require JavaScript.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1119
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1120
<p><b>JSON</b> represents data with the same basic types that programming languages
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1121
use. <b>JSON</b>'s basic types are:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1122
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1123
<ul type='disc'>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1124
    <li>Number (integer, real, or floating-point) 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1125
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1126
    <li>String (double-quoted with backslash escapement) 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1127
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1128
    <li>Boolean (<code>true</code> and <code>false</code>)
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1129
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1130
    <li>Array (an ordered sequence of values) 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1131
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1132
    <li>Object (collection of key/value pairs) 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1133
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1134
    <li><code>null</code> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1135
 </ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1136
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1137
<p>The structures used in most programming languages easily map directly onto JSON's
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1138
structures, and back again.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1139
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1140
<p>JSON maps data onto Unicode string. Then the string is mapped onto array of bytes
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1141
using UTF-8 encoding.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1142
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1143
<p>JSON specification:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1144
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1145
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1146
<i>&lt;object&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1147
    &rArr; {}
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1148
    &rArr; { <i>&lt;members&gt;</i> }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1149
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1150
<i>&lt;members&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1151
    &rArr; <i>&lt;string&gt;</i> : <i>&lt;value&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1152
    &rArr; <i>&lt;members&gt;</i> , <i>&lt;string&gt;</i> : <i>&lt;value&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1153
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1154
<i>&lt;array&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1155
    &rArr; []
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1156
    &rArr; [ <i>&lt;elements&gt;</i> ]
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1157
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1158
<i>&lt;elements&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1159
    &rArr; <i>&lt;value&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1160
    &rArr; <i>&lt;elements</i>&gt; , <i>&lt;value&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1161
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1162
<i>&lt;value&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1163
    &rArr; <i>&lt;string&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1164
    &rArr; <i>&lt;number&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1165
    &rArr; <i>&lt;object&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1166
    &rArr; <i>&lt;array&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1167
    &rArr; <i>&lt;boolean&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1168
    &rArr; null
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1169
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1170
<i>&lt;boolean&gt;</i> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1171
    &rArr; true
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1172
    &rArr; false
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1173
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1174
<i>&lt;string&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1175
    &rArr; ""
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1176
    &rArr; " <i>&lt;chars&gt;</i> "
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1177
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1178
<i>&lt;chars&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1179
    &rArr; <i>&lt;char&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1180
    &rArr; <i>&lt;chars&gt; &lt;char&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1181
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1182
<i>&lt;char</i>&gt;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1183
    &rArr; <i>&lt;any Unicode except " or \ or control&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1184
    &rArr; \"<i></i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1185
    &rArr; \\<i></i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1186
    &rArr; \/<i></i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1187
    &rArr; \b<i></i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1188
    &rArr; \f<i></i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1189
    &rArr; \n<i></i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1190
    &rArr; \r<i></i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1191
    &rArr; \t<i></i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1192
    &rArr; \u <i>&lt;four-hex-digits&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1193
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1194
<i>&lt;number</i>&gt;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1195
    &rArr; <i>&lt;int&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1196
    &rArr; &lt;<i>int&gt; &lt;fraction&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1197
    &rArr; &lt;<i>int&gt; &lt;exponent&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1198
    &rArr; &lt;<i>int&gt; &lt;fraction&gt; &lt;exponent&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1199
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1200
<i>&lt;int&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1201
    &rArr; <i>&lt;digit&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1202
    &rArr; &lt;<i>digit 1-9&gt; &lt;digits&gt;</i> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1203
    &rArr; - &lt;<i>digit&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1204
    &rArr; - &lt;<i>digit 1-9&gt; &lt;digits</i>&gt;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1205
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1206
<i>&lt;fraction&gt;</i> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1207
    &rArr; . <i>&lt;digits&gt;</i> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1208
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1209
<i>&lt;exponent&gt;</i> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1210
    &rArr; <i>&lt;e&gt;</i> <i>&lt;digits&gt;</i> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1211
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1212
<i>&lt;digits&gt;</i> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1213
    &rArr; <i>&lt;digit&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1214
    &rArr; &lt;<i>digits&gt;</i> &lt;<i>digit&gt;</i> 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1215
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1216
<i>&lt;e&gt;</i>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1217
    &rArr; e
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1218
    &rArr; e+
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1219
    &rArr; e-
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1220
    &rArr; E
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1221
    &rArr; E+
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1222
    &rArr; E-
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1223
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1224
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1225
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1226
<p>See <a href='http://www.json.org/'>www.json.org</a> for more details.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1227
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1228
<h2><a name='JSONExamples'>Examples</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1229
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1230
<p>This is a JSON array containing two objects:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1231
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1232
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1233
   [
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1234
       {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1235
          "Precision": "zip",
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1236
          "Latitude":  37.7668,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1237
          "Longitude": -122.3959,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1238
          "City":      "SAN FRANCISCO",
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1239
          "State":     "CA",
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1240
          "Zip":       "94107",
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1241
          "Country":   "US"
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1242
       },
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1243
       {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1244
          "Precision": "zip",
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1245
          "Latitude":  37.371991,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1246
          "Longitude": -122.026020,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1247
          "City":      "SUNNYVALE",
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1248
          "State":     "CA",
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1249
          "Zip":       "94085",
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1250
          "Country":   "US"
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1251
       }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1252
   ]
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1253
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1254
  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1255
<h1><a name='Locator'>Locator Service</a></h1>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1256
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1257
<p>Locator Service uses transport layer to search for peers and to collect data about
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1258
peer's attributes and capabilities (services).  Discovery mechanism depends on transport
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1259
protocol and is part of that protocol handler. Targets, known by other hosts, are
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1260
added to local list of peers. <font color=red>Security? </font>Automatically discovered
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1261
targets require no further configuration. Additional targets can be configured manually.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1262
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1263
<p>All TCF peers must implement Locator service. The implementation is part of the framework itself.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1264
It is the only required service, all other services are optional and, formally, not part of the framework.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1265
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1266
<h2><a name='LocatorPeer'>Peer Atributes</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1267
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1268
<p><i>&lt;object: peer data&gt;</i> is collection of peer attributes. It should, at least, contain member
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1269
<b><font face="Courier New" size=2 color=#333399>"ID" : <i>&lt;string&gt;</i></font></b>.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1270
It can also contain a number of components describing peer properties and capabilities.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1271
Predefined attributes are:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1272
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1273
<ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1274
    <li><code><b><font face="Courier New" size=2 color=#333399>"ID" : <i>&lt;string&gt;</i></font></b></code>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1275
    - ID of the peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1276
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1277
    <li><code><b><font face="Courier New" size=2 color=#333399>"Name" : <i>&lt;string&gt;</i></font></b></code>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1278
    - human readable peer name.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1279
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1280
    <li><code><b><font face="Courier New" size=2 color=#333399>"OSName" : <i>&lt;string&gt;</i></font></b></code>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1281
    - peer OS name, if applicable.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1282
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1283
    <li><code><b><font face="Courier New" size=2 color=#333399>"TransportName" : <i>&lt;string&gt;</i></font></b></code>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1284
    - name of a trasport protocol to use to connect to this peer, for example: TCP.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1285
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1286
    <li><code><b><font face="Courier New" size=2 color=#333399>"Host" : <i>&lt;string&gt;</i></font></b></code>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1287
    - peer host name, if transport is TCP or UDP.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1288
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1289
    <li><code><b><font face="Courier New" size=2 color=#333399>"Aliases" : <i>&lt;string&gt;</i></font></b></code>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1290
    - peer host name aliases, if transport is TCP or UDP.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1291
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1292
    <li><code><b><font face="Courier New" size=2 color=#333399>"Addresses" : <i>&lt;string&gt;</i></font></b></code>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1293
    - peer IP addresses, if transport is TCP or UDP.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1294
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1295
    <li><code><b><font face="Courier New" size=2 color=#333399>"Port" : <i>&lt;string&gt;</i></font></b></code>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1296
    - peer port number, if transport is TCP or UDP.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1297
</ul>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1298
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1299
<p>Most clients dont need to know peer attributes other then ID and Name. Clients are expected to call IPeer.openChannel()
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1300
method and let the framework to check peers attributes and create appropriate communication cahnnel that is best suited for
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1301
communication with the peer. After a channel is established, a client can learn peer capabilities by looking
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1302
at services it implements (use IChannel.getRemoteServices() method to get a map of services).</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1303
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1304
<h2><a name='LocatorCommands'>Locator Service Commands</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1305
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1306
<h3><a name='LocatorCommandRedirect'>redirect</a></h3>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1307
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1308
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1309
C &bull; <i>&lt;token&gt;</i> &bull; Locator &bull; redirect &bull; <i>&lt;string: peer ID&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1310
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1311
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1312
<p>The command redirects the channel to become connected to given peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1313
Locator service starts acting as a proxy.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1314
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1315
<p>Reply:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1316
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1317
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1318
R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1319
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1320
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1321
<h3><a name='LocatorCommandSync'>sync</a></h3>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1322
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1323
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1324
C &bull; <i>&lt;token&gt;</i> &bull; Locator &bull; sync &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1325
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1326
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1327
<p>Sync command does nothing and simply returns back an empty result. The command is used for
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1328
cross channel synchronization. Since commands are executed in order they were issued, by waiting
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1329
for sync result a client makes sure that all commands, that were issued before sync, are fully processed.</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1330
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1331
<p>Reply:</p>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1332
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1333
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1334
R &bull; <i>&lt;token&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1335
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1336
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1337
<h2><a name='LocatorEvents'>Locator Service Events</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1338
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1339
<pre><b><font face="Courier New" size=2 color=#333399>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1340
E &bull; Locator &bull; Hello &bull; <i>&lt;array: service names&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1341
E &bull; Locator &bull; peerAdded &bull; <i>&lt;object: peer data&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1342
E &bull; Locator &bull; peerChanged &bull; <i>&lt;object: peer data&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1343
E &bull; Locator &bull; peerRemoved &bull; <i>&lt;string: peer ID&gt;</i> &bull;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1344
</font></b></pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1345
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1346
<dl>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1347
    <dt><b>Hello</b>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1348
        <dd>is the first message sent by the framework after establishing a communication channel.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1349
        The message lets other side of the channel to know capabilities of this peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1350
        Message data consists of an array of service names that are provided by the peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1351
        Service names list is a complete and unambiguous declaration of peer's capabilities.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1352
        To avoid ambiguity, different services (even slightly different, like versions of same service)
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1353
        must have different names. Framework delays all other communications between peers until exchange
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1354
        of Hello messages is complete.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1355
    <dt><b>peerAdded</b>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1356
        <dd>is sent when the service discovers a new peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1357
    <dt><b>peerChanged</b>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1358
        <dd>is sent when peer attributes change.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1359
    <dt><b>peerRemoved</b>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1360
        <dd>is sent when the service deletes information about a peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1361
</dl>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1362
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1363
<h2><a name='LocatorAPI'>Locator Service API</a></h2>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1364
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1365
<pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1366
<font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1367
 * Base interface for all service interfaces. A client can get list of available services
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1368
 * by calling IChannel.getLocalServices() and IChannel.getRemoteServices().
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1369
 * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1370
 * Remote services are represented by a proxy objects that implement service interfaces by
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1371
 * translating method calls to TCF messages and sending them to a remote peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1372
 * When communication channel is open, TCF automatically creates proxies for standard services.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1373
 * TCF clients can provides addition proxies for non-standard services by calling IChannel.setServiceProxy(). 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1374
 */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1375
<font color=#7F0055>public</font> interface IService {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1376
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1377
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1378
     * Get unique name of this service.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1379
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1380
    String getName();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1381
}
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1382
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1383
<font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1384
 * Both hosts and targets are represented by objects
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1385
 * implementing IPeer interface. A peer can act as host or
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1386
 * target depending on services it implements.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1387
 * List of currently known peers can be retrieved by
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1388
 * calling ILocator.getPeers
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1389
 */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1390
<font color=#7F0055>public interface</font> IPeer {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1391
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1392
    <font color=#7F0055>static final</font> String
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1393
        <i><font color=#0000C0>ATTR_ID</font></i> = <font color=#2A00FF>"ID"</font>,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1394
        <i><font color=#0000C0>ATTR_NAME</font></i> = <font color=#2A00FF>"Name"</font>,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1395
        <i><font color=#0000C0>ATTR_OS_NAME</font></i> = <font color=#2A00FF>"OSName"</font>,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1396
        <i><font color=#0000C0>ATTR_TRANSPORT_NAME</font></i> = <font color=#2A00FF>"TransportName"</font>,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1397
        <i><font color=#0000C0>ATTR_IP_HOST</font></i> = <font color=#2A00FF>"Host"</font>,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1398
        <i><font color=#0000C0>ATTR_IP_ALIASES</font></i> = <font color=#2A00FF>"Aliases"</font>,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1399
        <i><font color=#0000C0>ATTR_IP_ADDRESSES</font></i> = <font color=#2A00FF>"Addresses"</font>,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1400
        <i><font color=#0000C0>ATTR_IP_PORT</font></i> = <font color=#2A00FF>"Port"</font>;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1401
            
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1402
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1403
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1404
     * <font color=#7F9FBF>@return</font> map of peer attributes
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1405
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1406
    Map&lt;String, String&gt; getAttributes();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1407
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1408
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1409
     * <font color=#7F9FBF>@return</font> peer unique ID, same as getAttributes().get(ATTR_ID)
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1410
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1411
    String getID();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1412
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1413
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1414
     * <font color=#7F9FBF>@return</font> peer name, same as getAttributes().get(ATTR_NAME)
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1415
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1416
    String getName();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1417
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1418
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1419
     * Same as getAttributes().get(ATTR_OS_NAME)
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1420
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1421
    String getOSName();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1422
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1423
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1424
     * Same as getAttributes().get(ATTR_TRANSPORT_NAME)
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1425
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1426
    String getTransportName();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1427
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1428
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1429
     * Open channel to communicate with this peer.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1430
     * Note: the channel is not fully open yet when this method returns.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1431
     * It's state is IChannel.STATE_OPENNING.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1432
     * Protocol.Listener will be called when the channel will be opened or closed.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1433
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1434
    IChannel openChannel() <font color=#7F0055>throws</font> IOException;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1435
}
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1436
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1437
<font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1438
 * ILocator service uses transport layer to search for peers and to collect data about
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1439
 * peer's attributes and capabilities (services). Discovery mechanism depends on
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1440
 * transport protocol and is part of that protocol handler. Targets, known by other
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1441
 * hosts, are added to local list of peers.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1442
 * Automatically discovered targets require no further configuration. Additional targets
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1443
 * can be configured manually.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1444
 * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1445
 * Clients should use Protocol.getLocator() to obtain local instance of ILocator,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1446
 * then ILocator.getPeers() can be used to get of available peers (hosts and targets).
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1447
 */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1448
<font color=#7F0055>public interface</font> ILocator <font color=#7F0055>extends</font> IService {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1449
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1450
    <font color=#7F0055>static final</font> String <i><font color=#0000C0>NAME</font></i> = <font color=#2A00FF>"Locator"</font>;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1451
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1452
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1453
     * Auto-configuration command and response codes.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1454
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1455
    <font color=#7F0055>static final int</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1456
        <i><font color=#0000C0>CONF_REQ_INFO</font></i> = 1,
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1457
        <i><font color=#0000C0>CONF_PEER_INFO</font></i> = 2;
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1458
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1459
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1460
     * <font color=#7F9FBF>@return</font> Locator service name: "Locator"
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1461
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1462
    String getName();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1463
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1464
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1465
     * Get map (ID -> IPeer) of available peers (hosts and targets).
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1466
     * The method return cached (currently known to the framework) list of peers.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1467
     * The list is updated according to event received from transport layer
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1468
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1469
    Map&lt;String,IPeer&gt; getPeers();
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1470
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1471
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1472
     * Redirect this service channel to given peer using this service as a proxy.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1473
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1474
    IToken redirect(String peer_id, DoneRedirect done);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1475
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1476
    <font color=#7F0055>interface</font> DoneRedirect {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1477
        <font color=#7F0055>void</font> doneRedirect(IToken token, Exception error);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1478
    }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1479
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1480
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1481
     * Call back after TCF messages sent to this target up to this moment are delivered.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1482
     * This method is intended for synchronization of messages
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1483
     * across multiple channels.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1484
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1485
     * Note: Cross channel synchronization can reduce performance and throughput.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1486
     * Most clients don't need channel synchronization and should not call this method. 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1487
     *  
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1488
     * @param done will be executed by dispatch thread after communication 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1489
     * messages are delivered to corresponding targets.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1490
     * 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1491
     * This is internal API, TCF clients should use {@code org.eclipse.tm.tcf.protocol.Protocol}.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1492
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1493
    IToken sync(DoneSync done);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1494
    
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1495
    <font color=#7F0055>interface</font> DoneSync {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1496
        <font color=#7F0055>void</font> doneSync(IToken token);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1497
    }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1498
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1499
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1500
     * Add a listener for locator service events.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1501
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1502
    <font color=#7F0055>void</font> addListener(Listener listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1503
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1504
    <font color=#3F5FBF>/**
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1505
     * Remove a listener for locator service events.
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1506
     */</font>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1507
    <font color=#7F0055>void</font> removeListener(Listener listener);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1508
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1509
    <font color=#7F0055>interface</font> Listener {
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1510
        <font color=#7F0055>void</font> peerAdded(IPeer peer);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1511
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1512
        <font color=#7F0055>void</font> peerRemoved(IPeer peer);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1513
 
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1514
        <font color=#7F0055>void</font> peerChanged(IPeer peer);
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1515
    }
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1516
}
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1517
</pre>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1518
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1519
</body>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1520
</html>
11a6943ebeb2 add dsdp/tm/tcf_0_3_x
duane.cawthron@nokia.com
parents:
diff changeset
  1521