Other Uses for RAS

There are many other uses for RAS, but few are useful for server-based applications. One exception is the set of functions associated with managing autodial connections. If a server needs to periodically connect to a remote location, and the server cannot know that a particular network resource is remote, the RAS functions allow the connection between a particular network resource and a dial-up connection to take place ”the connection is handled at the operating system level. RasSetAutodialAddress is one of these functions. This function allows for a connection to remote resources in a reasonably transparent way, handled automatically by the operating system. The prototype for RasSetAutodialAddress is

 DWORDRasSetAutodialAddress(LPCTSTRlpszAddress,//Pointertoanetworkaddress //string DWORDdwReserved,//Reserved;mustbezero LPRASAUTODIALENTRYlpAutoDialEntries, //Pointertobuffercontaining //AutoDialentrydata DWORDdwcbAutoDialEntries,//Size,inbytes,ofthebuffer DWORDdwcAutoDialEntries//Numberofentriesinthebuffer); 

The lpszAddress parameter is a pointer to a string containing the name of a network address ”either an IP dotted address ("10.10.10.0"), an Internet host name ("www.microsoft.com"), or a NetBIOS name ("DougR"). The lpAutoDialEntries parameter points to an array of RASAUTODIALENTRY structures. These structures contain the names of the entries in the RAS phonebook as well as TAPI- related information about the dialing location. If this entry is NULL and the value for the next parameter, dwcbAutoDialEntries , is 0, all information in the mapping database related to lpszAddress is eliminated. The dwcbAutoDialEntries parameter normally specifies the size, in bytes, of the buffer pointed to by lpAutoDialEntries . The dwcAutoDialEntries parameter specifies the number of RASAUTODIALENTRY structures pointed to by lpAutoDialEntries .

RasSetAutodialParam is another function for setting up autodialing using RAS.

 DWORDRasSetAutodialParam(DWORDdwKey,//Indicatestheparametertoset LPVOIDlpvValue,//Pointertoabufferthatspecifiesthevalue DWORDdwcbValue//Size,inbytes,ofthebuffer); 

The dwKey parameter specifies the autodial parameter to be set; lpvValue points to the value to be set for the dwKey parameter. The dwcbValue parameter is the size, in bytes, of the buffer passed as lpvValue . Table 6-1 shows the values for dwKey and the meaning of those values.

Table 6-1 Values of dwKey Parameter to RasSetAutodialParam

dwKey Possible Values Details
RASADP_DisableConnectionQuery 0 or 1 DWORD ”the default (0) ”shows a dialog box to query the user before autodialing. 1 disables that dialog box.
RASADP_LoginSessionDisable 0 or 1 DWORD ”the default (0) ”allows autodial connections. 1 disables autodial connections for this session. This is reset to 0 each time a user logs on.
RASADP_SavedAddressesLimit Any valid
DWORD
The number of addresses autodial stores in the registry. This number does not affect addresses saved using the RasSetAutodialAddress function, only the addresses learned by RAS after a connection is made. The default is 100.
RASADP_FailedConnectionTimeout Any valid
DWORD
The timeout in seconds that subsequent attempts to reach an address that previously failed must wait. This is to prevent multiple dialogs from appearing for the same failed connection. The default is 5.
RASADP_ConnectionQueryTimeout Any valid
DWORD
The timeout, in seconds, that an autodial dialog will wait for the user to cancel an autodial in progress.

Some of these parameters, especially RASADP_DisableConnectionQuery and RASADP_ConnectionQueryTimeout, have obvious applicability to server-based applications, which ”wherever possible ”want no user interface at all, since no user will be able to respond if the service application is a Windows 2000 service.



Inside Server-Based Applications
Inside Server-Based Applications (DV-MPS General)
ISBN: 1572318171
EAN: 2147483647
Year: 1999
Pages: 91

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net