Changeset 9a6bdbc for lib/format_erf.c


Ignore:
Timestamp:
01/07/19 10:35:07 (22 months ago)
Author:
Jacob Van Walraven <jcv9@…>
Branches:
develop
Children:
51276bd
Parents:
979ab1a0
git-author:
Jacob Van Walraven <jcv9@…> (12/14/18 09:31:48)
git-committer:
Jacob Van Walraven <jcv9@…> (01/07/19 10:35:07)
Message:

Added can_write functions to each output format, Fixed pcapng_get_header_type incorrectly flipping type bytes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    rd439067 r9a6bdbc  
    119119} erf_index_t;
    120120
     121static bool erf_can_write(libtrace_packet_t *packet) {
     122        /* Get the linktype */
     123        libtrace_linktype_t ltype = trace_get_link_type(packet);
     124
     125        if (ltype == TRACE_TYPE_PCAPNG_META
     126                || ltype == TRACE_TYPE_NONDATA) {
     127
     128                return false;
     129        }
     130
     131        return true;
     132}
     133
    121134/* Ethernet packets have a 2 byte padding before the packet
    122135 * so that the IP header is aligned on a 32 bit boundary.
     
    670683                libtrace_packet_t *packet)
    671684{
     685
     686        /* Check erf can write this type of packet */
     687        if (!erf_can_write(packet)) {
     688                return 0;
     689        }
     690
    672691        int numbytes = 0;
    673692        dag_record_t *dag_hdr = (dag_record_t *)packet->header;
     
    679698                return -1;
    680699        }
    681 
    682         if (trace_get_link_type(packet) == TRACE_TYPE_NONDATA)
    683                 return 0;
    684700
    685701        if (!packet->header) {
Note: See TracChangeset for help on using the changeset viewer.