char *process_user_json(char *plugin,char *method,char *cmdstr,int32_t broadcastflag,int32_t timeout) { struct daemon_info *find_daemoninfo(int32_t *indp,char *name,uint64_t daemonid,uint64_t instanceid); int32_t tmp,len; char *retstr; len = (int32_t)strlen(cmdstr) + 1; //printf("userjson.(%s).%d plugin.(%s)\n",cmdstr,len,plugin); if ( broadcastflag != 0 || strcmp(plugin,"relay") == 0 ) retstr = nn_loadbalanced((uint8_t *)cmdstr,len); else if ( strcmp(plugin,"peers") == 0 ) retstr = nn_allpeers((uint8_t *)cmdstr,len,timeout,0); else if ( find_daemoninfo(&tmp,plugin,0,0) != 0 ) retstr = plugin_method(0,1,plugin,method,0,0,cmdstr,len,timeout != 0 ? timeout : 0); else retstr = nn_publish((uint8_t *)cmdstr,len,0); return(retstr); }
char *process_user_json(char *plugin,char *method,char *cmdstr,int32_t broadcastflag,int32_t timeout) { struct daemon_info *find_daemoninfo(int32_t *indp,char *name,uint64_t daemonid,uint64_t instanceid); uint32_t nonce; int32_t tmp,len; char *retstr;//,tokenized[8192]; len = (int32_t)strlen(cmdstr) + 1; //printf("userjson.(%s).%d plugin.(%s) broadcastflag.%d method.(%s)\n",cmdstr,len,plugin,broadcastflag,method); if ( broadcastflag != 0 || strcmp(plugin,"relay") == 0 ) { if ( strcmp(method,"busdata") == 0 ) retstr = busdata_sync(&nonce,cmdstr,broadcastflag==0?0:"allnodes",0); else retstr = clonestr("{\"error\":\"direct load balanced calls deprecated, use busdata\"}"); } //else if ( strcmp(plugin,"peers") == 0 ) // retstr = nn_allrelays((uint8_t *)cmdstr,len,timeout,0); else if ( find_daemoninfo(&tmp,plugin,0,0) != 0 ) { //len = construct_tokenized_req(tokenized,cmdstr,SUPERNET.NXTACCTSECRET,broadcastflag!=0?"allnodes":0); //printf("console.(%s)\n",tokenized); retstr = plugin_method(-1,0,1,plugin,method,0,0,cmdstr,len,timeout != 0 ? timeout : 0,0); } else retstr = clonestr("{\"error\":\"invalid command\"}"); return(retstr); }