TCF Agent Prototype Implementation

Copyright (c) 2009 Wind River Systems, Inc. Made available under the EPL v1.0

Direct comments, questions to the mailing list

Table of Contents


This is a brief description of the TCF agent prototype implementation.

The agent is implemented in C. The code mostly uses POSIX APIs to improve portability.

The agent is implemented as an event driven program. The main event queue is handled by a single thread – the event dispatch thread. Some sub-systems are using other threads locally, but will never call other sub-systems using these threads. Instead an event will be placed on the main event queue to handle the inter sub-system communication.

Main program parses command line options and initialized sub-systems


Target Communication Framework

Command and Event Registration and Dispatch

This module handles registration of command and event handlers. It is called when new messages are received and will dispatch messages to the appropriate handler. It has no knowledge of what transport protocol is used and what services do.


Transport Layer

Implements input and output stream over TCP/IP transport and UDP based auto discovery.


Input and Output Stream Interface and Library

This module defines generic input and output stream interfaces and supporting library functions.




The breakpoint services implements a global breakpoint list.


Run Control

This module implements the run control service. It builds uses the context module to do low level control of contexts. It implements a “safe queue” which contains events that that should be processed then executable contexts are suspended. Incoming TCF messages are suspended while the safe queue is non-empty and are resumed when the last safe queue entry is handled.


System Monitoring

This module provides system level monitoring information, similar to the UNIX top or Windows task manager.


Agent Diagnostics

This service is used to do end-to-end self test from the host to the target.


Executable Context Handling

This module handles process/thread OS contexts and their state machine. All ptrace() handling is isolated to here.


Agent Event Queue

This module implements the main event queue dispatch and queuing. All events are processed by a single thread. Any thread can queue new events.



Command line interpreter

The module allows a user to interact with agent. Current implementation of command line interpreter is incomplete.


Error message display

This module defines agent error codes in addition to system codes defined in errno.h


Exception Handling

Exception handling. Functionality is similar to C++ try/catch.


JSON Library

The module contains utility functions for parsing and generating of JSON text. TCF standard services use JSON as messages format. See JSON - Preferred Marshaling for JSON description.


Double Linked List

Utilitity module to support double linked lists.


Host OS Abstraction

Machine and OS dependend definitions. This module implements host OS abstraction layer that helps make agent code portable between Linux, Windows, VxWorks and potentially other OSes.


Malloc Abstraction

Provides local versions of malloc(), realloc() and free().



Proxy service should allow tunneling of TCF messages to another target on behalf of a client. This service intended to be used when a client has no direct access to a target.


Test Application

Test application is used by Diagnostics service to run various tests.


Debug Logging

The module implements logging and tracing that is mostly intended for debugging of the agent.