-
Notifications
You must be signed in to change notification settings - Fork 370
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
[coap+tcp] Handling Signaling Option #2094
Comments
CoAP over TCP should be renamed in "CoAP similar formated messages over a different protocol" ;-). I plan to add some stuff to the option, but I didn't plan to add a second number domain ... I will see, if that will be possible. By the way, my feeling is still, that these signaling messages are no "coap exchanges". That are mainly "signals" (one way messages) in coap format, even using different number domains. |
Yep, I feel like I've fallen down in a rabbit hole. 🙃
Yep I try to handle those signaling messages in Layer but without "coap exchanges". void sendSignalingMessage(SignalingMessage message);
void receivedSignalingMessage(SignalingMessage message);
Waiting I will try to explore the 2. way. ( |
In I try to not change design too much but clearly this sounds not so satisfying. After working on this, I think that maybe a better design (or at least a way to explore) for Option could be : public class Option {
OptionDefinition def;
byte[] value;
}
public class OptionDefinition {
int number;
String name;
OptionFormat format;
int lengthMin;
int lengthMax;
byte[] default value;
// ... ...
// and all needed methods like :
assertValueLength(int valueLength);
/// ... ...
}
public class/interface OptionNumberRegistry {
// initialize with some value but I guess user could add its own definition.
OptionDefinition getDefinition(int optionNumber)
}
public class/interface SignalingOptionNumberRegistry {
OptionDefinition getDefinition(SignalingCode, int optionNumber)
}
|
The culprit is the |
I have a bad feeling about Do you identify issue with |
I'm unfortunately still busy with other tasks outside of Californium. |
I guess, OptionSet.addOption(Option) will cause pain. |
I think it should be OK, you just need to give the optionDefinition when creating an Option. For the code you point above ☝️, I did this change in byte[] value = reader.readBytes(optionLength);
Option option = createOption(message, currentOptionNumber, value);
if (option != null) {
optionSet.addOption(option);
} And so TcpDataParser with new API will looks like : public Option createOption(Message message, int optionNumber, byte[] value) {
if (message instanceof SignalingMessage) {
SignalingCode code = ((SignalingMessage)message).getCode();
OptionDefinition def = SignalingOptionNumberRegistry.getDefinition(code, optionNumber)
if (def == null && OptionUtils.isCritical(optionNumber)) {
throw new IllegalArgumentException("Unknown critical option " + optionNumber + "for" + code);
}
return new Option(def, value);
} else {
return super.createOption(message, optionNumber, value);
}
} |
I had a first view on the "Option" extension. |
I understand that you don't advice me to explore the Option way above ☝️ because you already plan to modify it ? |
At least, I guess we will have two variants and then need to decide, which one will be chosen. |
Currently, the So still don't know if you encourage me to work on it OR if the design above is enough to decide which one will be chosen ? And even harder question how do we make that decision ? 😬 |
That's more a question of the time lines. If you need it now, then you need to do it. You may also just do it, in order to see, if the other changes are working. Then later, if an alternative gets available, sure, some of your work (or the work of the alternative) gets obsolete.
As usual, if not agreed between the active committers, by "users voting". |
Not really, I already have a short term solution.
That doesn't sound efficient to me. I mean I will not implement it before to know if the current design sounds better to us.
About users voting you already know my opinion about that. Anyway, I think it's not a really good idea for me to try to provide PR about core californium feature. |
In the case that someone wants to continue this work, feel free to comment or open an new issue. |
Implementing a first draft version of #2092, I face some design issue to handle Signaling
Option
with current Californium Design.5.2. Signaling Option Numbers
See : CoAP Signaling Option Numbers Registry
Currently all
Option
design is based on the idea that "Option number" is enough to identify an option.But Signaling Option are identified by "Signaling Code + Signaling Option number"
Note for #2092, I already add :
SignalingMessage
which extendsMessage
,SignalingCode
likeCore
orResponseCode
.I create this issue to discuss what could be the right approach for
SignalingOption
?Here some ideas :
SignalingOption
class which inherit fromOption
with a newSignalingOptionNumberRegistry
? (more code but pretty much isolated)Option
API ? (which could benull
)Any preferences or other ideas ?
@boaks If there already known issue with current Option design ? Is there some plan about refactoring it ?
(I asked just in case a new design could solve known issue and this one)
The text was updated successfully, but these errors were encountered: