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

Definition at line 11 of file webTcpip.c.

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

Referenced by web_open_server().

12 {
13  register DNA_CONNECTION *dna_connp;
14  register int tcpip_code;
15  register int conn_id;
16  int web_start_read();
17 
18  if(protocol){}
19  conn_id = conn_get();
20 /*
21  if(!conn_id)
22  dim_panic("In ast_conn_h: No more connections\n");
23 */
24  dna_connp = &Dna_conns[conn_id] ;
25  dna_connp->error_ast = Dna_conns[svr_conn_id].error_ast;
26  tcpip_code = tcpip_open_connection( conn_id, handle );
27 
28  if(tcpip_failure(tcpip_code))
29  {
30  dna_report_error(conn_id, tcpip_code,
31  "Connecting to", DIM_ERROR, DIMTCPCNERR);
32  conn_free(conn_id);
33  } else {
34  dna_connp->state = RD_HDR;
35  dna_connp->buffer = (int *)malloc(TCP_RCV_BUF_SIZE);
36  memset(dna_connp->buffer, 0, TCP_RCV_BUF_SIZE);
37 /*
38  if(!dna_connp->buffer)
39  {
40  printf("Error in DNA - handle_connection malloc returned 0\n");
41  fflush(stdout);
42  }
43 */
44  dna_connp->buffer_size = TCP_RCV_BUF_SIZE;
45  dna_connp->read_ast = Dna_conns[svr_conn_id].read_ast;
46  dna_connp->saw_init = FALSE;
47  web_start_read(conn_id, TCP_RCV_BUF_SIZE); /* sizeof(DNA_NET) */
48  /* Connection arrived. Signal upper layer ? */
49  dna_connp->read_ast(conn_id, NULL, 0, STA_CONN);
50  }
51  tcpip_code = tcpip_start_listen(svr_conn_id, ast_conn_h);
52  if(tcpip_failure(tcpip_code))
53  {
54  dna_report_error(svr_conn_id, tcpip_code,
55  "Listening at", DIM_ERROR, DIMTCPLNERR);
56  }
57 }
int tcpip_start_listen(int conn_id, void(*ast_routine)())
Definition: tcpip.c:1308
static void ast_conn_h(int handle, int svr_conn_id, int protocol)
Definition: webTcpip.c:11
#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
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 web_start_read(int conn_id, int size)
Definition: webTcpip.c:149
int * buffer
Definition: dim.h:384
Definition: dim.h:190
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:

+ Here is the caller graph for this function: