nd_gui

Name

nd_gui -- 

Synopsis

void                (*ND_MenuEntryCB)                   (LND_Packet *packet,
                                                         guchar *header,
                                                         int value);
enum                ND_GuiColor;
void                nd_gui_init                         (void);
void                nd_gui_sync_menus                   (void);
void                nd_gui_sync_edit_menu               (void);
void                nd_gui_sync_file_menu               (void);
void                nd_gui_sync_go_menu                 (void);
void                nd_gui_sync_protocol_menu           (void);
void                nd_gui_show_packet_menu             (GdkEventButton *event);
void                nd_gui_show_iterator_mode_menu      (GdkEventButton *event);
void                nd_gui_num_packets_set              (void);
void                nd_gui_set_trace_status             (LND_Trace *trace);
void                nd_gui_iterator_mode_set            (LND_Trace *trace);
void                nd_gui_statusbar_set                (const char *text);
void                nd_gui_statusbar_set_noclear        (const char *text);
gint                nd_gui_statusbar_clear              (gpointer data);
void                nd_gui_pbar_reset                   (int num_total);
void                nd_gui_pbar_inc                     (int num_inc);
void                nd_gui_pbar_clear                   (int interval);
void                nd_gui_pbar_start_activity          (void);
void                nd_gui_pbar_stop_activity           (void);
void                nd_gui_list_freeze                  (LND_Trace *trace);
void                nd_gui_list_thaw                    (LND_Trace *trace);
void                nd_gui_list_set_incomplete_column_visible
                                                        (LND_Trace *trace,
                                                         gboolean visible);
void                nd_gui_list_set_row_incomplete      (LND_Trace *trace,
                                                         int row,
                                                         gboolean incomplete);
void                nd_gui_list_set_row_filtered        (LND_Trace *trace,
                                                         int row,
                                                         gboolean filtered);
void                nd_gui_list_remove_selected_rows    (LND_Trace *trace);
void                nd_gui_list_remove_row              (LND_Trace *trace,
                                                         guint index);
void                nd_gui_list_insert_row              (LND_Packet *packet,
                                                         int index);
void                nd_gui_list_clear                   (LND_Trace *trace);
void                nd_gui_list_update                  (LND_Trace *trace);
void                nd_gui_list_update_packet           (const LND_Packet *packet);
void                nd_gui_list_update_packet_at_index  (const LND_Packet *packet,
                                                         int index);
void                nd_gui_list_select_packet           (LND_Trace *trace,
                                                         guint index);
void                nd_gui_list_unselect_packet         (LND_Trace *trace,
                                                         guint index);
void                nd_gui_list_unselect_all            (LND_Trace *trace,
                                                         gboolean emit_signal);
void                nd_gui_list_select_all              (LND_Trace *trace,
                                                         gboolean emit_signal);
void                nd_gui_list_update_packet_state     (const LND_Packet *packet);
void                nd_gui_list_update_packet_state_at_index
                                                        (const LND_Packet *packet,
                                                         int index);
void                nd_gui_set_windowtitle              (const char *filename);
void                nd_gui_timestamp_schedule           (GtkCList *clist,
                                                         GdkEventMotion *event);
void                nd_gui_timestamp_hide               (void);
void                nd_gui_proto_menu_register          (LND_Protocol *proto);
void                nd_gui_trace_add                    (LND_Trace *trace);
void                nd_gui_trace_remove                 (LND_Trace *trace);
void                nd_gui_trace_new_tab                (LND_Trace *trace);
void                nd_gui_trace_set_name               (LND_Trace *trace);
void                nd_gui_widget_set_color             (GtkWidget *widget,
                                                         ND_GuiColor color);
GtkWidget *         nd_gui_create_menu                  (ND_MenuData *data);
GtkWidget *         nd_gui_proto_table_create           (LND_Trace *trace,
                                                         LND_ProtoInfo *pinf);
void                nd_gui_proto_table_clear            (LND_Trace *trace,
                                                         LND_ProtoInfo *pinf);
void                nd_gui_proto_table_add              (LND_Trace *trace,
                                                         LND_ProtoInfo *pinf,
                                                         ND_ProtoField *field,
                                                         void *data,
                                                         gboolean is_error);
void                nd_gui_proto_table_block_events     (LND_Trace *trace,
                                                         LND_ProtoInfo *pi);
void                nd_gui_proto_table_unblock_events   (LND_Trace *trace,
                                                         LND_ProtoInfo *pi);
void                nd_gui_add_monowidth_widget         (GtkWidget *widget);
void                nd_gui_del_monowidth_widget         (GtkWidget *widget);
void                nd_gui_update_monowidth_widgets     (void);
void                nd_gui_update_view_indicator        (void);
void                nd_gui_update_area_indicator        (void);

Description

Details

ND_MenuEntryCB ()

void                (*ND_MenuEntryCB)                   (LND_Packet *packet,
                                                         guchar *header,
                                                         int value);

Functions of this signature are used for nd_gui_create_menu(). Each menu item supplies a specific header field value, which gets passed to the callback as value. header is automatically set correctly and points to the beginning of the protocol data currently edited when the menu was popped up (including the correct nesting level).

packet :

currently edited packet.

header :

pointer to header structure of currently edited protocol.

value :

the value for the affected header field that is set by the menu item.


enum ND_GuiColor

typedef enum {
  ND_COLOR_BG,
  ND_COLOR_RED,
  ND_COLOR_YELLOW
} ND_GuiColor;


nd_gui_init ()

void                nd_gui_init                         (void);

The function initializes Netdude GUI components, beyond what can be done through Glade, e.g. the progress bar, tooltips etc.


nd_gui_sync_menus ()

void                nd_gui_sync_menus                   (void);

This function sets various GUI elements sensitive or insensitive according to the current packet/trace selection.


nd_gui_sync_edit_menu ()

void                nd_gui_sync_edit_menu               (void);


nd_gui_sync_file_menu ()

void                nd_gui_sync_file_menu               (void);


nd_gui_sync_go_menu ()

void                nd_gui_sync_go_menu                 (void);


nd_gui_sync_protocol_menu ()

void                nd_gui_sync_protocol_menu           (void);


nd_gui_show_packet_menu ()

void                nd_gui_show_packet_menu             (GdkEventButton *event);

This function pops up the packet menu when the user right-clicks a line in the packet list.

event :

mouse event that contains coordinates where to pop up menu.


nd_gui_show_iterator_mode_menu ()

void                nd_gui_show_iterator_mode_menu      (GdkEventButton *event);

This function pops up the packet iteration mode menu when the user clicks on the button in the trace's tab.

event :

mouse event that contains coordinates where to pop up menu.


nd_gui_num_packets_set ()

void                nd_gui_num_packets_set              (void);

The function updates the field in the lower left containing the number of packets of the current trace.


nd_gui_set_trace_status ()

void                nd_gui_set_trace_status             (LND_Trace *trace);

The function adjusts the GUI to reflect the modification status of trace (at the moment this means that the close button of trace is displayed either red or green).

trace :

trace to sync GUI to.


nd_gui_iterator_mode_set ()

void                nd_gui_iterator_mode_set            (LND_Trace *trace);

trace :


nd_gui_statusbar_set ()

void                nd_gui_statusbar_set                (const char *text);

The function sets the statusbar content to text, and schedules a timout that clears the statusbar after a little while.

text :

new statusbar message.


nd_gui_statusbar_set_noclear ()

void                nd_gui_statusbar_set_noclear        (const char *text);

The function sets the statusbar content to text just like nd_gui_statusbar_set(), but doesn't schedule a timeout to clear the bar.

text :

new statusbar message.


nd_gui_statusbar_clear ()

gint                nd_gui_statusbar_clear              (gpointer data);

The function immediately clears the status bar and is used by nd_gui_statusbar_set(). data is not used, nor is the return value, these only exist to make this function usable as a GTK timeout callback.

data :

unused.

Returns :

ignored.


nd_gui_pbar_reset ()

void                nd_gui_pbar_reset                   (int num_total);

The function initializes the progress bar in the lower right part of the main window to num_steps number of steps.

num_total :

number of steps between 0% and 100%.


nd_gui_pbar_inc ()

void                nd_gui_pbar_inc                     (int num_inc);

The function increments the progress bar by num_inc units. The value is bounded by the maximum value specified when nd_gui_pbar_reset() was called, so you cannot pass something "too large" here.

num_inc :

value to add to progress bar.


nd_gui_pbar_clear ()

void                nd_gui_pbar_clear                   (int interval);

The function clears the progress bar in the main window, after waiting the given amount of time if specified.

interval :

delay in milliseconds before the progress bar is cleared.


nd_gui_pbar_start_activity ()

void                nd_gui_pbar_start_activity          (void);

The function starts activity display in the main window, causing a small bar to slide back and forth in the progress bar.


nd_gui_pbar_stop_activity ()

void                nd_gui_pbar_stop_activity           (void);

The function stops activity display in the progress bar.


nd_gui_list_freeze ()

void                nd_gui_list_freeze                  (LND_Trace *trace);

trace :


nd_gui_list_thaw ()

void                nd_gui_list_thaw                    (LND_Trace *trace);

trace :


nd_gui_list_set_incomplete_column_visible ()

void                nd_gui_list_set_incomplete_column_visible
                                                        (LND_Trace *trace,
                                                         gboolean visible);

trace :

visible :


nd_gui_list_set_row_incomplete ()

void                nd_gui_list_set_row_incomplete      (LND_Trace *trace,
                                                         int row,
                                                         gboolean incomplete);

The function adjusts the completeness status in the GUI for the given packet. See also nd_gui_list_incomplete_column_visible(). The function does not adjust any internal structures -- only the GUI.

trace :

trace whose list widget to adjust.

row :

which row to update.

incomplete :

whether to mark the row as an incomplete packet or not.


nd_gui_list_set_row_filtered ()

void                nd_gui_list_set_row_filtered        (LND_Trace *trace,
                                                         int row,
                                                         gboolean filtered);

trace :

trace whose list widget to update.

row :

which row to update.

filtered :

whether to mark the row as filtered or not.


nd_gui_list_remove_selected_rows ()

void                nd_gui_list_remove_selected_rows    (LND_Trace *trace);

The function removes the selected rows from clist. This updates only the widget, no signals are emitted. Use the clist functions for full service.

trace :

trace whose list widget to update.


nd_gui_list_remove_row ()

void                nd_gui_list_remove_row              (LND_Trace *trace,
                                                         guint index);

The function removes the specified row from trace's list widget, (counting starts at zero). This updates only the widget, no signals are emitted. Use the clist functions for full service.

trace :

trace whose list widget to update.

index :

row number to remove.


nd_gui_list_insert_row ()

void                nd_gui_list_insert_row              (LND_Packet *packet,
                                                         int index);

The function inserts the packet's tcpdump data as a new row into the packet trace's list widget.

packet :

packet whose data to insert.

index :

row number of the new line.


nd_gui_list_clear ()

void                nd_gui_list_clear                   (LND_Trace *trace);

The function removes all entries from trace's list widget, without emitting any signals.

trace :

trace whose list widget to update.


nd_gui_list_update ()

void                nd_gui_list_update                  (LND_Trace *trace);

The function refreshes the tcpdump output for trace.

trace :

trace to update.


nd_gui_list_update_packet ()

void                nd_gui_list_update_packet           (const LND_Packet *packet);

The function updates the tcpdump output of packet. The packet is sent anew to the tcpdump process, then the text is updated. Context is always looked up. The completeness column is updated as well.

packet :

packet whose tcpdump output to update.


nd_gui_list_update_packet_at_index ()

void                nd_gui_list_update_packet_at_index  (const LND_Packet *packet,
                                                         int index);

If you know the index of packet in its trace, use this function instead of nd_gui_list_update_packet().

packet :

packet whose tcpdump output to update.

index :

index of packet in trace.


nd_gui_list_select_packet ()

void                nd_gui_list_select_packet           (LND_Trace *trace,
                                                         guint index);

The function selects row index in trace's list widget. A signal is emitted.

trace :

trace to update.

index :

row number to select.


nd_gui_list_unselect_packet ()

void                nd_gui_list_unselect_packet         (LND_Trace *trace,
                                                         guint index);

The function unselects row index in trace's list widget. A signal is emitted.

trace :

trace to update.

index :

row number to unselect.


nd_gui_list_unselect_all ()

void                nd_gui_list_unselect_all            (LND_Trace *trace,
                                                         gboolean emit_signal);

The function unselects all rows in trace's list widget. A signal is emitted depending on emit_signal.

trace :

trace to update.

emit_signal :

whether to emit unselect signals or not.


nd_gui_list_select_all ()

void                nd_gui_list_select_all              (LND_Trace *trace,
                                                         gboolean emit_signal);

The function elects all rows in trace's list widget. A signal is emitted depending on block_signal.

trace :

trace to update.

emit_signal :

whether to emit select signals or not.


nd_gui_list_update_packet_state ()

void                nd_gui_list_update_packet_state     (const LND_Packet *packet);

The function takes the tcpdump output from the list widget and iterates over all protocol in the packet, calling their update_tcpdump_line() implementations.

packet :

packet whose tcpdump output to update.


nd_gui_list_update_packet_state_at_index ()

void                nd_gui_list_update_packet_state_at_index
                                                        (const LND_Packet *packet,
                                                         int index);

If you know the index of packet in its trace, use this function instead of nd_gui_list_update_packet_state().

packet :

packet whose tcpdump output to update.

index :

index of packet in its trace.


nd_gui_set_windowtitle ()

void                nd_gui_set_windowtitle              (const char *filename);

The function displays the given file name in the window title. Depending on the current preferences, the canonical filename or the filename only will be shown.

filename :

new (canonical) filename to display in window title.


nd_gui_timestamp_schedule ()

void                nd_gui_timestamp_schedule           (GtkCList *clist,
                                                         GdkEventMotion *event);

The function schedules timestamp tooltip to be displayed. The delay depends on the user's preferences settings.

clist :

list widget with relevant row.

event :

event containing the coordinates of the mouse.


nd_gui_timestamp_hide ()

void                nd_gui_timestamp_hide               (void);


nd_gui_proto_menu_register ()

void                nd_gui_proto_menu_register          (LND_Protocol *proto);

Protocol plugins can provide a menu for any features they provide. This function takes care of hooking those menus into the main window.

proto :

Protocol providing a menu.


nd_gui_trace_add ()

void                nd_gui_trace_add                    (LND_Trace *trace);

The function adds trace to the GUI. No other internal data structures are touched. However, nd_trace_registry_set_current() is called automatically through the callback that gets activated when the trace is added.

trace :

trace to add to GUI.


nd_gui_trace_remove ()

void                nd_gui_trace_remove                 (LND_Trace *trace);

The function removes trace from the GUI. No other internal data structures are touched.

trace :

trace to remove from GUI:


nd_gui_trace_new_tab ()

void                nd_gui_trace_new_tab                (LND_Trace *trace);

The function creates a new GTK notebook tab for trace and hooks them into the given trace.

trace :

trace for which tab is created.


nd_gui_trace_set_name ()

void                nd_gui_trace_set_name               (LND_Trace *trace);

The function updates the notebook tab label of trace to its current name and whether or not the canonical or the local filename is displayed.

trace :

trace for which tab is updated.


nd_gui_widget_set_color ()

void                nd_gui_widget_set_color             (GtkWidget *widget,
                                                         ND_GuiColor color);

The function changes the color of the given widget by scaling its color values in the desired directions. The actual effect will depend on the GTK theme used. This function is used to implement nd_proto_info_field_set_state().

widget :

widget to modify.

color :

color to use.


nd_gui_create_menu ()

GtkWidget *         nd_gui_create_menu                  (ND_MenuData *data);

The function creates a menu out of the given ND_MenuData array and returns it. The last entry in the array must have a label value of NULL, which is easy since the data array is supposed to be declared statically.

data :

array of ND_MenuDatas.

Returns :

created menu.


nd_gui_proto_table_create ()

GtkWidget *         nd_gui_proto_table_create           (LND_Trace *trace,
                                                         LND_ProtoInfo *pinf);

The function creates a GUI table based upon the specification of a protocol. The result depends on the statically initialized array which the ND_Protocol's 'fields' pointer points to. Its last array entry must contain a NULL value.

trace :

trace to which table belongs.

pinf :

protocol type and nesting.

Returns :

created table, a GtkTable.


nd_gui_proto_table_clear ()

void                nd_gui_proto_table_clear            (LND_Trace *trace,
                                                         LND_ProtoInfo *pinf);

Additional buttons can be added to protocol header tables at any time using nd_gui_proto_table_add(). This is the mechanism to display e.g. IP options etc. To remove any previously added optional buttons, call this function.

trace :

trace to which table belongs.

pinf :

protocol type and nesting.


nd_gui_proto_table_add ()

void                nd_gui_proto_table_add              (LND_Trace *trace,
                                                         LND_ProtoInfo *pinf,
                                                         ND_ProtoField *field,
                                                         void *data,
                                                         gboolean is_error);

The function adds an optional button to the protocol header table of a given protocol. data is used to fill the field label string with the actual value. It depends on the format string in the field structure, what data needs to be passed here. When is_error is TRUE, the button is changed in color accordingly.

trace :

trace to which table belongs.

pinf :

protocol type and nesting.

field :

specification of the field.

data :

arbitrary data passed in as void pointer.

is_error :

whether the header field is in an erroneous state or not.


nd_gui_proto_table_block_events ()

void                nd_gui_proto_table_block_events     (LND_Trace *trace,
                                                         LND_ProtoInfo *pi);

The function blocks all event propagation from the protocol header table for the protocol instance specified in pi. Match this up with nd_gui_proto_table_unblock_events()!

trace :

trace affected.

pi :

protocol type and nesting.


nd_gui_proto_table_unblock_events ()

void                nd_gui_proto_table_unblock_events   (LND_Trace *trace,
                                                         LND_ProtoInfo *pi);

The function unblocks all event propagation from the protocol header table for the protocol instance specified in pi. Use this after blocking the events with nd_gui_proto_table_block_events().

trace :

trace affected.

pi :

protocol type and nesting.


nd_gui_add_monowidth_widget ()

void                nd_gui_add_monowidth_widget         (GtkWidget *widget);

Netdude keeps track of all widgets that need a monowidth font (like all the tcpdump packet lists). Use this function to add a widget to that set.

widget :

widget that uses a monowidth font.


nd_gui_del_monowidth_widget ()

void                nd_gui_del_monowidth_widget         (GtkWidget *widget);

When monowidth widgets get destroyed, make sure you call this function so that Netdude doesn't unnecessarily keep track of them.

widget :

widget to forget.


nd_gui_update_monowidth_widgets ()

void                nd_gui_update_monowidth_widgets     (void);


nd_gui_update_view_indicator ()

void                nd_gui_update_view_indicator        (void);


nd_gui_update_area_indicator ()

void                nd_gui_update_area_indicator        (void);