# libnetplus

A cross-platform C++17 networking library covering TCP/UDP sockets, TLS 1.2/1.3,
and a from-scratch QUIC/HTTP3 implementation, with epoll/kqueue/IOCP/select
event loops and hardware-accelerated cryptography.

## Class hierarchy

```
socket        base: address handling, non-blocking I/O, event registration
├── tcp       stream sockets, connection pooling
│   └── ssl   TLS 1.2/1.3 over tcp (handshake, record layer, ALPN)
└── udp       datagram sockets, GSO/GRO batching (sendmmsg/recvmmsg)
    └── quic  QUIC (RFC 9000/9001/9002/9438) + HTTP/3 over udp
```

## Features

- **Sockets**: TCP/UDP servers and clients, connection pooling, IPv4/IPv6,
  Unix domain sockets.
- **Event loops**: epoll (Linux), kqueue (BSD), IOCP (Windows), select
  (portable fallback) — chosen automatically per platform.
- **TLS**: 1.2 and 1.3 (RFC 8446), own X.509/PKCS#12 handling, ALPN.
- **QUIC/HTTP3**: RFC 9000 (transport), RFC 9001 (TLS integration), RFC 9002
  (loss detection/recovery), RFC 9438 (HyStart++); NewReno congestion
  control plus an experimental simplified BBR mode; UDP GSO/GRO batching;
  0-RTT-capable connection IDs, Retry, and Version Negotiation.
- **Crypto** (own implementations, no OpenSSL/libsodium dependency): AES-GCM
  with AES-NI/PCLMULQDQ hardware acceleration, RSA (PKCS#1v1.5, PSS),
  X25519/ECDHE, P-256, SHA-2, HKDF, HMAC, DES, RC4, Base64.
- **Threading**: a shared thread pool for off-loading slow stream callbacks
  without blocking event-loop workers.

## Dependencies

- Linux 2.6+ / Windows 10+ / FreeBSD 15+
- clang or gcc with C++17 support
- CMake 3.26+
- libc (tested against glibc and musl)
- libcmdplus

## Building

```sh
mkdir build && cd build
cmake ..
make
make install
```

## Documentation

API reference is generated from Doxygen comments in the headers under `src/`.
With [Doxygen](https://www.doxygen.nl/) installed, CMake registers a `docs`
build target automatically:

```sh
cmake ..
make docs          # writes HTML output to build/docs/html/index.html
```

If Doxygen is not found on the system, the `docs` target is simply omitted —
the rest of the build is unaffected.

## Testing

```sh
cd build
ctest --output-on-failure
```
