/usr/include/paristraceroute/event.h is in libparistraceroute-dev 0.93+git20160927-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #ifndef EVENT_H
#define EVENT_H
// Do not include "algorithm.h" to avoid mutual inclusion
/**
* \file event.h
* \brief
* Event structures are used to notify an algorithm when
* a particular event arises and to carry data between each
* instances.
*
* Events type are mainly here to manage libparistraceroute loop
* (memory, network ...) and are thus independant of the what
* does the algorithm.
*
* Specific-algorithm event are nested in a ALGORITHM_ANSWER event.
*/
/**
* \enum event_type_t
* \brief Enum to denote type of event
*/
typedef enum {
// Events raised by the network layer
// Such events are dispatched to the appropriate algorithm instances
PROBE_REPLY, /**< A reply has been sniffed */
PROBE_TIMEOUT, /**< No reply sniffed for a given probe */
// Events handled the algorithm layer
ALGORITHM_INIT, /**< An algorithm can start */
ALGORITHM_TERM, /**< An algorithm must terminate */
// Events raised by the algorithm layer
ALGORITHM_EVENT, /**< An algorithm has raised an event */
ALGORITHM_HAS_TERMINATED, /**< An algorithm must terminate */
ALGORITHM_ERROR /**< An error has occured */
} event_type_t;
/**
* \struct event_t
* \brief Structure representing an event
*/
typedef struct {
event_type_t type; /**< Event type */
void * data; /**< Data carried by the event */
void (* data_free)(void *); /**< Called in event_free to release data. Ignored if NULL. */
struct algorithm_instance_s * issuer; /**< Instance which has raised the event. NULL if raised by pt_loop. */
} event_t;
/**
* \brief Create a new event structure
* \param type Event type
* \param data Data that must be carried by this event
* \param issuer
* \return Newly created event structure
*/
event_t * event_create(
event_type_t type,
void * data,
struct algorithm_instance_s * issuer,
void (*data_free) (void * data)
);
/**
* \brief Release an event when done
* \param event The event to destroy
*/
void event_free(event_t * event);
#endif
|