c-ipfs/include/ipfs/core/ipfs_node.h

38 lines
997 B
C
Raw Normal View History

#pragma once
2017-07-24 19:56:30 +00:00
#include "ipfs/blocks/blockstore.h"
#include "ipfs/repo/config/identity.h"
#include "ipfs/repo/fsrepo/fs_repo.h"
2017-04-03 16:55:36 +00:00
#include "ipfs/routing/routing.h"
#include "libp2p/peer/peerstore.h"
2017-03-19 19:40:16 +00:00
#include "libp2p/peer/providerstore.h"
enum NodeMode { MODE_OFFLINE, MODE_ONLINE };
2016-10-27 18:11:34 +00:00
struct IpfsNode {
enum NodeMode mode;
struct Identity* identity;
struct FSRepo* repo;
struct Peerstore* peerstore;
2017-03-19 19:40:16 +00:00
struct ProviderStore* providerstore;
2017-04-03 16:55:36 +00:00
struct IpfsRouting* routing;
2017-07-24 19:56:30 +00:00
struct Blockstore* blockstore;
2016-10-27 18:11:34 +00:00
//struct Pinner pinning; // an interface
//struct Mount** mounts;
// TODO: Add more here
};
/***
* build an online IpfsNode
* @param repo_path where the IPFS repository directory is
* @param node the completed IpfsNode struct
* @returns true(1) on success
*/
int ipfs_node_online_new(const char* repo_path, struct IpfsNode** node);
/***
* Free resources from the creation of an IpfsNode
* @param node the node to free
* @returns true(1)
*/
int ipfs_node_free(struct IpfsNode* node);