From 97ba3631720cd0393b547894b7d2fafc5e361a5e Mon Sep 17 00:00:00 2001 From: fcolin Date: Wed, 19 Apr 2006 16:53:10 +0000 Subject: correction Filtred Binding + test avec ivyperf --- src/ivy.c | 2 +- src/ivyperf.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/ivy.c b/src/ivy.c index 6414f72..12b6ae3 100644 --- a/src/ivy.c +++ b/src/ivy.c @@ -402,7 +402,7 @@ static void Receive( Client client, void *data, char *line ) #endif //DEBUG if ( application_bind_callback ) { - (*application_bind_callback)( clnt, application_bind_data, id, snd->str_regexp, IvyFilterBind ); + (*application_bind_callback)( clnt, application_bind_data, id, arg, IvyFilterBind ); } return; } diff --git a/src/ivyperf.c b/src/ivyperf.c index 999fb69..283771c 100755 --- a/src/ivyperf.c +++ b/src/ivyperf.c @@ -39,6 +39,8 @@ extern int optind; #include "ivyloop.h" #define MILLISEC 1000.0 +char *mymessages[] = { "ping", "pong" }; + static double currentTime() { double current; @@ -73,7 +75,23 @@ void TimerCall(TimerId id, void *user_data, unsigned long delta) if ( count == 0 ) fprintf(stderr, "." ); } +void binCB( IvyClientPtr app, void *user_data, int id, char* regexp, IvyBindEvent event ) +{ + char *app_name = IvyGetApplicationName( app ); + switch ( event ) + { + case IvyAddBind: + printf("Application:%s bind '%s' ADDED\n", app_name, regexp ); + break; + case IvyRemoveBind: + printf("Application:%s bind '%s' REMOVED\n", app_name, regexp ); + break; + case IvyFilterBind: + printf("Application:%s bind '%s' FILTRED\n", app_name, regexp ); + break; + } +} int main(int argc, char *argv[]) { long time=200; @@ -82,7 +100,8 @@ int main(int argc, char *argv[]) if ( argc > 1 ) time = atol( argv[1] ); IvyInit ("IvyPerf", "IvyPerf ready", NULL,NULL,NULL,NULL); - + IvyClasses( sizeof( mymessages )/ sizeof( char *),mymessages ); + IvySetBindCallback( binCB, 0 ), IvyBindMsg (Reply, NULL, "^ping ts=(.*)"); IvyBindMsg (Pong, NULL, "^pong ts=(.*) tr=(.*)"); -- cgit v1.1