You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
962 B
37 lines
962 B
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <unistd.h> |
|
|
|
#include "../src/etcp_connections.h" |
|
#include "../src/utun_instance.h" |
|
#include "../lib/u_async.h" |
|
|
|
int main() { |
|
printf("=== Minimal Test ===\n"); |
|
|
|
struct UASYNC* ua = uasync_create(); |
|
struct UTUN_INSTANCE* instance = utun_instance_create(ua, "../utun.conf", NULL); |
|
|
|
if (!instance) { |
|
printf("Failed to create instance\n"); |
|
return 1; |
|
} |
|
|
|
printf("Instance created\n"); |
|
|
|
// Add a socket manually |
|
struct sockaddr_storage addr; |
|
struct sockaddr_in* sin = (struct sockaddr_in*)&addr; |
|
sin->sin_family = AF_INET; |
|
sin->sin_addr.s_addr = inet_addr("127.0.0.1"); |
|
sin->sin_port = htons(9001); |
|
|
|
struct ETCP_SOCKET* sock = etcp_socket_add(instance, &addr, 0, 0, 0); |
|
|
|
if (sock) { |
|
printf("Socket created: fd=%d\n", sock->fd); |
|
printf("Socket has socket_id: %p\n", sock->socket_id); |
|
} |
|
|
|
return 0; |
|
}
|
|
|