1 /** 2 * SPDX-License-Identifier: BSD-2-Clause-Patent 3 * 4 * SPDX-FileCopyrightText: Copyright (c) 2024 SoftAtHome 5 * 6 * Redistribution and use in source and binary forms, with or 7 * without modification, are permitted provided that the following 8 * conditions are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above 14 * copyright notice, this list of conditions and the following 15 * disclaimer in the documentation and/or other materials provided 16 * with the distribution. 17 * 18 * Subject to the terms and conditions of this license, each 19 * copyright holder and contributor hereby grants to those receiving 20 * rights under this license a perpetual, worldwide, non-exclusive, 21 * no-charge, royalty-free, irrevocable (except for failure to 22 * satisfy the conditions of this license) patent license to make, 23 * have made, use, offer to sell, sell, import, and otherwise 24 * transfer this software, where such license applies only to those 25 * patent claims, already acquired or hereafter acquired, licensable 26 * by such copyright holder or contributor that are necessarily 27 * infringed by: 28 * 29 * (a) their Contribution(s) (the licensed copyrights of copyright 30 * holders and non-copyrightable additions of contributors, in 31 * source or binary form) alone; or 32 * 33 * (b) combination of their Contribution(s) with the work of 34 * authorship to which such Contribution(s) was added by such 35 * copyright holder or contributor, if, at the time the Contribution 36 * is added, such addition causes such combination to be necessarily 37 * infringed. The patent license shall not apply to any other 38 * combinations which include the Contribution. 39 * 40 * Except as expressly stated above, no rights or licenses from any 41 * copyright holder or contributor is granted under this license, 42 * whether expressly, by implication, estoppel or otherwise. 43 * 44 * DISCLAIMER 45 * 46 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 47 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 48 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 49 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 50 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR 51 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 52 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 53 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 54 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 55 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 57 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 58 * POSSIBILITY OF SUCH DAMAGE. 59 * 60 */ 61 62 #ifndef _CONFIG_H_ 63 #define _CONFIG_H_ 64 65 #include "odhcp6c.h" 66 67 struct config_dhcp_rtx { 68 uint8_t delay_max; 69 uint8_t timeout_init; 70 uint16_t timeout_max; 71 uint8_t rc_max; 72 }; 73 74 enum config_dhcp_msg { 75 CONFIG_DHCP_SOLICIT, 76 CONFIG_DHCP_REQUEST, 77 CONFIG_DHCP_RENEW, 78 CONFIG_DHCP_REBIND, 79 CONFIG_DHCP_RELEASE, 80 CONFIG_DHCP_DECLINE, 81 CONFIG_DHCP_INFO_REQ, 82 CONFIG_DHCP_MAX 83 }; 84 85 struct config_dhcp { 86 bool release; 87 int dscp; 88 int sk_prio; 89 bool stateful_only_mode; 90 enum odhcp6c_ia_mode ia_na_mode; 91 enum odhcp6c_ia_mode ia_pd_mode; 92 unsigned int client_options; 93 int allow_slaac_only; 94 unsigned int oro_user_cnt; 95 struct config_dhcp_rtx message_rtx[CONFIG_DHCP_MAX]; 96 uint32_t irt_default; 97 uint32_t irt_min; 98 uint16_t rand_factor; 99 enum odhcp6c_auth_protocol auth_protocol; 100 char* auth_token; 101 }; 102 103 struct config_dhcp *config_dhcp_get(void); 104 void config_dhcp_reset(void); 105 void config_set_release(bool enable); 106 bool config_set_dscp(unsigned int value) ; 107 bool config_set_sk_priority(unsigned int priority); 108 void config_set_client_options(enum dhcpv6_config option, bool enable); 109 bool config_set_request_addresses(char *mode); 110 bool config_set_request_prefix(unsigned int length, unsigned int id); 111 void config_set_force_prefix(bool enable); 112 void config_set_stateful_only(bool enable); 113 void config_set_allow_slaac_only(int value); 114 void config_clear_requested_options(void) ; 115 bool config_add_requested_options(unsigned int option); 116 void config_clear_send_options(void); 117 bool config_add_send_options(char *option); 118 bool config_set_rtx_delay_max(enum config_dhcp_msg msg, unsigned int value); 119 bool config_set_rtx_timeout_init(enum config_dhcp_msg msg, unsigned int value); 120 bool config_set_rtx_timeout_max(enum config_dhcp_msg msg, unsigned int value); 121 bool config_set_rtx_rc_max(enum config_dhcp_msg msg, unsigned int value); 122 bool config_set_irt_default(unsigned int value); 123 bool config_set_irt_min(unsigned int value); 124 bool config_set_rand_factor(unsigned int value); 125 bool config_set_auth_protocol(const char* protocol); 126 bool config_set_auth_token(const char* token); 127 128 int config_add_opt(const uint16_t code, const uint8_t *data, const uint16_t len); 129 int config_parse_opt_data(const char *data, uint8_t **dst, const unsigned int type, const bool array); 130 int config_parse_opt(const char *opt); 131 132 void config_apply_dhcp_rtx(struct dhcpv6_retx* dhcpv6_retx); 133 134 #endif /* _CONFIG_H_ */ 135
This page was automatically generated by LXR 0.3.1. • OpenWrt