FACT++  1.0
void dis_send_service ( unsigned  service_id,
int *  buffer,
int  size 
)

Definition at line 1869 of file dis_old.c.

References DIS_PACKET::buffer, req_ent::conn_id, DIM_ERROR, DIMSVCINVAL, DIS_HEADER, dll_get_next(), dna_write_nowait(), error_handler(), Memory::free(), id_get_ptr(), Memory::malloc(), release_conn(), serv::request_head, req_ent::service_id, DIS_PACKET::service_id, size, DIS_PACKET::size, sprintf(), SRC_DIS, and str.

Referenced by dis_hash_print().

1870 {
1871  register REQUEST *reqp, *prevp;
1872  register SERVICE *servp;
1873  static DIS_PACKET *dis_packet;
1874  static int packet_size = 0;
1875  int conn_id;
1876  char str[128];
1877 
1878  DISABLE_AST
1879  if( !service_id ) {
1880  sprintf(str,"Send Service - Invalid service id");
1882  ENABLE_AST
1883  return;
1884  }
1885  servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
1886  if(!packet_size)
1887  {
1888  dis_packet = (DIS_PACKET *)malloc(DIS_HEADER+size);
1889  packet_size = DIS_HEADER + size;
1890  }
1891  else
1892  {
1893  if( DIS_HEADER+size > packet_size )
1894  {
1895  free(dis_packet);
1896  dis_packet = (DIS_PACKET *)malloc(DIS_HEADER+size);
1897  packet_size = DIS_HEADER+size;
1898  }
1899  }
1900  prevp = servp->request_head;
1901  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1902  (DLL *) prevp)) )
1903  {
1904  dis_packet->service_id = htovl(reqp->service_id);
1905  memcpy(dis_packet->buffer, buffer, size);
1906  dis_packet->size = htovl(DIS_HEADER + size);
1907 
1908  conn_id = reqp->conn_id;
1909  if( !dna_write_nowait(conn_id, dis_packet, size + DIS_HEADER) )
1910  {
1911  release_conn(conn_id, 1, 0);
1912  }
1913  else
1914  prevp = reqp;
1915  }
1916  ENABLE_AST
1917 }
unsigned service_id
Definition: db_dim_client.c:22
char str[80]
Definition: test_client.c:7
void * id_get_ptr(int id, SRC_TYPES type)
Definition: conn_handler.c:184
int service_id
Definition: dis.c:56
void * malloc()
Definition: EventBuilder.cc:99
Definition: dim.h:530
Definition: dis.c:69
REQUEST * request_head
Definition: dis.c:86
int size
Definition: dim.h:244
int service_id
Definition: dim.h:245
#define DIMSVCINVAL
Definition: dim_common.h:290
int dna_write_nowait(int conn_id, void *buffer, int size)
Definition: dna.c:412
int buffer[BUFFSIZE]
Definition: db_dim_client.c:14
int size
Definition: db_dim_server.c:17
static void error_handler(int conn_id, int severity, int errcode, char *reason)
Definition: dis_old.c:2827
int buffer[1]
Definition: dim.h:246
void free(void *mem)
DLL * dll_get_next(DLL *head, DLL *item)
Definition: dll.c:66
static int release_conn(int conn_id, int print_flg, int dns_flag)
Definition: dis_old.c:2374
#define DIS_HEADER
Definition: dim.h:249
int conn_id
Definition: dis.c:55
Definition: dis.c:52
sprintf(name1,"NewService%d", i)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: