Skip to content

Commit

Permalink
SQUASH_ME: Enable build without nw-layer
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer-simon committed Feb 26, 2020
1 parent 1254434 commit 9b8a755
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 4 additions & 2 deletions sys/include/net/gnrc/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ extern "C" {
*/
typedef struct {
int family; /**< IP address family. */
#ifdef MODULE_GNRC_IPV6
union {
#ifdef MODULE_GNRC_IPV6
uint8_t ipv6[sizeof(ipv6_addr_t)]; /**< IPv6 address storage */
} addr; /**< IP address storage */
#else
uint8_t dummy; /**< Enable build without network module */
#endif
} addr; /**< IP address storage */
uint16_t netif; /**< Network interface ID */
uint16_t port; /**< Port number (in host byte order) */
} gnrc_tcp_ep_t;
Expand Down
11 changes: 8 additions & 3 deletions sys/net/gnrc/transport_layer/tcp/gnrc_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ static int _gnrc_tcp_open(gnrc_tcp_tcb_t *tcb, const gnrc_tcp_ep_t *remote,
#else
/* Suppress Compiler Warnings */
(void) remote;
(void) local_addr;
#endif
/* Set port number to listen on */
tcb->local_port = local_port;
Expand Down Expand Up @@ -266,6 +267,9 @@ int gnrc_tcp_ep_init(gnrc_tcp_ep_t *ep, int family, const uint8_t *addr, size_t
return -EINVAL;
}
#else
/* Suppress Compiler Warnings */
(void) addr;
(void) addr_size;
return -EAFNOSUPPORT;
#endif

Expand Down Expand Up @@ -442,16 +446,17 @@ int gnrc_tcp_open_passive(gnrc_tcp_tcb_t *tcb, const gnrc_tcp_ep_t *local)
if (local->family != AF_INET6) {
return -EAFNOSUPPORT;
}
#else
return -EAFNOSUPPORT;
#endif

/* Check if AF-Family matches internally used AF-Family */
if (local->family != tcb->address_family) {
return -EINVAL;
}

/* Proceed with connection opening */
return _gnrc_tcp_open(tcb, NULL, local->addr.ipv6, local->port, 1);
#else
return -EAFNOSUPPORT;
#endif
}

ssize_t gnrc_tcp_send(gnrc_tcp_tcb_t *tcb, const void *data, const size_t len,
Expand Down

0 comments on commit 9b8a755

Please sign in to comment.