[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 11/32: transport (quic): conn object implement
From: |
gnunet |
Subject: |
[gnunet] 11/32: transport (quic): conn object implement |
Date: |
Tue, 18 Jul 2023 17:16:00 +0200 |
This is an automated email from the git hooks/post-receive script.
marshall pushed a commit to branch master
in repository gnunet.
commit 3ed77023f420a1eb78583eed0ca21412fa31b5c1
Author: marshall <stmr@umich.edu>
AuthorDate: Mon Jun 5 15:44:59 2023 -0400
transport (quic): conn object implement
---
src/transport/gnunet-communicator-quic.c | 69 ++++++++++++++++++++++++++++++--
1 file changed, 65 insertions(+), 4 deletions(-)
diff --git a/src/transport/gnunet-communicator-quic.c
b/src/transport/gnunet-communicator-quic.c
index f779297de..60a20c581 100644
--- a/src/transport/gnunet-communicator-quic.c
+++ b/src/transport/gnunet-communicator-quic.c
@@ -20,7 +20,14 @@
// #define STREAM_ID_MAX (UINT64_MAX - (0b11 << 62))
-#define STREAM_ID_MAX UINT64_MAX - 0xC000000000000000
+// #define STREAM_ID_MAX UINT64_MAX - 0xC000000000000000
+
+/* Currently equivalent to QUICHE_MAX_CONN_ID_LEN */
+#define LOCAL_CONN_ID_LEN 20
+#define MAX_TOKEN_LEN \
+ sizeof("quiche") - 1 + \
+ sizeof(struct sockaddr_storage) + \
+ QUICHE_MAX_CONN_ID_LEN
static const struct GNUNET_CONFIGURATION_Handle *cfg;
static struct GNUNET_TIME_Relative rekey_interval;
@@ -52,15 +59,24 @@ static int have_v6_socket;
static uint16_t my_port;
static unsigned long long rekey_max_bytes;
+struct quiche_conn *conn;
+
+struct quic_conn {
+
+ uint8_t cid[LOCAL_CONN_ID_LEN];
+
+ quiche_conn *conn;
+};
+
/**
* @param stream_type ...
* Generate a unique stream ID with indicated stream type
* quiche library has QUICHE_MAX_CONN_ID_LEN = 20?
*/
-uint64_t gen_streamid()
+static uint64_t gen_streamid()
{
uint64_t sid;
- sid = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_STRONG, STREAM_ID_MAX);
+ // sid = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_STRONG,
STREAM_ID_MAX);
/**
* Ensure each peer does NOT reuse one of their own stream ID
*/
@@ -76,6 +92,14 @@ uint64_t gen_streamid()
return sid;
}
+/**
+ * Generate a new connection ID
+*/
+static uint8_t *gen_cid(uint8_t *cid, size_t cid_len)
+{
+ int rand_cid = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_STRONG,
UINT8_MAX);
+}
+
/**
* Shutdown the UNIX communicator.
*
@@ -265,7 +289,6 @@ sock_read (void *cls)
(struct sockaddr *) &sa,
&salen);
- // ssize_t quic_rcvd = quiche_conn_recv(conn, buf, rcvd, &recv_info)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Read %lu bytes\n", rcvd);
@@ -274,6 +297,44 @@ sock_read (void *cls)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "recv");
return;
}
+ /**
+ * TODO:
+ * - handle connection ID (not stream ID) -> associate incoming packets by
connection ID
+ * with previous connection or generate new connection
+ *
+ * - create structure for individual connections (how many can we have
concurrently)
+ */
+ struct quic_conn *tmp_conn;
+
+
+ uint8_t new_cid[LOCAL_CONN_ID_LEN];
+ uint8_t type;
+ uint32_t version;
+
+ uint8_t scid[QUICHE_MAX_CONN_ID_LEN];
+ size_t scid_len = sizeof(scid);
+
+ uint8_t dcid[QUICHE_MAX_CONN_ID_LEN];
+ size_t dcid_len = sizeof(dcid);
+
+ uint8_t odcid[QUICHE_MAX_CONN_ID_LEN];
+ size_t odcid_len = sizeof(odcid);
+
+ uint8_t token[MAX_TOKEN_LEN];
+ size_t token_len = sizeof(token);
+
+ int rc = quiche_header_info(buf, read, LOCAL_CONN_ID_LEN, &version,
+ &type, scid, &scid_len, dcid, &dcid_len,
+ token, &token_len);
+ if (rc < 0)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "failed to parse quic header: %d",
rc);
+ }
+
+ /* look for connection in hashtable */
+
+
+
// if (rcvd > sizeof(struct UDPRekey))
// {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 03/32: transport (quic): add include for quiche.h, (continued)
- [gnunet] 03/32: transport (quic): add include for quiche.h, gnunet, 2023/07/18
- [gnunet] 02/32: configure: remove remnants from old libunistring checks, gnunet, 2023/07/18
- [gnunet] 08/32: transport (quic): handle reading data from socket, gnunet, 2023/07/18
- [gnunet] 10/32: transport (quic): define max streamid, gnunet, 2023/07/18
- [gnunet] 04/32: transport (quic): UDP listener skeleton, gnunet, 2023/07/18
- [gnunet] 05/32: transport (quic): change configure files/add changes, gnunet, 2023/07/18
- [gnunet] 01/32: transport (QUIC): create starter file and update Makefile, gnunet, 2023/07/18
- [gnunet] 06/32: transport (quic): remove binary, add quic communicator to gitignore, gnunet, 2023/07/18
- [gnunet] 09/32: transport (quic): link quiche w/ quic communicator, gnunet, 2023/07/18
- [gnunet] 12/32: transport (quic): get recv info from incoming data, gnunet, 2023/07/18
- [gnunet] 11/32: transport (quic): conn object implement,
gnunet <=
- [gnunet] 14/32: transport (quic): more logic for reading stream, gnunet, 2023/07/18
- [gnunet] 15/32: transport (quic): mint_token for generating tokens, gnunet, 2023/07/18
- [gnunet] 13/32: transport (quic): establish connection, gnunet, 2023/07/18
- [gnunet] 18/32: transport (quic): check for closed connections, gnunet, 2023/07/18
- [gnunet] 27/32: transport (quic): Add some pointers, gnunet, 2023/07/18
- [gnunet] 17/32: transport (quic): create connection functionality, gnunet, 2023/07/18
- [gnunet] 16/32: transport (quic): mint tokens, gnunet, 2023/07/18
- [gnunet] 20/32: transport (quic): cleanup, create header object, gnunet, 2023/07/18
- [gnunet] 19/32: transport (quic): minor cleanup, remove commented code, gnunet, 2023/07/18
- [gnunet] 22/32: transport (quic): token validation check, gnunet, 2023/07/18