0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #include <string.h>
0035 #include <stdio.h>
0036 #include <stdlib.h>
0037 #include <memory.h>
0038 #include <sys/param.h>
0039
0040 #include <ndrstandard.h>
0041 #include <ndebug.h>
0042 #include <nstdutil.h>
0043
0044 #include <ndrx.h>
0045 #include <ndrxdcmn.h>
0046 #include <atmi_int.h>
0047 #include <gencall.h>
0048 #include <nclopt.h>
0049
0050
0051
0052
0053
0054
0055
0056
0057 exprivate short M_svconly;
0058
0059
0060
0061
0062
0063 exprivate void print_hdr(void)
0064 {
0065 if (M_svconly)
0066 {
0067 fprintf(stderr, "Nd Service Name Prog SRVID #SUCC #FAIL MAX LAST STAT\n");
0068 fprintf(stderr, "-- ------------------------------ ---- ----- ----- ----- -------- -------- -----\n");
0069 }
0070 else
0071 {
0072 fprintf(stderr, "Nd Service Name Routine Name Prog Name SRVID #SUCC #FAIL MAX LAST STAT\n");
0073 fprintf(stderr, "-- ------------ ------------ --------- ----- ----- ----- -------- -------- -----\n");
0074 }
0075 }
0076
0077
0078
0079
0080
0081
0082
0083 expublic int psc_rsp_process(command_reply_t *reply, size_t reply_len)
0084 {
0085 int i;
0086 char binary[9+1];
0087 char svc[12+1];
0088 char fun[12+1];
0089
0090 if (NDRXD_CALL_TYPE_SVCINFO==reply->msg_type)
0091 {
0092 command_reply_psc_t * psc_info = (command_reply_psc_t*)reply;
0093 FIX_SVC_NM(psc_info->binary_name, binary, (sizeof(binary)-1));
0094 for (i=0; i<psc_info->svc_count; i++)
0095 {
0096 if (M_svconly)
0097 {
0098
0099
0100 fprintf(stdout, "%2d %-30.30s %-4.4s %5d %5.5s %5.5s %8.8s %8.8s %-5.5s\n",
0101 psc_info->nodeid,
0102 psc_info->svcdet[i].svc_nm, binary, psc_info->srvid,
0103 ndrx_decode_num(psc_info->svcdet[i].done, 0, 0, 1),
0104 ndrx_decode_num(psc_info->svcdet[i].fail, 1, 0, 1),
0105
0106 ndrx_decode_msec(psc_info->svcdet[i].max, 0, 0, 2),
0107 ndrx_decode_msec(psc_info->svcdet[i].last, 1, 0, 2),
0108 (psc_info->svcdet[i].status?"BUSY":"AVAIL"));
0109 }
0110 else
0111 {
0112 FIX_SVC_NM(psc_info->svcdet[i].svc_nm, svc, (sizeof(svc)-1));
0113 FIX_SVC_NM(psc_info->svcdet[i].fn_nm, fun, (sizeof(fun)-1));
0114
0115 fprintf(stdout, "%2d %-12.12s %-12.12s %-9.9s %5d %5.5s %5.5s %8.8s %8.8s %-5.5s\n",
0116 psc_info->nodeid,
0117 svc, fun, binary, psc_info->srvid,
0118 ndrx_decode_num(psc_info->svcdet[i].done, 0, 0, 1),
0119 ndrx_decode_num(psc_info->svcdet[i].fail, 1, 0, 1),
0120
0121 ndrx_decode_msec(psc_info->svcdet[i].max, 0, 0, 2),
0122 ndrx_decode_msec(psc_info->svcdet[i].last, 1, 0, 2),
0123 (psc_info->svcdet[i].status?"BUSY":"AVAIL"));
0124 }
0125 }
0126 }
0127
0128 return EXSUCCEED;
0129 }
0130
0131
0132
0133
0134
0135
0136
0137
0138 expublic int cmd_psc(cmd_mapping_t *p_cmd_map, int argc, char **argv, int *p_have_next)
0139 {
0140 command_call_t call;
0141
0142 int ret = EXSUCCEED;
0143
0144 ncloptmap_t clopt[] =
0145 {
0146 {'s', BFLD_INT, (void *)&M_svconly, sizeof(M_svconly),
0147 NCLOPT_OPT, "Print services only"},
0148 {0}
0149 };
0150
0151 M_svconly = EXFALSE;
0152
0153
0154 if (nstd_parse_clopt(clopt, EXTRUE, argc, argv, EXFALSE))
0155 {
0156 fprintf(stderr, XADMIN_INVALID_OPTIONS_MSG);
0157 EXFAIL_OUT(ret);
0158 }
0159
0160 memset(&call, 0, sizeof(call));
0161
0162
0163 print_hdr();
0164
0165 return cmd_generic_listcall(p_cmd_map->ndrxd_cmd, NDRXD_SRC_ADMIN,
0166 NDRXD_CALL_TYPE_GENERIC,
0167 &call, sizeof(call),
0168 G_config.reply_queue_str,
0169 G_config.reply_queue,
0170 G_config.ndrxd_q,
0171 G_config.ndrxd_q_str,
0172 argc, argv,
0173 p_have_next,
0174 G_call_args,
0175 EXFALSE,
0176 G_config.listcall_flags);
0177
0178 out:
0179 return ret;
0180 }
0181
0182