summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-30 00:59:35 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-30 00:59:35 +0000
commitb773065a8fcd6d50575bf290836aa65a02ee0fa5 (patch)
tree2c0b18c49f74ce1e6fa255d74d53a8f402c39abb
parent29deece3a54e6909d02a20b8c2712bee922b6297 (diff)
downloadchromium_src-b773065a8fcd6d50575bf290836aa65a02ee0fa5.zip
chromium_src-b773065a8fcd6d50575bf290836aa65a02ee0fa5.tar.gz
chromium_src-b773065a8fcd6d50575bf290836aa65a02ee0fa5.tar.bz2
Apply automatic range checking for enums across p2p_messages IPC.
This is part of a long-running background task to remove the remaining uses of the unchecked IPC_ENUM_TRAITS() macro. BUG=246708 Review URL: https://codereview.chromium.org/149193002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247791 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/common/p2p_messages.h10
-rw-r--r--content/public/common/p2p_socket_type.h1
-rw-r--r--net/base/net_util.h2
3 files changed, 10 insertions, 3 deletions
diff --git a/content/common/p2p_messages.h b/content/common/p2p_messages.h
index d65a10b..814adc1 100644
--- a/content/common/p2p_messages.h
+++ b/content/common/p2p_messages.h
@@ -16,9 +16,13 @@
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
#define IPC_MESSAGE_START P2PMsgStart
-IPC_ENUM_TRAITS(content::P2PSocketType)
-IPC_ENUM_TRAITS(net::DiffServCodePoint)
-IPC_ENUM_TRAITS(content::P2PSocketOption)
+IPC_ENUM_TRAITS_MAX_VALUE(content::P2PSocketType,
+ content::P2P_SOCKET_TYPE_LAST)
+IPC_ENUM_TRAITS_MAX_VALUE(content::P2PSocketOption,
+ content::P2P_SOCKET_OPT_MAX - 1)
+IPC_ENUM_TRAITS_MIN_MAX_VALUE(net::DiffServCodePoint,
+ net::DSCP_FIRST,
+ net::DSCP_LAST)
IPC_STRUCT_TRAITS_BEGIN(net::NetworkInterface)
IPC_STRUCT_TRAITS_MEMBER(name)
diff --git a/content/public/common/p2p_socket_type.h b/content/public/common/p2p_socket_type.h
index 5532229..10e7508 100644
--- a/content/public/common/p2p_socket_type.h
+++ b/content/public/common/p2p_socket_type.h
@@ -28,6 +28,7 @@ enum P2PSocketType {
P2P_SOCKET_STUN_SSLTCP_CLIENT,
P2P_SOCKET_TLS_CLIENT,
P2P_SOCKET_STUN_TLS_CLIENT,
+ P2P_SOCKET_TYPE_LAST = P2P_SOCKET_STUN_TLS_CLIENT
};
} // namespace content
diff --git a/net/base/net_util.h b/net/base/net_util.h
index fe91844..909233d 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -574,6 +574,7 @@ unsigned MaskPrefixLength(const IPAddressNumber& mask);
// See http://tools.ietf.org/html/rfc2474 for details.
enum DiffServCodePoint {
DSCP_NO_CHANGE = -1,
+ DSCP_FIRST = DSCP_NO_CHANGE,
DSCP_DEFAULT = 0, // Same as DSCP_CS0
DSCP_CS0 = 0, // The default
DSCP_CS1 = 8, // Bulk/background traffic
@@ -596,6 +597,7 @@ enum DiffServCodePoint {
DSCP_EF = 46, // Voice
DSCP_CS6 = 48, // Voice
DSCP_CS7 = 56, // Control messages
+ DSCP_LAST = DSCP_CS7
};
} // namespace net