OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 bool Shutdown(); | 59 bool Shutdown(); |
60 | 60 |
61 // Data Transimission | 61 // Data Transimission |
62 // Return 0 on failure. | 62 // Return 0 on failure. |
63 int Send(const char* buffer, int length) V8_WARN_UNUSED_RESULT; | 63 int Send(const char* buffer, int length) V8_WARN_UNUSED_RESULT; |
64 int Receive(char* buffer, int length) V8_WARN_UNUSED_RESULT; | 64 int Receive(char* buffer, int length) V8_WARN_UNUSED_RESULT; |
65 | 65 |
66 // Set the value of the SO_REUSEADDR socket option. | 66 // Set the value of the SO_REUSEADDR socket option. |
67 bool SetReuseAddress(bool reuse_address); | 67 bool SetReuseAddress(bool reuse_address); |
68 | 68 |
69 V8_INLINE(bool IsValid()) const V8_WARN_UNUSED_RESULT { | 69 V8_INLINE(bool IsValid()) const { |
70 return native_handle_ != kInvalidNativeHandle; | 70 return native_handle_ != kInvalidNativeHandle; |
71 } | 71 } |
72 | 72 |
73 static int GetLastError() V8_WARN_UNUSED_RESULT; | 73 static int GetLastError(); |
74 | 74 |
75 // The implementation-defined native handle type. | 75 // The implementation-defined native handle type. |
76 #if V8_OS_POSIX | 76 #if V8_OS_POSIX |
77 typedef int NativeHandle; | 77 typedef int NativeHandle; |
78 static const NativeHandle kInvalidNativeHandle = -1; | 78 static const NativeHandle kInvalidNativeHandle = -1; |
79 #elif V8_OS_WIN | 79 #elif V8_OS_WIN |
80 typedef SOCKET NativeHandle; | 80 typedef SOCKET NativeHandle; |
81 static const NativeHandle kInvalidNativeHandle = INVALID_SOCKET; | 81 static const NativeHandle kInvalidNativeHandle = INVALID_SOCKET; |
82 #endif | 82 #endif |
83 | 83 |
84 NativeHandle& native_handle() V8_WARN_UNUSED_RESULT { | 84 NativeHandle& native_handle() { |
85 return native_handle_; | 85 return native_handle_; |
86 } | 86 } |
87 const NativeHandle& native_handle() const V8_WARN_UNUSED_RESULT { | 87 const NativeHandle& native_handle() const { |
88 return native_handle_; | 88 return native_handle_; |
89 } | 89 } |
90 | 90 |
91 private: | 91 private: |
92 explicit Socket(NativeHandle native_handle) : native_handle_(native_handle) {} | 92 explicit Socket(NativeHandle native_handle) : native_handle_(native_handle) {} |
93 | 93 |
94 NativeHandle native_handle_; | 94 NativeHandle native_handle_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(Socket); | 96 DISALLOW_COPY_AND_ASSIGN(Socket); |
97 }; | 97 }; |
98 | 98 |
99 } } // namespace v8::internal | 99 } } // namespace v8::internal |
100 | 100 |
101 #endif // V8_PLATFORM_SOCKET_H_ | 101 #endif // V8_PLATFORM_SOCKET_H_ |
OLD | NEW |