0.0.002
ddat interop with dat js cable interop with cabal js ddat's frontend = dat-thang cable fe = cable-thang dillo support based on cel's dillo-dat bootstrap node xplatform support Signed-off-by: divo <418@cryspace.space>
This commit is contained in:
1 parent
f0f91540be
commit
b735900f2e
323 files changed
+134347
-343
No files matched your search
+18
-29
@@ -1,33 +1,22 @@
|
||||
#ifndef DAT_NET_H
|
||||
#define DAT_NET_H
|
||||
#ifndef DAT_NET_COMPAT_H
|
||||
#define DAT_NET_COMPAT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/socket.h>
|
||||
/* Source-compatibility names for Dat/Cable code written before libcess was
|
||||
* extracted. New integrations should include <cess_net.h> directly. */
|
||||
#include <libcess/cess_net.h>
|
||||
#include "dat_socket.h"
|
||||
|
||||
#define DATNET_PORT 3282
|
||||
#define DATNET_MAX_PACKET 1400
|
||||
#define DATNET_TOPIC_BYTES 32
|
||||
#define DATNET_PEERID_BYTES 32
|
||||
typedef cess_peer_t dat_peer_t;
|
||||
typedef cessnet_t datnet_t;
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
struct sockaddr_storage addr;
|
||||
socklen_t addrlen;
|
||||
uint8_t id[DATNET_PEERID_BYTES];
|
||||
} dat_peer_t;
|
||||
#define DATNET_PORT CESSNET_PORT
|
||||
#define DATNET_MAX_PACKET CESSNET_MAX_PACKET
|
||||
#define DATNET_TOPIC_BYTES CESSNET_TOPIC_BYTES
|
||||
#define DATNET_PEERID_BYTES CESSNET_PEERID_BYTES
|
||||
#define datnet_init cessnet_init
|
||||
#define datnet_bind cessnet_bind
|
||||
#define datnet_poll cessnet_poll
|
||||
#define datnet_send cessnet_send
|
||||
#define datnet_close cessnet_close
|
||||
|
||||
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 */
|
||||
#endif
|
||||
Reference in new issue
Block a user