FACT++  1.0
static void dis_insert_request ( int  conn_id,
DIC_PACKET dic_packet,
int  size,
int  status 
)
static

Definition at line 1146 of file dis_old.c.

References COMMAND, req_ent::conn_id, cli_ent::conn_id, exit_ent::conn_id, Curr_conn_id, req_ent::delay_delete, DIM_DELETE, dis_dns_ent::dis_client_id, Dis_timer_q, dis_update_service(), dll_get_next(), dll_init(), dll_insert_queue(), serv::dnsp, cli_ent::dnsp, dtq_add_entry(), execute_command(), execute_service(), find_client(), find_release_request(), find_service(), req_ent::first_time, req_ent::format, DIC_PACKET::format, Memory::free(), id_free(), id_get(), Last_client, Memory::malloc(), MONIT_FIRST, MONIT_ONLY, ONCE_ONLY, release_conn(), req_ent::req_id, reqp_ent::reqp, req_ent::reqpp, serv::request_head, cli_ent::requestp_head, req_ent::service_id, DIC_PACKET::service_id, DIC_PACKET::service_name, req_ent::service_ptr, SRC_DIS, req_ent::timeout, DIC_PACKET::timeout, req_ent::timr_ent, req_ent::to_delete, type, req_ent::type, DIC_PACKET::type, and UPDATE.

1147 {
1148  register SERVICE *servp;
1149  register REQUEST *newp, *reqp;
1150  CLIENT *clip;
1151  REQUEST_PTR *reqpp;
1152  int type, new_client = 0, found = 0;
1153  int find_release_request();
1154  DIS_DNS_CONN *dnsp;
1155 
1156  if(size){}
1157  /* status = 1 => new connection, status = -1 => conn. lost */
1158  if(!Client_head)
1159  {
1160  Client_head = (CLIENT *)malloc(sizeof(CLIENT));
1161  dll_init( (DLL *) Client_head );
1162  }
1163  if(status != 0)
1164  {
1165  if(status == -1) /* release all requests from conn_id */
1166  {
1167  release_conn(conn_id, 0, 0);
1168  }
1169  }
1170  else
1171  {
1172  if(!(servp = find_service(dic_packet->service_name)))
1173  {
1174  release_conn(conn_id, 0, 0);
1175  return;
1176  }
1177  dic_packet->type = vtohl(dic_packet->type);
1178  type = dic_packet->type & 0xFFF;
1179  /*
1180  if(type == COMMAND)
1181  {
1182  Curr_conn_id = conn_id;
1183  execute_command(servp, dic_packet);
1184  Curr_conn_id = 0;
1185  return;
1186  }
1187  */
1188  if(type == DIM_DELETE)
1189  {
1190  find_release_request(conn_id, vtohl(dic_packet->service_id));
1191  return;
1192  }
1193  newp = (REQUEST *)/*my_*/malloc(sizeof(REQUEST));
1194  newp->service_ptr = servp;
1195  newp->service_id = vtohl(dic_packet->service_id);
1196  newp->type = dic_packet->type;
1197  newp->timeout = vtohl(dic_packet->timeout);
1198  newp->format = vtohl(dic_packet->format);
1199  newp->conn_id = conn_id;
1200  newp->first_time = 1;
1201  newp->delay_delete = 0;
1202  newp->to_delete = 0;
1203  newp->timr_ent = 0;
1204  newp->req_id = id_get((void *)newp, SRC_DIS);
1205  newp->reqpp = 0;
1206  if(type == ONCE_ONLY)
1207  {
1208  execute_service(newp->req_id);
1209  id_free(newp->req_id, SRC_DIS);
1210  free(newp);
1211  return;
1212  }
1213  if(type == COMMAND)
1214  {
1215  Curr_conn_id = conn_id;
1216  execute_command(servp, dic_packet);
1217  Curr_conn_id = 0;
1218  reqp = servp->request_head;
1219  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1220  (DLL *) reqp)) )
1221  {
1222  if(reqp->conn_id == conn_id)
1223  {
1224  id_free(newp->req_id, SRC_DIS);
1225  free(newp);
1226  found = 1;
1227  break;
1228  }
1229  }
1230  if(!found)
1231  dll_insert_queue( (DLL *) servp->request_head, (DLL *) newp );
1232  return;
1233  }
1234  dll_insert_queue( (DLL *) servp->request_head, (DLL *) newp );
1235  if(!(clip = find_client(conn_id)))
1236  {
1237  clip = (CLIENT *)malloc(sizeof(CLIENT));
1238  clip->conn_id = conn_id;
1239  clip->dnsp = servp->dnsp;
1240  clip->requestp_head = (REQUEST_PTR *)malloc(sizeof(REQUEST_PTR));
1241  dll_init( (DLL *) clip->requestp_head );
1242  dll_insert_queue( (DLL *) Client_head, (DLL *) clip );
1243  new_client = 1;
1244  }
1245  reqpp = (REQUEST_PTR *)malloc(sizeof(REQUEST_PTR));
1246  reqpp->reqp = newp;
1247  dll_insert_queue( (DLL *) clip->requestp_head, (DLL *) reqpp );
1248  newp->reqpp = reqpp;
1249  if((type != MONIT_ONLY) && (type != UPDATE))
1250  {
1251  execute_service(newp->req_id);
1252  }
1253  if((type != MONIT_ONLY) && (type != MONIT_FIRST))
1254  {
1255  if(newp->timeout != 0)
1256  {
1258  newp->timeout,
1260  newp->req_id );
1261  }
1262  }
1263  if(new_client)
1264  {
1265  Last_client = conn_id;
1266  dnsp = clip->dnsp;
1267  if(dnsp->dis_client_id)
1269  }
1270  }
1271 }
int execute_service(int req_id)
Definition: dis_old.c:1275
DIS_DNS_CONN * dnsp
Definition: dis.c:87
int type
Definition: dim.h:234
static int Dis_timer_q
Definition: dis_old.c:141
#define MONIT_FIRST
Definition: dim_common.h:15
char service_name[MAX_NAME]
Definition: dim.h:232
int service_id
Definition: dim.h:233
#define COMMAND
Definition: dim_common.h:10
int to_delete
Definition: dis.c:64
int service_id
Definition: dis.c:56
void dll_insert_queue(DLL *head, DLL *item)
Definition: dll.c:23
int find_release_request(int conn_id, int service_id)
Definition: dis_old.c:2302
Definition: dis.c:98
int timeout
Definition: dim.h:235
static CLIENT * Client_head
Definition: dis_old.c:106
void * malloc()
Definition: EventBuilder.cc:99
void dll_init(DLL *head)
Definition: dll.c:14
TIMR_ENT * timr_ent
Definition: dis.c:65
int format
Definition: dis.c:61
#define UPDATE
Definition: dim_common.h:13
struct reqp_ent * reqpp
Definition: dis.c:66
static int Last_client
Definition: dis_old.c:147
static int Curr_conn_id
Definition: dis_old.c:123
Definition: dim.h:530
int conn_id
Definition: dis.c:101
Definition: dis.c:69
int type
REQUEST * request_head
Definition: dis.c:86
DIS_DNS_CONN * dnsp
Definition: dis.c:103
int dis_update_service(unsigned service_id)
Definition: dis_old.c:1517
REQUEST_PTR * requestp_head
Definition: dis.c:102
CLIENT * find_client(int conn_id)
Definition: dis_old.c:2148
struct serv * service_ptr
Definition: dis.c:59
int first_time
Definition: dis.c:62
void execute_command(SERVICE *servp, DIC_PACKET *packet)
Definition: dis_old.c:1421
SERVICE * find_service(char *name)
Definition: dis_old.c:2143
int size
Definition: db_dim_server.c:17
void id_free(int id, SRC_TYPES type)
Definition: conn_handler.c:206
int format
Definition: dim.h:236
void free(void *mem)
TIMR_ENT * dtq_add_entry(int queue_id, int time, void(*user_routine)(), dim_long tag)
Definition: dtq.c:399
int type
Definition: dis.c:58
int delay_delete
Definition: dis.c:63
int timeout
Definition: dis.c:60
DLL * dll_get_next(DLL *head, DLL *item)
Definition: dll.c:66
Definition: dis.c:92
REQUEST * reqp
Definition: dis.c:95
int id_get(void *ptr, SRC_TYPES type)
Definition: conn_handler.c:152
int req_id
Definition: dis.c:57
static int release_conn(int conn_id, int print_flg, int dns_flag)
Definition: dis_old.c:2374
#define ONCE_ONLY
Definition: dim_common.h:7
unsigned int dis_client_id
Definition: dis.c:48
int conn_id
Definition: dis.c:55
Definition: dis.c:52
#define DIM_DELETE
Definition: dim_common.h:11
#define MONIT_ONLY
Definition: dim_common.h:12

+ Here is the call graph for this function: