lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Detail usage of ppp (address@hidden)


From: narke
Subject: Re: [lwip-users] Detail usage of ppp (address@hidden)
Date: Tue, 23 Aug 2011 21:24:23 +0800

On 23 August 2011 09:40, Paul Archer <address@hidden> wrote:
>>> 1. What's the public interface (the real public function list) of PPP
>>> module
> I agree its rather hard to separate, and makes it hard to know what
> one should be using.
>
>> Have a look at the win32 port in contrib, which can use PPP if you configure 
>> it to. That's the only example I know of. There don't seem to be active lwIP 
>> developers using PPP and we didn't get that much feedback from users using 
>> PPP, lately...
>
> I am a user of the PPP code and it works great for me.
>
> The four functions that I use are
>
> int connected = 0;
>
> pppInit();
> pppSetAuth(PPPAUTHTYPE_ANY, username, password);
> pppOverSerialOpen(0, linkStatusCB, &connected);
> while (!done && timeout(60 seconds)) {
> }
>
> if (timeout) {
>    pppClose(0);
> }
>
> static void linkStatusCB(void *ctx, int errCode, void *arg) {
>    //DTRACE("ctx = 0x%04X, errCode = %d arg = 0x%04X", ctx, errCode, arg);
>    int *connected = (int *) ctx;
>
>    struct ppp_addrs *addrs = arg;
>
> struct ppp_addrs {
>  ip_addr_t our_ipaddr, his_ipaddr, netmask, dns1, dns2;
> };
>
>    if (errCode == PPPERR_NONE) {
>        /* We are connected */
>        *connected = 1;
>        syslog(LOG_DEBUG, "ip_addr = %s", inet_ntoa(addrs->our_ipaddr));
>        syslog(LOG_DEBUG, "netmask = %s", inet_ntoa(addrs->netmask));
>        syslog(LOG_DEBUG, "dns1    = %s", inet_ntoa(addrs->dns1));
>        syslog(LOG_DEBUG, "dns2    = %s", inet_ntoa(addrs->dns2));
>    } else {
>        /* We have lost connection */
>    }
> }
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>

Hi, Paul

Your sample code makes thing clear.  Thanks!



-- 
Life is the only flaw in an otherwise perfect nonexistence
    -- Schopenhauer

narke
public key at http://subkeys.pgp.net:11371 (address@hidden)



reply via email to

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