net/uhcp[cd]: use modules to select client/server code
This commit is contained in:
parent
4b2ca7a702
commit
dba51edc69
2
dist/tools/uhcpd/Makefile
vendored
2
dist/tools/uhcpd/Makefile
vendored
@ -1,5 +1,5 @@
|
|||||||
CFLAGS?=-g -O3 -Wall
|
CFLAGS?=-g -O3 -Wall
|
||||||
CFLAGS_EXTRA=-DUHCP_SERVER
|
CFLAGS_EXTRA=-DMODULE_UHCPD
|
||||||
all: bin bin/uhcpd
|
all: bin bin/uhcpd
|
||||||
|
|
||||||
bin:
|
bin:
|
||||||
|
|||||||
@ -1,3 +1,2 @@
|
|||||||
MODULE=uhcpc
|
MODULE=uhcpc
|
||||||
CFLAGS += -DUHCP_CLIENT
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTBASE)/Makefile.base
|
||||||
|
|||||||
@ -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");
|
LOG_ERROR("error: wrong protocol version.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch(type) {
|
||||||
#ifdef UHCP_SERVER
|
#ifdef MODULE_UHCPD
|
||||||
case UHCP_REQ:
|
case UHCP_REQ:
|
||||||
if (len < sizeof(uhcp_req_t)) {
|
if (len < sizeof(uhcp_req_t)) {
|
||||||
LOG_ERROR("error: request too small\n");
|
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;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef UHCP_CLIENT
|
#ifdef MODULE_UHCPC
|
||||||
case UHCP_PUSH:
|
case UHCP_PUSH:
|
||||||
{
|
{
|
||||||
uhcp_push_t *push = (uhcp_push_t*)hdr;
|
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 char _prefix[16];
|
||||||
extern unsigned _prefix_len;
|
extern unsigned _prefix_len;
|
||||||
void uhcp_handle_req(uhcp_req_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface)
|
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);
|
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)
|
void uhcp_handle_push(uhcp_push_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface)
|
||||||
{
|
{
|
||||||
char addr_str[INET6_ADDRSTRLEN];
|
char addr_str[INET6_ADDRSTRLEN];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user