FACT++  1.0
void client_info ( long *  tag,
int **  bufp,
int *  size,
int *  first_time 
)

Definition at line 2522 of file dis_old.c.

References Client_head, cli_ent::conn_id, dll_get_next(), dna_get_node_task(), cli_ent::dnsp, Memory::free(), i, Last_client, Memory::malloc(), MAX_CONNS, MAX_NODE_NAME, and MAX_TASK_NAME.

2523 {
2524  register CLIENT *clip;
2525  int curr_conns[MAX_CONNS];
2526  int i, index, max_size;
2527  static int curr_allocated_size = 0;
2528  static char *dns_info_buffer;
2529  register char *dns_client_info;
2530  char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
2531  DIS_DNS_CONN *dnsp = (DIS_DNS_CONN *)*tag;
2532 
2533  max_size = sizeof(DNS_CLIENT_INFO);
2534  if(!curr_allocated_size)
2535  {
2536  dns_info_buffer = malloc(max_size);
2537  curr_allocated_size = max_size;
2538  }
2539  dns_client_info = dns_info_buffer;
2540  dns_client_info[0] = '\0';
2541  index = 0;
2542  if(*first_time)
2543  {
2544  clip = Client_head;
2545  while( (clip = (CLIENT *)dll_get_next( (DLL *) Client_head,
2546  (DLL*) clip)) )
2547  {
2548  if(clip->dnsp != dnsp)
2549  continue;
2550  curr_conns[index++] = clip->conn_id;
2551  }
2552  max_size = (index+1)*sizeof(DNS_CLIENT_INFO);
2553  if (max_size > curr_allocated_size)
2554  {
2555  free(dns_info_buffer);
2556  dns_info_buffer = malloc(max_size);
2557  curr_allocated_size = max_size;
2558  }
2559  dns_client_info = dns_info_buffer;
2560  dns_client_info[0] = '\0';
2561  }
2562  else
2563  {
2564  if(Last_client > 0)
2565  {
2566  strcat(dns_client_info,"+");
2567  curr_conns[index++] = Last_client;
2568  }
2569  else
2570  {
2571  strcat(dns_client_info,"-");
2572  curr_conns[index++] = -Last_client;
2573  }
2574  }
2575 
2576  for(i=0; i<index;i++)
2577  {
2578  dna_get_node_task(curr_conns[i], node, task);
2579  strcat(dns_client_info,task);
2580  strcat(dns_client_info,"@");
2581  strcat(dns_client_info,node);
2582  strcat(dns_client_info,"|");
2583  }
2584  if(index)
2585  dns_client_info[strlen(dns_client_info)-1] = '\0';
2586  *bufp = (int *)dns_info_buffer;
2587  *size = strlen(dns_info_buffer)+1;
2588 }
Definition: dns.c:26
int i
Definition: db_dim_client.c:21
Definition: dis.c:98
static CLIENT * Client_head
Definition: dis_old.c:106
void * malloc()
Definition: EventBuilder.cc:99
#define MAX_CONNS
Definition: dim.h:163
static int Last_client
Definition: dis_old.c:147
Definition: dim.h:530
int conn_id
Definition: dis.c:101
DIS_DNS_CONN * dnsp
Definition: dis.c:103
#define MAX_TASK_NAME
Definition: dim.h:181
int dna_get_node_task(int conn_id, char *node, char *task)
Definition: dna.c:594
int size
Definition: db_dim_server.c:17
void free(void *mem)
DLL * dll_get_next(DLL *head, DLL *item)
Definition: dll.c:66
#define MAX_NODE_NAME
Definition: dim.h:180

+ Here is the call graph for this function: