Functions

gs_config.c File Reference

#include "utility.h"
#include <stdlib.h>
#include <string.h>
#include "comm_data.h"
#include "comm_basics.h"
#include "comm_encode.h"
#include "general.h"
#include "gs_tools.h"
Include dependency graph for gs_config.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Detailed Description

This program will print a list of servers. The usage is: GS_config <agent name>="">

Definition in file gs_config.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Entry point for GS_config.

Parameters:
argc -- arg count
argv -- array of command line args
Returns:
EXIT_SUCCESS on success, EXIT_FAILURE on error.

Definition at line 32 of file gs_config.c.

{
  char dottedIP[20], proxy_dottedIP[20], cid_string[2 * CID_LEN + 1];
  int i, num_servers, agentport;
  gs_server_t **server_list;

  if(argc < 2) {
    fprintf(stderr,"Usage: GS_config <agent name>\n");
    exit(EXIT_FAILURE);
  }
  
  initialize_sockets();

  agentport = getenv_int("GRIDSOLVE_AGENT_PORT", GRIDSOLVE_AGENT_PORT_DEFAULT);

  server_list = gs_tools_get_all_servers(argv[1], agentport, &num_servers);

  printf("AGENT: %s [%d servers]\n", argv[1], num_servers);

  for(i=0;i<num_servers;i++) {
    proxy_cid_to_str(cid_string, server_list[i]->componentid);
    proxy_ip_to_str(server_list[i]->ipaddress, dottedIP);
    proxy_ip_to_str(server_list[i]->proxyip, proxy_dottedIP);
    if(server_list[i]->proxyip != 0)
      printf("SERVER: %s (%s:%d, proxy=%s:%d) [cid=%s]\n", server_list[i]->hostname, 
        dottedIP, server_list[i]->port, proxy_dottedIP, 
        server_list[i]->proxyport, cid_string);
    else
      printf("SERVER: %s (%s:%d) [cid=%s]\n", server_list[i]->hostname, 
        dottedIP, server_list[i]->port, cid_string);
  }

  cleanup_sockets();

  return 0;
}

Here is the call graph for this function: