Logo Search packages:      
Sourcecode: cbmlink version File versions  Download package

static struct hostinfo* comm_init ( const struct commproto protocol,
const char *  dev,
const struct comm **  comm 
) [static, read]

Initialize the communications of a protocol

Parameters:
protocol the protocol
debug flag: enable debugging
dev name of the communication interface device
comm (output) pointer to the communication primitives
Returns:
pointer to host information, or NULL on error

detected host information

Definition at line 218 of file commsel.c.

References commproto::comm, commproto::comm_close, comm_close, commproto::comm_init, and commproto::name.

Referenced by establish().

{
  /** detected host information */
  static struct hostinfo hostinfo;
  int status;
  comm_close = protocol->comm_close;
  status = (*protocol->comm_init) (dev, &hostinfo);
  if (status) {
    fprintf (stderr, "init for '%s' returned %d\n", protocol->name, status);
    return 0;
  }
#ifdef COMM_DEBUG
  if (debug) {
    *comm = &debug_comm;
    currentproto = protocol;
  }
  else
#endif /* COMM_DEBUG */
  *comm = &protocol->comm;
  return &hostinfo;
}


Generated by  Doxygen 1.6.0   Back to index