Changeset 431548c5


Ignore:
Timestamp:
05/04/06 14:54:59 (14 years ago)
Author:
Shane Alcock <salcock@…>
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:
48a20e3
Parents:
e5f1431
Message:

Updated various format modules to use libtrace_direction_t rather than int8_t
Changed MIN in fifo.c to be FIFO_MIN as this was very prone to conflict

Location:
lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • lib/fifo.c

    r9e830d4 r431548c5  
    5151 * #define MIN(a,b) ({ int _a = a; int _b = b; (_a < _b) ? _a : _b; })
    5252 */
    53 #define MIN(a,b) ((a)<(b)?(a):(b))
     53#define FIFO_MIN(a,b) ((a)<(b)?(a):(b))
    5454
    5555static char *tracefifo_stat_buffer = 0;
     
    201201        lenleft = len;
    202202        while (lenleft > 0) {
    203                 size = MIN( ( fifo->length - fifo->datamap[which]), lenleft);
     203                size = FIFO_MIN( ( fifo->length - fifo->datamap[which]), lenleft);
    204204                memcpy(buffer,
    205205                                (char *)((ptrdiff_t)fifo->base + fifo->datamap[which]),
     
    228228        lenleft = len;
    229229        while (lenleft > 0) {
    230                 size = MIN((fifo->length - fifo->datamap[FIFO_PTR_IN]), lenleft );
     230                size = FIFO_MIN((fifo->length - fifo->datamap[FIFO_PTR_IN]), lenleft );
    231231                memcpy((char *)((ptrdiff_t)fifo->base + fifo->datamap[FIFO_PTR_IN]),
    232232                                buffer,
  • lib/format_erf.c

    re5f1431 r431548c5  
    775775}
    776776
    777 static int8_t erf_get_direction(const libtrace_packet_t *packet) {
     777static libtrace_direction_t erf_get_direction(const libtrace_packet_t *packet) {
    778778        dag_record_t *erfptr = 0;
    779779        erfptr = (dag_record_t *)packet->header;
     
    781781}
    782782
    783 static int8_t erf_set_direction(libtrace_packet_t *packet, int8_t direction) {
     783static libtrace_direction_t erf_set_direction(libtrace_packet_t *packet, libtrace_direction_t direction) {
    784784        dag_record_t *erfptr = 0;
    785785        erfptr = (dag_record_t *)packet->header;
  • lib/format_linux.c

    r9a5b234 r431548c5  
    273273}
    274274
    275 static int8_t linuxnative_get_direction(const struct libtrace_packet_t *packet) {
     275static libtrace_direction_t linuxnative_get_direction(const struct libtrace_packet_t *packet) {
    276276        switch (((struct libtrace_linuxnative_header*)(packet->buffer))->hdr.sll_pkttype) {
    277277                case PACKET_OUTGOING:
    278                         return 0;
     278                        return TRACE_DIR_OUTGOING;
    279279                default:
    280                         return 1;
     280                        return TRACE_DIR_INCOMING;
    281281        }
    282282}
  • lib/format_pcap.c

    re5f1431 r431548c5  
    368368}
    369369
    370 static int8_t pcap_set_direction(libtrace_packet_t *packet,int8_t dir) {
     370static libtrace_direction_t pcap_set_direction(libtrace_packet_t *packet,
     371                libtrace_direction_t dir) {
    371372        libtrace_sll_header_t *sll;
    372373        promote_packet(packet);
    373374        sll=packet->payload;
    374         if(dir==0)
    375                 sll->pkttype=0;
     375        if(dir==TRACE_DIR_OUTGOING)
     376                sll->pkttype=TRACE_DIR_OUTGOING;
    376377        else
    377                 sll->pkttype=1;
     378                sll->pkttype=TRACE_DIR_INCOMING;
    378379        return sll->pkttype;
    379380}
    380381
    381 static int8_t pcap_get_direction(const libtrace_packet_t *packet) {
     382static libtrace_direction_t pcap_get_direction(const libtrace_packet_t *packet) {
    382383        libtrace_direction_t direction  = -1;
    383384        switch(pcap_get_link_type(packet)) {
     
    404405                         */
    405406                        if (ntohs(sll->pkttype == 0)) {
    406                                 direction = 1;
     407                                direction = TRACE_DIR_INCOMING;
    407408                        } else {
    408                                 direction = 0;
     409                                direction = TRACE_DIR_OUTGOING;
    409410                        }
    410411                        break;
     
    424425                        if (ntohs(pflog->dir==0)) {
    425426
    426                                 direction = 1;
     427                                direction = TRACE_DIR_INCOMING;
    427428                        }
    428429                        else {
    429                                 direction = 0;
     430                                direction = TRACE_DIR_OUTGOING;
    430431                        }
    431432                        break;
  • lib/format_wag.c

    ref69a05 r431548c5  
    417417}
    418418
    419 static int8_t wag_get_direction(const libtrace_packet_t *packet) {
     419static libtrace_direction_t wag_get_direction(const libtrace_packet_t *packet) {
    420420        struct frame_data_rx_t *wagptr = (struct frame_data_rx_t *)packet->buffer;
    421421        if (wagptr->hdr.type == 0) {
  • lib/libtrace_int.h

    re5f1431 r431548c5  
    240240         * @note This callback may be NULL if not supported.
    241241         */
    242         int8_t (*get_direction)(const libtrace_packet_t *packet);
     242        libtrace_direction_t (*get_direction)(const libtrace_packet_t *packet);
    243243        /** set the direction of this packet
    244244         * @note This callback may be NULL if not supported.
    245245         */
    246         int8_t (*set_direction)(libtrace_packet_t *packet, int8_t direction);
     246        libtrace_direction_t (*set_direction)(libtrace_packet_t *packet, libtrace_direction_t direction);
    247247        /** return the erf timestamp of the packet.
    248248         * @return the 64bit erf timestamp
Note: See TracChangeset for help on using the changeset viewer.