This routine initializes the state structure for both the transmit and receive halves of some serial line. It must be called each time the line is brought up.
void sl_compress_init(comp) struct slcompress *comp; { register u_int i; register struct cstate *tstate = comp->tstate; /* * Clean out any junk left from the last time line was used. */ bzero((char *) comp, sizeof(*comp)); /* * Link the transmit states into a circular list. */ for (i = MAX_STATES - 1; i > 0; --i) { tstate[i].cs_id = i; tstate[i].cs_next = &tstate[i - 1]; } tstate[0].cs_next = &tstate[MAX_STATES - 1]; tstate[0].cs_id = 0; comp->last_cs = &tstate[0]; /* * Make sure we don't accidentally do CID compression * (assumes MAX_STATES < 255). */ comp->last_recv = 255; comp->last_xmit = 255; }