mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
PPP, adding const pragma to struct protent, saving about 200 bytes in .data segment
This commit is contained in:
parent
a0298728df
commit
9e4aa79278
@ -52,6 +52,6 @@ extern ccp_options ccp_gotoptions[];
|
|||||||
extern ccp_options ccp_allowoptions[];
|
extern ccp_options ccp_allowoptions[];
|
||||||
extern ccp_options ccp_hisoptions[];
|
extern ccp_options ccp_hisoptions[];
|
||||||
|
|
||||||
extern struct protent ccp_protent;
|
extern const struct protent ccp_protent;
|
||||||
|
|
||||||
#endif /* PPP_SUPPORT && CCP_SUPPORT */
|
#endif /* PPP_SUPPORT && CCP_SUPPORT */
|
||||||
|
@ -192,7 +192,7 @@ extern void chap_auth_peer(ppp_pcb *pcb, char *our_name, int digest_code);
|
|||||||
extern void chap_auth_with_peer(ppp_pcb *pcb, char *our_name, int digest_code);
|
extern void chap_auth_with_peer(ppp_pcb *pcb, char *our_name, int digest_code);
|
||||||
|
|
||||||
/* Represents the CHAP protocol to the main pppd code */
|
/* Represents the CHAP protocol to the main pppd code */
|
||||||
extern struct protent chap_protent;
|
extern const struct protent chap_protent;
|
||||||
|
|
||||||
#endif /* CHAP_H */
|
#endif /* CHAP_H */
|
||||||
#endif /* PPP_SUPPORT && CHAP_SUPPORT */
|
#endif /* PPP_SUPPORT && CHAP_SUPPORT */
|
||||||
|
@ -157,7 +157,7 @@ typedef struct eap_state {
|
|||||||
void eap_authwithpeer(ppp_pcb *pcb, char *localname);
|
void eap_authwithpeer(ppp_pcb *pcb, char *localname);
|
||||||
void eap_authpeer(ppp_pcb *pcb, char *localname);
|
void eap_authpeer(ppp_pcb *pcb, char *localname);
|
||||||
|
|
||||||
extern struct protent eap_protent;
|
extern const struct protent eap_protent;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,6 @@ extern ecp_options ecp_gotoptions[];
|
|||||||
extern ecp_options ecp_allowoptions[];
|
extern ecp_options ecp_allowoptions[];
|
||||||
extern ecp_options ecp_hisoptions[];
|
extern ecp_options ecp_hisoptions[];
|
||||||
|
|
||||||
extern struct protent ecp_protent;
|
extern const struct protent ecp_protent;
|
||||||
|
|
||||||
#endif /* PPP_SUPPORT && ECP_SUPPORT */
|
#endif /* PPP_SUPPORT && ECP_SUPPORT */
|
||||||
|
@ -101,7 +101,7 @@ typedef struct ipcp_options {
|
|||||||
char *ip_ntoa (u32_t);
|
char *ip_ntoa (u32_t);
|
||||||
#endif /* UNUSED, already defined by lwIP */
|
#endif /* UNUSED, already defined by lwIP */
|
||||||
|
|
||||||
extern struct protent ipcp_protent;
|
extern const struct protent ipcp_protent;
|
||||||
|
|
||||||
#endif /* IPCP_H */
|
#endif /* IPCP_H */
|
||||||
#endif /* PPP_SUPPORT */
|
#endif /* PPP_SUPPORT */
|
||||||
|
@ -173,7 +173,7 @@ typedef struct ipv6cp_options {
|
|||||||
eui64_t ourid, hisid; /* Interface identifiers */
|
eui64_t ourid, hisid; /* Interface identifiers */
|
||||||
} ipv6cp_options;
|
} ipv6cp_options;
|
||||||
|
|
||||||
extern struct protent ipv6cp_protent;
|
extern const struct protent ipv6cp_protent;
|
||||||
|
|
||||||
#endif /* IPV6CP_H */
|
#endif /* IPV6CP_H */
|
||||||
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */
|
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */
|
||||||
|
@ -164,7 +164,7 @@ void lcp_lowerup(ppp_pcb *pcb);
|
|||||||
void lcp_lowerdown(ppp_pcb *pcb);
|
void lcp_lowerdown(ppp_pcb *pcb);
|
||||||
void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len); /* send protocol reject */
|
void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len); /* send protocol reject */
|
||||||
|
|
||||||
extern struct protent lcp_protent;
|
extern const struct protent lcp_protent;
|
||||||
|
|
||||||
/* Default number of times we receive our magic number from the peer
|
/* Default number of times we receive our magic number from the peer
|
||||||
before deciding the link is looped-back. */
|
before deciding the link is looped-back. */
|
||||||
|
@ -295,7 +295,7 @@ struct protent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Table of pointers to supported protocols */
|
/* Table of pointers to supported protocols */
|
||||||
extern struct protent *protocols[];
|
extern const struct protent* const protocols[];
|
||||||
|
|
||||||
|
|
||||||
/* Values for auth_pending, auth_done */
|
/* Values for auth_pending, auth_done */
|
||||||
|
@ -120,7 +120,7 @@ void upap_authwithpeer(ppp_pcb *pcb, char *user, char *password);
|
|||||||
void upap_authpeer(ppp_pcb *pcb);
|
void upap_authpeer(ppp_pcb *pcb);
|
||||||
#endif /* PPP_SERVER */
|
#endif /* PPP_SERVER */
|
||||||
|
|
||||||
extern struct protent pap_protent;
|
extern const struct protent pap_protent;
|
||||||
|
|
||||||
#endif /* UPAP_H */
|
#endif /* UPAP_H */
|
||||||
#endif /* PPP_SUPPORT && PAP_SUPPORT */
|
#endif /* PPP_SUPPORT && PAP_SUPPORT */
|
||||||
|
@ -709,7 +709,7 @@ void link_down(ppp_pcb *pcb) {
|
|||||||
|
|
||||||
void upper_layers_down(ppp_pcb *pcb) {
|
void upper_layers_down(ppp_pcb *pcb) {
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
|
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
||||||
if (!protp->enabled_flag)
|
if (!protp->enabled_flag)
|
||||||
@ -735,7 +735,7 @@ void link_established(ppp_pcb *pcb) {
|
|||||||
#endif /* PPP_SERVER */
|
#endif /* PPP_SERVER */
|
||||||
lcp_options *ho = &pcb->lcp_hisoptions;
|
lcp_options *ho = &pcb->lcp_hisoptions;
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
#if PPP_SERVER
|
#if PPP_SERVER
|
||||||
int errcode;
|
int errcode;
|
||||||
#endif /* PPP_SERVER */
|
#endif /* PPP_SERVER */
|
||||||
@ -908,7 +908,7 @@ static void network_phase(ppp_pcb *pcb) {
|
|||||||
void start_networks(ppp_pcb *pcb) {
|
void start_networks(ppp_pcb *pcb) {
|
||||||
#if CCP_SUPPORT || ECP_SUPPORT
|
#if CCP_SUPPORT || ECP_SUPPORT
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
#endif /* CCP_SUPPORT || ECP_SUPPORT */
|
#endif /* CCP_SUPPORT || ECP_SUPPORT */
|
||||||
#if ECP_SUPPORT
|
#if ECP_SUPPORT
|
||||||
int ecp_required;
|
int ecp_required;
|
||||||
@ -974,7 +974,7 @@ void start_networks(ppp_pcb *pcb) {
|
|||||||
|
|
||||||
void continue_networks(ppp_pcb *pcb) {
|
void continue_networks(ppp_pcb *pcb) {
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start the "real" network protocols.
|
* Start the "real" network protocols.
|
||||||
|
@ -180,7 +180,7 @@ static int ccp_printpkt (u_char *pkt, int len,
|
|||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
static void ccp_datainput (int unit, u_char *pkt, int len);
|
static void ccp_datainput (int unit, u_char *pkt, int len);
|
||||||
|
|
||||||
struct protent ccp_protent = {
|
const struct protent ccp_protent = {
|
||||||
PPP_CCP,
|
PPP_CCP,
|
||||||
ccp_init,
|
ccp_init,
|
||||||
ccp_input,
|
ccp_input,
|
||||||
|
@ -634,7 +634,7 @@ static int chap_print_pkt(unsigned char *p, int plen,
|
|||||||
}
|
}
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
|
|
||||||
struct protent chap_protent = {
|
const struct protent chap_protent = {
|
||||||
PPP_CHAP,
|
PPP_CHAP,
|
||||||
chap_init,
|
chap_init,
|
||||||
chap_input,
|
chap_input,
|
||||||
|
@ -83,7 +83,7 @@ void
|
|||||||
demand_conf()
|
demand_conf()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
|
|
||||||
/* framemax = lcp_allowoptions[0].mru;
|
/* framemax = lcp_allowoptions[0].mru;
|
||||||
if (framemax < PPP_MRU) */
|
if (framemax < PPP_MRU) */
|
||||||
@ -128,7 +128,7 @@ void
|
|||||||
demand_block()
|
demand_block()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
|
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->enabled_flag && protp->demand_conf != NULL)
|
if (protp->enabled_flag && protp->demand_conf != NULL)
|
||||||
@ -145,7 +145,7 @@ demand_discard()
|
|||||||
{
|
{
|
||||||
struct packet *pkt, *nextpkt;
|
struct packet *pkt, *nextpkt;
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
|
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->enabled_flag && protp->demand_conf != NULL)
|
if (protp->enabled_flag && protp->demand_conf != NULL)
|
||||||
@ -171,7 +171,7 @@ void
|
|||||||
demand_unblock()
|
demand_unblock()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
|
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->enabled_flag && protp->demand_conf != NULL)
|
if (protp->enabled_flag && protp->demand_conf != NULL)
|
||||||
@ -436,7 +436,7 @@ active_packet(p, len)
|
|||||||
int len;
|
int len;
|
||||||
{
|
{
|
||||||
int proto, i;
|
int proto, i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
|
|
||||||
if (len < PPP_HDRLEN)
|
if (len < PPP_HDRLEN)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -111,7 +111,7 @@ static int eap_printpkt(u_char *inp, int inlen,
|
|||||||
void (*)(void *arg, char *fmt, ...), void *arg);
|
void (*)(void *arg, char *fmt, ...), void *arg);
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
|
|
||||||
struct protent eap_protent = {
|
const struct protent eap_protent = {
|
||||||
PPP_EAP, /* protocol number */
|
PPP_EAP, /* protocol number */
|
||||||
eap_init, /* initialization procedure */
|
eap_init, /* initialization procedure */
|
||||||
eap_input, /* process a received packet */
|
eap_input, /* process a received packet */
|
||||||
|
@ -99,7 +99,7 @@ static int ecp_printpkt (u_char *pkt, int len,
|
|||||||
static void ecp_datainput (int unit, u_char *pkt, int len);
|
static void ecp_datainput (int unit, u_char *pkt, int len);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct protent ecp_protent = {
|
const struct protent ecp_protent = {
|
||||||
PPP_ECP,
|
PPP_ECP,
|
||||||
ecp_init,
|
ecp_init,
|
||||||
NULL, /* ecp_input, */
|
NULL, /* ecp_input, */
|
||||||
|
@ -278,7 +278,7 @@ static int ip_active_pkt (u_char *, int);
|
|||||||
static void create_resolv (u32_t, u32_t);
|
static void create_resolv (u32_t, u32_t);
|
||||||
#endif /* UNUSED */
|
#endif /* UNUSED */
|
||||||
|
|
||||||
struct protent ipcp_protent = {
|
const struct protent ipcp_protent = {
|
||||||
PPP_IPCP,
|
PPP_IPCP,
|
||||||
ipcp_init,
|
ipcp_init,
|
||||||
ipcp_input,
|
ipcp_input,
|
||||||
|
@ -274,7 +274,7 @@ static int ipv6cp_printpkt(u_char *p, int plen,
|
|||||||
static int ipv6_active_pkt(u_char *pkt, int len);
|
static int ipv6_active_pkt(u_char *pkt, int len);
|
||||||
#endif /* PPP_DEMAND */
|
#endif /* PPP_DEMAND */
|
||||||
|
|
||||||
struct protent ipv6cp_protent = {
|
const struct protent ipv6cp_protent = {
|
||||||
PPP_IPV6CP,
|
PPP_IPV6CP,
|
||||||
ipv6cp_init,
|
ipv6cp_init,
|
||||||
ipv6cp_input,
|
ipv6cp_input,
|
||||||
|
@ -272,7 +272,7 @@ static int lcp_printpkt(u_char *p, int plen,
|
|||||||
void (*printer) (void *, char *, ...), void *arg);
|
void (*printer) (void *, char *, ...), void *arg);
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
|
|
||||||
struct protent lcp_protent = {
|
const struct protent lcp_protent = {
|
||||||
PPP_LCP,
|
PPP_LCP,
|
||||||
lcp_init,
|
lcp_init,
|
||||||
lcp_input,
|
lcp_input,
|
||||||
@ -592,7 +592,7 @@ static int lcp_extcode(fsm *f, int code, int id, u_char *inp, int len) {
|
|||||||
*/
|
*/
|
||||||
static void lcp_rprotrej(fsm *f, u_char *inp, int len) {
|
static void lcp_rprotrej(fsm *f, u_char *inp, int len) {
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
u_short prot;
|
u_short prot;
|
||||||
#if PPP_PROTOCOLNAME
|
#if PPP_PROTOCOLNAME
|
||||||
const char *pname;
|
const char *pname;
|
||||||
|
@ -152,7 +152,7 @@ int link_stats_valid;
|
|||||||
* One entry per supported protocol.
|
* One entry per supported protocol.
|
||||||
* The last entry must be NULL.
|
* The last entry must be NULL.
|
||||||
*/
|
*/
|
||||||
struct protent *protocols[] = {
|
const struct protent* const protocols[] = {
|
||||||
&lcp_protent,
|
&lcp_protent,
|
||||||
#if PAP_SUPPORT
|
#if PAP_SUPPORT
|
||||||
&pap_protent,
|
&pap_protent,
|
||||||
@ -599,7 +599,7 @@ int ppp_delete(ppp_pcb *pcb) {
|
|||||||
|
|
||||||
/* Set a PPP PCB to its initial state */
|
/* Set a PPP PCB to its initial state */
|
||||||
static void ppp_clear(ppp_pcb *pcb) {
|
static void ppp_clear(ppp_pcb *pcb) {
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
LWIP_ASSERT("pcb->phase == PHASE_DEAD || pcb->phase == PHASE_HOLDOFF", pcb->phase == PHASE_DEAD || pcb->phase == PHASE_HOLDOFF);
|
LWIP_ASSERT("pcb->phase == PHASE_DEAD || pcb->phase == PHASE_HOLDOFF", pcb->phase == PHASE_DEAD || pcb->phase == PHASE_HOLDOFF);
|
||||||
@ -769,7 +769,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
default: {
|
default: {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
/*
|
/*
|
||||||
* Upcall the proper protocol input routine.
|
* Upcall the proper protocol input routine.
|
||||||
*/
|
*/
|
||||||
|
@ -89,7 +89,7 @@ static void upap_protrej(ppp_pcb *pcb);
|
|||||||
static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, char *, ...), void *arg);
|
static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, char *, ...), void *arg);
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
|
|
||||||
struct protent pap_protent = {
|
const struct protent pap_protent = {
|
||||||
PPP_PAP,
|
PPP_PAP,
|
||||||
upap_init,
|
upap_init,
|
||||||
upap_input,
|
upap_input,
|
||||||
|
@ -455,7 +455,7 @@ static void ppp_format_packet(u_char *p, int len,
|
|||||||
void (*printer) (void *, char *, ...), void *arg) {
|
void (*printer) (void *, char *, ...), void *arg) {
|
||||||
int i, n;
|
int i, n;
|
||||||
u_short proto;
|
u_short proto;
|
||||||
struct protent *protp;
|
const struct protent *protp;
|
||||||
|
|
||||||
if (len >= 2) {
|
if (len >= 2) {
|
||||||
GETSHORT(proto, p);
|
GETSHORT(proto, p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user