From 810dde21ee65653c15606917b19566cfbaaf165e Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Tue, 9 Aug 2022 21:54:45 +0200 Subject: ecp server added --- ecp/src/platform/posix/transport.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'ecp/src/platform/posix/transport.c') diff --git a/ecp/src/platform/posix/transport.c b/ecp/src/platform/posix/transport.c index ebfbc7b..51f311a 100644 --- a/ecp/src/platform/posix/transport.c +++ b/ecp/src/platform/posix/transport.c @@ -6,8 +6,8 @@ #include #include -#include -#include +#include +#include #define MAX_ADDR_STR 32 @@ -49,20 +49,15 @@ int ecp_tr_addr_set(ecp_tr_addr_t *addr, void *addr_s) { return 0; } -int ecp_tr_open(ECPSocket *sock, void *addr_s) { +int ecp_tr_open(ECPSocket *sock, ecp_tr_addr_t *addr) { struct sockaddr_in _myaddr; int rv; memset((char *)&_myaddr, 0, sizeof(_myaddr)); _myaddr.sin_family = AF_INET; - if (addr_s) { - ecp_tr_addr_t addr; - - rv = ecp_tr_addr_set(&addr, addr_s); - if (rv) return rv; - - memcpy((void *)&_myaddr.sin_addr, addr.host, sizeof(addr.host)); - _myaddr.sin_port = addr.port; + if (addr) { + memcpy((void *)&_myaddr.sin_addr, addr->host, sizeof(addr->host)); + _myaddr.sin_port = addr->port; } else { _myaddr.sin_addr.s_addr = htonl(INADDR_ANY); _myaddr.sin_port = htons(0); -- cgit v1.2.3