PPP support for win32 port (need to add some files).

This commit is contained in:
fbernon 2007-12-03 22:10:46 +00:00
parent d0fee92fe2
commit e7fb399b3c
5 changed files with 124 additions and 122 deletions

View File

@ -77,4 +77,7 @@ typedef u32_t mem_ptr_t;
#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \
x, __LINE__, __FILE__); fflush(NULL); abort();} while(0)
/* C runtime functions redefined */
#define snprintf _snprintf
#endif /* __ARCH_CC_H__ */

View File

@ -45,5 +45,8 @@ typedef struct lwip_mbox* sys_mbox_t;
/* DWORD (thread id) is used for sys_thread_t but we won't include windows.h */
typedef u32_t sys_thread_t;
/* sys_jiffies */
#define sys_jiffies() sys_now()
#endif /* __ARCH_SYS_ARCH_H__ */

View File

@ -258,13 +258,16 @@ a lot of data that needs to be copied, this should be set high. */
#if PPP_SUPPORT
#define NUM_PPP 1 /* Max PPP sessions. */
#define NUM_PPP 1 /* Max PPP sessions. */
/* Select modules to enable. Ideally these would be set in the makefile but
* we're limited by the command line length so you need to modify the settings
* in this file.
*/
#define PPPOE_SUPPORT 1
#define PPPOS_SUPPORT 1
#define PAP_SUPPORT 1 /* Set > 0 for PAP. */
#define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
#define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
@ -273,59 +276,6 @@ a lot of data that needs to be copied, this should be set high. */
#define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
#define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
/*
* Timeouts.
*/
#define FSM_DEFTIMEOUT 6 /* Timeout time in seconds */
#define FSM_DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */
#define FSM_DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */
#define FSM_DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */
#define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */
#define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
#define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */
#define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */
/* Interval in seconds between keepalive echo requests, 0 to disable. */
#if 1
#define LCP_ECHOINTERVAL 0
#else
#define LCP_ECHOINTERVAL 10
#endif
/* Number of unanswered echo requests before failure. */
#define LCP_MAXECHOFAILS 3
/* Max Xmit idle time (in jiffies) before resend flag char. */
#define PPP_MAXIDLEFLAG 100
/*
* Packet sizes
*
* Note - lcp shouldn't be allowed to negotiate stuff outside these
* limits. See lcp.h in the pppd directory.
* (XXX - these constants should simply be shared by lcp.c instead
* of living in lcp.h)
*/
#define PPP_MTU 1500 /* Default MTU (size of Info field) */
#if 0
#define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN)
#else
#define PPP_MAXMTU 1500 /* Largest MTU we allow */
#endif
#define PPP_MINMTU 64
#define PPP_MRU 1500 /* default MRU = max length of info field */
#define PPP_MAXMRU 1500 /* Largest MRU we allow */
#define PPP_DEFMRU 296 /* Try for this */
#define PPP_MINMRU 128 /* No MRUs below this */
#define MAXNAMELEN 256 /* max length of hostname or name for auth */
#define MAXSECRETLEN 256 /* max length of password or secret */
#endif /* PPP_SUPPORT */
#endif /* __LWIPOPTS_H__ */

View File

@ -1078,13 +1078,8 @@
<File
RelativePath="$(LWIP_DIR)\src\netif\etharp.c"
>
</File>
<File
RelativePath="$(LWIP_DIR)\src\netif\ethernetif.c"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1092,7 +1087,24 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="$(LWIP_DIR)\src\netif\ethernetif.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1104,7 +1116,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1112,7 +1123,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1122,13 +1132,8 @@
<File
RelativePath="$(LWIP_DIR)\src\netif\loopif.c"
>
</File>
<File
RelativePath="$(LWIP_DIR)\src\netif\slipif.c"
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1136,7 +1141,24 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="$(LWIP_DIR)\src\netif\slipif.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1151,7 +1173,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1159,7 +1180,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1171,7 +1191,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1179,7 +1198,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1191,7 +1209,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1199,7 +1216,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1211,7 +1227,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1219,7 +1234,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1231,7 +1245,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1239,7 +1252,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1251,7 +1263,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1259,7 +1270,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1271,7 +1281,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1279,7 +1288,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1291,7 +1299,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1299,7 +1306,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1311,7 +1317,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1319,7 +1324,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1331,7 +1335,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1339,7 +1342,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1351,7 +1353,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1359,7 +1360,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1371,7 +1371,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1379,7 +1378,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1391,7 +1389,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1399,7 +1396,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1411,7 +1407,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1419,7 +1414,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1431,7 +1425,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1439,7 +1432,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1451,7 +1443,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1459,7 +1450,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1471,7 +1461,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1479,7 +1468,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1491,7 +1479,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1499,7 +1486,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1511,7 +1497,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1519,7 +1504,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1531,7 +1515,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1539,7 +1522,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1551,7 +1533,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1559,7 +1540,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1571,7 +1551,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1579,7 +1558,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1591,7 +1569,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1599,7 +1576,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1611,7 +1587,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1619,7 +1594,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1631,7 +1605,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1639,7 +1612,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
@ -1651,7 +1623,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1659,7 +1630,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1671,7 +1641,6 @@
>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
@ -1679,7 +1648,6 @@
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"

View File

@ -70,6 +70,12 @@
#include "lwip/autoip.h"
#endif /* NO_SYS */
#if PPP_SUPPORT
/* PPP includes */
#include "../netif/ppp/ppp.h"
#include "lwip/sio.h"
#endif /* PPP_SUPPORT */
#include "pktif.h"
/* include the port-dependent configuration */
@ -161,6 +167,62 @@ timers_update()
}
#endif /* NO_SYS */
#if PPP_SUPPORT
void
pppLinkStatusCallback(void *ctx, int errCode, void *arg)
{
switch(errCode) {
case PPPERR_NONE: { /* No error. */
struct ppp_addrs *ppp_addrs = arg;
printf("pppLinkStatusCallback: PPPERR_NONE");
printf(" our_ipaddr=%s", inet_ntoa(*(struct in_addr*)&(ppp_addrs->our_ipaddr.addr)));
printf(" his_ipaddr=%s", inet_ntoa(*(struct in_addr*)&(ppp_addrs->his_ipaddr.addr)));
printf(" netmask=%s", inet_ntoa(*(struct in_addr*)&(ppp_addrs->netmask.addr)));
printf(" dns1=%s", inet_ntoa(*(struct in_addr*)&(ppp_addrs->dns1.addr)));
printf(" dns2=%s\n", inet_ntoa(*(struct in_addr*)&(ppp_addrs->dns2.addr)));
break;
}
case PPPERR_PARAM: { /* Invalid parameter. */
printf("pppLinkStatusCallback: PPPERR_PARAM\n");
break;
}
case PPPERR_OPEN: { /* Unable to open PPP session. */
printf("pppLinkStatusCallback: PPPERR_OPEN\n");
break;
}
case PPPERR_DEVICE: { /* Invalid I/O device for PPP. */
printf("pppLinkStatusCallback: PPPERR_DEVICE\n");
break;
}
case PPPERR_ALLOC: { /* Unable to allocate resources. */
printf("pppLinkStatusCallback: PPPERR_ALLOC\n");
break;
}
case PPPERR_USER: { /* User interrupt. */
printf("pppLinkStatusCallback: PPPERR_USER\n");
break;
}
case PPPERR_CONNECT: { /* Connection lost. */
printf("pppLinkStatusCallback: PPPERR_CONNECT\n");
break;
}
case PPPERR_AUTHFAIL: { /* Failed authentication challenge. */
printf("pppLinkStatusCallback: PPPERR_AUTHFAIL\n");
break;
}
case PPPERR_PROTOCOL: { /* Failed to meet protocol. */
printf("pppLinkStatusCallback: PPPERR_PROTOCOL\n");
break;
}
default: {
printf("pppLinkStatusCallback: unknown errCode %d\n", errCode);
break;
}
}
}
#endif /* PPP_SUPPORT */
/* This function initializes all network interfaces */
static void
msvc_netif_init()
@ -203,6 +265,22 @@ msvc_netif_init()
#else /* NO_SYS */
netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_input));
#endif /* NO_SYS */
#if PPP_SUPPORT
{ sio_fd_t ppp_sio;
ppp_sio = sio_open(0);
if (ppp_sio != NULL) {
printf("pppInit\n");
pppInit();
pppSetAuth(PPPAUTHTYPE_CHAP, "lwip", "mysecret");
printf("pppOpen\n");
pppOpen(ppp_sio, pppLinkStatusCallback, NULL);
} else {
printf("sio_open error\n");
}
}
#endif /* PPP_SUPPORT */
#if LWIP_DHCP
dhcp_start(&netif);
#else /* LWIP_DHCP */