source: lib/libtrace.h.in @ e1fdc05

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