xref: /third_party/libuv/src/win/stream-inl.h (revision e66f31c5)
1e66f31c5Sopenharmony_ci/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2e66f31c5Sopenharmony_ci *
3e66f31c5Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy
4e66f31c5Sopenharmony_ci * of this software and associated documentation files (the "Software"), to
5e66f31c5Sopenharmony_ci * deal in the Software without restriction, including without limitation the
6e66f31c5Sopenharmony_ci * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7e66f31c5Sopenharmony_ci * sell copies of the Software, and to permit persons to whom the Software is
8e66f31c5Sopenharmony_ci * furnished to do so, subject to the following conditions:
9e66f31c5Sopenharmony_ci *
10e66f31c5Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
11e66f31c5Sopenharmony_ci * all copies or substantial portions of the Software.
12e66f31c5Sopenharmony_ci *
13e66f31c5Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14e66f31c5Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15e66f31c5Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16e66f31c5Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17e66f31c5Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18e66f31c5Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19e66f31c5Sopenharmony_ci * IN THE SOFTWARE.
20e66f31c5Sopenharmony_ci */
21e66f31c5Sopenharmony_ci
22e66f31c5Sopenharmony_ci#ifndef UV_WIN_STREAM_INL_H_
23e66f31c5Sopenharmony_ci#define UV_WIN_STREAM_INL_H_
24e66f31c5Sopenharmony_ci
25e66f31c5Sopenharmony_ci#include <assert.h>
26e66f31c5Sopenharmony_ci
27e66f31c5Sopenharmony_ci#include "uv.h"
28e66f31c5Sopenharmony_ci#include "internal.h"
29e66f31c5Sopenharmony_ci#include "handle-inl.h"
30e66f31c5Sopenharmony_ci#include "req-inl.h"
31e66f31c5Sopenharmony_ci
32e66f31c5Sopenharmony_ci
33e66f31c5Sopenharmony_ciINLINE static void uv__stream_init(uv_loop_t* loop,
34e66f31c5Sopenharmony_ci                                   uv_stream_t* handle,
35e66f31c5Sopenharmony_ci                                   uv_handle_type type) {
36e66f31c5Sopenharmony_ci  uv__handle_init(loop, (uv_handle_t*) handle, type);
37e66f31c5Sopenharmony_ci  handle->write_queue_size = 0;
38e66f31c5Sopenharmony_ci  handle->activecnt = 0;
39e66f31c5Sopenharmony_ci  handle->stream.conn.shutdown_req = NULL;
40e66f31c5Sopenharmony_ci  handle->stream.conn.write_reqs_pending = 0;
41e66f31c5Sopenharmony_ci
42e66f31c5Sopenharmony_ci  UV_REQ_INIT(&handle->read_req, UV_READ);
43e66f31c5Sopenharmony_ci  handle->read_req.event_handle = NULL;
44e66f31c5Sopenharmony_ci  handle->read_req.wait_handle = INVALID_HANDLE_VALUE;
45e66f31c5Sopenharmony_ci  handle->read_req.data = handle;
46e66f31c5Sopenharmony_ci}
47e66f31c5Sopenharmony_ci
48e66f31c5Sopenharmony_ci
49e66f31c5Sopenharmony_ciINLINE static void uv__connection_init(uv_stream_t* handle) {
50e66f31c5Sopenharmony_ci  handle->flags |= UV_HANDLE_CONNECTION;
51e66f31c5Sopenharmony_ci}
52e66f31c5Sopenharmony_ci
53e66f31c5Sopenharmony_ci
54e66f31c5Sopenharmony_ci#endif /* UV_WIN_STREAM_INL_H_ */
55