zephyr/include/net
Benjamin Lindqvist 1578e70eaf net: lwm2m: Add path generation macro
Currently, the Zephyr LwM2M code base is littered with hard-coded
object- and resource IDs, such as

    /* Mark 1st instance of security object as a bootstrap server */
    lwm2m_engine_set_u8("0/0/1", 1);

The purpose of this LoC is extremely opaque without the accompanying
comment. Each use of a resource path requires constantly checking
headers or the object registry to ensure you're not misremembering IDs.

To alleviate this, this commit introduces a variadic LwM2M path
expansion macro which performs preprocessor stringification on each
argument. For instance, "0/0/1" can now be written as

    LWM2M_PATH(LWM2M_OBJECT_SECURITY_ID, 0, SECURITY_BOOTSTRAP_FLAG_ID)

which, while albeit lengthier, avoids the use of hard-coded string
literals, thus making the code much more immediately understandable.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-11-10 14:10:44 +02:00
..
bt.h
buf.h
can.h
coap_link_format.h
coap.h
dhcpv4.h
dns_resolve.h
dns_sd.h
dummy.h
ethernet_mgmt.h
ethernet_vlan.h
ethernet.h
gptp.h
hostname.h
http_client.h
http_parser_state.h
http_parser_url.h
http_parser.h
ieee802154_mgmt.h
ieee802154_radio.h
ieee802154.h
ipv4_autoconf.h
lldp.h
lwm2m_path.h
lwm2m.h
mii.h
mqtt.h
net_config.h
net_conn_mgr.h
net_context.h
net_core.h
net_event.h
net_if.h
net_ip.h
net_l2.h
net_linkaddr.h
net_mgmt.h
net_offload.h
net_pkt.h
net_stats.h
net_timeout.h
openthread.h
ppp.h
promiscuous.h
ptp_time.h
sntp.h
socket_can.h
socket_net_mgmt.h
socket_offload.h
socket_select.h
socket.h
socketutils.h
tftp.h
tls_credentials.h
trickle.h
udp.h
websocket.h
wifi_mgmt.h
wifi.h