在这里我们主要介绍一下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 */