source: lib/protocols.h @ be1b03a

develop
Last change on this file since be1b03a was be1b03a, checked in by Shane Alcock <salcock@…>, 2 years ago

Fix header files that are missing header guards

  • Property mode set to 100644
File size: 2.9 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#ifndef LIBTRACE_PROTOCOLS_H_
28#define LIBTRACE_PROTOCOLS_H_
29
30/** @file
31 *
32 * @brief Protocol access functions that have not yet been made available
33 * through the external API.
34 *
35 * These are protocol decoders that haven't yet seen enough use to consider
36 * their API stable enough to move into libtrace.h where they probably belong.
37 */
38
39
40/* These are generally used by the next higher level, so really we should
41 * be defining API's that mean that these don't need to be known by the
42 * higher level.
43 */
44
45#include "libtrace.h"
46/* pkt meta headers */
47
48/* l2 headers */
49
50/** Gets a pointer to the payload following an Ethernet header
51 *
52 * @param ethernet      A pointer to the Ethernet header
53 * @param[out] type     Set to contain the Ethernet type of the next header
54 * @param[in, out] remaining    Updated with the number of captured bytes
55 *                              remaining
56 * @return A pointer to the header following the provided Ethernet header, or
57 * NULL if no subsequent header is present.
58 *
59 * Remaining must point to the number of bytes captured from the Ethernet header
60 * and beyond.  It will be decremented by the number of bytes skipped to find
61 * the payload.
62 *
63 * If the Ethernet header is complete but there are zero bytes of payload after
64 * the end of the header, a pointer to where the payload would be is returned
65 * and remaining will be set to 0.  If the Ethernet header is incomplete
66 * (truncated), then NULL is returned and remaining will be set to 0.
67 * Therefore, it is very important to check the value of remaining after
68 * calling this function.
69 *
70 * @note \ref trace_get_payload_from_layer2 provides a suitable alternative that is
71 * actually available via the external API
72 */
73void *trace_get_payload_from_ethernet(void *ethernet, 
74                uint16_t *type,
75                uint32_t *remaining);
76
77/* l3 definitions */
78
79/** Ports structure used to get the source and destination ports for transport
80 * protocols */
81struct ports_t {
82        uint16_t src;           /**< Source port */
83        uint16_t dst;           /**< Destination port */
84};
85
86#endif
Note: See TracBrowser for help on using the repository browser.