Skip to content

Commit

Permalink
Document deviations from RFC 8446 PL
Browse files Browse the repository at this point in the history
Explains in detail how the syntax from RFC 8446 section 3.7 is
repurposed for concise descriptions of structure variants. Additionally,
the section on message encoding is moved to "Protocol Definition" to
make the document flow better.

Closes #472
  • Loading branch information
tgeoghegan committed Jul 27, 2024
1 parent 83f1ea7 commit 93fca57
Showing 1 changed file with 82 additions and 10 deletions.
92 changes: 82 additions & 10 deletions draft-ietf-ppm-dap.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,6 @@ Report Share:

{:br}

This document uses the presentation language of {{!RFC8446}} to define messages
in the DAP protocol. Encoding and decoding of these messages as byte strings
also follows {{RFC8446}}.

# Overview {#overview}

The protocol is executed by a large set of Clients and a pair of servers
Expand Down Expand Up @@ -653,6 +649,82 @@ DAP has three major interactions which need to be defined:
Each of these interactions is defined in terms of "resources". In this section
we define these resources and the messages used to act on them.

## Message Encoding

We use the presentation language defined in {{!RFC8446, Section 3}} to define
messages in the DAP protocol, with the following deviations.

{{Section 3.7 of !RFC8446}} defines a syntax for structure fields whose values
are constants. In this document, we do not use that notation, but use something
similar to describe specific variants of structures containing enumerated types,
described in {{!RFC8446, Section 3.8}}.

For example, suppose we have an enumeration and a structure defined as follows:

~~~
enum {
number(0),
string(1),
(255)
} ExampleEnum;

struct {
uint32 always_present;
ExampleEnum type;
select (ExampleStruct.type) {
case number: uint32 a_number;
case string: opaque a_string<0..10>;
};
} ExampleStruct;
~~~

Then we describe the specific variant of `ExampleStruct` where `type == number`
with a `variant` block like so:

~~~
variant {
/* Field exists regardless of variant */
uint32 always_present;
ExampleEnum type = number;
/* Only fields included in the type == number variant is described */
uint32 a_number;
} ExampleStruct;
~~~

The protocol text accompanying this would explain how implementations should
handle the `always_present` and `a_number` fields but not `type`. This does not
mean that the `type` field of `ExampleStruct` can only ever have value `number`.

This notation can also be used in structures where the enum field does not
affect what fields are or are not present in the structure. For example:

~~~
enum {
something(0),
something_else(1),
(255)
} FailureReason;

struct {
FailureReason failure_reason;
opaque another_field<0..256>;
} FailedOperation;
~~~

The protocol text might include a description like:

~~~
variant {
FailureReason failure_reason = something;
opaque another_field<0..256>;
} FailedOperation;
~~~

Encoding and decoding of these messages as byte strings also follows
{{RFC8446}}.

## Basic Type Definitions

The following are some basic type definitions used in other messages:

~~~
Expand Down Expand Up @@ -1474,7 +1546,7 @@ For any report that was rejected, the Helper sets the outbound preparation
response to

~~~
struct {
variant {
ReportID report_id;
PrepareRespState prepare_resp_state = reject;
PrepareError prepare_error;
Expand Down Expand Up @@ -1507,7 +1579,7 @@ initial `outbound` message to send in response to the Leader. If `state` is of
type `Rejected`, then the Helper responds with

~~~
struct {
variant {
ReportID report_id;
PrepareRespState prepare_resp_state = reject;
PrepareError prepare_error = vdaf_prep_error;
Expand All @@ -1517,7 +1589,7 @@ struct {
Otherwise the Helper responds with

~~~
struct {
variant {
ReportID report_id;
PrepareRespState prepare_resp_state = continue;
opaque payload<0..2^32-1> = outbound;
Expand Down Expand Up @@ -1779,7 +1851,7 @@ denote the payload of the prep step. The Helper computes the following:
If `state == Rejected()`, then the Helper's response is

~~~
struct {
variant {
ReportID report_id;
PrepareRespState prepare_resp_state = reject;
PrepareError prepare_error = vdaf_prep_error;
Expand All @@ -1789,7 +1861,7 @@ struct {
Otherwise, if `outbound != None`, then the Helper's response is

~~~
struct {
variant {
ReportID report_id;
PrepareRespState prepare_resp_state = continue;
opaque payload<0..2^32-1> = outbound;
Expand All @@ -1799,7 +1871,7 @@ struct {
Otherwise, if `outbound == None`, then the Helper's response is

~~~
struct {
variant {
ReportID report_id;
PrepareRespState prepare_resp_state = finished;
} PrepareResp;
Expand Down

0 comments on commit 93fca57

Please sign in to comment.