• 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 1736 2012-01-05 22:25:39Z 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)|(13))
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
00225 };
00226 
00229 typedef enum {
00233         TRACE_DLT_NULL = 0, 
00234         TRACE_DLT_EN10MB = 1,
00235         TRACE_DLT_PPP = 9,
00236         TRACE_DLT_ATM_RFC1483 = 11,
00237         
00242 #ifdef __OpenBSD__
00243         TRACE_DLT_RAW = 14,     
00244 #else
00245         TRACE_DLT_RAW = 12,
00246 #endif
00247         TRACE_DLT_PPP_SERIAL = 50,
00248         TRACE_DLT_LINKTYPE_RAW = 101, 
00249         TRACE_DLT_C_HDLC = 104,
00250         TRACE_DLT_IEEE802_11 = 105,
00251         TRACE_DLT_LINUX_SLL = 113,
00252         TRACE_DLT_PFLOG = 117,
00253         TRACE_DLT_IEEE802_11_RADIO = 127 
00254 } libtrace_dlt_t ;
00255 
00257 typedef enum { 
00258     /* TRACE_TYPE_LEGACY = 0            Obsolete */
00259        TRACE_TYPE_HDLC_POS = 1,         
00260        TRACE_TYPE_ETH = 2,              
00261        TRACE_TYPE_ATM = 3,              
00262        TRACE_TYPE_80211 = 4,            
00263        TRACE_TYPE_NONE = 5,             
00264        TRACE_TYPE_LINUX_SLL = 6,        
00265        TRACE_TYPE_PFLOG = 7,            
00266     /* TRACE_TYPE_LEGACY_DEFAULT        Obsolete */
00267        TRACE_TYPE_POS = 9,              
00268     /* TRACE_TYPE_LEGACY_ATM            Obsolete */
00269     /* TRACE_TYPE_LEGACY_ETH            Obsolete */
00270        TRACE_TYPE_80211_PRISM = 12,     
00271        TRACE_TYPE_AAL5 = 13,            
00272        TRACE_TYPE_DUCK = 14,         
00273        TRACE_TYPE_80211_RADIO = 15,  
00274        TRACE_TYPE_LLCSNAP = 16,      
00275        TRACE_TYPE_PPP = 17,          
00276        TRACE_TYPE_METADATA = 18,        
00277        TRACE_TYPE_NONDATA = 19          
00278 } libtrace_linktype_t;
00279 
00284 enum base_format_t {
00285         TRACE_FORMAT_ERF          =1,   
00286         TRACE_FORMAT_PCAP         =2,   
00287         TRACE_FORMAT_PCAPFILE     =3,   
00288         TRACE_FORMAT_WAG          =4,   
00289         TRACE_FORMAT_RT           =5,   
00290         TRACE_FORMAT_LEGACY_ATM   =6,   
00291         TRACE_FORMAT_LEGACY_POS   =7,   
00292         TRACE_FORMAT_LEGACY_ETH   =8,   
00293         TRACE_FORMAT_LINUX_NATIVE =9,   
00294         TRACE_FORMAT_DUCK         =10,  
00295         TRACE_FORMAT_BPF          =11,  
00296         TRACE_FORMAT_TSH          =12,  
00297         TRACE_FORMAT_ATMHDR       =13,  
00298         TRACE_FORMAT_LEGACY_NZIX  =14   
00299 };
00300 
00302 typedef enum {
00303         TRACE_RT_HELLO          =1, 
00304         TRACE_RT_START          =2, 
00306         TRACE_RT_ACK            =3, 
00307         TRACE_RT_STATUS         =4, 
00308         TRACE_RT_DUCK           =5, 
00309         TRACE_RT_END_DATA       =6, 
00310         TRACE_RT_CLOSE          =7, 
00311         TRACE_RT_DENY_CONN      =8, 
00312         TRACE_RT_PAUSE          =9, 
00314         TRACE_RT_PAUSE_ACK      =10,
00315         TRACE_RT_OPTION         =11,
00316         TRACE_RT_KEYCHANGE      =12,
00317         TRACE_RT_DUCK_2_4       =13,
00318         TRACE_RT_DUCK_2_5       =14,
00319         TRACE_RT_LOSTCONN       =15,
00320         TRACE_RT_SERVERSTART    =16,
00321         TRACE_RT_CLIENTDROP     =17,
00322         TRACE_RT_METADATA       =18,
00325         TRACE_RT_DATA_SIMPLE    = 1000, 
00326         
00328         TRACE_RT_DATA_ERF       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_ERF, 
00330         TRACE_RT_DATA_WAG       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_WAG, 
00332         TRACE_RT_DATA_LEGACY_ATM=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_ATM, 
00334         TRACE_RT_DATA_LEGACY_POS=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_POS, 
00336         TRACE_RT_DATA_LEGACY_ETH=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LEGACY_ETH, 
00338         TRACE_RT_DATA_LINUX_NATIVE=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_LINUX_NATIVE,
00340         TRACE_RT_DATA_BPF       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_BPF,
00342         TRACE_RT_DATA_TSH       =TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_TSH,
00344         TRACE_RT_DATA_ATMHDR = TRACE_RT_DATA_SIMPLE + TRACE_FORMAT_ATMHDR,
00346         TRACE_RT_DATA_LEGACY_NZIX=TRACE_RT_DATA_SIMPLE + TRACE_FORMAT_LEGACY_NZIX,
00347 
00351         TRACE_RT_DATA_DLT               = 2000, 
00353         TRACE_RT_DLT_NULL               =TRACE_RT_DATA_DLT+TRACE_DLT_NULL,
00356         TRACE_RT_DLT_EN10MB             =TRACE_RT_DATA_DLT+TRACE_DLT_EN10MB,
00359         TRACE_RT_DLT_IEEE802_11         =TRACE_RT_DATA_DLT+TRACE_DLT_IEEE802_11,
00362         TRACE_RT_DLT_LINUX_SLL          =TRACE_RT_DATA_DLT+TRACE_DLT_LINUX_SLL,
00364         TRACE_RT_DLT_PFLOG              =TRACE_RT_DATA_DLT+TRACE_DLT_PFLOG,
00366         TRACE_RT_DLT_ATM_RFC1483        =TRACE_RT_DATA_DLT+TRACE_DLT_ATM_RFC1483,
00369         TRACE_RT_DATA_DLT_END           = 2999,
00372         TRACE_RT_LAST                   = (2<<31)
00373 } libtrace_rt_types_t;
00374 
00376 typedef enum {
00377         TRACE_IPPROTO_IP        = 0,    
00378         TRACE_IPPROTO_ICMP      = 1,    
00379         TRACE_IPPROTO_IGMP      = 2,    
00380         TRACE_IPPROTO_IPIP      = 4,    
00381         TRACE_IPPROTO_TCP       = 6,    
00382         TRACE_IPPROTO_UDP       = 17,   
00383         TRACE_IPPROTO_IPV6      = 41,   
00384         TRACE_IPPROTO_ROUTING   = 43,   
00385         TRACE_IPPROTO_FRAGMENT  = 44,   
00386         TRACE_IPPROTO_RSVP      = 46,   
00387         TRACE_IPPROTO_GRE       = 47,   
00388         TRACE_IPPROTO_ESP       = 50,   
00389         TRACE_IPPROTO_AH        = 51,   
00390         TRACE_IPPROTO_ICMPV6    = 58,   
00391         TRACE_IPPROTO_NONE      = 59,   
00392         TRACE_IPPROTO_DSTOPTS   = 60,   
00393         TRACE_IPPROTO_OSPF      = 89,   
00394         TRACE_IPPROTO_PIM       = 103,  
00395         TRACE_IPPROTO_SCTP      = 132   
00396 } libtrace_ipproto_t;
00397 
00399 typedef enum {
00400         /* Numbers <=1500 are of course, LLC/SNAP */
00401         TRACE_ETHERTYPE_IP      = 0x0800,       
00402         TRACE_ETHERTYPE_ARP     = 0x0806,       
00403         TRACE_ETHERTYPE_RARP    = 0x8035,       
00404         TRACE_ETHERTYPE_8021Q   = 0x8100,       
00405         TRACE_ETHERTYPE_IPV6    = 0x86DD,       
00406         TRACE_ETHERTYPE_MPLS    = 0x8847,       
00407         TRACE_ETHERTYPE_MPLS_MC = 0x8848,       
00408         TRACE_ETHERTYPE_PPP_DISC= 0x8863,       
00409         TRACE_ETHERTYPE_PPP_SES = 0x8864        
00410 } libtrace_ethertype_t;
00411 
00415 typedef struct libtrace_packet_t {
00416         struct libtrace_t *trace;       
00417         void *header;                   
00418         void *payload;                  
00419         void *buffer;                   
00420         libtrace_rt_types_t  type;      
00421         buf_control_t buf_control;      
00422         int capture_length;             
00423         int wire_length;                
00424         int payload_length;             
00425         void *l2_header;                
00426         libtrace_linktype_t link_type;  
00427         uint32_t l2_remaining;          
00428         void *l3_header;                
00429         uint16_t l3_ethertype;          
00430         uint32_t l3_remaining;          
00431         void *l4_header;                
00432         uint8_t transport_proto;        
00433         uint32_t l4_remaining;          
00434 } libtrace_packet_t;
00435 
00436 
00442 typedef enum {
00443         TRACE_DIR_OUTGOING = 0,         
00444         TRACE_DIR_INCOMING = 1,         
00445         TRACE_DIR_OTHER    = 2          
00446 } libtrace_direction_t;
00447 
00449 typedef enum {
00450     TRACE_RADIOTAP_TSFT = 0, 
00451     TRACE_RADIOTAP_FLAGS = 1, 
00452     TRACE_RADIOTAP_RATE = 2, 
00453     TRACE_RADIOTAP_CHANNEL = 3, 
00454     TRACE_RADIOTAP_FHSS = 4, 
00455     TRACE_RADIOTAP_DBM_ANTSIGNAL = 5, 
00456     TRACE_RADIOTAP_DBM_ANTNOISE = 6, 
00457     TRACE_RADIOTAP_LOCK_QUALITY = 7, 
00458     TRACE_RADIOTAP_TX_ATTENUATION = 8, 
00459     TRACE_RADIOTAP_DB_TX_ATTENUATION = 9, 
00460     TRACE_RADIOTAP_DBM_TX_POWER = 10, 
00461     TRACE_RADIOTAP_ANTENNA = 11, 
00462     TRACE_RADIOTAP_DB_ANTSIGNAL = 12, 
00463     TRACE_RADIOTAP_DB_ANTNOISE = 13, 
00464     TRACE_RADIOTAP_RX_FLAGS = 14, 
00465     TRACE_RADIOTAP_TX_FLAGS = 15, 
00466     TRACE_RADIOTAP_RTS_RETRIES = 16, 
00467     TRACE_RADIOTAP_DATA_RETRIES = 17, 
00468     TRACE_RADIOTAP_EXT = 31
00469 } libtrace_radiotap_field_t;
00470 
00471 
00478 #ifdef WIN32
00479 #pragma pack(push)
00480 #pragma pack(1)
00481 #endif
00482 
00484 typedef struct libtrace_ip
00485 {
00486 #if BYTE_ORDER == LITTLE_ENDIAN
00487     LT_BITFIELD8 ip_hl:4;               
00488     LT_BITFIELD8 ip_v:4;                
00489 #elif BYTE_ORDER == BIG_ENDIAN
00490     LT_BITFIELD8 ip_v:4;                
00491     LT_BITFIELD8 ip_hl:4;               
00492 #else
00493 #   error "Adjust your <bits/endian.h> defines"
00494 #endif
00495     uint8_t  ip_tos;                    
00496     uint16_t ip_len;                    
00497     int16_t  ip_id;                     
00498     uint16_t ip_off;                    
00499     uint8_t  ip_ttl;                    
00500     uint8_t  ip_p;                      
00501     uint16_t ip_sum;                    
00502     struct in_addr ip_src;              
00503     struct in_addr ip_dst;              
00504 } PACKED libtrace_ip_t;
00505 
00507 typedef struct libtrace_ip6_ext
00508 {
00509         uint8_t nxt;    
00510         uint8_t len;    
00511 } PACKED libtrace_ip6_ext_t;
00512 
00513 typedef struct libtrace_ip6_frag 
00514 {
00515         uint8_t nxt;    
00516         uint8_t res;    
00517         uint16_t frag_off;      
00518         uint32_t ident; 
00519 } PACKED libtrace_ip6_frag_t;
00520 
00526 typedef struct libtrace_ip6
00527 { 
00528     uint32_t flow;                      
00529     uint16_t plen;                      
00530     uint8_t nxt;                        
00531     uint8_t hlim;                       
00532     struct in6_addr ip_src;             
00533     struct in6_addr ip_dst;             
00534 } PACKED libtrace_ip6_t;
00535 
00537 typedef struct libtrace_tcp
00538   {
00539     uint16_t source;            
00540     uint16_t dest;              
00541     uint32_t seq;               
00542     uint32_t ack_seq;           
00543 #  if BYTE_ORDER == LITTLE_ENDIAN
00544     LT_BITFIELD8 ecn_ns:1;      
00545     LT_BITFIELD8 res1:3;        
00546     LT_BITFIELD8 doff:4;        
00547     LT_BITFIELD8 fin:1;         
00548     LT_BITFIELD8 syn:1;         
00549     LT_BITFIELD8 rst:1;         
00550     LT_BITFIELD8 psh:1;         
00551     LT_BITFIELD8 ack:1;         
00552     LT_BITFIELD8 urg:1;         
00553     LT_BITFIELD8 ece:1;         
00554     LT_BITFIELD8 cwr:1;         
00555 #  elif BYTE_ORDER == BIG_ENDIAN
00556     LT_BITFIELD8 doff:4;        
00557     LT_BITFIELD8 res1:3;        
00558     LT_BITFIELD8 ecn_ns:1;      
00559     LT_BITFIELD8 cwr:1;         
00560     LT_BITFIELD8 ece:1;         
00561     LT_BITFIELD8 urg:1;         
00562     LT_BITFIELD8 ack:1;         
00563     LT_BITFIELD8 psh:1;         
00564     LT_BITFIELD8 rst:1;         
00565     LT_BITFIELD8 syn:1;         
00566     LT_BITFIELD8 fin:1;         
00567 #  else
00568 #   error "Adjust your <bits/endian.h> defines"
00569 #  endif
00570     uint16_t window;            
00571     uint16_t check;             
00572     uint16_t urg_ptr;           
00573 } PACKED libtrace_tcp_t;
00574 
00576 typedef struct libtrace_udp {
00577   uint16_t      source;         
00578   uint16_t      dest;           
00579   uint16_t      len;            
00580   uint16_t      check;          
00581 } PACKED libtrace_udp_t;
00582 
00584 typedef struct libtrace_icmp
00585 {
00586   uint8_t type;         
00587   uint8_t code;         
00588   uint16_t checksum;            
00589   union
00590   {
00591     struct
00592     {
00593       uint16_t  id;             
00594       uint16_t  sequence;       
00595     } echo;                     
00596     uint32_t    gateway;        
00597     struct
00598     {
00599       uint16_t  unused;         
00600       uint16_t  mtu;            
00601     } frag;                     
00602   } un;                         
00603 } PACKED libtrace_icmp_t;
00604 
00606 typedef struct libtrace_llcsnap
00607 {
00608 /* LLC */
00609   uint8_t dsap;                 
00610   uint8_t ssap;                 
00611   uint8_t control;              
00612 /* SNAP */
00613   LT_BITFIELD32 oui:24;         
00614   uint16_t type;                
00615 } PACKED libtrace_llcsnap_t;
00616 
00618 typedef struct libtrace_ether
00619 {
00620   uint8_t ether_dhost[6];       
00621   uint8_t ether_shost[6];       
00622   uint16_t ether_type;          
00623 } PACKED libtrace_ether_t;
00624 
00626 typedef struct libtrace_8021q 
00627 {
00628   LT_BITFIELD16 vlan_pri:3;      
00629   LT_BITFIELD16 vlan_cfi:1;      
00631   LT_BITFIELD16 vlan_id:12;      
00632   uint16_t vlan_ether_type;      
00634 } PACKED libtrace_8021q_t;
00635 
00637 typedef struct libtrace_atm_cell
00638 {
00639   LT_BITFIELD32 gfc:4;          
00640   LT_BITFIELD32 vpi:8;          
00641   LT_BITFIELD32 vci:16;         
00642   LT_BITFIELD32 pt:3;           
00643   LT_BITFIELD32 clp:1;          
00644   LT_BITFIELD32 hec:8;          
00645 } PACKED libtrace_atm_cell_t;
00646 
00648 typedef struct libtrace_atm_nni_cell
00649 {
00650   LT_BITFIELD32 vpi:12;         
00651   LT_BITFIELD32 vci:16;         
00652   LT_BITFIELD32 pt:3;           
00653   LT_BITFIELD32 clp:1;          
00654   LT_BITFIELD32 hec:8;          
00655 } PACKED libtrace_atm_nni_cell_t;
00656 
00664 typedef struct libtrace_atm_capture_cell
00665 {
00666   LT_BITFIELD32 gfc:4;          
00667   LT_BITFIELD32 vpi:8;          
00668   LT_BITFIELD32 vci:16;         
00669   LT_BITFIELD32 pt:3;           
00670   LT_BITFIELD32 clp:1;          
00671 } PACKED libtrace_atm_capture_cell_t;
00672 
00680 typedef struct libtrace_atm_nni_capture_cell
00681 {
00682   LT_BITFIELD32 vpi:12;         
00683   LT_BITFIELD32 vci:16;         
00684   LT_BITFIELD32 pt:3;           
00685   LT_BITFIELD32 clp:1;          
00686   LT_BITFIELD32 hec:8;          
00687 } PACKED libtrace_atm_nni_capture_cell_t;
00688 
00690 typedef struct libtrace_ppp
00691 {
00692  /* I can't figure out where the hell these two variables come from. They're
00693   * definitely not in RFC 1661 which defines PPP. Probably some weird thing
00694   * relating to the lack of distinction between PPP, HDLC and CHDLC */
00695         
00696 /* uint8_t address; */          
00697 /* uint8_t header;  */          
00698  uint16_t protocol;             
00699 } PACKED libtrace_ppp_t;
00700 
00702 typedef struct libtrace_pppoe
00703 {
00704  LT_BITFIELD8 version:4;        
00705  LT_BITFIELD8 type:4;           
00706  uint8_t code;                  
00707  uint16_t session_id;           
00708  uint16_t length;               
00709 } PACKED libtrace_pppoe_t;
00710 
00712 typedef struct libtrace_80211_t {
00713 #if BYTE_ORDER == LITTLE_ENDIAN
00714         LT_BITFIELD32      protocol:2;  
00715         LT_BITFIELD32      type:2;      
00716         LT_BITFIELD32      subtype:4;   
00717 #else
00718         LT_BITFIELD32      subtype:4;   
00719         LT_BITFIELD32      type:2;      
00720         LT_BITFIELD32      protocol:2;  
00721 #endif
00722 
00723 #if BYTE_ORDER == LITTLE_ENDIAN
00724         LT_BITFIELD32      to_ds:1;     
00725         LT_BITFIELD32      from_ds:1;   
00726         LT_BITFIELD32      more_frag:1; 
00727         LT_BITFIELD32      retry:1;     
00728         LT_BITFIELD32      power:1;     
00729         LT_BITFIELD32      more_data:1; 
00730         LT_BITFIELD32      wep:1;       
00731         LT_BITFIELD32      order:1;     
00732 #else
00733         LT_BITFIELD32      order:1;     
00734         LT_BITFIELD32      wep:1;       
00735         LT_BITFIELD32      more_data:1; 
00736         LT_BITFIELD32      power:1;     
00737         LT_BITFIELD32      retry:1;     
00738         LT_BITFIELD32      more_frag:1; 
00739         LT_BITFIELD32      from_ds:1;   
00740         LT_BITFIELD32      to_ds:1;     
00741 #endif
00742         uint16_t     duration;  
00743         uint8_t      mac1[6];   
00744         uint8_t      mac2[6];   
00745         uint8_t      mac3[6];   
00746         uint16_t     SeqCtl;    
00747         uint8_t      mac4[6];   
00748 } PACKED libtrace_80211_t;
00749 
00757 typedef struct libtrace_radiotap_t {
00758     uint8_t     it_version; 
00759     uint8_t     it_pad; 
00760     uint16_t    it_len; 
00761     uint32_t    it_present; 
00762 } PACKED libtrace_radiotap_t;
00763 
00765 typedef struct libtrace_ospf_v2_t
00766 {
00767         uint8_t ospf_v;         
00768         uint8_t type;           
00769         uint16_t len;           
00770         struct in_addr router;  
00771         struct in_addr area;    
00772         uint16_t sum;           
00773         uint16_t au_type;       
00774         uint16_t zero;          
00775         uint8_t au_key_id;      
00776         uint8_t au_data_len;    
00777         uint32_t au_seq_num;    
00778 } PACKED libtrace_ospf_v2_t;
00779 
00781 typedef struct libtrace_ospf_options_t {
00782 #if BYTE_ORDER == LITTLE_ENDIAN
00783         LT_BITFIELD8 unused1:1;
00784         LT_BITFIELD8 e_bit:1;
00785         LT_BITFIELD8 mc_bit:1;
00786         LT_BITFIELD8 np_bit:1;
00787         LT_BITFIELD8 ea_bit:1;
00788         LT_BITFIELD8 dc_bit:1;
00789         LT_BITFIELD8 unused2:2;
00790 #elif BYTE_ORDER == BIG_ENDIAN
00791         LT_BITFIELD8 unused2:2;
00792         LT_BITFIELD8 dc_bit:1;
00793         LT_BITFIELD8 ea_bit:1;
00794         LT_BITFIELD8 np_bit:1;
00795         LT_BITFIELD8 mc_bit:1;
00796         LT_BITFIELD8 e_bit:1;
00797         LT_BITFIELD8 unused1:1;
00798 #endif
00799 } PACKED libtrace_ospf_options_t;
00800 
00802 typedef struct libtrace_ospf_lsa_v2_t
00803 {
00804         uint16_t age;           
00805         libtrace_ospf_options_t lsa_options;    
00806         uint8_t lsa_type;       
00807         struct in_addr ls_id;   
00808         struct in_addr adv_router; 
00809         uint32_t seq;           
00810         uint16_t checksum;      
00811         uint16_t length;        
00812 } PACKED libtrace_ospf_lsa_v2_t;
00813 
00815 typedef struct libtrace_ospf_hello_v2_t
00816 {
00817         struct in_addr mask;    
00818         uint16_t interval;      
00819         libtrace_ospf_options_t hello_options;  
00820         uint8_t priority;       
00821         uint32_t deadint;       
00822         struct in_addr designated;      
00823         struct in_addr backup;  
00827 } PACKED libtrace_ospf_hello_v2_t;
00828 
00830 typedef struct libtrace_ospf_db_desc_v2_t
00831 {
00832         uint16_t mtu;           
00833         libtrace_ospf_options_t db_desc_options;        
00834 #if BYTE_ORDER == LITTLE_ENDIAN
00835         LT_BITFIELD8 db_desc_ms:1;      
00836         LT_BITFIELD8 db_desc_m:1;       
00837         LT_BITFIELD8 db_desc_i:1;       
00838         LT_BITFIELD8 zero:5;
00839 #elif BYTE_ORDER == BIG_ENDIAN
00840         LT_BITFIELD8 zero:5;
00841         LT_BITFIELD8 db_desc_i:1;       
00842         LT_BITFIELD8 db_desc_m:1;       
00843         LT_BITFIELD8 db_desc_ms:1;      
00844 #endif
00845         uint32_t seq;           
00846 } PACKED libtrace_ospf_db_desc_v2_t;
00847 
00849 typedef struct libtrace_ospf_ls_req_t
00850 {
00851         uint32_t ls_type;       
00852         uint32_t ls_id;         
00853         uint32_t advertising_router;    
00854 } PACKED libtrace_ospf_ls_req_t;
00855 
00857 typedef struct libtrace_ospf_ls_update_t
00858 {
00859         uint32_t ls_num_adv;    
00861         /* Followed by LSAs, use API functions to access these */
00862 } PACKED libtrace_ospf_ls_update_t;
00863 
00865 typedef struct libtrace_ospf_as_external_lsa_t
00866 {
00867         struct in_addr netmask; 
00868 #if BYTE_ORDER == LITTLE_ENDIAN
00869         LT_BITFIELD8 tos:7;
00870         LT_BITFIELD8 e:1;       
00871 #elif BYTE_ORDER == BIG_ENDIAN
00872         LT_BITFIELD8 e:1;       
00873         LT_BITFIELD8 tos:7;
00874 #endif
00875         uint8_t metric_a;       
00876         uint8_t metric_b;       
00877         uint8_t metric_c;       
00878         struct in_addr forwarding;      
00879         uint32_t external_tag;          
00880 } PACKED libtrace_ospf_as_external_lsa_v2_t;
00881 
00883 typedef struct libtrace_ospf_summary_lsa
00884 {
00885         struct in_addr netmask; 
00886         uint8_t zero;           
00887         uint8_t metric_a;       
00888         uint8_t metric_b;       
00889         uint8_t metric_c;       
00891 } PACKED libtrace_ospf_summary_lsa_v2_t;
00892 
00894 typedef struct libtrace_ospf_network_lsa_t
00895 {
00896         struct in_addr netmask; 
00897         /* Followed by IDs of attached routers */
00898 } PACKED libtrace_ospf_network_lsa_v2_t;
00899 
00901 typedef struct libtrace_ospf_link_t
00902 {
00903         struct in_addr link_id;         
00904         struct in_addr link_data;       
00905         uint8_t type;                   
00906         uint8_t num_tos;                
00907         uint16_t tos_metric;            
00908 } PACKED libtrace_ospf_link_v2_t;
00909 
00911 typedef struct libtrace_ospf_router_lsa_t
00912 {
00913 #if BYTE_ORDER == LITTLE_ENDIAN
00914         LT_BITFIELD8 b:1;       
00915         LT_BITFIELD8 e:1;       
00916         LT_BITFIELD8 v:1;       
00917         LT_BITFIELD8 zero:5;
00918 #elif BYTE_ORDER == BIG_ENDIAN
00919         LT_BITFIELD8 zero:5;
00920         LT_BITFIELD8 v:1;       
00921         LT_BITFIELD8 e:1;       
00922         LT_BITFIELD8 b:1;       
00923 #endif
00924         uint8_t zero2;          
00925         uint16_t num_links;     
00926 } PACKED libtrace_ospf_router_lsa_v2_t;
00927 
00928 typedef enum {
00929         TRACE_OSPF_HELLO = 1,           
00930         TRACE_OSPF_DATADESC = 2,        
00931         TRACE_OSPF_LSREQ = 3,           
00932         TRACE_OSPF_LSUPDATE = 4,        
00933         TRACE_OSPF_LSACK = 5            
00934 } libtrace_ospf_types_t;
00935 
00936 typedef enum {
00937         TRACE_OSPF_LS_ROUTER = 1,       
00938         TRACE_OSPF_LS_NETWORK = 2,      
00939         TRACE_OSPF_LS_SUMMARY = 3,      
00940         TRACE_OSPF_LS_ASBR_SUMMARY = 4, 
00941         TRACE_OSPF_LS_EXTERNAL = 5      
00942 } libtrace_ospf_ls_types_t;
00943 
00944 
00945 #ifdef WIN32
00946 #pragma pack(pop)
00947 #endif
00948 
00949 
00957 DLLEXPORT void trace_help(void);
00958 
00974 DLLEXPORT void trace_interrupt(void); 
00975 
00994 DLLEXPORT const char *trace_parse_uri(const char *uri, char **format);
00995 
01016 DLLEXPORT libtrace_t *trace_create(const char *uri);
01017 
01031 DLLEXPORT libtrace_t *trace_create_dead(const char *uri);
01032 
01046 DLLEXPORT libtrace_out_t *trace_create_output(const char *uri);
01047 
01057 DLLEXPORT int trace_start(libtrace_t *libtrace);
01058 
01068 DLLEXPORT int trace_pause(libtrace_t *libtrace);
01069 
01077 DLLEXPORT int trace_start_output(libtrace_out_t *libtrace);
01078 
01080 typedef enum {
01082         TRACE_OPTION_SNAPLEN,   
01083 
01085         TRACE_OPTION_PROMISC,   
01086 
01088         TRACE_OPTION_FILTER,    
01089 
01091         TRACE_OPTION_META_FREQ, 
01092 
01095         TRACE_OPTION_EVENT_REALTIME
01096 } trace_option_t;
01097 
01105 DLLEXPORT int trace_config(libtrace_t *libtrace,
01106                 trace_option_t option,
01107                 void *value);
01108 
01112 typedef enum {
01113         TRACE_OPTION_COMPRESSTYPE_NONE = 0, 
01114         TRACE_OPTION_COMPRESSTYPE_ZLIB = 1, 
01115         TRACE_OPTION_COMPRESSTYPE_BZ2  = 2, 
01116         TRACE_OPTION_COMPRESSTYPE_LZO  = 3  
01117 } trace_option_compresstype_t;
01118 
01120 typedef enum {
01122         TRACE_OPTION_OUTPUT_FILEFLAGS,
01125         TRACE_OPTION_OUTPUT_COMPRESS,
01127         TRACE_OPTION_OUTPUT_COMPRESSTYPE
01128 } trace_option_output_t;
01129 
01139 DLLEXPORT int trace_config_output(libtrace_out_t *libtrace, 
01140                 trace_option_output_t option,
01141                 void *value
01142                 );
01143 
01149 DLLEXPORT void trace_destroy(libtrace_t *trace);
01150 
01154 DLLEXPORT void trace_destroy_dead(libtrace_t *trace);
01155 
01159 DLLEXPORT void trace_destroy_output(libtrace_out_t *trace);
01160 
01168 DLLEXPORT libtrace_err_t trace_get_err(libtrace_t *trace);
01169 
01176 DLLEXPORT bool trace_is_err(libtrace_t *trace);
01177 
01185 DLLEXPORT void trace_perror(libtrace_t *trace, const char *msg,...) PRINTF(2,3);
01186 
01194 DLLEXPORT libtrace_err_t trace_get_err_output(libtrace_out_t *trace);
01195 
01202 DLLEXPORT bool trace_is_err_output(libtrace_out_t *trace);
01203 
01210 DLLEXPORT void trace_perror_output(libtrace_out_t *trace, const char *msg,...)
01211         PRINTF(2,3);
01212 
01222 DLLEXPORT
01223 uint64_t trace_get_received_packets(libtrace_t *trace);
01224 
01233 DLLEXPORT
01234 uint64_t trace_get_filtered_packets(libtrace_t *trace);
01235 
01244 DLLEXPORT
01245 uint64_t trace_get_dropped_packets(libtrace_t *trace);
01246 
01255 DLLEXPORT
01256 uint64_t trace_get_accepted_packets(libtrace_t *trace);
01257 
01258 
01271 DLLEXPORT libtrace_packet_t *trace_create_packet(void);
01272 
01285 DLLEXPORT libtrace_packet_t *trace_copy_packet(const libtrace_packet_t *packet);
01286 
01291 DLLEXPORT void trace_destroy_packet(libtrace_packet_t *packet);
01292 
01293 
01311 DLLEXPORT int trace_read_packet(libtrace_t *trace, libtrace_packet_t *packet);
01312 
01316 typedef enum {
01317         TRACE_EVENT_IOWAIT,     
01318         TRACE_EVENT_SLEEP,      
01319         TRACE_EVENT_PACKET,     
01320         TRACE_EVENT_TERMINATE   
01321 } libtrace_event_t;
01322 
01324 typedef struct libtrace_eventobj_t {
01325         libtrace_event_t type; 
01328         int fd;                
01330         double seconds;        
01332         int size; 
01333 } libtrace_eventobj_t;
01334 
01346 DLLEXPORT libtrace_eventobj_t trace_event(libtrace_t *trace,
01347                 libtrace_packet_t *packet);
01348 
01349 
01356 DLLEXPORT int trace_write_packet(libtrace_out_t *trace, libtrace_packet_t *packet);
01357 
01366 DLLEXPORT 
01367 enum base_format_t trace_get_format(struct libtrace_packet_t *packet);
01368 
01381 DLLEXPORT
01382 void trace_construct_packet(libtrace_packet_t *packet,
01383                 libtrace_linktype_t linktype, const void *data, uint16_t len);
01384 
01431 DLLEXPORT void *trace_get_packet_buffer(const libtrace_packet_t *packet,
01432                 libtrace_linktype_t *linktype, uint32_t *remaining);
01433 
01444 DLLEXPORT SIMPLE_FUNCTION DEPRECATED
01445 void *trace_get_link(const libtrace_packet_t *packet);
01446 
01457 DLLEXPORT SIMPLE_FUNCTION
01458 libtrace_ip_t *trace_get_ip(libtrace_packet_t *packet);
01459 
01470 DLLEXPORT SIMPLE_FUNCTION
01471 libtrace_ip6_t *trace_get_ip6(libtrace_packet_t *packet);
01472 
01495 DLLEXPORT void *trace_get_packet_meta(const libtrace_packet_t *packet,
01496                 libtrace_linktype_t *linktype,
01497                 uint32_t *remaining);
01498 
01536 DLLEXPORT void *trace_get_payload_from_meta(const void *meta,
01537                 libtrace_linktype_t *linktype,
01538                 uint32_t *remaining);
01539 
01540 
01557 DLLEXPORT void *trace_get_layer2(const libtrace_packet_t *packet,
01558                 libtrace_linktype_t *linktype,
01559                 uint32_t *remaining);
01560 
01584 DLLEXPORT void *trace_get_payload_from_layer2(void *l2,
01585                 libtrace_linktype_t linktype,
01586                 uint16_t *ethertype,
01587                 uint32_t *remaining);
01588 
01589 
01603 DLLEXPORT 
01604 void *trace_get_layer3(const libtrace_packet_t *packet,
01605                 uint16_t *ethertype, uint32_t *remaining);
01606 
01623 DLLEXPORT void *trace_get_transport(const libtrace_packet_t *packet, 
01624                 uint8_t *proto, uint32_t *remaining);
01625 
01649 DLLEXPORT void *trace_get_payload_from_ip(libtrace_ip_t *ip, uint8_t *proto,
01650                 uint32_t *remaining);
01651 
01674 DLLEXPORT void *trace_get_payload_from_ip6(libtrace_ip6_t *ipptr,
01675                 uint8_t *proto, uint32_t *remaining);
01676 
01695 DLLEXPORT void *trace_get_payload_from_link(void *linkptr,
01696                 libtrace_linktype_t linktype, 
01697                 uint16_t *type, uint32_t *remaining);
01698 
01722 DLLEXPORT void *trace_get_payload_from_vlan(
01723                 void *vlan, uint16_t *type, uint32_t *remaining);
01724 
01754 DLLEXPORT void *trace_get_payload_from_mpls(
01755                 void *mpls, uint16_t *type, uint32_t *remaining);
01756 
01783 DLLEXPORT void *trace_get_payload_from_pppoe(
01784                 void *pppoe, uint16_t *type, uint32_t *remaining);
01785 
01804 DLLEXPORT void *trace_get_payload_from_tcp(libtrace_tcp_t *tcp, 
01805                 uint32_t *remaining);
01806 
01825 DLLEXPORT void *trace_get_payload_from_udp(libtrace_udp_t *udp, uint32_t *remaining);
01826 
01849 DLLEXPORT void *trace_get_payload_from_icmp(libtrace_icmp_t *icmp, 
01850                 uint32_t *remaining);
01851 
01865 DLLEXPORT SIMPLE_FUNCTION
01866 libtrace_tcp_t *trace_get_tcp(libtrace_packet_t *packet);
01867 
01892 DLLEXPORT SIMPLE_FUNCTION
01893 libtrace_tcp_t *trace_get_tcp_from_ip(libtrace_ip_t *ip, uint32_t *remaining);
01894 
01908 DLLEXPORT SIMPLE_FUNCTION
01909 libtrace_udp_t *trace_get_udp(libtrace_packet_t *packet);
01910 
01935 DLLEXPORT SIMPLE_FUNCTION
01936 libtrace_udp_t *trace_get_udp_from_ip(libtrace_ip_t *ip,uint32_t *remaining);
01937 
01951 DLLEXPORT SIMPLE_FUNCTION
01952 libtrace_icmp_t *trace_get_icmp(libtrace_packet_t *packet);
01953 
01978 DLLEXPORT SIMPLE_FUNCTION
01979 libtrace_icmp_t *trace_get_icmp_from_ip(libtrace_ip_t *ip,uint32_t *remaining);
01980 
02003 DLLEXPORT SIMPLE_FUNCTION
02004 void *trace_get_ospf_header(libtrace_packet_t *packet, uint8_t *version,
02005                 uint32_t *remaining);
02006 
02031 DLLEXPORT SIMPLE_FUNCTION
02032 void *trace_get_ospf_contents_v2(libtrace_ospf_v2_t *header,
02033                 uint8_t *ospf_type, uint32_t *remaining);
02034 
02053 DLLEXPORT SIMPLE_FUNCTION 
02054 unsigned char *trace_get_first_ospf_lsa_from_update_v2(
02055                 libtrace_ospf_ls_update_t *ls_update,
02056                 uint32_t *remaining);
02057 
02076 DLLEXPORT SIMPLE_FUNCTION 
02077 unsigned char *trace_get_first_ospf_lsa_from_db_desc_v2(
02078                 libtrace_ospf_db_desc_v2_t *db_desc,
02079                 uint32_t *remaining);
02080 
02100 DLLEXPORT SIMPLE_FUNCTION
02101 unsigned char *trace_get_first_ospf_link_from_router_lsa_v2(
02102                 libtrace_ospf_router_lsa_v2_t *lsa,
02103                 uint32_t *remaining);
02104 
02134 DLLEXPORT SIMPLE_FUNCTION
02135 int trace_get_next_ospf_link_v2(unsigned char **current,
02136                 libtrace_ospf_link_v2_t **link,
02137                 uint32_t *remaining,
02138                 uint32_t *link_len);
02139 
02181 DLLEXPORT SIMPLE_FUNCTION
02182 int trace_get_next_ospf_lsa_v2(unsigned char **current,
02183                 libtrace_ospf_lsa_v2_t **lsa_hdr,
02184                 unsigned char **lsa_body,
02185                 uint32_t *remaining,
02186                 uint8_t *lsa_type,
02187                 uint16_t *lsa_length);
02188 
02224 DLLEXPORT SIMPLE_FUNCTION
02225 int trace_get_next_ospf_lsa_header_v2(unsigned char **current,
02226                 libtrace_ospf_lsa_v2_t **lsa_hdr,
02227                 uint32_t *remaining,
02228                 uint8_t *lsa_type,
02229                 uint16_t *lsa_length); 
02230 
02240 DLLEXPORT SIMPLE_FUNCTION
02241 uint32_t trace_get_ospf_metric_from_as_external_lsa_v2(
02242                 libtrace_ospf_as_external_lsa_v2_t *as_lsa);
02243 
02253 DLLEXPORT SIMPLE_FUNCTION
02254 uint32_t trace_get_ospf_metric_from_summary_lsa_v2(
02255                 libtrace_ospf_summary_lsa_v2_t *sum_lsa);
02256 
02257 
02268 DLLEXPORT SIMPLE_FUNCTION
02269 uint8_t *trace_get_destination_mac(libtrace_packet_t *packet);
02270 
02281 DLLEXPORT SIMPLE_FUNCTION
02282 uint8_t *trace_get_source_mac(libtrace_packet_t *packet);
02283 
02297 DLLEXPORT SIMPLE_FUNCTION
02298 struct sockaddr *trace_get_source_address(const libtrace_packet_t *packet,
02299                 struct sockaddr *addr);
02300 
02314 DLLEXPORT SIMPLE_FUNCTION
02315 struct sockaddr *trace_get_destination_address(const libtrace_packet_t *packet,
02316                 struct sockaddr *addr);
02317 
02318 
02336 DLLEXPORT int trace_get_next_option(unsigned char **ptr,int *len,
02337                         unsigned char *type,
02338                         unsigned char *optlen,
02339                         unsigned char **data);
02340 
02355 DLLEXPORT SIMPLE_FUNCTION
02356 uint64_t trace_get_erf_timestamp(const libtrace_packet_t *packet);
02357 
02363 DLLEXPORT SIMPLE_FUNCTION
02364 struct timeval trace_get_timeval(const libtrace_packet_t *packet);
02365 
02371 DLLEXPORT SIMPLE_FUNCTION
02372 struct timespec trace_get_timespec(const libtrace_packet_t *packet);
02373 
02380 DLLEXPORT SIMPLE_FUNCTION
02381 double trace_get_seconds(const libtrace_packet_t *packet);
02382 
02399 DLLEXPORT int trace_seek_seconds(libtrace_t *trace, double seconds);
02400 
02414 DLLEXPORT int trace_seek_timeval(libtrace_t *trace, struct timeval tv);
02415 
02433 DLLEXPORT int trace_seek_erf_timestamp(libtrace_t *trace, uint64_t ts);
02434 
02463 DLLEXPORT SIMPLE_FUNCTION
02464 size_t trace_get_capture_length(const libtrace_packet_t *packet);
02465 
02482 DLLEXPORT SIMPLE_FUNCTION
02483 size_t trace_get_wire_length(const libtrace_packet_t *packet);
02484 
02493 DLLEXPORT SIMPLE_FUNCTION
02494 size_t trace_get_framing_length(const libtrace_packet_t *packet);
02495 
02510 DLLEXPORT SIMPLE_FUNCTION
02511 size_t trace_get_payload_length(const libtrace_packet_t *packet);
02512 
02527 DLLEXPORT size_t trace_set_capture_length(libtrace_packet_t *packet, size_t size);
02528 
02537 DLLEXPORT SIMPLE_FUNCTION
02538 libtrace_linktype_t trace_get_link_type(const libtrace_packet_t *packet);
02539 
02550 DLLEXPORT libtrace_direction_t trace_set_direction(libtrace_packet_t *packet, libtrace_direction_t direction);
02551 
02567 DLLEXPORT SIMPLE_FUNCTION
02568 libtrace_direction_t trace_get_direction(const libtrace_packet_t *packet);
02569 
02583 DLLEXPORT SIMPLE_FUNCTION
02584 libtrace_filter_t *trace_create_filter(const char *filterstring);
02585 
02595 DLLEXPORT libtrace_filter_t *
02596 trace_create_filter_from_bytecode(void *bf_insns, unsigned int bf_len);
02597 
02609 DLLEXPORT int trace_apply_filter(libtrace_filter_t *filter,
02610                 const libtrace_packet_t *packet);
02611 
02617 DLLEXPORT void trace_destroy_filter(libtrace_filter_t *filter);
02643 DLLEXPORT char *trace_ether_ntoa(const uint8_t *addr, char *buf);
02644 
02662 DLLEXPORT uint8_t *trace_ether_aton(const char *buf, uint8_t *addr);
02663 
02674 typedef enum {
02675         USE_DEST,       
02676         USE_SOURCE      
02677 } serverport_t;
02678 
02692 DLLEXPORT SIMPLE_FUNCTION
02693 uint16_t trace_get_source_port(const libtrace_packet_t *packet);
02694 
02710 DLLEXPORT SIMPLE_FUNCTION
02711 uint16_t trace_get_destination_port(const libtrace_packet_t *packet);
02712 
02729 DLLEXPORT SIMPLE_FUNCTION
02730 int8_t trace_get_server_port(uint8_t protocol, uint16_t source, uint16_t dest);
02731 
02751 #ifndef ARPHRD_80211_RADIOTAP
02752 
02753 #define ARPHRD_80211_RADIOTAP 803
02754 #endif
02755 
02767 DLLEXPORT bool trace_get_wireless_tsft(void *linkptr,
02768         libtrace_linktype_t linktype, uint64_t *tsft);
02769 
02777 DLLEXPORT bool trace_get_wireless_rate(void *linkptr,
02778         libtrace_linktype_t linktype, uint8_t *rate);
02779 
02787 DLLEXPORT bool trace_get_wireless_freq(void *linkptr,
02788         libtrace_linktype_t linktype, uint16_t *freq);
02789 
02797 DLLEXPORT bool trace_get_wireless_signal_strength_dbm(void *linkptr,
02798         libtrace_linktype_t linktype, int8_t *strength);
02799 
02807 DLLEXPORT bool trace_get_wireless_noise_strength_dbm(void *linkptr,
02808         libtrace_linktype_t linktype, int8_t *strength);
02809 
02817 DLLEXPORT bool trace_get_wireless_signal_strength_db(void *linkptr,
02818         libtrace_linktype_t linktype, uint8_t *strength);
02819 
02827 DLLEXPORT bool trace_get_wireless_noise_strength_db(void *linkptr,
02828         libtrace_linktype_t linktype, uint8_t *strength);
02829 
02838 DLLEXPORT bool trace_get_wireless_tx_attenuation(void *linkptr,
02839         libtrace_linktype_t linktype, uint16_t *attenuation);
02840 
02848 DLLEXPORT bool trace_get_wireless_tx_attenuation_db(void *linkptr,
02849         libtrace_linktype_t linktype, uint16_t *attenuation);
02850 
02858 DLLEXPORT bool trace_get_wireless_tx_power_dbm(void *linkptr, 
02859                 libtrace_linktype_t linktype, int8_t *txpower);
02860 
02868 DLLEXPORT bool trace_get_wireless_antenna(void *linkptr,
02869         libtrace_linktype_t linktype, uint8_t *antenna);
02870 
02873 #ifdef __cplusplus
02874 } /* extern "C" */
02875 #endif /* #ifdef __cplusplus */
02876 #endif /* LIBTRACE_H_ */

Generated on Fri Jan 6 2012 16:50:55 for WAND Trace processing by  doxygen 1.7.1