���߳� PING ������ַ�ĺ������ */
| 98 | |
| 99 | /* ���߳� PING ������ַ�ĺ������ */ |
| 100 | static void ping_main_sync(const char *dest, int npkt) |
| 101 | { |
| 102 | ACL_DNS_DB* dns_db; |
| 103 | const char* ip; |
| 104 | |
| 105 | /* ���� ICMP ���� */ |
| 106 | __chat = icmp_chat_create(NULL, 1); |
| 107 | |
| 108 | /* ������������ IP ��ַ */ |
| 109 | dns_db = acl_gethostbyname(dest, NULL); |
| 110 | if (dns_db == NULL) { |
| 111 | acl_msg_warn("Can't find domain %s", dest); |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | ip = acl_netdb_index_ip(dns_db, 0); |
| 116 | if (ip == NULL || *ip == 0) |
| 117 | acl_msg_fatal("ip invalid"); |
| 118 | |
| 119 | /* ��ʼ PING һ�� IP ��ַ */ |
| 120 | if (strcmp(dest, ip) == 0) |
| 121 | icmp_ping_one(__chat, NULL, ip, npkt, __delay, 1); |
| 122 | else |
| 123 | icmp_ping_one(__chat, dest, ip, npkt, __delay, 1); |
| 124 | |
| 125 | /* �ͷ� DNS ��ѯ��� */ |
| 126 | acl_netdb_free(dns_db); |
| 127 | |
| 128 | /* ��ʾ PING ���С�� */ |
| 129 | display_res(); |
| 130 | } |
| 131 | |
| 132 | /* PING �߳���� */ |
| 133 | static int __npkt = 10; |
no test coverage detected
searching dependent graphs…