-
Notifications
You must be signed in to change notification settings - Fork 6
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
Checksum support in PyRFLX #240
Comments
The added attribute to
Example: Note that we thought to have a list of expressions as arguments (which could be indices but also other values), not a list of fields (cf. #222).
I'm not sure what you are trying to do here. I think we should discuss that (probably it is easier to do this offline with @jklmnn or me).
The parameters of a checksum method should be:
The checksum method must determine the bounds of fields based on its arguments. Note: Currently we do not guarantee that indices are grouped as tuples, so there could be also checksum definition like:
|
In an offline discussion we decided to change the format to make it easier to detect dependent fields. In addition to single arguments we also allow ranges now. Both can be mixed together (cf. #222). {
"Checksum":
{
"FCS",
[
ValueRange(First("F1"), Last("F2")),
Variable("F4"),
ValueRange(First("F4"), Last("F5")),
Length("F2"),
]
}
} |
Would |
Well it would make a difference if it has to be set. |
An interesting special case would be also: AFAIK we have currently no concrete use case for that, so I'm not sure if we want to invest time into it. But probably it is not too hard to detect the scheme "First(Field) - 1". |
I think we should restrict the expressions in value ranges to field bounds, i.e. |
But then we could even think about only passing field names: |
You are right, that would be sufficient. But I'm not sure if we get a understandable specification for that. Current syntax: For me the new syntax is much harder to read. For your second idea of an exclusive value I don't even have an idea how to represent that. |
I agree. And I don't have a good idea for the specification either. We should leave it as is, then and restrict the left side of a range to We could still map that to the more restricted objects I suggested above during model creation ( |
We could, but I see no real advantage in doing this. |
Then let's stick with |
get checksum fields get fields which the checksum depends on pass msg as bytes and dict (kwargs) to checksum function test checksum implementation with icmp Ref. #240
The checksum support is incomplete: A checksum is never checked during parsing. |
I think we have to differentiate two parts of the automatic setting of checksums:
I agree that we can even forbid manual setting of a checksum field by using the |
We have to, to support parsing.
The checksum field has to be handled similarly to other fields to properly support parsing. Or at least we would need a way to detect when a checksum field should appear. |
That sounds like a design issue. The behavior of the public interface for setting fields should be independent of the parsing. What are the options? Would that be hard to change? |
The current implementation enables checksum checks for parsing and for the message generation without verification. When generating a message (with verification) the checksum can either be set manually, which will disable all checksum checks, or it can be set automatically. In this case the checksum will be recalculated when fields are changed. When generating a message without verification all fields (including the checksum itself) have to be set in order. The checksum field can contain any value that is then updated when calling When parsing a message the parsing will not fail but the message will not be marked as valid if the checksum is incorrect. The performance of @rssen we lately had a discussion about understanding and commenting code. Could you please try to explain in comments how the checksum setting works. Especially which checks are done (semantically) and why they're done. |
aspects: Mapping[str, Mapping[Field, Sequence[Expr]]]
preset_field
but starts at the INITIAL node (preset_fields starts at the current node), checks only if a field is set (not likepreset fields
if it has a length and first){"Checksum": {"FCS", [First("F1"), First("F4"), Last("F2"), Last("F5")]}}
The text was updated successfully, but these errors were encountered: