1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2 /* 3 * Based on include/uapi/linux/ipv6.h 4 * No Authors, no Copyright 5 * 6 * Based on include/uapi/linux/in6.h 7 * Authors: 8 * Pedro Roque <roque@di.fc.ul.pt> 9 */ 10 #ifndef _UAPI_NEWIP_H 11 #define _UAPI_NEWIP_H 12 13 #include <asm/byteorder.h> 14 #include <linux/libc-compat.h> 15 #include <linux/types.h> 16 #include <linux/if.h> 17 #include "nip_addr.h" 18 19 struct nip_ifreq { 20 struct nip_addr ifrn_addr; 21 int ifrn_ifindex; 22 }; 23 24 /* The following structure must be larger than V4. System calls use V4. 25 * If the definition is smaller than V4, the read process will have memory overruns 26 * v4: include\linux\socket.h --> sockaddr (16Byte) 27 */ 28 #define POD_SOCKADDR_SIZE 3 29 struct sockaddr_nin { 30 unsigned short sin_family; /* [2Byte] AF_NINET */ 31 unsigned short sin_port; /* [2Byte] Transport layer port, big-endian */ 32 struct nip_addr sin_addr; /* [9Byte] NIP address */ 33 34 unsigned char sin_zero[POD_SOCKADDR_SIZE]; /* [3Byte] Byte alignment */ 35 }; 36 37 struct nip_devreq { 38 char nip_ifr_name[IFNAMSIZ]; /* if name, e.g. "eth0", "wlan0" */ 39 40 union { 41 struct sockaddr_nin addr; 42 short flags; 43 } devreq; 44 }; 45 46 #define NIP_DEV_ADDR devreq.addr /* nip address */ 47 #define NIP_DEV_FLAGS devreq.flags /* net device flags */ 48 49 #endif /* _UAPI_NEWIP_H */ 50