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

Definition at line 551 of file dna.c.

References conn_free(), conn_get(), DIM_ERROR, DIMTCPLNERR, DIMTCPOPERR, Dna_conns, dna_init(), 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.

Referenced by dis_start_serving_dns(), and main().

552 {
553  register DNA_CONNECTION *dna_connp;
554  register int tcpip_code;
555  register int conn_id;
556 
557  dna_init();
558 /*
559  if(!DNA_Initialized)
560  {
561  conn_arr_create(SRC_DNA);
562  DNA_Initialized = TRUE;
563  }
564 */
565  *protocol = PROTOCOL;
566  conn_id = conn_get();
567  dna_connp = &Dna_conns[conn_id];
568 /*
569  if(!conn_id)
570  dim_panic("In dna_open_server: No more connections\n");
571 */
572  dna_connp->protocol = TCPIP;
573  dna_connp->error_ast = error_ast;
574  tcpip_code = tcpip_open_server(conn_id, task, port);
575  if(tcpip_failure(tcpip_code))
576  {
577  dna_report_error(conn_id, tcpip_code,
578  "Opening server port", DIM_ERROR, DIMTCPOPERR);
579  conn_free(conn_id);
580  return(0);
581  }
582  dna_connp->writing = FALSE;
583  dna_connp->read_ast = read_ast;
584  tcpip_code = tcpip_start_listen(conn_id, ast_conn_h);
585  if(tcpip_failure(tcpip_code))
586  {
587  dna_report_error(conn_id, tcpip_code, "Listening at", DIM_ERROR, DIMTCPLNERR);
588  return(0);
589  }
590  return(conn_id);
591 }
int tcpip_start_listen(int conn_id, void(*ast_routine)())
Definition: tcpip.c:1308
int protocol
Definition: dim.h:389
#define TCPIP
Definition: dim.h:194
#define FALSE
Definition: dim.h:136
void conn_free(int conn_id)
Definition: conn_handler.c:118
void(* error_ast)()
Definition: dim.h:383
static void ast_conn_h(int handle, int svr_conn_id, int protocol)
Definition: dna.c:484
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
int dna_init()
Definition: dna.c:530
#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:

+ Here is the caller graph for this function: