function rasconnectionstatetostring(nstate : integer) : string;
begin
case nstate of
rascs_openport: result := 'opening port';
rascs_portopened: result := 'port opened';
rascs_connectdevice: result := 'connecting device';
rascs_deviceconnected: result := 'device connected';
rascs_alldevicesconnected: result := 'all devices connected';
rascs_authenticate: result := 'starting authentication';
rascs_authnotify: result := 'authentication notify';
rascs_authretry: result := 'authentication retry';
rascs_authcallback: result := 'callback requested';
rascs_authchangepassword: result := 'change password requested';
rascs_authproject: result := 'projection phase started';
rascs_authlinkspeed: result := 'link speed calculation';
rascs_authack: result := 'authentication acknowledged';
rascs_reauthenticate: result := 'reauthentication started';
rascs_authenticated: result := 'authenticated';
rascs_prepareforcallback: result := 'preparation for callback';
rascs_waitformodemreset: result := 'waiting for modem reset';
rascs_waitforcallback: result := 'waiting for callback';
rascs_projected: result := 'projected';
{$ifdef winver400}
rascs_startauthentication: result := 'start authentication';
rascs_callbackcomplete: result := 'callback complete';
rascs_logonnetwork: result := 'logon network';
{$endif}
rascs_subentryconnected: result := '';
rascs_subentrydisconnected: result := '';
rascs_interactive: result := 'interactive';
rascs_retryauthentication: result := 'retry authentication';
rascs_callbacksetbycaller: result := 'callback set by caller';
rascs_passwordexpired: result := 'password expired';
rascs_connected: result := 'connected';
rascs_disconnected: result := 'disconnected';
else
result := 'connection state #' + inttostr(nstate);
end;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function rasgetipaddress: string;
var
rasconns : trasconn;
dwsize : dword;
dwcount : dword;
raspppip : traspppip;
begin
result := '';
rasconns.dwsize := sizeof(trasconn);
raspppip.dwsize := sizeof(raspppip);
dwsize := sizeof(rasconns);
if rasenumconnectionsa(@rasconns, @dwsize, @dwcount) = 0 then begin
if dwcount > 0 then begin
dwsize := sizeof(raspppip);
raspppip.dwsize := sizeof(raspppip);
if rasgetprojectioninfoa(rasconns.hrasconn,