FACT++  1.0
static void ast_conn_h ( int  handle,
int  svr_conn_id,
int  protocol 
)
static

Definition at line 484 of file dna.c.

References DNA_CONNECTION::buffer, DNA_CONNECTION::buffer_size, conn_free(), conn_get(), DIM_ERROR, DIMTCPCNERR, DIMTCPLNERR, Dna_conns, dna_report_error(), dna_start_read(), DNA_CONNECTION::error_ast, FALSE, Memory::malloc(), RD_HDR, DNA_CONNECTION::read_ast, READ_HEADER_SIZE, DNA_CONNECTION::saw_init, STA_CONN, DNA_CONNECTION::state, TCP_RCV_BUF_SIZE, tcpip_failure(), tcpip_open_connection(), and tcpip_start_listen().

485 {
486  register DNA_CONNECTION *dna_connp;
487  register int tcpip_code;
488  register int conn_id;
489 
490  if(protocol){}
491  conn_id = conn_get();
492 /*
493  if(!conn_id)
494  dim_panic("In ast_conn_h: No more connections\n");
495 */
496  dna_connp = &Dna_conns[conn_id] ;
497  dna_connp->error_ast = Dna_conns[svr_conn_id].error_ast;
498  tcpip_code = tcpip_open_connection( conn_id, handle );
499 
500  if(tcpip_failure(tcpip_code))
501  {
502  dna_report_error(conn_id, tcpip_code,
503  "Connecting to", DIM_ERROR, DIMTCPCNERR);
504  conn_free(conn_id);
505  } else {
506  dna_connp->state = RD_HDR;
507  dna_connp->buffer = (int *)malloc((size_t)TCP_RCV_BUF_SIZE);
508 /*
509  if(!dna_connp->buffer)
510  {
511  printf("Error in DNA - handle_connection malloc returned 0\n");
512  fflush(stdout);
513  }
514 */
515  dna_connp->buffer_size = TCP_RCV_BUF_SIZE;
516  dna_connp->read_ast = Dna_conns[svr_conn_id].read_ast;
517  dna_connp->saw_init = FALSE;
518  dna_start_read(conn_id, READ_HEADER_SIZE); /* sizeof(DNA_NET) */
519  /* Connection arrived. Signal upper layer ? */
520  dna_connp->read_ast(conn_id, NULL, 0, STA_CONN);
521  }
522  tcpip_code = tcpip_start_listen(svr_conn_id, ast_conn_h);
523  if(tcpip_failure(tcpip_code))
524  {
525  dna_report_error(svr_conn_id, tcpip_code,
526  "Listening at", DIM_ERROR, DIMTCPLNERR);
527  }
528 }
int tcpip_start_listen(int conn_id, void(*ast_routine)())
Definition: tcpip.c:1308
#define READ_HEADER_SIZE
Definition: dna.c:21
#define FALSE
Definition: dim.h:136
void conn_free(int conn_id)
Definition: conn_handler.c:118
void * malloc()
Definition: EventBuilder.cc:99
#define TCP_RCV_BUF_SIZE
Definition: dim.h:165
void(* error_ast)()
Definition: dim.h:383
CONN_STATE state
Definition: dim.h:390
#define DIMTCPCNERR
Definition: dim_common.h:298
static void ast_conn_h(int handle, int svr_conn_id, int protocol)
Definition: dna.c:484
void dna_report_error(int conn_id, int code, char *routine_name, int severity, int errcode)
Definition: dna.c:903
int saw_init
Definition: dim.h:392
DllExp DIM_NOSHARE DNA_CONNECTION * Dna_conns
Definition: conn_handler.c:31
#define DIMTCPLNERR
Definition: dim_common.h:296
int * buffer
Definition: dim.h:384
Definition: dim.h:190
int dna_start_read(int conn_id, int size)
Definition: dna.c:234
int buffer_size
Definition: dim.h:385
int tcpip_failure(int code)
Definition: tcpip.c:1540
void(* read_ast)()
Definition: dim.h:382
#define STA_CONN
Definition: dim.h:199
int tcpip_open_connection(int conn_id, int path)
Definition: tcpip.c:1332
int conn_get()
Definition: conn_handler.c:79

+ Here is the call graph for this function: