*/
#ifndef lint
-static char rcsid[] = "$Id: ipcp.c,v 1.9 1994/08/22 00:36:38 paulus Exp $";
+static char rcsid[] = "$Id: ipcp.c,v 1.11 1994/09/21 06:47:37 paulus Exp $";
#endif
/*
#include <sys/socket.h>
#include "pppd.h"
-#include "ppp.h"
#include "fsm.h"
#include "ipcp.h"
#include "pathnames.h"
/* global vars */
-ipcp_options ipcp_wantoptions[NPPP]; /* Options that we want to request */
-ipcp_options ipcp_gotoptions[NPPP]; /* Options that peer ack'd */
-ipcp_options ipcp_allowoptions[NPPP]; /* Options we allow peer to request */
-ipcp_options ipcp_hisoptions[NPPP]; /* Options that we ack'd */
-
-extern char ifname[];
-extern char devnam[];
-extern int baud_rate;
+ipcp_options ipcp_wantoptions[N_PPP]; /* Options that we want to request */
+ipcp_options ipcp_gotoptions[N_PPP]; /* Options that peer ack'd */
+ipcp_options ipcp_allowoptions[N_PPP]; /* Options we allow peer to request */
+ipcp_options ipcp_hisoptions[N_PPP]; /* Options that we ack'd */
/* local vars */
-static int cis_received[NPPP]; /* # Conf-Reqs received */
+static int cis_received[N_PPP]; /* # Conf-Reqs received */
/*
* Callbacks for fsm code. (CI = Configuration Information)
*/
-static void ipcp_resetci __ARGS((fsm *)); /* Reset our CI */
-static int ipcp_cilen __ARGS((fsm *)); /* Return length of our CI */
-static void ipcp_addci __ARGS((fsm *, u_char *, int *)); /* Add our CI */
-static int ipcp_ackci __ARGS((fsm *, u_char *, int)); /* Peer ack'd our CI */
-static int ipcp_nakci __ARGS((fsm *, u_char *, int)); /* Peer nak'd our CI */
-static int ipcp_rejci __ARGS((fsm *, u_char *, int)); /* Peer rej'd our CI */
-static int ipcp_reqci __ARGS((fsm *, u_char *, int *, int)); /* Rcv CI */
-static void ipcp_up __ARGS((fsm *)); /* We're UP */
-static void ipcp_down __ARGS((fsm *)); /* We're DOWN */
-static void ipcp_script __ARGS((fsm *, char *)); /* Run an up/down script */
-
-fsm ipcp_fsm[NPPP]; /* IPCP fsm structure */
+static void ipcp_resetci __P((fsm *)); /* Reset our CI */
+static int ipcp_cilen __P((fsm *)); /* Return length of our CI */
+static void ipcp_addci __P((fsm *, u_char *, int *)); /* Add our CI */
+static int ipcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */
+static int ipcp_nakci __P((fsm *, u_char *, int)); /* Peer nak'd our CI */
+static int ipcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */
+static int ipcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */
+static void ipcp_up __P((fsm *)); /* We're UP */
+static void ipcp_down __P((fsm *)); /* We're DOWN */
+static void ipcp_script __P((fsm *, char *)); /* Run an up/down script */
+
+fsm ipcp_fsm[N_PPP]; /* IPCP fsm structure */
static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */
ipcp_resetci, /* Reset our Configuration Information */
*/
char *
ip_ntoa(ipaddr)
-u_long ipaddr;
+u_int32_t ipaddr;
{
static char b[64];
ipcp_options *ao = &ipcp_allowoptions[unit];
f->unit = unit;
- f->protocol = IPCP;
+ f->protocol = PPP_IPCP;
f->callbacks = &ipcp_callbacks;
fsm_init(&ipcp_fsm[unit]);
if (neg) { \
int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \
if (len >= addrlen) { \
- u_long l; \
+ u_int32_t l; \
PUTCHAR(opt, ucp); \
PUTCHAR(addrlen, ucp); \
l = ntohl(val1); \
{
ipcp_options *go = &ipcp_gotoptions[f->unit];
u_short cilen, citype, cishort;
- u_long cilong;
+ u_int32_t cilong;
u_char cimaxslotindex, cicflag;
/*
#define ACKCIADDR(opt, neg, old, val1, val2) \
if (neg) { \
int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \
- u_long l; \
+ u_int32_t l; \
if ((len -= addrlen) < 0) \
goto bad; \
GETCHAR(citype, p); \
u_char cimaxslotindex, cicflag;
u_char citype, cilen, *next;
u_short cishort;
- u_long ciaddr1, ciaddr2, l;
+ u_int32_t ciaddr1, ciaddr2, l;
ipcp_options no; /* options we've seen Naks for */
ipcp_options try; /* options to request next time */
ipcp_options *go = &ipcp_gotoptions[f->unit];
u_char cimaxslotindex, ciflag, cilen;
u_short cishort;
- u_long cilong;
+ u_int32_t cilong;
ipcp_options try; /* options to request next time */
try = *go;
len >= (cilen = old? CILEN_ADDRS: CILEN_ADDR) && \
p[1] == cilen && \
p[0] == opt) { \
- u_long l; \
+ u_int32_t l; \
len -= cilen; \
INCPTR(2, p); \
GETLONG(l, p); \
u_char *cip, *next; /* Pointer to current and next CIs */
u_short cilen, citype; /* Parsed len, type */
u_short cishort; /* Parsed short value */
- u_long tl, ciaddr1, ciaddr2;/* Parsed address values */
+ u_int32_t tl, ciaddr1, ciaddr2;/* Parsed address values */
int rc = CONFACK; /* Final packet return code */
int orc; /* Individual option return code */
u_char *p; /* Pointer to next char to parse */
ipcp_up(f)
fsm *f;
{
- u_long mask;
+ u_int32_t mask;
ipcp_options *ho = &ipcp_hisoptions[f->unit];
ipcp_options *go = &ipcp_gotoptions[f->unit];
ipcp_down(f)
fsm *f;
{
- u_long ouraddr, hisaddr;
+ u_int32_t ouraddr, hisaddr;
IPCPDEBUG((LOG_INFO, "ipcp: down"));
int code, id, len, olen;
u_char *pstart, *optend;
u_short cishort;
- u_long cilong;
+ u_int32_t cilong;
if (plen < HEADERLEN)
return 0;