source: lib/protocols.h @ 729bed4

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivendag_formatrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 729bed4 was ee6e802, checked in by Shane Alcock <salcock@…>, 5 years ago

Updated copyright blurb on all source files

In some cases, this meant adding copyright blurbs to files that
had never had them before.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 *
3 * Copyright (c) 2007-2016 The University of Waikato, Hamilton, New Zealand.
4 * All rights reserved.
5 *
6 * This file is part of libtrace.
7 *
8 * This code has been developed by the University of Waikato WAND
9 * research group. For further information please see http://www.wand.net.nz/
10 *
11 * libtrace is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * libtrace is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 *
24 *
25 */
26
27/** @file
28 *
29 * @brief Protocol access functions that have not yet been made available
30 * through the external API.
31 *
32 * These are protocol decoders that haven't yet seen enough use to consider
33 * their API stable enough to move into libtrace.h where they probably belong.
34 */
35
36
37/* These are generally used by the next higher level, so really we should
38 * be defining API's that mean that these don't need to be known by the
39 * higher level.
40 */
41
42#include "libtrace.h"
43/* pkt meta headers */
44
45/* l2 headers */
46
47/** Gets a pointer to the payload following an Ethernet header
48 *
49 * @param ethernet      A pointer to the Ethernet header
50 * @param[out] type     Set to contain the Ethernet type of the next header
51 * @param[in, out] remaining    Updated with the number of captured bytes
52 *                              remaining
53 * @return A pointer to the header following the provided Ethernet header, or
54 * NULL if no subsequent header is present.
55 *
56 * Remaining must point to the number of bytes captured from the Ethernet header
57 * and beyond.  It will be decremented by the number of bytes skipped to find
58 * the payload.
59 *
60 * If the Ethernet header is complete but there are zero bytes of payload after
61 * the end of the header, a pointer to where the payload would be is returned
62 * and remaining will be set to 0.  If the Ethernet header is incomplete
63 * (truncated), then NULL is returned and remaining will be set to 0.
64 * Therefore, it is very important to check the value of remaining after
65 * calling this function.
66 *
67 * @note \ref trace_get_payload_from_layer2 provides a suitable alternative that is
68 * actually available via the external API
69 */
70void *trace_get_payload_from_ethernet(void *ethernet, 
71                uint16_t *type,
72                uint32_t *remaining);
73
74/* l3 definitions */
75
76/** Ports structure used to get the source and destination ports for transport
77 * protocols */
78struct ports_t {
79        uint16_t src;           /**< Source port */
80        uint16_t dst;           /**< Destination port */
81};
82
83
Note: See TracBrowser for help on using the repository browser.