annotate src/tooltalk.doc @ 5887:6eca500211f4

Prototype for X509_check_host() has changed, detect this in configure.ac ChangeLog addition: 2015-04-09 Aidan Kehoe <kehoea@parhasard.net> * configure.ac: If X509_check_host() is available, check the number of arguments it takes. Don't use it if it takes any number of arguments other than five. Also don't use it if <openssl/x509v3.h> does not declare it, since if that is so there is no portable way to tell how many arguments it should take, and so we would end up smashing the stack. * configure: Regenerate. src/ChangeLog addition: 2015-04-09 Aidan Kehoe <kehoea@parhasard.net> * tls.c: #include <openssl/x509v3.h> for its prototype for X509_check_host(). * tls.c (tls_open): Pass the new fifth argument to X509_check_host().
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 09 Apr 2015 14:27:02 +0100
parents 90dcf2376909
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5477
90dcf2376909 Last minute notice fixups.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 5416
diff changeset
1 Copyright (C) 1993 Sun Microsystems, Inc.
90dcf2376909 Last minute notice fixups.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 5416
diff changeset
2
5416
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
3 This file is part of XEmacs.
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
4
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
5 XEmacs is free software: you can redistribute it and/or modify it
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
6 under the terms of the GNU General Public License as published by the
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
7 Free Software Foundation, either version 3 of the License, or (at your
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
8 option) any later version.
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
9
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
10 XEmacs is distributed in the hope that it will be useful, but WITHOUT
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
13 for more details.
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
14
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
15 You should have received a copy of the GNU General Public License
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
16 along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
365bc8cb5894 Convert to GPLv3 misc files.
Mats Lidell <matsl@xemacs.org>
parents: 444
diff changeset
17
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Emacs Tooltalk API Summary
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 The Emacs Lisp interface to Tooltalk is similar, at least in spirit,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 to the standard C Tootalk API. Only the message and pattern parts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 of the API are supported at present, more of the API could be added
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 if needed. The Lisp interface departs from the C API in a few ways:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 - Tooltalk is initialized automatically at emacs startup-time. Messages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 can only be sent other Tooltalk applications connected to the same
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 X11 server that emacs is running on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 - There are fewer entry points, polymorphic functions with keyword
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 arguments are used instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 - The callback interface is simpler and marginally less functional.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 A single callback may be associated with a message or a pattern,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 the callback is specified with a Lisp symbol (the symbol should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 have a function binding).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 - The session attribute for messages and patterns is always
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 initialized to the default session.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 - Anywhere a Tooltalk enum constant, e.g. TT_SESSION, is valid one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 can substitute the corresponding symbol, e.g. 'TT_SESSION. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 simplifies building lists that represent messages and patterns.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 * Example: Receiving Messages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 Here's a simple example of a handler for a message that tells
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 emacs to display a string in the mini-buffer area. The message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 operation is called "emacs-display-string", its first (0th) argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 is the string to display:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 (defun tooltalk-display-string-handler (msg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 (message (get-tooltalk-message-attribute msg 'arg_val 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 (defvar display-string-pattern
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 '(category TT_HANDLE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 scope TT_SESSION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 op "emacs-display-string"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 callback tooltalk-display-string-handler))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 (let ((p (make-tooltalk-pattern display-string-pattern)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 (register-tooltalk-pattern p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 * Example: Sending Messages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 Here's a simple example that sends a query to another application
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 and then displays its reply. Both the query and the reply are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 stored in the first argument of the message.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 (defun tooltalk-random-query-handler (msg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 (let ((state (get-tooltalk-message-attribute msg 'state)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 ((eq state 'TT_HANDLED)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 (message (get-tooltalk-message-attribute msg arg_val 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 ((memq state '(TT_FAILED TT_REJECTED))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 (message "Random query turns up nothing")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 (defvar random-query-message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 '( class TT_REQUEST
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 scope TT_SESSION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 address TT_PROCEDURE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 op "random-query"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 args '((TT_INOUT "?" "string"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 callback tooltalk-random-query-handler))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 (let ((m (make-tooltalk-message random-query-message)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 (send-tooltalk-message m))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 * Emacs Lisp Tooltalk API
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 ** Sending Messages:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 (make-tooltalk-message attributes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 Create a tooltalk message and initialize its attributes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 The value of attributes must be a list of alternating keyword/values,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 where keywords are symbols that name valid message attributes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 For example:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 (make-tooltalk-message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 '(class TT_NOTICE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 scope TT_SESSION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 address TT_PROCEDURE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 op "do-something"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 Values must always be strings, integers, or symbols that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 represent Tooltalk constants. Attribute names are the same as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 those supported by set-tooltalk-message-attribute, plus 'args.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 The value of args should be a list of message arguments where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 each message argument has the following form:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 (mode [value [type]]) or just value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 Where mode is one of TT_IN, TT_OUT, TT_INOUT and type is a string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 If type isn't specified then "int" is used if the value is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 number otherwise "string" is used. If type is "string" then value is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 converted to a string (if it isn't a string already) with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 prin1-to-string. If only a value is specified then mode defaults
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 to TT_IN. If mode is TT_OUT then value and type don't need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 to be specified. You can find out more about the semantics and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 uses of ToolTalk message arguments in chapter 4 of the Tooltalk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 Programmers Guide.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 (send-tooltalk-message msg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 Send the message on its way. Once the message has been sent it's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 almost always a good idea to get rid of it with destroy-tooltalk-message.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 (return-tooltalk-message msg &optional mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 Send a reply to this message. The second argument can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 'reply, 'reject or 'fail, the default is 'reply. Before sending
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 a reply all message arguments whose mode is TT_INOUT or TT_OUT should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 have been filled in - see set-tooltalk-message-attribute."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 (get-tooltalk-message-attribute msg attribute &optional argn)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 Returns the indicated Tooltalk message attribute. Attributes are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 identified by symbols with the same name (underscores and all) as the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 suffix of the Tooltalk tt_message_<attribute> function that extracts the value.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 String attribute values are copied, enumerated type values (except disposition)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 are converted to symbols - e.g. TT_HANDLER is 'TT_HANDLER, uid and gid are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 represented by fixnums (small integers), opnum is converted to a string,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 and disposition is converted to a fixnum. We convert opnum (a C int) to a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 string, e.g. 123 => \"123\" because there's no guarantee that opnums will fit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 within the range of Emacs Lisp integers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 [TBD] Use the 'plist attribute instead of C API 'user attribute
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 for user defined message data. To retrieve the value of a message property
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 specify the indicator for argn. For example to get the value of a property
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 called 'rflagg, use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 (get-tooltalk-message-attribute msg 'plist 'rflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 To get the value of a message argument use one of the 'arg_val (strings),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 'arg_ival (integers), or 'arg_bval (strings with embedded nulls), attributes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 Because integer valued arguments can be larger than Emacs Lisp integers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 'arg_ival yields a string. If the value is will fit within 24 bits then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 convert it to an integer with string-to-int. For example to get the integer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 value of the third argument:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 (string-to-int (get-tooltalk-message-attribute msg 'arg_ival 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 As you can see, argument numbers are zero based. The type of each arguments
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 can be retrieved, with the 'arg_type attribute, however Tooltalk doesn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 define any semantics for the string value of 'arg_type. Conventionally
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 "string" is used for strings and "int" for 32 bit integers. Note that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 Emacs Lisp stores the lengths of strings explicitly (unlike C) so treating the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 value returned by 'arg_bval like a string is fine.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 (set-tooltalk-message-attribute value msg attribute &optional argn)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 Initialize one ToolTalk message attribute.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 Attribue names and values are the same as for get-tooltalk-message-attribute.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 A property list is provided for user data (instead of the 'user message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 attribute), see get-tooltalk-message-attribute.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 Callbacks are handled slightly differently than in the C Tooltalk API.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 The value of callback should be the name of a function of one argument.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 It will be called each time the state of the message changes. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 is usually used to notice when the messages state has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 changed to TT_HANDLED (or TT_FAILED), so that reply argument values
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 can be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 If one of the argument attributes is specified, 'arg_val, 'arg_ival, or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 'arg_bval then argn must be the number of an already created argument.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 Arguments can be added to a message with add-tooltalk-message-arg.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 (add-tooltalk-message-arg msg mode type &optional value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 Append one new argument to the message. Mode must be one of: TT_IN,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 TT_INOUT, or TT_OUT, type must be a string, and value can
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 be a string or an integer. Tooltalk doesn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 define any semantics for type, so only the participants in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 protocol you're using need to agree what types mean (if anything).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 Conventionally "string" is used for strings and "int" for 32 bit integers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 Arguments can initialized by providing a value or with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 set-tooltalk-message-attribute, the latter is necessary if you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 want to initialize the argument with a string that can contain
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 embedded nulls (use 'arg_bval).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 (create-tooltalk-message)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 Create a new tooltalk message. The messages session attribute is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 initialized to the default session. Other attributes can be initialized
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 with set-tooltalk-message-attribute. Make-tooltalk-message is the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 preferred to create and initialize a message.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 (destroy-tooltalk-message msg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 Apply tt_message_destroy to the message. It's not necessary
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 to destroy messages after they've been processed by a message or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 pattern callback, the Lisp/Tooltalk callback machinery does this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 for you.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 ** Receiving Messages:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 (make-tooltalk-pattern attributes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 Create a tooltalk pattern and initialize its attributes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 The value of attributes must be a list of alternating keyword/values,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 where keywords are symbols that name valid pattern attributes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 or lists of valid attributes. For example:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 (make-tooltalk-pattern
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 '(category TT_OBSERVE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 scope TT_SESSION
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 op ("operation1" "operation2")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 Attribute names are the same as those supported by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 add-tooltalk-pattern-attribute, plus 'args.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 Values must always be strings, integers, or symbols that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 represent Tooltalk constants or lists of same. When a list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 of values is provided all of the list elements are added to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 the attribute. In the example above, messages whose op
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 attribute is "operation1" or "operation2" would match the pattern.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 The value of args should be a list of pattern arguments where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 each pattern argument has the following form:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 (mode [value [type]]) or just value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 Where mode is one of TT_IN, TT_OUT, TT_INOUT and type is a string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 If type isn't specified then "int" is used if the value is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 number otherwise "string" is used. If type is "string" then value is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 converted to a string (if it isn't a string already) with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 prin1-to-string. If only a value is specified then mode defaults
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 to TT_IN. If mode is TT_OUT then value and type don't need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 to be specified. You can find out more about the semantics and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 uses of ToolTalk pattern arguments in chapter 3 of the Tooltalk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 Programmers Guide.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 (register-tooltalk-pattern pat)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 Emacs will begin receiving messages that match this pattern.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 (unregister-tooltalk-pattern pat)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 Emacs will stop receiving messages that match this pattern.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 (add-tooltalk-pattern-attribute value pat indicator)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 Add one value to the indicated pattern attribute. The names of attributes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 are the same as the Tooltalk accessors used to set them less the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 "tooltalk_pattern_" prefix and the "_add" suffix). For example
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 428
diff changeset
295 the name of the attribute for tt_pattern_disposition_add attribute
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 is 'disposition. The 'category attribute is handled specially,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 since a pattern can only be a member of one category (TT_OBSERVE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 or TT_HANDLE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 Callbacks are handled slightly differently than in the C Tooltalk API.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 The value of callback should be the name of a function of one argument.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 It will be called each time the pattern matches an incoming message.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 (add-tooltalk-pattern-arg pat mode type value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 Add one, fully specified, argument to a tooltalk pattern. Mode must
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 be one of TT_IN, TT_INOUT, or TT_OUT, type must be a string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 Value can be an integer, string or nil. If value is an integer then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 an integer argument (tt_pattern_iarg_add) added otherwise a string argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 is added. At present there's no way to add a binary data argument.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 (create-tooltalk-pattern)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 Create a new Tooltalk pattern and initialize its session attribute to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 be the default session.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 (destroy-tooltalk-pattern pat)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 Apply tt_pattern_destroy to the pattern. This effecticely unregisters
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 the pattern.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 (describe-tooltalk-message msg &optional stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 Print the messages attributes and arguments to stream. This is often
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 useful for debugging.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 * Things to be Done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 - At the moment there is almost no support for detecting and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 handling ToolTalk errors. This should be added.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 - Message and patterns should support a plist attribute. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 would be based on one more Tooltalk user data key. This would also make
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 it useful to apply the message and pattern callbacks to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 both the message and the matching pattern.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347