1 /*****************************************************************************\
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** Administration tool **
10 \*****************************************************************************/
15 #include <sys/types.h>
19 #include <sys/ioctl.h>
20 #include <sys/socket.h>
29 #define LTEE {addch(ACS_LTEE);addch(ACS_HLINE);addch(ACS_HLINE);}
30 #define LLCORNER {addch(ACS_LLCORNER);addch(ACS_HLINE);addch(ACS_HLINE);}
31 #define VLINE {addch(ACS_VLINE);addstr(" ");}
32 #define EMPTY {addstr(" ");}
33 //char rotator[] = {'-', '\\', '|', '/'};
34 int lastlines, lastcols;
35 int show_interfaces = 2,
48 char *text_interfaces[] = {
55 char *text_calls[] = {
70 char logline[LOGLINES][256];
71 unsigned long logcur = 0;
78 void init_curses(void)
81 initscr(); cbreak(); noecho();
83 nodelay(stdscr, TRUE);
84 if (COLOR_PAIRS>=8 && COLORS>=8)
98 void cleanup_curses(void)
103 void color(int color)
105 if (COLOR_PAIRS>=8 && COLORS>=8)
106 attrset(COLOR_PAIR(color));
110 * permanently show current state using ncurses
112 int debug_port(struct admin_message *msg, struct admin_message *m, int line, int i, int vline)
119 SPRINT(buffer,"%s(%d)", m[i].u.p.name,m[i].u.p.serial);
123 switch (m[i].u.p.state)
125 case ADMIN_STATE_IDLE:
129 case ADMIN_STATE_IN_SETUP:
131 addstr("'in << setup'");
133 case ADMIN_STATE_OUT_SETUP:
135 addstr("'out >> setup'");
137 case ADMIN_STATE_IN_OVERLAP:
139 addstr("'in << overlap'");
141 case ADMIN_STATE_OUT_OVERLAP:
143 addstr("'out >> overlap'");
145 case ADMIN_STATE_IN_PROCEEDING:
147 addstr("'in << proc'");
149 case ADMIN_STATE_OUT_PROCEEDING:
151 addstr("'out >> proc'");
153 case ADMIN_STATE_IN_ALERTING:
155 addstr("'in << alert'");
157 case ADMIN_STATE_OUT_ALERTING:
159 addstr("'out >> alert'");
161 case ADMIN_STATE_CONNECT:
165 case ADMIN_STATE_IN_DISCONNECT:
167 addstr("'in << disc'");
169 case ADMIN_STATE_OUT_DISCONNECT:
171 addstr("'out >> disc'");
175 addstr("'--NONE--'");
181 addstr(" bchannel=");
183 SPRINT(buffer,"%d", m[i].u.p.isdn_chan);
185 if (m[i].u.p.isdn_ces >= 0)
190 SPRINT(buffer, "%d", m[i].u.p.isdn_ces);
193 if (m[i].u.p.isdn_hold)
202 int debug_epoint(struct admin_message *msg, struct admin_message *m, int line, int i, int vline)
204 unsigned long epoint = m[i].u.e.serial;
211 SPRINT(buffer,"EPOINT(%d)", epoint);
215 switch (m[i].u.e.state)
217 case ADMIN_STATE_IDLE:
221 case ADMIN_STATE_IN_SETUP:
223 addstr("'in << setup'");
225 case ADMIN_STATE_OUT_SETUP:
227 addstr("'out >> setup'");
229 case ADMIN_STATE_IN_OVERLAP:
231 addstr("'in << overlap'");
233 case ADMIN_STATE_OUT_OVERLAP:
235 addstr("'out >> overlap'");
237 case ADMIN_STATE_IN_PROCEEDING:
239 addstr("'in << proc'");
241 case ADMIN_STATE_OUT_PROCEEDING:
243 addstr("'out >> proc'");
245 case ADMIN_STATE_IN_ALERTING:
247 addstr("'in << alert'");
249 case ADMIN_STATE_OUT_ALERTING:
251 addstr("'out >> alert'");
253 case ADMIN_STATE_CONNECT:
257 case ADMIN_STATE_IN_DISCONNECT:
259 addstr("'in << disc'");
261 case ADMIN_STATE_OUT_DISCONNECT:
263 addstr("'out >> disc'");
267 addstr("'--NONE--'");
269 if (m[i].u.e.terminal[0])
272 addstr(" terminal=");
274 addstr(m[i].u.e.terminal);
277 SPRINT(buffer, " %s", m[i].u.e.callerid);
282 addstr(m[i].u.e.dialing);
283 if (m[i].u.e.action[0])
288 addstr(m[i].u.e.action);
293 addstr(" park="); /* 9 digits */
295 UCPY(buffer, "\""); /* 9 digits */
297 jj = m[i].u.e.park_len;
300 c = m[i].u.e.park_callid[j];
301 if (c >= 32 && c < 127 && c != '[')
305 UPRINT(buffer+strlen(buffer), "[%02x]", c);
313 switch(m[i].u.e.rx_state)
315 case NOTIFY_STATE_SUSPEND:
316 addstr(" in=suspend");
318 case NOTIFY_STATE_HOLD:
321 case NOTIFY_STATE_CONFERENCE:
322 addstr(" in=conference");
325 switch(m[i].u.e.tx_state)
327 case NOTIFY_STATE_SUSPEND:
328 addstr(" out=suspend");
330 case NOTIFY_STATE_HOLD:
333 case NOTIFY_STATE_CONFERENCE:
334 addstr(" out=conference");
342 if (m[i].u.e.crypt) /* crypt on */
352 /* loop all related ports */
354 j = msg->u.s.interfaces+msg->u.s.calls+msg->u.s.epoints;
355 jj = j + msg->u.s.ports;
358 if (m[j].u.p.epoint == epoint)
361 move(++line>1?line:1, 1);
366 move(line>1?line:1, 5);
369 move(line>1?line:1, 8);
370 if (line+2 >= LINES) break;
371 line = debug_port(msg, m, line, j, vline);
372 if (line+2 >= LINES) break;
379 move(ltee>1?line:1, 5);
385 int debug_call(struct admin_message *msg, struct admin_message *m, int line, int i)
387 unsigned long call = m[i].u.c.serial;
392 SPRINT(buffer,"CALL(%d)", call);
394 if (m[i].u.c.partyline)
397 addstr(" partyline=");
399 SPRINT(buffer, "%d\n", m[i].u.c.partyline);
402 /* find number of epoints */
403 j = msg->u.s.interfaces+msg->u.s.calls;
404 jj = j + msg->u.s.epoints;
408 if (m[j].u.e.call == call)
412 /* loop all related endpoints */
413 j = msg->u.s.interfaces+msg->u.s.calls;
414 jj = j + msg->u.s.epoints;
417 if (m[j].u.e.call == call)
420 move(++line>1?line:1, 1);
426 move(line>1?line:1, 4);
427 if (line+2 >= LINES) break;
428 line = debug_epoint(msg, m, line, j, i?1:0);
429 if (line+2 >= LINES) break;
436 char *admin_state(int sock)
438 struct admin_message msg,
442 int line, offset = 0;
451 /* flush logfile name */
458 /* send reload command */
459 memset(&msg, 0, sizeof(msg));
460 msg.message = ADMIN_REQUEST_STATE;
461 // printf("sizeof=%d\n",sizeof(msg));
462 if (write(sock, &msg, sizeof(msg)) != sizeof(msg))
465 return("Broken pipe while sending command.");
468 /* receive response */
469 if (read(sock, &msg, sizeof(msg)) != sizeof(msg))
472 return("Broken pipe while receiving response.");
474 if (msg.message != ADMIN_RESPONSE_STATE)
477 return("Response not valid. Expecting state response.");
479 num = msg.u.s.interfaces + msg.u.s.calls + msg.u.s.epoints + msg.u.s.ports;
480 if (!(m = (struct admin_message *)malloc(num*sizeof(struct admin_message))))
483 return("Not enough memory for messages.");
487 if ((len = read(sock, ((unsigned char *)(m))+off,
488 num*sizeof(struct admin_message)-off)) != num*sizeof(struct admin_message)-off)
492 // fprintf(stderr, "got=%d expected=%d\n", i, num*sizeof(struct admin_message));
494 return("Broken pipe while receiving state infos.");
496 if (len < num*sizeof(struct admin_message))
504 // fprintf("getting =%d interfaces\n", msg.u.s.interfaces);
505 while(i < msg.u.s.interfaces)
507 // fprintf(stderr, "j=%d message=%d\n", j, m[j].message);
508 if (m[j].message != ADMIN_RESPONSE_S_INTERFACE)
512 return("Response not valid. Expecting interface information.");
518 while(i < msg.u.s.calls)
520 if (m[j].message != ADMIN_RESPONSE_S_CALL)
524 return("Response not valid. Expecting call information.");
530 while(i < msg.u.s.epoints)
532 if (m[j].message != ADMIN_RESPONSE_S_EPOINT)
536 return("Response not valid. Expecting endpoint information.");
542 while(i < msg.u.s.ports)
544 if (m[j].message != ADMIN_RESPONSE_S_PORT)
548 return("Response not valid. Expecting port information.");
553 // now j is the number of message blocks
561 if (!!strcmp(logfile, msg.u.s.logfile))
563 SCPY(logfile, msg.u.s.logfile);
571 logline[i][1] = '\0';
575 logfh = open(logfile, O_RDONLY|O_NONBLOCK);
578 /* seek at the end -8000 chars */
579 lseek(logfh, -8000, SEEK_END);
580 /* if not at the beginning, read until endofline */
581 logline[logcur % LOGLINES][0] = '\0';
582 l = read(logfh, logline[logcur % LOGLINES], sizeof(logline[logcur % LOGLINES])-1);
585 /* read first line and skip junk */
586 logline[logcur % LOGLINES][l] = '\0';
587 if ((p = strchr(logline[logcur % LOGLINES],'\n')))
590 SCPY(logline[logcur % LOGLINES], p+1);
591 SCPY(logline[(logcur-1) % LOGLINES], "...");
603 ll = strlen(logline[logcur % LOGLINES]);
604 l = read(logfh, logline[logcur % LOGLINES]+ll, sizeof(logline[logcur % LOGLINES])-ll-1);
607 logline[logcur % LOGLINES][ll+l] = '\0';
609 /* put data to lines */
610 while ((p = strchr(logline[logcur % LOGLINES],'\n')))
614 SCPY(logline[logcur % LOGLINES], p+1);
616 /* if line is full without return, go next line */
617 if (strlen(logline[logcur % LOGLINES]) == sizeof(logline[logcur % LOGLINES])-1)
620 logline[logcur % LOGLINES][0] = '\0';
625 /* display interfaces */
626 if (show_interfaces > 0)
630 ii = i + msg.u.s.interfaces;
633 /* show interface summary */
634 move(++line>1?line:1, 0);
637 SPRINT(buffer, "%s(%d) '%s' %s use:%d ", (m[i].u.i.ntmode)?"NT":"TE", m[i].u.i.portnum, m[i].u.i.interface_name, (m[i].u.i.ptp)?"ptp ":"ptmp", m[i].u.i.use);
639 if (m[i].u.i.ptp || !m[i].u.i.ntmode)
641 color((m[i].u.i.l2link)?green:red);
642 addstr((m[i].u.i.l2link)?" L2 UP":" L2 down");
644 color((m[i].u.i.l1link)?green:blue);
645 addstr((m[i].u.i.l1link)?" L1 ACTIVE":" L1 inactive");
646 if (line+2 >= LINES) goto end;
648 if (show_interfaces > 1)
652 jj = m[i].u.i.channels;
655 /* show all channels */
656 if (show_interfaces>2 || m[i].u.i.busy[j]>0)
659 /* show left side / right side */
660 if ((k & 1) && (COLS > 70))
662 move(line>1?line:1,4+((COLS-4)/2));
665 move(++line>1?line:1, 1);
672 SPRINT(buffer,"S%2d: ", j+1+(j>=15));
674 SPRINT(buffer,"B%2d: ", j+1);
681 color((m[i].u.i.busy[j])?yellow:blue);
682 addstr((m[i].u.i.busy[j])?"busy":"idle");
688 if (m[i].u.i.port[j])
690 /* search for port */
691 l = msg.u.s.interfaces+msg.u.s.calls+msg.u.s.epoints;
692 ll = l+msg.u.s.ports;
695 if (m[l].u.p.serial == m[i].u.i.port[j])
697 SPRINT(buffer, " %s(%ld)", m[l].u.p.name, m[l].u.p.serial);
708 move(line>1?line:1, 1);
719 move(line>1?line:1, 1);
722 if (line+2 >= LINES) goto end;
723 /* show summary if no channels were shown */
724 if (show_interfaces<2 && ltee==0)
727 move(++line>1?line:1, 1);
733 SPRINT(buffer,"all %d channels free", m[i].u.i.channels);
737 SPRINT(buffer,"all %d channels blocked", m[i].u.i.channels);
741 if (line+2 >= LINES) goto end;
748 if (line+2 >= LINES) goto end;
750 /* display calls (brief) */
754 i = msg.u.s.interfaces+msg.u.s.calls;
755 ii = i+msg.u.s.epoints;
758 /* for each endpoint... */
761 move(++line>1?line:1, 0);
763 SPRINT(buffer, "(%d): ", m[i].u.e.serial);
766 if (m[i].u.e.terminal[0])
770 addstr(m[i].u.e.terminal);
774 SPRINT(buffer, " %s", m[i].u.e.callerid);
779 SPRINT(buffer, "%s", m[i].u.e.dialing);
781 if (m[i].u.e.action[0])
786 addstr(m[i].u.e.action);
788 if (line+2 >= LINES) goto end;
793 j = msg.u.s.interfaces;
794 jj = j+msg.u.s.calls;
797 /* for each call... */
798 move(++line>1?line:1, 0);
800 SPRINT(buffer, "(%d):", m[j].u.c.serial);
802 i = msg.u.s.interfaces+msg.u.s.calls;
803 ii = i+msg.u.s.epoints;
806 /* for each endpoint... */
807 if (m[i].u.e.call == m[j].u.c.serial)
810 SPRINT(buffer, " (%d)", m[i].u.e.serial);
813 if (m[i].u.e.terminal[0])
817 addstr(m[i].u.e.terminal);
821 SPRINT(buffer, "-%s", m[i].u.e.callerid);
826 SPRINT(buffer, "%s", m[i].u.e.dialing);
832 if (line+2 >= LINES) goto end;
837 if (line+2 >= LINES) goto end;
839 /* display calls (structurd) */
842 /* show all ports with no epoint */
844 i = msg.u.s.interfaces+msg.u.s.calls+msg.u.s.epoints;
845 ii = i+msg.u.s.ports;
848 if (!m[i].u.p.epoint)
850 move(++line>1?line:1, 8);
851 if (line+2 >= LINES) goto end;
852 line = debug_port(&msg, m, line, i, 0);
853 if (line+2 >= LINES) goto end;
860 if (line+2 >= LINES) goto end;
862 /* show all epoints with no call */
864 i = msg.u.s.interfaces+msg.u.s.calls;
865 ii = i+msg.u.s.epoints;
870 move(++line>1?line:1, 4);
871 if (line+2 >= LINES) goto end;
872 line = debug_epoint(&msg, m, line, i, 0);
873 if (line+2 >= LINES) goto end;
880 if (line+2 >= LINES) goto end;
884 i = msg.u.s.interfaces;
885 ii = i+msg.u.s.calls;
888 move(++line>1?line:1, 0);
889 if (line+2 >= LINES) goto end;
890 line = debug_call(&msg, m, line, i);
891 if (line+2 >= LINES) goto end;
897 if (line+2 >= LINES) goto end;
906 move(line++>1?line-1:1, 0);
908 hline(ACS_HLINE, COLS);
911 l = logcur-(LINES-line-2);
913 if (ll-l >= LOGLINES)
917 move(line++>1?line-1:1, 0);
918 SCPY(buffer, logline[l % LOGLINES]);
919 if (COLS < (int)sizeof(buffer))
930 /* display name/time */
935 msg.u.s.version_string[sizeof(msg.u.s.version_string)-1] = '\0';
936 SPRINT(buffer, "PBX4Linux %s", msg.u.s.version_string);
941 SPRINT(buffer, "%04d-%02d-%02d %02d:%02d:%02d",
942 msg.u.s.tm.tm_year+1900, msg.u.s.tm.tm_mon+1, msg.u.s.tm.tm_mday,
943 msg.u.s.tm.tm_hour, msg.u.s.tm.tm_min, msg.u.s.tm.tm_sec);
946 /* displeay head line */
949 hline(ACS_HLINE, COLS);
953 SPRINT(buffer, "Offset +%d", offset);
960 hline(ACS_HLINE, COLS);
963 SPRINT(buffer, "i = interfaces '%s' c = calls '%s' l = log q = quit +/- = scroll", text_interfaces[show_interfaces], text_calls[show_calls]);
968 if (lastlines!=LINES || lastcols!=COLS)
978 case 12: /* refresh */
989 case 'i': /* toggle interface */
991 if (show_interfaces > 3) show_interfaces = 0;
994 case 'c': /* toggle calls */
996 if (show_calls > 2) show_calls = 0;
999 case 'l': /* toggle log */
1001 if (show_log > 1) show_log = 0;
1004 case '+': /* scroll down */
1008 case '-': /* scroll up */
1018 /* check for logfh */
1023 /* cleanup curses and exit */
1031 * Send command and show error message.
1033 char *admin_cmd(int sock, int mode, char *extension, char *number)
1035 static struct admin_message msg;
1037 /* send reload command */
1038 memset(&msg, 0, sizeof(msg));
1041 case MODE_INTERFACE:
1042 msg.message = ADMIN_REQUEST_CMD_INTERFACE;
1045 msg.message = ADMIN_REQUEST_CMD_ROUTE;
1048 msg.message = ADMIN_REQUEST_CMD_DIAL;
1049 SPRINT(msg.u.x.message, "%s:%s", extension?:"", number?:"");
1052 msg.message = ADMIN_REQUEST_CMD_RELEASE;
1053 SCPY(msg.u.x.message, number);
1057 if (write(sock, &msg, sizeof(msg)) != sizeof(msg))
1058 return("Broken pipe while sending command.");
1060 /* receive response */
1061 if (read(sock, &msg, sizeof(msg)) != sizeof(msg))
1062 return("Broken pipe while receiving response.");
1065 case MODE_INTERFACE:
1066 if (msg.message != ADMIN_RESPONSE_CMD_INTERFACE)
1067 return("Response not valid.");
1070 if (msg.message != ADMIN_RESPONSE_CMD_ROUTE)
1071 return("Response not valid.");
1074 if (msg.message != ADMIN_RESPONSE_CMD_DIAL)
1075 return("Response not valid.");
1078 if (msg.message != ADMIN_RESPONSE_CMD_RELEASE)
1079 return("Response not valid.");
1083 /* process response */
1086 return(msg.u.x.message);
1088 printf("Command successfull.\n");
1096 char *admin_testcall(int sock, int argc, char *argv[])
1098 static struct admin_message msg;
1100 printf("pid=%d\n", getpid()); fflush(stdout);
1102 /* send reload command */
1103 memset(&msg, 0, sizeof(msg));
1104 msg.message = ADMIN_CALL_SETUP;
1107 SCPY(msg.u.call.interface, argv[2]);
1111 SCPY(msg.u.call.callerid, argv[3]);
1115 SCPY(msg.u.call.dialing, argv[4]);
1119 if (argv[5][0] == 'p')
1120 msg.u.call.present = 1;
1122 msg.u.call.bc_capa = 0x00; /*INFO_BC_SPEECH*/
1123 msg.u.call.bc_mode = 0x00; /*INFO_BMODE_CIRCUIT*/
1124 msg.u.call.bc_info1 = 0;
1126 msg.u.call.exthlc = 0;
1128 msg.u.call.bc_capa = strtol(argv[6],NULL,0);
1130 msg.u.call.bc_info1 = 3 | 0x80; /* alaw, if no capability is given at all */
1132 msg.u.call.bc_mode = strtol(argv[7],NULL,0);
1133 if (msg.u.call.bc_mode) msg.u.call.bc_mode = 2;
1136 msg.u.call.bc_info1 = strtol(argv[8],NULL,0);
1137 if (msg.u.call.bc_info1 < 0)
1138 msg.u.call.bc_info1 = 0;
1140 msg.u.call.bc_info1 |= 0x80;
1143 msg.u.call.hlc = strtol(argv[9],NULL,0);
1144 if (msg.u.call.hlc < 0)
1147 msg.u.call.hlc |= 0x80;
1149 // printf("hlc=%d\n", msg.u.call.hlc);
1151 msg.u.call.exthlc = strtol(argv[10],NULL,0);
1152 if (msg.u.call.exthlc < 0)
1153 msg.u.call.exthlc = 0;
1155 msg.u.call.exthlc |= 0x80;
1158 if (write(sock, &msg, sizeof(msg)) != sizeof(msg))
1159 return("Broken pipe while sending command.");
1161 /* receive response */
1163 if (read(sock, &msg, sizeof(msg)) != sizeof(msg))
1164 return("Broken pipe while receiving response.");
1167 case ADMIN_CALL_SETUP_ACK:
1168 printf("SETUP ACKNOWLEDGE\n"); fflush(stdout);
1171 case ADMIN_CALL_PROCEEDING:
1172 printf("PROCEEDING\n"); fflush(stdout);
1175 case ADMIN_CALL_ALERTING:
1176 printf("ALERTING\n"); fflush(stdout);
1179 case ADMIN_CALL_CONNECT:
1180 printf("CONNECT\n number=%s\n", msg.u.call.callerid); fflush(stdout);
1183 case ADMIN_CALL_NOTIFY:
1184 printf("NOTIFY\n notify=%d\n number=%s\n", msg.u.call.notify, msg.u.call.callerid); fflush(stdout);
1187 case ADMIN_CALL_DISCONNECT:
1188 printf("DISCONNECT\n cause=%d %s\n location=%d %s\n", msg.u.call.cause, (msg.u.call.cause>0 && msg.u.call.cause<128)?isdn_cause[msg.u.call.cause].german:"", msg.u.call.location, (msg.u.call.location>=0 && msg.u.call.location<128)?isdn_location[msg.u.call.location].german:""); fflush(stdout);
1191 case ADMIN_CALL_RELEASE:
1192 printf("RELEASE\n cause=%d %s\n location=%d %s\n", msg.u.call.cause, (msg.u.call.cause>0 && msg.u.call.cause<128)?isdn_cause[msg.u.call.cause].german:"", msg.u.call.location, (msg.u.call.location>=0 && msg.u.call.location<128)?isdn_location[msg.u.call.location].german:""); fflush(stdout);
1196 return("Response not valid.");
1199 printf("Command successfull.\n");
1207 int main(int argc, char *argv[])
1210 char *socket_name = SOCKET_NAME;
1212 struct sockaddr_un sock_address;
1221 printf("Usage: %s state | interface | route | dial ...\n", argv[0]);
1222 printf("state - View current states using graphical console output.\n");
1223 printf("interface - Tell PBX to reload \"interface.conf\".\n");
1224 printf("route - Tell PBX to reload \"route.conf\".\n");
1225 printf("dial <extension> <number> - Tell PBX the next number to dial for extension.\n");
1226 printf("release <number> - Tell PBX to release endpoint with given number.\n");
1227 printf("testcall <interface> <callerid> <number> [present|restrict [<capability>]] - Testcall\n");
1228 printf(" -> capability = <bc> <mode> <codec> <hlc> <exthlc> (Values must be numbers, -1 to omit.)\n");
1234 if (!(strcasecmp(argv[1],"state")))
1238 if (!(strcasecmp(argv[1],"interface")))
1240 mode = MODE_INTERFACE;
1242 if (!(strcasecmp(argv[1],"route")))
1246 if (!(strcasecmp(argv[1],"dial")))
1252 if (!(strcasecmp(argv[1],"release")))
1256 mode = MODE_RELEASE;
1258 if (!(strcasecmp(argv[1],"testcall")))
1262 mode = MODE_TESTCALL;
1270 if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
1272 fprintf(stderr, "Failed to create socket.\n");
1275 memset(&sock_address, 0, sizeof(sock_address));
1276 sock_address.sun_family = PF_UNIX;
1277 UCPY(sock_address.sun_path, socket_name);
1278 if ((conn = connect(sock, (struct sockaddr *)&sock_address, SUN_LEN(&sock_address))) < 0)
1281 fprintf(stderr, "Failed to connect to socket \"%s\".\nIs PBX4Linux running?\n", sock_address.sun_path);
1289 ret = admin_state(sock);
1292 case MODE_INTERFACE:
1294 ret = admin_cmd(sock, mode, NULL, NULL);
1298 ret = admin_cmd(sock, mode, argv[2], argv[3]);
1302 ret = admin_cmd(sock, mode, NULL, argv[2]);
1306 ret = admin_testcall(sock, argc, argv);
1310 /* now we say good bye */
1313 // if (!strncasecmp(ret, "Broken Pipe", 11))
1315 printf("%s\n", ret);