gs_config.c

Go to the documentation of this file.
00001 
00008 /* $Id: gs_config.c,v 1.15 2008/10/29 21:04:14 seymour Exp $ */
00009 /* $UTK_Copyright: $ */
00010 
00011 #include "utility.h"
00012 
00013 #include <stdlib.h>
00014 #include <string.h>
00015 
00016 #include "comm_data.h"
00017 #include "comm_basics.h"
00018 #include "comm_encode.h"
00019 #include "general.h"
00020 #include "gs_tools.h"
00021 
00031 int
00032 main(int argc, char **argv)
00033 {
00034   char dottedIP[20], proxy_dottedIP[20], cid_string[2 * CID_LEN + 1];
00035   int i, num_servers, agentport;
00036   gs_server_t **server_list;
00037 
00038   if(argc < 2) {
00039     fprintf(stderr,"Usage: GS_config <agent name>\n");
00040     exit(EXIT_FAILURE);
00041   }
00042   
00043   initialize_sockets();
00044 
00045   agentport = getenv_int("GRIDSOLVE_AGENT_PORT", GRIDSOLVE_AGENT_PORT_DEFAULT);
00046 
00047   server_list = gs_tools_get_all_servers(argv[1], agentport, &num_servers);
00048 
00049   printf("AGENT: %s [%d servers]\n", argv[1], num_servers);
00050 
00051   for(i=0;i<num_servers;i++) {
00052     proxy_cid_to_str(cid_string, server_list[i]->componentid);
00053     proxy_ip_to_str(server_list[i]->ipaddress, dottedIP);
00054     proxy_ip_to_str(server_list[i]->proxyip, proxy_dottedIP);
00055     if(server_list[i]->proxyip != 0)
00056       printf("SERVER: %s (%s:%d, proxy=%s:%d) [cid=%s]\n", server_list[i]->hostname, 
00057         dottedIP, server_list[i]->port, proxy_dottedIP, 
00058         server_list[i]->proxyport, cid_string);
00059     else
00060       printf("SERVER: %s (%s:%d) [cid=%s]\n", server_list[i]->hostname, 
00061         dottedIP, server_list[i]->port, cid_string);
00062   }
00063 
00064   cleanup_sockets();
00065 
00066   return 0;
00067 }