From Fulko Hew via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4615 :
[obnox/wireshark/wip.git] / epan / stats_tree_priv.h
index a29ab8e5dcca5226f4b1a10eb4fb4220e748b050..ca4d1362c18331022e7660520e1906f8b28694e3 100644 (file)
@@ -4,8 +4,8 @@
  *
  * $Id$
  *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  * 
  * This program is free software; you can redistribute it and/or
 #define INDENT_MAX 32
 #define NUM_BUF_SIZE 32
 
-/* implementations should define this to contain its own node related data
+/** implementations should define this to contain its own node related data
  * as well as some operations on it */
 typedef struct _st_node_pres st_node_pres;
 
-/* implementations should define this to contain its own dynamic tree related data
+/** implementations should define this to contain its own dynamic tree related data
 * as well as some operations on it */
 typedef struct _tree_pres tree_pres;
 
-/* implementations should define this to contain its own static tree related data
+/** implementations should define this to contain its own static tree related data
 * as well as some operations on it */
 typedef struct _tree_cfg_pres tree_cfg_pres;
 
@@ -54,91 +54,95 @@ typedef struct _range_pair {
 
 struct _stat_node {
        gchar*                  name;
-       int                             id;
+       int                     id;
        
-       /* the counter it keeps */
+       /** the counter it keeps */
        gint                    counter;
 
-       /* children nodes by name */
-       GHashTable*             hash;
+       /** children nodes by name */
+       GHashTable              *hash;
        
-       /* the owner of this node */
-       stats_tree*     st;
+       /** the owner of this node */
+       stats_tree              *st;
        
-       /* relatives */
-       stat_node*      parent;
-       stat_node*      children;
-       stat_node*      next;
+       /** relatives */
+       stat_node               *parent;
+       stat_node               *children;
+       stat_node               *next;
 
-       /* used to check if value is within range */
-       range_pair_trng;
+       /** used to check if value is within range */
+       range_pair_t            *rng;
        
-       /* node presentation data */
-       st_node_prespr;
+       /** node presentation data */
+       st_node_pres            *pr;
 };
 
 struct _stats_tree {
-       /* the "class" from which it's derived */
-       stats_tree_cfgcfg;
+       /** the "class" from which it's derived */
+       stats_tree_cfg          *cfg;
        
-       char*                   filter;
-       guint32                 highest_seen;
+       char                    *filter;
        
        /* times */
-       float                   start;
-       float                   elapsed;
+       double                  start;
+       double                  elapsed;
 
-   /* used to lookup named parents:
+   /** used to lookup named parents:
        *    key: parent node name
        *  value: parent node
        */
-       GHashTable*                     names;
+       GHashTable              *names;
        
-   /* used for quicker lookups of parent nodes */
-       GPtrArray*                      parents;
+   /** used for quicker lookups of parent nodes */
+       GPtrArray               *parents;
                
-       /*
+       /**
         *  tree representation
         *      to be defined (if needed) by the implementations
         */
-       tree_prespr;
+       tree_pres               *pr;
        
-       /* every tree in nature has one */
-       stat_node       root;
+       /** every tree in nature has one */
+       stat_node               root;
 };
 
 struct _stats_tree_cfg {
-       guint8*                 abbr;
-       guint8*                 name;
-       guint8*                 tapname;
-       
+       gchar*                  abbr;
+       gchar*                  name;
+       gchar*                  tapname;
+       register_stat_group_t   stat_group;
        
-       /* dissector defined callbacks */
+       gboolean in_use;
+
+       /** dissector defined callbacks */
        stat_tree_packet_cb packet;
        stat_tree_init_cb init;
        stat_tree_cleanup_cb cleanup;
+
+       /** tap listener flags for the per-packet callback */
+       guint flags;
        
        /*
         * node presentation callbacks
         */
 
-       /* last to be called at node creation */
+       /** last to be called at node creation */
        void (*setup_node_pr)(stat_node*);
        
-       /* last to be called at node destruction */
+       /** last to be called at node destruction */
        void (*free_node_pr)(stat_node*);
        
-       /* to be called for every node in the tree */
+       /** to be called for every node in the tree */
        void (*draw_node)(stat_node*);
        void (*reset_node)(stat_node*);
        
-       /*
+       /**
         * tree presentation callbacks
         */
-       tree_cfg_prespr;
+       tree_cfg_pres *pr;
        
        
-       tree_pres(*new_tree_pr)(stats_tree*);
+       tree_pres *(*new_tree_pr)(stats_tree*);
        void (*free_tree_pr)(stats_tree*);
        void (*draw_tree)(stats_tree*);
        void (*reset_tree)(stats_tree*);
@@ -146,57 +150,57 @@ struct _stats_tree_cfg {
 
 /* guess what, this is it! */
 extern void stats_tree_presentation(void (*registry_iterator)(gpointer,gpointer,gpointer),
-                                                                       void (*setup_node_pr)(stat_node*),
-                                                                       void (*free_node_pr)(stat_node*),
-                                                                       void (*draw_node)(stat_node*),
-                                                                       void (*reset_node)(stat_node*),
-                                                                       tree_pres* (*new_tree_pr)(stats_tree*),
-                                                                       void (*free_tree_pr)(stats_tree*),
-                                                                       void (*draw_tree)(stats_tree*),
-                                                                       void (*reset_tree)(stats_tree*),
-                                                                       void* data);
-
-extern stats_tree* stats_tree_new(stats_tree_cfg* cfg, tree_pres* pr, char* filter);
-
-/* callback for taps */
+                                   void (*setup_node_pr)(stat_node*),
+                                   void (*free_node_pr)(stat_node*),
+                                   void (*draw_node)(stat_node*),
+                                   void (*reset_node)(stat_node*),
+                                   tree_pres *(*new_tree_pr)(stats_tree*),
+                                   void (*free_tree_pr)(stats_tree*),
+                                   void (*draw_tree)(stats_tree*),
+                                   void (*reset_tree)(stats_tree*),
+                                   void *data);
+
+extern stats_tree *stats_tree_new(stats_tree_cfg *cfg, tree_pres *pr, const char *filter);
+
+/** callback for taps */
 extern int  stats_tree_packet(void*, packet_info*, epan_dissect_t*, const void *);
 
-/* callback for reset */
-extern void stats_tree_reset(voidp_st);
+/** callback for reset */
+extern void stats_tree_reset(void *p_st);
 
-/* callback for clear */
-extern void stats_tree_reinit(voidp_st);
+/** callback for clear */
+extern void stats_tree_reinit(void *p_st);
 
 /* callback for destoy */
-extern void stats_tree_free(stats_treest);
+extern void stats_tree_free(stats_tree *st);
 
-/* given an optarg splits the abbr part
+/** given an optarg splits the abbr part
    and returns a newly allocated buffer containing it */
-extern guint8* stats_tree_get_abbr(const guint8* optarg);
+extern gchar *stats_tree_get_abbr(const gchar *optarg);
 
-/* obtains a stats tree from the registry given its abbr */
-extern stats_tree_cfg* stats_tree_get_cfg_by_abbr(guint8* abbr);
+/** obtains a stats tree from the registry given its abbr */
+extern stats_tree_cfg *stats_tree_get_cfg_by_abbr(gchar *abbr);
 
-/* extracts node data as strings from a stat_node into
+/** extracts node data as strings from a stat_node into
    the buffers given by value, rate and precent
    if NULL they are ignored */
-extern void stats_tree_get_strs_from_node(const stat_nodenode,
-                                                                 guint8* value,
-                                                                 guint8* rate,
-                                                                 guint8* percent);
+extern void stats_tree_get_strs_from_node(const stat_node *node,
+                                         gchar *value,
+                                         gchar *rate,
+                                         gchar *percent);
 
-/* populates the given GString with a tree representation of a branch given by node,
+/** populates the given GString with a tree representation of a branch given by node,
    using indent spaces as indentation */
-extern void stats_tree_branch_to_str(const stat_nodenode,
-                                                          GString* s,
-                                                          guint indent);
+extern void stats_tree_branch_to_str(const stat_node *node,
+                                    GString *s,
+                                    guint indent);
 
-/* used to calcuate the size of the indentation and the longest string */
-extern guint stats_tree_branch_max_namelen(const stat_nodenode, guint indent);
+/** used to calcuate the size of the indentation and the longest string */
+extern guint stats_tree_branch_max_namelen(const stat_node *node, guint indent);
 
-/* a text representation of a node,
+/** a text representation of a node,
    if buffer is NULL returns a newly allocated string */
-extern guint8* stats_tree_node_to_str(const stat_node* node,
-                                                               guint8* buffer, guint len);
+extern gchar *stats_tree_node_to_str(const stat_node *node,
+                                    gchar *buffer, guint len);
 
 #endif /* __STATS_TREE_PRIV_H */