source: lib/libtrace_int.h @ 0b01fea

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 0b01fea was 0b01fea, checked in by Richard Sanger <rsangerarj@…>, 6 years ago

Merge branch 'ring_refactor' into develop

  • Property mode set to 100644
File size: 40.9 KB
RevLine 
[4dedc28]1/*
2 * This file is part of libtrace
3 *
[8488c15]4 * Copyright (c) 2007,2008,2009,2010 The University of Waikato, Hamilton,
5 * New Zealand.
6 *
[4dedc28]7 * Authors: Daniel Lawson
[8488c15]8 *          Perry Lorier
9 *          Shane Alcock
[4dedc28]10 *         
11 * All rights reserved.
12 *
13 * This code has been developed by the University of Waikato WAND
14 * research group. For further information please see http://www.wand.net.nz/
15 *
16 * libtrace is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * libtrace is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with libtrace; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29 *
30 * $Id$
31 *
32 */
33
[8488c15]34/** @file
35 *
36 * @brief Header file containing definitions for structures and functions that
37 * are internal
38 *
39 * @author Daniel Lawson
40 * @author Perry Lorier
41 * @author Shane Alcock
42 *
43 * @version $Id$
44 *
45 * All of the structures and functions defined in this header file are intended
46 * for internal use within Libtrace only. They should not be exported as part
47 * of the library API as we don't want users accessing things like the
48 * contents of the libtrace packet structure directly!
49 */
[9e2a109]50#ifndef LIBTRACE_INT_H
51#define LIBTRACE_INT_H
[4dedc28]52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57#include "config.h"
[1326d5f]58#include "common.h"
[4dedc28]59#include "libtrace.h"
[91b72d3]60#include "wandio.h"
[8b49230]61#include "lt_bswap.h"
[af52072]62
63#ifdef _MSC_VER
[6ed6c4a]64// warning: deprecated function
[af52072]65#pragma warning(disable:4996)
[6ed6c4a]66// warning: benign redefinitions of types
67#pragma warning(disable:4142)
[af52072]68#endif
69
70#ifdef HAVE_INTTYPES_H
71# include <inttypes.h>
72#else
73# include "lt_inttypes.h"
74#endif
75
76#ifdef HAVE_STDDEF_H
77# include <stddef.h>
78#else
79#ifndef WIN32
80# error "Can't find stddev.h -- do you define ptrdiff_t elsewhere?"
81#endif
82#endif
83
84
[afd0b73]85#include "rt_protocol.h"
[c1f2553]86       
[1f47cdd]87/* Prefer net/bpf.h over pcap-bpf.h for format_bpf.c on MacOS */
[5361eae]88#ifdef HAVE_NET_BPF_H
89#    include <net/bpf.h>
90#    define HAVE_BPF 1
91#else
[e5c2bc4]92#ifdef HAVE_PCAP_BPF_H
[4dedc28]93#  include <pcap-bpf.h>
[e5c2bc4]94#  define HAVE_BPF 1
[5361eae]95#endif
[4dedc28]96#endif
97
[e5c2bc4]98#ifdef HAVE_PCAP_H
[4dedc28]99#  include <pcap.h>
100#  ifdef HAVE_PCAP_INT_H
101#    include <pcap-int.h>
102#  endif
103#endif
104
[e5c2bc4]105#ifdef HAVE_ZLIB_H
[4dedc28]106#  include <zlib.h>
107#endif
108
[1576a3b]109#ifndef HAVE_STRNDUP
110char *strndup(const char *s, size_t size);
111#endif
112
[39e141f]113#ifndef HAVE_STRNCASECMP
114# ifndef HAVE__STRNICMP
[8488c15]115/** A local implementation of strncasecmp (as some systems do not have it) */
[39e141f]116int strncasecmp(const char *str1, const char *str2, size_t n);
117# else
118# define strncasecmp _strnicmp
119# endif
120#endif
121
122#ifndef HAVE_SNPRINTF
123# ifndef HAVE_SPRINTF_S
[8488c15]124/** A local implementation of snprintf (as some systems do not have it) */
[39e141f]125int snprintf(char *str, size_t size, const char *format, ...);
126# else
127# define snprintf sprintf_s
128# endif
129#endif
[4dedc28]130
[f9374e9]131#include "daglegacy.h"
132       
[4dedc28]133#ifdef HAVE_DAG_API
134#  include "dagnew.h"
135#  include "dagapi.h"
[2317d78]136#       if DAG_VERSION == 24
[2faa57e]137#               include <erftypes.h>
[2317d78]138#       else
139#               include <daginf.h>
[deed208]140#       endif
[ae3779b]141#  include "erftypes.h"
[4dedc28]142#else
143#  include "dagformat.h"
144#endif
145
[31a15db]146#ifdef HAVE_LLVM
147#include "bpf-jit/bpf-jit.h"
148#endif
149
[d6a56b6]150#include "data-struct/ring_buffer.h"
[a49a9eb]151#include "data-struct/object_cache.h"
[d6a56b6]152#include "data-struct/vector.h"
153#include "data-struct/message_queue.h"
154#include "data-struct/deque.h"
[cb39d35]155#include "data-struct/linked_list.h"
[d6a56b6]156#include "data-struct/sliding_window.h"
157
[8488c15]158//#define RP_BUFSIZE 65536U
[4dedc28]159
[8488c15]160/** Data about the most recent event from a trace file */
[67a14d4]161struct libtrace_event_status_t {
[8488c15]162        /** A libtrace packet to store the packet when a PACKET event occurs */
[0d57541]163        libtrace_packet_t *packet;
[8488c15]164        /** Time between the timestamp for the current packet and the current
165         * walltime */
[4dedc28]166        double tdelta;
[8488c15]167        /** The timestamp of the previous PACKET event */
[4dedc28]168        double trace_last_ts;
[8488c15]169        /** The size of the current PACKET event */
[25024fd]170        int psize;
[9cc1266]171        /** Whether there is a packet stored in *packet above waiting for an
172         * event to occur */
173        bool waiting;
[4dedc28]174};
175
[29bbef0]176enum thread_types {
177        THREAD_EMPTY,
178        THREAD_HASHER,
[17a3dff]179        THREAD_PERPKT,
[f051c1b]180        THREAD_REPORTER,
[82facc5]181        THREAD_KEEPALIVE
[29bbef0]182};
183
184enum thread_states {
185        THREAD_RUNNING,
186        THREAD_FINISHING,
187        THREAD_FINISHED,
[3296252]188        THREAD_PAUSED,
189        THREAD_STATE_MAX
[29bbef0]190};
191
192/**
193 * Information of this thread
194 */
[8c42377]195struct libtrace_thread_t {
[368a1ae]196        uint64_t accepted_packets; // The number of packets accepted only used if pread
197        uint64_t filtered_packets;
[be3f75b]198        // is retreving packets
199        // Set to true once the first packet has been stored
200        bool recorded_first;
201        // For thread safety reason we actually must store this here
202        int64_t tracetime_offset_usec;
203        void* user_data; // TLS for the user to use
204        void* format_data; // TLS for the format to use
205        libtrace_message_queue_t messages; // Message handling
206        libtrace_ringbuffer_t rbuffer; // Input
[29bbef0]207        libtrace_t * trace;
208        void* ret;
209        enum thread_types type;
210        enum thread_states state;
211        pthread_t tid;
[17a3dff]212        int perpkt_num; // A number from 0-X that represents this perpkt threads number
[29bbef0]213                                // in the table, intended to quickly identify this thread
[17a3dff]214                                // -1 represents NA (such as the case this is not a perpkt thread)
[8c42377]215};
[29bbef0]216
217/**
218 * Storage to note time value against each.
219 * Used both internally to do trace time playback
220 * and can be used externally to assist applications which need
221 * a trace starting time such as tracertstats.
222 */
223struct first_packets {
224        pthread_spinlock_t lock;
[17a3dff]225        size_t count; // If == perpkt_thread_count threads we have all
[29bbef0]226        size_t first; // Valid if count != 0
227        struct __packet_storage_magic_type {
228                libtrace_packet_t * packet;
229                struct timeval tv;
230        } * packets;
231};
232
[fac8c46]233#define TRACE_STATES \
234        X(STATE_NEW) \
235        X(STATE_RUNNING) \
236        X(STATE_PAUSING) \
237        X(STATE_PAUSED) \
238        X(STATE_FINSHED) \
239        X(STATE_DESTROYED) \
[b13b939]240        X(STATE_JOINED) \
241        X(STATE_ERROR)
[fac8c46]242
243#define X(a) a,
244enum trace_state {
245        TRACE_STATES
246};
247#undef X
248
249#define X(a) case a: return #a;
250static inline char *get_trace_state_name(enum trace_state ts){
251        switch(ts) {
252                TRACE_STATES
253                default:
254                        return "UNKNOWN";
255        }
256}
257#undef X
[29bbef0]258
[8488c15]259/** A libtrace input trace
[9e2a109]260 * @internal
261 */
262struct libtrace_t {
[8488c15]263        /** The capture format for the input trace */
264        struct libtrace_format_t *format; 
265        /** Details of the most recent PACKET event reported by the trace */
266        struct libtrace_event_status_t event;
267        /** Pointer to the "global" data for the capture format module */       
268        void *format_data;             
269        /** A BPF filter to be applied to all packets read by the trace -
270         * used only if the capture format does not support filters natively */
271        struct libtrace_filter_t *filter; 
272        /** The snap length to be applied to all packets read by the trace -
273         * used only if the capture format does not support snapping natively */
274        size_t snaplen;                 
275        /** Count of the number of packets returned to the libtrace user */
276        uint64_t accepted_packets;     
277        /** Count of the number of packets filtered by libtrace */
278        uint64_t filtered_packets;     
279        /** The filename from the uri for the trace */
[29bbef0]280        char *uridata;
[8488c15]281        /** The libtrace IO reader for this trace (if applicable) */
[29bbef0]282        io_t *io;
[8488c15]283        /** Error information for the trace */
[29bbef0]284        libtrace_err_t err;
[8488c15]285        /** Boolean flag indicating whether the trace has been started */
[29bbef0]286        bool started;
287        /** Synchronise writes/reads across this format object and attached threads etc */
288        pthread_mutex_t libtrace_lock;
[fac8c46]289        /** State */
290        enum trace_state state;
[29bbef0]291        /** Use to control pausing threads and finishing threads etc always used with libtrace_lock */
292        pthread_cond_t perpkt_cond;
[3296252]293        /* Keep track of counts of threads in any given state */
294        int perpkt_thread_states[THREAD_STATE_MAX]; 
[fac8c46]295
[17a3dff]296        /** Set to indicate a perpkt's queue is full as such the writing perpkt cannot proceed */
297        bool perpkt_queue_full;
[29bbef0]298        /** Global storage for this trace, shared among all the threads  */
299        void* global_blob;
300        /** The actual freelist */
[a49a9eb]301        libtrace_ocache_t packet_freelist;
[29bbef0]302        /** User defined per_pkt function called when a pkt is ready */
303        fn_per_pkt per_pkt;
[f051c1b]304        /** User defined reporter function entry point XXX not hooked up */
305        fn_reporter reporter;
[29bbef0]306        /** The hasher function */
307        enum hasher_types hasher_type;
308        /** The hasher function - NULL implies they don't care or balance */
309        fn_hasher hasher; // If valid using a separate thread
310        void *hasher_data;
[858ce90]311        /** The pread_packet choosen path for the configuration */
312        int (*pread)(libtrace_t *, libtrace_thread_t *, libtrace_packet_t **, size_t);
313
[29bbef0]314        libtrace_thread_t hasher_thread;
[f051c1b]315        libtrace_thread_t reporter_thread;
[82facc5]316        libtrace_thread_t keepalive_thread;
[17a3dff]317        int perpkt_thread_count;
318        libtrace_thread_t * perpkt_threads; // All our perpkt threads
[29bbef0]319        // Used to keep track of the first packet seen on each thread
320        struct first_packets first_packets;
321        int tracetime;
[be3f75b]322
323        /*
324         * Caches statistic counters in the case that our trace is
325         * paused or stopped before this counter is taken
326         */
327        uint64_t dropped_packets;
[f051c1b]328        uint64_t received_packets;
329        struct user_configuration config;
[2498008]330        libtrace_combine_t combiner;
[9e2a109]331};
[1fc2f6a]332
[82facc5]333void trace_fin_packet(libtrace_packet_t *packet);
[5ba34eb]334void libtrace_zero_thread(libtrace_thread_t * t);
335void store_first_packet(libtrace_t *libtrace, libtrace_packet_t *packet, libtrace_thread_t *t);
[17a3dff]336libtrace_thread_t * get_thread_table(libtrace_t *libtrace);
337int get_thread_table_num(libtrace_t *libtrace);
338
[29bbef0]339
[8488c15]340/** A libtrace output trace
[2e223eca]341 * @internal
342 */
[9e2a109]343struct libtrace_out_t {
[8488c15]344        /** The capture format for the output trace */
[29bbef0]345        struct libtrace_format_t *format;
[8488c15]346        /** Pointer to the "global" data for the capture format module */
347        void *format_data;             
348        /** The filename for the uri for the output trace */
349        char *uridata;                 
350        /** Error information for the output trace */
351        libtrace_err_t err;
352        /** Boolean flag indicating whether the trace has been started */
[29bbef0]353        bool started;
[1fc2f6a]354};
355
[8488c15]356/** Sets the error status on an input trace
357 *
358 * @param trace         The input trace to set the error status for
359 * @param errcode       The code for the error - can be a libtrace error code or a regular errno value
360 * @param msg           A message to print when reporting the error
361 */
[e1868fb]362void trace_set_err(libtrace_t *trace, int errcode,const char *msg,...) 
[8488c15]363
[e1868fb]364                                                                PRINTF(3,4);
[8488c15]365/** Sets the error status on an output trace
366 *
367 * @param trace         The output trace to set the error status for
368 * @param errcode       The code for the error - can be a libtrace error code or a regular errno value
369 * @param msg           A message to print when reporting the error
370 */
[e1868fb]371void trace_set_err_out(libtrace_out_t *trace, int errcode, const char *msg,...)
372                                                                PRINTF(3,4);
[1fc2f6a]373
[9cc1266]374/** Clears the cached values for a libtrace packet
375 *
376 * @param packet        The libtrace packet that requires a cache reset
377 */
378void trace_clear_cache(libtrace_packet_t *packet);
[f0fb38f]379
[8488c15]380/** Converts the data provided in buffer into a valid libtrace packet
381 *
382 * @param trace         An input trace of the same format as the "packet"
383 *                      contained in the buffer
384 * @param packet        The libtrace packet to prepare
385 * @param buffer        A buffer containing the packet data, including the
386 *                      capture format header
387 * @param rt_type       The RT type for the packet that is being prepared
388 * @param flags         Used to specify options for the preparation function,
389 *                      e.g. who owns the packet buffer
390 *
391 * @return -1 if an error occurs, 0 otherwise
392 *
393 * Packet preparation is a tricky concept - the idea is to take the data
394 * pointed to by 'buffer' and treat it as a packet record of the same capture
395 * format as that used by the input trace. The provided libtrace packet then
396 * has its internal pointers and values set to describe the packet record in
397 * the buffer.
398 *
399 * The primary use of this function is to allow the RT packet reader to
400 * easily and safely convert packets from the RT format back into the format
401 * that they were originally captured with., essentially removing the RT
402 * encapsulation.
403 *
404 * We've decided not to make this function available via the exported API
405 * because there are several issues that can arise if it is not used very
406 * carefully and it is not very useful outside of internal contexts anyway.
[f0fb38f]407 */
408int trace_prepare_packet(libtrace_t *trace, libtrace_packet_t *packet,
409                void *buffer, libtrace_rt_types_t rt_type, uint32_t flags);
410
[8488c15]411/** Flags for prepare_packet functions */
[590fb30]412enum {
[8488c15]413        /** The buffer memory has been allocated by libtrace and should be
414         * freed when the packet is destroyed. */
[590fb30]415        TRACE_PREP_OWN_BUFFER           =1,
[8488c15]416       
417        /** The buffer memory is externally-owned and must not be freed by
418         * libtrace when the packet is destroyed. */
[590fb30]419        TRACE_PREP_DO_NOT_OWN_BUFFER    =0
420};
421
[1c1e4a2]422
[4dedc28]423#ifndef PF_RULESET_NAME_SIZE
424#define PF_RULESET_NAME_SIZE 16
425#endif
426
427#ifndef IFNAMSIZ
428#define IFNAMSIZ 16
429#endif
430
[8488c15]431
432/** A local definition of a PFLOG header */
[67a14d4]433typedef struct libtrace_pflog_header_t {
[8488c15]434        uint8_t    length;     
[4dedc28]435        sa_family_t   af;
436        uint8_t    action;
437        uint8_t    reason;
438        char       ifname[IFNAMSIZ];
439        char       ruleset[PF_RULESET_NAME_SIZE];
440        uint32_t   rulenr;
441        uint32_t   subrulenr;
442        uint8_t    dir;
443        uint8_t    pad[3];
[25024fd]444} PACKED libtrace_pflog_header_t;
[4dedc28]445
[8488c15]446/** A libtrace capture format module */
447/* All functions should return -1, or NULL on failure */
[9e2a109]448struct libtrace_format_t {
[8488c15]449        /** The name of this module, used in the libtrace URI to identify the
450         * capture format */
[4746c71]451        const char *name;
[8488c15]452        /** The version of this module */
[4746c71]453        const char *version;
[8488c15]454        /** The RT protocol type of this module */
[6dbc47a]455        enum base_format_t type;
[3c26e2a]456
457
[8488c15]458        /** Given a filename, return if this is the most likely capture format
459         * (used for devices). Used to "guess" the capture format when the
460         * URI is not fully specified.
461         *
462         * @param fname         The name of the device or file to examine
463         * @return 1 if the name matches the capture format, 0 otherwise
[91b72d3]464         */
465        int (*probe_filename)(const char *fname);
[8488c15]466       
467        /** Given a file, looks at the start of the file to determine if this
468         * is the capture format. Used to "guess" the capture format when the
469         * URI is not fully specified.
470         *
471         * @param io            An open libtrace IO reader for the file to check
472         * @return 1 if the file matches the capture format, 0 otherwise
473         */
[91b72d3]474        int (*probe_magic)(io_t *io);
[8488c15]475
476        /** Initialises an input trace using the capture format.
477         *
478         * @param libtrace      The input trace to be initialised
479         * @return 0 if successful, -1 in the event of error
480         */
[1fbd938]481        int (*init_input)(libtrace_t *libtrace);
[8488c15]482       
483        /** Applies a configuration option to an input trace.
484         *
485         * @param libtrace      The input trace to apply the option to
486         * @param option        The option that is being configured
487         * @param value         A pointer to the value that the option is to be
488         *                      set to
489         * @return 0 if successful, -1 if the option is unsupported or an error
490         * occurs
491         */
[1fbd938]492        int (*config_input)(libtrace_t *libtrace,trace_option_t option,void *value);
[8488c15]493        /** Starts or unpauses an input trace - note that this function is
494         * often the one that opens the file or device for reading.
495         *
496         * @param libtrace      The input trace to be started or unpaused
497         * @return 0 if successful, -1 in the event of error */
[1fbd938]498        int (*start_input)(libtrace_t *libtrace);
[8488c15]499
500        /** Pauses an input trace - this function should close or detach the
501         * file or device that is being read from.
502         *
503         * @param libtrace      The input trace to be paused
504         * @return 0 if successful, -1 in the event of error
505         */
[1fbd938]506        int (*pause_input)(libtrace_t *libtrace);
[8488c15]507
508        /** Initialises an output trace using the capture format.
509         *
510         * @param libtrace      The output trace to be initialised
511         * @return 0 if successful, -1 in the event of error
512         */
[1fbd938]513        int (*init_output)(libtrace_out_t *libtrace);
[8488c15]514       
515        /** Applies a configuration option to an output trace.
516         *
517         * @param libtrace      The output trace to apply the option to
518         * @param option        The option that is being configured
519         * @param value         A pointer to the value that the option is to be
520         *                      set to
521         * @return 0 if successful, -1 if the option is unsupported or an error
522         * occurs
523         * */
524        int (*config_output)(libtrace_out_t *libtrace, trace_option_output_t option, void *value);
525
526        /** Starts an output trace - note that this function is often the one
527         * that opens the file or device for writing.
528         *
529         * @param libtrace      The output trace to be started
530         * @return 0 if successful, -1 if an error occurs
531         *
532         * There is no pause for output traces, as writing is not performed
533         * asynchronously.
[9de8150]534         */
[1fbd938]535        int (*start_output)(libtrace_out_t *libtrace);
[8488c15]536
537        /** Concludes an input trace and cleans up the capture format data.
538         *
539         * @param libtrace      The input trace to be concluded
540         * @return 0 if successful, -1 if an error occurs
541         *
542         * Libtrace will call the pause_input function if the input trace is
543         * currently active prior to calling this function.
[ab4cb04]544         */
[1fbd938]545        int (*fin_input)(libtrace_t *libtrace);
[8488c15]546
547        /** Concludes an output trace and cleans up the capture format data.
548         *
549         * @param libtrace      The output trace to be concluded
550         * @return 0 if successful, -1 if an error occurs
551         */
[1fbd938]552        int (*fin_output)(libtrace_out_t *libtrace);
[8488c15]553
554        /** Reads the next packet from an input trace into the provided packet
555         * structure.
556         *
557         * @param libtrace      The input trace to read from
558         * @param packet        The libtrace packet to read into
559         * @return The size of the packet read (in bytes) including the capture
560         * framing header, or -1 if an error occurs. 0 is returned in the
561         * event of an EOF.
562         *
563         * If no packets are available for reading, this function should block
564         * until one appears or return 0 if the end of a trace file has been
565         * reached.
[9de8150]566         */
[97e39a7]567        int (*read_packet)(libtrace_t *libtrace, libtrace_packet_t *packet);
[8488c15]568       
569        /** Converts a buffer containing a packet record into a libtrace packet
570         *
571         * @param libtrace      An input trace in the capture format for the
572         *                      packet
573         * @param packet        A libtrace packet to put the prepared packet
574         *                      into
575         * @param buffer        The buffer containing the packet record
576         *                      (including the capture format header)
577         * @param rt_type       The RT type for the packet
578         * @param flags         Flags describing properties that should be
579         *                      applied to the new packet
580         * @return 0 if successful, -1 if an error occurs.
581         *
582         * Updates internal trace and packet details, such as payload pointers,
583         * loss counters and packet types to match the packet record provided
584         * in the buffer. This is a zero-copy function.
585         *
[f0fb38f]586         * Intended (at this stage) only for internal use, particularly by
587         * RT which needs to decapsulate RT packets */
588        int (*prepare_packet)(libtrace_t *libtrace, libtrace_packet_t *packet,
589                        void *buffer, libtrace_rt_types_t rt_type, 
590                        uint32_t flags);
[8488c15]591       
592        /** Frees any resources allocated by the capture format module for a
593         * libtrace packet.
594         *
595         * @param The packet to be finalised
596         *       */
[eeab9832]597        void (*fin_packet)(libtrace_packet_t *packet);
[8488c15]598
599        /** Write a libtrace packet to an output trace.
600         *
601         * @param libtrace      The output trace to write the packet to
602         * @param packet        The packet to be written out
603         * @return The number of bytes written, or -1 if an error occurs
[9de8150]604         */
[3a169d7]605        int (*write_packet)(libtrace_out_t *libtrace, libtrace_packet_t *packet);
[8488c15]606        /** Returns the libtrace link type for a packet.
607         *
608         * @param packet        The packet to get the link type for
609         * @return The libtrace link type, or -1 if this link type is unknown
[9de8150]610         */ 
[1fbd938]611        libtrace_linktype_t (*get_link_type)(const libtrace_packet_t *packet);
[8488c15]612
613        /** Returns the direction of a packet.
614         *
615         * @param packet        The packet to get the direction for
616         * @return The direction of the packet, or -1 if no direction tag is
617         * present or an error occurs
[9de8150]618         */ 
[431548c5]619        libtrace_direction_t (*get_direction)(const libtrace_packet_t *packet);
[8488c15]620       
621        /** Sets the direction of a packet.
622         *
623         * @param packet        The packet to set the direction for
624         * @param direction     The direction to assign to the packet
625         * @return The updated direction for the packet, or -1 if an error
626         * occurs
627         *
628         * @note Some capture formats do not feature direction tagging, so it
629         * will not make sense to implement a set_direction function for them.
[9de8150]630         */ 
[431548c5]631        libtrace_direction_t (*set_direction)(libtrace_packet_t *packet, libtrace_direction_t direction);
[8488c15]632       
633        /** Returns the timestamp for a packet in the ERF timestamp format.
634         *
635         * @param packet        The packet to get the timestamp from
636         * @return The 64-bit ERF timestamp
637         *
638         * @note Each format must implement at least one of the four "get
639         * timestamp" functions.
640         *
641         * If not implemented, libtrace will convert the result of one of the
642         * other timestamp functions into the appropriate format instead.
643         * This means each capture format only needs to implement the most
644         * sensible of the four and let libtrace handle any conversions.
645         *
[9de8150]646         */
[1fbd938]647        uint64_t (*get_erf_timestamp)(const libtrace_packet_t *packet);
[8488c15]648
649        /** Returns the timestamp for a packet in the timeval format
650         *
651         * @param packet        The packet to get the timestamp from
652         * @return The timestamp from the packet as a timeval
653         *
654         * @note Each format must implement at least one of the four "get
655         * timestamp" functions.
656         *
657         * If not implemented, libtrace will convert the result of one of the
658         * other timestamp functions into the appropriate format instead.
659         * This means each capture format only needs to implement the most
660         * sensible of the four and let libtrace handle any conversions.
[9de8150]661         */
[1fbd938]662        struct timeval (*get_timeval)(const libtrace_packet_t *packet);
[8488c15]663       
664        /** Returns the timestamp for a packet in the timespec format.
665         *
666         * @param packet        The packet to get the timestamp from
667         * @return The timestamp from the packet as a timespec
668         *
669         * @note Each format must implement at least one of the four "get
670         * timestamp" functions.
671         *
672         * If not implemented, libtrace will convert the result of one of the
673         * other timestamp functions into the appropriate format instead.
674         * This means each capture format only needs to implement the most
675         * sensible of the four and let libtrace handle any conversions.
[1aa4bf7]676         */
677        struct timespec (*get_timespec)(const libtrace_packet_t *packet);
[8488c15]678       
679        /** Returns the timestamp for a packet in floating point seconds.
680         *
681         * @param packet        The packet to get the timestamp from
682         * @return The timestamp from the packet as a floating point number of
683         * seconds since 1970-01-01 00:00:00 UTC
684         *
685         * @note Each format must implement at least one of the four "get
686         * timestamp" functions.
687         *
688         * If not implemented, libtrace will convert the result of one of the
689         * other timestamp functions into the appropriate format instead.
690         * This means each capture format only needs to implement the most
691         * sensible of the four and let libtrace handle any conversions.
[9de8150]692         */
[1fbd938]693        double (*get_seconds)(const libtrace_packet_t *packet);
[8488c15]694       
695        /** Moves the read pointer to a certain ERF timestamp within an input
696         * trace file.
697         *
698         * @param trace         The input trace to seek within
699         * @param timestamp     The timestamp to seek to, as an ERF timestamp
700         *
[9de8150]701         * @return 0 on success, -1 on failure.
[8488c15]702         *
703         * The next packet read from this trace will now be the first packet
704         * to have a timestamp equal to or greater than the provided timestamp.
705         *
706         * @note Each format that supports seeking must implement at least one
707         * of the seek functions.
708         *
709         * If not implemented, libtrace will convert the timestamp into the
710         * appropriate format to use a seek function that has been implemented.
711         * This means each capture format only needs to implement the seek
712         * function that matches the native timestamp format for that capture.
713         *
[9de8150]714         */
[1fbd938]715        int (*seek_erf)(libtrace_t *trace, uint64_t timestamp);
[8488c15]716        /** Moves the read pointer to a certain timestamp represented using a
717         * timeval within an input trace file.
718         *
719         * @param trace         The input trace to seek within
720         * @param timestamp     The timestamp to seek to, as a timeval
721         *
[9de8150]722         * @return 0 on success, -1 on failure.
[8488c15]723         *
724         * The next packet read from this trace will now be the first packet
725         * to have a timestamp equal to or greater than the provided timestamp.
726         *
727         * @note Each format that supports seeking must implement at least one
728         * of the seek functions.
729         *
730         * If not implemented, libtrace will convert the timestamp into the
731         * appropriate format to use a seek function that has been implemented.
732         * This means each capture format only needs to implement the seek
733         * function that matches the native timestamp format for that capture.
734         *
[9de8150]735         */
[1fbd938]736        int (*seek_timeval)(libtrace_t *trace, struct timeval tv);
[8488c15]737       
738        /** Moves the read pointer to a certain timestamp represented using
739         * floating point seconds within an input trace file.
740         *
741         * @param trace         The input trace to seek within
742         * @param timestamp     The timestamp to seek to, as floating point
743         *                      seconds since 1970-01-01 00:00:00 UTC
744         *
[9de8150]745         * @return 0 on success, -1 on failure.
[8488c15]746         *
747         * The next packet read from this trace will now be the first packet
748         * to have a timestamp equal to or greater than the provided timestamp.
749         *
750         * @note Each format that supports seeking must implement at least one
751         * of the seek functions.
752         *
753         * If not implemented, libtrace will convert the timestamp into the
754         * appropriate format to use a seek function that has been implemented.
755         * This means each capture format only needs to implement the seek
756         * function that matches the native timestamp format for that capture.
757         *
[9de8150]758         */
[1fbd938]759        int (*seek_seconds)(libtrace_t *trace, double seconds);
[8488c15]760       
761        /** Returns the payload length of the captured packet record.
762         *
763         * @param packet        The packet to get the capture length from
764         * @return The capture length for the packet, or -1 if an error occurs
765         *
766         * Capture length is the current size of the packet record itself,
767         * following any truncation that may have occurred during the capture
768         * process. This length does not include the capture format framing
769         * header.
[9de8150]770         */
[1fbd938]771        int (*get_capture_length)(const libtrace_packet_t *packet);
[8488c15]772
773        /** Returns the original length of the packet as it was on the wire.
774         *
775         * @param packet        The packet to get the wire length from
776         * @return The length of the packet on the wire at the time of capture,
777         * or -1 if an error occurs
778         *
779         * Wire length is the original size of the packet prior to any
780         * truncation that may have occurred as part of the capture process.
781         * This length does not include the capture format framing header.
[9de8150]782         */
[1fbd938]783        int (*get_wire_length)(const libtrace_packet_t *packet);
[8488c15]784       
785        /** Returns the length of the capture format framing header
786         *
787         * @param packet        The packet to get the framing length from
788         * @return The length of the framing header, or -1 if an error occurs
789         *
790         * The framing header is the extra metadata that the capture process
791         * records about a packet.  The framing length does not include any
792         * of the packet payload itself. The total size of the packet record
793         * can be calculated be adding this value with the capture length.
[9de8150]794         */
[1fbd938]795        int (*get_framing_length)(const libtrace_packet_t *packet);
[8488c15]796
797        /** Sets the capture length for a packet.
798         *
799         * @param packet        The packet to adjust the capture length for.
800         * @param size          The new capture length
801         * @return The new capture length of the packet, or -1 if an error
802         * occurs
803         *
804         * @note This function should only reduce the capture length. If the
805         * provided length is larger than the current capture length, -1 should
806         * be returned.
[9de8150]807         */
[c95b923]808        size_t (*set_capture_length)(struct libtrace_packet_t *packet,size_t size);
[8488c15]809        /** Returns the number of packets observed by an input trace.
810         *
811         * @param trace         The input trace to get the packet count for
812         * @return The number of packets observed by an input trace, or
813         * UINT64_MAX if the number is unknown
814         *
815         * This count includes packets that have been filtered and dropped.
[f2fae49]816         */
[50bbce8]817        uint64_t (*get_received_packets)(libtrace_t *trace);
[8488c15]818
819        /** Returns the number of packets filtered by an input trace.
820         *
821         * @param trace         The input trace to get the filtered count for
822         * @return The number of packets filtered by the input trace, or
823         * UINT64_MAX if the number is unknown
824         *
[f2fae49]825         */
[50bbce8]826        uint64_t (*get_filtered_packets)(libtrace_t *trace);
[8488c15]827       
828        /** Returns the number of packets dropped by an input trace.
829         *
830         * @param trace         The input trace to get the dropped count for
831         * @return The number of packets dropped by the input trace, or
832         * UINT64_MAX if the number is unknown
833         *
834         */
[50bbce8]835        uint64_t (*get_dropped_packets)(libtrace_t *trace);
[8488c15]836       
837        /** Returns the number of packets captured and returned by an input
838         * trace.
839         *
840         * @param trace         The input trace to get the capture count for
841         * @return The number of packets returned to the libtrace user, or
842         * UINT64_MAX if the number is unknown
843         *
844         * This is the number of packets that have been successfully returned
845         * to the libtrace user via the read_packet() function.
846         *
[f2fae49]847         */
[50bbce8]848        uint64_t (*get_captured_packets)(libtrace_t *trace);
[8488c15]849       
850        /** Returns the file descriptor used by the input trace.
851         *
852         * @param trace         The input trace to get the file descriptor for
853         * @return The file descriptor used by the input trace to read packets
854         *
[9de8150]855         */
[52f8fc2]856        int (*get_fd)(const libtrace_t *trace);
[8488c15]857       
858        /** Returns the next libtrace event for the input trace.
859         *
860         * @param trace         The input trace to get the next event from
861         * @param packet        A libtrace packet to read a packet into
862         * @return A libtrace event describing the event that occured
863         *
864         * The event API allows for non-blocking reading of packets from an
865         * input trace. If a packet is available and ready to be read, a packet
866         * event should be returned. Otherwise a sleep or fd event should be
867         * returned to indicate that the caller needs to wait. If the input
868         * trace has an error or reaches EOF, a terminate event should be
869         * returned.
[9de8150]870         */
[1fbd938]871        struct libtrace_eventobj_t (*trace_event)(libtrace_t *trace, libtrace_packet_t *packet);       
[8488c15]872
873        /** Prints some useful help information to standard output. */
[33d83d4]874        void (*help)(void);
[29bbef0]875       
[b13b939]876        /** Next pointer, should always be NULL - used by the format module
877         * manager. */
878        struct libtrace_format_t *next;
879
880        /** Holds information about the trace format */
881        struct libtrace_info_t info;
882
[04bf7c5]883        /**
884         * Starts or unpauses an input trace in parallel mode - note that
[29bbef0]885         * this function is often the one that opens the file or device for
886         * reading.
887         *
888         * @param libtrace      The input trace to be started or unpaused
[04bf7c5]889         * @return 0 upon success.
890         *         Otherwise in event of an error -1 is returned.
[29bbef0]891         *
892         */
893        int (*pstart_input)(libtrace_t *trace);
894       
[d7fd648]895        /**
896         * Read a batch of packets from the input stream related to thread.
897         * At most read nb_packets, however should return with less if packets
898         * are not waiting. However still must return at least 1, 0 still indicates
899         * EOF.
900         *
901         * @param libtrace      The input trace
902         * @param t     The thread
903         * @param packets       An array of packets
904         * @param nb_packets    The number of packets in the array (the maximum to read)
905         * @return The number of packets read, or 0 in the case of EOF or -1 in error or -2 to represent
906         * interrupted due to message waiting before packets had been read.
907         */
908        int (*pread_packets)(libtrace_t *trace, libtrace_thread_t *t, libtrace_packet_t **packets, size_t nb_packets);
[29bbef0]909       
[b13b939]910        /** Pause a parallel trace
911         *
912         * @param libtrace      The input trace to be paused
913         */
[29bbef0]914        int (*ppause_input)(libtrace_t *trace);
915       
[b13b939]916        /** Called after all threads have been paused, Finish (close) a parallel trace
[d7fd648]917         *
[b13b939]918         * @param libtrace      The input trace to be stopped
919         */
[29bbef0]920        int (*pfin_input)(libtrace_t *trace);
921       
922        /** Applies a configuration option to an input trace.
923         *
924         * @param libtrace      The input trace to apply the option to
925         * @param option        The option that is being configured
926         * @param value         A pointer to the value that the option is to be
927         *                      set to
928         * @return 0 if successful, -1 if the option is unsupported or an error
929         * occurs
930         */
931        int (*pconfig_input)(libtrace_t *libtrace,trace_parallel_option_t option,void *value);
[50ce607]932
933        /**
934         * Register a thread for use with the format or using the packets produced
[12ae766]935         * by it. This is NOT only used for threads reading packets in fact all
[50ce607]936         * threads use this.
937         *
[12ae766]938         * The libtrace lock is not held by this format but can be aquired
939         * by the format.
940         *
[50ce607]941         * Some use cases include setting up any thread local storage required for
942         * to read packets and free packets. For DPDK we require any thread that
943         * may release or read a packet to have have an internal number associated
944         * with it.
945         *
946         * The thread type can be used to see if this thread is going to be used
947         * to read packets or otherwise.
948         *
949         * @return 0 if successful, -1 if the option is unsupported or an error
950         * occurs (such as a maximum of threads being reached)
951         */
952        int (*pregister_thread)(libtrace_t *libtrace, libtrace_thread_t *t, bool reader);
953
954        /**
955         * If needed any memory allocated with pregister_thread can be released
956         * in this function. The thread will be destroyed directly after this
957         * function is called.
958         */
959        void (*punregister_thread)(libtrace_t *libtrace, libtrace_thread_t *t);
[4dedc28]960};
961
[b13b939]962/** Macro to zero out a single thread format */
963#define NON_PARALLEL(live) \
964{live, 1},              /* trace info */ \
965NULL,                   /* pstart_input */ \
966NULL,                   /* pread_packet */ \
967NULL,                   /* ppause_input */ \
968NULL,                   /* pfin_input */ \
[50ce607]969NULL,                   /* pconfig_input */ \
970NULL,                   /* pregister_thread */ \
971NULL                    /* punregister_thread */
[b13b939]972
[8488c15]973/** The list of registered capture formats */
[c0506ea]974//extern struct libtrace_format_t *form;
975
976/** Specifies whether any blocking packet readers should cease reading
977 * immediately
978 */
[d7fd648]979extern volatile int libtrace_halt;
[4dedc28]980
[8488c15]981/** Registers a new capture format module.
982 *
983 * @param format        The format module to be registered
984 */
[9e2a109]985void register_format(struct libtrace_format_t *format);
[7068467]986
[8488c15]987/** Converts a PCAP DLT into a libtrace link type.
988 *
989 * @param linktype      The PCAP DLT to be converted
990 * @return The libtrace link type that is equivalent to the provided DLT, or
991 * -1 if the DLT is unknown
992 */
[4c00a35]993libtrace_linktype_t pcap_linktype_to_libtrace(libtrace_dlt_t linktype);
[8488c15]994
995/** Converts a PCAP DLT into an RT protocol type.
996 *
997 * @param linktype      The PCAP DLT to be converted
998 * @return The RT type that is equivalent to the provided DLT
999 */
[ce0bf2c]1000libtrace_rt_types_t pcap_linktype_to_rt(libtrace_dlt_t linktype);
[8488c15]1001
1002/** Converts a libtrace link type into a PCAP linktype.
1003 *
1004 * @param type          The libtrace link type to be converted
1005 * @return The PCAP linktype that is equivalent to the provided libtrace link
1006 * type, or -1 if the link type is unknown
1007 */
[4c00a35]1008libtrace_dlt_t libtrace_to_pcap_linktype(libtrace_linktype_t type);
[8488c15]1009
1010/** Converts a libtrace link type into a PCAP DLT.
1011 *
1012 * @param type          The libtrace link type to be converted
1013 * @return The PCAP DLT that is equivalent to the provided libtrace link
1014 * type, or -1 if the link type is unknown
1015 */
[4c00a35]1016libtrace_dlt_t libtrace_to_pcap_dlt(libtrace_linktype_t type);
[8488c15]1017
1018/** Converts an RT protocol type into a PCAP DLT.
1019 *
1020 * @param rt_type       The RT type to be converted
1021 * @return The PCAP DLT that is equivalent to the provided RT protocol
1022 */
[4c00a35]1023libtrace_dlt_t rt_to_pcap_linktype(libtrace_rt_types_t rt_type);
[8488c15]1024
[f00c146]1025/** Converts a PCAP DLT into an RT protocol type for the BPF format.
1026 *
1027 * @param linktype      The PCAP DLT to be converted
1028 * @return The RT type that is equivalent to the provided DLT for BPF
1029 */
1030libtrace_rt_types_t bpf_linktype_to_rt(libtrace_dlt_t linktype);
1031
[8488c15]1032/** Converts an ERF type into a libtrace link type.
1033 *
1034 * @param erf           The ERF type to be converted
1035 * @return The libtrace link type that is equivalent to the provided ERF type,
1036 * or -1 if the ERF type is unknown
1037 */
[4bd8a5b]1038libtrace_linktype_t erf_type_to_libtrace(uint8_t erf);
[8488c15]1039
1040/** Converts a libtrace link type into an ERF type.
1041 *
1042 * @param linktype      The libtrace link type to be converted
1043 * @return The ERF type that is equivalent to the provided libtrace link type,
1044 * or -1 if the link type cannot be matched to an ERF type.
1045 */
[4bd8a5b]1046uint8_t libtrace_to_erf_type(libtrace_linktype_t linktype);
[7068467]1047
[8488c15]1048/** Converts an ARPHRD type into a libtrace link type.
1049 *
1050 * @param arphrd        The ARPHRD type to be converted
1051 * @return The libtrace link type that is equivalent to the provided ARPHRD
1052 * type, or -1 if the ARPHRD type is unknown
1053 */
1054libtrace_linktype_t arphrd_type_to_libtrace(unsigned int arphrd);
1055
1056/** Converts a libtrace link type into an ARPHRD type.
1057 *
1058 * @param type          The libtrace link type to be converted
1059 * @return The ARPHRD type that is equivalent to the provided libtrace link
1060 * type, or -1 if the link type cannot be matched to an ARPHRD type
1061 */
1062unsigned int libtrace_to_arphrd_type(libtrace_linktype_t type);
1063
1064/** Converts a libtrace packet to the Linux SLL type.
1065 *
1066 * @param packet        The packet to be promoted
1067 *
1068 * @note This will involve memcpy() so use sparingly.
1069 *
1070 * This function prepends a Linux SLL header to a packet so that we can store
1071 * direction tagging information.
1072 */
[81f9b6e]1073void promote_packet(libtrace_packet_t *packet);
[8488c15]1074
1075/** Attempts to demote a packet by removing the first header.
1076 *
1077 * @param packet        The packet to be demoted
1078 * @return True if the packet was demoted, false otherwise.
1079 *
1080 * Essentially the opposite of promote_packet, except that it will also remove
1081 * an ATM header as well as Linux SLL.
1082 *
1083 */
[0ff6ddf]1084bool demote_packet(libtrace_packet_t *packet);
[81f9b6e]1085
[8488c15]1086/** Returns a pointer to the header following a Linux SLL header.
1087 *
1088 * @param link          A pointer to the Linux SLL header to be skipped
[9cc1266]1089 * @param[out] arphrd_type      The arp hardware type of the packet
1090 * @param[out] next_header      The ethertype of the next header
[8488c15]1091 * @param[in,out] remaining     Updated with the number of captured bytes
1092 *                              remaining
1093 * @return A pointer to the header following the Linux SLL header, or NULL if
1094 * no subsequent header is present.
1095 *
1096 * Remaining must point to the number of bytes captured from the Linux SLL
1097 * header and beyond.  It will be decremented by the number of bytes skipped
1098 * to find the payload.
1099 *
1100 * If the Linux SLL header is complete but there are zero bytes of payload
1101 * after the end of the header, a pointer to where the payload would be is
1102 * returned and remaining will be set to zero. If the Linux SLL header is
1103 * incomplete (truncated), then NULL is returned and remaining will be set to
1104 * 0. Therefore, it is very important to check the value of remaining after
1105 * calling this function.
1106 */     
[9cc1266]1107void *trace_get_payload_from_linux_sll(const void *link,
1108                uint16_t *arphrd_type, 
1109                uint16_t *next_header, 
[8488c15]1110                uint32_t *remaining);
1111
1112/** Returns a pointer to the header following an ATM header.
1113 *
1114 * @param link          A pointer to the ATM header to be skipped
1115 * @param[out] type     The ethertype of the next header
1116 * @param[in,out] remaining     Updated with the number of captured bytes
1117 *                              remaining
1118 * @return A pointer to the header following the ATM header, or NULL if
1119 * no subsequent header is present.
1120 *
1121 * Remaining must point to the number of bytes captured from the ATM header
1122 * and beyond.  It will be decremented by the number of bytes skipped to find
1123 * the payload.
1124 *
1125 * If the ATM header is complete but there are zero bytes of payload
1126 * after the end of the header, a pointer to where the payload would be is
1127 * returned and remaining will be set to zero. If the ATM header is
1128 * incomplete (truncated), then NULL is returned and remaining will be set to
1129 * 0. Therefore, it is very important to check the value of remaining after
1130 * calling this function.
1131 */     
1132DLLEXPORT void *trace_get_payload_from_atm(void *link, uint8_t *type, 
1133                uint32_t *remaining);
[94af885]1134
1135
[e5c2bc4]1136#ifdef HAVE_BPF
[df338b3]1137/* A type encapsulating a bpf filter
1138 * This type covers the compiled bpf filter, as well as the original filter
1139 * string
1140 *
1141 */
[8488c15]1142
1143/** Internal representation of a BPF filter */
[df338b3]1144struct libtrace_filter_t {
[8488c15]1145        struct bpf_program filter;      /**< The BPF program itself */
1146        char * filterstring;            /**< The filter string */
1147        int flag;                       /**< Indicates if the filter is valid */
[31a15db]1148        struct bpf_jit_t *jitfilter;
[df338b3]1149};
[e5c2bc4]1150#else
[8488c15]1151/** BPF not supported by this system, but we still need to define a structure
1152 * for the filter */
[e5c2bc4]1153struct libtrace_filter_t {};
[df338b3]1154#endif
[45dfddc]1155
[8488c15]1156/** Local definition of a PCAP header */
[45dfddc]1157typedef struct libtrace_pcapfile_pkt_hdr_t {
[8488c15]1158        uint32_t ts_sec;        /* Seconds portion of the timestamp */
1159        uint32_t ts_usec;       /* Microseconds portion of the timestamp */
1160        uint32_t caplen;        /* Capture length of the packet */
1161        uint32_t wirelen;       /* The wire length of the packet */
[45dfddc]1162} libtrace_pcapfile_pkt_hdr_t;
1163
[5d56d34]1164#ifdef HAVE_DAG
[8488c15]1165/** Constructor for the DAG format module */
[5d56d34]1166void dag_constructor(void);
1167#endif
[8488c15]1168/** Constructor for the ERF format module */
[cab58c5]1169void erf_constructor(void);
[8488c15]1170/** Constructor for the TSH format module */
[e01a738]1171void tsh_constructor(void);
[8488c15]1172/** Constructor for the Legacy DAG format module */
[cab58c5]1173void legacy_constructor(void);
[8488c15]1174/** Constructor for the Linux Native format module */
[cab58c5]1175void linuxnative_constructor(void);
[6cf3ca0]1176/** Constructor for the Linux Ring format module */
1177void linuxring_constructor(void);
[8488c15]1178/** Constructor for the PCAP format module */
[cab58c5]1179void pcap_constructor(void);
[8488c15]1180/** Constructor for the PCAP File format module */
[cab58c5]1181void pcapfile_constructor(void);
[8488c15]1182/** Constructor for the RT format module */
[cab58c5]1183void rt_constructor(void);
[8488c15]1184/** Constructor for the DUCK format module */
[cab58c5]1185void duck_constructor(void);
[8488c15]1186/** Constructor for the ATM Header format module */
[e1fdc05]1187void atmhdr_constructor(void);
[3512119]1188#ifdef HAVE_BPF
[8488c15]1189/** Constructor for the BPF format module */
[3512119]1190void bpf_constructor(void);
1191#endif
[c04929c]1192#if HAVE_DPDK
1193/** Constructor for Intels DPDK format module */
1194void dpdk_constructor(void);
1195#endif
[cab58c5]1196
[8488c15]1197/** Extracts the RadioTap flags from a wireless link header
1198 *
1199 * @param link          A pointer to the wireless link header
1200 * @param linktype      The link type of the wireless header
1201 * @param[out] flags    Space to store the extracted flags
1202 * @return True if libtrace was able to extract flags from the link header,
1203 * false otherwise.
1204 *
1205 * This function has been left internal because it is not portable across
1206 * drivers.
1207 */
[f0c639b]1208bool trace_get_wireless_flags(void *link, libtrace_linktype_t linktype, uint8_t *flags);
1209#define TRACE_RADIOTAP_F_FCS 0x10
[4dedc28]1210       
1211#ifdef __cplusplus
1212}
1213#endif
1214
[7068467]1215#endif /* LIBTRACE_INT_H */
Note: See TracBrowser for help on using the repository browser.