mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 07:33:11 +00:00
PPP, CCP, added receive and transmit chosen protocols in ccp_flags_set() (renamed ccp_set())
We need to know which methods were chosen when CCP is up, this used to be done using ccp_test() which we are in the process of removing. Using non-existing method 0 instead of -1 in CCP for unset method, allowing type change from s16_t to u8_t for method.
This commit is contained in:
parent
a5503df32b
commit
ffb10e7aac
@ -152,7 +152,7 @@ typedef struct ccp_options {
|
||||
#if DEFLATE_SUPPORT
|
||||
u_short deflate_size; /* lg(window size) for Deflate */
|
||||
#endif /* DEFLATE_SUPPORT */
|
||||
short method; /* code for chosen compression method */
|
||||
u8_t method; /* code for chosen compression method */
|
||||
} ccp_options;
|
||||
|
||||
extern const struct protent ccp_protent;
|
||||
|
@ -475,7 +475,7 @@ int netif_get_mtu(ppp_pcb *pcb);
|
||||
|
||||
#if CCP_SUPPORT
|
||||
int ccp_test(ppp_pcb *pcb, u_char *opt_ptr, int opt_len, int for_transmit);
|
||||
void ccp_flags_set(ppp_pcb *pcb, int isopen, int isup);
|
||||
void ccp_set(ppp_pcb *pcb, u8_t isopen, u8_t isup, u8_t receive_method, u8_t transmit_method);
|
||||
int ccp_fatal_error(ppp_pcb *pcb);
|
||||
#endif /* CCP_SUPPORT */
|
||||
|
||||
|
@ -420,7 +420,7 @@ static void ccp_open(ppp_pcb *pcb) {
|
||||
ccp_options *go = &pcb->ccp_gotoptions;
|
||||
|
||||
if (f->state != PPP_FSM_OPENED)
|
||||
ccp_flags_set(pcb, 1, 0);
|
||||
ccp_set(pcb, 1, 0, 0, 0);
|
||||
|
||||
/*
|
||||
* Find out which compressors the kernel supports before
|
||||
@ -438,7 +438,7 @@ static void ccp_open(ppp_pcb *pcb) {
|
||||
*/
|
||||
static void ccp_close(ppp_pcb *pcb, const char *reason) {
|
||||
fsm *f = &pcb->ccp_fsm;
|
||||
ccp_flags_set(pcb, 0, 0);
|
||||
ccp_set(pcb, 0, 0, 0, 0);
|
||||
fsm_close(f, reason);
|
||||
}
|
||||
|
||||
@ -530,7 +530,7 @@ static void ccp_protrej(ppp_pcb *pcb) {
|
||||
ccp_options *go = &pcb->ccp_gotoptions;
|
||||
#endif /* MPPE_SUPPORT */
|
||||
|
||||
ccp_flags_set(pcb, 0, 0);
|
||||
ccp_set(pcb, 0, 0, 0, 0);
|
||||
fsm_lowerdown(f);
|
||||
|
||||
#if MPPE_SUPPORT
|
||||
@ -820,7 +820,7 @@ static void ccp_addci(fsm *f, u_char *p, int *lenp) {
|
||||
}
|
||||
#endif /* PREDICTOR_SUPPORT */
|
||||
|
||||
go->method = (p > p0)? p0[0]: -1;
|
||||
go->method = (p > p0)? p0[0]: 0;
|
||||
|
||||
*lenp = p - p0;
|
||||
}
|
||||
@ -1120,7 +1120,7 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) {
|
||||
len = *lenp;
|
||||
|
||||
memset(ho, 0, sizeof(ccp_options));
|
||||
ho->method = (len > 0)? p[0]: -1;
|
||||
ho->method = (len > 0)? p[0]: 0;
|
||||
|
||||
while (len > 0) {
|
||||
newret = CONFACK;
|
||||
@ -1459,7 +1459,7 @@ static void ccp_up(fsm *f) {
|
||||
ccp_options *ho = &pcb->ccp_hisoptions;
|
||||
char method1[64];
|
||||
|
||||
ccp_flags_set(pcb, 1, 1);
|
||||
ccp_set(pcb, 1, 1, go->method, ho->method);
|
||||
if (ccp_anycompress(go)) {
|
||||
if (ccp_anycompress(ho)) {
|
||||
if (go->method == ho->method) {
|
||||
@ -1492,7 +1492,7 @@ static void ccp_down(fsm *f) {
|
||||
if (pcb->ccp_localstate & RACK_PENDING)
|
||||
UNTIMEOUT(ccp_rack_timeout, f);
|
||||
pcb->ccp_localstate = 0;
|
||||
ccp_flags_set(pcb, 1, 0);
|
||||
ccp_set(pcb, 1, 0, 0, 0);
|
||||
#if MPPE_SUPPORT
|
||||
if (go->mppe) {
|
||||
go->mppe = 0;
|
||||
|
@ -114,7 +114,7 @@
|
||||
#endif /* EAP_SUPPORT */
|
||||
#if CCP_SUPPORT
|
||||
#include "netif/ppp/ccp.h"
|
||||
#endif /* EAP_SUPPORT */
|
||||
#endif /* CCP_SUPPORT */
|
||||
#if ECP_SUPPORT
|
||||
#include "netif/ppp/ecp.h"
|
||||
#endif /* EAP_SUPPORT */
|
||||
@ -1153,14 +1153,16 @@ ccp_test(ppp_pcb *pcb, u_char *opt_ptr, int opt_len, int for_transmit)
|
||||
}
|
||||
|
||||
/*
|
||||
* ccp_flags_set - inform about the current state of CCP.
|
||||
* ccp_set - inform about the current state of CCP.
|
||||
*/
|
||||
void
|
||||
ccp_flags_set(ppp_pcb *pcb, int isopen, int isup)
|
||||
ccp_set(ppp_pcb *pcb, u8_t isopen, u8_t isup, u8_t receive_method, u8_t transmit_method)
|
||||
{
|
||||
LWIP_UNUSED_ARG(pcb);
|
||||
LWIP_UNUSED_ARG(isopen);
|
||||
LWIP_UNUSED_ARG(isup);
|
||||
LWIP_UNUSED_ARG(receive_method);
|
||||
LWIP_UNUSED_ARG(transmit_method);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user