un.h revision 81857
11541Srgrimes/*
21541Srgrimes * Copyright (c) 1982, 1986, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes * 3. All advertising materials mentioning features or use of this software
141541Srgrimes *    must display the following acknowledgement:
151541Srgrimes *	This product includes software developed by the University of
161541Srgrimes *	California, Berkeley and its contributors.
171541Srgrimes * 4. Neither the name of the University nor the names of its contributors
181541Srgrimes *    may be used to endorse or promote products derived from this software
191541Srgrimes *    without specific prior written permission.
201541Srgrimes *
211541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311541Srgrimes * SUCH DAMAGE.
321541Srgrimes *
3314489Shsu *	@(#)un.h	8.3 (Berkeley) 2/19/95
3450477Speter * $FreeBSD: head/sys/sys/un.h 81857 2001-08-17 22:01:18Z dd $
351541Srgrimes */
361541Srgrimes
372165Spaul#ifndef _SYS_UN_H_
382165Spaul#define _SYS_UN_H_
392165Spaul
401541Srgrimes/*
411541Srgrimes * Definitions for UNIX IPC domain.
421541Srgrimes */
431541Srgrimesstruct	sockaddr_un {
441541Srgrimes	u_char	sun_len;		/* sockaddr len including null */
451541Srgrimes	u_char	sun_family;		/* AF_UNIX */
461541Srgrimes	char	sun_path[104];		/* path name (gag) */
471541Srgrimes};
481541Srgrimes
4981857Sdd/* Socket options. */
5081857Sdd#define LOCAL_PEERCRED		0x001		/* retrieve peer credentails */
5181857Sdd
5255205Speter#ifdef _KERNEL
5328270Swollmanstruct mbuf;
5436124Sbdestruct socket;
5514489Shsu
5614489Shsuint	uipc_usrreq __P((struct socket *so, int req, struct mbuf *m,
5714489Shsu		struct mbuf *nam, struct mbuf *control));
5881857Sddint	uipc_ctloutput __P((struct socket *so, struct sockopt *sopt));
5914489Shsuint	unp_connect2 __P((struct socket *so, struct socket *so2));
6014489Shsuvoid	unp_dispose __P((struct mbuf *m));
6114489Shsuint	unp_externalize __P((struct mbuf *rights));
6236079Swollmanvoid	unp_init __P((void));
6325201Swollmanextern	struct pr_usrreqs uipc_usrreqs;
6455205Speter#else /* !_KERNEL */
6514489Shsu
661541Srgrimes/* actual length of an initialized sockaddr_un */
671541Srgrimes#define SUN_LEN(su) \
681541Srgrimes	(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
692165Spaul
7055205Speter#endif /* _KERNEL */
7114489Shsu
7214489Shsu#endif /* !_SYS_UN_H_ */
73