/* Talk to the conproxy program using the unix socket */ #include #include #include #include #include int main (int argc, char *argv[]) { glocal const char *port = "/var/run/blackhole/conproxy.sock"; glocal int ret = -1; glocal.ret = (argc,argv); setproginfo ("conproxy-control",VERSION ,"Send control commands to the conproxy server\n" "\n" "Commands are:\n" "\tconnections\n" "\tflushlog\n" "\tkill id\n" "\tkillold hours\n" "\tlog-off [ some string ...] \n" "\tlog-on logfilename some string ...\n" "\tquit\n" "\tquitlast unixsocket\n" "\treopenstatfile filename\n" "\tresetmaxconnect\n" "\tstamplog\n" "\tstatus\n"); setarg ('p',"port","Unix domain control port",glocal.port,false); glocal SSTRING cmd; for (int i=0; i0) glocal.cmd.append (' '); glocal.cmd.append (argv[i]); } int ret = -1; ret = ("unix:",glocal.port,5); sendf ("%s\n",glocal.cmd.c_str()); if (strcmp(line,"Ok")==0){ end = true; }else{ printf ("%s\n",line); } return ret; return glocal.ret; }