Skip to content

Add InetSocket enum and placeholder TcpSocket struct#2589

Merged
stevenengler merged 1 commit intoshadow:mainfrom
stevenengler:inet-socket-wrapper
Dec 6, 2022
Merged

Add InetSocket enum and placeholder TcpSocket struct#2589
stevenengler merged 1 commit intoshadow:mainfrom
stevenengler:inet-socket-wrapper

Conversation

@stevenengler
Copy link
Copy Markdown
Contributor

@stevenengler stevenengler commented Dec 5, 2022

This is in preparation for wrapping the C TCP object in a Rust TcpSocket file object. This brings our rust file object hierarchy to:

- File (enum)
  - Pipe (struct)
  - EventFd (struct)
  - Socket (enum)
    - UnixSocket (struct)
    - InetSocket (enum)
       - TcpSocket (struct)

Each enum has corresponding Ref and RefMut enums as well. For example, there is a InetSocket enum, a InetSocketRef enum, and a InetSocketRefMut enum. It's a lot of extra boilerplate code, but makes working with files/sockets much nicer.

Eventually when the network interface is in Rust, it will deal with InetSocket objects, which will be a common interface for TCP and UDP sockets.

I originally thought about combining the TCP (stream) and UDP (dgram) socket structs into a single InetSocket struct (like how UnixSocket supports both stream and dgram protocols), but decided against it for now.

@stevenengler stevenengler changed the title Addd InetSocket enum and placeholder TcpSocket struct Add InetSocket enum and placeholder TcpSocket struct Dec 5, 2022
@github-actions github-actions bot added the Component: Main Composing the core Shadow executable label Dec 5, 2022
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 6, 2022

Codecov Report

Base: 67.01% // Head: 66.67% // Decreases project coverage by -0.34% ⚠️

Coverage data is based on head (702d66a) compared to base (3a59dfc).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2589      +/-   ##
==========================================
- Coverage   67.01%   66.67%   -0.35%     
==========================================
  Files         195      197       +2     
  Lines       29029    29171     +142     
  Branches     5716     5743      +27     
==========================================
- Hits        19454    19449       -5     
- Misses       5044     5184     +140     
- Partials     4531     4538       +7     
Flag Coverage Δ
tests 66.67% <0.00%> (-0.35%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/host/descriptor/socket/inet/mod.rs 0.00% <0.00%> (ø)
src/main/host/descriptor/socket/inet/tcp.rs 0.00% <0.00%> (ø)
src/main/host/descriptor/socket/mod.rs 29.78% <0.00%> (-14.83%) ⬇️
src/main/utility/enum_passthrough.rs 55.55% <0.00%> (-12.63%) ⬇️
src/main/core/scheduler/pools/bounded.rs 74.50% <0.00%> (-1.97%) ⬇️
src/main/host/syscall/handler/unistd.rs 55.02% <0.00%> (-0.88%) ⬇️
src/main/core/sim_config.rs 53.47% <0.00%> (-0.87%) ⬇️
src/main/host/descriptor/socket/unix.rs 68.00% <0.00%> (-0.23%) ⬇️
src/main/host/memory_manager/memory_mapper.rs 66.66% <0.00%> (+0.20%) ⬆️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@stevenengler stevenengler merged commit 53eedba into shadow:main Dec 6, 2022
@stevenengler stevenengler deleted the inet-socket-wrapper branch December 6, 2022 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Main Composing the core Shadow executable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants