FACT++  1.0
void recv_dns_dis_rout ( int  conn_id,
DNS_DIS_PACKET packet,
int  size,
int  status 
)

Definition at line 622 of file dis_old.c.

References ALL, exit_ent::conn_id, DIM_FATAL, DIM_WARNING, DIMDNSDUPLC, DIMDNSEXIT, DIMDNSREFUS, DIMDNSTMOUT, DIMDNSUNDEF, DIS_DNS_TMOUT_MAX, DIS_DNS_TMOUT_MIN, dis_stop_serving(), Dis_timer_q, dna_close(), dis_dns_ent::dns_dis_conn_id, DNS_DIS_EXIT, DNS_DIS_HEADER, DNS_DIS_KILL, DNS_DIS_REGISTER, DNS_DIS_STOP, dis_dns_ent::dns_timr_ent, dis_dns_ent::dnsid, do_dis_stop_serving_dns(), do_register_services(), dtq_add_entry(), dtq_rem_entry(), error_handler(), find_dns_by_conn_id(), open_dns(), rand_tmout(), register_services(), dis_dns_ent::serving, DNS_DIS_PACKET::size, sprintf(), SRC_DIS, STA_CONN, STA_DISC, str, dis_dns_ent::task_name, DNS_DIS_PACKET::type, WATCHDOG_TMOUT_MAX, and WATCHDOG_TMOUT_MIN.

Referenced by dis_start_serving_dns(), and release_conn().

623 {
624  char str[128];
625  int dns_timr_time;
626  extern int rand_tmout(int, int);
627  extern int open_dns(long, void (*)(), void (*)(), int, int, int);
628  extern DIS_DNS_CONN *find_dns_by_conn_id(int);
629  extern void do_register_services(DIS_DNS_CONN *);
630  extern void do_dis_stop_serving_dns(DIS_DNS_CONN *);
631  DIS_DNS_CONN *dnsp;
632 
633  if(size){}
634  dnsp = find_dns_by_conn_id(conn_id);
635  if(!dnsp)
636  {
637  return;
638  }
639  switch(status)
640  {
641  case STA_DISC: /* connection broken */
642  if( dnsp->dns_timr_ent ) {
644  dnsp->dns_timr_ent = NULL;
645  }
646 
647  if(dnsp->dns_dis_conn_id > 0)
648  dna_close(dnsp->dns_dis_conn_id);
649  if(dnsp->serving)
650  {
653  if(dnsp->dns_dis_conn_id == -2)
654  error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
655  }
656  break;
657  case STA_CONN: /* connection received */
658  if(dnsp->serving)
659  {
660  dnsp->dns_dis_conn_id = conn_id;
661  register_services(dnsp, ALL, 0);
662  dns_timr_time = rand_tmout(WATCHDOG_TMOUT_MIN,
665  dns_timr_time,
666  do_register_services, dnsp );
667  }
668  else
669  {
670  dna_close(conn_id);
671  }
672  break;
673  default : /* normal packet */
674  if(vtohl(packet->size) != DNS_DIS_HEADER)
675  break;
676  switch( vtohl(packet->type) )
677  {
678  case DNS_DIS_REGISTER :
679  sprintf(str,
680  "%s: Watchdog Timeout, DNS requests registration",
681  dnsp->task_name);
683  register_services(dnsp, ALL, 0);
684  break;
685  case DNS_DIS_KILL :
686  sprintf(str,
687  "%s: Some Services already known to DNS",
688  dnsp->task_name);
689  /*
690  exit(2);
691  */
695 /*
696  exit_tag = 0;
697  exit_code = 2;
698  exit_size = sizeof(int);
699  exit_handler(&exit_tag, &exit_code, &exit_size);
700 */
701  break;
702  case DNS_DIS_STOP :
703  sprintf(str,
704  "%s: DNS refuses connection",dnsp->task_name);
705 /*
706  exit(2);
707 */
711 /*
712  exit_tag = 0;
713  exit_code = 2;
714  exit_size = sizeof(int);
715  exit_handler(&exit_tag, &exit_code, &exit_size);
716 */
717  break;
718  case DNS_DIS_EXIT :
719  sprintf(str,
720  "%s: DNS requests Exit",dnsp->task_name);
722  break;
723  }
724  break;
725  }
726 }
#define DIMDNSTMOUT
Definition: dim_common.h:286
int serving
Definition: dis.c:46
int dns_dis_conn_id
Definition: dis.c:44
#define ALL
Definition: dis_old.c:32
static int Dis_timer_q
Definition: dis_old.c:141
void register_services(DIS_DNS_CONN *dnsp, int flag, int dns_flag)
Definition: dis_old.c:763
#define STA_DISC
Definition: dim.h:197
char task_name[MAX_NAME]
Definition: dis.c:40
void recv_dns_dis_rout(int conn_id, DNS_DIS_PACKET *packet, int size, int status)
Definition: dis_old.c:622
char str[80]
Definition: test_client.c:7
#define DIMDNSEXIT
Definition: dim_common.h:285
int rand_tmout(int min, int max)
Definition: open_dns.c:161
int dna_close(int conn_id)
Definition: dna.c:835
int type
Definition: dim.h:288
#define DNS_DIS_HEADER
Definition: dim.h:291
#define DIS_DNS_TMOUT_MAX
Definition: dim.h:157
void dis_stop_serving()
Definition: dis_old.c:2091
#define DIS_DNS_TMOUT_MIN
Definition: dim.h:156
#define DIMDNSUNDEF
Definition: dim_common.h:282
dim_long dnsid
Definition: dis.c:39
int open_dns(dim_long dnsid, void(*recv_rout)(), void(*error_rout)(), int tmout_min, int tmout_max, SRC_TYPES src_type)
Definition: open_dns.c:313
int size
Definition: dim.h:287
#define WATCHDOG_TMOUT_MIN
Definition: dim.h:174
int dtq_rem_entry(int queue_id, TIMR_ENT *entry)
Definition: dtq.c:503
TIMR_ENT * dns_timr_ent
Definition: dis.c:41
void do_dis_stop_serving_dns(DIS_DNS_CONN *dnsp)
Definition: dis_old.c:2010
void do_register_services(DIS_DNS_CONN *dnsp)
Definition: dis_old.c:758
#define DIMDNSDUPLC
Definition: dim_common.h:284
#define WATCHDOG_TMOUT_MAX
Definition: dim.h:175
int size
Definition: db_dim_server.c:17
static void error_handler(int conn_id, int severity, int errcode, char *reason)
Definition: dis_old.c:2827
TIMR_ENT * dtq_add_entry(int queue_id, int time, void(*user_routine)(), dim_long tag)
Definition: dtq.c:399
sprintf(name1,"NewService%d", i)
#define DIMDNSREFUS
Definition: dim_common.h:283
#define STA_CONN
Definition: dim.h:199
DIS_DNS_CONN * find_dns_by_conn_id(int conn_id)
Definition: dis_old.c:2994

+ Here is the call graph for this function:

+ Here is the caller graph for this function: