summaryrefslogtreecommitdiff
path: root/src/ivy.h
blob: d66e1c7b5aeb27232d6978dcc44542c842139937 (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
/*
 *	Ivy, C interface
 *
 *	Copyright (C) 1997-2000
 *	Centre d'Études de la Navigation Aérienne
 *
 * 	Main functions
 *
 *	Authors: François-Régis Colin <fcolin@cena.fr>
 *		 Stéphane Chatty <chatty@cena.fr>
 *
 *	$Id$
 * 
 *	Please refer to file version.h for the
 *	copyright notice regarding this software
 */

#ifndef IVY_H
#define IVY_H

#ifdef __cplusplus
extern "C" {
#endif

/* numero par default du bus */

#define DEFAULT_BUS 2010
#define DEFAULT_PRIORITY 100;

typedef struct _clnt_lst *IvyClientPtr;

typedef enum { IvyApplicationConnected, IvyApplicationDisconnected } IvyApplicationEvent;
typedef enum { IvyAddBind, IvyRemoveBind } IvyBindEvent;

extern void IvyDefaultApplicationCallback( IvyClientPtr app, void *user_data, IvyApplicationEvent event ) ;
extern void IvyDefaultBindCallback( IvyClientPtr app, void *user_data, IvyBindEvent event, char* regexp ) ;


/* callback callback appele sur connexion deconnexion d'une appli */
typedef void (*IvyApplicationCallback)( IvyClientPtr app, void *user_data, IvyApplicationEvent event ) ;

/* callback callback appele sur ajout ou suppression d'un bind */
typedef void (*IvyBindCallback)( IvyClientPtr app, void *user_data, IvyBindEvent event, char* regexp ) ;

/* callback appele sur reception de die */
typedef void (*IvyDieCallback)( IvyClientPtr app, void *user_data, int id ) ;

/* callback appele sur reception de messages normaux */
typedef void (*MsgCallback)( IvyClientPtr app, void *user_data, int argc, char **argv ) ;

/* callback appele sur reception de messages directs */
typedef void (*MsgDirectCallback)( IvyClientPtr app, void *user_data, int id, int len, void *msg ) ;

/* identifiant d'une expression reguliere ( Bind/Unbind ) */
typedef struct _msg_rcv *MsgRcvPtr;

/* filtrage des regexps */
void IvyClasses( int argc, const char **argv);

void IvyInit(
	 const char *AppName,		/* nom de l'application */
	 const char *ready,		/* ready Message peut etre NULL */
	 IvyApplicationCallback callback, /* callback appele sur connection deconnection d'une appli */
	 void *data,			/* user data passe au callback */
	 IvyDieCallback die_callback,	/* last change callback before die */
	 void *die_data 		/* user data */
	 );

void IvySetApplicationPriority( int priority );
void IvySetBindCallback( IvyBindCallback bind_callback, void *bind_data ); 
void IvyStart (const char*);
void IvyStop ();

/* query sur les applications connectees */
char *IvyGetApplicationName( IvyClientPtr app );
char *IvyGetApplicationHost( IvyClientPtr app );
char *IvyGetApplicationId( IvyClientPtr app );
IvyClientPtr IvyGetApplication( char *name );
char *IvyGetApplicationList();
char **IvyGetApplicationMessages( IvyClientPtr app); /* demande de reception d'un message */

MsgRcvPtr IvyBindMsg( MsgCallback callback, void *user_data, const char *fmt_regexp, ... ); /* avec sprintf prealable */
void IvyUnbindMsg( MsgRcvPtr id );

/* emission d'un message d'erreur */
void IvySendError( IvyClientPtr app, int id, const char *fmt, ... );

/* emmission d'un message die pour terminer l'application */
void IvySendDieMsg( IvyClientPtr app );

/* emission d'un message retourne le nb effectivement emis */

int IvySendMsg( const char *fmt_message, ... );		/* avec sprintf prealable */

/* Message Direct Inter-application */

void IvyBindDirectMsg( MsgDirectCallback callback, void *user_data);
void IvySendDirectMsg( IvyClientPtr app, int id, int len, void *msg );

/* boucle principale d'Ivy */
/* use of internal MainLoop or XtMainLoop, or other MainLoop integration */
extern void IvyMainLoop(void(*hook)(void));

#ifdef __cplusplus
}
#endif

#endif