Newer
Older
v_result := v_result + 2 + c_CRlen + lengthof("des:" & p_element.des.preconditionType & " " & p_element.des.strength & " " & p_element.des.statusType & " " & p_element.des.direction);
v_result := v_result + 2 + c_CRlen + lengthof("conf:" & p_element.conf.preconditionType & " " & p_element.conf.statusType & " " & p_element.conf.direction);
}
if (ischosen(p_element.rtpmap)) {
v_result := v_result + 2 + c_CRlen + lengthof("rtpmap:" & p_element.rtpmap.attr_value);
}
if (ischosen(p_element.rtcp)) {
v_result := v_result + 2 + c_CRlen + lengthof("rtcp:" & p_element.rtcp.attr_value);
}
if (ischosen(p_element.unknown)) {
v_result := v_result + 2 + c_CRlen + lengthof(p_element.unknown.name);
if (isvalue(p_element.unknown.attr_value)) {
var charstring aux := valueof(p_element.unknown.attr_value);
v_result := v_result + lengthof(":" & p_element.unknown.attr_value);
}
}
//* log("axr: length attribute=", v_result);
return v_result;
} //* f_SDPlength_attribute
} //* group SDPlen_calculation
group XML_Len_calculation {
/**
* @desc Declaration of external functions to calculate length of message bodies 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_calculateXMLBodyLen(
XmlBody p_mb
) return integer;
/**
* @desc Calculation of XML body length
* @param p_mb contain XML body
* @return xml_length
*/
function f_XMLBody_Length(
XmlBody p_mb,
boolean p_ext_func
) return integer {
var integer v_result := 0;
if (p_ext_func) {
v_result := fx_calculateXMLBodyLen(p_mb);
}
else {
// assume ConferenceInfo ONLY in the XML message
// body
if (ischosen(p_mb.conference)) {
v_result := f_XMLBody_ConferenceInfo_Length(p_mb.conference);
}
if (ischosen(p_mb.cug)) {
v_result := f_XMLBody_Cug_Length(p_mb.cug);
}
if (ischosen(p_mb.mcid)) {
v_result := f_XMLBody_Mcid_Length(p_mb.mcid);
}
if (ischosen(p_mb.cw)) {
v_result := f_XMLBody_Cw_Length(p_mb.cw);
}
if (ischosen(p_mb.cdivn)) {
v_result := f_XMLBody_Cdivn_Length(p_mb.cdivn);
}
if (ischosen(p_mb.pstnTransit)) {
v_result := f_XMLBody_PSTNTransit_Length(p_mb.pstnTransit);
}
if (ischosen(p_mb.simservs)) {
v_result := f_XMLBody_Simservs_Length(p_mb.simservs);
}
if (ischosen(p_mb.resourceLists)) {
v_result := f_XMLBody_ResourceList_Length(p_mb.resourceLists);
}
if (ischosen(p_mb.ims3gpp)) {
v_result := f_XMLBody_Ims3GPP_Length(p_mb.ims3gpp);
}
/**
* Add aditional checks regarding to new variants, also implement appropriate function for calculation
*/
}
return v_result;
} //* f_XMLBodyLength
group XMLBodies_calculation {
/**
* @desc Calculation of XML ConferenceInfo element length
* @param p_mb contain XML ConfInfo body
* @return xml_length
*/
function f_XMLBody_ConferenceInfo_Length(
template(value) Conference_type p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_ConferenceInfo_Length
/**
* @desc Calculation of XML CUG element length
* @param p_mb contain XML CUG body
* @return xml_length
*/
function f_XMLBody_Cug_Length(
template(value) Cug p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_Cug_Length
/**
* @desc Calculation of XML MCID element length
* @param p_mb contain XML MCID body
* @return xml_length
*/
function f_XMLBody_Mcid_Length(
template(value) Mcid p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_Mcid_Length
/**
* @desc Calculation of XML CW element length
* @param p_mb contain XML CW body
* @return xml_length
*/
function f_XMLBody_Cw_Length(
template(value) Ims_cw p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_Cw_Length
/**
* @desc Calculation of XML CDIVN element length
* @param p_mb contain XML CDIVN body
* @return xml_length
*/
function f_XMLBody_Cdivn_Length(
template(value) Comm_div_info_type p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_Cdivn_Length
/**
* @desc Calculation of XML PSTNTransit element length
* @param p_mb contain XML PSTNTransit body
* @return xml_length
*/
function f_XMLBody_PSTNTransit_Length(
template(value) PSTN_transit p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_PSTNTransit_Length
/**
* @desc Calculation of XML Simservs element length
* @param p_mb contain XML Simservs body
* @return xml_length
*/
function f_XMLBody_Simservs_Length(
template(value) Simservs p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_Simservs_Length
/**
* @desc Calculation of XML ResourceList length
* @param p_mb contain XML ResourceList body
* @return xml_length
*/
function f_XMLBody_ResourceList_Length(
template(value) Resource_lists p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_ResourceList_Length
/**
* @desc Calculation of XML Ims3GPP length
* @param p_mb contain XML Ims3GPP body
* @return xml_length
*/
function f_XMLBody_Ims3GPP_Length(
template(value) TIMS3GPP p_mb
) return integer {
var integer v_result := lengthof(encvalue(p_mb)) / 8;
return v_result;
} //* f_XMLBody_Ims3GPP_Length
} //* group XMLlen_calculation
group simpleMsgSummaryBody_Length {
function f_simpleMsgSummaryBody_Length(
SimpleMsgSummary p_mb
) return integer {
//* due to empty line beginning of message body
var charstring v_auxstring;
v_result := 2 + lengthof(p_mb.msg_status_line.msg_type) + 2 + lengthof(p_mb.msg_status_line.msg_status) + c_CRlen; //* "Message-Waiting:
//* yes"
//* "Message-Account"
{
v_result := v_result + 2 + lengthof(p_mb.msg_account.msg_type_account) + 2 + lengthof(p_mb.msg_account.account_URI) + c_CRlen;
}
for (var integer i := 0; i < lengthof(p_mb.msg_summary_line_list); i := i + 1) {
v_result := v_result + 2 + c_CRlen + lengthof(p_mb.msg_summary_line_list[i].msg_context_class) + 2 + lengthof(p_mb.msg_summary_line_list[i].msgs);
if (isvalue(p_mb.msg_summary_line_list[i].urgent_msgs)) {
v_auxstring := valueof(p_mb.msg_summary_line_list[i].urgent_msgs);
v_result := v_result + 1 + lengthof(v_auxstring);
}
}
}
for (var integer i := 0; i < lengthof(p_mb.opt_msg_headers); i := i + 1) {
v_result := v_result + 2 + c_CRlen + lengthof(p_mb.opt_msg_headers[i]);
}
}
return v_result;
}
}
group MIME_Len_calculation {
/**
* @desc Calculation of MIME length
* @param p_mb contain MIME message
* @return xml_length
*/
function f_MIMElength(
MIME_Message p_mb
) return integer {
v_result := v_result + lengthof(p_mb.boundary) + 2 /*0d0a*/;
for (var integer i := 0; i < lengthof(p_mb.mimeEncapsulatedList); i := i + 1) {
v_result := v_result + lengthof("Content-Type: ") + lengthof(p_mb.mimeEncapsulatedList[i].content_type) + 2 /*0d0a*/;
if (isvalue(p_mb.mimeEncapsulatedList[i].content_disposition)) {
v_result := v_result + lengthof("Content-Disposition: ") + lengthof(p_mb.mimeEncapsulatedList[i].content_disposition) + 2 /*0d0a*/;
}
// v_result := v_result +2/*0d0a*/; ??? to check
// assume SDP_Message ONLY in the message body
if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.sdpMessageBody)) {
v_result := v_result + f_SDPlength(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.sdpMessageBody);
}
if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlBody)) {
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 );
// };
// v_result := v_result +2/*0d0a*/; ??? to check
}
// v_result := v_result +2/*0d0a*/; ??? to check
return v_result;
} //* f_MIMElength
} //* group MIMElen_calculation
group TextPlain_Len_calculation {
/**
* @desc Calculation of messagebody-textplain type length
* @param p_mb contain textplain message
* @return lenght
*/
function f_TextPlainLength(
template(value) MessageBody p_mb
) return integer {
var integer v_result := 0;
v_result := v_result + lengthof(p_mb.textplain);
return v_result;
} //* group MessageBody_Calculation
group GiveHeaders {
/**
* @desc Return component variable of recordRoute header if vc_boo_recordRoute is true
* @return component variable of recordRoute header
*/
function f_recordroute(
) runs on SipComponent
return template(omit) RecordRoute {
template RecordRoute v_recordRoute := omit;
if (vc_boo_recordRoute) {
return vc_recordRoute;
return (v_recordRoute);
} //* TODO: RecordRoute is not OPTIONAL!!! Check IT!
}
/**
* @desc Return component variable of Route header if vc_boo_route is true
* @return component variable of recordRoute header
*/
function f_route(
) runs on SipComponent
return template(omit) Route {
template(omit) Route v_route := omit;
if (vc_boo_route) {
return v_route;
} //* TODO: Route header need to be in reverse order than
//* RecordRoute, question of return value - RecordRoute
else {
return (v_route);
} //* TODO: Route is not OPTIONAL!!! Check IT!
}
group others {
/*
*
* @desc function combines two comma parameter lists
* @param p_list1 first list
* @param p_list2 second list
* @return comma parameter list that contains parameters from both input lists
* @verdict
*/
function f_merge_CommaParam_List(
template(value) CommaParam_List p_list1,
template(value) CommaParam_List p_list2
) return template(value) CommaParam_List {
var template(value) CommaParam_List p_result;
var integer limit1 := lengthof(p_list1);
for (var integer i := 0; i < limit1; i := i + 1) {
p_result[i] := p_list1[i];
}
for (var integer i := 0; i < lengthof(p_list2); i := i + 1) {
p_result[i + limit1] := p_list2[i];
}
return p_result;
}