changeset 318:088ef7db9e52

Rename extension functions to avoid some strange problems with cmake
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 02 Mar 2009 11:55:07 +0900
parents 987cea8b1e37
children 25d722e650d4
files extensions/app_test/app_test.c extensions/app_test/app_test.h extensions/app_test/atst_cli.c extensions/app_test/atst_dict.c extensions/app_test/atst_serv.c extensions/app_test/atst_sig.c
diffstat 6 files changed, 95 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/app_test/app_test.c	Wed Feb 25 16:50:23 2009 +0900
+++ b/extensions/app_test/app_test.c	Mon Mar 02 11:55:07 2009 +0900
@@ -44,7 +44,7 @@
 atst_conf_t * atst_conf = NULL;
 static atst_conf_t _conf;
 
-static int conf_init(void)
+static int atst_conf_init(void)
 {
 	atst_conf = &_conf;
 	memset(atst_conf, 0, sizeof(atst_conf_t));
@@ -62,7 +62,7 @@
 	return 0;
 }
 
-static void conf_dump(void)
+static void atst_conf_dump(void)
 {
 	TRACE_DEBUG(FULL, "------- app_test configuration dump: ---------");
 	TRACE_DEBUG(FULL, " Vendor Id .......... : %u", atst_conf->vendor_id);
@@ -77,30 +77,30 @@
 }
 
 /* entry point */
-static int entry(char * conffile)
+static int atst_entry(char * conffile)
 {
 	TRACE_ENTRY("%p", conffile);
 	
 	/* Initialize configuration */
-	CHECK( conf_init() );
+	CHECK( atst_conf_init() );
 	
 	/* Parse configuration file */
 	if (conffile != NULL) {
 		CHECK( atst_conf_handle(conffile) );
 	}
-	conf_dump();
+	atst_conf_dump();
 	
 	/* Install objects definitions for this test application */
-	CHECK( dict_init() );
+	CHECK( atst_dict_init() );
 	
 	/* Install the handlers for incoming messages */
 	if (atst_conf->mode & MODE_SERV) {
-		CHECK( serv_init() );
+		CHECK( atst_serv_init() );
 	}
 	
 	/* Start the signal handler thread */
 	if (atst_conf->mode & MODE_CLI) {
-		CHECK( cli_init() );
+		CHECK( atst_cli_init() );
 	}
 	
 	return 0;
@@ -110,9 +110,9 @@
 void waaad_ext_fini(void)
 {
 	if (atst_conf->mode & MODE_CLI)
-		cli_fini();
+		atst_cli_fini();
 	if (atst_conf->mode & MODE_SERV)
-		serv_fini();
+		atst_serv_fini();
 }
 
-EXTENSION_API_INIT( API_MODULE_ALL, entry, "app_test");
+EXTENSION_API_INIT( API_MODULE_ALL, atst_entry, "app_test");
--- a/extensions/app_test/app_test.h	Wed Feb 25 16:50:23 2009 +0900
+++ b/extensions/app_test/app_test.h	Mon Mar 02 11:55:07 2009 +0900
@@ -72,19 +72,19 @@
 int atst_conf_handle(char * conffile);
 
 /* Start or stop the signal handler */
-int sig_init(void (*cb)(void));
-void sig_fini(void);
+int atst_sig_init(void (*cb)(void));
+void atst_sig_fini(void);
 
 /* Handle incoming messages (server) */
-int serv_init(void);
-void serv_fini(void);
+int atst_serv_init(void);
+void atst_serv_fini(void);
 
 /* Create outgoing message (client) */
-int cli_init(void);
-void cli_fini(void);
+int atst_cli_init(void);
+void atst_cli_fini(void);
 
 /* Initialize dictionary definitions */
-int dict_init(void);
+int atst_dict_init(void);
 
 
 /* Some global variables for dictionary */
@@ -94,12 +94,12 @@
 extern dict_object_t * atst_cmd_a;
 extern dict_object_t * atst_avp;
 
-extern dict_object_t * sess_id;
-extern dict_object_t * origin_host;
-extern dict_object_t * origin_realm;
-extern dict_object_t * dest_host;
-extern dict_object_t * dest_realm;
-extern dict_object_t * res_code;
+extern dict_object_t * atst_sess_id;
+extern dict_object_t * atst_origin_host;
+extern dict_object_t * atst_origin_realm;
+extern dict_object_t * atst_dest_host;
+extern dict_object_t * atst_dest_realm;
+extern dict_object_t * atst_res_code;
 
 
 /**********************************************************************************
--- a/extensions/app_test/atst_cli.c	Wed Feb 25 16:50:23 2009 +0900
+++ b/extensions/app_test/atst_cli.c	Mon Mar 02 11:55:07 2009 +0900
@@ -41,17 +41,17 @@
 
 #include "app_test.h"
 
-static sess_reg_t * cli_reg = NULL;
+static sess_reg_t * atst_cli_reg = NULL;
 
 typedef struct {
 	int32_t		randval;	/* a random value to store in Test-AVP */
 	struct timespec ts;		/* Time of sending the message */
-} mess_info_t;
+} atst_mess_info_t;
 
 /* Cb called when an answer is received */
-static void cb_ans(void * data, msg_t ** msg)
+static void atst_cb_ans(void * data, msg_t ** msg)
 {
-	mess_info_t * mi = NULL;
+	atst_mess_info_t * mi = NULL;
 	struct timespec ts;
 	
 	CHECK_VOID( clock_gettime(CLOCK_REALTIME, &ts) );
@@ -63,13 +63,13 @@
 		msg_avp_data_t * avpdata = NULL;
 		int new;
 		
-		CHECK_VOID( msg_search_avp(*msg, sess_id, &src) );
+		CHECK_VOID( msg_search_avp(*msg, atst_sess_id, &src) );
 		CHECK_VOID( msg_avp_data( src, &avpdata ) );
 		
 		CHECK_VOID( sess_fromsid( (char *)avpdata->avp_data->os.data, avpdata->avp_data->os.len, &sess, &new) );
 		ASSERT( new == 0 );
 		
-		CHECK_VOID( sess_data_dereg( sess, cli_reg, (void *)&mi) );
+		CHECK_VOID( sess_data_dereg( sess, atst_cli_reg, (void *)&mi) );
 		
 		TRACE_DEBUG( INFO, "%p %p", mi, data);
 		
@@ -100,7 +100,7 @@
 		msg_avp_t * src = NULL;
 		msg_avp_data_t * avpdata = NULL;
 		
-		CHECK_VOID( msg_search_avp(*msg, res_code, &src) );
+		CHECK_VOID( msg_search_avp(*msg, atst_res_code, &src) );
 		if (src) {
 			CHECK_VOID( msg_avp_data( src, &avpdata ) );
 			fprintf(stderr, "Status: %d ", avpdata->avp_data->i32);
@@ -114,7 +114,7 @@
 		msg_avp_t * src = NULL;
 		msg_avp_data_t * avpdata = NULL;
 		
-		CHECK_VOID( msg_search_avp(*msg, origin_host, &src) );
+		CHECK_VOID( msg_search_avp(*msg, atst_origin_host, &src) );
 		if (src) {
 			char * str;
 			CHECK_VOID( msg_avp_data( src, &avpdata ) );
@@ -133,7 +133,7 @@
 		msg_avp_t * src = NULL;
 		msg_avp_data_t * avpdata = NULL;
 		
-		CHECK_VOID( msg_search_avp(*msg, origin_realm, &src) );
+		CHECK_VOID( msg_search_avp(*msg, atst_origin_realm, &src) );
 		if (src) {
 			char * str;
 			CHECK_VOID( msg_avp_data( src, &avpdata ) );
@@ -170,10 +170,10 @@
 	return;
 }
 
-static void cli_test_message(void)
+static void atst_cli_test_message(void)
 {
 	msg_t * req = NULL;
-	mess_info_t * mi = NULL;
+	atst_mess_info_t * mi = NULL;
 	sess_id_t *sess = NULL;
 	
 	TRACE_DEBUG(FULL, "Creating a new message for sending.");
@@ -185,7 +185,7 @@
 	CHECK_VOID( sess_new( &sess, SESSION_NEW_DEFAULT, "app_test" ) );
 	
 	/* Create the random value to store with the session */
-	mi = malloc(sizeof(mess_info_t));
+	mi = malloc(sizeof(atst_mess_info_t));
 	if (mi == NULL) {
 		log_error("malloc failed: %s", strerror(errno));
 		return;
@@ -200,7 +200,7 @@
 		msg_avp_t * dst = NULL;
 		avp_value_t data;
 		
-		CHECK_VOID( msg_search_avp(req, sess_id, &dst) );
+		CHECK_VOID( msg_search_avp(req, atst_sess_id, &dst) );
 		
 		CHECK_VOID( sess_getsid(sess, (void *)&data.os.data) );
 		data.os.len  = strlen((char *)data.os.data);
@@ -216,7 +216,7 @@
 		data.os.data = (unsigned char *)(atst_conf->dest_realm);
 		data.os.len  = strlen(atst_conf->dest_realm);
 		
-		CHECK_VOID( msg_search_avp(req, dest_realm, &dst) );
+		CHECK_VOID( msg_search_avp(req, atst_dest_realm, &dst) );
 		CHECK_VOID( msg_avp_setvalue( dst, &data) );
 	}
 	
@@ -225,7 +225,7 @@
 		msg_avp_t * dst = NULL;
 		avp_value_t data;
 		
-		CHECK_VOID( msg_search_avp(req, dest_host, &dst) );
+		CHECK_VOID( msg_search_avp(req, atst_dest_host, &dst) );
 		
 		if (atst_conf->dest_host) {
 			data.os.data = (unsigned char *)(atst_conf->dest_host);
@@ -245,7 +245,7 @@
 		data.os.data = (unsigned char *)(g_pconf->diameter_identity);
 		data.os.len  = strlen(g_pconf->diameter_identity);
 		
-		CHECK_VOID( msg_search_avp(req, origin_host, &dst) );
+		CHECK_VOID( msg_search_avp(req, atst_origin_host, &dst) );
 		CHECK_VOID( msg_avp_setvalue( dst, &data) );
 	}
 	
@@ -257,7 +257,7 @@
 		data.os.data = (unsigned char *)(g_pconf->diameter_realm);
 		data.os.len  = strlen(g_pconf->diameter_realm);
 		
-		CHECK_VOID( msg_search_avp(req, origin_realm, &dst) );
+		CHECK_VOID( msg_search_avp(req, atst_origin_realm, &dst) );
 		CHECK_VOID( msg_avp_setvalue( dst, &data) );
 	}
 	
@@ -275,32 +275,32 @@
 	CHECK_VOID( clock_gettime(CLOCK_REALTIME, &mi->ts) );
 	
 	/* Store this value in the session */
-	CHECK_VOID( sess_data_reg ( sess, cli_reg, (void *) mi, (void (*)(void *))free ) ); 
+	CHECK_VOID( sess_data_reg ( sess, atst_cli_reg, (void *) mi, (void (*)(void *))free ) ); 
 	
 	/* Log sending the message */
 	fprintf(stderr, "SEND %x to '%s' (%s)\n", mi->randval, atst_conf->dest_realm, atst_conf->dest_host?:"-" );
 	fflush(stderr);
 	
 	/* Send the request */
-	CHECK_VOID( msg_send( &req, cb_ans, (void *)mi ) );
+	CHECK_VOID( msg_send( &req, atst_cb_ans, (void *)mi ) );
 	
 	return;
 }
 
-int cli_init(void)
+int atst_cli_init(void)
 {
-	CHECK( sess_regext(&cli_reg) );
+	CHECK( sess_regext(&atst_cli_reg) );
 	
-	CHECK( sig_init(cli_test_message) );
+	CHECK( atst_sig_init(atst_cli_test_message) );
 	
 	return 0;
 }
 
-void cli_fini(void)
+void atst_cli_fini(void)
 {
-	(void) sess_deregext(cli_reg);
+	(void) sess_deregext(atst_cli_reg);
 	
-	sig_fini();
+	atst_sig_fini();
 	
 	return;
 };
--- a/extensions/app_test/atst_dict.c	Wed Feb 25 16:50:23 2009 +0900
+++ b/extensions/app_test/atst_dict.c	Mon Mar 02 11:55:07 2009 +0900
@@ -43,14 +43,14 @@
 dict_object_t * atst_cmd_a = NULL;
 dict_object_t * atst_avp = NULL;
 
-dict_object_t * sess_id = NULL;
-dict_object_t * origin_host = NULL;
-dict_object_t * origin_realm = NULL;
-dict_object_t * dest_host = NULL;
-dict_object_t * dest_realm = NULL;
-dict_object_t * res_code = NULL;
+dict_object_t * atst_sess_id = NULL;
+dict_object_t * atst_origin_host = NULL;
+dict_object_t * atst_origin_realm = NULL;
+dict_object_t * atst_dest_host = NULL;
+dict_object_t * atst_dest_realm = NULL;
+dict_object_t * atst_res_code = NULL;
 
-int dict_init(void)
+int atst_dict_init(void)
 {
 	TRACE_DEBUG(FULL, "Initializing the dictionary for test");
 	
@@ -96,18 +96,18 @@
 	}
 	
 	/* Now resolve some other useful AVPs */
-	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Session-Id", &sess_id) );
-	ASSERT( sess_id != NULL );
-	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Origin-Host", &origin_host) );
-	ASSERT( origin_host != NULL );
-	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Origin-Realm", &origin_realm) );
-	ASSERT( origin_realm != NULL );
-	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Destination-Host", &dest_host) );
-	ASSERT( dest_host != NULL );
-	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Destination-Realm", &dest_realm) );
-	ASSERT( dest_realm != NULL );
-	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Result-Code", &res_code) );
-	ASSERT( res_code != NULL );
+	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Session-Id", &atst_sess_id) );
+	ASSERT( atst_sess_id != NULL );
+	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Origin-Host", &atst_origin_host) );
+	ASSERT( atst_origin_host != NULL );
+	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Origin-Realm", &atst_origin_realm) );
+	ASSERT( atst_origin_realm != NULL );
+	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Destination-Host", &atst_dest_host) );
+	ASSERT( atst_dest_host != NULL );
+	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Destination-Realm", &atst_dest_realm) );
+	ASSERT( atst_dest_realm != NULL );
+	CHECK( dict_search( DICT_AVP, AVP_BY_NAME, "Result-Code", &atst_res_code) );
+	ASSERT( atst_res_code != NULL );
 	
 	/* Create the rules for Test-Request and Test-Answer */
 	{
@@ -117,7 +117,7 @@
 		data.rule_template = 1;
 		
 		/* Session-Id is in first position */
-		data.rule_avp = sess_id;
+		data.rule_avp = atst_sess_id;
 		data.rule_position = RULE_FIXED_HEAD;
 		data.rule_order = 1;
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_r, NULL));
@@ -130,26 +130,26 @@
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_a, NULL));
 		
 		/* idem for Origin Host and Realm */
-		data.rule_avp = origin_host;
+		data.rule_avp = atst_origin_host;
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_r, NULL));
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_a, NULL));
 		
-		data.rule_avp = origin_realm;
+		data.rule_avp = atst_origin_realm;
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_r, NULL));
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_a, NULL));
 		
 		/* And Result-Code is mandatory for answers only */
-		data.rule_avp = res_code;
+		data.rule_avp = atst_res_code;
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_a, NULL));
 		
 		/* And Destination-Realm for requests only */
-		data.rule_avp = dest_realm;
+		data.rule_avp = atst_dest_realm;
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_r, NULL));
 		
 		/* And Destination-Host optional for requests only */
 		data.rule_position = RULE_OPTIONAL;
 		data.rule_min = 0;
-		data.rule_avp = dest_host;
+		data.rule_avp = atst_dest_host;
 		CHECK(dict_new( DICT_RULE, &data, atst_cmd_r, NULL));
 		
 	}
--- a/extensions/app_test/atst_serv.c	Wed Feb 25 16:50:23 2009 +0900
+++ b/extensions/app_test/atst_serv.c	Mon Mar 02 11:55:07 2009 +0900
@@ -37,11 +37,11 @@
 
 #include "app_test.h"
 
-static disp_cb_hdl_t * hdl_fb = NULL; /* handler for fallback cb */
-static disp_cb_hdl_t * hdl_tr = NULL; /* handler for Test-Request req cb */
+static disp_cb_hdl_t * atst_hdl_fb = NULL; /* handler for fallback cb */
+static disp_cb_hdl_t * atst_hdl_tr = NULL; /* handler for Test-Request req cb */
 
 /* Default callback for the application. */
-static int fb_cb( msg_t ** msg, msg_avp_t * avp )
+static int atst_fb_cb( msg_t ** msg, msg_avp_t * avp )
 {
 	/* This CB should never be called */
 	TRACE_ENTRY("%p %p", msg, avp);
@@ -52,7 +52,7 @@
 }
 
 /* Callback for incoming Test-Request messages */
-static int tr_cb( msg_t ** msg, msg_avp_t * avp )
+static int atst_tr_cb( msg_t ** msg, msg_avp_t * avp )
 {
 	msg_t * ans;
 	
@@ -72,8 +72,8 @@
 		msg_avp_t * dst = NULL;
 		msg_avp_data_t * data = NULL;
 		
-		CHECK( msg_search_avp(*msg, sess_id, &src) );
-		CHECK( msg_search_avp(ans, sess_id, &dst) );
+		CHECK( msg_search_avp(*msg, atst_sess_id, &src) );
+		CHECK( msg_search_avp(ans, atst_sess_id, &dst) );
 		CHECK( msg_avp_data( src, &data ) );
 		CHECK( msg_avp_setvalue( dst, data->avp_data) );
 	}
@@ -97,7 +97,7 @@
 		data.os.data = (unsigned char *)(g_pconf->diameter_identity);
 		data.os.len  = strlen(g_pconf->diameter_identity);
 		
-		CHECK( msg_search_avp(ans, origin_host, &dst) );
+		CHECK( msg_search_avp(ans, atst_origin_host, &dst) );
 		CHECK( msg_avp_setvalue( dst, &data) );
 	}
 	
@@ -109,7 +109,7 @@
 		data.os.data = (unsigned char *)(g_pconf->diameter_realm);
 		data.os.len  = strlen(g_pconf->diameter_realm);
 		
-		CHECK( msg_search_avp(ans, origin_realm, &dst) );
+		CHECK( msg_search_avp(ans, atst_origin_realm, &dst) );
 		CHECK( msg_avp_setvalue( dst, &data) );
 	}
 	
@@ -120,7 +120,7 @@
 		
 		data.u32 = 2001; /* Success */
 		
-		CHECK( msg_search_avp(ans, res_code, &dst) );
+		CHECK( msg_search_avp(ans, atst_res_code, &dst) );
 		CHECK( msg_avp_setvalue( dst, &data) );
 	}
 	
@@ -131,7 +131,7 @@
 	return 0;
 }
 
-int serv_init(void)
+int atst_serv_init(void)
 {
 	disp_reg_val_t data;
 	
@@ -142,21 +142,21 @@
 	data.command = atst_cmd_r;
 	
 	/* fallback CB if command != Test-Request received */
-	CHECK( disp_register( fb_cb, DISP_REG_APPID, &data, &hdl_fb ) );
+	CHECK( disp_register( atst_fb_cb, DISP_REG_APPID, &data, &atst_hdl_fb ) );
 	
 	/* Now specific handler for Test-Request */
-	CHECK( disp_register( tr_cb, DISP_REG_CC, &data, &hdl_tr ) );
+	CHECK( disp_register( atst_tr_cb, DISP_REG_CC, &data, &atst_hdl_tr ) );
 	
 	return 0;
 }
 
-void serv_fini(void)
+void atst_serv_fini(void)
 {
-	if (hdl_fb) {
-		(void) disp_unregister(hdl_fb);
+	if (atst_hdl_fb) {
+		(void) disp_unregister(atst_hdl_fb);
 	}
-	if (hdl_tr) {
-		(void) disp_unregister(hdl_tr);
+	if (atst_hdl_tr) {
+		(void) disp_unregister(atst_hdl_tr);
 	}
 	
 	return;
--- a/extensions/app_test/atst_sig.c	Wed Feb 25 16:50:23 2009 +0900
+++ b/extensions/app_test/atst_sig.c	Mon Mar 02 11:55:07 2009 +0900
@@ -39,7 +39,7 @@
 
 static pthread_t th = (pthread_t) NULL;
 
-static void * sig_th(void * arg)
+static void * atst_sig_th(void * arg)
 {
 	int sig;
 	int ret;
@@ -66,12 +66,12 @@
 	return NULL;
 }
 
-int sig_init(void (*cb)(void))
+int atst_sig_init(void (*cb)(void))
 {
-	return pthread_create( &th, NULL, sig_th, (void *)cb );
+	return pthread_create( &th, NULL, atst_sig_th, (void *)cb );
 }
 
-void sig_fini(void)
+void atst_sig_fini(void)
 {
 	void * th_ret = NULL;
 	
"Welcome to our mercurial repository"