/* This file is part of Bolixo. Bolixo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Bolixo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Bolixo. If not, see . */ #include #include #include #include #include "trlitool.h" #include "../bolixo.h" #include "../instrument.h" #define bolixod_client_getnode_NOTNEED #include "../proto/bolixod_client.protoch" #include "../proto/bolixoapi.protoh" #include #include #include string util_readsecret(); extern "C" void tlmp_initmod() { translat_load ("bolixo"); } static void webmain_real() { glocal CONNECT_INFO con; glocal.con.port = "/dev/bolixod.sock"; glocal.con.secret = util_readsecret(); bool endserver,endclient; REQUEST_JSON_INFO req; const char *json = tlmpweb_getpost(); tlmpweb_flushheader(); (NULL, req, json, strlen(json), endserver, endclient); (glocal.con); tlmp_error ("msg=%s sessiond=%d db=%d\n",msg,sessiond,db); glocal.bolixoapi.rep_test(msg,sessiond,db); // nodename = success:b msg (glocal.con,nodename); glocal.bolixoapi.rep_registernode(success,msg); // session = success:b msg (glocal.con,session); glocal.bolixoapi.rep_nodelogout(success,msg); // nodename = success:b msg session (glocal.con,nodename); glocal.bolixoapi.rep_nodelogin(success,msg,session); // session sign = success:b msg (glocal.con,session,sign); glocal.bolixoapi.rep_nodepass(success,msg); // session info:U{USERINFO} = success:b msg (glocal.con,session,info); glocal.bolixoapi.rep_publish(success,msg); // session info:U{USERINFO_V2} = success:b msg (glocal.con,session,info); glocal.bolixoapi.rep_publish_v2(success,msg); // session user name content:o more:b append:b (glocal.con,session,user,name,content,more,append); glocal.bolixoapi.rep_publish_file(success,msg); // session user = success:b msg (glocal.con,session,user); glocal.bolixoapi.rep_remove(success,msg); // session userid email = success:b msg (glocal.con,session,userid,email); glocal.bolixoapi.rep_recordemail(success,msg); // filter:U{FILTER} offset:u nb:u = success:b msg users:U{USERPUBINFO_V2}v (glocal.con,filter,offset,nb); vector tb; for (auto &u:users) tb.push_back(u); glocal.bolixoapi.rep_pub_search(success,msg,tb); // node user file offset:u = success:b msg modified content:o more:b size:u (glocal.con,node,user,file,offset); glocal.bolixoapi.rep_readfile(success,msg,modified,content,more,size); htmlprintf ("Invalid request\n"); } extern "C" void webmain() { ("unix:","/tmp/stop.sock",1); webmain_real(); end=true; webmain_real(); }