X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fcbcp.c;h=8add25f09b63887d6e793699afafb6b154530e9f;hb=50f06d79e6f4c457a68929df21d4c71b9d2dade1;hp=9405f7bfa266a179ceb0860f8a6639c6ce373561;hpb=cbe589d089e6db8828f71e88688793ead5b30954;p=ppp.git diff --git a/pppd/cbcp.c b/pppd/cbcp.c index 9405f7b..8add25f 100644 --- a/pppd/cbcp.c +++ b/pppd/cbcp.c @@ -19,7 +19,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: cbcp.c,v 1.1 1996/10/08 04:35:41 paulus Exp $"; +static char rcsid[] = "$Id: cbcp.c,v 1.4 1999/03/02 05:34:16 paulus Exp $"; #endif #include @@ -34,6 +34,17 @@ static char rcsid[] = "$Id: cbcp.c,v 1.1 1996/10/08 04:35:41 paulus Exp $"; #include "lcp.h" #include "ipcp.h" +/* + * Options. + */ +static int setcbcp __P((char **)); + +static option_t cbcp_option_list[] = { + { "callback", o_special, setcbcp, + "Ask for callback" }, + { NULL } +}; + /* * Protocol entry points. */ @@ -59,6 +70,8 @@ struct protent cbcp_protent = { NULL, 0, "CBCP", + cbcp_option_list, + NULL, NULL, NULL, NULL @@ -68,11 +81,26 @@ cbcp_state cbcp[NUM_PPP]; /* internal prototypes */ -void cbcp_recvreq(cbcp_state *us, char *pckt, int len); -void cbcp_resp(cbcp_state *us); -void cbcp_up(cbcp_state *us); -void cbcp_recvack(cbcp_state *us, char *pckt, int len); -void cbcp_send(cbcp_state *us, u_char code, u_char *buf, int len); +static void cbcp_recvreq __P((cbcp_state *us, char *pckt, int len)); +static void cbcp_resp __P((cbcp_state *us)); +static void cbcp_up __P((cbcp_state *us)); +static void cbcp_recvack __P((cbcp_state *us, char *pckt, int len)); +static void cbcp_send __P((cbcp_state *us, u_char code, u_char *buf, int len)); + +/* option processing */ +static int +setcbcp(argv) + char **argv; +{ + lcp_wantoptions[0].neg_cbcp = 1; + cbcp_protent.enabled_flag = 1; + cbcp[0].us_number = strdup(*argv); + if (cbcp[0].us_number == 0) + novm("callback number"); + cbcp[0].us_type |= (1 << CB_CONF_USER); + cbcp[0].us_type |= (1 << CB_CONF_ADMIN); + return (1); +} /* init state */ static void @@ -189,9 +217,7 @@ cbcp_printpkt(p, plen, printer, arg) void *arg; { int code, opt, id, len, olen, delay; - u_char *pstart, *optend; - u_short cishort; - u_long cilong; + u_char *pstart; if (plen < HEADERLEN) return 0; @@ -345,10 +371,9 @@ cbcp_resp(us) if (cb_type & ( 1 << CB_CONF_ADMIN ) ) { syslog(LOG_DEBUG, "cbcp_resp CONF_ADMIN"); PUTCHAR(CB_CONF_ADMIN, bufp); - len = 3 + 1; - PUTCHAR(len , bufp); + len = 3; + PUTCHAR(len, bufp); PUTCHAR(5, bufp); /* delay */ - PUTCHAR(0, bufp); cbcp_send(us, CBCP_RESP, buf, len); return; } @@ -360,7 +385,7 @@ cbcp_resp(us) PUTCHAR(len , bufp); PUTCHAR(0, bufp); cbcp_send(us, CBCP_RESP, buf, len); - ipcp_open(us->us_unit); + (*ipcp_protent.open)(us->us_unit); return; } } @@ -428,5 +453,5 @@ cbcp_up(us) cbcp_state *us; { persist = 0; - lcp_close(0); + lcp_close(0, "Call me back, please"); }