Beispiel #1
0
void
CcpInit(Bund b)
{
  CcpState	ccp = &b->ccp;

  /* Init CCP state for this bundle */
  memset(ccp, 0, sizeof(*ccp));
  FsmInit(&ccp->fsm, &gCcpFsmType, b);
  ccp->fsm.conf.maxfailure = CCP_MAXFAILURE;

  /* Construct options list if we haven't done so already */
  if (gConfList == NULL) {
    struct confinfo	*ci;
    int			k;

    ci = Malloc(MB_COMP, (CCP_NUM_PROTOS + 1) * sizeof(*ci));
    for (k = 0; k < CCP_NUM_PROTOS; k++) {
      ci[k].option = k;
      ci[k].peered = TRUE;
      ci[k].name = gCompTypes[k]->name;
    }

    /* Terminate list */
    ci[k].name = NULL;
    gConfList = (const struct confinfo *) ci;
  }
}
Beispiel #2
0
void
Ipv6cpInit(Bund b)
{
	Ipv6cpState ipv6cp = &b->ipv6cp;

	/* Init state machine */
	memset(ipv6cp, 0, sizeof(*ipv6cp));
	FsmInit(&ipv6cp->fsm, &gIpv6cpFsmType, b);

	CreateInterfaceID(ipv6cp->myintid, 0);

}
Beispiel #3
0
void
IpcpInit(Bund b)
{
  IpcpState		const ipcp = &b->ipcp;

  /* Init state machine */
  memset(ipcp, 0, sizeof(*ipcp));
  FsmInit(&ipcp->fsm, &gIpcpFsmType, b);

  /* Come up with a default IP address for my side of the link */
  u_rangeclear(&ipcp->conf.self_allow);
  GetAnyIpAddress(&ipcp->conf.self_allow.addr, NULL);

#ifdef USE_NG_VJC
  /* Default we want VJ comp */
  Enable(&ipcp->conf.options, IPCP_CONF_VJCOMP);
  Accept(&ipcp->conf.options, IPCP_CONF_VJCOMP);
#endif
}
Beispiel #4
0
int main(int argc, char *argv[])
{
	char ch;
	//定义状态机的对象 
	struct FsmObj st;

	FsmInit(&st, Func1);

	printf("请输入第一个字母\n");
	
	while (1)
	{
		ch = getche();
		FsmDispatch(&st, &ch);
	}
 
  	getchar();
	getchar();
  	return 0;
}