~ubuntu-branches/ubuntu/trusty/iaxmodem/trusty

« back to all changes in this revision

Viewing changes to lib/spandsp/src/hdlc.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien BLACHE
  • Date: 2007-05-15 09:43:53 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070515094353-bpr27hxvt6taxugb
Tags: 0.3.0~dfsg-1
* New upstream release.
  + Now supports V.17 reception; see changelog for details.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 * along with this program; if not, write to the Free Software
23
23
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
24
 *
25
 
 * $Id: hdlc.c,v 1.44 2006/11/28 16:59:56 steveu Exp $
 
25
 * $Id: hdlc.c,v 1.45 2007/03/29 12:28:35 steveu Exp $
26
26
 */
27
27
 
28
28
/*! \file */
285
285
                    {
286
286
                        s->rx_frames++;
287
287
                        s->rx_bytes += s->len - s->crc_bytes;
288
 
                        s->frame_handler(s->user_data,
289
 
                                         TRUE,
290
 
                                         s->buffer,
291
 
                                         s->len - s->crc_bytes);
 
288
                        s->len -= s->crc_bytes;
 
289
                        s->frame_handler(s->user_data, TRUE, s->buffer, s->len);
292
290
                    }
293
291
                    else
294
292
                    {
295
293
                        s->rx_crc_errors++;
296
294
                        if (s->report_bad_frames)
297
295
                        {
298
 
                            s->frame_handler(s->user_data,
299
 
                                             FALSE,
300
 
                                             s->buffer,
301
 
                                             s->len - s->crc_bytes);
 
296
                            s->len -= s->crc_bytes;
 
297
                            s->frame_handler(s->user_data, FALSE, s->buffer, s->len);
302
298
                        }
303
299
                    }
304
300
                    s->framing_ok_announced = FALSE;
308
304
                    /* Frame too short or too long */
309
305
                    if (s->report_bad_frames)
310
306
                    {
311
 
                        s->frame_handler(s->user_data,
312
 
                                         FALSE,
313
 
                                         s->buffer,
314
 
                                         s->len - s->crc_bytes);
 
307
                        s->len -= s->crc_bytes;
 
308
                        /* Don't let the length go negative, or it will be confused
 
309
                           with one of the special conditions. */
 
310
                        if (s->len < 0)
 
311
                            s->len = 0;
 
312
                        s->frame_handler(s->user_data, FALSE, s->buffer, s->len);
315
313
                    }
316
314
                    s->rx_length_errors++;
317
315
                }