示例#1
0
/** initializing context for LCP. */
void
lcp_init(lcp *_this, npppd_ppp *ppp)
{
	fsm_init(&_this->fsm);

	_this->fsm.ppp = ppp;
	_this->fsm.callbacks = &lcp_callbacks;
	_this->fsm.protocol = PPP_PROTO_LCP;
	_this->fsm.flags |= OPT_SILENT;
	_this->timerctx.ctx = _this;

	_this->recv_ress = 0;
	_this->recv_reqs = 0;
	_this->magic_number = ((0xffff & random()) << 16) | (0xffff & random());

	PPP_FSM_CONFIG(&_this->fsm, timeouttime,	"lcp.timeout");
	PPP_FSM_CONFIG(&_this->fsm, maxconfreqtransmits,"lcp.max_configure");
	PPP_FSM_CONFIG(&_this->fsm, maxtermtransmits,	"lcp.max_terminate");
	PPP_FSM_CONFIG(&_this->fsm, maxnakloops,	"lcp.max_nak_loop");

	/*
	 * PPTP and L2TP are able to detect lost carrier, so LCP ECHO is off
	 * by default.
	 */
	_this->echo_interval = 0;
	_this->echo_failures = 0;
	_this->echo_max_retries = 0;

	_this->auth_order[0] = -1;
}
示例#2
0
文件: ccp.c 项目: ajinkya93/OpenBSD
/** Initialize the context for ccp */
void
ccp_init(ccp *_this, npppd_ppp *ppp)
{
	struct tunnconf *conf;

	memset(_this, 0, sizeof(ccp));

	_this->ppp = ppp;
	_this->fsm.callbacks = &ccp_callbacks;
	_this->fsm.protocol = PPP_PROTO_NCP | NCP_CCP;
	_this->fsm.ppp = ppp;

	fsm_init(&_this->fsm);

	conf = ppp_get_tunnconf(ppp);
	PPP_FSM_CONFIG(&_this->fsm, timeouttime, conf->ccp_timeout);
	PPP_FSM_CONFIG(&_this->fsm, maxconfreqtransmits,
	    conf->ccp_max_configure);
	PPP_FSM_CONFIG(&_this->fsm, maxtermtransmits,
	    conf->ccp_max_terminate);
	PPP_FSM_CONFIG(&_this->fsm, maxnakloops,
	    conf->ccp_max_nak_loop);
}