*layer_hint = thishop;
/* This cell is for us. Keep a record of this cell because we will
* use it in the next SENDME cell. */
- if (sendme_circuit_is_next_cell(thishop->deliver_window)) {
- sendme_circuit_note_inbound_cell(thishop);
+ if (sendme_circuit_cell_is_next(thishop->deliver_window)) {
+ sendme_circuit_record_inbound_cell(thishop);
}
return 0;
}
/* We are about to send this cell outbound on the circuit. Keep a record of
* this cell if we are expecting that the next cell is a SENDME. */
- if (sendme_circuit_is_next_cell(TO_CIRCUIT(or_circ)->package_window)) {
- sendme_circuit_note_outbound_cell(or_circ);
+ if (sendme_circuit_cell_is_next(TO_CIRCUIT(or_circ)->package_window)) {
+ sendme_circuit_record_outbound_cell(or_circ);
}
/* encrypt one layer */
/** Keep the current inbound cell digest for the next SENDME digest. This part
* is only done by the client as the circuit came back from the Exit. */
void
-sendme_circuit_note_outbound_cell(or_circuit_t *or_circ)
+sendme_circuit_record_outbound_cell(or_circuit_t *or_circ)
{
tor_assert(or_circ);
relay_crypto_record_sendme_digest(&or_circ->crypto);
/** Keep the current inbound cell digest for the next SENDME digest. This part
* is only done by the client as the circuit came back from the Exit. */
void
-sendme_circuit_note_inbound_cell(crypt_path_t *cpath)
+sendme_circuit_record_inbound_cell(crypt_path_t *cpath)
{
tor_assert(cpath);
relay_crypto_record_sendme_digest(&cpath->crypto);
* one cell (the possible SENDME cell) should be a multiple of the increment
* window value. */
bool
-sendme_circuit_is_next_cell(int window)
+sendme_circuit_cell_is_next(int window)
{
/* Is this the last cell before a SENDME? The idea is that if the package or
* deliver window reaches a multiple of the increment, after this cell, we
/* Note the cell digest in the circuit sendme last digests FIFO if applicable.
* It is safe to pass a circuit that isn't meant to track those digests. */
void
-sendme_note_cell_digest(circuit_t *circ)
+sendme_record_cell_digest(circuit_t *circ)
{
const uint8_t *digest;
/* Is this the last cell before a SENDME? The idea is that if the
* package_window reaches a multiple of the increment, after this cell, we
* should expect a SENDME. */
- if (!sendme_circuit_is_next_cell(circ->package_window)) {
+ if (!sendme_circuit_cell_is_next(circ->package_window)) {
return;
}
int sendme_note_stream_data_packaged(edge_connection_t *conn);
/* Track cell digest. */
-void sendme_note_cell_digest(circuit_t *circ);
-void sendme_circuit_note_inbound_cell(crypt_path_t *cpath);
-void sendme_circuit_note_outbound_cell(or_circuit_t *or_circ);
+void sendme_record_cell_digest(circuit_t *circ);
+void sendme_circuit_record_inbound_cell(crypt_path_t *cpath);
+void sendme_circuit_record_outbound_cell(or_circuit_t *or_circ);
/* Circuit level information. */
-bool sendme_circuit_is_next_cell(int window);
+bool sendme_circuit_cell_is_next(int window);
/* Private section starts. */
#ifdef SENDME_PRIVATE
}
static void
-test_v1_note_digest(void *arg)
+test_v1_record_digest(void *arg)
{
or_circuit_t *or_circ = NULL;
origin_circuit_t *orig_circ = NULL;
circ->purpose = CIRCUIT_PURPOSE_S_REND_JOINED;
/* We should never note SENDME digest on origin circuit. */
- sendme_note_cell_digest(circ);
+ sendme_record_cell_digest(circ);
tt_assert(!circ->sendme_last_digests);
/* We do not need the origin circuit for now. */
orig_circ = NULL;
* in order to catched the CIRCWINDOW_INCREMENT-nth cell. Try something that
* shouldn't be noted. */
circ->package_window = CIRCWINDOW_INCREMENT;
- sendme_note_cell_digest(circ);
+ sendme_record_cell_digest(circ);
tt_assert(!circ->sendme_last_digests);
/* This should work now. Package window at CIRCWINDOW_INCREMENT + 1. */
circ->package_window++;
- sendme_note_cell_digest(circ);
+ sendme_record_cell_digest(circ);
tt_assert(circ->sendme_last_digests);
tt_int_op(smartlist_len(circ->sendme_last_digests), OP_EQ, 1);
/* Next cell in the package window shouldn't do anything. */
circ->package_window++;
- sendme_note_cell_digest(circ);
+ sendme_record_cell_digest(circ);
tt_int_op(smartlist_len(circ->sendme_last_digests), OP_EQ, 1);
/* The next CIRCWINDOW_INCREMENT should add one more digest. */
circ->package_window = (CIRCWINDOW_INCREMENT * 2) + 1;
- sendme_note_cell_digest(circ);
+ sendme_record_cell_digest(circ);
tt_int_op(smartlist_len(circ->sendme_last_digests), OP_EQ, 2);
done:
/* Note the wrong digest in the circuit, cell should fail validation. */
circ->package_window = CIRCWINDOW_INCREMENT + 1;
- sendme_note_cell_digest(circ);
+ sendme_record_cell_digest(circ);
tt_int_op(smartlist_len(circ->sendme_last_digests), OP_EQ, 1);
setup_full_capture_of_logs(LOG_INFO);
tt_int_op(sendme_is_valid(circ, payload, sizeof(payload)), OP_EQ, false);
/* Record the cell digest into the circuit, cell should validate. */
memcpy(or_circ->crypto.sendme_digest, digest, sizeof(digest));
circ->package_window = CIRCWINDOW_INCREMENT + 1;
- sendme_note_cell_digest(circ);
+ sendme_record_cell_digest(circ);
tt_int_op(smartlist_len(circ->sendme_last_digests), OP_EQ, 1);
tt_int_op(sendme_is_valid(circ, payload, sizeof(payload)), OP_EQ, true);
/* After a validation, the last digests is always popped out. */
}
struct testcase_t sendme_tests[] = {
- { "v1_note_digest", test_v1_note_digest, TT_FORK,
+ { "v1_record_digest", test_v1_record_digest, TT_FORK,
NULL, NULL },
{ "v1_consensus_params", test_v1_consensus_params, TT_FORK,
NULL, NULL },