public void RTSPRequestWIthStandardHeadersParseTest()
        {
            logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);

            int    cseq    = 23;
            string session = Guid.NewGuid().ToString();
            string body    = "v=0" + m_CRLF +
                             "o=- 2890844526 2890842807 IN IP4 192.16.24.202" + m_CRLF +
                             "s=RTSP Session" + m_CRLF +
                             "m=audio 3456 RTP/AVP 0" + m_CRLF +
                             "a=control:rtsp://live.example.com/concert/audio" + m_CRLF +
                             "c=IN IP4 224.2.0.1/16";

            RTSPResponse describeResponse = new RTSPResponse(RTSPResponseStatusCodesEnum.OK, null);

            describeResponse.Header = new RTSPHeader(cseq, session);
            describeResponse.Body   = body;

            byte[]      buffer      = Encoding.UTF8.GetBytes(describeResponse.ToString());
            RTSPMessage rtspMessage = RTSPMessage.ParseRTSPMessage(buffer, null, null);

            Assert.Equal(RTSPMessageTypesEnum.Response, rtspMessage.RTSPMessageType);
            Assert.Equal(body, rtspMessage.Body);
        }
Exemple #2
0
        public void RTSPRequestWIthStandardHeadersParseTest()
        {
            int    cseq    = 23;
            string session = Guid.NewGuid().ToString();

            RTSPRequest setupRequest = new RTSPRequest(RTSPMethodsEnum.SETUP, RTSPURL.ParseRTSPURL("rtsp://localhost/sample"));

            setupRequest.Header = new RTSPHeader(cseq, session);

            byte[]      rtspRequestBuffer = Encoding.UTF8.GetBytes(setupRequest.ToString());
            RTSPRequest req = RTSPRequest.ParseRTSPRequest(RTSPMessage.ParseRTSPMessage(rtspRequestBuffer, null, null));

            Assert.Equal(RTSPMethodsEnum.SETUP, req.Method);
            Assert.Equal(cseq, req.Header.CSeq);
            Assert.Equal(session, req.Header.Session);
        }
Exemple #3
0
        public void RTSPRequestWIthStandardHeadersParseTest()
        {
            logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);

            int    cseq    = 23;
            string session = Guid.NewGuid().ToString();

            RTSPRequest setupRequest = new RTSPRequest(RTSPMethodsEnum.SETUP, RTSPURL.ParseRTSPURL("rtsp://localhost/sample"));

            setupRequest.Header = new RTSPHeader(cseq, session);

            byte[]      rtspRequestBuffer = Encoding.UTF8.GetBytes(setupRequest.ToString());
            RTSPRequest req = RTSPRequest.ParseRTSPRequest(RTSPMessage.ParseRTSPMessage(rtspRequestBuffer, null, null));

            Assert.Equal(RTSPMethodsEnum.SETUP, req.Method);
            Assert.Equal(cseq, req.Header.CSeq);
            Assert.Equal(session, req.Header.Session);
        }
Exemple #4
0
        public void RTSPMessageWithNoContentLengthHeaderAvailable()
        {
            RTSPRequest setupRequest = new RTSPRequest(RTSPMethodsEnum.SETUP, RTSPURL.ParseRTSPURL("rtsp://localhost/sample"));

            byte[] rtspRequestBuffer = Encoding.UTF8.GetBytes(setupRequest.ToString());

            byte[] rtspMessageBuffer = null;

            RTSPConnection rtspConnection = new RTSPConnection(null, null, null);

            rtspConnection.RTSPMessageReceived += (conn, remoteEndPoint, buffer) => { rtspMessageBuffer = buffer; };
            rtspConnection.SocketBuffer         = rtspRequestBuffer;

            rtspConnection.SocketReadCompleted(rtspRequestBuffer.Length);

            Assert.IsNotNull(rtspMessageBuffer);

            RTSPRequest req = RTSPRequest.ParseRTSPRequest(RTSPMessage.ParseRTSPMessage(rtspMessageBuffer, null, null));

            Assert.AreEqual(RTSPMethodsEnum.SETUP, req.Method);
        }
        public void RTSPRequestWIthStandardHeadersParseTest()
        {
            int    cseq    = 23;
            string session = Guid.NewGuid().ToString();
            string body    = @"v=0
o=- 2890844526 2890842807 IN IP4 192.16.24.202
s=RTSP Session
m=audio 3456 RTP/AVP 0
a=control:rtsp://live.example.com/concert/audio
c=IN IP4 224.2.0.1/16";

            RTSPResponse describeResponse = new RTSPResponse(RTSPResponseStatusCodesEnum.OK, null);

            describeResponse.Header = new RTSPHeader(cseq, session);
            describeResponse.Body   = body;

            byte[]      buffer      = Encoding.UTF8.GetBytes(describeResponse.ToString());
            RTSPMessage rtspMessage = RTSPMessage.ParseRTSPMessage(buffer, null, null);

            Assert.Equal(RTSPMessageTypesEnum.Response, rtspMessage.RTSPMessageType);
            Assert.Equal(body, rtspMessage.Body);
        }
Exemple #6
0
        public void RTSPMessageWithNoContentLengthHeaderAvailable()
        {
            logger.LogDebug("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);

            RTSPRequest setupRequest = new RTSPRequest(RTSPMethodsEnum.SETUP, RTSPURL.ParseRTSPURL("rtsp://localhost/sample"));

            byte[] rtspRequestBuffer = Encoding.UTF8.GetBytes(setupRequest.ToString());

            byte[] rtspMessageBuffer = null;

            RTSPConnection rtspConnection = new RTSPConnection(null, null, null);

            rtspConnection.RTSPMessageReceived += (conn, remoteEndPoint, buffer) => { rtspMessageBuffer = buffer; };
            rtspConnection.SocketBuffer         = rtspRequestBuffer;

            rtspConnection.SocketReadCompleted(rtspRequestBuffer.Length);

            Assert.NotNull(rtspMessageBuffer);

            RTSPRequest req = RTSPRequest.ParseRTSPRequest(RTSPMessage.ParseRTSPMessage(rtspMessageBuffer, null, null));

            Assert.Equal(RTSPMethodsEnum.SETUP, req.Method);
        }