How cs144/imp works
This is a Stanford CS 144 networking lab repository: a collection of networking exercises and runtime primitives, not a finished networking product. The clearest implemented workflow is tcp_native: a user selects client or listen mode, the program connects or accepts a TCP peer, then copies bytes bidirectionally between the socket and standard input/output. The bounded ByteStream and event loop support that copy path, though the stream implementation shown is still stubbed. Packet-format and raw-network components are present in the tree, but their wiring is not established by the sampled source; those links are omitted.
Main entry points: file_descriptor.cc File descriptors · bidirectional_stream_copy.cc Bidirectional copy · tcp_native.cc TCP client/server · byte_stream.cc Bounded byte stream
Components 18
Applications
- TCP client/server
apps/tcp_native.cc - Bidirectional copy
apps/bidirectional_stream_copy.cc - Web fetch exercise
apps/webget.cc - Raw IP exercise
apps/ip_raw.cc
Byte streams
- Bounded byte stream
src/byte_stream.cc - Stream helpers
src/byte_stream_helpers.cc
I/O runtime
- Event loop
util/eventloop.cc - File descriptors
util/file_descriptor.cc - Socket operations
util/socket.cc
Network primitives
- Socket addresses
util/address.cc - Parser and serializer
util/parser.cc - IPv4 header
util/ipv4_header.cc - Packet formats
util - TUN interface
util/tun.cc
Other components
- User
- Standard input
- Standard output
- TCP peer
Connections 17
- User → TCP client/server: chooses mode
- TCP client/server → Socket addresses: resolves peer
- TCP client/server → Socket operations: connects or accepts
- TCP client/server → Bidirectional copy: starts copy
- TCP peer → Socket operations: TCP connection
- Bidirectional copy → Event loop: registers I/O rules
- Bidirectional copy → Bounded byte stream: buffers bytes
- Bidirectional copy → File descriptors: reads and writes
- Bidirectional copy → Socket operations: reads and writes
- Standard input → File descriptors: provides input
- File descriptors → Bounded byte stream: input bytes
- Bounded byte stream → File descriptors: output bytes
- File descriptors → Standard output: writes output
- Event loop → File descriptors: polls readiness
- Stream helpers → Bounded byte stream: reads from
- IPv4 header → Parser and serializer: parses fields
- IPv4 header → Parser and serializer: serializes fields