mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-23 01:21:33 +00:00
print packet functions are now optional
This commit is contained in:
parent
cf18e0776d
commit
2c4bd7162f
@ -176,9 +176,11 @@ static void ccp_lowerup __P((int unit));
|
||||
static void ccp_lowerdown __P((int));
|
||||
static void ccp_input __P((int unit, u_char *pkt, int len));
|
||||
static void ccp_protrej __P((int unit));
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int ccp_printpkt __P((u_char *pkt, int len,
|
||||
void (*printer) __P((void *, char *, ...)),
|
||||
void *arg));
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
static void ccp_datainput __P((int unit, u_char *pkt, int len));
|
||||
|
||||
struct protent ccp_protent = {
|
||||
@ -190,7 +192,9 @@ struct protent ccp_protent = {
|
||||
ccp_lowerdown,
|
||||
ccp_open,
|
||||
ccp_close,
|
||||
#if PRINTPKT_SUPPORT
|
||||
ccp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
ccp_datainput,
|
||||
1,
|
||||
"CCP",
|
||||
@ -1484,6 +1488,7 @@ ccp_down(f)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
/*
|
||||
* Print the contents of a CCP packet.
|
||||
*/
|
||||
@ -1614,6 +1619,7 @@ ccp_printpkt(p, plen, printer, arg)
|
||||
|
||||
return p - p0;
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
/*
|
||||
* We have received a packet that the decompressor failed to
|
||||
|
@ -135,8 +135,10 @@ static void chap_handle_status(struct chap_client_state *cs, int code, int id,
|
||||
unsigned char *pkt, int len);
|
||||
static void chap_protrej(int unit);
|
||||
static void chap_input(int unit, unsigned char *pkt, int pktlen);
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int chap_print_pkt(unsigned char *p, int plen,
|
||||
void (*printer) __P((void *, char *, ...)), void *arg);
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
/* List of digest types that we know about */
|
||||
static struct chap_digest_type *chap_digests;
|
||||
@ -589,6 +591,7 @@ chap_protrej(int unit)
|
||||
}
|
||||
}
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
/*
|
||||
* chap_print_pkt - print the contents of a CHAP packet.
|
||||
*/
|
||||
@ -650,6 +653,7 @@ chap_print_pkt(unsigned char *p, int plen,
|
||||
|
||||
return len + CHAP_HDRLEN;
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
struct protent chap_protent = {
|
||||
PPP_CHAP,
|
||||
@ -660,7 +664,9 @@ struct protent chap_protent = {
|
||||
chap_lowerdown,
|
||||
NULL, /* open */
|
||||
NULL, /* close */
|
||||
#if PRINTPKT_SUPPORT
|
||||
chap_print_pkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL, /* datainput */
|
||||
1, /* enabled_flag */
|
||||
"CHAP", /* name */
|
||||
|
@ -101,8 +101,10 @@ static void eap_input __P((int unit, u_char *inp, int inlen));
|
||||
static void eap_protrej __P((int unit));
|
||||
static void eap_lowerup __P((int unit));
|
||||
static void eap_lowerdown __P((int unit));
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int eap_printpkt __P((u_char *inp, int inlen,
|
||||
void (*)(void *arg, char *fmt, ...), void *arg));
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
struct protent eap_protent = {
|
||||
PPP_EAP, /* protocol number */
|
||||
@ -113,7 +115,9 @@ struct protent eap_protent = {
|
||||
eap_lowerdown, /* lower layer has gone down */
|
||||
NULL, /* open the protocol */
|
||||
NULL, /* close the protocol */
|
||||
#if PRINTPKT_SUPPORT
|
||||
eap_printpkt, /* print a packet in readable form */
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL, /* process a received data packet */
|
||||
1, /* protocol enabled */
|
||||
"EAP", /* text name of protocol */
|
||||
@ -2122,6 +2126,7 @@ int inlen;
|
||||
}
|
||||
}
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
/*
|
||||
* eap_printpkt - print the contents of an EAP packet.
|
||||
*/
|
||||
@ -2423,4 +2428,6 @@ void *arg;
|
||||
|
||||
return (inp - pstart);
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
#endif /* PPP_SUPPORT && EAP_SUPPORT */
|
||||
|
@ -93,9 +93,11 @@ static void ecp_lowerdown __P((int));
|
||||
static void ecp_input __P((int unit, u_char *pkt, int len));
|
||||
static void ecp_protrej __P((int unit));
|
||||
*/
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int ecp_printpkt __P((u_char *pkt, int len,
|
||||
void (*printer) __P((void *, char *, ...)),
|
||||
void *arg));
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
/*
|
||||
static void ecp_datainput __P((int unit, u_char *pkt, int len));
|
||||
*/
|
||||
@ -109,7 +111,9 @@ struct protent ecp_protent = {
|
||||
NULL, /* ecp_lowerdown, */
|
||||
NULL, /* ecp_open, */
|
||||
NULL, /* ecp_close, */
|
||||
#if PRINTPKT_SUPPORT
|
||||
ecp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL, /* ecp_datainput, */
|
||||
0,
|
||||
"ECP",
|
||||
@ -170,6 +174,7 @@ ecp_init(unit)
|
||||
}
|
||||
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int
|
||||
ecp_printpkt(p, plen, printer, arg)
|
||||
u_char *p;
|
||||
@ -179,5 +184,6 @@ ecp_printpkt(p, plen, printer, arg)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
#endif /* PPP_SUPPORT && ECP_SUPPORT */
|
||||
|
@ -256,8 +256,10 @@ static void ipcp_lowerup __P((int));
|
||||
static void ipcp_lowerdown __P((int));
|
||||
static void ipcp_input __P((int, u_char *, int));
|
||||
static void ipcp_protrej __P((int));
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int ipcp_printpkt __P((u_char *, int,
|
||||
void (*) __P((void *, char *, ...)), void *));
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
static void ip_check_options __P((void));
|
||||
#if DEMAND_SUPPORT
|
||||
static int ip_demand_conf __P((int));
|
||||
@ -274,7 +276,9 @@ struct protent ipcp_protent = {
|
||||
ipcp_lowerdown,
|
||||
ipcp_open,
|
||||
ipcp_close,
|
||||
#if PRINTPKT_SUPPORT
|
||||
ipcp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL,
|
||||
1,
|
||||
"IPCP",
|
||||
@ -2059,6 +2063,7 @@ create_resolv(peerdns1, peerdns2)
|
||||
/* FIXME: do we need to set here the DNS servers ? */
|
||||
}
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
/*
|
||||
* ipcp_printpkt - print the contents of an IPCP packet.
|
||||
*/
|
||||
@ -2185,7 +2190,9 @@ ipcp_printpkt(p, plen, printer, arg)
|
||||
|
||||
return p - pstart;
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
#if DEMAND_SUPPORT
|
||||
/*
|
||||
* ip_active_pkt - see if this IP packet is worth bringing the link up for.
|
||||
* We don't bring the link up for IP fragments or for TCP FIN packets
|
||||
@ -2199,7 +2206,6 @@ ipcp_printpkt(p, plen, printer, arg)
|
||||
#define TCP_HDRLEN 20
|
||||
#define TH_FIN 0x01
|
||||
|
||||
#if DEMAND_SUPPORT
|
||||
/*
|
||||
* We use these macros because the IP header may be at an odd address,
|
||||
* and some compilers might use word loads to get th_off or ip_hl.
|
||||
|
@ -264,8 +264,10 @@ static fsm_callbacks lcp_callbacks = { /* LCP callback routines */
|
||||
static void lcp_init __P((int));
|
||||
static void lcp_input __P((int, u_char *, int));
|
||||
static void lcp_protrej __P((int));
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int lcp_printpkt __P((u_char *, int,
|
||||
void (*) __P((void *, char *, ...)), void *));
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
struct protent lcp_protent = {
|
||||
PPP_LCP,
|
||||
@ -276,7 +278,9 @@ struct protent lcp_protent = {
|
||||
lcp_lowerdown,
|
||||
lcp_open,
|
||||
lcp_close,
|
||||
#if PRINTPKT_SUPPORT
|
||||
lcp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL,
|
||||
1,
|
||||
"LCP",
|
||||
@ -2249,6 +2253,7 @@ lcp_finished(f)
|
||||
}
|
||||
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
/*
|
||||
* lcp_printpkt - print the contents of an LCP packet.
|
||||
*/
|
||||
@ -2503,6 +2508,7 @@ lcp_printpkt(p, plen, printer, arg)
|
||||
|
||||
return p - pstart;
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
/*
|
||||
* Time to shut down the link because there is nothing out there.
|
||||
|
@ -422,10 +422,12 @@ struct protent {
|
||||
void (*open) __P((int unit));
|
||||
/* Close the protocol */
|
||||
void (*close) __P((int unit, char *reason));
|
||||
#if PRINTPKT_SUPPORT
|
||||
/* Print a packet in readable form */
|
||||
int (*printpkt) __P((u_char *pkt, int len,
|
||||
void (*printer) __P((void *, char *, ...)),
|
||||
void *arg));
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
/* Process a received data packet */
|
||||
void (*datainput) __P((int unit, u_char *pkt, int len));
|
||||
bool enabled_flag; /* 0 iff protocol is disabled */
|
||||
|
@ -84,8 +84,10 @@ static void upap_lowerup __P((int));
|
||||
static void upap_lowerdown __P((int));
|
||||
static void upap_input __P((int, u_char *, int));
|
||||
static void upap_protrej __P((int));
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int upap_printpkt __P((u_char *, int,
|
||||
void (*) __P((void *, char *, ...)), void *));
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
struct protent pap_protent = {
|
||||
PPP_PAP,
|
||||
@ -96,7 +98,9 @@ struct protent pap_protent = {
|
||||
upap_lowerdown,
|
||||
NULL,
|
||||
NULL,
|
||||
#if PRINTPKT_SUPPORT
|
||||
upap_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL,
|
||||
1,
|
||||
"PAP",
|
||||
@ -612,6 +616,7 @@ upap_sresp(u, code, id, msg, msglen)
|
||||
output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
|
||||
}
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
/*
|
||||
* upap_printpkt - print the contents of a PAP packet.
|
||||
*/
|
||||
@ -691,5 +696,6 @@ upap_printpkt(p, plen, printer, arg)
|
||||
|
||||
return p - pstart;
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
#endif /* PPP_SUPPORT && PAP_SUPPORT */
|
||||
|
@ -70,8 +70,10 @@ extern char *strerror();
|
||||
static void logit __P((int, char *, va_list));
|
||||
static void log_write __P((int, char *));
|
||||
static void vslp_printer __P((void *, char *, ...));
|
||||
#if PRINTPKT_SUPPORT
|
||||
static void format_packet __P((u_char *, int, void (*) (void *, char *, ...),
|
||||
void *));
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
struct buffer_info {
|
||||
char *ptr;
|
||||
@ -354,6 +356,7 @@ vslprintf(buf, buflen, fmt, args)
|
||||
OUTCHAR(c);
|
||||
}
|
||||
continue;
|
||||
#if PRINTPKT_SUPPORT
|
||||
case 'P': /* print PPP packet */
|
||||
bufinfo.ptr = buf;
|
||||
bufinfo.len = buflen + 1;
|
||||
@ -363,6 +366,7 @@ vslprintf(buf, buflen, fmt, args)
|
||||
buf = bufinfo.ptr;
|
||||
buflen = bufinfo.len - 1;
|
||||
continue;
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
case 'B':
|
||||
p = va_arg(args, unsigned char *);
|
||||
for (n = prec; n > 0; --n) {
|
||||
@ -469,6 +473,7 @@ log_packet(p, len, prefix, level)
|
||||
}
|
||||
#endif /* unused */
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
/*
|
||||
* format_packet - make a readable representation of a packet,
|
||||
* calling `printer(arg, format, ...)' to output it.
|
||||
@ -518,6 +523,7 @@ format_packet(p, len, printer, arg)
|
||||
else
|
||||
printer(arg, "%.*B", len, p);
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
/*
|
||||
* init_pr_log, end_pr_log - initialize and finish use of pr_log.
|
||||
|
Loading…
x
Reference in New Issue
Block a user