3d31ad290c8aefff874559099f6ad4613704fb44
[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.1 2004/03/04 10:29:24 hsu 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 static __inline int
41 so_pru_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
42     struct mbuf *top, struct mbuf *control, int flags, struct thread *td)
43 {
44         return ((*so->so_proto->pr_usrreqs->pru_sosend)(so, addr, uio, top,
45             control, flags, td));
46 }
47
48 static __inline int
49 so_pru_soreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio,
50     struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
51 {
52         return ((*so->so_proto->pr_usrreqs->pru_soreceive)(so, paddr, uio, mp0,
53             controlp, flagsp));
54 }
55
56 static __inline int
57 so_pru_abort(struct socket *so)
58 {
59         return ((*so->so_proto->pr_usrreqs->pru_abort)(so));
60 }
61
62 static __inline int
63 so_pru_accept(struct socket *so,
64     struct sockaddr **nam)
65 {
66         return ((*so->so_proto->pr_usrreqs->pru_accept)(so, nam));
67 }
68
69 static __inline int
70 so_pru_attach(struct socket *so, int proto, struct thread *td)
71 {
72         return ((*so->so_proto->pr_usrreqs->pru_attach)(so, proto, td));
73 }
74
75 static __inline int
76 so_pru_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
77 {
78         return ((*so->so_proto->pr_usrreqs->pru_bind)(so, nam, td));
79 }
80
81 static __inline int
82 so_pru_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
83 {
84         return ((*so->so_proto->pr_usrreqs->pru_connect)(so, nam, td));
85 }
86
87 static __inline int
88 so_pru_connect2(struct socket *so1, struct socket *so2)
89 {
90         return ((*so1->so_proto->pr_usrreqs->pru_connect2)(so1, so2));
91 }
92
93 static __inline int
94 so_pru_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
95     struct thread *td)
96 {
97         return ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, ifp,
98             td));
99 }
100
101 static __inline int
102 so_pru_detach(struct socket *so)
103 {
104         return ((*so->so_proto->pr_usrreqs->pru_detach)(so));
105 }
106
107 static __inline int
108 so_pru_disconnect(struct socket *so)
109 {
110         return ((*so->so_proto->pr_usrreqs->pru_disconnect)(so));
111 }
112
113 static __inline int
114 so_pru_listen(struct socket *so, struct thread *td)
115 {
116         return ((*so->so_proto->pr_usrreqs->pru_listen)(so, td));
117 }
118
119 static __inline int
120 so_pru_peeraddr(struct socket *so,
121     struct sockaddr **nam)
122 {
123         return ((*so->so_proto->pr_usrreqs->pru_peeraddr)(so, nam));
124 }
125
126 static __inline int
127 so_pru_rcvd(struct socket *so, int flags)
128 {
129         return ((*so->so_proto->pr_usrreqs->pru_rcvd)(so, flags));
130 }
131
132 static __inline int
133 so_pru_rcvoob(struct socket *so, struct mbuf *m, int flags)
134 {
135         return ((*so->so_proto->pr_usrreqs->pru_rcvoob)(so, m, flags));
136 }
137
138 static __inline int
139 so_pru_send(struct socket *so, int flags, struct mbuf *m,
140     struct sockaddr *addr, struct mbuf *control, struct thread *td)
141 {
142         return ((*so->so_proto->pr_usrreqs->pru_send)(so, flags, m, addr,
143             control, td));
144 }
145
146 static __inline int
147 so_pru_sense(struct socket *so, struct stat *sb)
148 {
149         return ((*so->so_proto->pr_usrreqs->pru_sense)(so, sb));
150 }
151
152 static __inline int
153 so_pru_shutdown(struct socket *so)
154 {
155         return ((*so->so_proto->pr_usrreqs->pru_shutdown)(so));
156 }
157
158 static __inline int
159 so_pru_sockaddr(struct socket *so, struct sockaddr **nam)
160 {
161         return ((*so->so_proto->pr_usrreqs->pru_sockaddr)(so, nam));
162 }
163
164 static __inline int
165 so_pru_sopoll(struct socket *so, int events, struct ucred *cred,
166     struct thread *td)
167 {
168         return ((*so->so_proto->pr_usrreqs->pru_sopoll)(so, events, cred, td));
169 }
170
171 static __inline int
172 so_pr_ctloutput(struct socket *so, struct sockopt *sopt)
173 {
174         return ((*so->so_proto->pr_ctloutput)(so, sopt));
175 }
176
177 #endif