Changeset 795


Ignore:
Timestamp:
05/10/06 09:57:52 (7 years ago)
Author:
spa1
Message:

OpenBSD compatibility fixes - adding in various #defines and #includes that are needed to compile under OpenBSD
Added a replacement pcap_next_ex function for systems that aren't running pcap-0.8 or better

Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.in

    r781 r795  
    158158        fi 
    159159    
    160         # Versions of libpcap earlier than 0.8 don't have pcap_dump_flush 
     160        # Versions of libpcap earlier than 0.8 don't have pcap_dump_flush or 
     161        # pcap_next_ex 
    161162        AC_CHECK_LIB(pcap,pcap_dump_flush, 
    162163                     have_pcap_dump_flush=true, 
     
    165166        if test "$have_pcap_dump_flush" = false; then 
    166167                AC_REPLACE_FUNCS(pcap_dump_flush) 
     168        fi 
     169         
     170        AC_CHECK_LIB(pcap,pcap_next_ex, 
     171                     have_pcap_next_ex=true, 
     172                     have_pcap_next_ex=false) 
     173 
     174        if test "$have_pcap_next_ex" = false; then 
     175                AC_REPLACE_FUNCS(pcap_next_ex) 
    167176        fi 
    168177 
  • trunk/lib/fifo.c

    r782 r795  
    3939 
    4040#include "fifo.h" 
     41 
     42#ifndef PRIu64 
     43        #define PRIu64 "llu" 
     44#endif 
     45 
     46#ifndef PRIi64 
     47        #define PRIi64 "lli" 
     48#endif 
    4149 
    4250enum which_t { FIFO_PTR_IN, FIFO_PTR_OUT, FIFO_PTR_ACK }; 
  • trunk/lib/format_pcap.c

    r782 r795  
    273273        packet->buf_control = TRACE_CTRL_PACKET; 
    274274 
     275        /* If we're using the replacement pcap_next_ex() we need to 
     276         * make sure we have a buffer to *shudder* memcpy into  
     277         */ 
     278        if (!packet->buffer) { 
     279                packet->buffer = malloc(LIBTRACE_PACKET_BUFSIZE); 
     280                if (!packet->buffer) { 
     281                        trace_set_err(libtrace, errno,  
     282                                        "Cannot allocate memory"); 
     283                        return -1; 
     284                } 
     285                         
     286                packet->header = packet->buffer; 
     287                packet->payload = (char *)packet->buffer +  
     288                                        sizeof(struct pcap_pkthdr); 
     289        } 
     290         
    275291        for(;;) { 
    276292 
  • trunk/lib/libtrace.h.in

    r781 r795  
    5757 
    5858#include <sys/types.h> 
     59#include <sys/time.h> 
     60 
    5961#ifdef _MSC_VER 
    6062    /* define the following from MSVC's internal types */ 
     
    98100#    include <netinet/in.h> 
    99101#    include <stdbool.h> 
     102#    include <sys/types.h> 
     103#    include <sys/socket.h> 
    100104#endif 
    101105 
     
    119123#  define SIMPLE_FUNCTION 
    120124#  define UNUSED 
    121 #  define PACKED __declspec(align(1)) 
     125#  define PACKED  
    122126#  define CONSTRUCTOR 
    123127#endif 
  • trunk/lib/linktypes.c

    r788 r795  
    1313#ifndef WIN32 
    1414#include <net/if_arp.h> 
    15 #else 
     15#endif 
     16 
     17#ifndef ARPHRD_ETHER 
    1618#define ARPHRD_ETHER    1               /* Ethernet 10/100Mbps.  */ 
     19#endif 
     20 
     21#ifndef ARPHRD_PPP 
    1722#define ARPHRD_PPP      512 
    1823#endif 
  • trunk/lib/pcap_dump_flush.c

    r698 r795  
    1717                return (0); 
    1818} 
     19 
    1920#endif 
  • trunk/lib/protocols.c

    r790 r795  
    1111#ifndef WIN32 
    1212#include <net/if_arp.h> 
    13 #else 
     13#endif 
     14 
     15#ifndef ARPHRD_ETHER 
    1416#define ARPHRD_ETHER    1               /* Ethernet 10/100Mbps.  */ 
     17#endif 
     18 
     19#ifndef ARPHRD_PPP 
    1520#define ARPHRD_PPP      512 
    1621#endif 
     22 
    1723 
    1824/* Returns the payload from 802.3 ethernet.  Type optionally returned in 
  • trunk/lib/trace.c

    r773 r795  
    5050#include <sys/stat.h> 
    5151#include <sys/types.h> 
     52#include <sys/socket.h> 
    5253#include <stdarg.h> 
    5354 
Note: See TracChangeset for help on using the changeset viewer.