Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Edouard Gomez ([EMAIL PROTECTED]) wrote:
> I'll do that tonight.

Quick hack that could be the start of a smarter junk byte skipping.

My approach is now to look for the next cell beginning in a [0..ATM cell si=
ze]
range. To achieve that, i look for a vpi, vci matching the ones we
expect and finally the HEC (header CRC) just to be sure.=20

--=20
Edouard Gomez

-- Attached file included as plaintext by Listar --

Index: atm.c
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/atm.c,v
retrieving revision 1.8
diff -u -r1.8 atm.c
--- atm.c       28 Dec 2002 13:42:21 -0000      1.8
+++ atm.c       10 Mar 2003 18:36:02 -0000
@@ -302,13 +302,29 @@
        src = atm_cells;
        dst = aal5_frame + *cur_pos;
 
-       /* There's sometimes junk bytes at the beginning of atm_cells_buffer */
+       /* There's sometimes junk bytes in atm_cells_buffer */
        tmp = length % ATM_CELL_TOTAL_SIZE;
 
-       /* Skip the junk bytes at the beginning */
-       if(!tmp) {
-               src    += tmp;
-               length -= tmp;
+       /* We skip junk bytes until the next ATM cell */
+       if(tmp) {
+
+               int i;
+               
+               /*
+                * We should find a cell's beginning before an ATM cell size
+                * byte range from current position
+                */
+               for(i=0; i<ATM_CELL_TOTAL_SIZE; i++) {
+
+                       /* First we try finding VPI/VCI */
+                       if(atm_header_get_vpi(src + i) == vpi &&
+                          atm_header_get_vci(src + i) == vci &&
+                          atm_calc_hec(src + i)       == *(src + i + 4)) {
+                               src += i;
+                               length -= i;
+                               break;
+                       }
+               }
        }
 
 
Index: crc.c
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/crc.c,v
retrieving revision 1.4
diff -u -r1.4 crc.c
--- crc.c       28 Dec 2002 13:42:21 -0000      1.4
+++ crc.c       10 Mar 2003 18:36:03 -0000
@@ -114,7 +114,6 @@
 * Precomputed ATM CRC8 lookup table
 ******************************************************************************/
 
-#ifdef DEBUG
 unsigned char hec_table[256]=
 {
 
@@ -152,7 +151,6 @@
        0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3
 
 };
-#endif
 
 /******************************************************************************
 * Functions
@@ -185,7 +183,6 @@
 
 }
 
-#ifdef DEBUG
 unsigned char atm_calc_hec(unsigned char *header)
 {
 
@@ -199,6 +196,5 @@
        return(hec^ATM_HEADER_COSET_LEADER);
 
 }
-#endif
 
 #endif
Index: crc.h
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/crc.h,v
retrieving revision 1.4
diff -u -r1.4 crc.h
--- crc.h       28 Dec 2002 13:42:21 -0000      1.4
+++ crc.h       10 Mar 2003 18:36:03 -0000
@@ -40,8 +40,6 @@
 ******************************************************************************/
 
 extern unsigned int  aal5_calc_crc(unsigned char *mem, int len, unsigned int initial);
-#ifdef DEBUG
 extern unsigned char atm_calc_hec(unsigned char *header);
-#endif
 
 #endif


-- Attached file included as plaintext by Listar --

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+bNx7R5dTYz5sWMcRAlxCAJ9g4aDvNos1lMtlJtnoHIwI4LObpgCfXpcE
qPkehSiPd/K8y6oVhgLeo9M=
=5xLY
-----END PGP SIGNATURE-----


Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se désinscrire : mailto:[EMAIL PROTECTED]

        

Reply via email to