FACT++  1.0
int web_open_server ( char *  task,
void(*)()  read_ast,
int *  protocol,
int *  port,
void(*)()  error_ast 
)

Definition at line 199 of file webTcpip.c.

References ast_conn_h(), conn_free(), conn_get(), DIM_ERROR, DIMTCPLNERR, DIMTCPOPERR, dna_close(), Dna_conns, dna_open_client(), dna_report_error(), DNA_CONNECTION::error_ast, FALSE, DNA_CONNECTION::protocol, DNA_CONNECTION::read_ast, TCPIP, tcpip_failure(), tcpip_open_server(), tcpip_start_listen(), and DNA_CONNECTION::writing.

200 {
201  register DNA_CONNECTION *dna_connp;
202  register int tcpip_code;
203  register int conn_id;
204 
205  conn_id = dna_open_client("", "", 0, 0,
206  0, 0, 0);
207  dna_close(conn_id);
208 /*
209  if(!DNA_Initialized)
210  {
211  conn_arr_create(SRC_DNA);
212  DNA_Initialized = TRUE;
213  }
214 */
215  *protocol = PROTOCOL;
216  conn_id = conn_get();
217  dna_connp = &Dna_conns[conn_id];
218 /*
219  if(!conn_id)
220  dim_panic("In dna_open_server: No more connections\n");
221 */
222  dna_connp->protocol = TCPIP;
223  dna_connp->error_ast = error_ast;
224  tcpip_code = tcpip_open_server(conn_id, task, port);
225  if(tcpip_failure(tcpip_code))
226  {
227  dna_report_error(conn_id, tcpip_code,
228  "Opening server port", DIM_ERROR, DIMTCPOPERR);
229  conn_free(conn_id);
230  return(0);
231  }
232  dna_connp->writing = FALSE;
233  dna_connp->read_ast = read_ast;
234  tcpip_code = tcpip_start_listen(conn_id, ast_conn_h);
235  if(tcpip_failure(tcpip_code))
236  {
237  dna_report_error(conn_id, tcpip_code, "Listening at", DIM_ERROR, DIMTCPLNERR);
238  return(0);
239  }
240  return(conn_id);
241 }
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
int protocol
Definition: dim.h:389
int dna_open_client(char *server_node, char *server_task, int port, int server_protocol, void(*read_ast)(), void(*error_ast)(), SRC_TYPES src_type)
Definition: dna.c:733
#define TCPIP
Definition: dim.h:194
#define FALSE
Definition: dim.h:136
int dna_close(int conn_id)
Definition: dna.c:835
void conn_free(int conn_id)
Definition: conn_handler.c:118
void(* error_ast)()
Definition: dim.h:383
int writing
Definition: dim.h:391
void dna_report_error(int conn_id, int code, char *routine_name, int severity, int errcode)
Definition: dna.c:903
DllExp DIM_NOSHARE DNA_CONNECTION * Dna_conns
Definition: conn_handler.c:31
#define DIMTCPLNERR
Definition: dim_common.h:296
int tcpip_open_server(int conn_id, char *task, int *port)
Definition: tcpip.c:1182
int tcpip_failure(int code)
Definition: tcpip.c:1540
void(* read_ast)()
Definition: dim.h:382
#define DIMTCPOPERR
Definition: dim_common.h:297
int conn_get()
Definition: conn_handler.c:79

+ Here is the call graph for this function: