C# Class FiftyOne.Foundation.Mobile.Redirection.RequestRecord

Class used to convert a HttpRequest into a single long value that is almost unique for the requesting device. Two devices that share the same external IP address and HTTP headers will calculate to the same long value so it may not always be unique. The number of handsets that fall into this category should be sufficiently small enough for it not to present a practical problem. The date and time the request was received is also recorded to enable out of date records to be removed from the list.
Inheritance: IComparable
Datei anzeigen Open project: 51Degrees/dotNET-Device-Detection Class Usage Examples

Public Methods

Method Description
CompareTo ( object obj ) : int

Compares one request to another to determine if they are the same.

Protected Methods

Method Description
Read ( BinaryReader reader ) : void
RequestRecord ( ) : System

Creates a new empty instance of RequestRecord class.

RequestRecord ( BinaryReader reader ) : System
RequestRecord ( HttpRequest request ) : System

If the IP address is IPv4 (4 bytes) then use the ip address as the high order bytes of the value and the hashcode as the low order bytes. If the IP address is IPv6 (8 bytes) then covert the bytes to a 64 bit integer. If anything else which we can't imagine use a hashcode of the string value.

RequestRecord ( RequestRecord recordToCopy ) : System

Constructs a new instance of RequestRecord class. Copies the values of the RequestRecord provided to the new instance.

Write ( Stream stream ) : void

Private Methods

Method Description
SetHashCode ( byte buffer, HttpRequest request ) : void

Adds the hashcode of the relevent header fields as the low order bytes of the array.

Method Details

CompareTo() public method

Compares one request to another to determine if they are the same.
public CompareTo ( object obj ) : int
obj object The object being compared.
return int

Read() protected method

protected Read ( BinaryReader reader ) : void
reader System.IO.BinaryReader
return void

RequestRecord() protected method

Creates a new empty instance of RequestRecord class.
protected RequestRecord ( ) : System
return System

RequestRecord() protected method

protected RequestRecord ( BinaryReader reader ) : System
reader System.IO.BinaryReader
return System

RequestRecord() protected method

If the IP address is IPv4 (4 bytes) then use the ip address as the high order bytes of the value and the hashcode as the low order bytes. If the IP address is IPv6 (8 bytes) then covert the bytes to a 64 bit integer. If anything else which we can't imagine use a hashcode of the string value.
protected RequestRecord ( HttpRequest request ) : System
request HttpRequest
return System

RequestRecord() protected method

Constructs a new instance of RequestRecord class. Copies the values of the RequestRecord provided to the new instance.
protected RequestRecord ( RequestRecord recordToCopy ) : System
recordToCopy RequestRecord
return System

Write() protected method

protected Write ( Stream stream ) : void
stream Stream
return void