mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-07-04 15:29:30 +00:00
Minor changes in msvc6 port...
This commit is contained in:
parent
6f9aed6e0b
commit
9e245185ea
@ -32,10 +32,13 @@
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
#include "arch/cc.h"
|
||||
|
||||
#define NO_SYS 0
|
||||
#define LWIP_SOCKET 1
|
||||
#define LWIP_NETCONN 1
|
||||
|
||||
#define LWIP_IGMP 1
|
||||
#define LWIP_ICMP 1
|
||||
#define LWIP_SNMP 1
|
||||
|
||||
#define LWIP_HAVE_LOOPIF 1
|
||||
|
||||
@ -110,7 +113,7 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||
timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT 3
|
||||
#define MEMP_NUM_SYS_TIMEOUT 8
|
||||
|
||||
/* The following four are used only with the sequential API and can be
|
||||
set to 0 if the application only will use the raw API. */
|
||||
@ -176,6 +179,7 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define LWIP_ARP 1
|
||||
#define ARP_TABLE_SIZE 10
|
||||
#define ARP_QUEUEING 1
|
||||
|
||||
@ -214,16 +218,21 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
|
||||
/* ---------- Statistics options ---------- */
|
||||
|
||||
#ifdef LWIP_STATS
|
||||
#define LINK_STATS
|
||||
#define IP_STATS
|
||||
#define ICMP_STATS
|
||||
#define UDP_STATS
|
||||
#define TCP_STATS
|
||||
#define MEM_STATS
|
||||
#define MEMP_STATS
|
||||
#define PBUF_STATS
|
||||
#define SYS_STATS
|
||||
#define LWIP_STATS 1
|
||||
#define LWIP_STATS_DISPLAY 1
|
||||
|
||||
#if LWIP_STATS
|
||||
#define LINK_STATS 1
|
||||
#define IP_STATS 1
|
||||
#define ICMP_STATS 1
|
||||
#define IGMP_STATS 1
|
||||
#define IPFRAG_STATS 1
|
||||
#define UDP_STATS 1
|
||||
#define TCP_STATS 1
|
||||
#define MEM_STATS 1
|
||||
#define MEMP_STATS 1
|
||||
#define PBUF_STATS 1
|
||||
#define SYS_STATS 1
|
||||
#endif /* LWIP_STATS */
|
||||
|
||||
/* ---------- PPP options ---------- */
|
||||
|
@ -70,12 +70,15 @@
|
||||
#include <packet32.h>
|
||||
#include <ntddndis.h>
|
||||
|
||||
/** @todo use the lwip header file */
|
||||
#define ETHARP_HWADDR_LEN 6
|
||||
|
||||
LPADAPTER lpAdapter;
|
||||
LPPACKET lpPacket;
|
||||
char buffer[256000]; // buffer to hold the data coming from the driver
|
||||
unsigned char *cur_packet;
|
||||
int cur_length;
|
||||
unsigned char ethaddr[6];
|
||||
unsigned char ethaddr[ETHARP_HWADDR_LEN];
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int init_adapter(int adapter_num, char* mac_addr)
|
||||
@ -170,19 +173,19 @@ int init_adapter(int adapter_num, char* mac_addr)
|
||||
if (adapter_num >= AdapterNum) {
|
||||
return -1;
|
||||
}
|
||||
ppacket_oid_data=malloc(sizeof(PACKET_OID_DATA)+6);
|
||||
ppacket_oid_data=malloc(sizeof(PACKET_OID_DATA)+ETHARP_HWADDR_LEN);
|
||||
lpAdapter=PacketOpenAdapter(AdapterList[adapter_num]);
|
||||
if (!lpAdapter || (lpAdapter->hFile == INVALID_HANDLE_VALUE)) {
|
||||
return -1;
|
||||
}
|
||||
ppacket_oid_data->Oid=OID_802_3_PERMANENT_ADDRESS;
|
||||
ppacket_oid_data->Length=6;
|
||||
ppacket_oid_data->Length=ETHARP_HWADDR_LEN;
|
||||
if (!PacketRequest(lpAdapter,FALSE,ppacket_oid_data)) {
|
||||
return -1;
|
||||
}
|
||||
memcpy(ðaddr,ppacket_oid_data->Data,6);
|
||||
memcpy(ðaddr,ppacket_oid_data->Data,ETHARP_HWADDR_LEN);
|
||||
free(ppacket_oid_data);
|
||||
memcpy(mac_addr, ethaddr, 6);
|
||||
memcpy(mac_addr, ethaddr, ETHARP_HWADDR_LEN);
|
||||
printf("MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", ethaddr[0], ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5]);
|
||||
PacketSetBuff(lpAdapter,512000);
|
||||
PacketSetReadTimeout(lpAdapter,1);
|
||||
|
@ -87,7 +87,9 @@
|
||||
#define IFNAME1 'k'
|
||||
|
||||
/* index of the network adapter to use for lwIP */
|
||||
#define PACKET_LIB_ADAPTER_NR 3
|
||||
#ifndef PACKET_LIB_ADAPTER_NR
|
||||
#define PACKET_LIB_ADAPTER_NR 0
|
||||
#endif
|
||||
|
||||
static struct eth_addr broadcastaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
|
@ -40,39 +40,18 @@
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/sockets.h"
|
||||
#include "netif/etharp.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/tcpip.h"
|
||||
|
||||
#include "netif/loopif.h"
|
||||
|
||||
#include "httpd.h"
|
||||
|
||||
/* index of the network adapter to use for lwIP */
|
||||
#define PACKET_LIB_ADAPTER_NR 3
|
||||
|
||||
err_t ethernetif_init(struct netif *netif);
|
||||
int init_adapter(int adapter_num, char *macaddr_out);
|
||||
void shutdown_adapter(void);
|
||||
void update_adapter(void);
|
||||
|
||||
int dbg_printf(const char *fmt, ...)
|
||||
{
|
||||
va_list v;
|
||||
int r;
|
||||
|
||||
va_start(v, fmt);
|
||||
r = vfprintf(stderr,fmt, v);
|
||||
va_end(v);
|
||||
return r;
|
||||
}
|
||||
|
||||
#if LWIP_TCP
|
||||
static err_t netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user