Ignore:
Timestamp:
01/08/19 09:40:10 (22 months ago)
Author:
Jacob Van Walraven <jcv9@…>
Branches:
develop
Children:
3c828b8
Parents:
f47025d
Message:

Add callback for meta packets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace_parallel.c

    r9c46b65 r62b2d97  
    242242        case MESSAGE_PACKET:
    243243                return;
    244         }
    245 
     244        case MESSAGE_META_PACKET:
     245                return;
     246        }
    246247        if (fn)
    247248                (*fn)(trace, thread, trace->global_blob, thread->user_data);
     
    496497                        t->accepted_packets++;
    497498                }
    498                 if (trace->perpkt_cbs->message_packet)
    499                         *packet = (*trace->perpkt_cbs->message_packet)(trace, t, trace->global_blob, t->user_data, *packet);
     499
     500                /* If packet is meta call the meta callback */
     501                if (IS_LIBTRACE_META_PACKET((*packet))) {
     502                        if (trace->perpkt_cbs->message_meta_packet) {
     503                                *packet = (*trace->perpkt_cbs->message_meta_packet)(trace, t, trace->global_blob,
     504                                        t->user_data, *packet);
     505                        }
     506                } else {
     507                        if (trace->perpkt_cbs->message_packet) {
     508                                *packet = (*trace->perpkt_cbs->message_packet)(trace, t, trace->global_blob, t->user_data,
     509                                        *packet);
     510                        }
     511                }
    500512                trace_fin_packet(*packet);
    501513        } else {
     
    20352047                fn_cb_packet handler) {
    20362048        cbset->message_packet = handler;
     2049        return 0;
     2050}
     2051
     2052DLLEXPORT int trace_set_meta_packet_cb(libtrace_callback_set_t *cbset,
     2053                fn_cb_meta_packet handler) {
     2054        cbset->message_meta_packet = handler;
    20372055        return 0;
    20382056}
Note: See TracChangeset for help on using the changeset viewer.