Class SdpTokenAttribute
Attribute for string properties representing an SDP token, which has constraints on the allowed characters it can contain, as defined in the SDP RFC.
See https://tools.ietf.org/html/rfc4566#page-43 for details.
Namespace: Microsoft.MixedReality.WebRTC.Unity
Assembly: cs.temp.dll.dll
Syntax
public class SdpTokenAttribute : PropertyAttribute
Constructors
SdpTokenAttribute(Boolean)
Declaration
public SdpTokenAttribute(bool allowEmpty = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | allowEmpty | Value of AllowEmpty. |
Fields
InvalidCharacters
Regular expression that matches all characters which can't be used in an SDP token.
Declaration
public const string InvalidCharacters = "[^A-Za-z0-9!#$%&'*+-.^_`{|}~]"
Field Value
Type | Description |
---|---|
String |
Properties
AllowEmpty
Allow empty tokens, that is a string property which is null
or an empty string.
This is not valid in the RFC, but can be allowed as a property value to represent a default
value generated at runtime by the implementation instead of being provided by the user.
This is typically used as an argument to Validate(String, Boolean).
Declaration
public bool AllowEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Methods
Validate(String, Boolean)
Validate an SDP token name against the list of allowed characters:
- Symbols
[!#$%'*+-.^_`{|}~&]
- Alphanumerical characters
[A-Za-z0-9]
If the validation fails, the method throws an exception.
Declaration
public static void Validate(string name, bool allowEmpty = true)
Parameters
Type | Name | Description |
---|---|---|
String | name | The token name to validate. |
Boolean | allowEmpty |
|
Remarks
See https://tools.ietf.org/html/rfc4566#page-43 for 'token' reference.