View Source quicer_nif (quicer v0.0.303)

Summary

Types

-type acceptor_opts() :: map().
-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 conf_handle() :: reference().
-type conn_opts() ::
    quic_settings() |
    #{alpn := [string()],
      conn_callback => module(),
      cert => filelib:filename(),
      certfile => filelib:filename(),
      key => filelib:filename(),
      keyfile => filelib:filename(),
      password => string(),
      verify => none | peer,
      handle => connection_handle(),
      nst => binary(),
      cacertfile => filelib:filename(),
      sslkeylogfile => filelib:filename(),
      peer_bidi_stream_count => uint16(),
      peer_unidi_stream_count => uint16(),
      handshake_idle_timeout_ms => non_neg_integer(),
      quic_event_mask => uint32(),
      param_conn_disable_1rtt_encryption => boolean(),
      param_conn_local_address => string()}.
-type conn_shutdown_flag() :: 0 | 1.
-type connection_handle() :: reference().
-type execution_profile() ::
    quic_execution_profile_low_latency | quic_execution_profile_type_max_throughput |
    quic_execution_profile_type_scavenger | quic_execution_profile_type_realtime.
-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 => filelib:filename(),
      password => string(),
      sslkeylogfile => filelib:filename(),
      allow_insecure => boolean(),
      quic_registration => reg_handle(),
      conn_acceptors => non_neg_integer()}.
-type listener_handle() :: reference().
-type optlevel() :: false | quic_global | quic_registration | quic_configuration | quic_tls.
Link to this type

optname_configuration/0

View Source
-type optname_configuration() :: param_configuration_settings | param_configuration_ticket_keys.
-type optname_conn() ::
    param_conn_quic_version | param_conn_local_address | param_conn_remote_address |
    param_conn_ideal_processor | param_conn_settings | param_conn_statistics |
    param_conn_statistics_plat | param_conn_share_udp_binding |
    param_conn_local_bidi_stream_count | param_conn_local_unidi_stream_count |
    param_conn_max_stream_ids | param_conn_close_reason_phrase |
    param_conn_stream_scheduling_scheme | param_conn_datagram_receive_enabled |
    param_conn_datagram_send_enabled | param_conn_disable_1rtt_encryption |
    param_conn_resumption_ticket | param_conn_peer_certificate_valid | param_conn_local_interface.
-type optname_global() ::
    param_global_retry_memory_percent | param_global_supported_versions |
    param_global_load_balacing_mode | param_global_perf_counters | param_global_settings |
    param_global_version.
-type optname_listener() ::
    param_listener_local_address | param_listener_stats | param_listener_cibir_id.
-type optname_reg() :: param_registration_cid_prefix.
-type optname_stream() ::
    active | controlling_process | param_stream_id | param_stream_0rtt_length |
    param_stream_ideal_send_buffer_size | param_stream_priority.
-type optname_tls() ::
    param_tls_schannel_context_attribute_w | param_tls_handshake_info | param_tls_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(),
      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() ::
    quic_execution_profile_low_latency | quic_execution_profile_max_throughput |
    quic_execution_profile_scavenger | quic_execution_profile_realtime.
-type send_flags() :: non_neg_integer().
-type stream_handle() :: reference().
-type stream_open_flags() :: 0 | 1 | 2.
-type stream_opts() ::
    #{active := boolean() | once | integer(),
      open_flag => stream_open_flags(),
      start_flag => stream_start_flags(),
      event_mask => uint32(),
      disable_fpbuffer => boolean()}.
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 uint64() :: 0..1 bsl 64 - 1.

Functions

-spec abi_version() -> integer().
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_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 | {error, closed | badarg}.
Link to this function

close_registration(Handle)

View Source
-spec close_registration(reg_handle()) -> ok | {error | badarg}.
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}.
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 get_conn_owner(connection_handle()) -> {ok, pid()} | {error, undefined | badarg}.
-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()) -> {ok, pid()} | {error, undefined | badarg}.
-spec get_listeners() -> [listener_handle()].
-spec get_listeners(reg_handle()) -> [listener_handle()] | {error, badarg}.
Link to this function

get_registration_name(Handle)

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

getopt(Handle, Optname, IsRaw)

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()}.
Link to this function

new_registration(Name, Profile)

View Source
-spec new_registration(Name :: string(), registration_profile()) ->
                    {ok, reg_handle()} | {error, atom_reason()}.
-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} | {error, open_failed, atom_reason()}.
-spec peercert(connection_handle() | stream_handle()) ->
            {ok, Cert :: public_key:der_encoded()} | {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}.
-spec reg_open(execution_profile()) -> ok | {error, badarg}.
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 | closed} |
              {error, dgram_send_error, atom_reason()}.
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(reg_handle()) -> ok | {error | badarg}.
Link to this function

shutdown_registration(Handle, IsSilent, ErrorCode)

View Source
-spec shutdown_registration(reg_handle(), IsSilent :: boolean(), ErrorCode :: uint64()) ->
                         ok | {error | badarg}.
-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 | badarg}.