ntpdc_ops.c (82498) | ntpdc_ops.c (106163) |
---|---|
1/* 2 * ntpdc_ops.c - subroutines which are called to perform operations by ntpdc 3 */ 4 5#ifdef HAVE_CONFIG_H 6# include <config.h> 7#endif 8 --- 772 unchanged lines hidden (view full) --- 781 ufptoa(NTOHS_FP(is->rootdispersion), 5)); 782 (void) fprintf(fp, "reference ID: [%s]\n", 783 refid_string(is->refid, is->stratum)); 784 NTOHL_FP(&is->reftime, &tempts); 785 (void) fprintf(fp, "reference time: %s\n", prettydate(&tempts)); 786 787 (void) fprintf(fp, "system flags: "); 788 if ((is->flags & (INFO_FLAG_BCLIENT | INFO_FLAG_AUTHENABLE | | 1/* 2 * ntpdc_ops.c - subroutines which are called to perform operations by ntpdc 3 */ 4 5#ifdef HAVE_CONFIG_H 6# include <config.h> 7#endif 8 --- 772 unchanged lines hidden (view full) --- 781 ufptoa(NTOHS_FP(is->rootdispersion), 5)); 782 (void) fprintf(fp, "reference ID: [%s]\n", 783 refid_string(is->refid, is->stratum)); 784 NTOHL_FP(&is->reftime, &tempts); 785 (void) fprintf(fp, "reference time: %s\n", prettydate(&tempts)); 786 787 (void) fprintf(fp, "system flags: "); 788 if ((is->flags & (INFO_FLAG_BCLIENT | INFO_FLAG_AUTHENABLE | |
789 INFO_FLAG_NTP | INFO_FLAG_KERNEL| INFO_FLAG_PLL_SYNC | | 789 INFO_FLAG_NTP | INFO_FLAG_KERNEL| INFO_FLAG_CAL | |
790 INFO_FLAG_PPS_SYNC | INFO_FLAG_MONITOR | INFO_FLAG_FILEGEN)) == 0) { 791 (void) fprintf(fp, "none\n"); 792 } else { 793 if (is->flags & INFO_FLAG_BCLIENT) 794 (void) fprintf(fp, "bclient "); 795 if (is->flags & INFO_FLAG_AUTHENTICATE) 796 (void) fprintf(fp, "auth "); 797 if (is->flags & INFO_FLAG_MONITOR) 798 (void) fprintf(fp, "monitor "); 799 if (is->flags & INFO_FLAG_NTP) 800 (void) fprintf(fp, "ntp "); 801 if (is->flags & INFO_FLAG_KERNEL) 802 (void) fprintf(fp, "kernel "); 803 if (is->flags & INFO_FLAG_FILEGEN) 804 (void) fprintf(fp, "stats "); | 790 INFO_FLAG_PPS_SYNC | INFO_FLAG_MONITOR | INFO_FLAG_FILEGEN)) == 0) { 791 (void) fprintf(fp, "none\n"); 792 } else { 793 if (is->flags & INFO_FLAG_BCLIENT) 794 (void) fprintf(fp, "bclient "); 795 if (is->flags & INFO_FLAG_AUTHENTICATE) 796 (void) fprintf(fp, "auth "); 797 if (is->flags & INFO_FLAG_MONITOR) 798 (void) fprintf(fp, "monitor "); 799 if (is->flags & INFO_FLAG_NTP) 800 (void) fprintf(fp, "ntp "); 801 if (is->flags & INFO_FLAG_KERNEL) 802 (void) fprintf(fp, "kernel "); 803 if (is->flags & INFO_FLAG_FILEGEN) 804 (void) fprintf(fp, "stats "); |
805 if (is->flags & INFO_FLAG_PLL_SYNC) 806 (void) fprintf(fp, "kernel_sync "); | 805 if (is->flags & INFO_FLAG_CAL) 806 (void) fprintf(fp, "calibrate "); |
807 if (is->flags & INFO_FLAG_PPS_SYNC) | 807 if (is->flags & INFO_FLAG_PPS_SYNC) |
808 (void) fprintf(fp, "pps_sync "); | 808 (void) fprintf(fp, "pps "); |
809 (void) fprintf(fp, "\n"); 810 } 811 (void) fprintf(fp, "jitter: %s s\n", 812 fptoa(ntohl(is->frequency), 6)); 813 (void) fprintf(fp, "stability: %s ppm\n", 814 ufptoa(ntohl(is->stability), 3)); 815 (void) fprintf(fp, "broadcastdelay: %s s\n", 816 fptoa(NTOHS_FP(is->bdelay), 6)); --- 352 unchanged lines hidden (view full) --- 1169 cpeer.maxpoll = NTP_MAXDPOLL; 1170 cpeer.flags = (u_char)flags; 1171 cpeer.ttl = cmode; 1172 1173 res = doquery(IMPL_XNTPD, REQ_CONFIG, 1, 1, 1174 sizeof(struct conf_peer), (char *)&cpeer, &items, 1175 &itemsize, &dummy, 0); 1176 | 809 (void) fprintf(fp, "\n"); 810 } 811 (void) fprintf(fp, "jitter: %s s\n", 812 fptoa(ntohl(is->frequency), 6)); 813 (void) fprintf(fp, "stability: %s ppm\n", 814 ufptoa(ntohl(is->stability), 3)); 815 (void) fprintf(fp, "broadcastdelay: %s s\n", 816 fptoa(NTOHS_FP(is->bdelay), 6)); --- 352 unchanged lines hidden (view full) --- 1169 cpeer.maxpoll = NTP_MAXDPOLL; 1170 cpeer.flags = (u_char)flags; 1171 cpeer.ttl = cmode; 1172 1173 res = doquery(IMPL_XNTPD, REQ_CONFIG, 1, 1, 1174 sizeof(struct conf_peer), (char *)&cpeer, &items, 1175 &itemsize, &dummy, 0); 1176 |
1177 if (res == INFO_ERR_FMT) { 1178 (void) fprintf(fp, 1179 "***Retrying command with old conf_peer size\n"); 1180 res = doquery(IMPL_XNTPD, REQ_CONFIG, 1, 1, 1181 sizeof(struct old_conf_peer), (char *)&cpeer, 1182 &items, &itemsize, &dummy, 0); 1183 } |
|
1177 if (res == 0) 1178 (void) fprintf(fp, "done!\n"); 1179 return; 1180} 1181 1182 1183/* 1184 * unconfig - unconfigure some associations --- 66 unchanged lines hidden (view full) --- 1251 int items; 1252 int itemsize; 1253 char *dummy; 1254 int res; 1255 1256 sys.flags = 0; 1257 res = 0; 1258 for (items = 0; items < pcmd->nargs; items++) { | 1184 if (res == 0) 1185 (void) fprintf(fp, "done!\n"); 1186 return; 1187} 1188 1189 1190/* 1191 * unconfig - unconfigure some associations --- 66 unchanged lines hidden (view full) --- 1258 int items; 1259 int itemsize; 1260 char *dummy; 1261 int res; 1262 1263 sys.flags = 0; 1264 res = 0; 1265 for (items = 0; items < pcmd->nargs; items++) { |
1259 if (STREQ(pcmd->argval[items].string, "pps")) 1260 sys.flags |= SYS_FLAG_PPS; | 1266 if (STREQ(pcmd->argval[items].string, "auth")) 1267 sys.flags |= SYS_FLAG_AUTH; |
1261 else if (STREQ(pcmd->argval[items].string, "bclient")) | 1268 else if (STREQ(pcmd->argval[items].string, "bclient")) |
1262 sys.flags |= SYS_FLAG_BCLIENT; | 1269 sys.flags |= SYS_FLAG_BCLIENT; 1270 else if (STREQ(pcmd->argval[items].string, "calibrate")) 1271 sys.flags |= SYS_FLAG_CAL; 1272 else if (STREQ(pcmd->argval[items].string, "kernel")) 1273 sys.flags |= SYS_FLAG_KERNEL; |
1263 else if (STREQ(pcmd->argval[items].string, "monitor")) | 1274 else if (STREQ(pcmd->argval[items].string, "monitor")) |
1264 sys.flags |= SYS_FLAG_MONITOR; | 1275 sys.flags |= SYS_FLAG_MONITOR; |
1265 else if (STREQ(pcmd->argval[items].string, "ntp")) | 1276 else if (STREQ(pcmd->argval[items].string, "ntp")) |
1266 sys.flags |= SYS_FLAG_NTP; 1267 else if (STREQ(pcmd->argval[items].string, "kernel")) 1268 sys.flags |= SYS_FLAG_KERNEL; | 1277 sys.flags |= SYS_FLAG_NTP; 1278 else if (STREQ(pcmd->argval[items].string, "pps")) 1279 sys.flags |= SYS_FLAG_PPS; |
1269 else if (STREQ(pcmd->argval[items].string, "stats")) | 1280 else if (STREQ(pcmd->argval[items].string, "stats")) |
1270 sys.flags |= SYS_FLAG_FILEGEN; | 1281 sys.flags |= SYS_FLAG_FILEGEN; |
1271 else { 1272 (void) fprintf(fp, "Unknown flag %s\n", | 1282 else { 1283 (void) fprintf(fp, "Unknown flag %s\n", |
1273 pcmd->argval[items].string); | 1284 pcmd->argval[items].string); |
1274 res = 1; 1275 } 1276 } 1277 1278 if (res || sys.flags == 0) 1279 return; 1280 1281 res = doquery(IMPL_XNTPD, req, 1, 1, --- 1192 unchanged lines hidden --- | 1285 res = 1; 1286 } 1287 } 1288 1289 if (res || sys.flags == 0) 1290 return; 1291 1292 res = doquery(IMPL_XNTPD, req, 1, 1, --- 1192 unchanged lines hidden --- |