2019-08-22 21:35:47 +00:00
|
|
|
## Nim-LibP2P
|
|
|
|
## Copyright (c) 2018 Status Research & Development GmbH
|
|
|
|
## Licensed under either of
|
|
|
|
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
|
|
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
|
|
## at your option.
|
|
|
|
## This file may not be copied, modified, or distributed except according to
|
|
|
|
## those terms.
|
|
|
|
|
|
|
|
import chronos
|
|
|
|
|
|
|
|
type ReadWrite* = ref object of RootObj
|
2019-08-24 19:16:04 +00:00
|
|
|
closed*: bool
|
2019-08-22 21:35:47 +00:00
|
|
|
|
2019-08-26 15:37:15 +00:00
|
|
|
method read*(s: ReadWrite, n = -1): Future[seq[byte]]
|
2019-08-22 21:35:47 +00:00
|
|
|
{.base, async.} =
|
|
|
|
discard
|
|
|
|
|
2019-08-26 15:37:15 +00:00
|
|
|
method readExactly*(s: ReadWrite, pbytes: pointer, nbytes: int): Future[void]
|
2019-08-22 21:35:47 +00:00
|
|
|
{.base, async.} =
|
|
|
|
discard
|
|
|
|
|
2019-08-26 15:37:15 +00:00
|
|
|
method readLine*(s: ReadWrite, limit = 0, sep = "\r\n"): Future[string]
|
|
|
|
{.base, async.} =
|
2019-08-22 21:35:47 +00:00
|
|
|
discard
|
|
|
|
|
2019-08-26 15:37:15 +00:00
|
|
|
method readOnce*(s: ReadWrite, pbytes: pointer, nbytes: int): Future[int]
|
|
|
|
{.base, async.} =
|
2019-08-22 21:35:47 +00:00
|
|
|
discard
|
|
|
|
|
2019-08-26 15:37:15 +00:00
|
|
|
method readUntil*(s: ReadWrite,
|
|
|
|
pbytes: pointer, nbytes: int,
|
|
|
|
sep: seq[byte]): Future[int]
|
|
|
|
{.base, async.} =
|
2019-08-22 21:35:47 +00:00
|
|
|
discard
|
|
|
|
|
2019-08-24 23:48:01 +00:00
|
|
|
method write*(s: ReadWrite, pbytes: pointer, nbytes: int)
|
2019-08-26 15:37:15 +00:00
|
|
|
{.base, async.} =
|
2019-08-22 21:35:47 +00:00
|
|
|
discard
|
|
|
|
|
2019-08-24 23:48:01 +00:00
|
|
|
method write*(s: ReadWrite, msg: string, msglen = -1)
|
2019-08-26 15:37:15 +00:00
|
|
|
{.base, async.} =
|
2019-08-22 21:35:47 +00:00
|
|
|
discard
|
|
|
|
|
2019-08-24 23:48:01 +00:00
|
|
|
method write*(s: ReadWrite, msg: seq[byte], msglen = -1)
|
2019-08-26 15:37:15 +00:00
|
|
|
{.base, async.} =
|
2019-08-22 21:35:47 +00:00
|
|
|
discard
|
|
|
|
|
2019-08-26 15:37:15 +00:00
|
|
|
method close*(s: ReadWrite)
|
|
|
|
{.base, async.} =
|
2019-08-22 21:35:47 +00:00
|
|
|
discard
|