mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-10-12 08:23:42 +00:00
Minor change in Win32 port: add the adapter's vendor description display
This commit is contained in:
parent
e63bdc8022
commit
bf8469722f
@ -80,6 +80,8 @@
|
|||||||
#define PACKET_ADAPTER_BUFSIZE 512000
|
#define PACKET_ADAPTER_BUFSIZE 512000
|
||||||
#define PACKET_INPUT_BUFSIZE 256000
|
#define PACKET_INPUT_BUFSIZE 256000
|
||||||
|
|
||||||
|
#define PACKET_OID_DATA_SIZE 255
|
||||||
|
|
||||||
/* Packet Adapter informations */
|
/* Packet Adapter informations */
|
||||||
struct packet_adapter {
|
struct packet_adapter {
|
||||||
input_fn input;
|
input_fn input;
|
||||||
@ -172,12 +174,23 @@ init_adapter(int adapter_num, char *mac_addr, input_fn input, void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* set up the selected adapter */
|
/* set up the selected adapter */
|
||||||
ppacket_oid_data = malloc(sizeof(PACKET_OID_DATA) + ETHARP_HWADDR_LEN);
|
|
||||||
pa->lpAdapter = PacketOpenAdapter(AdapterList[adapter_num]);
|
pa->lpAdapter = PacketOpenAdapter(AdapterList[adapter_num]);
|
||||||
if (!pa->lpAdapter || (pa->lpAdapter->hFile == INVALID_HANDLE_VALUE)) {
|
if (!pa->lpAdapter || (pa->lpAdapter->hFile == INVALID_HANDLE_VALUE)) {
|
||||||
free(pa);
|
free(pa);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
/* alloc the OID packet */
|
||||||
|
ppacket_oid_data = malloc(sizeof(PACKET_OID_DATA) + PACKET_OID_DATA_SIZE);
|
||||||
|
if (!ppacket_oid_data) {
|
||||||
|
free(pa);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/* get the description of the selected adapter */
|
||||||
|
ppacket_oid_data->Oid = OID_GEN_VENDOR_DESCRIPTION;
|
||||||
|
ppacket_oid_data->Length = PACKET_OID_DATA_SIZE;
|
||||||
|
if (PacketRequest(pa->lpAdapter, FALSE, ppacket_oid_data)) {
|
||||||
|
printf("USE: %s\n", ppacket_oid_data->Data);
|
||||||
|
}
|
||||||
/* get the MAC address of the selected adapter */
|
/* get the MAC address of the selected adapter */
|
||||||
ppacket_oid_data->Oid = OID_802_3_PERMANENT_ADDRESS;
|
ppacket_oid_data->Oid = OID_802_3_PERMANENT_ADDRESS;
|
||||||
ppacket_oid_data->Length = ETHARP_HWADDR_LEN;
|
ppacket_oid_data->Length = ETHARP_HWADDR_LEN;
|
||||||
|
Loading…
Reference in New Issue
Block a user