ToolTalk, in the Common Desktop Environment (CDE), is a message brokering system that enables applications to communicate with each other without having direct knowledge of one another. Client and server applications can be developed independently, mixed and matched, and upgraded separately through plug-and-play. In addition, the Desktop Service can be called to perform methods on file and buffer objects on behalf of ToolTalk.
Figure 1 shows the ToolTalk Service listening for TtChmod client requests. ToolTalk Service brokers pattern-matched Chmod messages to the registered mock change-mode application server (ttchmodd) that is waiting to handle the incoming messages.
ToolTalk brokers the requests from the client to the server application. The Desktop Service can forward CDE object method invocations to the ToolTalk Service. With the Desktop, both C programs and dtksh scripts can initiate actions that are transmitted to the ToolTalk Service. Consequently, client invocations from the dtaction command line, application manager icons, and file manager icons can be directed through the Desktop Service to ToolTalk application services. Therefore, double clicking on a file icon in the file manager can be plugged into a ToolTalk registered application by first routing through the Desktop action and data-type service.
The key to the ToolTalk message brokering system is its ability to define process-type identifiers with specific operations and arguments. In Listing 1, the process-type (ptype) TtChmod will execute the ToolTalk change-mode daemon application ttchmodd. This occurs when the session operation Chmod with file name and mode arguments are matched from a request. Compiling the ptype definition with the tt_type_comp utility will register services for ToolTalk client applications to call. Consider the ptype as a C header file describing an application programming interface (API) and the compiled suite of ToolTalk Services definitions as a library of methods to call. For the list of installed process-type identifiers, try running tt_type_comp -P at the command line to dump the database to the screen.
The file change-mode application (ttchmod) described in Listing 2 is simply the Motif command widget. In Figure 2, the ttchmodd server application graphically prompts the user for a command, then calls the callback command callCB to execute it; however, for this example, the application just prints the command. The file change-mode application quickly becomes a plug-and-play service when it registers itself with the ToolTalk Service, then listens for messages to be handled by its ToolTalkCB receiver routine.
An application must first locate the ToolTalk session associated with the X display to register itself as a service, as shown in Listing 3. After the application sets its default session to the display session, the application can initiate itself as a ToolTalk process and obtain a ToolTalk file descriptor. When the ttchmodd application gets a handle on the ToolTalk session, then it can register the TtChmod process type and join the session to listen for requests.
ToolTalk sends a message to a registered service; the service listens on its ToolTalk file descriptor for input. When input is observed, the ToolTalkCB routine is triggered, and the message is read and analyzed. (See Listing 4.) The message's operation is checked, then the arguments are read from the message. ToolTalk messages are similar to a reentrant version of an ordinary C program's command-line arguments. The ttchmodd service is no longer needed after it reads the message, so the recipient tells the ToolTalk service to discard the message.
Getting Started with DevOps - Including New Data on IT Performance from Puppet Labs 2015 State of DevOps Report
August 27, 2015
12:00 PM CDT
DevOps represents a profound change from the way most IT departments have traditionally worked: from siloed teams and high-anxiety releases to everyone collaborating on uneventful and more frequent releases of higher-quality code. It doesn't matter how large or small an organization is, or even whether it's historically slow moving or risk averse — there are ways to adopt DevOps sanely, and get measurable results in just weeks.
Free to Linux Journal readers.Register Now!
|Secure Server Deployments in Hostile Territory, Part II||Jul 29, 2015|
|Hacking a Safe with Bash||Jul 28, 2015|
|KDE Reveals Plasma Mobile||Jul 28, 2015|
|Huge Package Overhaul for Debian and Ubuntu||Jul 23, 2015|
|diff -u: What's New in Kernel Development||Jul 22, 2015|
|Shashlik - a Tasty New Android Simulator||Jul 21, 2015|
- Hacking a Safe with Bash
- Secure Server Deployments in Hostile Territory, Part II
- Home Automation with Raspberry Pi
- Huge Package Overhaul for Debian and Ubuntu
- KDE Reveals Plasma Mobile
- The Controversy Behind Canonical's Intellectual Property Policy
- Shashlik - a Tasty New Android Simulator
- Embed Linux in Monitoring and Control Systems
- Purism Librem 13 Review
- diff -u: What's New in Kernel Development