source: lib/libtrace.h.in @ 9185dcfd

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 9185dcfd was 9185dcfd, checked in by Perry Lorier <perry@…>, 14 years ago

Fix documentation around UDP/ICMP mistakenly mentioning TCP due to cut and
paste errors.

Reported by Calle Olsen of Autonomica.

  • Property mode set to 100644
File size: 60.6 KB
Line 
1/*
2 * This file is part of libtrace
3 *
4 * Copyright (c) 2007 The University of Waikato, Hamilton, New Zealand.
5 * Authors: Daniel Lawson
6 *          Perry Lorier
7 *         
8 * All rights reserved.
9 *
10 * This code has been developed by the University of Waikato WAND
11 * research group. For further information please see http://www.wand.net.nz/
12 *
13 * libtrace is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * libtrace is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with libtrace; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 *
27 * $Id: libtrace.h 773 2006-05-01 12:58:09Z perry $
28 *
29 */
30
31#ifndef LIBTRACE_H
32#define LIBTRACE_H
33
34/** @file
35 *
36 * @brief Trace file processing library header
37 *
38 * @author Daniel Lawson
39 * @author Perry Lorier
40 *
41 * @version $Id: libtrace.h 773 2006-05-01 12:58:09Z perry $
42 *
43 * This library provides a per packet interface into a trace file, or a live
44 * captures.  It supports ERF, DAG cards, WAG cards, WAG's event format,
45 * pcap etc.
46 *
47 * @par Usage
48 * See the example/ directory in the source distribution for some simple examples
49 * @par Linking
50 * To use this library you need to link against libtrace by passing -ltrace
51 * to your linker. You may also need to link against a version of libpcap
52 * and of zlib which are compiled for largefile support (if you wish to access
53 * traces larger than 2 GB). This is left as an exercise for the reader. Debian
54 * Woody, at least, does not support large file offsets.
55 *
56 */
57
58#include <sys/types.h>
59#ifndef WIN32
60#include <sys/time.h>
61#endif
62
63#ifdef _MSC_VER
64    /* define the following from MSVC's internal types */
65    typedef             __int8  int8_t;
66    typedef             __int16 int16_t;
67    typedef             __int32 int32_t;
68    typedef             __int64 int64_t;
69    typedef unsigned    __int8  uint8_t;
70    typedef unsigned    __int16 uint16_t;
71    typedef unsigned    __int32 uint32_t;
72    typedef unsigned    __int64 uint64_t;
73    #ifdef BUILDING_DLL
74        #define DLLEXPORT __declspec(dllexport)
75    #else
76        #define DLLEXPORT __declspec(dllimport)
77    #endif
78    #define DLLLOCAL
79    /* Windows pads bitfields out to to the size of their parent type
80     * however gcc warns that this doesn't meet with the iso C specification
81     * so produces warnings for this behaviour.  sigh.
82     */
83    #define LT_BITFIELD8        uint8_t
84    #define LT_BITFIELD16       uint16_t
85    #define LT_BITFIELD32       uint32_t
86    #define LT_BITFIELD64       uint64_t
87#else
88#   include <stdint.h>
89    #ifdef HAVE_GCCVISIBILITYPATCH
90        #define DLLEXPORT __attribute__ (visibility("default"))
91        #define DLLLOCAL __attribute__ (visibility("hidden"))
92    #else
93        #define DLLEXPORT
94        #define DLLLOCAL
95    #endif
96    /* GCC warns if the bitfield type is not "unsigned int", however windows
97     * generates incorrect code for this (see above), so we define these
98     * macros.  How Hidious.  So much for C's portability.
99     */
100    #define LT_BITFIELD8        unsigned int
101    #define LT_BITFIELD16       unsigned int
102    #define LT_BITFIELD32       unsigned int
103    #define LT_BITFIELD64       unsigned int
104#endif
105
106#ifdef WIN32
107#   include <winsock2.h>
108#   include <ws2tcpip.h>
109    typedef short sa_family_t;
110    /* Make up for a lack of stdbool.h */
111#    define bool signed char
112#    define false 0
113#    define true 1
114#    if !defined(ssize_t)
115     /* XXX: Not 64-bit safe! */
116#    define ssize_t int
117#    endif   
118#else
119#    include <netinet/in.h>
120
121#ifndef __cplusplus
122#    include <stdbool.h>
123#endif
124
125#    include <sys/types.h>
126#    include <sys/socket.h>
127#endif
128
129/** API version as 2 byte hex digits, eg 0xXXYYZZ */
130#define LIBTRACE_API_VERSION \
131            ((@LIBTRACE_MAJOR@<<16)|(@LIBTRACE_MID@<<8)|(@LIBTRACE_MINOR@))
132
133#define LIBTRACE_SVN_REVISION 0
134#define DAG_DRIVER_V "@DAG_VERSION_NUM@"
135   
136#ifdef __cplusplus
137extern "C" {
138#endif
139
140/* Function does not depend on anything but its
141 * parameters, used to hint gcc's optimisations
142 */
143#if __GNUC__ >= 3
144#  define SIMPLE_FUNCTION __attribute__((pure))
145#  define UNUSED __attribute__((unused))
146#  define PACKED __attribute__((packed))
147#  define PRINTF(formatpos,argpos) __attribute__((format(printf,formatpos,argpos)))
148#else
149#  define SIMPLE_FUNCTION
150#  define UNUSED
151#  define PACKED
152#  define PRINTF(formatpos,argpos)
153#endif
154       
155/** Opaque structure holding information about an output trace */
156typedef struct libtrace_out_t libtrace_out_t;
157       
158/** Opaque structure holding information about a trace */
159typedef struct libtrace_t libtrace_t;
160       
161/** Opaque structure holding information about a bpf filter */
162typedef struct libtrace_filter_t libtrace_filter_t;
163
164/** If a packet has memory allocated
165 * If the packet has allocated it's own memory it's buffer_control should
166 * be TRACE_CTRL_PACKET, when the packet is destroyed it's memory will be
167 * free()'d.  If it's doing zerocopy out of memory owned by something else
168 * it should be TRACE_CTRL_EXTERNAL.
169 * @note the letters p and e are magic numbers used to detect if the packet
170 * wasn't created properly
171 */
172typedef enum {
173        TRACE_CTRL_PACKET='p',
174        TRACE_CTRL_EXTERNAL='e'
175} buf_control_t;
176/** The size of a packet's buffer when managed by libtrace */
177#define LIBTRACE_PACKET_BUFSIZE 65536
178
179/** libtrace error information */
180typedef struct trace_err_t{
181        int err_num;            /**< error code */
182        char problem[255];      /**< the format, uri etc that caused the error for reporting purposes */
183} libtrace_err_t;
184
185/** Enumeration of error codes */
186enum {
187        /** No Error has occured.... yet. */
188        TRACE_ERR_NOERROR       = 0,
189        /** The URI passed to trace_create() is unsupported, or badly formed */
190        TRACE_ERR_BAD_FORMAT    = -1,
191        /** The trace failed to initialise */
192        TRACE_ERR_INIT_FAILED   = -2,
193        /** Unknown config option */
194        TRACE_ERR_UNKNOWN_OPTION= -3,
195        /** This output uri cannot write packets of this type */
196        TRACE_ERR_NO_CONVERSION = -4,
197        /** This packet is corrupt, or unusable for the action required */
198        TRACE_ERR_BAD_PACKET    = -5,
199        /** Option known, but unsupported by this format */
200        TRACE_ERR_OPTION_UNAVAIL= -6,
201        /** This feature is unsupported */
202        TRACE_ERR_UNSUPPORTED   = -7
203};
204
205/** Enumeration of DLT supported by libtrace
206 */
207typedef enum {
208        TRACE_DLT_NULL = 0,
209        TRACE_DLT_EN10MB = 1,
210        TRACE_DLT_PPP = 9,
211        TRACE_DLT_ATM_RFC1483 = 11,
212        /* Sigh. This is handled in files with LINKTYPE's */
213#ifdef __OpenBSD__
214        TRACE_DLT_RAW = 14,     
215#else
216        TRACE_DLT_RAW = 12,
217#endif
218        TRACE_DLT_LINKTYPE_RAW = 101,
219        TRACE_DLT_IEEE802_11 = 105,
220        TRACE_DLT_LINUX_SLL = 113,
221        TRACE_DLT_PFLOG = 117,
222        TRACE_DLT_IEEE802_11_RADIO = 127 /**< Radiotap */
223} libtrace_dlt_t ;
224
225/** Enumeration of link layer types supported by libtrace */
226typedef enum {
227    /* TRACE_TYPE_LEGACY = 0            Obsolete */
228       TRACE_TYPE_HDLC_POS = 1,
229       TRACE_TYPE_ETH = 2,              /**< 802.3 style Ethernet */
230       TRACE_TYPE_ATM = 3,              /**< ATM frame */
231       TRACE_TYPE_80211 = 4,            /**< 802.11 frames */
232       TRACE_TYPE_NONE = 5,             /**< Raw IP frames */
233       TRACE_TYPE_LINUX_SLL = 6,        /**< Linux "null" framing */
234       TRACE_TYPE_PFLOG = 7,            /**< FreeBSD's PFlug */
235    /* TRACE_TYPE_LEGACY_DEFAULT        Obsolete */
236       TRACE_TYPE_POS = 9,
237    /* TRACE_TYPE_LEGACY_ATM            Obsolete */
238    /* TRACE_TYPE_LEGACY_ETH            Obsolete */
239       TRACE_TYPE_80211_PRISM = 12,
240       TRACE_TYPE_AAL5 = 13,
241       TRACE_TYPE_DUCK = 14,         /**< Pseudo link layer for DUCK packets */
242       TRACE_TYPE_80211_RADIO = 15,  /**< Radiotap + 802.11 */
243       TRACE_TYPE_LLCSNAP = 16,      /**< Raw LLC/SNAP */
244       TRACE_TYPE_PPP = 17,          /**< PPP frames */
245       TRACE_TYPE_METADATA = 18         /**< WDCAP-style meta-data */
246       
247} libtrace_linktype_t;
248
249/** RT protocol base format identifiers
250 * This is used to say what kind of packet is being sent over the rt protocol
251 */
252enum base_format_t {
253        TRACE_FORMAT_ERF          =1,
254        TRACE_FORMAT_PCAP         =2,
255        TRACE_FORMAT_PCAPFILE     =3,
256        TRACE_FORMAT_WAG          =4,
257        TRACE_FORMAT_RT           =5,
258        TRACE_FORMAT_LEGACY_ATM   =6,
259        TRACE_FORMAT_LEGACY_POS   =7,
260        TRACE_FORMAT_LEGACY_ETH   =8,
261        TRACE_FORMAT_LINUX_NATIVE =9,
262        TRACE_FORMAT_DUCK         =10,
263        TRACE_FORMAT_BPF          =11,
264        TRACE_FORMAT_TSH          =12,
265        TRACE_FORMAT_ATMHDR       =13,
266        TRACE_FORMAT_LEGACY_NZIX  =14
267};
268
269/* RT protocol packet types */
270typedef enum {
271        TRACE_RT_HELLO          =1, /**< Connection accepted */
272        TRACE_RT_START          =2, /**< Request for data transmission to begin
273                                    */
274        TRACE_RT_ACK            =3, /**< Data acknowledgement */
275        TRACE_RT_STATUS         =4, /**< Fifo status packet */
276        TRACE_RT_DUCK           =5, /**< Dag duck info packet */
277        TRACE_RT_END_DATA       =6, /**< Server is exiting message */
278        TRACE_RT_CLOSE          =7, /**< Client is exiting message */
279        TRACE_RT_DENY_CONN      =8, /**< Connection has been denied */
280        TRACE_RT_PAUSE          =9, /**< Request server to suspend sending data
281                                     */
282        TRACE_RT_PAUSE_ACK      =10,/**< Server is paused message */
283        TRACE_RT_OPTION         =11,/**< Option request */
284        TRACE_RT_KEYCHANGE      =12,/**< Anonymisation key has changed */
285        TRACE_RT_DUCK_2_4       =13,/**< Dag 2.4 Duck */
286        TRACE_RT_DUCK_2_5       =14,/**< Dag 2.5 Duck */
287        TRACE_RT_LOSTCONN       =15,/**< Lost connection to server */
288        TRACE_RT_SERVERSTART    =16,/**< Reliable server has been restarted */
289        TRACE_RT_CLIENTDROP     =17,/**< Reliable client was lost */
290        TRACE_RT_METADATA       =18,/**< Packet contains server meta-data */
291
292        TRACE_RT_DATA_SIMPLE    = 1000, /**< Trace types that know their link
293                                          * type
294                                          */
295        TRACE_RT_DATA_ERF       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_ERF,
296        TRACE_RT_DATA_WAG       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_WAG,
297        TRACE_RT_DATA_LEGACY_ATM=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_ATM,
298        TRACE_RT_DATA_LEGACY_POS=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_POS,
299        TRACE_RT_DATA_LEGACY_ETH=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_ETH,
300        TRACE_RT_DATA_LINUX_NATIVE=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LINUX_NATIVE,
301        TRACE_RT_DATA_TSH       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_TSH,
302
303        TRACE_RT_DATA_ATMHDR = TRACE_RT_DATA_SIMPLE + TRACE_FORMAT_ATMHDR,
304        TRACE_RT_DATA_LEGACY_NZIX=TRACE_RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_NZIX,
305        TRACE_RT_DATA_DLT               = 2000, /**< Pcap doesn't store the
306                                                  * linktype per packet, and
307                                                  * thus we have to store it
308                                                  * in here.  sigh.
309                                                  */
310        TRACE_RT_DLT_NULL               =TRACE_RT_DATA_DLT+TRACE_DLT_NULL,
311        TRACE_RT_DLT_EN10MB             =TRACE_RT_DATA_DLT+TRACE_DLT_EN10MB,
312        TRACE_RT_DLT_IEEE802_11         =TRACE_RT_DATA_DLT+TRACE_DLT_IEEE802_11,
313        TRACE_RT_DLT_LINUX_SLL          =TRACE_RT_DATA_DLT+TRACE_DLT_LINUX_SLL,
314        TRACE_RT_DLT_PFLOG              =TRACE_RT_DATA_DLT+TRACE_DLT_PFLOG,
315        TRACE_RT_DLT_ATM_RFC1483        =TRACE_RT_DATA_DLT+TRACE_DLT_ATM_RFC1483,
316        TRACE_RT_LAST                   = (2<<31)
317} libtrace_rt_types_t;
318
319/** The libtrace packet structure, applications shouldn't be
320 * meddling around in here
321 */
322typedef struct libtrace_packet_t {
323        struct libtrace_t *trace;       /**< pointer to the trace */
324        void *header;                   /**< pointer to the framing header */
325        void *payload;                  /**< pointer to the link layer */
326        void *buffer;                   /**< allocated buffer */
327        libtrace_rt_types_t  type;      /**< rt protocol type for the packet */
328        buf_control_t buf_control;      /**< who owns the memory */
329        int capture_length;             /**< Cached capture length */
330        void *l3_header;                /**< Cached l3 header */
331        uint16_t l3_ethertype;          /**< Cached l3 ethertype */
332} libtrace_packet_t;
333
334
335/** Trace directions
336 * Note that these are the directions used by convention, more directions
337 * are possible, not just these 3, and that they may not conform to this
338 * convention.
339 */
340typedef enum {
341        TRACE_DIR_OUTGOING = 0,         /**< Packets originating "inside" */
342        TRACE_DIR_INCOMING = 1,         /**< Packets originating "outside" */
343        TRACE_DIR_OTHER    = 2          /**< Packets with an unknown direction, or one that's unknown */
344} libtrace_direction_t;
345
346/** Enumeration of Radiotap fields */
347typedef enum {
348    TRACE_RADIOTAP_TSFT = 0, /**< Timer synchronisation function, in microseconds (uint64) */
349    TRACE_RADIOTAP_FLAGS = 1, /**< Wireless flags (uint8) */
350    TRACE_RADIOTAP_RATE = 2, /**< Bitrate in units of 500kbps (uint8) */
351    TRACE_RADIOTAP_CHANNEL = 3, /**< Frequency in MHz (uint16) and channel flags (uint16) */
352    TRACE_RADIOTAP_FHSS = 4, /**< FHSS hop set (uint8) and hopping pattern (uint8) */
353    TRACE_RADIOTAP_DBM_ANTSIGNAL = 5, /**< Signal power in dBm (int8) */
354    TRACE_RADIOTAP_DBM_ANTNOISE = 6, /**< Noise power in dBm (int8) */
355    TRACE_RADIOTAP_LOCK_QUALITY = 7, /**< Barker Code lock quality (uint16) */
356    TRACE_RADIOTAP_TX_ATTENUATION = 8, /**< TX attenuation as unitless distance from max power (uint16) */
357    TRACE_RADIOTAP_DB_TX_ATTENUATION = 9, /**< TX attenutation as dB from max power (uint16) */
358    TRACE_RADIOTAP_DBM_TX_POWER = 10, /**< TX Power in dBm (int8) */
359    TRACE_RADIOTAP_ANTENNA = 11, /**< Antenna frame was rx'd or tx'd on (uint8) */
360    TRACE_RADIOTAP_DB_ANTSIGNAL = 12, /**< Signal power in dB from a fixed reference (uint8) */
361    TRACE_RADIOTAP_DB_ANTNOISE = 13, /**< Noise power in dB from a fixed reference (uint8) */
362    TRACE_RADIOTAP_RX_FLAGS = 14, /** Properties of received frame (uint16) */
363    TRACE_RADIOTAP_TX_FLAGS = 15, /** Properties of transmitted frame (uint16) */
364    TRACE_RADIOTAP_RTS_RETRIES = 16, /** Number of rts retries frame used (uint8) */
365    TRACE_RADIOTAP_DATA_RETRIES = 17, /** Number of unicast retries a transmitted frame used (uint8) */
366    TRACE_RADIOTAP_EXT = 31
367} libtrace_radiotap_field_t;
368
369
370/** @name Protocol structures
371 * These convenience structures are here as they are portable ways of dealing
372 * with various protocols.
373 * @{
374 */
375
376#ifdef WIN32
377#pragma pack(push)
378#pragma pack(1)
379#endif
380
381/** Generic IP header structure */
382typedef struct libtrace_ip
383{
384#if BYTE_ORDER == LITTLE_ENDIAN
385    LT_BITFIELD8 ip_hl:4;               /**< Header Length */
386    LT_BITFIELD8 ip_v:4;                /**< Version */
387#elif BYTE_ORDER == BIG_ENDIAN
388    LT_BITFIELD8 ip_v:4;                /**< Version */
389    LT_BITFIELD8 ip_hl:4;               /**< Header Length */
390#else
391#   error "Adjust your <bits/endian.h> defines"
392#endif
393    uint8_t  ip_tos;                    /**< Type of Service */
394    uint16_t ip_len;                    /**< Total Length */
395    int16_t  ip_id;                     /**< Identification */
396#if BYTE_ORDER == LITTLE_ENDIAN
397    LT_BITFIELD16 ip_off:12;            /**< Fragment Offset */
398    LT_BITFIELD16 ip_mf:1;              /**< More Fragments Flag */
399    LT_BITFIELD16 ip_df:1;              /**< Dont Fragment Flag */
400    LT_BITFIELD16 ip_rf:1;              /**< Reserved Fragment Flag */
401#elif BYTE_ORDER == BIG_ENDIAN
402    LT_BITFIELD16 ip_rf:1;              /**< Fragment Offset */
403    LT_BITFIELD16 ip_df:1;              /**< More Fragments Flag */
404    LT_BITFIELD16 ip_mf:1;              /**< Dont Fragment Flag */
405    LT_BITFIELD16 ip_off:12;            /**< Reserved Fragment Flag */
406#else
407#   error "Adjust your <bits/endian.h> defines"
408#endif
409    uint8_t  ip_ttl;                    /**< Time to Live */
410    uint8_t  ip_p;                      /**< Protocol */
411    uint16_t ip_sum;                    /**< Checksum */
412    struct in_addr ip_src;              /**< Source Address */
413    struct in_addr ip_dst;              /**< Destination Address */
414} PACKED libtrace_ip_t;
415
416/** IPv6 header extension structure */
417typedef struct libtrace_ip6_ext
418{
419        uint8_t nxt;
420        uint8_t len;
421} PACKED libtrace_ip6_ext_t;
422
423/** Generic IPv6 header structure */
424typedef struct libtrace_ip6
425{
426    uint32_t flow;
427    uint16_t plen;                      /**< Payload length */
428    uint8_t nxt;                        /**< Next header */
429    uint8_t hlim;                       /**< Hop limit */
430    struct in6_addr ip_src;             /**< source address */
431    struct in6_addr ip_dst;             /**< dest address */
432} PACKED libtrace_ip6_t;
433
434/** Generic TCP header structure */
435typedef struct libtrace_tcp
436  {
437    uint16_t source;            /**< Source Port */
438    uint16_t dest;              /**< Destination port */
439    uint32_t seq;               /**< Sequence number */
440    uint32_t ack_seq;           /**< Acknowledgement Number */
441#  if BYTE_ORDER == LITTLE_ENDIAN
442    LT_BITFIELD8 res1:4;        /**< Reserved bits */
443    LT_BITFIELD8 doff:4;        /**< Data Offset */     
444    LT_BITFIELD8 fin:1;         /**< FIN */
445    LT_BITFIELD8 syn:1;         /**< SYN flag */
446    LT_BITFIELD8 rst:1;         /**< RST flag */
447    LT_BITFIELD8 psh:1;         /**< PuSH flag */
448    LT_BITFIELD8 ack:1;         /**< ACK flag */
449    LT_BITFIELD8 urg:1;         /**< URG flag */
450    LT_BITFIELD8 res2:2;        /**< Reserved */
451#  elif BYTE_ORDER == BIG_ENDIAN
452    LT_BITFIELD8 doff:4;        /**< Data offset */
453    LT_BITFIELD8 res1:4;        /**< Reserved bits */
454    LT_BITFIELD8 res2:2;        /**< Reserved */
455    LT_BITFIELD8 urg:1;         /**< URG flag */
456    LT_BITFIELD8 ack:1;         /**< ACK flag */
457    LT_BITFIELD8 psh:1;         /**< PuSH flag */
458    LT_BITFIELD8 rst:1;         /**< RST flag */
459    LT_BITFIELD8 syn:1;         /**< SYN flag */
460    LT_BITFIELD8 fin:1;         /**< FIN flag */
461#  else
462#   error "Adjust your <bits/endian.h> defines"
463#  endif
464    uint16_t window;            /**< Window Size */
465    uint16_t check;             /**< Checksum */
466    uint16_t urg_ptr;           /**< Urgent Pointer */
467} PACKED libtrace_tcp_t;
468
469/** Generic UDP header structure */
470typedef struct libtrace_udp {
471  uint16_t      source;         /**< Source port */
472  uint16_t      dest;           /**< Destination port */
473  uint16_t      len;            /**< Length */
474  uint16_t      check;          /**< Checksum */
475} PACKED libtrace_udp_t;
476
477/** Generic ICMP header structure */
478typedef struct libtrace_icmp
479{
480  uint8_t type;         /**< Message Type */
481  uint8_t code;         /**< Type Sub-code */
482  uint16_t checksum;            /**< Checksum */
483  union
484  {
485    struct
486    {
487      uint16_t  id;
488      uint16_t  sequence;
489    } echo;                     /**< Echo Datagram */
490    uint32_t    gateway;        /**< Gateway Address */
491    struct
492    {
493      uint16_t  unused;
494      uint16_t  mtu;
495    } frag;                     /**< Path MTU Discovery */
496  } un;                         /**< Union for Payloads of Various ICMP Codes */
497} PACKED libtrace_icmp_t;
498
499/** Generic LLC/SNAP header structure */
500typedef struct libtrace_llcsnap
501{
502/* LLC */
503  uint8_t dsap;                 /**< Destination Service Access Point */
504  uint8_t ssap;                 /**< Source Service Access Point */
505  uint8_t control;
506/* SNAP */
507  LT_BITFIELD32 oui:24;         /**< Organisationally Unique Identifier (scope)*/
508  uint16_t type;                /**< Protocol within OUI */
509} PACKED libtrace_llcsnap_t;
510
511/** 802.3 frame */
512typedef struct libtrace_ether
513{
514  uint8_t ether_dhost[6];       /**< Destination Ether Addr */
515  uint8_t ether_shost[6];       /**< Source Ether Addr */
516  uint16_t ether_type;          /**< Packet Type ID Field (next-header) */
517} PACKED libtrace_ether_t;
518
519/** 802.1Q frame */
520typedef struct libtrace_8021q
521{
522  LT_BITFIELD16 vlan_pri:3;      /**< VLAN User Priority */
523  LT_BITFIELD16 vlan_cfi:1;      /**< VLAN Format Indicator,
524                                   * 0 for ethernet, 1 for token ring */
525  LT_BITFIELD16 vlan_id:12;      /**< VLAN Id */
526  uint16_t vlan_ether_type;      /**< VLAN Sub-packet Type ID Field
527                                   * (next-header)*/
528} PACKED libtrace_8021q_t;
529
530/** ATM User Network Interface (UNI) Cell. */
531typedef struct libtrace_atm_cell
532{
533  LT_BITFIELD32 gfc:4;          /**< Generic Flow Control */
534  LT_BITFIELD32 vpi:8;          /**< Virtual Path Identifier */
535  LT_BITFIELD32 vci:16;         /**< Virtual Channel Identifier */
536  LT_BITFIELD32 pt:3;           /**< Payload Type */
537  LT_BITFIELD32 clp:1;          /**< Cell Loss Priority */
538  LT_BITFIELD32 hec:8;          /**< Header Error Control */
539} PACKED libtrace_atm_cell_t;
540
541/** ATM Network Node/Network Interface (NNI) Cell. */
542typedef struct libtrace_atm_nni_cell
543{
544  LT_BITFIELD32 vpi:12;         /**< Virtual Path Identifier */
545  LT_BITFIELD32 vci:16;         /**< Virtual Channel Identifier */
546  LT_BITFIELD32 pt:3;           /**< Payload Type */
547  LT_BITFIELD32 clp:1;          /**< Cell Loss Priority */
548  LT_BITFIELD32 hec:8;          /**< Header Error Control */
549} PACKED libtrace_atm_nni_cell_t;
550
551/** Captured UNI cell.
552 *
553 * Endance don't capture the HEC, presumably to keep alignment.  This
554 * version of the \ref libtrace_atm_cell  is used when dealing with dag
555 * captures of uni cells.
556 *
557 */
558typedef struct libtrace_atm_capture_cell
559{
560  LT_BITFIELD32 gfc:4;          /**< Generic Flow Control */
561  LT_BITFIELD32 vpi:8;          /**< Virtual Path Identifier */
562  LT_BITFIELD32 vci:16;         /**< Virtual Channel Identifier */
563  LT_BITFIELD32 pt:3;           /**< Payload Type */
564  LT_BITFIELD32 clp:1;          /**< Cell Loss Priority */
565} PACKED libtrace_atm_capture_cell_t;
566
567/** Captured NNI cell.
568 *
569 * Endance don't capture the HEC, presumably to keep alignment.  This
570 * version of the \ref libtrace_atm_nni_cell  is used when dealing with dag
571 * captures of nni cells.
572 *
573 */
574typedef struct libtrace_atm_nni_capture_cell
575{
576  LT_BITFIELD32 vpi:12;         /**< Virtual Path Identifier */
577  LT_BITFIELD32 vci:16;         /**< Virtual Channel Identifier */
578  LT_BITFIELD32 pt:3;           /**< Payload Type */
579  LT_BITFIELD32 clp:1;          /**< Cell Loss Priority */
580  LT_BITFIELD32 hec:8;          /**< Header Error Control */
581} PACKED libtrace_atm_nni_capture_cell_t;
582
583/** PPP header */
584typedef struct libtrace_pps
585{
586 uint8_t addres;                /**< PPP Address (0xFF - All stations) */
587 uint8_t header;                /**< PPP Control (0x03 - Unnumbered info) */
588 uint16_t protocol;             /**< PPP Protocol (htons(0x0021) - IPv4 */
589} PACKED libtrace_ppp_t;
590
591/** 802.11 header */
592typedef struct libtrace_80211_t {
593#if BYTE_ORDER == LITTLE_ENDIAN
594        LT_BITFIELD32      protocol:2;
595        LT_BITFIELD32      type:2;
596        LT_BITFIELD32      subtype:4;
597#else
598        LT_BITFIELD32      subtype:4;
599        LT_BITFIELD32      type:2;
600        LT_BITFIELD32      protocol:2;
601#endif
602
603#if BYTE_ORDER == LITTLE_ENDIAN
604        LT_BITFIELD32      to_ds:1;     /**< Packet to Distribution Service */
605        LT_BITFIELD32      from_ds:1;   /**< Packet from Distribution Service */
606        LT_BITFIELD32      more_frag:1; /**< Packet has more fragments */
607        LT_BITFIELD32      retry:1;     /**< Packet is a retry */
608        LT_BITFIELD32      power:1;
609        LT_BITFIELD32      more_data:1;
610        LT_BITFIELD32      wep:1;
611        LT_BITFIELD32      order:1;
612#else
613        LT_BITFIELD32      order:1;
614        LT_BITFIELD32      wep:1;
615        LT_BITFIELD32      more_data:1;
616        LT_BITFIELD32      power:1;
617        LT_BITFIELD32      retry:1;     /**< Packet is a retry */
618        LT_BITFIELD32      more_frag:1; /**< Packet has more fragments */
619        LT_BITFIELD32      from_ds:1;   /**< Packet from Distribution Service */
620        LT_BITFIELD32      to_ds:1;     /**< Packet to Distribution Service */
621#endif
622        uint16_t     duration;
623        uint8_t      mac1[6];
624        uint8_t      mac2[6];
625        uint8_t      mac3[6];
626        uint16_t     SeqCtl;
627        uint8_t      mac4[6];
628} PACKED libtrace_80211_t;
629
630/** The Radiotap header pre-amble
631 *
632 * All Radiotap headers start with this pre-amble, followed by the fields
633 * specified in the it_present bitmask. If bit 31 of it_present is set, then
634 * another bitmask follows.
635 * @note All of the radiotap data fields are in little-endian byte-order.
636 */
637typedef struct libtrace_radiotap_t {
638    uint8_t     it_version; /**< Radiotap version */
639    uint8_t     it_pad; /**< Padding for natural alignment */
640    uint16_t    it_len; /**< Length in bytes of the entire Radiotap header */
641    uint32_t    it_present; /**< Which Radiotap fields are present */
642} PACKED libtrace_radiotap_t;
643
644
645#ifdef WIN32
646#pragma pack(pop)
647#endif
648
649
650/*@}*/
651
652/** Prints help information for libtrace
653 *
654 * Function prints out some basic help information regarding libtrace,
655 * and then prints out the help() function registered with each input module
656 */
657DLLEXPORT void trace_help(void);
658
659/** @name Trace management
660 * These members deal with creating, configuring, starting, pausing and
661 * cleaning up a trace object
662 *@{
663 */
664
665/** Create a trace file from a URI
666 *
667 * @param uri containing a valid libtrace URI
668 * @return an opaque pointer to a libtrace_t
669 *
670 * Valid URI's are:
671 *  - erf:/path/to/erf/file
672 *  - erf:-  (stdin)
673 *  - dag:/dev/dagcard                 
674 *  - pcapint:pcapinterface                (eg: pcap:eth0)
675 *  - pcap:/path/to/pcap/file
676 *  - pcap:-
677 *  - rt:hostname
678 *  - rt:hostname:port
679 *  - rtclient:hostname (deprecated)
680 *  - rtclient:hostname:port (deprecated)
681 *  - wag:/dev/wagcard
682 *  - wtf:-
683 *  - wtf:/path/to/wtf/file
684 *
685 *  If an error occured when attempting to open the trace file, an error
686 *  trace is returned and trace_get_error should be called to find out
687 *  if an error occured, and what that error was.  The trace is created in the
688 *  configuration state, you must call trace_start to start the capture.
689 */
690DLLEXPORT libtrace_t *trace_create(const char *uri);
691
692/** Creates a "dummy" trace file that has only the format type set.
693 *
694 * @return an opaque pointer to a (sparsely initialised) libtrace_t
695 *
696 * IMPORTANT: Do not attempt to call trace_read_packet or other such functions
697 * with the dummy trace. Its intended purpose is to act as a packet->trace for
698 * libtrace_packet_t's that are not associated with a libtrace_t structure.
699 */
700DLLEXPORT libtrace_t *trace_create_dead(const char *uri);
701
702/** Creates a trace output file from a URI.
703 *
704 * @param uri   the uri string describing the output format and destination
705 * @return an opaque pointer to a libtrace_output_t
706 *
707 * Valid URI's are:
708 *  - erf:/path/to/erf/file
709 *  - pcap:/path/to/pcap/file
710 *  - wtf:/path/to/wtf/file
711 *
712 *  If an error occured when attempting to open the output trace, NULL is returned
713 *  and trace_errno is set. Use trace_perror_output() to get more information
714 */
715DLLEXPORT libtrace_out_t *trace_create_output(const char *uri);
716
717/** Start the capture
718 * @param libtrace      The trace to start
719 * @return 0 on success, -1 on failure
720 *
721 * This does the actual work with starting the trace capture, and applying
722 * all the config options.  This may fail.
723 */
724DLLEXPORT int trace_start(libtrace_t *libtrace);
725
726/** Pause the capture
727 * @param libtrace      The trace to pause
728 * @return 0 on success, -1 on failure
729 *
730 * This stops a capture in progress and returns you to the configuration
731 * state.  Any packets that arrive after trace_pause() has been called
732 * will be discarded.  To resume capture, call trace_start().
733 */
734DLLEXPORT int trace_pause(libtrace_t *libtrace);
735
736/** Start an output trace
737 * @param libtrace      The trace to start
738 * @return 0 on success, -1 on failure
739 *
740 * This does the actual work with starting a trace for write.  This generally
741 * creates the file.
742 */
743DLLEXPORT int trace_start_output(libtrace_out_t *libtrace);
744
745/** Valid trace capture options */
746typedef enum {
747        TRACE_OPTION_SNAPLEN,   /**< Number of bytes captured */
748        TRACE_OPTION_PROMISC,   /**< Capture packets to other hosts */
749        TRACE_OPTION_FILTER,    /**< Apply this filter to all packets */
750        TRACE_OPTION_META_FREQ, /**< Frequency of meta-data information, e.g. DUCK packets */
751        /** trace_event ignores gaps between packets when reading traces off disk */
752        TRACE_OPTION_EVENT_REALTIME
753} trace_option_t;
754
755/** Sets an input config option
756 * @param libtrace      the trace object to apply the option to
757 * @param option        the option to set
758 * @param value         the value to set the option to
759 * @return -1 if option configuration failed, 0 otherwise
760 * This should be called after trace_create, and before trace_start
761 */
762DLLEXPORT int trace_config(libtrace_t *libtrace,
763                trace_option_t option,
764                void *value);
765
766typedef enum {
767        TRACE_OPTION_OUTPUT_FILEFLAGS, /**< File flags to open the trace file
768                                        * with.  eg O_APPEND
769                                        */
770        TRACE_OPTION_OUTPUT_COMPRESS   /**< Compression level, eg 6. */
771} trace_option_output_t;
772
773/** Sets an output config option
774 *
775 * @param libtrace      the output trace object to apply the option to
776 * @param option        the option to set
777 * @param value         the value to set the option to
778 * @return -1 if option configuration failed, 0 otherwise
779 * This should be called after trace_create_output, and before
780 * trace_start_output
781 */
782DLLEXPORT int trace_config_output(libtrace_out_t *libtrace,
783                trace_option_output_t option,
784                void *value
785                );
786
787/** Close a trace file, freeing up any resources it may have been using
788 *
789 */
790DLLEXPORT void trace_destroy(libtrace_t *trace);
791
792/** Close a trace file, freeing up any resources it may have been using
793 * @param trace         trace file to be destroyed
794 */
795DLLEXPORT void trace_destroy_dead(libtrace_t *trace);
796
797/** Close a trace output file, freeing up any resources it may have been using
798 * @param trace         the output trace file to be destroyed
799 */
800DLLEXPORT void trace_destroy_output(libtrace_out_t *trace);
801
802/** Check (and clear) the current error state of an input trace
803 * @param trace         the trace file to check the error state on
804 * @return Error report
805 * This reads and returns the current error state and sets the current error
806 * to "no error".
807 */
808DLLEXPORT libtrace_err_t trace_get_err(libtrace_t *trace);
809
810/** Return if there is an error
811 * @param trace         the trace file to check the error state on
812 * This does not clear the error status, and only returns true or false.
813 */
814DLLEXPORT bool trace_is_err(libtrace_t *trace);
815
816/** Output an error message to stderr and clear the error status.
817 * @param trace         the trace with the error to output
818 * @param msg           the message to prefix to the error
819 * This function does clear the error status.
820 */
821DLLEXPORT void trace_perror(libtrace_t *trace, const char *msg,...) PRINTF(2,3);
822
823/** Check (and clear) the current error state of an output trace
824 * @param trace         the output trace file to check the error state on
825 * @return Error report
826 * This reads and returns the current error state and sets the current error
827 * to "no error".
828 */
829DLLEXPORT libtrace_err_t trace_get_err_output(libtrace_out_t *trace);
830
831/** Return if there is an error
832 * @param trace         the trace file to check the error state on
833 * This does not clear the error status, and only returns true or false.
834 */
835DLLEXPORT bool trace_is_err_output(libtrace_out_t *trace);
836
837/** Output an error message to stderr and clear the error status.
838 * @param trace         the trace with the error to output
839 * @param msg           the message to prefix to the error
840 * This function does clear the error status.
841 */
842DLLEXPORT void trace_perror_output(libtrace_out_t *trace, const char *msg,...)
843        PRINTF(2,3);
844
845
846/*@}*/
847
848/** @name Reading/Writing packets
849 * These members deal with creating, reading and writing packets
850 *
851 * @{
852 */
853
854/** Create a new packet object
855 *
856 * @return a pointer to an initialised libtrace_packet_t object
857 */
858DLLEXPORT libtrace_packet_t *trace_create_packet(void);
859
860/** Copy a packet
861 * @param packet        the source packet to copy
862 * @return a new packet which has the same content as the source packet
863 * @note This always involves a copy, which can be slow.  Use of this
864 * function should be avoided where possible.
865 * @par The reason you would want to use this function is that a zerocopied
866 * packet from a device is using the devices memory which may be a limited
867 * resource.  Copying the packet will cause it to be copied into the systems
868 * memory.
869 */
870DLLEXPORT libtrace_packet_t *trace_copy_packet(const libtrace_packet_t *packet);
871
872/** Destroy a packet object
873 *
874 * sideeffect: sets packet to NULL
875 */
876DLLEXPORT void trace_destroy_packet(libtrace_packet_t *packet);
877
878
879/** Read one packet from the trace
880 *
881 * @param trace         the libtrace opaque pointer
882 * @param packet        the packet opaque pointer
883 * @return 0 on EOF, negative value on error, number of bytes read when
884 * successful.
885 *
886 * @note the number of bytes read is usually (but not always) the same as
887 * trace_get_framing_length()+trace_get_capture_length() depending on the
888 * trace format.
889 * @note the trace must have been started with trace_start before calling
890 * this function
891 */
892DLLEXPORT int trace_read_packet(libtrace_t *trace, libtrace_packet_t *packet);
893
894/** Event types
895 * see \ref libtrace_eventobj_t and \ref trace_event
896 */
897typedef enum {
898        TRACE_EVENT_IOWAIT,     /**< Need to block on fd */
899        TRACE_EVENT_SLEEP,      /**< Sleep for some time */
900        TRACE_EVENT_PACKET,     /**< packet has arrived */
901        TRACE_EVENT_TERMINATE   /**< End of trace */
902} libtrace_event_t;
903
904/** Structure returned by libtrace_event explaining what the current event is */
905typedef struct libtrace_eventobj_t {
906        libtrace_event_t type; /**< event type (iowait,sleep,packet) */
907        int fd;                /**< if IOWAIT, the fd to sleep on */
908        double seconds;        /**< if SLEEP, the amount of time to sleep for
909                                */
910        int size;              /**< if PACKET, the value returned from
911                                *  trace_read_packet
912                                */
913} libtrace_eventobj_t;
914
915/** Processes the next libtrace event
916 * @param trace the libtrace opaque pointer
917 * @param packet the libtrace_packet opaque pointer
918 * @return libtrace_event struct containing the type, and potential
919 *      fd or seconds to sleep on
920 *
921 * Type can be:
922 *  TRACE_EVENT_IOWAIT  Waiting on I/O on fd
923 *  TRACE_EVENT_SLEEP   Next event in seconds
924 *  TRACE_EVENT_PACKET  Packet arrived in buffer with size size
925 *  TRACE_EVENT_TERMINATE Trace terminated (perhaps with an error condition)
926 */
927DLLEXPORT libtrace_eventobj_t trace_event(libtrace_t *trace,
928                libtrace_packet_t *packet);
929
930
931/** Write one packet out to the output trace
932 *
933 * @param trace         the libtrace_out opaque pointer
934 * @param packet        the packet opaque pointer
935 * @return the number of bytes written out, if zero or negative then an error has occured.
936 */
937DLLEXPORT int trace_write_packet(libtrace_out_t *trace, libtrace_packet_t *packet);
938/*@}*/
939
940/** @name Protocol decodes
941 * These functions locate and return a pointer to various headers inside a
942 * packet
943 * @{
944 */
945
946/** get a pointer to the link layer
947 * @param packet        the packet opaque pointer
948 *
949 * @return a pointer to the link layer, or NULL if there is no link layer
950 *
951 * @note you should call trace_get_link_type to find out what type of link
952 * layer this is
953 */
954DLLEXPORT SIMPLE_FUNCTION
955void *trace_get_link(const libtrace_packet_t *packet);
956
957/** get a pointer to the IPv4 header (if any)
958 * @param packet        the packet opaque pointer
959 *
960 * @return a pointer to the IPv4 header, or NULL if there is no IPv4 header
961 */
962DLLEXPORT SIMPLE_FUNCTION
963libtrace_ip_t *trace_get_ip(libtrace_packet_t *packet);
964
965/** get a pointer to the IPv6 header (if any)
966 * @param packet        the packet opaque pointer
967 *
968 * @return a pointer to the IPv6 header, or NULL if there is no IPv6 header
969 */
970DLLEXPORT SIMPLE_FUNCTION
971libtrace_ip6_t *trace_get_ip6(libtrace_packet_t *packet);
972
973/** Get a pointer to the layer 3 header.
974 * @param packet                The packet opaque pointer
975 * @param[out] ethertype        The ethertype of the layer 3 header
976 * @param[out] remaining        The amount of space available after this header
977 *                              has been removed.
978 *
979 * @return a pointer to the layer 3 header.
980 * remaining may be NULL, otherwise it will be filled in by the remaining size
981 * of the captured packet.
982 */
983DLLEXPORT SIMPLE_FUNCTION
984void *trace_get_layer3(libtrace_packet_t *packet,
985                uint16_t *ethertype, uint32_t *remaining);
986
987/** Gets a pointer to the transport layer header (if any)
988 * @param packet        a pointer to a libtrace_packet structure
989 * @param[out] proto    transport layer protocol
990 *
991 * @return a pointer to the transport layer header, or NULL if there is no header
992 *
993 * @note proto may be NULL if proto is unneeded.
994 */
995DLLEXPORT void *trace_get_transport(libtrace_packet_t *packet, uint8_t *proto,
996                uint32_t *remaining);
997
998/** Gets a pointer to the payload given a pointer to the IP header
999 * @param ip            The IP Header
1000 * @param[out] proto    An output variable of the IP protocol
1001 * @param[in,out] remaining Updated with the number of bytes remaining
1002 *
1003 * @return a pointer to the transport layer header, or NULL if header isn't present.
1004 *
1005 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
1006 * of bytes captured of the IP header and beyond.  It will be updated after this
1007 * function to the number of bytes remaining after the IP header (and any IP options)
1008 * have been removed.
1009 *
1010 * proto may be NULL if not needed.
1011 *
1012 * @note This is similar to trace_get_transport_from_ip in libtrace2
1013 */
1014DLLEXPORT void *trace_get_payload_from_ip(libtrace_ip_t *ip, uint8_t *proto,
1015                uint32_t *remaining);
1016
1017/** Gets a pointer to the payload given a pointer to the IPv6 header
1018 * @param ipptr         The IPv6 Header
1019 * @param[out] proto    An output variable of the protocol of the next header
1020 * @param[in,out] remaining Updated with the number of bytes remaining
1021 *
1022 * @return a pointer to the transport layer header, or NULL if the IPv6 header isn't complete.
1023 *
1024 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
1025 * of bytes captured of the IP header and beyond.  It will be updated after this
1026 * function to the number of bytes remaining after the IP header (and any IP options)
1027 * have been removed.
1028 *
1029 * proto may be NULL if not needed.
1030 *
1031 */
1032DLLEXPORT void *trace_get_payload_from_ip6(libtrace_ip6_t *ipptr,
1033                uint8_t *prot, uint32_t *remaining);
1034
1035/** Gets a pointer to the payload given a pointer to the link header
1036 * @param ip            The link pointer
1037 * @param[out] type     An output variable of the ethernet type
1038 * @param[in,out] remaining Updated with the number of bytes remaining
1039 *
1040 * @return a pointer to the transport layer header, or NULL if header isn't
1041 * present.
1042 *
1043 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
1044 * of bytes captured of the linklayer and beyond.  It will be updated after
1045 * this function to the number of bytes remaining after the IP header (and any
1046 * IP options) have been removed.
1047 *
1048 * type may be NULL if not needed.
1049 *
1050 */
1051DLLEXPORT void *trace_get_payload_from_link(void *linkptr,
1052                libtrace_linktype_t linktype,
1053                uint16_t *type, uint32_t *remaining);
1054
1055/** Skips over any 802.1q headers, if present.
1056 * @param ethernet      A pointer to the payload following an ethernet header -usually the result of calling trace_get_payload_from_link
1057 * @param[in,out] type  The ethernet type, replaced with the vlan ether type
1058 * @param[in,out] remaining Updated with the number of bytes remaining
1059 *
1060 * @return a pointer to the header beyond the vlan header, if present.
1061 * Otherwise, returns the ethernet payload that was passed in
1062 *
1063 * Remaining may be NULL. If Remaining is not NULL it must point to the number
1064 * of bytes captured past (but not including) the link layer. It will be
1065 * updated after this function to the number of bytes remaining after the
1066 * vlan header. If it is unchanged then no vlan header exists.
1067 *
1068 * Type must point to the value of the ethernet type. Libtrace will assert
1069 * fail if type is NULL.
1070 *
1071 */
1072DLLEXPORT void *trace_get_vlan_payload_from_ethernet_payload(
1073                void *ethernet_payload, uint16_t *type, uint32_t *remaining);
1074
1075/** Gets a pointer to the payload given a pointer to a tcp header
1076 * @param tcp           The tcp Header
1077 * @param[in,out] remaining Updated with the number of bytes remaining
1078 *
1079 * @return a pointer to the tcp payload, or NULL if the payload isn't present.
1080 *
1081 * Remaining may be NULL.  If remaining is not NULL it must point to the number
1082 * of bytes captured of the TCP header and beyond.  It will be updated after
1083 * this function to the number of bytes remaining after the TCP header (and any
1084 * TCP options) have been removed.
1085 *
1086 */
1087DLLEXPORT void *trace_get_payload_from_tcp(libtrace_tcp_t *tcp,
1088                uint32_t *remaining);
1089
1090/** Gets a pointer to the payload given a pointer to a udp header
1091 * @param udp           The udp Header
1092 * @param[in,out] remaining Updated with the number of bytes remaining
1093 *
1094 * @return a pointer to the udp payload, or NULL if the payload isn't present.
1095 *
1096 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
1097 * of bytes captured of the UDP header and beyond.  It will be updated after
1098 * this function to the number of bytes remaining after the UDP header.
1099 *
1100 */
1101DLLEXPORT void *trace_get_payload_from_udp(libtrace_udp_t *udp, uint32_t *remaining);
1102
1103/** Gets a pointer to the payload given a pointer to a icmp header
1104 * @param icmp          The icmp Header
1105 * @param[in,out] remaining Updated with the number of bytes remaining
1106 *
1107 * @return a pointer to the icmp payload, or NULL if the payload isn't present.
1108 *
1109 * Remaining may be NULL.  If remaining is not NULL it must point to the number
1110 * of bytes captured of the ICMP header and beyond.  It will be updated after
1111 * this function to the number of bytes remaining after the ICMP header.
1112 *
1113 */
1114DLLEXPORT void *trace_get_payload_from_icmp(libtrace_icmp_t *icmp,
1115                uint32_t *remaining);
1116
1117/** get a pointer to the TCP header (if any)
1118 * @param packet        the packet opaque pointer
1119 *
1120 * @return a pointer to the TCP header, or NULL if there is not a TCP packet
1121 */
1122DLLEXPORT SIMPLE_FUNCTION
1123libtrace_tcp_t *trace_get_tcp(libtrace_packet_t *packet);
1124
1125/** get a pointer to the TCP header (if any) given a pointer to the IP header
1126 * @param ip            The IP header
1127 * @param[in,out] remaining Updated with the number of bytes remaining
1128 *
1129 * @return a pointer to the TCP header, or NULL if this is not a TCP packet
1130 *
1131 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
1132 * of bytes captured of the TCP header and beyond.  It will be updated after
1133 * this function to the number of bytes remaining after the TCP header (and any
1134 * TCP options) have been removed.
1135 *
1136 * @note The last parameter has changed from libtrace2
1137 */
1138DLLEXPORT SIMPLE_FUNCTION
1139libtrace_tcp_t *trace_get_tcp_from_ip(libtrace_ip_t *ip, uint32_t *remaining);
1140
1141/** get a pointer to the UDP header (if any)
1142 * @param packet        the packet opaque pointer
1143 *
1144 * @return a pointer to the UDP header, or NULL if this is not a UDP packet
1145 */
1146DLLEXPORT SIMPLE_FUNCTION
1147libtrace_udp_t *trace_get_udp(libtrace_packet_t *packet);
1148
1149/** get a pointer to the UDP header (if any) given a pointer to the IP header
1150 * @param       ip      The IP header
1151 * @param[in,out] remaining Updated with the number of bytes remaining
1152 *
1153 * @return a pointer to the UDP header, or NULL if this is not an UDP packet
1154 *
1155 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
1156 * of bytes captured of the UDP header and beyond.  It will be updated after
1157 * this function to the number of bytes remaining after the UDP header have
1158 * been removed.
1159 *
1160 * @note Beware the change from libtrace2 from skipped to remaining
1161 */
1162DLLEXPORT SIMPLE_FUNCTION
1163libtrace_udp_t *trace_get_udp_from_ip(libtrace_ip_t *ip,uint32_t *remaining);
1164
1165/** get a pointer to the ICMP header (if any)
1166 * @param packet        the packet opaque pointer
1167 *
1168 * @return a pointer to the ICMP header, or NULL if this is not a ICMP packet
1169 */
1170DLLEXPORT SIMPLE_FUNCTION
1171libtrace_icmp_t *trace_get_icmp(libtrace_packet_t *packet);
1172
1173/** get a pointer to the ICMP header (if any) given a pointer to the IP header
1174 * @param ip            The IP header
1175 * @param[in,out] remaining Updated with the number of bytes remaining
1176 *
1177 * @return a pointer to the ICMP header, or NULL if this is not an ICMP packet
1178 *
1179 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
1180 * of bytes captured of the ICMP header and beyond.  It will be updated after
1181 * this function to the number of bytes remaining after the ICMP header.
1182 *
1183 * @note Beware the change from libtrace2 from skipped to remaining
1184 */
1185DLLEXPORT SIMPLE_FUNCTION
1186libtrace_icmp_t *trace_get_icmp_from_ip(libtrace_ip_t *ip,uint32_t *remaining);
1187
1188/** Get the destination MAC address
1189 * @param packet        the packet opaque pointer
1190 * @return a pointer to the destination mac, (or NULL if there is no
1191 * destination MAC)
1192 */
1193DLLEXPORT SIMPLE_FUNCTION
1194uint8_t *trace_get_destination_mac(libtrace_packet_t *packet);
1195
1196/** Get the source MAC address
1197 * @param packet        the packet opaque pointer
1198 * @return a pointer to the source mac, (or NULL if there is no source MAC)
1199 */
1200DLLEXPORT SIMPLE_FUNCTION
1201uint8_t *trace_get_source_mac(libtrace_packet_t *packet);
1202
1203/** Get the source IP address
1204 * @param packet        the packet opaque pointer
1205 * @param addr          a pointer to a sockaddr to store the address in, or NULL to use
1206 *                      static storage.
1207 * @return NULL if there is no source address, or a sockaddr holding a v4 or v6
1208 * address
1209 */
1210DLLEXPORT SIMPLE_FUNCTION
1211struct sockaddr *trace_get_source_address(const libtrace_packet_t *packet,
1212                struct sockaddr *addr);
1213
1214/** Get the destination IP address
1215 * @param packet        the packet opaque pointer
1216 * @param addr          a pointer to a sockaddr to store the address in, or NULL to use
1217 *                      static storage.
1218 * @return NULL if there is no destination address, or a sockaddr holding a v4
1219 * or v6 address
1220 */
1221DLLEXPORT SIMPLE_FUNCTION
1222struct sockaddr *trace_get_destination_address(const libtrace_packet_t *packet,
1223                struct sockaddr *addr);
1224
1225/*@}*/
1226
1227/** parse an ip or tcp option
1228 * @param[in,out] ptr   the pointer to the current option
1229 * @param[in,out] len   the length of the remaining buffer
1230 * @param[out] type     the type of the option
1231 * @param[out] optlen   the length of the option
1232 * @param[out] data     the data of the option
1233 *
1234 * @return bool true if there is another option (and the fields are filled in)
1235 *               or false if this was the last option.
1236 *
1237 * This updates ptr to point to the next option after this one, and updates
1238 * len to be the number of bytes remaining in the options area.  Type is updated
1239 * to be the code of this option, and data points to the data of this option,
1240 * with optlen saying how many bytes there are.
1241 *
1242 * @note Beware of fragmented packets.
1243 */
1244DLLEXPORT int trace_get_next_option(unsigned char **ptr,int *len,
1245                        unsigned char *type,
1246                        unsigned char *optlen,
1247                        unsigned char **data);
1248
1249
1250/** @name Time
1251 * These functions deal with time that a packet arrived and return it
1252 * in various formats
1253 * @{
1254 */
1255/** Get the current time in DAG time format
1256 * @param packet        the packet opaque pointer
1257 *
1258 * @return a 64 bit timestamp in DAG ERF format (upper 32 bits are the seconds
1259 * past 1970-01-01, the lower 32bits are partial seconds)
1260 */
1261DLLEXPORT SIMPLE_FUNCTION
1262uint64_t trace_get_erf_timestamp(const libtrace_packet_t *packet);
1263
1264/** Get the current time in struct timeval
1265 * @param packet        the packet opaque pointer
1266 *
1267 * @return time that this packet was seen in a struct timeval
1268 */
1269DLLEXPORT SIMPLE_FUNCTION
1270struct timeval trace_get_timeval(const libtrace_packet_t *packet);
1271
1272/** Get the current time in floating point seconds
1273 * @param packet        the packet opaque pointer
1274 *
1275 * @return time that this packet was seen in 64bit floating point seconds from
1276 * the unix epoch (1970-01-01 00:00:00 UTC).
1277 */
1278DLLEXPORT SIMPLE_FUNCTION
1279double trace_get_seconds(const libtrace_packet_t *packet);
1280
1281/** Seek within a trace
1282 * @param trace         trace to seek
1283 * @param seconds       time to seek to
1284 * @return 0 on success.
1285 * Make the next packet read to be the first packet to occur at or after the
1286 * time searched for.  This must be called in the configuration state (ie,
1287 * before trace_start() or after trace_pause().
1288 * @note This function may be extremely slow.
1289 */
1290DLLEXPORT int trace_seek_seconds(libtrace_t *trace, double seconds);
1291
1292/** Seek within a trace
1293 * @param trace         trace to seek
1294 * @param tv            time to seek to
1295 * @return 0 on success.
1296 * Make the next packet read to be the first packet to occur at or after the
1297 * time searched for.  This must be called in the configuration state (ie,
1298 * before trace_start() or after trace_pause().
1299 * @note This function may be extremely slow.
1300 */
1301DLLEXPORT int trace_seek_timeval(libtrace_t *trace, struct timeval tv);
1302
1303/** Seek within a trace
1304 * @param trace         trace to seek
1305 * @param ts            erf timestamp
1306 * @return 0 on success.
1307 * Make the next packet read to be the first packet to occur at or after the
1308 * time searched for.  This must be called in the configuration state (ie,
1309 * before trace_start() or after trace_pause().
1310 * @note This function may be extremely slow.
1311 */
1312DLLEXPORT int trace_seek_erf_timestamp(libtrace_t *trace, uint64_t ts);
1313
1314/*@}*/
1315
1316/** @name Sizes
1317 * This section deals with finding or setting the various different lengths
1318 * a packet can have
1319 * @{
1320 */
1321/** Get the size of the packet in the trace
1322 * @param packet        the packet opaque pointer
1323 * @return the size of the packet in the trace
1324 * @note Due to this being a header capture, or anonymisation, this may not
1325 * be the same size as the original packet.  See get_wire_length() for the
1326 * original size of the packet.
1327 * @note This can (and often is) different for different packets in a trace!
1328 * @note This is sometimes called the "snaplen".
1329 * @note The return size refers to the network-level payload of the packet and
1330 * does not include any capture framing headers. For example, an Ethernet
1331 * packet with an empty TCP packet will return sizeof(ethernet_header) +
1332 * sizeof(ip_header) + sizeof(tcp_header), but not the capture file
1333 * (pcap/erf/etc) header.
1334 */
1335DLLEXPORT SIMPLE_FUNCTION
1336size_t trace_get_capture_length(libtrace_packet_t *packet);
1337
1338/** Get the size of the packet as it was seen on the wire.
1339 * @param packet        the packet opaque pointer
1340 * @return the size of the packet as it was on the wire.
1341 * @note Due to the trace being a header capture, or anonymisation this may
1342 * not be the same as the Capture Len.
1343 * @note trace_getwire_length \em{includes} FCS.
1344 * @note The return size refers to the network-level payload of the packet and
1345 * does not include any capture framing headers. For example, an Ethernet
1346 * packet with an empty TCP packet will return sizeof(ethernet_header) +
1347 * sizeof(ip_header) + sizeof(tcp_header), but not the capture file
1348 * (pcap/erf/etc) header.
1349 */
1350DLLEXPORT SIMPLE_FUNCTION
1351size_t trace_get_wire_length(const libtrace_packet_t *packet);
1352
1353/** Get the length of the capture framing headers.
1354 * @param packet        the packet opaque pointer
1355 * @return the size of the packet as it was on the wire.
1356 * @note this length corresponds to the difference between the size of a
1357 * captured packet in memory, and the captured length of the packet
1358 */
1359DLLEXPORT SIMPLE_FUNCTION
1360size_t trace_get_framing_length(const libtrace_packet_t *packet);
1361
1362/** Truncate ("snap") the packet at the suggested length
1363 * @param packet        the packet opaque pointer
1364 * @param size          the new length of the packet
1365 * @return the new capture length of the packet, or the original capture
1366 * length of the packet if unchanged
1367 */
1368DLLEXPORT size_t trace_set_capture_length(libtrace_packet_t *packet, size_t size);
1369
1370/*@}*/
1371
1372
1373/** Get the type of the link layer
1374 * @param packet        the packet opaque pointer
1375 * @return libtrace_linktype_t
1376 */
1377DLLEXPORT SIMPLE_FUNCTION
1378libtrace_linktype_t trace_get_link_type(const libtrace_packet_t *packet);
1379
1380/** Set the direction flag, if it has one
1381 * @param packet        the packet opaque pointer
1382 * @param direction     the new direction
1383 * @returns -1 on error, or the direction that was set.
1384 */
1385DLLEXPORT libtrace_direction_t trace_set_direction(libtrace_packet_t *packet, libtrace_direction_t direction);
1386
1387/** Get the direction flag, if it has one
1388 * @param packet        the packet opaque pointer
1389 * @return a value containing the direction flag, or -1 if this is not supported
1390 * The direction is defined as 0 for packets originating locally (ie, outbound)
1391 * and 1 for packets originating remotely (ie, inbound).
1392 * Other values are possible, which might be overloaded to mean special things
1393 * for a special trace.
1394 */
1395DLLEXPORT SIMPLE_FUNCTION
1396libtrace_direction_t trace_get_direction(const libtrace_packet_t *packet);
1397
1398/** @name BPF
1399 * This section deals with using Berkley Packet Filters
1400 * @{
1401 */
1402/** setup a BPF filter
1403 * @param filterstring a char * containing the bpf filter string
1404 * @return opaque pointer pointer to a libtrace_filter_t object
1405 * @note The filter is not actually compiled at this point, so no correctness
1406 * tests are performed here. trace_create_filter will always return ok, but
1407 * if the filter is poorly constructed an error will be generated when the
1408 * filter is actually used
1409 */
1410DLLEXPORT SIMPLE_FUNCTION
1411libtrace_filter_t *trace_create_filter(const char *filterstring);
1412
1413/** apply a BPF filter
1414 * @param filter        the filter opaque pointer
1415 * @param packet        the packet opaque pointer
1416 * @return >0 if the filter matches, 0 if it doesn't, -1 on error.
1417 * @note Due to the way BPF filters are built, the filter is not actually
1418 * compiled until the first time trace_create_filter is called. If your filter
1419 * is incorrect, it will generate an error message and assert, exiting the
1420 * program. This behaviour may change to more graceful handling of this error
1421 * in the future.
1422 */
1423DLLEXPORT int trace_apply_filter(libtrace_filter_t *filter,
1424                const libtrace_packet_t *packet);
1425
1426/** destory of BPF filter
1427 * @param filter        the filter opaque pointer
1428 * Deallocate all the resources associated with a BPF filter
1429 */
1430DLLEXPORT void trace_destroy_filter(libtrace_filter_t *filter);
1431/*@}*/
1432
1433/** @name Portability
1434 * This section has functions that causes annoyances to portability for one
1435 * reason or another.
1436 * @{
1437 */
1438
1439/** Convert an ethernet address to a string
1440 * @param addr  Ethernet address in network byte order
1441 * @param buf   Buffer to store the ascii representation, or NULL
1442 * @return buf, or if buf is NULL then a statically allocated buffer.
1443 *
1444 * This function is similar to the GNU ether_ntoa_r function, with a few
1445 * minor differences.  if NULL is passed as buf, then the function will
1446 * use an internal static buffer, if NULL isn't passed then the function
1447 * will use that buffer instead.
1448 *
1449 * @note the type of addr isn't struct ether_addr as it is with ether_ntoa_r,
1450 * however it is bit compatible so that a cast will work.
1451 */
1452DLLEXPORT char *trace_ether_ntoa(const uint8_t *addr, char *buf);
1453
1454/** Convert a string to an ethernet address
1455 * @param buf   Ethernet address in hex format delimited with :'s.
1456 * @param addr  buffer to store the binary representation, or NULL
1457 * @return addr, or if addr is NULL, then a statically allocated buffer.
1458 *
1459 * This function is similar to the GNU ether_aton_r function, with a few
1460 * minor differences.  if NULL is passed as addr, then the function will
1461 * use an internal static buffer, if NULL isn't passed then the function will
1462 * use that buffer instead.
1463 *
1464 * @note the type of addr isn't struct ether_addr as it is with ether_aton_r,
1465 * however it is bit compatible so that a cast will work.
1466 */
1467DLLEXPORT uint8_t *trace_ether_aton(const char *buf, uint8_t *addr);
1468
1469/*@}*/
1470
1471
1472/** Which port is the server port */
1473typedef enum {
1474        USE_DEST,       /**< Destination port is the server port */
1475        USE_SOURCE      /**< Source port is the server port */
1476} serverport_t;
1477
1478/** Get the source port
1479 * @param packet        the packet to read from
1480 * @return a port in \em HOST byte order, or equivalent to ports for this
1481 * protocol, or 0 if this protocol has no ports.
1482 */
1483DLLEXPORT SIMPLE_FUNCTION
1484uint16_t trace_get_source_port(const libtrace_packet_t *packet);
1485
1486/** Get the destination port
1487 * @param packet        the packet to read from
1488 * @return a port in \em HOST byte order, or equivilent to ports for this
1489 * protocol, or 0 if this protocol has no ports.
1490 */
1491DLLEXPORT SIMPLE_FUNCTION
1492uint16_t trace_get_destination_port(const libtrace_packet_t *packet);
1493
1494/** hint at the server port in specified protocol
1495 * @param protocol      the IP layer protocol, eg 6 (tcp), 17 (udp)
1496 * @param source        the source port from the packet
1497 * @param dest          the destination port from the packet
1498 * @return one of USE_SOURCE or USE_DEST depending on which one you should use
1499 * @note ports must be in \em HOST byte order!
1500 */
1501DLLEXPORT SIMPLE_FUNCTION
1502int8_t trace_get_server_port(uint8_t protocol, uint16_t source, uint16_t dest);
1503
1504/** Takes a uri and splits it into a format and uridata component.
1505 * @param uri           the uri to be parsed
1506 * @param format        destination location for the format component of the uri
1507 * @return 0 if an error occured, otherwise return the uridata component
1508 */
1509DLLEXPORT const char *trace_parse_uri(const char *uri, char **format);
1510
1511/** Gets the format type for a given packet.
1512 * @param packet        the packet opaque pointer
1513 * @return the format of the packet
1514 */
1515DLLEXPORT
1516enum base_format_t trace_get_format(struct libtrace_packet_t *packet);
1517
1518/** Construct a packet from a buffer.
1519 * @param packet[in,out]        Libtrace Packet object to update with the new
1520 *                              data.
1521 * @param linktype              The linktype of the packet.
1522 * @param[in] data              The packet data (including linklayer)
1523 * @param len                   Length of packet data
1524 */
1525DLLEXPORT
1526void trace_construct_packet(libtrace_packet_t *packet,
1527                libtrace_linktype_t linktype, const void *data, uint16_t len);
1528
1529/*@}*/
1530
1531/** @name Wireless trace support
1532 * Functions to access wireless information from packets that have wireless
1533 * monitoring headers such as Radiotap or Prism.
1534 *
1535 * The trace_get_wireless_* functions provide an abstract interface for
1536 * retrieving information from wireless traces. They take a pointer to the
1537 * wireless monitoring header (usually found with trace_get_link(packet)) and
1538 * the linktype of the header passed in.
1539 *
1540 * All of the trace_get_wireless_* functions return false if the requested
1541 * information was unavailable, or true if it was. The actual data is stored
1542 * in an output variable supplied by the caller. Values returned into the
1543 * output variable will always be returned in host byte order.
1544 * @{
1545 */
1546
1547
1548#ifndef ARPHRD_80211_RADIOTAP
1549/* libc doesn't define this yet, but it seems to be what everyone is using
1550 */
1551#define ARPHRD_80211_RADIOTAP 803
1552#endif
1553
1554/** Get the wireless Timer Syncronisation Function
1555 *
1556 * Gets the value of the timer syncronisation function for this frame, which
1557 * is a value in microseconds indicating the time that the first bit of the
1558 * MPDU was received by the MAC.
1559 *
1560 * @param link the wireless header
1561 * @param linktype the linktype of the wireless header passed in
1562 * @param[out] tsft the value of the timer syncronisation function.
1563 * @return true if the field was available, false if not.
1564 */
1565DLLEXPORT bool trace_get_wireless_tsft(void *linkptr,
1566        libtrace_linktype_t linktype, uint64_t *tsft);
1567
1568/** Get the wireless rate
1569 * @param link the wireless header
1570 * @param linktype the linktype of the wireless header passed in
1571 * @param[out] rate the data-rate of the frame in units of 500kbps
1572 * @return true if the field was available, false if not.
1573 */
1574DLLEXPORT bool trace_get_wireless_rate(void *linkptr,
1575        libtrace_linktype_t linktype, uint8_t *rate);
1576
1577/** Get the wireless channel frequency
1578 * @param link the wireless header
1579 * @param linktype the linktype of the wireless header passed in
1580 * @param[out] freq the frequency in MHz of the channel the frame was transmitted
1581 * or received on.
1582 * @return true if the field was available, false if not.
1583 */
1584DLLEXPORT bool trace_get_wireless_freq(void *linkptr,
1585        libtrace_linktype_t linktype, uint16_t *freq);
1586
1587/** Get the wireless signal strength in dBm
1588 * @param link the wireless header
1589 * @param linktype the linktype of the wireless header passed in
1590 * @param[out] strength the RF signal power at the antenna, in dB difference
1591 * from 1mW.
1592 * @return true if the field was available, false if not.
1593 */
1594DLLEXPORT bool trace_get_wireless_signal_strength_dbm(void *linkptr,
1595        libtrace_linktype_t linktype, int8_t *strength);
1596
1597/** Get the wireless noise strength in dBm
1598 * @param link the wireless header
1599 * @param linktype the linktype of the wireless header passed in
1600 * @param[out] strength the RF noise power at the antenna, in dB difference
1601 * from 1mW.
1602 * @return true if the field was available, false if not.
1603 */
1604DLLEXPORT bool trace_get_wireless_noise_strength_dbm(void *linkptr,
1605        libtrace_linktype_t linktype, int8_t *strength);
1606
1607/** Get the wireless signal strength in dB
1608 * @param link the wireless header
1609 * @param linktype the linktype of the wireless header passed in
1610 * @param[out] strength the RF signal power at the antenna,in dB difference
1611 * from a fixed reference.
1612 * @return true if the field was available, false if not.
1613 */
1614DLLEXPORT bool trace_get_wireless_signal_strength_db(void *linkptr,
1615        libtrace_linktype_t linktype, uint8_t *strength);
1616
1617/** Get the wireless noise strength in dB
1618 * @param link the wireless header
1619 * @param linktype the linktype of the wireless header passed in
1620 * @param[out] strength the RF noise power at the antenna, in dB difference
1621 * from a fixed reference.
1622 * @return true if the field was available, false if not.
1623 */
1624DLLEXPORT bool trace_get_wireless_noise_strength_db(void *linkptr,
1625        libtrace_linktype_t linktype, uint8_t *strength);
1626
1627/** Get the wireless transmit attenuation
1628 * @param link the wireless header
1629 * @param linktype the linktype of the wireless header passed in
1630 * @param[out] attenuation the transmit power as a unitless distance from maximum
1631 * power set at factory calibration. 0 indicates maximum transmission power.
1632 * @return true if the field was available, false if not.
1633 */
1634DLLEXPORT bool trace_get_wireless_tx_attenuation(void *linkptr,
1635        libtrace_linktype_t linktype, uint16_t *attenuation);
1636
1637/** Get the wireless transmit attenuation in dB
1638 * @param link the wireless header
1639 * @param linktype the linktype of the wireless header passed in
1640 * @param[out] attenuation the transmit power as dB difference from maximum power
1641 * set at factory calibration. 0 indicates maximum power.
1642 * @return true if the field was available, false if not.
1643 */
1644DLLEXPORT bool trace_get_wireless_tx_attenuation_db(void *linkptr,
1645        libtrace_linktype_t linktype, uint16_t *attenuation);
1646
1647/** Get the wireless transmit power in dBm @param link the wireless header
1648 * @param linktype the linktype of the wireless header passed in
1649 * @param[out] txpower the transmit power as dB from a 1mW reference. This is the absolute power level measured at the antenna port. 
1650 * @return true if the field was available, false if not.
1651 */
1652DLLEXPORT bool trace_get_wireless_tx_power_dbm(void *linkptr, libtrace_linktype_t
1653                linktype, int8_t *txpower);
1654
1655/** Get the wireless antenna
1656 * @param link the wireless header
1657 * @param linktype the linktype of the wireless header passed in
1658 * @param[out] antenna which antenna was used to transmit or receive the frame.
1659 * @return true if the field was available, false if not.
1660 */
1661DLLEXPORT bool trace_get_wireless_antenna(void *linkptr,
1662        libtrace_linktype_t linktype, uint8_t *antenna);
1663
1664/*@}*/
1665
1666#ifdef __cplusplus
1667} /* extern "C" */
1668#endif /* #ifdef __cplusplus */
1669#endif /* LIBTRACE_H_ */
Note: See TracBrowser for help on using the repository browser.