MprAdminInterfaceConnect function (mprapi.h)
The MprAdminInterfaceConnect function creates a connection to the specified WAN interface.
Syntax
DWORD MprAdminInterfaceConnect(
[in] MPR_SERVER_HANDLE hMprServer,
[in] HANDLE hInterface,
[in] HANDLE hEvent,
[in] BOOL fSynchronous
);
Parameters
[in] hMprServer
Handle to the router on which to execute this call. Obtain this handle by calling MprAdminServerConnect.
[in] hInterface
Handle to the interface. This handle is obtained from a previous call to MprAdminInterfaceCreate.
[in] hEvent
Handle to an event that is signaled after the attempt to connect the interface has completed. The function initiates the connection attempt and returns immediately. After the event is signaled, you can obtain the result of the connection attempt by calling MprAdminInterfaceGetInfo.
If this parameter is NULL, and fBlocking is TRUE, then this call is synchronous, that is, the function does not return until the connection attempt has completed.
The calling application must specify NULL for this parameter, if hMprServer specifies a remote router.
[in] fSynchronous
If hEvent is NULL and this parameter is set to TRUE, the function does not return until the connection attempt has completed.
If hEvent is NULL, and this parameter is set to FALSE, the function will return immediately. A return value of PENDING indicates that the connection attempt was initiated successfully.
If hEvent is not NULL, this parameter is ignored.
Return value
If the function succeeds, the return value is NO_ERROR.
If the function fails, the return value is one of the following error codes.
Value | Meaning |
---|---|
|
The calling application does not have sufficient privileges. |
|
A connection is already in progress on this interface. |
|
The Demand Dial Manager (DDM) is not running. |
|
The interface is currently disabled. |
|
No adapters are available for this interface. |
|
The hInterface value is invalid. |
|
The Demand Dial service is currently paused. |
|
The interface is in the process of connecting. The calling application must wait on the hEvent handle, if one was specified. After the event is signaled, you can obtain the state of the connection and any associated error by calling MprAdminInterfaceGetInfo. |
Remarks
The following table summarizes the relationship between hEvent and fBlocking.
hEvent | fBlocking | Result |
---|---|---|
Event Handle | Ignored | The call returns immediately. A return value of PENDING indicates that the attempt was initiated successfully. Wait on hEvent. When hEvent is signaled, use MprAdminInterfaceGetInfo to determine the success or failure of the connection attempt. |
NULL | TRUE | The call does not return until the connection attempt has completed. |
NULL | FALSE | The call returns immediately. A return value of PENDING indicates that the attempt was initiated successfully. |
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | mprapi.h |
Library | Mprapi.lib |
DLL | Mprapi.dll |