• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

libtrace.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of libtrace
00003  *
00004  * Copyright (c) 2007,2008,2009,2010 The University of Waikato, Hamilton, 
00005  * New Zealand.
00006  *
00007  * Authors: Daniel Lawson 
00008  *          Perry Lorier
00009  *          Shane Alcock 
00010  *          
00011  * All rights reserved.
00012  *
00013  * This code has been developed by the University of Waikato WAND 
00014  * research group. For further information please see http://www.wand.net.nz/
00015  *
00016  * libtrace is free software; you can redistribute it and/or modify
00017  * it under the terms of the GNU General Public License as published by
00018  * the Free Software Foundation; either version 2 of the License, or
00019  * (at your option) any later version.
00020  *
00021  * libtrace is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  * GNU General Public License for more details.
00025  *
00026  * You should have received a copy of the GNU General Public License
00027  * along with libtrace; if not, write to the Free Software
00028  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00029  *
00030  * $Id: libtrace.h.in 1763 2012-05-28 02:26:20Z salcock $
00031  *
00032  */
00033 
00034 #ifndef LIBTRACE_H
00035 #define LIBTRACE_H
00036 
00064 #include <sys/types.h>
00065 #ifndef WIN32
00066 #include <sys/time.h>
00067 #endif
00068 
00069 #ifdef _MSC_VER
00070     /* define the following from MSVC's internal types */
00071     typedef             __int8  int8_t;
00072     typedef             __int16 int16_t;
00073     typedef             __int32 int32_t;
00074     typedef             __int64 int64_t;
00075     typedef unsigned    __int8  uint8_t;
00076     typedef unsigned    __int16 uint16_t;
00077     typedef unsigned    __int32 uint32_t;
00078     typedef unsigned    __int64 uint64_t;
00079     #ifdef LT_BUILDING_DLL
00080         #define DLLEXPORT __declspec(dllexport)
00081     #else
00082         #define DLLEXPORT __declspec(dllimport)
00083     #endif
00084     #define DLLLOCAL
00085     /* Windows pads bitfields out to to the size of their parent type
00086      * however gcc warns that this doesn't meet with the iso C specification
00087      * so produces warnings for this behaviour.  sigh.
00088      */
00089     #define LT_BITFIELD8        uint8_t
00090     #define LT_BITFIELD16       uint16_t
00091     #define LT_BITFIELD32       uint32_t
00092     #define LT_BITFIELD64       uint64_t
00093 #else
00094     #ifdef HAVE_STDINT_H
00095         #   include <stdint.h>
00096     #endif
00097     #if __GNUC__ >= 4
00098         #ifdef LT_BUILDING_DLL
00099                 #define DLLEXPORT __attribute__ ((visibility("default")))
00100                 #define DLLLOCAL __attribute__ ((visibility("hidden")))
00101         #else
00102                 #define DLLEXPORT
00103                 #define DLLLOCAL
00104         #endif
00105     #else
00106         #define DLLEXPORT
00107         #define DLLLOCAL
00108     #endif
00109     /* GCC warns if the bitfield type is not "unsigned int", however windows
00110      * generates incorrect code for this (see above), so we define these
00111      * macros.  How Hideous.  So much for C's portability.
00112      */
00113     #define LT_BITFIELD8        unsigned int
00114     #define LT_BITFIELD16       unsigned int
00115     #define LT_BITFIELD32       unsigned int
00116     #define LT_BITFIELD64       unsigned int
00117 #endif
00118 
00119 #ifdef WIN32
00120 #   include <winsock2.h>
00121 #   include <ws2tcpip.h>
00122     typedef short sa_family_t;
00123     /* Make up for a lack of stdbool.h */
00124 #    define bool signed char
00125 #    define false 0
00126 #    define true 1
00127 #    if !defined(ssize_t)
00128      /* XXX: Not 64-bit safe! */
00129 #    define ssize_t int
00130 #    endif    
00131 #else
00132 #    include <netinet/in.h>
00133 
00134 #ifndef __cplusplus
00135 #    include <stdbool.h>
00136 #endif
00137 
00138 #    include <sys/types.h>
00139 #    include <sys/socket.h>
00140 #endif
00141 
00143 #define LIBTRACE_API_VERSION \
00144             ((3<<16)|(0<<8)|(15))
00145 
00148 #define LIBTRACE_SVN_REVISION 0
00149 
00151 #define DAG_DRIVER_V ""
00152     
00153 #ifdef __cplusplus 
00154 extern "C" { 
00155 #endif
00156 
00157 /* Function does not depend on anything but its
00158  * parameters, used to hint gcc's optimisations
00159  */
00160 #if __GNUC__ >= 3 
00161 #  define DEPRECATED __attribute__((deprecated))
00162 #  define SIMPLE_FUNCTION __attribute__((pure))
00163 #  define UNUSED __attribute__((unused))
00164 #  define PACKED __attribute__((packed))
00165 #  define PRINTF(formatpos,argpos) __attribute__((format(printf,formatpos,argpos)))
00166 #else
00167 #  define DEPRECATED
00168 #  define SIMPLE_FUNCTION
00169 #  define UNUSED
00170 #  define PACKED 
00171 #  define PRINTF(formatpos,argpos) 
00172 #endif
00173         
00175 typedef struct libtrace_out_t libtrace_out_t;
00176         
00178 typedef struct libtrace_t libtrace_t;
00179         
00181 typedef struct libtrace_filter_t libtrace_filter_t;
00182 
00191 typedef enum {
00192         TRACE_CTRL_PACKET='p',  
00193         TRACE_CTRL_EXTERNAL='e' 
00194 } buf_control_t;
00195 
00197 #define LIBTRACE_PACKET_BUFSIZE 65536
00198 
00200 typedef struct trace_err_t{
00201         int err_num;            
00202         char problem[255];      
00203 } libtrace_err_t;
00204 
00206 enum {
00208         TRACE_ERR_NOERROR       = 0,
00210         TRACE_ERR_BAD_FORMAT    = -1,
00212         TRACE_ERR_INIT_FAILED   = -2,
00214         TRACE_ERR_UNKNOWN_OPTION= -3,
00216         TRACE_ERR_NO_CONVERSION = -4,
00218         TRACE_ERR_BAD_PACKET    = -5,
00220         TRACE_ERR_OPTION_UNAVAIL= -6,
00222         TRACE_ERR_UNSUPPORTED   = -7,
00224         TRACE_ERR_BAD_STATE     = -8,
00226         TRACE_ERR_BAD_FILTER    = -9,
00228         TRACE_ERR_RT_FAILURE    = -10,
00230         TRACE_ERR_UNSUPPORTED_COMPRESS  = -11
00231 };
00232 
00235 typedef enum {
00239         TRACE_DLT_NULL = 0, 
00240         TRACE_DLT_EN10MB = 1,
00241         TRACE_DLT_PPP = 9,
00242         TRACE_DLT_ATM_RFC1483 = 11,
00243         
00248 #ifdef __OpenBSD__
00249         TRACE_DLT_RAW = 14,     
00250 #else
00251         TRACE_DLT_RAW = 12,
00252 #endif
00253         TRACE_DLT_PPP_SERIAL = 50,
00254         TRACE_DLT_LINKTYPE_RAW = 101, 
00255         TRACE_DLT_C_HDLC = 104,
00256         TRACE_DLT_IEEE802_11 = 105,
00257         TRACE_DLT_LINUX_SLL = 113,
00258         TRACE_DLT_PFLOG = 117,
00259         TRACE_DLT_IEEE802_11_RADIO = 127 
00260 } libtrace_dlt_t ;
00261 
00263 typedef enum { 
00264     /* TRACE_TYPE_LEGACY = 0            Obsolete */
00265        TRACE_TYPE_HDLC_POS = 1,         
00266        TRACE_TYPE_ETH = 2,              
00267        TRACE_TYPE_ATM = 3,              
00268        TRACE_TYPE_80211 = 4,            
00269        TRACE_TYPE_NONE = 5,             
00270        TRACE_TYPE_LINUX_SLL = 6,        
00271        TRACE_TYPE_PFLOG = 7,            
00272     /* TRACE_TYPE_LEGACY_DEFAULT        Obsolete */
00273        TRACE_TYPE_POS = 9,              
00274     /* TRACE_TYPE_LEGACY_ATM            Obsolete */
00275     /* TRACE_TYPE_LEGACY_ETH            Obsolete */
00276        TRACE_TYPE_80211_PRISM = 12,     
00277        TRACE_TYPE_AAL5 = 13,            
00278        TRACE_TYPE_DUCK = 14,         
00279        TRACE_TYPE_80211_RADIO = 15,  
00280        TRACE_TYPE_LLCSNAP = 16,      
00281        TRACE_TYPE_PPP = 17,          
00282        TRACE_TYPE_METADATA = 18,        
00283        TRACE_TYPE_NONDATA = 19          
00284 } libtrace_linktype_t;
00285 
00290 enum base_format_t {
00291         TRACE_FORMAT_ERF          =1,   
00292         TRACE_FORMAT_PCAP         =2,   
00293         TRACE_FORMAT_PCAPFILE     =3,   
00294         TRACE_FORMAT_WAG          =4,   
00295         TRACE_FORMAT_RT           =5,   
00296         TRACE_FORMAT_LEGACY_ATM   =6,   
00297         TRACE_FORMAT_LEGACY_POS   =7,   
00298         TRACE_FORMAT_LEGACY_ETH   =8,   
00299         TRACE_FORMAT_LINUX_NATIVE =9,   
00300         TRACE_FORMAT_DUCK         =10,  
00301         TRACE_FORMAT_BPF          =11,  
00302         TRACE_FORMAT_TSH          =12,  
00303         TRACE_FORMAT_ATMHDR       =13,  
00304         TRACE_FORMAT_LEGACY_NZIX  =14   
00305 };
00306 
00308 typedef enum {
00309         TRACE_RT_HELLO          =1, 
00310         TRACE_RT_START          =2, 
00312         TRACE_RT_ACK            =3, 
00313         TRACE_RT_STATUS         =4, 
00314         TRACE_RT_DUCK           =5, 
00315         TRACE_RT_END_DATA       =6, 
00316         TRACE_RT_CLOSE          =7, 
00317         TRACE_RT_DENY_CONN      =8, 
00318         TRACE_RT_PAUSE          =9, 
00320         TRACE_RT_PAUSE_ACK      =10,
00321         TRACE_RT_OPTION         =11,
00322         TRACE_RT_KEYCHANGE      =12,
00323         TRACE_RT_DUCK_2_4       =13,
00324         TRACE_RT_DUCK_2_5       =14,
00325         TRACE_RT_LOSTCONN       =15,
00326         TRACE_RT_SERVERSTART    =16,
00327         TRACE_RT_CLIENTDROP     =17,
00328         TRACE_RT_METADATA       =18,
00331         TRACE_RT_DATA_SIMPLE    = 1000, 
00332         
00334         TRACE_RT_DATA_ERF       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_ERF, 
00336         TRACE_RT_DATA_WAG       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_WAG, 
00338         TRACE_RT_DATA_LEGACY_ATM=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_ATM, 
00340         TRACE_RT_DATA_LEGACY_POS=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_POS, 
00342         TRACE_RT_DATA_LEGACY_ETH=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_ETH, 
00344         TRACE_RT_DATA_LINUX_NATIVE=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LINUX_NATIVE,
00346         TRACE_RT_DATA_BPF       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_BPF,
00348         TRACE_RT_DATA_TSH       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_TSH,
00350         TRACE_RT_DATA_ATMHDR = TRACE_RT_DATA_SIMPLE + TRACE_FORMAT_ATMHDR,
00352         TRACE_RT_DATA_LEGACY_NZIX=TRACE_RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_NZIX,
00353 
00357         TRACE_RT_DATA_DLT               = 2000, 
00359         TRACE_RT_DLT_NULL               =TRACE_RT_DATA_DLT+TRACE_DLT_NULL,
00362         TRACE_RT_DLT_EN10MB             =TRACE_RT_DATA_DLT+TRACE_DLT_EN10MB,
00365         TRACE_RT_DLT_IEEE802_11         =TRACE_RT_DATA_DLT+TRACE_DLT_IEEE802_11,
00368         TRACE_RT_DLT_LINUX_SLL          =TRACE_RT_DATA_DLT+TRACE_DLT_LINUX_SLL,
00370         TRACE_RT_DLT_PFLOG              =TRACE_RT_DATA_DLT+TRACE_DLT_PFLOG,
00372         TRACE_RT_DLT_ATM_RFC1483        =TRACE_RT_DATA_DLT+TRACE_DLT_ATM_RFC1483,
00375         TRACE_RT_DATA_DLT_END           = 2999,
00378         TRACE_RT_LAST                   = 3000
00379 } libtrace_rt_types_t;
00380 
00382 typedef enum {
00383         TRACE_IPPROTO_IP        = 0,    
00384         TRACE_IPPROTO_ICMP      = 1,    
00385         TRACE_IPPROTO_IGMP      = 2,    
00386         TRACE_IPPROTO_IPIP      = 4,    
00387         TRACE_IPPROTO_TCP       = 6,    
00388         TRACE_IPPROTO_UDP       = 17,   
00389         TRACE_IPPROTO_IPV6      = 41,   
00390         TRACE_IPPROTO_ROUTING   = 43,   
00391         TRACE_IPPROTO_FRAGMENT  = 44,   
00392         TRACE_IPPROTO_RSVP      = 46,   
00393         TRACE_IPPROTO_GRE       = 47,   
00394         TRACE_IPPROTO_ESP       = 50,   
00395         TRACE_IPPROTO_AH        = 51,   
00396         TRACE_IPPROTO_ICMPV6    = 58,   
00397         TRACE_IPPROTO_NONE      = 59,   
00398         TRACE_IPPROTO_DSTOPTS   = 60,   
00399         TRACE_IPPROTO_OSPF      = 89,   
00400         TRACE_IPPROTO_PIM       = 103,  
00401         TRACE_IPPROTO_SCTP      = 132   
00402 } libtrace_ipproto_t;
00403 
00405 typedef enum {
00406         /* Numbers <=1500 are of course, LLC/SNAP */
00407         TRACE_ETHERTYPE_IP      = 0x0800,       
00408         TRACE_ETHERTYPE_ARP     = 0x0806,       
00409         TRACE_ETHERTYPE_RARP    = 0x8035,       
00410         TRACE_ETHERTYPE_8021Q   = 0x8100,       
00411         TRACE_ETHERTYPE_IPV6    = 0x86DD,       
00412         TRACE_ETHERTYPE_MPLS    = 0x8847,       
00413         TRACE_ETHERTYPE_MPLS_MC = 0x8848,       
00414         TRACE_ETHERTYPE_PPP_DISC= 0x8863,       
00415         TRACE_ETHERTYPE_PPP_SES = 0x8864        
00416 } libtrace_ethertype_t;
00417 
00421 typedef struct libtrace_packet_t {
00422         struct libtrace_t *trace;       
00423         void *header;                   
00424         void *payload;                  
00425         void *buffer;                   
00426         libtrace_rt_types_t  type;      
00427         buf_control_t buf_control;      
00428         int capture_length;             
00429         int wire_length;                
00430         int payload_length;             
00431         void *l2_header;                
00432         libtrace_linktype_t link_type;  
00433         uint32_t l2_remaining;          
00434         void *l3_header;                
00435         uint16_t l3_ethertype;          
00436         uint32_t l3_remaining;          
00437         void *l4_header;                
00438         uint8_t transport_proto;        
00439         uint32_t l4_remaining;          
00440 } libtrace_packet_t;
00441 
00442 
00448 typedef enum {
00449         TRACE_DIR_OUTGOING = 0,         
00450         TRACE_DIR_INCOMING = 1,         
00451         TRACE_DIR_OTHER    = 2          
00452 } libtrace_direction_t;
00453 
00455 typedef enum {
00456     TRACE_RADIOTAP_TSFT = 0, 
00457     TRACE_RADIOTAP_FLAGS = 1, 
00458     TRACE_RADIOTAP_RATE = 2, 
00459     TRACE_RADIOTAP_CHANNEL = 3, 
00460     TRACE_RADIOTAP_FHSS = 4, 
00461     TRACE_RADIOTAP_DBM_ANTSIGNAL = 5, 
00462     TRACE_RADIOTAP_DBM_ANTNOISE = 6, 
00463     TRACE_RADIOTAP_LOCK_QUALITY = 7, 
00464     TRACE_RADIOTAP_TX_ATTENUATION = 8, 
00465     TRACE_RADIOTAP_DB_TX_ATTENUATION = 9, 
00466     TRACE_RADIOTAP_DBM_TX_POWER = 10, 
00467     TRACE_RADIOTAP_ANTENNA = 11, 
00468     TRACE_RADIOTAP_DB_ANTSIGNAL = 12, 
00469     TRACE_RADIOTAP_DB_ANTNOISE = 13, 
00470     TRACE_RADIOTAP_RX_FLAGS = 14, 
00471     TRACE_RADIOTAP_TX_FLAGS = 15, 
00472     TRACE_RADIOTAP_RTS_RETRIES = 16, 
00473     TRACE_RADIOTAP_DATA_RETRIES = 17, 
00474     TRACE_RADIOTAP_EXT = 31
00475 } libtrace_radiotap_field_t;
00476 
00477 
00484 #ifdef WIN32
00485 #pragma pack(push)
00486 #pragma pack(1)
00487 #endif
00488 
00490 typedef struct libtrace_ip
00491 {
00492 #if BYTE_ORDER == LITTLE_ENDIAN
00493     LT_BITFIELD8 ip_hl:4;               
00494     LT_BITFIELD8 ip_v:4;                
00495 #elif BYTE_ORDER == BIG_ENDIAN
00496     LT_BITFIELD8 ip_v:4;                
00497     LT_BITFIELD8 ip_hl:4;               
00498 #else
00499 #   error "Adjust your <bits/endian.h> defines"
00500 #endif
00501     uint8_t  ip_tos;                    
00502     uint16_t ip_len;                    
00503     int16_t  ip_id;                     
00504     uint16_t ip_off;                    
00505     uint8_t  ip_ttl;                    
00506     uint8_t  ip_p;                      
00507     uint16_t ip_sum;                    
00508     struct in_addr ip_src;              
00509     struct in_addr ip_dst;              
00510 } PACKED libtrace_ip_t;
00511 
00513 typedef struct libtrace_ip6_ext
00514 {
00515         uint8_t nxt;    
00516         uint8_t len;    
00517 } PACKED libtrace_ip6_ext_t;
00518 
00519 typedef struct libtrace_ip6_frag 
00520 {
00521         uint8_t nxt;    
00522         uint8_t res;    
00523         uint16_t frag_off;      
00524         uint32_t ident; 
00525 } PACKED libtrace_ip6_frag_t;
00526 
00532 typedef struct libtrace_ip6
00533 { 
00534     uint32_t flow;                      
00535     uint16_t plen;                      
00536     uint8_t nxt;                        
00537     uint8_t hlim;                       
00538     struct in6_addr ip_src;             
00539     struct in6_addr ip_dst;             
00540 } PACKED libtrace_ip6_t;
00541 
00543 typedef struct libtrace_tcp
00544   {
00545     uint16_t source;            
00546     uint16_t dest;              
00547     uint32_t seq;               
00548     uint32_t ack_seq;           
00549 #  if BYTE_ORDER == LITTLE_ENDIAN
00550     LT_BITFIELD8 ecn_ns:1;      
00551     LT_BITFIELD8 res1:3;        
00552     LT_BITFIELD8 doff:4;        
00553     LT_BITFIELD8 fin:1;         
00554     LT_BITFIELD8 syn:1;         
00555     LT_BITFIELD8 rst:1;         
00556     LT_BITFIELD8 psh:1;         
00557     LT_BITFIELD8 ack:1;         
00558     LT_BITFIELD8 urg:1;         
00559     LT_BITFIELD8 ece:1;         
00560     LT_BITFIELD8 cwr:1;         
00561 #  elif BYTE_ORDER == BIG_ENDIAN
00562     LT_BITFIELD8 doff:4;        
00563     LT_BITFIELD8 res1:3;        
00564     LT_BITFIELD8 ecn_ns:1;      
00565     LT_BITFIELD8 cwr:1;         
00566     LT_BITFIELD8 ece:1;         
00567     LT_BITFIELD8 urg:1;         
00568     LT_BITFIELD8 ack:1;         
00569     LT_BITFIELD8 psh:1;         
00570     LT_BITFIELD8 rst:1;         
00571     LT_BITFIELD8 syn:1;         
00572     LT_BITFIELD8 fin:1;         
00573 #  else
00574 #   error "Adjust your <bits/endian.h> defines"
00575 #  endif
00576     uint16_t window;            
00577     uint16_t check;             
00578     uint16_t urg_ptr;           
00579 } PACKED libtrace_tcp_t;
00580 
00582 typedef struct libtrace_udp {
00583   uint16_t      source;         
00584   uint16_t      dest;           
00585   uint16_t      len;            
00586   uint16_t      check;          
00587 } PACKED libtrace_udp_t;
00588 
00590 typedef struct libtrace_icmp
00591 {
00592   uint8_t type;         
00593   uint8_t code;         
00594   uint16_t checksum;            
00595   union
00596   {
00597     struct
00598     {
00599       uint16_t  id;             
00600       uint16_t  sequence;       
00601     } echo;                     
00602     uint32_t    gateway;        
00603     struct
00604     {
00605       uint16_t  unused;         
00606       uint16_t  mtu;            
00607     } frag;                     
00608   } un;                         
00609 } PACKED libtrace_icmp_t;
00610 
00612 typedef struct libtrace_llcsnap
00613 {
00614 /* LLC */
00615   uint8_t dsap;                 
00616   uint8_t ssap;                 
00617   uint8_t control;              
00618 /* SNAP */
00619   LT_BITFIELD32 oui:24;         
00620   uint16_t type;                
00621 } PACKED libtrace_llcsnap_t;
00622 
00624 typedef struct libtrace_ether
00625 {
00626   uint8_t ether_dhost[6];       
00627   uint8_t ether_shost[6];       
00628   uint16_t ether_type;          
00629 } PACKED libtrace_ether_t;
00630 
00632 typedef struct libtrace_8021q 
00633 {
00634   LT_BITFIELD16 vlan_pri:3;      
00635   LT_BITFIELD16 vlan_cfi:1;      
00637   LT_BITFIELD16 vlan_id:12;      
00638   uint16_t vlan_ether_type;      
00640 } PACKED libtrace_8021q_t;
00641 
00643 typedef struct libtrace_atm_cell
00644 {
00645   LT_BITFIELD32 gfc:4;          
00646   LT_BITFIELD32 vpi:8;          
00647   LT_BITFIELD32 vci:16;         
00648   LT_BITFIELD32 pt:3;           
00649   LT_BITFIELD32 clp:1;          
00650   LT_BITFIELD32 hec:8;          
00651 } PACKED libtrace_atm_cell_t;
00652 
00654 typedef struct libtrace_atm_nni_cell
00655 {
00656   LT_BITFIELD32 vpi:12;         
00657   LT_BITFIELD32 vci:16;         
00658   LT_BITFIELD32 pt:3;           
00659   LT_BITFIELD32 clp:1;          
00660   LT_BITFIELD32 hec:8;          
00661 } PACKED libtrace_atm_nni_cell_t;
00662 
00670 typedef struct libtrace_atm_capture_cell
00671 {
00672   LT_BITFIELD32 gfc:4;          
00673   LT_BITFIELD32 vpi:8;          
00674   LT_BITFIELD32 vci:16;         
00675   LT_BITFIELD32 pt:3;           
00676   LT_BITFIELD32 clp:1;          
00677 } PACKED libtrace_atm_capture_cell_t;
00678 
00686 typedef struct libtrace_atm_nni_capture_cell
00687 {
00688   LT_BITFIELD32 vpi:12;         
00689   LT_BITFIELD32 vci:16;         
00690   LT_BITFIELD32 pt:3;           
00691   LT_BITFIELD32 clp:1;          
00692   LT_BITFIELD32 hec:8;          
00693 } PACKED libtrace_atm_nni_capture_cell_t;
00694 
00696 typedef struct libtrace_ppp
00697 {
00698  /* I can't figure out where the hell these two variables come from. They're
00699   * definitely not in RFC 1661 which defines PPP. Probably some weird thing
00700   * relating to the lack of distinction between PPP, HDLC and CHDLC */
00701         
00702 /* uint8_t address; */          
00703 /* uint8_t header;  */          
00704  uint16_t protocol;             
00705 } PACKED libtrace_ppp_t;
00706 
00708 typedef struct libtrace_pppoe
00709 {
00710  LT_BITFIELD8 version:4;        
00711  LT_BITFIELD8 type:4;           
00712  uint8_t code;                  
00713  uint16_t session_id;           
00714  uint16_t length;               
00715 } PACKED libtrace_pppoe_t;
00716 
00718 typedef struct libtrace_80211_t {
00719 #if BYTE_ORDER == LITTLE_ENDIAN
00720         LT_BITFIELD32      protocol:2;  
00721         LT_BITFIELD32      type:2;      
00722         LT_BITFIELD32      subtype:4;   
00723 #else
00724         LT_BITFIELD32      subtype:4;   
00725         LT_BITFIELD32      type:2;      
00726         LT_BITFIELD32      protocol:2;  
00727 #endif
00728 
00729 #if BYTE_ORDER == LITTLE_ENDIAN
00730         LT_BITFIELD32      to_ds:1;     
00731         LT_BITFIELD32      from_ds:1;   
00732         LT_BITFIELD32      more_frag:1; 
00733         LT_BITFIELD32      retry:1;     
00734         LT_BITFIELD32      power:1;     
00735         LT_BITFIELD32      more_data:1; 
00736         LT_BITFIELD32      wep:1;       
00737         LT_BITFIELD32      order:1;     
00738 #else
00739         LT_BITFIELD32      order:1;     
00740         LT_BITFIELD32      wep:1;       
00741         LT_BITFIELD32      more_data:1; 
00742         LT_BITFIELD32      power:1;     
00743         LT_BITFIELD32      retry:1;     
00744         LT_BITFIELD32      more_frag:1; 
00745         LT_BITFIELD32      from_ds:1;   
00746         LT_BITFIELD32      to_ds:1;     
00747 #endif
00748         
00749         uint16_t     duration;  
00750         uint8_t      mac1[6];   
00751         uint8_t      mac2[6];   
00752         uint8_t      mac3[6];   
00753         uint16_t     SeqCtl;    
00754         uint8_t      mac4[6];   
00755 } PACKED libtrace_80211_t;
00756 
00764 typedef struct libtrace_radiotap_t {
00765     uint8_t     it_version; 
00766     uint8_t     it_pad; 
00767     uint16_t    it_len; 
00768     uint32_t    it_present; 
00769 } PACKED libtrace_radiotap_t;
00770 
00772 typedef struct libtrace_ospf_v2_t
00773 {
00774         uint8_t ospf_v;         
00775         uint8_t type;           
00776         uint16_t len;           
00777         struct in_addr router;  
00778         struct in_addr area;    
00779         uint16_t sum;           
00780         uint16_t au_type;       
00781         uint16_t zero;          
00782         uint8_t au_key_id;      
00783         uint8_t au_data_len;    
00784         uint32_t au_seq_num;    
00785 } PACKED libtrace_ospf_v2_t;
00786 
00788 typedef struct libtrace_ospf_options_t {
00789 #if BYTE_ORDER == LITTLE_ENDIAN
00790         LT_BITFIELD8 unused1:1;
00791         LT_BITFIELD8 e_bit:1;
00792         LT_BITFIELD8 mc_bit:1;
00793         LT_BITFIELD8 np_bit:1;
00794         LT_BITFIELD8 ea_bit:1;
00795         LT_BITFIELD8 dc_bit:1;
00796         LT_BITFIELD8 unused2:2;
00797 #elif BYTE_ORDER == BIG_ENDIAN
00798         LT_BITFIELD8 unused2:2;
00799         LT_BITFIELD8 dc_bit:1;
00800         LT_BITFIELD8 ea_bit:1;
00801         LT_BITFIELD8 np_bit:1;
00802         LT_BITFIELD8 mc_bit:1;
00803         LT_BITFIELD8 e_bit:1;
00804         LT_BITFIELD8 unused1:1;
00805 #endif
00806 } PACKED libtrace_ospf_options_t;
00807 
00809 typedef struct libtrace_ospf_lsa_v2_t
00810 {
00811         uint16_t age;           
00812         libtrace_ospf_options_t lsa_options;    
00813         uint8_t lsa_type;       
00814         struct in_addr ls_id;   
00815         struct in_addr adv_router; 
00816         uint32_t seq;           
00817         uint16_t checksum;      
00818         uint16_t length;        
00819 } PACKED libtrace_ospf_lsa_v2_t;
00820 
00822 typedef struct libtrace_ospf_hello_v2_t
00823 {
00824         struct in_addr mask;    
00825         uint16_t interval;      
00826         libtrace_ospf_options_t hello_options;  
00827         uint8_t priority;       
00828         uint32_t deadint;       
00829         struct in_addr designated;      
00830         struct in_addr backup;  
00834 } PACKED libtrace_ospf_hello_v2_t;
00835 
00837 typedef struct libtrace_ospf_db_desc_v2_t
00838 {
00839         uint16_t mtu;           
00840         libtrace_ospf_options_t db_desc_options;        
00841 #if BYTE_ORDER == LITTLE_ENDIAN
00842         LT_BITFIELD8 db_desc_ms:1;      
00843         LT_BITFIELD8 db_desc_m:1;       
00844         LT_BITFIELD8 db_desc_i:1;       
00845         LT_BITFIELD8 zero:5;
00846 #elif BYTE_ORDER == BIG_ENDIAN
00847         LT_BITFIELD8 zero:5;
00848         LT_BITFIELD8 db_desc_i:1;       
00849         LT_BITFIELD8 db_desc_m:1;       
00850         LT_BITFIELD8 db_desc_ms:1;      
00851 #endif
00852         uint32_t seq;           
00853 } PACKED libtrace_ospf_db_desc_v2_t;
00854 
00856 typedef struct libtrace_ospf_ls_req_t
00857 {
00858         uint32_t ls_type;       
00859         uint32_t ls_id;         
00860         uint32_t advertising_router;    
00861 } PACKED libtrace_ospf_ls_req_t;
00862 
00864 typedef struct libtrace_ospf_ls_update_t
00865 {
00866         uint32_t ls_num_adv;    
00868         /* Followed by LSAs, use API functions to access these */
00869 } PACKED libtrace_ospf_ls_update_t;
00870 
00872 typedef struct libtrace_ospf_as_external_lsa_t
00873 {
00874         struct in_addr netmask; 
00875 #if BYTE_ORDER == LITTLE_ENDIAN
00876         LT_BITFIELD8 tos:7;
00877         LT_BITFIELD8 e:1;       
00878 #elif BYTE_ORDER == BIG_ENDIAN
00879         LT_BITFIELD8 e:1;       
00880         LT_BITFIELD8 tos:7;
00881 #endif
00882         uint8_t metric_a;       
00883         uint8_t metric_b;       
00884         uint8_t metric_c;       
00885         struct in_addr forwarding;      
00886         uint32_t external_tag;          
00887 } PACKED libtrace_ospf_as_external_lsa_v2_t;
00888 
00890 typedef struct libtrace_ospf_summary_lsa
00891 {
00892         struct in_addr netmask; 
00893         uint8_t zero;           
00894         uint8_t metric_a;       
00895         uint8_t metric_b;       
00896         uint8_t metric_c;       
00898 } PACKED libtrace_ospf_summary_lsa_v2_t;
00899 
00901 typedef struct libtrace_ospf_network_lsa_t
00902 {
00903         struct in_addr netmask; 
00904         /* Followed by IDs of attached routers */
00905 } PACKED libtrace_ospf_network_lsa_v2_t;
00906 
00908 typedef struct libtrace_ospf_link_t
00909 {
00910         struct in_addr link_id;         
00911         struct in_addr link_data;       
00912         uint8_t type;                   
00913         uint8_t num_tos;                
00914         uint16_t tos_metric;            
00915 } PACKED libtrace_ospf_link_v2_t;
00916 
00918 typedef struct libtrace_ospf_router_lsa_t
00919 {
00920 #if BYTE_ORDER == LITTLE_ENDIAN
00921         LT_BITFIELD8 b:1;       
00922         LT_BITFIELD8 e:1;       
00923         LT_BITFIELD8 v:1;       
00924         LT_BITFIELD8 zero:5;
00925 #elif BYTE_ORDER == BIG_ENDIAN
00926         LT_BITFIELD8 zero:5;
00927         LT_BITFIELD8 v:1;       
00928         LT_BITFIELD8 e:1;       
00929         LT_BITFIELD8 b:1;       
00930 #endif
00931         uint8_t zero2;          
00932         uint16_t num_links;     
00933 } PACKED libtrace_ospf_router_lsa_v2_t;
00934 
00935 typedef enum {
00936         TRACE_OSPF_HELLO = 1,           
00937         TRACE_OSPF_DATADESC = 2,        
00938         TRACE_OSPF_LSREQ = 3,           
00939         TRACE_OSPF_LSUPDATE = 4,        
00940         TRACE_OSPF_LSACK = 5            
00941 } libtrace_ospf_types_t;
00942 
00943 typedef enum {
00944         TRACE_OSPF_LS_ROUTER = 1,       
00945         TRACE_OSPF_LS_NETWORK = 2,      
00946         TRACE_OSPF_LS_SUMMARY = 3,      
00947         TRACE_OSPF_LS_ASBR_SUMMARY = 4, 
00948         TRACE_OSPF_LS_EXTERNAL = 5      
00949 } libtrace_ospf_ls_types_t;
00950 
00952 typedef struct libtrace_sll_header_t {
00953         uint16_t pkttype;               
00954         uint16_t hatype;                
00955         uint16_t halen;                 
00956         unsigned char addr[8];          
00957         uint16_t protocol;              
00958 } libtrace_sll_header_t;
00959 
00960 
00961 /* SLL packet types */
00962 
00964 #define TRACE_SLL_HOST          0
00965 
00966 #define TRACE_SLL_BROADCAST     1
00967 
00968 #define TRACE_SLL_MULTICAST     2
00969 
00971 #define TRACE_SLL_OTHERHOST     3
00972 
00973 #define TRACE_SLL_OUTGOING      4
00974 
00975 
00976 #ifdef WIN32
00977 #pragma pack(pop)
00978 #endif
00979 
00980 
00988 DLLEXPORT void trace_help(void);
00989 
01005 DLLEXPORT void trace_interrupt(void); 
01006 
01025 DLLEXPORT const char *trace_parse_uri(const char *uri, char **format);
01026 
01047 DLLEXPORT libtrace_t *trace_create(const char *uri);
01048 
01062 DLLEXPORT libtrace_t *trace_create_dead(const char *uri);
01063 
01077 DLLEXPORT libtrace_out_t *trace_create_output(const char *uri);
01078 
01088 DLLEXPORT int trace_start(libtrace_t *libtrace);
01089 
01099 DLLEXPORT int trace_pause(libtrace_t *libtrace);
01100 
01108 DLLEXPORT int trace_start_output(libtrace_out_t *libtrace);
01109 
01111 typedef enum {
01113         TRACE_OPTION_SNAPLEN,   
01114 
01116         TRACE_OPTION_PROMISC,   
01117 
01119         TRACE_OPTION_FILTER,    
01120 
01122         TRACE_OPTION_META_FREQ, 
01123 
01126         TRACE_OPTION_EVENT_REALTIME
01127 } trace_option_t;
01128 
01136 DLLEXPORT int trace_config(libtrace_t *libtrace,
01137                 trace_option_t option,
01138                 void *value);
01139 
01143 typedef enum {
01144         TRACE_OPTION_COMPRESSTYPE_NONE = 0, 
01145         TRACE_OPTION_COMPRESSTYPE_ZLIB = 1, 
01146         TRACE_OPTION_COMPRESSTYPE_BZ2  = 2, 
01147         TRACE_OPTION_COMPRESSTYPE_LZO  = 3  
01148 } trace_option_compresstype_t;
01149 
01151 typedef enum {
01153         TRACE_OPTION_OUTPUT_FILEFLAGS,
01156         TRACE_OPTION_OUTPUT_COMPRESS,
01158         TRACE_OPTION_OUTPUT_COMPRESSTYPE
01159 } trace_option_output_t;
01160 
01170 DLLEXPORT int trace_config_output(libtrace_out_t *libtrace, 
01171                 trace_option_output_t option,
01172                 void *value
01173                 );
01174 
01180 DLLEXPORT void trace_destroy(libtrace_t *trace);
01181 
01185 DLLEXPORT void trace_destroy_dead(libtrace_t *trace);
01186 
01190 DLLEXPORT void trace_destroy_output(libtrace_out_t *trace);
01191 
01199 DLLEXPORT libtrace_err_t trace_get_err(libtrace_t *trace);
01200 
01207 DLLEXPORT bool trace_is_err(libtrace_t *trace);
01208 
01216 DLLEXPORT void trace_perror(libtrace_t *trace, const char *msg,...) PRINTF(2,3);
01217 
01225 DLLEXPORT libtrace_err_t trace_get_err_output(libtrace_out_t *trace);
01226 
01233 DLLEXPORT bool trace_is_err_output(libtrace_out_t *trace);
01234 
01241 DLLEXPORT void trace_perror_output(libtrace_out_t *trace, const char *msg,...)
01242         PRINTF(2,3);
01243 
01253 DLLEXPORT
01254 uint64_t trace_get_received_packets(libtrace_t *trace);
01255 
01264 DLLEXPORT
01265 uint64_t trace_get_filtered_packets(libtrace_t *trace);
01266 
01275 DLLEXPORT
01276 uint64_t trace_get_dropped_packets(libtrace_t *trace);
01277 
01286 DLLEXPORT
01287 uint64_t trace_get_accepted_packets(libtrace_t *trace);
01288 
01289 
01302 DLLEXPORT libtrace_packet_t *trace_create_packet(void);
01303 
01316 DLLEXPORT libtrace_packet_t *trace_copy_packet(const libtrace_packet_t *packet);
01317 
01322 DLLEXPORT void trace_destroy_packet(libtrace_packet_t *packet);
01323 
01324 
01342 DLLEXPORT int trace_read_packet(libtrace_t *trace, libtrace_packet_t *packet);
01343 
01347 typedef enum {
01348         TRACE_EVENT_IOWAIT,     
01349         TRACE_EVENT_SLEEP,      
01350         TRACE_EVENT_PACKET,     
01351         TRACE_EVENT_TERMINATE   
01352 } libtrace_event_t;
01353 
01355 typedef struct libtrace_eventobj_t {
01356         libtrace_event_t type; 
01359         int fd;                
01361         double seconds;        
01363         int size; 
01364 } libtrace_eventobj_t;
01365 
01377 DLLEXPORT libtrace_eventobj_t trace_event(libtrace_t *trace,
01378                 libtrace_packet_t *packet);
01379 
01380 
01387 DLLEXPORT int trace_write_packet(libtrace_out_t *trace, libtrace_packet_t *packet);
01388 
01397 DLLEXPORT 
01398 enum base_format_t trace_get_format(struct libtrace_packet_t *packet);
01399 
01412 DLLEXPORT
01413 void trace_construct_packet(libtrace_packet_t *packet,
01414                 libtrace_linktype_t linktype, const void *data, uint16_t len);
01415 
01462 DLLEXPORT void *trace_get_packet_buffer(const libtrace_packet_t *packet,
01463                 libtrace_linktype_t *linktype, uint32_t *remaining);
01464 
01475 DLLEXPORT SIMPLE_FUNCTION DEPRECATED
01476 void *trace_get_link(const libtrace_packet_t *packet);
01477 
01488 DLLEXPORT SIMPLE_FUNCTION
01489 libtrace_ip_t *trace_get_ip(libtrace_packet_t *packet);
01490 
01501 DLLEXPORT SIMPLE_FUNCTION
01502 libtrace_ip6_t *trace_get_ip6(libtrace_packet_t *packet);
01503 
01526 DLLEXPORT void *trace_get_packet_meta(const libtrace_packet_t *packet,
01527                 libtrace_linktype_t *linktype,
01528                 uint32_t *remaining);
01529 
01567 DLLEXPORT void *trace_get_payload_from_meta(const void *meta,
01568                 libtrace_linktype_t *linktype,
01569                 uint32_t *remaining);
01570 
01571 
01588 DLLEXPORT void *trace_get_layer2(const libtrace_packet_t *packet,
01589                 libtrace_linktype_t *linktype,
01590                 uint32_t *remaining);
01591 
01615 DLLEXPORT void *trace_get_payload_from_layer2(void *l2,
01616                 libtrace_linktype_t linktype,
01617                 uint16_t *ethertype,
01618                 uint32_t *remaining);
01619 
01620 
01634 DLLEXPORT 
01635 void *trace_get_layer3(const libtrace_packet_t *packet,
01636                 uint16_t *ethertype, uint32_t *remaining);
01637 
01654 DLLEXPORT void *trace_get_transport(const libtrace_packet_t *packet, 
01655                 uint8_t *proto, uint32_t *remaining);
01656 
01680 DLLEXPORT void *trace_get_payload_from_ip(libtrace_ip_t *ip, uint8_t *proto,
01681                 uint32_t *remaining);
01682 
01705 DLLEXPORT void *trace_get_payload_from_ip6(libtrace_ip6_t *ipptr,
01706                 uint8_t *proto, uint32_t *remaining);
01707 
01726 DLLEXPORT void *trace_get_payload_from_link(void *linkptr,
01727                 libtrace_linktype_t linktype, 
01728                 uint16_t *type, uint32_t *remaining);
01729 
01753 DLLEXPORT void *trace_get_payload_from_vlan(
01754                 void *vlan, uint16_t *type, uint32_t *remaining);
01755 
01785 DLLEXPORT void *trace_get_payload_from_mpls(
01786                 void *mpls, uint16_t *type, uint32_t *remaining);
01787 
01814 DLLEXPORT void *trace_get_payload_from_pppoe(
01815                 void *pppoe, uint16_t *type, uint32_t *remaining);
01816 
01835 DLLEXPORT void *trace_get_payload_from_tcp(libtrace_tcp_t *tcp, 
01836                 uint32_t *remaining);
01837 
01856 DLLEXPORT void *trace_get_payload_from_udp(libtrace_udp_t *udp, uint32_t *remaining);
01857 
01880 DLLEXPORT void *trace_get_payload_from_icmp(libtrace_icmp_t *icmp, 
01881                 uint32_t *remaining);
01882 
01896 DLLEXPORT SIMPLE_FUNCTION
01897 libtrace_tcp_t *trace_get_tcp(libtrace_packet_t *packet);
01898 
01923 DLLEXPORT SIMPLE_FUNCTION
01924 libtrace_tcp_t *trace_get_tcp_from_ip(libtrace_ip_t *ip, uint32_t *remaining);
01925 
01939 DLLEXPORT SIMPLE_FUNCTION
01940 libtrace_udp_t *trace_get_udp(libtrace_packet_t *packet);
01941 
01966 DLLEXPORT SIMPLE_FUNCTION
01967 libtrace_udp_t *trace_get_udp_from_ip(libtrace_ip_t *ip,uint32_t *remaining);
01968 
01982 DLLEXPORT SIMPLE_FUNCTION
01983 libtrace_icmp_t *trace_get_icmp(libtrace_packet_t *packet);
01984 
02009 DLLEXPORT SIMPLE_FUNCTION
02010 libtrace_icmp_t *trace_get_icmp_from_ip(libtrace_ip_t *ip,uint32_t *remaining);
02011 
02034 DLLEXPORT SIMPLE_FUNCTION
02035 void *trace_get_ospf_header(libtrace_packet_t *packet, uint8_t *version,
02036                 uint32_t *remaining);
02037 
02062 DLLEXPORT SIMPLE_FUNCTION
02063 void *trace_get_ospf_contents_v2(libtrace_ospf_v2_t *header,
02064                 uint8_t *ospf_type, uint32_t *remaining);
02065 
02084 DLLEXPORT SIMPLE_FUNCTION 
02085 unsigned char *trace_get_first_ospf_lsa_from_update_v2(
02086                 libtrace_ospf_ls_update_t *ls_update,
02087                 uint32_t *remaining);
02088 
02107 DLLEXPORT SIMPLE_FUNCTION 
02108 unsigned char *trace_get_first_ospf_lsa_from_db_desc_v2(
02109                 libtrace_ospf_db_desc_v2_t *db_desc,
02110                 uint32_t *remaining);
02111 
02131 DLLEXPORT SIMPLE_FUNCTION
02132 unsigned char *trace_get_first_ospf_link_from_router_lsa_v2(
02133                 libtrace_ospf_router_lsa_v2_t *lsa,
02134                 uint32_t *remaining);
02135 
02165 DLLEXPORT SIMPLE_FUNCTION
02166 int trace_get_next_ospf_link_v2(unsigned char **current,
02167                 libtrace_ospf_link_v2_t **link,
02168                 uint32_t *remaining,
02169                 uint32_t *link_len);
02170 
02212 DLLEXPORT SIMPLE_FUNCTION
02213 int trace_get_next_ospf_lsa_v2(unsigned char **current,
02214                 libtrace_ospf_lsa_v2_t **lsa_hdr,
02215                 unsigned char **lsa_body,
02216                 uint32_t *remaining,
02217                 uint8_t *lsa_type,
02218                 uint16_t *lsa_length);
02219 
02255 DLLEXPORT SIMPLE_FUNCTION
02256 int trace_get_next_ospf_lsa_header_v2(unsigned char **current,
02257                 libtrace_ospf_lsa_v2_t **lsa_hdr,
02258                 uint32_t *remaining,
02259                 uint8_t *lsa_type,
02260                 uint16_t *lsa_length); 
02261 
02271 DLLEXPORT SIMPLE_FUNCTION
02272 uint32_t trace_get_ospf_metric_from_as_external_lsa_v2(
02273                 libtrace_ospf_as_external_lsa_v2_t *as_lsa);
02274 
02284 DLLEXPORT SIMPLE_FUNCTION
02285 uint32_t trace_get_ospf_metric_from_summary_lsa_v2(
02286                 libtrace_ospf_summary_lsa_v2_t *sum_lsa);
02287 
02288 
02299 DLLEXPORT SIMPLE_FUNCTION
02300 uint8_t *trace_get_destination_mac(libtrace_packet_t *packet);
02301 
02312 DLLEXPORT SIMPLE_FUNCTION
02313 uint8_t *trace_get_source_mac(libtrace_packet_t *packet);
02314 
02328 DLLEXPORT SIMPLE_FUNCTION
02329 struct sockaddr *trace_get_source_address(const libtrace_packet_t *packet,
02330                 struct sockaddr *addr);
02331 
02345 DLLEXPORT SIMPLE_FUNCTION
02346 struct sockaddr *trace_get_destination_address(const libtrace_packet_t *packet,
02347                 struct sockaddr *addr);
02348 
02349 
02367 DLLEXPORT int trace_get_next_option(unsigned char **ptr,int *len,
02368                         unsigned char *type,
02369                         unsigned char *optlen,
02370                         unsigned char **data);
02371 
02386 DLLEXPORT SIMPLE_FUNCTION
02387 uint64_t trace_get_erf_timestamp(const libtrace_packet_t *packet);
02388 
02394 DLLEXPORT SIMPLE_FUNCTION
02395 struct timeval trace_get_timeval(const libtrace_packet_t *packet);
02396 
02402 DLLEXPORT SIMPLE_FUNCTION
02403 struct timespec trace_get_timespec(const libtrace_packet_t *packet);
02404 
02411 DLLEXPORT SIMPLE_FUNCTION
02412 double trace_get_seconds(const libtrace_packet_t *packet);
02413 
02430 DLLEXPORT int trace_seek_seconds(libtrace_t *trace, double seconds);
02431 
02445 DLLEXPORT int trace_seek_timeval(libtrace_t *trace, struct timeval tv);
02446 
02464 DLLEXPORT int trace_seek_erf_timestamp(libtrace_t *trace, uint64_t ts);
02465 
02494 DLLEXPORT SIMPLE_FUNCTION
02495 size_t trace_get_capture_length(const libtrace_packet_t *packet);
02496 
02513 DLLEXPORT SIMPLE_FUNCTION
02514 size_t trace_get_wire_length(const libtrace_packet_t *packet);
02515 
02524 DLLEXPORT SIMPLE_FUNCTION
02525 size_t trace_get_framing_length(const libtrace_packet_t *packet);
02526 
02541 DLLEXPORT SIMPLE_FUNCTION
02542 size_t trace_get_payload_length(const libtrace_packet_t *packet);
02543 
02558 DLLEXPORT size_t trace_set_capture_length(libtrace_packet_t *packet, size_t size);
02559 
02568 DLLEXPORT SIMPLE_FUNCTION
02569 libtrace_linktype_t trace_get_link_type(const libtrace_packet_t *packet);
02570 
02581 DLLEXPORT libtrace_direction_t trace_set_direction(libtrace_packet_t *packet, libtrace_direction_t direction);
02582 
02598 DLLEXPORT SIMPLE_FUNCTION
02599 libtrace_direction_t trace_get_direction(const libtrace_packet_t *packet);
02600 
02614 DLLEXPORT SIMPLE_FUNCTION
02615 libtrace_filter_t *trace_create_filter(const char *filterstring);
02616 
02626 DLLEXPORT libtrace_filter_t *
02627 trace_create_filter_from_bytecode(void *bf_insns, unsigned int bf_len);
02628 
02640 DLLEXPORT int trace_apply_filter(libtrace_filter_t *filter,
02641                 const libtrace_packet_t *packet);
02642 
02648 DLLEXPORT void trace_destroy_filter(libtrace_filter_t *filter);
02674 DLLEXPORT char *trace_ether_ntoa(const uint8_t *addr, char *buf);
02675 
02693 DLLEXPORT uint8_t *trace_ether_aton(const char *buf, uint8_t *addr);
02694 
02705 typedef enum {
02706         USE_DEST,       
02707         USE_SOURCE      
02708 } serverport_t;
02709 
02723 DLLEXPORT SIMPLE_FUNCTION
02724 uint16_t trace_get_source_port(const libtrace_packet_t *packet);
02725 
02741 DLLEXPORT SIMPLE_FUNCTION
02742 uint16_t trace_get_destination_port(const libtrace_packet_t *packet);
02743 
02760 DLLEXPORT SIMPLE_FUNCTION
02761 int8_t trace_get_server_port(uint8_t protocol, uint16_t source, uint16_t dest);
02762 
02782 #ifndef ARPHRD_80211_RADIOTAP
02783 
02784 #define ARPHRD_80211_RADIOTAP 803
02785 #endif
02786 
02798 DLLEXPORT bool trace_get_wireless_tsft(void *linkptr,
02799         libtrace_linktype_t linktype, uint64_t *tsft);
02800 
02808 DLLEXPORT bool trace_get_wireless_rate(void *linkptr,
02809         libtrace_linktype_t linktype, uint8_t *rate);
02810 
02818 DLLEXPORT bool trace_get_wireless_freq(void *linkptr,
02819         libtrace_linktype_t linktype, uint16_t *freq);
02820 
02828 DLLEXPORT bool trace_get_wireless_signal_strength_dbm(void *linkptr,
02829         libtrace_linktype_t linktype, int8_t *strength);
02830 
02838 DLLEXPORT bool trace_get_wireless_noise_strength_dbm(void *linkptr,
02839         libtrace_linktype_t linktype, int8_t *strength);
02840 
02848 DLLEXPORT bool trace_get_wireless_signal_strength_db(void *linkptr,
02849         libtrace_linktype_t linktype, uint8_t *strength);
02850 
02858 DLLEXPORT bool trace_get_wireless_noise_strength_db(void *linkptr,
02859         libtrace_linktype_t linktype, uint8_t *strength);
02860 
02869 DLLEXPORT bool trace_get_wireless_tx_attenuation(void *linkptr,
02870         libtrace_linktype_t linktype, uint16_t *attenuation);
02871 
02879 DLLEXPORT bool trace_get_wireless_tx_attenuation_db(void *linkptr,
02880         libtrace_linktype_t linktype, uint16_t *attenuation);
02881 
02889 DLLEXPORT bool trace_get_wireless_tx_power_dbm(void *linkptr, 
02890                 libtrace_linktype_t linktype, int8_t *txpower);
02891 
02899 DLLEXPORT bool trace_get_wireless_antenna(void *linkptr,
02900         libtrace_linktype_t linktype, uint8_t *antenna);
02901 
02904 #ifdef __cplusplus
02905 } /* extern "C" */
02906 #endif /* #ifdef __cplusplus */
02907 #endif /* LIBTRACE_H_ */

Generated on Mon Oct 8 2012 11:29:09 for WAND Trace processing by  doxygen 1.7.1