usrPPPInit()函數應用(中英對照)
在這里我們主要介紹一下usrPPPInit()的語法應用。這里我們就針對這方面知識進行一下總結。這里我們搜集了一些參考資料進行一下中英文對照。希望對大家有所幫助。下面看看具體內容吧。
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.
經過配置和初始化后,PPP就將自己綁定在VxWorks TCP/IP棧的驅動層中了。(VxWorks目標機)和遠程主機建立PPP連接之后,所有的VxWorks IP網絡功能都是可用的,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連接。當調用兩個之中的任一個函數時,遠程主機應該進行初始化。處于被動方的節點,應該先進行初始化(參考PPP 選項)。
usrPPPInit()函數在config/all/bootConfig.c和src/config/usrNetwork.c中,有四種方式調用它:
如果啟動設備設置了ppp,usrPPPInit()如下調用:
From( )bootConfig.c when booting from boot ROMs. 從ROM啟動時在bootConfig.c里調用。
From usrNetwork.c when booting from VxWorks boot code. 從VxWorks啟動代碼啟動時在usrNetWorks.c里調用。
The PPP interface can also be initialized by calling usrPPPInit( ): 也可以以下面的方式調用usrPPPInit( ):
From the VxWorks shell. 從VxWorks shell里調用。
By user application code. 從用戶應用程序代碼里調用。
Use either syntax when calling usrPPPInit( ): 可以使用下面兩種語法調用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()中使用機器名(之前添加到主機數據庫里的),例如,你可以用以下的方式調用:
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()函數調用pppInit(), 它使用編譯的時候配置好的選項初始化PPP(Selecting PPP Options By Configuring VxWorks)。pppInit()函數可以多次調用以初始化多個連接,可以用PPP_CONNECT_DELAY來指定連接time out的時間。如果連接建立成功,就返回OK,所有網絡的功能就都可以使用了。
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()是標準的PPP初始化函數。所有可用的PPP選項都可以通過參數傳遞給pppInit()(see Selecting PPP Options Using an Options Structure)。不像usrPPPInit(), pppInit()的返回值不指示連接的狀態,它僅僅報告連接是否進行了初始化。要檢查是否真正建立了連接,調用函數pppInfoGet()(之前先確保IPCP的狀態是OPENED)。下面的代碼段演示了這個機制:
PPP_INFO pppInfo;
if ((pppInfoGet (2, &pppInfo) == OK) &&
(pppInfo.ipcp_fsm.state == OPENED))
return (OK); /* link established */
else
return (ERROR); /* link down */