mirror of
https://github.com/Netflix/dial-reference.git
synced 2026-06-08 10:59:59 +00:00
Added app manager IPC interface. Updated verions to 2.1
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "url_lib.h"
|
||||
#include "nf_appmanager.h"
|
||||
|
||||
#define NF_APP_MANAGER
|
||||
@@ -104,49 +105,6 @@ void signalHandler(int signal)
|
||||
}
|
||||
}
|
||||
|
||||
/* The URL encoding source code was obtained here:
|
||||
* http://www.geekhideout.com/urlcode.shtml
|
||||
*/
|
||||
|
||||
/* Converts a hex character to its integer value */
|
||||
char from_hex(char ch) {
|
||||
return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
|
||||
}
|
||||
|
||||
/* Converts an integer value to its hex character*/
|
||||
char to_hex(char code) {
|
||||
static char hex[] = "0123456789abcdef";
|
||||
return hex[code & 15];
|
||||
}
|
||||
|
||||
/* Returns a url-encoded version of str */
|
||||
/* IMPORTANT: be sure to free() the returned string after use */
|
||||
char *url_encode(const char *str) {
|
||||
const char *pstr;
|
||||
char *buf, *pbuf;
|
||||
pstr = str;
|
||||
buf = malloc(strlen(str) * 3 + 1);
|
||||
pbuf = buf;
|
||||
if( buf )
|
||||
{
|
||||
while (*pstr) {
|
||||
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
|
||||
*pbuf++ = *pstr;
|
||||
else if (*pstr == ' ')
|
||||
*pbuf++ = '+';
|
||||
else
|
||||
*pbuf++ = '%', *pbuf++ = to_hex(*pstr >> 4), *pbuf++ = to_hex(*pstr & 15);
|
||||
pstr++;
|
||||
}
|
||||
*pbuf = '\0';
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* End of URL ENCODE source
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function will walk /proc and look for the application in
|
||||
* /proc/<PID>/comm. and /proc/<PID>/cmdline to find it's command (executable
|
||||
|
||||
Reference in New Issue
Block a user