2016-11-23 20:19:16 +00:00
|
|
|
#ifndef NAMESYS_H
|
|
|
|
#define NAMESYS_H
|
|
|
|
|
|
|
|
#define DefaultDepthLimit 32
|
|
|
|
|
2016-12-23 03:45:13 +00:00
|
|
|
#include "ipfs/util/errs.h"
|
2016-11-23 20:19:16 +00:00
|
|
|
|
|
|
|
typedef struct s_resolvers {
|
|
|
|
char *protocol;
|
|
|
|
int (*func)(char**, char*);
|
|
|
|
} resolvers;
|
|
|
|
|
2016-12-01 22:25:16 +00:00
|
|
|
// Resolver provides path resolution to IPFS
|
|
|
|
// It has a pointer to a DAGService, which is uses to resolve nodes.
|
|
|
|
// TODO: now that this is more modular, try to unify this code with the
|
|
|
|
// the resolvers in namesys
|
2016-11-24 10:52:15 +00:00
|
|
|
typedef struct s_resolver {
|
2016-12-01 22:25:16 +00:00
|
|
|
//DAGService DAG;
|
|
|
|
//NodeLink *lnk;
|
2016-11-24 10:52:15 +00:00
|
|
|
// resolveOnce looks up a name once (without recursion).
|
|
|
|
int (*resolveOnce) (char **, char *);
|
|
|
|
} resolver;
|
|
|
|
|
2016-11-23 20:19:16 +00:00
|
|
|
//TODO ciPrivKey from c-libp2p-crypto
|
|
|
|
typedef void* ciPrivKey;
|
|
|
|
|
|
|
|
typedef struct s_publishers {
|
|
|
|
char *protocol;
|
|
|
|
int (*func) (ciPrivKey, char*);
|
|
|
|
int (*func_eol) (ciPrivKey, char*, time_t);
|
|
|
|
} publishers;
|
|
|
|
|
|
|
|
typedef struct s_mpns {
|
|
|
|
resolvers *resolver;
|
2016-12-05 11:55:17 +00:00
|
|
|
publishers *publisher;
|
2016-11-23 20:19:16 +00:00
|
|
|
} mpns;
|
2016-11-24 10:52:15 +00:00
|
|
|
|
2016-11-24 22:52:19 +00:00
|
|
|
typedef struct s_tlds {
|
|
|
|
char *str;
|
|
|
|
int condition;
|
|
|
|
} tlds;
|
|
|
|
|
2016-12-05 11:55:17 +00:00
|
|
|
int ipfs_namesys_resolve(char **path, char *name);
|
|
|
|
int ipfs_namesys_resolve_n(char **path, char *name, int depth);
|
|
|
|
int ipfs_namesys_resolve_once (char **path, char *name);
|
|
|
|
int ipfs_namesys_publish (char *proto, ciPrivKey name, char *value);
|
|
|
|
int ipfs_namesys_publish_with_eol (char *proto, ciPrivKey name, char *value, time_t eol);
|
2016-11-24 12:50:05 +00:00
|
|
|
|
2016-12-05 11:55:17 +00:00
|
|
|
int ipfs_proquint_is_proquint(char *str);
|
|
|
|
char *ipfs_proquint_encode(char *buf, int size);
|
|
|
|
char *ipfs_proquint_decode(char *str);
|
|
|
|
int ipfs_proquint_resolve_once (char **p, char *name);
|
2016-11-24 22:52:19 +00:00
|
|
|
|
2016-12-05 11:55:17 +00:00
|
|
|
int ipfs_isdomain_match_string (char *d);
|
|
|
|
int ipfs_isdomain_is_icann_tld(char *s);
|
|
|
|
int ipfs_isdomain_is_extended_tld (char *s);
|
|
|
|
int ipfs_isdomain_is_tld (char *s);
|
|
|
|
int ipfs_isdomain_is_domain (char *s);
|
2016-11-27 13:57:28 +00:00
|
|
|
|
2016-11-29 23:35:55 +00:00
|
|
|
typedef struct s_DNSResolver {
|
|
|
|
// TODO
|
2016-12-23 03:28:30 +00:00
|
|
|
int (*lookupTXT) (char ***, char *);
|
2016-11-29 23:35:55 +00:00
|
|
|
} DNSResolver;
|
|
|
|
|
2016-12-23 03:28:30 +00:00
|
|
|
int ipfs_dns_resolver_resolve_once (char **path, char *name);
|
2016-12-05 11:55:17 +00:00
|
|
|
int ipfs_dns_work_domain (int output, DNSResolver *r, char *name);
|
2016-12-23 03:28:30 +00:00
|
|
|
int ipfs_dns_parse_entry (char **path, char *txt);
|
|
|
|
int ipfs_dns_try_parse_dns_link(char **path, char *txt);
|
2016-11-23 20:19:16 +00:00
|
|
|
#endif //NAMESYS_H
|