PPP, fixed some compiler warnings

Using -Wall -pedantic -Wparentheses -Wsequence-point
-Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith
-Wbad-function-cast -Wc++-compat -Wwrite-strings -Wold-style-definition
-Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address
This commit is contained in:
Sylvain Rochet
2014-12-24 15:16:03 +01:00
parent 01391f0234
commit 2b3e020152
22 changed files with 272 additions and 177 deletions

View File

@@ -1927,6 +1927,13 @@
#define ECP_SUPPORT 0
#endif
/**
* DEMAND_SUPPORT==1: Support dial on demand. CURRENTLY NOT SUPPORTED! DO NOT SET!
*/
#ifndef DEMAND_SUPPORT
#define DEMAND_SUPPORT 0
#endif
/**
* LQR_SUPPORT==1: Support Link Quality Report. Do nothing except exchanging some LCP packets.
*/

View File

@@ -74,7 +74,7 @@
typedef struct fsm {
ppp_pcb *pcb; /* PPP Interface */
const struct fsm_callbacks *callbacks; /* Callback routines */
char *term_reason; /* Reason for closing protocol */
const char *term_reason; /* Reason for closing protocol */
u8_t seen_ack; /* Have received valid Ack/Nak/Rej to Req */
/* -- This is our only flag, we might use u_int :1 if we have more flags */
u16_t protocol; /* Data Link Layer Protocol field value */
@@ -120,7 +120,7 @@ typedef struct fsm_callbacks {
(fsm *);
int (*extcode) /* Called when unknown code received */
(fsm *, int, int, u_char *, int);
char *proto_name; /* String name for protocol (for messages) */
const char *proto_name; /* String name for protocol (for messages) */
} fsm_callbacks;
@@ -165,7 +165,7 @@ void fsm_init(fsm *f);
void fsm_lowerup(fsm *f);
void fsm_lowerdown(fsm *f);
void fsm_open(fsm *f);
void fsm_close(fsm *f, char *reason);
void fsm_close(fsm *f, const char *reason);
void fsm_input(fsm *f, u_char *inpacket, int l);
void fsm_protreject(fsm *f);
void fsm_sdata(fsm *f, u_char code, u_char id, u_char *data, int datalen);

View File

@@ -159,7 +159,7 @@ typedef struct lcp_options {
} lcp_options;
void lcp_open(ppp_pcb *pcb);
void lcp_close(ppp_pcb *pcb, char *reason);
void lcp_close(ppp_pcb *pcb, const char *reason);
void lcp_lowerup(ppp_pcb *pcb);
void lcp_lowerdown(ppp_pcb *pcb);
void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len); /* send protocol reject */

View File

@@ -53,6 +53,10 @@
#define PPP_OPTIONS 0
#endif
#ifndef PPP_NOTIFY
#define PPP_NOTIFY 0
#endif
#ifndef PPP_REMOTENAME
#define PPP_REMOTENAME 0
#endif
@@ -69,10 +73,6 @@
#define PPP_MAXCONNECT 0
#endif
#ifndef DEMAND_SUPPORT
#define DEMAND_SUPPORT 0
#endif
#ifndef PPP_ALLOWED_ADDRS
#define PPP_ALLOWED_ADDRS 0
#endif

View File

@@ -277,11 +277,11 @@ struct protent {
/* Open the protocol */
void (*open) (ppp_pcb *pcb);
/* Close the protocol */
void (*close) (ppp_pcb *pcb, char *reason);
void (*close) (ppp_pcb *pcb, const char *reason);
#if PRINTPKT_SUPPORT
/* Print a packet in readable form */
int (*printpkt) (u_char *pkt, int len,
void (*printer) (void *, char *, ...),
void (*printer) (void *, const char *, ...),
void *arg);
#endif /* PRINTPKT_SUPPORT */
/* FIXME: data input is only used by CCP, which is not supported at this time,
@@ -291,8 +291,8 @@ struct protent {
void (*datainput) (ppp_pcb *pcb, u_char *pkt, int len);
u8_t enabled_flag; /* 0 if protocol is disabled */
#if PRINTPKT_SUPPORT
char *name; /* Text name of protocol */
char *data_name; /* Text name of corresponding data protocol */
const char *name; /* Text name of protocol */
const char *data_name; /* Text name of corresponding data protocol */
#endif /* PRINTPKT_SUPPORT */
#if PPP_OPTIONS
option_t *options; /* List of command-line options */
@@ -552,17 +552,17 @@ int str_to_epdisc (struct epdisc *, char *); /* endpt disc. from str */
#endif
/* Procedures exported from utils.c. */
void ppp_print_string(char *p, int len, void (*printer) (void *, char *, ...), void *arg); /* Format a string for output */
int ppp_slprintf(char *buf, int buflen, char *fmt, ...); /* sprintf++ */
int ppp_vslprintf(char *buf, int buflen, char *fmt, va_list args); /* vsprintf++ */
void ppp_print_string(char *p, int len, void (*printer) (void *, const char *, ...), void *arg); /* Format a string for output */
int ppp_slprintf(char *buf, int buflen, const char *fmt, ...); /* sprintf++ */
int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args); /* vsprintf++ */
size_t ppp_strlcpy(char *dest, const char *src, size_t len); /* safe strcpy */
size_t ppp_strlcat(char *dest, const char *src, size_t len); /* safe strncpy */
void ppp_dbglog(char *fmt, ...); /* log a debug message */
void ppp_info(char *fmt, ...); /* log an informational message */
void ppp_notice(char *fmt, ...); /* log a notice-level message */
void ppp_warn(char *fmt, ...); /* log a warning message */
void ppp_error(char *fmt, ...); /* log an error message */
void ppp_fatal(char *fmt, ...); /* log an error message and die(1) */
void ppp_dbglog(const char *fmt, ...); /* log a debug message */
void ppp_info(const char *fmt, ...); /* log an informational message */
void ppp_notice(const char *fmt, ...); /* log a notice-level message */
void ppp_warn(const char *fmt, ...); /* log a warning message */
void ppp_error(const char *fmt, ...); /* log an error message */
void ppp_fatal(const char *fmt, ...); /* log an error message and die(1) */
#if PRINTPKT_SUPPORT
void ppp_dump_packet(const char *tag, unsigned char *p, int len);
/* dump packet to debug log if interesting */