Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.git] / sys / net / netmsg.h
blob5b5d497f0df5f8408a88d22fc2e95b80358a0d7b
1 /*
2 * Copyright (c) 2003 Jeffrey Hsu
3 * All rights reserved.
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.
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.
30 * $DragonFly: src/sys/net/netmsg.h,v 1.10 2008/10/27 02:56:30 sephe Exp $
33 #ifndef _NET_NETMSG_H_
34 #define _NET_NETMSG_H_
36 #ifndef _SYS_THREAD_H_
37 #include <sys/thread.h>
38 #endif
39 #ifndef _SYS_PROTOSW_H_
40 #include <sys/protosw.h>
41 #endif
43 struct netmsg;
45 typedef void (*netisr_fn_t)(struct netmsg *);
48 * Base netmsg
50 typedef struct netmsg {
51 struct lwkt_msg nm_lmsg;
52 netisr_fn_t nm_dispatch;
53 } *netmsg_t;
55 #define MSGF_MPSAFE MSGF_USER0
57 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
60 * User protocol requests messages.
62 struct netmsg_pru_abort {
63 struct netmsg nm_netmsg;
64 pru_abort_fn_t nm_prufn;
65 struct socket *nm_so;
68 struct netmsg_pru_accept {
69 struct netmsg nm_netmsg;
70 pru_accept_fn_t nm_prufn;
71 struct socket *nm_so;
72 struct sockaddr **nm_nam;
75 struct netmsg_pru_attach {
76 struct netmsg nm_netmsg;
77 pru_attach_fn_t nm_prufn;
78 struct socket *nm_so;
79 int nm_proto;
80 struct pru_attach_info *nm_ai;
83 struct netmsg_pru_bind {
84 struct netmsg nm_netmsg;
85 pru_bind_fn_t nm_prufn;
86 struct socket *nm_so;
87 struct sockaddr *nm_nam;
88 struct thread *nm_td;
91 struct netmsg_pru_connect {
92 struct netmsg nm_netmsg;
93 pru_connect_fn_t nm_prufn;
94 struct socket *nm_so;
95 struct sockaddr *nm_nam;
96 struct thread *nm_td;
99 struct netmsg_pru_connect2 {
100 struct netmsg nm_netmsg;
101 pru_connect2_fn_t nm_prufn;
102 struct socket *nm_so1;
103 struct socket *nm_so2;
106 struct netmsg_pru_control {
107 struct netmsg nm_netmsg;
108 pru_control_fn_t nm_prufn;
109 struct socket *nm_so;
110 u_long nm_cmd;
111 caddr_t nm_data;
112 struct ifnet *nm_ifp;
113 struct thread *nm_td;
116 struct netmsg_pru_detach {
117 struct netmsg nm_netmsg;
118 pru_detach_fn_t nm_prufn;
119 struct socket *nm_so;
122 struct netmsg_pru_disconnect {
123 struct netmsg nm_netmsg;
124 pru_disconnect_fn_t nm_prufn;
125 struct socket *nm_so;
128 struct netmsg_pru_listen {
129 struct netmsg nm_netmsg;
130 pru_listen_fn_t nm_prufn;
131 struct socket *nm_so;
132 struct thread *nm_td;
135 struct netmsg_pru_peeraddr {
136 struct netmsg nm_netmsg;
137 pru_peeraddr_fn_t nm_prufn;
138 struct socket *nm_so;
139 struct sockaddr **nm_nam;
142 struct netmsg_pru_rcvd {
143 struct netmsg nm_netmsg;
144 pru_rcvd_fn_t nm_prufn;
145 struct socket *nm_so;
146 int nm_flags;
149 struct netmsg_pru_rcvoob {
150 struct netmsg nm_netmsg;
151 pru_rcvoob_fn_t nm_prufn;
152 struct socket *nm_so;
153 struct mbuf *nm_m;
154 int nm_flags;
157 struct netmsg_pru_send {
158 struct netmsg nm_netmsg;
159 pru_send_fn_t nm_prufn;
160 struct socket *nm_so;
161 int nm_flags;
162 struct mbuf *nm_m;
163 struct sockaddr *nm_addr;
164 struct mbuf *nm_control;
165 struct thread *nm_td;
168 struct netmsg_pru_sense {
169 struct netmsg nm_netmsg;
170 pru_sense_fn_t nm_prufn;
171 struct socket *nm_so;
172 struct stat *nm_stat;
175 struct netmsg_pru_shutdown {
176 struct netmsg nm_netmsg;
177 pru_shutdown_fn_t nm_prufn;
178 struct socket *nm_so;
181 struct netmsg_pru_sockaddr {
182 struct netmsg nm_netmsg;
183 pru_sockaddr_fn_t nm_prufn;
184 struct socket *nm_so;
185 struct sockaddr **nm_nam;
188 struct netmsg_pru_sosend {
189 struct netmsg nm_netmsg;
190 pru_sosend_fn_t nm_prufn;
191 struct socket *nm_so;
192 struct sockaddr *nm_addr;
193 struct uio *nm_uio;
194 struct mbuf *nm_top;
195 struct mbuf *nm_control;
196 int nm_flags;
197 struct thread *nm_td;
200 struct netmsg_pru_soreceive {
201 struct netmsg nm_netmsg;
202 struct sockaddr *nm_addr;
203 struct socket *nm_so;
204 struct sockaddr **nm_paddr;
205 struct uio *nm_uio;
206 struct sockbuf *nm_sio;
207 struct mbuf **nm_controlp;
208 int *nm_flagsp;
211 struct netmsg_pru_sopoll {
212 struct netmsg nm_netmsg;
213 pru_sopoll_fn_t nm_prufn;
214 struct socket *nm_so;
215 int nm_events;
216 struct ucred *nm_cred;
217 struct thread *nm_td;
220 struct netmsg_pru_ctloutput {
221 struct netmsg nm_netmsg;
222 pru_ctloutput_fn_t nm_prufn;
223 struct socket *nm_so;
224 struct sockopt *nm_sopt;
227 struct netmsg_pru_ctlinput {
228 struct netmsg nm_netmsg;
229 pru_ctlinput_fn_t nm_prufn;
230 int nm_cmd;
231 struct sockaddr *nm_arg;
232 void *nm_extra;
235 #endif /* _KERNEL || _KERNEL_STRUCTURES */
237 #endif /* !_NET_NETMSG_H_ */