lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] PPP-new threaded vs non-threaded application


From: LMao
Subject: [lwip-users] PPP-new threaded vs non-threaded application
Date: Mon, 7 Apr 2014 20:05:33 +0000

Hi Sylvain,

I think in your post 
http://lists.nongnu.org/archive/html/lwip-users/2013-06/msg00011.html, you gave 
some code snippet  showing how to use ppp-new in user's application. I believe 
that snippet is used in a non-threaded application, am I right?

Can you give an example application code snippet for threaded environment? I 
have problem to get my threaded application work with PPP-new. Basically, I 
followed your example for non-threaded environment, but use functions with 
pre-fix pppapi_ instead of ppp_ as you suggested in that post. The following 
code snippet is my task(freeRTOS is used) function handling PPP. 

void vPPPApplication(void)
{
  ppp_pcb *ppps;
  char *username = "test";
  char *password = "test";

  int connected = 0;
  int pd;
  
  ppps = pppapi_new();

  /* set the method of authentication. Use PPPAUTHTYPE_PAP, or
   * PPPAUTHTYPE_CHAP for more security .
   * If this is not called, the default is PPPAUTHTYPE_NONE. 
   */
  pppapi_set_auth(ppps, PPPAUTHTYPE_PAP, username, password);
  
  pppapi_over_serial_create(ppps, 0, ppp_link_status_cb, NULL);
  
  pppapi_open(ppps, 0);
  while(1) 
  {
    u8_t buffer[128];
    int len;
    len = sio_read(0, buffer, 20);
    if(len <= 0) {
      vTaskDelay( 10 );
    } else {
      pppos_input(ppps, buffer, len);
    }
  }
}

Thanks,

Charles

reply via email to

[Prev in Thread] Current Thread [Next in Thread]