Skip to content

Commit

Permalink
feat(sockutls): Declare socketpar and gai-error via standard headers
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cermak committed Dec 16, 2024
1 parent e12ecb8 commit 7f10357
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/sock_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ idf_component_register(SRCS "src/getnameinfo.c"
"src/gethostname.c"
INCLUDE_DIRS "include"
PRIV_REQUIRES lwip esp_netif)

# To support declarations from standard headers in lwip component
# - socket pair from lwip/sockets.h
# - gai_strerror from lwip/netdb.h
# also need to make lwip depend on the sock_utils lib
idf_component_get_property(lwip lwip COMPONENT_LIB)
target_compile_definitions(${lwip} PUBLIC LWIP_SOCKET_HAS_SOCKETPAIR=1)
target_compile_definitions(${lwip} PUBLIC LWIP_NETDB_HAS_GAI_STRERROR=1)
target_link_libraries(${lwip} PUBLIC ${COMPONENT_LIB})
7 changes: 7 additions & 0 deletions components/sock_utils/include/netdb_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@
#ifndef AF_UNIX
#define AF_UNIX 1
#endif

#ifndef PF_LOCAL
/*
* In POSIX, AF_UNIX and PF_LOCAL are essentially synonymous.
*/
#define PF_LOCAL AF_UNIX
#endif

0 comments on commit 7f10357

Please sign in to comment.