summaryrefslogtreecommitdiff
path: root/extmod/modnetwork.h
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-02-01 14:19:45 +1100
committerDamien George <damien@micropython.org>2023-03-01 01:26:17 +1100
commita3773026238c7c779cad79aa9d9c468e680e7004 (patch)
treef2654f2bc0ab70f2032b4d8cdf70573d68b83c14 /extmod/modnetwork.h
parentfc4c47f7bc72bf0ff216a45a334702fcd25e14de (diff)
extmod/modnetwork: Add network.hostname() and network.country().
This provides a standard interface to setting the global networking config for all interfaces and interface types. For ports that already use either a static hostname (mimxrt, rp2) they will now use the configured value. The default is configured by the port (or optionally the board). For interfaces that previously supported .config(hostname), this is still supported but now implemented using the global network.hostname. Similarly, pyb.country and rp2.country are now deprecated, but the methods still exist (and forward to network.hostname). Because ESP32/ESP8266 do not use extmod/modnetwork.c they are not affected by this commit. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'extmod/modnetwork.h')
-rw-r--r--extmod/modnetwork.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/extmod/modnetwork.h b/extmod/modnetwork.h
index a28ec6e42..0ef612d10 100644
--- a/extmod/modnetwork.h
+++ b/extmod/modnetwork.h
@@ -52,6 +52,14 @@
#define MOD_NETWORK_SS_CONNECTED (2)
#define MOD_NETWORK_SS_CLOSED (3)
+extern char mod_network_country_code[2];
+
+#ifndef MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN
+#define MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN (16)
+#endif
+
+extern char mod_network_hostname[MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN];
+
#if MICROPY_PY_LWIP
struct netif;
void mod_network_lwip_init(void);