usrPPPInit()函數(shù)應(yīng)用(中英對照)
在這里我們主要介紹一下usrPPPInit()的語法應(yīng)用。這里我們就針對這方面知識進行一下總結(jié)。這里我們搜集了一些參考資料進行一下中英文對照。希望對大家有所幫助。下面看看具體內(nèi)容吧。
Using PPP 使用PPP
After it is configured and initialized, PPP attaches itself into the VxWorks TCP/IP stack at the driver (link) layer. After a PPP link has been established with the remote peer, all normal VxWorks IP networking facilities are available; the PPP connection is transparent to the user.
經(jīng)過配置和初始化后,PPP就將自己綁定在VxWorks TCP/IP棧的驅(qū)動層中了。(VxWorks目標(biāo)機)和遠程主機建立PPP連接之后,所有的VxWorks IP網(wǎng)絡(luò)功能都是可用的,PPP連接對用戶是透明的。
Initializing a PPP Link 初始化一條PPP連接
A PPP link is initialized by calls to either usrPPPInit( ) or pppInit( ). When either of these routines is invoked, the remote peer should be initialized. When a peer is running in passive mode, it must be initialized first (see PPP Options.)
The usrPPPInit( )routine is in config/all/bootConfig.c and src/config/usrNetwork.c. There are four ways it can be called:
If the boot device is set to ppp, usrPPPInit( ) is called as follows:
可以使用usrPPPInit()或pppInit()初始化一條PPP連接。當(dāng)調(diào)用兩個之中的任一個函數(shù)時,遠程主機應(yīng)該進行初始化。處于被動方的節(jié)點,應(yīng)該先進行初始化(參考PPP 選項)。
usrPPPInit()函數(shù)在config/all/bootConfig.c和src/config/usrNetwork.c中,有四種方式調(diào)用它:
如果啟動設(shè)備設(shè)置了ppp,usrPPPInit()如下調(diào)用:
From( )bootConfig.c when booting from boot ROMs. 從ROM啟動時在bootConfig.c里調(diào)用。
From usrNetwork.c when booting from VxWorks boot code. 從VxWorks啟動代碼啟動時在usrNetWorks.c里調(diào)用。
The PPP interface can also be initialized by calling usrPPPInit( ): 也可以以下面的方式調(diào)用usrPPPInit( ):
From the VxWorks shell. 從VxWorks shell里調(diào)用。
By user application code. 從用戶應(yīng)用程序代碼里調(diào)用。
Use either syntax when calling usrPPPInit( ): 可以使用下面兩種語法調(diào)用usrPPPInit():
usrPPPInit ("bootDevice", unitNum, "localIPAddress", "remoteIPAddress")
usrPPPInit ("bootDevice", unitNum, "localHostName", "remoteHostName")
You can use host names in usrPPPInit( ) provided the hosts have been previously added to the host database. For example, you can call usrPPPInit( ) in the following way:
你可以在usrPPPInit()中使用機器名(之前添加到主機數(shù)據(jù)庫里的),例如,你可以用以下的方式調(diào)用:
usrPPPInit ("ppp=/tyCo/1,38400", 1, "147.11.90.1", "147.11.90.199")
The usrPPPInit( ) routine calls pppInit( ), which initializes PPP with the configuration options that were specified at compile-time (see Selecting PPP Options By Configuring VxWorks). The pppInit( ) routine can be called multiple times to initialize multiple channels.2 The connection timeout is specified by PPP_CONNECT_DELAY. The return value of this routine indicates whether the link has been successfully established--if the return value is OK, the network connection should be fully operational.
usrPPPInit()函數(shù)調(diào)用pppInit(), 它使用編譯的時候配置好的選項初始化PPP(Selecting PPP Options By Configuring VxWorks)。pppInit()函數(shù)可以多次調(diào)用以初始化多個連接,可以用PPP_CONNECT_DELAY來指定連接time out的時間。如果連接建立成功,就返回OK,所有網(wǎng)絡(luò)的功能就都可以使用了。
The pppInit( ) routine is the standard entry point for initializing a PPP link. All available PPP options can be set using parameters specified for this routine (see Selecting PPP Options Using an Options Structure). Unlike usrPPPInit( ), the return value of pppInit( ) does not indicate the status of the PPP link; it merely reports whether the link could be initialized. To check whether the link is actually established, call pppInfoGet( ) and make sure that the state of IPCP is OPENED. The following code fragment demonstrates use of this mechanism for PPP unit 2:
pppInit()是標(biāo)準(zhǔn)的PPP初始化函數(shù)。所有可用的PPP選項都可以通過參數(shù)傳遞給pppInit()(see Selecting PPP Options Using an Options Structure)。不像usrPPPInit(), pppInit()的返回值不指示連接的狀態(tài),它僅僅報告連接是否進行了初始化。要檢查是否真正建立了連接,調(diào)用函數(shù)pppInfoGet()(之前先確保IPCP的狀態(tài)是OPENED)。下面的代碼段演示了這個機制:
PPP_INFO pppInfo;
if ((pppInfoGet (2, &pppInfo) == OK) &&
(pppInfo.ipcp_fsm.state == OPENED))
return (OK); /* link established */
else
return (ERROR); /* link down */