1 /* 2 * Copyright (c) 2003 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/net/netmsg.h,v 1.6 2007/05/23 08:57:10 dillon Exp $ 31 */ 32 33 #ifndef _NET_NETMSG_H_ 34 #define _NET_NETMSG_H_ 35 36 #ifndef _SYS_THREAD_H_ 37 #include <sys/thread.h> 38 #endif 39 #ifndef _SYS_PROTOSW_H_ 40 #include <sys/protosw.h> 41 #endif 42 43 struct netmsg; 44 45 typedef void (*netisr_fn_t)(struct netmsg *); 46 47 /* 48 * Base netmsg 49 */ 50 typedef struct netmsg { 51 struct lwkt_msg nm_lmsg; 52 netisr_fn_t nm_dispatch; 53 } *netmsg_t; 54 55 /* 56 * User protocol requests messages. 57 */ 58 struct netmsg_pru_abort { 59 struct netmsg nm_netmsg; 60 pru_abort_fn_t nm_prufn; 61 struct socket *nm_so; 62 }; 63 64 struct netmsg_pru_accept { 65 struct netmsg nm_netmsg; 66 pru_accept_fn_t nm_prufn; 67 struct socket *nm_so; 68 struct sockaddr **nm_nam; 69 }; 70 71 struct netmsg_pru_attach { 72 struct netmsg nm_netmsg; 73 pru_attach_fn_t nm_prufn; 74 struct socket *nm_so; 75 int nm_proto; 76 struct pru_attach_info *nm_ai; 77 }; 78 79 struct netmsg_pru_bind { 80 struct netmsg nm_netmsg; 81 pru_bind_fn_t nm_prufn; 82 struct socket *nm_so; 83 struct sockaddr *nm_nam; 84 struct thread *nm_td; 85 }; 86 87 struct netmsg_pru_connect { 88 struct netmsg nm_netmsg; 89 pru_connect_fn_t nm_prufn; 90 struct socket *nm_so; 91 struct sockaddr *nm_nam; 92 struct thread *nm_td; 93 }; 94 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; 100 }; 101 102 struct netmsg_pru_control { 103 struct netmsg nm_netmsg; 104 pru_control_fn_t nm_prufn; 105 struct socket *nm_so; 106 u_long nm_cmd; 107 caddr_t nm_data; 108 struct ifnet *nm_ifp; 109 struct thread *nm_td; 110 }; 111 112 struct netmsg_pru_detach { 113 struct netmsg nm_netmsg; 114 pru_detach_fn_t nm_prufn; 115 struct socket *nm_so; 116 }; 117 118 struct netmsg_pru_disconnect { 119 struct netmsg nm_netmsg; 120 pru_disconnect_fn_t nm_prufn; 121 struct socket *nm_so; 122 }; 123 124 struct netmsg_pru_listen { 125 struct netmsg nm_netmsg; 126 pru_listen_fn_t nm_prufn; 127 struct socket *nm_so; 128 struct thread *nm_td; 129 }; 130 131 struct netmsg_pru_peeraddr { 132 struct netmsg nm_netmsg; 133 pru_peeraddr_fn_t nm_prufn; 134 struct socket *nm_so; 135 struct sockaddr **nm_nam; 136 }; 137 138 struct netmsg_pru_rcvd { 139 struct netmsg nm_netmsg; 140 pru_rcvd_fn_t nm_prufn; 141 struct socket *nm_so; 142 int nm_flags; 143 }; 144 145 struct netmsg_pru_rcvoob { 146 struct netmsg nm_netmsg; 147 pru_rcvoob_fn_t nm_prufn; 148 struct socket *nm_so; 149 struct mbuf *nm_m; 150 int nm_flags; 151 }; 152 153 struct netmsg_pru_send { 154 struct netmsg nm_netmsg; 155 pru_send_fn_t nm_prufn; 156 struct socket *nm_so; 157 int nm_flags; 158 struct mbuf *nm_m; 159 struct sockaddr *nm_addr; 160 struct mbuf *nm_control; 161 struct thread *nm_td; 162 }; 163 164 struct netmsg_pru_sense { 165 struct netmsg nm_netmsg; 166 pru_sense_fn_t nm_prufn; 167 struct socket *nm_so; 168 struct stat *nm_stat; 169 }; 170 171 struct netmsg_pru_shutdown { 172 struct netmsg nm_netmsg; 173 pru_shutdown_fn_t nm_prufn; 174 struct socket *nm_so; 175 }; 176 177 struct netmsg_pru_sockaddr { 178 struct netmsg nm_netmsg; 179 pru_sockaddr_fn_t nm_prufn; 180 struct socket *nm_so; 181 struct sockaddr **nm_nam; 182 }; 183 184 struct netmsg_pru_sosend { 185 struct netmsg nm_netmsg; 186 pru_sosend_fn_t nm_prufn; 187 struct socket *nm_so; 188 struct sockaddr *nm_addr; 189 struct uio *nm_uio; 190 struct mbuf *nm_top; 191 struct mbuf *nm_control; 192 int nm_flags; 193 struct thread *nm_td; 194 }; 195 196 struct netmsg_pru_soreceive { 197 struct netmsg nm_netmsg; 198 struct sockaddr *nm_addr; 199 struct socket *nm_so; 200 struct sockaddr **nm_paddr; 201 struct uio *nm_uio; 202 struct sockbuf *nm_sio; 203 struct mbuf **nm_controlp; 204 int *nm_flagsp; 205 }; 206 207 struct netmsg_pru_sopoll { 208 struct netmsg nm_netmsg; 209 pru_sopoll_fn_t nm_prufn; 210 struct socket *nm_so; 211 int nm_events; 212 struct ucred *nm_cred; 213 struct thread *nm_td; 214 }; 215 216 #endif 217