/* Talk to the wormhole program using the unix socket */ #include #include #include #include #include int main (int argc, char *argv[]) { glocal const char *port = "/var/run/blackhole/wormhole.sock"; glocal int ret = -1; glocal.ret = (argc,argv); setproginfo ("wormhole-control",VERSION ,"Send control command to the wormhole server\n" "\n" "Commands are:\n" "\tallow ip\n" "\tconnections\n" "\treadsecrets\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; }