Example #1
0
static inline int
irnet_open_tsap(irnet_socket *	self)
{
  notify_t	notify;		

  DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);

  DABORT(self->tsap != NULL, -EBUSY, IRDA_SR_ERROR, "Already busy !\n");

  
  irda_notify_init(&notify);
  notify.connect_confirm	= irnet_connect_confirm;
  notify.connect_indication	= irnet_connect_indication;
  notify.disconnect_indication	= irnet_disconnect_indication;
  notify.data_indication	= irnet_data_indication;
  
  notify.flow_indication	= irnet_flow_indication;
  notify.status_indication	= irnet_status_indication;
  notify.instance		= self;
  strlcpy(notify.name, IRNET_NOTIFY_NAME, sizeof(notify.name));

  
  self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT,
			       &notify);
  DABORT(self->tsap == NULL, -ENOMEM,
	 IRDA_SR_ERROR, "Unable to allocate TSAP !\n");

  
  self->stsap_sel = self->tsap->stsap_sel;

  DEXIT(IRDA_SR_TRACE, " - tsap=0x%p, sel=0x%X\n",
	self->tsap, self->stsap_sel);
  return 0;
}
Example #2
0
/*
 * Function ircomm_open_tsap (self)
 *
 *    
 *
 */
int ircomm_open_tsap(struct ircomm_cb *self)
{
	notify_t notify;

	IRDA_DEBUG(4, "%s()\n", __FUNCTION__);

	/* Register callbacks */
	irda_notify_init(&notify);
	notify.data_indication       = ircomm_ttp_data_indication;
	notify.connect_confirm       = ircomm_ttp_connect_confirm;
	notify.connect_indication    = ircomm_ttp_connect_indication;
	notify.flow_indication       = ircomm_ttp_flow_indication;
	notify.disconnect_indication = ircomm_ttp_disconnect_indication;
	notify.instance = self;
	strncpy(notify.name, "IrCOMM", NOTIFY_MAX_NAME);

	self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT,
				     &notify);
	if (!self->tsap) {
		IRDA_DEBUG(0, "%s failed to allocate tsap\n", __FUNCTION__);
		return -1;
	}
	self->slsap_sel = self->tsap->stsap_sel;

	/*
	 *  Initialize the call-table for issuing commands
	 */
	self->issue.data_request       = ircomm_ttp_data_request;
	self->issue.connect_request    = ircomm_ttp_connect_request;
	self->issue.connect_response   = ircomm_ttp_connect_response;
	self->issue.disconnect_request = ircomm_ttp_disconnect_request;

	return 0;
}
Example #3
0
/*
 * Function irda_open_tsap (self)
 *
 *    Open local Transport Service Access Point (TSAP)
 *
 * Create a IrTTP instance for us and set all the IrTTP callbacks.
 */
static inline int
irnet_open_tsap(irnet_socket *	self)
{
  notify_t	notify;		/* Callback structure */

  DENTER(IRDA_SR_TRACE, "(self=0x%X)\n", (unsigned int) self);

  DABORT(self->tsap != NULL, -EBUSY, IRDA_SR_ERROR, "Already busy !\n");

  /* Initialize IrTTP callbacks to be used by the IrDA stack */
  irda_notify_init(&notify);
  notify.connect_confirm	= irnet_connect_confirm;
  notify.connect_indication	= irnet_connect_indication;
  notify.disconnect_indication	= irnet_disconnect_indication;
  notify.data_indication	= irnet_data_indication;
  /*notify.udata_indication	= NULL;*/
  notify.flow_indication	= irnet_flow_indication;
  notify.status_indication	= irnet_status_indication;
  notify.instance		= self;
  strncpy(notify.name, IRNET_NOTIFY_NAME, NOTIFY_MAX_NAME);

  /* Open an IrTTP instance */
  self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT,
			       &notify);	
  DABORT(self->tsap == NULL, -ENOMEM,
	 IRDA_SR_ERROR, "Unable to allocate TSAP !\n");

  /* Remember which TSAP selector we actually got */
  self->stsap_sel = self->tsap->stsap_sel;

  DEXIT(IRDA_SR_TRACE, " - tsap=0x%X, sel=0x%X\n",
	(unsigned int) self->tsap, self->stsap_sel);
  return 0;
}