PPP: fix constness in PPP related files when PRINTPKT_SUPPORT is enabled

This commit is contained in:
Sylvain Rochet 2015-09-09 20:28:01 +02:00
parent 79e7201854
commit 41ee45d9f7
11 changed files with 26 additions and 26 deletions

View File

@ -101,7 +101,7 @@
/* The reverse of the above */ /* The reverse of the above */
#define MPPE_CI_TO_OPTS(ci, opts) \ #define MPPE_CI_TO_OPTS(ci, opts) \
do { \ do { \
u_char *ptr = ci; /* u_char[4] */ \ const u_char *ptr = ci; /* u_char[4] */ \
\ \
opts = 0; \ opts = 0; \
\ \

View File

@ -290,7 +290,7 @@ struct protent {
void (*close) (ppp_pcb *pcb, const char *reason); void (*close) (ppp_pcb *pcb, const char *reason);
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
/* Print a packet in readable form */ /* Print a packet in readable form */
int (*printpkt) (u_char *pkt, int len, int (*printpkt) (const u_char *pkt, int len,
void (*printer) (void *, const char *, ...), void (*printer) (void *, const char *, ...),
void *arg); void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */

View File

@ -173,7 +173,7 @@ static void ccp_lowerdown(ppp_pcb *pcb);
static void ccp_input(ppp_pcb *pcb, u_char *pkt, int len); static void ccp_input(ppp_pcb *pcb, u_char *pkt, int len);
static void ccp_protrej(ppp_pcb *pcb); static void ccp_protrej(ppp_pcb *pcb);
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int ccp_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); static int ccp_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
#if PPP_DATAINPUT #if PPP_DATAINPUT
static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len); static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len);
@ -1519,8 +1519,8 @@ static const char* const ccp_codenames[] = {
"ResetReq", "ResetAck", "ResetReq", "ResetAck",
}; };
static int ccp_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { static int ccp_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) {
u_char *p0, *optend; const u_char *p0, *optend;
int code, id, len; int code, id, len;
int optlen; int optlen;

View File

@ -104,7 +104,7 @@ static void chap_handle_status(ppp_pcb *pcb, int code, int id,
static void chap_protrej(ppp_pcb *pcb); static void chap_protrej(ppp_pcb *pcb);
static void chap_input(ppp_pcb *pcb, unsigned char *pkt, int pktlen); static void chap_input(ppp_pcb *pcb, unsigned char *pkt, int pktlen);
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int chap_print_pkt(unsigned char *p, int plen, static int chap_print_pkt(const unsigned char *p, int plen,
void (*printer) (void *, const char *, ...), void *arg); void (*printer) (void *, const char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
@ -590,7 +590,7 @@ static const char* const chap_code_names[] = {
"Challenge", "Response", "Success", "Failure" "Challenge", "Response", "Success", "Failure"
}; };
static int chap_print_pkt(unsigned char *p, int plen, static int chap_print_pkt(const unsigned char *p, int plen,
void (*printer) (void *, const char *, ...), void *arg) { void (*printer) (void *, const char *, ...), void *arg) {
int code, id, len; int code, id, len;
int clen, nlen; int clen, nlen;

View File

@ -108,7 +108,7 @@ static void eap_protrej(ppp_pcb *pcb);
static void eap_lowerup(ppp_pcb *pcb); static void eap_lowerup(ppp_pcb *pcb);
static void eap_lowerdown(ppp_pcb *pcb); static void eap_lowerdown(ppp_pcb *pcb);
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int eap_printpkt(u_char *inp, int inlen, static int eap_printpkt(const u_char *inp, int inlen,
void (*)(void *arg, const char *fmt, ...), void *arg); void (*)(void *arg, const char *fmt, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
@ -2135,9 +2135,9 @@ static const char* const eap_typenames[] = {
"Cisco", "Nokia", "SRP" "Cisco", "Nokia", "SRP"
}; };
static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, const char *, ...), void *arg) { static int eap_printpkt(const u_char *inp, int inlen, void (*printer) (void *, const char *, ...), void *arg) {
int code, id, len, rtype, vallen; int code, id, len, rtype, vallen;
u_char *pstart; const u_char *pstart;
u32_t uval; u32_t uval;
if (inlen < EAP_HEADERLEN) if (inlen < EAP_HEADERLEN)

View File

@ -91,7 +91,7 @@ static void ecp_input (int unit, u_char *pkt, int len);
static void ecp_protrej (int unit); static void ecp_protrej (int unit);
*/ */
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int ecp_printpkt (u_char *pkt, int len, static int ecp_printpkt (const u_char *pkt, int len,
void (*printer) (void *, char *, ...), void (*printer) (void *, char *, ...),
void *arg); void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
@ -179,7 +179,7 @@ ecp_init(unit)
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int static int
ecp_printpkt(p, plen, printer, arg) ecp_printpkt(p, plen, printer, arg)
u_char *p; const u_char *p;
int plen; int plen;
void (*printer) (void *, char *, ...); void (*printer) (void *, char *, ...);
void *arg; void *arg;

View File

@ -264,7 +264,7 @@ static void ipcp_lowerdown(ppp_pcb *pcb);
static void ipcp_input(ppp_pcb *pcb, u_char *p, int len); static void ipcp_input(ppp_pcb *pcb, u_char *p, int len);
static void ipcp_protrej(ppp_pcb *pcb); static void ipcp_protrej(ppp_pcb *pcb);
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int ipcp_printpkt(u_char *p, int plen, static int ipcp_printpkt(const u_char *p, int plen,
void (*printer) (void *, const char *, ...), void *arg); void (*printer) (void *, const char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
#if PPP_OPTIONS #if PPP_OPTIONS
@ -2226,10 +2226,10 @@ static const char* const ipcp_codenames[] = {
"TermReq", "TermAck", "CodeRej" "TermReq", "TermAck", "CodeRej"
}; };
static int ipcp_printpkt(u_char *p, int plen, static int ipcp_printpkt(const u_char *p, int plen,
void (*printer) (void *, const char *, ...), void *arg) { void (*printer) (void *, const char *, ...), void *arg) {
int code, id, len, olen; int code, id, len, olen;
u_char *pstart, *optend; const u_char *pstart, *optend;
#if VJ_SUPPORT #if VJ_SUPPORT
u_short cishort; u_short cishort;
#endif /* VJ_SUPPORT */ #endif /* VJ_SUPPORT */

View File

@ -264,7 +264,7 @@ static void ipv6_check_options(void);
static int ipv6_demand_conf(int u); static int ipv6_demand_conf(int u);
#endif /* DEMAND_SUPPORT */ #endif /* DEMAND_SUPPORT */
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int ipv6cp_printpkt(u_char *p, int plen, static int ipv6cp_printpkt(const u_char *p, int plen,
void (*printer)(void *, const char *, ...), void *arg); void (*printer)(void *, const char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
#if DEMAND_SUPPORT #if DEMAND_SUPPORT
@ -1398,10 +1398,10 @@ static const char* const ipv6cp_codenames[] = {
"TermReq", "TermAck", "CodeRej" "TermReq", "TermAck", "CodeRej"
}; };
static int ipv6cp_printpkt(u_char *p, int plen, static int ipv6cp_printpkt(const u_char *p, int plen,
void (*printer)(void *, const char *, ...), void *arg) { void (*printer)(void *, const char *, ...), void *arg) {
int code, id, len, olen; int code, id, len, olen;
u_char *pstart, *optend; const u_char *pstart, *optend;
#ifdef IPV6CP_COMP #ifdef IPV6CP_COMP
u_short cishort; u_short cishort;
#endif /* IPV6CP_COMP */ #endif /* IPV6CP_COMP */

View File

@ -268,7 +268,7 @@ static void lcp_init(ppp_pcb *pcb);
static void lcp_input(ppp_pcb *pcb, u_char *p, int len); static void lcp_input(ppp_pcb *pcb, u_char *p, int len);
static void lcp_protrej(ppp_pcb *pcb); static void lcp_protrej(ppp_pcb *pcb);
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int lcp_printpkt(u_char *p, int plen, static int lcp_printpkt(const u_char *p, int plen,
void (*printer) (void *, const char *, ...), void *arg); void (*printer) (void *, const char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
@ -2377,10 +2377,10 @@ static const char* const lcp_codenames[] = {
"TimeRem" "TimeRem"
}; };
static int lcp_printpkt(u_char *p, int plen, static int lcp_printpkt(const u_char *p, int plen,
void (*printer) (void *, const char *, ...), void *arg) { void (*printer) (void *, const char *, ...), void *arg) {
int code, id, len, olen, i; int code, id, len, olen, i;
u_char *pstart, *optend; const u_char *pstart, *optend;
u_short cishort; u_short cishort;
u32_t cilong; u32_t cilong;

View File

@ -86,7 +86,7 @@ static void upap_lowerdown(ppp_pcb *pcb);
static void upap_input(ppp_pcb *pcb, u_char *inpacket, int l); static void upap_input(ppp_pcb *pcb, u_char *inpacket, int l);
static void upap_protrej(ppp_pcb *pcb); static void upap_protrej(ppp_pcb *pcb);
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg); static int upap_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */ #endif /* PRINTPKT_SUPPORT */
const struct protent pap_protent = { const struct protent pap_protent = {
@ -599,11 +599,11 @@ static const char* const upap_codenames[] = {
"AuthReq", "AuthAck", "AuthNak" "AuthReq", "AuthAck", "AuthNak"
}; };
static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) { static int upap_printpkt(const u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg) {
int code, id, len; int code, id, len;
int mlen, ulen, wlen; int mlen, ulen, wlen;
char *user, *pwd, *msg; char *user, *pwd, *msg;
u_char *pstart; const u_char *pstart;
if (plen < UPAP_HEADERLEN) if (plen < UPAP_HEADERLEN)
return 0; return 0;

View File

@ -73,7 +73,7 @@ static void ppp_logit(int level, const char *fmt, va_list args);
static void ppp_log_write(int level, char *buf); static void ppp_log_write(int level, char *buf);
#if PRINTPKT_SUPPORT #if PRINTPKT_SUPPORT
static void ppp_vslp_printer(void *arg, const char *fmt, ...); static void ppp_vslp_printer(void *arg, const char *fmt, ...);
static void ppp_format_packet(u_char *p, int len, static void ppp_format_packet(const u_char *p, int len,
void (*printer) (void *, const char *, ...), void *arg); void (*printer) (void *, const char *, ...), void *arg);
struct buffer_info { struct buffer_info {
@ -443,7 +443,7 @@ log_packet(p, len, prefix, level)
* ppp_format_packet - make a readable representation of a packet, * ppp_format_packet - make a readable representation of a packet,
* calling `printer(arg, format, ...)' to output it. * calling `printer(arg, format, ...)' to output it.
*/ */
static void ppp_format_packet(u_char *p, int len, static void ppp_format_packet(const u_char *p, int len,
void (*printer) (void *, const char *, ...), void *arg) { void (*printer) (void *, const char *, ...), void *arg) {
int i, n; int i, n;
u_short proto; u_short proto;