FACT++  1.0
void execute_command ( SERVICE servp,
DIC_PACKET packet 
)

Definition at line 1421 of file dis_old.c.

References buffer, DIC_PACKET::buffer, copy_swap_buffer_in(), DIC_HEADER, dis_set_timestamp(), FORMAT_STR::flags, DIC_PACKET::format, serv::format_data, Memory::free(), serv::id, IT_IS_FLOAT, Memory::malloc(), MAX_NAME, FORMAT_STR::par_bytes, size, DIC_PACKET::size, serv::tag, and serv::user_routine.

Referenced by dis_insert_request().

1422 {
1423  int size;
1424  int format;
1425  FORMAT_STR format_data_cp[MAX_NAME/4], *formatp;
1426  static int *buffer;
1427  static int buffer_size = 0;
1428  int add_size;
1429 
1430  size = vtohl(packet->size) - DIC_HEADER;
1431  add_size = size + (size/2);
1432  if(!buffer_size)
1433  {
1434  buffer = (int *)malloc(add_size);
1435  buffer_size = add_size;
1436  }
1437  else
1438  {
1439  if( add_size > buffer_size )
1440  {
1441  free(buffer);
1442  buffer = (int *)malloc(add_size);
1443  buffer_size = add_size;
1444  }
1445  }
1446 
1447  dis_set_timestamp(servp->id, 0, 0);
1448  if(servp->user_routine != 0)
1449  {
1450  format = vtohl(packet->format);
1451  memcpy(format_data_cp, servp->format_data, sizeof(format_data_cp));
1452  if((format & 0xF) == ((MY_FORMAT) & 0xF))
1453  {
1454  for(formatp = format_data_cp; formatp->par_bytes; formatp++)
1455  {
1456  if(formatp->flags & IT_IS_FLOAT)
1457  formatp->flags |= (format & 0xf0);
1458  formatp->flags &= 0xFFF0; /* NOSWAP */
1459  }
1460  }
1461  else
1462  {
1463  for(formatp = format_data_cp; formatp->par_bytes; formatp++)
1464  {
1465  if(formatp->flags & IT_IS_FLOAT)
1466  formatp->flags |= (format & 0xf0);
1467  }
1468  }
1469  size = copy_swap_buffer_in(format_data_cp,
1470  buffer,
1471  packet->buffer, size);
1472  (servp->user_routine)(&servp->tag, buffer, &size);
1473  }
1474 }
#define MAX_NAME
Definition: dim.h:182
int copy_swap_buffer_in(FORMAT_STR *format_data, void *buff_out, void *buff_in, int size)
Definition: copy_swap.c:270
int dis_set_timestamp(unsigned serv_id, int secs, int millisecs)
Definition: dis_old.c:1776
short flags
Definition: dim.h:219
void * malloc()
Definition: EventBuilder.cc:99
#define DIC_HEADER
Definition: dim.h:240
dim_long tag
Definition: dis.c:80
short par_bytes
Definition: dim.h:218
FORMAT_STR format_data[MAX_NAME/4]
Definition: dis.c:76
#define IT_IS_FLOAT
Definition: dim.h:27
void(* user_routine)()
Definition: dis.c:79
int buffer[BUFFSIZE]
Definition: db_dim_client.c:14
int size
Definition: dim.h:231
int size
Definition: db_dim_server.c:17
int buffer[1]
Definition: dim.h:237
int format
Definition: dim.h:236
void free(void *mem)
int id
Definition: dis.c:73

+ Here is the call graph for this function:

+ Here is the caller graph for this function: