Atrinik Client  4.0
Data Structures | Typedefs | Functions | Variables
network_graph.c File Reference
#include <global.h>
#include <network_graph.h>
#include <toolkit/string.h>

Go to the source code of this file.

Data Structures

struct  network_graph_data
 
struct  network_graph_widget
 
struct  network_graph_work
 

Typedefs

typedef struct network_graph_data network_graph_data_t
 
typedef struct network_graph_widget network_graph_widget_t
 
typedef struct network_graph_work network_graph_work_t
 

Functions

static void widget_network_graph_update (widgetdata *widget, int type, int traffic, size_t bytes)
 
static void widget_draw (widgetdata *widget)
 
static void widget_background (widgetdata *widget, int draw)
 
static int widget_event (widgetdata *widget, SDL_Event *event)
 
static void widget_deinit (widgetdata *widget)
 
static void menu_network_graph_display_change (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_network_graph_display (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_network_graph_filters_change (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_network_graph_filters (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static int widget_menu_handle (widgetdata *widget, SDL_Event *event)
 
void network_graph_update (int type, int traffic, size_t bytes)
 
void widget_network_graph_init (widgetdata *widget)
 

Variables

static const char *const network_graph_types [NETWORK_GRAPH_TYPE_MAX]
 
static const char *const network_graph_filters [NETWORK_GRAPH_TRAFFIC_MAX]
 
static const char *const network_graph_colors [NETWORK_GRAPH_TYPE_MAX]
 
static SDL_mutex * network_graph_mutex = NULL
 
static network_graph_work_twork_queue = NULL
 

Detailed Description

Implements network graph type widgets.

Author
Alex Tokar

Definition in file network_graph.c.

Typedef Documentation

Holds network graph data about a particular data type.

Network graph widget sub-structure.

Work structure used to enqueue a network graph update.

Function Documentation

void network_graph_update ( int  type,
int  traffic,
size_t  bytes 
)

Updates all network graph widgets with new data.

Parameters
typeThe network graph type.
trafficThe traffic type (tx/rx).
bytesBytes.
Note
This function is thread-safe.

Definition at line 440 of file network_graph.c.

static void widget_background ( widgetdata widget,
int  draw 
)
static

Definition at line 161 of file network_graph.c.

static void widget_deinit ( widgetdata widget)
static

Definition at line 237 of file network_graph.c.

static void widget_draw ( widgetdata widget)
static

Definition at line 115 of file network_graph.c.

static int widget_event ( widgetdata widget,
SDL_Event *  event 
)
static

Definition at line 206 of file network_graph.c.

static int widget_menu_handle ( widgetdata widget,
SDL_Event *  event 
)
static

Definition at line 332 of file network_graph.c.

void widget_network_graph_init ( widgetdata widget)

Initializes one network graph widget.

Parameters
widgetThe widget.

Definition at line 464 of file network_graph.c.

static void widget_network_graph_update ( widgetdata widget,
int  type,
int  traffic,
size_t  bytes 
)
static

Actually performs updating for the specified network graph widget.

Parameters
widgetThe widget.
typeThe network graph type.
trafficThe traffic type (tx/rx).
bytesBytes.

Definition at line 355 of file network_graph.c.

Variable Documentation

const char* const network_graph_colors[NETWORK_GRAPH_TYPE_MAX]
static
Initial value:
= {
"#ff0000", "#00ff00"
}

Colors of the network graph types.

Definition at line 96 of file network_graph.c.

const char* const network_graph_filters[NETWORK_GRAPH_TRAFFIC_MAX]
static
Initial value:
= {
"Received", "Transmitted"
}

String representations of the network traffic types.

Definition at line 89 of file network_graph.c.

SDL_mutex* network_graph_mutex = NULL
static

Mutex used to provide reentrant API for network graph updates.

Definition at line 103 of file network_graph.c.

const char* const network_graph_types[NETWORK_GRAPH_TYPE_MAX]
static
Initial value:
= {
"Game data", "HTTP data"
}

String representations of the network graph types.

Definition at line 82 of file network_graph.c.

network_graph_work_t* work_queue = NULL
static

The work queue.

Definition at line 108 of file network_graph.c.