From 9116b7e8f8ad4576b0c7456d1911f1c490d76754 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 13 Apr 2010 13:58:12 -0500 Subject: [PATCH] ppp: Let the upper layer handle open / up events This removes the need for the layer_started functions in lcp and ipcp. For LCP the link is always up unless the socket has been closed, and for IPCP the link should be opened as soon as LCP is ready anyway. --- gatchat/gatppp.c | 2 ++ gatchat/ppp_ipcp.c | 9 --------- gatchat/ppp_lcp.c | 10 ---------- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c index 0813435c..9f082618 100644 --- a/gatchat/gatppp.c +++ b/gatchat/gatppp.c @@ -385,6 +385,7 @@ static void ppp_transition_phase(GAtPPP *ppp, enum ppp_phase phase) /* bring network phase up */ ppp_net_open(ppp->net); pppcp_signal_open(ppp->ipcp); + pppcp_signal_up(ppp->ipcp); break; } } @@ -481,6 +482,7 @@ void g_at_ppp_open(GAtPPP *ppp) { /* send an open event to the lcp layer */ pppcp_signal_open(ppp->lcp); + pppcp_signal_up(ppp->lcp); } void g_at_ppp_set_credentials(GAtPPP *ppp, const char *username, diff --git a/gatchat/ppp_ipcp.c b/gatchat/ppp_ipcp.c index 74e7778f..f695079e 100644 --- a/gatchat/ppp_ipcp.c +++ b/gatchat/ppp_ipcp.c @@ -149,14 +149,6 @@ static void ipcp_down(struct pppcp_data *pppcp) pppcp_set_local_options(pppcp, ipcp->options, ipcp->options_len); } -/* - * Tell the protocol to start the handshake - */ -static void ipcp_started(struct pppcp_data *data) -{ - pppcp_signal_up(data); -} - static void ipcp_finished(struct pppcp_data *pppcp) { } @@ -300,7 +292,6 @@ struct pppcp_proto ipcp_proto = { .supported_codes = IPCP_SUPPORTED_CODES, .this_layer_up = ipcp_up, .this_layer_down = ipcp_down, - .this_layer_started = ipcp_started, .this_layer_finished = ipcp_finished, .rca = ipcp_rca, .rcn_nak = ipcp_rcn_nak, diff --git a/gatchat/ppp_lcp.c b/gatchat/ppp_lcp.c index b37aae1c..daa39071 100644 --- a/gatchat/ppp_lcp.c +++ b/gatchat/ppp_lcp.c @@ -117,15 +117,6 @@ static void lcp_down(struct pppcp_data *pppcp) pppcp_set_local_options(pppcp, lcp->options, lcp->options_len); } -/* - * Indicate that the lower layer is now needed - * Should trigger Up event - */ -static void lcp_started(struct pppcp_data *pppcp) -{ - ppp_generate_event(pppcp_get_ppp(pppcp), PPP_UP); -} - /* * Indicate that the lower layer is not needed * Should trigger Down event @@ -233,7 +224,6 @@ struct pppcp_proto lcp_proto = { .supported_codes = LCP_SUPPORTED_CODES, .this_layer_up = lcp_up, .this_layer_down = lcp_down, - .this_layer_started = lcp_started, .this_layer_finished = lcp_finished, .rca = lcp_rca, .rcn_nak = lcp_rcn_nak,