Commit de83b6b3 authored by pintar's avatar pintar
Browse files

new XML definitions(new or adapted types, templates and constants)

parent 23ae9303
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -83,6 +83,15 @@ group SimpleConstants
	  // IMS 3GPP name CW application
	  const charstring c_ims3gppCwApplication := "application/vnd.3gpp.cw+xml";
	  
      // IMS ETSI name MCID application
      const charstring c_imsEtsiMcidApplication := "application/vnd.etsi.mcid+xml";
	  
      // IMS ETSI name CUG application
      const charstring c_imsEtsiCugApplication := "application/vnd.etsi.cug+xml";
	  
      // IMS ETSI name Simservs application(TIP/TIR, ACR, CDIV, OIP/OIR, CUG)
      const charstring c_imsEtsiSimservsApplication := "application/vnd.etsi.simservs+xml";
      
	  // OCTET-STREAM name application
	  const charstring c_octetAplication := "application/octet-stream";
	  
@@ -1769,8 +1778,8 @@ group SubTypes{// Subtypes
	{
	  type union MessageBody{
		SDP_Message sdpMessageBody, 	// if there is only SDP part
		XmlBody xmlBody,            	// if there is XML message body
		XMLMessage xmlMessage,          // if there is XML with header&body
//		XMLMessage xmlMessage,          // if there is XML message (with header and body)
        XmlBody xmlBody,				// if there is XML body
		MIME_Message mimeMessageBody, 	// if there is SDP and encapsulated ISUP part
		charstring sipfrag, 			// if content-Type is message/sipfrag (cp. NOTIFY, cp TS124147 A.4.3.1.2)
		charstring textplain			// if content type is text/plain (for testing long messages)
@@ -1785,8 +1794,8 @@ group SubTypes{// Subtypes
    	
		type union MIME_Encapsulated_Parts {
		  SDP_Message 	sdpMessageBody,
		  XmlBody 					xmlBody,       	// if there is XML message body
		  XMLMessage 				xmlMessage		// if there is XML with header&body
          XmlBody xmlBody					// if there is XML body
//          XMLMessage 	xmlMessage          // if there is XML message (with header and body)
		} 
		
		type record MIME_Encapsulated_Part {
+43 −124
Original line number Diff line number Diff line
@@ -22,6 +22,37 @@ module LibSip_Templates
	import from LibSip_PIXITS all;
	import from LibSip_XMLTypes all;
	
	//LibXMLTypes
	import from ietf_params_xml_ns_resource_lists language "XSD" all
	with {
		extension "File:../xsd/ResourceList.xsd"
	}
	
	import from org_etsi_uri__ngn_params_xml_simservs_xcap language "XSD" all
	with {
		extension "File:../xsd/SupplementaryServices.xsd"
	}
	
	import from org_etsi_uri__ngn_params_xml_simservs_mcid language "XSD" all
	with {
		extension "File:../xsd/MCID.xsd"
	}
	
    import from Ims_3gpp language "XSD" all
    with {
        extension "File:../xsd/Ims_3gpp.xsd"
    }
    
    import from ietf_params_xml_ns_conference_info language "XSD" all
    with {
        extension "File:../xsd/CONF.xsd"
    }
    
    import from org_etsi_uri__ngn_params_xml_simservs_pstn language "XSD" all
    with {
        extension "File:../xsd/PSTN.xsd"
    }
	
	group ModuleParameters {
	
	    modulepar boolean MB_LENGTH_FROM_ENCVAL:=true; //* to get length of message body from ecoded value
@@ -2669,7 +2700,7 @@ group MessageBodies {
	
	template MessageBody mw_MBody_MIME_Ims3gpp(
		template charstring p_disposition, 
		template Ims_3gpp p_ims3gpp
		template TIMS3GPP p_ims3gpp
	):= {
		mimeMessageBody := {boundary:=?, 
			mimeEncapsulatedList:= {
@@ -2690,7 +2721,7 @@ group MessageBodies {
	
	template MessageBody mw_MBody_MIME_Ims3gppCW(
		template charstring p_disposition, 
		template Ims_3gpp p_ims3gpp
		template TIMS3GPP p_ims3gpp
	):= {
		mimeMessageBody := {boundary:=?, 
			mimeEncapsulatedList:= {
@@ -2745,12 +2776,6 @@ group TemplatePreparationFunctions {
    			v_result := f_XMLBody_Length(p_mb_par.xmlBody, USE_FX_FOR_XML_LENGTH );
    		};
    		
            //assume XML_Message ONLY in the message body
            if (ischosen(p_mb_par.xmlMessage))
            { 
            	v_result := f_XMLlength(p_mb_par.xmlMessage, USE_FX_FOR_XML_LENGTH );
            };
    
    		//  assume MIME_Message in the message body
    		if (ischosen(p_mb_par.mimeMessageBody))
    		{ 
@@ -2995,63 +3020,8 @@ group TemplatePreparationFunctions {
		* switching of internal or external functions are made by boolean module parameter/PIXIT
		* USE_FX_FOR_XML_LENGTH declared at top of this module
		*/
		external function fx_calculateXMLMessageLen(XMLMessage p_mb) return integer;
		external function fx_calculateXMLBodyLen(XmlBody p_mb) return integer;
		
		/**
		* 
		* @desc Calculation of XML length
		* @param p_mb contain XML message
		* @return xml_length
		*/
		function f_XMLlength(XMLMessage p_mb, boolean p_ext_func) return integer
		{
			var integer v_result:=0;
			
			if ( p_ext_func){
				v_result := fx_calculateXMLMessageLen(p_mb);
			}else{
				if (ispresent(p_mb.header)){
					v_result := f_XMLHeader_Length(p_mb.header);
				}
				
				//false given, because decision of external function usage is done in first if statement
				v_result := v_result + f_XMLBody_Length(p_mb.body, false); 
			}
			return v_result
		} //* f_XMLlength
		
		/**
		* 
		* @desc Calculation of XML header length
		* @param p_mh contain XML header 
		* @return xml_header_length
		*/
		function f_XMLHeader_Length(XmlHeader p_mh) return integer
		{
			var integer v_result:=0;
			
			//*<?xml version="1.0" encoding="UTF-8"?>\n len=39*/
			//* 2 3          1   1          1     1 2 1*/
			
			v_result:=2+3+lengthof(" version=")+1+lengthof(p_mh.version)+1;  //<?xml version="1.0"

			if (ispresent(p_mh.encoding)){
				
				v_result:=v_result+lengthof(" encoding=")+1+lengthof(p_mh.encoding)+1;  // encoding="UTF-8"
			}
			
			if (ispresent(p_mh.anyAttributes)){
				for (var integer i:=0; i<sizeof(p_mh.anyAttributes); i:=i+1){
					v_result := v_result + 1 + lengthof(p_mh.anyAttributes[i].name)+ 2 + lengthof(p_mh.anyAttributes[i].val) + 1;
					//vresult + " "(1)+ length(name) + "=\""(2) + length(val) + "\""(1)
				}
			}
			
			v_result:=v_result+2+1; //?>\n
			
			return v_result
		} //* f_XMLHeaderLength
		external function fx_calculateXMLBodyLen(XmlBody p_mb) return integer;
		
		/**
		* 
@@ -3067,9 +3037,9 @@ group TemplatePreparationFunctions {
				v_result := fx_calculateXMLBodyLen(p_mb);
			}else{
				//  assume ConferenceInfo ONLY in the XML message body
				if (ischosen(p_mb.conferenceInfo))
				if (ischosen(p_mb.conference_type))
				{ 
					v_result := f_XMLBody_ConferenceInfo_Length(p_mb.conferenceInfo);
					v_result := f_XMLBody_ConferenceInfo_Length(p_mb.conference_type);
				};
				
				//  assume CUG ONLY in the XML message body
@@ -3096,24 +3066,6 @@ group TemplatePreparationFunctions {
					v_result := f_XMLBody_Simservs_Length(p_mb.simservs);
				};
				
				//  assume CDIV ONLY in the XML message body
				if (ischosen(p_mb.cdivn))
				{ 
					v_result := f_XMLBody_CDIV_Length(p_mb.cdivn);
				};
				
				//  assume ICB ONLY in the XML message body
				if (ischosen(p_mb.icb))
				{ 
					v_result := f_XMLBody_ICB_Length(p_mb.icb);
				};
				
				//  assume OCB ONLY in the XML message body
				if (ischosen(p_mb.ocb))
				{ 
					v_result := f_XMLBody_OCB_Length(p_mb.ocb);
				};
				
				//  assume ResourceLists ONLY in the XML message body
				if (ischosen(p_mb.resourceLists))
				{ 
@@ -3141,7 +3093,7 @@ group TemplatePreparationFunctions {
			* @param p_mb contain XML ConfInfo body
			* @return xml_length
			*/
			function f_XMLBody_ConferenceInfo_Length(Conference_info p_mb) return integer
			function f_XMLBody_ConferenceInfo_Length(Conference_type p_mb) return integer
			{
				var integer v_result:=0;
				//TODO: write function body
@@ -3206,39 +3158,6 @@ group TemplatePreparationFunctions {
				return v_result
			} //* f_XMLBody_Simservs_Length	
			
			/** @desc Calculation of XML CDIV element length
			* @param p_mb contain XML CDIV body
			* @return xml_length
			*/
			function f_XMLBody_CDIV_Length(Comm_div_info p_mb) return integer
			{
				var integer v_result:=0;
				//TODO: write function body
				return v_result
			} //* f_XMLBody_CDIV_Length		
			
			/** @desc Calculation of XML ICB length
			* @param p_mb contain XML ICB body
			* @return xml_length
			*/
			function f_XMLBody_ICB_Length(Incoming_communication_barring p_mb) return integer
			{
				var integer v_result:=0;
				//TODO: write function body
				return v_result
			} //* f_XMLBody_ICB_Length
			
			/** @desc Calculation of XML OCB length
			* @param p_mb contain XML OCB body
			* @return xml_length
			*/
			function f_XMLBody_OCB_Length(Outgoing_communication_barring p_mb) return integer
			{
				var integer v_result:=0;
				//TODO: write function body
				return v_result
			} //* f_XMLBody_OCB_Length
			
			/** @desc Calculation of XML ResourceList length
			* @param p_mb contain XML ResourceList body
			* @return xml_length
@@ -3254,7 +3173,7 @@ group TemplatePreparationFunctions {
			* @param p_mb contain XML Ims3GPP body
			* @return xml_length
			*/
			function f_XMLBody_Ims3GPP_Length(Ims_3gpp p_mb) return integer
			function f_XMLBody_Ims3GPP_Length(TIMS3GPP p_mb) return integer
			{
				var integer v_result:=0;
				//TODO: write function body
@@ -3300,11 +3219,11 @@ group TemplatePreparationFunctions {
            		v_result := v_result + f_XMLBody_Length(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlBody, USE_FX_FOR_XML_LENGTH );
            	};
		
				//assume XML_Message ONLY in the message body
				if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlMessage))
				{ 
					v_result := v_result + f_XMLlength(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlMessage, USE_FX_FOR_XML_LENGTH );
				};
//				//assume XML_Message ONLY in the message body
//				if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlMessage))
//				{ 
//					v_result := v_result + f_XMLlength(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlMessage, USE_FX_FOR_XML_LENGTH );
//				};
                
                //v_result := v_result +2/*0d0a*/; ??? to check
			}
+38 −926

File changed.

Preview size limit exceeded, changes collapsed.