The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/net/netmsg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    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.10 2008/10/27 02:56:30 sephe 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 pktinfo;
   44 
   45 typedef void (*netisr_fn_t)(netmsg_t);
   46 typedef void (*netisr_ru_t)(void);
   47 typedef void (*netisr_hashfn_t)(struct mbuf **, int);
   48 typedef void (*netisr_hashck_t)(struct mbuf *, const struct pktinfo *);
   49 
   50 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
   51 
   52 /*
   53  * The base netmsg prefixes all netmsgs and includes an embedded LWKT
   54  * message.
   55  */
   56 struct netmsg_base {
   57         struct lwkt_msg         lmsg;
   58         netisr_fn_t             nm_dispatch;
   59         struct socket           *nm_so;
   60 };
   61 
   62 typedef struct netmsg_base *netmsg_base_t;
   63 
   64 /*
   65  * NETISR messages
   66  *
   67  * NOTE:
   68  * - netmsg_packet is embedded in mbufs.
   69  * - netmsg_pru_send is embedded in mbufs.
   70  * - netmsg_inarp is embedded in mbufs.
   71  */
   72 TAILQ_HEAD(notifymsglist, netmsg_so_notify);
   73 
   74 struct netmsg_packet {
   75         struct netmsg_base      base;
   76         struct mbuf             *nm_packet;
   77         int                     nm_nxt;
   78 };
   79 
   80 struct netmsg_inarp {
   81         struct netmsg_base      base;
   82         struct mbuf             *m;
   83         in_addr_t               saddr;
   84         in_addr_t               taddr;
   85         in_addr_t               myaddr;
   86 };
   87 
   88 struct netmsg_pr_timeout {
   89         struct netmsg_base      base;
   90 };
   91 
   92 struct netmsg_so_notify;
   93 typedef __boolean_t (*msg_predicate_fn_t)(struct netmsg_so_notify *);
   94 
   95 struct netmsg_so_notify {
   96         struct netmsg_base      base;
   97         msg_predicate_fn_t      nm_predicate;
   98         int                     nm_fflags; /* flags e.g. FNONBLOCK */
   99         int                     nm_etype;  /* receive or send event */
  100         TAILQ_ENTRY(netmsg_so_notify) nm_list;
  101 };
  102 
  103 struct netmsg_so_notify_abort {
  104         struct netmsg_base      base;
  105         struct netmsg_so_notify *nm_notifymsg;
  106 };
  107 
  108 #define NM_REVENT       0x1             /* event on receive buffer */
  109 #define NM_SEVENT       0x2             /* event on send buffer */
  110 
  111 /*
  112  * User protocol requests messages.
  113  */
  114 struct netmsg_pru_abort {
  115         struct netmsg_base      base;
  116 };
  117 
  118 struct netmsg_pru_accept {
  119         struct netmsg_base      base;
  120         struct sockaddr         **nm_nam;
  121 };
  122 
  123 struct netmsg_pru_attach {
  124         struct netmsg_base      base;
  125         int                     nm_proto;
  126         struct pru_attach_info  *nm_ai;
  127 };
  128 
  129 struct netmsg_pru_bind {
  130         struct netmsg_base      base;
  131         struct sockaddr         *nm_nam;
  132         struct thread           *nm_td;
  133 };
  134 
  135 struct netmsg_pru_connect {
  136         struct netmsg_base      base;
  137         struct sockaddr         *nm_nam;
  138         struct thread           *nm_td;
  139         struct mbuf             *nm_m;          /* connect with send */
  140         int                     nm_sndflags;    /* connect with send, PRUS_ */
  141         int                     nm_flags;       /* message control */
  142 };
  143 
  144 #define PRUC_RECONNECT          0x0001          /* thread port change */
  145 #define PRUC_NAMALLOC           0x0002          /* nm_nam allocated */
  146 #define PRUC_PUSH               0x0004          /* call tcp_output */
  147 #define PRUC_FALLBACK           0x0008          /* fallback to ipv4 */
  148 #define PRUC_ASYNC              0x0010
  149 #define PRUC_HELDTD             0x0020
  150 
  151 struct netmsg_pru_connect2 {
  152         struct netmsg_base      base;
  153         struct socket           *nm_so1;
  154         struct socket           *nm_so2;
  155 };
  156 
  157 struct netmsg_pru_control {
  158         struct netmsg_base      base;
  159         u_long                  nm_cmd;
  160         caddr_t                 nm_data;
  161         struct ifnet            *nm_ifp;
  162         struct thread           *nm_td;
  163 };
  164 
  165 struct netmsg_pru_detach {
  166         struct netmsg_base      base;
  167 };
  168 
  169 struct netmsg_pru_disconnect {
  170         struct netmsg_base      base;
  171 };
  172 
  173 struct netmsg_pru_listen {
  174         struct netmsg_base      base;
  175         struct thread           *nm_td;
  176         int                     nm_flags;       /* PRUL_xxx */
  177 };
  178 
  179 #define PRUL_RELINK             0x1
  180 
  181 struct netmsg_pru_peeraddr {
  182         struct netmsg_base      base;
  183         struct sockaddr         **nm_nam;
  184 };
  185 
  186 struct netmsg_pru_rcvd {
  187         struct netmsg_base      base;
  188         int                     nm_flags;
  189         int                     nm_pru_flags;   /* PRUR_xxx */
  190 };
  191 
  192 #define PRUR_ASYNC              0x1
  193 #define PRUR_DEAD               0x2
  194 
  195 struct netmsg_pru_rcvoob {
  196         struct netmsg_base      base;
  197         struct mbuf             *nm_m;
  198         int                     nm_flags;
  199 };
  200 
  201 struct netmsg_pru_send {
  202         struct netmsg_base      base;
  203         int                     nm_flags;       /* PRUS_xxx */
  204         struct mbuf             *nm_m;
  205         struct sockaddr         *nm_addr;
  206         struct mbuf             *nm_control;
  207         struct thread           *nm_td;
  208 };
  209 
  210 #define PRUS_OOB                0x1
  211 #define PRUS_EOF                0x2
  212 #define PRUS_MORETOCOME         0x4
  213 #define PRUS_NAMALLOC           0x8
  214 #define PRUS_NOREPLY            0x10
  215 #define PRUS_DONTROUTE          0x20
  216 #define PRUS_FREEADDR           0x40
  217 #define PRUS_HELDTD             0x80
  218 
  219 struct netmsg_pru_sense {
  220         struct netmsg_base      base;
  221         struct stat             *nm_stat;
  222 };
  223 
  224 struct netmsg_pru_shutdown {
  225         struct netmsg_base      base;
  226 };
  227 
  228 struct netmsg_pru_sockaddr {
  229         struct netmsg_base      base;
  230         struct sockaddr         **nm_nam;
  231 };
  232 
  233 struct netmsg_pru_sosend {
  234         struct netmsg_base      base;
  235         struct sockaddr         *nm_addr;
  236         struct uio              *nm_uio;
  237         struct mbuf             *nm_top;
  238         struct mbuf             *nm_control;
  239         int                     nm_flags;
  240         struct thread           *nm_td;
  241 };
  242 
  243 struct netmsg_pru_soreceive {
  244         struct netmsg_base      base;
  245         struct sockaddr         *nm_addr;
  246         struct sockaddr         **nm_paddr;
  247         struct uio              *nm_uio;
  248         struct sockbuf          *nm_sio;
  249         struct mbuf             **nm_controlp;
  250         int                     *nm_flagsp;
  251 };
  252 
  253 struct netmsg_pr_ctloutput {
  254         struct netmsg_base      base;
  255         struct sockopt          *nm_sopt;
  256 };
  257 
  258 struct netmsg_pru_ctlinput {
  259         struct netmsg_base      base;
  260         int                     nm_cmd;
  261         struct sockaddr         *nm_arg;
  262         void                    *nm_extra;
  263 };
  264 
  265 /*
  266  * Union of all possible netmsgs.  Note that when a netmsg is sent the
  267  * actual allocated storage is likely only the size of the particular
  268  * class of message, and not sizeof(union netmsg).
  269  */
  270 union netmsg {
  271         struct lwkt_msg                 lmsg;           /* base embedded */
  272         struct netmsg_base              base;           /* base embedded */
  273 
  274         struct netmsg_packet            packet;         /* mbuf embedded */
  275         struct netmsg_pr_timeout        timeout;
  276         struct netmsg_so_notify         notify;
  277         struct netmsg_so_notify_abort   notify_abort;
  278 
  279         struct netmsg_pr_ctloutput      ctloutput;
  280 
  281         struct netmsg_pru_abort         abort;
  282         struct netmsg_pru_accept        accept;         /* synchronous */
  283         struct netmsg_pru_attach        attach;
  284         struct netmsg_pru_bind          bind;
  285         struct netmsg_pru_connect       connect;
  286         struct netmsg_pru_connect2      connect2;
  287         struct netmsg_pru_control       control;        /* synchronous */
  288         struct netmsg_pru_detach        detach;
  289         struct netmsg_pru_disconnect    disconnect;
  290         struct netmsg_pru_listen        listen;
  291         struct netmsg_pru_peeraddr      peeraddr;
  292         struct netmsg_pru_rcvd          rcvd;
  293         struct netmsg_pru_rcvoob        rcvoob;
  294         struct netmsg_pru_send          send;
  295         struct netmsg_pru_sense         sense;
  296         struct netmsg_pru_shutdown      shutdown;
  297         struct netmsg_pru_sockaddr      sockaddr;
  298         struct netmsg_pru_sosend        sosend;         /* synchronous */
  299         struct netmsg_pru_soreceive     soreceive;      /* synchronous */
  300         struct netmsg_pru_ctlinput      ctlinput;
  301 };
  302 
  303 #endif  /* _KERNEL || _KERNEL_STRUCTURES */
  304 
  305 #endif  /* !_NET_NETMSG_H_ */

Cache object: 35e6a3198f533f49e89496d5d0395856


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.