00001 /* 00002 * This file is part of libtrace 00003 * 00004 * Copyright (c) 2007,2008,2009,2010 The University of Waikato, Hamilton, 00005 * New Zealand. 00006 * 00007 * Authors: Daniel Lawson 00008 * Perry Lorier 00009 * Shane Alcock 00010 * 00011 * All rights reserved. 00012 * 00013 * This code has been developed by the University of Waikato WAND 00014 * research group. For further information please see http://www.wand.net.nz/ 00015 * 00016 * libtrace is free software; you can redistribute it and/or modify 00017 * it under the terms of the GNU General Public License as published by 00018 * the Free Software Foundation; either version 2 of the License, or 00019 * (at your option) any later version. 00020 * 00021 * libtrace is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU General Public License 00027 * along with libtrace; if not, write to the Free Software 00028 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00029 * 00030 * $Id: dagformat.h 1505 2010-02-03 01:00:32Z salcock $ 00031 * 00032 */ 00033 00049 #ifndef _DAGFORMAT_H_ 00050 #define _DAGFORMAT_H_ 00051 00052 #include "libtrace.h" 00053 #include "erftypes.h" 00054 00055 #ifdef WIN32 00056 #pragma pack(push) 00057 #pragma pack(1) 00058 #endif 00059 00061 typedef struct pos_rec { 00062 uint32_t hdlc; 00063 uint8_t pload[1]; 00064 } PACKED pos_rec_t; 00065 00067 typedef struct eth_rec { 00068 uint8_t offset; 00069 uint8_t pad; 00070 uint8_t dst[6]; 00071 uint8_t src[6]; 00072 uint16_t etype; 00073 uint8_t pload[1]; 00074 } PACKED eth_rec_t; 00075 00077 typedef struct atm_rec { 00078 uint32_t header; 00079 uint8_t pload[1]; 00080 } PACKED atm_rec_t; 00081 00083 typedef struct aal5_rec { 00084 uint32_t header; 00085 uint8_t pload[1]; 00086 } PACKED aal5_rec_t; 00087 00089 typedef struct flags { 00090 LT_BITFIELD8 iface:2; 00091 LT_BITFIELD8 vlen:1; 00092 LT_BITFIELD8 trunc:1; 00093 LT_BITFIELD8 rxerror:1; 00094 LT_BITFIELD8 dserror:1; 00095 LT_BITFIELD8 pad:2; 00096 } PACKED flags_t; 00097 00099 typedef struct dag_record { 00100 uint64_t ts; 00101 uint8_t type; 00102 flags_t flags; 00103 uint16_t rlen; 00104 uint16_t lctr; 00105 uint16_t wlen; 00106 union { 00107 pos_rec_t pos; 00108 eth_rec_t eth; 00109 atm_rec_t atm; 00110 aal5_rec_t aal5; 00111 } rec; 00112 } PACKED dag_record_t; 00113 00114 #ifdef WIN32 00115 #pragma pack(pop) 00116 #endif 00117 00119 #define dag_record_size 16U 00120 00121 #endif /* _DAGFORMAT_H_ */