]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4100] Change enums to uint16_t
authorAndrei Pavel <andrei@isc.org>
Fri, 24 Oct 2025 07:27:16 +0000 (10:27 +0300)
committerAndrei Pavel <andrei@isc.org>
Fri, 24 Oct 2025 14:07:29 +0000 (17:07 +0300)
Addresses the range checks in *toText() functions.

15 files changed:
src/bin/d2/d2_queue_mgr.h
src/hooks/dhcp/radius/radius_accounting.h
src/lib/asiodns/io_fetch.h
src/lib/cc/data.h
src/lib/cryptolink/cryptolink.h
src/lib/d2srv/dns_client.h
src/lib/dhcp/option4_client_fqdn.h
src/lib/dhcp/option6_client_fqdn.h
src/lib/dhcp/option_data_types.h
src/lib/dhcp_ddns/ncr_io.h
src/lib/dhcpsrv/cfg_globals.h
src/lib/dhcpsrv/host.h
src/lib/dhcpsrv/lease.h
src/lib/dns/message.h
src/lib/eval/token.h

index 4d34b726b1ccf57f8e80ca33e8827a1e931c27f2..00b87db2c96568ea921f4d81ec3e432c2c5fc440 100644 (file)
@@ -136,7 +136,7 @@ public:
     static const size_t MAX_QUEUE_DEFAULT = 1024;
 
     /// @brief Defines the list of possible states for D2QueueMgr.
-    enum State : int {
+    enum State : uint16_t {
       NOT_INITTED = 0,
       INITTED = 1,
       RUNNING = 2,
index 52a05684293f58e179ca0ff5828d399576bedb2e..9a826c4213ce7ffd24792cc7b6ecb9a0ad9f0e16 100644 (file)
@@ -22,7 +22,7 @@ namespace isc {
 namespace radius {
 
 /// @brief Type of accounting events.
-enum Event : int {
+enum Event : uint16_t {
     EVENT_CREATE = 0,  //< A new lease was created (leaseX_select hooks).
     EVENT_RENEW = 1,   //< A lease was renewed (leaseX_renew hooks).
     EVENT_REBIND = 2,  //< A lease was rebound (lease6_rebind hook).
index a2c8c92dd2787f1aa4cca60e3840443ed61a3eef..e9c85b58c5bab99d5e870eeb07736930cc9ff0d9 100644 (file)
@@ -56,7 +56,7 @@ public:
     /// @note that this applies to the status of I/Os in the fetch - a fetch that
     /// resulted in a packet being received from the server is a SUCCESS, even if
     /// the contents of the packet indicate that some error occurred.
-    enum Result : int {
+    enum Result : uint16_t {
         SUCCESS = 0,       // Success, fetch completed
         TIME_OUT = 1,      // Failure, fetch timed out
         STOPPED = 2,       // Control code, fetch has been stopped
index b93e2ec29eceb24cf483bffbaaf2745371283b35..f684581cb2826253ef49adb79a1e371a3626bdcc 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2025 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -136,7 +136,7 @@ public:
     ///
     /// any is a special type used in list specifications, specifying that the
     /// elements can be of any type.
-    enum types : int {
+    enum types : uint16_t {
         integer = 0,
         real = 1,
         boolean = 2,
index 4749dc136b106831d5d35f5d06291df12e396070..cd7ac99f9868023f4c7ae49b84cbf312102908b5 100644 (file)
@@ -20,7 +20,7 @@ namespace isc {
 namespace cryptolink {
 
 /// @brief Hash algorithm identifiers.
-enum HashAlgorithm : int {
+enum HashAlgorithm : uint16_t {
     UNKNOWN_HASH = 0,   // This value can be used in conversion
                         // functions, to be returned when the
                         // input is unknown (but a value MUST be
index 5c1f2c2f2a397212cca8547ea3f3b06eff594887..c7cbd3c43bd6133512fe208dfb9e2b7d571bc543 100644 (file)
@@ -55,7 +55,7 @@ public:
     };
 
     /// @brief A status code of the DNSClient.
-    enum Status : int {
+    enum Status : uint16_t {
         SUCCESS = 0,            ///< Response received and is ok.
         TIMEOUT = 1,            ///< No response, timeout.
         IO_STOPPED = 2,         ///< IO was stopped.
index 07dacd6d2151e52edb45b0477c687e3307109917..47392b42f9fc863ca7f5cd6fc526f020b48832ce 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2025 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -145,7 +145,7 @@ public:
 
 
     /// @brief Type of the domain-name: partial or full.
-    enum DomainNameType : int {
+    enum DomainNameType : uint16_t {
         PARTIAL,
         FULL
     };
index f51e18584d1045e2ccb061578ed8acc4c80d6b71..9d625354b42fd52913405343074f5f60a8589e5a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2025 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -102,7 +102,7 @@ public:
     static const uint16_t FLAG_FIELD_LEN = 1;
 
     /// @brief Type of the domain-name: partial or full.
-    enum DomainNameType : int {
+    enum DomainNameType : uint16_t {
         PARTIAL,
         FULL
     };
index 6621d2fec01f2f6fdc1d9349ad60e5d04ecfae31..9a0596d45665ca4b2bd2a09a39e67e6ec0eec424 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2025 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -42,7 +42,7 @@ public:
 /// must always be and OPT_RECORD_TYPE must be at second to last.
 /// This is because some functions perform sanity checks on data type
 /// values using '>' operators, assuming that all values beyond the
-enum OptionDataType : int {
+enum OptionDataType : uint16_t {
     OPT_EMPTY_TYPE          = 0,
     OPT_BINARY_TYPE         = 1,
     OPT_BOOLEAN_TYPE        = 2,
index db0d572cfc749d1d2ee49145fb5f6c76b9ba8479..3965db391f4c1c9939bb963035b2baafd5dbe667 100644 (file)
@@ -475,7 +475,7 @@ public:
     static const size_t MAX_QUEUE_DEFAULT = 1024;
 
     /// @brief Defines the outcome of an asynchronous NCR send.
-    enum Result : int {
+    enum Result : uint16_t {
         SUCCESS = 0,
         TIME_OUT = 1,
         STOPPED = 2,
index 1129f24d4cc1c8446fc30066f46adb2f69caef92..88d587037f80841623069118d10854c69a48a1fd 100644 (file)
@@ -36,7 +36,7 @@ public:
     /// @c SimpleParser6::GLOBAL6_PARAMETERS, first part with common
     /// parameters followed by DHCPv4 and DHCPv6 specific parameters.
     /// Keep the order, enum element names is uppercase with - replaced by _.
-    enum Index : int {
+    enum Index : uint16_t {
         // Common parameters.
         VALID_LIFETIME,
         MIN_VALID_LIFETIME,
index 1ef85c25e322dd027464c49da8e92e3a54967d03..63a84b04fafa08a09aeec162640fedf9743b52fc 100644 (file)
@@ -334,7 +334,7 @@ public:
     /// - DUID (DHCPv4 and DHCPv6) (identifier name: "duid"),
     /// - circuit identifier (DHCPv4) (identifier name: "circuit-id"),
     /// - client identifier (DHCPv4) (identifier name: "client-id")
-    enum IdentifierType : int {
+    enum IdentifierType : uint16_t {
         IDENT_HWADDR = 0,
         IDENT_DUID = 1,
         IDENT_CIRCUIT_ID = 2,
index 9618fd5ee83c02132056360441fa97227b163dd1..1096d5d11274662909d87f0ca034908f61a7b9cd 100644 (file)
@@ -43,7 +43,7 @@ struct Lease : public isc::data::UserContext, public isc::data::CfgToElement {
     static std::string lifetimeToText(uint32_t lifetime);
 
     /// @brief Type of lease or pool
-    enum Type : int {
+    enum Type : uint16_t {
         TYPE_NA = 0, ///< the lease contains non-temporary IPv6 address
         TYPE_TA = 1, ///< the lease contains temporary IPv6 address
         TYPE_PD = 2, ///< the lease contains IPv6 prefix (for prefix delegation)
index 1dea110ddb0d654eea8b4862819dddc8ae9215ce..6240a380d2705cb71850fd03eec4cbb5a7d86b21 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2024 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2009-2025 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -199,7 +199,7 @@ public:
     /// introducing a separately defined class considering the balance
     /// between the complexity and advantage, but hopefully the cast notation
     /// is sufficiently ugly to prevent proliferation of the usage.
-    enum HeaderFlag : int {
+    enum HeaderFlag : uint16_t {
         HEADERFLAG_QR = 0x8000, // Query (if cleared) or response (if set)
         HEADERFLAG_AA = 0x0400, // Authoritative answer
         HEADERFLAG_TC = 0x0200, // Truncation
@@ -239,7 +239,7 @@ public:
     ///
     /// <b>Future Extension:</b> We'll probably also define constants for
     /// the section names used in dynamic updates in future versions.
-    enum Section : int {
+    enum Section : uint16_t {
         SECTION_QUESTION = 0,   // Question section
         SECTION_ANSWER = 1,     // Answer section
         SECTION_AUTHORITY = 2,  // Authority section
index 8c1570b3a11c5796dd6521a1a91d8f62b642bc3a..c87dcc28b2a04cfa00ba35cc1fe4c016a4233c16 100644 (file)
@@ -570,7 +570,7 @@ class TokenPkt : public Token {
 public:
 
     /// @brief enum value that determines the field.
-    enum MetadataType : int {
+    enum MetadataType : uint16_t {
         IFACE, ///< interface name (string)
         SRC,   ///< source (IP address)
         DST,   ///< destination (IP address)
@@ -620,7 +620,7 @@ class TokenPkt4 : public Token {
 public:
 
     /// @brief enum value that determines the field.
-    enum FieldType : int {
+    enum FieldType : uint16_t {
         CHADDR, ///< chaddr field (up to 16 bytes link-layer address)
         GIADDR, ///< giaddr (IPv4 address)
         CIADDR, ///< ciaddr (IPv4 address)
@@ -674,7 +674,7 @@ private:
 class TokenPkt6 : public Token {
 public:
     /// @brief enum value that determines the field.
-    enum FieldType : int {
+    enum FieldType : uint16_t {
         MSGTYPE, ///< msg type
         TRANSID  ///< transaction id (integer but manipulated as a string)
     };
@@ -727,7 +727,7 @@ class TokenRelay6Field : public Token {
 public:
 
     /// @brief enum value that determines the field.
-    enum FieldType : int {
+    enum FieldType : uint16_t {
         PEERADDR, ///< Peer address field (IPv6 address)
         LINKADDR  ///< Link address field (IPv6 address)
     };
@@ -1137,7 +1137,7 @@ class TokenVendor : public TokenOption {
 public:
 
     /// @brief Specifies a field of the vendor option
-    enum FieldType : int {
+    enum FieldType : uint16_t {
         SUBOPTION,     ///< If this token fetches a suboption, not a field.
         ENTERPRISE_ID, ///< enterprise-id field (vendor-info, vendor-class)
         EXISTS,        ///< vendor[123].exists