The MprAdminInterfaceConnect function creates a connection to the specified WAN interface.
DWORD MprAdminInterfaceConnect( MPR_SERVER_HANDLE hMprServer, // handle to router HANDLE hInterface, // handle to interface HANDLE hEvent, // event to signal when connection // attempt is complete BOOL fSynchronous // flag to control synchronous // versus asychronous operation );
If this parameter is NULL, and fBlocking is TRUE, then this call is synchronous, that is, the function will not return until the connection attempt has completed.
The calling application must specify NULL for this parameter, if hMprserver specifies a remote router.
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.
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 |
---|---|
ERROR_ACCESS_DENIED | The calling application does not have sufficient privileges. |
ERROR_ALREADY_CONNECTING | A connection is already in progress on this interface. |
ERROR_DDM_NOT_RUNNING | The Demand Dial Manager (DDM) is not running. |
ERROR_INTERFACE_DISABLED | The interface is currently disabled. |
ERROR_INTERFACE_HAS_NO_DEVICES | No adapters are available for this interface. |
ERROR_INVALID_HANDLE | The hInterface value is invalid. |
ERROR_SERVICE_IS_PAUSED | The Demand Dial service is currently paused. |
PENDING | The interface is in the process of connecting. The calling application should 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. |
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. |
Windows NT/2000: Requires Windows 2000.
Header: Declared in Mprapi.h.
Library: Use Mprapi.lib.
Router Management Reference, Router Administration Functions, MprAdminInterfaceCreate, MprAdminInterfaceDisconnect, MprAdminInterfaceGetInfo, MprAdminServerConnect