diff --git a/config/sngreprc b/config/sngreprc index 4f0643d..2934210 100644 --- a/config/sngreprc +++ b/config/sngreprc @@ -8,11 +8,25 @@ ## Enable color on or off # set color on +##----------------------------------------------------------------------------- +## Enable temporal file usage +## By default, sngrep uses a random tempfile in /tmp for storing packages +## in case user want to save them to another file. This files are removed +## when sngep exits + +## Uncomment this to disable temporal pcap file while sngrep is running or +## change the used file +# set sngrep.tmpfile off +# set sngrep.tmpfile /tmp/last-sngrep-capture.pcap + +## Uncomment this to keep temporal files +# set sngrep.keeptmpfile on + ##----------------------------------------------------------------------------- ## Change default scrolling in call list # set cl.scrollstep 20 ## Disable exit prompt -# set cl.noexitprompt 1 +# set cl.noexitprompt off ## Or set its default button # set cl.defexitbutton 0/1 @@ -26,7 +40,7 @@ ## You can also configure the column width using ## set cl.column{num}.width {cols} ## -## Available columns fields are: +## Available columns fields are: ## - sipfrom ## - sipto ## - src @@ -56,13 +70,13 @@ # set cf.rawminwidth 100 ##----------------------------------------------------------------------------- -## Ignore dialogs that does not start with a request method -# set sip.ignoreincomplete 1 +## Uncomment to display dialogs that does not start with a request method +# set sip.ignoreincomplete off ##----------------------------------------------------------------------------- ## You can ignore some calls with any of the previous attributes with a given ## value with ignore directive. -## +## ## ignore {field} {value} ## diff --git a/src/Makefile.in b/src/Makefile.in index 7956eca..e3aa3b8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -267,7 +267,7 @@ uninstall-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -sngrep$(EXEEXT): $(sngrep_OBJECTS) $(sngrep_DEPENDENCIES) $(EXTRA_sngrep_DEPENDENCIES) +sngrep$(EXEEXT): $(sngrep_OBJECTS) $(sngrep_DEPENDENCIES) $(EXTRA_sngrep_DEPENDENCIES) @rm -f sngrep$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sngrep_OBJECTS) $(sngrep_LDADD) $(LIBS) diff --git a/src/exec.c b/src/exec.c index 4288bf9..45f6378 100644 --- a/src/exec.c +++ b/src/exec.c @@ -29,6 +29,7 @@ #include #include #include +#include "option.h" #include "ui_manager.h" //! Forced stdbuf command line arguments @@ -37,8 +38,8 @@ #define NGREP_ARGS "-qpt -W byline" /**************************************************************************** - ** Current version of sngrep launches a thread that execs original ngrep - ** binary. sngrep was born with the idea of parsing ngrep output. + ** Current version of sngrep launches a thread that execs original ngrep + ** binary. sngrep was born with the idea of parsing ngrep output. ** This could be changed with a bit of effort to a network capturing thread ** using libpcap functions, but we'll keep this way for now. ** @@ -47,8 +48,8 @@ ** forced by the exec process. ** ** U DD/MM/YY hh:mm:ss.uuuuuu fff.fff.fff.fff:pppp -> fff.fff.fff.fff:pppp - ** - ** If any other parameters are supplied to sngrep that changes this header + ** + ** If any other parameters are supplied to sngrep that changes this header ** (let's say -T), sngrep will fail at parsing any header :( ** ****************************************************************************/ @@ -64,10 +65,14 @@ online_capture(void *pargv) // Build the commald line to execute ngrep sprintf(cmdline, "%s %s %s %s", STDBUF_BIN, STDBUF_ARGS, NGREP_BIN, NGREP_ARGS); - while (argv[argc]) - sprintf(cmdline, "%s \"%s\"", cmdline, argv[argc++]); + // Add save to temporal file (if option enabled) + if (!is_option_disabled("sngrep.tmpfile")) + sprintf(cmdline, "%s -O %s", cmdline, get_option_value("sngrep.tmpfile")); - // Open the command for reading. + while (argv[argc]) + sprintf(cmdline, "%s \"%s\"", cmdline, argv[argc++]); + + // Open the command for reading. fp = popen(cmdline, "r"); if (fp == NULL) { printf("Failed to run command\n"); @@ -77,7 +82,7 @@ online_capture(void *pargv) // Read the output a line at a time - output it. while (fgets(stdout_line, 1024, fp) != NULL) { if (!strncmp(stdout_line, "\n", 1) && strlen(msg_header) && strlen(msg_payload)) { - // Parse message + // Parse message struct sip_msg *msg; if ((msg = sip_load_message(msg_header, strdup((const char*) msg_payload)))) { // Update the ui diff --git a/src/exec.h b/src/exec.h index c0ff243..94d3f00 100644 --- a/src/exec.h +++ b/src/exec.h @@ -34,8 +34,8 @@ #define __SNGREP_EXEC_H /**************************************************************************** - ** Current version of sngrep launches a thread that execs original ngrep - ** binary. sngrep was born with the idea of parsing ngrep output. + ** Current version of sngrep launches a thread that execs original ngrep + ** binary. sngrep was born with the idea of parsing ngrep output. ** This could be changed with a bit of effort to a network capturing thread ** using libpcap functions, but we'll keep this way for now. ** @@ -44,8 +44,8 @@ ** forced by the exec process. ** ** U DD/MM/YY hh:mm:ss.uuuuuu fff.fff.fff.fff:pppp -> fff.fff.fff.fff:pppp - ** - ** If any other parameters are supplied to sngrep that changes this header + ** + ** If any other parameters are supplied to sngrep that changes this header ** (let's say -T), sngrep will fail at parsing any header :( ** ****************************************************************************/ diff --git a/src/main.c b/src/main.c index 0c70838..7c2fc5d 100644 --- a/src/main.c +++ b/src/main.c @@ -62,7 +62,7 @@ usage(const char* progname) * * Parse command line options and start running threads * - * @note There are no params actually... if you supply one + * @note There are no params actually... if you supply one * param, I will assume we are running offline mode with * a pcap file. Otherwise the args will be passed to ngrep * without any type of validation. @@ -88,8 +88,8 @@ main(int argc, char* argv[]) return 1; } else if (argc == 2) { // Show offline mode in ui - set_option_value("running.mode", "Offline"); - set_option_value("running.file", argv[1]); + set_option_value("sngrep.mode", "Offline"); + set_option_value("sngrep.file", argv[1]); // Assume Offline mode with pcap file if (load_from_file(argv[1]) != 0) { @@ -98,7 +98,7 @@ main(int argc, char* argv[]) } } else { // Show online mode in ui - set_option_value("running.mode", "Online"); + set_option_value("sngrep.mode", "Online"); // Assume online mode, launch ngrep in a thread pthread_attr_init(&attr); @@ -113,6 +113,13 @@ main(int argc, char* argv[]) // Initialize interface // This is a blocking call. Interface have user action loops. init_interface(); + + // Delete the temporal file (if any) + if (!is_option_enabled("sngrep.keeptmpfile") && + !is_option_disabled(get_option_value("sngrep.tmpfile"))) { + unlink(get_option_value("sngrep.tmpfile")); + } + // Leaving! return ret; } diff --git a/src/option.c b/src/option.c index 88478f8..be16cfc 100644 --- a/src/option.c +++ b/src/option.c @@ -44,6 +44,11 @@ int optscnt = 0; int init_options() { + // Template for temporal file + char tmpfile[32]; + // Custom user conf file + char userconf[128]; + // Add basic optionurations set_option_value("color", "on"); @@ -73,25 +78,32 @@ init_options() set_option_value("cf.splitcallid", "off"); // Allow dialogs to be incomplete - set_option_value("sip.ignoreincomlete", "0"); - - // Toggle capture + set_option_value("sip.ignoreincomlete", "on"); set_option_value("sip.capture", "on"); + // Set default temporal file + sprintf(tmpfile, "/tmp/sngrep-%u-XXXXXX", (unsigned)time()); + set_option_value("sngrep.tmpfile", mktemp(tmpfile)); + set_option_value("sngpre.keeptmpfile", "off"); + // Set default filter options - set_option_value("filter.enable", "off"); + set_option_value("filter.enable", "off"); set_option_value("filter.REGISTER", "on"); - set_option_value("filter.INVITE", "on"); + set_option_value("filter.INVITE", "on"); set_option_value("filter.SUBSCRIBE", "on"); - set_option_value("filter.NOTIFY", "on"); - set_option_value("filter.OPTIONS", "on"); - set_option_value("filter.PUBLISH", "on"); - set_option_value("filter.MESSAGE", "on"); + set_option_value("filter.NOTIFY", "on"); + set_option_value("filter.OPTIONS", "on"); + set_option_value("filter.PUBLISH", "on"); + set_option_value("filter.MESSAGE", "on"); // Read options from configuration files read_options("/etc/sngreprc"); read_options("/usr/local/etc/sngreprc"); - read_options("/root/.sngreprc"); + // Get user homedir configuration + if (getenv("HOME")) { + sprintf(userconf, "%s/.sngreprc", getenv("HOME")); + read_options(userconf); + } return 0; } @@ -172,7 +184,6 @@ set_option_value(const char *opt, const char *value) } } } - //printf("%s %s\n", opt, value); } int @@ -180,9 +191,23 @@ is_option_enabled(const char *opt) { const char *value; if ((value = get_option_value(opt))) { - if (!strcasecmp(value, "on")) { + if (!strcasecmp(value, "on")) + return 1; + if (!strcasecmp(value, "1")) + return 1; + } + return 0; +} + +int +is_option_disabled(const char *opt) +{ + const char *value; + if ((value = get_option_value(opt))) { + if (!strcasecmp(value, "off")) + return 1; + if (!strcasecmp(value, "0")) return 1; - } } return 0; } diff --git a/src/option.h b/src/option.h index 2a5f29d..4ce1ee0 100644 --- a/src/option.h +++ b/src/option.h @@ -152,6 +152,19 @@ set_ignore_value(const char *opt, const char *value); extern int is_option_enabled(const char *opt); +/** + * @brief Check if a configuration option is "disabled" + * + * An option is considered disabled if it has "off" or "0" as value, + * otherwise will return enabled (1); + * + * @param opt Name of configuration option + * @return 1 if value is "off" or "0", 0 otherwise + */ +extern int +is_option_disabled(const char *opt); + + /** * @brief Check if a exits an ignore directive for the given field and value * diff --git a/src/sip.c b/src/sip.c index 91f738e..8ca89f5 100644 --- a/src/sip.c +++ b/src/sip.c @@ -40,7 +40,7 @@ #include "sip.h" #include "option.h" -/** +/** * @brief Linked list of parsed calls * * All parsed calls will be added to this list, only accesible from diff --git a/src/spcap.c b/src/spcap.c index 4287b95..7a8c402 100644 --- a/src/spcap.c +++ b/src/spcap.c @@ -63,6 +63,8 @@ online_capture(void *pargv) bpf_u_int32 mask; //! The IP of our sniffing device bpf_u_int32 net; + //! Pointer to the dump file + pcap_dumper_t *pd; //! Build the filter options while (argv[argc]) { @@ -77,15 +79,20 @@ online_capture(void *pargv) handle = pcap_open_live(dev, BUFSIZ, 1, 1000, errbuf); if (handle == NULL) { fprintf(stderr, "Couldn't open device %s: %s\n", dev, errbuf); - return(2); + return 2; } if (pcap_compile(handle, &fp, filter_exp, 0, net) == -1) { fprintf(stderr, "Couldn't parse filter %s: %s\n", filter_exp, pcap_geterr(handle)); - return(2); + return 2; } if (pcap_setfilter(handle, &fp) == -1) { fprintf(stderr, "Couldn't install filter %s: %s\n", filter_exp, pcap_geterr(handle)); - return(2); + return 2; + } + if ((pd = pcap_dump_open(handle, get_option_value("sngrep.tmpfile"))) == NULL) { + fprintf(stderr, "Couldn't open temporal dump file %s: %s\n", + get_option_value("sngrep.tmpfile"), pcap_geterr(handle)); + return 2; } // Get datalink to parse packages correctly diff --git a/src/spcap.h b/src/spcap.h index a146d12..52a0640 100644 --- a/src/spcap.h +++ b/src/spcap.h @@ -120,11 +120,11 @@ online_capture(void *pargv); /** * @brief Read from pcap file and fill sngrep sctuctures * - * This function will use libpcap files and previous structures to + * This function will use libpcap files and previous structures to * parse the pcap file. * This program is only focused in VoIP calls so we only consider * TCP/UDP packets with Ethernet or Linux coocked headers - * + * * @param file Full path to PCAP file * @return 0 if load has been successfull, 1 otherwise * diff --git a/src/ui_call_flow.c b/src/ui_call_flow.c index be28aea..14505c0 100644 --- a/src/ui_call_flow.c +++ b/src/ui_call_flow.c @@ -81,7 +81,7 @@ call_flow_create() // Create a new panel to fill all the screen panel = new_panel(newwin(LINES, COLS, 0, 0)); - // Initialize Call List specific data + // Initialize Call List specific data info = malloc(sizeof(call_flow_info_t)); memset(info, 0, sizeof(call_flow_info_t)); // Store it into panel userptr @@ -186,7 +186,7 @@ call_flow_draw(PANEL *panel) //if ((20 + info->columns->colpos * 30 + get_option_int_value("cf.rawminwidth") < width) if (is_option_enabled("cf.forceraw")) { call_flow_draw_raw(panel, info->cur_msg); - } + } return 0; diff --git a/src/ui_call_list.c b/src/ui_call_list.c index 745f0d6..c9858f3 100644 --- a/src/ui_call_list.c +++ b/src/ui_call_list.c @@ -48,7 +48,7 @@ call_list_create() // Create a new panel that fill all the screen panel = new_panel(newwin(LINES, COLS, 0, 0)); - // Initialize Call List specific data + // Initialize Call List specific data info = malloc(sizeof(call_list_info_t)); memset(info, 0, sizeof(call_list_info_t)); // Store it into panel userptr @@ -82,9 +82,9 @@ call_list_create() // Draw a header with APP_NAME and APP_LONG_DESC - FIXME /calculate a properly middle :P mvwprintw(win, 1, (width - 45) / 2, "sngrep - SIP message interface for ngrep"); - mvwprintw(win, 3, 2, "Current Mode: %s", get_option_value("running.mode")); - if (get_option_value("running.file")) { - mvwprintw(win, 4, 2, "Filename: %s", get_option_value("running.file")); + mvwprintw(win, 3, 2, "Current Mode: %s", get_option_value("sngrep.mode")); + if (get_option_value("sngrep.file")) { + mvwprintw(win, 4, 2, "Filename: %s", get_option_value("sngrep.file")); } mvwaddch(win, 5, 0, ACS_LTEE); mvwhline(win, 5, 1, ACS_HLINE, width - 2); @@ -149,7 +149,7 @@ call_list_draw(PANEL *panel) // Print in the header if we're actually capturing mvwprintw(win, 3, 23, "%s", is_option_enabled("sip.capture")?" ":"(Paused)"); - + // Get available calls counter (we'll use it here a couple of times) if (!(callcnt = sip_calls_count())) return 0; @@ -263,7 +263,7 @@ call_list_handle_key(PANEL *panel, int key) } break; case KEY_NPAGE: - // Next page => N key down strokes + // Next page => N key down strokes for (i = 0; i < rnpag_steps; i++) call_list_handle_key(panel, KEY_DOWN); break; @@ -318,7 +318,7 @@ call_list_handle_key(PANEL *panel, int key) case 'F': // KEY_F, Display filter panel next_panel = ui_create(ui_find_by_type(FILTER_PANEL)); - wait_for_input(next_panel); + wait_for_input(next_panel); call_list_filter_update(panel); break; case ' ': @@ -332,7 +332,7 @@ call_list_handle_key(PANEL *panel, int key) case 'q': case 27: /* KEY_ESC */ // Handle quit from this screen unless requested - if (get_option_int_value("cl.noexitprompt") != 1) { + if (!is_option_enabled("cl.noexitprompt")) { return call_list_exit_confirm(panel); } break; @@ -485,11 +485,11 @@ call_list_add_column(PANEL *panel, enum sip_attr_id id, const char* attr, const void call_list_filter_update(PANEL *panel) { - + WINDOW *win = panel_window(panel); int height, width, i, startline = 8; - // Get panel info + // Get panel info call_list_info_t *info = (call_list_info_t*) panel_userptr(panel); if (!info) return; @@ -503,9 +503,9 @@ call_list_filter_update(PANEL *panel) // Clear Displayed lines for (i=0; i < info->linescnt; i++) { - mvwprintw(win, startline++, 5, "%*s", width - 6, ""); - } - + mvwprintw(win, startline++, 5, "%*s", width - 6, ""); + } + // Print filter info mvwprintw(win, 4, 2, "%*s", width - 4, ""); if (is_option_enabled("filter.enable")) diff --git a/src/ui_call_list.h b/src/ui_call_list.h index 4bebc1d..1bd8d6c 100644 --- a/src/ui_call_list.h +++ b/src/ui_call_list.h @@ -41,8 +41,8 @@ typedef struct call_list_info call_list_info_t; /** * @brief Call List column information * - * It will be nice make which columns will appear in this list and - * in which order a configurable option. + * It will be nice make which columns will appear in this list and + * in which order a configurable option. * This structure is one step towards configurable stuff */ struct call_list_column @@ -71,7 +71,7 @@ struct call_list_info sip_call_group_t *group; //! Displayed column list, make it configurable in the future call_list_column_t columns[10]; - //! Displayed column count. + //! Displayed column count. int columncnt; //! Displayed lines in the list. int linescnt; @@ -159,7 +159,7 @@ call_list_help(PANEL *panel); * This function will request the user to confirm exit from * the program. This message can be avoided using configuration * option cl.noexitprompt 0 - * The default button can be configured using option + * The default button can be configured using option * cl.defexitbutton (default 1, that means yes) * * @param panel Call list panel pointer @@ -190,7 +190,7 @@ call_list_add_column(PANEL *panel, enum sip_attr_id id, const char* attr, const * This function is called after showing the filter dialog (@see ui_filter.h) * and resets the displayed information to force a new call list * load. - * + * * @param panel Call list panel pointer */ extern void diff --git a/src/ui_call_raw.c b/src/ui_call_raw.c index 77f7d2a..202b2c0 100644 --- a/src/ui_call_raw.c +++ b/src/ui_call_raw.c @@ -44,7 +44,7 @@ call_raw_create() // Create a new panel to fill all the screen panel = new_panel(newwin(LINES, COLS, 0, 0)); - // Initialize Call List specific data + // Initialize Call List specific data info = malloc(sizeof(call_raw_info_t)); memset(info, 0, sizeof(call_raw_info_t)); // Store it into panel userptr @@ -150,7 +150,7 @@ call_raw_handle_key(PANEL *panel, int key) if (info->scrollpos > 0) info->scrollpos--; break; case KEY_NPAGE: - // Next page => N key down strokes + // Next page => N key down strokes for (i = 0; i < rnpag_steps; i++) call_raw_handle_key(panel, KEY_DOWN); break; diff --git a/src/ui_call_raw.h b/src/ui_call_raw.h index 6624397..323c170 100644 --- a/src/ui_call_raw.h +++ b/src/ui_call_raw.h @@ -36,7 +36,7 @@ //! Sorter declaration of struct call_raw_info typedef struct call_raw_info call_raw_info_t; -/** +/** * @brief Call raw status information * * This data stores the actual status of the panel. It's stored in the diff --git a/src/ui_filter.c b/src/ui_filter.c index 58e72d4..f3939b9 100644 --- a/src/ui_filter.c +++ b/src/ui_filter.c @@ -9,7 +9,7 @@ ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. - ** + ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -50,10 +50,10 @@ filter_create() // Cerate a new indow for the panel and form win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2); - // Create a new panel + // Create a new panel panel = new_panel(win); - // Initialize Filter panel specific data + // Initialize Filter panel specific data info = malloc(sizeof(filter_info_t)); memset(info, 0, sizeof(filter_info_t)); @@ -77,11 +77,11 @@ filter_create() info->fields[FIELD_CANCEL] = new_field(1, 10, height - 2, 30, 0, 0); info->fields[FIELD_COUNT] = NULL; - // Set fields options + // Set fields options field_opts_off(info->fields[FIELD_ENABLE], O_AUTOSKIP); - field_opts_off(info->fields[FIELD_SIPFROM], O_AUTOSKIP); - field_opts_off(info->fields[FIELD_SIPTO], O_AUTOSKIP); - field_opts_off(info->fields[FIELD_SRC], O_AUTOSKIP); + field_opts_off(info->fields[FIELD_SIPFROM], O_AUTOSKIP); + field_opts_off(info->fields[FIELD_SIPTO], O_AUTOSKIP); + field_opts_off(info->fields[FIELD_SRC], O_AUTOSKIP); field_opts_off(info->fields[FIELD_DST], O_AUTOSKIP); field_opts_off(info->fields[FIELD_REGISTER], O_AUTOSKIP); field_opts_off(info->fields[FIELD_INVITE], O_AUTOSKIP); @@ -94,10 +94,10 @@ filter_create() field_opts_off(info->fields[FIELD_CANCEL], O_EDIT); // Change background of input fields - set_field_back(info->fields[FIELD_SIPFROM], A_UNDERLINE); - set_field_back(info->fields[FIELD_SIPTO], A_UNDERLINE); - set_field_back(info->fields[FIELD_SRC], A_UNDERLINE); - set_field_back(info->fields[FIELD_DST], A_UNDERLINE); + set_field_back(info->fields[FIELD_SIPFROM], A_UNDERLINE); + set_field_back(info->fields[FIELD_SIPTO], A_UNDERLINE); + set_field_back(info->fields[FIELD_SRC], A_UNDERLINE); + set_field_back(info->fields[FIELD_DST], A_UNDERLINE); // Create the form and post it info->form = new_form(info->fields); @@ -146,7 +146,7 @@ filter_create() mvwaddch(win, 9, 49, ACS_RTEE); wattroff(win, COLOR_PAIR(DETAIL_BORDER_COLOR)); - // Set default cursor position + // Set default cursor position set_current_field(info->form, info->fields[FIELD_SIPFROM]); wmove(win, 5, 18); curs_set(1); @@ -174,12 +174,12 @@ filter_handle_key(PANEL *panel, int key) field_idx = field_index(current_field(info->form)); // Get current field value. - // We trim spaces with sscanf because and empty field is stored as + // We trim spaces with sscanf because and empty field is stored as // space characters memset(field_value, 0, sizeof(field_value)); sscanf(field_buffer(current_field(info->form), 0), "%[^ ]", field_value); - switch(key) { + switch(key) { case 9 /*KEY_TAB*/: case KEY_DOWN: form_driver(info->form, REQ_NEXT_FIELD); @@ -208,7 +208,7 @@ filter_handle_key(PANEL *panel, int key) return key; break; case KEY_BACKSPACE: - if (strlen(field_value) > 0) + if (strlen(field_value) > 0) form_driver(info->form, REQ_DEL_PREV); break; case ' ': @@ -231,14 +231,14 @@ filter_handle_key(PANEL *panel, int key) form_driver(info->form, REQ_NEXT_FIELD); form_driver(info->form, REQ_END_LINE); break; - } + } break; case 10: /* KEY_ENTER */ if (field_idx != FIELD_CANCEL) filter_save_options(panel); return 27; default: - // If this is a normal character on input field, print it + // If this is a normal character on input field, print it switch(field_idx) { case FIELD_SIPFROM: case FIELD_SIPTO: @@ -279,7 +279,7 @@ filter_save_options(PANEL *panel) for (i = 0; i < FIELD_COUNT; i++) { // Get current field value. - // We trim spaces with sscanf because and empty field is stored as + // We trim spaces with sscanf because and empty field is stored as // space characters memset(field_value, 0, sizeof(field_value)); sscanf(field_buffer(info->fields[i], 0), "%[^ ]", field_value); @@ -311,7 +311,7 @@ filter_save_options(PANEL *panel) set_option_value("filter.MESSAGE", strlen(field_value)?"on":"off"); break; default: break; - } + } } } diff --git a/src/ui_filter.h b/src/ui_filter.h index 154d874..2c871e2 100644 --- a/src/ui_filter.h +++ b/src/ui_filter.h @@ -80,7 +80,7 @@ struct filter_info * @brief Creates a new filter panel * * This function allocates all required memory for - * displaying the filter panel. It also draws all the + * displaying the filter panel. It also draws all the * static information of the panel that will never be * redrawn. * @@ -91,7 +91,7 @@ filter_create(); /** * @brief Destroy filter panel - * + * * This function do the final cleanups for this panel */ extern void @@ -100,11 +100,11 @@ filter_destroy(); /** * @brief Manage pressed keys for filter panel * - * This function is called by UI manager every time a + * This function is called by UI manager every time a * key is pressed. This allow the filter panel to manage - * its own keys. + * its own keys. * If this function return 0, the key will not be handled - * by ui manager. Otherwise the return will be considered + * by ui manager. Otherwise the return will be considered * a key code. * * @param panel Filter panel pointer diff --git a/src/ui_manager.c b/src/ui_manager.c index 7cb7bc0..2d3e93f 100644 --- a/src/ui_manager.c +++ b/src/ui_manager.c @@ -47,7 +47,7 @@ pthread_mutex_t refresh_lock; * This list contein the available list of windows * and pointer to their main functions. * - * XXX If the panel count increase a lot, it will be required to + * XXX If the panel count increase a lot, it will be required to * load panels as modules and provide a way to register * themselfs into the panel pool dynamically. */ @@ -86,7 +86,7 @@ static ui_t panel_pool[] = { int init_interface() { - // Initialize curses + // Initialize curses if (!initscr()) { fprintf(stderr, "Unable to initialize ncurses mode.\n"); return -1; @@ -102,7 +102,7 @@ init_interface() start_color(); toggle_color(is_option_enabled("color")); - // Start showing call list + // Start showing call list wait_for_input(ui_create(ui_find_by_type(MAIN_PANEL))); // End ncurses mode diff --git a/src/ui_manager.h b/src/ui_manager.h index 8b13546..c4de61f 100644 --- a/src/ui_manager.h +++ b/src/ui_manager.h @@ -125,7 +125,7 @@ enum panel_types //! Raw SIP messages ui screen RAW_PANEL, //! Filters panel - FILTER_PANEL, + FILTER_PANEL, }; /** @@ -133,8 +133,8 @@ enum panel_types * * This functions will initialize ncurses mode and show a * Call List panel. - * - * @returns 0 on ncurses initialization success, 1 otherwise + * + * @returns 0 on ncurses initialization success, 1 otherwise */ extern int init_interface(); @@ -152,7 +152,7 @@ extern ui_t * ui_create(ui_t *ui); /** - * @brief Destroy a panel structure + * @brief Destroy a panel structure * * Removes the panel associatet to the given ui and free * its memory. Most part of this task is done in the custom @@ -204,11 +204,11 @@ ui_draw_panel(ui_t *ui); /** * @brief Show help screen from current UI (if any) - * + * * This function will display the help screen for given - * ui if exits. + * ui if exits. * All help screens exits after any character input - * + * * @param ui UI structure */ extern void @@ -250,7 +250,7 @@ toggle_color(int on); * * This function manages all user input in all panel types and * redraws the panel using its own draw function - * + * * @param ui the topmost panel ui structure */ extern int @@ -274,8 +274,8 @@ title_foot_box(WINDOW *win); * * This function is invocked asynchronously from the * ngrep exec thread to notify a new message of the giving - * callid. If the UI is displaying this call or it's - * extended one, the topmost panel will be redraw again + * callid. If the UI is displaying this call or it's + * extended one, the topmost panel will be redraw again * * @param msg Last readed message in Online mode */