summaryrefslogtreecommitdiff
path: root/doc/ivy-c-functions.1
blob: 491234013dee4fab820a88361dfffb8ca22f6d91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
'\"
'\" Ivy, C interface \- library managing connexions to a software bus
'\"
'\" Copyright (C) 1997-1999
'\" Centre d'Études de la Navigation Aérienne
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" 
'\" 
'\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ie !"\\$3"" \{\
.ta \\n()Au \\n()Bu
\&\\$1	\\fI\\$2\\fP	(\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
'\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
'\"	# BS - start boxed text
'\"	# ^y = starting y location
'\"	# ^b = 1
.TH Ivy-c-3.0 1 3.0  "Ivy-c-3.0 Library Functions"
.SH NAME
IvyInit, IvyStart, IvyStop, IvyBindMsg, IvyUnbindMsg, IvyBindDirectMsg,
IvySendMsg, IvySendDirectMsg, IvySendDieMsg, IvySendError, IvyGetApplicationName,
IvyGetApplicationHost, IvyGetApplication, IvyGetApplicationList,
IvyGetApplicationMessages, IvyDefaultApplicationCallback, IvyClasses,
IvyChannelInit, IvyChannelSetUp, IvyMainLoop, IvyChannelClose,
IvyChannelDelete, IvyChannelHandleRead,
IvyChannelHandleExcpt,  IvyXtChannelInit, IvyXtChannelSetUp
IvyXtChannelClose, IvyXtHandleChannelRead, IvyXtHandleChannelDelete,
IvyXtChannelAppContext, 
.SH SYNOPSIS
useful set of library functions for communicating between different
processes through a software bus
.nf
.sp
\fBIvyInit(\fIAppName, ready, callback, data, die_callback, die_data\fB)\fR
.sp
void
\fBIvyStart(\fIbus\fB)\fR
.sp
void
\fBIvyStop()\fR
.sp
MsgRcvPtr
\fBIvyBindMsg(\fIcallback, user_data, regexp, ...\fB)\fR
.sp
void
\fBIvyUnbindMsg(\fIid\fB)\fR
.sp
void
\fBIvyBindDirectMsg(\fIcallback, user_data\fB)\fR
.sp
int
\fBIvySendMsg(\fIfmt_message, ...\fB)\fR
.sp
void
\fBIvySendDirectMsg(\fIapp, id, msg\fB)\fR
.sp
void
\fBIvySendDieMsg(\fIapp\fB)\fR
.sp
void
\fBIvySendError(\fIapp, id, fmt, ...\fB)\fR
.sp
char*
\fBIvyGetApplicationName(\fIapp\fB)\fR
.sp
char*
\fBIvyGetApplicationHost(\fIapp\fB)\fR
.sp
char*
\fBIvyGetApplication(\fIname\fB)\fR
.sp
char*
\fBIvyGetApplicationList()\fR
.sp
char**
\fBIvyGetApplicationMessages(\fapp\fB)\fR
.sp
char*
\fBIvyDefaultApplicationCallback(\fIapp, user_data, Event\fB)\fR
char*
\fBIvyClasses(\fIargc, argv\fB)\fR
.sp
void
\fBIvyChannelInit(\fIvoid\fB)\fR
.sp
Channel
\fBIvyChannelSetUp(\fIfd, data, handle_delete, handle_read\fB)\fR
.sp
void
\fBIvyMainLoop(\fIhook\fB)\fR
.sp
void
\fBIvyChannelClose(\fIchannel\fB)\fR
.sp
static void
\fBIvyChannelDelete(\fIchannel\fB)\fR
.sp
static void
\fBIvyChannelHandleRead(\fIcurrent\fB)\fR
.sp
static void
\fBIvyChannelHandleExcpt(\fIcurrent\fB)\fR
.sp
static void
\fBIvyXtChannelInit(\fIvoid\fB)\fR
.sp
static void
\fBIvyXtChannelSetUp(\fIfd, data, handle_delete, handle_read\fB)\fR
.sp
void
\fBIvyXtChannelClose(\fIchannel\fB)\fR
.sp
static void
\fBIvyXtHandleChannelRead(\fIclosure, source, id\fB)\fR
.sp
static void
\fBIvyXtHandleChannelDelete(\fIclosure, source, id\fB)\fR
.sp
void
\fBIvyChannelAppContext(\fIcntx\fB)\fR
.SH ARGUMENTS
Only main functions are detailed in this section
.SH
\fBIvyInit\fR:
Initialisation of a connection
.sp
.AS "MaxSize" die_callback
.AP const_char *AppName in
Application Name
.AP const_char *ready in
Ready Message (can be NULL)
.AP IvyApplicationCallback callback in
Callback to be called on a connexion/deconnexion of an application
.AP void *data in
user data 
.AP IvyDieCallback die_callback in
last change callback before die
.AP void *die_data in
user data
.SH Example:
\fBIvyInit ("PLN-SERVER", "PLN-READY", NULL, NULL, NULL);\fR
.SH
\fBIvyStart\fR:
Initialisation of TCP/UPD port and sending of a broadcast handshake on every network
.AP const_char *bus in
Bus to be used (format : network list followed by broadcast port).
.SH Example:
the given bus can be a string like 123.231,123.123:2000 or 123.231 or
:2000. If no argument is specified, then the environment variable
\fBIVYBUS\fR is checked, else the default value : 127.255.255.255:2010 
is used (broadcast on the local machine).
.nf
\fBIvyStart ("143.196.53.255:2001");\fR
.SH 
\fBIvyBindMsg\fR:
Message binding
.AP MsgCallback callback in
.AP void *user_data in
.AP const_char *regexp in
.AP MsgRcvPtr id out
.SH Example:
\fBIvyBindMsg (StartTimeCallback, 0,  "^CLOCK Start time=(.*)");\fR
.nf
In this example the function \fBStartTimeCallback\fR will be called
each time the string \fBCLOCK Start time=(.*)\fR will be emitted on
the bus.
.SH 
\fBIvyUnbindMsg\fR:
Message unbinding
.AP MsgRcvPtr id in
ident of the message to unbind
.SH 
\fBIvySendMsg\fR:
Sending a message
.AP const_char* fmt in
String to be sent on the bus
.SH Example:
\fBIvySendMsg ("SECTOR:%s.AIRCRAFT:%s Entered", sectorname, pln->indicatif);\fR
.SH
\fBIvyChannelSetUp\fR:
.AP HANDLE fd in
.AP void *data in
.AP ChannelHandleDelete handle_delete in
.AP ChannelHandleRead handle_read in
.AP Channel out out
.SH Example:
\fBIvyChannelSetUp (0, NULL, NULL, HandleStdin);\fR:
.VE 
.BE
.SH DESCRIPTION
.PP
These functions provide facilities for connecting applications on a
software bus and managing messages exchanges among them.
Each time an application initializes a connection on the bus, a
"ready" message is sent to all other applications already connected, and the
list of the messages subscribed by this application is dispatched.
The format for the messages is free.

.SH EXAMPLE
Connection of the application \fBIVYPROBE\fR on a given bus
.nf

.DS

#include "ivyloop.h"
#include "ivysocket.h"
#include "ivy.h"

 int main (int argc, char* argv[]){
/* bus domain and port number to be used */
	const char* bus="127.255.255.255:2010";
/* initialisation of the connection */
	IvyInit ("IVYPROBE",
		 bport,
		 "IVYPROBE READY",
		 ApplicationCallback,
		 NULL,
		 NULL,
		 NULL);
/* keyboard's inputs management */
	IvyChannelSetUp(0, NULL, NULL, HandleStdin);
/* starting the connection */
	IvyStart (bus);
/* Main loop */
	IvyMainLoop(0);
};
.DE

.SH FILES
.I /usr/include/ivy.h
.nf
.I /usr/include/ivyloop.h
.nf
.I /usr/include/ivysocket.h
.SH ENVIRONMENT
.I IVYBUS
.nf
.I IVYDOMAINS
.SH DIAGNOSTICS
error messages displayed
.SH BUGS
none reported yet!
.SH AUTHORS
Francois-Regis Colin <fcolin@cenatoulouse.dgac.fr>
Stephane Chatty <chatty@cenatoulouse.dgac.fr>
.SH SEE ALSO
ivyprobe (1)
.sp
For further details, please refer to the Ivy html page at http://www.cenatls.cena.dgac.fr/pii/produits/Ivy.html
.SH NOTES
In case of any comment or bug report on this library, please contact
fcolin@cenatoulouse.dgac.fr, chatty@cenatoulouse.dgac.fr, jacomi@cenatoulouse.dgac.fr