Skip to content

Commit

Permalink
wsutil: Add configuration namespaces.
Browse files Browse the repository at this point in the history
Rename init_progfile_dir to configuration_init. Add an argument which
specifies our configuration namespace, which can be "Wireshark"
(default) or "Logwolf".
  • Loading branch information
geraldcombs committed Apr 4, 2022
1 parent 6d2ab69 commit 3086774
Show file tree
Hide file tree
Showing 28 changed files with 178 additions and 106 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,12 @@ if(ENABLE_APPLICATION_BUNDLE)
# Xcode
set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/PlugIns/wireshark/${PLUGIN_PATH_ID}")
endif()
if(CMAKE_CFG_INTDIR STREQUAL ".")
set(_logshark_plugin_dir "${CMAKE_BINARY_DIR}/run/Logshark.app/Contents/PlugIns/logwolf/${PLUGIN_PATH_ID}")
else()
# Xcode
set(_logshark_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/Logshark.app/Contents/PlugIns/logwolf/${PLUGIN_PATH_ID}")
endif()
elseif(WIN32 AND NOT CMAKE_CFG_INTDIR STREQUAL ".")
set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/${PLUGIN_VERSION_DIR}")
else()
Expand Down
10 changes: 5 additions & 5 deletions capinfos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ capinfos_cmdarg_err_cont(const char *msg_format, va_list ap)
int
main(int argc, char *argv[])
{
char *init_progfile_dir_error;
char *configuration_init_error;
static const struct report_message_routines capinfos_report_routines = {
failure_message,
failure_message,
Expand Down Expand Up @@ -1630,12 +1630,12 @@ main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr,
"capinfos: Can't get pathname of directory containing the capinfos program: %s.\n",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error);
g_free(configuration_init_error);
}

init_report_message("capinfos", &capinfos_report_routines);
Expand Down
10 changes: 5 additions & 5 deletions captype.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ captype_cmdarg_err_cont(const char *msg_format, va_list ap)
int
main(int argc, char *argv[])
{
char *init_progfile_dir_error;
char *configuration_init_error;
static const struct report_message_routines captype_report_routines = {
failure_message,
failure_message,
Expand Down Expand Up @@ -137,12 +137,12 @@ main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr,
"captype: Can't get pathname of directory containing the captype program: %s.\n",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error);
g_free(configuration_init_error);
}

init_report_message("captype", &captype_report_routines);
Expand Down
10 changes: 5 additions & 5 deletions dftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void dftest_cmdarg_err_cont(const char *fmt, va_list ap);
int
main(int argc, char **argv)
{
char *init_progfile_dir_error;
char *configuration_init_error;
static const struct report_message_routines dftest_report_routines = {
failure_message,
failure_message,
Expand Down Expand Up @@ -77,11 +77,11 @@ main(int argc, char **argv)
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr, "dftest: Can't get pathname of directory containing the dftest program: %s.\n",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error);
g_free(configuration_init_error);
}

init_report_message("dftest", &dftest_report_routines);
Expand Down
10 changes: 5 additions & 5 deletions editcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ process_new_idbs(wtap *wth, wtap_dumper *pdh, GArray *idbs_seen,
int
main(int argc, char *argv[])
{
char *init_progfile_dir_error;
char *configuration_init_error;
static const struct report_message_routines editcap_report_routines = {
failure_message,
failure_message,
Expand Down Expand Up @@ -1203,12 +1203,12 @@ main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr,
"editcap: Can't get pathname of directory containing the editcap program: %s.\n",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error);
g_free(configuration_init_error);
}

init_report_message("editcap", &editcap_report_routines);
Expand Down
2 changes: 1 addition & 1 deletion extcap/androiddump.c
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,7 @@ int main(int argc, char *argv[]) {
* Attempt to get the pathname of the directory containing the
* executable file.
*/
err_msg = init_progfile_dir(argv[0]);
err_msg = configuration_init(argv[0], NULL);
if (err_msg != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
err_msg);
Expand Down
2 changes: 1 addition & 1 deletion extcap/ciscodump.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ int main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
err_msg = init_progfile_dir(argv[0]);
err_msg = configuration_init(argv[0], NULL);
if (err_msg != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
err_msg);
Expand Down
10 changes: 5 additions & 5 deletions extcap/dpauxmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ static void run_listener(const char* fifo, unsigned int interface_id)

int main(int argc, char *argv[])
{
char* init_progfile_dir_error;
char* configuration_init_error;
int option_idx = 0;
int result;
unsigned int interface_id = 0;
Expand All @@ -506,11 +506,11 @@ int main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error);
g_free(configuration_init_error);
}

extcap_base_set_util_info(extcap_conf, argv[0], DPAUXMON_VERSION_MAJOR, DPAUXMON_VERSION_MINOR, DPAUXMON_VERSION_RELEASE,
Expand Down
2 changes: 1 addition & 1 deletion extcap/etwdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int main(int argc, char* argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
err_msg = init_progfile_dir(argv[0]);
err_msg = configuration_init(argv[0], NULL);
if (err_msg != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
err_msg);
Expand Down
2 changes: 1 addition & 1 deletion extcap/randpktdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ int main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
err_msg = init_progfile_dir(argv[0]);
err_msg = configuration_init(argv[0], NULL);
if (err_msg != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
err_msg);
Expand Down
10 changes: 5 additions & 5 deletions extcap/sdjournal.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ static int list_config(char *interface)

int main(int argc, char **argv)
{
char* init_progfile_dir_error;
char* configuration_init_error;
int result;
int option_idx = 0;
int start_from_entries = 10;
Expand All @@ -353,11 +353,11 @@ int main(int argc, char **argv)
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error);
g_free(configuration_init_error);
}

help_url = data_file_url("sdjournal.html");
Expand Down
2 changes: 1 addition & 1 deletion extcap/sshdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ int main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
err_msg = init_progfile_dir(argv[0]);
err_msg = configuration_init(argv[0], NULL);
if (err_msg != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
err_msg);
Expand Down
2 changes: 1 addition & 1 deletion extcap/udpdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ int main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
err_msg = init_progfile_dir(argv[0]);
err_msg = configuration_init(argv[0], NULL);
if (err_msg != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
err_msg);
Expand Down
2 changes: 1 addition & 1 deletion extcap/wifidump.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ int main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
err_msg = init_progfile_dir(argv[0]);
err_msg = configuration_init(argv[0], NULL);
if (err_msg != NULL) {
ws_warning("Can't get pathname of directory containing the extcap program: %s.",
err_msg);
Expand Down
10 changes: 5 additions & 5 deletions fuzz/fuzzshark.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fuzz_prefs_apply(void)
static int
fuzz_init(int argc _U_, char **argv)
{
char *init_progfile_dir_error;
char *configuration_init_error;

static const struct report_message_routines fuzzshark_report_routines = {
failure_message,
Expand Down Expand Up @@ -256,10 +256,10 @@ fuzz_init(int argc _U_, char **argv)
/*
* Attempt to get the pathname of the executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
fprintf(stderr, "fuzzshark: Can't get pathname of oss-fuzzshark program: %s.\n", init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr, "fuzzshark: Can't get pathname of oss-fuzzshark program: %s.\n", configuration_init_error);
g_free(configuration_init_error);
}

/* Initialize the version information. */
Expand Down
10 changes: 5 additions & 5 deletions mergecap.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ merge_callback(merge_event event, int num,
int
main(int argc, char *argv[])
{
char *init_progfile_dir_error;
char *configuration_init_error;
static const struct report_message_routines mergecap_report_routines = {
failure_message,
failure_message,
Expand Down Expand Up @@ -241,12 +241,12 @@ main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr,
"mergecap: Can't get pathname of directory containing the mergecap program: %s.\n",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error);
g_free(configuration_init_error);
}

init_report_message("mergecap", &mergecap_report_routines);
Expand Down
2 changes: 1 addition & 1 deletion packaging/debian/libwsutil0.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ libwsutil.so.0 libwsutil0 #MINVER#
codecs_init@Base 3.1.0
codecs_register_plugin@Base 3.1.0
config_file_exists_with_entries@Base 2.9.0
configuration_init@Base 3.7.0
copy_file_binary_mode@Base 1.12.0~rc1
copy_persconffile_profile@Base 1.12.0~rc1
crc11_307_noreflect_noxor@Base 1.10.0
Expand Down Expand Up @@ -115,7 +116,6 @@ libwsutil.so.0 libwsutil0 #MINVER#
ieee80211_mhz_to_chan@Base 1.99.7
ieee80211_mhz_to_str@Base 1.99.7
init_process_policies@Base 1.10.0
init_progfile_dir@Base 1.12.0~rc1
init_report_message@Base 2.3.0
int64_to_str_back@Base 3.5.1
int_to_str_back@Base 3.5.1
Expand Down
12 changes: 6 additions & 6 deletions randpkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ usage(gboolean is_error)
int
main(int argc, char *argv[])
{
char *init_progfile_dir_error;
char *configuration_init_error;
static const struct report_message_routines randpkt_report_routines = {
failure_message,
failure_message,
Expand Down Expand Up @@ -144,12 +144,12 @@ main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr,
"capinfos: Can't get pathname of directory containing the capinfos program: %s.\n",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
"capinfos: Can't get pathname of directory containing the capinfos program: %s.\n",
configuration_init_error);
g_free(configuration_init_error);
}

init_report_message("randpkt", &randpkt_report_routines);
Expand Down
2 changes: 1 addition & 1 deletion rawshark.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
err_msg = init_progfile_dir(argv[0]);
err_msg = configuration_init(argv[0], NULL);
if (err_msg != NULL) {
fprintf(stderr, "rawshark: Can't get pathname of rawshark program: %s.\n",
err_msg);
Expand Down
10 changes: 5 additions & 5 deletions reordercap.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ reordercap_cmdarg_err_cont(const char *msg_format, va_list ap)
int
main(int argc, char *argv[])
{
char *init_progfile_dir_error;
char *configuration_init_error;
static const struct report_message_routines reordercap_message_routines = {
failure_message,
failure_message,
Expand Down Expand Up @@ -218,12 +218,12 @@ main(int argc, char *argv[])
* Attempt to get the pathname of the directory containing the
* executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr,
"reordercap: Can't get pathname of directory containing the reordercap program: %s.\n",
init_progfile_dir_error);
g_free(init_progfile_dir_error);
configuration_init_error);
g_free(configuration_init_error);
}

init_report_message("reordercap", &reordercap_message_routines);
Expand Down
8 changes: 4 additions & 4 deletions sharkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ print_current_user(void)
int
main(int argc, char *argv[])
{
char *init_progfile_dir_error;
char *configuration_init_error;

char *err_msg = NULL;
e_prefs *prefs_p;
Expand Down Expand Up @@ -136,10 +136,10 @@ main(int argc, char *argv[])
/*
* Attempt to get the pathname of the executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL) {
configuration_init_error = configuration_init(argv[0], NULL);
if (configuration_init_error != NULL) {
fprintf(stderr, "sharkd: Can't get pathname of sharkd program: %s.\n",
init_progfile_dir_error);
configuration_init_error);
}

/* Initialize the version information. */
Expand Down
Loading

0 comments on commit 3086774

Please sign in to comment.