FACT++  1.0
int request_command ( char *  serv_name,
void *  serv_address,
int  serv_size,
void(*)()  usr_routine,
dim_long  tag,
int  stamped 
)

Definition at line 736 of file dic.c.

References COMMAND, conn_arr_create(), dic_serv::conn_id, Dic_timer_q, dim_init_threads(), dll_init(), dtq_create(), dtq_start_timer(), end_command(), dic_serv::fill_address, dic_serv::fill_size, Memory::free(), insert_service(), locate_command(), locate_pending(), locate_service(), Memory::malloc(), send_command(), dic_serv::serv_id, SRC_DIC, dic_serv::tag, Threads_off, dic_serv::user_routine, and WAITING_DNS_UP.

Referenced by dic_cmnd_callback(), dic_cmnd_callback_stamped(), dic_cmnd_service(), dic_cmnd_service_stamped(), and send_data().

738 {
739  int conn_id, ret;
740  register DIC_SERVICE *servp, *testp;
741  int *fillp;
742  int send_command();
743  int end_command();
744  void dim_init_threads(void);
745  int locate_service();
746 
747  if(!Threads_off)
748  {
750  }
751  {
752  DISABLE_AST
753  /* create a timer queue for timeouts if not yet done */
754  if( !Dic_timer_q ) {
757  }
758 
759  /* store_service */
760  if( !Cmnd_head ) {
761  Cmnd_head = (DIC_SERVICE *) malloc(sizeof(DIC_SERVICE) );
762  dll_init( (DLL *) Cmnd_head );
763  Cmnd_head->serv_id = 0;
764  }
765  if( (servp = locate_command(serv_name)) )
766  {
767  if(!(testp = locate_pending(serv_name)))
768  {
769  if( (conn_id = servp->conn_id) )
770  {
771  if(servp->fill_size > 0)
772  free( servp->fill_address );
773  fillp = serv_address;
774  if(serv_size > 0)
775  {
776  fillp = (int *)malloc((size_t)serv_size);
777  memcpy( (char *)fillp, (char *)serv_address, (size_t)serv_size );
778  }
779  servp->fill_address = fillp;
780  servp->fill_size = serv_size;
781 /*
782  servp->fill_address = (int *)serv_address;
783  servp->fill_size = serv_size;
784 */
785  servp->user_routine = usr_routine;
786  servp->tag = tag;
787  ret = send_command(conn_id, servp);
788  end_command(servp, ret);
789  ENABLE_AST
790  return(1);
791  }
792  }
793  }
794  servp = insert_service( COMMAND, 0,
795  serv_name, 0, 0, usr_routine, tag,
796  (int *)serv_address, serv_size,
797  WAITING_DNS_UP, stamped );
798  if( locate_service(servp) <= 0)
799  {
800 /*
801  service_tmout( servp->serv_id );
802 */
804  }
805  ENABLE_AST
806  }
807  return(-1);
808 }
int end_command(DIC_SERVICE *servp, int ret)
Definition: dic.c:1808
int * fill_address
Definition: dim.h:470
DIC_SERVICE * locate_pending(char *serv_name)
Definition: dic.c:1214
#define COMMAND
Definition: dim_common.h:10
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 dll_init(DLL *head)
Definition: dll.c:14
void conn_arr_create(SRC_TYPES type)
Definition: conn_handler.c:49
void(* user_routine)()
Definition: dim.h:472
dim_long tag
Definition: dim.h:473
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 send_command(int conn_id, DIC_SERVICE *servp)
Definition: dic.c:1956
int serv_id
Definition: dim.h:461
void free(void *mem)
void service_tmout(int serv_id)
Definition: dic.c:518
int fill_size
Definition: dim.h:471
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: