70
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
2 |
<html>
|
|
3 |
|
|
4 |
<head>
|
|
5 |
<TITLE>TCF Agent Prototype Implementation</TITLE>
|
|
6 |
</head>
|
|
7 |
|
|
8 |
<body LANG="EN-US">
|
|
9 |
|
|
10 |
<h1>TCF Agent Prototype Implementation</h1>
|
|
11 |
|
|
12 |
<p>
|
|
13 |
Copyright (c) 2009 Wind River Systems, Inc. Made available under the EPL v1.0
|
|
14 |
</p>
|
|
15 |
<p>
|
|
16 |
Direct comments, questions to the <a href="mailto:dsdp-tcf-dev@eclipse.org">dsdp-tcf-dev@eclipse.org</a> mailing list
|
|
17 |
</p>
|
|
18 |
|
|
19 |
<h2>Table of Contents</h2>
|
|
20 |
<ul>
|
|
21 |
<li>
|
|
22 |
<a href='#Introduction'>Introduction</a>
|
|
23 |
</li>
|
|
24 |
<li>
|
|
25 |
<a href='#Framework'>Target Communication Framework</a>
|
|
26 |
</li>
|
|
27 |
<li>
|
|
28 |
<a href='#Services'>Services</a>
|
|
29 |
</li>
|
|
30 |
<li>
|
|
31 |
<a href='#Context'>Executable Context Handling</a>
|
|
32 |
</li>
|
|
33 |
<li>
|
|
34 |
<a href='#EventQueue'>Agent Event Queue</a>
|
|
35 |
</li>
|
|
36 |
<li>
|
|
37 |
<a href='#Misc'>Misc</a>
|
|
38 |
</li>
|
|
39 |
<li>
|
|
40 |
<a href='#Architecture'>Architecture</a>
|
|
41 |
</li>
|
|
42 |
</ul>
|
|
43 |
|
|
44 |
<h1><a name='Introduction'>Inroduction<a></h1>
|
|
45 |
|
|
46 |
<p>This is a brief description of the TCF
|
|
47 |
agent prototype implementation.</p>
|
|
48 |
|
|
49 |
<p>The agent is implemented in C.
|
|
50 |
The code mostly uses POSIX APIs to improve portability.
|
|
51 |
|
|
52 |
|
|
53 |
<p>The agent is implemented as
|
|
54 |
an event driven program. The main event queue is handled by a single
|
|
55 |
thread – the event dispatch thread. Some sub-systems are using
|
|
56 |
other threads locally, but will never call other sub-systems using
|
|
57 |
these threads. Instead an event will be placed on the main event
|
|
58 |
queue to handle the inter sub-system communication.</p>
|
|
59 |
|
|
60 |
<p>Main program parses command line options and initialized sub-systems</p>
|
|
61 |
<p>Files:</p>
|
|
62 |
<ul>
|
|
63 |
<li>main.c</li>
|
|
64 |
</ul>
|
|
65 |
|
|
66 |
<h1><a name='Framework'>Target Communication Framework</a></h1>
|
|
67 |
|
|
68 |
<h3>Command and Event Registration and Dispatch</h3>
|
|
69 |
|
|
70 |
<p>This module handles registration of command and
|
|
71 |
event handlers. It is called when new messages are received and will
|
|
72 |
dispatch messages to the appropriate handler. It has no knowledge of
|
|
73 |
what transport protocol is used and what services do.</p>
|
|
74 |
<p>Files:</p>
|
|
75 |
<ul>
|
|
76 |
<li>protocol.c</li>
|
|
77 |
<li>protocol.h</li>
|
|
78 |
</ul>
|
|
79 |
|
|
80 |
<h3>Transport Layer</h3>
|
|
81 |
|
|
82 |
<p>Implements input and output stream over TCP/IP
|
|
83 |
transport and UDP based auto discovery.</p>
|
|
84 |
<p>Files:</p>
|
|
85 |
<ul>
|
|
86 |
<li>channel.c</li>
|
|
87 |
<li>channel.h</li>
|
|
88 |
<li>channel_tcp.c</li>
|
|
89 |
<li>channel_tcp.h</li>
|
|
90 |
<li>discovery.c</li>
|
|
91 |
<li>discovery.h</li>
|
|
92 |
<li>discovery_udp.c</li>
|
|
93 |
<li>discovery_udp.h</li>
|
|
94 |
<li>tcf.h</li>
|
|
95 |
</ul>
|
|
96 |
|
|
97 |
<h3>Input and Output Stream Interface and Library</h3>
|
|
98 |
|
|
99 |
<p>This module defines generic input and output stream
|
|
100 |
interfaces and supporting library functions.</p>
|
|
101 |
<p>Files:</p>
|
|
102 |
<ul>
|
|
103 |
<li>streams.c</li>
|
|
104 |
<li>streams.h</li>
|
|
105 |
</ul>
|
|
106 |
|
|
107 |
<h1><a name='Services'>Services</a></h1>
|
|
108 |
|
|
109 |
<h3>Breakpoint</h3>
|
|
110 |
|
|
111 |
<p>The breakpoint services implements a global
|
|
112 |
breakpoint list.</p>
|
|
113 |
<p>Files:</p>
|
|
114 |
<ul>
|
|
115 |
<li>breakpoints.c</li>
|
|
116 |
<li>breakpoints.h</li>
|
|
117 |
</ul>
|
|
118 |
|
|
119 |
<h3>Run Control</h3>
|
|
120 |
|
|
121 |
<p>This module implements the run control service. It
|
|
122 |
builds uses the context module to do low level control of contexts.
|
|
123 |
It implements a “safe queue” which contains events that
|
|
124 |
that should be processed then executable contexts are suspended. Incoming
|
|
125 |
TCF messages are suspended while the safe queue is non-empty and are
|
|
126 |
resumed when the last safe queue entry is handled.</p>
|
|
127 |
<p>Files:</p>
|
|
128 |
<ul>
|
|
129 |
<li>runctrl.c</li>
|
|
130 |
<li>runctrl.h</li>
|
|
131 |
</ul>
|
|
132 |
|
|
133 |
<h3>System Monitoring</h3>
|
|
134 |
|
|
135 |
<p>This module provides system level monitoring
|
|
136 |
information, similar to the UNIX top or Windows task manager.</p>
|
|
137 |
<p>Files:</p>
|
|
138 |
<ul>
|
|
139 |
<li>sysmon.c</li>
|
|
140 |
<li>sysmon.h</li>
|
|
141 |
</ul>
|
|
142 |
|
|
143 |
<h3>Agent Diagnostics</h3>
|
|
144 |
|
|
145 |
<p>This service is used to do end-to-end self test
|
|
146 |
from the host to the target.</p>
|
|
147 |
<p>Files:</p>
|
|
148 |
<ul>
|
|
149 |
<li>diagnostics.c</li>
|
|
150 |
<li>diagnostics.h</li>
|
|
151 |
</ul>
|
|
152 |
|
|
153 |
<h1><a name='Context'>Executable Context Handling</a></h1>
|
|
154 |
|
|
155 |
<p>This module handles process/thread OS contexts and
|
|
156 |
their state machine. All ptrace() handling is isolated to here.</p>
|
|
157 |
<p>Files:</p>
|
|
158 |
<ul>
|
|
159 |
<li>context.c</li>
|
|
160 |
<li>context.h</li>
|
|
161 |
</ul>
|
|
162 |
|
|
163 |
<h1><a name='EventQueue'>Agent Event Queue<a></h1>
|
|
164 |
|
|
165 |
<p>This module implements the main event queue
|
|
166 |
dispatch and queuing. All events are processed by a single thread.
|
|
167 |
Any thread can queue new events.</p>
|
|
168 |
<p>Files:</p>
|
|
169 |
<ul>
|
|
170 |
<li>events.c</li>
|
|
171 |
<li>events.h</li>
|
|
172 |
</ul>
|
|
173 |
|
|
174 |
<h1><a name='Misc'>Misc</a></h1>
|
|
175 |
|
|
176 |
<h3>Command line interpreter</h3>
|
|
177 |
|
|
178 |
<p>The module allows a user to interact with agent. Current implementation of command line interpreter is incomplete.</p>
|
|
179 |
<p>Files:</p>
|
|
180 |
<ul>
|
|
181 |
<li>cmdline.c</li>
|
|
182 |
<li>cmdline.h</li>
|
|
183 |
</ul>
|
|
184 |
|
|
185 |
<h3>Error message display</h3>
|
|
186 |
|
|
187 |
<p>This module defines agent error codes in addition to system codes defined in errno.h</p>
|
|
188 |
<p>Files:</p>
|
|
189 |
<ul>
|
|
190 |
<li>errors.c</li>
|
|
191 |
<li>errors.h</li>
|
|
192 |
</ul>
|
|
193 |
|
|
194 |
<h3>Exception Handling</h3>
|
|
195 |
|
|
196 |
<p>Exception handling. Functionality is similar to C++ try/catch.</p>
|
|
197 |
<p>Files:</p>
|
|
198 |
<ul>
|
|
199 |
<li>exceptions.c</li>
|
|
200 |
<li>exceptions.h</li>
|
|
201 |
</ul>
|
|
202 |
|
|
203 |
<h3>JSON Library</h3>
|
|
204 |
|
|
205 |
<p>The module contains utility functions for parsing and generating of JSON text.
|
|
206 |
TCF standard services use JSON as messages format. See <a href='TCF Specification.html#JSON'>JSON - Preferred Marshaling</a>
|
|
207 |
for JSON description.</p>
|
|
208 |
<p>Files:</p>
|
|
209 |
<ul>
|
|
210 |
<li>json.c</li>
|
|
211 |
<li>json.h</li>
|
|
212 |
</ul>
|
|
213 |
|
|
214 |
<h3>Double Linked List</h3>
|
|
215 |
|
|
216 |
<p>Utilitity module to support double linked lists.</p>
|
|
217 |
<p>Files:</p>
|
|
218 |
<ul>
|
|
219 |
<li>link.h</li>
|
|
220 |
</ul>
|
|
221 |
|
|
222 |
<h3>Host OS Abstraction</h3>
|
|
223 |
|
|
224 |
<p>Machine and OS dependend definitions.
|
|
225 |
This module implements host OS abstraction layer that helps make
|
|
226 |
agent code portable between Linux, Windows, VxWorks and potentially other OSes.</p>
|
|
227 |
<p>Files:</p>
|
|
228 |
<ul>
|
|
229 |
<li>mdep.c</li>
|
|
230 |
<li>mdep.h</li>
|
|
231 |
</ul>
|
|
232 |
|
|
233 |
<h3>Malloc Abstraction</h3>
|
|
234 |
|
|
235 |
<p>Provides local versions of malloc(), realloc() and free().</p>
|
|
236 |
<p>Files:</p>
|
|
237 |
<ul>
|
|
238 |
<li>myalloc.c</li>
|
|
239 |
<li>myalloc.h</li>
|
|
240 |
</ul>
|
|
241 |
|
|
242 |
<h3>Proxy</h3>
|
|
243 |
|
|
244 |
<p>Proxy service should allow tunneling of TCF messages to another target on behalf of a client.
|
|
245 |
This service intended to be used when a client has no direct access to a target.</p>
|
|
246 |
<p>Files:</p>
|
|
247 |
<ul>
|
|
248 |
<li>proxy.c</li>
|
|
249 |
<li>proxy.h</li>
|
|
250 |
</ul>
|
|
251 |
|
|
252 |
<h3>Test Application</h3>
|
|
253 |
|
|
254 |
<p>Test application is used by Diagnostics service to run various tests.</p>
|
|
255 |
<p>Files:</p>
|
|
256 |
<ul>
|
|
257 |
<li>test.c</li>
|
|
258 |
<li>test.h</li>
|
|
259 |
</ul>
|
|
260 |
|
|
261 |
<h3>Debug Logging</h3>
|
|
262 |
|
|
263 |
<p>The module implements logging and tracing that is mostly intended for debugging of the agent.</p>
|
|
264 |
<p>Files:</p>
|
|
265 |
<ul>
|
|
266 |
<li>trace.c</li>
|
|
267 |
<li>trace.h</li>
|
|
268 |
</ul>
|
|
269 |
|
|
270 |
<h1><a name='Architecture'>Architecture</a></h1>
|
|
271 |
|
|
272 |
<p><img SRC="TCF%20Architecture.png" NAME="graphics1" ALIGN=BOTTOM WIDTH=647 HEIGHT=359 BORDER=0></p>
|
|
273 |
|
|
274 |
</body>
|
|
275 |
</html>
|