mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-06 18:41:30 +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 */
|
||||
void (*datainput) (ppp_pcb *pcb, u_char *pkt, int len);
|
||||
u8_t enabled_flag; /* 0 if protocol is disabled */
|
||||
#if PRINTPKT_SUPPORT
|
||||
const char *name; /* Text name of 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;
|
||||
|
||||
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
||||
if (!protp->enabled_flag)
|
||||
continue;
|
||||
if (protp->protocol != PPP_LCP && protp->lowerdown != NULL)
|
||||
(*protp->lowerdown)(pcb);
|
||||
if (protp->protocol < 0xC000 && protp->close != NULL)
|
||||
@ -744,7 +742,7 @@ void link_established(ppp_pcb *pcb) {
|
||||
*/
|
||||
if (!doing_multilink) {
|
||||
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)(pcb);
|
||||
}
|
||||
@ -946,7 +944,7 @@ void start_networks(ppp_pcb *pcb) {
|
||||
|| protp->protocol == PPP_CCP
|
||||
#endif /* CCP_SUPPORT */
|
||||
)
|
||||
&& protp->enabled_flag && protp->open != NULL)
|
||||
&& protp->open != NULL)
|
||||
(*protp->open)(pcb);
|
||||
#endif /* CCP_SUPPORT || ECP_SUPPORT */
|
||||
|
||||
@ -986,7 +984,7 @@ void continue_networks(ppp_pcb *pcb) {
|
||||
#if ECP_SUPPORT
|
||||
&& protp->protocol != PPP_ECP
|
||||
#endif /* ECP_SUPPORT */
|
||||
&& protp->enabled_flag && protp->open != NULL) {
|
||||
&& protp->open != NULL) {
|
||||
(*protp->open)(pcb);
|
||||
++pcb->num_np_open;
|
||||
}
|
||||
|
@ -193,7 +193,6 @@ const struct protent ccp_protent = {
|
||||
ccp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
ccp_datainput,
|
||||
1,
|
||||
#if PRINTPKT_SUPPORT
|
||||
"CCP",
|
||||
"Compressed",
|
||||
|
@ -652,7 +652,6 @@ const struct protent chap_protent = {
|
||||
chap_print_pkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL, /* datainput */
|
||||
1, /* enabled_flag */
|
||||
#if PRINTPKT_SUPPORT
|
||||
"CHAP", /* name */
|
||||
NULL, /* data_name */
|
||||
|
@ -111,7 +111,7 @@ demand_conf()
|
||||
* Call the demand_conf procedure for each protocol that's got one.
|
||||
*/
|
||||
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));
|
||||
/* FIXME: find a way to die() here */
|
||||
#if 0
|
||||
@ -131,7 +131,7 @@ demand_block()
|
||||
const struct protent *protp;
|
||||
|
||||
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);
|
||||
get_loop_output();
|
||||
}
|
||||
@ -148,7 +148,7 @@ demand_discard()
|
||||
const struct protent *protp;
|
||||
|
||||
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);
|
||||
get_loop_output();
|
||||
|
||||
@ -174,7 +174,7 @@ demand_unblock()
|
||||
const struct protent *protp;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -454,8 +454,6 @@ active_packet(p, len)
|
||||
#endif
|
||||
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
||||
if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {
|
||||
if (!protp->enabled_flag)
|
||||
return 0;
|
||||
if (protp->active_pkt == NULL)
|
||||
return 1;
|
||||
return (*protp->active_pkt)(p, len);
|
||||
|
@ -124,7 +124,6 @@ const struct protent eap_protent = {
|
||||
eap_printpkt, /* print a packet in readable form */
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL, /* process a received data packet */
|
||||
1, /* protocol enabled */
|
||||
#if PRINTPKT_SUPPORT
|
||||
"EAP", /* text name of protocol */
|
||||
NULL, /* text name of corresponding data protocol */
|
||||
|
@ -112,7 +112,6 @@ const struct protent ecp_protent = {
|
||||
ecp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL, /* ecp_datainput, */
|
||||
0,
|
||||
#if PRINTPKT_SUPPORT
|
||||
"ECP",
|
||||
"Encrypted",
|
||||
|
@ -291,7 +291,6 @@ const struct protent ipcp_protent = {
|
||||
ipcp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL,
|
||||
1,
|
||||
#if PRINTPKT_SUPPORT
|
||||
"IPCP",
|
||||
"IP",
|
||||
|
@ -284,7 +284,6 @@ const struct protent ipv6cp_protent = {
|
||||
ipv6cp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL,
|
||||
1,
|
||||
#if PRINTPKT_SUPPORT
|
||||
"IPV6CP",
|
||||
"IPV6",
|
||||
|
@ -285,7 +285,6 @@ const struct protent lcp_protent = {
|
||||
lcp_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL,
|
||||
1,
|
||||
#if PRINTPKT_SUPPORT
|
||||
"LCP",
|
||||
NULL,
|
||||
@ -586,7 +585,7 @@ static void lcp_rprotrej(fsm *f, u_char *inp, int len) {
|
||||
* Upcall the proper Protocol-Reject routine.
|
||||
*/
|
||||
for (i = 0; (protp = protocols[i]) != NULL; ++i)
|
||||
if (protp->protocol == prot && protp->enabled_flag) {
|
||||
if (protp->protocol == prot) {
|
||||
#if PPP_PROTOCOLNAME
|
||||
if (pname != NULL)
|
||||
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.
|
||||
*/
|
||||
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
|
||||
if (protp->protocol == protocol && protp->enabled_flag) {
|
||||
if (protp->protocol == protocol) {
|
||||
pb = ppp_singlebuf(pb);
|
||||
(*protp->input)(pcb, (u_char*)pb->payload, pb->len);
|
||||
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
|
||||
* implementation.
|
||||
*/
|
||||
if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag
|
||||
if (protocol == (protp->protocol & ~0x8000)
|
||||
&& protp->datainput != NULL) {
|
||||
(*protp->datainput)(pcb, pb->payload, pb->len);
|
||||
goto out;
|
||||
|
@ -102,7 +102,6 @@ const struct protent pap_protent = {
|
||||
upap_printpkt,
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
NULL,
|
||||
1,
|
||||
#if PRINTPKT_SUPPORT
|
||||
"PAP",
|
||||
NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user