|
| 以 PDF 格式下载本书
An Overview of the ToolTalk Service
2
- As computer users increasingly demand that independently developed applications work together, inter-operability is becoming an important theme for software developers. By cooperatively using each other's facilities, inter-operating applications offer users capabilities that would be difficult to provide in a single application. The ToolTalk service is designed to facilitate the development of inter-operating applications that serve individuals and work groups.
2.1 ToolTalk Architecture
- The following ToolTalk service components work together to provide inter-application communication and object information management:
-
-
-
libtt is the ToolTalk application programming interface (API) library. Applications include the API library in their program and call the ToolTalk functions in the library.
- The ToolTalk service uses the ONC(TM) Remote Procedure Call (RPC) to communicate between these ToolTalk components.
- Applications provide the ToolTalk service with process and object type information. This information is stored in an XDR format file, which is referred to as the ToolTalk Types Database in this manual.
-
Figure 2-1 illustrates the ToolTalk service architecture.

Figure 2-1
2.2 Starting a ToolTalk Session
- The ToolTalk message server ttsession automatically starts when you open communication with the ToolTalk server. This background process must be running before any messages can be sent or received. Each message server defines a session.
-
Note - A session can have more than one session identifier.
- To manually start a session, enter the following command on the command line:
-
ttsession [-a level][-d display][-spStvh][-{E|X}][-c command]
|
- See Table 2-1 for a description of the ttsession command line options.
-
Table 2-1 ttsession
| Argument | Description |
| -a level | Sets the server authentication level.
The level must be unix, xauth, or des. |
| -d display | Directs ttsession to start an X session for the given display. Normally, ttsession uses the $DISPLAY environment variable. |
| -h | Prints help on how to invoke ttsession and exits. |
| -p | Starts a new ttsession and prints out its session id. |
| -S | Directs ttsession not to fork a background instance to manage its session. |
| -s | Enables silent operation; warning messages are not printed. |
| Note -- If neither the -c, -d, or -p options are specified, ttsession starts an X session for the display specified in the $DISPLAY environment variable. |
-
Table 2-1 ttsession
| Argument | Description |
| -t | Turns on trace mode. If trace mode is turned on while ttsession is running, messages appear on the console. Use this mode to see how messages are dispatched and delivered. Trace mode displays the state of a message when it is first seen by ttsession. It also displays any attempt to send the message to a given process with the success of that attempt. To toggle the trace mode on or off, use the USR1 signal. |
| -v | Prints the version number and exits. |
| -E | Reads in the types from the Classing Engine database. This option is disabled. (The ToolTalk service now uses the XDR format databases.) |
| -X | Reads in the types from the XDR format database in $TTHOME/.tt/types.xdr and /etc/tt/types.xdr. This option is the default. |
| -c command | Starts a process tree session and runs the given command. The special environment variable _SUN_TT_SESSION will be set to the name of this session. Any process that was started with this environment variable will default to be in this session. This option must be the last option on the command line; any characters placed after the -c option on the command line are taken as the command to be executed. If command is omitted, the value of $SHELL is used instead. |
| Note -- If neither the -c, -d, or -p options are specified, ttsession starts an X session for the display specified in the $DISPLAY environment variable. |
-
ttsession responds to two signals.
-
- If it receives the SIGUSR1 signal, it toggles the trace mode on or off.
- If it receives the SIGUSR2 signal, it rereads the types file.
Background and Batch Sessions
- Run your application as its own session if it runs as a background job, in a batch session, or in a session bound to a character terminal. To run your application in its own session, use the -c parameter with the ttsession command, as follows:
-
ttsession -c [ command-to-run-in-batch ]
|
- This command will fork off a shell from which you can run your application.
-
Note - The -c parameter must be the last option on the command line; any characters placed after the -c parameter on the command line are taken as the command to be executed.
X Window System
- To establish a session under the X Window System, execute ttsession either without arguments (which takes the display from the $DISPLAY environment variable) or specify the display with the -d parameter as follows:
-
- When ttsession is invoked, it immediately forks and the parent copy exits; the process managing the session executes in the background. The session is registered as a property, named by _SUN_TT_SESSION on the root window of screen 0; the host and port number is given for communication with the process managing the session.
Locating ttsession
- To display the sessid of the session for the Xdisplay:
-
xprop -root | grep _SUN_TT_SESSION
|
2.3 Maintaining ToolTalk Files and Databases
- The ToolTalk package contains a special set of shell commands you can use to copy, move, and remove ToolTalk files (that is, files mentioned in messages and files that contain ToolTalk objects). After a standard shell command (such as cp, mv, or rm) is performed, the ToolTalk service is notified that a file location has changed.
- The ToolTalk package also contains a database check and repair utility for the ToolTalk database, ttdbck, that you can use to check and repair your ToolTalk databases.
2.4 Demonstration Programs
- The ToolTalk service source files contain several interesting OpenWindows-based demonstration programs:
-
- CoEd A shared editor that uses ToolTalk messages to keep the shared edit session consistent across multiple editors. This program is OLIT-based.
- ttsample1 A simple demonstration of the ToolTalk service sending and receiving messages. This program is XView-based.
- ttsnoop A demonstration program that allows you to create and send custom-constructed ToolTalk messages. You can also use this program to selectively monitor any or all ToolTalk messages on your system. This program is XView-based.
- edit_demo Two programs - cntl and edit - that demonstrate ToolTalk object-oriented messaging. This program is XView-based.
|
|