Esempio n. 1
0
        private bool TryReadQuotedValue(out int startIndex, out int length)
        {
            startIndex = -1;
            length     = 0;

            if (remainingChars == StringSegment.Empty)
            {
                return(false);
            }

            startIndex = SipCharacters.IndexOfNonWhitespace(remainingChars);

            if (startIndex < 0)
            {
                return(false);
            }

            if (remainingChars[startIndex] != QuoteChar)
            {
                return(false);
            }

            var endQuoteCharIndex = SipCharacters.IndexOfNonEscaped(remainingChars, QuoteChar, startIndex + 1);

            if (endQuoteCharIndex < 0)
            {
                return(false);
            }

            length = endQuoteCharIndex - startIndex;
            return(true);
        }
        private static bool TryReadQuotedDisplayName(StringSegment chars, out int startIndex, out int length)
        {
            startIndex = -1;
            length     = 0;

            if (chars == StringSegment.Empty)
            {
                return(false);
            }

            startIndex = SipCharacters.IndexOfNonWhitespace(chars);

            if (startIndex < 0)
            {
                return(false);
            }

            if (chars[startIndex] != QuoteChar)
            {
                return(false);
            }

            var endQuoteCharIndex = SipCharacters.IndexOfNonEscaped(chars, QuoteChar, startIndex + 1);

            if (endQuoteCharIndex < 0)
            {
                return(false);
            }

            length = endQuoteCharIndex - startIndex;
            return(true);
        }
Esempio n. 3
0
        private static StringSegment ReadSequenceNumber(StringSegment chars)
        {
            var separatorIndex = SipCharacters.IndexOfWhitespace(chars);

            if (separatorIndex < 0)
            {
                return(chars);
            }

            return(chars.Subsegment(0, separatorIndex));
        }
        private static bool IsUriValid(StringSegment chars)
        {
            var uri = chars;

            if (IsInUriBrackets(chars))
            {
                uri = chars.Subsegment(1, chars.Length - 2);
            }

            return(uri != StringSegment.Empty && SipCharacters.IsValidUri(uri));
        }
Esempio n. 5
0
        private static StringSegment ReadProtocol(StringSegment chars)
        {
            var spaceIndex = SipCharacters.IndexOfWhitespace(chars);

            if (spaceIndex == -1)
            {
                return(chars);
            }

            return(chars.Subsegment(0, spaceIndex));
        }
Esempio n. 6
0
        private static bool IsProtocolValid(StringSegment protocol)
        {
            if (protocol == StringSegment.Empty)
            {
                return(false);
            }

            if (!SipCharacters.IsValidToken(protocol))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
        private bool IsValidName()
        {
            if (currentName == StringSegment.Empty)
            {
                return(false);
            }

            if (!SipCharacters.IsValidToken(currentName))
            {
                return(false);
            }

            return(true);
        }
        private static bool IsDisplayNameValid(StringSegment chars)
        {
            if (chars == StringSegment.Empty)
            {
                return(true);
            }

            if (SipCharacters.IsValidQuoted(chars))
            {
                return(true);
            }

            if (SipCharacters.IsValidTokenExcludeWhitespase(chars))
            {
                return(true);
            }

            return(false);
        }
Esempio n. 9
0
        private bool IsValidValue()
        {
            if (isSingleName)
            {
                return(true);
            }

            if (currentValue == StringSegment.Empty)
            {
                return(false);
            }

            if (SipCharacters.IsValidQuoted(currentValue))
            {
                return(true);
            }

            if (!SipCharacters.IsValidToken(currentValue))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 10
0
 private static bool IsMethodValid(ReadOnlyMemory <char> chars)
 {
     return(!chars.IsEmpty && SipCharacters.IsValidToken(chars.Span));
 }
Esempio n. 11
0
 private static bool IsSequenceNumberValid(StringSegment chars)
 {
     return(chars.Length > 0 && SipCharacters.IsDigits(chars));
 }
Esempio n. 12
0
 private static bool IsHeaderNameValid(ReadOnlyMemory <char> chars)
 {
     return(!chars.IsEmpty && SipCharacters.IsValidField(chars.Span));
 }
Esempio n. 13
0
 private static bool IsUriValid(ReadOnlyMemory <byte> bytes)
 {
     return(!bytes.IsEmpty && SipCharacters.IsValidUri(bytes.Span));
 }
Esempio n. 14
0
 private static bool IsReasonPhraseValid(ReadOnlyMemory <byte> bytes)
 {
     return(!SipCharacters.HasCROrLF(bytes.Span));
 }
Esempio n. 15
0
 private static bool IsStatusCodeValid(ReadOnlyMemory <byte> bytes)
 {
     return(bytes.Length == StatusCodeLenght && SipCharacters.IsDigits(bytes.Span));
 }
Esempio n. 16
0
 private static bool IsMethodValid(ReadOnlyMemory <byte> bytes)
 {
     return(!bytes.IsEmpty && SipCharacters.IsValidToken(bytes.Span));
 }
Esempio n. 17
0
 private static bool IsHostValid(StringSegment host)
 {
     return(host != StringSegment.Empty && SipCharacters.IsValidHost(host));
 }
Esempio n. 18
0
 private static bool IsMethodValid(StringSegment chars)
 {
     return(chars.Length > 0 && SipCharacters.IsValidToken(chars));
 }
Esempio n. 19
0
 private static bool IsUriValid(ReadOnlyMemory <char> chars)
 {
     return(!chars.IsEmpty && SipCharacters.IsValidUri(chars.Span));
 }