source: lib/dagformat.h @ 322c516

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 322c516 was 143eaba, checked in by Shane Alcock <salcock@…>, 12 years ago
  • Updated the documentation and licensing on dagformat.h
  • Most notably, removed the duck_inf structure as we do not really support DUCK reading and anyone wanting to write DUCK will already have the real DAG headers available defining the DUCK structure
  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[143eaba]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/** @file
35 *
36 * @brief Header file containing definitions required to process DAG / ERF
37 * traces
38 *
39 * @author Daniel Lawson
40 * @author Perry Lorier
41 * @author Shane Alcock
42 *
43 * @version $Id$
44 *
45 * Most of the structures defined in here are already defined in the Endace DAG
46 * libraries, but we need to re-define them ourselves here so that we can
47 * process ERF traces without requiring the user to buy a DAG card :)
48 */
[750a1e0]49#ifndef _DAGFORMAT_H_
50#define _DAGFORMAT_H_
51
[d8fc342]52#include "libtrace.h"
[2faa57e]53#include "erftypes.h"
[121b7e2]54
[bf66333]55#ifdef WIN32
56#pragma pack(push)
57#pragma pack(1)
58#endif
59
[9de8150]60/** GPP Type 1 */
[750a1e0]61typedef struct pos_rec {
[143eaba]62        uint32_t  hdlc;                 /**< The HDLC header */ 
63        uint8_t   pload[1];             /**< First byte of payload */
[15e9390]64}  PACKED pos_rec_t;
[750a1e0]65
[9de8150]66/** GPP Type 2 */
[750a1e0]67typedef struct eth_rec {
[143eaba]68        uint8_t   offset;               /**< Ethernet record offset */
69        uint8_t   pad;                  /**< Padding */
70        uint8_t   dst[6];               /**< Destination MAC address */ 
71        uint8_t   src[6];               /**< Source MAC address */
72        uint16_t  etype;                /**< Ethertype */
73        uint8_t   pload[1];             /**< First byte of payload */
[15e9390]74}  PACKED eth_rec_t;
[750a1e0]75
[9de8150]76/** GPP Type 3 */
[750a1e0]77typedef struct atm_rec {
[143eaba]78        uint32_t  header;               /**< The ATM header */ 
79        uint8_t   pload[1];             /**< First byte of payload */
[15e9390]80}  PACKED atm_rec_t;
[750a1e0]81
[9de8150]82/** GPP Type 4 */
[750a1e0]83typedef struct aal5_rec {
[143eaba]84        uint32_t  header;               /**< The AAL5 header */
85        uint8_t   pload[1];             /**< First byte of payload */
[15e9390]86}  PACKED aal5_rec_t;
[750a1e0]87
[9de8150]88/** Flags */
[750a1e0]89typedef struct flags {
[e2aebe7]90        LT_BITFIELD8  iface:2;          /**< Interface (direction) */
[143eaba]91        LT_BITFIELD8  vlen:1;           /**< Varying Record Lengths Present */
92        LT_BITFIELD8  trunc:1;          /**< Truncated Record */
93        LT_BITFIELD8  rxerror:1;        /**< RX Error detected */
[e2aebe7]94        LT_BITFIELD8  dserror:1;        /**< Data stream error */
95        LT_BITFIELD8  pad:2;            /**< Unused */
[23971d0]96} PACKED flags_t;
[750a1e0]97
[9de8150]98/** GPP Global type */
[750a1e0]99typedef struct dag_record {
[143eaba]100        uint64_t  ts;           /**< ERF timestamp */
[9de8150]101        uint8_t   type;         /**< GPP record type */
[143eaba]102        flags_t   flags;        /**< Flags */
103        uint16_t  rlen;         /**< Record len (capture+framing) */
104        uint16_t  lctr;         /**< Loss counter */
105        uint16_t  wlen;         /**< Wire length */
[750a1e0]106        union {
[143eaba]107                pos_rec_t       pos;           
[750a1e0]108                eth_rec_t       eth;
109                atm_rec_t       atm;
110                aal5_rec_t      aal5;
[143eaba]111        } rec;                  /**< The captured record itself */
[23971d0]112} PACKED dag_record_t;
[750a1e0]113
[bf66333]114#ifdef WIN32
115#pragma pack(pop)
116#endif
117
[143eaba]118/** The size of the ERF record header, without the rec field */
[4bd8a5b]119#define dag_record_size         16U
[750a1e0]120
[7068467]121#endif /* _DAGFORMAT_H_ */
Note: See TracBrowser for help on using the repository browser.