Avi Kivity
c0f87bbf40
net: fix byte order confusion in listen()
...
posix sockaddr_in gives the port in network byte order.
2014-09-10 15:42:24 +03:00
Avi Kivity
430acf7109
net: set up native network stack correctly
...
Start the interface and set up an IP address.
2014-09-10 15:41:51 +03:00
Avi Kivity
bb26a0c08a
httpd: allow switching network stack
2014-09-10 13:46:54 +03:00
Avi Kivity
e1e85ca5ff
core: allow configuring the network stack
2014-09-10 13:46:25 +03:00
Avi Kivity
82cf2eff7c
sstring: add conversion from std::string
2014-09-10 13:45:54 +03:00
Avi Kivity
1fc5069503
core: add format_separated()
...
For producing nice comma-separated lists.
2014-09-10 13:44:46 +03:00
Avi Kivity
033f941a1c
core: add sprint(fmt, ...)
...
Similar to sprintf(), only type-safe.
2014-09-10 13:44:10 +03:00
Avi Kivity
9c2a31bf0f
core: add networking stack registry
...
The registry allows stacks to name themselves to the core, so that
a networking stack can be selected at startup.
2014-09-10 11:42:33 +03:00
Avi Kivity
5ad3648c4f
sstring: fix assignment operator missing return
2014-09-10 11:36:13 +03:00
Avi Kivity
5630f636cd
net: add protcol stack adapter for native stack
...
This defines adapter classes for converting from the tcp<> class to the
abstractions that applications use.
Still very inefficient due to impedance mismatch between the data types used.
2014-09-10 10:42:21 +03:00
Avi Kivity
509e4e2768
net: add packet move assignment operator
2014-09-10 10:42:05 +03:00
Avi Kivity
c443c2852e
core: add escape accessors from socket_address to posix types
2014-09-10 10:41:23 +03:00
Avi Kivity
96563bbf5b
core: abstract reactor::listen() as a virtual networking_stack method
...
Since every connection (thus far) is established via listen(), this allows
us to abstract the entire stack.
2014-09-09 13:10:03 +03:00
Avi Kivity
1385a5278e
core: get rid of embarassing while () loop in future_state::get()
2014-09-09 12:37:13 +03:00
Avi Kivity
b3b5e1964f
core: switch output_stream to use data_sink instead of pollable_fd
2014-09-09 11:39:39 +03:00
Avi Kivity
7acbae1e5a
core: implement data_sink for posix sockets
2014-09-09 11:38:58 +03:00
Avi Kivity
cdf11e69f9
core: add data_sink abstraction
...
A data_sink is somewhere to send chunks of data, with back-pressure provided
by a future<> that becomes ready when it is okay to push more data.
2014-09-09 11:37:34 +03:00
Avi Kivity
6565909722
s/bsd/posix/
...
"bsd" in this context refers to BSD sockets, but it will be a lot less
confusing to refer to it as a POSIX API.
2014-09-09 09:18:39 +03:00
Avi Kivity
d71ac705a6
core: reactor::run(): cosmetic rearrangement
2014-09-08 21:39:52 +03:00
Avi Kivity
014657eaff
core: switch input_stream to use data_source
...
With this change, input_stream can be used to either the hosted or the native
stack (when it is plugged in).
2014-09-08 21:31:43 +03:00
Avi Kivity
f9084a2085
core: add a few helpers to temporary_buffer
2014-09-08 21:31:11 +03:00
Avi Kivity
2847a1de65
core: add data_source abstraction
...
This is a stream of data arriving in chunks. With a native TCP stack,
it will serve individual buffers as arriving from the network interface and
queued by the TCP stack. With the hosted stack (bsd_data_source_impl),
we unfortunately have to allocate each chunk individually.
2014-09-08 21:29:08 +03:00
Avi Kivity
e5e59dc7c2
temporary_buffer: support for sharing
...
A shared buffer will be destroyed when the last clone is destroyed.
2014-09-08 21:27:07 +03:00
Avi Kivity
6f86186e6d
eclipse: support for lvalue references
2014-09-08 21:22:51 +03:00
Avi Kivity
c14daba9e6
core: exit program by breaking the loop rather than exit()
...
This gives more destructors the option to run, making an easier job for
leak detectors.
2014-09-08 21:21:00 +03:00
Avi Kivity
d06508927e
core: add a share() helper for deleter class
2014-09-08 21:20:25 +03:00
Avi Kivity
2cc4728325
core: fix shared_ptr memory leak
2014-09-08 21:20:00 +03:00
Avi Kivity
be5e75b6a6
core: disable shared_ptr assignments (until implemented)
2014-09-08 21:19:36 +03:00
Avi Kivity
12aba7e9cb
core: fix promise move assignment
...
Leaked if an object was assigned to itself.
2014-09-08 21:00:09 +03:00
Avi Kivity
b725fa8ecc
core: support signals
...
Using a signalfd, convert the signal into a future<>, which is completed
when the signal is delivered.
Handle SIGINT by exiting cleanly.
2014-09-08 15:24:49 +03:00
Avi Kivity
a4beb74fa5
posix: add signalfd wrappers
2014-09-08 15:23:59 +03:00
Avi Kivity
a4b1716d69
core: join non-async worker thread on termination
...
Cleanly join the worker thread during termination, to avoid an EBADF when
the signalfd used for communication is destroyed. This lets atexit handlers
run, specifically leak detectors.
2014-09-08 15:20:10 +03:00
Avi Kivity
147046adea
Fix copyrights
2014-09-04 18:39:25 +03:00
Avi Kivity
effca50ae0
core: fix temporary_buffer<> assigned to itself
2014-09-04 15:33:28 +03:00
Avi Kivity
78154f4606
Switch temporary_buffer<> to use deleter for cleanup
...
More flexibility for integration with the native stack.
2014-09-04 15:29:05 +03:00
Avi Kivity
6092ac617b
build: use linker flags only when linking
...
Or clang complains.
2014-09-04 15:19:13 +03:00
Avi Kivity
b91389b1d5
core: extract packet::deleter into a core class
...
Useful everywhere zero-copy can be used.
2014-09-04 13:28:51 +03:00
Avi Kivity
ce7d8c5835
reactor.hh: remove dead code
2014-09-04 12:32:33 +03:00
Avi Kivity
3b0a9d89d9
core: abstract connected sockets
...
Instead of returning a pollable_fd from server_socket::accept(), return
a new abstract class connected_socket, which is able to provide an
input_stream and an output_stream to the caller.
2014-09-04 12:31:02 +03:00
Avi Kivity
6c1aabd7e1
core: abstrace reactor::listen()
...
Instead of returning the Unix-tied pollable_fd, return an abstract
server_socket class which is then implement atop pollable_fd, but can
be replaced with a native implementation.
2014-09-04 12:11:17 +03:00
Avi Kivity
065de692db
core: rename input_stream_buffer and output_stream_buffer
...
Since they are going to be the abstract interface to both the bsd socket
layer and the native tcp stack, rename them to more generic names -
input_stream and output_stream.
2014-09-04 11:24:08 +03:00
Avi Kivity
6f22345cf0
Add eclipse.hh to hide Eclipse CDT parsing errors
2014-09-04 10:42:01 +03:00
Avi Kivity
300abc77d8
core: split future/promise into a new header file
2014-09-04 10:37:59 +03:00
Avi Kivity
03c532eb03
net: tcp: only emit packet when needed
2014-09-04 09:21:18 +03:00
Avi Kivity
21d79c6a57
net: tcp: transmit data in outgoing packets
2014-09-04 09:20:44 +03:00
Avi Kivity
6e37ef5a6c
net: tcp: advance sequence number after our SYN is acked
2014-09-04 09:16:46 +03:00
Avi Kivity
e16ccd5fc5
net: tcp: keep track of whether our SYN was sent
2014-09-04 09:16:46 +03:00
Avi Kivity
f81450c1de
net: add iostream support to tcp_seq
2014-09-04 09:14:02 +03:00
Avi Kivity
8c5ce8c63f
net: add iostream support to packed<>
2014-09-04 09:13:42 +03:00
Avi Kivity
6a53e41053
net: packet sharing support
...
Add a share() method that enables reference counting for the packet and
returns a clone. The packet's deleter will only be invoked after all clones
are destroyed.
This is useful for tcp, which keeps a packet in the unacknowledged transmit
queue while sending it lower down the stack.
2014-09-04 09:13:00 +03:00