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); }
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)); }
private static StringSegment ReadProtocol(StringSegment chars) { var spaceIndex = SipCharacters.IndexOfWhitespace(chars); if (spaceIndex == -1) { return(chars); } return(chars.Subsegment(0, spaceIndex)); }
private static bool IsProtocolValid(StringSegment protocol) { if (protocol == StringSegment.Empty) { return(false); } if (!SipCharacters.IsValidToken(protocol)) { return(false); } return(true); }
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); }
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); }
private static bool IsMethodValid(ReadOnlyMemory <char> chars) { return(!chars.IsEmpty && SipCharacters.IsValidToken(chars.Span)); }
private static bool IsSequenceNumberValid(StringSegment chars) { return(chars.Length > 0 && SipCharacters.IsDigits(chars)); }
private static bool IsHeaderNameValid(ReadOnlyMemory <char> chars) { return(!chars.IsEmpty && SipCharacters.IsValidField(chars.Span)); }
private static bool IsUriValid(ReadOnlyMemory <byte> bytes) { return(!bytes.IsEmpty && SipCharacters.IsValidUri(bytes.Span)); }
private static bool IsReasonPhraseValid(ReadOnlyMemory <byte> bytes) { return(!SipCharacters.HasCROrLF(bytes.Span)); }
private static bool IsStatusCodeValid(ReadOnlyMemory <byte> bytes) { return(bytes.Length == StatusCodeLenght && SipCharacters.IsDigits(bytes.Span)); }
private static bool IsMethodValid(ReadOnlyMemory <byte> bytes) { return(!bytes.IsEmpty && SipCharacters.IsValidToken(bytes.Span)); }
private static bool IsHostValid(StringSegment host) { return(host != StringSegment.Empty && SipCharacters.IsValidHost(host)); }
private static bool IsMethodValid(StringSegment chars) { return(chars.Length > 0 && SipCharacters.IsValidToken(chars)); }
private static bool IsUriValid(ReadOnlyMemory <char> chars) { return(!chars.IsEmpty && SipCharacters.IsValidUri(chars.Span)); }