fix keys.h typo, began dat_net c/h

This commit is contained in:
2025-10-16 14:08:14 -04:00
parent a1da7deba4
commit f0f91540be
4 changed files with 42 additions and 3 deletions

33
inc/dat_net.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef DAT_NET_H
#define DAT_NET_H
#include <stdint.h>
#include <stddef.h>
#include <sys/socket.h>
#define DATNET_PORT 3282
#define DATNET_MAX_PACKET 1400
#define DATNET_TOPIC_BYTES 32
#define DATNET_PEERID_BYTES 32
typedef struct {
int fd;
struct sockaddr_storage addr;
socklen_t addrlen;
uint8_t id[DATNET_PEERID_BYTES];
} dat_peer_t;
typedef struct {
int sock;
uint8_t topic[DATNET_TOPIC_BYTES];
uint8_t peerid[DATNET_PEERID_BYTES];
void (*on_message)(dat_peer_t *peer, const uint8_t *msg, size_t len);
} datnet_t;
int datnet_init();
int datnet_bind();
int datnet_poll();
int datnet_send();
int datnet_close(datnet_t *net);
#endif /* DAT_NET_H */

View File

@@ -5,12 +5,12 @@
#define SLEEP_PUB_KEY_BYTES 32
#define SLEEP_SECRET_KEY_BYTES 64
#define SLEEP_SIGNATURE_BYES 64
#define SLEEP_BLAKE2B_BYES 32
#define SLEEP_SIGNATURE_BYTES 64
#define SLEEP_BLAKE2B_BYTES 32
typedef struct {
uint8_t pubkey[SLEEP_PUB_KEY_BYTES];
uint8_t seckey[SLEEP_SECRET_KEY_BYES];
uint8_t seckey[SLEEP_SECRET_KEY_BYTES];
} sleep_keypair_t;

View File

@@ -1 +1,3 @@
// hyperswarm dht
#include "cesspool.h"
#include "s7.h"

View File

@@ -0,0 +1,4 @@
// dat_net.c
#include "sleep.h"
#include "dat_net.h"
#include "cesspool.h"