Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: net/base/net_util.cc

Issue 6577: Porting of listen_socket, telnet_server to linux (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <unicode/ucnv.h> 6 #include <unicode/ucnv.h>
7 #include <unicode/uidna.h> 7 #include <unicode/uidna.h>
8 #include <unicode/ulocdata.h> 8 #include <unicode/ulocdata.h>
9 #include <unicode/uniset.h> 9 #include <unicode/uniset.h>
10 #include <unicode/uscript.h> 10 #include <unicode/uscript.h>
11 #include <unicode/uset.h> 11 #include <unicode/uset.h>
12 12
13 #ifdef OS_WIN 13 #include "build/build_config.h"
14
15 #if defined(OS_WIN)
14 #include <windows.h> 16 #include <windows.h>
17 #elif defined(OS_POSIX)
18 #include <sys/socket.h>
19 #include <fcntl.h>
15 #endif 20 #endif
16 21
17 #include "net/base/net_util.h" 22 #include "net/base/net_util.h"
18 23
19 #include "base/basictypes.h" 24 #include "base/basictypes.h"
20 #include "base/file_util.h" 25 #include "base/file_util.h"
21 #include "base/logging.h" 26 #include "base/logging.h"
22 #include "base/path_service.h" 27 #include "base/path_service.h"
23 #include "base/scoped_ptr.h" 28 #include "base/scoped_ptr.h"
24 #include "base/string_escape.h" 29 #include "base/string_escape.h"
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 int array_size = arraysize(kAllowedFtpPorts); 911 int array_size = arraysize(kAllowedFtpPorts);
907 for (int i = 0; i < array_size; i++) { 912 for (int i = 0; i < array_size; i++) {
908 if (kAllowedFtpPorts[i] == port) { 913 if (kAllowedFtpPorts[i] == port) {
909 return true; 914 return true;
910 } 915 }
911 } 916 }
912 // Port not explicitly allowed by FTP, so return the default restrictions. 917 // Port not explicitly allowed by FTP, so return the default restrictions.
913 return IsPortAllowedByDefault(port); 918 return IsPortAllowedByDefault(port);
914 } 919 }
915 920
921 int SetNonBlocking(int fd) {
922 #if defined(OS_WIN)
923 unsigned long no_block = 1;
924 return ioctlsocket(fd, FIONBIO, &no_block);
925 #elif defined(OS_POSIX)
926 int flags = fcntl(fd, F_GETFL, 0);
927 if (-1 == flags)
928 flags = 0;
929 return fcntl(fd, F_SETFL, 0);
930 #endif
931 }
932
916 } // namespace net 933 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698