kernels/linux-2.4.0/net/irda/irnet/irnet_irda.c
/*------------------------------------------------------------------*/
/*
 * Function irnet_data_indication (instance, sap, skb)
 *
 *    Received some data from TinyTP. Just queue it on the receive queue
 *
 */
Function irnet_data_indication (instance, sap, skb)
Received some data from TinyTP. Just queue it on the receive queue
Function irnet_data_indication ( instance sap skb ) Received some data from TinyTP . Just queue it on the receive queue
static int
irnet_data_indication(void *	instance,
		      void *	sap,
		      struct sk_buff *skb)
{
  irnet_socket *	ap = (irnet_socket *) instance;
  unsigned char *	p;
  int			code = 0;
  DENTER(IRDA_TCB_TRACE, "(self/ap=0x%X, skb=0x%X)\n",
	 (unsigned int) ap,(unsigned int) skb);
  DASSERT(skb != NULL, 0, IRDA_CB_ERROR, "skb is NULL !!!\n");
  if(!ap->ppp_open)
    {
      DERROR(IRDA_CB_ERROR, "PPP not ready, dropping packet...\n");
      return -ENOMEM;
    }
  p = skb->data;
  if((p[0] == PPP_ALLSTATIONS) && (p[1] == PPP_UI))
    {
      if(skb->len < 3)
	goto err_exit;
      p = skb_pull(skb, 2);
    }
  if(p[0] & 1)
    {
      skb_push(skb, 1)[0] = 0;
    }
  else
    if(skb->len < 2)
      goto err_exit;
  ppp_input(&ap->chan, skb);
  DEXIT(IRDA_TCB_TRACE, "\n");
  return 0;
 err_exit:
  DERROR(IRDA_CB_ERROR, "Packet too small, dropping...\n");
  kfree_skb(skb);
  ppp_input_error(&ap->chan, code);
  return 0;	
}
static int irnet_data_indication ( void * instance , void * sap , struct sk_buff * skb ) { irnet_socket * ap = ( irnet_socket * ) instance ; unsigned char * p ; int code = 0 ; DENTER ( IRDA_TCB_TRACE , " \n " , ( unsigned int ) ap , ( unsigned int ) skb ) ; DASSERT ( skb != NULL , 0 , IRDA_CB_ERROR , " \n " ) ; if ( ! ap -> ppp_open ) { DERROR ( IRDA_CB_ERROR , " \n " ) ; return - ENOMEM ; } p = skb -> data ; if ( ( p [ 0 ] == PPP_ALLSTATIONS ) && ( p [ 1 ] == PPP_UI ) ) { if ( skb -> len < 3 ) goto err_exit ; p = skb_pull ( skb , 2 ) ; } if ( p [ 0 ] & 1 ) { skb_push ( skb , 1 ) [ 0 ] = 0 ; } else if ( skb -> len < 2 ) goto err_exit ; ppp_input ( & ap -> chan , skb ) ; DEXIT ( IRDA_TCB_TRACE , " \n " ) ; return 0 ; err_exit : DERROR ( IRDA_CB_ERROR , " \n " ) ; kfree_skb ( skb ) ; ppp_input_error ( & ap -> chan , code ) ; return 0 ; }
Function irnet_data_indication (instance, sap, skb)
    Received some data from TinyTP.
Function irnet_data_indication ( instance sap skb ) Received some data from TinyTP .
/* Check is ppp is ready to receive our packet */ /* When we return error, TTP will need to requeue the skb and
       * will stop the sender. IrTTP will stall until we send it a
       * flow control request... */ /* strip address/control field if present */ /* chop off address/control */ /* decompress protocol field if compressed */ /* protocol is compressed */ /* pass to generic ppp layer */ /* Note : how do I know if ppp can accept or not the packet ? This is
   * essential if I want to manage flow control smoothly... */ /* Don't return an error code, only for flow control... */