JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
ToolTalk User's Guide
search filter icon
search icon

Document Information

Preface

1.  Introducing the ToolTalk Service

2.  An Overview of the ToolTalk Service

3.  Message Patterns

4.  Setting Up and Maintaining the ToolTalk Processes

5.  Maintaining Application Information

6.  Maintaining Files and Objects Referenced in ToolTalk Messages

7.  Participating in ToolTalk Sessions

8.  Sending Messages

9.  Dynamic Message Patterns

10.  Static Message Patterns

11.  Receiving Messages

Retrieving Messages

Identifying and Processing Messages Easily

Recognizing and Handling Replies Easily

Checking Message Status

Examining Messages

Callback Routines

Callbacks for Messages Addressed to Handlers

Attaching Callbacks to Static Patterns

Handling Requests

Replying to Requests

Rejecting or Failing a Request

Rejecting a Request

Failing a Request

Observing Offers

Destroying Messages

12.  Objects

13.  Managing Information Storage

14.  Handling Errors

A.  Migrating from the Classing Engine to the ToolTalk Types Database

B.  A Simple Demonstration of How the ToolTalk Service Works

C.  The ToolTalk Standard Message Sets

D.  Frequently Asked Questions

Glossary

Index

Examining Messages

When your process receives a message, you examine the message and take appropriate action.

Before you start to retrieve values, obtain a mark on the ToolTalk API stack so that you can release the information the ToolTalk service returns to you all at once. allocates storage, examines message contents, and releases the storage.

Example 11-3 Allocating, Examining, and Releasing Storage

        /*
         * Get a storage mark so we can easily free all the data
         * ToolTalk returns to us.
         */

        mark = tt_mark();

        if (0==strcmp(“ttsample1_value”, tt_message_op(msg_in))) {
                tt_message_arg_ival(msg_in, 0, &val_in);
                xv_set(gauge, PANEL_VALUE, val_in, NULL);
        }

        tt_message_destroy(msg_in);
        tt_release(mark);
        return;

lists the ToolTalk functions you use to examine the attributes of a message you have received.

Table 11-1 Functions to Examine Message Attributes

Return Type
ToolTalk Function
Description
Tt_address
tt_message_address(Tt_message m)
The address of the message.
Tt_status
tt_message_arg_bval(Tt_message m, int n, unsigned char **value, int *len)
The argument value as a byte array.
Tt_status
tt_message_arg_ival(Tt_message m, int n, int *value)
The argument value as an integer.
Tt_status
tt_message_arg_xval(Tt_message m, int n, xdrproc_t xdr_proc, void *value)
The argument value as an xdr.
Tt_mode
tt_message_arg_mode(Tt_message m, int n)
The argument mode (in, out, inout).
char *
tt_message_arg_type(Tt_message m, int n)
The argument type.
char *
tt_message_arg_val(Tt_message m, int n)
The argument value as a string.
int
tt_message_args_count(Tt_message m)
The number of arguments.
Tt_class
tt_message_class(Tt_message m)
The type of message (notice or request).
int
tt_message_contexts_count(Tt_message m);
The number of contexts.
char *
tt_message_context_slotname(Tt_message m, int n);
The name of a message's nth context.
Tt_disposition
tt_message_disposition(Tt_message m)
How to handle the message if there is no receiving application running.
char *
tt_message_file(Tt_message m)
The name of the file to which the message is scoped.
gid_t
tt_message_gid(Tt_message m)
The group identifier of the sending application.
char *
tt_message_handler(Tt_message m)
The procid of the handler.
char *
tt_message_handler_ptype(Tt_message m)
The ptype of the handler.
char *
tt_message_object(Tt_message m)
The object to which the message was sent.
char *
tt_message_op(Tt_message m)
The operation name.
int
tt_message_opnum(Tt_message m)
The operation number.
char *
tt_message_otype(Tt_message m)
The object type to which the message was sent.
Tt_pattern
tt_message_pattern(Tt_message m)
The pattern to which the message is to be matched.
Tt_scope
tt_message_scope(Tt_message m)
Who is to receive the message (FILE, SESSION, BOTH).
char *
tt_message_sender(Tt_message m)
The procid of the sending application.
char *
tt_message_sender_ptype(Tt_message m)
The ptype of the sending application.
char *
tt_message_session(Tt_message m)
The session from which the message was sent.
Tt_state
tt_message_state(Tt_message m)
The current state of the message.
int
tt_message_status(Tt_message m)
The current status of the message.
char *
tt_message_status_string(Tt_message m)
Text describing the current status of the message.
uid_t
tt_message_uid(Tt_message m)
The user identifier of the sending application.
void *
tt_message_user(Tt_message m, int key)
Opaque data internal to the application.