FACT++  1.0
void update_show_servers ( void *  tag,
unsigned long *  reason 
)

Definition at line 2425 of file didMarkus.c.

References app_context, item::busy, item::button_id, create_button(), Curr_matrix, Curr_view_opt, Curr_view_opt_par, Force_update, Memory::free(), get_something(), GREEN, i, Matrix_id, MAX_NODE_NAME, N_servers, N_services, DNS_SERVER_INFO::n_services, item::name, DNS_SERVICE_INFO::name, No_link_button_id, DNS_SERVER_INFO::node, put_label(), RED, remove_all_buttons(), remove_button(), item::server, Server_head, item::service_ptr, set_color(), sll_empty(), sll_get_next(), sll_remove(), and sll_remove_head().

Referenced by app_initialize(), and show_servers().

2426 {
2427 DNS_SERVER_INFO *server_ptr;
2428 DNS_SERVICE_INFO *service_ptr;
2429 int i, j, found, n_done = 0;
2430 Widget w, create_button();
2431 SERVER *servp, *prevp;
2432 static int old_n_services = 0;
2433 char node[MAX_NODE_NAME], par[MAX_NODE_NAME], *ptr;
2434 void remove_button();
2435 void remove_all_buttons();
2436 void put_label();
2437 
2438  DISABLE_AST
2439  if(tag){}
2440  if(reason){}
2441  if((N_services != old_n_services) || (Force_update))
2442  {
2443  if(!Matrix_id[Curr_matrix])
2444  {
2445  XtAppAddTimeOut(app_context, 1000, update_show_servers, 0);
2446  ENABLE_AST
2447  return;
2448  }
2449  if(!N_servers)
2450  {
2452  if(! No_link_button_id)
2453  {
2454  No_link_button_id = create_button("DNS is down", 0);
2455  set_color(No_link_button_id, XmNbackground, RED);
2456  get_something(No_link_button_id,XmNuserData,&w);
2457  set_color(w, XmNbackground, RED);
2458  XtSetSensitive(No_link_button_id, False);
2459  }
2460  while(!sll_empty((SLL *)Server_head))
2461  {
2462  servp = (SERVER *)sll_remove_head((SLL *)Server_head);
2463  if(servp->service_ptr)
2464  free(servp->service_ptr);
2465  free(servp);
2466  }
2467  put_label();
2468  old_n_services = N_services;
2469  Force_update = 0;
2470  XtAppAddTimeOut(app_context, 1000, update_show_servers, 0);
2471  ENABLE_AST
2472  return;
2473  }
2474  if(No_link_button_id)
2475  {
2476  XtDestroyWidget(No_link_button_id);
2477  /*
2478  XFlush(XtDisplay(No_link_button_id));
2479  */
2480  No_link_button_id = 0;
2481  }
2482  servp = Server_head;
2483  prevp = 0;
2484  while( (servp = (SERVER *)sll_get_next((SLL *)servp)) )
2485  {
2486  if(prevp)
2487  {
2488  free(prevp);
2489  prevp = 0;
2490  }
2491  if(n_done == 10)
2492  {
2493  if(!Force_update)
2494  put_label();
2495  XtAppAddTimeOut(app_context, 100, update_show_servers, 0);
2496  ENABLE_AST
2497  return;
2498  }
2499  server_ptr = &servp->server;
2500  if(servp->busy == 1)
2501  {
2502  if(!servp->button_id)
2503  {
2504  switch(Curr_view_opt)
2505  {
2506  case 1 :
2507  servp->button_id = create_button(/*server_ptr->task*/servp->name, servp);
2508  n_done++;
2509  break;
2510  case 0 :
2511  strcpy(node, server_ptr->node);
2512  strcpy(par, Curr_view_opt_par);
2513  ptr = strchr(node, '.');
2514  if(ptr)
2515  *ptr = '\0';
2516  ptr = strchr(par,'.');
2517  if(ptr)
2518  *ptr = '\0';
2519  ptr = node;
2520  for(i = 0; i < (int)strlen(ptr); i++)
2521  ptr[i] = tolower(ptr[i]);
2522  ptr = par;
2523  for(i = 0; i < (int)strlen(ptr); i++)
2524  ptr[i] = tolower(ptr[i]);
2525  if(!strcmp(/*server_ptr->*/node, /*Curr_view_opt_*/par))
2526  {
2527  servp->button_id = create_button(/*server_ptr->task*/servp->name, servp);
2528  n_done++;
2529  }
2530  break;
2531  case 2 :
2532  found = 0;
2533  if(!(service_ptr = servp->service_ptr))
2534  break;
2535  for(j = 0; j < server_ptr->n_services; j++)
2536  {
2537  if(strstr(service_ptr->name, Curr_view_opt_par) > (char *)0)
2538  {
2539  found = 1;
2540  break;
2541  }
2542  service_ptr++;
2543  }
2544  if (found)
2545  {
2546  servp->button_id = create_button(/*server_ptr->task*/servp->name, servp);
2547  n_done++;
2548  }
2549  break;
2550  case 3 :
2551  if(server_ptr->n_services == -1)
2552  {
2553  servp->button_id = create_button(/*server_ptr->task*/servp->name, servp);
2554  n_done++;
2555  }
2556  else
2557  {
2558  if(servp->button_id)
2559  remove_button(servp);
2560  }
2561  n_done++;
2562  break;
2563  }
2564  }
2565  servp->busy = 2;
2566  if(servp->button_id)
2567  {
2568  if(Curr_view_opt != -1)
2569  {
2570  if (server_ptr->n_services == -1)
2571  {
2572  set_color(servp->button_id, XmNbackground, RED);
2573  get_something(servp->button_id,XmNuserData,&w);
2574  set_color(w, XmNbackground, RED);
2575  }
2576  else
2577  {
2578  set_color(servp->button_id, XmNbackground, GREEN);
2579  get_something(servp->button_id,XmNuserData,&w);
2580  set_color(w, XmNbackground, GREEN);
2581  }
2582  }
2583  }
2584  }
2585  else if (servp->busy == -1)
2586  {
2587  remove_button(servp);
2588  sll_remove((SLL *)Server_head, (SLL *)servp);
2589  if(servp->service_ptr)
2590  {
2591  free(servp->service_ptr);
2592  servp->service_ptr = 0;
2593  }
2594  prevp = servp;
2595  n_done++;
2596  }
2597  }
2598  if(prevp)
2599  {
2600  free(prevp);
2601  prevp = 0;
2602  }
2603  put_label();
2604  old_n_services = N_services;
2605  Force_update = 0;
2606  }
2607  XtAppAddTimeOut(app_context, 1000, update_show_servers, 0);
2608  ENABLE_AST
2609 }
Definition: dns.c:26
Widget Matrix_id[2]
Definition: did.h:57
char Curr_view_opt_par[80]
Definition: didMarkus.c:11
int busy
Definition: did.h:52
void put_label()
Definition: didMarkus.c:3122
Definition: did.h:42
int i
Definition: db_dim_client.c:21
Widget button_id
Definition: did.h:47
char node[MAX_NODE_NAME]
Definition: dim.h:338
int N_services
Definition: didMarkus.c:16
XtAppContext app_context
Definition: did.h:38
Widget No_link_button_id
Definition: did.h:63
int N_servers
Definition: didMarkus.c:15
SERVER * Server_head
Definition: did.h:55
char name[132]
Definition: did.h:46
SLL * sll_get_next(SLL *item)
Definition: sll.c:50
Definition: dim.h:536
int Curr_view_opt
Definition: didMarkus.c:10
SLL * sll_remove_head(SLL *head)
Definition: sll.c:94
DNS_SERVICE_INFO * service_ptr
Definition: did.h:45
char name[MAX_NAME]
Definition: dim.h:331
int sll_remove(SLL *head, SLL *item)
Definition: sll.c:74
DNS_SERVER_INFO server
Definition: did.h:44
void set_color()
void get_something()
void free(void *mem)
Widget create_button(char *name, SERVER *servp)
Definition: didMarkus.c:2611
void remove_button(SERVER *servp)
Definition: didMarkus.c:2707
int Force_update
Definition: didMarkus.c:36
#define MAX_NODE_NAME
Definition: dim.h:180
int Curr_matrix
Definition: did.h:58
int n_services
Definition: dim.h:341
void update_show_servers(void *tag, unsigned long *reason)
Definition: didMarkus.c:2425
int sll_empty(SLL *head)
Definition: sll.c:60
Definition: dui_colors.h:4
void remove_all_buttons()
Definition: didMarkus.c:2691

+ Here is the call graph for this function:

+ Here is the caller graph for this function: