本文整理汇总了C#中RecordType类的典型用法代码示例。如果您正苦于以下问题:C# RecordType类的具体用法?C# RecordType怎么用?C# RecordType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RecordType类属于命名空间,在下文中一共展示了RecordType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public override void Write(RecordType type, TlsVersion version, byte[] data)
{
var cipher = GetCipher().Cipher;
// TODO parametrised from CipherSpec
var explicitNonceLength = 8;
var nonce = RandomGenerator.RandomBytes(explicitNonceLength);
var aad = new byte[13];
Array.Copy(EndianBitConverter.Big.GetBytes(State.WriteSeqNum++), 0, aad, 0, 8);
Array.Copy(new[] { (byte)type, version.Major, version.Major }, 0, aad, 8, 3);
Array.Copy(EndianBitConverter.Big.GetBytes((ushort)data.Length), 0, aad, 11, 2);
var payload = new byte[explicitNonceLength + data.Length + cipher.TagLength];
Array.Copy(nonce, payload, explicitNonceLength);
cipher.Init(State.GetAEADParameters(false, aad, nonce));
var payloadLength = explicitNonceLength;
payloadLength += cipher.Encrypt(data, 0, payload, payloadLength, data.Length);
payloadLength += cipher.EncryptFinal(payload, payloadLength);
Writer.Write(type);
Writer.Write(version);
Writer.Write((ushort)payloadLength);
Writer.Write(payload, 0, payloadLength);
}
示例2: AssertMxRecordAncestorIsObsolete
public void AssertMxRecordAncestorIsObsolete(RecordType recordType)
{
var expectedMessage = "Obsolete - use an MX record.";
var attribute = recordType.Attribute<ObsoleteAttribute>();
Assert.That(attribute.Message, Is.EqualTo(expectedMessage));
}
示例3: Read
public override Record Read(RecordType type, TlsVersion version, ushort length)
{
var cipher = GetCipher().Cipher;
// TODO parametrised from CipherSpec
var explicitNonceLength = 8;
var nonce = Reader.ReadBytes(explicitNonceLength);
var payload = Reader.ReadBytes(length - explicitNonceLength);
var aad = new byte[13];
Array.Copy(EndianBitConverter.Big.GetBytes(State.ReadSeqNum++), 0, aad, 0, 8);
Array.Copy(new[] { (byte)type, version.Major, version.Major }, 0, aad, 8, 3);
Array.Copy(EndianBitConverter.Big.GetBytes((ushort)(length - explicitNonceLength - cipher.TagLength)), 0, aad, 11, 2);
cipher.Init(State.GetAEADParameters(true, aad, nonce));
var plaintext = new byte[payload.Length - cipher.TagLength];
var plaintextLength = cipher.Decrypt(payload, 0, plaintext, 0, payload.Length - cipher.TagLength);
plaintextLength += cipher.DecryptFinal(payload, plaintextLength, plaintext, plaintextLength);
Array.Resize(ref plaintext, plaintextLength);
return new Record(type, version, plaintext);
}
示例4: WellKnownServiceData
public WellKnownServiceData(RecordType recordType)
{
_address = new AddressData(recordType);
_protocol = 0;
_bitMap = new byte[0];
_recordType = recordType;
}
示例5: Add
public void Add(string controllerId, int count, string reason, RecordType type=RecordType.Permanent)
{
if (!Records.ContainsKey(controllerId))
Records[controllerId] = new List<ScoreRecord>();
Records[controllerId].Add(new ScoreRecord(count, reason, world.Clocks.CurrentTime, type));
if (ScoresChanged != null) ScoresChanged();
}
示例6: AudioParameters
public AudioParameters(RecordType recordType, int durationLimit, int sizeLimit, params string[] supportedExtensions)
{
DurationLimit = durationLimit;
SizeLimit = sizeLimit;
SupportedExtensions = supportedExtensions;
AudioRecordType = recordType;
}
示例7: Lookup
/// <summary>
/// Retrieves whois information
/// </summary>
/// <param name="domainName">The registrar or domain or name server whose whois information to be retrieved</param>
/// <param name="recordType">The type of record i.e a domain, nameserver or a registrar</param>
/// <returns></returns>
public static string Lookup(string domainName, RecordType recordType)
{
string whoisServerName = WhoisServerResolver.GetWhoisServerName(domainName);
using (TcpClient whoisClient = new TcpClient())
{
whoisClient.Connect(whoisServerName, Whois_Server_Default_PortNumber);
string domainQuery = recordType.ToString() + " " + domainName + "\r\n";
byte[] domainQueryBytes = Encoding.ASCII.GetBytes(domainQuery.ToCharArray());
Stream whoisStream = whoisClient.GetStream();
whoisStream.Write(domainQueryBytes, 0, domainQueryBytes.Length);
StreamReader whoisStreamReader = new StreamReader(whoisClient.GetStream(), Encoding.ASCII);
string streamOutputContent = "";
List<string> whoisData = new List<string>();
while (null != (streamOutputContent = whoisStreamReader.ReadLine()))
{
whoisData.Add(streamOutputContent);
}
whoisClient.Close();
return String.Join(Environment.NewLine, whoisData);
}
}
示例8: WriteQuestion
public void WriteQuestion(Name name, RecordType qtype, RecordClass qclass = RecordClass.Internet)
{
WriteName(name);
WriteUInt16((ushort)qtype);
WriteUInt16((ushort)qclass);
_questionCount++;
}
示例9: DnsResponse
private DnsResponse(ushort messageId, DnsName queryName, RecordType queryType, RecordClass queryClass)
{
this.MessageId = messageId;
this.QueryName = queryName;
this.QueryType = queryType;
this.QueryClass = queryClass;
}
示例10: Record
private Record(List<DateTime> records, int minutes, DateTime day, RecordType type)
{
mRecordsOfDay = records;
mMinutes = minutes;
mDay = day;
mType = type;
}
示例11: ResourceRecord
internal ResourceRecord(string name, RecordType type, RecordClass rClass, DateTime expiry)
{
_name = name;
_type = type;
_class = rClass;
_expiry = expiry;
}
示例12: Record
public Record (byte version, RecordType type, ushort requestID,
byte[] bodyData, int bodyIndex, int bodyLength)
{
if (bodyData == null)
throw new ArgumentNullException ("bodyData");
if (bodyIndex < 0 || bodyIndex > bodyData.Length)
throw new ArgumentOutOfRangeException (
"bodyIndex");
if (bodyLength < 0)
bodyLength = bodyData.Length - bodyIndex;
if (bodyLength > MaxBodySize)
throw new ArgumentException (
Strings.Record_DataTooBig,
"data");
this.Version = version;
this.Type = type;
this.RequestId = requestID;
this.Body = bodyData;
this.BodyOffset = bodyIndex;
this.BodyLength = (ushort)bodyLength;
this.PaddingLength = 0;
}
示例13: ResourceRecord
public ResourceRecord(DnsReader br)
{
_domain = br.ReadDomain();
_qtype = (RecordType)br.ReadInt16();
_qclass = (RecordClass)br.ReadInt16();
_ttl = br.ReadInt32();
int recordLength = br.ReadInt16();
if (recordLength != 0)
{
switch (_qtype)
{
case RecordType.A: _record = new ARecord(br); break;
case RecordType.CNAME: _record = new CNAMERecord(br); break;
case RecordType.MX: _record = new MXRecord(br); break;
case RecordType.NS: _record = new NSRecord(br); break;
case RecordType.SOA: _record = new SOARecord(br); break;
case RecordType.TXT: _record = new TXTRecord(br); break;
case RecordType.PTR: _record = new PTRERecord(br); break;
// NetBIOS related records
case RecordType.NB: _record = new NBRecord(br); break;
default:
br += recordLength;
break;
}
}
}
示例14: RecordDataFor
public static RecordData RecordDataFor(RecordType recordType)
{
switch (recordType)
{
case RecordType.A:
return new AddressData(recordType);
case RecordType.AAAA:
return new IPv6AddressData(recordType);
case RecordType.CNAME:
case RecordType.MB: // Experimental
case RecordType.MD: // Obsolete.. Should throw exception instead? Or use MX?
case RecordType.MF: // Obsolete.. Should throw exception instead? Or use MX?
case RecordType.MG: // Experimental
case RecordType.MR: // Experimental
case RecordType.NS:
case RecordType.PTR:
return new DomainNameData(recordType);
case RecordType.HINFO:
return new HostInformationData(recordType);
case RecordType.MINFO:
return new MailInformationData(recordType);
case RecordType.MX:
return new MailExchangeData(recordType);
case RecordType.SOA:
return new StartOfAuthorityData(recordType);
case RecordType.TXT:
return new TextData(recordType);
case RecordType.WKS:
return new WellKnownServiceData(recordType);
case RecordType.NULL: // Experimental
return new NullData(recordType);
}
return new NullData(recordType);
}
示例15: Record
public Record(Socket socket, Buffers receive_buffer)
: this()
{
if (socket == null)
throw new ArgumentNullException ("socket");
CompatArraySegment<byte> header_buffer = receive_buffer.EnforceHeaderLength (HeaderSize);
// Read the 8 byte record header.
ReceiveAll (socket, header_buffer, HeaderSize);
// Read the values from the data.
version = header_buffer [0];
type = (RecordType) header_buffer [1];
request_id = ReadUInt16 (header_buffer, 2);
BodyLength = ReadUInt16 (header_buffer, 4);
byte padding_length = header_buffer [6];
CompatArraySegment<byte> body_buffer = receive_buffer.EnforceBodyLength (BodyLength);
// Read the record data, and throw an exception if the
// complete data cannot be read.
if (BodyLength > 0)
ReceiveAll (socket, body_buffer, BodyLength);
CompatArraySegment<byte> padding_buffer = receive_buffer.EnforcePaddingLength (padding_length);
if(padding_length > 0)
ReceiveAll(socket, padding_buffer, padding_length);
buffers = receive_buffer;
Logger.Write (LogLevel.Debug, Strings.Record_Received, Type, RequestID, BodyLength);
}