leshan
leshan copied to clipboard
Add Transport Layer abstraction at Server side.
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)
RedisRegistrationStoreimplementation 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 #1047.
- CoapAPI in
LeshanServeris 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 #1295