Consolidate SYSCTL_DECL(_kern_ipc), move it to sys/sysctl.h as
[dragonfly.git] / sys / sys / socketops.h
1 /*
2  * Copyright (c) 2003, 2004 Jeffrey Hsu
3  * 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
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by Jeffrey M. Hsu.
16  * 4. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  * 
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * $DragonFly: src/sys/sys/socketops.h,v 1.4 2004/03/19 17:00:06 dillon Exp $
31  */
32
33 #ifndef _SOCKETOPS_H_
34 #define _SOCKETOPS_H_
35
36 #include <sys/protosw.h>
37 #include <sys/socket.h>
38 #include <sys/socketvar.h>
39
40 /*
41  * sosend() and soreceive() can block and also calls other pru_usrreq functions.
42  * They should not really be usrreq functions.  Always call them directly from
43  * the process context rather than passing a message to the protocol thread.
44  */
45 static __inline int
46 so_pru_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
47     struct mbuf *top, struct mbuf *control, int flags, struct thread *td)
48 {
49         return ((*so->so_proto->pr_usrreqs->pru_sosend)(so, addr, uio, top,
50             control, flags, td));
51 }
52
53 static __inline int
54 so_pru_soreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio,
55     struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
56 {
57         return ((*so->so_proto->pr_usrreqs->pru_soreceive)(so, paddr, uio, mp0,
58             controlp, flagsp));
59 }
60
61 int so_pru_abort (struct socket *so);
62 int so_pru_accept (struct socket *so, struct sockaddr **nam);
63 int so_pru_attach (struct socket *so, int proto, struct pru_attach_info *ai);
64 int so_pru_bind (struct socket *so, struct sockaddr *nam, struct thread *td);
65 int so_pru_connect (struct socket *so, struct sockaddr *nam, struct thread *td);
66 int so_pru_connect2 (struct socket *so1, struct socket *so2);
67 int so_pru_control (struct socket *so, u_long cmd, caddr_t data,
68                     struct ifnet *ifp, struct thread *td);
69 int so_pru_detach (struct socket *so);
70 int so_pru_disconnect (struct socket *so);
71 int so_pru_listen (struct socket *so, struct thread *td);
72 int so_pru_peeraddr (struct socket *so, struct sockaddr **nam);
73 int so_pru_rcvd (struct socket *so, int flags);
74 int so_pru_rcvoob (struct socket *so, struct mbuf *m, int flags);
75 int so_pru_send (struct socket *so, int flags, struct mbuf *m,
76                  struct sockaddr *addr, struct mbuf *control,
77                  struct thread *td);
78 int so_pru_sense (struct socket *so, struct stat *sb);
79 int so_pru_shutdown (struct socket *so);
80 int so_pru_sockaddr (struct socket *so, struct sockaddr **nam);
81 int so_pru_sopoll (struct socket *so, int events, struct ucred *cred,
82                    struct thread *td);
83 int so_pr_ctloutput(struct socket *so, struct sockopt *sopt);
84
85 #endif