Skip to content

Conversation

maribu
Copy link
Member

@maribu maribu commented Apr 17, 2025

Contribution description

This allows using and compiling the URL handling functions of sock_util without a network stack used.

Specifically, the URL splitting function can be useful even without having a network stack in use, e.g. for exotic CoAP transports (say, CoAP over SMS or CoAP over UART).

Testing procedure

The generated binaries should not change. But including sock/util.h without a network stack should now work without compilation failures.

Issues/PRs references

Split out of #21048

@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Apr 17, 2025
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 17, 2025
@riot-ci
Copy link

riot-ci commented Apr 17, 2025

Murdock results

✔️ PASSED

41c8f51 sys/net/sockutil: use #pragma once

Success Failures Total Runtime
10332 0 10335 09m:03s

Artifacts

Copy link
Contributor

@Teufelchen1 Teufelchen1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice <3 this has been annoying me for some time!

maribu and others added 2 commits May 5, 2025 18:09
This allows using and compiling the URL handling functions of sock_util
without a network stack used.

Co-authored-by: benpicco <benpicco@googlemail.com>
Co-authored-by: benpicco <benpicco@googlemail.com>
@maribu maribu force-pushed the sys/net/sock_util branch from 3ff51ad to 41c8f51 Compare May 5, 2025 16:09
@benpicco benpicco added this pull request to the merge queue May 5, 2025
Merged via the queue into RIOT-OS:master with commit c937969 May 5, 2025
25 checks passed
@maribu maribu deleted the sys/net/sock_util branch May 5, 2025 20:37
@maribu
Copy link
Member Author

maribu commented May 5, 2025

Thx :)

@benpicco
Copy link
Contributor

benpicco commented May 6, 2025

This does break the build with lwIP - turns out we don't have this covered by CI 😕

make -C examples/networking/coap/gcoap LWIP_IPV4=1

In file included from /home/benpicco/dev/RIOT/examples/networking/coap/gcoap/client.c:32:
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:107:41: error: unknown type name ‘sock_tcp_ep_t’
  107 | static inline int sock_tcp_ep_fmt(const sock_tcp_ep_t *endpoint,
      |                                         ^~~~~~~~~~~~~
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h: In function ‘sock_tcp_ep_fmt’:
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:110:27: error: passing argument 1 of ‘sock_tl_ep_fmt’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  110 |     return sock_tl_ep_fmt(endpoint, addr_str, port);
      |                           ^~~~~~~~
      |                           |
      |                           const int *
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:94:46: note: expected ‘const struct _sock_tl_ep *’ but argument is of type ‘const int *’
   94 | int sock_tl_ep_fmt(const struct _sock_tl_ep *endpoint,
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h: At top level:
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:171:35: error: unknown type name ‘sock_tcp_ep_t’; did you mean ‘sock_udp_ep_t’?
  171 | static inline int sock_tcp_str2ep(sock_tcp_ep_t *ep_out, const char *str)
      |                                   ^~~~~~~~~~~~~
      |                                   sock_udp_ep_t
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:190:36: error: unknown type name ‘sock_tcp_ep_t’; did you mean ‘sock_udp_ep_t’?
  190 | static inline int sock_tcp_name2ep(sock_tcp_ep_t *ep_out, const char *str)
      |                                    ^~~~~~~~~~~~~
      |                                    sock_udp_ep_t
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:260:44: error: unknown type name ‘sock_tcp_ep_t’
  260 | static inline bool sock_tcp_ep_equal(const sock_tcp_ep_t *a,
      |                                            ^~~~~~~~~~~~~
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:261:44: error: unknown type name ‘sock_tcp_ep_t’
  261 |                                      const sock_tcp_ep_t *b)
      |                                            ^~~~~~~~~~~~~
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h: In function ‘sock_tcp_ep_equal’:
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:263:29: error: passing argument 1 of ‘sock_tl_ep_equal’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  263 |     return sock_tl_ep_equal(a, b);
      |                             ^
      |                             |
      |                             const int *
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:244:49: note: expected ‘const struct _sock_tl_ep *’ but argument is of type ‘const int *’
  244 | bool sock_tl_ep_equal(const struct _sock_tl_ep *a,
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:263:32: error: passing argument 2 of ‘sock_tl_ep_equal’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  263 |     return sock_tl_ep_equal(a, b);
      |                                ^
      |                                |
      |                                const int *
/home/benpicco/dev/RIOT/sys/include/net/sock/util.h:245:49: note: expected ‘const struct _sock_tl_ep *’ but argument is of type ‘const int *’
  245 |                       const struct _sock_tl_ep *b);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^
cc1: all warnings being treated as errors
make[1]: *** [/home/benpicco/dev/RIOT/Makefile.base:157: /home/benpicco/dev/RIOT/examples/networking/coap/gcoap/bin/native64/application_gcoap_example/client.o] Error 1
make: *** [/home/benpicco/dev/RIOT/examples/networking/coap/gcoap/../../../../Makefile.include:762: application_gcoap_example.module] Error 2
make: Leaving directory '/home/benpicco/dev/RIOT/examples/networking/coap/gcoap'

@maribu
Copy link
Member Author

maribu commented May 6, 2025

I'll have a look later today

@benpicco
Copy link
Contributor

benpicco commented May 6, 2025

#21467 should fix this

@krzysztof-cabaj
Copy link
Contributor

@benpicco thanks for rapid response!

@krzysztof-cabaj
Copy link
Contributor

This does break the build with lwIP - turns out we don't have this covered by CI 😕

I'm planing a simple client/server example for LWIP IPv4, which could serve as test for such situations.
But first, I would like finalize PR #21342 - because without that example do not pass Murdock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants