summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 17:54:42 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 17:54:42 +0000
commit521aebb9c3a9a8dc3df9f5e6f96ab3bb8872281e (patch)
tree4347a53f93a19613ed0760b79c60698e1c0d755e /net
parent4451b50281e9156c5db058777c8746a11a906049 (diff)
downloadchromium_src-521aebb9c3a9a8dc3df9f5e6f96ab3bb8872281e.zip
chromium_src-521aebb9c3a9a8dc3df9f5e6f96ab3bb8872281e.tar.gz
chromium_src-521aebb9c3a9a8dc3df9f5e6f96ab3bb8872281e.tar.bz2
Add net/base/sys_byteorder.h
TEST=compiles BUG=None Review URL: http://codereview.chromium.org/6870021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81966 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/sys_byteorder.h22
-rw-r--r--net/net.gyp1
-rw-r--r--net/spdy/spdy_frame_builder.h7
-rw-r--r--net/spdy/spdy_framer.h6
-rw-r--r--net/spdy/spdy_protocol.h7
5 files changed, 26 insertions, 17 deletions
diff --git a/net/base/sys_byteorder.h b/net/base/sys_byteorder.h
new file mode 100644
index 0000000..bde3151
--- /dev/null
+++ b/net/base/sys_byteorder.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is a convenience header to pull in the platform-specific
+// headers that define functions for byte-order conversion,
+// particularly: ntohs(), htons(), ntohl(), htonl(). Prefer including
+// this file instead of directly writing the #if / #else, since it
+// avoids duplicating the platform-specific selections.
+
+#ifndef NET_BASE_SYS_BYTEORDER_H_
+#define NET_BASE_SYS_BYTEORDER_H_
+
+#include "build/build_config.h"
+
+#if defined(OS_WIN)
+#include <winsock2.h>
+#else
+#include <arpa/inet.h>
+#endif
+
+#endif // NET_BASE_SYS_BYTEORDER_H_
diff --git a/net/net.gyp b/net/net.gyp
index 1c8b595..0797653 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -198,6 +198,7 @@
'base/transport_security_state.cc',
'base/transport_security_state.h',
'base/sys_addrinfo.h',
+ 'base/sys_byteorder.h',
'base/upload_data.cc',
'base/upload_data.h',
'base/upload_data_stream.cc',
diff --git a/net/spdy/spdy_frame_builder.h b/net/spdy/spdy_frame_builder.h
index 36a3f53..df2f16d 100644
--- a/net/spdy/spdy_frame_builder.h
+++ b/net/spdy/spdy_frame_builder.h
@@ -6,15 +6,10 @@
#define NET_SPDY_SPDY_FRAME_BUILDER_H_
#pragma once
-#ifdef WIN32
-#include <winsock2.h> // for htonl() functions
-#else
-#include <arpa/inet.h>
-#endif
-
#include <string>
#include "base/basictypes.h"
+#include "net/base/sys_byteorder.h"
#include "net/spdy/spdy_protocol.h"
namespace spdy {
diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h
index 688c611..332a47f 100644
--- a/net/spdy/spdy_framer.h
+++ b/net/spdy/spdy_framer.h
@@ -6,11 +6,6 @@
#define NET_SPDY_SPDY_FRAMER_H_
#pragma once
-#ifdef _WIN32
-#include <winsock2.h>
-#else
-#include <arpa/inet.h>
-#endif
#include <list>
#include <map>
#include <string>
@@ -19,6 +14,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "net/base/sys_byteorder.h"
#include "net/spdy/spdy_protocol.h"
typedef struct z_stream_s z_stream; // Forward declaration for zlib.
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h
index 2389152..aa28b3c 100644
--- a/net/spdy/spdy_protocol.h
+++ b/net/spdy/spdy_protocol.h
@@ -8,16 +8,11 @@
#define NET_SPDY_SPDY_PROTOCOL_H_
#pragma once
-#ifdef WIN32
-#include <winsock2.h>
-#else
-#include <arpa/inet.h>
-#endif
-
#include <limits>
#include "base/basictypes.h"
#include "base/logging.h"
+#include "net/base/sys_byteorder.h"
#include "net/spdy/spdy_bitmasks.h"
// Data Frame Format