storage: refactor sip_stats_t into StorageStats

This commit is contained in:
Kaian 2018-11-27 11:26:47 +01:00
parent 611c19fafa
commit 997c657ef0
5 changed files with 14 additions and 19 deletions

View File

@ -333,7 +333,7 @@ call_list_draw_header(Window *window)
}
// Print calls count (also filtered)
sip_stats_t stats = storage_calls_stats();
StorageStats stats = storage_calls_stats();
mvwprintw(window->win, 1, 45, "%*s", 30, "");
if (stats.total != stats.displayed) {
mvwprintw(window->win, 1, 45, "%s: %d (%d displayed)", countlb, stats.total, stats.displayed);

View File

@ -75,7 +75,7 @@ save_draw(Window *window)
g_return_val_if_fail(info != NULL, -1);
// Get filter stats
sip_stats_t stats = storage_calls_stats();
StorageStats stats = storage_calls_stats();
mvwprintw(window->win, 7, 3, "( ) all dialogs ");
mvwprintw(window->win, 8, 3, "( ) selected dialogs [%d]", call_group_count(info->group));
@ -602,7 +602,7 @@ save_win_new()
curs_set(1);
// Get filter stats
sip_stats_t stats = storage_calls_stats();
StorageStats stats = storage_calls_stats();
// Set default save modes
info->savemode = (stats.displayed == stats.total) ? SAVE_ALL : SAVE_DISPLAYED;

View File

@ -27,7 +27,7 @@
*/
/*
* +---------------------------------------------------------+
* | Stats Information |
* | StorageStats Information |
* +---------------------------------------------------------+
* | Dialogs: 725 COMPLETED: 7 (22.1%) |
* | Calls: 10 CANCELLED: 2 (12.2%) |
@ -80,7 +80,7 @@ stats_win_new()
window_init(window, 25, 60);
// Set the window title and boxes
mvwprintw(window->win, 1, window->width / 2 - 9, "Stats Information");
mvwprintw(window->win, 1, window->width / 2 - 9, "StorageStats Information");
wattron(window->win, COLOR_PAIR(CP_BLUE_ON_DEF));
title_foot_box(window->panel);
mvwhline(window->win, 10, 1, ACS_HLINE, window->width - 1);

View File

@ -95,10 +95,10 @@ storage_calls()
return storage.calls;
}
sip_stats_t
StorageStats
storage_calls_stats()
{
sip_stats_t stats = { 0 };
StorageStats stats = { 0 };
// Total number of calls without filtering
stats.total = g_ptr_array_len(storage.calls);

View File

@ -38,23 +38,21 @@
//! Shorter declaration of sip_call_list structure
typedef struct _Storage Storage;
//! Shorter declaration of sip stats
typedef struct sip_stats sip_stats_t;
typedef struct _StorageStats StorageStats;
//! Shorter declaration of structs
typedef struct _StorageSortOpts StorageSortOpts;
typedef struct _StorageMatchOpts StorageMatchOpts;
typedef struct _StorageCaptureOpts StorageCaptureOpts;
struct _StorageSortOpts
{
struct _StorageSortOpts {
//! Sort call list by this attribute
enum AttributeId by;
//! Sory by attribute ascending
gboolean asc;
};
struct _StorageMatchOpts
{
struct _StorageMatchOpts {
//! Only store dialogs starting with INVITE
gboolean invite;
//! Only store dialogs starting with a Method without to-tag
@ -69,8 +67,7 @@ struct _StorageMatchOpts
GRegex *mregex;
};
struct _StorageCaptureOpts
{
struct _StorageCaptureOpts {
//! Max number of calls in the list
guint limit;
//! Rotate first call when the limit is reached
@ -84,8 +81,7 @@ struct _StorageCaptureOpts
/**
* @brief Structure to store dialog stats
*/
struct sip_stats
{
struct _StorageStats {
//! Total number of captured dialogs
int total;
//! Total number of displayed dialogs after filtering
@ -97,8 +93,7 @@ struct sip_stats
*
* This structure acts as header of calls list
*/
struct _Storage
{
struct _Storage {
//! Matching options
StorageMatchOpts match;
//! Capture options
@ -188,7 +183,7 @@ storage_calls();
* @param total Total calls processed
* @param displayed number of calls matching filters
*/
sip_stats_t
StorageStats
storage_calls_stats();
/**