22 #ifndef SRC_STREAM_WRAP_H_ 23 #define SRC_STREAM_WRAP_H_ 25 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 39 class StreamWrap :
public HandleWrap,
public StreamBase {
41 static void Initialize(v8::Local<v8::Object> target,
42 v8::Local<v8::Value> unused,
43 v8::Local<v8::Context> context);
46 void* Cast()
override;
47 bool IsAlive()
override;
48 bool IsClosing()
override;
49 bool IsIPCPipe()
override;
52 int ReadStart()
override;
53 int ReadStop()
override;
56 int DoShutdown(ShutdownWrap* req_wrap)
override;
57 int DoTryWrite(uv_buf_t** bufs,
size_t* count)
override;
58 int DoWrite(WriteWrap* w,
61 uv_stream_t* send_handle)
override;
63 inline uv_stream_t* stream()
const {
67 inline bool is_named_pipe()
const {
68 return stream()->type == UV_NAMED_PIPE;
71 inline bool is_named_pipe_ipc()
const {
72 return is_named_pipe() &&
73 reinterpret_cast<const uv_pipe_t*
>(stream())->ipc != 0;
76 inline bool is_tcp()
const {
77 return stream()->type == UV_TCP;
81 StreamWrap(Environment* env,
82 v8::Local<v8::Object>
object,
84 AsyncWrap::ProviderType provider);
89 AsyncWrap* GetAsyncWrap()
override;
90 void UpdateWriteQueueSize();
92 static void AddMethods(Environment* env,
93 v8::Local<v8::FunctionTemplate> target,
94 int flags = StreamBase::kFlagNone);
97 static void SetBlocking(
const v8::FunctionCallbackInfo<v8::Value>& args);
100 static void OnAlloc(uv_handle_t* handle,
101 size_t suggested_size,
104 static void OnRead(uv_stream_t* handle,
106 const uv_buf_t*
buf);
107 static void AfterWrite(uv_write_t*
req,
int status);
108 static void AfterShutdown(uv_shutdown_t*
req,
int status);
111 static void OnAfterWriteImpl(WriteWrap* w,
void*
ctx);
112 static void OnAllocImpl(
size_t size, uv_buf_t*
buf,
void*
ctx);
113 static void OnReadImpl(ssize_t nread,
115 uv_handle_type pending,
118 uv_stream_t*
const stream_;
124 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 126 #endif // SRC_STREAM_WRAP_H_
void Initialize(Local< Object > target, Local< Value > unused, Local< Context > context, void *priv)