source: lib/protocols.h @ c7021d9

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