/*
* cbcp - Call Back Configuration Protocol.
*
* Copyright (c) 2000 by Sun Microsystems, Inc.
* All rights reserved.
*
* Copyright (c) 1995 Pedro Roque Marques
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by Pedro Roque Marques. The name of the author may not be used to
* endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include "pppd.h"
#include "cbcp.h"
#include "fsm.h"
#include "lcp.h"
#endif
/*
* Options.
*/
"Ask for callback" },
{ NULL }
};
/*
* Protocol entry points.
*/
void *arg));
PPP_CBCP, /* PPP protocol number */
cbcp_init, /* Initialization procedure */
cbcp_input, /* Process a received packet */
cbcp_protrej, /* Process a received protocol-reject */
cbcp_lowerup, /* Lower layer has come up */
NULL, /* Lower layer has gone down */
NULL, /* Open the protocol */
NULL, /* Close the protocol */
cbcp_printpkt, /* Print a packet in readable form */
NULL, /* Process a received data packet */
0, /* 0 iff protocol is disabled */
"CBCP", /* Text name of protocol */
NULL, /* Text name of corresponding data protocol */
cbcp_option_list, /* List of command-line options */
NULL, /* Check requested options, assign defaults */
NULL, /* Configure interface for demand-dial */
NULL /* Say whether to bring up link for this pkt */
};
/* Not static'd for plug-ins */
/* internal prototypes */
/* option processing */
/*ARGSUSED*/
static int
char **argv;
{
novm("callback number");
return (1);
}
/* init state */
static void
int unit;
{
}
/* lower layer is up */
static void
int unit;
{
if (debug) {
}
}
/* process an incoming packet */
static void
int unit;
int pktlen;
{
if (pktlen < CBCP_MINLEN) {
return;
}
return;
}
len -= CBCP_MINLEN;
switch (code) {
case CBCP_REQ:
break;
case CBCP_RESP:
if (debug)
dbglog("CBCP Response received; no request sent");
break;
case CBCP_ACK:
if (debug)
break;
}
break;
default:
if (debug)
break;
}
}
/* protocol was rejected by foe */
/*ARGSUSED*/
static void
{
}
static char *cbcp_codenames[] = {
"Request", "Response", "Ack"
};
static char *cbcp_optionnames[] = {
"NoCallback",
"UserDefined",
"AdminDefined",
"List"
};
/*
* Pretty print a packet. Return value is number of bytes parsed out
* of the packet and printed in some way. Caller (in util.c) will
* print the remainder of the packet.
*/
static int
u_char *p;
int plen;
void *arg;
{
return (0);
}
pstart = p;
else
return (HEADERLEN);
}
}
switch (code) {
case CBCP_REQ:
case CBCP_RESP:
case CBCP_ACK:
while (len >= 2) {
if (olen < 2)
break;
}
olen -= 2;
else
if (olen > 0) {
olen--;
}
while (olen > 0) {
olen--;
if (cichar != 1)
else
p += alen + 1;
}
}
default:
break;
}
if (len > 0) {
if (len > 8)
else
}
p += len;
return p - pstart;
}
/*
* received CBCP request.
* No reason to print packet contents in detail here, since enabling
* debug mode will cause the print routine above to be invoked.
*/
static void
cbcp_state *us;
int pcktlen;
{
us->us_allowed = 0;
while (len > 0) {
if (opt_len > 2) {
pckt++; /* ignore the delay time */
}
/*
* Careful; don't use left-shift operator on numbers that are
* too big.
*/
if (type > CB_CONF_LIST) {
if (debug)
continue;
}
switch (type) {
case CB_CONF_NO:
if (debug)
dbglog("CBCP: operation without callback allowed");
break;
case CB_CONF_USER:
if (debug)
dbglog("callback to user-specified number allowed");
break;
case CB_CONF_ADMIN:
if (debug)
dbglog("CBCP: callback to admin-defined address allowed");
break;
case CB_CONF_LIST:
if (debug)
dbglog("CBCP: callback to one out of list allowed");
break;
}
}
/* Now generate the response */
len = 0;
if (debug)
dbglog("CBCP Response: selecting user-specified number");
return;
}
if (debug)
dbglog("CBCP Response: selecting admin-specified number");
len = 3;
return;
}
if (debug)
dbglog("CBCP Response: selecting no-callback mode");
len = 3;
return;
}
if (debug)
dbglog("CBCP: no callback types in common");
}
static void
cbcp_state *us;
int code;
int len;
{
int outlen;
if (len > 0)
}
/*
* Received CBCP Acknowledgment message.
*/
static void
cbcp_state *us;
int len;
{
int opt_len;
if (len > 0) {
if (type == CB_CONF_NO) {
if (debug)
dbglog("CBCP: proceeding without callback");
return;
}
/* just ignore the delay time */
pckt++;
if (opt_len > 4) {
if (addr_type != 1)
}
}
persist = 0;
}