FACT++  1.0
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 at line 810 of file dic.c.

References Dic_timer_q, dll_init(), dll_insert_queue(), dtq_add_entry(), id_get(), Memory::malloc(), MAX_NAME, MONIT_FIRST, ONCE_ONLY, dic_serv::serv_id, service_id, size, SRC_DIC, and type.

Referenced by request_command(), and request_service().

813 {
814  register DIC_SERVICE *newp;
815  int *fillp;
816  int service_id;
817  int tout;
818  float ftout;
819 
820  DISABLE_AST
821  newp = (DIC_SERVICE *) malloc(sizeof(DIC_SERVICE));
822  newp->pending = 0;
823  strncpy( newp->serv_name, name, (size_t)MAX_NAME );
824  newp->type = type;
825  newp->timeout = timeout;
826  newp->serv_address = address;
827  newp->serv_size = size;
828  newp->user_routine = routine;
829  newp->tag = tag;
830  fillp = fill_addr;
831  if(fill_size > 0)
832  {
833  fillp = (int *)malloc((size_t)fill_size);
834  memcpy( (char *) fillp, (char *) fill_addr, (size_t)fill_size );
835  }
836  newp->fill_address = fillp;
837  newp->fill_size = fill_size;
838  newp->conn_id = 0;
839  newp->format_data[0].par_bytes = 0;
840  newp->next = (DIC_SERVICE *)0;
841  service_id = id_get((void *)newp, SRC_DIC);
842  newp->serv_id = service_id;
843  if( !Service_pend_head )
844  {
848  }
849  dll_insert_queue( (DLL *) Service_pend_head, (DLL *)newp );
850  newp->timer_ent = NULL;
851  if(type != MONIT_FIRST)
852  {
853  if( timeout )
854  {
855  tout = timeout;
856  if(type != ONCE_ONLY)
857  {
858  if(tout < 10)
859  tout = 10;
860  ftout = (float)tout * (float)1.5;
861  tout = (int)ftout;
862  }
863  newp->curr_timeout = tout;
864  newp->timer_ent = dtq_add_entry( Dic_timer_q,
865  newp->curr_timeout,
866  service_tmout, newp->serv_id );
867  }
868  }
869  newp->pending = pending;
870  newp->tmout_done = 0;
871  newp->stamped = stamped;
872  newp->time_stamp[0] = 0;
873  newp->time_stamp[1] = 0;
874  newp->quality = 0;
875  newp->def[0] = '\0';
876 #ifdef VxWorks
877  newp->tid = taskIdSelf();
878 #endif
879  ENABLE_AST
880  return(newp);
881 }
#define MAX_NAME
Definition: dim.h:182
#define MONIT_FIRST
Definition: dim_common.h:15
unsigned service_id
Definition: db_dim_client.c:22
void dll_insert_queue(DLL *head, DLL *item)
Definition: dll.c:23
void * malloc()
Definition: EventBuilder.cc:99
void dll_init(DLL *head)
Definition: dll.c:14
Definition: dim.h:530
int type
Definition: dim.h:457
int serv_id
Definition: dim.h:461
int size
Definition: db_dim_server.c:17
TIMR_ENT * dtq_add_entry(int queue_id, int time, void(*user_routine)(), dim_long tag)
Definition: dtq.c:399
int id_get(void *ptr, SRC_TYPES type)
Definition: conn_handler.c:152
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
static DIC_SERVICE * Service_pend_head
Definition: dic.c:41

+ Here is the call graph for this function:

+ Here is the caller graph for this function: