Commits

Paweł Wieczorek committed 6baf62d Draft

more tests

Comments (0)

Files changed (3)

src/Sip_parser.ml

 
         let uri            = SipUri _uri in
 
+(*
         let sip_contact    = SipContact (Hashtbl.find mime "contact") in
+*)
 
         let max_forwards   = int_of_string (Hashtbl.find mime "max-forwards") in
 
 
         method max_forwards     = max_forwards
 
+(*
         method contact          = sip_contact
+*)
 
         method header name      = Hashtbl.find mime name
 
 
         method max_forwards     : int
 
+(*
         method contact          : sip_contact
+*)
 
         method header           : string -> string
 
 let string_of_sip_uri = function
     | SipUri s -> s
 
+let sip_uri_of_string = function
+    | s -> SipUri s
+
 let string_of_sip_cseq = function
     | SipCseq s -> s
 
+let sip_cseq_of_string = function
+    | s -> SipCseq s

tests/data/Testdata_messages.ml

                 142
             ]
 
+        ; prepare_valid_message "sip message OPTION from RFC3261.11.1"
+            [ "OPTIONS sip:carol@chicago.com SIP/2.0"
+            ; "Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKhjhs8ass877"
+            ; "Max-Forwards: 70"
+            ; "To: <sip:carol@chicago.com>"
+            ; "From: Alice <sip:alice@atlanta.com>;tag=1928301774"
+            ; "Call-ID: a84b4c76e66710"
+            ; "CSeq: 63104 OPTIONS"
+            ; "Contact: <sip:alice@pc33.atlanta.com>"
+            ; "Accept: application/sdp"
+            ; "Content-Length: 0"
+            ; ""
+            ; ""
+            ]
+
+            [ descr_sip_method
+                OPTIONS
+
+            ; descr_uri
+                (SipUri "sip:carol@chicago.com")
+
+            ; descr_sip_version
+                SIP_2_0
+
+            ; descr_max_forwards
+                70
+            ]
+
         ; prepare_valid_message "register from RFC3261.24.1"
             [ "REGISTER sip:registrar.biloxi.com SIP/2.0"
             ; "Via: SIP/2.0/UDP bobspc.biloxi.com:5060;branch=z9hG4bKnashds7"
             ; descr_sip_version
                 SIP_2_0
             ]
+
     ]
 
 end
     open Util
 
     let messages =
-        [ prepare_invalid_message "basic invite RFC3261.4, without the Contact header"
-            [ "INVITE sip:bob@biloxi.com SIP/2.0" 
-            ; "Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds" 
-            ; "Max-Forwards: 70" 
-            ; "To: Bob <sip:bob@biloxi.com>" 
-            ; "From: Alice <sip:alice@atlanta.com>;tag=1928301774" 
-            ; "Call-ID: a84b4c76e66710@pc33.atlanta.com" 
-            ; "CSeq: 314159 INVITE"
-            ; "Content-Type: application/sdp"
-            ; "Content-Length: 142"
-            ; ""
-            ; String.repeat "a" 142
-            ]
-
-        ; prepare_invalid_message "basic invite RFC3261.4, without the Call-ID header"
+        [ prepare_invalid_message "basic invite RFC3261.4, without the Call-ID header"
             [ "INVITE sip:bob@biloxi.com SIP/2.0" 
             ; "Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds" 
             ; "Max-Forwards: 70"