C# Class P2PStateServer.ServiceRequest

Represents a ServiceRequest message
The ServiceRequest class represents a request message from a peer to another or from a client to a state server. Request messages should be derived from the ServiceRequest class.
Inheritance: ServiceMessage
显示文件 Open project: tenor/p2pStateServer

Protected Properties

Property Type Description
extraFlags string
queryTimeout DateTime?

Public Methods

Method Description
Reply ( ResponseData Response ) : void

Sends a reply to the source of this request

ServiceRequest ( HTTPPartialData Data, StateServer Service ) : System

Initializes a new instance of the ServiceRequest class

Protected Methods

Method Description
BuildResponse ( Type ResponseType, string ResponseMessage, ISessionResponseInfo ResponseInfo, byte Content ) : ResponseData

When overriden in a derived class, Generates an appropriate ResponseData object for this message, filled with supplied data

MergeResponseData ( StringBuilder Headers, byte Content, bool AppendContent, bool EncryptContent, SHA256_AESAuthenticator Authenticator, byte SessionKey ) : byte[]

Generates a raw response message data

QueryNetwork ( ) : bool

Initiates a network query for a session

QueryNetwork ( System TimeoutHandler ) : bool

Initiates a network query for a session

Validate ( ) : bool

Validates a ServiceRequest message

Method Details

BuildResponse() protected abstract method

When overriden in a derived class, Generates an appropriate ResponseData object for this message, filled with supplied data
protected abstract BuildResponse ( Type ResponseType, string ResponseMessage, ISessionResponseInfo ResponseInfo, byte Content ) : ResponseData
ResponseType System.Type The Type of the Response message
ResponseMessage string The HTTP response reason phrase
ResponseInfo ISessionResponseInfo The session response information
Content byte The response data
return ResponseData

MergeResponseData() protected static method

Generates a raw response message data
protected static MergeResponseData ( StringBuilder Headers, byte Content, bool AppendContent, bool EncryptContent, SHA256_AESAuthenticator Authenticator, byte SessionKey ) : byte[]
Headers StringBuilder The HTTP Headers (includes first line)
Content byte The Content (message body)
AppendContent bool Specifies whether the content is to be included in the generated message
EncryptContent bool Specifies whether the content is to be encrypted
Authenticator SHA256_AESAuthenticator The Authenticator object
SessionKey byte The session encryption key
return byte[]

QueryNetwork() protected method

Initiates a network query for a session
protected QueryNetwork ( ) : bool
return bool

QueryNetwork() protected method

Initiates a network query for a session
protected QueryNetwork ( System TimeoutHandler ) : bool
TimeoutHandler System The Action that is called when the query times out
return bool

Reply() public method

Sends a reply to the source of this request
public Reply ( ResponseData Response ) : void
Response ResponseData The response data
return void

ServiceRequest() public method

Initializes a new instance of the ServiceRequest class
public ServiceRequest ( HTTPPartialData Data, StateServer Service ) : System
Data HTTPPartialData The HTTPPartialData class to load this instance from
Service StateServer State server instance
return System

Validate() protected method

Validates a ServiceRequest message
protected Validate ( ) : bool
return bool

Property Details

extraFlags protected_oe property

The request ExtraFlags value
protected string extraFlags
return string

queryTimeout protected_oe property

The time out datestamp for a network query
protected DateTime? queryTimeout
return DateTime?