Deleted Added
full compact
socket.h (22975) socket.h (24083)
1/*
2 * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)socket.h 8.4 (Berkeley) 2/21/94
1/*
2 * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)socket.h 8.4 (Berkeley) 2/21/94
34 * $Id$
34 * $Id: socket.h,v 1.17 1997/02/22 09:45:55 peter Exp $
35 */
36
37#ifndef _SYS_SOCKET_H_
38#define _SYS_SOCKET_H_
39
40/*
41 * Definitions related to sockets: types, address families, options.
42 */

--- 241 unchanged lines hidden (view full) ---

284 */
285struct cmsghdr {
286 u_int cmsg_len; /* data byte count, including hdr */
287 int cmsg_level; /* originating protocol */
288 int cmsg_type; /* protocol-specific type */
289/* followed by u_char cmsg_data[]; */
290};
291
35 */
36
37#ifndef _SYS_SOCKET_H_
38#define _SYS_SOCKET_H_
39
40/*
41 * Definitions related to sockets: types, address families, options.
42 */

--- 241 unchanged lines hidden (view full) ---

284 */
285struct cmsghdr {
286 u_int cmsg_len; /* data byte count, including hdr */
287 int cmsg_level; /* originating protocol */
288 int cmsg_type; /* protocol-specific type */
289/* followed by u_char cmsg_data[]; */
290};
291
292/*
293 * While we may have more groups than this, the cmsgcred struct must
294 * be able to fit in an mbuf, and NGROUPS_MAX is too large to allow
295 * this.
296*/
297#define CMGROUP_MAX 16
298
299/*
300 * Credentials structure, used to verify the identity of a peer
301 * process that has sent us a message. This is allocated by the
302 * peer process but filled in by the kernel. This prevents the
303 * peer from lying about its identity. (Note that cmcred_groups[0]
304 * is the effective GID.)
305 */
306struct cmsgcred {
307 pid_t cmcred_pid; /* PID of sending process */
308 uid_t cmcred_uid; /* real UID of sending process */
309 uid_t cmcred_euid; /* effective UID of sending process */
310 gid_t cmcred_gid; /* real GID of sending process */
311 short cmcred_ngroups; /* number or groups */
312 gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
313};
314
292/* given pointer to struct cmsghdr, return pointer to data */
293#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1))
294
295/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
296#define CMSG_NXTHDR(mhdr, cmsg) \
297 (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \
298 (mhdr)->msg_control + (mhdr)->msg_controllen) ? \
299 (struct cmsghdr *)NULL : \
300 (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len)))
301
302#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
303
304/* "Socket"-level control message types: */
305#define SCM_RIGHTS 0x01 /* access rights (array of int) */
306#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */
315/* given pointer to struct cmsghdr, return pointer to data */
316#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1))
317
318/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
319#define CMSG_NXTHDR(mhdr, cmsg) \
320 (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \
321 (mhdr)->msg_control + (mhdr)->msg_controllen) ? \
322 (struct cmsghdr *)NULL : \
323 (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len)))
324
325#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
326
327/* "Socket"-level control message types: */
328#define SCM_RIGHTS 0x01 /* access rights (array of int) */
329#define SCM_TIMESTAMP 0x02 /* timestamp (struct timeval) */
330#define SCM_CREDS 0x03 /* process creds (struct cmsgcred) */
307
308/*
309 * 4.3 compat sockaddr, move to compat file later
310 */
311struct osockaddr {
312 u_short sa_family; /* address family */
313 char sa_data[14]; /* up to 14 bytes of direct address */
314};

--- 42 unchanged lines hidden ---
331
332/*
333 * 4.3 compat sockaddr, move to compat file later
334 */
335struct osockaddr {
336 u_short sa_family; /* address family */
337 char sa_data[14]; /* up to 14 bytes of direct address */
338};

--- 42 unchanged lines hidden ---