# NETWORK TOOLS UDP TOOL CONTRACT (K2366–K2370) - **Move Range:** `K2366–K2370` - **Phase:** `Phase 18 — Daily Use Applications` - **Module:** `network_tools.udp_tool` - **Title:** `UDP gönder al aracı` - **Invariant:** `Datagram boy ve tuple kaydedilir` - **Positive Case:** `Peerle üç byte payload` (`k2370-udptriplebyte`) - **Counterexample:** `Yanlış port veya truncated reply` (`k2370-udptruncated`) - **Acceptance Criterion:** `Beklenen hash ve hata kodu` - **Crate:** `os-network-tools` (`src/udp_tool.rs`) - **Inspection Symbol:** `os_network_tools_udp_tool` ## 1. Scope and Invariants 1. **Datagram Size and Endpoint Tuple Recording (`K2366–K2367`):** - Every UDP send/receive operation must record both the datagram payload size and endpoint tuple (`datagram_size_or_tuple_unrecorded == false`, `recorded_tuple_endpoints == 2`) and verify expected payload hash and error codes (`expected_hash_and_error_code_verified == true`). - Any attempt to omit datagram size/tuple recording or bypass hash/error-code verification is deterministically refused (`NetworkToolsUdpToolError::DatagramSizeOrTupleUnrecorded`, `NetworkToolsUdpToolError::ExpectedHashAndErrorCodeViolated`). 2. **Refusal of Wrong Port or Truncated Reply (`K2368`):** - Replies arriving from a wrong UDP port or with truncated payload bytes (`wrong_port_or_truncated_reply == true`, `k2370-udptruncated`) are rejected before any UDP exchange receipt is committed (`NetworkToolsUdpToolError::WrongPortOrTruncatedReply`), keeping `truncated_or_wrong_port_accepts == 0`. 3. **Three-Byte Peer Payload Exchange (`K2369–K2370`):** - The positive path (`k2370-udptriplebyte`) exchanges a 3-byte payload with the peer (`peer_payload_bytes == 3`), records 2 tuple endpoints (`recorded_tuple_endpoints == 2`), verifies 2 datagram hashes (`verified_datagram_hashes == 2`), and records 0 truncated or wrong-port accepts (`truncated_or_wrong_port_accepts == 0`), bound by a monotonic `udp_tool_epoch` and FNV-1a digest (`compute_network_tools_udp_tool_binding_digest`).