PERFORCE change 123005 for review

dongmei dongmei at FreeBSD.org
Fri Jul 6 10:00:59 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=123005

Change 123005 by dongmei at dongmei-soc2007-home on 2007/07/06 10:00:08

	add the function which can parse trail file in list view and tree view

Affected files ...

.. //depot/projects/soc2007/dongmei-auditanalyzer/buffer.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/buffer.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/except.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/except.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/exceptions.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/file_access.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/file_util.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/file_util.h#3 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/file_wrappers.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/filesystem.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/filesystem.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/Makefile#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/Todo#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/auanalyzer.core#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/compat_macros.h#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/file_dlg.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/file_dlg.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/gtkglobals.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/gui_utils.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/gui_utils.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/keys.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/list_view.c#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/list_view.h#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/main.c#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/menu.c#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/menu.h#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/progress_dlg.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/simple_dialog.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/trail_file_dlg.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/trail_file_dlg.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/tree_view.c#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/tree_view.h#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/image/stock_dialog_error_48.xpm#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/image/stock_dialog_info_48.xpm#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/image/stock_dialog_question_48.xpm#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/image/stock_dialog_stop_48.xpm#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/image/stock_dialog_warning_48.xpm#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/progress_dlg.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/simple_dialog.h#3 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/strerror.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/strerror.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/tfile.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/tfile.h#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/tsess.c#1 add
.. //depot/projects/soc2007/dongmei-auditanalyzer/tsess.h#1 add

Differences ...

==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/Makefile#2 (text+ko) ====


==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/compat_macros.h#2 (text+ko) ====

@@ -1,5 +1,25 @@
 /* compat_macros.h
  * GTK-related Global defines, etc.
+ *
+ * $Id: compat_macros.h 19924 2006-11-18 01:47:49Z gerald $
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald at wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
 #ifndef __COMPAT_MACROS_H__
@@ -294,6 +314,86 @@
 #define ITEM_FACTORY_STOCK_ENTRY(path, accelerator, callback, action, data) \
 {path, accelerator, GTK_MENU_FUNC(callback), action, "<StockItem>", data}
 
+#ifdef HAVE_LIBPCAP
+#define WIRESHARK_STOCK_LABEL_CAPTURE_INTERFACES       "_Interfaces"
+#define WIRESHARK_STOCK_LABEL_CAPTURE_AIRPCAP          "_Wireless"
+#define WIRESHARK_STOCK_LABEL_CAPTURE_OPTIONS          "_Options"
+#define WIRESHARK_STOCK_LABEL_CAPTURE_START            "_Start"
+#define WIRESHARK_STOCK_LABEL_CAPTURE_STOP             "S_top"
+#define WIRESHARK_STOCK_LABEL_CAPTURE_RESTART          "_Restart"
+#define WIRESHARK_STOCK_LABEL_CAPTURE_FILTER           "_CFilter"
+#define WIRESHARK_STOCK_LABEL_CAPTURE_FILTER_ENTRY     "_Capture Filter:"
+#define WIRESHARK_STOCK_LABEL_CAPTURE_DETAILS          "_Details"
+#endif
+#define WIRESHARK_STOCK_LABEL_DISPLAY_FILTER           "_Filter"
+#define WIRESHARK_STOCK_LABEL_DISPLAY_FILTER_ENTRY     "_Filter:"
+#define WIRESHARK_STOCK_LABEL_PREFS                    "_Prefs"
+#define WIRESHARK_STOCK_LABEL_BROWSE                   "_Browse..."
+#define WIRESHARK_STOCK_LABEL_CREATE_STAT              "Create _Stat"
+#define WIRESHARK_STOCK_LABEL_EXPORT                   "_Export..."
+#define WIRESHARK_STOCK_LABEL_IMPORT                   "_Import..."
+#define WIRESHARK_STOCK_LABEL_EDIT                     "_Edit..."
+#define WIRESHARK_STOCK_LABEL_ADD_EXPRESSION           "_Expression..." /* plus sign coming from icon */
+#define WIRESHARK_STOCK_LABEL_DONT_SAVE                "Continue _without Saving"
+#define WIRESHARK_STOCK_LABEL_ABOUT                    "_About"
+#define WIRESHARK_STOCK_LABEL_COLORIZE                 "_Colorize"
+#define WIRESHARK_STOCK_LABEL_AUTOSCROLL               "_Auto Scroll in Live Capture"
+#define WIRESHARK_STOCK_LABEL_RESIZE_COLUMNS           "Resize Columns"
+#define WIRESHARK_STOCK_LABEL_TIME                     "Time"
+#define WIRESHARK_STOCK_LABEL_INTERNET                 "Internet"
+#define WIRESHARK_STOCK_LABEL_WEB_SUPPORT              "Web Support"
+#define WIRESHARK_STOCK_LABEL_WIKI                     "Wiki"
+#define WIRESHARK_STOCK_LABEL_CONVERSATIONS            "Conversations"
+#define WIRESHARK_STOCK_LABEL_ENDPOINTS                "Endpoints"
+#define WIRESHARK_STOCK_LABEL_GRAPHS                   "Graphs"
+#define WIRESHARK_STOCK_LABEL_TELEPHONY                "Telephony"
+#define WIRESHARK_STOCK_LABEL_DECODE_AS                "Decode As"
+#define WIRESHARK_STOCK_LABEL_CHECKBOX                 "Checkbox"
+#define WIRESHARK_STOCK_LABEL_FILE_SET_LIST            "List Files"
+#define WIRESHARK_STOCK_LABEL_FILE_SET_NEXT            "Next File"
+#define WIRESHARK_STOCK_LABEL_FILE_SET_PREVIOUS        "Previous File"
+#define WIRESHARK_STOCK_LABEL_FILTER_OUT_STREAM        "Filter Out This Stream"
+
+#ifdef HAVE_LIBPCAP
+#define WIRESHARK_STOCK_CAPTURE_INTERFACES       "Wireshark_Stock_CaptureInterfaces"
+#define WIRESHARK_STOCK_CAPTURE_AIRPCAP			 "Wireshark_Stock_CaptureAirpcap"
+#define WIRESHARK_STOCK_CAPTURE_OPTIONS          "Wireshark_Stock_CaptureOptionss"
+#define WIRESHARK_STOCK_CAPTURE_START            "Wireshark_Stock_CaptureStart"
+#define WIRESHARK_STOCK_CAPTURE_STOP             "Wireshark_Stock_CaptureStop"
+#define WIRESHARK_STOCK_CAPTURE_RESTART          "Wireshark_Stock_CaptureRestart"
+#define WIRESHARK_STOCK_CAPTURE_FILTER           "Wireshark_Stock_CaptureFilter"
+#define WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY     "Wireshark_Stock_CaptureFilter_Entry"
+#define WIRESHARK_STOCK_CAPTURE_DETAILS          "Wireshark_Stock_CaptureDetails"
+#endif
+#define WIRESHARK_STOCK_DISPLAY_FILTER           "Wireshark_Stock_DisplayFilter"
+#define WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY     "Wireshark_Stock_DisplayFilter_Entry"
+#define WIRESHARK_STOCK_PREFS                    "Wireshark_Stock_Prefs"
+#define WIRESHARK_STOCK_BROWSE                   "Wireshark_Stock_Browse"
+#define WIRESHARK_STOCK_CREATE_STAT              "Wireshark_Stock_CreateStat"
+#define WIRESHARK_STOCK_EXPORT                   "Wireshark_Stock_Export"
+#define WIRESHARK_STOCK_IMPORT                   "Wireshark_Stock_Import"
+#define WIRESHARK_STOCK_EDIT                     "Wireshark_Stock_Edit"
+#define WIRESHARK_STOCK_ADD_EXPRESSION           "Wireshark_Stock_Edit_Add_Expression"
+#define WIRESHARK_STOCK_DONT_SAVE                "Wireshark_Stock_Continue_without_Saving"
+#define WIRESHARK_STOCK_ABOUT                    "Wireshark_Stock_About"
+#define WIRESHARK_STOCK_COLORIZE                 "Wireshark_Stock_Colorize"
+#define WIRESHARK_STOCK_AUTOSCROLL               "Wireshark_Stock_Autoscroll"
+#define WIRESHARK_STOCK_RESIZE_COLUMNS           "Wireshark_Stock_Resize_Columns"
+#define WIRESHARK_STOCK_TIME                     "Wireshark_Stock_Time"
+#define WIRESHARK_STOCK_INTERNET                 "Wireshark_Stock_Internet"
+#define WIRESHARK_STOCK_WEB_SUPPORT              "Wireshark_Stock_Web_Support"
+#define WIRESHARK_STOCK_WIKI                     "Wireshark_Stock_Wiki"
+#define WIRESHARK_STOCK_CONVERSATIONS            "Wireshark_Stock_Conversations"
+#define WIRESHARK_STOCK_ENDPOINTS                "Wireshark_Stock_Endpoints"
+#define WIRESHARK_STOCK_GRAPHS                   "Wireshark_Stock_Graphs"
+#define WIRESHARK_STOCK_TELEPHONY                "Wireshark_Stock_Telephony"
+#define WIRESHARK_STOCK_DECODE_AS                "Wireshark_Stock_DecodeAs"
+#define WIRESHARK_STOCK_CHECKBOX                 "Wireshark_Stock_Checkbox"
+#define WIRESHARK_STOCK_FILE_SET_LIST            "Wireshark_Stock_File_Set_List"
+#define WIRESHARK_STOCK_FILE_SET_NEXT            "Wireshark_Stock_File_Set_Next"
+#define WIRESHARK_STOCK_FILE_SET_PREVIOUS        "Wireshark_Stock_File_Set_Previous"
+#define WIRESHARK_STOCK_FILTER_OUT_STREAM        "Wireshark_Stock_Filter_Out_This_Stream"
+
 #define BUTTON_NEW_FROM_STOCK(stock_id) \
 gtk_button_new_from_stock(stock_id);
 

==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/list_view.c#2 (text+ko) ====

@@ -8,157 +8,133 @@
  */
 
 #include <gtk/gtk.h>
+#include <bsm/libbsm.h>
+#include <string.h>
+#include "compat_macros.h"
+#include "../tfile.h"
 
+extern trailer_file cfile;
 static GtkWidget *window = NULL;
 
-typedef struct
-{
-  const gboolean  fixed;
-  const guint     number;
-  const gchar    *severity;
-  const gchar    *description;
-}
-Bug;
-
 enum
 {
-  COLUMN_FIXED,
   COLUMN_NUMBER,
-  COLUMN_SEVERITY,
-  COLUMN_DESCRIPTION,
+  COLUMN_CREATE_TIME,
+  COLUMN_MS,
+  COLUMN_EVENT,
+  COLUMN_VERSION,
+  COLUMN_RECORD_LEN,
   NUM_COLUMNS
 };
 
-static Bug data[] =
-{
-  { FALSE, 60482, "Normal",     "scrollable notebooks and hidden tabs" },
-  { FALSE, 60620, "Critical",   "gdk_window_clear_area (gdkwindow-win32.c) is not thread-safe" },
-  { FALSE, 50214, "Major",      "Xft support does not clean up correctly" },
-  { TRUE,  52877, "Major",      "GtkFileSelection needs a refresh method. " },
-  { FALSE, 56070, "Normal",     "Can't click button after setting in sensitive" },
-  { TRUE,  56355, "Normal",     "GtkLabel - Not all changes propagate correctly" },
-  { FALSE, 50055, "Normal",     "Rework width/height computations for TreeView" },
-  { FALSE, 58278, "Normal",     "gtk_dialog_set_response_sensitive () doesn't work" },
-  { FALSE, 55767, "Normal",     "Getters for all setters" },
-  { FALSE, 56925, "Normal",     "Gtkcalender size" },
-  { FALSE, 56221, "Normal",     "Selectable label needs right-click copy menu" },
-  { TRUE,  50939, "Normal",     "Add shift clicking to GtkTextView" },
-  { FALSE, 6112,  "Enhancement","netscape-like collapsable toolbars" },
-  { FALSE, 1,     "Normal",     "First bug :=)" },
-};
+//GtkWidget *record_list;
+
+GtkListStore *record_list;
 
 static GtkTreeModel *
 create_model (void)
 {
   gint i = 0;
-  GtkListStore *store;
-  GtkTreeIter iter;
-
   /* create list store */
-  store = gtk_list_store_new (NUM_COLUMNS,
-			      G_TYPE_BOOLEAN,
-			      G_TYPE_UINT,
-			      G_TYPE_STRING,
-			      G_TYPE_STRING);
+  record_list = gtk_list_store_new (NUM_COLUMNS,
+			      G_TYPE_INT,
+			      G_TYPE_INT,
+			      G_TYPE_INT,
+			      G_TYPE_INT,
+			      G_TYPE_INT,
+			      G_TYPE_INT);
 
-  /* add data to the list store */
-  for (i = 0; i < G_N_ELEMENTS (data); i++)
-    {
-      gtk_list_store_append (store, &iter);
-      gtk_list_store_set (store, &iter,
-			  COLUMN_FIXED, data[i].fixed,
-			  COLUMN_NUMBER, data[i].number,
-			  COLUMN_SEVERITY, data[i].severity,
-			  COLUMN_DESCRIPTION, data[i].description,
-			  -1);
-    }
-
-  return GTK_TREE_MODEL (store);
+  return GTK_TREE_MODEL (record_list);
 }
 
 static void
-fixed_toggled (GtkCellRendererToggle *cell,
-	       gchar                 *path_str,
-	       gpointer               data)
-{
-  GtkTreeModel *model = (GtkTreeModel *)data;
-  GtkTreeIter  iter;
-  GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
-  gboolean fixed;
-
-  /* get toggled iter */
-  gtk_tree_model_get_iter (model, &iter, path);
-  gtk_tree_model_get (model, &iter, COLUMN_FIXED, &fixed, -1);
-
-  /* do something with the value */
-  fixed ^= 1;
-
-  /* set new value */
-  gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_FIXED, fixed, -1);
-
-  /* clean up */
-  gtk_tree_path_free (path);
-}
-
-static void
 add_columns (GtkTreeView *treeview)
 {
   GtkCellRenderer *renderer;
   GtkTreeViewColumn *column;
   GtkTreeModel *model = gtk_tree_view_get_model (treeview);
 
-  /* column for fixed toggles */
-  renderer = gtk_cell_renderer_toggle_new ();
-  g_signal_connect (renderer, "toggled",
-		    G_CALLBACK (fixed_toggled), model);
+  /* column for numbers */
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes ("No",
+						     renderer,
+						     "text",
+						     COLUMN_NUMBER,
+						     NULL);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_NUMBER);
+  gtk_tree_view_append_column (treeview, column);
 
-  column = gtk_tree_view_column_new_with_attributes ("Fixed?",
+  /* column for Create Time */
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes ("Create Time",
 						     renderer,
-						     "active", COLUMN_FIXED,
+						     "text",
+						     COLUMN_CREATE_TIME,
 						     NULL);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_CREATE_TIME);
+  gtk_tree_view_append_column (treeview, column);
 
-  /* set this column to a fixed sizing (of 50 pixels) */
-  gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
-				   GTK_TREE_VIEW_COLUMN_FIXED);
-  gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
+  /* column for Millisecond */
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes ("Millisecond",
+						     renderer,
+						     "text",
+						     COLUMN_MS,
+						     NULL);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_MS);
   gtk_tree_view_append_column (treeview, column);
 
-  /* column for bug numbers */
+  /* column for EVENT */
   renderer = gtk_cell_renderer_text_new ();
-  column = gtk_tree_view_column_new_with_attributes ("Bug number",
+  column = gtk_tree_view_column_new_with_attributes ("Event",
 						     renderer,
 						     "text",
-						     COLUMN_NUMBER,
+						     COLUMN_EVENT,
 						     NULL);
-  gtk_tree_view_column_set_sort_column_id (column, COLUMN_NUMBER);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_EVENT);
   gtk_tree_view_append_column (treeview, column);
-
-  /* column for severities */
+  
+  /* column for Version */
   renderer = gtk_cell_renderer_text_new ();
-  column = gtk_tree_view_column_new_with_attributes ("Severity",
+  column = gtk_tree_view_column_new_with_attributes ("Version",
 						     renderer,
 						     "text",
-						     COLUMN_SEVERITY,
+						     COLUMN_VERSION,
 						     NULL);
-  gtk_tree_view_column_set_sort_column_id (column, COLUMN_SEVERITY);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_VERSION);
   gtk_tree_view_append_column (treeview, column);
-
-  /* column for description */
+  
+  /* column for Record length */
   renderer = gtk_cell_renderer_text_new ();
-  column = gtk_tree_view_column_new_with_attributes ("Description",
+  column = gtk_tree_view_column_new_with_attributes ("Record length",
 						     renderer,
 						     "text",
-						     COLUMN_DESCRIPTION,
+						     COLUMN_RECORD_LEN,
 						     NULL);
-  gtk_tree_view_column_set_sort_column_id (column, COLUMN_DESCRIPTION);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_RECORD_LEN);
   gtk_tree_view_append_column (treeview, column);
+
 }
+void 
+record_list_select_cb(GtkTreeSelection *treeselection,
+                                                        gpointer          user_data)
+{
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	if (gtk_tree_selection_get_selected(treeselection,&model,&iter))
+	{		
+		gint num;
+		gtk_tree_model_get(model,&iter,COLUMN_NUMBER,&num,-1);
+		tf_select_record(&cfile,num);
+		printf("num=%d\n",num);
+	}
+}                                                        
 GtkWidget *
 create_list()
 {
 	GtkTreeModel *model;
-	GtkWidget *treeview;
-
+ 	GtkWidget *treeview;
+	GtkTreeSelection *treeselection;
 	  /* create tree model */
 	model = create_model ();
 
@@ -166,47 +142,47 @@
 	treeview = gtk_tree_view_new_with_model (model);
 	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
 	gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
-				   COLUMN_DESCRIPTION);
+				   COLUMN_EVENT);
+	treeselection=gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+	
+    SIGNAL_CONNECT(treeselection, "changed", record_list_select_cb, NULL);
 
 	g_object_unref (model);
 	/* add columns to the tree view */
 	add_columns (GTK_TREE_VIEW (treeview));
 	return treeview;
 }
-/* Add some text to our text widget - this is a callback that is invoked
-when our window is realized. We could also force our window to be
-realized with gtk_widget_realize, but it would have to be part of
-a hierarchy first */
 
-void insert_text (GtkTextBuffer *buffer)
+void 
+record_list_clear(void)
 {
-   GtkTextIter iter;
- 
-   gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
+	gtk_list_store_clear(record_list);
+}
 
-   gtk_text_buffer_insert (buffer, &iter,   
-    "audit analyzer", -1);
+int
+print_sec32(char *timestr,u_int32_t sec)
+{
+	time_t timestamp;
+	timestamp = (time_t)sec;
+	ctime_r(&timestamp, timestr);
+	timestr[24] = '\0'; /* No new line */
+	return 0;
 }
-   
-/* Create a scrolled text area that displays a "message" */
-GtkWidget *create_text( void )
+
+void
+record_list_append(tokenstr_t *data,gint number)
 {
-   GtkWidget *scrolled_window;
-   GtkWidget *view;
-   GtkTextBuffer *buffer;
+	GtkTreeIter iter;
+	/* add data to the list store */
+	gtk_list_store_append (record_list, &iter);
+	gtk_list_store_set (record_list, &iter,
+		  COLUMN_NUMBER, number,
+		  COLUMN_CREATE_TIME,data->tt.hdr32.s,
+		  COLUMN_MS,data->tt.hdr32.ms,
+		  COLUMN_EVENT,data->tt.hdr32.e_type,
+		  COLUMN_VERSION,data->tt.hdr32.version,
+		  COLUMN_RECORD_LEN,data->tt.hdr32.size,
+		  -1);
 
-   view = gtk_text_view_new ();
-   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
-   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
+}
 
-   gtk_container_add (GTK_CONTAINER (scrolled_window), view);
-   insert_text (buffer);
-
-   gtk_widget_show_all (scrolled_window);
-
-   return scrolled_window;
-}

==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/list_view.h#2 (text+ko) ====


==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/main.c#2 (text+ko) ====

@@ -6,9 +6,11 @@
 
 #include <gtk/gtk.h>
 #include <glib/gstdio.h>
+#include "../tfile.h"
 #include "list_view.h"
 #include "tree_view.h"
 
+trailer_file cfile;
 
 GtkWidget   *top_level = NULL,*list_view,*tree_view,*list_sw,*tree_sw;
 static GtkWidget   *menubar, *main_vbox, *main_tb, *pkt_scrollw, *stat_hbox, *filter_tb;
@@ -38,7 +40,7 @@
     gtk_toolbar_set_orientation(GTK_TOOLBAR(main_tb),
                                 GTK_ORIENTATION_HORIZONTAL);
 	/* our first item is <close> button */
-	iconw = gtk_image_new_from_file ("../image/toolbar/close.xpm"); /* icon widget */
+	iconw = gtk_image_new_from_file ("image/toolbar/close.xpm"); /* icon widget */
 	close_button = 
 	gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), /* our toolbar */
 							 "Close",               /* button label */
@@ -179,6 +181,7 @@
     GtkWidget *vpaned;
  
     gtk_init (&argc, &argv);
+    init_trail_file(&cfile);
 	create_main_window();
 	show_main_window();
     gtk_main ();

==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/menu.c#2 (text+ko) ====

@@ -1,6 +1,7 @@
 #include <gtk/gtk.h>
 #include <string.h>
 #include "compat_macros.h"
+#include "trail_file_dlg.h" 
 
 #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
 
@@ -8,9 +9,9 @@
 static GtkItemFactoryEntry menu_items[] =
 {
     ITEM_FACTORY_ENTRY("/_File", NULL, NULL, 0, "<Branch>", NULL),
-/*    ITEM_FACTORY_STOCK_ENTRY("/File/_Open...", "<control>O", file_open_cmd_cb,
+    ITEM_FACTORY_STOCK_ENTRY("/File/_Open...", "<control>O", file_open_cmd_cb,
                              0, GTK_STOCK_OPEN),
-    ITEM_FACTORY_STOCK_ENTRY("/File/_Quit", "<control>Q", file_quit_cmd_cb,
+/*    ITEM_FACTORY_STOCK_ENTRY("/File/_Quit", "<control>Q", file_quit_cmd_cb,
                              0, GTK_STOCK_QUIT),
 */
     ITEM_FACTORY_ENTRY("/_Edit", NULL, NULL, 0, "<Branch>", NULL),

==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/menu.h#2 (text+ko) ====


==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/tree_view.c#2 (text+ko) ====

@@ -7,248 +7,489 @@
  * example first.
  *
  */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include <gtk/gtk.h>
+#include <glib.h>
+#include <glib/gprintf.h>
+#include <bsm/libbsm.h>
+#include "../tfile.h"
 
 static GtkWidget *window = NULL;
+GtkTreeStore *record_tree;
 
-/* TreeItem structure */
-typedef struct _TreeItem TreeItem;
-struct _TreeItem
-{
-  const gchar    *label;
-  gboolean        alex;
-  gboolean        havoc;
-  gboolean        tim;
-  gboolean        owen;
-  gboolean        dave;
-  gboolean        world_holiday; /* shared by the European hackers */
-  TreeItem       *children;
-};
-
 /* columns */
 enum
 {
-  HOLIDAY_NAME_COLUMN = 0,
-  ALEX_COLUMN,
-  HAVOC_COLUMN,
-  TIM_COLUMN,
-  OWEN_COLUMN,
-  DAVE_COLUMN,
-
-  VISIBLE_COLUMN,
-  WORLD_COLUMN,
+  TOKEN_DETAIL_COLUMN = 0,
   NUM_COLUMNS
 };
 
-/* tree data */
-static TreeItem january[] =
+static GtkTreeModel *
+create_model (void)
 {
-  {"New Years Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
-  {"Presidential Inauguration", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
-  {"Martin Luther King Jr. day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
-  { NULL }
-};
+  /* create tree store */
+  record_tree= gtk_tree_store_new (NUM_COLUMNS,
+			      G_TYPE_STRING);
 
-static TreeItem february[] =
+  return GTK_TREE_MODEL (record_tree);
+}
+/*
+ * Prints a single byte in the given format.
+ */
+static void
+sprint_1_byte(gchar **str, u_char val, const gchar *label)
 {
-  { "Presidents' Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
-  { "Groundhog Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Valentine's Day", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, NULL },
-  { NULL }
-};
+	*str=(gchar *)malloc(sizeof(label)+50);
+	g_sprintf(*str,"%s:%u\0",label,val);
+}
 
-static TreeItem march[] =
+/*
+ * Print 2 bytes in the given format.
+ */
+static void
+sprint_2_bytes(gchar **str, u_int16_t val, const gchar *label)
 {
-  { "National Tree Planting Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "St Patrick's Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
-  { NULL }
-};
-static TreeItem april[] =
+	*str=(gchar *)malloc(sizeof(label)+50);
+	g_sprintf(str,"%s:%u\0",label,val);
+}
+
+/*
+ * Prints 4 bytes in the given format.
+ */
+static void
+sprint_4_bytes(gchar **str, u_int32_t val, const gchar *label)
 {
-  { "April Fools' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
-  { "Army Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Earth Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
-  { "Administrative Professionals' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { NULL }
-};
+	*str=(gchar *)malloc(sizeof(label)+50);
+	g_sprintf(*str,"%s:%u\0",label,val);
+}
 
-static TreeItem may[] =
+/*
+ * Prints 8 bytes in the given format.
+ */
+static void
+sprint_8_bytes(gchar **str, u_int64_t val, const gchar *label)
 {
-  { "Nurses' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "National Day of Prayer", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Mothers' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
-  { "Armed Forces Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Memorial Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
-  { NULL }
-};
+	*str=(gchar *)malloc(sizeof(label)+50);
+	g_sprintf(*str,"%s:%llu\0",label,val);
+}
 
-static TreeItem june[] =
+/*
+ * Prints the given size of data bytes in hex.
+ */
+static void
+sprint_mem(gchar **str, u_char *data, size_t len)
 {
-  { "June Fathers' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
-  { "Juneteenth (Liberation of Slaves)", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Flag Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
-  { NULL }
-};
+	*str=(gchar *)malloc(len+1);
+	int i;
 
-static TreeItem july[] =
-{
-  { "Parents' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
-  { "Independence Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
-  { NULL }
-};
+	if (len > 0) {
+		g_sprintf(*str, "0x");
+		for (i = 0; i < len; i++)
+			g_sprintf(*str, "%x", data[i]);
+	}
+}
 
-static TreeItem august[] =
+/*
+ * Prints the given data bytes as a string.
+ */
+static void
+sprint_string(gchar **dstr, const char *sstr, size_t len, const gchar *label)
 {
-  { "Air Force Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Coast Guard Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Friendship Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { NULL }
-};
-
-static TreeItem september[] =
+	int i;
+	*dstr=(gchar *)malloc(len+1+sizeof(label));
+	g_sprintf(dstr,"%s:",label);
+	if (len > 0) {
+		for (i = 0; i < len; i++) {
+			if (sstr[i] != '\0')
+				g_sprintf(*dstr, "%c", sstr[i]);
+		}
+	}
+}
+/*
+ * Prints seconds in the ctime format.
+ */
+static void
+sprint_sec32(gchar **str, u_int32_t sec, const gchar *label)
 {
-  { "Grandparents' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
-  { "Citizenship Day or Constitution Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Labor Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
-  { NULL }
-};
+	time_t timestamp;
+	char timestr[26];
+	*str=(gchar *)malloc(sizeof(label)+1+26);
+	timestamp = (time_t)sec;
+	ctime_r(&timestamp, timestr);
+	timestr[24] = '\0'; /* No new line */
+	g_sprintf(*str,"%s:%s",label,timestr);
+}
 
-static TreeItem october[] =
+/*
+ * XXXRW: 64-bit token streams make use of 64-bit time stamps; since we
+ * assume a 32-bit time_t, we simply truncate for now.
+ */
+static void
+sprint_sec64(gchar **str, u_int64_t sec,const gchar *label)
 {
-  { "National Children's Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Bosses' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Sweetest Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Mother-in-Law's Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Navy Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Columbus Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
-  { "Halloween", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
-  { NULL }
-};
+	time_t timestamp;
+	char timestr[26];
+	*str=(gchar *)malloc(sizeof(label)+1+26);
+	timestamp = (time_t)sec;
+	ctime_r(&timestamp, timestr);
+	timestr[24] = '\0'; /* No new line */
+	g_sprintf(*str,"%s:%s",label,timestr);
+}
 
-static TreeItem november[] =
+/*
+ * Prints the excess milliseconds.
+ */
+static void
+sprint_msec32(gchar **str, u_int32_t msec, const gchar *label)
 {
-  { "Marine Corps Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Veterans' Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
-  { "Thanksgiving", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
-  { NULL }
-};
+	*str=(gchar *)malloc(sizeof(label)+1+50);
+	g_sprintf(*str,"%s:+ %u msec",label,msec);
+}
 
-static TreeItem december[] =
+/*
+ * XXXRW: 64-bit token streams make use of 64-bit time stamps; since we assume
+ * a 32-bit msec, we simply truncate for now.
+ */
+static void
+sprint_msec64(gchar **str, u_int64_t msec, const gchar *label)
 {
-  { "Pearl Harbor Remembrance Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { "Christmas", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
-  { "Kwanzaa", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
-  { NULL }
-};
-
-
-static TreeItem toplevel[] =
+	*str=(gchar *)malloc(sizeof(label)+1+50);
+	msec &= 0xffffffff;
+	g_sprintf(*str,"%s:+ %u msec",label,(u_int32_t)msec);
+}
+#define IP_V4_ADDRESS_LEN  20
+#define IP_V6_ADDRESS_LEN 25
+/*
+ * Prints a dotted form for the IP address.
+ */
+static void
+sprint_ip_address(gchar **str, u_int32_t ip,const gchar *label)
 {
-  {"January", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, january},
-  {"February", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, february},
-  {"March", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, march},
-  {"April", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, april},
-  {"May", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, may},
-  {"June", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, june},
-  {"July", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, july},
-  {"August", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, august},
-  {"September", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, september},
-  {"October", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, october},
-  {"November", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, november},
-  {"December", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, december},
-  {NULL}
-};
+	struct in_addr ipaddr;
+	*str=(gchar *)malloc(sizeof(label)+1+IP_V4_ADDRESS_LEN);
+	ipaddr.s_addr = ip;
+	g_sprintf(*str,"%s:%s",label,inet_ntoa(ipaddr));
+}
 
-
-static GtkTreeModel *
-create_model (void)
+/*
+ * Prints a string value for the given ip address.
+ */
+static void
+sprint_ip_ex_address(gchar **str, u_int32_t type, u_int32_t *ipaddr,const gchar *label)
 {
-  GtkTreeStore *model;
-  GtkTreeIter iter;
-  TreeItem *month = toplevel;
+	struct in_addr ipv4;
+	struct in6_addr ipv6;
+	char dst[INET6_ADDRSTRLEN];
+	*str=(gchar *)malloc(sizeof(label)+1+IP_V6_ADDRESS_LEN);
+	
+	switch (type) {
+	case AU_IPv4:
+		ipv4.s_addr = (in_addr_t)(ipaddr[0]);
+		g_sprintf(*str,"%s:%s",label,inet_ntop(AF_INET, &ipv4, dst,
+		    INET6_ADDRSTRLEN));
+		break;
 
-  /* create tree store */
-  model = gtk_tree_store_new (NUM_COLUMNS,
-			      G_TYPE_STRING,
-			      G_TYPE_BOOLEAN,
-			      G_TYPE_BOOLEAN,
-			      G_TYPE_BOOLEAN,
-			      G_TYPE_BOOLEAN,
-			      G_TYPE_BOOLEAN,
-			      G_TYPE_BOOLEAN,
-			      G_TYPE_BOOLEAN);
+	case AU_IPv6:
+		bcopy(ipaddr, &ipv6, sizeof(ipv6));
+		g_sprintf(*str, "%s:%s",label, inet_ntop(AF_INET6, &ipv6, dst,
+		    INET6_ADDRSTRLEN));
+		break;
 
-  /* add data to the tree store */
-  while (month->label)
-    {
-      TreeItem *holiday = month->children;
-
-      gtk_tree_store_append (model, &iter, NULL);
-      gtk_tree_store_set (model, &iter,
-			  HOLIDAY_NAME_COLUMN, month->label,
-			  ALEX_COLUMN, FALSE,
-			  HAVOC_COLUMN, FALSE,
-			  TIM_COLUMN, FALSE,
-			  OWEN_COLUMN, FALSE,
-			  DAVE_COLUMN, FALSE,
-			  VISIBLE_COLUMN, FALSE,
-			  WORLD_COLUMN, FALSE,
-			  -1);
-
-      /* add children */
-      while (holiday->label)
-	{
-	  GtkTreeIter child_iter;
-
-	  gtk_tree_store_append (model, &child_iter, &iter);
-	  gtk_tree_store_set (model, &child_iter,
-			      HOLIDAY_NAME_COLUMN, holiday->label,
-			      ALEX_COLUMN, holiday->alex,
-			      HAVOC_COLUMN, holiday->havoc,
-			      TIM_COLUMN, holiday->tim,
-			      OWEN_COLUMN, holiday->owen,
-			      DAVE_COLUMN, holiday->dave,
-			      VISIBLE_COLUMN, TRUE,
-			      WORLD_COLUMN, holiday->world_holiday,
-			      -1);
-
-	  holiday++;
+	default:
+		g_sprintf(*str, "%s:invalid",label);
 	}
+}
+#define RETVAL_MAX_LEN	128
+/*
+ * Prints return value as success or failure.
+ */
+static void
+sprint_retval(gchar **str, u_char status, const gchar *label)
+{
+	*str=(gchar *)malloc(sizeof(label)+1+RETVAL_MAX_LEN);
 
-      month++;
-    }
+	if (status == 0)
+		g_sprintf(*str, "%s:success",label);
+	else
+		g_sprintf(*str, "%s:failure : %s",label, strerror(status));
+}
 
-  return GTK_TREE_MODEL (model);
+/*
+ * Prints the exit value.
+ */
+static void
+sprint_errval(gchar **str, u_int32_t val,const gchar *label)
+{
+	*str=(gchar *)malloc(sizeof(label)+1+RETVAL_MAX_LEN);
+	g_sprintf(*str, "%s:Error %u",label, val);
 }
 
+/*
+ * Prints IPC type.
+ */
 static void
-item_toggled (GtkCellRendererToggle *cell,
-	      gchar                 *path_str,
-	      gpointer               data)
+sprint_ipctype(gchar **str, u_char type, const gchar *label)
 {
-  GtkTreeModel *model = (GtkTreeModel *)data;
-  GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
-  GtkTreeIter iter;
-  gboolean toggle_item;
+	if (type == AT_IPC_MSG)
+		g_sprintf(*str, "%s:Message IPC",label);
+	else if (type == AT_IPC_SEM)
+		g_sprintf(*str, "%s:Semaphore IPC",label);
+	else if (type == AT_IPC_SHM)
+		g_sprintf(*str, "%s:Shared Memory IPC",label);
+	else
+		g_sprintf(*str, "%s:%u", label,type);
+}
 
-  gint *column;
+/*
+ * Prints the event from the header token in either the short, default or raw
+ * form.
+ */
+static void
+sprint_event(gchar **event_name, u_int16_t ev,const gchar *label)
+{
+	char event_ent_name[AU_EVENT_NAME_MAX];
+	char event_ent_desc[AU_EVENT_DESC_MAX];
+	struct au_event_ent e, *ep;
+	*event_name=(gchar *)malloc(sizeof(label)+1+AU_EVENT_NAME_MAX);
+	bzero(&e, sizeof(e));
+	bzero(event_ent_name, sizeof(event_ent_name));
+	bzero(event_ent_desc, sizeof(event_ent_desc));
+	e.ae_name = event_ent_name;
+	e.ae_desc = event_ent_desc;
 
-  column = g_object_get_data (G_OBJECT (cell), "column");
+	ep = getauevnum_r(&e, ev);
+	if (ep == NULL) {
+		g_sprintf(*event_name, "%s:%u", label, ev);
+		return;
+	}
+	g_sprintf(*event_name, "%s:%s",label,e.ae_name);
+}

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list