Commit 1b80238a authored by nikolajev's avatar nikolajev
Browse files

Replaced ispresent->isvalue in LibSIP

parent 0eef3bf9
Loading
Loading
Loading
Loading
+54 −54
Original line number Diff line number Diff line
@@ -691,7 +691,7 @@ group ParameterOperations {
        var RouteBody_List v_routeBody_List;
        var integer size_recordRoute := 0;

	      if (ispresent(p_recordRoute)){
	      if (isvalue(p_recordRoute)){
          size_recordRoute := lengthof(valueof(p_recordRoute).routeBody);
        }
	      for (var integer i:=1; i<size_recordRoute+1; i:=i+1) {
@@ -730,7 +730,7 @@ group FieldOperations {
		inout ViaBody p_viaBody) 
		
		{
		if (ispresent (p_viaBody.viaParams)) {
		if (isvalue (p_viaBody.viaParams)) {
			return;
		}
		p_viaBody.viaParams := {
@@ -755,7 +755,7 @@ group FieldOperations {
		inout To p_to) 
		
		{
		if (ispresent (p_to.toParams)) {
		if (isvalue (p_to.toParams)) {
			return;
		}
		p_to.toParams := {
@@ -789,7 +789,7 @@ group FieldOperations {
		*/
	function f_checkRequirePrecondition(in Request p_message)
	{
		if (ispresent(p_message.msgHeader.require))
		if (isvalue(p_message.msgHeader.require))
		{
			var boolean v_precondition_found:=false;
			for (var integer v_i:=0; v_i<lengthof(p_message.msgHeader.require.optionsTags); v_i:=v_i+1){			
@@ -820,7 +820,7 @@ group FieldOperations {
	{
	  var integer v_chargeParamsLen;
	  
	  if (ispresent(p_message.msgHeader.pChargingVector)) {		
	  if (isvalue(p_message.msgHeader.pChargingVector)) {		
		for (var integer i:=0; i<lengthof(p_message.msgHeader.pChargingVector.chargeParams); i:=i+1)
				{if(p_message.msgHeader.pChargingVector.chargeParams[i].id == p_id)
					{return (true)}
@@ -840,7 +840,7 @@ group FieldOperations {
	{
	  var integer v_chargeParamsLen;
	  
	  if (ispresent(p_message.msgHeader.pChargingVector)) {		
	  if (isvalue(p_message.msgHeader.pChargingVector)) {		
		for (var integer i:=0; i<lengthof(p_message.msgHeader.pChargingVector.chargeParams); i:=i+1)
				{if(p_message.msgHeader.pChargingVector.chargeParams[i].id == p_id)
					{return true}
@@ -893,7 +893,7 @@ group FieldOperations {
      
		v_locAddr.host := v_SipUrl.components.sip.hostPort.host;
      
		if (ispresent(v_SipUrl.components.sip.hostPort.portField))
		if (isvalue(v_SipUrl.components.sip.hostPort.portField))
		{
			v_locAddr.portField := v_SipUrl.components.sip.hostPort.portField;
		}
@@ -916,7 +916,7 @@ group FieldOperations {
	{
			var integer v_chargeParamsLen;
	  
			if (ispresent(p_message.msgHeader.historyInfo)) {		
			if (isvalue(p_message.msgHeader.historyInfo)) {		
		for (var integer i:=0; i<lengthof(p_message.msgHeader.historyInfo.historyInfoList); i:=i+1)
				{if(p_message.msgHeader.historyInfo.historyInfoList[i].nameAddr.addrSpec == p_URI)
					{return (true)}
@@ -971,7 +971,7 @@ group FieldOperations {
	 */
	function f_getPathHeaderTop(inout Request p_Request) return template NameAddr
	{
	  if (ispresent(p_Request.msgHeader.path)) {
	  if (isvalue(p_Request.msgHeader.path)) {
	  	if (lengthof(p_Request.msgHeader.path.pathValues)>0) {
			return(p_Request.msgHeader.path.pathValues[0].nameAddr)}
	  	};
@@ -1009,7 +1009,7 @@ group FieldOperations {
			   valueof (p_source_address.host),
			   v_viaBody);
	   }
	   if (ispresent(v_viaBody.sentBy.portField))
	   if (isvalue(v_viaBody.sentBy.portField))
	   {
		 p_source_address.portField := valueof(v_viaBody.sentBy.portField);
	   }
@@ -1028,7 +1028,7 @@ group FieldOperations {
	 */
	function f_getRouteHeaderElementAddressFromRequest(in Request p_message, in integer p_index) return HostPort
	{
	  if (ispresent(p_message.msgHeader.route)) {
	  if (isvalue(p_message.msgHeader.route)) {
		if (lengthof(p_message.msgHeader.route.routeBody)>p_index) {
			return(p_message.msgHeader.route.routeBody[p_index].nameAddr.addrSpec.components.sip.hostPort)}
		};
@@ -1045,7 +1045,7 @@ group FieldOperations {
	 */
	function f_getRecordRouteHeaderElementAddressFromRequest(in Request p_message, in integer p_index) return HostPort
	{
	  if (ispresent(p_message.msgHeader.recordRoute)) {
	  if (isvalue(p_message.msgHeader.recordRoute)) {
		if (lengthof(p_message.msgHeader.recordRoute.routeBody)>p_index) {
			return(p_message.msgHeader.recordRoute.routeBody[p_index].nameAddr.addrSpec.components.sip.hostPort)}
		};
@@ -1062,7 +1062,7 @@ group FieldOperations {
	 */
	function f_getRecordRouteHeaderElementAddressFromResponse(in Response p_message, in integer p_index) return HostPort
	{
	  if (ispresent(p_message.msgHeader.recordRoute)) {
	  if (isvalue(p_message.msgHeader.recordRoute)) {
		if (lengthof(p_message.msgHeader.recordRoute.routeBody)>p_index) {
			return(p_message.msgHeader.recordRoute.routeBody[p_index].nameAddr.addrSpec.components.sip.hostPort)}
		};
@@ -1646,7 +1646,7 @@ group SetHeaders {
      
	  vc_cancel_To := p_Request.msgHeader.toField;
      
	  if (ispresent(p_Request.msgHeader.contact) and (not ischosen(p_Request.msgHeader.contact.contactBody.wildcard))) {
	  if (isvalue(p_Request.msgHeader.contact) and (not ischosen(p_Request.msgHeader.contact.contactBody.wildcard))) {
		vc_reqHostPort := f_getContactAddr(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
	  	}
      
@@ -1683,7 +1683,7 @@ group SetHeaders {
      
	  vc_cancel_To := p_Request.msgHeader.toField;
      
	  if (ispresent(p_Request.msgHeader.contact)) {
	  if (isvalue(p_Request.msgHeader.contact)) {
		vc_reqHostPort := f_getContactAddr(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
		}
      
@@ -1706,7 +1706,7 @@ group SetHeaders {
      vc_requestUri := p_Request.requestLine.requestUri;
      vc_cancel_To := p_Request.msgHeader.toField;
      
      if (ispresent(p_Request.msgHeader.contact)) {
      if (isvalue(p_Request.msgHeader.contact)) {
        vc_reqHostPort := f_getContactAddr(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
        vc_requestUri := f_getContactUri(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
        }
@@ -1742,7 +1742,7 @@ group SetHeaders {
	vc_caller_From := vc_from;
	vc_caller_To := vc_to;
      
	if (ispresent(p_Request.msgHeader.contact)) {
	if (isvalue(p_Request.msgHeader.contact)) {
	   	vc_reqHostPort := 
	  	f_getContactAddr(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
		vc_requestUri := f_getContactUri(p_Request.msgHeader.contact.contactBody.contactAddresses[0]);
@@ -1761,14 +1761,14 @@ group SetHeaders {
		vc_privacy := p_Request.msgHeader.privacy;
		};
        
	if (ispresent(p_Request.messageBody)) { 
	if (isvalue(p_Request.messageBody)) { 
		//cleaning of attributes before assignment
		if (ispresent(vc_sdp_remote.media_list))
		if (isvalue(vc_sdp_remote.media_list))
		{
			var integer v_length := lengthof(vc_sdp_remote.media_list);
			for (var integer i:=0; i<v_length; i:=i+1)
			{			
				if (ispresent(vc_sdp_remote.media_list[i].attributes))
				if (isvalue(vc_sdp_remote.media_list[i].attributes))
				{
					vc_sdp_remote.media_list[i].attributes := omit ; 
				}
@@ -1807,7 +1807,7 @@ group SetHeaders {
		}	
	};
	   
	if (ispresent(p_Request.msgHeader.supported.optionsTags)) {
	if (isvalue(p_Request.msgHeader.supported.optionsTags)) {
		for (var integer i := lengthof(p_Request.msgHeader.supported.optionsTags); i>0; i:=i-1)
		   {
			   if (p_Request.msgHeader.supported.optionsTags[i-1]=="100rel")
@@ -2061,9 +2061,9 @@ group SDPOperations{
	*/
	function f_check_attribute(in SDP_Message p_sdp, in template SDP_attribute p_attribute) runs on SipComponent return boolean {
		
    	if (ispresent(p_sdp.media_list)) {
    	if (isvalue(p_sdp.media_list)) {
    		for (var integer j:=0; j<lengthof(p_sdp.media_list); j:=j+1){			
    			if (ispresent(p_sdp.media_list[j].attributes)) {
    			if (isvalue(p_sdp.media_list[j].attributes)) {
    				for (var integer i:=0; i<lengthof(p_sdp.media_list[j].attributes); i:=i+1){			
    					if (match(p_sdp.media_list[j].attributes[i],p_attribute)) 
    						{return(true);};
@@ -2071,7 +2071,7 @@ group SDPOperations{
    			}
    			};
    	}
    	if (ispresent(p_sdp.attributes)) {
    	if (isvalue(p_sdp.attributes)) {
    		for (var integer j:=0; j<lengthof(p_sdp.attributes); j:=j+1){			
    			if (match(p_sdp.attributes[j],p_attribute)) {return(true);};
    			};
@@ -2087,7 +2087,7 @@ group SDPOperations{
    */
    function f_check_session_attribute(in SDP_Message p_sdp, in template SDP_attribute p_attribute) runs on SipComponent return boolean {
		
        if (ispresent(p_sdp.attributes)) {
        if (isvalue(p_sdp.attributes)) {
            for (var integer j:=0; j<lengthof(p_sdp.attributes); j:=j+1){			
                if (match(p_sdp.attributes[j],p_attribute)) {return(true);};
                };
@@ -2109,16 +2109,16 @@ group SDPOperations{
		var template SDP_attribute v_attribute := p_attribute;
		
		// check if the selected attribute is included in the SDP offer (session attributes)
		if (ispresent(p_sdp.attributes)) {
		if (isvalue(p_sdp.attributes)) {
			for (var integer j:=0; j<lengthof(p_sdp.attributes); j:=j+1){			
				if (match(p_sdp.attributes[j],p_attribute)) {v_attribute := p_sdp.attributes[j];};
				};
		}

		// check if the selected attribute is included in the SDP offer (any of the media attributes)
		else {if (ispresent(p_sdp.media_list)) {
		else {if (isvalue(p_sdp.media_list)) {
			for (var integer j:=0; j<lengthof(p_sdp.media_list); j:=j+1){			
				if (ispresent(p_sdp.media_list[j].attributes)) {
				if (isvalue(p_sdp.media_list[j].attributes)) {
					for (var integer i:=0; i<lengthof(p_sdp.media_list[j].attributes); i:=i+1){			
						if (match(p_sdp.media_list[j].attributes[i],p_attribute)) 
							{v_attribute := p_sdp.media_list[j].attributes[i];};
@@ -2143,14 +2143,14 @@ group SDPOperations{
	*/
	function f_check_bandwidth(in SDP_Message loc_sdp, in template SDP_bandwidth loc_bandw) runs on SipComponent return boolean {
	
					if (ispresent(loc_sdp.bandwidth)) {
					if (isvalue(loc_sdp.bandwidth)) {
						for (var integer j:=0; j<lengthof(loc_sdp.bandwidth); j:=j+1){			
							if (match(loc_sdp.bandwidth[j],loc_bandw)) {return(true);};
							};
					};
					if (ispresent(loc_sdp.media_list)) {
					if (isvalue(loc_sdp.media_list)) {
						for (var integer j:=0; j<lengthof(loc_sdp.media_list); j:=j+1){
							if (ispresent(loc_sdp.media_list[j].bandwidth)) {
							if (isvalue(loc_sdp.media_list[j].bandwidth)) {
							 for(var integer i:=0; i< lengthof(loc_sdp.media_list[j].bandwidth); i:=i+1) {
								if (match(loc_sdp.media_list[j].bandwidth[i],loc_bandw)) {
									return(true);};
@@ -2168,7 +2168,7 @@ group SDPOperations{
	*/
	function f_check_media(in SDP_Message loc_sdp, in template SDP_media_desc loc_media) runs on SipComponent return boolean {
		
    	if (ispresent(loc_sdp.media_list)) {
    	if (isvalue(loc_sdp.media_list)) {
    		for (var integer j:=0; j<lengthof(loc_sdp.media_list); j:=j+1){			
    			if (match(loc_sdp.media_list[j].media_field.transport,loc_media.media_field.transport) and
    				match(loc_sdp.media_list[j].media_field.fmts,loc_media.media_field.fmts)) 
@@ -2233,7 +2233,7 @@ group SDPOperations{
	 * @param p_curr new curr attribute
	 */
	function f_replace_curr_attribute(inout SDP_Message p_sdp, in SDP_attribute_curr p_curr) {
		if(ispresent(p_sdp.media_list)) {
		if(isvalue(p_sdp.media_list)) {
			var integer mn := lengthof(p_sdp.media_list[0].attributes);
			for(var integer i := 0; i<mn; i := i+1) {
				if(ischosen(p_sdp.media_list[0].attributes[i].curr)){
@@ -2250,7 +2250,7 @@ group SDPOperations{
	 * @param p_att SDP attribute to appand
	 */
	function f_append_media_attribute(inout SDP_Message p_sdp, in SDP_attribute p_att) {
		if(ispresent(p_sdp.media_list)) {
		if(isvalue(p_sdp.media_list)) {
			var integer mn := lengthof(p_sdp.media_list[0].attributes);
			p_sdp.media_list[0].attributes[mn] := p_att;
		}
@@ -2360,7 +2360,7 @@ group SDPOperations{
		for (i :=0;  i < mn; i := i+1)
		{
			//for every single media
			if (ispresent(vc_sdp_remote.media_list[i].attributes))
			if (isvalue(vc_sdp_remote.media_list[i].attributes))
			{
				cn := lengthof(vc_sdp_remote.media_list[i].attributes);
			};
@@ -2390,7 +2390,7 @@ group SDPOperations{
				}
				vc_sdp_local.media_list[i].attributes := v_mediaAttributes;
				
                if (ispresent(vc_sdp_local.media_list[i].attributes))
                if (isvalue(vc_sdp_local.media_list[i].attributes))
                {
                    cn := lengthof(vc_sdp_local.media_list[i].attributes);
                    for (j :=0; j<cn; j:=j+1)
@@ -2499,10 +2499,10 @@ group SDPOperations{
		{
			v_cn := 0; // initialize the number of attributes of the media list entry
		
			if (ispresent(vc_sdp_local.media_list)) //media_list is optional
			if (isvalue(vc_sdp_local.media_list)) //media_list is optional
			{						
//				log("vc_sdp_local.media_list[i] ",vc_sdp_local.media_list[i]);
				if (ispresent(vc_sdp_local.media_list[i].attributes))
				if (isvalue(vc_sdp_local.media_list[i].attributes))
				{
					v_cn := lengthof(vc_sdp_local.media_list[i].attributes);
				};
@@ -2549,7 +2549,7 @@ group SDPOperations{
      var boolean v_set_direction := false;
      var integer v_mn:= 0, i:=0;
      
	  if (ispresent(vc_sdp_local.attributes))
	  if (isvalue(vc_sdp_local.attributes))
		{ v_mn:= lengthof(vc_sdp_local.attributes);			
       
          for (i :=0;  i < v_mn; i := i+1)
@@ -2583,7 +2583,7 @@ group SDPOperations{
	function f_SIP_checksetSDPreqDirection(template(value) SDP_attribute p_direction_in, template(value) SDP_attribute p_direction_out) runs on SipComponent
	{	var template(value) SDP_attribute v_direction_out := p_direction_out;
		// check incoming SDP attribute
		if (not (ispresent(vc_request.messageBody) and (f_check_attribute(vc_request.messageBody.sdpMessageBody,p_direction_in)
		if (not (isvalue(vc_request.messageBody) and (f_check_attribute(vc_request.messageBody.sdpMessageBody,p_direction_in)
			))) 
			{
			    if (
@@ -2615,7 +2615,7 @@ group SDPOperations{
    function f_SIP_checkResponsesetSDPreqDirection(template(value) SDP_attribute p_direction_in, template(value) SDP_attribute p_direction_out) runs on SipComponent
    {	var template(value) SDP_attribute v_direction_out := p_direction_out;
        // check incoming SDP attribute
        if (not (ispresent(vc_response.messageBody) and (f_check_attribute(vc_response.messageBody.sdpMessageBody,p_direction_in)
        if (not (isvalue(vc_response.messageBody) and (f_check_attribute(vc_response.messageBody.sdpMessageBody,p_direction_in)
            ))) 
            {
                if (
@@ -2647,7 +2647,7 @@ group SDPOperations{
    function f_SIP_checksetSDPreqDirectionSession(template(value) SDP_attribute p_direction_in, template(value) SDP_attribute p_direction_out) runs on SipComponent
    {	var template(value) SDP_attribute v_direction_out := p_direction_out;
        // check incoming SDP attribute
        if (not (ispresent(vc_request.messageBody) and (f_check_session_attribute(vc_request.messageBody.sdpMessageBody,p_direction_in)
        if (not (isvalue(vc_request.messageBody) and (f_check_session_attribute(vc_request.messageBody.sdpMessageBody,p_direction_in)
            ))) 
            {if (
                match(valueof(p_direction_in), mw_attribute_sendrecv) and
@@ -2676,7 +2676,7 @@ group SDPOperations{
    function f_SIP_checkResponsesetSDPreqDirectionSession(template(value) SDP_attribute p_direction_in, template(value) SDP_attribute p_direction_out) runs on SipComponent
    {	var template(value) SDP_attribute v_direction_out := p_direction_out;
        // check incoming SDP attribute
        if (not (ispresent(vc_response.messageBody) and (f_check_session_attribute(vc_response.messageBody.sdpMessageBody,p_direction_in)
        if (not (isvalue(vc_response.messageBody) and (f_check_session_attribute(vc_response.messageBody.sdpMessageBody,p_direction_in)
            ))) 
            {if (
                match(valueof(p_direction_in), mw_attribute_sendrecv) and
@@ -2706,7 +2706,7 @@ group SDPOperations{
    function f_SIP_checkSDPrespDirection(template SDP_attribute p_direction_in) runs on SipComponent
    {		
    	// check incoming SDP attribute
    	if (not (ispresent(vc_response.messageBody) and f_check_attribute(vc_response.messageBody.sdpMessageBody,p_direction_in))) 
    	if (not (isvalue(vc_response.messageBody) and f_check_attribute(vc_response.messageBody.sdpMessageBody,p_direction_in))) 
    		{setverdict(fail);};
    }

@@ -2735,7 +2735,7 @@ group SDPOperations{
		for (i :=p_medianum-1;  i < v_mn; i := i+1)
		{
			//for every single media
			if (ispresent(vc_sdp_remote.media_list[i].attributes))
			if (isvalue(vc_sdp_remote.media_list[i].attributes))
			{
				v_cn := lengthof(vc_sdp_remote.media_list[i].attributes);
				log (v_cn);
@@ -2770,21 +2770,21 @@ group SDPOperations{
	*/
	function f_copy_SDP() runs on SipComponent
	{
		if (ispresent(vc_sdp_remote.connection))
		if (isvalue(vc_sdp_remote.connection))
				{vc_sdp_local.connection := vc_sdp_remote.connection}
			else {vc_sdp_local.connection := omit};
			
        vc_sdp_local.origin := vc_sdp_remote.origin;
        vc_sdp_local.session_name := vc_sdp_remote.session_name;
			
        if (ispresent(vc_sdp_remote.bandwidth))
        if (isvalue(vc_sdp_remote.bandwidth))
                {vc_sdp_local.bandwidth := vc_sdp_remote.bandwidth}
            else {vc_sdp_local.bandwidth := {}};
			
		if (ispresent(vc_sdp_remote.media_list))
		if (isvalue(vc_sdp_remote.media_list))
		{
                //			// cleaning of media before assignment	
                //			if (ispresent(vc_sdp_local.media_list))
                //			if (isvalue(vc_sdp_local.media_list))
                //			{
                //				for (var integer i:=0; i<lengthof(vc_sdp_local.media_list); i:=i+1)
                //				{			
@@ -3477,7 +3477,7 @@ group AwaitingMessage {
			  f_setHeadersOnReceiptOfRequest(v_MSG);
			  //Answer to the PRACK
			  // TODO STF471 changed: To include message body in 200OK on PRACK
			  if (ispresent(vc_request.messageBody) and ischosen(vc_request.messageBody.sdpMessageBody)){
			  if (isvalue(vc_request.messageBody) and ischosen(vc_request.messageBody.sdpMessageBody)){
				f_sendResponse(m_Response_mbody(c_statusLine200, vc_callId, vc_cSeq, vc_caller_From, vc_caller_To, vc_via, omit, f_recordroute(), m_MBody_SDP(vc_sdp_local)));
			  }
			  else {
@@ -3562,7 +3562,7 @@ group AwaitingMessage {
				f_setHeadersOnReceiptOfRequest(v_MSG);
				//Answer to the UPDATE
                // TODO STF471 changed: To include message body in 200OK on UPDATE
				if (ispresent(vc_request.messageBody) and ischosen(vc_request.messageBody.sdpMessageBody)){
				if (isvalue(vc_request.messageBody) and ischosen(vc_request.messageBody.sdpMessageBody)){
					f_sendResponse(m_Response_mbody(c_statusLine200, vc_callId, vc_cSeq, vc_caller_From, vc_caller_To, vc_via, omit, f_recordroute(), m_MBody_SDP(vc_sdp_local)));
				}
				else {
@@ -3686,8 +3686,8 @@ group SendMessage {
//    var PRACK_Request prackReq;
//		f_setHeadersGeneral(vc_cSeq, "PRACK"); // cseq, contact, branch, via	
//    // TODO: CR?
//    if (ispresent(vc_response.msgHeader.rSeq) and 
//      ispresent(vc_response.msgHeader.rSeq.responseNum)){
//    if (isvalue(vc_response.msgHeader.rSeq) and 
//      isvalue(vc_response.msgHeader.rSeq.responseNum)){
//      responseNum := vc_response.msgHeader.rSeq.responseNum;
//    }
//		vc_rAck := valueof(m_RAck(responseNum, p_rack_cseq.seqNumber, p_rack_cseq.method));
@@ -3702,7 +3702,7 @@ group SendMessage {
//      vc_rAck);
//      
//      // TODO: added route header if required -> CR?
//      //if (ispresent(vc_response.msgHeader.recordRoute)){
//      //if (isvalue(vc_response.msgHeader.recordRoute)){
//      prackReq.msgHeader.route := f_route();
//      //}
//