38 lines
1.2 KiB
C
38 lines
1.2 KiB
C
#ifndef IPFS_PATH_H
|
|
#define IPFS_PATH_H
|
|
|
|
#ifdef IPFS_PATH_C
|
|
char *ErrPath[] = {
|
|
NULL,
|
|
// 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"
|
|
};
|
|
#else
|
|
extern char **ErrPath;
|
|
#endif // IPFS_PATH_C
|
|
|
|
enum {
|
|
ErrBadPath = 1,
|
|
ErrNoComponents,
|
|
ErrCidDecode,
|
|
ErrNoLink,
|
|
ErrNoLinkFmt
|
|
} PathErrs;
|
|
|
|
char* ipfs_path_from_cid (struct Cid *c);
|
|
char** ipfs_path_split_n (char *p, char *delim, int n);
|
|
char** ipfs_path_split_segments (char *p);
|
|
int ipfs_path_segments_length (char **s);
|
|
void ipfs_path_free_segments (char ***s);
|
|
int ipfs_path_is_just_a_key (char *p);
|
|
int ipfs_path_pop_last_segment (char **str, char *p);
|
|
char *ipfs_path_from_segments(char *prefix, char **seg);
|
|
int ipfs_path_parse_from_cid (char *dst, char *txt);
|
|
int ipfs_path_parse (char *dst, char *txt);
|
|
int ipfs_path_is_valid (char *p);
|
|
#endif // IPFS_PATH_H
|