Wire up RPC plugin loading to Node.
This commit is contained in:
parent
af8fcac0fc
commit
57d8730f1b
6 changed files with 102 additions and 3 deletions
|
@ -29,14 +29,13 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include "Utils.hpp"
|
||||
#include "Mutex.hpp"
|
||||
|
||||
#if defined(__APPLE__) || defined(__linux__) || defined(linux) || defined(__LINUX__) || defined(__linux)
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -46,6 +45,9 @@
|
|||
#include <sys/stat.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include "Utils.hpp"
|
||||
#include "Mutex.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
const char Utils::HEXCHARS[16] = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' };
|
||||
|
@ -214,6 +216,29 @@ const char Utils::base64DecMap[128] = {
|
|||
static const char *DAY_NAMES[7] = { "Sun","Mon","Tue","Wed","Thu","Fri","Sat" };
|
||||
static const char *MONTH_NAMES[12] = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };
|
||||
|
||||
std::map<std::string,bool> Utils::listDirectory(const char *path)
|
||||
{
|
||||
struct dirent de;
|
||||
struct dirent *dptr;
|
||||
std::map<std::string,bool> r;
|
||||
|
||||
DIR *d = opendir(path);
|
||||
if (!d)
|
||||
return r;
|
||||
|
||||
dptr = (struct dirent *)0;
|
||||
for(;;) {
|
||||
if (readdir_r(d,&de,&dptr))
|
||||
break;
|
||||
if (dptr) {
|
||||
if ((!strcmp(dptr->d_name,"."))&&(!strcmp(dptr->d_name,"..")))
|
||||
r[std::string(dptr->d_name)] = (dptr->d_type == DT_DIR);
|
||||
} else break;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
std::string Utils::base64Encode(const void *data,unsigned int len)
|
||||
{
|
||||
if (!len)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue