Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract system-specifics from Socket #10706

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions src/crystal/system/socket.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
module Crystal::System::Socket
# Creates a file descriptor / socket handle
# private def create_handle(family, type, protocol, blocking) : Handle

# Initializes a file descriptor / socket handle for use with Crystal Socket
# private def initialize_handle(fd)

# private def system_connect(addr, timeout = nil)

# Tries to bind the socket to a local address.
# Yields an `Socket::BindError` if the binding failed.
# private def system_bind(addr, addrstr)

# private def system_listen(backlog)

# private def system_accept

# private def system_send(bytes : Bytes) : Int32

# private def system_send_to(bytes : Bytes, addr : ::Socket::Address)

# private def system_receive(bytes)

# private def system_close_read

# private def system_close_write

# private def system_reuse_port?

# private def system_reuse_port=(val : Bool)

# private def system_linger

# private def system_linger=(val)

# private def system_getsockopt(fd, optname, optval, level = LibC::SOL_SOCKET)

# private def system_setsockopt(fd, optname, optval, level = LibC::SOL_SOCKET)

# private def system_blocking?

# private def system_blocking=(value)

# private def system_tty?

# private def system_close_on_exec?

# private def system_close_on_exec=(arg : Bool)

# def self.fcntl(fd, cmd, arg = 0)

# private def unbuffered_read(slice : Bytes)

# private def unbuffered_write(slice : Bytes)

# private def system_close

# IPSocket:

# private def system_local_address

# private def system_remote_address

# TCPSocket:

# private def system_tcp_keepalive_idle

# private def system_tcp_keepalive_idle=(val : Int)

# private def system_tcp_keepalive_interval

# private def system_tcp_keepalive_interval=(val : Int)

# private def system_tcp_keepalive_count

# private def system_tcp_keepalive_count=(val : Int)
end

{% if flag?(:unix) %}
require "./unix/socket"
{% else %}
{% raise "No Crystal::System::Socket implementation available" %}
{% end %}
Loading