source: lib/libtrace.h @ da22687

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