From df8030d9bb2d045265f6a965efb06b98423ce3c2 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Sun, 7 Jun 2020 20:27:42 -0400 Subject: [PATCH] GUACAMOLE-513: Implement defaults header for protocol constants. --- src/common/common/defaults.h | 31 +++++++++++++++++++++++++++ src/libguac/guacamole/wol-constants.h | 6 ------ src/protocols/rdp/settings.c | 3 ++- src/protocols/ssh/settings.c | 3 ++- src/protocols/telnet/settings.c | 3 ++- src/protocols/vnc/settings.c | 3 ++- 6 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 src/common/common/defaults.h diff --git a/src/common/common/defaults.h b/src/common/common/defaults.h new file mode 100644 index 00000000..17d761d7 --- /dev/null +++ b/src/common/common/defaults.h @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef GUAC_COMMON_DEFAULTS_H +#define GUAC_COMMON_DEFAULTS_H + +/** + * The default number of seconds to wait after sending the Wake-on-LAN packet + * for the destination host to start responding. + */ +#define GUAC_WOL_DEFAULT_BOOT_WAIT_TIME 60 + + +#endif /* GUAC_COMMON_DEFAULTS_H */ + diff --git a/src/libguac/guacamole/wol-constants.h b/src/libguac/guacamole/wol-constants.h index 6f27dd07..215e6b88 100644 --- a/src/libguac/guacamole/wol-constants.h +++ b/src/libguac/guacamole/wol-constants.h @@ -32,12 +32,6 @@ */ #define GUAC_WOL_LOCAL_IPV4_BROADCAST "255.255.255.255" -/** - * The number of seconds to wait after sending the Wake-on-LAN packet - * for the destination host to start responding. - */ -#define GUAC_WOL_BOOT_WAIT_TIME 60 - /** * The size of the magic Wake-on-LAN packet to send to wake a remote host. This * consists of 6 bytes of 0xFF, and then the MAC address repeated 16 times. diff --git a/src/protocols/rdp/settings.c b/src/protocols/rdp/settings.c index 7c4b23cb..0f47f6e2 100644 --- a/src/protocols/rdp/settings.c +++ b/src/protocols/rdp/settings.c @@ -17,6 +17,7 @@ * under the License. */ +#include "common/defaults.h" #include "common/string.h" #include "config.h" #include "resolution.h" @@ -1084,7 +1085,7 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user, /* Parse the WoL wait time. */ settings->wol_wait_time = guac_user_parse_args_int(user, GUAC_RDP_CLIENT_ARGS, argv, - IDX_WOL_WAIT_TIME, GUAC_WOL_BOOT_WAIT_TIME); + IDX_WOL_WAIT_TIME, GUAC_WOL_DEFAULT_BOOT_WAIT_TIME); } diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c index c76feaeb..5e798178 100644 --- a/src/protocols/ssh/settings.c +++ b/src/protocols/ssh/settings.c @@ -20,6 +20,7 @@ #include "config.h" #include "client.h" +#include "common/defaults.h" #include "settings.h" #include @@ -508,7 +509,7 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user, settings->wol_wait_time = guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv, - IDX_WOL_WAIT_TIME, GUAC_WOL_BOOT_WAIT_TIME); + IDX_WOL_WAIT_TIME, GUAC_WOL_DEFAULT_BOOT_WAIT_TIME); } diff --git a/src/protocols/telnet/settings.c b/src/protocols/telnet/settings.c index 63f68d17..8b537de4 100644 --- a/src/protocols/telnet/settings.c +++ b/src/protocols/telnet/settings.c @@ -19,6 +19,7 @@ #include "config.h" +#include "common/defaults.h" #include "settings.h" #include @@ -511,7 +512,7 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user, /* Parse the WoL wait time. */ settings->wol_wait_time = guac_user_parse_args_int(user, GUAC_TELNET_CLIENT_ARGS, argv, - IDX_WOL_WAIT_TIME, GUAC_WOL_BOOT_WAIT_TIME); + IDX_WOL_WAIT_TIME, GUAC_WOL_DEFAULT_BOOT_WAIT_TIME); } diff --git a/src/protocols/vnc/settings.c b/src/protocols/vnc/settings.c index 847f6733..8ca7e463 100644 --- a/src/protocols/vnc/settings.c +++ b/src/protocols/vnc/settings.c @@ -20,6 +20,7 @@ #include "config.h" #include "client.h" +#include "common/defaults.h" #include "settings.h" #include @@ -586,7 +587,7 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user, /* Parse the WoL wait time. */ settings->wol_wait_time = guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv, - IDX_WOL_WAIT_TIME, GUAC_WOL_BOOT_WAIT_TIME); + IDX_WOL_WAIT_TIME, GUAC_WOL_DEFAULT_BOOT_WAIT_TIME); }