2 * Copyright (c) 2003 Jeffrey Hsu
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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>
39 #ifndef _SYS_PROTOSW_H_
40 #include <sys/protosw.h>
45 typedef void (*netisr_fn_t
)(struct netmsg
*);
50 typedef struct netmsg
{
51 struct lwkt_msg nm_lmsg
;
52 netisr_fn_t nm_dispatch
;
56 #define MSGF_MPSAFE MSGF_USER0
58 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
61 * User protocol requests messages.
63 struct netmsg_pru_abort
{
64 struct netmsg nm_netmsg
;
65 pru_abort_fn_t nm_prufn
;
68 struct netmsg_pru_accept
{
69 struct netmsg nm_netmsg
;
70 pru_accept_fn_t nm_prufn
;
71 struct sockaddr
**nm_nam
;
74 struct netmsg_pru_attach
{
75 struct netmsg nm_netmsg
;
76 pru_attach_fn_t nm_prufn
;
78 struct pru_attach_info
*nm_ai
;
81 struct netmsg_pru_bind
{
82 struct netmsg nm_netmsg
;
83 pru_bind_fn_t nm_prufn
;
84 struct sockaddr
*nm_nam
;
88 struct netmsg_pru_connect
{
89 struct netmsg nm_netmsg
;
90 pru_connect_fn_t nm_prufn
;
91 struct sockaddr
*nm_nam
;
95 struct netmsg_pru_connect2
{
96 struct netmsg nm_netmsg
;
97 pru_connect2_fn_t nm_prufn
;
98 struct socket
*nm_so1
;
99 struct socket
*nm_so2
;
102 struct netmsg_pru_control
{
103 struct netmsg nm_netmsg
;
104 pru_control_fn_t nm_prufn
;
107 struct ifnet
*nm_ifp
;
108 struct thread
*nm_td
;
111 struct netmsg_pru_detach
{
112 struct netmsg nm_netmsg
;
113 pru_detach_fn_t nm_prufn
;
116 struct netmsg_pru_disconnect
{
117 struct netmsg nm_netmsg
;
118 pru_disconnect_fn_t nm_prufn
;
121 struct netmsg_pru_listen
{
122 struct netmsg nm_netmsg
;
123 pru_listen_fn_t nm_prufn
;
124 struct thread
*nm_td
;
127 struct netmsg_pru_peeraddr
{
128 struct netmsg nm_netmsg
;
129 pru_peeraddr_fn_t nm_prufn
;
130 struct sockaddr
**nm_nam
;
133 struct netmsg_pru_rcvd
{
134 struct netmsg nm_netmsg
;
135 pru_rcvd_fn_t nm_prufn
;
139 struct netmsg_pru_rcvoob
{
140 struct netmsg nm_netmsg
;
141 pru_rcvoob_fn_t nm_prufn
;
146 struct netmsg_pru_send
{
147 struct netmsg nm_netmsg
;
148 pru_send_fn_t nm_prufn
;
151 struct sockaddr
*nm_addr
;
152 struct mbuf
*nm_control
;
153 struct thread
*nm_td
;
156 struct netmsg_pru_sense
{
157 struct netmsg nm_netmsg
;
158 pru_sense_fn_t nm_prufn
;
159 struct stat
*nm_stat
;
162 struct netmsg_pru_shutdown
{
163 struct netmsg nm_netmsg
;
164 pru_shutdown_fn_t nm_prufn
;
167 struct netmsg_pru_sockaddr
{
168 struct netmsg nm_netmsg
;
169 pru_sockaddr_fn_t nm_prufn
;
170 struct sockaddr
**nm_nam
;
173 struct netmsg_pru_sosend
{
174 struct netmsg nm_netmsg
;
175 pru_sosend_fn_t nm_prufn
;
176 struct sockaddr
*nm_addr
;
179 struct mbuf
*nm_control
;
181 struct thread
*nm_td
;
184 struct netmsg_pru_soreceive
{
185 struct netmsg nm_netmsg
;
186 struct sockaddr
*nm_addr
;
187 struct sockaddr
**nm_paddr
;
189 struct sockbuf
*nm_sio
;
190 struct mbuf
**nm_controlp
;
194 struct netmsg_pru_sopoll
{
195 struct netmsg nm_netmsg
;
196 pru_sopoll_fn_t nm_prufn
;
198 struct ucred
*nm_cred
;
199 struct thread
*nm_td
;
202 struct netmsg_pru_ctloutput
{
203 struct netmsg nm_netmsg
;
204 pru_ctloutput_fn_t nm_prufn
;
205 struct sockopt
*nm_sopt
;
208 struct netmsg_pru_ctlinput
{
209 struct netmsg nm_netmsg
;
210 pru_ctlinput_fn_t nm_prufn
;
212 struct sockaddr
*nm_arg
;
216 #endif /* _KERNEL || _KERNEL_STRUCTURES */
218 #endif /* !_NET_NETMSG_H_ */