aardio 文档

inet.ras 库模块帮助文档

inet.ras 成员列表

inet.ras.dial(连接参数)

inet.ras.dial(   
    entryName =  "拔号连接名";  
    user =  "拔号用户名";  
    password = "拔号密码"  
)

inet.ras.eachEntry()

for name,flags,phonebook in inet.ras.eachEntry(){  
    /*遍历拔号连接,name为连接名*/  
}

inet.ras.getConnection()

获取当前拔号连接,失败返回空,错误代码

返回对象:rasconnObject

inet.ras.getEntries()

返回所有拔号连接

inet.ras.getEntry(参数表)

inet.ras.getEntry(  
    entryName = "连接名"  
)

inet.ras.hangUp(连接句柄)

挂断
省略连接句柄则获取当前活动连接

inet.ras.isAlive()

返回两个值: 是否存在广域网连接(WAN),是否存在局域网连接(LAN)

inet.ras.lasterr(错误代码)

返回错误信息,错误代码

inet.ras.setCredentials(登录信息)

inet.ras.setCredentials(  
    entryName = "连接名";   
    userName = "用户名";   
    password = "密码";   
)

inet.ras.setEntry(VPN连接参数)

inet.ras.setEntry(  
    type = 2/*_RASET_Vpn*/;   
    fOptions =  0x10/*_RASEO_RemoteDefaultGateway*/ | 0x100/*_RASEO_ModemLights*/ | 0x200/*_RASEO_SwCompression*/ | 0x800/*_RASEO_RequireMsEncryptedPw*/ | 0x1000000/*_RASEO_PreviewUserPw*/ | 0x400/*_RASEO_RequireEncryptedPw*/ | 0x20000000/*_RASEO_RequireMsCHAP2*/;  
    fOptions2 = 0x2000000/*_RASEO2_CacheCredentials*/;  
    ipaddrDns = "8.8.8.8";  
    ipaddrDnsAlt = "1.1.1.1";  
    vpnStrategy = 2/*_VS_PptpFirst*/;  
    deviceType = "VPN";  
    deviceName = "VPN";   
    localPhoneNumber = "服务器地址";  
    entryName = "VPN连接"  
)

inet.ras.setEntry(宽带连接参数)

inet.ras.setEntry(  
    type = 5/*_RASET_Broadband*/;   
    fOptions = 0x10/*_RASEO_RemoteDefaultGateway*/  
        | 0x1000000/*_RASEO_PreviewUserPw*/  
        | 0x4000000/*_RASEO_ShowDialingProgress*/  
        | 0x100/*_RASEO_ModemLights*/  
        | 0x100/*_RASEO2_ReconnectIfDropped*/ ;  
    fOptions2 = 0x2000000/*_RASEO2_CacheCredentials*/   
        | 4/*_RASEO2_DontNegotiateMultilink*/;  
    deviceType = "PPPoE";  
    deviceName = "WAN 微型端口 (PPPOE)";    
    entryName = "ADSL宽带连接"  
)

inet.ras.setProxy("连接名")

指定连接不使用代理

inet.ras.setProxy("连接名","SOCKS=代理服务器地址:端口","绕过代理地址")

省略连接名表示默认连接以及所有拔号连接,
设置SOCKS4代理服务器,不支持登录
绕过代理地址可在域名或IP中使用通配符,多个以分号分隔

inet.ras.setProxy("连接名","被代理协议=代理协议://主机地址:端口号","绕过代理地址")

省略连接名表示默认连接以及所有拔号连接,
参数@2可以直接写代理服务器域名或IP,
省略协议则默认为HTTP,省略端口则默认为80,
绕过代理地址可在域名或IP中使用通配符,多个以分号分隔

inet.ras.setProxy()

默认连接以及所有拔号连接不使用代理
设置进程内代理请使用 inet.setProxy 函数

inet.ras.setProxyAutoConfig("连接名", "HTTP://主机地址:端口号")

为指定连接设置自动配置代理(PAC)地址,
省略连接名表示默认连接以及所有拔号连接

inet.ras.status()

返回对象:rasconnstatusObject

inet.ras.status(连接句柄)

返回拔号连接状态信息
省略连接句柄则获取当前活动连接

rasconnObject 成员列表

rasconnObject.deviceName

设备名

rasconnObject.deviceType

设备类型

rasconnObject.entryName

连接名

rasconnObject.hConn

连接句柄

rasconnstatusObject 成员列表

rasconnstatusObject.deviceName

设备名

rasconnstatusObject.deviceType

设备类型

rasconnstatusObject.err

错误代码

rasconnstatusObject.phoneNumber

连接号码

rasconnstatusObject.state

RASCS前缀常量表示连接状态

自动完成常量

_ET_None=0
_ET_Optional=3
_ET_Require=1
_ET_RequireMax=2
_RASCM_DDMPreSharedKey=0x40
_RASCM_DefaultCreds=8
_RASCM_Domain=4
_RASCM_Password=2
_RASCM_PreSharedKey=0x10
_RASCM_ServerPreSharedKey=0x20
_RASCM_UserName=1
_RASCS_AllDevicesConnected=4
_RASCS_ApplySettings=0x18
_RASCS_AuthAck=0xC
_RASCS_AuthCallback=8
_RASCS_AuthChangePassword=9
_RASCS_AuthLinkSpeed=0xB
_RASCS_AuthNotify=6
_RASCS_AuthProject=0xA
_RASCS_AuthRetry=7
_RASCS_Authenticate=5
_RASCS_Authenticated=0xE
_RASCS_CallbackComplete=0x14
_RASCS_CallbackSetByCaller=0x1002
_RASCS_ConnectDevice=2
_RASCS_Connected=0x2000
_RASCS_DONE=0x2000
_RASCS_DeviceConnected=3
_RASCS_Disconnected=0x2001
_RASCS_Interactive=0x1000
_RASCS_InvokeEapUI=0x1004
_RASCS_LogonNetwork=0x15
_RASCS_OpenPort=0
_RASCS_PAUSED=0x1000
_RASCS_PasswordExpired=0x1003
_RASCS_PortOpened=1
_RASCS_PrepareForCallback=0xF
_RASCS_Projected=0x12
_RASCS_ReAuthenticate=0xD
_RASCS_RetryAuthentication=0x1001
_RASCS_StartAuthentication=0x13
_RASCS_SubEntryConnected=0x16
_RASCS_SubEntryDisconnected=0x17
_RASCS_WaitForCallback=0x11
_RASCS_WaitForModemReset=0x10
_RASEO2_CacheCredentials=0x2000000
_RASEO2_DisableIKENameEkuCheck=0x20000
_RASEO2_DisableNbtOverIP=0x40
_RASEO2_DontNegotiateMultilink=4
_RASEO2_DontUseRasCredentials=8
_RASEO2_IPv4ExplicitMetric=0x8000
_RASEO2_IPv6ExplicitMetric=0x10000
_RASEO2_IPv6RemoteDefaultGateway=0x1000
_RASEO2_IPv6SpecificNameServer=0x800
_RASEO2_Internet=0x20
_RASEO2_ReconnectIfDropped=0x100
_RASEO2_RegisterIpWithDNS=0x2000
_RASEO2_SecureClientForMSNet=2
_RASEO2_SecureFileAndPrint=1
_RASEO2_SecureRoutingCompartment=0x400
_RASEO2_SharePhoneNumbers=0x200
_RASEO2_UseDNSSuffixForRegistration=0x4000
_RASEO2_UseGlobalDeviceSettings=0x80
_RASEO2_UsePreSharedKey=0x10
_RASEO_Custom=0x100000
_RASEO_CustomScript=0x80000000
_RASEO_DisableLcpExtensions=0x20
_RASEO_IpHeaderCompression=8
_RASEO_ModemLights=0x100
_RASEO_NetworkLogon=0x2000
_RASEO_PreviewDomain=0x2000000
_RASEO_PreviewPhoneNumber=0x200000
_RASEO_PreviewUserPw=0x1000000
_RASEO_PromoteAlternates=0x8000
_RASEO_RemoteDefaultGateway=0x10
_RASEO_RequireCHAP=0x8000000
_RASEO_RequireDataEncryption=0x1000
_RASEO_RequireEAP=0x20000
_RASEO_RequireEncryptedPw=0x400
_RASEO_RequireMsCHAP=0x10000000
_RASEO_RequireMsCHAP2=0x20000000
_RASEO_RequireMsEncryptedPw=0x800
_RASEO_RequirePAP=0x40000
_RASEO_RequireSPAP=0x80000
_RASEO_RequireW95MSCHAP=0x40000000
_RASEO_SecureLocalFiles=0x10000
_RASEO_SharedPhoneNumbers=0x800000
_RASEO_ShowDialingProgress=0x4000000
_RASEO_SpecificIpAddr=2
_RASEO_SpecificNameServers=4
_RASEO_SwCompression=0x200
_RASEO_TerminalAfterDial=0x80
_RASEO_TerminalBeforeDial=0x40
_RASEO_UseCountryAndAreaCodes=1
_RASEO_UseLogonCredentials=0x4000
_RASET_Broadband=5
_RASET_Phone=1
_RASET_Vpn=2
_RASFP_Ppp=1
_RASFP_Ras=4
_RASFP_Slip=2
_RASNP_Ip=4
_RASNP_Ipv6=8
_RASNP_Ipx=2
_RASNP_NetBEUI=1
_VS_Default=0
_VS_L2tpFirst=4
_VS_L2tpOnly=3
_VS_PptpFirst=2
_VS_PptpOnly=1

Markdown 格式