1 /* crc10-tvb.c
2  * CRC-10 tvb routines
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #include "config.h"
12 
13 #include <glib.h>
14 #include <epan/tvbuff.h>
15 #include <wsutil/crc10.h>
16 #include <epan/crc10-tvb.h>
17 
18 /* update the data block's CRC-10 remainder one byte at a time */
19 guint16
update_crc10_by_bytes_tvb(guint16 crc10,tvbuff_t * tvb,int offset,int len)20 update_crc10_by_bytes_tvb(guint16 crc10, tvbuff_t *tvb, int offset, int len)
21 {
22     const guint8 *buf;
23 
24     tvb_ensure_bytes_exist(tvb, offset, len);  /* len == -1 not allowed */
25     buf = tvb_get_ptr(tvb, offset, len);
26 
27     return update_crc10_by_bytes(crc10, buf, len);
28 }
29 
30 /*
31  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
32  *
33  * Local variables:
34  * c-basic-offset: 4
35  * tab-width: 8
36  * indent-tabs-mode: nil
37  * End:
38  *
39  * vi: set shiftwidth=4 tabstop=8 expandtab:
40  * :indentSize=4:tabSize=8:noTabs=true:
41  */
42