FACT++  1.0
unsigned request_service ( char *  serv_name,
int  req_type,
int  req_timeout,
void *  serv_address,
int  serv_size,
void(*)()  usr_routine,
dim_long  tag,
void *  fill_addr,
int  fill_size,
int  stamped 
)

Definition at line 625 of file dic.c.

References conn_arr_create(), dic_serv::conn_id, Dic_timer_q, dim_init_threads(), dll_init(), dtq_create(), dtq_start_timer(), insert_service(), locate_command(), locate_service(), Memory::malloc(), modify_service(), NOT_PENDING, ONCE_ONLY, dic_serv::pending, send_service(), dic_serv::serv_id, SRC_DIC, Threads_off, WAITING_DNS_UP, and WAITING_SERVER_UP.

Referenced by dic_info_service(), dic_info_service_stamped(), and Java_dim_Client_infoService().

627 {
628  register DIC_SERVICE *servp;
629  int conn_id;
630  int send_service();
631  int locate_service();
632  void dim_init_threads(void);
633 
634  if(!Threads_off)
635  {
637  }
638  {
639  DISABLE_AST
640  /* create a timer queue for timeouts if not yet done */
641  if( !Dic_timer_q ) {
644  }
645 
646  /* store_service */
647  if(req_timeout < 0)
648  req_timeout = 0;
649  if(req_type == ONCE_ONLY)
650  {
651  if( !Cmnd_head ) {
652  Cmnd_head = (DIC_SERVICE *) malloc(sizeof(DIC_SERVICE) );
653  dll_init( (DLL *) Cmnd_head );
654  Cmnd_head->serv_id = 0;
655  }
656  if( (servp = locate_command(serv_name)) )
657  {
658  if( (conn_id = servp->conn_id) )
659  {
660  if(servp->pending == NOT_PENDING)
661  {
662  modify_service( servp, req_timeout,
663  (int *)serv_address, serv_size, usr_routine, tag,
664  (int *)fill_addr, fill_size, stamped);
665  servp->pending = WAITING_SERVER_UP;
666  if(send_service(conn_id, servp))
667  {
668  ENABLE_AST
669  return(1);
670  }
671  }
672  }
673  }
674  }
675  servp = insert_service( req_type, req_timeout,
676  serv_name, (int *)serv_address, serv_size, usr_routine, tag,
677  (int *)fill_addr, fill_size, WAITING_DNS_UP, stamped );
678 
679  /* get_address of server from name_server */
680 
681  if( locate_service(servp) <= 0)
682  {
683 /*
684  service_tmout( servp->serv_id );
685 */
687  }
688  ENABLE_AST
689  }
690  return((unsigned) servp->serv_id);
691 }
int send_service(int conn_id, DIC_SERVICE *servp)
Definition: dic.c:1891
DIC_SERVICE * locate_command(char *serv_name)
Definition: dic.c:1202
int dtq_create()
Definition: dtq.c:353
void * malloc()
Definition: EventBuilder.cc:99
void modify_service(DIC_SERVICE *servp, int timeout, int *address, int size, void(*routine)(), dim_long tag, int *fill_addr, int fill_size, int stamped)
Definition: dic.c:884
void dll_init(DLL *head)
Definition: dll.c:14
PENDING_STATES pending
Definition: dim.h:476
void conn_arr_create(SRC_TYPES type)
Definition: conn_handler.c:49
static int Threads_off
Definition: dic.c:50
void dim_init_threads()
Definition: dim_thr.c:399
Definition: dim.h:530
void dtq_start_timer(int time, void(*user_routine)(), dim_long tag)
Definition: dtq.c:790
int locate_service(DIC_SERVICE *servp)
Definition: dic.c:1167
int conn_id
Definition: dim.h:475
static DIC_SERVICE * Cmnd_head
Definition: dic.c:42
Definition: dim.h:457
int serv_id
Definition: dim.h:461
void service_tmout(int serv_id)
Definition: dic.c:518
#define ONCE_ONLY
Definition: dim_common.h:7
static int Dic_timer_q
Definition: dic.c:45
DIC_SERVICE * insert_service(int type, int timeout, char *name, int *address, int size, void(*routine)(), dim_long tag, int *fill_addr, int fill_size, int pending, int stamped)
Definition: dic.c:810

+ Here is the call graph for this function:

+ Here is the caller graph for this function: