]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/header-config
wireless-ap: Add support for WPA3 and rewrite WPA2
[people/ms/network.git] / src / header-config
index e3c642338c33b06f0a288185ae38633c455c7b91..4458eaa94862472c93d512520f95194a2733b1da 100644 (file)
 ###############################################################################
 
 hook_new() {
-       cmd_not_implemented
+       local zone="${1}"
+       shift
+
+       local id=$(zone_config_get_new_id ${zone})
+       log DEBUG "ID for the config is: ${id}"
+
+       # Parse command line arguments
+       if ! hook_parse_cmdline "${id}" "$@"; then
+               # Return an error if the parsing of the cmd line fails
+               return ${EXIT_ERROR}
+       fi
+
+       # Write configuration to disk
+       if ! zone_config_settings_write "${zone}" "${HOOK}"; then
+               return ${EXIT_ERROR}
+       fi
+
+       return ${EXIT_OK}
 }
 
 hook_edit() {
@@ -55,7 +72,7 @@ hook_edit() {
                return ${EXIT_ERROR}
        fi
 
-       if ! hook_parse_cmdline $@; then
+       if ! hook_parse_cmdline "${id}" "$@"; then
                # Return an error if the parsing of the cmd line fails
                return ${EXIT_ERROR}
        fi
@@ -76,3 +93,17 @@ hook_edit() {
 
        exit ${EXIT_OK}
 }
+
+hook_destroy() {
+       return ${EXIT_OK}
+}
+
+
+# Returns the ID as a unique identifier
+# Should always be overwritten by a hook
+hook_hid() {
+       local zone=${1}
+       local config=${2}
+
+       config_get_id_from_config "${config}"
+}