We express this state machine in more concrete form in the form of a table,
which makes the available transitions clear:
-† Except where superceded by a more specific transition
+† Except where superseded by a more specific transition
ε means “where no other transition is applicable”.
uint32_t pto[QUIC_PN_SPACE_NUM];
} OSSL_ACKM_PROBE_INFO;
-int ossl_ackm_get_probe_request(OSSL_ACKM *ackm, int clear,
- OSSL_ACKM_PROBE_INFO *info);
+/*
+ * Returns a pointer to a structure counting any pending probe requests which
+ * have been generated by the ACKM. The fields in the structure are incremented
+ * by one every time the ACKM wants another probe of the given type to be sent.
+ * If the ACKM thinks two packets should be generated for a probe, it will
+ * increment the field twice (TODO).
+ *
+ * It is permissible for the caller to decrement or zero these fields to keep
+ * track of when it has generated a probe as asked. The returned structure
+ * has the same lifetime as the ACKM.
+ *
+ * This function should be called after calling e.g. ossl_ackm_on_timeout
+ * to determine if any probe requests have been generated.
+ */
+OSSL_ACKM_PROBE_INFO *ossl_ackm_get_probe_request(OSSL_ACKM *ackm);
int ossl_ackm_get_largest_unacked(OSSL_ACKM *ackm, int pkt_space, QUIC_PN *pn);
if (pseudo)
/*
- * If this is psuedo-loss (e.g. during connection retry) we do not
+ * If this is pseudo-loss (e.g. during connection retry) we do not
* inform the CC as it is not a real loss and not reflective of network
* conditions.
*/
return ackm->loss_detection_deadline;
}
-int ossl_ackm_get_probe_request(OSSL_ACKM *ackm, int clear,
- OSSL_ACKM_PROBE_INFO *info)
+OSSL_ACKM_PROBE_INFO *ossl_ackm_get_probe_request(OSSL_ACKM *ackm)
{
- *info = ackm->pending_probe;
-
- if (clear != 0)
- memset(&ackm->pending_probe, 0, sizeof(ackm->pending_probe));
-
- return 1;
+ return &ackm->pending_probe;
}
int ossl_ackm_get_largest_unacked(OSSL_ACKM *ackm, int pkt_space, QUIC_PN *pn)
}
} else if (mode == MODE_PTO) {
OSSL_TIME deadline = ossl_ackm_get_loss_detection_deadline(h.ackm);
- OSSL_ACKM_PROBE_INFO probe = {0};
+ OSSL_ACKM_PROBE_INFO probe;
if (!TEST_int_eq(ossl_time_compare(deadline, loss_detection_deadline), 0))
goto err;
goto err;
/* Should not have any probe requests yet. */
- if (!TEST_int_eq(ossl_ackm_get_probe_request(h.ackm, 0, &probe), 1))
- goto err;
-
+ probe = *ossl_ackm_get_probe_request(h.ackm);
if (!TEST_int_eq(test_probe_counts(&probe, 0, 0, 0, 0, 0), 1))
goto err;
/* Should have a probe request. Not cleared by first call. */
for (i = 0; i < 3; ++i) {
- if (!TEST_int_eq(ossl_ackm_get_probe_request(h.ackm, i > 0, &probe), 1))
- goto err;
+ probe = *ossl_ackm_get_probe_request(h.ackm);
+ if (i > 0)
+ memset(ossl_ackm_get_probe_request(h.ackm), 0, sizeof(probe));
if (i == 2) {
if (!TEST_int_eq(test_probe_counts(&probe, 0, 0, 0, 0, 0), 1))