In my opinion, storing the MAC address inside the pcap_if_t structure could
be a useful feature, currently I'm adding somthing similar in packet.dll.
However, this mailing list is not the right place to request it, since
pcap_if_t is a structure defined by libpcap, that is included in WinPcap but
that is maintained at www.tcpdump.org.
Loris
----- Original Message -----
From: "Descript" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 03, 2003 10:16 AM
Subject: [WinPcap-users] MAC ADDRESS pcap_if_t
> Hello list,
>
> I would like to get the mac address of a network device. I cant use ARP
> request (due some security consideration).
> So i'v see a small code from Microsoft that use Netbios function....
>
> I'v to find a function that can give to me the address, so why pcap_if_t
> typedef doesn't provide local mac address ?!
>
> (on the bottom a small idea for pcap_if_t)
>
> <--SNIP-->
> #include <windows.h>
> #include <wincon.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <time.h>
>
> typedef struct _ASTAT_ {
> ADAPTER_STATUS adapt;
> NAME_BUFFER NameBuff [30];
> }ASTAT, * PASTAT;
>
> ASTAT Adapter;
>
> void main (void)
> {
> NCB ncb;
> UCHAR uRetCode;
> char NetName[50];
>
> memset( &ncb, 0, sizeof(ncb) );
> ncb.ncb_command = NCBRESET;
> ncb.ncb_lana_num = 0;
>
> uRetCode = Netbios( &ncb );
> printf( "The NCBRESET return code is: 0x%x \n", uRetCode );
>
> memset( &ncb, 0, sizeof(ncb) );
> ncb.ncb_command = NCBASTAT;
> ncb.ncb_lana_num = 0;
>
> strcpy( ncb.ncb_callname, "* " );
> ncb.ncb_buffer = (char *) &Adapter;
> ncb.ncb_length = sizeof(Adapter);
>
> uRetCode = Netbios( &ncb );
> printf( "The NCBASTAT return code is: 0x%x \n", uRetCode );
> if ( uRetCode == 0 )
> {
> printf( "The Ethernet Number is: %02x%02x%02x%02x%02x%02x\n",
> Adapter.adapt.adapter_address[0],
> Adapter.adapt.adapter_address[1],
> Adapter.adapt.adapter_address[2],
> Adapter.adapt.adapter_address[3],
> Adapter.adapt.adapter_address[4],
> Adapter.adapt.adapter_address[5] );
> }
> }
> </--SNIP-->
>
> <--SNIP-->
> struct pcap_if_macaddress {
> unsigned char byte1;
> unsigned char byte2;
> unsigned char byte3;
> unsigned char byte4;
> unsigned char byte5;
> unsigned char byte6;
> };
> struct pcap_if {
> struct pcap_if *next;
> char *name;
> char *description;
> struct pcap_addr *addresses;
> u_int flags;
> pcap_if_macaddress macaddress; // compat end of struct (no chained
list
> needed.)
> };
> </--SNIP-->
>
> Regards,
> Michael
>
>
>
> ==================================================================
> This is the WinPcap users list. It is archived at
> http://www.mail-archive.com/[EMAIL PROTECTED]/
>
> To unsubscribe use
> mailto: [EMAIL PROTECTED]
> ==================================================================
>
==================================================================
This is the WinPcap users list. It is archived at
http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe use
mailto: [EMAIL PROTECTED]
==================================================================