WAND Trace processing  4.0.5
libtrace_parallel.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2007-2016 The University of Waikato, Hamilton, New Zealand.
4  * All rights reserved.
5  *
6  * This file is part of libtrace.
7  *
8  * This code has been developed by the University of Waikato WAND
9  * research group. For further information please see http://www.wand.net.nz/
10  *
11  * libtrace is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * libtrace is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  *
24  *
25  */
26 
27 
43 #ifndef LIBTRACE_PARALLEL_H
44 #define LIBTRACE_PARALLEL_H
45 
46 #include "libtrace.h"
47 #include <stdio.h>
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
54 
62 typedef union {
63  /* Pointers */
64  void *ptr;
65  libtrace_packet_t *pkt;
66  libtrace_result_t *res;
67 
68  /* C99 Integer types */
69  /* NOTE: Standard doesn't require 64-bit
70  * but x32 and x64 gcc does */
71  int64_t sint64;
72  uint64_t uint64;
73 
74  uint32_t uint32s[2];
75  int32_t sint32s[2];
76  uint32_t uint32;
77  int32_t sint32;
78 
79  uint16_t uint16s[4];
80  int16_t sint16s[4];
81  uint16_t uint16;
82  int16_t sint16;
83 
84  uint8_t uint8s[8];
85  int8_t sint8s[8];
86  uint8_t uint8;
87  int8_t sint8;
88 
89  size_t size;
90 
91  /* C basic types - we cannot be certain of the size */
92  int sint;
93  unsigned int uint;
94 
95  signed char schars[8];
96  unsigned char uchars[8];
97  signed char schar;
98  unsigned char uchar;
99 
100  /* Real numbers */
101  float rfloat;
102  double rdouble;
104 ct_assert(sizeof(libtrace_generic_t) == 8);
105 
109 typedef struct libtrace_message_t {
110  int code;
114 
117  uint64_t key;
119  int type;
120 };
121 
137 
142 
149 
155 
164 
174 
179 
184 
198 
206 
229 
249 
255 };
256 
267 
277 
284 
290 };
291 
292 typedef struct libtrace_info_t {
298  bool live;
299 
307 
308  /* TODO hash fn supported list */
309 
310  /* TODO consider time/clock details?? */
312 
313 typedef struct libtrace_combine libtrace_combine_t;
321 
331 
337 
344  void (*publish)(libtrace_t *, int thread_id, libtrace_combine_t *, libtrace_result_t *);
345 
355  void (*read)(libtrace_t *, libtrace_combine_t *);
356 
373  void (*read_final)(libtrace_t *, libtrace_combine_t *);
374 
381  void (*pause)(libtrace_t *, libtrace_combine_t *);
382 
386  void *queues;
387 
391  uint64_t last_count_tick;
392 
396  uint64_t last_ts_tick;
397 
403 };
404 
415 typedef uint64_t (*fn_hasher)(const libtrace_packet_t* packet, void *data);
416 
417 
437 DLLEXPORT int trace_pstart(libtrace_t *libtrace, void* global_blob,
438  libtrace_callback_set_t *per_packet_cbs,
439  libtrace_callback_set_t *reporter_cbs);
440 
453 typedef void* (*fn_cb_starting)(libtrace_t *libtrace,
455  void *global);
456 
466 typedef void (*fn_cb_dataless)(libtrace_t *libtrace,
468  void *global,
469  void *tls);
470 
479 typedef void (*fn_cb_first_packet)(libtrace_t *libtrace,
481  void *global,
482  void *tls,
483  libtrace_thread_t *sender);
484 
495 typedef void (*fn_cb_tick)(libtrace_t *libtrace,
497  void *global,
498  void *tls,
499  uint64_t order);
500 
514 typedef libtrace_packet_t* (*fn_cb_packet)(libtrace_t *libtrace,
516  void *global,
517  void *tls,
518  libtrace_packet_t *packet);
519 
531 typedef void (*fn_cb_result)(libtrace_t *libtrace, libtrace_thread_t *sender,
532  void *global, void *tls, libtrace_result_t *result);
533 
534 
547 typedef void (*fn_cb_usermessage) (libtrace_t *libtrace, libtrace_thread_t *t,
548  void *global, void *tls, int mesg, libtrace_generic_t data,
549  libtrace_thread_t *sender);
550 
551 
560  fn_cb_starting handler);
561 
570  fn_cb_dataless handler);
571 
580  fn_cb_dataless handler);
581 
589 DLLEXPORT int trace_set_pausing_cb(libtrace_callback_set_t *cbset,
590  fn_cb_dataless handler);
591 
599 DLLEXPORT int trace_set_packet_cb(libtrace_callback_set_t *cbset,
600  fn_cb_packet handler);
601 
610  fn_cb_first_packet handler);
611 
619 DLLEXPORT int trace_set_result_cb(libtrace_callback_set_t *cbset,
620  fn_cb_result handler);
621 
630  fn_cb_tick handler);
631 
640  fn_cb_tick handler);
641 
650  fn_cb_usermessage handler);
651 
658 
664 
665 
672 DLLEXPORT int trace_ppause(libtrace_t *libtrace);
673 
686 DLLEXPORT int trace_pstop(libtrace_t *libtrace);
687 
696 DLLEXPORT void trace_join(libtrace_t * trace);
697 
698 
741 DLLEXPORT int trace_set_perpkt_threads(libtrace_t *trace, int nb);
742 
757 DLLEXPORT int trace_set_tick_interval(libtrace_t *trace, size_t millisec);
758 
772 DLLEXPORT int trace_set_tick_count(libtrace_t *trace, size_t count);
773 
783 DLLEXPORT int trace_set_tracetime(libtrace_t *trace, bool tracetime);
784 
804 DLLEXPORT int trace_set_cache_size(libtrace_t *trace, size_t size);
805 
816 DLLEXPORT int trace_set_thread_cache_size(libtrace_t *trace, size_t size);
817 
836 DLLEXPORT int trace_set_fixed_count(libtrace_t *trace, bool fixed);
837 
853 DLLEXPORT int trace_set_burst_size(libtrace_t *trace, size_t size);
854 
863 DLLEXPORT int trace_set_hasher_queue_size(libtrace_t *trace, size_t size);
864 
883 DLLEXPORT int trace_set_hasher_polling(libtrace_t *trace, bool polling);
884 
902 DLLEXPORT int trace_set_reporter_polling(libtrace_t *trace, bool polling);
903 
923 DLLEXPORT int trace_set_reporter_thold(libtrace_t *trace, size_t thold);
924 
938 DLLEXPORT int trace_set_debug_state(libtrace_t *trace, bool debug_state);
939 
969 DLLEXPORT int trace_set_hasher(libtrace_t *trace, enum hasher_types type,
970  fn_hasher hasher, void *data);
971 
973 
974 
991 
996 
1002 
1007 
1008 };
1009 
1018 DLLEXPORT void trace_publish_result(libtrace_t *libtrace,
1019  libtrace_thread_t *t,
1020  uint64_t key,
1021  libtrace_generic_t value,
1022  int type);
1023 
1032 DLLEXPORT bool trace_has_dedicated_hasher(libtrace_t * libtrace);
1033 
1039 DLLEXPORT bool trace_has_reporter(libtrace_t * libtrace);
1040 
1048 DLLEXPORT int trace_post_reporter(libtrace_t *libtrace);
1049 
1060 DLLEXPORT int libtrace_thread_get_message_count(libtrace_t * libtrace,
1061  libtrace_thread_t *t);
1062 
1075 DLLEXPORT int libtrace_thread_get_message(libtrace_t * libtrace,
1076  libtrace_thread_t *t,
1077  libtrace_message_t * message);
1078 
1092 DLLEXPORT int libtrace_thread_try_get_message(libtrace_t * libtrace,
1093  libtrace_thread_t *t,
1094  libtrace_message_t * message);
1095 
1106 DLLEXPORT int trace_message_reporter(libtrace_t * libtrace,
1107  libtrace_message_t * message);
1108 
1120 DLLEXPORT int trace_message_perpkts(libtrace_t * libtrace,
1121  libtrace_message_t * message);
1122 
1134 DLLEXPORT int trace_message_thread(libtrace_t * libtrace,
1135  libtrace_thread_t *t,
1136  libtrace_message_t * message);
1137 
1146 DLLEXPORT bool trace_has_finished(libtrace_t * libtrace);
1147 
1148 
1171 DLLEXPORT bool trace_is_parallel(libtrace_t * libtrace);
1172 
1182 DLLEXPORT uint64_t trace_packet_get_order(libtrace_packet_t * packet);
1183 
1193 DLLEXPORT uint64_t trace_packet_get_hash(libtrace_packet_t * packet);
1194 
1205 DLLEXPORT void trace_packet_set_order(libtrace_packet_t * packet, uint64_t order);
1206 
1216 DLLEXPORT void trace_packet_set_hash(libtrace_packet_t * packet, uint64_t hash);
1217 
1218 
1236 DLLEXPORT int trace_get_first_packet(libtrace_t *libtrace,
1237  libtrace_thread_t *t,
1238  const libtrace_packet_t **packet,
1239  const struct timeval **tv);
1240 
1250 DLLEXPORT void libtrace_make_packet_safe(libtrace_packet_t *pkt);
1251 
1261 DLLEXPORT void libtrace_make_result_safe(libtrace_result_t *res);
1262 
1275 DLLEXPORT void trace_free_packet(libtrace_t * libtrace, libtrace_packet_t * packet);
1276 
1286 DLLEXPORT void trace_increment_packet_refcount(libtrace_packet_t *packet);
1287 
1300 DLLEXPORT void trace_decrement_packet_refcount(libtrace_packet_t *packet);
1301 
1302 
1311 DLLEXPORT libtrace_info_t *trace_get_information(libtrace_t * libtrace);
1312 
1346 DLLEXPORT int trace_set_configuration(libtrace_t *trace, const char * str);
1347 
1358 DLLEXPORT int trace_set_configuration_file(libtrace_t *trace, FILE *file);
1359 
1366 DLLEXPORT int trace_get_perpkt_threads(libtrace_t* t);
1367 
1374 DLLEXPORT int trace_get_perpkt_thread_id(libtrace_thread_t *thread);
1375 
1387 DLLEXPORT void trace_set_combiner(libtrace_t *trace, const libtrace_combine_t *combiner, libtrace_generic_t config);
1388 
1395 
1407 
1417 extern const libtrace_combine_t combiner_sorted;
1418 
1419 #ifdef __cplusplus
1420 }
1421 #endif
1422 
1423 #endif // LIBTRACE_PARALLEL_H
void(* fn_cb_usermessage)(libtrace_t *libtrace, libtrace_thread_t *t, void *global, void *tls, int mesg, libtrace_generic_t data, libtrace_thread_t *sender)
Callback for handling any user-defined message types.
Definition: libtrace_parallel.h:547
void(* read)(libtrace_t *, libtrace_combine_t *)
Read as many results as possible from the trace.
Definition: libtrace_parallel.h:355
DLLEXPORT int trace_get_perpkt_threads(libtrace_t *t)
Returns the number of processing threads that have been created for a given trace.
Definition: trace_parallel.c:285
void(* destroy)(libtrace_t *, libtrace_combine_t *)
Called when the trace ends, clean up any memory allocated by the initialise function.
Definition: libtrace_parallel.h:336
This message is sent to each thread when the thread ends and will trigger the stopping callback for t...
Definition: libtrace_parallel.h:154
const libtrace_combine_t combiner_sorted
Like classic Google Map/Reduce, the results are sorted in ascending order based on their key...
Definition: combiner_sorted.c:114
DLLEXPORT int trace_set_reporter_polling(libtrace_t *trace, bool polling)
Enables or disables polling of the reporter result queue.
Definition: trace_parallel.c:2485
DLLEXPORT bool trace_is_parallel(libtrace_t *libtrace)
Check if libtrace is directly reading from multiple queues from within the capture format (such as a ...
Definition: trace_parallel.c:1671
uint64_t last_ts_tick
The last timestamp tick that we saw, so we can avoid duplicating any ticks that are published...
Definition: libtrace_parallel.h:396
DLLEXPORT int trace_ppause(libtrace_t *libtrace)
Pauses a trace previously started with trace_pstart()
Definition: trace_parallel.c:1994
DLLEXPORT int libtrace_thread_try_get_message(libtrace_t *libtrace, libtrace_thread_t *t, libtrace_message_t *message)
Read a message from a thread in a non-blocking fashion.
Definition: trace_parallel.c:2298
result_types
Types of results.
Definition: libtrace_parallel.h:980
Use a hash which is uni-directional across TCP and UDP flows, such that the opposing directions of th...
Definition: libtrace_parallel.h:283
DLLEXPORT void trace_publish_result(libtrace_t *libtrace, libtrace_thread_t *t, uint64_t key, libtrace_generic_t value, int type)
Publish a result to the reporter thread (via the combiner)
Definition: trace_parallel.c:2360
DLLEXPORT int trace_set_reporter_thold(libtrace_t *trace, size_t thold)
Set the number of results that are required in the result queue before a MESSAGE_POST_REPORTER is sen...
Definition: trace_parallel.c:2492
void * queues
Data storage for all the combiner threads.
Definition: libtrace_parallel.h:386
The methods we use to combine the results from multiple processing threads into a single output...
Definition: libtrace_parallel.h:320
DLLEXPORT int trace_set_hasher_polling(libtrace_t *trace, bool polling)
Enables or disables polling of the hasher queue.
Definition: trace_parallel.c:2478
A libtrace result is ready, this will trigger the result callback for the reporter thread...
Definition: libtrace_parallel.h:141
DLLEXPORT int trace_set_burst_size(libtrace_t *trace, size_t size)
The number of packets to batch together for processing internally by libtrace.
Definition: trace_parallel.c:2464
void(* read_final)(libtrace_t *, libtrace_combine_t *)
Called when the trace is finished to flush the final results to the reporter thread.
Definition: libtrace_parallel.h:373
DLLEXPORT int trace_set_tick_interval(libtrace_t *trace, size_t millisec)
Set the interval between tick messages in milliseconds.
Definition: trace_parallel.c:2422
This message is sent to each thread when the thread transitions into a paused state from a running st...
Definition: libtrace_parallel.h:173
Trace file processing library header.
A libtrace input trace.
Definition: libtrace_int.h:306
DLLEXPORT int trace_set_packet_cb(libtrace_callback_set_t *cbset, fn_cb_packet handler)
Registers a packet callback against a callback set.
Definition: trace_parallel.c:1948
DLLEXPORT int trace_set_configuration_file(libtrace_t *trace, FILE *file)
Sets configuration from a file.
Definition: trace_parallel.c:2587
libtrace_thread_t * sender
The thread that sent the message.
Definition: libtrace_parallel.h:112
DLLEXPORT int trace_pstart(libtrace_t *libtrace, void *global_blob, libtrace_callback_set_t *per_packet_cbs, libtrace_callback_set_t *reporter_cbs)
Start or restart an input trace in the parallel libtrace framework.
Definition: trace_parallel.c:1677
DLLEXPORT void libtrace_make_packet_safe(libtrace_packet_t *pkt)
Makes a packet safe, preventing the packet from becoming invalid after a pausing a trace...
Definition: trace_parallel.c:422
const libtrace_combine_t combiner_unordered
Takes unordered (or ordered) input and produces unordered output.
Definition: combiner_unordered.c:95
DLLEXPORT int trace_set_tick_count(libtrace_t *trace, size_t count)
Set the number of packets to be read between tick messages.
Definition: trace_parallel.c:2429
uint64_t key
The unique key for the result.
Definition: libtrace_parallel.h:117
All message codes at or above this value represent custom user-defined messages and will trigger the ...
Definition: libtrace_parallel.h:254
DLLEXPORT void trace_decrement_packet_refcount(libtrace_packet_t *packet)
Decrements the internal reference counter for a packet.
Definition: trace_parallel.c:2619
DLLEXPORT int trace_set_result_cb(libtrace_callback_set_t *cbset, fn_cb_result handler)
Registers a result callback against a callback set.
Definition: trace_parallel.c:1972
void(* publish)(libtrace_t *, int thread_id, libtrace_combine_t *, libtrace_result_t *)
Receive a result from a processing thread.
Definition: libtrace_parallel.h:344
int code
The message code, as defined in enum libtrace_messages.
Definition: libtrace_parallel.h:110
The result is a tick timestamp.
Definition: libtrace_parallel.h:995
DLLEXPORT int trace_set_hasher(libtrace_t *trace, enum hasher_types type, fn_hasher hasher, void *data)
Set the hasher function for a parallel trace.
Definition: trace_parallel.c:2158
DLLEXPORT int trace_message_perpkts(libtrace_t *libtrace, libtrace_message_t *message)
Send a message to all processing threads.
Definition: trace_parallel.c:2339
DLLEXPORT int trace_get_first_packet(libtrace_t *libtrace, libtrace_thread_t *t, const libtrace_packet_t **packet, const struct timeval **tv)
Returns the first packet read by a processing thread since the source trace was last started or resta...
Definition: trace_parallel.c:1055
DLLEXPORT int trace_post_reporter(libtrace_t *libtrace)
Post a message to the reporter thread requesting that it check for more results.
Definition: trace_parallel.c:2332
DLLEXPORT libtrace_info_t * trace_get_information(libtrace_t *libtrace)
Provides some basic information about a trace based on its input format.
Definition: trace_parallel.c:2630
This message is sent to each thread when the thread transitions from a paused state to a running stat...
Definition: libtrace_parallel.h:163
Definition: libtrace_int.h:289
Sent to per-packet threads periodically after the configured time interval has passed.
Definition: libtrace_parallel.h:228
struct libtrace_message_t libtrace_message_t
Structure describing a message that can be sent to a libtrace thread.
Use a hash which is bi-directional for TCP and UDP flows, such that packets with the same 5-tuple are...
Definition: libtrace_parallel.h:276
DLLEXPORT void trace_packet_set_hash(libtrace_packet_t *packet, uint64_t hash)
Sets the hash of a packet.
Definition: trace_parallel.c:2392
Structure describing a message that can be sent to a libtrace thread.
Definition: libtrace_parallel.h:109
A collection of types for convenience used in place of a simple void* to allow any type of data to be...
Definition: libtrace_parallel.h:62
An internal message for forcing another thread to stop.
Definition: libtrace_parallel.h:183
The result is a tick counter.
Definition: libtrace_parallel.h:1001
DLLEXPORT int trace_set_cache_size(libtrace_t *trace, size_t size)
Sets the maximum size of the freelist used to store empty packets and their memory buffers...
Definition: trace_parallel.c:2443
int max_threads
The maximum number of threads supported by a parallel trace.
Definition: libtrace_parallel.h:306
DLLEXPORT int libtrace_thread_get_message_count(libtrace_t *libtrace, libtrace_thread_t *t)
Check the number of messages waiting in a thread's message queue.
Definition: trace_parallel.c:2273
DLLEXPORT int trace_set_resuming_cb(libtrace_callback_set_t *cbset, fn_cb_dataless handler)
Registers a resuming callback against a callback set.
Definition: trace_parallel.c:1936
libtrace_packet_t *(* fn_cb_packet)(libtrace_t *libtrace, libtrace_thread_t *t, void *global, void *tls, libtrace_packet_t *packet)
A callback function triggered when a processing thread receives a packet.
Definition: libtrace_parallel.h:514
void(* fn_cb_dataless)(libtrace_t *libtrace, libtrace_thread_t *t, void *global, void *tls)
A callback function for any message that does not require any specific data, e.g. ...
Definition: libtrace_parallel.h:466
DLLEXPORT int trace_set_tracetime(libtrace_t *trace, bool tracetime)
Delays packets so they are played back in trace-time rather than as fast as possible (real-time)...
Definition: trace_parallel.c:2436
DLLEXPORT void trace_packet_set_order(libtrace_packet_t *packet, uint64_t order)
Sets the order of a packet.
Definition: trace_parallel.c:2388
This message is sent to each thread when it first starts and will trigger the starting callback for t...
Definition: libtrace_parallel.h:148
int type
Describes the type of result, see enum result_types.
Definition: libtrace_parallel.h:119
Any user-defined result codes should be at or above this value.
Definition: libtrace_parallel.h:1006
An internal message for forcing another thread to pause.
Definition: libtrace_parallel.h:178
uint64_t last_count_tick
The last counter tick that we saw, so we can avoid duplicating any ticks that are published...
Definition: libtrace_parallel.h:391
DLLEXPORT int trace_set_pausing_cb(libtrace_callback_set_t *cbset, fn_cb_dataless handler)
Registers a pausing callback against a callback set.
Definition: trace_parallel.c:1930
DLLEXPORT void trace_increment_packet_refcount(libtrace_packet_t *packet)
Increments the internal reference counter for a packet.
Definition: trace_parallel.c:2609
This value indicates that the hasher is a custom user-defined function.
Definition: libtrace_parallel.h:289
libtrace_generic_t data
Additional data related to the message.
Definition: libtrace_parallel.h:111
DLLEXPORT int trace_set_tick_count_cb(libtrace_callback_set_t *cbset, fn_cb_tick handler)
Registers a tick counter callback against a callback set.
Definition: trace_parallel.c:1960
The libtrace packet structure.
Definition: libtrace.h:543
The result contains a pointer to a libtrace_packet_t.
Definition: libtrace_parallel.h:990
Information of this thread.
Definition: libtrace_int.h:198
void(* fn_cb_tick)(libtrace_t *libtrace, libtrace_thread_t *t, void *global, void *tls, uint64_t order)
A callback function for handling a tick message within a processing thread.
Definition: libtrace_parallel.h:495
DLLEXPORT int trace_set_user_message_cb(libtrace_callback_set_t *cbset, fn_cb_usermessage handler)
Registers a callback for custom user messages against a callback set.
Definition: trace_parallel.c:1978
An internal message for notifying the reporter thread that more results are available.
Definition: libtrace_parallel.h:205
const libtrace_combine_t combiner_ordered
Takes ordered input and produces ordered output.
Definition: combiner_ordered.c:262
Structure holding information about a result.
Definition: libtrace_parallel.h:116
void(* fn_cb_first_packet)(libtrace_t *libtrace, libtrace_thread_t *t, void *global, void *tls, libtrace_thread_t *sender)
A callback function for a first packet message seen by a processing thread.
Definition: libtrace_parallel.h:479
DLLEXPORT int trace_set_debug_state(libtrace_t *trace, bool debug_state)
Enable or disable debug output for parallel libtrace.
Definition: trace_parallel.c:2499
DLLEXPORT int trace_set_first_packet_cb(libtrace_callback_set_t *cbset, fn_cb_first_packet handler)
Registers a first packet callback against a callback set.
Definition: trace_parallel.c:1954
DLLEXPORT uint64_t trace_packet_get_order(libtrace_packet_t *packet)
Returns either the sequence number or erf timestamp of a packet.
Definition: trace_parallel.c:2380
DLLEXPORT libtrace_callback_set_t * trace_create_callback_set(void)
Create a callback set that can be used to define callbacks for parallel libtrace threads.
Definition: trace_parallel.c:254
Balance load across per-packet threads as best as possible, i.e the program does not care which threa...
Definition: libtrace_parallel.h:266
DLLEXPORT void libtrace_make_result_safe(libtrace_result_t *res)
Makes a result safe, preventing the result from becoming invalid after pausing a trace.
Definition: trace_parallel.c:442
DLLEXPORT int trace_set_tick_interval_cb(libtrace_callback_set_t *cbset, fn_cb_tick handler)
Registers a tick interval callback against a callback set.
Definition: trace_parallel.c:1966
Sent to per-packet threads once the configured number of packets are read from a trace.
Definition: libtrace_parallel.h:248
DLLEXPORT int trace_set_perpkt_threads(libtrace_t *trace, int nb)
Set the maximum number of perpkt threads to use in a trace.
Definition: trace_parallel.c:2408
DLLEXPORT int trace_set_thread_cache_size(libtrace_t *trace, size_t size)
This sets the maximum size of the freelist cache owned by each thread used to provide faster access t...
Definition: trace_parallel.c:2450
DLLEXPORT uint64_t trace_packet_get_hash(libtrace_packet_t *packet)
Returns the hash of a packet.
Definition: trace_parallel.c:2384
DLLEXPORT int trace_set_configuration(libtrace_t *trace, const char *str)
Sets the configuration of a trace based upon a comma separated list of key value pairs.
Definition: trace_parallel.c:2561
DLLEXPORT bool trace_has_dedicated_hasher(libtrace_t *libtrace)
Check if a dedicated hasher thread is being used.
Definition: trace_parallel.c:266
libtrace_generic_t value
The result value itself.
Definition: libtrace_parallel.h:118
A libtrace packet is ready, this will trigger the packet callback for the processing threads...
Definition: libtrace_parallel.h:136
DLLEXPORT void trace_set_combiner(libtrace_t *trace, const libtrace_combine_t *combiner, libtrace_generic_t config)
Sets a combiner function for an input trace.
Definition: trace_parallel.c:2370
DLLEXPORT int trace_set_hasher_queue_size(libtrace_t *trace, size_t size)
Sets the maximum size of the buffer used between the single hasher thread and the packet processing t...
Definition: trace_parallel.c:2471
uint64_t(* fn_hasher)(const libtrace_packet_t *packet, void *data)
The definition for a hasher function, allowing matching packets to be directed to the correct thread ...
Definition: libtrace_parallel.h:415
DLLEXPORT int libtrace_thread_get_message(libtrace_t *libtrace, libtrace_thread_t *t, libtrace_message_t *message)
Read a message from a thread in a blocking fashion.
Definition: trace_parallel.c:2285
This message is sent to each processing thread as soon as the first packet has been seen by any of th...
Definition: libtrace_parallel.h:197
void *(* fn_cb_starting)(libtrace_t *libtrace, libtrace_thread_t *t, void *global)
The starting callback for a processing or reporting thread.
Definition: libtrace_parallel.h:453
DLLEXPORT int trace_pstop(libtrace_t *libtrace)
Stops a parallel trace, causing all threads to exit as if an EOF has occurred.
Definition: trace_parallel.c:2127
hasher_types
The hasher types that are available to libtrace applications.
Definition: libtrace_parallel.h:260
DLLEXPORT int trace_get_perpkt_thread_id(libtrace_thread_t *thread)
Returns the internal unique ID for a packet processing thread.
Definition: trace_parallel.c:289
DLLEXPORT int trace_message_thread(libtrace_t *libtrace, libtrace_thread_t *t, libtrace_message_t *message)
Send a message to a specific thread.
Definition: trace_parallel.c:2312
DLLEXPORT bool trace_has_reporter(libtrace_t *libtrace)
Checks if a trace is using a reporter thread.
Definition: trace_parallel.c:271
bool live
True if a live format (i.e.
Definition: libtrace_parallel.h:298
libtrace_messages
The libtrace_messages enum All libtrace messages are defined and documented here. ...
Definition: libtrace_parallel.h:132
DLLEXPORT int trace_set_stopping_cb(libtrace_callback_set_t *cbset, fn_cb_dataless handler)
Registers a stopping callback against a callback set.
Definition: trace_parallel.c:1942
int(* initialise)(libtrace_t *, libtrace_combine_t *)
Called at the start of the trace to allow data-structures to be initialised and allow functions to be...
Definition: libtrace_parallel.h:330
DLLEXPORT int trace_set_starting_cb(libtrace_callback_set_t *cbset, fn_cb_starting handler)
Registers a starting callback against a callback set.
Definition: trace_parallel.c:1924
DLLEXPORT void trace_free_packet(libtrace_t *libtrace, libtrace_packet_t *packet)
In a parallel trace, free a packet back to libtrace.
Definition: trace_parallel.c:2602
DLLEXPORT int trace_set_fixed_count(libtrace_t *trace, bool fixed)
Determines whether a trace is allowed to create additional packets beyond the cache size...
Definition: trace_parallel.c:2457
Definition: libtrace_parallel.h:292
libtrace_generic_t configuration
Configuration options, what this does is up to the combiner chosen.
Definition: libtrace_parallel.h:402
void(* fn_cb_result)(libtrace_t *libtrace, libtrace_thread_t *sender, void *global, void *tls, libtrace_result_t *result)
Callback for handling a result message.
Definition: libtrace_parallel.h:531
void(* pause)(libtrace_t *, libtrace_combine_t *)
Pause must make sure any queued results that contain packets are safe.
Definition: libtrace_parallel.h:381
DLLEXPORT int trace_message_reporter(libtrace_t *libtrace, libtrace_message_t *message)
Send a message to the reporter thread.
Definition: trace_parallel.c:2322
DLLEXPORT bool trace_has_finished(libtrace_t *libtrace)
Checks if a parallel trace has finished reading packets.
Definition: trace_parallel.c:2396
DLLEXPORT void trace_destroy_callback_set(libtrace_callback_set_t *cbset)
Destroys a callback set, freeing up any resources it was using.
Definition: trace_parallel.c:250
DLLEXPORT void trace_join(libtrace_t *trace)
Waits for a trace to finish and all threads to join.
Definition: trace_parallel.c:2219