2 * @(#)osdep.h 2.1 97/10/23
4 /* @(#)types.h 1.18 87/07/24 SMI */
6 * Copyright (c) 1992-1997,2001 by Standard Performance Evaluation Corporation
8 * Standard Performance Evaluation Corporation (SPEC)
9 * 6585 Merchant Place, Suite 100
12 * This product contains benchmarks acquired from several sources who
13 * understand and agree with SPEC's goal of creating fair and objective
14 * benchmarks to measure computer performance.
16 * This copyright notice is placed here only to protect SPEC in the
17 * event the source is misused in any manner that is contrary to the
18 * spirit, the goals and the intent of SPEC.
20 * The source code is provided to the user or company under the license
21 * agreement for the SPEC Benchmark Suite for this product.
24 #ifndef __RPC_OSDEP_H__
25 #define __RPC_OSDEP_H__
30 * These are non-XPG4.2 standard include files, if not compiling in a
31 * strict environment simply #include them, otherwise we must define
32 * our own missing pieces. The definitions below are specific to
33 * Solaris 2.X and may be different on other systems.
36 #if !defined(_XOPEN_SOURCE) || defined (OSF1) || defined(AIX)
41 #include <sys/param.h>
43 #include <sys/socket.h>
44 #include <netinet/in.h>
46 #include <netinet/tcp.h>
47 #include <arpa/inet.h>
48 #include <sys/ioctl.h>
50 #if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(lint)
57 #elif !defined(ntohl) /* little-endian */
59 extern unsigned short ntohs(unsigned short ns);
60 extern unsigned short htons(unsigned short hs);
61 extern unsigned long ntohl(unsigned long nl);
62 extern unsigned long htonl(unsigned long hl);
67 * This definition contains obsolete fields for compatibility
68 * with SunOS 3.x and 4.2bsd. The presence of subnets renders
69 * divisions into fixed fields misleading at best. New code
70 * should use only the s_addr field.
74 struct { unsigned char s_b1, s_b2, s_b3, s_b4; } S_un_b;
75 struct { unsigned short s_w1, s_w2; } S_un_w;
78 #define s_addr S_un.S_addr /* should be used for all code */
79 #define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */
80 #define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */
81 #define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */
82 #define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */
83 #define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */
88 unsigned short sin_port;
89 struct in_addr sin_addr;
94 * Structure used by kernel to store most
98 uint16_t sa_family; /* address family */
99 char sa_data[14]; /* up to 14 bytes of direct address */
103 * Interface request structure used for socket
104 * ioctl's. All interface ioctl's must have parameter
105 * definitions which begin with ifr_name. The
106 * remainder may be interface specific.
110 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
112 struct sockaddr ifru_addr;
113 struct sockaddr ifru_dstaddr;
114 char ifru_oname[IFNAMSIZ]; /* other if name */
115 struct sockaddr ifru_broadaddr;
118 char ifru_data[1]; /* interface dependent data */
120 int if_muxid[2]; /* mux id's for arp and ip */
122 /* Struct for FDDI ioctl's */
123 struct ifr_dnld_reqs {
130 /* Struct for FDDI stats */
131 struct ifr_fddi_stats {
136 struct ifr_netmapents {
137 uint_t map_ent_size, /* size of netmap structure */
138 entry_number; /* index into netmap list */
139 void *fddi_map_ent; /* pointer to user structure */
142 /* Field for generic ioctl for fddi */
144 struct ifr_fddi_gen_struct {
145 int ifru_fddi_gioctl; /* field for gen ioctl */
146 void *ifru_fddi_gaddr; /* Generic ptr to a field */
151 #define ifr_addr ifr_ifru.ifru_addr /* address */
152 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
153 #define ifr_oname ifr_ifru.ifru_oname /* other if name */
154 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
155 #define ifr_flags ifr_ifru.ifru_flags /* flags */
156 #define ifr_metric ifr_ifru.ifru_metric /* metric */
157 #define ifr_data ifr_ifru.ifru_data /* for use by interface */
158 #define ifr_enaddr ifr_ifru.ifru_enaddr /* ethernet address */
161 #define ifr_dnld_req ifr_ifru.ifru_dnld_req
162 #define ifr_fddi_stat ifr_ifru.ifru_fddi_stat
163 #define ifr_fddi_netmap ifr_ifru.ifru_netmapent /* FDDI network map entries */
164 #define ifr_fddi_gstruct ifr_ifru.ifru_fddi_gstruct
166 #define ifr_ip_muxid ifr_ifru.if_muxid[0]
167 #define ifr_arp_muxid ifr_ifru.if_muxid[1]
171 int ifc_len; /* size of associated buffer */
174 struct ifreq *ifcu_req;
176 #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
177 #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
181 #define IPPROTO_TCP 6
182 #define IPPROTO_UDP 17
183 #define IPPORT_RESERVED 1024
185 #define SOCK_STREAM 2
186 #define SO_SNDBUF 0x1001
187 #define SO_RCVBUF 0x1002
188 #define SOL_SOCKET 0xffff
189 #define INADDR_ANY (uint32_t)0x00000000
190 #define IFF_BROADCAST 0x2
193 #define IOCPARM_MASK 0xff
194 #define IOC_OUT 0x40000000
195 #define IOC_IN 0x80000000
196 #define IOC_INOUT (IOC_IN|IOC_OUT)
197 #define _IOWR(x, y, t) \
198 (IOC_INOUT|((((int)sizeof (t))&IOCPARM_MASK)<<16)|(x<<8)|y)
199 #define SIOCGIFCONF _IOWR('i', 20, struct ifconf)
200 #define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq)
201 #define SIOCGIFBRDADDR _IOWR('i', 23, struct ifreq)
203 extern int accept(int, struct sockaddr *, int *);
204 extern int bind(int, struct sockaddr *, int);
205 extern int connect(int, struct sockaddr *, int);
206 extern int getsockname(int, struct sockaddr *, int *);
207 extern int getsockopt(int, int, int, char *, int *);
208 extern int listen(int, int);
209 extern int recvfrom(int, char *, int, int, struct sockaddr *, int *);
210 extern int sendto(int, const char *, int, int, const struct sockaddr *, int);
211 extern int setsockopt(int, int, int, const char *, int);
212 extern int socket(int, int, int);
213 extern unsigned long inet_netof(struct in_addr);
214 extern struct in_addr inet_makeaddr(int, int);
216 #endif /* _XOPEN_SOURCE */
218 #endif /* __RPC_OSDEP_H__ */