Initial implementation of namesys/proquint

This commit is contained in:
Jose Marcial Vieira Bisneto 2016-11-24 09:50:05 -03:00
parent 05c45666e5
commit ef2f112f6a
2 changed files with 20 additions and 0 deletions

View file

@ -56,4 +56,6 @@
int resolveOnce (char **path, char *name); int resolveOnce (char **path, char *name);
int Publish (char *proto, ciPrivKey name, char *value); int Publish (char *proto, ciPrivKey name, char *value);
int PublishWithEOL (char *proto, ciPrivKey name, char *value, time_t eol); int PublishWithEOL (char *proto, ciPrivKey name, char *value, time_t eol);
int ProquintResolveOnce (char **p, char *name);
#endif //NAMESYS_H #endif //NAMESYS_H

18
namesys/proquint.c Normal file
View file

@ -0,0 +1,18 @@
#include <stdlib.h>
#include "ipfs/namesys/namesys.h"
#include "ipfs/cid/cid.h"
#include "ipfs/path/path.h"
// resolveOnce implements resolver. Decodes the proquint string.
int ProquintResolveOnce (char **p, char *name)
{
int err = proquintIsProquint(name);
if (err) {
*p = NULL;
err = ErrInvalidProquint;
} else {
err = pathFromString(p, proquintDecode(name));
}
return err;
}