| 1 | /* $NetBSD: linux_sockio.h,v 1.19 2013/01/11 19:01:36 christos Exp $ */ |
| 2 | |
| 3 | /*- |
| 4 | * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * This code is derived from software contributed to The NetBSD Foundation |
| 8 | * by Frank van der Linden and Eric Haszlakiewicz. |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions |
| 12 | * are met: |
| 13 | * 1. Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in the |
| 17 | * documentation and/or other materials provided with the distribution. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
| 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 | * POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef _LINUX_SOCKIO_H |
| 33 | #define _LINUX_SOCKIO_H |
| 34 | |
| 35 | #define LINUX_SIOCGIFNAME _LINUX_IO(0x89, 0x10) |
| 36 | #define LINUX_SIOCGIFCONF _LINUX_IO(0x89, 0x12) |
| 37 | #define LINUX_SIOCGIFFLAGS _LINUX_IO(0x89, 0x13) |
| 38 | #define LINUX_SIOCSIFFLAGS _LINUX_IO(0x89, 0x14) |
| 39 | #define LINUX_SIOCGIFADDR _LINUX_IO(0x89, 0x15) |
| 40 | #define LINUX_SIOCSIFADDR _LINUX_IO(0x89, 0x16) |
| 41 | #define LINUX_SIOCGIFDSTADDR _LINUX_IO(0x89, 0x17) |
| 42 | #define LINUX_SIOCGIFBRDADDR _LINUX_IO(0x89, 0x19) |
| 43 | #define LINUX_SIOCGIFNETMASK _LINUX_IO(0x89, 0x1b) |
| 44 | #define LINUX_SIOCGIFMTU _LINUX_IO(0x89, 0x21) |
| 45 | #define LINUX_SIOCADDMULTI _LINUX_IO(0x89, 0x31) |
| 46 | #define LINUX_SIOCDELMULTI _LINUX_IO(0x89, 0x32) |
| 47 | #define LINUX_SIOCGIFHWADDR _LINUX_IO(0x89, 0x27) |
| 48 | #define LINUX_SIOCDEVPRIVATE _LINUX_IO(0x89, 0xf0) |
| 49 | #define LINUX_SIOCGIFBR _LINUX_IO(0x89, 0x40) |
| 50 | #define LINUX_SIOCSIFBR _LINUX_IO(0x89, 0x41) |
| 51 | |
| 52 | #define LINUX_IFNAMSIZ 16 |
| 53 | |
| 54 | struct linux_ifmap { |
| 55 | unsigned long mem_start; |
| 56 | unsigned long mem_end; |
| 57 | unsigned short base_addr; |
| 58 | unsigned char irq; |
| 59 | unsigned char dma; |
| 60 | unsigned char port; |
| 61 | }; |
| 62 | |
| 63 | struct linux_ifreq { |
| 64 | union { |
| 65 | char ifrn_name[LINUX_IFNAMSIZ]; /* if name, e.g. "en0" */ |
| 66 | } ifr_ifrn; |
| 67 | union { |
| 68 | struct osockaddr ifru_addr; |
| 69 | struct osockaddr ifru_hwaddr; |
| 70 | struct linux_ifmap ifru_map; |
| 71 | int ifru_ifindex; |
| 72 | } ifr_ifru; |
| 73 | #define ifr_name ifr_ifrn.ifrn_name /* interface name */ |
| 74 | #define ifr_addr ifr_ifru.ifru_addr /* address */ |
| 75 | #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ |
| 76 | #define ifr_map ifr_ifru.ifru_map /* device map */ |
| 77 | }; |
| 78 | |
| 79 | struct linux_ifconf { |
| 80 | int ifc_len; |
| 81 | union { |
| 82 | char *ifcu_buf; |
| 83 | struct linux_ifreq *ifcu_req; |
| 84 | } ifc_ifcu; |
| 85 | }; |
| 86 | |
| 87 | #define ifc_buf ifc_ifcu.ifcu_buf |
| 88 | #define ifc_req ifc_ifcu.ifcu_req |
| 89 | |
| 90 | #endif /* !_LINUX_SOCKIO_H */ |
| 91 | |