Changeset edb18ce for lib/format_linux.c


Ignore:
Timestamp:
04/21/06 00:42:17 (15 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
d0906e7
Parents:
671566a
Message:

Rewrote libtrace's IO handling to use shim functions when needing to do
zlib io

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_linux.c

    r566e404 redb18ce  
    4545#include <net/ethernet.h>
    4646#include <net/if_arp.h>
     47
     48#include <string.h>
     49#include <net/if.h>
     50#include <sys/ioctl.h>
    4751
    4852static struct libtrace_format_t linuxnative;
     
    113117static int linuxnative_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
    114118        struct libtrace_linuxnative_header *hdr;
     119        socklen_t socklen;
    115120        if (!packet->buffer || packet->buf_control == TRACE_CTRL_EXTERNAL) {
    116121                packet->buffer = malloc(LIBTRACE_PACKET_BUFSIZE);
     
    120125        packet->header = packet->buffer;
    121126        packet->type = RT_DATA_LINUX_NATIVE;
    122         packet->payload = packet->buffer+sizeof(*hdr);
     127        packet->payload = (char*)packet->buffer+sizeof(*hdr);
    123128
    124129        hdr=(void*)packet->buffer;
    125         socklen_t socklen=sizeof(hdr->hdr);
     130        socklen=sizeof(hdr->hdr);
    126131        hdr->wirelen = recvfrom(FORMAT(libtrace->format_data)->fd,
    127132                        (void*)packet->payload,
     
    141146
    142147static libtrace_linktype_t linuxnative_get_link_type(const struct libtrace_packet_t *packet) {
    143         switch htons((((struct libtrace_linuxnative_header*)(packet->buffer))->hdr.sll_protocol)) {
     148        switch (htons((((struct libtrace_linuxnative_header*)(packet->buffer))->hdr.sll_protocol))) {
    144149                case ETH_P_IP:
    145150                case ETH_P_IPV6:
     
    171176static int linuxnative_get_framing_length(const struct libtrace_packet_t *packet) {
    172177        return sizeof(struct libtrace_linuxnative_header);
    173 }
    174 
    175 static size_t linuxnative_set_capture_length(struct libtrace_packet_t *packet,size_t size) {
    176         return -1;
    177178}
    178179
Note: See TracChangeset for help on using the changeset viewer.