Starting to make the daemon more intelligent
This commit is contained in:
parent
fbd862431c
commit
f8e4286740
7 changed files with 98 additions and 8 deletions
|
@ -15,6 +15,12 @@
|
|||
uint16_t port;
|
||||
};
|
||||
|
||||
struct IpfsNodeListenParams {
|
||||
uint32_t ipv4;
|
||||
uint16_t port;
|
||||
struct IpfsNode* local_node;
|
||||
};
|
||||
|
||||
void *ipfs_null_connection (void *ptr);
|
||||
void *ipfs_null_listen (void *ptr);
|
||||
int ipfs_daemon (int argc, char **argv);
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#ifndef __CORE_IPFS_NODE_H__
|
||||
#define __CORE_IPFS_NODE_H__
|
||||
#pragma once
|
||||
|
||||
enum NodeMode { MODE_OFFLINE, MODE_ONLINE };
|
||||
|
||||
struct IpfsNode {
|
||||
enum NodeMode mode;
|
||||
//struct PeerId identity;
|
||||
//struct Repo repo;
|
||||
struct FSRepo* repo;
|
||||
struct Peerstore* peerstore;
|
||||
//struct Pinner pinning; // an interface
|
||||
//struct Mount** mounts;
|
||||
//struct PrivKey* private_key;
|
||||
// TODO: Add more here
|
||||
};
|
||||
|
||||
#endif /* ipfs_node_h */
|
||||
|
|
35
include/ipfs/core/net.h
Normal file
35
include/ipfs/core/net.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include "libp2p/net/stream.h"
|
||||
|
||||
struct IpfsListener {
|
||||
char* conCh;
|
||||
char* protocol;
|
||||
};
|
||||
|
||||
/**
|
||||
* Do a socket accept
|
||||
* @param listener the listener
|
||||
* @param stream the returned stream
|
||||
* @returns true(1) on success, false(0) otherwise
|
||||
*/
|
||||
int ipfs_core_net_accept(struct IpfsListener* listener, struct Stream* stream);
|
||||
|
||||
/**
|
||||
* Listen using a particular protocol
|
||||
* @param node the node
|
||||
* @param protocol the protocol to use
|
||||
* @param listener the results
|
||||
* @returns true(1) on success, false(0) otherwise
|
||||
*/
|
||||
int ipfs_core_net_listen(struct IpfsNode* node, char* protocol, struct IpfsListener* listener);
|
||||
|
||||
/***
|
||||
* Dial a peer
|
||||
* @param node this node
|
||||
* @param peer_id who to dial
|
||||
* @param protocol the protocol to use
|
||||
* @param stream the resultant stream
|
||||
* @returns true(1) on success, otherwise false(0)
|
||||
*/
|
||||
int ipsf_core_net_dial(struct IpfsNode* node, char* peer_id, char* protocol, struct Stream* stream);
|
Loading…
Add table
Add a link
Reference in a new issue