Changeset 9a6bdbc for lib/format_dag25.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_dag25.c

    r8c5c550 r9a6bdbc  
    174174 * many times or close a device that we're still using */
    175175struct dag_dev_t *open_dags = NULL;
     176
     177static bool dag_can_write(libtrace_packet_t *packet) {
     178        /* Get the linktype */
     179        libtrace_linktype_t ltype = trace_get_link_type(packet);
     180
     181        if (ltype == TRACE_TYPE_ERF_META
     182                || ltype == TRACE_TYPE_NONDATA) {
     183
     184                return false;
     185        }
     186
     187        return true;
     188}
    176189
    177190/* Returns the amount of padding between the ERF header and the start of the
     
    11861199static int dag_write_packet(libtrace_out_t *libtrace, libtrace_packet_t *packet)
    11871200{
     1201        /* Check dag can write this type of packet */
     1202        if (!dag_can_write(packet)) {
     1203                return 0;
     1204        }
     1205
    11881206        /* This is heavily borrowed from erf_write_packet(). Yes, CnP
    11891207         * coding sucks, sorry about that.
     
    12001218                return -1;
    12011219        }
    1202 
    1203         if (trace_get_link_type(packet) == TRACE_TYPE_NONDATA)
    1204                 return 0;
    12051220
    12061221        pad = dag_get_padding(packet);
Note: See TracChangeset for help on using the changeset viewer.