Beispiel #1
0
/*---------------------------------------------------------------------------*/
void
ppp_upcall(u16_t protocol, u8_t *buffer, u16_t len)
{
  ++ppp_rx_frame_count;
#if PACKET_RX_DEBUG
  //dump_ppp_packet(buffer, len);
  if(ppp_rx_frame_count > 18) {
    done = 1;
  }
#endif
  ANNOTATE("Recv ");
  /* check to see if we have a packet waiting to be processed */
  if(ppp_flags & PPP_RX_READY) {	
    /* demux on protocol field */
    switch(protocol) {
    case LCP:	/* We must support some level of LCP */
      ANNOTATE("LCP Packet - \n");
      lcp_rx(buffer, len);
      ANNOTATE("\n");
      break;
    case PAP:	/* PAP should be compile in optional */
      ANNOTATE("PAP Packet - \n");
      pap_rx(buffer, len);
      ANNOTATE("\n");
      break;
    case IPCP:	/* IPCP should be compile in optional. */
      ANNOTATE("IPCP Packet - \n");
      ipcp_rx(buffer, len);
      ANNOTATE("\n");
      break;
    case IPV6CP:	/* IPV6CP should be compile in optional. */
      ANNOTATE("IPV6CP Packet - \n");
      ipv6cp_rx(buffer, len);
      ANNOTATE("\n");
      break;
    case IPV4:	/* We must support IPV4 */
      ANNOTATE("IPV4 Packet---\n");
      memcpy( &uip_buf[ UIP_LLH_LEN ], buffer, len);
      uip_len = len;
      ANNOTATE("\n");
      break;
    case IPV6:
      ANNOTATE("IPV6 Packet---\n");
      memcpy( &uip_buf[ UIP_LLH_LEN ], buffer, len);
      uip_len = len;
      ANNOTATE("\n");
      break;

    default:
      ppp_reject_protocol(protocol, buffer, len);
      break;
    }
  }
}
Beispiel #2
0
/*---------------------------------------------------------------------------*/
void
ppp_upcall(u16_t protocol, u8_t *buffer, u16_t len)
{
#if PACKET_RX_DEBUG
  ++ppp_rx_frame_count;
  dump_ppp_packet(buffer, len);
  if(ppp_rx_frame_count > 18) {
    done = 1;
  }
#endif

  /* check to see if we have a packet waiting to be processed */
  if(ppp_flags & PPP_RX_READY) {	
    /* demux on protocol field */
    switch(protocol) {
    case LCP:	/* We must support some level of LCP */
      DEBUG1(("LCP Packet - "));
      lcp_rx(buffer, len);
      DEBUG1(("\n"));
      break;
    case PAP:	/* PAP should be compile in optional */
      DEBUG1(("PAP Packet - "));
      pap_rx(buffer, len);
      DEBUG1(("\n"));
      break;
    case IPCP:	/* IPCP should be compile in optional. */
      DEBUG1(("IPCP Packet - "));
      ipcp_rx(buffer, len);
      DEBUG1(("\n"));
      break;
    case IPV4:	/* We must support IPV4 */
      DEBUG1(("IPV4 Packet---\n"));
      memcpy(uip_buf, buffer, len);
      uip_len = len;
      DEBUG1(("\n"));
      break;
    default:
      DEBUG1(("Unknown PPP Packet Type 0x%04x - ",protocol));
      ppp_reject_protocol(protocol, buffer, len);
      DEBUG1(("\n"));
      break;
    }
  }
}