Skip to content

Kconfig: Expose net/sock/util configurations#12944

Merged
fjmolinas merged 2 commits intoRIOT-OS:masterfrom
leandrolanzieri:pr/kconfig_migrate/net/sock_util
Jan 3, 2020
Merged

Kconfig: Expose net/sock/util configurations#12944
fjmolinas merged 2 commits intoRIOT-OS:masterfrom
leandrolanzieri:pr/kconfig_migrate/net/sock_util

Conversation

@leandrolanzieri
Copy link
Copy Markdown
Contributor

Contribution description

This PR moves configuration macros of SOCK utilities module to the CONFIG_ namespace. It also exposes them to Kconfig.

Testing procedure

You can check the values in some application that uses this module (e.g. examples/gcoap). Make sure configurations take the default values as usual from the header files. Run make menuconfig, enable the configuration of the module and change the values.

You can use this patch:

diff --git a/examples/gcoap/main.c b/examples/gcoap/main.c
index 3757922d0..cbea87001 100644
--- a/examples/gcoap/main.c
+++ b/examples/gcoap/main.c
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include "msg.h"
 
+#include "net/sock/util.h"
 #include "net/gcoap.h"
 #include "kernel_types.h"
 #include "shell.h"
@@ -42,7 +43,9 @@ int main(void)
     msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
     gcoap_cli_init();
     puts("gcoap example app");
-
+    printf("Scheme length: %d\n", CONFIG_SOCK_SCHEME_MAXLEN);
+    printf("Host:Port length: %d\n", CONFIG_SOCK_HOSTPORT_MAXLEN);
+    printf("URL path length: %d\n", CONFIG_SOCK_URLPATH_MAXLEN);
     /* start shell */
     puts("All up, running the shell now");
     char line_buf[SHELL_DEFAULT_BUFSIZE];

Issues/PRs references

Part of #12888

Macros that changed:
SOCK_SCHEME_MAXLEN -> CONFIG_SOCK_SCHEME_MAXLEN
SOCK_HOSTPORT_MAXLEN -> CONFIG_SOCK_HOSTPORT_MAXLEN
SOCK_URLPATH_MAXLEN -> CONFIG_SOCK_URLPATH_MAXLEN
@leandrolanzieri leandrolanzieri added Area: network Area: Networking Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR TF: Config Marks issues and PRs related to the work of the Configuration Task Force labels Dec 13, 2019
@leandrolanzieri leandrolanzieri added this to the Release 2020.01 milestone Dec 13, 2019
@fjmolinas
Copy link
Copy Markdown
Contributor

Run make menuconfig, enable the configuration of the module and change the values.

@leandrolanzieri I haven't used kconfig much yet, how do I enable it for the module? :)

@leandrolanzieri
Copy link
Copy Markdown
Contributor Author

leandrolanzieri commented Jan 3, 2020

Run make menuconfig, enable the configuration of the module and change the values.

@leandrolanzieri I haven't used kconfig much yet, how do I enable it for the module? :)

In an application that uses the module (e.g. examples/gcoap) you can run make menuconfig, there navigate to System > Networking and enable the option Configure SOCK utility functions with space or enter keys. You can also get into that submenu and change parameters. Save with S and try to build.

@fjmolinas
Copy link
Copy Markdown
Contributor

In an application that uses the module (e.g. examples/gcoap) you can run make menuconfig, there navigate to System > Networking and enable the option Configure SOCK utility functions with space or enter keys. You can also get into that submenu and change parameters. Save with S and try to build.

I had done that but didn't specify the BOARD when reunning menuconfig, which is why I didn't see the changes at first, may bad, works as expected.

2020-01-03 11:37:29,036 # �main(): This is RIOT! (Version: 2020.01-devel-1378-g047c8-pr-12944)
2020-01-03 11:37:29,037 # gcoap example app
2020-01-03 11:37:29,050 # Scheme length: 32
2020-01-03 11:37:29,050 # Host:Port length: 128
2020-01-03 11:37:29,051 # URL path length: 128
2020-01-03 11:37:29,051 # All up, running the shell now

Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

ACK!

@fjmolinas fjmolinas merged commit d4c3476 into RIOT-OS:master Jan 3, 2020
@leandrolanzieri
Copy link
Copy Markdown
Contributor Author

@fjmolinas thanks for testing and reviewing !

@leandrolanzieri leandrolanzieri deleted the pr/kconfig_migrate/net/sock_util branch January 3, 2020 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR TF: Config Marks issues and PRs related to the work of the Configuration Task Force Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants