aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2022-06-17 15:22:26 -0700
committerGerald Combs <gerald@wireshark.org>2022-07-06 10:53:21 -0500
commitf296a00f09de2d22233800ea2b6bd39c5753d53f (patch)
tree0a545e02dee32a3295f415cad677618cd8b05767
parent75efbb1ac4590f0e086bd3d028bc8b525b8eb3c6 (diff)
Add a default configuration profile for Logray.
Add and install default coloring rules and filter buttons for Logray. Add is_packet_configuration_namespace() and use it to set the default timestamp type for Logray to "Absolute", which is more appropriate for log entries.
-rw-r--r--CMakeLists.txt42
-rw-r--r--resources/share/logray/dfilter_buttons5
-rw-r--r--ui/recent.c4
-rw-r--r--ui/software_update.c2
-rw-r--r--wsutil/filesystem.c5
-rw-r--r--wsutil/filesystem.h7
6 files changed, 62 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f03269b32a..3c399a34dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1570,6 +1570,24 @@ endif()
set(DATAFILE_DIR ${_datafile_dir} CACHE INTERNAL "Build time data file location.")
+if(ENABLE_APPLICATION_BUNDLE)
+ if(CMAKE_CFG_INTDIR STREQUAL ".")
+ set(_log_datafile_dir "${CMAKE_BINARY_DIR}/run/Logray.app/Contents/Resources/share/logray")
+ else()
+ # Xcode
+ set(_log_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/Logray.app/Contents/Resources/share/logray")
+ endif()
+ set(LOG_DATAFILE_DIR ${_log_datafile_dir} CACHE INTERNAL "Build time log analysis data file location.")
+# XXX We need to update wsutil/filesystem.c and packaging/nsis/*logray* to match.
+# elseif(NOT CMAKE_CFG_INTDIR STREQUAL ".")
+# # Visual Studio, Xcode, etc.
+# set(_log_datafile_dir "${CMAKE_BINARY_DIR}/run/${CMAKE_CFG_INTDIR}/share/logray")
+# else()
+# # Makefile, Ninja, etc.
+# set(_log_datafile_dir "${CMAKE_BINARY_DIR}/run/share/logray")
+endif()
+
+
# wsutil must be added after DATAFILE_DIR is set such that filesystem.c can
# learn about the directory location.
add_subdirectory( wsutil )
@@ -1946,6 +1964,13 @@ set(INSTALL_FILES
wka
)
+if (BUILD_logray)
+ set(LOG_INSTALL_FILES
+ resources/share/logray/colorfilters
+ resources/share/logray/dfilter_buttons
+ )
+endif()
+
if (ASCIIDOCTOR_FOUND)
list(APPEND INSTALL_FILES
${CMAKE_BINARY_DIR}/doc/AUTHORS-SHORT
@@ -2232,6 +2257,23 @@ foreach(_install_file ${INSTALL_FILES})
list(APPEND copy_data_files_depends "${_output_file}")
endforeach()
+if (BUILD_logray AND ENABLE_APPLICATION_BUNDLE)
+ foreach(_install_file ${LOG_INSTALL_FILES})
+ get_filename_component(_install_file_src "${_install_file}" ABSOLUTE)
+ get_filename_component(_install_basename "${_install_file}" NAME)
+ set(_output_file "${LOG_DATAFILE_DIR}/${_install_basename}")
+ add_custom_command(OUTPUT "${_output_file}"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${_install_file_src}"
+ "${_output_file}"
+ DEPENDS
+ docs
+ "${_install_file}"
+ )
+ list(APPEND copy_data_files_depends "${_output_file}")
+ endforeach()
+endif()
+
# Install Lua files in staging directory such that Lua can used when Wireshark
# is ran from the build directory. For install targets, see
# epan/wslua/CMakeLists.txt
diff --git a/resources/share/logray/dfilter_buttons b/resources/share/logray/dfilter_buttons
new file mode 100644
index 0000000000..57b024b578
--- /dev/null
+++ b/resources/share/logray/dfilter_buttons
@@ -0,0 +1,5 @@
+# This file is automatically generated, DO NOT MODIFY.
+"TRUE","S3","ct.shortsrc == \x22s3\x22","S3 events"
+"TRUE","EC2","ct.shortsrc == \x22ec2\x22","EC2 events"
+"TRUE","S3 PutObject","ct.name == \x22PutObject\x22",""
+"TRUE","Writes","ct.readonly == \x22false\x22",""
diff --git a/ui/recent.c b/ui/recent.c
index 6db4ddf46e..e3d8b6bdc0 100644
--- a/ui/recent.c
+++ b/ui/recent.c
@@ -1094,8 +1094,8 @@ read_set_recent_pair_static(gchar *key, const gchar *value,
} else if (strcmp(key, RECENT_KEY_PACKET_LIST_COLORIZE) == 0) {
parse_recent_boolean(value, &recent.packet_list_colorize);
} else if (strcmp(key, RECENT_GUI_TIME_FORMAT) == 0) {
- recent.gui_time_format =
- (ts_type)str_to_val(value, ts_type_values, TS_RELATIVE);
+ recent.gui_time_format = (ts_type)str_to_val(value, ts_type_values,
+ is_packet_configuration_namespace() ? TS_RELATIVE : TS_ABSOLUTE);
} else if (strcmp(key, RECENT_GUI_TIME_PRECISION) == 0) {
recent.gui_time_precision =
(ts_precision)str_to_val(value, ts_precision_values, TS_PREC_AUTO);
diff --git a/ui/software_update.c b/ui/software_update.c
index bcb6a2c29b..2b6c97c8f7 100644
--- a/ui/software_update.c
+++ b/ui/software_update.c
@@ -69,7 +69,7 @@ static char *get_appcast_update_url(software_update_channel_e chan) {
const char *su_application = get_configuration_namespace();
const char *su_version = VERSION;
- if (g_str_has_prefix(su_application, "Log")) {
+ if (!is_packet_configuration_namespace()) {
su_version = LOG_VERSION;
}
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index bb948753c2..4d749da2fb 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -309,6 +309,11 @@ get_configuration_namespace(void)
return CONFIGURATION_NAMESPACE_PROPER;
}
+bool is_packet_configuration_namespace(void)
+{
+ return configuration_namespace != CONFIGURATION_NAMESPACE_LOGRAY;
+}
+
#ifndef _WIN32
/*
* Get the pathname of the executable using various platform-
diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h
index 8363f0842c..ae082e7fb7 100644
--- a/wsutil/filesystem.h
+++ b/wsutil/filesystem.h
@@ -45,6 +45,13 @@ WS_DLL_PUBLIC char *configuration_init(const char *arg0, const char *namespace_n
*/
WS_DLL_PUBLIC const char *get_configuration_namespace(void);
+/**
+ * Check to see if the configuration namespace is for packet analysis
+ * (Wireshark) or log analysis (Logray).
+ * @return true if the configuration namespace is for packets.
+ */
+WS_DLL_PUBLIC bool is_packet_configuration_namespace(void);
+
/*
* Get the directory in which the program resides.
*/