X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FMainpage.dox;h=cb9444a0bfb57cb1bb4d5c70e2b393a4dae7d050;hb=6a0836b7f462d3d77b79b35638cdbf4c9d4202fc;hp=a164bd16ddc0f3cfc4cd254fea9e2d204b55b53f;hpb=226247520d34c4ec0539bfebf485d7cd46adcd70;p=senf.git diff --git a/Packets/Mainpage.dox b/Packets/Mainpage.dox index a164bd1..cb9444a 100644 --- a/Packets/Mainpage.dox +++ b/Packets/Mainpage.dox @@ -667,7 +667,8 @@ itself but gives us some information about the packet: A timestamp, the interface the packet was received on or other processing related information. - This type of information can be stored using the annotation interface. + This type of information can be stored using the annotation interface. The following example + will read packet data and will store the read timestamp as a packet annotation. \code struct Timestamp { @@ -689,7 +690,7 @@ } \endcode - It is very important to define a specific structure (or class) type for each type of + It is very important to define a specific structure (or class or enum) type for each type of annotation. \e Never directly store a fundamental type as an annotation: The name of the type is used to look up the annotation, so you can store only one annotation for each built-in type. \c typedef does not help since \c typedef does not introduce new type names, it only defines an @@ -722,6 +723,9 @@ } \endcode + Every annotation is automatically default-initialized, there is no way to query, whether a + packet holds a specific annotation -- every packet conceptually always holds all annotations. + You should use annotations economically: Every annotation type used in your program will allocate an annotation slot in \e all packet data structures. So don't use hundreds of different annotation types if this is not really necessary: Reuse annotation types where possible or