|
|
|
|
@ -17,6 +17,7 @@
|
|
|
|
|
|
|
|
|
|
#define TEST_TIMEOUT_MS 5000 // 5 seconds for packet transmission
|
|
|
|
|
#define PACKET_SIZE 100 // Test packet size
|
|
|
|
|
#define MAX_QUEUE_ENTRIES 100 // Max entries in queue before considering it full
|
|
|
|
|
|
|
|
|
|
static struct UTUN_INSTANCE* server_instance = NULL; |
|
|
|
|
static struct UTUN_INSTANCE* client_instance = NULL; |
|
|
|
|
@ -28,37 +29,15 @@ static uint8_t test_packet_data[PACKET_SIZE];
|
|
|
|
|
static int packet_sent = 0; |
|
|
|
|
static int packet_received = 0; |
|
|
|
|
|
|
|
|
|
// Function to check if connection is established - UPDATED WITH DEBUG
|
|
|
|
|
// Function to check if connection is established
|
|
|
|
|
static int is_connection_established(struct UTUN_INSTANCE* inst) { |
|
|
|
|
printf("[DEBUG] is_connection_established: Checking instance %p\n", inst); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "is_connection_established: Checking instance %p", inst); |
|
|
|
|
|
|
|
|
|
if (!inst) { |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "is_connection_established: Instance is NULL"); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
printf("[DEBUG] is_connection_established: Instance has %d connections\n", inst->connections_count); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "is_connection_established: Instance has %d connections", inst->connections_count); |
|
|
|
|
if (!inst) return 0; |
|
|
|
|
|
|
|
|
|
struct ETCP_CONN* conn = inst->connections; |
|
|
|
|
while (conn) { |
|
|
|
|
printf("[DEBUG] is_connection_established: Checking connection %p\n", conn); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "is_connection_established: Checking connection %p", conn); |
|
|
|
|
struct ETCP_LINK* link = conn->links; |
|
|
|
|
while (link) { |
|
|
|
|
printf("[DEBUG] is_connection_established: Link %p - initialized=%d, is_server=%d\n",
|
|
|
|
|
link, link->initialized, link->is_server); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "is_connection_established: Link %p - initialized=%d, is_server=%d",
|
|
|
|
|
link, link->initialized, link->is_server); |
|
|
|
|
if (link->initialized) { |
|
|
|
|
printf("[DEBUG] is_connection_established: FOUND initialized link!\n"); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "is_connection_established: FOUND initialized link!"); |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
link = link->next; |
|
|
|
|
@ -66,18 +45,12 @@ static int is_connection_established(struct UTUN_INSTANCE* inst) {
|
|
|
|
|
conn = conn->next; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "is_connection_established: No initialized links found"); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Function to send test packet to client's input queue
|
|
|
|
|
// Function to send test packet via normalizer packer input queue
|
|
|
|
|
static void send_test_packet(void) { |
|
|
|
|
printf("[DEBUG] send_test_packet: ENTERING\n"); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "send_test_packet: ENTERING"); |
|
|
|
|
|
|
|
|
|
if (!client_instance || packet_sent) { |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "send_test_packet: SKIPPING (client_instance=%p, packet_sent=%d)", client_instance, packet_sent); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -87,21 +60,15 @@ static void send_test_packet(void) {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
printf("[DEBUG] send_test_packet: Found connection %p\n", conn); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "send_test_packet: Found connection %p", conn); |
|
|
|
|
printf("[DEBUG] send_test_packet: connection input_queue=%p\n", conn->input_queue); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "send_test_packet: connection input_queue=%p", conn->input_queue); |
|
|
|
|
printf("[DEBUG] send_test_packet: connection output_queue=%p\n", conn->output_queue); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "send_test_packet: connection output_queue=%p", conn->output_queue); |
|
|
|
|
printf("[DEBUG] send_test_packet: connection next_tx_id=%u\n", conn->next_tx_id); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "send_test_packet: connection next_tx_id=%u", conn->next_tx_id); |
|
|
|
|
|
|
|
|
|
if (!conn->input_queue) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "send_test_packet: Client input queue is NULL"); |
|
|
|
|
if (!conn->normalizer || !conn->normalizer->packer || !conn->normalizer->packer->input) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "send_test_packet: Client normalizer/packer/input not initialized"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Check queue fullness before writing
|
|
|
|
|
size_t queue_count = queue_entry_count(conn->normalizer->packer->input); |
|
|
|
|
if (queue_count >= MAX_QUEUE_ENTRIES) { |
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_ETCP, "send_test_packet: Packer input queue is full (%zu entries), waiting...", queue_count); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -110,86 +77,71 @@ static void send_test_packet(void) {
|
|
|
|
|
test_packet_data[i] = (uint8_t)(i % 256); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "send_test_packet: Created test data, first byte=%02X, last byte=%02X",
|
|
|
|
|
test_packet_data[0], test_packet_data[PACKET_SIZE-1]); |
|
|
|
|
// Allocate memory for packet using queue API
|
|
|
|
|
void* entry_data = queue_data_new(PACKET_SIZE); |
|
|
|
|
if (!entry_data) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "send_test_packet: Failed to allocate queue data"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Use new etcp_send function - much simpler API
|
|
|
|
|
printf("[DEBUG] send_test_packet: Calling etcp_send with len=%d\n", PACKET_SIZE); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "send_test_packet: Calling etcp_send with len=%d", PACKET_SIZE); |
|
|
|
|
int result = etcp_send(conn, test_packet_data, PACKET_SIZE); |
|
|
|
|
printf("[DEBUG] send_test_packet: etcp_send returned %d\n", result); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "send_test_packet: etcp_send returned %d", result); |
|
|
|
|
memcpy(entry_data, test_packet_data, PACKET_SIZE); |
|
|
|
|
|
|
|
|
|
if (result != 0) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "send_test_packet: Failed to send packet via etcp_send"); |
|
|
|
|
// Set the length in ll_entry
|
|
|
|
|
struct ll_entry* entry = (struct ll_entry *)((char *)entry_data - offsetof(struct ll_entry, data)); |
|
|
|
|
entry->len = PACKET_SIZE; |
|
|
|
|
|
|
|
|
|
// Write to packer input queue
|
|
|
|
|
if (queue_data_put(conn->normalizer->packer->input, entry_data, 0) < 0) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "send_test_packet: Failed to put data in packer input queue"); |
|
|
|
|
queue_data_free(entry_data); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
packet_sent = 1; |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "send_test_packet: SUCCESS - Test packet sent via etcp_send (%d bytes)", PACKET_SIZE); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "send_test_packet: Test packet sent to packer input queue (%d bytes)", PACKET_SIZE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Function to check if packet received in server's output queue
|
|
|
|
|
// Function to check if packet received in server's unpacker output queue
|
|
|
|
|
static void check_packet_received(void) { |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "check_packet_received: ENTERING"); |
|
|
|
|
|
|
|
|
|
if (!server_instance || packet_received) { |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "check_packet_received: SKIPPING (server_instance=%p, packet_received=%d)", server_instance, packet_received); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct ETCP_CONN* conn = server_instance->connections; |
|
|
|
|
if (!conn) { |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "check_packet_received: No connection on server"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!conn->output_queue) { |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "check_packet_received: No output_queue on server connection"); |
|
|
|
|
if (!conn->normalizer || !conn->normalizer->unpacker || !conn->normalizer->unpacker->output) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: Checking server connection %p", conn); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: Server output_queue count: %d", queue_entry_count(conn->output_queue)); |
|
|
|
|
// Read from unpacker output queue
|
|
|
|
|
void* data = queue_data_get(conn->normalizer->unpacker->output); |
|
|
|
|
if (!data) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Check if there's any packet in output queue
|
|
|
|
|
struct ETCP_FRAGMENT* pkt = queue_data_get(conn->output_queue); |
|
|
|
|
if (pkt) { |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: Found packet in output queue"); |
|
|
|
|
|
|
|
|
|
// ETCP_FRAGMENT содержит ll_entry в начале, данные в pkt_data
|
|
|
|
|
size_t size = pkt->ll.size; |
|
|
|
|
uint8_t* data = pkt->pkt_data; |
|
|
|
|
|
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: Packet size=%zu, expected=%d", size, PACKET_SIZE); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: First byte received=%02X, expected=%02X", |
|
|
|
|
data[0], test_packet_data[0]); |
|
|
|
|
|
|
|
|
|
// Проверяем только данные (первые PACKET_SIZE байт), размер может включать ETCP заголовки
|
|
|
|
|
if (size >= PACKET_SIZE && memcmp(data, test_packet_data, PACKET_SIZE) == 0) { |
|
|
|
|
packet_received = 1; |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "check_packet_received: SUCCESS - Packet received in server output queue (%zu bytes), data matches", size); |
|
|
|
|
} else { |
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_ETCP, "check_packet_received: Packet received but data differs (expected %d bytes, got %zu)", PACKET_SIZE, size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Освобождаем ETCP_FRAGMENT и данные
|
|
|
|
|
if (pkt->pkt_data) { |
|
|
|
|
memory_pool_free(conn->instance->data_pool, pkt->pkt_data); |
|
|
|
|
} |
|
|
|
|
queue_data_free(pkt); |
|
|
|
|
// Get the length from ll_entry
|
|
|
|
|
struct ll_entry* entry = (struct ll_entry *)((char *)data - offsetof(struct ll_entry, data)); |
|
|
|
|
size_t size = entry->len; |
|
|
|
|
|
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "check_packet_received: Found packet in unpacker output queue (size=%zu)", size); |
|
|
|
|
|
|
|
|
|
// Verify packet data
|
|
|
|
|
if (size >= PACKET_SIZE && memcmp(data, test_packet_data, PACKET_SIZE) == 0) { |
|
|
|
|
packet_received = 1; |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "check_packet_received: SUCCESS - Packet received and data matches (%zu bytes)", size); |
|
|
|
|
} else { |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "check_packet_received: No packet found in output queue"); |
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_ETCP, "check_packet_received: Packet received but data differs (expected %d bytes, got %zu)", PACKET_SIZE, size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Free the data
|
|
|
|
|
queue_data_free(data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Monitor connection and send packet when ready
|
|
|
|
|
static void monitor_and_send(void* arg) { |
|
|
|
|
printf("[DEBUG] monitor_and_send: ENTERING (arg=%p)\n", arg); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "monitor_and_send: ENTERING (arg=%p)", arg); |
|
|
|
|
(void)arg; |
|
|
|
|
|
|
|
|
|
if (test_completed) { |
|
|
|
|
@ -205,17 +157,9 @@ static void monitor_and_send(void* arg) {
|
|
|
|
|
int server_ready = is_connection_established(server_instance); |
|
|
|
|
int client_ready = is_connection_established(client_instance); |
|
|
|
|
|
|
|
|
|
printf("[DEBUG] monitor_and_send: Connection check - server=%d, client=%d\n", server_ready, client_ready); |
|
|
|
|
fflush(stdout); |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "monitor_and_send: Connection check - server=%d, client=%d", server_ready, client_ready); |
|
|
|
|
|
|
|
|
|
// We only need client link initialized to send packet
|
|
|
|
|
// Server will accept packets via its socket
|
|
|
|
|
if (client_ready) { |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "monitor_and_send: Client link initialized, ready to send packet (server=%d, client=%d)", server_ready, client_ready); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "monitor_and_send: Client link initialized, ready to send packet"); |
|
|
|
|
connection_checked = 1; |
|
|
|
|
} else { |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "monitor_and_send: Waiting for connection... (server=%d, client=%d)", server_ready, client_ready); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -259,19 +203,12 @@ static void test_timeout(void* arg) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int main() { |
|
|
|
|
printf("=== ETCP Simple Traffic Test (Queue-based) ===\n\n"); |
|
|
|
|
printf("=== ETCP Simple Traffic Test (via normalizer queues) ===\n\n"); |
|
|
|
|
|
|
|
|
|
// Enable debug output - MAXIMUM DEBUGGING
|
|
|
|
|
// Enable debug output
|
|
|
|
|
debug_config_init(); |
|
|
|
|
debug_set_level(DEBUG_LEVEL_TRACE); |
|
|
|
|
debug_set_categories(DEBUG_CATEGORY_ALL); |
|
|
|
|
debug_enable_function_name(1); |
|
|
|
|
|
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_MEMORY, "*************1"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("Function names enabled: YES\n"); |
|
|
|
|
printf("===========================\n\n"); |
|
|
|
|
debug_set_level(DEBUG_LEVEL_INFO); |
|
|
|
|
debug_set_categories(DEBUG_CATEGORY_ETCP | DEBUG_CATEGORY_CONNECTION); |
|
|
|
|
|
|
|
|
|
// Explicitly disable TUN initialization for this test
|
|
|
|
|
utun_instance_set_tun_init_enabled(0); |
|
|
|
|
@ -285,24 +222,13 @@ int main() {
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Initialize connections and register sockets regardless of TUN state
|
|
|
|
|
if (server_instance->tun.fd < 0) { |
|
|
|
|
printf("ℹ️ Server TUN disabled - initializing connections only\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Initialize ETCP connections (creates sockets and links)
|
|
|
|
|
// Initialize ETCP connections
|
|
|
|
|
if (init_connections(server_instance) < 0) { |
|
|
|
|
printf("Failed to initialize server connections\n"); |
|
|
|
|
utun_instance_destroy(server_instance); |
|
|
|
|
return 1; |
|
|
|
|
} else { |
|
|
|
|
printf("Server connections initialized: sockets=%p, connections=%p\n",
|
|
|
|
|
server_instance->etcp_sockets, server_instance->connections); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("✅ Server instance initialized successfully (node_id=%llx)\n", (unsigned long long)server_instance->node_id); |
|
|
|
|
printf("Server instance ready (node_id=%llx)\n\n", (unsigned long long)server_instance->node_id); |
|
|
|
|
|
|
|
|
|
// Create client instance
|
|
|
|
|
@ -315,61 +241,16 @@ int main() {
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Initialize connections and register sockets regardless of TUN state
|
|
|
|
|
if (client_instance->tun.fd < 0) { |
|
|
|
|
printf("ℹ️ Client TUN disabled - initializing connections only\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Initialize ETCP connections (creates sockets and links)
|
|
|
|
|
printf("About to call init_connections() for client instance\n"); |
|
|
|
|
fflush(stdout); |
|
|
|
|
|
|
|
|
|
int conn_result = init_connections(client_instance); |
|
|
|
|
printf("init_connections() returned: %d\n", conn_result); |
|
|
|
|
fflush(stdout); |
|
|
|
|
|
|
|
|
|
if (conn_result < 0) { |
|
|
|
|
printf("Failed to initialize client connections (result=%d)\n", conn_result); |
|
|
|
|
printf("But continuing test to analyze the issue...\n"); |
|
|
|
|
fflush(stdout); |
|
|
|
|
// Don't return error - continue to analyze
|
|
|
|
|
} else { |
|
|
|
|
printf("Client connections initialized: sockets=%p, connections=%p, count=%d\n",
|
|
|
|
|
client_instance->etcp_sockets, client_instance->connections, |
|
|
|
|
client_instance ? client_instance->connections_count : -1); |
|
|
|
|
fflush(stdout); |
|
|
|
|
// Initialize ETCP connections
|
|
|
|
|
if (init_connections(client_instance) < 0) { |
|
|
|
|
printf("Failed to initialize client connections\n"); |
|
|
|
|
utun_instance_destroy(server_instance); |
|
|
|
|
utun_instance_destroy(client_instance); |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("✅ Client instance initialized successfully (node_id=%llx)\n", (unsigned long long)client_instance->node_id); |
|
|
|
|
printf("Client instance ready (node_id=%llx)\n\n", (unsigned long long)client_instance->node_id); |
|
|
|
|
|
|
|
|
|
// Debug: print connection and link info
|
|
|
|
|
printf("\n=== Connection Debug ===\n"); |
|
|
|
|
struct ETCP_CONN* conn = client_instance->connections; |
|
|
|
|
while (conn) { |
|
|
|
|
printf("Client connection %p: peer_node_id=%llx\n", conn, (unsigned long long)conn->peer_node_id); |
|
|
|
|
struct ETCP_LINK* link = conn->links; |
|
|
|
|
while (link) { |
|
|
|
|
printf(" Link %p: initialized=%d, is_server=%d, remote_addr family=%d, conn->fd=%d\n",
|
|
|
|
|
link, link->initialized, link->is_server, link->remote_addr.ss_family, link->conn ? link->conn->fd : -1); |
|
|
|
|
link = link->next; |
|
|
|
|
} |
|
|
|
|
conn = conn->next; |
|
|
|
|
} |
|
|
|
|
conn = server_instance->connections; |
|
|
|
|
while (conn) { |
|
|
|
|
printf("Server connection %p: peer_node_id=%llx\n", conn, (unsigned long long)conn->peer_node_id); |
|
|
|
|
struct ETCP_LINK* link = conn->links; |
|
|
|
|
while (link) { |
|
|
|
|
printf(" Link %p: initialized=%d, is_server=%d\n", link, link->initialized, link->is_server); |
|
|
|
|
link = link->next; |
|
|
|
|
} |
|
|
|
|
conn = conn->next; |
|
|
|
|
} |
|
|
|
|
printf("=== End Debug ===\n\n"); |
|
|
|
|
|
|
|
|
|
// Start monitoring and packet transmission
|
|
|
|
|
printf("Starting packet transmission test...\n"); |
|
|
|
|
packet_timeout_id = uasync_set_timeout(server_ua, 500, NULL, monitor_and_send); |
|
|
|
|
@ -428,16 +309,15 @@ int main() {
|
|
|
|
|
// Evaluate test result
|
|
|
|
|
if (test_completed == 1) { |
|
|
|
|
printf("\n=== TEST PASSED ===\n"); |
|
|
|
|
printf("✅ Packet successfully transmitted from client input queue to server output queue\n"); |
|
|
|
|
printf("✅ ETCP connection and queue mechanisms verified\n"); |
|
|
|
|
printf("Packet successfully transmitted from client packer input to server unpacker output\n"); |
|
|
|
|
printf("ETCP + normalizer integration verified\n"); |
|
|
|
|
return 0; |
|
|
|
|
} else if (test_completed == 2) { |
|
|
|
|
printf("\n=== TEST FAILED: Packet not received within timeout ===\n"); |
|
|
|
|
printf("❌ Connection may not have been established\n"); |
|
|
|
|
printf("❌ Check if UDP sockets were created and bound correctly\n"); |
|
|
|
|
printf("Connection may not have been established\n"); |
|
|
|
|
return 1; |
|
|
|
|
} else { |
|
|
|
|
printf("\n=== TEST FAILED: Unknown error ===\n"); |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|