# Copyright (c) 2023 Yuki Kimoto
# MIT License

class Net::SSLeay::ERR : pointer {
  version_from Net::SSLeay;
  
  use Net::SSLeay::Error;
  
  use Fn;
  
  # Class Methods
  native static method error_string_n : void ($e : long, $buf : mutable string, $len : int = -1);
  
  # Instance Methods
  static method error_string : string ($e : long) {
    my $buf = (mutable string)new_string_len 256;
    
    &error_string_n($e, $buf);
    
    Fn->shorten_null_char($buf);
    
    return $buf;
  }
  
  native method get_error : long ();
  
  native method peek_error : long ();
  
  native method peek_last_error : long ();
  
}