In Linux ppp.c source code, I am specially interested in
ppp_async_encode( )
module, where I cannot grasp the meaning of some source codes
as shown below .
I would like to modify the encoding part for wireless applications.
If anybody can explain or cite some reference for the following
souce codes ,
it would be really appreciated.
Regards.
Shin, Byung-Cheol, Ph.D. T:+82-431-261-2389(O),HandPhone:+82-17-404-0239
Chungbuk National University,Korea; e.mail:[EMAIL PROTECTED]
http://mcr.chungbuk.ac.kr/people/bcshin.html (or http://mcr.chungbuk.ac.kr/~bcshin)
------------------------------------------------------------------
(1)
/*
* Start of a new packet - insert the leading FLAG
* character if necessary.
*/
if (islcp || flag_time == 0
|| jiffies - ppp->last_xmit >= flag_time)
*buf++ = PPP_FLAG;
< Question 1 >
* meaning of "flag_time == 0 " or
"jiffies - ppp->last_xmit >= flag_time" above :
(2)
/*
* Do address/control compression
*/
if ((ppp->flags & SC_COMP_AC) != 0 && !islcp
&& PPP_ADDRESS(data) == PPP_ALLSTATIONS
&& PPP_CONTROL(data) == PPP_UI)
i += 2;
<Question2 >
* role or meaning of " i += 2" above :
3)
/*
* Once we put in the last byte, we need to put in the FCS
* and closing flag, so make sure there is at least 7 bytes
* of free space in the output buffer.
*/
buflim = buf + OBUFSIZE - 6;
while (i < count && buf < buflim) {
c = data[i++];
if (i == 3 && c == 0 && (ppp->flags & SC_COMP_PROT))
continue; /* compress protocol field */
< Question3 >
*usual space requirement is FCS: 2 bytes, flag: 1 byte
-- why 7 bytes space in output buffer here?
* role/meaning of " c == 0 " ? Does it mean
there is no more data ?
4)
/ *
* We have finished the packet. Add the FCS and flag.
*/
fcs = ~fcs;
c = fcs & 0xff;
if (in_xmap(ppp, c) || (islcp && c < 0x20)) {
*buf++ = PPP_ESCAPE;
c ^= 0x20;
}
<Question4 >
* what is the meaning of in_xmap(ppp,c) ?
* What is the necessity of " c< 0x20 "
?
