4.7 KiB
danog\MadelineProto\Stream\Common\HashedBufferedStream
Author: Daniil Gentili daniil@daniil.it
Hash stream wrapper.
Method list:
startReadHash(): void
checkReadHash(int $after): void
getReadHash(): string
hasReadHash(): bool
startWriteHash(): void
checkWriteHash(int $after): void
getWriteHash(): string
hasWriteHash(): bool
bufferReadGenerator(int $length): \Generator That resolves with a string when the provided promise is resolved and the data is added to the hashing context
setExtra(string $hash): void
connect(\danog\MadelineProto\Stream\ConnectionContext $ctx): \Generator
disconnect(): \Amp\Promise
getReadBufferGenerator(int $length): \Generator
getWriteBufferGenerator(int $length): \Generator
bufferRead(): \Promise Resolves with a string when new data is available or
nullif the stream has closed.
bufferWrite(string $data): \Promise Succeeds once the data has been successfully written to the stream.
getSocket(): \Amp\Socket\Socket
getStream(): \danog\MadelineProto\Stream\RawStreamInterface
getReadBuffer(int $length): \Amp\Promise
getWriteBuffer(int $length, string $append): \Amp\Promise
Methods:
startReadHash(): void
Enable read hashing.
checkReadHash(int $after): void
Check the read hash after N bytes are read.
Parameters:
$after
:int
The number of bytes to read before checking the hash
getReadHash(): string
Stop read hashing and get final hash.
hasReadHash(): bool
Check if we are read hashing.
startWriteHash(): void
Enable write hashing.
checkWriteHash(int $after): void
Write the write hash after N bytes are read.
Parameters:
$after
:int
The number of bytes to read before writing the hash
getWriteHash(): string
Stop write hashing and get final hash.
hasWriteHash(): bool
Check if we are write hashing.
bufferReadGenerator(int $length): \Generator That resolves with a string when the provided promise is resolved and the data is added to the hashing context
Hashes read data asynchronously.
Parameters:
$length
:int
Read and hash $length bytes
Return value: That resolves with a string when the provided promise is resolved and the data is added to the hashing context
setExtra(string $hash): void
Set the hash algorithm.
Parameters:
$hash
:string
Algorithm name
connect(\danog\MadelineProto\Stream\ConnectionContext $ctx): \Generator
Connect to stream.
Parameters:
$ctx
:\danog\MadelineProto\Stream\ConnectionContext
The connection context
See also:
disconnect(): \Amp\Promise
Async close.
See also:
\Amp\Promise
getReadBufferGenerator(int $length): \Generator
Get read buffer asynchronously.
Parameters:
$length
:int
Length of payload, as detected by this layer
See also:
\Generator
getWriteBufferGenerator(int $length): \Generator
Get write buffer asynchronously.
Parameters:
$length
:int
Length of data that is going to be written to the write buffer
See also:
\Generator
bufferRead(): \Promise Resolves with a string when new data is available or
null if the stream has closed.
Reads data from the stream.
Return value: Resolves with a string when new data is available or null
if the stream has closed.
bufferWrite(string $data): \Promise Succeeds once the data has been successfully written to the stream.
Writes data to the stream.
Parameters:
$data
:string
Bytes to write.
Return value: Succeeds once the data has been successfully written to the stream.
getSocket(): \Amp\Socket\Socket
{@inheritdoc}
See also:
\Amp\Socket\Socket
getStream(): \danog\MadelineProto\Stream\RawStreamInterface
{@inheritDoc}
See also:
getReadBuffer(int $length): \Amp\Promise
Get read buffer asynchronously.
Parameters:
$length
:int
Length of payload, as detected by this layer
See also:
\Amp\Promise
getWriteBuffer(int $length, string $append): \Amp\Promise
Get write buffer asynchronously.
Parameters:
$length
:int
Total length of data that is going to be piped in the buffer$append
:string
Data to append after entire buffer is written
See also:
\Amp\Promise
Generated by danog/phpdoc