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

Definition at line 2832 of file dis.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.

2833 {
2834  register CLIENT *clip;
2835  int curr_conns[MAX_CONNS];
2836  int i, index, max_size;
2837  static int curr_allocated_size = 0;
2838  static char *dns_info_buffer;
2839  register char *dns_client_info;
2840  char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
2841  DIS_DNS_CONN *dnsp = (DIS_DNS_CONN *)*tag;
2842 
2843  max_size = sizeof(DNS_CLIENT_INFO);
2844  if(!curr_allocated_size)
2845  {
2846  dns_info_buffer = malloc((size_t)max_size);
2847  curr_allocated_size = max_size;
2848  }
2849  dns_client_info = dns_info_buffer;
2850  dns_client_info[0] = '\0';
2851  index = 0;
2852  if(*first_time)
2853  {
2854  clip = Client_head;
2855  while( (clip = (CLIENT *)dll_get_next( (DLL *) Client_head,
2856  (DLL*) clip)) )
2857  {
2858  if(clip->dnsp != dnsp)
2859  continue;
2860  curr_conns[index++] = clip->conn_id;
2861  }
2862  max_size = (index+1)*(int)sizeof(DNS_CLIENT_INFO);
2863  if (max_size > curr_allocated_size)
2864  {
2865  free(dns_info_buffer);
2866  dns_info_buffer = malloc((size_t)max_size);
2867  curr_allocated_size = max_size;
2868  }
2869  dns_client_info = dns_info_buffer;
2870  dns_client_info[0] = '\0';
2871  }
2872  else
2873  {
2874  if(Last_client > 0)
2875  {
2876  strcat(dns_client_info,"+");
2877  curr_conns[index++] = Last_client;
2878  }
2879  else
2880  {
2881  strcat(dns_client_info,"-");
2882  curr_conns[index++] = -Last_client;
2883  }
2884  }
2885 
2886  for(i=0; i<index;i++)
2887  {
2888  dna_get_node_task(curr_conns[i], node, task);
2889  strcat(dns_client_info,task);
2890  strcat(dns_client_info,"@");
2891  strcat(dns_client_info,node);
2892  strcat(dns_client_info,"|");
2893  }
2894  if(index)
2895  dns_client_info[(int)strlen(dns_client_info)-1] = '\0';
2896  *bufp = (int *)dns_info_buffer;
2897  *size = (int)strlen(dns_info_buffer)+1;
2898 }
Definition: dns.c:26
int i
Definition: db_dim_client.c:21
Definition: dis.c:98
void * malloc()
Definition: EventBuilder.cc:99
#define MAX_CONNS
Definition: dim.h:163
static CLIENT * Client_head
Definition: dis.c:106
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
static int Last_client
Definition: dis.c:149
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: