FACT++  1.0
int main ( int  argc,
char **  argv 
)

Definition at line 1419 of file dns.c.

References conn_arr_create(), conn_get(), node::conn_id, Curr_N_Conns, dim_init(), dim_print_date_time(), dim_set_keepalive_timeout(), dim_set_listen_backlog(), dim_set_read_buffer_size(), dim_set_write_buffer_size(), dim_set_write_timeout(), DIM_VERSION_NUMBER, dim_wait(), dis_add_cmnd, dis_add_service, dis_send_service, dis_start_serving, dna_open_server(), Dns_conns, DNS_TASK, dtq_add_entry(), dtq_create(), error_handler(), FALSE, get_dns_port_number(), get_dns_server_info(), get_new_dns_server_info(), get_node_name(), get_rpc_info(), handle_registration(), i, id, id_free(), id_get_ptr(), kill_servers(), MAX_NAME, print_hash_table(), print_stats(), recv_rout(), Rpc_id, send_dns_server_info(), Server_info_id, Server_new_info_id, service_init(), set_debug_off(), set_debug_on(), set_rpc_info(), size, SRC_DIS, SRC_DNS, Timer_q, update_did(), and wake_up.

1420 {
1421  int i, protocol, dns_port;
1422  int *bufp;
1423  int size;
1424  int conn_id, id;
1425  DIS_DNS_PACKET *dis_dns_packet;
1426  char node[MAX_NAME];
1427  void service_init();
1428 
1429  if(argc > 1)
1430  {
1431  if(!strcmp(argv[1],"-d"))
1432  set_debug_on();
1433  else
1434  {
1435  printf("Parameters: -d Debug On\n");
1436  exit(0);
1437  }
1438  }
1440  dim_set_listen_backlog(1024);
1443  dim_set_read_buffer_size(32768);
1444  dim_init();
1446  service_init();
1447  Timer_q = dtq_create();
1448  get_node_name(node);
1450  printf(" DNS version %d starting up on %s\n",DIM_VERSION_NUMBER, node);
1451  fflush(stdout);
1452 
1453  Server_new_info_id =(int) dis_add_service( "DIS_DNS/SERVER_LIST", "C", 0, 0,
1455  Server_info_id = (int)dis_add_service( "DIS_DNS/SERVER_INFO", 0, 0, 0,
1456  get_dns_server_info, 0 );
1457  dis_add_cmnd( "DIS_DNS/PRINT_STATS", 0, print_stats, 0 );
1458  dis_add_cmnd( "DIS_DNS/DEBUG_ON", 0, set_debug_on, 0 );
1459  dis_add_cmnd( "DIS_DNS/DEBUG_OFF", 0, set_debug_off, 0 );
1460  dis_add_cmnd( "DIS_DNS/KILL_SERVERS", "I", kill_servers, 0 );
1461  dis_add_cmnd( "DIS_DNS/PRINT_HASH_TABLE", 0, print_hash_table, 0 );
1462  dis_add_cmnd( "DIS_DNS/SERVICE_INFO/RpcIn", "C", set_rpc_info, 0 );
1463  Rpc_id = (int)dis_add_service( "DIS_DNS/SERVICE_INFO/RpcOut", "C", 0, 0,
1464  get_rpc_info, 0 );
1465  dns_port = get_dns_port_number();
1466  if( !dna_open_server(DNS_TASK, recv_rout, &protocol, &dns_port, error_handler) )
1467  return(0);
1468 
1469  id = dis_start_serving("DIS_DNS");
1470  dis_dns_packet = (DIS_DNS_PACKET *) id_get_ptr(id, SRC_DIS);
1471  id_free(id, SRC_DIS);
1472  conn_id = conn_get();
1473  handle_registration(conn_id, dis_dns_packet, 0);
1474  dtq_add_entry(Timer_q, 5, update_did, 0xded0000);
1475  while(1)
1476  {
1477 #ifdef VMS
1478  sys$hiber();
1479 #else
1480  wake_up = FALSE;
1481  while( !wake_up )
1482  {
1483  dim_wait();
1484  }
1485 #endif
1486  for( i = 0; i< Curr_N_Conns; i++ )
1487  {
1488  if( Dns_conns[i].src_type == SRC_DIS )
1489  {
1490  send_dns_server_info( i, &bufp, &size );
1491  dis_send_service( Server_info_id, bufp, size );
1492  }
1493  }
1494  }
1495  return(1);
1496 }
void update_did()
Definition: dns.c:573
#define MAX_NAME
Definition: dim.h:182
static int wake_up
Definition: dns.c:81
Definition: dns.c:26
void kill_servers(int *tag, int *code, int *size)
Definition: dns.c:1568
DllExp DIM_NOSHARE int Curr_N_Conns
Definition: conn_handler.c:33
int handle_registration(int conn_id, DIS_DNS_PACKET *packet, int tmout_flag)
Definition: dns.c:176
int dim_wait(void)
Definition: dim_thr.c:409
static int Rpc_id
Definition: dns.c:81
DllExp DIM_NOSHARE DNS_CONNECTION * Dns_conns
Definition: conn_handler.c:29
int i
Definition: db_dim_client.c:21
static int Server_info_id
Definition: dns.c:81
void * id_get_ptr(int id, SRC_TYPES type)
Definition: conn_handler.c:184
void set_rpc_info(int *tag, char *buffer, int *size)
Definition: dns.c:1824
#define DNS_TASK
Definition: dim.h:138
#define FALSE
Definition: dim.h:136
int dtq_create()
Definition: dtq.c:353
void print_stats()
Definition: dns.c:1499
void get_new_dns_server_info(int *tag, int **bufp, int *size, int *first_time)
Definition: dns.c:1296
char id[4]
Definition: FITS.h:71
void set_debug_on()
Definition: dns.c:1556
void conn_arr_create(SRC_TYPES type)
Definition: conn_handler.c:49
void print_hash_table()
Definition: dns.c:1667
#define dis_add_cmnd
Definition: dis.h:13
void dim_set_listen_backlog(int size)
Definition: tcpip.c:113
void dim_init()
Definition: dim_thr.c:111
static void error_handler(int conn_id, int severity, int errcode, char *reason)
Definition: dns.c:162
static void recv_rout(int conn_id, DIC_DNS_PACKET *packet, int size, int status)
Definition: dns.c:105
#define dis_start_serving
Definition: dis.h:8
void service_init()
Definition: dns.c:1620
void dim_set_write_timeout(int secs)
Definition: tcpip.c:141
static int Server_new_info_id
Definition: dns.c:81
int get_dns_port_number()
Definition: utilities.c:216
void dim_set_keepalive_timeout(int secs)
Definition: tcpip.c:123
int dna_open_server(char *task, void(*read_ast)(), int *protocol, int *port, void(*error_ast)())
Definition: dna.c:551
int size
Definition: db_dim_server.c:17
void id_free(int id, SRC_TYPES type)
Definition: conn_handler.c:206
#define dis_send_service
Definition: dis.h:20
static int Timer_q
Definition: dns.c:80
TIMR_ENT * dtq_add_entry(int queue_id, int time, void(*user_routine)(), dim_long tag)
Definition: dtq.c:399
int dim_set_write_buffer_size(int size)
Definition: tcpip.c:160
#define dis_add_service
Definition: dis.h:12
void dim_print_date_time()
Definition: utilities.c:134
#define DIM_VERSION_NUMBER
Definition: dim.h:16
int get_node_name(char *node_name)
Definition: utilities.c:33
void set_debug_off()
Definition: dns.c:1562
void get_rpc_info(int *tag, char **buffer, int *size)
Definition: dns.c:1930
void get_dns_server_info(int *tag, int **bufp, int *size, int *first_time)
Definition: dns.c:1216
int dim_set_read_buffer_size(int size)
Definition: tcpip.c:176
void send_dns_server_info(int conn_id, int **bufp, int *size)
Definition: dns.c:1239
int conn_get()
Definition: conn_handler.c:79

+ Here is the call graph for this function: