mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-13 02:05:43 +00:00
PPP, CORE, Removed useless enabled_flag from struct protent
Our struct protent are const everywhere to save RAM, enable/disable flag on a const struct is useless, saving some flash, removed.
This commit is contained in:
parent
730529353d
commit
b71d9ce3f6
@ -285,7 +285,6 @@ struct protent {
|
|||||||
*/
|
*/
|
||||||
/* Process a received data packet */
|
/* Process a received data packet */
|
||||||
void (*datainput) (ppp_pcb *pcb, u_char *pkt, int len);
|
void (*datainput) (ppp_pcb *pcb, u_char *pkt, int len);
|
||||||
u8_t enabled_flag; /* 0 if protocol is disabled */
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
const char *name; /* Text name of protocol */
|
const char *name; /* Text name of protocol */
|
||||||
const char *data_name; /* Text name of corresponding data protocol */
|
const char *data_name; /* Text name of corresponding data protocol */
|
||||||
|
@ -711,8 +711,6 @@ void upper_layers_down(ppp_pcb *pcb) {
|
|||||||
const 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)
|
|
||||||
continue;
|
|
||||||
if (protp->protocol != PPP_LCP && protp->lowerdown != NULL)
|
if (protp->protocol != PPP_LCP && protp->lowerdown != NULL)
|
||||||
(*protp->lowerdown)(pcb);
|
(*protp->lowerdown)(pcb);
|
||||||
if (protp->protocol < 0xC000 && protp->close != NULL)
|
if (protp->protocol < 0xC000 && protp->close != NULL)
|
||||||
@ -744,7 +742,7 @@ void link_established(ppp_pcb *pcb) {
|
|||||||
*/
|
*/
|
||||||
if (!doing_multilink) {
|
if (!doing_multilink) {
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->protocol != PPP_LCP && protp->enabled_flag
|
if (protp->protocol != PPP_LCP
|
||||||
&& protp->lowerup != NULL)
|
&& protp->lowerup != NULL)
|
||||||
(*protp->lowerup)(pcb);
|
(*protp->lowerup)(pcb);
|
||||||
}
|
}
|
||||||
@ -946,7 +944,7 @@ void start_networks(ppp_pcb *pcb) {
|
|||||||
|| protp->protocol == PPP_CCP
|
|| protp->protocol == PPP_CCP
|
||||||
#endif /* CCP_SUPPORT */
|
#endif /* CCP_SUPPORT */
|
||||||
)
|
)
|
||||||
&& protp->enabled_flag && protp->open != NULL)
|
&& protp->open != NULL)
|
||||||
(*protp->open)(pcb);
|
(*protp->open)(pcb);
|
||||||
#endif /* CCP_SUPPORT || ECP_SUPPORT */
|
#endif /* CCP_SUPPORT || ECP_SUPPORT */
|
||||||
|
|
||||||
@ -986,7 +984,7 @@ void continue_networks(ppp_pcb *pcb) {
|
|||||||
#if ECP_SUPPORT
|
#if ECP_SUPPORT
|
||||||
&& protp->protocol != PPP_ECP
|
&& protp->protocol != PPP_ECP
|
||||||
#endif /* ECP_SUPPORT */
|
#endif /* ECP_SUPPORT */
|
||||||
&& protp->enabled_flag && protp->open != NULL) {
|
&& protp->open != NULL) {
|
||||||
(*protp->open)(pcb);
|
(*protp->open)(pcb);
|
||||||
++pcb->num_np_open;
|
++pcb->num_np_open;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,6 @@ const struct protent ccp_protent = {
|
|||||||
ccp_printpkt,
|
ccp_printpkt,
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
ccp_datainput,
|
ccp_datainput,
|
||||||
1,
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
"CCP",
|
"CCP",
|
||||||
"Compressed",
|
"Compressed",
|
||||||
|
@ -652,7 +652,6 @@ const struct protent chap_protent = {
|
|||||||
chap_print_pkt,
|
chap_print_pkt,
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
NULL, /* datainput */
|
NULL, /* datainput */
|
||||||
1, /* enabled_flag */
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
"CHAP", /* name */
|
"CHAP", /* name */
|
||||||
NULL, /* data_name */
|
NULL, /* data_name */
|
||||||
|
@ -111,7 +111,7 @@ demand_conf()
|
|||||||
* Call the demand_conf procedure for each protocol that's got one.
|
* Call the demand_conf procedure for each protocol that's got one.
|
||||||
*/
|
*/
|
||||||
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->demand_conf != NULL)
|
||||||
((*protp->demand_conf)(pcb));
|
((*protp->demand_conf)(pcb));
|
||||||
/* FIXME: find a way to die() here */
|
/* FIXME: find a way to die() here */
|
||||||
#if 0
|
#if 0
|
||||||
@ -131,7 +131,7 @@ demand_block()
|
|||||||
const 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->demand_conf != NULL)
|
||||||
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_QUEUE);
|
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_QUEUE);
|
||||||
get_loop_output();
|
get_loop_output();
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ demand_discard()
|
|||||||
const 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->demand_conf != NULL)
|
||||||
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_ERROR);
|
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_ERROR);
|
||||||
get_loop_output();
|
get_loop_output();
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ demand_unblock()
|
|||||||
const 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->demand_conf != NULL)
|
||||||
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_PASS);
|
sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_PASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,8 +454,6 @@ active_packet(p, len)
|
|||||||
#endif
|
#endif
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
||||||
if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {
|
if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {
|
||||||
if (!protp->enabled_flag)
|
|
||||||
return 0;
|
|
||||||
if (protp->active_pkt == NULL)
|
if (protp->active_pkt == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
return (*protp->active_pkt)(p, len);
|
return (*protp->active_pkt)(p, len);
|
||||||
|
@ -124,7 +124,6 @@ const struct protent eap_protent = {
|
|||||||
eap_printpkt, /* print a packet in readable form */
|
eap_printpkt, /* print a packet in readable form */
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
NULL, /* process a received data packet */
|
NULL, /* process a received data packet */
|
||||||
1, /* protocol enabled */
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
"EAP", /* text name of protocol */
|
"EAP", /* text name of protocol */
|
||||||
NULL, /* text name of corresponding data protocol */
|
NULL, /* text name of corresponding data protocol */
|
||||||
|
@ -112,7 +112,6 @@ const struct protent ecp_protent = {
|
|||||||
ecp_printpkt,
|
ecp_printpkt,
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
NULL, /* ecp_datainput, */
|
NULL, /* ecp_datainput, */
|
||||||
0,
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
"ECP",
|
"ECP",
|
||||||
"Encrypted",
|
"Encrypted",
|
||||||
|
@ -291,7 +291,6 @@ const struct protent ipcp_protent = {
|
|||||||
ipcp_printpkt,
|
ipcp_printpkt,
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
NULL,
|
NULL,
|
||||||
1,
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
"IPCP",
|
"IPCP",
|
||||||
"IP",
|
"IP",
|
||||||
|
@ -284,7 +284,6 @@ const struct protent ipv6cp_protent = {
|
|||||||
ipv6cp_printpkt,
|
ipv6cp_printpkt,
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
NULL,
|
NULL,
|
||||||
1,
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
"IPV6CP",
|
"IPV6CP",
|
||||||
"IPV6",
|
"IPV6",
|
||||||
|
@ -285,7 +285,6 @@ const struct protent lcp_protent = {
|
|||||||
lcp_printpkt,
|
lcp_printpkt,
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
NULL,
|
NULL,
|
||||||
1,
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
"LCP",
|
"LCP",
|
||||||
NULL,
|
NULL,
|
||||||
@ -586,7 +585,7 @@ static void lcp_rprotrej(fsm *f, u_char *inp, int len) {
|
|||||||
* Upcall the proper Protocol-Reject routine.
|
* Upcall the proper Protocol-Reject routine.
|
||||||
*/
|
*/
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||||
if (protp->protocol == prot && protp->enabled_flag) {
|
if (protp->protocol == prot) {
|
||||||
#if PPP_PROTOCOLNAME
|
#if PPP_PROTOCOLNAME
|
||||||
if (pname != NULL)
|
if (pname != NULL)
|
||||||
ppp_dbglog("Protocol-Reject for '%s' (0x%x) received", pname,
|
ppp_dbglog("Protocol-Reject for '%s' (0x%x) received", pname,
|
||||||
|
@ -743,7 +743,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
* Upcall the proper protocol input routine.
|
* Upcall the proper protocol input routine.
|
||||||
*/
|
*/
|
||||||
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
||||||
if (protp->protocol == protocol && protp->enabled_flag) {
|
if (protp->protocol == protocol) {
|
||||||
pb = ppp_singlebuf(pb);
|
pb = ppp_singlebuf(pb);
|
||||||
(*protp->input)(pcb, (u_char*)pb->payload, pb->len);
|
(*protp->input)(pcb, (u_char*)pb->payload, pb->len);
|
||||||
goto out;
|
goto out;
|
||||||
@ -757,7 +757,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
* This is only used by CCP, which we cannot support until we have a CCP data
|
* This is only used by CCP, which we cannot support until we have a CCP data
|
||||||
* implementation.
|
* implementation.
|
||||||
*/
|
*/
|
||||||
if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag
|
if (protocol == (protp->protocol & ~0x8000)
|
||||||
&& protp->datainput != NULL) {
|
&& protp->datainput != NULL) {
|
||||||
(*protp->datainput)(pcb, pb->payload, pb->len);
|
(*protp->datainput)(pcb, pb->payload, pb->len);
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -102,7 +102,6 @@ const struct protent pap_protent = {
|
|||||||
upap_printpkt,
|
upap_printpkt,
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
NULL,
|
NULL,
|
||||||
1,
|
|
||||||
#if PRINTPKT_SUPPORT
|
#if PRINTPKT_SUPPORT
|
||||||
"PAP",
|
"PAP",
|
||||||
NULL,
|
NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user