글

라벨이 mac address인 게시물 표시

OS/2 codes: How to get MAC address of network interfaces

MAC address is an 48-bits unique hardware address of a network adapter. OS/2 provides socket calls to retrive MAC address from network adapters. First way is to use os2_ioctl( SIOSTATIF42 ) . It returns the informations about all network interfaces available on a machine into struct ifmib . struct ifmib is based on an index of a network interface. That is, it does not provides canonical name of a network interface such as lan0. You should mangle a canonical name from a description field and an index field. For details, see the following ODIN sources. http://trac.netlabs.org/odin32/browser/trunk/src/iphlpapi/iphlpapi.cpp#L169 Second is ioctl( SIOCGIFCONF ) . It returns the information about all network interfaces available on a machine into struct ifconf . On TCP/IP v4.21 or later, struct ifconf may contain AF_LINK address storage. In this case, strcut ifconf contains a canonical name of a network interface, its index and its MAC address. Here is the implementation to re...