Skip to content

Commit

Permalink
Added additional comments to structs and enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
allinurl committed Sep 23, 2015
1 parent f8c155f commit e9f8105
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/browsers.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#define BROWSER_TYPE_LEN 13

/* Each Browser contains the number of hits and the Browser's type */
typedef struct GBrowser_
{
char browser_type[BROWSER_TYPE_LEN];
Expand Down
11 changes: 10 additions & 1 deletion src/commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ extern size_t term_w;
#define REQ_PROTO_LEN 9
#define REQ_METHOD_LEN 8

/* Type of IP */
typedef enum
{
TYPE_IPINV,
Expand All @@ -88,6 +89,7 @@ typedef enum
REQUEST_PROTOCOL
} GReqMeta;

/* Type of Modules */
typedef enum MODULES
{
VISITORS,
Expand All @@ -107,6 +109,7 @@ typedef enum MODULES
STATUS_CODES,
} GModule;

/* Metrics within GHolder or GDashData */
typedef struct GMetrics
{
/* metric id can be used to identify
Expand Down Expand Up @@ -153,6 +156,7 @@ typedef struct GMetrics
} maxts;
} GMetrics;

/* Holder sub item */
typedef struct GSubItem_
{
GModule module;
Expand All @@ -161,19 +165,22 @@ typedef struct GSubItem_
struct GSubItem_ *next;
} GSubItem;

/* Double linked-list of sub items */
typedef struct GSubList_
{
int size;
struct GSubItem_ *head;
struct GSubItem_ *tail;
} GSubList;

/* Holder item */
typedef struct GHolderItem_
{
GSubList *sub_list;
GMetrics *metrics;
} GHolderItem;

/* Holder of GRawData */
typedef struct GHolder_
{
GHolderItem *items; /* items */
Expand All @@ -184,12 +191,14 @@ typedef struct GHolder_
int sub_items_size; /* total number of sub items */
} GHolder;

/* Enum-to-string */
typedef struct GEnum_
{
const char *str;
int idx;
} GEnum;

/* A metric can contain a root/data/uniq node id */
typedef struct GDataMap_
{
int data;
Expand All @@ -208,7 +217,7 @@ typedef struct GAgents_
struct GAgentItem_ *items;
} GAgents;

/* single linked-list */
/* Generic Single linked-list */
typedef struct GSLList_
{
void *data;
Expand Down
4 changes: 4 additions & 0 deletions src/gdashboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#define COLUMN_HITS_LEN 4
#define COLUMN_VIS_LEN 4

/* Render holder */
typedef struct GDashRender_
{
WINDOW *win;
Expand All @@ -59,12 +60,14 @@ typedef struct GDashRender_
int sel;
} GDashRender;

/* Dashboard panel item */
typedef struct GDashData_
{
GMetrics *metrics;
short is_subitem;
} GDashData;

/* Dashboard panel */
typedef struct GDashModule_
{
GDashData *data;
Expand All @@ -86,6 +89,7 @@ typedef struct GDashModule_
unsigned short pos_y;
} GDashModule;

/* Dashboard */
typedef struct GDash_
{
int total_alloc;
Expand Down
2 changes: 2 additions & 0 deletions src/gmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ enum ACTION
typedef struct GMenu_ GMenu;
typedef struct GItem_ GItem;

/* Menu Item */
struct GItem_
{
char *name;
int checked;
};

/* Menu Panel */
struct GMenu_
{
WINDOW *win;
Expand Down
6 changes: 5 additions & 1 deletion src/gstorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "commons.h"

/* Enumerated Storage Metrics */
typedef enum GSMetric_
{
MTRC_KEYMAP,
Expand All @@ -39,6 +40,7 @@ typedef enum GSMetric_
MTRC_AGENTS,
} GSMetric;

/* Metrics Storage */
typedef struct GStorageMetrics_
{
/* Maps keys (string) to numeric values (integer).
Expand Down Expand Up @@ -138,6 +140,7 @@ typedef struct GStorageMetrics_

} GStorageMetrics;

/* Data Storage per module */
typedef struct GStorage_
{
GModule module;
Expand All @@ -154,6 +157,7 @@ int *int2ptr (int val);
uint64_t *uint642ptr (uint64_t val);
void *get_storage_metric_by_module (GModule module, GSMetric metric);
void *get_storage_metric (GModule module, GSMetric metric);
void set_data_metrics (GMetrics * ometrics, GMetrics ** nmetrics, int processed);
void set_data_metrics (GMetrics * ometrics, GMetrics ** nmetrics,
int processed);

#endif // for #ifndef GSTORAGE_H
1 change: 1 addition & 0 deletions src/opesys.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#define OPESYS_TYPE_LEN 10

/* Each OS contains the number of hits and the OS's type */
typedef struct GOpeSys_
{
char os_type[OPESYS_TYPE_LEN];
Expand Down
4 changes: 4 additions & 0 deletions src/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "commons.h"

/* Log properties. Note: This is per line parsed */
typedef struct GLogItem_
{
char *agent;
Expand Down Expand Up @@ -64,6 +65,7 @@ typedef struct GLogItem_
int agent_nkey;
} GLogItem;

/* Overall parsed log properties */
typedef struct GLog_
{
unsigned int excluded_ip;
Expand All @@ -77,12 +79,14 @@ typedef struct GLog_
GLogItem *items;
} GLog;

/* Raw Data extracted from table stores */
typedef struct GRawDataItem_
{
void *key;
void *value;
} GRawDataItem;

/* Raw Data per module */
typedef struct GRawData_
{
GRawDataItem *items; /* data */
Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ typedef struct GConfKeyword_
const char *keyword;
} GConfKeyword;

/* All configuration properties */
typedef struct GConf_
{
char *date_format;
Expand Down
3 changes: 3 additions & 0 deletions src/sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define SORT_MODULE_LEN 15 + 1 /* longest module name */
#define SORT_ORDER_LEN 4 + 1

/* Enumerated sorting metrics */
typedef enum GSortField_
{
SORT_BY_HITS,
Expand All @@ -48,12 +49,14 @@ typedef enum GSortField_
SORT_BY_MTHD,
} GSortField;

/* Enumerated sorting order */
typedef enum GSortOrder_
{
SORT_ASC,
SORT_DESC
} GSortOrder;

/* Sorting of each panel, metric and order */
typedef struct GSort_
{
GModule module;
Expand Down
4 changes: 4 additions & 0 deletions src/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
#include "commons.h"
#include "sort.h"

/* Curses dashboard find */
typedef struct GFind_
{
GModule module;
Expand All @@ -235,12 +236,14 @@ typedef struct GFind_
int icase;
} GFind;

/* Each panel contains its own scrolling and offset */
typedef struct GScrollModule_
{
int scroll;
int offset;
} GScrollModule;

/* Curses Scrolling */
typedef struct GScroll_
{
GScrollModule module[TOTAL_MODULES];
Expand All @@ -249,6 +252,7 @@ typedef struct GScroll_
int expanded;
} GScroll;

/* Spinner or Progress Indicator */
typedef struct GSpinner_
{
const char *label;
Expand Down

0 comments on commit e9f8105

Please sign in to comment.