C# Class Microsoft.Protocols.TestTools.StackSdk.BranchCache.Pchc.PCHCServer

The PCHC server class which is used to exchange the pchc message between the client.
Inheritance: IDisposable
ファイルを表示 Open project: Microsoft/WindowsProtocolTestSuites Class Usage Examples

Public Methods

Method Description
CreateResponseMessage ( RESPONSE_CODE responseCode ) : RESPONSE_MESSAGE

Create pchc response message.

Dispose ( ) : void

Implement IDisposable. Do not make this method virtual. A derived class should not be able to override this method.

ExpectInitialOfferMessage ( string ipaddress, System.TimeSpan timeout ) : INITIAL_OFFER_MESSAGE

Expect the INITIAL_OFFER_MESSAGE request from the client.

ExpectSegmentInfoMessage ( string ipaddress, System.TimeSpan timeout ) : SEGMENT_INFO_MESSAGE

Expect the SEGMENT_INFO_MESSAGE request from the client.

PCHCServer ( ) : System

Initializes a new instance of the PCHCServer class with the default transport type: Https; hosted cache server listen port: 443; IPAddress type: IPv4;

PCHCServer ( ILogPrinter logger ) : System

Initializes a new instance of the PCHCServer class with specified logger instance and the default transport type: Https; hosted cache server listen port: 443; IPAddress type: IPv4;

PCHCServer ( TransferProtocol transferProtocol, int hostedCacheModeListenPort, IPAddressType ipaddressType ) : System

Initializes a new instance of the PCHCServer class with the specified osted Cache Mode Listen Port and IPAddress type.

PCHCServer ( TransferProtocol transferProtocol, int hostedCacheModeListenPort, IPAddressType ipaddressType, ILogPrinter logger ) : System

Initializes a new instance of the PCHCServer class with the specified osted Cache Mode Listen Port and IPAddress type.

SendHttpStatusCode401 ( ) : void

Send http status code 401.

SendPackage ( RESPONSE_MESSAGE responseMessage ) : void

Send Reponse Message to the client.

Start ( ) : void

Start the http server process to listen and receive and http request.

Stop ( ) : void

Stop the http server process and Release this object resources.

Private Methods

Method Description
DecomposeHttpRequest ( HttpListenerRequest httpListenerRequest ) : void

Get the request body byte array from the specified http request.

Dispose ( bool disposing ) : void

Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. If disposing equals false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed

ReceiveHttpRequest ( object sender, HttpRequestEventArg e ) : void

THe handle for the received http request event.

SendByte ( byte reponseMessagePayload ) : void

Send the response payload.

Method Details

CreateResponseMessage() public method

Create pchc response message.
public CreateResponseMessage ( RESPONSE_CODE responseCode ) : RESPONSE_MESSAGE
responseCode RESPONSE_CODE /// The response code indicates the hosted cache server response to the client request message ///
return RESPONSE_MESSAGE

Dispose() public method

Implement IDisposable. Do not make this method virtual. A derived class should not be able to override this method.
public Dispose ( ) : void
return void

ExpectInitialOfferMessage() public method

Expect the INITIAL_OFFER_MESSAGE request from the client.
/// Throw when no INITIAL_OFFER_MESSAGE request from the client. ///
public ExpectInitialOfferMessage ( string ipaddress, System.TimeSpan timeout ) : INITIAL_OFFER_MESSAGE
ipaddress string The expected ipAddress of the remote endpoint which send request.
timeout System.TimeSpan The waiting timeout.
return INITIAL_OFFER_MESSAGE

ExpectSegmentInfoMessage() public method

Expect the SEGMENT_INFO_MESSAGE request from the client.
/// Throw when no SEGMENT_INFO_MESSAGE request from the client. ///
public ExpectSegmentInfoMessage ( string ipaddress, System.TimeSpan timeout ) : SEGMENT_INFO_MESSAGE
ipaddress string The expected ipAddress of the remote endpoint which send request.
timeout System.TimeSpan The waiting timeout.
return SEGMENT_INFO_MESSAGE

PCHCServer() public method

Initializes a new instance of the PCHCServer class with the default transport type: Https; hosted cache server listen port: 443; IPAddress type: IPv4;
public PCHCServer ( ) : System
return System

PCHCServer() public method

Initializes a new instance of the PCHCServer class with specified logger instance and the default transport type: Https; hosted cache server listen port: 443; IPAddress type: IPv4;
public PCHCServer ( ILogPrinter logger ) : System
logger ILogPrinter The logger.
return System

PCHCServer() public method

Initializes a new instance of the PCHCServer class with the specified osted Cache Mode Listen Port and IPAddress type.
public PCHCServer ( TransferProtocol transferProtocol, int hostedCacheModeListenPort, IPAddressType ipaddressType ) : System
transferProtocol TransferProtocol The transport type will be used
hostedCacheModeListenPort int /// The specified BranchCache service's listen port in hosted cache mode. ///
ipaddressType IPAddressType The IP address type.
return System

PCHCServer() public method

Initializes a new instance of the PCHCServer class with the specified osted Cache Mode Listen Port and IPAddress type.
public PCHCServer ( TransferProtocol transferProtocol, int hostedCacheModeListenPort, IPAddressType ipaddressType, ILogPrinter logger ) : System
transferProtocol TransferProtocol The transport type will be used
hostedCacheModeListenPort int /// The specified BranchCache service's listen port in hosted cache mode. ///
ipaddressType IPAddressType The IP address type.
logger ILogPrinter The logger.
return System

SendHttpStatusCode401() public method

Send http status code 401.
public SendHttpStatusCode401 ( ) : void
return void

SendPackage() public method

Send Reponse Message to the client.
public SendPackage ( RESPONSE_MESSAGE responseMessage ) : void
responseMessage RESPONSE_MESSAGE The response message.
return void

Start() public method

Start the http server process to listen and receive and http request.
public Start ( ) : void
return void

Stop() public method

Stop the http server process and Release this object resources.
public Stop ( ) : void
return void