1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2000,2002 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _ETHERADDR_H 28 #define _ETHERADDR_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * Module: etheraddr 34 * Description: This is the solaris-specific interface for retrieving 35 * the MAC (IEEE 802.3) node identifier, a.k.a. the ethernet 36 * address of the system. Note that this can only get the 37 * ethernet address if the process running the code can open 38 * /dev/[whatever] read/write, e.g. you must be root. 39 */ 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 #include <sys/socket.h> 46 #include <net/if.h> 47 #include <netinet/if_ether.h> 48 #include <sys/uuid.h> 49 50 /* max modules that can be pushed on intr */ 51 #define MAX_MODS 9 52 53 /* used to avoid getting errors from lo0 */ 54 #define LOOPBACK_IF "lo0" 55 56 /* 57 * Local structure encapsulating an interface 58 * device and its associated modules 59 */ 60 typedef struct dev_att { 61 char ifname[LIFNAMSIZ]; /* interface name, such as "le0" */ 62 int style; /* DLPI message style */ 63 int ppa; /* Physical point of attachment */ 64 int lun; /* logical unit number */ 65 int mod_cnt; /* # modules to push onto stream */ 66 char devname[LIFNAMSIZ]; /* device name, such as "/dev/le0" */ 67 char modlist[MAX_MODS][LIFNAMSIZ]; /* modules to push onto stream */ 68 } dev_att_t; 69 70 71 /* where devices are located */ 72 #define DEVDIR "/dev" 73 74 /* how long to wait for dlpi requests to succeed */ 75 #define DLPI_TIMEOUT 60 76 77 /* 78 * Global functions 79 */ 80 int arp_get(uuid_node_t *); 81 int dlpi_get_address(char *, struct ether_addr *); 82 int get_net_if_names(char ***); 83 void free_net_if_names(char **); 84 int get_ethernet_address(uuid_node_t *); 85 86 #ifdef __cplusplus 87 } 88 #endif 89 90 #endif /* _ETHERADDR_H */ 91