亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? irnet_irda.c

?? 優龍2410linux2.6.8內核源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* *	IrNET protocol module : Synchronous PPP over an IrDA socket. * *		Jean II - HPL `00 - <jt@hpl.hp.com> * * This file implement the IRDA interface of IrNET. * Basically, we sit on top of IrTTP. We set up IrTTP, IrIAS properly, * and exchange frames with IrTTP. */#include "irnet_irda.h"		/* Private header *//************************* CONTROL CHANNEL *************************//* * When ppp is not active, /dev/irnet act as a control channel. * Writing allow to set up the IrDA destination of the IrNET channel, * and any application may be read events happening on IrNET... *//*------------------------------------------------------------------*//* * Post an event to the control channel... * Put the event in the log, and then wait all process blocked on read * so they can read the log... */static voidirnet_post_event(irnet_socket *	ap,		 irnet_event	event,		 __u32		saddr,		 __u32		daddr,		 char *		name,		 __u16		hints){  int			index;		/* In the log */  DENTER(CTRL_TRACE, "(ap=0x%p, event=%d, daddr=%08x, name=``%s'')\n",	 ap, event, daddr, name);  /* Protect this section via spinlock.   * Note : as we are the only event producer, we only need to exclude   * ourself when touching the log, which is nice and easy.   */  spin_lock_bh(&irnet_events.spinlock);  /* Copy the event in the log */  index = irnet_events.index;  irnet_events.log[index].event = event;  irnet_events.log[index].daddr = daddr;  irnet_events.log[index].saddr = saddr;  /* Try to copy IrDA nickname */  if(name)    strcpy(irnet_events.log[index].name, name);  else    irnet_events.log[index].name[0] = '\0';  /* Copy hints */  irnet_events.log[index].hints.word = hints;  /* Try to get ppp unit number */  if((ap != (irnet_socket *) NULL) && (ap->ppp_open))    irnet_events.log[index].unit = ppp_unit_number(&ap->chan);  else    irnet_events.log[index].unit = -1;  /* Increment the index   * Note that we increment the index only after the event is written,   * to make sure that the readers don't get garbage... */  irnet_events.index = (index + 1) % IRNET_MAX_EVENTS;  DEBUG(CTRL_INFO, "New event index is %d\n", irnet_events.index);  /* Spin lock end */  spin_unlock_bh(&irnet_events.spinlock);  /* Now : wake up everybody waiting for events... */  wake_up_interruptible_all(&irnet_events.rwait);  DEXIT(CTRL_TRACE, "\n");}/************************* IRDA SUBROUTINES *************************//* * These are a bunch of subroutines called from other functions * down there, mostly common code or to improve readability... * * Note : we duplicate quite heavily some routines of af_irda.c, * because our input structure (self) is quite different * (struct irnet instead of struct irda_sock), which make sharing * the same code impossible (at least, without templates). *//*------------------------------------------------------------------*//* * 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 intirnet_open_tsap(irnet_socket *	self){  notify_t	notify;		/* Callback structure */  DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", 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;  strlcpy(notify.name, IRNET_NOTIFY_NAME, sizeof(notify.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%p, sel=0x%X\n",	self->tsap, self->stsap_sel);  return 0;}/*------------------------------------------------------------------*//* * Function irnet_ias_to_tsap (self, result, value) * *    Examine an IAS object and extract TSAP * * We do an IAP query to find the TSAP associated with the IrNET service. * When IrIAP pass us the result of the query, this function look at * the return values to check for failures and extract the TSAP if * possible. * Also deallocate value * The failure is in self->errno * Return TSAP or -1 */static inline __u8irnet_ias_to_tsap(irnet_socket *	self,		  int			result,		  struct ias_value *	value){  __u8	dtsap_sel = 0;		/* TSAP we are looking for */  DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);  /* By default, no error */  self->errno = 0;  /* Check if request succeeded */  switch(result)    {      /* Standard errors : service not available */    case IAS_CLASS_UNKNOWN:    case IAS_ATTRIB_UNKNOWN:      DEBUG(IRDA_SR_INFO, "IAS object doesn't exist ! (%d)\n", result);      self->errno = -EADDRNOTAVAIL;      break;      /* Other errors, most likely IrDA stack failure */    default :      DEBUG(IRDA_SR_INFO, "IAS query failed ! (%d)\n", result);      self->errno = -EHOSTUNREACH;      break;      /* Success : we got what we wanted */    case IAS_SUCCESS:      break;    }  /* Check what was returned to us */  if(value != NULL)    {      /* What type of argument have we got ? */      switch(value->type)	{	case IAS_INTEGER:	  DEBUG(IRDA_SR_INFO, "result=%d\n", value->t.integer);	  if(value->t.integer != -1)	    /* Get the remote TSAP selector */	    dtsap_sel = value->t.integer;	  else 	    self->errno = -EADDRNOTAVAIL;	  break;	default:	  self->errno = -EADDRNOTAVAIL;	  DERROR(IRDA_SR_ERROR, "bad type ! (0x%X)\n", value->type);	  break;	}      /* Cleanup */      irias_delete_value(value);    }  else	/* value == NULL */    {      /* Nothing returned to us - usually result != SUCCESS */      if(!(self->errno))	{	  DERROR(IRDA_SR_ERROR,		 "IrDA bug : result == SUCCESS && value == NULL\n");	  self->errno = -EHOSTUNREACH;	}    }  DEXIT(IRDA_SR_TRACE, "\n");  /* Return the TSAP */  return(dtsap_sel);}/*------------------------------------------------------------------*//* * Function irnet_find_lsap_sel (self) * *    Try to lookup LSAP selector in remote LM-IAS * * Basically, we start a IAP query, and then go to sleep. When the query * return, irnet_getvalue_confirm will wake us up, and we can examine the * result of the query... * Note that in some case, the query fail even before we go to sleep, * creating some races... */static inline intirnet_find_lsap_sel(irnet_socket *	self){  DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);  /* This should not happen */  DABORT(self->iriap, -EBUSY, IRDA_SR_ERROR, "busy with a previous query.\n");  /* Create an IAP instance, will be closed in irnet_getvalue_confirm() */  self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,			   irnet_getvalue_confirm);  /* Treat unexpected signals as disconnect */  self->errno = -EHOSTUNREACH;  /* Query remote LM-IAS */  iriap_getvaluebyclass_request(self->iriap, self->rsaddr, self->daddr,				IRNET_SERVICE_NAME, IRNET_IAS_VALUE);  /* The above request is non-blocking.   * After a while, IrDA will call us back in irnet_getvalue_confirm()   * We will then call irnet_ias_to_tsap() and finish the   * connection procedure */  DEXIT(IRDA_SR_TRACE, "\n");  return 0;}/*------------------------------------------------------------------*//* * Function irnet_connect_tsap (self) * *    Initialise the TTP socket and initiate TTP connection * */static inline intirnet_connect_tsap(irnet_socket *	self){  int		err;  DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);  /* Open a local TSAP (an IrTTP instance) */  err = irnet_open_tsap(self);  if(err != 0)    {      clear_bit(0, &self->ttp_connect);      DERROR(IRDA_SR_ERROR, "connect aborted!\n");      return(err);    }  /* Connect to remote device */  err = irttp_connect_request(self->tsap, self->dtsap_sel, 			      self->rsaddr, self->daddr, NULL, 			      self->max_sdu_size_rx, NULL);  if(err != 0)    {      clear_bit(0, &self->ttp_connect);      DERROR(IRDA_SR_ERROR, "connect aborted!\n");      return(err);    }  /* The above call is non-blocking.   * After a while, the IrDA stack will either call us back in   * irnet_connect_confirm() or irnet_disconnect_indication()   * See you there ;-) */  DEXIT(IRDA_SR_TRACE, "\n");  return(err);}/*------------------------------------------------------------------*//* * Function irnet_discover_next_daddr (self) * *    Query the IrNET TSAP of the next device in the log. * * Used in the TSAP discovery procedure. */static inline intirnet_discover_next_daddr(irnet_socket *	self){  /* Close the last instance of IrIAP, and open a new one.   * We can't reuse the IrIAP instance in the IrIAP callback */  if(self->iriap)    {      iriap_close(self->iriap);      self->iriap = NULL;    }  /* Create a new IAP instance */  self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,			   irnet_discovervalue_confirm);  if(self->iriap == NULL)    return -ENOMEM;  /* Next discovery - before the call to avoid races */  self->disco_index++;  /* Check if we have one more address to try */  if(self->disco_index < self->disco_number)    {      /* Query remote LM-IAS */      iriap_getvaluebyclass_request(self->iriap,				    self->discoveries[self->disco_index].saddr,				    self->discoveries[self->disco_index].daddr,				    IRNET_SERVICE_NAME, IRNET_IAS_VALUE);      /* The above request is non-blocking.       * After a while, IrDA will call us back in irnet_discovervalue_confirm()       * We will then call irnet_ias_to_tsap() and come back here again... */      return(0);    }  else    return(1);}/*------------------------------------------------------------------*//* * Function irnet_discover_daddr_and_lsap_sel (self) * *    This try to find a device with the requested service. * * Initiate a TSAP discovery procedure. * It basically look into the discovery log. For each address in the list, * it queries the LM-IAS of the device to find if this device offer * the requested service. * If there is more than one node supporting the service, we complain * to the user (it should move devices around). * If we find one node which have the requested TSAP, we connect to it. * * This function just start the whole procedure. It request the discovery * log and submit the first IAS query. * The bulk of the job is handled in irnet_discovervalue_confirm() * * Note : this procedure fails if there is more than one device in range * on the same dongle, because IrLMP doesn't disconnect the LAP when the * last LSAP is closed. Moreover, we would need to wait the LAP * disconnection... */static inline intirnet_discover_daddr_and_lsap_sel(irnet_socket *	self){  int	ret;  DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);  /* Ask lmp for the current discovery log */  self->discoveries = irlmp_get_discoveries(&self->disco_number, self->mask,					    DISCOVERY_DEFAULT_SLOTS);  /* Check if the we got some results */  if(self->discoveries == NULL)    {      self->disco_number = -1;      clear_bit(0, &self->ttp_connect);      DRETURN(-ENETUNREACH, IRDA_SR_INFO, "No Cachelog...\n");    }  DEBUG(IRDA_SR_INFO, "Got the log (0x%p), size is %d\n",	self->discoveries, self->disco_number);  /* Start with the first discovery */  self->disco_index = -1;  self->daddr = DEV_ADDR_ANY;  /* This will fail if the log is empty - this is non-blocking */  ret = irnet_discover_next_daddr(self);  if(ret)    {      /* Close IAP */      if(self->iriap)	iriap_close(self->iriap);      self->iriap = NULL;      /* Cleanup our copy of the discovery log */      kfree(self->discoveries);      self->discoveries = NULL;      clear_bit(0, &self->ttp_connect);      DRETURN(-ENETUNREACH, IRDA_SR_INFO, "Cachelog empty...\n");    }  /* Follow me in irnet_discovervalue_confirm() */  DEXIT(IRDA_SR_TRACE, "\n");  return(0);}/*------------------------------------------------------------------*//* * Function irnet_dname_to_daddr (self) * *    Convert an IrDA nickname to a valid IrDA address * * It basically look into the discovery log until there is a match. */static inline intirnet_dname_to_daddr(irnet_socket *	self){  struct irda_device_info *discoveries;	/* Copy of the discovery log */  int	number;			/* Number of nodes in the log */  int	i;  DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self);  /* Ask lmp for the current discovery log */  discoveries = irlmp_get_discoveries(&number, 0xffff,				      DISCOVERY_DEFAULT_SLOTS);  /* Check if the we got some results */  if(discoveries == NULL)    DRETURN(-ENETUNREACH, IRDA_SR_INFO, "Cachelog empty...\n");  /*    * Now, check all discovered devices (if any), and connect   * client only about the services that the client is   * interested in...   */  for(i = 0; i < number; i++)    {      /* Does the name match ? */      if(!strncmp(discoveries[i].info, self->rname, NICKNAME_MAX_LEN))	{	  /* Yes !!! Get it.. */	  self->daddr = discoveries[i].daddr;	  DEBUG(IRDA_SR_INFO, "discovered device ``%s'' at address 0x%08x.\n",		self->rname, self->daddr);	  kfree(discoveries);	  DEXIT(IRDA_SR_TRACE, "\n");	  return 0;	}    }  /* No luck ! */  DEBUG(IRDA_SR_INFO, "cannot discover device ``%s'' !!!\n", self->rname);  kfree(discoveries);  return(-EADDRNOTAVAIL);}/************************* SOCKET ROUTINES *************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
538在线一区二区精品国产| 91美女片黄在线观看91美女| 欧美一级生活片| 日本不卡视频一二三区| 制服丝袜亚洲精品中文字幕| 日韩激情一二三区| 精品播放一区二区| 成人av影院在线| 亚洲少妇屁股交4| 欧美日本国产视频| 日本视频免费一区| 国产亚洲精品中文字幕| 91老师国产黑色丝袜在线| 亚洲超丰满肉感bbw| 欧美一区二区不卡视频| 国产精品一二三在| 亚洲最新视频在线播放| 日韩亚洲欧美在线观看| 成人小视频免费在线观看| 亚洲手机成人高清视频| 91精品国产综合久久香蕉的特点| 国产精品一品二品| 一二三区精品视频| 国产日韩欧美精品综合| 欧美日韩中文另类| 国产精品自拍网站| 亚洲成人av电影在线| 久久久久久9999| 欧美猛男男办公室激情| 高清不卡一区二区在线| 午夜私人影院久久久久| 中文字幕不卡三区| 日韩欧美黄色影院| 色美美综合视频| 日本91福利区| 一区二区三区不卡视频| 337p日本欧洲亚洲大胆精品| 欧美最猛性xxxxx直播| 国产成人精品综合在线观看| 亚洲综合成人在线| 国产精品久久久久影院| 日韩精品一区二区三区视频在线观看| 一本大道久久精品懂色aⅴ| 精品一区二区三区的国产在线播放| 亚洲男人天堂av| 欧美激情一区二区三区四区| 欧美一级高清大全免费观看| 91日韩精品一区| 国产麻豆9l精品三级站| 视频一区二区中文字幕| 亚洲影视资源网| 国产精品国产a| 国产午夜精品一区二区三区四区 | 亚洲与欧洲av电影| 久久久精品免费观看| 日韩欧美国产不卡| 5566中文字幕一区二区电影| 日本高清不卡一区| 91在线精品秘密一区二区| 国产激情视频一区二区三区欧美 | 亚洲国产精品影院| 国产精品国产馆在线真实露脸| 2023国产精品| 精品国产1区二区| 日韩三级精品电影久久久| 欧美日韩国产小视频在线观看| 欧美在线免费播放| 在线精品视频免费播放| 欧美午夜免费电影| 欧美性生活大片视频| 欧美视频精品在线观看| 欧美性色欧美a在线播放| 一本色道a无线码一区v| 99r国产精品| 91视频在线观看免费| av在线播放一区二区三区| 97久久精品人人做人人爽50路 | 亚洲丝袜美腿综合| 亚洲欧美日韩国产另类专区| 综合久久一区二区三区| 亚洲天堂网中文字| 亚洲综合丁香婷婷六月香| 亚洲一区二区三区小说| 午夜欧美电影在线观看| 日韩黄色小视频| 国产一区二区美女诱惑| 国产成人免费视频一区| 一本色道久久加勒比精品| 欧美视频在线不卡| 欧美哺乳videos| 久久久99精品久久| 日韩理论片在线| 亚洲一区中文在线| 免费成人美女在线观看.| 国产一区二区在线影院| 成人精品小蝌蚪| 在线区一区二视频| 日韩欧美你懂的| 中文一区二区在线观看| 亚洲一区二区高清| 精品一区二区精品| 99久久99久久免费精品蜜臀| 欧美女孩性生活视频| 久久综合色之久久综合| 国产精品白丝在线| 日本亚洲一区二区| 成人h动漫精品一区二| 欧美性xxxxxx少妇| 精品成人佐山爱一区二区| 国产精品毛片无遮挡高清| 五月激情丁香一区二区三区| 九九九久久久精品| 色视频成人在线观看免| 亚洲精品一线二线三线| 一区二区三区精品视频在线| 久久精品国产一区二区三| 一本色道综合亚洲| 精品国产91久久久久久久妲己 | 欧美激情一区二区三区四区 | 日韩精品一区二区三区视频在线观看 | 亚洲成人av电影在线| 国产精品888| 欧美精品久久一区二区三区| 国产视频一区不卡| 日韩精品1区2区3区| 99精品欧美一区二区蜜桃免费| 91精品国产色综合久久| 亚洲精品欧美二区三区中文字幕| 久久精品国产成人一区二区三区| 色狠狠色狠狠综合| 国产欧美一区二区精品仙草咪| 亚洲va韩国va欧美va| 91一区二区三区在线观看| 久久久久88色偷偷免费| 日韩在线一区二区| 色综合天天综合网天天狠天天| 日韩欧美高清一区| 一级特黄大欧美久久久| 成人午夜激情影院| 精品国产免费人成电影在线观看四季| 亚洲自拍偷拍综合| 91在线视频播放地址| 国产清纯白嫩初高生在线观看91 | 91精品麻豆日日躁夜夜躁| 亚洲精品ww久久久久久p站| 成人激情图片网| 2020国产精品| 久久 天天综合| 日韩女优毛片在线| 日本中文在线一区| 欧美高清视频在线高清观看mv色露露十八 | 久久日一线二线三线suv| 秋霞国产午夜精品免费视频| 欧美制服丝袜第一页| 一区二区视频免费在线观看| 99这里只有精品| 国产精品久线在线观看| 成人一区二区在线观看| 国产精品丝袜黑色高跟| 国产成人免费在线视频| 久久久久97国产精华液好用吗 | caoporm超碰国产精品| 国产拍欧美日韩视频二区| 国产美女视频91| 国产性色一区二区| 国产91综合网| 国产精品你懂的| 成人午夜视频在线观看| 欧美国产精品劲爆| av一区二区三区黑人| 亚洲欧美日韩一区| 欧美最猛黑人xxxxx猛交| 亚洲mv在线观看| 在线不卡中文字幕| 青青草国产精品亚洲专区无| 91精品综合久久久久久| 免费精品99久久国产综合精品| 日韩一级二级三级| 国产一区二区看久久| 中文字幕精品一区二区精品绿巨人| 成人美女视频在线看| 亚洲欧美偷拍卡通变态| 欧美日韩一级片网站| 婷婷亚洲久悠悠色悠在线播放| 欧美美女一区二区在线观看| 精一区二区三区| 国产精品久99| 欧美三级在线视频| 精品中文av资源站在线观看| 欧美激情一区在线观看| 91黄色免费看| 欧美aa在线视频| 国产精品美女久久久久久 | 成人精品一区二区三区四区| 亚洲免费电影在线| 91精品国产麻豆| 成人深夜视频在线观看| 亚洲成a人在线观看| 久久午夜电影网| 在线欧美日韩精品|