GUACAMOLE-513: Implement defaults header for protocol constants.

This commit is contained in:
Nick Couchman 2020-06-07 20:27:42 -04:00
parent 02a7291742
commit df8030d9bb
6 changed files with 39 additions and 10 deletions

View File

@ -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 */

View File

@ -32,12 +32,6 @@
*/ */
#define GUAC_WOL_LOCAL_IPV4_BROADCAST "255.255.255.255" #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 * 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. * consists of 6 bytes of 0xFF, and then the MAC address repeated 16 times.

View File

@ -17,6 +17,7 @@
* under the License. * under the License.
*/ */
#include "common/defaults.h"
#include "common/string.h" #include "common/string.h"
#include "config.h" #include "config.h"
#include "resolution.h" #include "resolution.h"
@ -1084,7 +1085,7 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
/* Parse the WoL wait time. */ /* Parse the WoL wait time. */
settings->wol_wait_time = settings->wol_wait_time =
guac_user_parse_args_int(user, GUAC_RDP_CLIENT_ARGS, argv, 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);
} }

View File

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include "client.h" #include "client.h"
#include "common/defaults.h"
#include "settings.h" #include "settings.h"
#include <guacamole/user.h> #include <guacamole/user.h>
@ -508,7 +509,7 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
settings->wol_wait_time = settings->wol_wait_time =
guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv, 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);
} }

View File

@ -19,6 +19,7 @@
#include "config.h" #include "config.h"
#include "common/defaults.h"
#include "settings.h" #include "settings.h"
#include <guacamole/user.h> #include <guacamole/user.h>
@ -511,7 +512,7 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user,
/* Parse the WoL wait time. */ /* Parse the WoL wait time. */
settings->wol_wait_time = settings->wol_wait_time =
guac_user_parse_args_int(user, GUAC_TELNET_CLIENT_ARGS, argv, 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);
} }

View File

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include "client.h" #include "client.h"
#include "common/defaults.h"
#include "settings.h" #include "settings.h"
#include <guacamole/user.h> #include <guacamole/user.h>
@ -586,7 +587,7 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user,
/* Parse the WoL wait time. */ /* Parse the WoL wait time. */
settings->wol_wait_time = settings->wol_wait_time =
guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv, 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);
} }