Name

SPVM::Net::SSLeay::BIO - BIO Data Strucutre in OpenSSL

Description

Net::SSLeay::BIO class of SPVM represents BIO data structure in OpenSSL.

Usage

use Net::SSLeay::BIO;

Class Methods

new

static method new : Net::SSLeay::BIO ();

Calls BIO_new function given the return value of native BIO_s_mem function as the first argument, creates a new Net::SSLeay::BIO object, sets the pointer value of the new object to the return value of the native function, and returns the new object.

Exceptions:

If BIO_new failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

new_file

static method new_file : Net::SSLeay::BIO ($filename : string, $mode : string);

Calls native BIO_new_file function given the file name $filename and the mode $mode, creates a new Net::SSLeay::BIO object, sets the pointer value of the new object to the return value of the native function, and returns the new object.

Exceptions:

If BIO_new_file failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

Instance Methods

read

method read : int ($data : mutable string, $dlen : int = -1);

Calls native BIO_read function given the pointer value of the instance, $data and $dlen, and returns its return value.

If $dlen is lower than 0, it is set to the length of $data.

Exceptions:

The $data must be defined. Otherwise an exception is thrown.

The $dlen must be lower than or equal to the length of the $data. Otherwise an exception is thrown.

If BIO_read failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

write

method write : int ($data : string, $dlen : int = -1);

Calls native BIO_write function given the pointer value of the instance, $data and $dlen, and returns its return value.

If $dlen is lower than 0, it is set to the length of $data.

Exceptions:

The $data must be defined. Otherwise an exception is thrown.

The $dlen must be lower than or equal to the length of the $data. Otherwise an exception is thrown.

If BIO_write failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

DESTROY

method DESTROY : void ();

Calls native BIO_free function given the pointer value of the instance unless no_free flag of the instance is a true value.

See Also

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License