Lines Matching refs:fsm
46 #include "fsm.h"
66 cbcp->fsm.state = CBCP_CLOSED;
67 cbcp->fsm.id = 0;
68 cbcp->fsm.delay = 0;
69 *cbcp->fsm.phone = '\0';
70 memset(&cbcp->fsm.timer, '\0', sizeof cbcp->fsm.timer);
83 timer_Stop(&cbcp->fsm.timer);
84 if (cbcp->fsm.restart) {
85 switch (cbcp->fsm.state) {
105 switch (cbcp->fsm.state) {
134 timer_Stop(&cbcp->fsm.timer);
135 cbcp->fsm.timer.func = cbcp_Timeout;
136 cbcp->fsm.timer.name = "cbcp";
137 cbcp->fsm.timer.load = timeout * SECTICKS;
138 cbcp->fsm.timer.arg = cbcp;
139 timer_Start(&cbcp->fsm.timer);
163 if (cbcp->fsm.state != new) {
165 cbcpstate(cbcp->fsm.state), cbcpstate(new));
166 cbcp->fsm.state = new;
204 head->id = cbcp->fsm.id;
260 char list[sizeof cbcp->fsm.phone], *next;
266 cbcp->fsm.id, cbcpstate(cbcp->fsm.state));
267 data.type = cbcp->fsm.type;
269 strncpy(list, cbcp->fsm.phone, sizeof list - 1);
308 cbcp->fsm.restart--;
309 cbcp_StartTimer(cbcp, cbcp->fsm.delay);
318 cbcp->fsm.delay = cbcp->p->dl->cfg.cbcp.delay;
320 !auth_SetPhoneList(cbcp->p->dl->peer.authname, cbcp->fsm.phone,
321 sizeof cbcp->fsm.phone)) {
322 strncpy(cbcp->fsm.phone, cbcp->p->dl->cfg.cbcp.phone,
323 sizeof cbcp->fsm.phone - 1);
324 cbcp->fsm.phone[sizeof cbcp->fsm.phone - 1] = '\0';
328 if (*cbcp->fsm.phone == '\0')
329 cbcp->fsm.type = CBCP_NONUM;
330 else if (!strcmp(cbcp->fsm.phone, "*")) {
331 cbcp->fsm.type = CBCP_SERVERNUM;
332 *cbcp->fsm.phone = '\0';
334 cbcp->fsm.type = CBCP_CLIENTNUM;
336 cbcp_StartTimer(cbcp, cbcp->fsm.delay * DEF_FSMTRIES);
338 if (*cbcp->fsm.phone == '\0')
339 cbcp->fsm.type = CBCP_NONUM;
340 else if (!strcmp(cbcp->fsm.phone, "*")) {
341 cbcp->fsm.type = CBCP_CLIENTNUM;
342 *cbcp->fsm.phone = '\0';
343 } else if (strchr(cbcp->fsm.phone, ','))
344 cbcp->fsm.type = CBCP_LISTNUM;
346 cbcp->fsm.type = CBCP_SERVERNUM;
347 cbcp->fsm.restart = DEF_FSMTRIES;
356 * We've received a REQ (data). Adjust our response (cbcp->fsm.*)
369 cbcp->fsm.type = CBCP_NONUM;
380 if (cbcp->fsm.type == CBCP_CLIENTNUM) {
396 ptr = strchr(cbcp->fsm.phone, ',');
405 if (cbcp->fsm.type == CBCP_SERVERNUM) {
406 *cbcp->fsm.phone = '\0';
421 } else if (cbcp->fsm.type == CBCP_CLIENTNUM) {
427 char list[sizeof cbcp->fsm.phone], *next;
429 strncpy(list, cbcp->fsm.phone, sizeof list - 1);
433 cbcp->fsm.type = CBCP_SERVERNUM;
434 strcpy(cbcp->fsm.phone, next);
443 if (cbcp->fsm.type == CBCP_CLIENTNUM || cbcp->fsm.type == CBCP_LISTNUM) {
445 * Search through ``data''s addresses and see if cbcp->fsm.phone
448 char list[sizeof cbcp->fsm.phone], *next, *end;
455 strncpy(list, cbcp->fsm.phone, sizeof list - 1);
459 cbcp->fsm.type = CBCP_LISTNUM;
460 strcpy(cbcp->fsm.phone, next);
486 cbcp->fsm.id, cbcpstate(cbcp->fsm.state));
488 data.type = cbcp->fsm.type;
489 data.delay = cbcp->fsm.delay;
493 else if (*cbcp->fsm.phone) {
495 strncpy(addr->addr, cbcp->fsm.phone, sizeof addr->addr - 1);
503 cbcp->fsm.restart--;
504 cbcp_StartTimer(cbcp, cbcp->fsm.delay);
518 * our REQ (cbcp->fsm)
524 if (data->type == cbcp->fsm.type) {
525 switch (cbcp->fsm.type) {
536 strncpy(cbcp->fsm.phone, addr->addr, sizeof cbcp->fsm.phone - 1);
537 cbcp->fsm.phone[sizeof cbcp->fsm.phone - 1] = '\0';
538 cbcp->fsm.delay = data->delay;
544 cbcp->fsm.delay = data->delay;
554 char list[sizeof cbcp->fsm.phone], *next;
556 strncpy(list, cbcp->fsm.phone, sizeof list - 1);
560 strcpy(cbcp->fsm.phone, next);
561 cbcp->fsm.delay = data->delay;
570 (int)cbcp->fsm.type);
572 } else if (data->type == CBCP_NONUM && cbcp->fsm.type == CBCP_CLIENTNUM) {
577 cbcp->fsm.type = CBCP_NONUM;
593 cbcp->fsm.id, cbcpstate(cbcp->fsm.state));
595 data.type = cbcp->fsm.type;
603 strncpy(addr->addr, cbcp->fsm.phone, sizeof addr->addr - 1);
605 data.delay = cbcp->fsm.delay;
609 data.delay = cbcp->fsm.delay;
616 cbcp->fsm.restart--;
617 cbcp_StartTimer(cbcp, cbcp->fsm.delay);
660 p->dl->name, head->id, cbcpstate(cbcp->fsm.state));
662 if (cbcp->fsm.state == CBCP_STOPPED || cbcp->fsm.state == CBCP_RESPSENT) {
663 timer_Stop(&cbcp->fsm.timer);
665 cbcp->fsm.restart = DEF_FSMTRIES;
666 cbcp->fsm.id = head->id;
676 p->dl->name, head->id, cbcpstate(cbcp->fsm.state));
678 if (cbcp->fsm.id != head->id) {
680 cbcp->fsm.id, head->id);
681 cbcp->fsm.id = head->id;
683 if (cbcp->fsm.state == CBCP_REQSENT || cbcp->fsm.state == CBCP_ACKSENT) {
684 timer_Stop(&cbcp->fsm.timer);
691 cbcp->fsm.restart = DEF_FSMTRIES;
693 if (cbcp->fsm.type == CBCP_NONUM) {
698 timer_Stop(&cbcp->fsm.timer);
713 p->dl->name, head->id, cbcpstate(cbcp->fsm.state));
715 if (cbcp->fsm.id != head->id) {
717 cbcp->fsm.id, head->id);
718 cbcp->fsm.id = head->id;
720 if (cbcp->fsm.type == CBCP_NONUM) {
725 timer_Stop(&cbcp->fsm.timer);
727 } else if (cbcp->fsm.state == CBCP_RESPSENT) {
728 timer_Stop(&cbcp->fsm.timer);
748 timer_Stop(&cbcp->fsm.timer);
756 if (p->dl->cbcp.fsm.state == CBCP_ACKSENT) {
760 p->dl->cbcp.fsm.phone);