/usr/include/paristraceroute/metafield.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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | #ifndef METAFIELD_H
#define METAFIELD_H
#include <unistd.h>
#include "dynarray.h"
#include "bitfield.h"
#include "protocol_field.h"
// metafield = sur champ
// définit pour une clé par exemple flow le bon bitfield
// abstrait un concept (par exemple flow) ce qui permet d'avoir une implem commune entre ipv4 et ipv6
// probe_set_field("flow_id", ...)
// probe_set_constraint("flow_id", CONSTANT)
// ==, !=, pas de < ou de >
/**
* A metafield provides an abstraction of a set of bits stored in a
* data structure. This is a convenient way to abstract a concept
* (for example "what is a flow").
* This extend the concept of protocol_field.
*/
typedef struct metafield_s {
/* Exposed fields */
const char * name;
char ** patterns;
/* Internal fields */
bitfield_t bitfield; /**< Bits related to the metafield */
} metafield_t;
metafield_t* metafield_search(const char * name);
void metafield_register(metafield_t * metafield);
// - pattern matching
// - successor of a value
// - bitmask of unauthorized bits ?
// - prevent some fields to be used : eg. do not vary dst_port not to appear as
// a port scan. how to do it for flow_id and ipv6 for example ?
// - an options to parametrize metafields
typedef long long int metafield_value_t;
//--------------------------------------------------------------------------
// Allocation
//--------------------------------------------------------------------------
/**
* \brief Allocate a metafield. You are then suppose to set
* \param key Name of the metafield (for example "flow")
* \param fields Fields related to the metafield (for example
* "src_ip", "dst_ip", "src_port", "dst_port", "proto" for
* a tcp/ip flow)
* \return Address of the metafield if success, NULL otherwise
*/
/*
metafield_t * metafield_create(
const char * key
// TO COMPLETE
);
*/
/**
* \brief Delete a metafield from the memory.
* It only releases the metafield_t instance, not the pointed structures.
*/
//void metafield_free(metafield_t * metafield);
//--------------------------------------------------------------------------
// Getter / setter
//--------------------------------------------------------------------------
/**
* \brief Sum the size of every underlying fields
* \param metafield The metafield
* \return The number of bytes
*/
//size_t metafield_get_size(const metafield_t * metafield);
/**
* \brief Retrieve the value stored in a metafield.
* \param metafield The metafield
* \return The integer stored in the metafield.
*/
//metafield_value_t metafield_get(const metafield_t * metafield);
/**
* \brief Set a value stored in a buffer in a metafield.
* \param value The value we will set in the metafield.
*/
/*
bool metafield_set(
metafield_t * metafield,
metafield_value_t value
);
*/
//--------------------------------------------------------------------------
// Operator
//--------------------------------------------------------------------------
/**
* \brief Test whether two metafields are equal
* \param x The first metafield
* \param y The first metafield
* \return true iif x == y
*/
/*
bool metafield_equal(
const metafield_t * x,
const metafield_t * y
);
*/
/**
* \brief Test whether two metafields are different
* \param x The first metafield
* \param y The first metafield
* \return true iif x != y
*/
/*
bool metafield_not_equal(
const metafield_t * x,
const metafield_t * y
);
*/
#endif
|