Changeset 14a9d05


Ignore:
Timestamp:
07/07/04 17:48:32 (17 years ago)
Author:
Daniel Lawson <dlawson@…>
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:
90e4aa4
Parents:
a79ddbe
Message:

added get_direction

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h

    ra79ddbe r14a9d05  
    363363                        int buflen);
    364364
     365/** Get the direction flag, if it has one
     366 * @param libtrace the libtrace opaque pointer
     367 * @param buffer a point to a fille in buffer
     368 * @param buflen the length of the buffer
     369 * @returns a signed value containing the direction flag, or -1 if this is not supported
     370 * @author Daniel Lawson
     371 */
     372int8_t get_direction(struct libtrace_t *libtrace,
     373                      void *buffer,
     374                      int buflen);
     375
    365376/** Event types */
    366377typedef enum {
  • lib/trace.c

    ra79ddbe r14a9d05  
    11001100}
    11011101
    1102 
     1102/** Get the direction flag, if it has one
     1103 * @param libtrace the libtrace opaque pointer
     1104 * @param buffer a point to a fille in buffer
     1105 * @param buflen the length of the buffer
     1106 * @returns a signed value containing the direction flag, or -1 if this is not supported
     1107 * @author Daniel Lawson
     1108 */
     1109int8_t get_direction(struct libtrace_t *libtrace,
     1110                      void *buffer,
     1111                      int buflen) {
     1112       
     1113        int8_t direction;
     1114        dag_record_t *erfptr = 0;
     1115        assert(libtrace);
     1116        assert(buffer);
     1117
     1118        switch(libtrace->format) {
     1119                case DAG:
     1120                case ERF:
     1121                case RTCLIENT:
     1122                        erfptr = (dag_record_t *)buffer;
     1123                        direction = erfptr->flags.iface;
     1124                        break;
     1125                default:
     1126                        direction = -1;
     1127        }
     1128       
     1129        return direction;
     1130       
     1131       
     1132}
     1133
Note: See TracChangeset for help on using the changeset viewer.