Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Transport Layer abstraction at Server side. #1318

Merged
merged 1 commit into from
Jan 6, 2023
Merged

Conversation

sbernard31
Copy link
Contributor

@sbernard31 sbernard31 commented Oct 5, 2022

This aims to implement #1025 at Server side.

This is based on experimentation done in #1220.

The API looks like :

// You create your LeshanServer with the builder like before
LeshanServerBuilder builder = new LeshanServerBuilder();

// But builder does not allow to configure any details about transport layer anymore
// instead you need to provide a LwM2mServerEndpointsProvider
// LwM2mServerEndpointsProvider will provide 1 or several LwM2mServerEndpoint

// For Californium (coap/coaps), Endpoint Provider API looks like this :
// --------------------------------------------------------
CaliforniumServerEndpointsProvider.Builder endpointsBuilder = new CaliforniumServerEndpointsProvider.Builder(
		    new CoapServerProtocolProvider(), new CoapsServerProtocolProvider());

// Change Californium configuration :
Configuration californiumConfig = endpointsBuilder.createDefaultConfiguration();
californiumConfig.set(DtlsConfig.DTLS_RECOMMENDED_CIPHER_SUITES_ONLY, true);
endpointsBuilder.setConfiguration(californiumConfig);

// By default the Californium Builder will create 1 endpoint by protocolProvider
// But you can create it manually like this :
endpointsBuilder.addEndpoint(new InetSocketAddress(0), Protocol.COAP);
endpointsBuilder.addEndpoint("coaps://localhost:5684");

// then add the endpoints provider to LeshanServerBuilder
builder.setEndpointsProvider(endpointsBuilder.build());

Some consequences / limitation of this changes:

  • The way we handle observation is not so good but I can find anything better for now. (this should imply more memory/space disk)
  • RedisRegistrationStore implementation change a lot and data format is not backward compatible... (especially the observation part)
  • Possibly some issues if an observation is serialized by using UDPDataSerialize and deserialized with TCPDataparser. I guess we should better handle this when we will implement Add CoAP over TCP transport layer  #1047.
  • CoapAPI in LeshanServer is lost but this is possibe to access to coap endpoint. I guess maybe we can expose this kind of api again with something completely different.

More tasks for later :

  • there is not so much javadoc and so it should be added later.
  • there is still some TODO TL : ... to implement.
  • Currently we can add only 1 LwM2mEndpointsProvider but we should be able to add several one.
  • I think we should have new interface to separate LWM2M request and LWM2M bootstrap request.
  • of course code should also be moved to follow new Transport Layer Module design. #1295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant