????

Your IP : 18.218.61.200


Current Path : C:/Program Files/IIS/Application Request Routing/
Upload File :
Current File : C:/Program Files/IIS/Application Request Routing/serverprovider.h

#pragma once

#define SERVER_PROVIDER_ASSIGNSERVERS    "AssignServers"

class __declspec(uuid("B54F7EB2-3D71-422D-B1D4-3FFBEFCC3088"))
IServerCollection
{
  public:
    // AddServer is called zero or more times to assign servers to a particular request.  E.g., a server provider
    // may assign servers 1 and 2 to a particular host, in which case it will call AddServer for servers 1 and 2
    // each time the AssignServers export is invoked for that particular host.
    //
    // pszAddress   - the server's address, which must be unique for each weight, httpPort, httpsPort assignment.
    //                Attempting to use an address with a different weight, httpPort, httpsPort that previously
    //                assigned will result in an error.
    // dwWeight     - value between 1 and 4294967295 used for load balancing.  0 is special and means use the weight
    //                assigned previously, or the default value from schema if not previously used.
    // uHttpPort    - value between 1 and 65535 indicating HTTP port.  0 is special and means use the httpPort
    //                assigned previously, or the default value from schema if not previously used.
    // uHttpsPort   - value between 1 and 65535 indicating HTTPS port. 0 is special and means use the httpsPort
    //                assigned previously, or the default value from schema if not previously used.
    //
    // RETURN VALUE: common error values include:
    //               HRESULT_FROM_WIN32(ERROR_DEVICE_NOT_AVAILABLE) - ARR health monitoring indicates the specified server is not healthy
    //               HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) - server address was previously assigned a different weight, httpPort, or httpsPort
    //               E_INVALIDARG  - One or more arguments are invalid
    //               E_OUTOFMEMORY - Ran out of memory
    virtual
    HRESULT
    AddServer(
        __in  PCWSTR    pszAddress,
        __in  DWORD     dwWeight,
        __in  USHORT    uHttpPort,
        __in  USHORT    uHttpsPort
    ) = 0;
    
    // GetInterface may be used in future releases to obtain interfaces with additional functionality.
    //
    // riid      - a reference to the interface ID, e.g., obtained via __uuidof(IServerCollection).
    // ppObject  - receives a pointer to the requested interface
    //
    // RETURN VALUE: 
    //               E_INVALIDARG  - One or more arguments are invalid
    //               E_NOINTERFACE - No such interface supported
    virtual
    HRESULT
    GetInterface(
        __in        REFIID      riid,
        __deref_out VOID **     ppObject
    ) = 0;

};

typedef enum _LB_ALGO_ENUM
{
    LB_ALGO_ROUND_ROBIN = 0, // DEFAULT
    LB_ALGO_UNSUPPORTED_1,
    LB_ALGO_UNSUPPORTED_2,
    LB_ALGO_UNSUPPORTED_3,
    LB_ALGO_REQUEST_HASH
} LB_ALGO_ENUM;

class __declspec(uuid("9C949B25-9D13-4205-9E67-8EEB029C2741"))
IServerCollection2 : public IServerCollection
{
public:
    virtual
    HRESULT
    SetLoadBalancingAlgorithm(
        __in  LB_ALGO_ENUM  lba
    ) = 0;
};

class __declspec(uuid("AE85CF99-8D58-4652-AE8C-4615AC0C89A3"))
IServerCollection3 : public IServerCollection2
{
public:
    virtual
    VOID
    SetCookieAffinity(
        BOOL      fEnable
    ) = 0;
};

//
// AssignServers entry point - called by ARR on each request so the server provider can assign servers to the current request
// 
typedef
HRESULT
(WINAPI * PFN_ASSIGNSERVERS)(
    __in PCWSTR                           pszWebFarmName,
    __in IHttpContext *                   pHttpContext,
    __in IServerCollection *              pServerCollection
);