LibMsrp_Templates.ttcn 21.6 KB
Newer Older
Bostjan Pintar's avatar
Bostjan Pintar committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
/*
 *  @author   STF 435
 *  @version  $Id$
 *	@desc     This module defines MSRP Templates for message, header, and 
 *            structured types. <br>
 *            Note that any changes made to the definitions in this module
 *            may be overwritten by future releases of this library
 *            End users are encouraged to contact the distributers of this  
 *            module regarding their modifications or additions
 *  @remark   Any additions to the templates shall follow the design rules
 *            and always modify base templates only;
 *            Existing templates shall not be changed or removed -
 *            change requests shall be made to http://t-ort.etsi.org
 */
module LibMsrp_Templates {
    
    // LibMsrp
    import from LibMsrp_TypesAndValues all;
    
    /**
     * @desc Declaration of constants used by templates
     */
    group constants {
        
        group codes {
            
            /**
             * @desc 200 status OK
             * @see RFC 4975 - Clause 10.1
             */
            const StatusCode c_OKCode := 200;
            
            /**
             * @desc 400 status Bad request
             * @see RFC 4975 - Clause 10.2
             */
            const StatusCode c_BadRequestCode := 400;
            
            /**
             * @desc 403 status Forbidden
             * @see RFC 4975 - Clause 10.3
             */
            const StatusCode c_ForbiddenCode := 403;
            
            /**
             * @desc 408 status Request Time-out
             * @see RFC 4975 - Clause 10.4
             */
            const StatusCode c_RequestTimeoutCode := 408;
            
            /**
             * @desc 413 status Request Entity Too Large
             * @see RFC 4975 - Clause 10.5
             */
            const StatusCode c_RequestEntityTooLargeCode := 413;
            
            /**
             * @desc 415 status Unsupported Media Type
             * @see RFC 4975 - Clause 10.6
             */
            const StatusCode c_UnsupportedMediaTypeCode := 415;
            
            /**
             * @desc 423 status Locked
             * @see RFC 4975 - Clause 10.7
             */
            const StatusCode c_LockedCode := 423;
            
            /**
             * @desc 481 status Call/Transaction Does Not Exist
             * @see RFC 4975 - Clause 10.8
             */
            const StatusCode c_CallTransactionDoesNotExistCode := 481;
            
            /**
             * @desc 501 status Not Implemented
             * @see RFC 4975 - Clause 10.9
             */
            const StatusCode c_NotImplementedCode := 501;
            
            /**
             * @desc 506 status Variant also negotiates
             * @see RFC 4975 - Clause 10.10
             */
            const StatusCode c_VariantNegotiatesCode := 506;
            
        } // End of group codes
        
        group comments {
            
            /**
             * @desc Comment for 200 status
             * @see RFC 4975 - Clause 10.1
             */
            const charstring c_OKComment := "OK";
            
            /**
             * @desc Comment for 400 Bad request
             * @see RFC 4975 - Clause 10.2
             */
            const charstring c_BadRequestComment := "Bad request";
            
            /**
             * @desc Comment for 403 Forbidden
             * @see RFC 4975 - Clause 10.3
             */
            const charstring c_ForbiddenComment := "Forbidden";
            
            /**
             * @desc Comment for 408 Request Time-out
             * @see RFC 4975 - Clause 10.4
             */
            const charstring c_RequestTimeoutComment := "Request Time-out";
            
            /**
             * @desc 413 status Request Entity Too Large
             * @see RFC 4975 - Clause 10.5
             */
            const charstring c_RequestEntityTooLargeComment := "Request Entity Too Large";
            
            /**
             * @desc 415 status Unsupported Media Type
             * @see RFC 4975 - Clause 10.6
             */
            const charstring c_UnsupportedMediaTypeComment := "Unsupported Media Type";
            
            /**
             * @desc 423 status Locked
             * @see RFC 4975 - Clause 10.7
             */
            const charstring c_LockedComment := "Locked";
            
            /**
             * @desc 481 status Call/Transaction Does Not Exist
             * @see RFC 4975 - Clause 10.8
             */
            const charstring c_CallTransactionDoesNotExistComment := "Call/Transaction Does Not Exist";
            
            /**
             * @desc 501 status Not Implemented
             * @see RFC 4975 - Clause 10.9
             */
            const charstring c_NotImplementedComment := "Not Implemented";
            
            /**
             * @desc 506 status Variant also negotiates
             * @see RFC 4975 - Clause 10.10
             */
            const charstring c_VariantNegotiatesComment := "Variant also negotiates";
            
        } // 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 MsrpRequestLine mw_RequestLine_SEND_any := {
            tagMsrp := e_MSRP, 
            transactionID := ?, 
            method := SEND_E
        } // End of template mw_RequestLine_SEND_any
        
        template MsrpRequestLine mw_RequestLine_REPORT_any := {
            tagMsrp := e_MSRP, 
            transactionID := ?, 
            method := REPORT_E
        } // End of template mw_RequestLine_SEND_any
        
        /**
         * @desc Generic receive template for RECEIVE start response line 
         */
        template MsrpResponseLine mw_ResponseLine_any := {
            tagMsrp := e_MSRP, 
            transactionID := ?, 
            statusCode := ?, 
            comment := * 
        } // End of template mw_ResponseLine_any
        
        template MsrpResponseLine mw_ResponseLine_success 
        modifies mw_ResponseLine_any := { 
            statusCode := c_OKCode, 
            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 := e_endMessage // No chunk
        } // End of template mw_EndLine_noMore
        
    } // End of group delimiterLines
    
    /**
     * @see RFC 4975 - Clause 5.2. MSRP Addressing 
     */
    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 := {
                userinfo := omit,
                host := "biloxi.example.com",
                portNumber := 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 := {
                userinfo := omit,
                host := "atlanta.example.com",
            	portNumber := 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 := { 
            headerName := TO_PATH_E, 
            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 := { 
            headerName := FROM_PATH_E, 
            msrpURIs := { 
                m_msrpURIs_FromPath_Dummy
            }
        } // End of template m_msrpFromPath_Dummy
        
        template ToPath mw_toPath(in template (present) MsrpURI p_path) := {
            headerName := TO_PATH_E,
            msrpURIs := {
                p_path
            }
        } // End of template mw_toPath
        
        template FromPath mw_fromPath(in template (present) MsrpURI p_path) := {
            headerName := FROM_PATH_E,
            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 := {
            headerName := MESSAGE_ID_E, 
            messageId := "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 := { 
            headerName := BYTE_RANGE_E, 
            startValue := 1, 
            endValue := { intValue := 25 }, 
            totalValue := { intValue := 25 } 
        } // End of template m_msrpByteRange_Dummy
        
        template Headers mw_Headers_any := {
            toPath := ?, 
            fromPath := ?, 
            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 := {
            toPath := p_toPath,
            fromPath := 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 := { 
                headerName := CONTENT_TYPE_E, 
                mediaType := { 
                    mediaType := "text", 
                    subType := "plain", 
                    genParams := omit 
                } // End of 'mediaType' field
            }, // End of 'contentType' field
            data := char2oct("Hey Bob, are you there?")
        } // End of template m_msrpByteRange_Dummy
        
        template MediaType mw_mediaType_any := {
            mediaType := ?,
            subType := ?,
            genParams := *
        } // End of template mw_mediaType_any
        
        template MsrpContentType mw_contentType_any := {
            headerName := CONTENT_TYPE_E,
            mediaType := mw_mediaType_any
        } // End of template mw_contentType_any
        
        template ContentStuff mw_contentStuff_any := {
            mimeHeaders := *,
            contentType := mw_contentType_any,
            data := ?
            
        } // End of template mw_contentStuff_any
        
        template MsrpContentType mw_contentType( 
            in charstring p_mediaType, 
            in charstring p_subType
        ) modifies mw_contentType_any := { 
            headerName := CONTENT_TYPE_E, 
            mediaType := { 
                mediaType := p_mediaType, 
                subType := p_subType, 
                genParams := * 
            } // End of 'mediaType' field
        } // End of template mw_contentType
        
    } // 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 {
            
        } // End of group msrpSEND
    
        group msrpSEND {
            
            /**
             * @desc Dummy send template for SEND request
             * @ see RFC 4975 - Figure 2: Example MSRP Exchange
             * <pre>
             *     MSRP a786hjs2 SEND
             *     To-Path: msrp://biloxi.example.com:12763/kjhd37s2s20w2a;tcp
             *     From-Path: msrp://atlanta.example.com:7654/jshA7weztas;tcp
             *     Message-ID: 87652491
             *     Byte-Range: 1-25/25
             *     Content-Type: text/plain
             *  
             *     Hey Bob, are you there?
             *     -------a786hjs2$
             *  
             *     MSRP a786hjs2 200 OK
             *     To-Path: msrp://atlanta.example.com:7654/jshA7weztas;tcp
             *     From-Path: msrp://biloxi.example.com:12763/kjhd37s2s20w2a;tcp
             *     -------a786hjs2$
             * </pre>
             */
            template (value) SEND_request m_msrpSend_Dummy := { 
                startLine := { 
                    tagMsrp := e_MSRP, 
                    transactionID := "a786hjs2", 
                    method := SEND_E 
                }, // End of 'startLine' field 
                headers := { 
                    toPath := m_msrpToPath_Dummy, 
                    fromPath := m_msrpFromPath_Dummy, 
                    headers := { 
Yann Garcia's avatar
Yann Garcia committed
						messageID := m_msrpMessageID_Dummy, 
						successReport := omit,
						failureReport := omit,
Bostjan Pintar's avatar
Bostjan Pintar committed
						byteRange := m_msrpByteRange_Dummy,
Yann Garcia's avatar
Yann Garcia committed
						status := omit,
Bostjan Pintar's avatar
Bostjan Pintar committed
						expires := omit,
                        minExpires := omit,
Yann Garcia's avatar
Yann Garcia committed
						maxExpires := omit,
Bostjan Pintar's avatar
Bostjan Pintar committed
						usePath := omit,
Yann Garcia's avatar
Yann Garcia committed
						wwwAuthenticate := omit,
						authorization := omit,
                        authenticationInfo := omit,
						extHeaders := omit
Bostjan Pintar's avatar
Bostjan Pintar committed
                    } 
                }, // End of 'headers' field 
                contentStuff := m_msrpContentStuff_Dummy, 
                endLine := { 
                    transactionID := "a786hjs2", 
                    continuationFlag := e_endMessage 
                } 
            } // End of template m_msrpSend_Dummy
            
            /**
             * @desc Dummy send template for SEND request
             * @ see RFC 4975 - Figure 2: Example MSRP Exchange
             * <pre>
             *      MSRP a786hjs2 REPORT
             *      To-Path: msrp://alicepc.example.com:7777/iau39soe2843z;tcp
             *      From-Path: msrp://bob.example.com:8888/9di4eae923wzd;tcp
             *      Message-ID: 87652491
             *      Byte-Range: 1-25/25
             *      Status: 000 200 OK
             *      ——-a786hjs2$
             * </pre>
             */
            template (value) SEND_request m_msrpReport_Dummy 
            modifies m_msrpSend_Dummy := { 
                headers := { 
                    toPath := m_msrpToPath_Dummy, 
                    fromPath := m_msrpFromPath_Dummy, 
                    headers := { 
                        messageID := m_msrpMessageID_Dummy, 
                        byteRange := m_msrpByteRange_Dummy 
                    } 
                } // End of 'headers' field 
            } // 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,
                contentStuff := mw_contentStuff_any,
                endLine := mw_EndLine_noMore
            } // End of template mw_msrpSEND_any
            
            template SEND_request mw_msrpSEND_toPath_fromPath_contentType( 
                in template (present) ToPath p_toPath,
                in template (present) FromPath p_fromPath,
                in template (present) MsrpContentType p_contentType
            ) modifies mw_msrpSEND_any := {
                headers := mw_Headers_toPath_FromPath(
                    p_toPath, 
                    p_fromPath),
                contentStuff := {
                    contentType := p_contentType
                }
            } // End of template mw_msrpSEND_toPath_fromPath_contentType
            
            template SEND_request mw_msrpREPORT_success modifies mw_msrpSEND_any := {
                startLine := mw_RequestLine_REPORT_any,
                headers := {
                    headers := {
                        messageID := *,
                        successReport := *, 
                        failureReport := *,
                        byteRange := *,
                        status := {
                        	headerName := STATUS_E, 
                            namespace := 0,
                            statusCode := c_OKCode, 
                            comment := c_OKComment
                        }, // End of 'status' field
                        expires := *,
                        minExpires := *,
                        maxExpires := *,
                        usePath := *,
                        wwwAuthenticate := *,
                        authorization := *,
                        authenticationInfo := *,
                        extHeaders := *
                    }
                } // End of 'headers' field
            } // End of template mw_msrpREPORT_success
            
        } // End of group msrpSEND
    
    } // End of group msrpRequest
    
    group msrpResponse {
        
        /**
         * @desc Dummy send template for RECEIVE response
         * @ see RFC 4975 - Figure 2: Example MSRP Exchange
         */
        template (value) RECEIVE_response m_msrpResponse_Dummy := {
                startLine := { 
                    tagMsrp := e_MSRP, 
                    transactionID := "a786hjs2", 
                    statusCode := c_OKCode, 
                    comment := c_OKComment
                }, // End of 'startLine' field 
                headers := { 
                    toPath := m_msrpToPath_Dummy, 
                    fromPath := m_msrpFromPath_Dummy,
                    headers := { 
Yann Garcia's avatar
Yann Garcia committed
						messageID := m_msrpMessageID_Dummy,
						successReport := omit,
						failureReport := omit,
Bostjan Pintar's avatar
Bostjan Pintar committed
						byteRange := omit,
Yann Garcia's avatar
Yann Garcia committed
						status := omit,
Bostjan Pintar's avatar
Bostjan Pintar committed
						expires := omit,
						minExpires := omit,
Yann Garcia's avatar
Yann Garcia committed
						maxExpires := omit,
Bostjan Pintar's avatar
Bostjan Pintar committed
						usePath := omit,
Yann Garcia's avatar
Yann Garcia committed
						wwwAuthenticate := omit,
						authorization := omit,
						authenticationInfo := omit,
						extHeaders := omit
Bostjan Pintar's avatar
Bostjan Pintar committed
                    } 
                }, // End of 'headers' field 
                endLine := { 
                    transactionID := "a786hjs2", 
                    continuationFlag := e_endMessage 
                } 
        } // End of template m_msrpResponse_Dummy
        
        template RECEIVE_response mw_msrpResponse_any := {
            startLine := mw_ResponseLine_any,
            headers := mw_Headers_any,
            endLine := mw_EndLine_noMore
        } // End of template mw_msrpResponse_any
        
        template RECEIVE_response mw_msrpResponse_success 
        modifies mw_msrpResponse_any := {
            startLine := mw_ResponseLine_success
        } // End of template mw_msrpResponse_success
        
        template RECEIVE_response mw_msrpResponse_toPath_fromPath( 
            in template (present) ToPath p_toPath, 
            in template (present) FromPath p_fromPath 
        ) modifies mw_msrpResponse_success := {
            headers := { 
                toPath := p_toPath, 
                fromPath := p_fromPath 
            } // End of 'headers' field
        } // End of template mw_msrpResponse_toPath_fromPath
        
        template RECEIVE_response mw_msrpResponse_toPath_fromPath_with_transferReports( // TODO Check if it it really used
            in template (present) ToPath p_toPath, 
            in template (present) FromPath p_fromPath 
        ) modifies mw_msrpResponse_toPath_fromPath := {
            headers := { 
                headers := {
					messageID := *,
                    successReport := {
                        headerName := SUCCESS_REPORT_E,
                        reportStatus := e_YES
                    },
                    failureReport := {
                        headerName := FAILURE_REPORT_E,
                        reportStatus := e_NO
                    },
Yann Garcia's avatar
Yann Garcia committed
					byteRange := *,
					status := *,
					expires := *,
					minExpires := *,
					maxExpires := *,
Bostjan Pintar's avatar
Bostjan Pintar committed
					usePath := *,
Yann Garcia's avatar
Yann Garcia committed
					wwwAuthenticate := *,
					authorization := *,
					authenticationInfo := *,
					extHeaders := *
Bostjan Pintar's avatar
Bostjan Pintar committed
                } // End of 'header' field
            } // End of 'headers' field
        } // // End of template mw_msrpResponse_toPath_fromPath_with_transferReports
        
    } // End of group msrpResponse
    
} // End of LibMsrp_Templates