View Source quicer_nif (quicer v0.2.12)

Summary

Functions

close the listener return closed if the listener is closed. return ok if the listener is stopped then closed, and caller should expect listener_stopped signal.
enable signal buffering, used in stream handoff. * not exposed API.
flush buffered stream signals to the current owner * not exposed API. also @see quicer:controlling_process/2
mock buffer a signal in sig_buffer. for testing sig_buffer

Types

-type abi_version() :: integer().
-type acceptor_opts() :: quic_settings() | #{active => boolean()}.
-type active_n() :: boolean() | once | integer().
-type alpn() :: string().
-type app_errno() :: non_neg_integer().
-type atom_reason() ::
    success | pending | continue | out_of_memory | invalid_parameter | invalid_state |
    not_supported | not_found | buffer_too_small | handshake_failure | aborted | address_in_use |
    connection_timeout | connection_idle | internal_error | connection_refused | protocol_error |
    ver_neg_error | unreachable | tls_error | user_canceled | alpn_neg_failure |
    stream_limit_reached.
-type close_registration() :: ok | {error, badarg}.
-type conf_handle() :: reference().
-type conn_opts() ::
    quic_settings() |
    #{alpn := [string()],
      conn_callback => module(),
      cert => file:filename(),
      certfile => file:filename(),
      key => file:filename(),
      keyfile => file:filename(),
      password => string(),
      verify => none | peer,
      custom_verify => boolean(),
      handle => connection_handle(),
      nst => binary(),
      cacertfile => file:filename(),
      sslkeylogfile => file:filename(),
      handshake_idle_timeout_ms => non_neg_integer(),
      quic_event_mask => uint32(),
      disable_1rtt_encryption => boolean(),
      local_address => string(),
      local_bidi_stream_count => uint16(),
      local_peer_unidi_stream_count => uint16(),
      _ => _}.
-type conn_shutdown_flag() :: 0 | 1.
-type connection_handle() :: reference().
-type csend_flags() :: 0 | 1 | 2 | 4 | 8 | 16.
-type execution_profile() ::
    quic_execution_profile_low_latency | quic_execution_profile_max_throughput |
    quic_execution_profile_scavenger | quic_execution_profile_real_time.
-type get_connections() :: [connection_handle()].
-type get_listeners() :: [listener_handle()].
-type get_owner() :: {ok, pid()} | {error, undefined | badarg}.
Link to this type

get_registration_name/0

View Source
-type get_registration_name() :: {ok, string()} | {error, badarg}.
Link to this type

get_registration_refcnt/0

View Source
-type get_registration_refcnt() :: {error, closed} | integer().
-type global_handle() :: quic_global.
-type hostname() :: string().
-type listen_on() :: inet:port_number() | string().
-type listen_opts() :: listen_security_opts() | quic_settings().
Link to this type

listen_security_opts/0

View Source
-type listen_security_opts() ::
    #{alpn := [alpn()],
      cert := file:filename(),
      certfile := file:filename(),
      key := file:filename(),
      keyfile := file:filename(),
      verify => none | peer | verify_peer | verify_none,
      cacertfile => file:filename(),
      password => string(),
      sslkeylogfile => file:filename(),
      allow_insecure => boolean(),
      quic_registration => reg_handle(),
      conn_acceptors => non_neg_integer()}.
-type listener_handle() :: reference().
-type new_registration() :: {ok, reg_handle()} | {error, atom_reason()}.
-type optlevel() :: false | quic_global | quic_registration | quic_configuration | quic_tls.
Link to this type

optname_configuration/0

View Source
-type optname_configuration() :: settings | ticket_keys.
-type optname_conn() ::
    quic_version | local_address | remote_address | ideal_processor | settings | statistics |
    statistics_plat | share_udp_binding | local_bidi_stream_count | local_unidi_stream_count |
    max_stream_ids | close_reason_phrase | stream_scheduling_scheme | datagram_receive_enabled |
    datagram_send_enabled | disable_1rtt_encryption | resumption_ticket | peer_certificate_valid |
    local_interface.
-type optname_global() ::
    retry_memory_percent | supported_versions | load_balacing_mode | perf_counters |
    global_settings | global_version.
-type optname_listener() :: local_address | stats | cibir_id.
-type optname_reg() :: cid_prefix.
-type optname_stream() ::
    active | controlling_process | stream_id | '0rtt_length' | ideal_send_buffer_size | priority.
-type optname_tls() :: schannel_context_attribute_w | handshake_info | negotiated_alpn.
-type quic_settings() ::
    #{max_bytes_per_key => uint64(),
      handshake_idle_timeout_ms => uint64(),
      idle_timeout_ms => uint64(),
      tls_client_max_send_buffer => uint32(),
      tls_server_max_send_buffer => uint32(),
      stream_recv_window_default => uint32(),
      stream_recv_buffer_default => uint32(),
      conn_flow_control_window => uint32(),
      max_stateless_operations => uint32(),
      initial_window_packets => uint32(),
      send_idle_timeout_ms => uint32(),
      initial_rtt_ms => uint32(),
      max_ack_delay_ms => uint32(),
      disconnect_timeout_ms => uint32(),
      keep_alive_interval_ms => uint32(),
      congestion_control_algorithm => uint16(),
      peer_bidi_stream_count => uint16(),
      peer_unidi_stream_count => uint16(),
      retry_memory_limit => uint16(),
      load_balancing_mode => uint16(),
      max_operations_per_drain => uint8(),
      send_buffering_enabled => uint8(),
      pacing_enabled => uint8(),
      migration_enabled => uint8(),
      datagram_receive_enabled => uint8(),
      server_resumption_level => uint8(),
      minimum_mtu => uint16(),
      maximum_mtu => uint16(),
      mtu_discovery_search_complete_timeout_us => uint64(),
      mtu_discovery_missing_probe_count => uint8(),
      max_binding_stateless_operations => uint16(),
      stateless_operation_expiration_ms => uint16()}.
-type reg_handle() :: reference().
Link to this type

registration_profile/0

View Source
-type registration_profile() :: execution_profile().
-type send_flags() :: csend_flags() | 4096.
Link to this type

shutdown_registration/0

View Source
-type shutdown_registration() :: ok | {error, badarg | invalid_state}.
-type stream_handle() :: reference().
-type stream_open_flags() :: 0 | 1 | 2.
-type stream_opts() ::
    #{active := active_n(),
      open_flag => stream_open_flags(),
      start_flag => stream_start_flags(),
      event_mask => uint32(),
      disable_fpbuffer => boolean(),
      stream_id => uint62(),
      priority => uint16(),
      ideal_send_buffer_size => uint64(),
      '0rtt_length' => uint64(),
      _ => _}.
Link to this type

stream_shutdown_flags/0

View Source
-type stream_shutdown_flags() :: 0 | 1 | 2 | 4 | 6 | 8.
-type stream_start_flags() :: 0 | 1 | 2 | 4 | 8.
-type uint8() :: 0..1 bsl 8 - 1.
-type uint16() :: 0..1 bsl 16 - 1.
-type uint32() :: 0..1 bsl 32 - 1.
-type uint62() :: 0..1 bsl 62 - 1.
-type uint64() :: 0..1 bsl 64 - 1.

Functions

-spec abi_version() -> abi_version().
Link to this function

async_accept(Listener, Opts)

View Source
-spec async_accept(listener_handle(), acceptor_opts()) ->
                {ok, listener_handle()} | {error, badarg | param_error | not_enough_mem | badpid}.
Link to this function

async_accept_stream(Conn, Opts)

View Source
-spec async_accept_stream(connection_handle(), stream_opts()) ->
                       {ok, connection_handle()} |
                       {error, badarg | internal_error | bad_pid | owner_dead}.
Link to this function

async_connect(Host, Port, Opts)

View Source
-spec async_connect(hostname(), inet:port_number(), conn_opts()) ->
                 {ok, connection_handle()} |
                 {error, conn_open_error | config_error | conn_start_error} |
                 {error, not_found, any()}.
Link to this function

async_handshake(Connection)

View Source
-spec async_handshake(connection_handle()) -> ok | {error, badarg | atom_reason()}.
Link to this function

async_handshake(Connection, ConnOpts)

View Source
-spec async_handshake(connection_handle(), conn_opts()) -> ok | {error, badarg | atom_reason()}.
Link to this function

async_shutdown_connection(Conn, Flags, ErrorCode)

View Source
-spec async_shutdown_connection(connection_handle(), conn_shutdown_flag(), app_errno()) ->
                             ok | {error, badarg}.
Link to this function

async_shutdown_stream(Stream, Flags, ErrorCode)

View Source
-spec async_shutdown_stream(stream_handle(), stream_shutdown_flags(), app_errno()) ->
                         ok | {error, badarg | atom_reason()}.
-spec close_lib() -> ok.
Link to this function

close_listener(Listener)

View Source
-spec close_listener(listener_handle()) -> ok | closed | {error, closed | badarg}.
close the listener return closed if the listener is closed. return ok if the listener is stopped then closed, and caller should expect listener_stopped signal.
Link to this function

close_registration(Handle)

View Source
-spec close_registration(reg_handle()) -> close_registration().
Link to this function

complete_cert_validation(Conn, IsAccepted, TlsAlert)

View Source
-spec complete_cert_validation(connection_handle(), boolean(), integer()) -> ok | {error, any()}.
Link to this function

controlling_process(H, P)

View Source
-spec controlling_process(connection_handle() | stream_handle(), pid()) ->
                       ok | {error, closed | badarg | owner_dead | not_owner}.
-spec copy_stream_handle(stream_handle()) -> {ok, stream_handle()} | {error, badarg}.
-spec count_reg_conns() -> non_neg_integer().
Link to this function

count_reg_conns(RegHandle)

View Source
-spec count_reg_conns(reg_handle()) -> non_neg_integer() | {error, badarg}.
Link to this function

csend(Conn, Data, Opts, Flags)

View Source
-spec csend(connection_handle(), iodata(), stream_opts(), send_flags()) ->
         {ok, BytesSent :: pos_integer()} |
         {error, badarg | not_enough_mem | closed} |
         {error, stream_send_error, atom_reason()}.
-spec enable_sig_buffer(stream_handle()) -> ok.
enable signal buffering, used in stream handoff. * not exposed API.
Link to this function

flush_stream_buffered_sigs(H)

View Source
-spec flush_stream_buffered_sigs(stream_handle()) -> ok | {error, badarg | none}.
flush buffered stream signals to the current owner * not exposed API. also @see quicer:controlling_process/2
-spec get_conn_owner(connection_handle()) -> get_owner().
-spec get_conn_rid(connection_handle()) -> {ok, non_neg_integer()} | {error, badarg | internal_error}.
-spec get_connections() -> [connection_handle()].
Link to this function

get_connections(RegHandle)

View Source
-spec get_connections(reg_handle()) -> [connection_handle()] | {error, badarg}.
-spec get_listener_owner(listener_handle()) -> get_owner().
-spec get_listeners() -> get_listeners().
-spec get_listeners(reg_handle()) -> get_listeners().
Link to this function

get_registration_name(Handle)

View Source
-spec get_registration_name(reg_handle()) -> get_registration_name().
Link to this function

get_registration_refcnt(Handle)

View Source
-spec get_registration_refcnt(reg_handle()) -> get_registration_refcnt().
-spec get_snab_kc_pid() -> pid().
-spec get_stream_owner(connection_handle()) -> get_owner().
-spec get_stream_rid(stream_handle()) -> {ok, non_neg_integer()} | {error, badarg | internal_error}.
Link to this function

getopt(Handle, Optname, Level)

View Source
-spec getopt(handle(), optname(), optlevel()) ->
          not_found |
          {ok, any()} |
          {error, badarg | param_error | internal_error | not_enough_mem} |
          {error, atom_reason()}.
Link to this function

listen(ListenOn, Options)

View Source
-spec listen(listen_on(), listen_opts()) ->
          {ok, listener_handle()} |
          {error, listener_open_error, atom_reason()} |
          {error, listener_start_error, atom_reason()}.
-spec malloc_stats() -> ok.
-spec malloc_trim() -> ok.
Link to this function

mock_buffer_sig(StreamHandle, OrigOwner, Msg)

View Source
-spec mock_buffer_sig(stream_handle(), OrigOwner :: pid(), term()) ->
                   ok | {error, false | none | bad_pid | bad_arg}.
mock buffer a signal in sig_buffer. for testing sig_buffer
Link to this function

new_registration(Name, Profile)

View Source
-spec new_registration(Name :: string(), Profile :: registration_profile()) -> new_registration().
-spec open_connection() -> {ok, connection_handle()} | {error, atom_reason()}.
-spec open_connection(#{quic_registration => reg_handle()}) ->
                   {ok, connection_handle()} | {error, atom_reason()}.
-spec open_lib() ->
            {ok, true} |
            {ok, false} |
            {ok, debug} |
            {ok, fake} |
            {error, open_failed, atom_reason()}.
-spec peercert(connection_handle() | stream_handle()) ->
            {ok, CertDerEncoded :: binary()} | {error, any()}.
-spec recv(stream_handle(), non_neg_integer()) ->
        {ok, binary()} | {ok, not_ready} | {error, badarg | einval | closed}.
-spec reg_close() -> ok.
-spec reg_open() -> ok | {error, badarg | invalid_state}.
-spec reg_open(execution_profile()) -> ok | {error, badarg | invalid_state}.
Link to this function

send(Stream, Data, Flags)

View Source
-spec send(stream_handle(), iodata(), send_flags()) ->
        {ok, BytesSent :: pos_integer()} |
        {error, badarg | not_enough_mem | closed} |
        {error, stream_send_error, atom_reason()}.
Link to this function

send_dgram(Conn, Data, Flags)

View Source
-spec send_dgram(connection_handle(), iodata(), send_flags()) ->
              {ok, BytesSent :: pos_integer()} |
              {error, badarg | not_enough_memory | invalid_parameter | closed} |
              {error, dgram_send_error, atom_reason()}.
-spec set_snab_kc_pid(pid()) -> ok | {error, badarg}.
Link to this function

setopt(Handle, Opt, Value, Level)

View Source
-spec setopt(handle(), optname(), any(), optlevel()) ->
          ok |
          {error, badarg | param_error | internal_error | not_enough_mem} |
          {error, atom_reason()}.
Link to this function

shutdown_registration(Handle)

View Source
-spec shutdown_registration(global | reg_handle()) -> shutdown_registration().
Link to this function

shutdown_registration(Handle, IsSilent, ErrorCode)

View Source
-spec shutdown_registration(global | reg_handle(), IsSilent :: boolean(), ErrorCode :: uint64()) ->
                         shutdown_registration().
-spec sockname(connection_handle() | stream_handle()) ->
            {ok, {inet:ip_address(), inet:port_number()}} | {error, badarg | sockname_error}.
Link to this function

start_listener(Listener, ListenOn, Opts)

View Source
-spec start_listener(listener_handle(), listen_on(), listen_opts()) -> ok | {error, closed | badarg}.
Link to this function

start_stream(Conn, Opts)

View Source
-spec start_stream(connection_handle(), stream_opts()) ->
                {ok, stream_handle()} |
                {error, badarg | internal_error | bad_pid | owner_dead | not_enough_mem} |
                {error, stream_open_error, atom_reason()} |
                {error, stream_start_error, atom_reason()}.
-spec stop_listener(listener_handle()) -> ok | {error, closed | listener_stopped | badarg}.