eclipse / paho.mqtt-sn.embedded-c

Paho C MQTT-SN gateway and libraries for embedded systems. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
313 stars 179 forks source link

Add DTLS support for paho.mqtt-sn #227

Closed mailych closed 2 years ago

mailych commented 3 years ago

Hi,

I am trying to implements DTLS support for MQTT_SN using tinydtls library https://github.com/eclipse/tinydtls/.

At high level, my plan is to

  1. Use tinydtls library to add DTLS support for MQTT-SN
  2. tinydtls has sample code in dtls-server.c and dtls-client.c. These has code for client and server to complete handshake and perform data transfer.
  3. For MQTT_SN Gateway/Server side, I will adopt code from dtls-server.c. Looking at Gateway code, I will have to create new SensorNetwork.h and add code there. Most of the code can be taken from dtls-server.c.
  4. I am hoping, I wont have to modify other parts of Gateway code.
  5. On client side, I will implement interfaces defined in transport.h using code from dtls-client.c
  6. I am hoping, other parts of client code won't need change.

I would appreciate feedback from others especially those who are familiar with dtls/tinydtls or paho.mqtt-sn

Thanks, Yoonus

ty4tw commented 3 years ago

Hi, I hope src/linux/rfcomm/Sensoernetwork.h and .cpp will help you. This implementation does not need to create a new thread for an accepted socket.

ty4tw commented 3 years ago

Hi, mailych I'd like to know your opinion about how will you handle about multicast.

mailych commented 3 years ago

Hi, I hope src/linux/rfcomm/Sensoernetwork.h and .cpp will help you. This implementation does not need to create a new thread for an accepted socket.

First, Thanks for excellent design for mqtt-sn. I have able to implement SensorNetwork.* for dtls connection as per my initial plan. There was little/no change required to other parts of mqtt-sn. I plan to publish the work. Its using c++ classes right now. Hence need some changes before it can be integrated here.

Thanks again.

mailych commented 3 years ago

Hi, mailych I'd like to know your opinion about how will you handle about multicast.

Good catch. Our project doesn't need multicast now. Hence I have not looked into it in detail. As per my initial analysis, multicast won't be possible.

ty4tw commented 3 years ago

GW can't send ADVERTISE without Multicast. How does your client realize the GW stopped and connect to a alternative GW ?

mailych commented 3 years ago

GW can't send ADVERTISE without Multicast. How does your client realize the GW stopped and connect to a alternative GW ?

Our client and gateway talks over internet. Hence gateway address is pre configured on clients. They don't change at run time.

ty4tw commented 2 years ago

This issue is merged with #90