2
/*___INFO__MARK_BEGIN__*/
3
/*************************************************************************
5
* The Contents of this file are made available subject to the terms of
6
* the Sun Industry Standards Source License Version 1.2
8
* Sun Microsystems Inc., March, 2001
11
* Sun Industry Standards Source License Version 1.2
12
* =================================================
13
* The contents of this file are subject to the Sun Industry Standards
14
* Source License Version 1.2 (the "License"); You may not use this file
15
* except in compliance with the License. You may obtain a copy of the
16
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
18
* Software provided under this License is provided on an "AS IS" basis,
19
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
20
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
21
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
22
* See the License for the specific provisions governing your rights and
23
* obligations concerning the Software.
25
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
27
* Copyright: 2001 by Sun Microsystems, Inc.
29
* All Rights Reserved.
31
************************************************************************/
32
/*___INFO__MARK_END__*/
41
#include <arpa/inet.h> /* for inet_makeaddr() */
42
#include <netinet/in.h>
44
#include "cl_commlib.h"
45
#include "cl_host_list.h"
51
main(int argc, char** argv)
62
printf("usage: test_cl_hostname_list <DEBUGLEVEL> hostnames\n");
66
printf("commlib setup ...\n");
67
retval = cl_com_setup_commlib(CL_NO_THREAD, (cl_log_t)atoi(argv[1]), NULL);
68
printf("%s\n\n",cl_get_error_text(retval));
70
printf("reslovling host addr 129.157.141.10 ...\n");
71
addr = inet_makeaddr(129*256+157,141*256+10);
72
printf("ip addr: %s\n",inet_ntoa(addr)); /* inet_ntoa() is not MT save */
73
addr2 = inet_makeaddr(192*256+168,11*256+1);
74
printf("ip addr2: %s\n",inet_ntoa(addr2)); /* inet_ntoa() is not MT save */
78
while ((loops--) != 0) {
81
while( argv[arg] != NULL) {
82
printf("resolving host \"%s\" ...\n", argv[arg]);
83
retval = cl_com_cached_gethostbyname(argv[arg],&rhost,NULL,NULL,NULL);
84
printf("%s\n",cl_get_error_text(retval));
87
printf(" -> host resolved as \"%s\"\n", rhost );
92
printf("cl_com_gethostbyaddr ... %s\n", inet_ntoa(addr)); /* inet_ntoa() is not MT save */
94
retval = cl_com_cached_gethostbyaddr(&addr, &rhost, NULL, NULL);
95
printf("%s\n",cl_get_error_text(retval));
97
if (retval == CL_RETVAL_OK) {
98
printf(" -> host name is \"%s\"\n", rhost);
103
printf("cl_com_gethostbyaddr ... %s\n",inet_ntoa(addr2) ); /* inet_ntoa() is not MT save */
106
retval = cl_com_cached_gethostbyaddr(&addr2, &rhost, NULL, NULL);
107
printf("%s\n",cl_get_error_text(retval));
109
if (retval == CL_RETVAL_OK) {
110
printf(" -> host name is \"%s\"\n", rhost);
115
printf("***********************************************************\n");
122
printf("commlib cleanup ...\n");
123
retval = cl_com_cleanup_commlib();
124
printf("%s\n\n",cl_get_error_text(retval));
127
printf("main done\n");