changeset 430:f77fc3a97287

Corrected compilation warnings on app_sip and test_sip
author Alexandre Westfahl <awestfahl@freediameter.net>
date Tue, 27 Jul 2010 14:56:21 +0900
parents f98ffcd86d15
children 1bb1bc417efe
files extensions/app_sip/diamsip.h extensions/app_sip/libdiamsip.c extensions/app_sip/locationinfo.c extensions/app_sip/locationinfosl.c extensions/app_sip/multimediaauth.c extensions/app_sip/serverassignment.c extensions/app_sip/userauthorization.c extensions/test_sip/locationinfo.c extensions/test_sip/locationinfosl.c extensions/test_sip/serverassignment.c extensions/test_sip/test_sip.c extensions/test_sip/userauthorization.c
diffstat 12 files changed, 55 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/app_sip/diamsip.h	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/app_sip/diamsip.h	Tue Jul 27 14:56:21 2010 +0900
@@ -96,6 +96,8 @@
 int clear_pending_flag(const unsigned char  *username, const size_t usernamelen);
 int set_real_sipserver_uri(const unsigned char  *username, const size_t usernamelen, const unsigned char *sipserver_uri,const size_t sipserverurilen);
 int set_sipserver_uri(const unsigned char  *username, const size_t usernamelen, const unsigned char *sipserver_uri,const size_t sipserverurilen);
+int get_sipserver_uri(const unsigned char *sip_aor, const size_t sipaorlen, unsigned char ** sipserver_uri, size_t *sipserverurilen);
+int allow_roaming(const unsigned char  *username, const size_t usernamelen, const char * network,const size_t networklen);
 
 //count functions
 int count_supporteddatatype(const struct msg * message);
--- a/extensions/app_sip/libdiamsip.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/app_sip/libdiamsip.c	Tue Jul 27 14:56:21 2010 +0900
@@ -689,7 +689,7 @@
 {
 	CHECK_PARAMS(username && usernamelen);
 	
-	int not_found=2;
+	
 	size_t querylen, usernamepurelen;
 	char *query, *username_pure;
 	
@@ -725,7 +725,7 @@
 {
 	CHECK_PARAMS(username && usernamelen);
 	
-	int not_found=2;
+	
 	size_t querylen, usernamepurelen;
 	char *query, *username_pure;
 	
@@ -764,7 +764,7 @@
 {
 	CHECK_PARAMS(username && usernamelen && sipserver_uri && sipserverurilen);
 	
-	int not_found=2;
+	
 	size_t querylen, usernamepurelen, sipserveruripurelen;
 	char *query, *username_pure, *sipserveruri_pure;
 	
@@ -803,7 +803,7 @@
 {
 	CHECK_PARAMS(sipserver_uri && sipserverurilen);
 	
-	int not_found=2;
+
 	size_t querylen, sipserveruripurelen;
 	char *query, *sipserveruri_pure;
 	
@@ -837,7 +837,7 @@
 {
 	CHECK_PARAMS(username && usernamelen && sipserver_uri && sipserverurilen);
 	
-	int not_found=2;
+	
 	size_t querylen, usernamepurelen, sipserveruripurelen;
 	char *query, *username_pure, *sipserveruri_pure;
 	
@@ -873,7 +873,7 @@
 	return 0;
 }
 
-int get_sipserver_uri(const unsigned char *sip_aor, const size_t sipaorlen, char ** sipserver_uri, size_t *sipserverurilen)
+int get_sipserver_uri(const unsigned char *sip_aor, const size_t sipaorlen, unsigned char ** sipserver_uri, size_t *sipserverurilen)
 {
 	CHECK_PARAMS(sip_aor && sipaorlen && sipserver_uri && sipserverurilen );
 	
@@ -926,7 +926,7 @@
 				if(*sipserverurilen>4)
 				{
 					CHECK_MALLOC(*sipserver_uri=malloc(*sipserverurilen+1));
-					strcpy(*sipserver_uri,row[0]);
+					strcpy((char *)*sipserver_uri,row[0]);
 					not_found=0;
 					break;
 				}
@@ -999,7 +999,7 @@
 	}
 	return counter;
 }
-/*
+/* 
 void nonce_add_element(char * nonce)
 {
 	noncechain *newelt=malloc(sizeof(noncechain));
--- a/extensions/app_sip/locationinfo.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/app_sip/locationinfo.c	Tue Jul 27 14:56:21 2010 +0900
@@ -114,8 +114,8 @@
 		}
 		
 		//If we arrive here, the user is known
-		int sipserverurilen;
-		char * sipserver_uri=NULL;
+		size_t sipserverurilen;
+		unsigned char * sipserver_uri=NULL;
 		
 		ret=get_sipserver_uri(avphdr->avp_value->os.data, avphdr->avp_value->os.len, &sipserver_uri, &sipserverurilen);
 		
--- a/extensions/app_sip/locationinfosl.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/app_sip/locationinfosl.c	Tue Jul 27 14:56:21 2010 +0900
@@ -41,7 +41,7 @@
 	TRACE_ENTRY("%p %p %p %p", msg, paramavp, sess, act);
 	
 	struct msg *ans, *qry;
-	struct avp *avp, *groupedavp;
+	struct avp *avp;
 	struct avp_hdr *avphdr;
 	union avp_value value;
 	
@@ -85,7 +85,7 @@
 	{
 		CHECK_FCT( fd_msg_search_avp ( qry, sip_dict.SIP_AOR, &avp) );
 		CHECK_FCT( fd_msg_avp_hdr( avp, &avphdr )  );
-		int diameterurilen;
+		size_t diameterurilen;
 		char * diameter_uri=NULL;
 		
 		
@@ -104,7 +104,7 @@
 		  else
 		  {
 		    CHECK_FCT( fd_msg_avp_new ( sip_dict.Redirect_Host, 0, &avp ) );
-		    value.os.data=diameter_uri;
+		    value.os.data=(unsigned char *)diameter_uri;
 		    value.os.len=diameterurilen;
 		    CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		    CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, avp ) );
--- a/extensions/app_sip/multimediaauth.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/app_sip/multimediaauth.c	Tue Jul 27 14:56:21 2010 +0900
@@ -49,8 +49,10 @@
 	char password[51];
 	int idx=0, number_of_auth_items=0,i=0, ret=0;
 	//Flags and variables for Database
-	int sipurinotstored=0, authenticationpending=0, querylen=0, usernamelen=0;
-	char *query=NULL,*username=NULL;
+	int sipurinotstored=0, authenticationpending=0; 
+	size_t querylen=0, usernamelen=0;
+	char *query=NULL;
+	unsigned char *username=NULL;
 	
 	//The nonce we will store and retrieve in session
 	struct ds_nonce *storednonce=NULL;
@@ -151,7 +153,7 @@
 				//We allocate the double size of username because at worst it can be all quotes
 				username=malloc(avphdr->avp_value->os.len*2+1);
 				//We purify username not to have forbidden characters
-				usernamelen=mysql_real_escape_string(conn, username, (const char *)avphdr->avp_value->os.data, avphdr->avp_value->os.len);
+				usernamelen=mysql_real_escape_string(conn, (char *)username, (const char *)avphdr->avp_value->os.data, avphdr->avp_value->os.len);
 				
 				//Now that we know the user exist, we get the list of AOR owned by this user
 				querylen=SQL_GETSIPAOR_LEN + usernamelen;
@@ -199,13 +201,13 @@
 			
 			if(avphdr!=NULL)
 			{
-				char *sipuri=NULL;
+				unsigned char *sipuri=NULL;
 				int sipurilen=0;
 
 				//We allocate the double size of SIP-URI because at worst it can be all quotes
 				CHECK_MALLOC(sipuri=malloc(avphdr->avp_value->os.len*2+1));
 				//We purify SIP-URI not to have forbidden characters
-				sipurilen=mysql_real_escape_string(conn, sipuri, (const char *)avphdr->avp_value->os.data, avphdr->avp_value->os.len);
+				sipurilen=mysql_real_escape_string(conn, (char *)sipuri, (const char *)avphdr->avp_value->os.data, avphdr->avp_value->os.len);
 				
 				
 				//We get the SIP-URI assignated to the user
--- a/extensions/app_sip/serverassignment.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/app_sip/serverassignment.c	Tue Jul 27 14:56:21 2010 +0900
@@ -122,7 +122,7 @@
 				if(sipaorhdr!=NULL)
 				{
 					//We must check that this user can use this SIP-AOR
-					ret=check_sipaor(usernamehdr->avp_value->os.data, usernamehdr->avp_value->os.len, sipaorhdr->avp_value->os.data,sipaorhdr->avp_value->os.len);
+					ret=check_sipaor(usernamehdr->avp_value->os.data, usernamehdr->avp_value->os.len,(const char *) sipaorhdr->avp_value->os.data,sipaorhdr->avp_value->os.len);
 					
 					if(ret==0)
 					{
@@ -202,7 +202,7 @@
 				{
 					
 					CHECK_MALLOC(table_supporteddatatype[counter]=malloc(avphdr->avp_value->os.len+1));
-					strncpy(table_supporteddatatype[counter],avphdr->avp_value->os.data,avphdr->avp_value->os.len);
+					strncpy(table_supporteddatatype[counter],(const char *)avphdr->avp_value->os.data,avphdr->avp_value->os.len);
 					table_supporteddatatype[counter][avphdr->avp_value->os.len+1]='\0';
 					
 					counter++;
--- a/extensions/app_sip/userauthorization.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/app_sip/userauthorization.c	Tue Jul 27 14:56:21 2010 +0900
@@ -107,7 +107,7 @@
 			{//found
 				
 				//We must check that this user can use this SIP-AOR
-				ret=check_sipaor(usernamehdr->avp_value->os.data, usernamehdr->avp_value->os.len, sipaorhdr->avp_value->os.data,sipaorhdr->avp_value->os.len);
+				ret=check_sipaor(usernamehdr->avp_value->os.data, usernamehdr->avp_value->os.len, (const char *)sipaorhdr->avp_value->os.data,sipaorhdr->avp_value->os.len);
 				
 				if(ret==0)
 				{
@@ -166,7 +166,7 @@
 					MUST set the Result-Code AVP value in the Diameter UAA message to
 					DIAMETER_ERROR_ROAMING_NOT_ALLOWED.
 					*/
-					ret=allow_roaming(usernamehdr->avp_value->os.data, usernamehdr->avp_value->os.len, visitednethdr->avp_value->os.data,visitednethdr->avp_value->os.len);
+					ret=allow_roaming(usernamehdr->avp_value->os.data, usernamehdr->avp_value->os.len, (const char *)visitednethdr->avp_value->os.data,visitednethdr->avp_value->os.len);
 					
 					if(ret==0)
 					{
@@ -215,7 +215,7 @@
 		
 		
 		//Let's look for the SIP_Server_URI'
-		char *sipserver_uri;
+		unsigned char *sipserver_uri;
 		size_t sipserverurilen;
 		
 		ret=get_sipserver_uri(sipaorhdr->avp_value->os.data, sipaorhdr->avp_value->os.len, &sipserver_uri, &sipserverurilen);
--- a/extensions/test_sip/locationinfo.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/test_sip/locationinfo.c	Tue Jul 27 14:56:21 2010 +0900
@@ -45,7 +45,7 @@
 	union avp_value value;
 	
 	//Fake values START
-	unsigned char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
+	char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
 	size_t aor_len=strlen(sip_aor); 
 	char *destination_realm="tera.ics.keio.ac.jp";
 	size_t destination_realmlen=strlen(destination_realm);
@@ -111,7 +111,7 @@
 	{
 		
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_AOR, 0, &avp ) );
-		value.os.data=sip_aor;
+		value.os.data=(unsigned char *)sip_aor;
 		value.os.len=aor_len;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
--- a/extensions/test_sip/locationinfosl.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/test_sip/locationinfosl.c	Tue Jul 27 14:56:21 2010 +0900
@@ -45,7 +45,7 @@
 	union avp_value value;
 	
 	//Fake values START
-	unsigned char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
+	char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
 	size_t aor_len=strlen(sip_aor); 
 	char *destination_realm="tera.ics.keio.ac.jp";
 	size_t destination_realmlen=strlen(destination_realm);
@@ -113,7 +113,7 @@
 	{
 		
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_AOR, 0, &avp ) );
-		value.os.data=sip_aor;
+		value.os.data=(unsigned char *)sip_aor;
 		value.os.len=aor_len;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
--- a/extensions/test_sip/serverassignment.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/test_sip/serverassignment.c	Tue Jul 27 14:56:21 2010 +0900
@@ -45,17 +45,17 @@
 	union avp_value value;
 	
 	//Fake values START
-	unsigned char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
+	 char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
 	size_t aor_len=strlen(sip_aor); 
-	unsigned char *destination_realm="tera.ics.keio.ac.jp";
+	 char *destination_realm="tera.ics.keio.ac.jp";
 	size_t destination_realmlen=strlen(destination_realm);
-	unsigned char *destination_host="suika.tera.ics.keio.ac.jp";
+	 char *destination_host="suika.tera.ics.keio.ac.jp";
 	size_t destination_hostlen=strlen(destination_host);
-	unsigned char *username="aw-lappy";
+	 char *username="aw-lappy";
 	size_t usernamelen=strlen(username);
-	unsigned char *visitednetwork="Pink";
-	size_t visitednetworklen=strlen(visitednetwork);
-	int registrationtype = 2;
+	// char *visitednetwork="Pink";
+	//size_t visitednetworklen=strlen(visitednetwork);
+	//int registrationtype = 2;
 	int data_already_available=0;
 	int assignment_type=0;
 	//Fake values STOP
@@ -99,7 +99,7 @@
 	//Destination_Host
 	{
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.Destination_Host, 0, &avp ) );
-		value.os.data=destination_host;
+		value.os.data=(unsigned char *)destination_host;
 		value.os.len=destination_hostlen;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
@@ -107,7 +107,7 @@
 	//Destination_Realm
 	{
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.Destination_Realm, 0, &avp ) );
-		value.os.data=destination_realm;
+		value.os.data=(unsigned char *)destination_realm;
 		value.os.len=destination_realmlen;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
@@ -117,7 +117,7 @@
 	{
 		
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_AOR, 0, &avp ) );
-		value.os.data=sip_aor;
+		value.os.data=(unsigned char *)sip_aor;
 		value.os.len=aor_len;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
@@ -127,7 +127,7 @@
 	{
 		
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.User_Name, 0, &avp ) );
-		value.os.data=username;
+		value.os.data=(unsigned char *)username;
 		value.os.len=usernamelen;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
--- a/extensions/test_sip/test_sip.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/test_sip/test_sip.c	Tue Jul 27 14:56:21 2010 +0900
@@ -100,6 +100,9 @@
 	struct dict_object * app=NULL;
 	struct disp_when data;
 	
+	
+	//TODO: activate again configuration file
+	CHECK_FCT( ts_conf_init() );
 	/* Initialize configuration 
 	//CHECK_FCT( ts_conf_init() );
 	
--- a/extensions/test_sip/userauthorization.c	Tue Jul 27 14:19:45 2010 +0900
+++ b/extensions/test_sip/userauthorization.c	Tue Jul 27 14:56:21 2010 +0900
@@ -45,15 +45,15 @@
 	union avp_value value;
 	
 	//Fake values START
-	unsigned char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
+	char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
 	size_t aor_len=strlen(sip_aor); 
-	unsigned char *destination_realm="tera.ics.keio.ac.jp";
+	 char *destination_realm="tera.ics.keio.ac.jp";
 	size_t destination_realmlen=strlen(destination_realm);
-	unsigned char *destination_host="suika.tera.ics.keio.ac.jp";
+	 char *destination_host="suika.tera.ics.keio.ac.jp";
 	size_t destination_hostlen=strlen(destination_host);
-	unsigned char *username="aw-lappy";
+	 char *username="aw-lappy";
 	size_t usernamelen=strlen(username);
-	unsigned char *visitednetwork="Pink";
+	 char *visitednetwork="Pink";
 	size_t visitednetworklen=strlen(visitednetwork);
 	int registrationtype = 2;
 	//Fake values STOP
@@ -98,7 +98,7 @@
 	//Destination_Host
 	{
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.Destination_Host, 0, &avp ) );
-		value.os.data=destination_host;
+		value.os.data=(unsigned char *)destination_host;
 		value.os.len=destination_hostlen;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
@@ -106,7 +106,7 @@
 	//Destination_Realm
 	{
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.Destination_Realm, 0, &avp ) );
-		value.os.data=destination_realm;
+		value.os.data=(unsigned char *)destination_realm;
 		value.os.len=destination_realmlen;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
@@ -116,7 +116,7 @@
 	{
 		
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_AOR, 0, &avp ) );
-		value.os.data=sip_aor;
+		value.os.data=(unsigned char *)sip_aor;
 		value.os.len=aor_len;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
@@ -126,7 +126,7 @@
 	{
 		
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.User_Name, 0, &avp ) );
-		value.os.data=username;
+		value.os.data=(unsigned char *)username;
 		value.os.len=usernamelen;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
@@ -136,7 +136,7 @@
 	{
 		
 		CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_Visited_Network_Id, 0, &avp ) );
-		value.os.data=visitednetwork;
+		value.os.data=(unsigned char *)visitednetwork;
 		value.os.len=visitednetworklen;
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
"Welcome to our mercurial repository"