Determine MAC address

Is there any library function to determine the mac address of my own network
adapter.

TIA
HDSander

| STN ATLAS Marine Electronics GmbH
| Dipl.-Ing. Heinz-Dieter Sander
| Software Navigation Systems, Dept. MST 21
| Kurfuerstenallee 130
| D-28211 Bremen, Germany
|
| Phone : +49 421 457 3511
| Fax : +49 421 457 2026
| eMail : Heinz-Dieter.Sander@sam-electronics.de

Take a look at the following knowledge base entry.
http://qdn.qnx.com/support/bok/solution.qnx?10246

Regards,
Dave B.

Heinz-Dieter Sander <HDSander@is-bremen.de> wrote:

Is there any library function to determine the mac address of my own network
adapter.

TIA
HDSander

| STN ATLAS Marine Electronics GmbH
| Dipl.-Ing. Heinz-Dieter Sander
| Software Navigation Systems, Dept. MST 21
| Kurfuerstenallee 130
| D-28211 Bremen, Germany
|
| Phone : +49 421 457 3511
| Fax : +49 421 457 2026
| eMail : > Heinz-Dieter.Sander@sam-electronics.de

Is there a way of doing this under QNX 4 ?

“Applications Mail Group” <apps@qnx.com> wrote in message
news:9krf30$r6m$2@nntp.qnx.com

Take a look at the following knowledge base entry.
http://qdn.qnx.com/support/bok/solution.qnx?10246

Regards,
Dave B.

Heinz-Dieter Sander <> HDSander@is-bremen.de> > wrote:
Is there any library function to determine the mac address of my own
network
adapter.

TIA
HDSander

| STN ATLAS Marine Electronics GmbH
| Dipl.-Ing. Heinz-Dieter Sander
| Software Navigation Systems, Dept. MST 21
| Kurfuerstenallee 130
| D-28211 Bremen, Germany
|
| Phone : +49 421 457 3511
| Fax : +49 421 457 2026
| eMail : > Heinz-Dieter.Sander@sam-electronics.de

I assume you know ‘netinfo -l’ under QNX - call it from “system(
“netinfo -l > into_a_file” )” and write a parser for it. should be the
simplest way :slight_smile:

Marc Lupien schrieb:

Is there a way of doing this under QNX 4 ?

“Applications Mail Group” <> apps@qnx.com> > wrote in message
news:9krf30$r6m$> 2@nntp.qnx.com> …
Take a look at the following knowledge base entry.
http://qdn.qnx.com/support/bok/solution.qnx?10246

Regards,
Dave B.

Heinz-Dieter Sander <> HDSander@is-bremen.de> > wrote:
Is there any library function to determine the mac address of my own
network
adapter.

TIA
HDSander

| STN ATLAS Marine Electronics GmbH
| Dipl.-Ing. Heinz-Dieter Sander
| Software Navigation Systems, Dept. MST 21
| Kurfuerstenallee 130
| D-28211 Bremen, Germany
|
| Phone : +49 421 457 3511
| Fax : +49 421 457 2026
| eMail : > Heinz-Dieter.Sander@sam-electronics.de

Dr. Jörg Kampmann - IBK-Consult for Real-Time and Embedded Systems
D-31228 Peine - Tel.:+49-177-276-3140 - Fax: +49-5171-13385
http://www.ibk-consult.de
===== QNX is the better Choice for Real-Time: http://www.qnx.com ====

of course QNX 4 :slight_smile:

Joerg Kampmann schrieb:

I assume you know ‘netinfo -l’ under QNX - call it from “system(
“netinfo -l > into_a_file” )” and write a parser for it. should be the
simplest way > :slight_smile:

Marc Lupien schrieb:

Is there a way of doing this under QNX 4 ?

“Applications Mail Group” <> apps@qnx.com> > wrote in message
news:9krf30$r6m$> 2@nntp.qnx.com> …
Take a look at the following knowledge base entry.
http://qdn.qnx.com/support/bok/solution.qnx?10246

Regards,
Dave B.

Heinz-Dieter Sander <> HDSander@is-bremen.de> > wrote:
Is there any library function to determine the mac address of my own
network
adapter.

TIA
HDSander

| STN ATLAS Marine Electronics GmbH
| Dipl.-Ing. Heinz-Dieter Sander
| Software Navigation Systems, Dept. MST 21
| Kurfuerstenallee 130
| D-28211 Bremen, Germany
|
| Phone : +49 421 457 3511
| Fax : +49 421 457 2026
| eMail : > Heinz-Dieter.Sander@sam-electronics.de


\

=====================================================================
Dr. Jörg Kampmann - IBK-Consult for Real-Time and Embedded Systems
D-31228 Peine - Tel.:+49-177-276-3140 - Fax: +49-5171-13385
http://www.ibk-consult.de
===== QNX is the better Choice for Real-Time: > http://www.qnx.com > ====

Dr. Jörg Kampmann - IBK-Consult for Real-Time and Embedded Systems
D-31228 Peine - Tel.:+49-177-276-3140 - Fax: +49-5171-13385
http://www.ibk-consult.de
===== QNX is the better Choice for Real-Time: http://www.qnx.com ====

“Marc Lupien” <marclupien@hotmail.com> wrote in message
news:9l9uh6$n7u$1@inn.qnx.com

Is there a way of doing this under QNX 4 ?

take a look at ftp.qnx.com/usr/free/qnx4/os/net/netraw.v4.tgz there’s an
example inside that enumerates network interfaces and displays NICs
information for each including MAC address etc.

“Applications Mail Group” <> apps@qnx.com> > wrote in message
news:9krf30$r6m$> 2@nntp.qnx.com> …
Take a look at the following knowledge base entry.
http://qdn.qnx.com/support/bok/solution.qnx?10246

Regards,
Dave B.

Heinz-Dieter Sander <> HDSander@is-bremen.de> > wrote:
Is there any library function to determine the mac address of my own
network
adapter.

// wbr

Marc Lupien <marclupien@hotmail.com> wrote:

Is there a way of doing this under QNX 4 ?

#include <stdio.h>
#include <malloc.h>
#include <sys/kernel.h>
#include <sys/net_nq.h>
#include <sys/net41msg.h>
#include <sys/net_drvr.h>
#include <errno.h>


void main()

{
int ctr;
int pid;
struct _net_rnodemap rnodemap;
char data[1024];
struct _net_rnodemap_reply *rnodemap_reply;
int nids[20];

if ((pid=qnx_vc_name_attach(0, 64, “qnx/net”))==-1) {
printf (“Could not attach to Net (%d)\n”, errno);
exit(0);
}

memset(&rnodemap, 0, sizeof(rnodemap));
rnodemap.type=_NET_RNODEMAP;
rnodemap.log_nid=getnid();

rnodemap_reply=(struct _net_rnodemap_reply *) data;

if ((Send(pid, &rnodemap, rnodemap_reply, sizeof(rnodemap),
1000))==-1) {
printf (“Send error\n” );
exit(0);
}

printf (“MAC: “); // If you have multiple cards you will need a loop here
for (ctr=0; ctr<6; ctr++)
printf (”%02X”, rnodemap_reply->card[0].phys_addr[ctr]);

printf ("\n");

}

The sys/net* headers are in the netraw package on /usr/free.

I think all the relevant bits are:

#define _NET_RNODEMAP 0x421

struct _net_rnodemap {
short unsigned int type;
short unsigned int subtype;
nid_t log_nid;
short unsigned int zero1;
short unsigned int zero2;
};
struct _card_info {
short unsigned int lan_addr;
unsigned char phys_addr[6];
time_t last_tx_fail;
};
struct _net_rnodemap_reply {
short unsigned int status;
short unsigned int zero1;
short unsigned int num_card;
short unsigned int zero2;
struct _card_info card[];
};

-David


QNX Training Services
dagibbs@qnx.com

There is a message that can be sent to Net.* drivers that returns the
information that ‘netinfo -l’ displays.

Someone from QSSL with have to give you the info on how to send that
message. I think there was a non-disclosure agreement to sign.

Bill Caroselli


“Marc Lupien” <marclupien@hotmail.com> wrote in message
news:9l9uh6$n7u$1@inn.qnx.com

Is there a way of doing this under QNX 4 ?

“Applications Mail Group” <> apps@qnx.com> > wrote in message
news:9krf30$r6m$> 2@nntp.qnx.com> …
Take a look at the following knowledge base entry.
http://qdn.qnx.com/support/bok/solution.qnx?10246

Regards,
Dave B.

Heinz-Dieter Sander <> HDSander@is-bremen.de> > wrote:
Is there any library function to determine the mac address of my own
network
adapter.

TIA
HDSander

| STN ATLAS Marine Electronics GmbH
| Dipl.-Ing. Heinz-Dieter Sander
| Software Navigation Systems, Dept. MST 21
| Kurfuerstenallee 130
| D-28211 Bremen, Germany
|
| Phone : +49 421 457 3511
| Fax : +49 421 457 2026
| eMail : > Heinz-Dieter.Sander@sam-electronics.de
\