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: Paul Archer
Subject: Re: [lwip-users] Detail usage of ppp (address@hidden)
Date: Tue, 23 Aug 2011 11:40:29 +1000

>> 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 */
    }
}



reply via email to

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