source: lib/libtrace.h.in @ 83445f0

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 83445f0 was 83445f0, checked in by Shane Alcock <salcock@…>, 16 years ago

Tidied up some of the documentation
Removed the out-dated trace_get_output_format function

  • Property mode set to 100644
File size: 42.1 KB
Line 
1/*
2 * This file is part of libtrace
3 *
4 * Copyright (c) 2004 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#include <sys/time.h>
60
61#ifdef _MSC_VER
62    /* define the following from MSVC's internal types */
63    typedef             __int8  int8_t;
64    typedef             __int16 int16_t;
65    typedef             __int32 int32_t;
66    typedef             __int64 int64_t;
67    typedef unsigned    __int8  uint8_t;
68    typedef unsigned    __int16 uint16_t;
69    typedef unsigned    __int32 uint32_t;
70    typedef unsigned    __int64 uint64_t;
71        #ifdef BUILDING_DLL
72                #define DLLEXPORT __declspec(dllexport)
73        #else
74                #define DLLEXPORT __declspec(dllimport)
75        #endif
76        #define DLLLOCAL
77#else
78        #ifdef HAVE_GCCVISIBILITYPATCH
79                #define DLLEXPORT __attribute__ (visibility("default"))
80                #define DLLLOCAL __attribute__ (visibility("hidden"))
81        #else
82                #define DLLEXPORT
83                #define DLLLOCAL
84        #endif
85#endif
86
87#ifdef WIN32
88#   include <winsock2.h>
89#   include <ws2tcpip.h>
90    typedef short sa_family_t;
91    /* Make up for a lack of stdbool.h */
92#    define bool signed char
93#    define false 0
94#    define true 1
95#    if !defined(ssize_t)
96     /* XXX: Not 64-bit safe! */
97#    define ssize_t int
98#    endif   
99#else
100#    include <netinet/in.h>
101
102#ifndef __cplusplus
103#    include <stdbool.h>
104#endif
105
106#    include <sys/types.h>
107#    include <sys/socket.h>
108#endif
109
110/** API version as 2 byte hex digits, eg 0xXXYYZZ */
111#define LIBTRACE_API_VERSION \
112            ((@LIBTRACE_MAJOR@<<16)|(@LIBTRACE_MID@<<8)|(@LIBTRACE_MINOR@))
113
114#ifdef __cplusplus
115extern "C" {
116#endif
117
118/* Function does not depend on anything but its
119 * parameters, used to hint gcc's optimisations
120 */
121#if __GNUC__ >= 3
122#  define SIMPLE_FUNCTION __attribute__((pure))
123#  define UNUSED __attribute__((unused))
124#  define PACKED __attribute__((packed))
125#  define CONSTRUCTOR __attribute__((constructor))
126#else
127#  define SIMPLE_FUNCTION
128#  define UNUSED
129#  define PACKED
130#  define CONSTRUCTOR
131#endif
132       
133/** Opaque structure holding information about an output trace */
134typedef struct libtrace_out_t libtrace_out_t;
135       
136/** Opaque structure holding information about a trace */
137typedef struct libtrace_t libtrace_t;
138       
139/** Opaque structure holding information about a bpf filter */
140typedef struct libtrace_filter_t libtrace_filter_t;
141
142/** If a packet has memory allocated
143 * If the packet has allocated it's own memory it's buffer_control should
144 * be TRACE_CTRL_PACKET, when the packet is destroyed it's memory will be
145 * free()'d.  If it's doing zerocopy out of memory owned by something else
146 * it should be TRACE_CTRL_EXTERNAL.
147 * @note the letters p and e are magic numbers used to detect if the packet
148 * wasn't created properly
149 */
150typedef enum {
151        TRACE_CTRL_PACKET='p',
152        TRACE_CTRL_EXTERNAL='e'
153} buf_control_t;
154/** The size of a packet's buffer when managed by libtrace */
155#define LIBTRACE_PACKET_BUFSIZE 65536
156
157/** The libtrace packet structure, applications shouldn't be
158 * meddling around in here
159 */
160typedef struct libtrace_packet_t {
161        struct libtrace_t *trace; /**< pointer to the trace */
162        void *header;           /**< pointer to the framing header */
163        void *payload;          /**< pointer to the link layer */
164        buf_control_t buf_control; /**< who owns the memory */
165        void *buffer;           /**< allocated buffer */
166        size_t size;            /**< trace_get_framing_length()
167                                 * +trace_get_capture_length() */
168        uint32_t type;          /**< rt protocol type for the packet */
169} libtrace_packet_t;
170
171/** libtrace error information */
172typedef struct trace_err_t{
173        int err_num;            /**< error code */
174        char problem[255];      /**< the format, uri etc that caused the error for reporting purposes */
175} libtrace_err_t;
176
177/** Enumeration of error codes */
178enum {
179        /** No Error has occured.... yet. */
180        TRACE_ERR_NOERROR       = 0,
181        /** The URI passed to trace_create() is unsupported, or badly formed */
182        TRACE_ERR_BAD_FORMAT    = -1,
183        /** The trace failed to initialise */
184        TRACE_ERR_INIT_FAILED   = -2,
185        /** Unknown config option */
186        TRACE_ERR_UNKNOWN_OPTION= -3,
187        /** This output uri cannot write packets of this type */
188        TRACE_ERR_NO_CONVERSION = -4,
189        /** This packet is corrupt, or unusable for the action required */
190        TRACE_ERR_BAD_PACKET    = -5,
191        /** Option known, but unsupported by this format */
192        TRACE_ERR_OPTION_UNAVAIL= -6,
193        /** This feature is unsupported */
194        TRACE_ERR_UNSUPPORTED   = -7
195};
196
197/** Enumeration of DLT types supported by libtrace */
198typedef enum {
199        TRACE_DLT_NULL = 0,
200        TRACE_DLT_EN10MB = 1,
201        TRACE_DLT_ATM_RFC1483 = 11,
202        TRACE_DLT_IEEE802_11 = 105,
203        TRACE_DLT_LINUX_SLL = 113,
204        TRACE_DLT_PFLOG = 117
205} libtrace_dlt_t ;
206
207/** Enumeration of link layer types supported by libtrace */
208typedef enum {
209       TRACE_TYPE_HDLC_POS = 1,
210       TRACE_TYPE_ETH,                  /**< 802.3 style Ethernet */
211       TRACE_TYPE_ATM,                  /**< ATM frame */
212       TRACE_TYPE_AAL5,
213       TRACE_TYPE_80211,                /**< 802.11 frames */
214       TRACE_TYPE_NONE,                 /**< Raw IP frames */
215       TRACE_TYPE_LINUX_SLL,            /**< Linux "null" framing */
216       TRACE_TYPE_PFLOG,                /**< FreeBSD's PFlug */
217       TRACE_TYPE_POS,
218       TRACE_TYPE_80211_PRISM = 12
219     } libtrace_linktype_t;
220
221/** Trace directions
222 * Note that these are the directions used by convention, more directions
223 * are possible, not just these 3, and that they may not conform to this
224 * convention.
225 */
226typedef enum {
227        TRACE_DIR_OUTGOING = 0,         /**< Packets originating "outside" */
228        TRACE_DIR_INCOMING = 1,         /**< Packets originating "inside" */
229        TRACE_DIR_OTHER    = 2          /**< Packets with an unknown direction, or one that's unknown */
230} libtrace_direction_t;
231
232/** @name Protocol structures
233 * These convenience structures are here as they are portable ways of dealing
234 * with various protocols.
235 * @{
236 */
237
238#ifdef WIN32
239#pragma pack(push)
240#pragma pack(1)
241#endif
242
243/** Generic IP header structure */
244typedef struct libtrace_ip
245{
246#if BYTE_ORDER == LITTLE_ENDIAN
247    uint8_t ip_hl:4;            /**< Header Length */
248    uint8_t ip_v:4;             /**< Version */
249#elif BYTE_ORDER == BIG_ENDIAN
250    uint8_t ip_v:4;             /**< Version */
251    uint8_t ip_hl:4;            /**< Header Length */
252#else
253#   error "Adjust your <bits/endian.h> defines"
254#endif
255    uint8_t  ip_tos;                    /**< Type of Service */
256    uint16_t ip_len;                    /**< Total Length */
257    int16_t  ip_id;                     /**< Identification */
258#if BYTE_ORDER == LITTLE_ENDIAN
259    uint16_t ip_off:12;         /**< Fragment Offset */
260    uint16_t ip_mf:1;           /**< More Fragments Flag */
261    uint16_t ip_df:1;           /**< Dont Fragment Flag */
262    uint16_t ip_rf:1;           /**< Reserved Fragment Flag */
263#elif BYTE_ORDER == BIG_ENDIAN
264    uint16_t ip_rf:1;           /**< Fragment Offset */
265    uint16_t ip_df:1;           /**< More Fragments Flag */
266    uint16_t ip_mf:1;           /**< Dont Fragment Flag */
267    uint16_t ip_off:12;         /**< Reserved Fragment Flag */
268#else
269#   error "Adjust your <bits/endian.h> defines"
270#endif
271    uint8_t  ip_ttl;                    /**< Time to Live */
272    uint8_t  ip_p;                      /**< Protocol */
273    uint16_t ip_sum;                    /**< Checksum */
274    struct in_addr ip_src;              /**< Source Address */
275    struct in_addr ip_dst;              /**< Destination Address */
276} PACKED libtrace_ip_t;
277
278/** IPv6 header extension structure */
279typedef struct libtrace_ip6_ext
280{
281        uint8_t nxt;
282        uint8_t len;
283} PACKED libtrace_ip6_ext_t;
284
285/** Generic IPv6 header structure */
286typedef struct libtrace_ip6
287{
288    uint32_t flow;
289    uint16_t plen;                      /**< Payload length */
290    uint8_t nxt;                        /**< Next header */
291    uint8_t hlim;                       /**< Hop limit */
292    struct in6_addr ip_src;             /**< source address */
293    struct in6_addr ip_dst;             /**< dest address */
294} PACKED libtrace_ip6_t;
295
296/** Generic TCP header structure */
297typedef struct libtrace_tcp
298  {
299    uint16_t source;            /**< Source Port */
300    uint16_t dest;              /**< Destination port */
301    uint32_t seq;               /**< Sequence number */
302    uint32_t ack_seq;           /**< Acknowledgement Number */
303#  if BYTE_ORDER == LITTLE_ENDIAN
304    uint8_t res1:4;     /**< Reserved bits */
305    uint8_t doff:4;     /**< Data Offset */     
306    uint8_t fin:1;              /**< FIN */
307    uint8_t syn:1;              /**< SYN flag */
308    uint8_t rst:1;              /**< RST flag */
309    uint8_t psh:1;              /**< PuSH flag */
310    uint8_t ack:1;              /**< ACK flag */
311    uint8_t urg:1;              /**< URG flag */
312    uint8_t res2:2;     /**< Reserved */
313#  elif BYTE_ORDER == BIG_ENDIAN
314    uint8_t doff:4;     /**< Data offset */
315    uint8_t res1:4;     /**< Reserved bits */
316    uint8_t res2:2;     /**< Reserved */
317    uint8_t urg:1;              /**< URG flag */
318    uint8_t ack:1;              /**< ACK flag */
319    uint8_t psh:1;              /**< PuSH flag */
320    uint8_t rst:1;              /**< RST flag */
321    uint8_t syn:1;              /**< SYN flag */
322    uint8_t fin:1;              /**< FIN flag */
323#  else
324#   error "Adjust your <bits/endian.h> defines"
325#  endif
326    uint16_t window;            /**< Window Size */
327    uint16_t check;             /**< Checksum */
328    uint16_t urg_ptr;           /**< Urgent Pointer */
329} PACKED libtrace_tcp_t;
330
331/** Generic UDP header structure */
332typedef struct libtrace_udp {
333  uint16_t      source;         /**< Source port */
334  uint16_t      dest;           /**< Destination port */
335  uint16_t      len;            /**< Length */
336  uint16_t      check;          /**< Checksum */
337} PACKED libtrace_udp_t;
338
339/** Generic ICMP header structure */
340typedef struct libtrace_icmp
341{
342  uint8_t type;         /**< Message Type */
343  uint8_t code;         /**< Type Sub-code */
344  uint16_t checksum;            /**< Checksum */
345  union
346  {
347    struct
348    {
349      uint16_t  id;
350      uint16_t  sequence;
351    } echo;                     /**< Echo Datagram */
352    uint32_t    gateway;        /**< Gateway Address */
353    struct
354    {
355      uint16_t  unused;
356      uint16_t  mtu;
357    } frag;                     /**< Path MTU Discovery */
358  } un;                         /**< Union for Payloads of Various ICMP Codes */
359} PACKED libtrace_icmp_t;
360
361/** Generic LLC/SNAP header structure */
362typedef struct libtrace_llcsnap
363{
364/* LLC */
365  uint8_t dsap;                 /**< Destination Service Access Point */
366  uint8_t ssap;                 /**< Source Service Access Point */
367  uint8_t control;
368/* SNAP */
369  uint32_t oui:24;              /**< Organisationally Unique Identifier (scope)*/
370  uint16_t type;                /**< Protocol within OUI */
371} PACKED libtrace_llcsnap_t;
372
373/** 802.3 frame */
374typedef struct libtrace_ether
375{
376  uint8_t ether_dhost[6];       /**< Destination Ether Addr */
377  uint8_t ether_shost[6];       /**< Source Ether Addr */
378  uint16_t ether_type;          /**< Packet Type ID Field (next-header) */
379} PACKED libtrace_ether_t;
380
381/** 802.1Q frame */
382typedef struct libtrace_8021q
383{
384  uint16_t vlan_pri:3;   /**< VLAN User Priority */
385  uint16_t vlan_cfi:1;   /**< VLAN Format Indicator,
386                                   * 0 for ethernet, 1 for token ring */
387  uint16_t vlan_id:12;   /**< VLAN Id */
388  uint16_t vlan_ether_type;      /**< VLAN Sub-packet Type ID Field
389                                   * (next-header)*/
390} PACKED libtrace_8021q_t;
391
392/** ATM cell */
393typedef struct libtrace_atm_cell
394{
395  uint32_t gfc:4;               /**< Generic Flow Control */
396  uint32_t vpi:8;               /**< Virtual Path Identifier */
397  uint32_t vci:8;               /**< Virtual Channel Identifier */
398  uint32_t pt:3;                /**< Payload Type */
399  uint32_t clp:1;               /**< Cell Loss Priority */
400  uint32_t hec:8;               /**< Header Error Control */
401} PACKED libtrace_atm_cell_t;
402
403/** POS header */
404typedef struct libtrace_pos
405{
406 uint16_t header;
407 uint16_t ether_type;           /**< Ether Type */
408} PACKED libtrace_pos_t;
409
410/** 802.11 header */
411typedef struct libtrace_80211_t {
412        uint16_t      protocol:2;
413        uint16_t      type:2;
414        uint16_t      subtype:4;
415        uint16_t      to_ds:1;          /**< Packet to Distribution Service */
416        uint16_t      from_ds:1;        /**< Packet from Distribution Service */
417        uint16_t      more_frag:1;      /**< Packet has more fragments */
418        uint16_t      retry:1;          /**< Packet is a retry */
419        uint16_t      power:1;
420        uint16_t      more_data:1;
421        uint16_t      wep:1;
422        uint16_t      order:1;
423        uint16_t     duration;
424        uint8_t      mac1[6];
425        uint8_t      mac2[6];
426        uint8_t      mac3[6];
427        uint16_t     SeqCtl;
428        uint8_t      mac4[6];
429} PACKED libtrace_80211_t;
430
431#ifdef WIN32
432#pragma pack(pop)
433#endif
434
435
436/*@}*/
437
438/** Prints help information for libtrace
439 *
440 * Function prints out some basic help information regarding libtrace,
441 * and then prints out the help() function registered with each input module
442 */
443DLLEXPORT void trace_help();
444
445/** @name Trace management
446 * These members deal with creating, configuring, starting, pausing and
447 * cleaning up a trace object
448 *@{
449 */
450
451/** Create a trace file from a URI
452 *
453 * @param uri containing a valid libtrace URI
454 * @return an opaque pointer to a libtrace_t
455 *
456 * Valid URI's are:
457 *  - erf:/path/to/erf/file
458 *  - erf:-  (stdin)
459 *  - dag:/dev/dagcard                 
460 *  - pcapint:pcapinterface                (eg: pcap:eth0)
461 *  - pcap:/path/to/pcap/file
462 *  - pcap:-
463 *  - rt:hostname
464 *  - rt:hostname:port
465 *  - rtclient:hostname (deprecated)
466 *  - rtclient:hostname:port (deprecated)
467 *  - wag:/dev/wagcard
468 *  - wtf:-
469 *  - wtf:/path/to/wtf/file
470 *
471 *  If an error occured when attempting to open the trace file, an error
472 *  trace is returned and trace_get_error should be called to find out
473 *  if an error occured, and what that error was.  The trace is created in the
474 *  configuration state, you must call trace_start to start the capture.
475 */
476DLLEXPORT libtrace_t *trace_create(const char *uri);
477
478/** Creates a "dummy" trace file that has only the format type set.
479 *
480 * @return an opaque pointer to a (sparsely initialised) libtrace_t
481 *
482 * IMPORTANT: Do not attempt to call trace_read_packet or other such functions
483 * with the dummy trace. Its intended purpose is to act as a packet->trace for
484 * libtrace_packet_t's that are not associated with a libtrace_t structure.
485 */
486DLLEXPORT libtrace_t *trace_create_dead(const char *uri);
487
488/** Creates a trace output file from a URI.
489 *
490 * @param uri   the uri string describing the output format and destination
491 * @return an opaque pointer to a libtrace_output_t
492 *
493 * Valid URI's are:
494 *  - erf:/path/to/erf/file
495 *  - pcap:/path/to/pcap/file
496 *  - wtf:/path/to/wtf/file
497 *
498 *  If an error occured when attempting to open the output trace, NULL is returned
499 *  and trace_errno is set. Use trace_perror() to get more information
500 */
501DLLEXPORT libtrace_out_t *trace_create_output(const char *uri);
502
503/** Start the capture
504 * @param libtrace      The trace to start
505 * @return 0 on success, -1 on failure
506 *
507 * This does the actual work with starting the trace capture, and applying
508 * all the config options.  This may fail.
509 */
510DLLEXPORT int trace_start(libtrace_t *libtrace);
511
512/** Pause the capture
513 * @param libtrace      The trace to pause
514 * @return 0 on success, -1 on failure
515 *
516 * This stops a capture in progress and returns you to the configuration
517 * state.  Any packets that arrive after trace_pause() has been called
518 * will be discarded.  To resume capture, call trace_start().
519 */
520DLLEXPORT int trace_pause(libtrace_t *libtrace);
521
522/** Start an output trace
523 * @param libtrace      The trace to start
524 * @return 0 on success, -1 on failure
525 *
526 * This does the actual work with starting a trace for write.  This generally
527 * creates the file.
528 */
529DLLEXPORT int trace_start_output(libtrace_out_t *libtrace);
530
531/** Valid trace capture options */
532typedef enum {
533        TRACE_OPTION_SNAPLEN, /**< Number of bytes captured */
534        TRACE_OPTION_PROMISC, /**< Capture packets to other hosts */
535        TRACE_OPTION_FILTER   /**< Apply this filter to all packets recieved */
536} trace_option_t;
537
538/** Sets an input config option
539 * @param libtrace      the trace object to apply the option to
540 * @param option        the option to set
541 * @param value         the value to set the option to
542 * @return -1 if option configuration failed, 0 otherwise
543 * This should be called after trace_create, and before trace_start
544 */
545DLLEXPORT int trace_config(libtrace_t *libtrace,
546                trace_option_t option,
547                void *value);
548
549typedef enum {
550        TRACE_OPTION_OUTPUT_FILEFLAGS, /**< File flags to open the trace file
551                                        * with.  eg O_APPEND
552                                        */
553        TRACE_OPTION_OUTPUT_COMPRESS   /**< Compression level, eg 6. */
554} trace_option_output_t;
555
556/** Sets an output config option
557 *
558 * @param libtrace      the output trace object to apply the option to
559 * @param option        the option to set
560 * @param value         the value to set the option to
561 * @return -1 if option configuration failed, 0 otherwise
562 * This should be called after trace_create_output, and before
563 * trace_start_output
564 */
565DLLEXPORT int trace_config_output(libtrace_out_t *libtrace,
566                trace_option_output_t option,
567                void *value
568                );
569
570/** Close a trace file, freeing up any resources it may have been using
571 *
572 */
573DLLEXPORT void trace_destroy(libtrace_t *trace);
574
575/** Close a trace file, freeing up any resources it may have been using
576 * @param trace         trace file to be destroyed
577 */
578DLLEXPORT void trace_destroy_dead(libtrace_t *trace);
579
580/** Close a trace output file, freeing up any resources it may have been using
581 * @param trace         the output trace file to be destroyed
582 */
583DLLEXPORT void trace_destroy_output(libtrace_out_t *trace);
584
585/** Check (and clear) the current error state of an input trace
586 * @param trace         the trace file to check the error state on
587 * @return Error report
588 * This reads and returns the current error state and sets the current error
589 * to "no error".
590 */
591DLLEXPORT libtrace_err_t trace_get_err(libtrace_t *trace);
592
593/** Return if there is an error
594 * @param trace         the trace file to check the error state on
595 * This does not clear the error status, and only returns true or false.
596 */
597DLLEXPORT bool trace_is_err(libtrace_t *trace);
598
599/** Output an error message to stderr and clear the error status.
600 * @param trace         the trace with the error to output
601 * @param msg           the message to prefix to the error
602 * This function does clear the error status.
603 */
604DLLEXPORT void trace_perror(libtrace_t *trace, const char *msg,...);
605
606/** Check (and clear) the current error state of an output trace
607 * @param trace         the output trace file to check the error state on
608 * @return Error report
609 * This reads and returns the current error state and sets the current error
610 * to "no error".
611 */
612DLLEXPORT libtrace_err_t trace_get_err_output(libtrace_out_t *trace);
613
614/** Return if there is an error
615 * @param trace         the trace file to check the error state on
616 * This does not clear the error status, and only returns true or false.
617 */
618DLLEXPORT bool trace_is_err_output(libtrace_out_t *trace);
619
620/** Output an error message to stderr and clear the error status.
621 * @param trace         the trace with the error to output
622 * @param msg           the message to prefix to the error
623 * This function does clear the error status.
624 */
625DLLEXPORT void trace_perror_output(libtrace_out_t *trace, const char *msg,...);
626
627
628/*@}*/
629
630/** @name Reading/Writing packets
631 * These members deal with creating, reading and writing packets
632 *
633 * @{
634 */
635
636/** Create a new packet object
637 *
638 * @return a pointer to an initialised libtrace_packet_t object
639 */
640DLLEXPORT libtrace_packet_t *trace_create_packet();
641
642/** Copy a packet
643 * @param packet        the source packet to copy
644 * @return a new packet which has the same content as the source packet
645 * @note This always involves a copy, which can be slow.  Use of this
646 * function should be avoided where possible.
647 * @par The reason you would want to use this function is that a zerocopied
648 * packet from a device is using the devices memory which may be a limited
649 * resource.  Copying the packet will cause it to be copied into the systems
650 * memory.
651 */
652DLLEXPORT libtrace_packet_t *trace_copy_packet(const libtrace_packet_t *packet);
653
654/** Destroy a packet object
655 *
656 * sideeffect: sets packet to NULL
657 */
658DLLEXPORT void trace_destroy_packet(libtrace_packet_t **packet);
659
660
661/** Read one packet from the trace
662 *
663 * @param trace         the libtrace opaque pointer
664 * @param packet        the packet opaque pointer
665 * @return 0 on EOF, negative value on error, number of bytes read when
666 * successful.
667 *
668 * @note the number of bytes read is usually (but not always) the same as
669 * trace_get_framing_length()+trace_get_capture_length() depending on the
670 * trace format.
671 * @note the trace must have been started with trace_start before calling
672 * this function
673 */
674DLLEXPORT int trace_read_packet(libtrace_t *trace, libtrace_packet_t *packet);
675
676/** Event types
677 * see \ref libtrace_eventobj_t and \ref trace_event
678 */
679typedef enum {
680        TRACE_EVENT_IOWAIT,     /**< Need to block on fd */
681        TRACE_EVENT_SLEEP,      /**< Sleep for some time */
682        TRACE_EVENT_PACKET,     /**< packet has arrived */
683        TRACE_EVENT_TERMINATE   /**< End of trace */
684} libtrace_event_t;
685
686/** Structure returned by libtrace_event explaining what the current event is */
687typedef struct libtrace_eventobj_t {
688        libtrace_event_t type; /**< event type (iowait,sleep,packet) */
689        int fd;                /**< if IOWAIT, the fd to sleep on */
690        double seconds;        /**< if SLEEP, the amount of time to sleep for
691                                */
692        int size;              /**< if PACKET, the value returned from
693                                *  trace_read_packet
694                                */
695} libtrace_eventobj_t;
696
697/** Processes the next libtrace event
698 * @param trace the libtrace opaque pointer
699 * @param packet the libtrace_packet opaque pointer
700 * @return libtrace_event struct containing the type, and potential
701 *      fd or seconds to sleep on
702 *
703 * Type can be:
704 *  TRACE_EVENT_IOWAIT  Waiting on I/O on fd
705 *  TRACE_EVENT_SLEEP   Next event in seconds
706 *  TRACE_EVENT_PACKET  Packet arrived in buffer with size size
707 *  TRACE_EVENT_TERMINATE Trace terminated (perhaps with an error condition)
708 */
709DLLEXPORT libtrace_eventobj_t trace_event(libtrace_t *trace,
710                libtrace_packet_t *packet);
711
712
713/** Write one packet out to the output trace
714 *
715 * @param trace         the libtrace_out opaque pointer
716 * @param packet        the packet opaque pointer
717 * @return the number of bytes written out, if zero or negative then an error has occured.
718 */
719DLLEXPORT int trace_write_packet(libtrace_out_t *trace, const libtrace_packet_t *packet);
720/*@}*/
721
722/** @name Protocol decodes
723 * These functions locate and return a pointer to various headers inside a
724 * packet
725 * @{
726 */
727
728/** get a pointer to the link layer
729 * @param packet        the packet opaque pointer
730 *
731 * @return a pointer to the link layer, or NULL if there is no link layer
732 *
733 * @note you should call trace_get_link_type to find out what type of link
734 * layer this is
735 */
736DLLEXPORT SIMPLE_FUNCTION
737void *trace_get_link(const libtrace_packet_t *packet);
738
739/** get a pointer to the IP header (if any)
740 * @param packet        the packet opaque pointer
741 *
742 * @return a pointer to the IP header, or NULL if there is no IP header
743 */
744DLLEXPORT SIMPLE_FUNCTION
745libtrace_ip_t *trace_get_ip(libtrace_packet_t *packet);
746
747/** Gets a pointer to the transport layer header (if any)
748 * @param packet        a pointer to a libtrace_packet structure
749 * @param[out] proto    transport layer protocol
750 *
751 * @return a pointer to the transport layer header, or NULL if there is no header
752 *
753 * @note proto may be NULL if proto is unneeded.
754 */
755DLLEXPORT void *trace_get_transport(libtrace_packet_t *packet, uint8_t *proto,
756                uint32_t *remaining);
757
758/** Gets a pointer to the payload given a pointer to the IP header
759 * @param ip            The IP Header
760 * @param[out] proto    An output variable of the IP protocol
761 * @param[in,out] remaining Updated with the number of bytes remaining
762 *
763 * @return a pointer to the transport layer header, or NULL if header isn't present.
764 *
765 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
766 * of bytes captured of the IP header and beyond.  It will be updated after this
767 * function to the number of bytes remaining after the IP header (and any IP options)
768 * have been removed.
769 *
770 * proto may be NULL if not needed.
771 *
772 * @note This is similar to trace_get_transport_from_ip in libtrace2
773 */
774DLLEXPORT void *trace_get_payload_from_ip(libtrace_ip_t *ip, uint8_t *proto,
775                uint32_t *remaining);
776
777/** Gets a pointer to the payload given a pointer to a tcp header
778 * @param tcp           The tcp Header
779 * @param[in,out] remaining Updated with the number of bytes remaining
780 *
781 * @return a pointer to the tcp payload, or NULL if the payload isn't present.
782 *
783 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
784 * of bytes captured of the TCP header and beyond.  It will be updated after this
785 * function to the number of bytes remaining after the TCP header (and any TCP options)
786 * have been removed.
787 *
788 * @note This is similar to trace_get_transport_from_ip in libtrace2
789 */
790DLLEXPORT void *trace_get_payload_from_tcp(libtrace_tcp_t *tcp, uint32_t *remaining);
791
792/** Gets a pointer to the payload given a pointer to a udp header
793 * @param udp           The udp Header
794 * @param[in,out] remaining Updated with the number of bytes remaining
795 *
796 * @return a pointer to the udp payload, or NULL if the payload isn't present.
797 *
798 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
799 * of bytes captured of the TCP header and beyond.  It will be updated after this
800 * function to the number of bytes remaining after the TCP header (and any TCP options)
801 * have been removed.
802 *
803 * @note This is similar trace_get_transport_from_ip in libtrace2
804 */
805DLLEXPORT void *trace_get_payload_from_udp(libtrace_udp_t *udp, uint32_t *remaining);
806
807/** Gets a pointer to the payload given a pointer to a icmp header
808 * @param icmp          The icmp Header
809 * @param[in,out] remaining Updated with the number of bytes remaining
810 *
811 * @return a pointer to the icmp payload, or NULL if the payload isn't present.
812 *
813 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
814 * of bytes captured of the TCP header and beyond.  It will be updated after this
815 * function to the number of bytes remaining after the TCP header (and any TCP options)
816 * have been removed.
817 *
818 * @note This is similar to trace_get_payload_from_icmp in libtrace2
819 */
820DLLEXPORT void *trace_get_payload_from_icmp(libtrace_icmp_t *icmp, uint32_t *remaining);
821
822/** get a pointer to the TCP header (if any)
823 * @param packet        the packet opaque pointer
824 *
825 * @return a pointer to the TCP header, or NULL if there is not a TCP packet
826 */
827DLLEXPORT SIMPLE_FUNCTION
828libtrace_tcp_t *trace_get_tcp(libtrace_packet_t *packet);
829
830/** get a pointer to the TCP header (if any) given a pointer to the IP header
831 * @param ip            The IP header
832 * @param[in,out] remaining Updated with the number of bytes remaining
833 *
834 * @return a pointer to the TCP header, or NULL if this is not a TCP packet
835 *
836 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
837 * of bytes captured of the TCP header and beyond.  It will be updated after this
838 * function to the number of bytes remaining after the TCP header (and any TCP options)
839 * have been removed.
840 *
841 * @note The last parameter has changed from libtrace2
842 */
843DLLEXPORT SIMPLE_FUNCTION
844libtrace_tcp_t *trace_get_tcp_from_ip(libtrace_ip_t *ip, uint32_t *remaining);
845
846/** get a pointer to the UDP header (if any)
847 * @param packet        the packet opaque pointer
848 *
849 * @return a pointer to the UDP header, or NULL if this is not a UDP packet
850 */
851DLLEXPORT SIMPLE_FUNCTION
852libtrace_udp_t *trace_get_udp(libtrace_packet_t *packet);
853
854/** get a pointer to the UDP header (if any) given a pointer to the IP header
855 * @param       ip      The IP header
856 * @param[in,out] remaining Updated with the number of bytes remaining
857 *
858 * @return a pointer to the UDP header, or NULL if this is not an UDP packet
859 *
860 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
861 * of bytes captured of the TCP header and beyond.  It will be updated after this
862 * function to the number of bytes remaining after the TCP header (and any TCP options)
863 * have been removed.
864 *
865 * @note Beware the change from libtrace2 from skipped to remaining
866 */
867DLLEXPORT SIMPLE_FUNCTION
868libtrace_udp_t *trace_get_udp_from_ip(libtrace_ip_t *ip,uint32_t *remaining);
869
870/** get a pointer to the ICMP header (if any)
871 * @param packet        the packet opaque pointer
872 *
873 * @return a pointer to the ICMP header, or NULL if this is not a ICMP packet
874 */
875DLLEXPORT SIMPLE_FUNCTION
876libtrace_icmp_t *trace_get_icmp(libtrace_packet_t *packet);
877
878/** get a pointer to the ICMP header (if any) given a pointer to the IP header
879 * @param ip            The IP header
880 * @param[in,out] remaining Updated with the number of bytes remaining
881 *
882 * @return a pointer to the ICMP header, or NULL if this is not an ICMP packet
883 *
884 * Remaining may be NULL.  If Remaining is not NULL it must point to the number
885 * of bytes captured of the TCP header and beyond.  It will be updated after this
886 * function to the number of bytes remaining after the TCP header (and any TCP options)
887 * have been removed.
888 *
889 * @note Beware the change from libtrace2 from skipped to remaining
890 */
891DLLEXPORT SIMPLE_FUNCTION
892libtrace_icmp_t *trace_get_icmp_from_ip(libtrace_ip_t *ip,uint32_t *remaining);
893
894/** Get the destination MAC addres
895 * @param packet        the packet opaque pointer
896 * @return a pointer to the destination mac, (or NULL if there is no
897 * destination MAC)
898 */
899DLLEXPORT SIMPLE_FUNCTION
900uint8_t *trace_get_destination_mac(libtrace_packet_t *packet);
901
902/** Get the source MAC addres
903 * @param packet        the packet opaque pointer
904 * @return a pointer to the source mac, (or NULL if there is no source MAC)
905 */
906DLLEXPORT SIMPLE_FUNCTION
907uint8_t *trace_get_source_mac(libtrace_packet_t *packet);
908
909/** Get the source addres
910 * @param packet        the packet opaque pointer
911 * @param addr          a pointer to a sockaddr to store the address in, or NULL to use
912 *                      static storage.
913 * @return NULL if there is no source address, or a sockaddr holding a v4 or v6 address
914 */
915DLLEXPORT SIMPLE_FUNCTION
916struct sockaddr *trace_get_source_address(const libtrace_packet_t *packet,
917                struct sockaddr *addr);
918
919/** Get the source addres
920 * @param packet        the packet opaque pointer
921 * @param addr          a pointer to a sockaddr to store the address in, or NULL to use
922 *                      static storage.
923 * @return NULL if there is no source address, or a sockaddr holding a v4 or v6 address
924 */
925DLLEXPORT SIMPLE_FUNCTION
926struct sockaddr *trace_get_destination_address(const libtrace_packet_t *packet,
927                struct sockaddr *addr);
928
929/*@}*/
930
931/** parse an ip or tcp option
932 * @param[in,out] ptr   the pointer to the current option
933 * @param[in,out] len   the length of the remaining buffer
934 * @param[out] type     the type of the option
935 * @param[out] optlen   the length of the option
936 * @param[out] data     the data of the option
937 *
938 * @return bool true if there is another option (and the fields are filled in)
939 *               or false if this was the last option.
940 *
941 * This updates ptr to point to the next option after this one, and updates
942 * len to be the number of bytes remaining in the options area.  Type is updated
943 * to be the code of this option, and data points to the data of this option,
944 * with optlen saying how many bytes there are.
945 *
946 * @note Beware of fragmented packets.
947 */
948DLLEXPORT int trace_get_next_option(unsigned char **ptr,int *len,
949                        unsigned char *type,
950                        unsigned char *optlen,
951                        unsigned char **data);
952
953
954/** @name Time
955 * These functions deal with time that a packet arrived and return it
956 * in various formats
957 * @{
958 */
959/** Get the current time in DAG time format
960 * @param packet        the packet opaque pointer
961 *
962 * @return a 64 bit timestamp in DAG ERF format (upper 32 bits are the seconds
963 * past 1970-01-01, the lower 32bits are partial seconds)
964 */
965DLLEXPORT SIMPLE_FUNCTION
966uint64_t trace_get_erf_timestamp(const libtrace_packet_t *packet);
967
968/** Get the current time in struct timeval
969 * @param packet        the packet opaque pointer
970 *
971 * @return time that this packet was seen in a struct timeval
972 */
973DLLEXPORT SIMPLE_FUNCTION
974struct timeval trace_get_timeval(const libtrace_packet_t *packet);
975
976/** Get the current time in floating point seconds
977 * @param packet        the packet opaque pointer
978 *
979 * @return time that this packet was seen in 64bit floating point seconds
980 */
981DLLEXPORT SIMPLE_FUNCTION
982double trace_get_seconds(const libtrace_packet_t *packet);
983
984/** Seek within a trace
985 * @param trace         trace to seek
986 * @param seconds       time to seek to
987 * @return 0 on success.
988 * Make the next packet read to be the first packet to occur at or after the
989 * time searched for.  This must be called in the configuration state (ie,
990 * before trace_start() or after trace_pause().
991 * @note This function may be extremely slow.
992 */
993DLLEXPORT int trace_seek_seconds(libtrace_t *trace, double seconds);
994
995/** Seek within a trace
996 * @param trace         trace to seek
997 * @param tv            time to seek to
998 * @return 0 on success.
999 * Make the next packet read to be the first packet to occur at or after the
1000 * time searched for.  This must be called in the configuration state (ie,
1001 * before trace_start() or after trace_pause().
1002 * @note This function may be extremely slow.
1003 */
1004DLLEXPORT int trace_seek_timeval(libtrace_t *trace, struct timeval tv);
1005
1006/** Seek within a trace
1007 * @param trace         trace to seek
1008 * @param ts            erf timestamp
1009 * @return 0 on success.
1010 * Make the next packet read to be the first packet to occur at or after the
1011 * time searched for.  This must be called in the configuration state (ie,
1012 * before trace_start() or after trace_pause().
1013 * @note This function may be extremely slow.
1014 */
1015DLLEXPORT int trace_seek_erf_timestamp(libtrace_t *trace, uint64_t ts);
1016
1017/*@}*/
1018
1019/** @name Sizes
1020 * This section deals with finding or setting the various different lengths
1021 * a packet can have
1022 * @{
1023 */
1024/** Get the size of the packet in the trace
1025 * @param packet        the packet opaque pointer
1026 * @return the size of the packet in the trace
1027 * @note Due to this being a header capture, or anonymisation, this may not
1028 * be the same size as the original packet.  See get_wire_length() for the
1029 * original size of the packet.
1030 * @note This can (and often is) different for different packets in a trace!
1031 * @note This is sometimes called the "snaplen".
1032 * @note The return size refers to the network-level payload of the packet and
1033 * does not include any capture framing headers. For example, an Ethernet
1034 * packet with an empty TCP packet will return sizeof(ethernet_header) +
1035 * sizeof(ip_header) + sizeof(tcp_header).
1036 */
1037DLLEXPORT SIMPLE_FUNCTION
1038size_t trace_get_capture_length(const libtrace_packet_t *packet);
1039
1040/** Get the size of the packet as it was seen on the wire.
1041 * @param packet        the packet opaque pointer
1042 * @return the size of the packet as it was on the wire.
1043 * @note Due to the trace being a header capture, or anonymisation this may
1044 * not be the same as the Capture Len.
1045 * @note trace_getwire_length \em{includes} FCS.
1046 */
1047DLLEXPORT SIMPLE_FUNCTION
1048size_t trace_get_wire_length(const libtrace_packet_t *packet);
1049
1050/** Get the length of the capture framing headers.
1051 * @param packet        the packet opaque pointer
1052 * @return the size of the packet as it was on the wire.
1053 * @note this length corresponds to the difference between the size of a
1054 * captured packet in memory, and the captured length of the packet
1055 */
1056DLLEXPORT SIMPLE_FUNCTION
1057size_t trace_get_framing_length(const libtrace_packet_t *packet);
1058
1059/** Truncate ("snap") the packet at the suggested length
1060 * @param packet        the packet opaque pointer
1061 * @param size          the new length of the packet
1062 * @return the new capture length of the packet, or the original capture
1063 * length of the packet if unchanged
1064 */
1065DLLEXPORT size_t trace_set_capture_length(libtrace_packet_t *packet, size_t size);
1066
1067/*@}*/
1068
1069
1070/** Get the type of the link layer
1071 * @param packet        the packet opaque pointer
1072 * @return libtrace_linktype_t
1073 */
1074DLLEXPORT SIMPLE_FUNCTION
1075libtrace_linktype_t trace_get_link_type(const libtrace_packet_t *packet);
1076
1077/** Set the direction flag, if it has one
1078 * @param packet        the packet opaque pointer
1079 * @param direction     the new direction
1080 * @returns -1 on error, or the direction that was set.
1081 */
1082DLLEXPORT libtrace_direction_t trace_set_direction(libtrace_packet_t *packet, libtrace_direction_t direction);
1083
1084/** Get the direction flag, if it has one
1085 * @param packet        the packet opaque pointer
1086 * @return a value containing the direction flag, or -1 if this is not supported
1087 * The direction is defined as 0 for packets originating locally (ie, outbound)
1088 * and 1 for packets originating remotely (ie, inbound).
1089 * Other values are possible, which might be overloaded to mean special things
1090 * for a special trace.
1091 */
1092DLLEXPORT SIMPLE_FUNCTION
1093libtrace_direction_t trace_get_direction(const libtrace_packet_t *packet);
1094
1095/** @name BPF
1096 * This section deals with using Berkley Packet Filters
1097 * @{
1098 */
1099/** setup a BPF filter
1100 * @param filterstring a char * containing the bpf filter string
1101 * @return opaque pointer pointer to a libtrace_filter_t object
1102 * @note The filter is not actually compiled at this point, so no correctness
1103 * tests are performed here. trace_bpf_setfilter will always return ok, but
1104 * if the filter is poorly constructed an error will be generated when the
1105 * filter is actually used
1106 */
1107DLLEXPORT SIMPLE_FUNCTION
1108libtrace_filter_t *trace_bpf_setfilter(const char *filterstring);
1109
1110/** apply a BPF filter
1111 * @param filter        the filter opaque pointer
1112 * @param packet        the packet opaque pointer
1113 * @return 1 if the filter matches, 0 if it doesn't.
1114 * @note Due to the way BPF filters are built, the filter is not actually
1115 * compiled until the first time trace_bpf_filter is called. If your filter is
1116 * incorrect, it will generate an error message and assert, exiting the
1117 * program. This behaviour may change to more graceful handling of this error
1118 * in the future.
1119 */
1120DLLEXPORT int trace_bpf_filter(libtrace_filter_t *filter,
1121                const libtrace_packet_t *packet);
1122
1123/** destory of BPF filter
1124 * @param filter        the filter opaque pointer
1125 * Deallocate all the resources associated with a BPF filter
1126 */
1127DLLEXPORT void trace_destroy_bpf(libtrace_filter_t *filter);
1128/*@}*/
1129
1130/** @name Portability
1131 * This section has functions that causes annoyances to portability for one
1132 * reason or another.
1133 * @{
1134 */
1135
1136/** Convert an ethernet address to a string
1137 * @param addr  Ethernet address in network byte order
1138 * @param buf   Buffer to store the ascii representation, or NULL
1139 * @return buf, or if buf is NULL then a statically allocated buffer.
1140 *
1141 * This function is similar to the GNU ether_ntoa_r function, with a few
1142 * minor differences.  if NULL is passed as buf, then the function will
1143 * use an internal static buffer, if NULL isn't passed then the function
1144 * will use that buffer instead.
1145 *
1146 * @note the type of addr isn't struct ether_addr as it is with ether_ntoa_r,
1147 * however it is bit compatible so that a cast will work.
1148 */
1149DLLEXPORT char *trace_ether_ntoa(const uint8_t *addr, char *buf);
1150
1151/** Convert a string to an ethernet address
1152 * @param buf   Ethernet address in hex format delimited with :'s.
1153 * @param addr  buffer to store the binary representation, or NULL
1154 * @return addr, or if addr is NULL, then a statically allocated buffer.
1155 *
1156 * This function is similar to the GNU ether_aton_r function, with a few
1157 * minor differences.  if NULL is passed as addr, then the function will
1158 * use an internal static buffer, if NULL isn't passed then the function will
1159 * use that buffer instead.
1160 *
1161 * @note the type of addr isn't struct ether_addr as it is with ether_aton_r,
1162 * however it is bit compatible so that a cast will work.
1163 */
1164DLLEXPORT uint8_t *trace_ether_aton(const char *buf, uint8_t *addr);
1165
1166/*@}*/
1167
1168
1169/** Which port is the server port */
1170typedef enum {
1171        USE_DEST,       /**< Destination port is the server port */
1172        USE_SOURCE      /**< Source port is the server port */
1173} serverport_t;
1174
1175/** Get the source port
1176 * @param packet        the packet to read from
1177 * @return a port in \em HOST byte order, or equivalent to ports for this
1178 * protocol, or 0 if this protocol has no ports.
1179 */
1180DLLEXPORT SIMPLE_FUNCTION
1181uint16_t trace_get_source_port(const libtrace_packet_t *packet);
1182
1183/** Get the destination port
1184 * @param packet        the packet to read from
1185 * @return a port in \em HOST byte order, or equivilent to ports for this
1186 * protocol, or 0 if this protocol has no ports.
1187 */
1188DLLEXPORT SIMPLE_FUNCTION
1189uint16_t trace_get_destination_port(const libtrace_packet_t *packet);
1190
1191/** hint at the server port in specified protocol
1192 * @param protocol      the IP layer protocol, eg 6 (tcp), 17 (udp)
1193 * @param source        the source port from the packet
1194 * @param dest          the destination port from the packet
1195 * @return one of USE_SOURCE or USE_DEST depending on which one you should use
1196 * @note ports must be in \em HOST byte order!
1197 */
1198DLLEXPORT SIMPLE_FUNCTION
1199int8_t trace_get_server_port(uint8_t protocol, uint16_t source, uint16_t dest);
1200
1201/** Takes a uri and splits it into a format and uridata component.
1202 * @param uri           the uri to be parsed
1203 * @param format        destination location for the format component of the uri
1204 * @return 0 if an error occured, otherwise return the uridata component
1205 */
1206DLLEXPORT const char *trace_parse_uri(const char *uri, char **format);
1207
1208/** RT protocol base format identifiers
1209 * This is used to say what kind of packet is being sent over the rt protocol
1210 */
1211enum base_format_t {
1212        TRACE_FORMAT_ERF          =1,
1213        TRACE_FORMAT_PCAP         =2,
1214        TRACE_FORMAT_PCAPFILE     =3,
1215        TRACE_FORMAT_WAG          =4,
1216        TRACE_FORMAT_RT           =5,
1217        TRACE_FORMAT_LEGACY_ATM   =6,
1218        TRACE_FORMAT_LEGACY_POS   =7,
1219        TRACE_FORMAT_LEGACY_ETH   =8,
1220        TRACE_FORMAT_LINUX_NATIVE =9
1221};
1222
1223/** Gets the format type for a given packet.
1224 * @param packet        the packet opaque pointer
1225 * @return the format of the packet
1226 */
1227DLLEXPORT
1228enum base_format_t trace_get_format(struct libtrace_packet_t *packet);
1229
1230
1231#ifdef __cplusplus
1232} /* extern "C" */
1233#endif /* #ifdef __cplusplus */
1234#endif /* LIBTRACE_H_ */
Note: See TracBrowser for help on using the repository browser.