Loading LibMsrp/LibMsrp_Functions.ttcn3 +15 −0 Original line number Diff line number Diff line Loading @@ -4,4 +4,19 @@ * @desc This module provides the functions used by the test component */ module LibMsrp_Functions { // LibMsrp import from LibMsrp_TypesAndValues { type MsrpURI }; function f_str2msrpUri(in charstring p_uri, out template MsrpURI p_msrpUri) return boolean { var integer v_res := 0; v_res := decvalue(oct2bit(char2oct(p_uri)), p_msrpUri); return v_res == 0; } // End of function f_str2msrpUri } // End of LibMsrp_Functions No newline at end of file LibMsrp/LibMsrp_Templates.ttcn3 +207 −12 Original line number Diff line number Diff line Loading @@ -15,31 +15,50 @@ module LibMsrp_Templates { // LibMsrp import from LibMsrp_TypesAndValues { type StatusCode, RequestLine, ResponseLine, EndLine, Headers, ContentStuff, ContentType, MediaType, SEND_request, RECEIVE_response }; import from LibMsrp_TypesAndValues all; /** * @desc Declaration of constants used by templates */ group constants { group codes { /** * @desc 200 status */ const StatusCode c_OKCode := 200; } // End of group codes group comments { /** * @desc Comment for 200 status */ const charstring c_OKComment := "OK"; } // End of group comments } // End of group constants /** * @desc Start and End line descriptions */ group delimiterLines { /** * @desc Generic receive template for SEND start request line */ template RequestLine mw_RequestLine_SEND_any := { tagMsrp := e_MSRP, transactionID := ?, method := e_SEND } // End of template mw_RequestLine_SEND_any /** * @desc Generic receive template for RECEIVE start response line */ template ResponseLine mw_ResponseLine_any := { tagMsrp := e_MSRP, transactionID := ?, Loading @@ -53,9 +72,12 @@ module LibMsrp_Templates { comment := c_OKComment } // End of template mw_ResponseLine_success /** * @desc Receive template for SEND/RECEIVE end line, assuming that message are small enought to prevent chunk */ template EndLine mw_EndLine_noMore := { transactionID := ?, continuationFlag := false continuationFlag := false // No chunk } // End of template mw_EndLine_noMore } // End of group delimiterLines Loading @@ -65,20 +87,146 @@ module LibMsrp_Templates { */ group msrpAddressing { /** * @desc Dummy send template for MsrpURI used by ToPath * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>msrp://biloxi.example.com:12763/kjhd37s2s20w2a;tcp</pre> */ template (value) MsrpURI m_msrpURIs_ToPath_Dummy := { scheme := { scheme := e_SCHEME }, authority := "biloxi.example.com:12763", sessionID := "kjhd37s2s20w2a", transport := "tcp", uriParams := omit } // End of template m_msrpURIs_ToPath_Dummy /** * @desc Dummy send template for MsrpURI used by FromPath * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>msrp://atlanta.example.com:7654/jshA7weztas;tcp</pre> */ template (value) MsrpURI m_msrpURIs_FromPath_Dummy := { scheme := { scheme := e_SCHEME }, authority := "atlanta.example.com:7654", sessionID := "jshA7weztas", transport := "tcp", uriParams := omit } // End of template m_msrpURIs_FromPath_Dummy /** * @desc Dummy send template for ToPath * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>msrp://atlanta.example.com:7654/jshA7weztas;tcp</pre> */ template (value) ToPath m_msrpToPath_Dummy := { pathID := e_TO_PATH, msrpURIs := { m_msrpURIs_ToPath_Dummy } } // End of template m_msrpToPath_Dummy /** * @desc Dummy send template for FromPath * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>msrp://atlanta.example.com:7654/jshA7weztas;tcp</pre> */ template (value) FromPath m_msrpFromPath_Dummy := { pathID := e_FROM_PATH, msrpURIs := { m_msrpURIs_FromPath_Dummy } } // End of template m_msrpFromPath_Dummy template ToPath mw_toPath(in template (present) MsrpURI p_path) := { pathID := e_TO_PATH, msrpURIs := { p_path } } // End of template mw_toPath template FromPath mw_fromPath(in template (present) MsrpURI p_path) := { pathID := e_FROM_PATH, msrpURIs := { p_path } } // End of template mw_fromPath } // End of group msrpAddressing group msrpHeaders { /** * @desc Dummy send template for MessageID * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>Message-ID: 87652491</pre> */ template (value) MessageID m_msrpMessageID_Dummy := { messageID := e_MESSAGEID, messageValue := "87652491" } // End of template m_msrpMessageID_Dummy /** * @desc Dummy send template for ByteRange * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>Byte-Range: 1-25/25</pre> */ template (value) ByteRange m_msrpByteRange_Dummy := { byteRangeID := e_BYTE_RANGE, startValue := 1, endValue := 25, totalValue := 25 } // End of template m_msrpByteRange_Dummy template Headers mw_Headers_any := { toPaths := ?, fromPaths := ?, headers := { ? } } // End of type Headers } // End of template mw_Headers_any template Headers mw_Headers_toPath_FromPath( in template ToPath p_toPath, in template FromPath p_fromPath ) modifies mw_Headers_any := { toPaths := { p_toPath }, fromPaths := { p_fromPath } } // End of template mw_Headers_toPath_FromPath } // End of group msrpHeaders group msrpContent { /** * @desc Dummy send template for ContentStuff * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre> * Content-Type: text/plain * * * Hey Bob, are you there? * </pre> */ template (value) ContentStuff m_msrpContentStuff_Dummy := { mimeHeaders := omit, contentType := { contentTypeID := e_CONTENT_TYPE, mediaType := { mediaType := str2oct("text"), subType := str2oct("plain"), genParams := omit } // End of 'mediaType' field }, // End of 'contentType' field data := str2oct("Hey Bob, are you there?") } // End of template m_msrpByteRange_Dummy template MediaType mw_mediaType_any := { mediaType := ?, subType := ?, Loading @@ -99,6 +247,11 @@ module LibMsrp_Templates { } // End of group msrpContent /** * Provides types for MSRP request * @see RFC 4975 - Clause 7.1. Constructing Requests * @see RFC 4976 - Relay Extensions for the Message Session Relay Protocol (MSRP) */ group msrpRequest { group msrpAUTH { Loading @@ -107,6 +260,38 @@ module LibMsrp_Templates { group msrpSEND { /** * @desc Dummy send template for SEND request * @ see RFC 4975 - Figure 2: Example MSRP Exchange */ template (value) SEND_request m_msrpSend_Dummy := { startLine := { tagMsrp := e_MSRP, transactionID := "a786hjs2", method := e_SEND }, // End of 'startLine' field headers := { toPaths := { m_msrpToPath_Dummy }, fromPaths := { m_msrpToPath_Dummy }, headers := { { messageID := m_msrpMessageID_Dummy }, { byteRange := m_msrpByteRange_Dummy } } }, // End of 'headers' field contentStuff := m_msrpContentStuff_Dummy, endLine := { transactionID := "a786hjs2", continuationFlag := false } } // End of template m_msrpSend_Dummy /** * @desc Generic receive template for SEND request */ template SEND_request mw_msrpSEND_any := { startLine := mw_RequestLine_SEND_any, headers := mw_Headers_any, Loading @@ -114,6 +299,16 @@ module LibMsrp_Templates { endLine := mw_EndLine_noMore } // End of template mw_msrpSEND_any template SEND_request mw_msrpSEND_toPath_FromPath( in template ToPath p_toPath, in template FromPath p_fromPath ) modifies mw_msrpSEND_any := { headers := mw_Headers_toPath_FromPath( p_toPath, p_fromPath) } // End of template mw_msrpSEND_toPath_FromPath } // End of group msrpSEND } // End of group msrpRequest Loading LibMsrp/LibMsrp_TypesAndValues.ttcn3 +10 −4 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ module LibMsrp_TypesAndValues { } // End of group tokens /** * @desc Start and End line descriptions */ group delimiterLines { /** Loading Loading @@ -248,7 +251,7 @@ module LibMsrp_TypesAndValues { Authority authority, SessionID sessionID optional, charstring transport, // transport = "tcp" / 1*ALPHANUM URIParams uriParams // List of URI-parameter URIParams uriParams optional // List of URI-parameter } // End of type Values type set of MsrpURI MsrpURIs;// length (1..infinity); Loading @@ -270,7 +273,10 @@ module LibMsrp_TypesAndValues { * @member msrpURIs The URIs of the sender * @see RFC 4975 - Clause 9. Formal Syntax */ type ToPath FromPath; type record FromPath { MsrpKeywords pathID (e_FROM_PATH), MsrpURIs msrpURIs } // End of type Path type set of ToPath ToPaths;// length (1..infinity); Loading Loading @@ -397,14 +403,14 @@ module LibMsrp_TypesAndValues { group msrpRequests { /** * @desc * @desc TODO * @see RFC 4976 - Clause 5.1. Connecting to Relays Acting on Your Behalf */ type record AUTH_request { } // End of type AUTH_request /** * @desc * @desc TODO * @see RFC 4975 - Clause 7.1.1. Sending SEND Requests */ type record SEND_request { Loading Loading
LibMsrp/LibMsrp_Functions.ttcn3 +15 −0 Original line number Diff line number Diff line Loading @@ -4,4 +4,19 @@ * @desc This module provides the functions used by the test component */ module LibMsrp_Functions { // LibMsrp import from LibMsrp_TypesAndValues { type MsrpURI }; function f_str2msrpUri(in charstring p_uri, out template MsrpURI p_msrpUri) return boolean { var integer v_res := 0; v_res := decvalue(oct2bit(char2oct(p_uri)), p_msrpUri); return v_res == 0; } // End of function f_str2msrpUri } // End of LibMsrp_Functions No newline at end of file
LibMsrp/LibMsrp_Templates.ttcn3 +207 −12 Original line number Diff line number Diff line Loading @@ -15,31 +15,50 @@ module LibMsrp_Templates { // LibMsrp import from LibMsrp_TypesAndValues { type StatusCode, RequestLine, ResponseLine, EndLine, Headers, ContentStuff, ContentType, MediaType, SEND_request, RECEIVE_response }; import from LibMsrp_TypesAndValues all; /** * @desc Declaration of constants used by templates */ group constants { group codes { /** * @desc 200 status */ const StatusCode c_OKCode := 200; } // End of group codes group comments { /** * @desc Comment for 200 status */ const charstring c_OKComment := "OK"; } // End of group comments } // End of group constants /** * @desc Start and End line descriptions */ group delimiterLines { /** * @desc Generic receive template for SEND start request line */ template RequestLine mw_RequestLine_SEND_any := { tagMsrp := e_MSRP, transactionID := ?, method := e_SEND } // End of template mw_RequestLine_SEND_any /** * @desc Generic receive template for RECEIVE start response line */ template ResponseLine mw_ResponseLine_any := { tagMsrp := e_MSRP, transactionID := ?, Loading @@ -53,9 +72,12 @@ module LibMsrp_Templates { comment := c_OKComment } // End of template mw_ResponseLine_success /** * @desc Receive template for SEND/RECEIVE end line, assuming that message are small enought to prevent chunk */ template EndLine mw_EndLine_noMore := { transactionID := ?, continuationFlag := false continuationFlag := false // No chunk } // End of template mw_EndLine_noMore } // End of group delimiterLines Loading @@ -65,20 +87,146 @@ module LibMsrp_Templates { */ group msrpAddressing { /** * @desc Dummy send template for MsrpURI used by ToPath * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>msrp://biloxi.example.com:12763/kjhd37s2s20w2a;tcp</pre> */ template (value) MsrpURI m_msrpURIs_ToPath_Dummy := { scheme := { scheme := e_SCHEME }, authority := "biloxi.example.com:12763", sessionID := "kjhd37s2s20w2a", transport := "tcp", uriParams := omit } // End of template m_msrpURIs_ToPath_Dummy /** * @desc Dummy send template for MsrpURI used by FromPath * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>msrp://atlanta.example.com:7654/jshA7weztas;tcp</pre> */ template (value) MsrpURI m_msrpURIs_FromPath_Dummy := { scheme := { scheme := e_SCHEME }, authority := "atlanta.example.com:7654", sessionID := "jshA7weztas", transport := "tcp", uriParams := omit } // End of template m_msrpURIs_FromPath_Dummy /** * @desc Dummy send template for ToPath * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>msrp://atlanta.example.com:7654/jshA7weztas;tcp</pre> */ template (value) ToPath m_msrpToPath_Dummy := { pathID := e_TO_PATH, msrpURIs := { m_msrpURIs_ToPath_Dummy } } // End of template m_msrpToPath_Dummy /** * @desc Dummy send template for FromPath * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>msrp://atlanta.example.com:7654/jshA7weztas;tcp</pre> */ template (value) FromPath m_msrpFromPath_Dummy := { pathID := e_FROM_PATH, msrpURIs := { m_msrpURIs_FromPath_Dummy } } // End of template m_msrpFromPath_Dummy template ToPath mw_toPath(in template (present) MsrpURI p_path) := { pathID := e_TO_PATH, msrpURIs := { p_path } } // End of template mw_toPath template FromPath mw_fromPath(in template (present) MsrpURI p_path) := { pathID := e_FROM_PATH, msrpURIs := { p_path } } // End of template mw_fromPath } // End of group msrpAddressing group msrpHeaders { /** * @desc Dummy send template for MessageID * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>Message-ID: 87652491</pre> */ template (value) MessageID m_msrpMessageID_Dummy := { messageID := e_MESSAGEID, messageValue := "87652491" } // End of template m_msrpMessageID_Dummy /** * @desc Dummy send template for ByteRange * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre>Byte-Range: 1-25/25</pre> */ template (value) ByteRange m_msrpByteRange_Dummy := { byteRangeID := e_BYTE_RANGE, startValue := 1, endValue := 25, totalValue := 25 } // End of template m_msrpByteRange_Dummy template Headers mw_Headers_any := { toPaths := ?, fromPaths := ?, headers := { ? } } // End of type Headers } // End of template mw_Headers_any template Headers mw_Headers_toPath_FromPath( in template ToPath p_toPath, in template FromPath p_fromPath ) modifies mw_Headers_any := { toPaths := { p_toPath }, fromPaths := { p_fromPath } } // End of template mw_Headers_toPath_FromPath } // End of group msrpHeaders group msrpContent { /** * @desc Dummy send template for ContentStuff * @ see RFC 4975 - Figure 2: Example MSRP Exchange * <pre> * Content-Type: text/plain * * * Hey Bob, are you there? * </pre> */ template (value) ContentStuff m_msrpContentStuff_Dummy := { mimeHeaders := omit, contentType := { contentTypeID := e_CONTENT_TYPE, mediaType := { mediaType := str2oct("text"), subType := str2oct("plain"), genParams := omit } // End of 'mediaType' field }, // End of 'contentType' field data := str2oct("Hey Bob, are you there?") } // End of template m_msrpByteRange_Dummy template MediaType mw_mediaType_any := { mediaType := ?, subType := ?, Loading @@ -99,6 +247,11 @@ module LibMsrp_Templates { } // End of group msrpContent /** * Provides types for MSRP request * @see RFC 4975 - Clause 7.1. Constructing Requests * @see RFC 4976 - Relay Extensions for the Message Session Relay Protocol (MSRP) */ group msrpRequest { group msrpAUTH { Loading @@ -107,6 +260,38 @@ module LibMsrp_Templates { group msrpSEND { /** * @desc Dummy send template for SEND request * @ see RFC 4975 - Figure 2: Example MSRP Exchange */ template (value) SEND_request m_msrpSend_Dummy := { startLine := { tagMsrp := e_MSRP, transactionID := "a786hjs2", method := e_SEND }, // End of 'startLine' field headers := { toPaths := { m_msrpToPath_Dummy }, fromPaths := { m_msrpToPath_Dummy }, headers := { { messageID := m_msrpMessageID_Dummy }, { byteRange := m_msrpByteRange_Dummy } } }, // End of 'headers' field contentStuff := m_msrpContentStuff_Dummy, endLine := { transactionID := "a786hjs2", continuationFlag := false } } // End of template m_msrpSend_Dummy /** * @desc Generic receive template for SEND request */ template SEND_request mw_msrpSEND_any := { startLine := mw_RequestLine_SEND_any, headers := mw_Headers_any, Loading @@ -114,6 +299,16 @@ module LibMsrp_Templates { endLine := mw_EndLine_noMore } // End of template mw_msrpSEND_any template SEND_request mw_msrpSEND_toPath_FromPath( in template ToPath p_toPath, in template FromPath p_fromPath ) modifies mw_msrpSEND_any := { headers := mw_Headers_toPath_FromPath( p_toPath, p_fromPath) } // End of template mw_msrpSEND_toPath_FromPath } // End of group msrpSEND } // End of group msrpRequest Loading
LibMsrp/LibMsrp_TypesAndValues.ttcn3 +10 −4 Original line number Diff line number Diff line Loading @@ -34,6 +34,9 @@ module LibMsrp_TypesAndValues { } // End of group tokens /** * @desc Start and End line descriptions */ group delimiterLines { /** Loading Loading @@ -248,7 +251,7 @@ module LibMsrp_TypesAndValues { Authority authority, SessionID sessionID optional, charstring transport, // transport = "tcp" / 1*ALPHANUM URIParams uriParams // List of URI-parameter URIParams uriParams optional // List of URI-parameter } // End of type Values type set of MsrpURI MsrpURIs;// length (1..infinity); Loading @@ -270,7 +273,10 @@ module LibMsrp_TypesAndValues { * @member msrpURIs The URIs of the sender * @see RFC 4975 - Clause 9. Formal Syntax */ type ToPath FromPath; type record FromPath { MsrpKeywords pathID (e_FROM_PATH), MsrpURIs msrpURIs } // End of type Path type set of ToPath ToPaths;// length (1..infinity); Loading Loading @@ -397,14 +403,14 @@ module LibMsrp_TypesAndValues { group msrpRequests { /** * @desc * @desc TODO * @see RFC 4976 - Clause 5.1. Connecting to Relays Acting on Your Behalf */ type record AUTH_request { } // End of type AUTH_request /** * @desc * @desc TODO * @see RFC 4975 - Clause 7.1.1. Sending SEND Requests */ type record SEND_request { Loading