diff --git a/include/ipfs/dnslink/dnslink.h b/include/ipfs/dnslink/dnslink.h index f04cb7c..69221b2 100644 --- a/include/ipfs/dnslink/dnslink.h +++ b/include/ipfs/dnslink/dnslink.h @@ -1,7 +1,7 @@ #ifndef DNSLINK_H #define DNSLINK_H - #include "ipfs/errs.h" + #include "ipfs/util/errs.h" // DefaultDepthLimit controls how many dns links to resolve through before // returning. Users can override this default. @@ -17,6 +17,7 @@ extern int (*ipfs_dnslink_lookup_txt)(char ***, char *); #endif // IPFS_DNSLINK_C + int ipfs_dns (int argc, char **argv); int ipfs_dnslink_resolve (char **p, char *domain); int ipfs_dnslink_resolve_n (char **p, char *d, int depth); int ipfs_dnslink_resolv_lookupTXT(char ***txt, char *domain); diff --git a/include/ipfs/errs.h b/include/ipfs/errs.h deleted file mode 100644 index 18494b4..0000000 --- a/include/ipfs/errs.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef IPFS_ERRS_H - #define IPFS_ERRS_H - - char *Err[] = { - NULL, - "ErrAllocFailed", - "ErrNULLPointer", - "ErrUnknow", - "ErrPipe", - "ErrPoll", - "Could not publish name." - "Could not resolve name.", - "Could not resolve name (recursion limit exceeded).", - "expired record", - "unrecognized validity type", - "not a valid proquint string", - "not a valid domain name", - "not a valid dnslink entry", - // ErrBadPath is returned when a given path is incorrectly formatted - "invalid 'ipfs ref' path", - // Paths after a protocol must contain at least one component - "path must contain at least one component", - "TODO: ErrCidDecode", - NULL, - "no link named %s under %s", - "ErrInvalidParam", - // ErrResolveLimit is returned when a recursive resolution goes over - // the limit. - "resolve depth exceeded", - NULL, - "Invalid value. Not signed by PrivateKey corresponding to %s" - }; - - enum { - ErrAllocFailed = 1, - ErrNULLPointer, - ErrUnknow, - ErrPipe, - ErrPoll, - ErrPublishFailed, - ErrResolveFailed, - ErrResolveRecursion, - ErrExpiredRecord, - ErrUnrecognizedValidity, - ErrInvalidProquint, - ErrInvalidDomain, - ErrInvalidDNSLink, - ErrBadPath, - ErrNoComponents, - ErrCidDecode, - ErrNoLink, - ErrNoLinkFmt, - ErrInvalidParam, - ErrResolveLimit, - ErrInvalidSignature, - ErrInvalidSignatureFmt - } ErrsIdx; -#endif // IPFS_ERRS_H diff --git a/include/ipfs/namesys/namesys.h b/include/ipfs/namesys/namesys.h index 7c0fe3c..40891dd 100644 --- a/include/ipfs/namesys/namesys.h +++ b/include/ipfs/namesys/namesys.h @@ -3,7 +3,7 @@ #define DefaultDepthLimit 32 - #include "ipfs/errs.h" + #include "ipfs/util/errs.h" typedef struct s_resolvers { char *protocol; diff --git a/include/ipfs/path/path.h b/include/ipfs/path/path.h index e588c67..e687c5f 100644 --- a/include/ipfs/path/path.h +++ b/include/ipfs/path/path.h @@ -1,7 +1,7 @@ #ifndef IPFS_PATH_H #define IPFS_PATH_H - #include "ipfs/errs.h" + #include "ipfs/util/errs.h" char* ipfs_path_from_cid (struct Cid *c); char** ipfs_path_split_n (char *p, char *delim, int n); diff --git a/include/ipfs/util/errs.h b/include/ipfs/util/errs.h new file mode 100644 index 0000000..a872dc6 --- /dev/null +++ b/include/ipfs/util/errs.h @@ -0,0 +1,31 @@ +#ifndef IPFS_ERRS_H + #define IPFS_ERRS_H + + extern char *Err[]; + + enum { + ErrAllocFailed = 1, + ErrNULLPointer, + ErrUnknow, + ErrPipe, + ErrPoll, + ErrPublishFailed, + ErrResolveFailed, + ErrResolveRecursion, + ErrExpiredRecord, + ErrUnrecognizedValidity, + ErrInvalidProquint, + ErrInvalidDomain, + ErrInvalidDNSLink, + ErrBadPath, + ErrNoComponents, + ErrCidDecode, + ErrNoLink, + ErrNoLinkFmt, + ErrInvalidParam, + ErrResolveLimit, + ErrInvalidSignature, + ErrInvalidSignatureFmt, + ErrNoRecord + } ErrsIdx; +#endif // IPFS_ERRS_H diff --git a/namesys/publisher.c b/namesys/publisher.c index 1710b93..2e19e38 100644 --- a/namesys/publisher.c +++ b/namesys/publisher.c @@ -1,6 +1,6 @@ #include #include -#include "ipfs/errs.h" +#include "ipfs/util/errs.h" #include "ipfs/util/time.h" #include "ipfs/namesys/pb.h" #include "ipfs/namesys/publisher.h" diff --git a/util/errs.c b/util/errs.c new file mode 100644 index 0000000..6083506 --- /dev/null +++ b/util/errs.c @@ -0,0 +1,32 @@ +#include + +char *Err[] = { + NULL, + "ErrAllocFailed", + "ErrNULLPointer", + "ErrUnknow", + "ErrPipe", + "ErrPoll", + "Could not publish name." + "Could not resolve name.", + "Could not resolve name (recursion limit exceeded).", + "expired record", + "unrecognized validity type", + "not a valid proquint string", + "not a valid domain name", + "not a valid dnslink entry", + // ErrBadPath is returned when a given path is incorrectly formatted + "invalid 'ipfs ref' path", + // Paths after a protocol must contain at least one component + "path must contain at least one component", + "TODO: ErrCidDecode", + NULL, + "no link named %s under %s", + "ErrInvalidParam", + // ErrResolveLimit is returned when a recursive resolution goes over + // the limit. + "resolve depth exceeded", + NULL, + "Invalid value. Not signed by PrivateKey corresponding to %s", + "no usable records in given set" +};