1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #17171 from kaspar030/uhcp_modules

net/uhcp[cd]: use modules to select client/server code
This commit is contained in:
Francisco 2021-11-10 08:59:08 +01:00 committed by GitHub
commit fc4a3d3363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

View File

@ -1,5 +1,5 @@
CFLAGS?=-g -O3 -Wall
CFLAGS_EXTRA=-DUHCP_SERVER
CFLAGS_EXTRA=-DMODULE_UHCPD
all: bin bin/uhcpd
bin:

View File

@ -1,3 +1,2 @@
MODULE=uhcpc
CFLAGS += -DUHCP_CLIENT
include $(RIOTBASE)/Makefile.base

View File

@ -39,8 +39,8 @@ void uhcp_handle_udp(uint8_t *buf, size_t len, uint8_t *src, uint16_t port, uhcp
LOG_ERROR("error: wrong protocol version.\n");
}
switch (type) {
#ifdef UHCP_SERVER
switch(type) {
#ifdef MODULE_UHCPD
case UHCP_REQ:
if (len < sizeof(uhcp_req_t)) {
LOG_ERROR("error: request too small\n");
@ -50,7 +50,7 @@ void uhcp_handle_udp(uint8_t *buf, size_t len, uint8_t *src, uint16_t port, uhcp
}
break;
#endif
#ifdef UHCP_CLIENT
#ifdef MODULE_UHCPC
case UHCP_PUSH:
{
uhcp_push_t *push = (uhcp_push_t*)hdr;
@ -70,7 +70,7 @@ void uhcp_handle_udp(uint8_t *buf, size_t len, uint8_t *src, uint16_t port, uhcp
}
}
#ifdef UHCP_SERVER
#ifdef MODULE_UHCPD
extern char _prefix[16];
extern unsigned _prefix_len;
void uhcp_handle_req(uhcp_req_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface)
@ -89,9 +89,9 @@ void uhcp_handle_req(uhcp_req_t *req, uint8_t *src, uint16_t port, uhcp_iface_t
LOG_ERROR("uhcp_handle_req(): udp_sendto() res=%i\n", res);
}
}
#endif /* UHCP_SERVER */
#endif /* MODULE_UHCPD */
#ifdef UHCP_CLIENT
#ifdef MODULE_UHCPC
void uhcp_handle_push(uhcp_push_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface)
{
char addr_str[INET6_ADDRSTRLEN];