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 Client side. #1323

Merged
merged 1 commit into from
Jan 6, 2023
Merged

Conversation

sbernard31
Copy link
Contributor

@sbernard31 sbernard31 commented Oct 13, 2022

This aims to implement #1025 at Client side.

This is based on experimentation done in #1220.

The API looks like :

// You create your LeshanClient with the builder like before
LeshanClientBuilder builder = new LeshanClientBuilder("myclient");

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

// For Californium (coap/coaps), Endpoint Provider API looks like this :
// --------------------------------------------------------
CaliforniumClientEndpointsProvider.Builder endpointsBuilder = new CaliforniumClientEndpointsProvider.Builder(
		    new CoapClientProtocolProvider(), new CoapsClientProtocolProvider());

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

// default is any LocalAddress.
endpointsBuilder.setClientAddress(InetAddress.getByName("192.168..0.1"));

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

Some consequences / limitation of this changes:

  • The way we handle observation is maybe too tied to Californium way.
  • Identity should maybe used URI instead of InetSocketAddress
  • ServerIdentity and Identity sounds to similar concept maybe ServerIdentity should be replaced by something like ServerProfile...
  • We lost the API about choosing Request Encoding by ObjectEnabler, I don't know if this was really useful.
  • the CLI option "-lp, --local-port of leshan-client-demo was removed as it does not make so much sense.

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.
  • of course code should also be moved to follow new Transport Layer Module design. #1295

@sbernard31 sbernard31 changed the base branch from endpoint_server to master January 6, 2023 09:50
@sbernard31 sbernard31 marked this pull request as draft January 6, 2023 09:51
@sbernard31 sbernard31 marked this pull request as ready for review January 6, 2023 09:51
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