refactor: STCP connections as ETCP links (is_tcp)

- Add is_tcp, tcp_link, tcp_reconnect_* fields to ETCP_LINK
- Remove transport_link from ETCP_CONN, add tcp_link_count
- stcp_link: replace embedded etcp_conn with pointer; add etcp_link backpointer
- stcp_link: link_rx_cb routes ETCP data to etcp_conn_input
- stcp_link: call on_close_cb in close
- New TCP functions: etcp_link_enter_ready_tcp, etcp_tcp_link_start_connect,
  etcp_tcp_link_start_reconnect, tcp_link_close_cb, etcp_tcp_send
- etcp_link_new: handle NULL conn for TCP links; skip enter_init for TCP
- etcp_link_close: close stcp_link for TCP
- etcp_encrypt_send: redirect TCP to etcp_tcp_send (skips AES-CCM)
- tcp_server_on_link: create ETCP_LINK(is_tcp=1) + enter_ready_tcp
- etcp_connect: TCP addrs -> etcp_tcp_link_start_connect
- Remove ctx->tcp_link/tcp_ready
- test_stcp_traffic: find stcp_link via links->is_tcp instead of transport_link
- 66/68 tests pass; 2 STCP tests expected to fail (integration not complete)
This commit is contained in:
evgeny committed 2026-08-06 22:14:32 +03:00
1 parent 937af4c26a
commit d773f1724a
1705 files changed
+187 -1082154

No files matched your search

@@ -1,72 +0,0 @@
/*
* Copyright 2016 Nu-book Inc.
* Copyright 2016 ZXing authors
*/
// SPDX-License-Identifier: Apache-2.0
#pragma once
namespace ZXing {
class ByteArray;
/**
* <p>This provides an easy abstraction to read bits at a time from a sequence of bytes, where the
* number of bits read is not often a multiple of 8.</p>
*
* <p>This class is thread-safe but not reentrant -- unless the caller modifies the bytes array
* it passed in, in which case all bets are off.</p>
*
* @author Sean Owen
*/
class BitSource
{
const ByteArray& _bytes;
int _byteOffset = 0;
int _bitOffset = 0;
public:
/**
* @param bytes bytes from which this will read bits. Bits will be read from the first byte first.
* Bits are read within a byte from most-significant to least-significant bit.
* IMPORTANT: Bit source DOES NOT copy data byte, thus make sure that the bytes outlive the bit source object.
*/
explicit BitSource(const ByteArray& bytes) : _bytes(bytes) {}
BitSource(BitSource &) = delete;
BitSource& operator=(const BitSource &) = delete;
/**
* @return index of next bit in current byte which would be read by the next call to {@link #readBits(int)}.
*/
int bitOffset() const {
return _bitOffset;
}
/**
* @return index of next byte in input byte array which would be read by the next call to {@link #readBits(int)}.
*/
int byteOffset() const {
return _byteOffset;
}
/**
* @param numBits number of bits to read
* @return int representing the bits read. The bits will appear as the least-significant bits of the int
*/
int readBits(int numBits);
/**
* @param numBits number of bits to peek at
* @return int representing the bits peeked at. The bits will appear as the least-significant
* bits of the int
*/
int peekBits(int numBits) const;
/**
* @return number of bits that can be read successfully
*/
int available() const;
};
} // ZXing