[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 12/32: transport (quic): get recv info from incoming data
From: |
gnunet |
Subject: |
[gnunet] 12/32: transport (quic): get recv info from incoming data |
Date: |
Tue, 18 Jul 2023 17:16:01 +0200 |
This is an automated email from the git hooks/post-receive script.
marshall pushed a commit to branch master
in repository gnunet.
commit 573a941d74513700fa46fb60d4f90945d3878f0f
Author: marshall <stmr@umich.edu>
AuthorDate: Thu Jun 8 12:06:14 2023 -0400
transport (quic): get recv info from incoming data
---
src/transport/gnunet-communicator-quic.c | 53 +++++++++++++++++++++++++++-----
1 file changed, 45 insertions(+), 8 deletions(-)
diff --git a/src/transport/gnunet-communicator-quic.c
b/src/transport/gnunet-communicator-quic.c
index 60a20c581..a710c80de 100644
--- a/src/transport/gnunet-communicator-quic.c
+++ b/src/transport/gnunet-communicator-quic.c
@@ -29,11 +29,13 @@
sizeof(struct sockaddr_storage) + \
QUICHE_MAX_CONN_ID_LEN
+/**
+ * Map of DCID (uint8_t) -> quic_conn for quickly retrieving connections to
other peers.
+ */
+struct GNUNET_CONTAINER_MultiHashMap *conn_map;
+
static const struct GNUNET_CONFIGURATION_Handle *cfg;
static struct GNUNET_TIME_Relative rekey_interval;
-/**
- * the socket to transmit data on
-*/
static struct GNUNET_NETWORK_Handle *udp_sock;
// static struct GNUNET_STATISTICS_Handle *stats;
// static struct GNUNET_CONTAINER_MultiPeerMap *senders;
@@ -59,8 +61,10 @@ static int have_v6_socket;
static uint16_t my_port;
static unsigned long long rekey_max_bytes;
-struct quiche_conn *conn;
-
+/**
+ * QUIC connection object. A connection has a unique SCID/DCID pair. Here we
store our SCID
+ * (incoming packet DCID field == outgoing packet SCID field) for a given
connection.
+*/
struct quic_conn {
uint8_t cid[LOCAL_CONN_ID_LEN];
@@ -88,7 +92,6 @@ static uint64_t gen_streamid()
* 0x02: client-initiated, unidirectional
* 0x03: server-initiated, unidirectional
*/
-
return sid;
}
@@ -304,8 +307,7 @@ sock_read (void *cls)
*
* - create structure for individual connections (how many can we have
concurrently)
*/
- struct quic_conn *tmp_conn;
-
+ struct quic_conn *conn;
uint8_t new_cid[LOCAL_CONN_ID_LEN];
uint8_t type;
@@ -332,9 +334,43 @@ sock_read (void *cls)
}
/* look for connection in hashtable */
+ /* each connection to the peer should have a unique incoming DCID */
+ /* check against a conn SCID */
+ struct GNUNET_HashCode *conn_key;
+ GNUNET_CRYPTO_hash(dcid, sizeof(dcid), conn_key);
+ conn = GNUNET_CONTAINER_multihashmap_get(conn_map, conn_key);
+ if (NULL == conn)
+ {
+ /**
+ * create_conn(), error check for problems with creation
+ */
+ }
+ /**
+ * TODO: today finish sock_read, make create_conn, get compilation working
+ */
+ char *bindto;
+ socklen_t in_len;
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ COMMUNICATOR_CONFIG_SECTION,
+ "BINDTO",
+ &bindto))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ COMMUNICATOR_CONFIG_SECTION,
+ "BINDTO");
+ return;
+ }
+ struct sock_addr *recv_sock = udp_address_to_sockaddr(bindto, in_len);
+ quiche_recv_info recv_info = {
+ (struct sockaddr *)&sa,
+ salen,
+ recv_sock,
+ in_len,
+ };
// if (rcvd > sizeof(struct UDPRekey))
// {
@@ -700,6 +736,7 @@ main(int argc, char *const *argv)
* Setup QUICHE configuration
*/
quiche_config *quiche_conf = quiche_config_new(QUICHE_PROTOCOL_VERSION);
+ conn_map = GNUNET_CONTAINER_multihashmap_create(2, GNUNET_NO);
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 07/32: transport (quic): Makefile.am add necessary linker flags, (continued)
- [gnunet] 07/32: transport (quic): Makefile.am add necessary linker flags, gnunet, 2023/07/18
- [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 <=
- [gnunet] 11/32: transport (quic): conn object implement, gnunet, 2023/07/18
- [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