forked from agorise/c-ipfs
Created errs.c and moved to util directory.
This commit is contained in:
parent
049078effc
commit
7691fe0dc2
7 changed files with 68 additions and 62 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#define DefaultDepthLimit 32
|
||||
|
||||
#include "ipfs/errs.h"
|
||||
#include "ipfs/util/errs.h"
|
||||
|
||||
typedef struct s_resolvers {
|
||||
char *protocol;
|
||||
|
|
|
@ -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);
|
||||
|
|
31
include/ipfs/util/errs.h
Normal file
31
include/ipfs/util/errs.h
Normal file
|
@ -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
|
|
@ -1,6 +1,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "ipfs/errs.h"
|
||||
#include "ipfs/util/errs.h"
|
||||
#include "ipfs/util/time.h"
|
||||
#include "ipfs/namesys/pb.h"
|
||||
#include "ipfs/namesys/publisher.h"
|
||||
|
|
32
util/errs.c
Normal file
32
util/errs.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include <stdio.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",
|
||||
"no usable records in given set"
|
||||
};
|
Loading…
Reference in a new issue