\hypertarget{ng__base_8c_source}{}\doxysection{ng\+\_\+base.\+c}
\label{ng__base_8c_source}\index{netgraph/ng\_base.c@{netgraph/ng\_base.c}}
\mbox{\hyperlink{ng__base_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 1996-\/1999 Whistle Communications, Inc.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00003}00003 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00004}00004 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00005}00005 \textcolor{comment}{ * Subject to the following obligations and disclaimer of warranty, use and}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00006}00006 \textcolor{comment}{ * redistribution of this software, in source or object code forms, with or}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00007}00007 \textcolor{comment}{ * without modifications are expressly permitted by Whistle Communications;}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00008}00008 \textcolor{comment}{ * provided, however, that:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00009}00009 \textcolor{comment}{ * 1. Any and all reproductions of the source or object code must include the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00010}00010 \textcolor{comment}{ *    copyright notice above and the following disclaimer of warranties; and}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00011}00011 \textcolor{comment}{ * 2. No rights are granted, in any manner or form, to use Whistle}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00012}00012 \textcolor{comment}{ *    Communications, Inc. trademarks, including the mark "{}WHISTLE}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00013}00013 \textcolor{comment}{ *    COMMUNICATIONS"{} on advertising, endorsements, or otherwise except as}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00014}00014 \textcolor{comment}{ *    such appears in the above copyright notice or in the software.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00016}00016 \textcolor{comment}{ * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "{}AS IS"{}, AND}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00017}00017 \textcolor{comment}{ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00018}00018 \textcolor{comment}{ * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00019}00019 \textcolor{comment}{ * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00020}00020 \textcolor{comment}{ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-\/INFRINGEMENT.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00021}00021 \textcolor{comment}{ * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00022}00022 \textcolor{comment}{ * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00023}00023 \textcolor{comment}{ * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00024}00024 \textcolor{comment}{ * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00025}00025 \textcolor{comment}{ * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00026}00026 \textcolor{comment}{ * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00027}00027 \textcolor{comment}{ * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00028}00028 \textcolor{comment}{ * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00029}00029 \textcolor{comment}{ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00030}00030 \textcolor{comment}{ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00031}00031 \textcolor{comment}{ * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00032}00032 \textcolor{comment}{ * OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00033}00033 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00034}00034 \textcolor{comment}{ * Authors: Julian Elischer <julian@freebsd.org>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00035}00035 \textcolor{comment}{ *          Archie Cobbs <archie@freebsd.org>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00036}00036 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00037}00037 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00038}00038 \textcolor{comment}{ * \$Whistle: ng\_base.c,v 1.39 1999/01/28 23:54:53 julian Exp \$}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00039}00039 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00040}00040 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00041}00041 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00042}00042 \textcolor{comment}{ * This file implements the base netgraph code.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00043}00043 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00044}00044 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <sys/ctype.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/hash.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/kdb.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <sys/kthread.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <sys/ktr.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00053}00053 \textcolor{preprocessor}{\#include <sys/limits.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00055}00055 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <sys/proc.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00058}00058 \textcolor{preprocessor}{\#include <sys/epoch.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <sys/refcount.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00061}00061 \textcolor{preprocessor}{\#include <sys/rwlock.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00062}00062 \textcolor{preprocessor}{\#include <sys/smp.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00063}00063 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00064}00064 \textcolor{preprocessor}{\#include <sys/syslog.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00065}00065 \textcolor{preprocessor}{\#include <sys/unistd.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00066}00066 \textcolor{preprocessor}{\#include <machine/cpu.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00067}00067 \textcolor{preprocessor}{\#include <vm/uma.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00068}00068 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00069}00069 \textcolor{preprocessor}{\#include <net/netisr.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00070}00070 \textcolor{preprocessor}{\#include <net/vnet.h>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00071}00071 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00072}00072 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__message_8h}{netgraph/ng\_message.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00073}00073 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{netgraph_8h}{netgraph/netgraph.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00074}00074 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__parse_8h}{netgraph/ng\_parse.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00075}00075 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00076}\mbox{\hyperlink{ng__base_8c_a6b19b3abe9c3ecd68b3ba27b77f9db40}{00076}} \mbox{\hyperlink{ng__base_8c_a6b19b3abe9c3ecd68b3ba27b77f9db40}{MODULE\_VERSION}}(netgraph, \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00077}00077 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00078}00078 \textcolor{comment}{/* Mutex to protect topology events. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00079}\mbox{\hyperlink{ng__base_8c_a9f7903387702ed64f0d8f9d6a1fe2c44}{00079}} \textcolor{keyword}{static} \textcolor{keyword}{struct }rwlock    \mbox{\hyperlink{ng__base_8c_a9f7903387702ed64f0d8f9d6a1fe2c44}{ng\_topo\_lock}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00080}\mbox{\hyperlink{ng__base_8c_ae5b87416a2b11accb2a7f3271b033b21}{00080}} \textcolor{preprocessor}{\#define TOPOLOGY\_RLOCK()        rw\_rlock(\&ng\_topo\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00081}\mbox{\hyperlink{ng__base_8c_ac1083cc6c0f464103baed3f28488e144}{00081}} \textcolor{preprocessor}{\#define TOPOLOGY\_RUNLOCK()      rw\_runlock(\&ng\_topo\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00082}\mbox{\hyperlink{ng__base_8c_a94bd888ffca08e14ce5466ceceb4dcc6}{00082}} \textcolor{preprocessor}{\#define TOPOLOGY\_WLOCK()        rw\_wlock(\&ng\_topo\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00083}\mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{00083}} \textcolor{preprocessor}{\#define TOPOLOGY\_WUNLOCK()      rw\_wunlock(\&ng\_topo\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00084}\mbox{\hyperlink{ng__base_8c_a1b0965a46f18b75d1296474b25a43150}{00084}} \textcolor{preprocessor}{\#define TOPOLOGY\_NOTOWNED()     rw\_assert(\&ng\_topo\_lock, RA\_UNLOCKED)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00086}00086 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00087}00087 \textcolor{keyword}{static} \textcolor{keyword}{struct }mtx       ng\_nodelist\_mtx; \textcolor{comment}{/* protects global node/hook lists */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00088}00088 \textcolor{keyword}{static} \textcolor{keyword}{struct }mtx       ngq\_mtx;        \textcolor{comment}{/* protects the queue item list */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00089}00089 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00090}00090 \textcolor{keyword}{static} \mbox{\hyperlink{ng__bridge_8c_ac0f1c4b4c4a12c9bf3c4e860e746a966}{SLIST\_HEAD}}(, \mbox{\hyperlink{structng__node}{ng\_node}}) ng\_allnodes;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00091}00091 \textcolor{keyword}{static} \mbox{\hyperlink{ngatmbase_8c_a64ce0b7623e1c2ab0cc07245307db113}{LIST\_HEAD}}(, \mbox{\hyperlink{structng__node}{ng\_node}}) ng\_freenodes; \textcolor{comment}{/* in debug, we never free() them */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00092}00092 \textcolor{keyword}{static} \mbox{\hyperlink{ng__bridge_8c_ac0f1c4b4c4a12c9bf3c4e860e746a966}{SLIST\_HEAD}}(, \mbox{\hyperlink{structng__hook}{ng\_hook}}) ng\_allhooks;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00093}00093 \textcolor{keyword}{static} \mbox{\hyperlink{ngatmbase_8c_a64ce0b7623e1c2ab0cc07245307db113}{LIST\_HEAD}}(, \mbox{\hyperlink{structng__hook}{ng\_hook}}) ng\_freehooks; \textcolor{comment}{/* in debug, we never free() them */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00094}00094 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00095}00095 \textcolor{keyword}{static} \textcolor{keywordtype}{void} ng\_dumpitems(\textcolor{keywordtype}{void});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00096}00096 \textcolor{keyword}{static} \textcolor{keywordtype}{void} ng\_dumpnodes(\textcolor{keywordtype}{void});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00097}00097 \textcolor{keyword}{static} \textcolor{keywordtype}{void} ng\_dumphooks(\textcolor{keywordtype}{void});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00098}00098 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00099}00099 \textcolor{preprocessor}{\#endif  }\textcolor{comment}{/* NETGRAPH\_DEBUG */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00100}00100 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00101}00101 \textcolor{comment}{ * DEAD versions of the structures.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00102}00102 \textcolor{comment}{ * In order to avoid races, it is sometimes necessary to point}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00103}00103 \textcolor{comment}{ * at SOMETHING even though theoretically, the current entity is}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00104}00104 \textcolor{comment}{ * INVALID. Use these to avoid these races.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00105}00105 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00106}\mbox{\hyperlink{ng__base_8c_ad77874e8dc1023bf59c8ff1a0ba21cf6}{00106}} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} \mbox{\hyperlink{ng__base_8c_ad77874e8dc1023bf59c8ff1a0ba21cf6}{ng\_deadtype}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00107}00107         \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00108}00108         \textcolor{stringliteral}{"{}dead"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00109}00109         NULL,   \textcolor{comment}{/* modevent */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00110}00110         NULL,   \textcolor{comment}{/* constructor */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00111}00111         NULL,   \textcolor{comment}{/* rcvmsg */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00112}00112         NULL,   \textcolor{comment}{/* shutdown */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00113}00113         NULL,   \textcolor{comment}{/* newhook */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00114}00114         NULL,   \textcolor{comment}{/* findhook */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00115}00115         NULL,   \textcolor{comment}{/* connect */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00116}00116         NULL,   \textcolor{comment}{/* rcvdata */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00117}00117         NULL,   \textcolor{comment}{/* disconnect */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00118}00118         NULL,   \textcolor{comment}{/* cmdlist */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00119}00119 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00121}\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{00121}} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__node}{ng\_node}} \mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00122}00122         \textcolor{stringliteral}{"{}dead"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00123}00123         \&\mbox{\hyperlink{ng__base_8c_ad77874e8dc1023bf59c8ff1a0ba21cf6}{ng\_deadtype}},        }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00124}00124         \mbox{\hyperlink{netgraph_8h_a6d3a9e7aa2f636921cc07ea3206bc5e5}{NGF\_INVALID}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00125}00125         0,      \textcolor{comment}{/* numhooks */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00126}00126         NULL,   \textcolor{comment}{/* private */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00127}00127         0,      \textcolor{comment}{/* ID */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00128}00128         LIST\_HEAD\_INITIALIZER(\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}}.nd\_hooks),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00129}00129         \{\},     \textcolor{comment}{/* all\_nodes list entry */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00130}00130         \{\},     \textcolor{comment}{/* id hashtable list entry */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00131}00131         \{       0,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00132}00132                 0,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00133}00133                 \{\}, \textcolor{comment}{/* should never use! (should hang) */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00134}00134                 \{\}, \textcolor{comment}{/* workqueue entry */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00135}00135                 STAILQ\_HEAD\_INITIALIZER(\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}}.\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.queue),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00136}00136         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00137}00137         1,      \textcolor{comment}{/* refs */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00138}00138         NULL,   \textcolor{comment}{/* vnet */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00139}00139 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00140}00140         ND\_MAGIC,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00141}00141         \_\_FILE\_\_,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00142}00142         \_\_LINE\_\_,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00143}00143         \{NULL\}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00144}00144 \textcolor{preprocessor}{\#endif  }\textcolor{comment}{/* NETGRAPH\_DEBUG */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00145}00145 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00146}00146 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00147}\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{00147}} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__hook}{ng\_hook}} \mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00148}00148         \textcolor{stringliteral}{"{}dead"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00149}00149         NULL,           \textcolor{comment}{/* private */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00150}00150         \mbox{\hyperlink{netgraph_8h_a3731dfce0d5b1c0924ae5e57ee04aa52}{HK\_INVALID}} | \mbox{\hyperlink{netgraph_8h_af75025aa28056c01585b572f351a52b3}{HK\_DEAD}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00151}00151         0,              \textcolor{comment}{/* undefined data link type */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00152}00152         \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}},        \textcolor{comment}{/* Peer is self */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00153}00153         \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}},        \textcolor{comment}{/* attached to deadnode */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00154}00154         \{\},             \textcolor{comment}{/* hooks list */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00155}00155         NULL,           \textcolor{comment}{/* override rcvmsg() */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00156}00156         NULL,           \textcolor{comment}{/* override rcvdata() */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00157}00157         1,              \textcolor{comment}{/* refs always >= 1 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00158}00158 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00159}00159         HK\_MAGIC,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00160}00160         \_\_FILE\_\_,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00161}00161         \_\_LINE\_\_,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00162}00162         \{NULL\}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00163}00163 \textcolor{preprocessor}{\#endif  }\textcolor{comment}{/* NETGRAPH\_DEBUG */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00164}00164 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00165}00165 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00166}00166 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00167}00167 \textcolor{comment}{ * END DEAD STRUCTURES}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00168}00168 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00169}00169 \textcolor{comment}{/* List nodes with unallocated work */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00170}\mbox{\hyperlink{ng__base_8c_a6a5e8c42ccf1bf8607f2942872fdac0f}{00170}} \textcolor{keyword}{static} \mbox{\hyperlink{ng__base_8c_a6a5e8c42ccf1bf8607f2942872fdac0f}{STAILQ\_HEAD}}(, \mbox{\hyperlink{structng__node}{ng\_node}}) ng\_worklist = STAILQ\_HEAD\_INITIALIZER(ng\_worklist);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00171}00171 \textcolor{keyword}{static} \textcolor{keyword}{struct }mtx       ng\_worklist\_mtx;   \textcolor{comment}{/* MUST LOCK NODE FIRST */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00172}00172 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00173}00173 \textcolor{comment}{/* List of installed types */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00174}00174 \textcolor{keyword}{static} \mbox{\hyperlink{ngatmbase_8c_a64ce0b7623e1c2ab0cc07245307db113}{LIST\_HEAD}}(, \mbox{\hyperlink{structng__type}{ng\_type}}) ng\_typelist;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00175}00175 \textcolor{keyword}{static} \textcolor{keyword}{struct }rwlock    ng\_typelist\_lock;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00176}00176 \textcolor{preprocessor}{\#define TYPELIST\_RLOCK()        rw\_rlock(\&ng\_typelist\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00177}00177 \textcolor{preprocessor}{\#define TYPELIST\_RUNLOCK()      rw\_runlock(\&ng\_typelist\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00178}00178 \textcolor{preprocessor}{\#define TYPELIST\_WLOCK()        rw\_wlock(\&ng\_typelist\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00179}00179 \textcolor{preprocessor}{\#define TYPELIST\_WUNLOCK()      rw\_wunlock(\&ng\_typelist\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00180}00180 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00181}00181 \textcolor{comment}{/* Hash related definitions. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00182}00182 \mbox{\hyperlink{ngatmbase_8c_a64ce0b7623e1c2ab0cc07245307db113}{LIST\_HEAD}}(nodehash, \mbox{\hyperlink{structng__node}{ng\_node}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00183}00183 \mbox{\hyperlink{ng__eiface_8c_a90b5d68c60d1921b9e21804d1a576a2c}{VNET\_DEFINE\_STATIC}}(\textcolor{keyword}{struct} nodehash *, ng\_ID\_hash);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00184}00184 \mbox{\hyperlink{ng__eiface_8c_a90b5d68c60d1921b9e21804d1a576a2c}{VNET\_DEFINE\_STATIC}}(u\_long, ng\_ID\_hmask);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00185}00185 \mbox{\hyperlink{ng__eiface_8c_a90b5d68c60d1921b9e21804d1a576a2c}{VNET\_DEFINE\_STATIC}}(u\_long, ng\_nodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00186}00186 \mbox{\hyperlink{ng__eiface_8c_a90b5d68c60d1921b9e21804d1a576a2c}{VNET\_DEFINE\_STATIC}}(\textcolor{keyword}{struct} nodehash *, ng\_name\_hash);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00187}00187 \mbox{\hyperlink{ng__eiface_8c_a90b5d68c60d1921b9e21804d1a576a2c}{VNET\_DEFINE\_STATIC}}(u\_long, ng\_name\_hmask);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00188}00188 \mbox{\hyperlink{ng__eiface_8c_a90b5d68c60d1921b9e21804d1a576a2c}{VNET\_DEFINE\_STATIC}}(u\_long, ng\_named\_nodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00189}00189 \textcolor{preprocessor}{\#define V\_ng\_ID\_hash            VNET(ng\_ID\_hash)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00190}00190 \textcolor{preprocessor}{\#define V\_ng\_ID\_hmask           VNET(ng\_ID\_hmask)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00191}00191 \textcolor{preprocessor}{\#define V\_ng\_nodes              VNET(ng\_nodes)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00192}00192 \textcolor{preprocessor}{\#define V\_ng\_name\_hash          VNET(ng\_name\_hash)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00193}00193 \textcolor{preprocessor}{\#define V\_ng\_name\_hmask         VNET(ng\_name\_hmask)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00194}00194 \textcolor{preprocessor}{\#define V\_ng\_named\_nodes        VNET(ng\_named\_nodes)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00195}00195 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00196}00196 \textcolor{keyword}{static} \textcolor{keyword}{struct }rwlock    ng\_idhash\_lock;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00197}00197 \textcolor{preprocessor}{\#define IDHASH\_RLOCK()          rw\_rlock(\&ng\_idhash\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00198}00198 \textcolor{preprocessor}{\#define IDHASH\_RUNLOCK()        rw\_runlock(\&ng\_idhash\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00199}00199 \textcolor{preprocessor}{\#define IDHASH\_WLOCK()          rw\_wlock(\&ng\_idhash\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00200}00200 \textcolor{preprocessor}{\#define IDHASH\_WUNLOCK()        rw\_wunlock(\&ng\_idhash\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00201}00201 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00202}00202 \textcolor{comment}{/* Method to find a node.. used twice so do it here */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00203}00203 \textcolor{preprocessor}{\#define NG\_IDHASH\_FN(ID) ((ID) \% (V\_ng\_ID\_hmask + 1))}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00204}00204 \textcolor{preprocessor}{\#define NG\_IDHASH\_FIND(ID, node)                                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00205}00205 \textcolor{preprocessor}{        do \{                                                            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00206}00206 \textcolor{preprocessor}{                rw\_assert(\&ng\_idhash\_lock, RA\_LOCKED);                  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00207}00207 \textcolor{preprocessor}{                LIST\_FOREACH(node, \&V\_ng\_ID\_hash[NG\_IDHASH\_FN(ID)],     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00208}00208 \textcolor{preprocessor}{                                                nd\_idnodes) \{           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00209}00209 \textcolor{preprocessor}{                        if (NG\_NODE\_IS\_VALID(node)                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00210}00210 \textcolor{preprocessor}{                        \&\& (NG\_NODE\_ID(node) == ID)) \{                  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00211}00211 \textcolor{preprocessor}{                                break;                                  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00212}00212 \textcolor{preprocessor}{                        \}                                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00213}00213 \textcolor{preprocessor}{                \}                                                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00214}00214 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00215}00215 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00216}00216 \textcolor{keyword}{static} \textcolor{keyword}{struct }rwlock    ng\_namehash\_lock;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00217}00217 \textcolor{preprocessor}{\#define NAMEHASH\_RLOCK()        rw\_rlock(\&ng\_namehash\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00218}00218 \textcolor{preprocessor}{\#define NAMEHASH\_RUNLOCK()      rw\_runlock(\&ng\_namehash\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00219}00219 \textcolor{preprocessor}{\#define NAMEHASH\_WLOCK()        rw\_wlock(\&ng\_namehash\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00220}00220 \textcolor{preprocessor}{\#define NAMEHASH\_WUNLOCK()      rw\_wunlock(\&ng\_namehash\_lock)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00221}00221 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00222}00222 \textcolor{comment}{/* Internal functions */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00223}00223 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__base_8c_acdcfe7d2de980edf8b023940e2f5ca3d}{ng\_add\_hook}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \mbox{\hyperlink{structng__hook}{hook\_p}} * hookp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00224}00224 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__base_8c_ad936e93d4e0d25b58468217a014d1320}{ng\_generic\_msg}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} lasthook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00225}00225 \textcolor{keyword}{static} \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}}   \mbox{\hyperlink{ng__base_8c_a8cd13d5bed55b7feb7d42b3eff8c3866}{ng\_decodeidname}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00226}00226 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__base_8c_a396817d48f5ba91f0db49c527b4dc21a}{ngb\_mod\_event}}(module\_t mod, \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__ubt__var_8h_aeef6900f411bc223febdd92c9435693b}{event}}, \textcolor{keywordtype}{void} *\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00227}00227 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{ng__base_8c_a9d715d2e185b01588e7a07fb218c1d22}{ng\_worklist\_add}}(\mbox{\hyperlink{structng__node}{node\_p}} node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00228}00228 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{ng__base_8c_a7d51ab82df99dad752e4dd859ced10ca}{ngthread}}(\textcolor{keywordtype}{void} *);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00229}00229 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__base_8c_ab25445fc9c3b61a1a811723785c6a01d}{ng\_apply\_item}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \textcolor{keywordtype}{int} rw);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00230}00230 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{ng__base_8c_abd80e0814383b1cb4d4e88855160eac4}{ng\_flush\_input\_queue}}(\mbox{\hyperlink{structng__node}{node\_p}} node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00231}00231 \textcolor{keyword}{static} \mbox{\hyperlink{structng__node}{node\_p}}     \mbox{\hyperlink{ng__base_8c_ab22a4b7ba7932993a29f6f9426d5ddda}{ng\_ID2noderef}}(\mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}} ID);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00232}00232 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__base_8c_a5def34cf5530ace8fcb8d5e805e653a9}{ng\_con\_nodes}}(\mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00233}00233                     \mbox{\hyperlink{structng__node}{node\_p}} node2, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00234}00234 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__base_8c_a0756b63155b159535f352915ac5cc77b}{ng\_con\_part2}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00235}00235 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__base_8c_a76dfd3c077be6fd0a11484327e3a8455}{ng\_con\_part3}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00236}00236 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__base_8c_ae41f58c0e2071e9978775a6fb5e00b41}{ng\_mkpeer}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name2,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00237}00237                     \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00238}00238 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{ng__base_8c_ae70cd76253855a0ac8b8e7acb5ca567d}{ng\_name\_rehash}}(\textcolor{keywordtype}{void});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00239}00239 \textcolor{keyword}{static} \textcolor{keywordtype}{void}     \mbox{\hyperlink{ng__base_8c_a635a4cb4c9c3d15699bde4208d9bdd5b}{ng\_ID\_rehash}}(\textcolor{keywordtype}{void});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00240}00240 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00241}00241 \textcolor{comment}{/* Imported, these used to be externally visible, some may go back. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00242}00242 \textcolor{keywordtype}{void}    \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00243}00243 \textcolor{keywordtype}{int}     \mbox{\hyperlink{ng__base_8c_a4e328a30d6a99603f9b47e5e02e76178}{ng\_path2noderef}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *path,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00244}00244         \mbox{\hyperlink{structng__node}{node\_p}} *dest, \mbox{\hyperlink{structng__hook}{hook\_p}} *lasthook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00245}00245 \textcolor{keywordtype}{int}     \mbox{\hyperlink{ng__base_8c_a4877bafb8cdb93eefaecd207af968dfa}{ng\_make\_node}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \mbox{\hyperlink{structng__node}{node\_p}} *nodepp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00246}00246 \textcolor{keywordtype}{int}     \mbox{\hyperlink{ng__base_8c_a8905c404d8e7fc81228a092b670294c9}{ng\_path\_parse}}(\textcolor{keywordtype}{char} *addr, \textcolor{keywordtype}{char} **node, \textcolor{keywordtype}{char} **path, \textcolor{keywordtype}{char} **hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00247}00247 \textcolor{keywordtype}{void}    \mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} dummy1, \textcolor{keywordtype}{void} *dummy2, \textcolor{keywordtype}{int} dummy3);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00248}00248 \textcolor{keywordtype}{void}    \mbox{\hyperlink{ng__base_8c_a3d0c9145c32fcd7f37d545ece27c9663}{ng\_unname}}(\mbox{\hyperlink{structng__node}{node\_p}} node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00249}00249 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00250}00250 \textcolor{comment}{/* Our own netgraph malloc type */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00251}00251 \mbox{\hyperlink{ng__ccatm_8c_ae738595abd0b2c23262b81953927d5f8}{MALLOC\_DEFINE}}(M\_NETGRAPH, \textcolor{stringliteral}{"{}netgraph"{}}, \textcolor{stringliteral}{"{}netgraph structures and ctrl messages"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00252}00252 \mbox{\hyperlink{ng__ccatm_8c_ae738595abd0b2c23262b81953927d5f8}{MALLOC\_DEFINE}}(M\_NETGRAPH\_MSG, \textcolor{stringliteral}{"{}netgraph\_msg"{}}, \textcolor{stringliteral}{"{}netgraph name storage"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00253}00253 \textcolor{keyword}{static} \mbox{\hyperlink{ng__ccatm_8c_ae738595abd0b2c23262b81953927d5f8}{MALLOC\_DEFINE}}(M\_NETGRAPH\_HOOK, \textcolor{stringliteral}{"{}netgraph\_hook"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00254}00254     \textcolor{stringliteral}{"{}netgraph hook structures"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00255}00255 \textcolor{keyword}{static} \mbox{\hyperlink{ng__ccatm_8c_ae738595abd0b2c23262b81953927d5f8}{MALLOC\_DEFINE}}(M\_NETGRAPH\_NODE, \textcolor{stringliteral}{"{}netgraph\_node"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00256}00256     \textcolor{stringliteral}{"{}netgraph node structures"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00257}00257 \textcolor{keyword}{static} \mbox{\hyperlink{ng__ccatm_8c_ae738595abd0b2c23262b81953927d5f8}{MALLOC\_DEFINE}}(M\_NETGRAPH\_ITEM, \textcolor{stringliteral}{"{}netgraph\_item"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00258}00258     \textcolor{stringliteral}{"{}netgraph item structures"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00259}00259 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00260}00260 \textcolor{comment}{/* Should not be visible outside this file */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00261}00261 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00262}00262 \textcolor{preprocessor}{\#define \_NG\_ALLOC\_HOOK(hook) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00263}00263 \textcolor{preprocessor}{        hook = malloc(sizeof(*hook), M\_NETGRAPH\_HOOK, M\_NOWAIT | M\_ZERO)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00264}00264 \textcolor{preprocessor}{\#define \_NG\_ALLOC\_NODE(node) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00265}00265 \textcolor{preprocessor}{        node = malloc(sizeof(*node), M\_NETGRAPH\_NODE, M\_NOWAIT | M\_ZERO)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00266}00266 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00267}00267 \textcolor{preprocessor}{\#define NG\_QUEUE\_LOCK\_INIT(n)                   \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00268}00268 \textcolor{preprocessor}{        mtx\_init(\&(n)-\/>q\_mtx, "{}ng\_node"{}}, NULL, MTX\_DEF)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00269}00269 \textcolor{preprocessor}{\#define NG\_QUEUE\_LOCK(n)                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00270}00270 \textcolor{preprocessor}{        mtx\_lock(\&(n)-\/>q\_mtx)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00271}00271 \textcolor{preprocessor}{\#define NG\_QUEUE\_UNLOCK(n)                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00272}00272 \textcolor{preprocessor}{        mtx\_unlock(\&(n)-\/>q\_mtx)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00273}00273 \textcolor{preprocessor}{\#define NG\_WORKLIST\_LOCK\_INIT()                 \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00274}00274 \textcolor{preprocessor}{        mtx\_init(\&ng\_worklist\_mtx, "{}ng\_worklist"{}}, NULL, MTX\_DEF)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00275}00275 \textcolor{preprocessor}{\#define NG\_WORKLIST\_LOCK()                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00276}00276 \textcolor{preprocessor}{        mtx\_lock(\&ng\_worklist\_mtx)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00277}00277 \textcolor{preprocessor}{\#define NG\_WORKLIST\_UNLOCK()                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00278}00278 \textcolor{preprocessor}{        mtx\_unlock(\&ng\_worklist\_mtx)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00279}00279 \textcolor{preprocessor}{\#define NG\_WORKLIST\_SLEEP()                     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00280}00280 \textcolor{preprocessor}{        mtx\_sleep(\&ng\_worklist, \&ng\_worklist\_mtx, PI\_NET, "{}sleep"{}}, 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00281}00281 \textcolor{preprocessor}{\#define NG\_WORKLIST\_WAKEUP()                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00282}00282 \textcolor{preprocessor}{        wakeup\_one(\&ng\_worklist)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00283}00283 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00284}00284 \textcolor{preprocessor}{\#ifdef NETGRAPH\_DEBUG }\textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00285}00285 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00286}00286 \textcolor{comment}{ * In debug mode:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00287}00287 \textcolor{comment}{ * In an attempt to help track reference count screwups}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00288}00288 \textcolor{comment}{ * we do not free objects back to the malloc system, but keep them}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00289}00289 \textcolor{comment}{ * in a local cache where we can examine them and keep information safely}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00290}00290 \textcolor{comment}{ * after they have been freed.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00291}00291 \textcolor{comment}{ * We use this scheme for nodes and hooks, and to some extent for items.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00292}00292 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00293}00293 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__hook}{hook\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00294}00294 ng\_alloc\_hook(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00295}00295 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00296}00296         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00297}00297         SLIST\_ENTRY(\mbox{\hyperlink{structng__hook}{ng\_hook}}) temp;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00298}00298         mtx\_lock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00299}00299         hook = LIST\_FIRST(\&ng\_freehooks);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00300}00300         \textcolor{keywordflow}{if} (hook) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00301}00301                 LIST\_REMOVE(hook, hk\_hooks);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00302}00302                 bcopy(\&hook-\/>hk\_all, \&temp, \textcolor{keyword}{sizeof}(temp));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00303}00303                 bzero(hook, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__hook}{ng\_hook}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00304}00304                 bcopy(\&temp, \&hook-\/>hk\_all, \textcolor{keyword}{sizeof}(temp));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00305}00305                 mtx\_unlock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00306}00306                 hook-\/>hk\_magic = HK\_MAGIC;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00307}00307         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00308}00308                 mtx\_unlock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00309}00309                 \mbox{\hyperlink{ng__base_8c_a32ff5ce6379ebaea2f1749beb2b29ce6}{\_NG\_ALLOC\_HOOK}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00310}00310                 \textcolor{keywordflow}{if} (hook) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00311}00311                         hook-\/>hk\_magic = HK\_MAGIC;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00312}00312                         mtx\_lock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00313}00313                         SLIST\_INSERT\_HEAD(\&ng\_allhooks, hook, hk\_all);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00314}00314                         mtx\_unlock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00315}00315                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00316}00316         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00317}00317         \textcolor{keywordflow}{return} (hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00318}00318 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00319}00319 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00320}00320 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__node}{node\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00321}00321 ng\_alloc\_node(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00322}00322 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00323}00323         \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00324}00324         SLIST\_ENTRY(\mbox{\hyperlink{structng__node}{ng\_node}}) temp;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00325}00325         mtx\_lock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00326}00326         node = LIST\_FIRST(\&ng\_freenodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00327}00327         \textcolor{keywordflow}{if} (node) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00328}00328                 LIST\_REMOVE(node, nd\_nodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00329}00329                 bcopy(\&node-\/>nd\_all, \&temp, \textcolor{keyword}{sizeof}(temp));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00330}00330                 bzero(node, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__node}{ng\_node}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00331}00331                 bcopy(\&temp, \&node-\/>nd\_all, \textcolor{keyword}{sizeof}(temp));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00332}00332                 mtx\_unlock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00333}00333                 node-\/>nd\_magic = ND\_MAGIC;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00334}00334         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00335}00335                 mtx\_unlock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00336}00336                 \mbox{\hyperlink{ng__base_8c_ac64ef8ff527e8e835452c102df0efb6a}{\_NG\_ALLOC\_NODE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00337}00337                 \textcolor{keywordflow}{if} (node) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00338}00338                         node-\/>nd\_magic = ND\_MAGIC;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00339}00339                         mtx\_lock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00340}00340                         SLIST\_INSERT\_HEAD(\&ng\_allnodes, node, nd\_all);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00341}00341                         mtx\_unlock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00342}00342                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00343}00343         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00344}00344         \textcolor{keywordflow}{return} (node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00345}00345 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00346}00346 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00347}00347 \textcolor{preprocessor}{\#define NG\_ALLOC\_HOOK(hook) do \{ (hook) = ng\_alloc\_hook(); \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00348}00348 \textcolor{preprocessor}{\#define NG\_ALLOC\_NODE(node) do \{ (node) = ng\_alloc\_node(); \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00349}00349 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00350}00350 \textcolor{preprocessor}{\#define NG\_FREE\_HOOK(hook)                                              \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00351}00351 \textcolor{preprocessor}{        do \{                                                            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00352}00352 \textcolor{preprocessor}{                mtx\_lock(\&ng\_nodelist\_mtx);                             \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00353}00353 \textcolor{preprocessor}{                LIST\_INSERT\_HEAD(\&ng\_freehooks, hook, hk\_hooks);        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00354}00354 \textcolor{preprocessor}{                hook-\/>hk\_magic = 0;                                     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00355}00355 \textcolor{preprocessor}{                mtx\_unlock(\&ng\_nodelist\_mtx);                           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00356}00356 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00357}00357 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00358}00358 \textcolor{preprocessor}{\#define NG\_FREE\_NODE(node)                                              \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00359}00359 \textcolor{preprocessor}{        do \{                                                            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00360}00360 \textcolor{preprocessor}{                mtx\_lock(\&ng\_nodelist\_mtx);                             \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00361}00361 \textcolor{preprocessor}{                LIST\_INSERT\_HEAD(\&ng\_freenodes, node, nd\_nodes);        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00362}00362 \textcolor{preprocessor}{                node-\/>nd\_magic = 0;                                     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00363}00363 \textcolor{preprocessor}{                mtx\_unlock(\&ng\_nodelist\_mtx);                           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00364}00364 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00365}00365 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00366}00366 \textcolor{preprocessor}{\#else }\textcolor{comment}{/* NETGRAPH\_DEBUG */}\textcolor{preprocessor}{ }\textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00367}00367 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00368}00368 \textcolor{preprocessor}{\#define NG\_ALLOC\_HOOK(hook) \_NG\_ALLOC\_HOOK(hook)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00369}00369 \textcolor{preprocessor}{\#define NG\_ALLOC\_NODE(node) \_NG\_ALLOC\_NODE(node)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00370}00370 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00371}00371 \textcolor{preprocessor}{\#define NG\_FREE\_HOOK(hook) do \{ free((hook), M\_NETGRAPH\_HOOK); \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00372}00372 \textcolor{preprocessor}{\#define NG\_FREE\_NODE(node) do \{ free((node), M\_NETGRAPH\_NODE); \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00373}00373 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00374}00374 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* NETGRAPH\_DEBUG */}\textcolor{preprocessor}{ }\textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00375}00375 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00376}00376 \textcolor{comment}{/* Set this to kdb\_enter("{}X"{}) to catch all errors as they occur */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00377}00377 \textcolor{preprocessor}{\#ifndef TRAP\_ERROR}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00378}00378 \textcolor{preprocessor}{\#define TRAP\_ERROR()}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00379}00379 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00380}00380 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00381}00381 \mbox{\hyperlink{ng__eiface_8c_a90b5d68c60d1921b9e21804d1a576a2c}{VNET\_DEFINE\_STATIC}}(\mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}}, nextID) = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00382}00382 \textcolor{preprocessor}{\#define V\_nextID                        VNET(nextID)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00383}00383 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00384}00384 \textcolor{preprocessor}{\#ifdef INVARIANTS}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00385}00385 \textcolor{preprocessor}{\#define CHECK\_DATA\_MBUF(m)      do \{                                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00386}00386 \textcolor{preprocessor}{                struct mbuf *n;                                         \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00387}00387 \textcolor{preprocessor}{                int total;                                              \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00388}00388 \textcolor{preprocessor}{                                                                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00389}00389 \textcolor{preprocessor}{                M\_ASSERTPKTHDR(m);                                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00390}00390 \textcolor{preprocessor}{                for (total = 0, n = (m); n != NULL; n = n-\/>m\_next) \{    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00391}00391 \textcolor{preprocessor}{                        total += n-\/>m\_len;                              \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00392}00392 \textcolor{preprocessor}{                        if (n-\/>m\_nextpkt != NULL)                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00393}00393 \textcolor{preprocessor}{                                panic("{}\%s: m\_nextpkt"{}}, \_\_func\_\_);       \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00394}00394                 \}                                                       \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00395}00395                                                                         \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00396}00396                 if ((m)-\/>m\_pkthdr.len != total) \{                       \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00397}00397                         panic("{}\%s: \%d != \%d"{},                           \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00398}00398                             \_\_func\_\_, (m)-\/>m\_pkthdr.len, total);        \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00399}00399                 \}                                                       \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00400}00400         \} while (0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00401}00401 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00402}00402 \textcolor{preprocessor}{\#define CHECK\_DATA\_MBUF(m)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00403}00403 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00404}00404 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00405}00405 \textcolor{preprocessor}{\#define ERROUT(x)       do \{ error = (x); goto done; \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00406}00406 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00407}00407 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00408}00408 \textcolor{comment}{        Parse type definitions for generic messages}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00409}00409 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00410}00410 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00411}00411 \textcolor{comment}{/* Handy structure parse type defining macro */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00412}00412 \textcolor{preprocessor}{\#define DEFINE\_PARSE\_STRUCT\_TYPE(lo, up, args)                          \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00413}00413 \textcolor{preprocessor}{static const struct ng\_parse\_struct\_field                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00414}00414 \textcolor{preprocessor}{        ng\_ \#\# lo \#\# \_type\_fields[] = NG\_GENERIC\_ \#\# up \#\# \_INFO args;  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00415}00415 \textcolor{preprocessor}{static const struct ng\_parse\_type ng\_generic\_ \#\# lo \#\# \_type = \{        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00416}00416 \textcolor{preprocessor}{        \&ng\_parse\_struct\_type,                                          \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00417}00417 \textcolor{preprocessor}{        \&ng\_ \#\# lo \#\# \_type\_fields                                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00418}00418 \textcolor{preprocessor}{\}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00419}00419 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00420}00420 \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(mkpeer, MKPEER, ());}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00421}00421 \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(connect, CONNECT, ());}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00422}00422 \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, NAME, ());}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00423}00423 \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(rmhook, RMHOOK, ());}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00424}00424 \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(\mbox{\hyperlink{structnodeinfo}{nodeinfo}}, NODEINFO, ());}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00425}00425 \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(\mbox{\hyperlink{structtypeinfo}{typeinfo}}, TYPEINFO, ());}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00426}00426 \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(\mbox{\hyperlink{structlinkinfo}{linkinfo}}, LINKINFO, (\&ng\_generic\_nodeinfo\_type));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00427}00427 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00428}00428 \textcolor{comment}{/* Get length of an array when the length is stored as a 32 bit}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00429}00429 \textcolor{comment}{   value immediately preceding the array -\/-\/ as with struct namelist}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00430}00430 \textcolor{comment}{   and struct typelist. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00431}00431 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00432}00432 ng\_generic\_list\_getLength(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00433}00433         \textcolor{keyword}{const} u\_char *start, \textcolor{keyword}{const} u\_char *buf)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00434}00434 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00435}00435         \textcolor{keywordflow}{return} *((\textcolor{keyword}{const} u\_int32\_t *)(buf -\/ 4));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00436}00436 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00437}00437 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00438}00438 \textcolor{comment}{/* Get length of the array of struct linkinfo inside a struct hooklist */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00439}00439 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00440}\mbox{\hyperlink{ng__base_8c_aa954d959e86b604a062f0db7a5d00c45}{00440}} \mbox{\hyperlink{ng__base_8c_aa954d959e86b604a062f0db7a5d00c45}{ng\_generic\_linkinfo\_getLength}}(\textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00441}00441         \textcolor{keyword}{const} u\_char *start, \textcolor{keyword}{const} u\_char *buf)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00442}00442 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00443}00443         \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structhooklist}{hooklist}} *hl = (\textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structhooklist}{hooklist}} *)start;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00444}00444 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00445}00445         \textcolor{keywordflow}{return} hl-\/>\mbox{\hyperlink{structhooklist_af884753859489604435be85ea729a7b6}{nodeinfo}}.\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00446}00446 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00447}00447 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00448}00448 \textcolor{comment}{/* Array type for a variable length array of struct namelist */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00449}\mbox{\hyperlink{ng__base_8c_ad06531901423e43c43b4d04b21d2f422}{00449}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__array__info}{ng\_parse\_array\_info}} \mbox{\hyperlink{ng__base_8c_ad06531901423e43c43b4d04b21d2f422}{ng\_nodeinfoarray\_type\_info}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00450}00450         \&ng\_generic\_nodeinfo\_type,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00451}00451         \&ng\_generic\_list\_getLength}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00452}00452 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00453}\mbox{\hyperlink{ng__base_8c_a5750f1f9203e203c54600c122e31841e}{00453}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__base_8c_a5750f1f9203e203c54600c122e31841e}{ng\_generic\_nodeinfoarray\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00454}00454         \&\mbox{\hyperlink{ng__parse_8c_a979248410eaad0c3e86262fe53840012}{ng\_parse\_array\_type}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00455}00455         \&\mbox{\hyperlink{ng__base_8c_ad06531901423e43c43b4d04b21d2f422}{ng\_nodeinfoarray\_type\_info}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00456}00456 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00457}00457 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00458}00458 \textcolor{comment}{/* Array type for a variable length array of struct typelist */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00459}\mbox{\hyperlink{ng__base_8c_a6935d75d63670bf19331e985ea8623c0}{00459}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__array__info}{ng\_parse\_array\_info}} \mbox{\hyperlink{ng__base_8c_a6935d75d63670bf19331e985ea8623c0}{ng\_typeinfoarray\_type\_info}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00460}00460         \&ng\_generic\_typeinfo\_type,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00461}00461         \&ng\_generic\_list\_getLength}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00462}00462 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00463}\mbox{\hyperlink{ng__base_8c_abce55ef217d8bb499144f74883dd36db}{00463}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__base_8c_abce55ef217d8bb499144f74883dd36db}{ng\_generic\_typeinfoarray\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00464}00464         \&\mbox{\hyperlink{ng__parse_8c_a979248410eaad0c3e86262fe53840012}{ng\_parse\_array\_type}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00465}00465         \&\mbox{\hyperlink{ng__base_8c_a6935d75d63670bf19331e985ea8623c0}{ng\_typeinfoarray\_type\_info}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00466}00466 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00467}00467 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00468}00468 \textcolor{comment}{/* Array type for array of struct linkinfo in struct hooklist */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00469}\mbox{\hyperlink{ng__base_8c_a52e9b6fa3fd3aad4fe7083c019a0c642}{00469}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__array__info}{ng\_parse\_array\_info}} \mbox{\hyperlink{ng__base_8c_a52e9b6fa3fd3aad4fe7083c019a0c642}{ng\_generic\_linkinfo\_array\_type\_info}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00470}00470         \&ng\_generic\_linkinfo\_type,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00471}00471         \&\mbox{\hyperlink{ng__base_8c_aa954d959e86b604a062f0db7a5d00c45}{ng\_generic\_linkinfo\_getLength}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00472}00472 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00473}\mbox{\hyperlink{ng__base_8c_a4c2e062a792c0f0adb7f2a7fc9dc3f22}{00473}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__base_8c_a4c2e062a792c0f0adb7f2a7fc9dc3f22}{ng\_generic\_linkinfo\_array\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00474}00474         \&\mbox{\hyperlink{ng__parse_8c_a979248410eaad0c3e86262fe53840012}{ng\_parse\_array\_type}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00475}00475         \&\mbox{\hyperlink{ng__base_8c_a52e9b6fa3fd3aad4fe7083c019a0c642}{ng\_generic\_linkinfo\_array\_type\_info}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00476}00476 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00477}00477 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00478}\mbox{\hyperlink{ng__base_8c_a4b382daa5b7f243fa9aa09e871512c88}{00478}} \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(\mbox{\hyperlink{structtypelist}{typelist}}, TYPELIST, (\&\mbox{\hyperlink{ng__base_8c_abce55ef217d8bb499144f74883dd36db}{ng\_generic\_typeinfoarray\_type}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00479}\mbox{\hyperlink{ng__base_8c_ad063e3e6001494f1d9044a33f7d0d998}{00479}} \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(\mbox{\hyperlink{structhooklist}{hooklist}}, HOOKLIST,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00480}00480         (\&ng\_generic\_nodeinfo\_type, \&\mbox{\hyperlink{ng__base_8c_a4c2e062a792c0f0adb7f2a7fc9dc3f22}{ng\_generic\_linkinfo\_array\_type}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00481}\mbox{\hyperlink{ng__base_8c_acba7323681c639d45e634d5e290a03ff}{00481}} \mbox{\hyperlink{ng__base_8c_a51809d6455a65252532c011b693813aa}{DEFINE\_PARSE\_STRUCT\_TYPE}}(listnodes, LISTNODES,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00482}00482         (\&\mbox{\hyperlink{ng__base_8c_a5750f1f9203e203c54600c122e31841e}{ng\_generic\_nodeinfoarray\_type}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00483}00483 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00484}00484 \textcolor{comment}{/* List of commands and how to convert arguments to/from ASCII */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00485}\mbox{\hyperlink{ng__base_8c_a802f80fc0639e0767d35c63b7e35fd5b}{00485}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__cmdlist}{ng\_cmdlist}} \mbox{\hyperlink{ng__base_8c_a802f80fc0639e0767d35c63b7e35fd5b}{ng\_generic\_cmds}}[] = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00486}00486         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00487}00487           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00488}00488           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0acb1763fedfa5fd35d1df1714454094ad}{NGM\_SHUTDOWN}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00489}00489           \textcolor{stringliteral}{"{}shutdown"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00490}00490           NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00491}00491           NULL}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00492}00492         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00493}00493         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00494}00494           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00495}00495           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a5fc29cf4ce02b402f65505507799f2ed}{NGM\_MKPEER}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00496}00496           \textcolor{stringliteral}{"{}mkpeer"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00497}00497           \&ng\_generic\_mkpeer\_type,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00498}00498           NULL}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00499}00499         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00500}00500         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00501}00501           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00502}00502           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0af38cee2e5b53400e215b8fb8db695bce}{NGM\_CONNECT}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00503}00503           \textcolor{stringliteral}{"{}connect"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00504}00504           \&ng\_generic\_connect\_type,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00505}00505           NULL}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00506}00506         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00507}00507         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00508}00508           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00509}00509           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a1ee2726bb8af3fa09a65bea230141735}{NGM\_NAME}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00510}00510           \textcolor{stringliteral}{"{}name"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00511}00511           \&ng\_generic\_name\_type,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00512}00512           NULL}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00513}00513         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00514}00514         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00515}00515           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00516}00516           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a0b1365508f5148fc26e5a82a9d503a02}{NGM\_RMHOOK}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00517}00517           \textcolor{stringliteral}{"{}rmhook"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00518}00518           \&ng\_generic\_rmhook\_type,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00519}00519           NULL}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00520}00520         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00521}00521         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00522}00522           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00523}00523           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a06a8887d77fdfb9a8ab815f81d4ecb7e}{NGM\_NODEINFO}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00524}00524           \textcolor{stringliteral}{"{}nodeinfo"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00525}00525           NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00526}00526           \&ng\_generic\_nodeinfo\_type}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00527}00527         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00528}00528         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00529}00529           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00530}00530           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a748d86ae93f55fabc43800d2193c7019}{NGM\_LISTHOOKS}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00531}00531           \textcolor{stringliteral}{"{}listhooks"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00532}00532           NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00533}00533           \&ng\_generic\_hooklist\_type}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00534}00534         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00535}00535         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00536}00536           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00537}00537           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0acc084b513978221e02a4a0a57086e5f9}{NGM\_LISTNAMES}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00538}00538           \textcolor{stringliteral}{"{}listnames"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00539}00539           NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00540}00540           \&ng\_generic\_listnodes\_type    \textcolor{comment}{/* same as NGM\_LISTNODES */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00541}00541         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00542}00542         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00543}00543           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00544}00544           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a72393c83679d5b8739c897e06c8f26ff}{NGM\_LISTNODES}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00545}00545           \textcolor{stringliteral}{"{}listnodes"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00546}00546           NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00547}00547           \&ng\_generic\_listnodes\_type}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00548}00548         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00549}00549         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00550}00550           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00551}00551           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a6a83554981dbf3473c7a3c7665d1d4b6}{NGM\_LISTTYPES}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00552}00552           \textcolor{stringliteral}{"{}listtypes"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00553}00553           NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00554}00554           \&ng\_generic\_typelist\_type}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00555}00555         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00556}00556         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00557}00557           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00558}00558           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a5be276b7d12ec0ce60c7743a0e97394c}{NGM\_TEXT\_CONFIG}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00559}00559           \textcolor{stringliteral}{"{}textconfig"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00560}00560           NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00561}00561           \&\mbox{\hyperlink{ng__parse_8c_aa4b5bfd2c5af56c9fc6806de550a581a}{ng\_parse\_string\_type}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00562}00562         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00563}00563         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00564}00564           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00565}00565           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0af7e8d918ab39873056284fe1b8dfe71b}{NGM\_TEXT\_STATUS}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00566}00566           \textcolor{stringliteral}{"{}textstatus"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00567}00567           NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00568}00568           \&\mbox{\hyperlink{ng__parse_8c_aa4b5bfd2c5af56c9fc6806de550a581a}{ng\_parse\_string\_type}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00569}00569         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00570}00570         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00571}00571           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00572}00572           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0ad2c43c923c2238df21c860962cd497f3}{NGM\_ASCII2BINARY}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00573}00573           \textcolor{stringliteral}{"{}ascii2binary"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00574}00574           \&\mbox{\hyperlink{ng__parse_8c_a197eb09a68c77c77db609d06a765f5bf}{ng\_parse\_ng\_mesg\_type}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00575}00575           \&\mbox{\hyperlink{ng__parse_8c_a197eb09a68c77c77db609d06a765f5bf}{ng\_parse\_ng\_mesg\_type}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00576}00576         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00577}00577         \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00578}00578           \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00579}00579           \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0ac5d95002a62b4e73972b30792b0a5253}{NGM\_BINARY2ASCII}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00580}00580           \textcolor{stringliteral}{"{}binary2ascii"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00581}00581           \&\mbox{\hyperlink{ng__parse_8c_a197eb09a68c77c77db609d06a765f5bf}{ng\_parse\_ng\_mesg\_type}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00582}00582           \&\mbox{\hyperlink{ng__parse_8c_a197eb09a68c77c77db609d06a765f5bf}{ng\_parse\_ng\_mesg\_type}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00583}00583         \},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00584}00584         \{ 0 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00585}00585 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00586}00586 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00587}00587 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00588}00588 \textcolor{comment}{                        Node routines}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00589}00589 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00590}00590 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00591}00591 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00592}00592 \textcolor{comment}{ * Instantiate a node of the requested type}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00593}00593 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00594}00594 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00595}\mbox{\hyperlink{ng__base_8c_a4877bafb8cdb93eefaecd207af968dfa}{00595}} \mbox{\hyperlink{ng__base_8c_a4877bafb8cdb93eefaecd207af968dfa}{ng\_make\_node}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *\textcolor{keyword}{typename}, \mbox{\hyperlink{structng__node}{node\_p}} *nodepp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00596}00596 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00597}00597         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00598}00598         \textcolor{keywordtype}{int}     error;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00599}00599 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00600}00600         \textcolor{comment}{/* Check that the type makes sense */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00601}00601         \textcolor{keywordflow}{if} (\textcolor{keyword}{typename} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00602}00602                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00603}00603                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00604}00604         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00605}00605 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00606}00606         \textcolor{comment}{/* Locate the node type. If we fail we return. Do not try to load}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00607}00607 \textcolor{comment}{         * module.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00608}00608 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00609}00609         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}} = \mbox{\hyperlink{ng__base_8c_a1573d618c9d2901cc492a73c4205de7e}{ng\_findtype}}(\textcolor{keyword}{typename})) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00610}00610                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00611}00611 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00612}00612         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00613}00613 \textcolor{comment}{         * If we have a constructor, then make the node and}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00614}00614 \textcolor{comment}{         * call the constructor to do type specific initialisation.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00615}00615 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00616}00616         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>constructor != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00617}00617                 \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__base_8c_ab7746fbe2e081d197c5c9911a6b42076}{ng\_make\_node\_common}}(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, nodepp)) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00618}00618                         \textcolor{keywordflow}{if} ((error = ((*\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>constructor)(*nodepp))) != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00619}00619                                 \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(*nodepp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00620}00620                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00621}00621                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00622}00622         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00623}00623                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00624}00624 \textcolor{comment}{                 * Node has no constructor. We cannot ask for one}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00625}00625 \textcolor{comment}{                 * to be made. It must be brought into existence by}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00626}00626 \textcolor{comment}{                 * some external agency. The external agency should}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00627}00627 \textcolor{comment}{                 * call ng\_make\_node\_common() directly to get the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00628}00628 \textcolor{comment}{                 * netgraph part initialised.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00629}00629 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00630}00630                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00631}00631                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00632}00632         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00633}00633         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00634}00634 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00635}00635 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00636}00636 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00637}00637 \textcolor{comment}{ * Generic node creation. Called by node initialisation for externally}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00638}00638 \textcolor{comment}{ * instantiated nodes (e.g. hardware, sockets, etc ).}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00639}00639 \textcolor{comment}{ * The returned node has a reference count of 1.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00640}00640 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00641}00641 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00642}\mbox{\hyperlink{netgraph_8h_aba2cbbfc891d71bd283ce2368c8392db}{00642}} \mbox{\hyperlink{ng__base_8c_ab7746fbe2e081d197c5c9911a6b42076}{ng\_make\_node\_common}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__type}{ng\_type}} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \mbox{\hyperlink{structng__node}{node\_p}} *nodepp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00643}00643 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00644}00644         \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00645}00645 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00646}00646         \textcolor{comment}{/* Require the node type to have been already installed */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00647}00647         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_a1573d618c9d2901cc492a73c4205de7e}{ng\_findtype}}(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>name) == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00648}00648                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00649}00649                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00650}00650         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00651}00651 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00652}00652         \textcolor{comment}{/* Make a node and try attach it to the type */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00653}00653         \mbox{\hyperlink{ng__base_8c_ab6e0077ece6980827d6041c7d2bb4a66}{NG\_ALLOC\_NODE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00654}00654         \textcolor{keywordflow}{if} (node == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00655}00655                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00656}00656                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00657}00657         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00658}00658         node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}} = \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00659}00659 \textcolor{preprocessor}{\#ifdef VIMAGE}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00660}00660         node-\/>\mbox{\hyperlink{structng__node_a7d28e926ab6c7f794fc1479d28e50b35}{nd\_vnet}} = curvnet;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00661}00661 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00662}00662         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);                           \textcolor{comment}{/* note reference */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00663}00663         \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>refs++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00664}00664 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00665}00665         \mbox{\hyperlink{ng__base_8c_ad928fd4c0240042807f3fd39a4d2c60a}{NG\_QUEUE\_LOCK\_INIT}}(\&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00666}00666         STAILQ\_INIT(\&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.queue);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00667}00667         node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00668}00668 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00669}00669         \textcolor{comment}{/* Initialize hook list for new node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00670}00670         LIST\_INIT(\&node-\/>nd\_hooks);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00671}00671 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00672}00672         \textcolor{comment}{/* Get an ID and put us in the hash chain. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00673}00673         \mbox{\hyperlink{ng__base_8c_ac813e72949383fcb1b15370e228553e4}{IDHASH\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00674}00674         \textcolor{keywordflow}{for} (;;) \{ \textcolor{comment}{/* wrap protection, even if silly */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00675}00675                 \mbox{\hyperlink{structng__node}{node\_p}} node2 = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00676}00676                 node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}} = \mbox{\hyperlink{ng__base_8c_a46822549ab6d6bad03929ef57524c63e}{V\_nextID}}++; \textcolor{comment}{/* 137/sec for 1 year before wrap */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00677}00677 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00678}00678                 \textcolor{comment}{/* Is there a problem with the new number? */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00679}00679                 \mbox{\hyperlink{ng__base_8c_ae48fdf26194dbff38203310b45f0f573}{NG\_IDHASH\_FIND}}(node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node2); \textcolor{comment}{/* already taken? */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00680}00680                 \textcolor{keywordflow}{if} ((node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}} != 0) \&\& (node2 == NULL)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00681}00681                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00682}00682                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00683}00683         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00684}00684         \mbox{\hyperlink{ng__base_8c_ad685d5a522de935eabb0fd450c116d2b}{V\_ng\_nodes}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00685}00685         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_ad685d5a522de935eabb0fd450c116d2b}{V\_ng\_nodes}} * 2 > \mbox{\hyperlink{ng__base_8c_aa28823cd95db08aaf3e195ad052d261c}{V\_ng\_ID\_hmask}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00686}00686                 \mbox{\hyperlink{ng__base_8c_a635a4cb4c9c3d15699bde4208d9bdd5b}{ng\_ID\_rehash}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00687}00687         LIST\_INSERT\_HEAD(\&\mbox{\hyperlink{ng__base_8c_ad0a4773cb27c547300c11cc1cdc74780}{V\_ng\_ID\_hash}}[\mbox{\hyperlink{ng__base_8c_a6fefe6eae928e4a14060f2e2f3b4e4b4}{NG\_IDHASH\_FN}}(node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}})], node,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00688}00688             nd\_idnodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00689}00689         \mbox{\hyperlink{ng__base_8c_a25d0bab8bdf34e6fb0845ff73db9d678}{IDHASH\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00690}00690 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00691}00691         \textcolor{comment}{/* Done */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00692}00692         *nodepp = node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00693}00693         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00694}00694 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00695}00695 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00696}00696 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00697}00697 \textcolor{comment}{ * Forceably start the shutdown process on a node. Either call}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00698}00698 \textcolor{comment}{ * its shutdown method, or do the default shutdown if there is}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00699}00699 \textcolor{comment}{ * no type-\/specific method.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00700}00700 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00701}00701 \textcolor{comment}{ * We can only be called from a shutdown message, so we know we have}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00702}00702 \textcolor{comment}{ * a writer lock, and therefore exclusive access. It also means}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00703}00703 \textcolor{comment}{ * that we should not be on the work queue, but we check anyhow.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00704}00704 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00705}00705 \textcolor{comment}{ * Persistent node types must have a type-\/specific method which}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00706}00706 \textcolor{comment}{ * allocates a new node in which case, this one is irretrievably going away,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00707}00707 \textcolor{comment}{ * or cleans up anything it needs, and just makes the node valid again,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00708}00708 \textcolor{comment}{ * in which case we allow the node to survive.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00709}00709 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00710}00710 \textcolor{comment}{ * XXX We need to think of how to tell a persistent node that we}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00711}00711 \textcolor{comment}{ * REALLY need to go away because the hardware has gone or we}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00712}00712 \textcolor{comment}{ * are rebooting.... etc.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00713}00713 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00714}00714 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00715}\mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{00715}} \mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} dummy1, \textcolor{keywordtype}{void} *dummy2, \textcolor{keywordtype}{int} dummy3)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00716}00716 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00717}00717         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00718}00718 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00719}00719         \textcolor{comment}{/* Check if it's already shutting down */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00720}00720         \textcolor{keywordflow}{if} ((node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} \& \mbox{\hyperlink{netgraph_8h_a27c692370549951d03e2eb9e842029dd}{NGF\_CLOSING}}) != 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00721}00721                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00722}00722 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00723}00723         \textcolor{keywordflow}{if} (node == \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00724}00724                 printf (\textcolor{stringliteral}{"{}shutdown called on deadnode\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00725}00725                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00726}00726         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00727}00727 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00728}00728         \textcolor{comment}{/* Add an extra reference so it doesn't go away during this */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00729}00729         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00730}00730 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00731}00731         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00732}00732 \textcolor{comment}{         * Mark it invalid so any newcomers know not to try use it}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00733}00733 \textcolor{comment}{         * Also add our own mark so we can't recurse}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00734}00734 \textcolor{comment}{         * note that NGF\_INVALID does not do this as it's also set during}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00735}00735 \textcolor{comment}{         * creation}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00736}00736 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00737}00737         node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} |= \mbox{\hyperlink{netgraph_8h_a6d3a9e7aa2f636921cc07ea3206bc5e5}{NGF\_INVALID}}|\mbox{\hyperlink{netgraph_8h_a27c692370549951d03e2eb9e842029dd}{NGF\_CLOSING}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00738}00738 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00739}00739         \textcolor{comment}{/* If node has its pre-\/shutdown method, then call it first*/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00740}00740         \textcolor{keywordflow}{if} (node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}} \&\& node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a2ad739cae5f7f48974b3d97c0895d7b6}{close}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00741}00741                 (*node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a2ad739cae5f7f48974b3d97c0895d7b6}{close}})(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00742}00742 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00743}00743         \textcolor{comment}{/* Notify all remaining connected nodes to disconnect */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00744}00744         \textcolor{keywordflow}{while} ((hook = LIST\_FIRST(\&node-\/>nd\_hooks)) != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00745}00745                 \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00746}00746 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00747}00747         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00748}00748 \textcolor{comment}{         * Drain the input queue forceably.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00749}00749 \textcolor{comment}{         * it has no hooks so what's it going to do, bleed on someone?}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00750}00750 \textcolor{comment}{         * Theoretically we came here from a queue entry that was added}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00751}00751 \textcolor{comment}{         * Just before the queue was closed, so it should be empty anyway.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00752}00752 \textcolor{comment}{         * Also removes us from worklist if needed.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00753}00753 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00754}00754         \mbox{\hyperlink{ng__base_8c_abd80e0814383b1cb4d4e88855160eac4}{ng\_flush\_input\_queue}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00755}00755 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00756}00756         \textcolor{comment}{/* Ask the type if it has anything to do in this case */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00757}00757         \textcolor{keywordflow}{if} (node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}} \&\& node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_ad07b501fcff0c1cfb00adf8d23c3bed8}{shutdown}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00758}00758                 (*node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_ad07b501fcff0c1cfb00adf8d23c3bed8}{shutdown}})(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00759}00759                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a6bdd56e0f33084eeaadbe696febcbbd8}{NG\_NODE\_IS\_VALID}}(node)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00760}00760                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00761}00761 \textcolor{comment}{                         * Well, blow me down if the node code hasn't declared}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00762}00762 \textcolor{comment}{                         * that it doesn't want to die.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00763}00763 \textcolor{comment}{                         * Presumably it is a persistent node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00764}00764 \textcolor{comment}{                         * If we REALLY want it to go away,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00765}00765 \textcolor{comment}{                         *  e.g. hardware going away,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00766}00766 \textcolor{comment}{                         * Our caller should set NGF\_REALLY\_DIE in nd\_flags.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00767}00767 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00768}00768                         node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} \&= \string~(\mbox{\hyperlink{netgraph_8h_a6d3a9e7aa2f636921cc07ea3206bc5e5}{NGF\_INVALID}}|\mbox{\hyperlink{netgraph_8h_a27c692370549951d03e2eb9e842029dd}{NGF\_CLOSING}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00769}00769                         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node); \textcolor{comment}{/* Assume they still have theirs */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00770}00770                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00771}00771                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00772}00772         \} \textcolor{keywordflow}{else} \{                                \textcolor{comment}{/* do the default thing */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00773}00773                 \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00774}00774         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00775}00775 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00776}00776         \mbox{\hyperlink{ng__base_8c_a3d0c9145c32fcd7f37d545ece27c9663}{ng\_unname}}(node); \textcolor{comment}{/* basically a NOP these days */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00777}00777 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00778}00778         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00779}00779 \textcolor{comment}{         * Remove extra reference, possibly the last}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00780}00780 \textcolor{comment}{         * Possible other holders of references may include}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00781}00781 \textcolor{comment}{         * timeout callouts, but theoretically the node's supposed to}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00782}00782 \textcolor{comment}{         * have cancelled them. Possibly hardware dependencies may}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00783}00783 \textcolor{comment}{         * force a driver to 'linger' with a reference.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00784}00784 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00785}00785         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00786}00786 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00787}00787 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00788}00788 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00789}00789 \textcolor{comment}{ * Remove a reference to the node, possibly the last.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00790}00790 \textcolor{comment}{ * deadnode always acts as it it were the last.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00791}00791 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00792}00792 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00793}\mbox{\hyperlink{netgraph_8h_a22cd6bd52207ca868967686c8b04793e}{00793}} \mbox{\hyperlink{ng__base_8c_a22cd6bd52207ca868967686c8b04793e}{ng\_unref\_node}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00794}00794 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00795}00795 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00796}00796         \textcolor{keywordflow}{if} (node == \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00797}00797                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00798}00798 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00799}00799         CURVNET\_SET(node-\/>\mbox{\hyperlink{structng__node_a7d28e926ab6c7f794fc1479d28e50b35}{nd\_vnet}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00800}00800 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00801}00801         \textcolor{keywordflow}{if} (refcount\_release(\&node-\/>\mbox{\hyperlink{structng__node_a3c5445a7a1b01bbb5c8a4e09d9b6bd6e}{nd\_refs}})) \{ \textcolor{comment}{/* we were the last */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00802}00802 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00803}00803                 node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a912f3c02f88139ad9727811c34a69356}{refs}}-\/-\/; \textcolor{comment}{/* XXX maybe should get types lock? */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00804}00804                 \mbox{\hyperlink{ng__base_8c_ab370b1a5e1ad1b827616bdf05db3c341}{NAMEHASH\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00805}00805                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a73fb7660bb50d227ec6997cb007a5dd0}{NG\_NODE\_HAS\_NAME}}(node)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00806}00806                         \mbox{\hyperlink{ng__base_8c_a615ed8121628e631b8eb8d93ccb999c5}{V\_ng\_named\_nodes}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00807}00807                         LIST\_REMOVE(node, nd\_nodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00808}00808                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00809}00809                 \mbox{\hyperlink{ng__base_8c_aae4b3bcd8ef99b9c62f63a00e572aaa4}{NAMEHASH\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00810}00810 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00811}00811                 \mbox{\hyperlink{ng__base_8c_ac813e72949383fcb1b15370e228553e4}{IDHASH\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00812}00812                 \mbox{\hyperlink{ng__base_8c_ad685d5a522de935eabb0fd450c116d2b}{V\_ng\_nodes}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00813}00813                 LIST\_REMOVE(node, nd\_idnodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00814}00814                 \mbox{\hyperlink{ng__base_8c_a25d0bab8bdf34e6fb0845ff73db9d678}{IDHASH\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00815}00815 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00816}00816                 mtx\_destroy(\&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_af8931ff60a46e61cf4ae98af76d95621}{q\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00817}00817                 \mbox{\hyperlink{ng__base_8c_afcb1c616fe17f74aa28708b2e5c2e9f3}{NG\_FREE\_NODE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00818}00818         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00819}00819         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00820}00820 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00821}00821 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00822}00822 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00823}00823 \textcolor{comment}{                        Node ID handling}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00824}00824 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00825}00825 \textcolor{keyword}{static} \mbox{\hyperlink{structng__node}{node\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00826}\mbox{\hyperlink{ng__base_8c_ab22a4b7ba7932993a29f6f9426d5ddda}{00826}} \mbox{\hyperlink{ng__base_8c_ab22a4b7ba7932993a29f6f9426d5ddda}{ng\_ID2noderef}}(\mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}} ID)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00827}00827 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00828}00828         \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00829}00829 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00830}00830         \mbox{\hyperlink{ng__base_8c_ac31008b26fb640721ee68fc1692094e3}{IDHASH\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00831}00831         \mbox{\hyperlink{ng__base_8c_ae48fdf26194dbff38203310b45f0f573}{NG\_IDHASH\_FIND}}(ID, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00832}00832         \textcolor{keywordflow}{if} (node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00833}00833                 \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00834}00834         \mbox{\hyperlink{ng__base_8c_af5200c0955f48c3220918e108cb12e7f}{IDHASH\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00835}00835         \textcolor{keywordflow}{return}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00836}00836 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00837}00837 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00838}00838 \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00839}\mbox{\hyperlink{netgraph_8h_ac91f2c547b34db13ef98bb895defc729}{00839}} \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(\mbox{\hyperlink{netgraph_8h_a70cc0b2d21053f394c5351228ac45339}{node\_cp}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00840}00840 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00841}00841         \textcolor{keywordflow}{return} (node ? \mbox{\hyperlink{netgraph_8h_a4e976220d11ba62c9757bae3cfe1e9ed}{NG\_NODE\_ID}}(node) : 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00842}00842 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00843}00843 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00844}00844 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00845}00845 \textcolor{comment}{                        Node name handling}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00846}00846 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00847}00847 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00848}00848 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00849}00849 \textcolor{comment}{ * Assign a node a name.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00850}00850 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00851}00851 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00852}\mbox{\hyperlink{netgraph_8h_abae5851c9f312eebd398b1cd085fe067}{00852}} \mbox{\hyperlink{ng__base_8c_abae5851c9f312eebd398b1cd085fe067}{ng\_name\_node}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00853}00853 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00854}00854         uint32\_t hash;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00855}00855         \mbox{\hyperlink{structng__node}{node\_p}} node2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00856}00856         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00857}00857 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00858}00858         \textcolor{comment}{/* Rename without change is a noop */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00859}00859         \textcolor{keywordflow}{if} (strcmp(\mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node), \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}) == 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00860}00860                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00861}00861 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00862}00862         \textcolor{comment}{/* Check the name is valid */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00863}00863         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{ng__message_8h_a32299027e019790ea1d3c43118fa9825}{NG\_NODESIZ}}; i++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00864}00864                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}[i] == \textcolor{charliteral}{'\(\backslash\)0'} || \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}[i] == \textcolor{charliteral}{'.'} || \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}[i] == \textcolor{charliteral}{':'})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00865}00865                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00866}00866         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00867}00867         \textcolor{keywordflow}{if} (i == 0 || \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}[i] != \textcolor{charliteral}{'\(\backslash\)0'}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00868}00868                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00869}00869                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00870}00870         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00871}00871         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_a8cd13d5bed55b7feb7d42b3eff8c3866}{ng\_decodeidname}}(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}) != 0) \{ \textcolor{comment}{/* valid IDs not allowed here */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00872}00872                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00873}00873                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00874}00874         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00875}00875 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00876}00876         \mbox{\hyperlink{ng__base_8c_ab370b1a5e1ad1b827616bdf05db3c341}{NAMEHASH\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00877}00877         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_a615ed8121628e631b8eb8d93ccb999c5}{V\_ng\_named\_nodes}} * 2 > \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00878}00878                 \mbox{\hyperlink{ng__base_8c_ae70cd76253855a0ac8b8e7acb5ca567d}{ng\_name\_rehash}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00879}00879 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00880}00880         hash = hash32\_str(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, HASHINIT) \& \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00881}00881         \textcolor{comment}{/* Check the name isn't already being used. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00882}00882         LIST\_FOREACH(node2, \&\mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}}[hash], nd\_nodes)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00883}00883                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a6bdd56e0f33084eeaadbe696febcbbd8}{NG\_NODE\_IS\_VALID}}(node2) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00884}00884                     (strcmp(\mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node2), \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}) == 0)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00885}00885                         \mbox{\hyperlink{ng__base_8c_aae4b3bcd8ef99b9c62f63a00e572aaa4}{NAMEHASH\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00886}00886                         \textcolor{keywordflow}{return} (EADDRINUSE);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00887}00887                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00888}00888 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00889}00889         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a73fb7660bb50d227ec6997cb007a5dd0}{NG\_NODE\_HAS\_NAME}}(node))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00890}00890                 LIST\_REMOVE(node, nd\_nodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00891}00891         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00892}00892                 \mbox{\hyperlink{ng__base_8c_a615ed8121628e631b8eb8d93ccb999c5}{V\_ng\_named\_nodes}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00893}00893         \textcolor{comment}{/* Copy it. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00894}00894         strlcpy(\mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node), \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \mbox{\hyperlink{ng__message_8h_a32299027e019790ea1d3c43118fa9825}{NG\_NODESIZ}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00895}00895         \textcolor{comment}{/* Update name hash. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00896}00896         LIST\_INSERT\_HEAD(\&\mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}}[hash], node, nd\_nodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00897}00897         \mbox{\hyperlink{ng__base_8c_aae4b3bcd8ef99b9c62f63a00e572aaa4}{NAMEHASH\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00898}00898 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00899}00899         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00900}00900 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00901}00901 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00902}00902 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00903}00903 \textcolor{comment}{ * Find a node by absolute name. The name should NOT end with ':'}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00904}00904 \textcolor{comment}{ * The name "{}."{} means "{}this node"{} and "{}[xxx]"{} means "{}the node}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00905}00905 \textcolor{comment}{ * with ID (ie, at address) xxx"{}.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00906}00906 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00907}00907 \textcolor{comment}{ * Returns the node if found, else NULL.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00908}00908 \textcolor{comment}{ * Eventually should add something faster than a sequential search.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00909}00909 \textcolor{comment}{ * Note it acquires a reference on the node so you can be sure it's still}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00910}00910 \textcolor{comment}{ * there.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00911}00911 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00912}00912 \mbox{\hyperlink{structng__node}{node\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00913}\mbox{\hyperlink{netgraph_8h_ac51e8abd96d3b1cd5d168a7f87670cd8}{00913}} \mbox{\hyperlink{ng__base_8c_af5cdde2e6651a68d0a638c86b06998d7}{ng\_name2noderef}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00914}00914 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00915}00915         \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00916}00916         \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}} temp;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00917}00917         \textcolor{keywordtype}{int}     hash;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00918}00918 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00919}00919         \textcolor{comment}{/* "{}."{} means "{}this node"{} */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00920}00920         \textcolor{keywordflow}{if} (strcmp(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \textcolor{stringliteral}{"{}."{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00921}00921                 \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(here);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00922}00922                 \textcolor{keywordflow}{return}(here);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00923}00923         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00924}00924 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00925}00925         \textcolor{comment}{/* Check for name-\/by-\/ID */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00926}00926         \textcolor{keywordflow}{if} ((temp = \mbox{\hyperlink{ng__base_8c_a8cd13d5bed55b7feb7d42b3eff8c3866}{ng\_decodeidname}}(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}})) != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00927}00927                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__base_8c_ab22a4b7ba7932993a29f6f9426d5ddda}{ng\_ID2noderef}}(temp));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00928}00928         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00929}00929 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00930}00930         \textcolor{comment}{/* Find node by name. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00931}00931         hash = hash32\_str(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, HASHINIT) \& \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00932}00932         \mbox{\hyperlink{ng__base_8c_ab036211d590592840dba407807582728}{NAMEHASH\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00933}00933         LIST\_FOREACH(node, \&\mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}}[hash], nd\_nodes)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00934}00934                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a6bdd56e0f33084eeaadbe696febcbbd8}{NG\_NODE\_IS\_VALID}}(node) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00935}00935                     (strcmp(\mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node), \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}) == 0)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00936}00936                         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00937}00937                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00938}00938                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00939}00939         \mbox{\hyperlink{ng__base_8c_a6675e9790d9d4e39414826450f46b734}{NAMEHASH\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00940}00940 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00941}00941         \textcolor{keywordflow}{return} (node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00942}00942 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00943}00943 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00944}00944 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00945}00945 \textcolor{comment}{ * Decode an ID name, eg. "{}[f03034de]"{}. Returns 0 if the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00946}00946 \textcolor{comment}{ * string is not valid, otherwise returns the value.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00947}00947 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00948}00948 \textcolor{keyword}{static} \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00949}\mbox{\hyperlink{ng__base_8c_a8cd13d5bed55b7feb7d42b3eff8c3866}{00949}} \mbox{\hyperlink{ng__base_8c_a8cd13d5bed55b7feb7d42b3eff8c3866}{ng\_decodeidname}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00950}00950 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00951}00951         \textcolor{keyword}{const} \textcolor{keywordtype}{int} len = strlen(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00952}00952         \textcolor{keywordtype}{char} *eptr;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00953}00953         u\_long val;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00954}00954 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00955}00955         \textcolor{comment}{/* Check for proper length, brackets, no leading junk */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00956}00956         \textcolor{keywordflow}{if} ((len < 3) || (\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}[0] != \textcolor{charliteral}{'['}) || (\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}[len -\/ 1] != \textcolor{charliteral}{']'}) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00957}00957             (!isxdigit(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}[1])))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00958}00958                 \textcolor{keywordflow}{return} ((\mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}})0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00959}00959 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00960}00960         \textcolor{comment}{/* Decode number */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00961}00961         val = strtoul(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}} + 1, \&eptr, 16);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00962}00962         \textcolor{keywordflow}{if} ((eptr -\/ \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}} != len -\/ 1) || (val == ULONG\_MAX) || (val == 0))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00963}00963                 \textcolor{keywordflow}{return} ((\mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}})0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00964}00964 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00965}00965         \textcolor{keywordflow}{return} ((\mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}})val);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00966}00966 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00967}00967 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00968}00968 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00969}00969 \textcolor{comment}{ * Remove a name from a node. This should only be called}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00970}00970 \textcolor{comment}{ * when shutting down and removing the node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00971}00971 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00972}00972 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00973}\mbox{\hyperlink{ng__base_8c_a3d0c9145c32fcd7f37d545ece27c9663}{00973}} \mbox{\hyperlink{ng__base_8c_a3d0c9145c32fcd7f37d545ece27c9663}{ng\_unname}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00974}00974 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00975}00975 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00976}00976 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00977}00977 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00978}00978 \textcolor{comment}{ * Allocate a bigger name hash.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00979}00979 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00980}00980 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00981}\mbox{\hyperlink{ng__base_8c_ae70cd76253855a0ac8b8e7acb5ca567d}{00981}} \mbox{\hyperlink{ng__base_8c_ae70cd76253855a0ac8b8e7acb5ca567d}{ng\_name\_rehash}}()}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00982}00982 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00983}00983         \textcolor{keyword}{struct }nodehash *\textcolor{keyword}{new};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00984}00984         uint32\_t hash;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00985}00985         u\_long hmask;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00986}00986         \mbox{\hyperlink{structng__node}{node\_p}} node, node2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00987}00987         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00988}00988 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00989}00989         \textcolor{keyword}{new} = hashinit\_flags((\mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}} + 1) * 2, M\_NETGRAPH\_NODE, \&hmask,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00990}00990             HASH\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00991}00991         \textcolor{keywordflow}{if} (\textcolor{keyword}{new} == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00992}00992                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00993}00993 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00994}00994         \textcolor{keywordflow}{for} (i = 0; i <= \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}}; i++)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00995}00995                 LIST\_FOREACH\_SAFE(node, \&\mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}}[i], nd\_nodes, node2) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00996}00996 \textcolor{preprocessor}{\#ifdef INVARIANTS}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00997}00997                         LIST\_REMOVE(node, nd\_nodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00998}00998 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l00999}00999                         hash = hash32\_str(\mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node), HASHINIT) \& hmask;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01000}01000                         LIST\_INSERT\_HEAD(\&\textcolor{keyword}{new}[hash], node, nd\_nodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01001}01001                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01002}01002 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01003}01003         hashdestroy(\mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}}, M\_NETGRAPH\_NODE, \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01004}01004         \mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}} = \textcolor{keyword}{new};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01005}01005         \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}} = hmask;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01006}01006 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01007}01007 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01008}01008 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01009}01009 \textcolor{comment}{ * Allocate a bigger ID hash.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01010}01010 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01011}01011 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01012}\mbox{\hyperlink{ng__base_8c_a635a4cb4c9c3d15699bde4208d9bdd5b}{01012}} \mbox{\hyperlink{ng__base_8c_a635a4cb4c9c3d15699bde4208d9bdd5b}{ng\_ID\_rehash}}()}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01013}01013 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01014}01014         \textcolor{keyword}{struct }nodehash *\textcolor{keyword}{new};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01015}01015         uint32\_t hash;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01016}01016         u\_long hmask;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01017}01017         \mbox{\hyperlink{structng__node}{node\_p}} node, node2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01018}01018         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01019}01019 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01020}01020         \textcolor{keyword}{new} = hashinit\_flags((\mbox{\hyperlink{ng__base_8c_aa28823cd95db08aaf3e195ad052d261c}{V\_ng\_ID\_hmask}} + 1) * 2, M\_NETGRAPH\_NODE, \&hmask,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01021}01021             HASH\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01022}01022         \textcolor{keywordflow}{if} (\textcolor{keyword}{new} == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01023}01023                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01024}01024 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01025}01025         \textcolor{keywordflow}{for} (i = 0; i <= \mbox{\hyperlink{ng__base_8c_aa28823cd95db08aaf3e195ad052d261c}{V\_ng\_ID\_hmask}}; i++)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01026}01026                 LIST\_FOREACH\_SAFE(node, \&\mbox{\hyperlink{ng__base_8c_ad0a4773cb27c547300c11cc1cdc74780}{V\_ng\_ID\_hash}}[i], nd\_idnodes, node2) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01027}01027 \textcolor{preprocessor}{\#ifdef INVARIANTS}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01028}01028                         LIST\_REMOVE(node, nd\_idnodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01029}01029 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01030}01030                         hash = (node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}} \% (hmask + 1));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01031}01031                         LIST\_INSERT\_HEAD(\&\textcolor{keyword}{new}[hash], node, nd\_idnodes);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01032}01032                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01033}01033 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01034}01034         hashdestroy(\mbox{\hyperlink{ng__base_8c_ad0a4773cb27c547300c11cc1cdc74780}{V\_ng\_ID\_hash}}, M\_NETGRAPH\_NODE, \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01035}01035         \mbox{\hyperlink{ng__base_8c_ad0a4773cb27c547300c11cc1cdc74780}{V\_ng\_ID\_hash}} = \textcolor{keyword}{new};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01036}01036         \mbox{\hyperlink{ng__base_8c_aa28823cd95db08aaf3e195ad052d261c}{V\_ng\_ID\_hmask}} = hmask;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01037}01037 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01038}01038 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01039}01039 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01040}01040 \textcolor{comment}{                        Hook routines}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01041}01041 \textcolor{comment}{ Names are not optional. Hooks are always connected, except for a}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01042}01042 \textcolor{comment}{ brief moment within these routines. On invalidation or during creation}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01043}01043 \textcolor{comment}{ they are connected to the 'dead' hook.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01044}01044 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01045}01045 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01046}01046 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01047}01047 \textcolor{comment}{ * Remove a hook reference}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01048}01048 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01049}01049 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01050}\mbox{\hyperlink{netgraph_8h_a110fa425ee607f014ff26deb935dc639}{01050}} \mbox{\hyperlink{ng__base_8c_a110fa425ee607f014ff26deb935dc639}{ng\_unref\_hook}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01051}01051 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01052}01052 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01053}01053         \textcolor{keywordflow}{if} (hook == \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01054}01054                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01055}01055 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01056}01056         \textcolor{keywordflow}{if} (refcount\_release(\&hook-\/>\mbox{\hyperlink{structng__hook_af63714658d050321cf7cb8402fbe6809}{hk\_refs}})) \{ \textcolor{comment}{/* we were the last */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01057}01057                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a6b55c0c75eaed4461c6842667c267f6c}{\_NG\_HOOK\_NODE}}(hook)) \textcolor{comment}{/* it'll probably be ng\_deadnode */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01058}01058                         \mbox{\hyperlink{netgraph_8h_aba5d1046e7da882e8c2072d4a892cea1}{\_NG\_NODE\_UNREF}}((\mbox{\hyperlink{netgraph_8h_a6b55c0c75eaed4461c6842667c267f6c}{\_NG\_HOOK\_NODE}}(hook)));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01059}01059                 \mbox{\hyperlink{ng__base_8c_a8722277e9896682a744cdfd4e36e3e36}{NG\_FREE\_HOOK}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01060}01060         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01061}01061 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01062}01062 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01063}01063 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01064}01064 \textcolor{comment}{ * Add an unconnected hook to a node. Only used internally.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01065}01065 \textcolor{comment}{ * Assumes node is locked. (XXX not yet true )}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01066}01066 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01067}01067 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01068}\mbox{\hyperlink{ng__base_8c_acdcfe7d2de980edf8b023940e2f5ca3d}{01068}} \mbox{\hyperlink{ng__base_8c_acdcfe7d2de980edf8b023940e2f5ca3d}{ng\_add\_hook}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \mbox{\hyperlink{structng__hook}{hook\_p}} *hookp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01069}01069 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01070}01070         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01071}01071         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01072}01072 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01073}01073         \textcolor{comment}{/* Check that the given name is good */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01074}01074         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01075}01075                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01076}01076                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01077}01077         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01078}01078         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(node, \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}) != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01079}01079                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01080}01080                 \textcolor{keywordflow}{return} (EEXIST);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01081}01081         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01082}01082 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01083}01083         \textcolor{comment}{/* Allocate the hook and link it up */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01084}01084         \mbox{\hyperlink{ng__base_8c_a4d799b4632971b7b01dae0c1b36af091}{NG\_ALLOC\_HOOK}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01085}01085         \textcolor{keywordflow}{if} (hook == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01086}01086                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01087}01087                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01088}01088         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01089}01089         hook-\/>\mbox{\hyperlink{structng__hook_af63714658d050321cf7cb8402fbe6809}{hk\_refs}} = 1;               \textcolor{comment}{/* add a reference for us to return */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01090}01090         hook-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} = \mbox{\hyperlink{netgraph_8h_a3731dfce0d5b1c0924ae5e57ee04aa52}{HK\_INVALID}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01091}01091         hook-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}}; \textcolor{comment}{/* start off this way */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01092}01092         hook-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}} = node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01093}01093         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);           \textcolor{comment}{/* each hook counts as a reference */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01094}01094 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01095}01095         \textcolor{comment}{/* Set hook name */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01096}01096         strlcpy(\mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(hook), \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \mbox{\hyperlink{ng__message_8h_a2fadb5752a5c456671b0aea53179c2dd}{NG\_HOOKSIZ}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01097}01097 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01098}01098         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01099}01099 \textcolor{comment}{         * Check if the node type code has something to say about it}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01100}01100 \textcolor{comment}{         * If it fails, the unref of the hook will also unref the node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01101}01101 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01102}01102         \textcolor{keywordflow}{if} (node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a2613901390d5b07e32bf7c370bb7728d}{newhook}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01103}01103                 \textcolor{keywordflow}{if} ((error = (*node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a2613901390d5b07e32bf7c370bb7728d}{newhook}})(node, hook, \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01104}01104                         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook);       \textcolor{comment}{/* this frees the hook */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01105}01105                         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01106}01106                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01107}01107         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01108}01108         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01109}01109 \textcolor{comment}{         * The 'type' agrees so far, so go ahead and link it in.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01110}01110 \textcolor{comment}{         * We'll ask again later when we actually connect the hooks.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01111}01111 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01112}01112         LIST\_INSERT\_HEAD(\&node-\/>nd\_hooks, hook, hk\_hooks);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01113}01113         node-\/>\mbox{\hyperlink{structng__node_a55e56dfb6c3134af0533343b4d0be160}{nd\_numhooks}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01114}01114         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);   \textcolor{comment}{/* one for the node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01115}01115 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01116}01116         \textcolor{keywordflow}{if} (hookp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01117}01117                 *hookp = hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01118}01118         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01119}01119 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01120}01120 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01121}01121 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01122}01122 \textcolor{comment}{ * Find a hook}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01123}01123 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01124}01124 \textcolor{comment}{ * Node types may supply their own optimized routines for finding}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01125}01125 \textcolor{comment}{ * hooks.  If none is supplied, we just do a linear search.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01126}01126 \textcolor{comment}{ * XXX Possibly we should add a reference to the hook?}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01127}01127 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01128}01128 \mbox{\hyperlink{structng__hook}{hook\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01129}\mbox{\hyperlink{netgraph_8h_afe7f3ef6e4db622ef5c1578ba08d3d9c}{01129}} \mbox{\hyperlink{ng__base_8c_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01130}01130 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01131}01131         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01132}01132 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01133}01133         \textcolor{keywordflow}{if} (node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a0370fbddee52d67bc66d8759bceb6b60}{findhook}} != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01134}01134                 \textcolor{keywordflow}{return} (*node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a0370fbddee52d67bc66d8759bceb6b60}{findhook}})(node, \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01135}01135         LIST\_FOREACH(hook, \&node-\/>nd\_hooks, hk\_hooks) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01136}01136                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(hook) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01137}01137                     (strcmp(\mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(hook), \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}) == 0))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01138}01138                         \textcolor{keywordflow}{return} (hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01139}01139         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01140}01140         \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01141}01141 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01142}01142 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01143}01143 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01144}01144 \textcolor{comment}{ * Destroy a hook}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01145}01145 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01146}01146 \textcolor{comment}{ * As hooks are always attached, this really destroys two hooks.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01147}01147 \textcolor{comment}{ * The one given, and the one attached to it. Disconnect the hooks}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01148}01148 \textcolor{comment}{ * from each other first. We reconnect the peer hook to the 'dead'}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01149}01149 \textcolor{comment}{ * hook so that it can still exist after we depart. We then}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01150}01150 \textcolor{comment}{ * send the peer its own destroy message. This ensures that we only}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01151}01151 \textcolor{comment}{ * interact with the peer's structures when it is locked processing that}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01152}01152 \textcolor{comment}{ * message. We hold a reference to the peer hook so we are guaranteed that}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01153}01153 \textcolor{comment}{ * the peer hook and node are still going to exist until}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01154}01154 \textcolor{comment}{ * we are finished there as the hook holds a ref on the node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01155}01155 \textcolor{comment}{ * We run this same code again on the peer hook, but that time it is already}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01156}01156 \textcolor{comment}{ * attached to the 'dead' hook.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01157}01157 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01158}01158 \textcolor{comment}{ * This routine is called at all stages of hook creation}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01159}01159 \textcolor{comment}{ * on error detection and must be able to handle any such stage.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01160}01160 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01161}01161 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01162}\mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{01162}} \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01163}01163 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01164}01164         \mbox{\hyperlink{structng__hook}{hook\_p}} peer;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01165}01165         \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01166}01166 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01167}01167         \textcolor{keywordflow}{if} (hook == \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}}) \{  \textcolor{comment}{/* better safe than sorry */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01168}01168                 printf(\textcolor{stringliteral}{"{}ng\_destroy\_hook called on deadhook\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01169}01169                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01170}01170         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01171}01171 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01172}01172         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01173}01173 \textcolor{comment}{         * Protect divorce process with mutex, to avoid races on}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01174}01174 \textcolor{comment}{         * simultaneous disconnect.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01175}01175 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01176}01176         \mbox{\hyperlink{ng__base_8c_a94bd888ffca08e14ce5466ceceb4dcc6}{TOPOLOGY\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01177}01177 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01178}01178         hook-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} |= \mbox{\hyperlink{netgraph_8h_a3731dfce0d5b1c0924ae5e57ee04aa52}{HK\_INVALID}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01179}01179 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01180}01180         peer = \mbox{\hyperlink{netgraph_8h_a74d793bf65c44f5732dbaf331d871681}{NG\_HOOK\_PEER}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01181}01181         node = \mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01182}01182 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01183}01183         \textcolor{keywordflow}{if} (peer \&\& (peer != \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}})) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01184}01184                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01185}01185 \textcolor{comment}{                 * Set the peer to point to ng\_deadhook}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01186}01186 \textcolor{comment}{                 * from this moment on we are effectively independent it.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01187}01187 \textcolor{comment}{                 * send it an rmhook message of its own.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01188}01188 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01189}01189                 peer-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}}; \textcolor{comment}{/* They no longer know us */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01190}01190                 hook-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}}; \textcolor{comment}{/* Nor us, them */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01191}01191                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(peer) == \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01192}01192                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01193}01193 \textcolor{comment}{                         * If it's already divorced from a node,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01194}01194 \textcolor{comment}{                         * just free it.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01195}01195 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01196}01196                         \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01197}01197                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01198}01198                         \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01199}01199                         \mbox{\hyperlink{ng__base_8c_a6cbe70c76c741d7035f338d9132a05d0}{ng\_rmhook\_self}}(peer);     \textcolor{comment}{/* Send it a surprise */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01200}01200                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01201}01201                 \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(peer);               \textcolor{comment}{/* account for peer link */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01202}01202                 \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook);               \textcolor{comment}{/* account for peer link */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01203}01203         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01204}01204                 \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01205}01205 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01206}01206         \mbox{\hyperlink{ng__base_8c_a1b0965a46f18b75d1296474b25a43150}{TOPOLOGY\_NOTOWNED}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01207}01207 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01208}01208         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01209}01209 \textcolor{comment}{         * Remove the hook from the node's list to avoid possible recursion}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01210}01210 \textcolor{comment}{         * in case the disconnection results in node shutdown.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01211}01211 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01212}01212         \textcolor{keywordflow}{if} (node == \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}}) \{ \textcolor{comment}{/* happens if called from ng\_con\_nodes() */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01213}01213                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01214}01214         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01215}01215         LIST\_REMOVE(hook, hk\_hooks);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01216}01216         node-\/>\mbox{\hyperlink{structng__node_a55e56dfb6c3134af0533343b4d0be160}{nd\_numhooks}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01217}01217         \textcolor{keywordflow}{if} (node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a14860a69307b7d51b498405275780059}{disconnect}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01218}01218                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01219}01219 \textcolor{comment}{                 * The type handler may elect to destroy the node so don't}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01220}01220 \textcolor{comment}{                 * trust its existence after this point. (except}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01221}01221 \textcolor{comment}{                 * that we still hold a reference on it. (which we}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01222}01222 \textcolor{comment}{                 * inherrited from the hook we are destroying)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01223}01223 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01224}01224                 (*node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a14860a69307b7d51b498405275780059}{disconnect}}) (hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01225}01225         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01226}01226 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01227}01227         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01228}01228 \textcolor{comment}{         * Note that because we will point to ng\_deadnode, the original node}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01229}01229 \textcolor{comment}{         * is not decremented automatically so we do that manually.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01230}01230 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01231}01231         \mbox{\hyperlink{netgraph_8h_a6b55c0c75eaed4461c6842667c267f6c}{\_NG\_HOOK\_NODE}}(hook) = \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01232}01232         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);       \textcolor{comment}{/* We no longer point to it so adjust count */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01233}01233         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook);       \textcolor{comment}{/* Account for linkage (in list) to node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01234}01234 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01235}01235 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01236}01236 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01237}01237 \textcolor{comment}{ * Take two hooks on a node and merge the connection so that the given node}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01238}01238 \textcolor{comment}{ * is effectively bypassed.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01239}01239 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01240}01240 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01241}\mbox{\hyperlink{netgraph_8h_ad1f7c03db501a87de69cfb57100ce144}{01241}} \mbox{\hyperlink{ng__base_8c_ad1f7c03db501a87de69cfb57100ce144}{ng\_bypass}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook1, \mbox{\hyperlink{structng__hook}{hook\_p}} hook2)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01242}01242 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01243}01243         \textcolor{keywordflow}{if} (hook1-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}} != hook2-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01244}01244                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01245}01245                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01246}01246         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01247}01247         \mbox{\hyperlink{ng__base_8c_a94bd888ffca08e14ce5466ceceb4dcc6}{TOPOLOGY\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01248}01248         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook1) || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook2)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01249}01249                 \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01250}01250                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01251}01251         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01252}01252         hook1-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}}-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = hook2-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01253}01253         hook2-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}}-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = hook1-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01254}01254 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01255}01255         hook1-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01256}01256         hook2-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01257}01257         \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01258}01258 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01259}01259         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook1);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01260}01260         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01261}01261 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01262}01262         \textcolor{comment}{/* XXX If we ever cache methods on hooks update them as well */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01263}01263         \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook1);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01264}01264         \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01265}01265         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01266}01266 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01267}01267 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01268}01268 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01269}01269 \textcolor{comment}{ * Install a new netgraph type}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01270}01270 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01271}01271 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01272}\mbox{\hyperlink{netgraph_8h_a67f567d871dc683c4cb7a75dcfedf458}{01272}} \mbox{\hyperlink{ng__base_8c_a67f567d871dc683c4cb7a75dcfedf458}{ng\_newtype}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__type}{ng\_type}} *tp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01273}01273 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01274}01274         \textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} namelen = strlen(tp-\/>\mbox{\hyperlink{structng__type_a7be0a2326d841f2d3e347eb682eef992}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01275}01275 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01276}01276         \textcolor{comment}{/* Check version and type name fields */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01277}01277         \textcolor{keywordflow}{if} ((tp-\/>\mbox{\hyperlink{structng__type_adbc1c8884ff0e625c19c4b513262fd0e}{version}} != \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}}) || (namelen == 0) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01278}01278             (namelen >= \mbox{\hyperlink{ng__message_8h_a906b5420bdaacab22ea6b99ba61f0dcd}{NG\_TYPESIZ}})) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01279}01279                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01280}01280                 \textcolor{keywordflow}{if} (tp-\/>\mbox{\hyperlink{structng__type_adbc1c8884ff0e625c19c4b513262fd0e}{version}} != \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01281}01281                         printf(\textcolor{stringliteral}{"{}Netgraph: Node type rejected. ABI mismatch. "{}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01282}01282                             \textcolor{stringliteral}{"{}Suggest recompile\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01283}01283                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01284}01284                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01285}01285         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01286}01286 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01287}01287         \textcolor{comment}{/* Check for name collision */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01288}01288         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_a1573d618c9d2901cc492a73c4205de7e}{ng\_findtype}}(tp-\/>\mbox{\hyperlink{structng__type_a7be0a2326d841f2d3e347eb682eef992}{name}}) != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01289}01289                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01290}01290                 \textcolor{keywordflow}{return} (EEXIST);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01291}01291         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01292}01292 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01293}01293         \textcolor{comment}{/* Link in new type */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01294}01294         \mbox{\hyperlink{ng__base_8c_add5cd5fbd97c58f0434a25ebde39bfda}{TYPELIST\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01295}01295         LIST\_INSERT\_HEAD(\&ng\_typelist, tp, types);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01296}01296         tp-\/>\mbox{\hyperlink{structng__type_a912f3c02f88139ad9727811c34a69356}{refs}} = 1;       \textcolor{comment}{/* first ref is linked list */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01297}01297         \mbox{\hyperlink{ng__base_8c_a8b788036e6feb332405dc003726502b6}{TYPELIST\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01298}01298         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01299}01299 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01300}01300 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01301}01301 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01302}01302 \textcolor{comment}{ * unlink a netgraph type}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01303}01303 \textcolor{comment}{ * If no examples exist}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01304}01304 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01305}01305 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01306}\mbox{\hyperlink{netgraph_8h_ab38b5c23d992569bd43607fbc99ca862}{01306}} \mbox{\hyperlink{ng__base_8c_ab38b5c23d992569bd43607fbc99ca862}{ng\_rmtype}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__type}{ng\_type}} *tp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01307}01307 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01308}01308         \textcolor{comment}{/* Check for name collision */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01309}01309         \textcolor{keywordflow}{if} (tp-\/>\mbox{\hyperlink{structng__type_a912f3c02f88139ad9727811c34a69356}{refs}} != 1) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01310}01310                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01311}01311                 \textcolor{keywordflow}{return} (EBUSY);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01312}01312         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01313}01313 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01314}01314         \textcolor{comment}{/* Unlink type */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01315}01315         \mbox{\hyperlink{ng__base_8c_add5cd5fbd97c58f0434a25ebde39bfda}{TYPELIST\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01316}01316         LIST\_REMOVE(tp, types);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01317}01317         \mbox{\hyperlink{ng__base_8c_a8b788036e6feb332405dc003726502b6}{TYPELIST\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01318}01318         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01319}01319 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01320}01320 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01321}01321 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01322}01322 \textcolor{comment}{ * Look for a type of the name given}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01323}01323 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01324}01324 \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} *}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01325}\mbox{\hyperlink{netgraph_8h_a11e96ff129f76a9785dd4352328fbaf6}{01325}} \mbox{\hyperlink{ng__base_8c_a1573d618c9d2901cc492a73c4205de7e}{ng\_findtype}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *\textcolor{keyword}{typename})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01326}01326 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01327}01327         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01328}01328 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01329}01329         \mbox{\hyperlink{ng__base_8c_ad792d0dd51964515d36b0d8fe4a5fcd1}{TYPELIST\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01330}01330         LIST\_FOREACH(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \&ng\_typelist, types) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01331}01331                 \textcolor{keywordflow}{if} (strcmp(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>name, \textcolor{keyword}{typename}) == 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01332}01332                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01333}01333         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01334}01334         \mbox{\hyperlink{ng__base_8c_a708532d52448aee33f5f494c088c6c19}{TYPELIST\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01335}01335         \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01336}01336 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01337}01337 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01338}01338 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01339}01339 \textcolor{comment}{                        Composite routines}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01340}01340 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01341}01341 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01342}01342 \textcolor{comment}{ * Connect two nodes using the specified hooks, using queued functions.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01343}01343 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01344}01344 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01345}\mbox{\hyperlink{ng__base_8c_a76dfd3c077be6fd0a11484327e3a8455}{01345}} \mbox{\hyperlink{ng__base_8c_a76dfd3c077be6fd0a11484327e3a8455}{ng\_con\_part3}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01346}01346 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01347}01347         \textcolor{keywordtype}{int}     error = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01348}01348 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01349}01349         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01350}01350 \textcolor{comment}{         * When we run, we know that the node 'node' is locked for us.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01351}01351 \textcolor{comment}{         * Our caller has a reference on the hook.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01352}01352 \textcolor{comment}{         * Our caller has a reference on the node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01353}01353 \textcolor{comment}{         * (In this case our caller is ng\_apply\_item() ).}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01354}01354 \textcolor{comment}{         * The peer hook has a reference on the hook.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01355}01355 \textcolor{comment}{         * We are all set up except for the final call to the node, and}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01356}01356 \textcolor{comment}{         * the clearing of the INVALID flag.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01357}01357 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01358}01358         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook) == \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01359}01359                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01360}01360 \textcolor{comment}{                 * The node must have been freed again since we last visited}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01361}01361 \textcolor{comment}{                 * here. ng\_destry\_hook() has this effect but nothing else does.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01362}01362 \textcolor{comment}{                 * We should just release our references and}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01363}01363 \textcolor{comment}{                 * free anything we can think of.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01364}01364 \textcolor{comment}{                 * Since we know it's been destroyed, and it's our caller}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01365}01365 \textcolor{comment}{                 * that holds the references, just return.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01366}01366 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01367}01367                 \mbox{\hyperlink{ng__base_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01368}01368         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01369}01369         \textcolor{keywordflow}{if} (hook-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a87a6bdf65a8d0acf196f83d4f3609d4a}{connect}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01370}01370                 \textcolor{keywordflow}{if} ((error = (*hook-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a87a6bdf65a8d0acf196f83d4f3609d4a}{connect}}) (hook))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01371}01371                         \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);   \textcolor{comment}{/* also zaps peer */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01372}01372                         printf(\textcolor{stringliteral}{"{}failed in ng\_con\_part3()\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01373}01373                         \mbox{\hyperlink{ng__base_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01374}01374                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01375}01375         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01376}01376         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01377}01377 \textcolor{comment}{         *  XXX this is wrong for SMP. Possibly we need}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01378}01378 \textcolor{comment}{         * to separate out 'create' and 'invalid' flags.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01379}01379 \textcolor{comment}{         * should only set flags on hooks we have locked under our node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01380}01380 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01381}01381         hook-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} \&= \string~HK\_INVALID;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01382}01382 done:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01383}01383         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01384}01384         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01385}01385 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01386}01386 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01387}01387 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01388}\mbox{\hyperlink{ng__base_8c_a0756b63155b159535f352915ac5cc77b}{01388}} \mbox{\hyperlink{ng__base_8c_a0756b63155b159535f352915ac5cc77b}{ng\_con\_part2}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01389}01389 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01390}01390         \mbox{\hyperlink{structng__hook}{hook\_p}}    peer;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01391}01391         \textcolor{keywordtype}{int}     error = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01392}01392 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01393}01393         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01394}01394 \textcolor{comment}{         * When we run, we know that the node 'node' is locked for us.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01395}01395 \textcolor{comment}{         * Our caller has a reference on the hook.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01396}01396 \textcolor{comment}{         * Our caller has a reference on the node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01397}01397 \textcolor{comment}{         * (In this case our caller is ng\_apply\_item() ).}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01398}01398 \textcolor{comment}{         * The peer hook has a reference on the hook.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01399}01399 \textcolor{comment}{         * our node pointer points to the 'dead' node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01400}01400 \textcolor{comment}{         * First check the hook name is unique.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01401}01401 \textcolor{comment}{         * Should not happen because we checked before queueing this.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01402}01402 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01403}01403         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(node, \mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(hook)) != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01404}01404                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01405}01405                 \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook); \textcolor{comment}{/* should destroy peer too */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01406}01406                 printf(\textcolor{stringliteral}{"{}failed in ng\_con\_part2()\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01407}01407                 \mbox{\hyperlink{ng__base_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EEXIST);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01408}01408         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01409}01409         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01410}01410 \textcolor{comment}{         * Check if the node type code has something to say about it}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01411}01411 \textcolor{comment}{         * If it fails, the unref of the hook will also unref the attached node,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01412}01412 \textcolor{comment}{         * however since that node is 'ng\_deadnode' this will do nothing.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01413}01413 \textcolor{comment}{         * The peer hook will also be destroyed.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01414}01414 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01415}01415         \textcolor{keywordflow}{if} (node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a2613901390d5b07e32bf7c370bb7728d}{newhook}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01416}01416                 \textcolor{keywordflow}{if} ((error = (*node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a2613901390d5b07e32bf7c370bb7728d}{newhook}})(node, hook,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01417}01417                     hook-\/>\mbox{\hyperlink{structng__hook_a1b5feb51d20fcb4e32d8542159b4abc6}{hk\_name}}))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01418}01418                         \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook); \textcolor{comment}{/* should destroy peer too */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01419}01419                         printf(\textcolor{stringliteral}{"{}failed in ng\_con\_part2()\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01420}01420                         \mbox{\hyperlink{ng__base_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01421}01421                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01422}01422         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01423}01423 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01424}01424         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01425}01425 \textcolor{comment}{         * The 'type' agrees so far, so go ahead and link it in.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01426}01426 \textcolor{comment}{         * We'll ask again later when we actually connect the hooks.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01427}01427 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01428}01428         hook-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}} = node;            \textcolor{comment}{/* just overwrite ng\_deadnode */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01429}01429         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);           \textcolor{comment}{/* each hook counts as a reference */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01430}01430         LIST\_INSERT\_HEAD(\&node-\/>nd\_hooks, hook, hk\_hooks);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01431}01431         node-\/>\mbox{\hyperlink{structng__node_a55e56dfb6c3134af0533343b4d0be160}{nd\_numhooks}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01432}01432         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);   \textcolor{comment}{/* one for the node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01433}01433 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01434}01434         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01435}01435 \textcolor{comment}{         * We now have a symmetrical situation, where both hooks have been}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01436}01436 \textcolor{comment}{         * linked to their nodes, the newhook methods have been called}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01437}01437 \textcolor{comment}{         * And the references are all correct. The hooks are still marked}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01438}01438 \textcolor{comment}{         * as invalid, as we have not called the 'connect' methods}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01439}01439 \textcolor{comment}{         * yet.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01440}01440 \textcolor{comment}{         * We can call the local one immediately as we have the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01441}01441 \textcolor{comment}{         * node locked, but we need to queue the remote one.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01442}01442 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01443}01443         \textcolor{keywordflow}{if} (hook-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a87a6bdf65a8d0acf196f83d4f3609d4a}{connect}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01444}01444                 \textcolor{keywordflow}{if} ((error = (*hook-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a87a6bdf65a8d0acf196f83d4f3609d4a}{connect}}) (hook))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01445}01445                         \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);   \textcolor{comment}{/* also zaps peer */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01446}01446                         printf(\textcolor{stringliteral}{"{}failed in ng\_con\_part2(A)\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01447}01447                         \mbox{\hyperlink{ng__base_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01448}01448                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01449}01449         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01450}01450 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01451}01451         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01452}01452 \textcolor{comment}{         * Acquire topo mutex to avoid race with ng\_destroy\_hook().}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01453}01453 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01454}01454         \mbox{\hyperlink{ng__base_8c_ae5b87416a2b11accb2a7f3271b033b21}{TOPOLOGY\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01455}01455         peer = hook-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01456}01456         \textcolor{keywordflow}{if} (peer == \&\mbox{\hyperlink{ng__base_8c_a7b3579274c11317f5f0c7ded0c8f0154}{ng\_deadhook}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01457}01457                 \mbox{\hyperlink{ng__base_8c_ac1083cc6c0f464103baed3f28488e144}{TOPOLOGY\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01458}01458                 printf(\textcolor{stringliteral}{"{}failed in ng\_con\_part2(B)\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01459}01459                 \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01460}01460                 \mbox{\hyperlink{ng__base_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01461}01461         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01462}01462         \mbox{\hyperlink{ng__base_8c_ac1083cc6c0f464103baed3f28488e144}{TOPOLOGY\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01463}01463 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01464}01464         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__base_8c_ae6eed3e0eff8b28cfbf7eef24626df73}{ng\_send\_fn2}}(peer-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}, peer, item, \&\mbox{\hyperlink{ng__base_8c_a76dfd3c077be6fd0a11484327e3a8455}{ng\_con\_part3}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01465}01465             NULL, 0, \mbox{\hyperlink{netgraph_8h_a62719900a67b93f52470baf2cff3ed42}{NG\_REUSE\_ITEM}}))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01466}01466                 printf(\textcolor{stringliteral}{"{}failed in ng\_con\_part2(C)\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01467}01467                 \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);   \textcolor{comment}{/* also zaps peer */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01468}01468                 \textcolor{keywordflow}{return} (error);         \textcolor{comment}{/* item was consumed. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01469}01469         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01470}01470         hook-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} \&= \string~HK\_INVALID; \textcolor{comment}{/* need both to be able to work */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01471}01471         \textcolor{keywordflow}{return} (0);                     \textcolor{comment}{/* item was consumed. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01472}01472 done:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01473}01473         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01474}01474         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01475}01475 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01476}01476 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01477}01477 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01478}01478 \textcolor{comment}{ * Connect this node with another node. We assume that this node is}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01479}01479 \textcolor{comment}{ * currently locked, as we are only called from an NGM\_CONNECT message.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01480}01480 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01481}01481 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01482}\mbox{\hyperlink{ng__base_8c_a5def34cf5530ace8fcb8d5e805e653a9}{01482}} \mbox{\hyperlink{ng__base_8c_a5def34cf5530ace8fcb8d5e805e653a9}{ng\_con\_nodes}}(\mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01483}01483     \mbox{\hyperlink{structng__node}{node\_p}} node2, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name2)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01484}01484 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01485}01485         \textcolor{keywordtype}{int}     error;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01486}01486         \mbox{\hyperlink{structng__hook}{hook\_p}}    hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01487}01487         \mbox{\hyperlink{structng__hook}{hook\_p}}    hook2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01488}01488 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01489}01489         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(node2, name2) != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01490}01490                 \textcolor{keywordflow}{return}(EEXIST);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01491}01491         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01492}01492         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__base_8c_acdcfe7d2de980edf8b023940e2f5ca3d}{ng\_add\_hook}}(node, \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \&hook)))  \textcolor{comment}{/* gives us a ref */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01493}01493                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01494}01494         \textcolor{comment}{/* Allocate the other hook and link it up */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01495}01495         \mbox{\hyperlink{ng__base_8c_a4d799b4632971b7b01dae0c1b36af091}{NG\_ALLOC\_HOOK}}(hook2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01496}01496         \textcolor{keywordflow}{if} (hook2 == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01497}01497                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01498}01498                 \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);   \textcolor{comment}{/* XXX check ref counts so far */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01499}01499                 \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook);       \textcolor{comment}{/* including our ref */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01500}01500                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01501}01501         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01502}01502         hook2-\/>\mbox{\hyperlink{structng__hook_af63714658d050321cf7cb8402fbe6809}{hk\_refs}} = 1;              \textcolor{comment}{/* start with a reference for us. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01503}01503         hook2-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} = \mbox{\hyperlink{netgraph_8h_a3731dfce0d5b1c0924ae5e57ee04aa52}{HK\_INVALID}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01504}01504         hook2-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = hook;           \textcolor{comment}{/* Link the two together */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01505}01505         hook-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = hook2;   }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01506}01506         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);           \textcolor{comment}{/* Add a ref for the peer to each*/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01507}01507         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01508}01508         hook2-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}} = \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01509}01509         strlcpy(\mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(hook2), name2, \mbox{\hyperlink{ng__message_8h_a2fadb5752a5c456671b0aea53179c2dd}{NG\_HOOKSIZ}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01510}01510 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01511}01511         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01512}01512 \textcolor{comment}{         * Queue the function above.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01513}01513 \textcolor{comment}{         * Procesing continues in that function in the lock context of}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01514}01514 \textcolor{comment}{         * the other node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01515}01515 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01516}01516         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__base_8c_ae6eed3e0eff8b28cfbf7eef24626df73}{ng\_send\_fn2}}(node2, hook2, item, \&\mbox{\hyperlink{ng__base_8c_a0756b63155b159535f352915ac5cc77b}{ng\_con\_part2}}, NULL, 0,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01517}01517             \mbox{\hyperlink{netgraph_8h_a1c75827c8804a03bc15ada5001f5e985}{NG\_NOFLAGS}}))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01518}01518                 printf(\textcolor{stringliteral}{"{}failed in ng\_con\_nodes(): \%d\(\backslash\)n"{}}, error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01519}01519                 \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);   \textcolor{comment}{/* also zaps peer */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01520}01520         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01521}01521 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01522}01522         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook);               \textcolor{comment}{/* Let each hook go if it wants to */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01523}01523         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01524}01524         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01525}01525 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01526}01526 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01527}01527 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01528}01528 \textcolor{comment}{ * Make a peer and connect.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01529}01529 \textcolor{comment}{ * We assume that the local node is locked.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01530}01530 \textcolor{comment}{ * The new node probably doesn't need a lock until}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01531}01531 \textcolor{comment}{ * it has a hook, because it cannot really have any work until then,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01532}01532 \textcolor{comment}{ * but we should think about it a bit more.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01533}01533 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01534}01534 \textcolor{comment}{ * The problem may come if the other node also fires up}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01535}01535 \textcolor{comment}{ * some hardware or a timer or some other source of activation,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01536}01536 \textcolor{comment}{ * also it may already get a command msg via it's ID.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01537}01537 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01538}01538 \textcolor{comment}{ * We could use the same method as ng\_con\_nodes() but we'd have}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01539}01539 \textcolor{comment}{ * to add ability to remove the node when failing. (Not hard, just}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01540}01540 \textcolor{comment}{ * make arg1 point to the node to remove).}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01541}01541 \textcolor{comment}{ * Unless of course we just ignore failure to connect and leave}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01542}01542 \textcolor{comment}{ * an unconnected node?}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01543}01543 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01544}01544 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01545}\mbox{\hyperlink{ng__base_8c_ae41f58c0e2071e9978775a6fb5e00b41}{01545}} \mbox{\hyperlink{ng__base_8c_ae41f58c0e2071e9978775a6fb5e00b41}{ng\_mkpeer}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name2, \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01546}01546 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01547}01547         \mbox{\hyperlink{structng__node}{node\_p}}    node2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01548}01548         \mbox{\hyperlink{structng__hook}{hook\_p}}    hook1, hook2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01549}01549         \textcolor{keywordtype}{int}     error;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01550}01550 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01551}01551         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__base_8c_a4877bafb8cdb93eefaecd207af968dfa}{ng\_make\_node}}(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \&node2))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01552}01552                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01553}01553         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01554}01554 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01555}01555         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__base_8c_acdcfe7d2de980edf8b023940e2f5ca3d}{ng\_add\_hook}}(node, \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \&hook1))) \{ \textcolor{comment}{/* gives us a ref */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01556}01556                 \mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}(node2, NULL, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01557}01557                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01558}01558         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01559}01559 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01560}01560         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__base_8c_acdcfe7d2de980edf8b023940e2f5ca3d}{ng\_add\_hook}}(node2, name2, \&hook2))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01561}01561                 \mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}(node2, NULL, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01562}01562                 \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook1);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01563}01563                 \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook1);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01564}01564                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01565}01565         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01566}01566 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01567}01567         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01568}01568 \textcolor{comment}{         * Actually link the two hooks together.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01569}01569 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01570}01570         hook1-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = hook2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01571}01571         hook2-\/>\mbox{\hyperlink{structng__hook_a469a30a09c0a49a9753264e5b336e3fe}{hk\_peer}} = hook1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01572}01572 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01573}01573         \textcolor{comment}{/* Each hook is referenced by the other */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01574}01574         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook1);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01575}01575         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01576}01576 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01577}01577         \textcolor{comment}{/* Give each node the opportunity to veto the pending connection */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01578}01578         \textcolor{keywordflow}{if} (hook1-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a87a6bdf65a8d0acf196f83d4f3609d4a}{connect}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01579}01579                 error = (*hook1-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a87a6bdf65a8d0acf196f83d4f3609d4a}{connect}}) (hook1);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01580}01580         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01581}01581 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01582}01582         \textcolor{keywordflow}{if} ((error == 0) \&\& hook2-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a87a6bdf65a8d0acf196f83d4f3609d4a}{connect}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01583}01583                 error = (*hook2-\/>\mbox{\hyperlink{structng__hook_a87404c0a8619bbd37d1c9a0c2ab61482}{hk\_node}}-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a87a6bdf65a8d0acf196f83d4f3609d4a}{connect}}) (hook2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01584}01584         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01585}01585 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01586}01586         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01587}01587 \textcolor{comment}{         * drop the references we were holding on the two hooks.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01588}01588 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01589}01589         \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01590}01590                 \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook2);  \textcolor{comment}{/* also zaps hook1 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01591}01591                 \mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}(node2, NULL, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01592}01592         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01593}01593                 \textcolor{comment}{/* As a last act, allow the hooks to be used */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01594}01594                 hook1-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} \&= \string~HK\_INVALID;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01595}01595                 hook2-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} \&= \string~HK\_INVALID;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01596}01596         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01597}01597         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook1);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01598}01598         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01599}01599         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01600}01600 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01601}01601 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01602}01602 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01603}01603 \textcolor{comment}{                Utility routines to send self messages}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01604}01604 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01605}01605 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01606}01606 \textcolor{comment}{/* Shut this node down as soon as everyone is clear of it */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01607}01607 \textcolor{comment}{/* Should add arg "{}immediately"{} to jump the queue */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01608}01608 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01609}\mbox{\hyperlink{netgraph_8h_a85914ce0da2b314478aaf7efcdcd3ff0}{01609}} \mbox{\hyperlink{ng__base_8c_a61b14c501529c1aed905f3ccf6b28ff9}{ng\_rmnode\_self}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01610}01610 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01611}01611         \textcolor{keywordtype}{int}             error;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01612}01612 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01613}01613         \textcolor{keywordflow}{if} (node == \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01614}01614                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01615}01615         node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} |= \mbox{\hyperlink{netgraph_8h_a6d3a9e7aa2f636921cc07ea3206bc5e5}{NGF\_INVALID}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01616}01616         \textcolor{keywordflow}{if} (node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} \& \mbox{\hyperlink{netgraph_8h_a27c692370549951d03e2eb9e842029dd}{NGF\_CLOSING}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01617}01617                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01618}01618 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01619}01619         error = \mbox{\hyperlink{ng__base_8c_abc5e657ef87b4ec66eceab40a5344831}{ng\_send\_fn}}(node, NULL, \&\mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01620}01620         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01621}01621 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01622}01622 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01623}01623 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01624}\mbox{\hyperlink{ng__base_8c_a9dcdba5417f7def6500b0dc3bf5f4215}{01624}} \mbox{\hyperlink{ng__base_8c_a9dcdba5417f7def6500b0dc3bf5f4215}{ng\_rmhook\_part2}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{void} *arg1, \textcolor{keywordtype}{int} arg2)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01625}01625 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01626}01626         \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01627}01627         return ;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01628}01628 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01629}01629 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01630}01630 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01631}\mbox{\hyperlink{netgraph_8h_a6cbe70c76c741d7035f338d9132a05d0}{01631}} \mbox{\hyperlink{ng__base_8c_a6cbe70c76c741d7035f338d9132a05d0}{ng\_rmhook\_self}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01632}01632 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01633}01633         \textcolor{keywordtype}{int}             error;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01634}01634         \mbox{\hyperlink{structng__node}{node\_p}} node = \mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01635}01635 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01636}01636         \textcolor{keywordflow}{if} (node == \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01637}01637                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01638}01638 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01639}01639         error = \mbox{\hyperlink{ng__base_8c_abc5e657ef87b4ec66eceab40a5344831}{ng\_send\_fn}}(node, hook, \&\mbox{\hyperlink{ng__base_8c_a9dcdba5417f7def6500b0dc3bf5f4215}{ng\_rmhook\_part2}}, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01640}01640         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01641}01641 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01642}01642 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01643}01643 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01644}01644 \textcolor{comment}{ * Parse and verify a string of the form:  <NODE:><PATH>}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01645}01645 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01646}01646 \textcolor{comment}{ * Such a string can refer to a specific node or a specific hook}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01647}01647 \textcolor{comment}{ * on a specific node, depending on how you look at it. In the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01648}01648 \textcolor{comment}{ * latter case, the PATH component must not end in a dot.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01649}01649 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01650}01650 \textcolor{comment}{ * Both <NODE:> and <PATH> are optional. The <PATH> is a string}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01651}01651 \textcolor{comment}{ * of hook names separated by dots. This breaks out the original}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01652}01652 \textcolor{comment}{ * string, setting *nodep to "{}NODE"{} (or NULL if none) and *pathp}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01653}01653 \textcolor{comment}{ * to "{}PATH"{} (or NULL if degenerate). Also, *hookp will point to}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01654}01654 \textcolor{comment}{ * the final hook component of <PATH>, if any, otherwise NULL.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01655}01655 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01656}01656 \textcolor{comment}{ * This returns -\/1 if the path is malformed. The char ** are optional.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01657}01657 \textcolor{comment}{ ***********************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01658}01658 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01659}\mbox{\hyperlink{ng__base_8c_a8905c404d8e7fc81228a092b670294c9}{01659}} \mbox{\hyperlink{ng__base_8c_a8905c404d8e7fc81228a092b670294c9}{ng\_path\_parse}}(\textcolor{keywordtype}{char} *addr, \textcolor{keywordtype}{char} **nodep, \textcolor{keywordtype}{char} **pathp, \textcolor{keywordtype}{char} **hookp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01660}01660 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01661}01661         \textcolor{keywordtype}{char}    *node, *path, *hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01662}01662         \textcolor{keywordtype}{int}     k;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01663}01663 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01664}01664         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01665}01665 \textcolor{comment}{         * Extract absolute NODE, if any}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01666}01666 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01667}01667         \textcolor{keywordflow}{for} (path = addr; *path \&\& *path != \textcolor{charliteral}{':'}; path++);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01668}01668         \textcolor{keywordflow}{if} (*path) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01669}01669                 node = addr;    \textcolor{comment}{/* Here's the NODE */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01670}01670                 *path++ = \textcolor{charliteral}{'\(\backslash\)0'}; \textcolor{comment}{/* Here's the PATH */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01671}01671 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01672}01672                 \textcolor{comment}{/* Node name must not be empty */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01673}01673                 \textcolor{keywordflow}{if} (!*node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01674}01674                         \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01675}01675 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01676}01676                 \textcolor{comment}{/* A name of "{}."{} is OK; otherwise '.' not allowed */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01677}01677                 \textcolor{keywordflow}{if} (strcmp(node, \textcolor{stringliteral}{"{}."{}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01678}01678                         \textcolor{keywordflow}{for} (k = 0; node[k]; k++)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01679}01679                                 \textcolor{keywordflow}{if} (node[k] == \textcolor{charliteral}{'.'})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01680}01680                                         \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01681}01681                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01682}01682         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01683}01683                 node = NULL;    \textcolor{comment}{/* No absolute NODE */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01684}01684                 path = addr;    \textcolor{comment}{/* Here's the PATH */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01685}01685         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01686}01686 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01687}01687         \textcolor{comment}{/* Snoop for illegal characters in PATH */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01688}01688         \textcolor{keywordflow}{for} (k = 0; path[k]; k++)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01689}01689                 \textcolor{keywordflow}{if} (path[k] == \textcolor{charliteral}{':'})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01690}01690                         \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01691}01691 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01692}01692         \textcolor{comment}{/* Check for no repeated dots in PATH */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01693}01693         \textcolor{keywordflow}{for} (k = 0; path[k]; k++)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01694}01694                 \textcolor{keywordflow}{if} (path[k] == \textcolor{charliteral}{'.'} \&\& path[k + 1] == \textcolor{charliteral}{'.'})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01695}01695                         \textcolor{keywordflow}{return} -\/1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01696}01696 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01697}01697         \textcolor{comment}{/* Remove extra (degenerate) dots from beginning or end of PATH */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01698}01698         \textcolor{keywordflow}{if} (path[0] == \textcolor{charliteral}{'.'})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01699}01699                 path++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01700}01700         \textcolor{keywordflow}{if} (*path \&\& path[strlen(path) -\/ 1] == \textcolor{charliteral}{'.'})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01701}01701                 path[strlen(path) -\/ 1] = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01702}01702 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01703}01703         \textcolor{comment}{/* If PATH has a dot, then we're not talking about a hook */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01704}01704         \textcolor{keywordflow}{if} (*path) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01705}01705                 \textcolor{keywordflow}{for} (hook = path, k = 0; path[k]; k++)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01706}01706                         \textcolor{keywordflow}{if} (path[k] == \textcolor{charliteral}{'.'}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01707}01707                                 hook = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01708}01708                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01709}01709                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01710}01710         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01711}01711                 path = hook = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01712}01712 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01713}01713         \textcolor{comment}{/* Done */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01714}01714         \textcolor{keywordflow}{if} (nodep)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01715}01715                 *nodep = node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01716}01716         \textcolor{keywordflow}{if} (pathp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01717}01717                 *pathp = path;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01718}01718         \textcolor{keywordflow}{if} (hookp)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01719}01719                 *hookp = hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01720}01720         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01721}01721 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01722}01722 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01723}01723 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01724}01724 \textcolor{comment}{ * Given a path, which may be absolute or relative, and a starting node,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01725}01725 \textcolor{comment}{ * return the destination node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01726}01726 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01727}01727 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01728}\mbox{\hyperlink{ng__base_8c_a4e328a30d6a99603f9b47e5e02e76178}{01728}} \mbox{\hyperlink{ng__base_8c_a4e328a30d6a99603f9b47e5e02e76178}{ng\_path2noderef}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_aae3c1824fe47b66db79327a8ae360e3b}{address}}, \mbox{\hyperlink{structng__node}{node\_p}} *destp,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01729}01729     \mbox{\hyperlink{structng__hook}{hook\_p}} *lasthook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01730}01730 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01731}01731         \textcolor{keywordtype}{char}    fullpath[\mbox{\hyperlink{ng__message_8h_a733bc82f792f68fbacb86b295697ec54}{NG\_PATHSIZ}}];}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01732}01732         \textcolor{keywordtype}{char}   *nodename, *path;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01733}01733         \mbox{\hyperlink{structng__node}{node\_p}}  node, oldnode;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01734}01734 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01735}01735         \textcolor{comment}{/* Initialize */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01736}01736         \textcolor{keywordflow}{if} (destp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01737}01737                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01738}01738                 \textcolor{keywordflow}{return} EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01739}01739         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01740}01740         *destp = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01741}01741 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01742}01742         \textcolor{comment}{/* Make a writable copy of address for ng\_path\_parse() */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01743}01743         strncpy(fullpath, \mbox{\hyperlink{ng__btsocket__rfcomm_8h_aae3c1824fe47b66db79327a8ae360e3b}{address}}, \textcolor{keyword}{sizeof}(fullpath) -\/ 1);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01744}01744         fullpath[\textcolor{keyword}{sizeof}(fullpath) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01745}01745 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01746}01746         \textcolor{comment}{/* Parse out node and sequence of hooks */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01747}01747         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_a8905c404d8e7fc81228a092b670294c9}{ng\_path\_parse}}(fullpath, \&nodename, \&path, NULL) < 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01748}01748                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01749}01749                 \textcolor{keywordflow}{return} EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01750}01750         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01751}01751 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01752}01752         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01753}01753 \textcolor{comment}{         * For an absolute address, jump to the starting node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01754}01754 \textcolor{comment}{         * Note that this holds a reference on the node for us.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01755}01755 \textcolor{comment}{         * Don't forget to drop the reference if we don't need it.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01756}01756 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01757}01757         \textcolor{keywordflow}{if} (nodename) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01758}01758                 node = \mbox{\hyperlink{ng__base_8c_af5cdde2e6651a68d0a638c86b06998d7}{ng\_name2noderef}}(here, nodename);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01759}01759                 \textcolor{keywordflow}{if} (node == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01760}01760                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01761}01761                         \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01762}01762                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01763}01763         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01764}01764                 \textcolor{keywordflow}{if} (here == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01765}01765                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01766}01766                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01767}01767                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01768}01768                 node = here;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01769}01769                 \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01770}01770         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01771}01771 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01772}01772         \textcolor{keywordflow}{if} (path == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01773}01773                 \textcolor{keywordflow}{if} (lasthook != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01774}01774                         *lasthook = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01775}01775                 *destp = node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01776}01776                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01777}01777         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01778}01778 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01779}01779         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01780}01780 \textcolor{comment}{         * Now follow the sequence of hooks}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01781}01781 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01782}01782 \textcolor{comment}{         * XXXGL: The path may demolish as we go the sequence, but if}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01783}01783 \textcolor{comment}{         * we hold the topology mutex at critical places, then, I hope,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01784}01784 \textcolor{comment}{         * we would always have valid pointers in hand, although the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01785}01785 \textcolor{comment}{         * path behind us may no longer exist.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01786}01786 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01787}01787         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01788}01788                 \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01789}01789                 \textcolor{keywordtype}{char} *\mbox{\hyperlink{structsegment}{segment}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01790}01790 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01791}01791                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01792}01792 \textcolor{comment}{                 * Break out the next path segment. Replace the dot we just}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01793}01793 \textcolor{comment}{                 * found with a NUL; "{}path"{} points to the next segment (or the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01794}01794 \textcolor{comment}{                 * NUL at the end).}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01795}01795 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01796}01796                 \textcolor{keywordflow}{for} (\mbox{\hyperlink{structsegment}{segment}} = path; *path != \textcolor{charliteral}{'\(\backslash\)0'}; path++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01797}01797                         \textcolor{keywordflow}{if} (*path == \textcolor{charliteral}{'.'}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01798}01798                                 *path++ = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01799}01799                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01800}01800                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01801}01801                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01802}01802 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01803}01803                 \textcolor{comment}{/* We have a segment, so look for a hook by that name */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01804}01804                 hook = \mbox{\hyperlink{ng__base_8c_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(node, \mbox{\hyperlink{structsegment}{segment}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01805}01805 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01806}01806                 \mbox{\hyperlink{ng__base_8c_a94bd888ffca08e14ce5466ceceb4dcc6}{TOPOLOGY\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01807}01807                 \textcolor{comment}{/* Can't get there from here... */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01808}01808                 \textcolor{keywordflow}{if} (hook == NULL || \mbox{\hyperlink{netgraph_8h_a74d793bf65c44f5732dbaf331d871681}{NG\_HOOK\_PEER}}(hook) == NULL ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01809}01809                     \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01810}01810                     \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(\mbox{\hyperlink{netgraph_8h_a74d793bf65c44f5732dbaf331d871681}{NG\_HOOK\_PEER}}(hook))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01811}01811                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01812}01812                         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01813}01813                         \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01814}01814                         \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01815}01815                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01816}01816 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01817}01817                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01818}01818 \textcolor{comment}{                 * Hop on over to the next node}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01819}01819 \textcolor{comment}{                 * XXX}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01820}01820 \textcolor{comment}{                 * Big race conditions here as hooks and nodes go away}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01821}01821 \textcolor{comment}{                 * *** Idea.. store an ng\_ID\_t in each hook and use that}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01822}01822 \textcolor{comment}{                 * instead of the direct hook in this crawl?}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01823}01823 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01824}01824                 oldnode = node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01825}01825                 \textcolor{keywordflow}{if} ((node = \mbox{\hyperlink{netgraph_8h_a2422a9fbdceb03a36586612af27100fb}{NG\_PEER\_NODE}}(hook)))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01826}01826                         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);   \textcolor{comment}{/* XXX RACE */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01827}01827                 \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(oldnode);    \textcolor{comment}{/* XXX another race */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01828}01828                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01829}01829                         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);       \textcolor{comment}{/* XXX more races */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01830}01830                         \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01831}01831                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01832}01832                         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01833}01833                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01834}01834 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01835}01835                 \textcolor{keywordflow}{if} (*path == \textcolor{charliteral}{'\(\backslash\)0'}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01836}01836                         \textcolor{keywordflow}{if} (lasthook != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01837}01837                                 \textcolor{keywordflow}{if} (hook != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01838}01838                                         *lasthook = \mbox{\hyperlink{netgraph_8h_a74d793bf65c44f5732dbaf331d871681}{NG\_HOOK\_PEER}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01839}01839                                         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(*lasthook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01840}01840                                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01841}01841                                         *lasthook = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01842}01842                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01843}01843                         \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01844}01844                         *destp = node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01845}01845                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01846}01846                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01847}01847                 \mbox{\hyperlink{ng__base_8c_a694e1fe09b2a613be2324c29050ff544}{TOPOLOGY\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01848}01848         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01849}01849 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01850}01850 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01851}01851 \textcolor{comment}{/***************************************************************\(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01852}01852 \textcolor{comment}{* Input queue handling.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01853}01853 \textcolor{comment}{* All activities are submitted to the node via the input queue}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01854}01854 \textcolor{comment}{* which implements a multiple-\/reader/single-\/writer gate.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01855}01855 \textcolor{comment}{* Items which cannot be handled immediately are queued.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01856}01856 \textcolor{comment}{*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01857}01857 \textcolor{comment}{* read-\/write queue locking inline functions                     *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01858}01858 \textcolor{comment}{\(\backslash\)***************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01859}01859 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01860}01860 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}    \mbox{\hyperlink{ng__base_8c_a1466ee9aeecfe805b7d10ef057feb3a5}{ng\_queue\_rw}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}}  item, \textcolor{keywordtype}{int} rw);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01861}01861 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}    \mbox{\hyperlink{ng__base_8c_a3071a7c84b79acd625c9009ab858aa5a}{ng\_dequeue}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keywordtype}{int} *rw);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01862}01862 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}    \mbox{\hyperlink{ng__base_8c_a2fda4cdaa64d66c0b3371de1856df377}{ng\_acquire\_read}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}}  item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01863}01863 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}    \mbox{\hyperlink{ng__base_8c_a4efc88578d7fe8394b07594b37d97cff}{ng\_acquire\_write}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}}  item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01864}01864 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}    \mbox{\hyperlink{ng__base_8c_a1d782c3c61ee01c8dd34bc6acb92c3ee}{ng\_leave\_read}}(\mbox{\hyperlink{structng__node}{node\_p}} node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01865}01865 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}    \mbox{\hyperlink{ng__base_8c_aa24302b13a2a3ea612fcf70a882db5b5}{ng\_leave\_write}}(\mbox{\hyperlink{structng__node}{node\_p}} node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01866}01866 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01867}01867 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01868}01868 \textcolor{comment}{ * Definition of the bits fields in the ng\_queue flag word.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01869}01869 \textcolor{comment}{ * Defined here rather than in netgraph.h because no-\/one should fiddle}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01870}01870 \textcolor{comment}{ * with them.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01871}01871 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01872}01872 \textcolor{comment}{ * The ordering here may be important! don't shuffle these.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01873}01873 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01874}01874 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01875}01875 \textcolor{comment}{ Safety Barrier-\/-\/-\/-\/-\/-\/-\/-\/+ (adjustable to suit taste) (not used yet)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01876}01876 \textcolor{comment}{                       |}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01877}01877 \textcolor{comment}{                       V}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01878}01878 \textcolor{comment}{+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01879}01879 \textcolor{comment}{  | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01880}01880 \textcolor{comment}{  | |A|c|t|i|v|e| |R|e|a|d|e|r| |C|o|u|n|t| | | | | | | | | |P|A|}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01881}01881 \textcolor{comment}{  | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |O|W|}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01882}01882 \textcolor{comment}{+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01883}01883 \textcolor{comment}{  \(\backslash\)\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_/ | |}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01884}01884 \textcolor{comment}{                            V                                | |}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01885}01885 \textcolor{comment}{                  [active reader count]                      | |}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01886}01886 \textcolor{comment}{                                                             | |}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01887}01887 \textcolor{comment}{            Operation Pending -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+ |}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01888}01888 \textcolor{comment}{                                                               |}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01889}01889 \textcolor{comment}{          Active Writer -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01890}01890 \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01891}01891 \textcolor{comment}{Node queue has such semantics:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01892}01892 \textcolor{comment}{-\/ All flags modifications are atomic.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01893}01893 \textcolor{comment}{-\/ Reader count can be incremented only if there is no writer or pending flags.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01894}01894 \textcolor{comment}{  As soon as this can't be done with single operation, it is implemented with}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01895}01895 \textcolor{comment}{  spin loop and atomic\_cmpset().}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01896}01896 \textcolor{comment}{-\/ Writer flag can be set only if there is no any bits set.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01897}01897 \textcolor{comment}{  It is implemented with atomic\_cmpset().}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01898}01898 \textcolor{comment}{-\/ Pending flag can be set any time, but to avoid collision on queue processing}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01899}01899 \textcolor{comment}{  all queue fields are protected by the mutex.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01900}01900 \textcolor{comment}{-\/ Queue processing thread reads queue holding the mutex, but releases it while}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01901}01901 \textcolor{comment}{  processing. When queue is empty pending flag is removed.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01902}01902 \textcolor{comment}{*/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01903}01903 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01904}\mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{01904}} \textcolor{preprocessor}{\#define WRITER\_ACTIVE   0x00000001}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01905}\mbox{\hyperlink{ng__base_8c_a495a0a463d2403303bd8c1966ac1439d}{01905}} \textcolor{preprocessor}{\#define OP\_PENDING      0x00000002}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01906}\mbox{\hyperlink{ng__base_8c_aacd5572c6bd93411765fc210a523b510}{01906}} \textcolor{preprocessor}{\#define READER\_INCREMENT 0x00000004}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01907}\mbox{\hyperlink{ng__base_8c_a84bca447e1f23b03434e2fc0fdb6753b}{01907}} \textcolor{preprocessor}{\#define READER\_MASK     0xfffffffc      }\textcolor{comment}{/* Not valid if WRITER\_ACTIVE is set */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01908}\mbox{\hyperlink{ng__base_8c_a1c64b75236062784fd964d9b6c6d9043}{01908}} \textcolor{preprocessor}{\#define SAFETY\_BARRIER  0x00100000      }\textcolor{comment}{/* 128K items queued should be enough */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01909}01909 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01910}01910 \textcolor{comment}{/* Defines of more elaborate states on the queue */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01911}01911 \textcolor{comment}{/* Mask of bits a new read cares about */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01912}\mbox{\hyperlink{ng__base_8c_acbd24c49abe22086862b716e5d411c17}{01912}} \textcolor{preprocessor}{\#define NGQ\_RMASK       (WRITER\_ACTIVE|OP\_PENDING)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01913}01913 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01914}01914 \textcolor{comment}{/* Mask of bits a new write cares about */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01915}\mbox{\hyperlink{ng__base_8c_a8499b55087845bc94a0555c21d17dbed}{01915}} \textcolor{preprocessor}{\#define NGQ\_WMASK       (NGQ\_RMASK|READER\_MASK)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01916}01916 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01917}01917 \textcolor{comment}{/* Test to decide if there is something on the queue. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01918}\mbox{\hyperlink{ng__base_8c_ae30fb9d28bb8d286889040f11ced4ad5}{01918}} \textcolor{preprocessor}{\#define QUEUE\_ACTIVE(QP) ((QP)-\/>q\_flags \& OP\_PENDING)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01919}01919 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01920}01920 \textcolor{comment}{/* How to decide what the next queued item is. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01921}\mbox{\hyperlink{ng__base_8c_a7404eb363295e5b2e18353bb7d8640d5}{01921}} \textcolor{preprocessor}{\#define HEAD\_IS\_READER(QP)  NGI\_QUEUED\_READER(STAILQ\_FIRST(\&(QP)-\/>queue))}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01922}\mbox{\hyperlink{ng__base_8c_a73d06b8f6e682eaad0b38fe92d7c0bb8}{01922}} \textcolor{preprocessor}{\#define HEAD\_IS\_WRITER(QP)  NGI\_QUEUED\_WRITER(STAILQ\_FIRST(\&(QP)-\/>queue)) }\textcolor{comment}{/* notused */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01923}01923 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01924}01924 \textcolor{comment}{/* Read the status to decide if the next item on the queue can now run. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01925}\mbox{\hyperlink{ng__base_8c_a64b81945ef0721fa7351d6949bc6bae6}{01925}} \textcolor{preprocessor}{\#define QUEUED\_READER\_CAN\_PROCEED(QP)                   \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01926}01926 \textcolor{preprocessor}{                (((QP)-\/>q\_flags \& (NGQ\_RMASK \& \string~OP\_PENDING)) == 0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01927}\mbox{\hyperlink{ng__base_8c_a5f9b8b2f2e1c6ce76af64b43c927e07b}{01927}} \textcolor{preprocessor}{\#define QUEUED\_WRITER\_CAN\_PROCEED(QP)                   \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01928}01928 \textcolor{preprocessor}{                (((QP)-\/>q\_flags \& (NGQ\_WMASK \& \string~OP\_PENDING)) == 0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01929}01929 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01930}01930 \textcolor{comment}{/* Is there a chance of getting ANY work off the queue? */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01931}\mbox{\hyperlink{ng__base_8c_a885feaf999909ea41b7c36a9f4111a2b}{01931}} \textcolor{preprocessor}{\#define NEXT\_QUEUED\_ITEM\_CAN\_PROCEED(QP)                                \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01932}01932 \textcolor{preprocessor}{        ((HEAD\_IS\_READER(QP)) ? QUEUED\_READER\_CAN\_PROCEED(QP) :         \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01933}01933 \textcolor{preprocessor}{                                QUEUED\_WRITER\_CAN\_PROCEED(QP))}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01934}01934 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01935}\mbox{\hyperlink{ng__base_8c_a0136f4beabe27edcd169dccb65e9ec10}{01935}} \textcolor{preprocessor}{\#define NGQRW\_R 0}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01936}\mbox{\hyperlink{ng__base_8c_a3bdaac4235ca6763d7e50b47981c4f74}{01936}} \textcolor{preprocessor}{\#define NGQRW\_W 1}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01937}01937 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01938}\mbox{\hyperlink{ng__base_8c_ab1201e0899217addc29a99b7e6b28491}{01938}} \textcolor{preprocessor}{\#define NGQ2\_WORKQ      0x00000001}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01939}01939 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01940}01940 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01941}01941 \textcolor{comment}{ * Taking into account the current state of the queue and node, possibly take}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01942}01942 \textcolor{comment}{ * the next entry off the queue and return it. Return NULL if there was}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01943}01943 \textcolor{comment}{ * nothing we could return, either because there really was nothing there, or}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01944}01944 \textcolor{comment}{ * because the node was in a state where it cannot yet process the next item}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01945}01945 \textcolor{comment}{ * on the queue.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01946}01946 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01947}01947 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01948}\mbox{\hyperlink{ng__base_8c_a3071a7c84b79acd625c9009ab858aa5a}{01948}} \mbox{\hyperlink{ng__base_8c_a3071a7c84b79acd625c9009ab858aa5a}{ng\_dequeue}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keywordtype}{int} *rw)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01949}01949 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01950}01950         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01951}01951         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__queue}{ng\_queue}} *ngq = \&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01952}01952 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01953}01953         \textcolor{comment}{/* This MUST be called with the mutex held. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01954}01954         mtx\_assert(\&ngq-\/>\mbox{\hyperlink{structng__queue_af8931ff60a46e61cf4ae98af76d95621}{q\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01955}01955 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01956}01956         \textcolor{comment}{/* If there is nothing queued, then just return. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01957}01957         \textcolor{keywordflow}{if} (!\mbox{\hyperlink{ng__base_8c_ae30fb9d28bb8d286889040f11ced4ad5}{QUEUE\_ACTIVE}}(ngq)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01958}01958                 CTR4(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) queue empty; "{}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01959}01959                     \textcolor{stringliteral}{"{}queue flags 0x\%lx"{}}, \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01960}01960                     node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node, ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01961}01961                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01962}01962         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01963}01963 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01964}01964         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01965}01965 \textcolor{comment}{         * From here, we can assume there is a head item.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01966}01966 \textcolor{comment}{         * We need to find out what it is and if it can be dequeued, given}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01967}01967 \textcolor{comment}{         * the current state of the node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01968}01968 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01969}01969         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_a7404eb363295e5b2e18353bb7d8640d5}{HEAD\_IS\_READER}}(ngq)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01970}01970                 \textcolor{keywordflow}{while} (1) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01971}01971                         \textcolor{keywordtype}{long} t = ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01972}01972                         \textcolor{keywordflow}{if} (t \& \mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{WRITER\_ACTIVE}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01973}01973                                 \textcolor{comment}{/* There is writer, reader can't proceed. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01974}01974                                 CTR4(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) queued "{}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01975}01975                                     \textcolor{stringliteral}{"{}reader can't proceed; queue flags 0x\%lx"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01976}01976                                     \_\_func\_\_, node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node, t);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01977}01977                                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01978}01978                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01979}01979                         \textcolor{keywordflow}{if} (atomic\_cmpset\_acq\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, t,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01980}01980                             t + \mbox{\hyperlink{ng__base_8c_aacd5572c6bd93411765fc210a523b510}{READER\_INCREMENT}}))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01981}01981                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01982}01982                         cpu\_spinwait();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01983}01983                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01984}01984                 \textcolor{comment}{/* We have got reader lock for the node. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01985}01985                 *rw = \mbox{\hyperlink{ng__base_8c_a0136f4beabe27edcd169dccb65e9ec10}{NGQRW\_R}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01986}01986         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (atomic\_cmpset\_acq\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_a495a0a463d2403303bd8c1966ac1439d}{OP\_PENDING}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01987}01987             \mbox{\hyperlink{ng__base_8c_a495a0a463d2403303bd8c1966ac1439d}{OP\_PENDING}} + \mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{WRITER\_ACTIVE}})) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01988}01988                 \textcolor{comment}{/* We have got writer lock for the node. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01989}01989                 *rw = \mbox{\hyperlink{ng__base_8c_a3bdaac4235ca6763d7e50b47981c4f74}{NGQRW\_W}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01990}01990         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01991}01991                 \textcolor{comment}{/* There is somebody other, writer can't proceed. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01992}01992                 CTR4(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) queued writer can't "{}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01993}01993                     \textcolor{stringliteral}{"{}proceed; queue flags 0x\%lx"{}}, \_\_func\_\_, node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01994}01994                     ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01995}01995                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01996}01996         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01997}01997 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01998}01998         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l01999}01999 \textcolor{comment}{         * Now we dequeue the request (whatever it may be) and correct the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02000}02000 \textcolor{comment}{         * pending flags and the next and last pointers.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02001}02001 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02002}02002         item = STAILQ\_FIRST(\&ngq-\/>queue);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02003}02003         STAILQ\_REMOVE\_HEAD(\&ngq-\/>queue, el\_next);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02004}02004         \textcolor{keywordflow}{if} (STAILQ\_EMPTY(\&ngq-\/>queue))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02005}02005                 atomic\_clear\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_a495a0a463d2403303bd8c1966ac1439d}{OP\_PENDING}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02006}02006         CTR6(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) returning item \%p as \%s; queue "{}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02007}02007             \textcolor{stringliteral}{"{}flags 0x\%lx"{}}, \_\_func\_\_, node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node, item, *rw ? \textcolor{stringliteral}{"{}WRITER"{}} :}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02008}02008             \textcolor{stringliteral}{"{}READER"{}}, ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02009}02009         \textcolor{keywordflow}{return} (item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02010}02010 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02011}02011 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02012}02012 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02013}02013 \textcolor{comment}{ * Queue a packet to be picked up later by someone else.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02014}02014 \textcolor{comment}{ * If the queue could be run now, add node to the queue handler's worklist.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02015}02015 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02016}02016 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02017}\mbox{\hyperlink{ng__base_8c_a1466ee9aeecfe805b7d10ef057feb3a5}{02017}} \mbox{\hyperlink{ng__base_8c_a1466ee9aeecfe805b7d10ef057feb3a5}{ng\_queue\_rw}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}}  item, \textcolor{keywordtype}{int} rw)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02018}02018 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02019}02019         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__queue}{ng\_queue}} *ngq = \&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02020}02020         \textcolor{keywordflow}{if} (rw == \mbox{\hyperlink{ng__base_8c_a3bdaac4235ca6763d7e50b47981c4f74}{NGQRW\_W}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02021}02021                 \mbox{\hyperlink{netgraph_8h_a1be7f7b9b5fd024ab6974994b91f7919}{NGI\_SET\_WRITER}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02022}02022         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02023}02023                 \mbox{\hyperlink{netgraph_8h_a6e1e3f75f6a6a51c8d7a14c2495f2848}{NGI\_SET\_READER}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02024}02024         item-\/>\mbox{\hyperlink{structng__item_a3bdc44b5cd6db7c73890ddc6edb085c3}{depth}} = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02025}02025 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02026}02026         \mbox{\hyperlink{ng__base_8c_ad44d725964133ec727d4071d4faf23a1}{NG\_QUEUE\_LOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02027}02027         \textcolor{comment}{/* Set OP\_PENDING flag and enqueue the item. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02028}02028         atomic\_set\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_a495a0a463d2403303bd8c1966ac1439d}{OP\_PENDING}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02029}02029         STAILQ\_INSERT\_TAIL(\&ngq-\/>queue, item, el\_next);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02030}02030 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02031}02031         CTR5(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) queued item \%p as \%s"{}}, \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02032}02032             node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node, item, rw ? \textcolor{stringliteral}{"{}WRITER"{}} : \textcolor{stringliteral}{"{}READER"{}} );}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02033}02033 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02034}02034         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02035}02035 \textcolor{comment}{         * We can take the worklist lock with the node locked}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02036}02036 \textcolor{comment}{         * BUT NOT THE REVERSE!}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02037}02037 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02038}02038         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_a885feaf999909ea41b7c36a9f4111a2b}{NEXT\_QUEUED\_ITEM\_CAN\_PROCEED}}(ngq))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02039}02039                 \mbox{\hyperlink{ng__base_8c_a9d715d2e185b01588e7a07fb218c1d22}{ng\_worklist\_add}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02040}02040         \mbox{\hyperlink{ng__base_8c_a31e37f4f425bc8027b90ed416cbdb02f}{NG\_QUEUE\_UNLOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02041}02041 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02042}02042 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02043}02043 \textcolor{comment}{/* Acquire reader lock on node. If node is busy, queue the packet. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02044}02044 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02045}\mbox{\hyperlink{ng__base_8c_a2fda4cdaa64d66c0b3371de1856df377}{02045}} \mbox{\hyperlink{ng__base_8c_a2fda4cdaa64d66c0b3371de1856df377}{ng\_acquire\_read}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02046}02046 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02047}02047         KASSERT(node != \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02048}02048             (\textcolor{stringliteral}{"{}\%s: working on deadnode"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02049}02049 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02050}02050         \textcolor{comment}{/* Reader needs node without writer and pending items. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02051}02051         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02052}02052                 \textcolor{keywordtype}{long} t = node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02053}02053                 \textcolor{keywordflow}{if} (t \& \mbox{\hyperlink{ng__base_8c_acbd24c49abe22086862b716e5d411c17}{NGQ\_RMASK}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02054}02054                         \textcolor{keywordflow}{break}; \textcolor{comment}{/* Node is not ready for reader. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02055}02055                 \textcolor{keywordflow}{if} (atomic\_cmpset\_acq\_int(\&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, t,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02056}02056                     t + \mbox{\hyperlink{ng__base_8c_aacd5572c6bd93411765fc210a523b510}{READER\_INCREMENT}})) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02057}02057                         \textcolor{comment}{/* Successfully grabbed node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02058}02058                         CTR4(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) acquired item \%p"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02059}02059                             \_\_func\_\_, node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node, item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02060}02060                         \textcolor{keywordflow}{return} (item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02061}02061                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02062}02062                 cpu\_spinwait();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02063}02063         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02064}02064 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02065}02065         \textcolor{comment}{/* Queue the request for later. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02066}02066         \mbox{\hyperlink{ng__base_8c_a1466ee9aeecfe805b7d10ef057feb3a5}{ng\_queue\_rw}}(node, item, \mbox{\hyperlink{ng__base_8c_a0136f4beabe27edcd169dccb65e9ec10}{NGQRW\_R}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02067}02067 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02068}02068         \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02069}02069 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02070}02070 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02071}02071 \textcolor{comment}{/* Acquire writer lock on node. If node is busy, queue the packet. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02072}02072 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02073}\mbox{\hyperlink{ng__base_8c_a4efc88578d7fe8394b07594b37d97cff}{02073}} \mbox{\hyperlink{ng__base_8c_a4efc88578d7fe8394b07594b37d97cff}{ng\_acquire\_write}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02074}02074 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02075}02075         KASSERT(node != \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02076}02076             (\textcolor{stringliteral}{"{}\%s: working on deadnode"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02077}02077 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02078}02078         \textcolor{comment}{/* Writer needs completely idle node. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02079}02079         \textcolor{keywordflow}{if} (atomic\_cmpset\_acq\_int(\&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, 0,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02080}02080             \mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{WRITER\_ACTIVE}})) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02081}02081                 \textcolor{comment}{/* Successfully grabbed node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02082}02082                 CTR4(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) acquired item \%p"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02083}02083                     \_\_func\_\_, node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node, item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02084}02084                 \textcolor{keywordflow}{return} (item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02085}02085         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02086}02086 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02087}02087         \textcolor{comment}{/* Queue the request for later. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02088}02088         \mbox{\hyperlink{ng__base_8c_a1466ee9aeecfe805b7d10ef057feb3a5}{ng\_queue\_rw}}(node, item, \mbox{\hyperlink{ng__base_8c_a3bdaac4235ca6763d7e50b47981c4f74}{NGQRW\_W}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02089}02089 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02090}02090         \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02091}02091 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02092}02092 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02093}02093 \textcolor{preprocessor}{\#if 0}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02094}02094 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02095}02095 ng\_upgrade\_write(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02096}02096 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02097}02097         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__queue}{ng\_queue}} *ngq = \&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02098}02098         KASSERT(node != \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02099}02099             (\textcolor{stringliteral}{"{}\%s: working on deadnode"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02100}02100 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02101}02101         \mbox{\hyperlink{netgraph_8h_a1be7f7b9b5fd024ab6974994b91f7919}{NGI\_SET\_WRITER}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02102}02102 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02103}02103         \mbox{\hyperlink{ng__base_8c_ad44d725964133ec727d4071d4faf23a1}{NG\_QUEUE\_LOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02104}02104 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02105}02105         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02106}02106 \textcolor{comment}{         * There will never be no readers as we are there ourselves.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02107}02107 \textcolor{comment}{         * Set the WRITER\_ACTIVE flags ASAP to block out fast track readers.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02108}02108 \textcolor{comment}{         * The caller we are running from will call ng\_leave\_read()}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02109}02109 \textcolor{comment}{         * soon, so we must account for that. We must leave again with the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02110}02110 \textcolor{comment}{         * READER lock. If we find other readers, then}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02111}02111 \textcolor{comment}{         * queue the request for later. However "{}later"{} may be rignt now}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02112}02112 \textcolor{comment}{         * if there are no readers. We don't really care if there are queued}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02113}02113 \textcolor{comment}{         * items as we will bypass them anyhow.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02114}02114 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02115}02115         atomic\_add\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{WRITER\_ACTIVE}} -\/ \mbox{\hyperlink{ng__base_8c_aacd5572c6bd93411765fc210a523b510}{READER\_INCREMENT}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02116}02116         \textcolor{keywordflow}{if} ((ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}} \& (\mbox{\hyperlink{ng__base_8c_a8499b55087845bc94a0555c21d17dbed}{NGQ\_WMASK}} \& \string~\mbox{\hyperlink{ng__base_8c_a495a0a463d2403303bd8c1966ac1439d}{OP\_PENDING}})) == \mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{WRITER\_ACTIVE}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02117}02117                 \mbox{\hyperlink{ng__base_8c_a31e37f4f425bc8027b90ed416cbdb02f}{NG\_QUEUE\_UNLOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02118}02118                 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02119}02119                 \textcolor{comment}{/* It's just us, act on the item. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02120}02120                 \textcolor{comment}{/* will NOT drop writer lock when done */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02121}02121                 \mbox{\hyperlink{ng__base_8c_ab25445fc9c3b61a1a811723785c6a01d}{ng\_apply\_item}}(node, item, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02122}02122 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02123}02123                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02124}02124 \textcolor{comment}{                 * Having acted on the item, atomically}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02125}02125 \textcolor{comment}{                 * downgrade back to READER and finish up.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02126}02126 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02127}02127                 atomic\_add\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_aacd5572c6bd93411765fc210a523b510}{READER\_INCREMENT}} -\/ \mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{WRITER\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02128}02128 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02129}02129                 \textcolor{comment}{/* Our caller will call ng\_leave\_read() */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02130}02130                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02131}02131         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02132}02132         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02133}02133 \textcolor{comment}{         * It's not just us active, so queue us AT THE HEAD.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02134}02134 \textcolor{comment}{         * "{}Why?"{} I hear you ask.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02135}02135 \textcolor{comment}{         * Put us at the head of the queue as we've already been}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02136}02136 \textcolor{comment}{         * through it once. If there is nothing else waiting,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02137}02137 \textcolor{comment}{         * set the correct flags.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02138}02138 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02139}02139         \textcolor{keywordflow}{if} (STAILQ\_EMPTY(\&ngq-\/>queue)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02140}02140                 \textcolor{comment}{/* We've gone from, 0 to 1 item in the queue */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02141}02141                 atomic\_set\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_a495a0a463d2403303bd8c1966ac1439d}{OP\_PENDING}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02142}02142 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02143}02143                 CTR3(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) set OP\_PENDING"{}}, \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02144}02144                     node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02145}02145         \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02146}02146         STAILQ\_INSERT\_HEAD(\&ngq-\/>queue, item, el\_next);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02147}02147         CTR4(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) requeued item \%p as WRITER"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02148}02148             \_\_func\_\_, node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node, item );}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02149}02149 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02150}02150         \textcolor{comment}{/* Reverse what we did above. That downgrades us back to reader */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02151}02151         atomic\_add\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_aacd5572c6bd93411765fc210a523b510}{READER\_INCREMENT}} -\/ \mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{WRITER\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02152}02152         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_ae30fb9d28bb8d286889040f11ced4ad5}{QUEUE\_ACTIVE}}(ngq) \&\& \mbox{\hyperlink{ng__base_8c_a885feaf999909ea41b7c36a9f4111a2b}{NEXT\_QUEUED\_ITEM\_CAN\_PROCEED}}(ngq))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02153}02153                 \mbox{\hyperlink{ng__base_8c_a9d715d2e185b01588e7a07fb218c1d22}{ng\_worklist\_add}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02154}02154         \mbox{\hyperlink{ng__base_8c_a31e37f4f425bc8027b90ed416cbdb02f}{NG\_QUEUE\_UNLOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02155}02155 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02156}02156         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02157}02157 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02158}02158 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02159}02159 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02160}02160 \textcolor{comment}{/* Release reader lock. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02161}02161 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02162}\mbox{\hyperlink{ng__base_8c_a1d782c3c61ee01c8dd34bc6acb92c3ee}{02162}} \mbox{\hyperlink{ng__base_8c_a1d782c3c61ee01c8dd34bc6acb92c3ee}{ng\_leave\_read}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02163}02163 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02164}02164         atomic\_subtract\_rel\_int(\&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_aacd5572c6bd93411765fc210a523b510}{READER\_INCREMENT}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02165}02165 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02166}02166 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02167}02167 \textcolor{comment}{/* Release writer lock. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02168}02168 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02169}\mbox{\hyperlink{ng__base_8c_aa24302b13a2a3ea612fcf70a882db5b5}{02169}} \mbox{\hyperlink{ng__base_8c_aa24302b13a2a3ea612fcf70a882db5b5}{ng\_leave\_write}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02170}02170 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02171}02171         atomic\_clear\_rel\_int(\&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_aff19aa31c4f64aab524e2b1f6684196c}{WRITER\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02172}02172 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02173}02173 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02174}02174 \textcolor{comment}{/* Purge node queue. Called on node shutdown. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02175}02175 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02176}\mbox{\hyperlink{ng__base_8c_abd80e0814383b1cb4d4e88855160eac4}{02176}} \mbox{\hyperlink{ng__base_8c_abd80e0814383b1cb4d4e88855160eac4}{ng\_flush\_input\_queue}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02177}02177 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02178}02178         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__queue}{ng\_queue}} *ngq = \&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02179}02179         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02180}02180 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02181}02181         \mbox{\hyperlink{ng__base_8c_ad44d725964133ec727d4071d4faf23a1}{NG\_QUEUE\_LOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02182}02182         \textcolor{keywordflow}{while} ((item = STAILQ\_FIRST(\&ngq-\/>queue)) != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02183}02183                 STAILQ\_REMOVE\_HEAD(\&ngq-\/>queue, el\_next);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02184}02184                 \textcolor{keywordflow}{if} (STAILQ\_EMPTY(\&ngq-\/>queue))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02185}02185                         atomic\_clear\_int(\&ngq-\/>\mbox{\hyperlink{structng__queue_af854f7290bc2d784c5a2192cb07716fb}{q\_flags}}, \mbox{\hyperlink{ng__base_8c_a495a0a463d2403303bd8c1966ac1439d}{OP\_PENDING}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02186}02186                 \mbox{\hyperlink{ng__base_8c_a31e37f4f425bc8027b90ed416cbdb02f}{NG\_QUEUE\_UNLOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02187}02187 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02188}02188                 \textcolor{comment}{/* If the item is supplying a callback, call it with an error */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02189}02189                 \textcolor{keywordflow}{if} (item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02190}02190                         \textcolor{keywordflow}{if} (item-\/>\mbox{\hyperlink{structng__item_a3bdc44b5cd6db7c73890ddc6edb085c3}{depth}} == 1)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02191}02191                                 item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = ENOENT;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02192}02192                         \textcolor{keywordflow}{if} (refcount\_release(\&item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_ab1ea8ac95942def588d77f15e84b4f8d}{refs}})) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02193}02193                                 (*item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}})(item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_a3976fb515f0c516d1cdca84c1b65f4fb}{context}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02194}02194                                     item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02195}02195                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02196}02196                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02197}02197                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02198}02198                 \mbox{\hyperlink{ng__base_8c_ad44d725964133ec727d4071d4faf23a1}{NG\_QUEUE\_LOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02199}02199         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02200}02200         \mbox{\hyperlink{ng__base_8c_a31e37f4f425bc8027b90ed416cbdb02f}{NG\_QUEUE\_UNLOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02201}02201 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02202}02202 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02203}02203 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02204}02204 \textcolor{comment}{* Externally visible method for sending or queueing messages or data.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02205}02205 \textcolor{comment}{***********************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02206}02206 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02207}02207 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02208}02208 \textcolor{comment}{ * The module code should have filled out the item correctly by this stage:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02209}02209 \textcolor{comment}{ * Common:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02210}02210 \textcolor{comment}{ *    reference to destination node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02211}02211 \textcolor{comment}{ *    Reference to destination rcv hook if relevant.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02212}02212 \textcolor{comment}{ *    apply pointer must be or NULL or reference valid struct ng\_apply\_info.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02213}02213 \textcolor{comment}{ * Data:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02214}02214 \textcolor{comment}{ *    pointer to mbuf}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02215}02215 \textcolor{comment}{ * Control\_Message:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02216}02216 \textcolor{comment}{ *    pointer to msg.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02217}02217 \textcolor{comment}{ *    ID of original sender node. (return address)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02218}02218 \textcolor{comment}{ * Function:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02219}02219 \textcolor{comment}{ *    Function pointer}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02220}02220 \textcolor{comment}{ *    void * argument}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02221}02221 \textcolor{comment}{ *    integer argument}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02222}02222 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02223}02223 \textcolor{comment}{ * The nodes have several routines and macros to help with this task:}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02224}02224 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02225}02225 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02226}02226 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02227}\mbox{\hyperlink{netgraph_8h_ab67aecb22d64ae1d2f0a29621e266029}{02227}} \mbox{\hyperlink{ng__base_8c_a898d23f9c7a120c6d28ffb0d75b37db0}{ng\_snd\_item}}(\mbox{\hyperlink{structng__item}{item\_p}} item, \textcolor{keywordtype}{int} \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02228}02228 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02229}02229         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02230}02230         \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02231}02231         \textcolor{keywordtype}{int} queue, rw;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02232}02232         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__queue}{ng\_queue}} *ngq;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02233}02233         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02234}02234 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02235}02235         \textcolor{comment}{/* We are sending item, so it must be present! */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02236}02236         KASSERT(item != NULL, (\textcolor{stringliteral}{"{}ng\_snd\_item: item is NULL"{}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02237}02237 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02238}02238 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02239}02239         \_ngi\_check(item, \_\_FILE\_\_, \_\_LINE\_\_);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02240}02240 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02241}02241 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02242}02242         \textcolor{comment}{/* Item was sent once more, postpone apply() call. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02243}02243         \textcolor{keywordflow}{if} (item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02244}02244                 refcount\_acquire(\&item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_ab1ea8ac95942def588d77f15e84b4f8d}{refs}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02245}02245 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02246}02246         node = \mbox{\hyperlink{netgraph_8h_a97b667178feea9a4527e2c7d9e7a0372}{NGI\_NODE}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02247}02247         \textcolor{comment}{/* Node is never optional. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02248}02248         KASSERT(node != NULL, (\textcolor{stringliteral}{"{}ng\_snd\_item: node is NULL"{}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02249}02249 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02250}02250         hook = \mbox{\hyperlink{netgraph_8h_aef96fca28a348d16229cef3f7414d0ee}{NGI\_HOOK}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02251}02251         \textcolor{comment}{/* Valid hook and mbuf are mandatory for data. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02252}02252         \textcolor{keywordflow}{if} ((item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) == \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02253}02253                 KASSERT(hook != NULL, (\textcolor{stringliteral}{"{}ng\_snd\_item: hook for data is NULL"{}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02254}02254                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a08cf471587aa844de10e9c3c1d7a8c28}{NGI\_M}}(item) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02255}02255                         \mbox{\hyperlink{ng__base_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02256}02256                 \mbox{\hyperlink{ng__base_8c_ae3c44cef9081767d218acce82a03a3d7}{CHECK\_DATA\_MBUF}}(\mbox{\hyperlink{netgraph_8h_a08cf471587aa844de10e9c3c1d7a8c28}{NGI\_M}}(item));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02257}02257         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02258}02258 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02259}02259         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02260}02260 \textcolor{comment}{         * If the item or the node specifies single threading, force}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02261}02261 \textcolor{comment}{         * writer semantics. Similarly, the node may say one hook always}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02262}02262 \textcolor{comment}{         * produces writers. These are overrides.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02263}02263 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02264}02264         \textcolor{keywordflow}{if} (((item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a31b3a4a7be8a1d4041ed4f360ffe314f}{NGQF\_RW}}) == \mbox{\hyperlink{netgraph_8h_a67a819fdd211467138c305a66cf53f8e}{NGQF\_WRITER}}) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02265}02265             (node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} \& \mbox{\hyperlink{netgraph_8h_a18dd256579ac4118f9694036510f82b2}{NGF\_FORCE\_WRITER}}) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02266}02266             (hook \&\& (hook-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} \& \mbox{\hyperlink{netgraph_8h_a9f511e2693578006c9ff8cb2404c15c4}{HK\_FORCE\_WRITER}}))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02267}02267                 rw = \mbox{\hyperlink{ng__base_8c_a3bdaac4235ca6763d7e50b47981c4f74}{NGQRW\_W}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02268}02268         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02269}02269                 rw = \mbox{\hyperlink{ng__base_8c_a0136f4beabe27edcd169dccb65e9ec10}{NGQRW\_R}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02270}02270         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02271}02271 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02272}02272         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02273}02273 \textcolor{comment}{         * If sender or receiver requests queued delivery, or call graph}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02274}02274 \textcolor{comment}{         * loops back from outbound to inbound path, or stack usage}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02275}02275 \textcolor{comment}{         * level is dangerous -\/ enqueue message.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02276}02276 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02277}02277         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}} \& \mbox{\hyperlink{netgraph_8h_a5c38f651b432e35ab198595d020c8917}{NG\_QUEUE}}) || (hook \&\& (hook-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4dd7057bd88b9188cbbab651a21aed04}{HK\_QUEUE}}))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02278}02278                 queue = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02279}02279         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (hook \&\& (hook-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} \& \mbox{\hyperlink{netgraph_8h_a0ac1121ebd51e9fa180ba21c9ac92b8a}{HK\_TO\_INBOUND}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02280}02280             curthread-\/>td\_ng\_outbound) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02281}02281                 queue = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02282}02282         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02283}02283                 queue = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02284}02284 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02285}02285                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02286}02286 \textcolor{comment}{                 * Most of netgraph nodes have small stack consumption and}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02287}02287 \textcolor{comment}{                 * for them 25\% of free stack space is more than enough.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02288}02288 \textcolor{comment}{                 * Nodes/hooks with higher stack usage should be marked as}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02289}02289 \textcolor{comment}{                 * HI\_STACK. For them 50\% of stack will be guaranteed then.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02290}02290 \textcolor{comment}{                 * XXX: Values 25\% and 50\% are completely empirical.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02291}02291 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02292}02292                 \textcolor{keywordtype}{size\_t}  st, su, sl;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02293}02293                 GET\_STACK\_USAGE(st, su);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02294}02294                 sl = st -\/ su;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02295}02295                 \textcolor{keywordflow}{if} ((sl * 4 < st) || ((sl * 2 < st) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02296}02296                     ((node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} \& \mbox{\hyperlink{netgraph_8h_ac7ed4338b4620858ced5333903daae3a}{NGF\_HI\_STACK}}) || (hook \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02297}02297                     (hook-\/>\mbox{\hyperlink{structng__hook_aa2067987f21b226bdae7f8da5f788e6a}{hk\_flags}} \& \mbox{\hyperlink{netgraph_8h_a0e850ad6cb6209a8b4bb2be34d8b3bc6}{HK\_HI\_STACK}})))))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02298}02298                         queue = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02299}02299         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02300}02300 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02301}02301         \textcolor{keywordflow}{if} (queue) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02302}02302                 \textcolor{comment}{/* Put it on the queue for that node*/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02303}02303                 \mbox{\hyperlink{ng__base_8c_a1466ee9aeecfe805b7d10ef057feb3a5}{ng\_queue\_rw}}(node, item, rw);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02304}02304                 \textcolor{keywordflow}{return} ((\mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}} \& \mbox{\hyperlink{netgraph_8h_ac39b0d4fbd5ff6db52a4cba4e053053f}{NG\_PROGRESS}}) ? EINPROGRESS : 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02305}02305         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02306}02306 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02307}02307         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02308}02308 \textcolor{comment}{         * We already decided how we will be queueud or treated.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02309}02309 \textcolor{comment}{         * Try get the appropriate operating permission.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02310}02310 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02311}02311         \textcolor{keywordflow}{if} (rw == \mbox{\hyperlink{ng__base_8c_a0136f4beabe27edcd169dccb65e9ec10}{NGQRW\_R}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02312}02312                 item = \mbox{\hyperlink{ng__base_8c_a2fda4cdaa64d66c0b3371de1856df377}{ng\_acquire\_read}}(node, item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02313}02313         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02314}02314                 item = \mbox{\hyperlink{ng__base_8c_a4efc88578d7fe8394b07594b37d97cff}{ng\_acquire\_write}}(node, item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02315}02315 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02316}02316         \textcolor{comment}{/* Item was queued while trying to get permission. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02317}02317         \textcolor{keywordflow}{if} (item == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02318}02318                 \textcolor{keywordflow}{return} ((\mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}} \& \mbox{\hyperlink{netgraph_8h_ac39b0d4fbd5ff6db52a4cba4e053053f}{NG\_PROGRESS}}) ? EINPROGRESS : 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02319}02319 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02320}02320         \mbox{\hyperlink{netgraph_8h_a168fc2ed5239f5d498db599d0ef36db4}{NGI\_GET\_NODE}}(item, node); \textcolor{comment}{/* zaps stored node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02321}02321 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02322}02322         item-\/>\mbox{\hyperlink{structng__item_a3bdc44b5cd6db7c73890ddc6edb085c3}{depth}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02323}02323         error = \mbox{\hyperlink{ng__base_8c_ab25445fc9c3b61a1a811723785c6a01d}{ng\_apply\_item}}(node, item, rw); \textcolor{comment}{/* drops r/w lock when done */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02324}02324 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02325}02325         \textcolor{comment}{/* If something is waiting on queue and ready, schedule it. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02326}02326         ngq = \&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02327}02327         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_ae30fb9d28bb8d286889040f11ced4ad5}{QUEUE\_ACTIVE}}(ngq)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02328}02328                 \mbox{\hyperlink{ng__base_8c_ad44d725964133ec727d4071d4faf23a1}{NG\_QUEUE\_LOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02329}02329                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_ae30fb9d28bb8d286889040f11ced4ad5}{QUEUE\_ACTIVE}}(ngq) \&\& \mbox{\hyperlink{ng__base_8c_a885feaf999909ea41b7c36a9f4111a2b}{NEXT\_QUEUED\_ITEM\_CAN\_PROCEED}}(ngq))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02330}02330                         \mbox{\hyperlink{ng__base_8c_a9d715d2e185b01588e7a07fb218c1d22}{ng\_worklist\_add}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02331}02331                 \mbox{\hyperlink{ng__base_8c_a31e37f4f425bc8027b90ed416cbdb02f}{NG\_QUEUE\_UNLOCK}}(ngq);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02332}02332         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02333}02333 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02334}02334         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02335}02335 \textcolor{comment}{         * Node may go away as soon as we remove the reference.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02336}02336 \textcolor{comment}{         * Whatever we do, DO NOT access the node again!}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02337}02337 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02338}02338         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02339}02339 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02340}02340         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02341}02341 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02342}02342 done:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02343}02343         \textcolor{comment}{/* If was not sent, apply callback here. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02344}02344         \textcolor{keywordflow}{if} (item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02345}02345                 \textcolor{keywordflow}{if} (item-\/>\mbox{\hyperlink{structng__item_a3bdc44b5cd6db7c73890ddc6edb085c3}{depth}} == 0 \&\& error != 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02346}02346                         item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = error;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02347}02347                 \textcolor{keywordflow}{if} (refcount\_release(\&item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_ab1ea8ac95942def588d77f15e84b4f8d}{refs}})) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02348}02348                         (*item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}})(item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_a3976fb515f0c516d1cdca84c1b65f4fb}{context}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02349}02349                             item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}}-\/>\mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02350}02350                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02351}02351         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02352}02352 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02353}02353         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02354}02354         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02355}02355 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02356}02356 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02357}02357 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02358}02358 \textcolor{comment}{ * We have an item that was possibly queued somewhere.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02359}02359 \textcolor{comment}{ * It should contain all the information needed}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02360}02360 \textcolor{comment}{ * to run it on the appropriate node/hook.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02361}02361 \textcolor{comment}{ * If there is apply pointer and we own the last reference, call apply().}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02362}02362 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02363}02363 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02364}\mbox{\hyperlink{ng__base_8c_ab25445fc9c3b61a1a811723785c6a01d}{02364}} \mbox{\hyperlink{ng__base_8c_ab25445fc9c3b61a1a811723785c6a01d}{ng\_apply\_item}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \textcolor{keywordtype}{int} rw)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02365}02365 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02366}02366         \mbox{\hyperlink{structng__hook}{hook\_p}}  hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02367}02367         \mbox{\hyperlink{netgraph_8h_aa87ef7415b345b801747ceaf99de6c43}{ng\_rcvdata\_t}} *rcvdata;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02368}02368         \mbox{\hyperlink{netgraph_8h_a47b860e2900386e775707cc1ae661162}{ng\_rcvmsg\_t}} *rcvmsg;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02369}02369         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__apply__info}{ng\_apply\_info}} *\mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02370}02370         \textcolor{keywordtype}{int}     \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = 0, depth;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02371}02371 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02372}02372         \textcolor{comment}{/* Node and item are never optional. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02373}02373         KASSERT(node != NULL, (\textcolor{stringliteral}{"{}ng\_apply\_item: node is NULL"{}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02374}02374         KASSERT(item != NULL, (\textcolor{stringliteral}{"{}ng\_apply\_item: item is NULL"{}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02375}02375 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02376}02376         \mbox{\hyperlink{netgraph_8h_a1d7f4586c2c27938d66748ba39a1c792}{NGI\_GET\_HOOK}}(item, hook); \textcolor{comment}{/* clears stored hook */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02377}02377 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02378}02378         \_ngi\_check(item, \_\_FILE\_\_, \_\_LINE\_\_);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02379}02379 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02380}02380 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02381}02381         \mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}} = item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02382}02382         depth = item-\/>\mbox{\hyperlink{structng__item_a3bdc44b5cd6db7c73890ddc6edb085c3}{depth}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02383}02383 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02384}02384         \textcolor{keywordflow}{switch} (item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02385}02385         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02386}02386                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02387}02387 \textcolor{comment}{                 * Check things are still ok as when we were queued.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02388}02388 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02389}02389                 KASSERT(hook != NULL, (\textcolor{stringliteral}{"{}ng\_apply\_item: hook for data is NULL"{}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02390}02390                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02391}02391                     \mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02392}02392                         \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = EIO;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02393}02393                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02394}02394                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02395}02395                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02396}02396                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02397}02397 \textcolor{comment}{                 * If no receive method, just silently drop it.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02398}02398 \textcolor{comment}{                 * Give preference to the hook over-\/ride method.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02399}02399 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02400}02400                 \textcolor{keywordflow}{if} ((!(rcvdata = hook-\/>\mbox{\hyperlink{structng__hook_a232e080199df3db2eacdbb39cf636c36}{hk\_rcvdata}})) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02401}02401                     (!(rcvdata = \mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook)-\/>nd\_type-\/>rcvdata))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02402}02402                         \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02403}02403                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02404}02404                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02405}02405                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02406}02406                 \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = (*rcvdata)(hook, item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02407}02407                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02408}02408         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a9e3984d767a278bf9893ae7145a143a8}{NGQF\_MESG}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02409}02409                 \textcolor{keywordflow}{if} (hook \&\& \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02410}02410                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02411}02411 \textcolor{comment}{                         * The hook has been zapped then we can't use it.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02412}02412 \textcolor{comment}{                         * Immediately drop its reference.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02413}02413 \textcolor{comment}{                         * The message may not need it.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02414}02414 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02415}02415                         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02416}02416                         hook = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02417}02417                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02418}02418                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02419}02419 \textcolor{comment}{                 * Similarly, if the node is a zombie there is}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02420}02420 \textcolor{comment}{                 * nothing we can do with it, drop everything.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02421}02421 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02422}02422                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02423}02423                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02424}02424                         \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02425}02425                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02426}02426                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02427}02427                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02428}02428                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02429}02429 \textcolor{comment}{                 * Call the appropriate message handler for the object.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02430}02430 \textcolor{comment}{                 * It is up to the message handler to free the message.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02431}02431 \textcolor{comment}{                 * If it's a generic message, handle it generically,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02432}02432 \textcolor{comment}{                 * otherwise call the type's message handler (if it exists).}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02433}02433 \textcolor{comment}{                 * XXX (race). Remember that a queued message may}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02434}02434 \textcolor{comment}{                 * reference a node or hook that has just been}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02435}02435 \textcolor{comment}{                 * invalidated. It will exist as the queue code}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02436}02436 \textcolor{comment}{                 * is holding a reference, but..}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02437}02437 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02438}02438                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.typecookie == \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02439}02439                     ((\mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item)-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.flags \& \mbox{\hyperlink{ng__message_8h_a5fe4082cbb0ac2567dde73b46d0eabd3}{NGF\_RESP}}) == 0)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02440}02440                         \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = \mbox{\hyperlink{ng__base_8c_ad936e93d4e0d25b58468217a014d1320}{ng\_generic\_msg}}(node, item, hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02441}02441                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02442}02442                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02443}02443                 \textcolor{keywordflow}{if} (((!hook) || (!(rcvmsg = hook-\/>hk\_rcvmsg))) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02444}02444                     (!(rcvmsg = node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a66db0c248a3c20594061723005122526}{rcvmsg}}))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02445}02445                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02446}02446                         \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02447}02447                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02448}02448                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02449}02449                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02450}02450                 \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = (*rcvmsg)(node, item, hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02451}02451                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02452}02452         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_ad51ccd1f1dc08a7ba45702b1f40153b4}{NGQF\_FN}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02453}02453         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a7f371ec83585e8fefb12ac2402cafc2e}{NGQF\_FN2}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02454}02454                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02455}02455 \textcolor{comment}{                 * In the case of the shutdown message we allow it to hit}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02456}02456 \textcolor{comment}{                 * even if the node is invalid.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02457}02457 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02458}02458                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02459}02459                     \mbox{\hyperlink{netgraph_8h_a1e699611762d50d1a1128aa2ba34046b}{NGI\_FN}}(item) != \&\mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02460}02460                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02461}02461                         \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02462}02462                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02463}02463                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02464}02464                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02465}02465                 \textcolor{comment}{/* Same is about some internal functions and invalid hook. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02466}02466                 \textcolor{keywordflow}{if} (hook \&\& \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02467}02467                     \mbox{\hyperlink{netgraph_8h_a90ce7966244748e4028b0446b0f0332b}{NGI\_FN2}}(item) != \&\mbox{\hyperlink{ng__base_8c_a0756b63155b159535f352915ac5cc77b}{ng\_con\_part2}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02468}02468                     \mbox{\hyperlink{netgraph_8h_a90ce7966244748e4028b0446b0f0332b}{NGI\_FN2}}(item) != \&\mbox{\hyperlink{ng__base_8c_a76dfd3c077be6fd0a11484327e3a8455}{ng\_con\_part3}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02469}02469                     \mbox{\hyperlink{netgraph_8h_a1e699611762d50d1a1128aa2ba34046b}{NGI\_FN}}(item) != \&\mbox{\hyperlink{ng__base_8c_a9dcdba5417f7def6500b0dc3bf5f4215}{ng\_rmhook\_part2}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02470}02470                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02471}02471                         \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02472}02472                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02473}02473                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02474}02474                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02475}02475                 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02476}02476                 \textcolor{keywordflow}{if} ((item-\/>el\_flags \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) == \mbox{\hyperlink{netgraph_8h_ad51ccd1f1dc08a7ba45702b1f40153b4}{NGQF\_FN}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02477}02477                         (*\mbox{\hyperlink{netgraph_8h_a1e699611762d50d1a1128aa2ba34046b}{NGI\_FN}}(item))(node, hook, \mbox{\hyperlink{netgraph_8h_a0de706e5902f9465d04d1f46935665b6}{NGI\_ARG1}}(item),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02478}02478                             \mbox{\hyperlink{netgraph_8h_a562a3d1e8b0d9278c48c07c855f9b711}{NGI\_ARG2}}(item));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02479}02479                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02480}02480                 \} \textcolor{keywordflow}{else}  \textcolor{comment}{/* it is NGQF\_FN2 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02481}02481                         \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = (*\mbox{\hyperlink{netgraph_8h_a90ce7966244748e4028b0446b0f0332b}{NGI\_FN2}}(item))(node, item, hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02482}02482                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02483}02483         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02484}02484         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02485}02485 \textcolor{comment}{         * We held references on some of the resources}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02486}02486 \textcolor{comment}{         * that we took from the item. Now that we have}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02487}02487 \textcolor{comment}{         * finished doing everything, drop those references.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02488}02488 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02489}02489         \textcolor{keywordflow}{if} (hook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02490}02490                 \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02491}02491 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02492}02492         \textcolor{keywordflow}{if} (rw == \mbox{\hyperlink{ng__base_8c_a0136f4beabe27edcd169dccb65e9ec10}{NGQRW\_R}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02493}02493                 \mbox{\hyperlink{ng__base_8c_a1d782c3c61ee01c8dd34bc6acb92c3ee}{ng\_leave\_read}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02494}02494         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02495}02495                 \mbox{\hyperlink{ng__base_8c_aa24302b13a2a3ea612fcf70a882db5b5}{ng\_leave\_write}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02496}02496 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02497}02497         \textcolor{comment}{/* Apply callback. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02498}02498         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02499}02499                 \textcolor{keywordflow}{if} (depth == 1 \&\& \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} != 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02500}02500                         \mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}}-\/>error = \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02501}02501                 \textcolor{keywordflow}{if} (refcount\_release(\&\mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}}-\/>refs))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02502}02502                         (*\mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}}-\/>apply)(\mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}}-\/>context, \mbox{\hyperlink{structng__apply__info_abee51013e21cc2032a9f834608b426f2}{apply}}-\/>error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02503}02503         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02504}02504 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02505}02505         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02506}02506 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02507}02507 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02508}02508 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02509}02509 \textcolor{comment}{ * Implement the 'generic' control messages}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02510}02510 \textcolor{comment}{ ***********************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02511}02511 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02512}\mbox{\hyperlink{ng__base_8c_ad936e93d4e0d25b58468217a014d1320}{02512}} \mbox{\hyperlink{ng__base_8c_ad936e93d4e0d25b58468217a014d1320}{ng\_generic\_msg}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} lasthook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02513}02513 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02514}02514         \textcolor{keywordtype}{int} \mbox{\hyperlink{structng__apply__info_aa7e0680e2b11256de6c9c2c93da62dd6}{error}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02515}02515         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02516}02516         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *resp = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02517}02517 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02518}02518         \mbox{\hyperlink{netgraph_8h_adc9a04fd174ef3c29ecae94016b84839}{NGI\_GET\_MSG}}(item, msg);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02519}02519         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_ab59e14593b69a406ed5ca4209d489a10}{typecookie}} != \mbox{\hyperlink{ng__message_8h_a577acb07400a990f6e293df85928c01e}{NGM\_GENERIC\_COOKIE}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02520}02520                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02521}02521                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02522}02522                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02523}02523         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02524}02524         \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02525}02525         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0acb1763fedfa5fd35d1df1714454094ad}{NGM\_SHUTDOWN}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02526}02526                 \mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}(here, NULL, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02527}02527                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02528}02528         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a5fc29cf4ce02b402f65505507799f2ed}{NGM\_MKPEER}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02529}02529             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02530}02530                 \textcolor{keyword}{struct }\mbox{\hyperlink{structngm__mkpeer}{ngm\_mkpeer}} *\textcolor{keyword}{const} mkp = (\textcolor{keyword}{struct }\mbox{\hyperlink{structngm__mkpeer}{ngm\_mkpeer}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02531}02531 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02532}02532                 if (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*mkp)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02533}02533                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02534}02534                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02535}02535                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02536}02536                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02537}02537                 mkp-\/>\mbox{\hyperlink{structngm__mkpeer_ad3c7780f0b06ee74d7058fbe3aad9085}{type}}[\textcolor{keyword}{sizeof}(mkp-\/>\mbox{\hyperlink{structngm__mkpeer_ad3c7780f0b06ee74d7058fbe3aad9085}{type}}) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02538}02538                 mkp-\/>\mbox{\hyperlink{structngm__mkpeer_a9a1de77fc7f0af8930d34ed7e650f59e}{ourhook}}[\textcolor{keyword}{sizeof}(mkp-\/>\mbox{\hyperlink{structngm__mkpeer_a9a1de77fc7f0af8930d34ed7e650f59e}{ourhook}}) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02539}02539                 mkp-\/>\mbox{\hyperlink{structngm__mkpeer_ae208c92e0eaadfb45911e4dccf84c5dd}{peerhook}}[\textcolor{keyword}{sizeof}(mkp-\/>\mbox{\hyperlink{structngm__mkpeer_ae208c92e0eaadfb45911e4dccf84c5dd}{peerhook}}) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02540}02540                 error = \mbox{\hyperlink{ng__base_8c_ae41f58c0e2071e9978775a6fb5e00b41}{ng\_mkpeer}}(here, mkp-\/>\mbox{\hyperlink{structngm__mkpeer_a9a1de77fc7f0af8930d34ed7e650f59e}{ourhook}}, mkp-\/>\mbox{\hyperlink{structngm__mkpeer_ae208c92e0eaadfb45911e4dccf84c5dd}{peerhook}}, mkp-\/>\mbox{\hyperlink{structngm__mkpeer_ad3c7780f0b06ee74d7058fbe3aad9085}{type}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02541}02541                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02542}02542             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02543}02543         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0af38cee2e5b53400e215b8fb8db695bce}{NGM\_CONNECT}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02544}02544             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02545}02545                 \textcolor{keyword}{struct }\mbox{\hyperlink{structngm__connect}{ngm\_connect}} *\textcolor{keyword}{const} con =}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02546}02546                         (\textcolor{keyword}{struct }\mbox{\hyperlink{structngm__connect}{ngm\_connect}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02547}02547                 \mbox{\hyperlink{structng__node}{node\_p}} node2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02548}02548 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02549}02549                 if (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*con)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02550}02550                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02551}02551                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02552}02552                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02553}02553                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02554}02554                 con-\/>\mbox{\hyperlink{structngm__connect_ae6149fa7ea08264a21d9c2384a6ca0c1}{path}}[\textcolor{keyword}{sizeof}(con-\/>\mbox{\hyperlink{structngm__connect_ae6149fa7ea08264a21d9c2384a6ca0c1}{path}}) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02555}02555                 con-\/>\mbox{\hyperlink{structngm__connect_a9514c5e976aacfb19ce15a5de1876ba9}{ourhook}}[\textcolor{keyword}{sizeof}(con-\/>\mbox{\hyperlink{structngm__connect_a9514c5e976aacfb19ce15a5de1876ba9}{ourhook}}) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02556}02556                 con-\/>\mbox{\hyperlink{structngm__connect_a0894a71a3064959480c23c0d51980d70}{peerhook}}[\textcolor{keyword}{sizeof}(con-\/>\mbox{\hyperlink{structngm__connect_a0894a71a3064959480c23c0d51980d70}{peerhook}}) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02557}02557                 \textcolor{comment}{/* Don't forget we get a reference.. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02558}02558                 error = \mbox{\hyperlink{ng__base_8c_a4e328a30d6a99603f9b47e5e02e76178}{ng\_path2noderef}}(here, con-\/>\mbox{\hyperlink{structngm__connect_ae6149fa7ea08264a21d9c2384a6ca0c1}{path}}, \&node2, NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02559}02559                 \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02560}02560                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02561}02561                 error = \mbox{\hyperlink{ng__base_8c_a5def34cf5530ace8fcb8d5e805e653a9}{ng\_con\_nodes}}(item, here, con-\/>\mbox{\hyperlink{structngm__connect_a9514c5e976aacfb19ce15a5de1876ba9}{ourhook}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02562}02562                     node2, con-\/>\mbox{\hyperlink{structngm__connect_a0894a71a3064959480c23c0d51980d70}{peerhook}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02563}02563                 \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node2);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02564}02564                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02565}02565             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02566}02566         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a1ee2726bb8af3fa09a65bea230141735}{NGM\_NAME}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02567}02567             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02568}02568                 \textcolor{keyword}{struct }\mbox{\hyperlink{structngm__name}{ngm\_name}} *\textcolor{keyword}{const} nam = (\textcolor{keyword}{struct }\mbox{\hyperlink{structngm__name}{ngm\_name}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02569}02569 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02570}02570                 if (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*nam)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02571}02571                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02572}02572                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02573}02573                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02574}02574                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02575}02575                 nam-\/>\mbox{\hyperlink{structngm__name_a2e1042ad75be6502b6017cba50599a7a}{name}}[\textcolor{keyword}{sizeof}(nam-\/>\mbox{\hyperlink{structngm__name_a2e1042ad75be6502b6017cba50599a7a}{name}}) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02576}02576                 error = \mbox{\hyperlink{ng__base_8c_abae5851c9f312eebd398b1cd085fe067}{ng\_name\_node}}(here, nam-\/>\mbox{\hyperlink{structngm__name_a2e1042ad75be6502b6017cba50599a7a}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02577}02577                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02578}02578             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02579}02579         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a0b1365508f5148fc26e5a82a9d503a02}{NGM\_RMHOOK}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02580}02580             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02581}02581                 \textcolor{keyword}{struct }\mbox{\hyperlink{structngm__rmhook}{ngm\_rmhook}} *\textcolor{keyword}{const} rmh = (\textcolor{keyword}{struct }\mbox{\hyperlink{structngm__rmhook}{ngm\_rmhook}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02582}02582                 \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02583}02583 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02584}02584                 if (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*rmh)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02585}02585                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02586}02586                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02587}02587                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02588}02588                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02589}02589                 rmh-\/>\mbox{\hyperlink{structngm__rmhook_a073980420023fabdbead54a64e2fbdeb}{ourhook}}[\textcolor{keyword}{sizeof}(rmh-\/>\mbox{\hyperlink{structngm__rmhook_a073980420023fabdbead54a64e2fbdeb}{ourhook}}) -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02590}02590                 \textcolor{keywordflow}{if} ((hook = \mbox{\hyperlink{ng__base_8c_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(here, rmh-\/>\mbox{\hyperlink{structngm__rmhook_a073980420023fabdbead54a64e2fbdeb}{ourhook}})) != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02591}02591                         \mbox{\hyperlink{ng__base_8c_a5eaed3e663791906c07b11c75fc502f6}{ng\_destroy\_hook}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02592}02592                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02593}02593             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02594}02594         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a06a8887d77fdfb9a8ab815f81d4ecb7e}{NGM\_NODEINFO}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02595}02595             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02596}02596                 \textcolor{keyword}{struct }\mbox{\hyperlink{structnodeinfo}{nodeinfo}} *ni;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02597}02597 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02598}02598                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(*ni), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02599}02599                 \textcolor{keywordflow}{if} (resp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02600}02600                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02601}02601                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02602}02602                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02603}02603 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02604}02604                 \textcolor{comment}{/* Fill in node info */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02605}02605                 ni = (\textcolor{keyword}{struct }\mbox{\hyperlink{structnodeinfo}{nodeinfo}} *) resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02606}02606                 if (\mbox{\hyperlink{netgraph_8h_a73fb7660bb50d227ec6997cb007a5dd0}{NG\_NODE\_HAS\_NAME}}(here))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02607}02607                         strcpy(ni-\/>\mbox{\hyperlink{structnodeinfo_a414e265d0fe9cdbf5b280b174df712c9}{name}}, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(here));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02608}02608                 strcpy(ni-\/>\mbox{\hyperlink{structnodeinfo_a0cb74e11fd9579caf45240e65948df3e}{type}}, here-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a7be0a2326d841f2d3e347eb682eef992}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02609}02609                 ni-\/>\mbox{\hyperlink{structnodeinfo_a611d9a736c6b372831b46754349915ea}{id}} = \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(here);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02610}02610                 ni-\/>\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}} = here-\/>\mbox{\hyperlink{structng__node_a55e56dfb6c3134af0533343b4d0be160}{nd\_numhooks}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02611}02611                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02612}02612             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02613}02613         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a748d86ae93f55fabc43800d2193c7019}{NGM\_LISTHOOKS}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02614}02614             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02615}02615                 \textcolor{keyword}{const} \textcolor{keywordtype}{int} nhooks = here-\/>\mbox{\hyperlink{structng__node_a55e56dfb6c3134af0533343b4d0be160}{nd\_numhooks}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02616}02616                 \textcolor{keyword}{struct }\mbox{\hyperlink{structhooklist}{hooklist}} *hl;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02617}02617                 \textcolor{keyword}{struct }\mbox{\hyperlink{structnodeinfo}{nodeinfo}} *ni;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02618}02618                 \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02619}02619 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02620}02620                 \textcolor{comment}{/* Get response struct */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02621}02621                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(*hl) +}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02622}02622                     (nhooks * \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structlinkinfo}{linkinfo}})), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02623}02623                 \textcolor{keywordflow}{if} (resp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02624}02624                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02625}02625                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02626}02626                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02627}02627                 hl = (\textcolor{keyword}{struct }\mbox{\hyperlink{structhooklist}{hooklist}} *) resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02628}02628                 ni = \&hl-\/>\mbox{\hyperlink{structhooklist_af884753859489604435be85ea729a7b6}{nodeinfo}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02629}02629 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02630}02630                 \textcolor{comment}{/* Fill in node info */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02631}02631                 if (\mbox{\hyperlink{netgraph_8h_a73fb7660bb50d227ec6997cb007a5dd0}{NG\_NODE\_HAS\_NAME}}(here))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02632}02632                         strcpy(ni-\/>\mbox{\hyperlink{structnodeinfo_a414e265d0fe9cdbf5b280b174df712c9}{name}}, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(here));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02633}02633                 strcpy(ni-\/>\mbox{\hyperlink{structnodeinfo_a0cb74e11fd9579caf45240e65948df3e}{type}}, here-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a7be0a2326d841f2d3e347eb682eef992}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02634}02634                 ni-\/>\mbox{\hyperlink{structnodeinfo_a611d9a736c6b372831b46754349915ea}{id}} = \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(here);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02635}02635 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02636}02636                 \textcolor{comment}{/* Cycle through the linked list of hooks */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02637}02637                 ni-\/>\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02638}02638                 LIST\_FOREACH(hook, \&here-\/>nd\_hooks, hk\_hooks) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02639}02639                         \textcolor{keyword}{struct }\mbox{\hyperlink{structlinkinfo}{linkinfo}} *\textcolor{keyword}{const} link = \&hl-\/>\mbox{\hyperlink{structhooklist_a087274115e2d32f565d9b2b4558b4b73}{link}}[ni-\/>\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}}];}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02640}02640 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02641}02641                         \textcolor{keywordflow}{if} (ni-\/>\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}} >= nhooks) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02642}02642                                 log(LOG\_ERR, \textcolor{stringliteral}{"{}\%s: number of \%s changed\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02643}02643                                     \_\_func\_\_, \textcolor{stringliteral}{"{}hooks"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02644}02644                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02645}02645                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02646}02646                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02647}02647                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02648}02648                         strcpy(link-\/>\mbox{\hyperlink{structlinkinfo_a062e959f7169f053fc07d60029200d85}{ourhook}}, \mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02649}02649                         strcpy(link-\/>\mbox{\hyperlink{structlinkinfo_a356201a36b9f465c23dc58018b72e0d3}{peerhook}}, \mbox{\hyperlink{netgraph_8h_a30232cc06ccf8b53265365f50e1e5114}{NG\_PEER\_HOOK\_NAME}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02650}02650                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a851b1b334b1c024bfaf406a64fefb710}{NG\_PEER\_NODE\_NAME}}(hook)[0] != \textcolor{charliteral}{'\(\backslash\)0'})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02651}02651                                 strcpy(link-\/>\mbox{\hyperlink{structlinkinfo_ac05f0fe3ef111c033ef363f59309d70c}{nodeinfo}}.\mbox{\hyperlink{structnodeinfo_a414e265d0fe9cdbf5b280b174df712c9}{name}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02652}02652                                     \mbox{\hyperlink{netgraph_8h_a851b1b334b1c024bfaf406a64fefb710}{NG\_PEER\_NODE\_NAME}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02653}02653                         strcpy(link-\/>\mbox{\hyperlink{structlinkinfo_ac05f0fe3ef111c033ef363f59309d70c}{nodeinfo}}.\mbox{\hyperlink{structnodeinfo_a0cb74e11fd9579caf45240e65948df3e}{type}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02654}02654                            \mbox{\hyperlink{netgraph_8h_a2422a9fbdceb03a36586612af27100fb}{NG\_PEER\_NODE}}(hook)-\/>nd\_type-\/>name);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02655}02655                         link-\/>\mbox{\hyperlink{structlinkinfo_ac05f0fe3ef111c033ef363f59309d70c}{nodeinfo}}.\mbox{\hyperlink{structnodeinfo_a611d9a736c6b372831b46754349915ea}{id}} = \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(\mbox{\hyperlink{netgraph_8h_a2422a9fbdceb03a36586612af27100fb}{NG\_PEER\_NODE}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02656}02656                         link-\/>\mbox{\hyperlink{structlinkinfo_ac05f0fe3ef111c033ef363f59309d70c}{nodeinfo}}.\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}} = \mbox{\hyperlink{netgraph_8h_a2422a9fbdceb03a36586612af27100fb}{NG\_PEER\_NODE}}(hook)-\/>nd\_numhooks;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02657}02657                         ni-\/>\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02658}02658                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02659}02659                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02660}02660             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02661}02661 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02662}02662         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a72393c83679d5b8739c897e06c8f26ff}{NGM\_LISTNODES}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02663}02663             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02664}02664                 \textcolor{keyword}{struct }\mbox{\hyperlink{structnamelist}{namelist}} *nl;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02665}02665                 \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02666}02666                 \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02667}02667 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02668}02668                 \mbox{\hyperlink{ng__base_8c_ac31008b26fb640721ee68fc1692094e3}{IDHASH\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02669}02669                 \textcolor{comment}{/* Get response struct. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02670}02670                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(*nl) +}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02671}02671                     (\mbox{\hyperlink{ng__base_8c_ad685d5a522de935eabb0fd450c116d2b}{V\_ng\_nodes}} * \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structnodeinfo}{nodeinfo}})), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02672}02672                 \textcolor{keywordflow}{if} (resp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02673}02673                         \mbox{\hyperlink{ng__base_8c_af5200c0955f48c3220918e108cb12e7f}{IDHASH\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02674}02674                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02675}02675                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02676}02676                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02677}02677                 nl = (\textcolor{keyword}{struct }\mbox{\hyperlink{structnamelist}{namelist}} *) resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02678}02678 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02679}02679                 \textcolor{comment}{/* Cycle through the lists of nodes. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02680}02680                 nl-\/>\mbox{\hyperlink{structnamelist_a2b2e18f17711fb2f414d23059aae55e8}{numnames}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02681}02681                 for (i = 0; i <= \mbox{\hyperlink{ng__base_8c_aa28823cd95db08aaf3e195ad052d261c}{V\_ng\_ID\_hmask}}; i++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02682}02682                         LIST\_FOREACH(node, \&\mbox{\hyperlink{ng__base_8c_ad0a4773cb27c547300c11cc1cdc74780}{V\_ng\_ID\_hash}}[i], nd\_idnodes) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02683}02683                                 \textcolor{keyword}{struct }\mbox{\hyperlink{structnodeinfo}{nodeinfo}} *\textcolor{keyword}{const} np =}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02684}02684                                     \&nl-\/>\mbox{\hyperlink{structnamelist_aee7503413f74917aa46a78e60ec379b9}{nodeinfo}}[nl-\/>\mbox{\hyperlink{structnamelist_a2b2e18f17711fb2f414d23059aae55e8}{numnames}}];}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02685}02685 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02686}02686                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02687}02687                                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02688}02688                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a73fb7660bb50d227ec6997cb007a5dd0}{NG\_NODE\_HAS\_NAME}}(node))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02689}02689                                         strcpy(np-\/>\mbox{\hyperlink{structnodeinfo_a414e265d0fe9cdbf5b280b174df712c9}{name}}, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02690}02690                                 strcpy(np-\/>\mbox{\hyperlink{structnodeinfo_a0cb74e11fd9579caf45240e65948df3e}{type}}, node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a7be0a2326d841f2d3e347eb682eef992}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02691}02691                                 np-\/>\mbox{\hyperlink{structnodeinfo_a611d9a736c6b372831b46754349915ea}{id}} = \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02692}02692                                 np-\/>\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}} = node-\/>\mbox{\hyperlink{structng__node_a55e56dfb6c3134af0533343b4d0be160}{nd\_numhooks}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02693}02693                                 KASSERT(nl-\/>\mbox{\hyperlink{structnamelist_a2b2e18f17711fb2f414d23059aae55e8}{numnames}} < \mbox{\hyperlink{ng__base_8c_ad685d5a522de935eabb0fd450c116d2b}{V\_ng\_nodes}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02694}02694                                     (\textcolor{stringliteral}{"{}\%s: no space"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02695}02695                                 nl-\/>\mbox{\hyperlink{structnamelist_a2b2e18f17711fb2f414d23059aae55e8}{numnames}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02696}02696                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02697}02697                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02698}02698                 \mbox{\hyperlink{ng__base_8c_af5200c0955f48c3220918e108cb12e7f}{IDHASH\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02699}02699                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02700}02700             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02701}02701         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0acc084b513978221e02a4a0a57086e5f9}{NGM\_LISTNAMES}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02702}02702             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02703}02703                 \textcolor{keyword}{struct }\mbox{\hyperlink{structnamelist}{namelist}} *nl;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02704}02704                 \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02705}02705                 \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02706}02706 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02707}02707                 \mbox{\hyperlink{ng__base_8c_ab036211d590592840dba407807582728}{NAMEHASH\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02708}02708                 \textcolor{comment}{/* Get response struct. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02709}02709                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(*nl) +}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02710}02710                     (\mbox{\hyperlink{ng__base_8c_a615ed8121628e631b8eb8d93ccb999c5}{V\_ng\_named\_nodes}} * \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structnodeinfo}{nodeinfo}})), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02711}02711                 \textcolor{keywordflow}{if} (resp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02712}02712                         \mbox{\hyperlink{ng__base_8c_a6675e9790d9d4e39414826450f46b734}{NAMEHASH\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02713}02713                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02714}02714                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02715}02715                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02716}02716                 nl = (\textcolor{keyword}{struct }\mbox{\hyperlink{structnamelist}{namelist}} *) resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02717}02717 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02718}02718                 \textcolor{comment}{/* Cycle through the lists of nodes. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02719}02719                 nl-\/>\mbox{\hyperlink{structnamelist_a2b2e18f17711fb2f414d23059aae55e8}{numnames}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02720}02720                 for (i = 0; i <= \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}}; i++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02721}02721                         LIST\_FOREACH(node, \&\mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}}[i], nd\_nodes) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02722}02722                                 \textcolor{keyword}{struct }\mbox{\hyperlink{structnodeinfo}{nodeinfo}} *\textcolor{keyword}{const} np =}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02723}02723                                     \&nl-\/>\mbox{\hyperlink{structnamelist_aee7503413f74917aa46a78e60ec379b9}{nodeinfo}}[nl-\/>\mbox{\hyperlink{structnamelist_a2b2e18f17711fb2f414d23059aae55e8}{numnames}}];}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02724}02724 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02725}02725                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node))}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02726}02726                                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02727}02727                                 strcpy(np-\/>\mbox{\hyperlink{structnodeinfo_a414e265d0fe9cdbf5b280b174df712c9}{name}}, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(node));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02728}02728                                 strcpy(np-\/>\mbox{\hyperlink{structnodeinfo_a0cb74e11fd9579caf45240e65948df3e}{type}}, node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a7be0a2326d841f2d3e347eb682eef992}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02729}02729                                 np-\/>\mbox{\hyperlink{structnodeinfo_a611d9a736c6b372831b46754349915ea}{id}} = \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02730}02730                                 np-\/>\mbox{\hyperlink{structnodeinfo_a5f90f85c7c5f0750e8e5889070eec64b}{hooks}} = node-\/>\mbox{\hyperlink{structng__node_a55e56dfb6c3134af0533343b4d0be160}{nd\_numhooks}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02731}02731                                 KASSERT(nl-\/>\mbox{\hyperlink{structnamelist_a2b2e18f17711fb2f414d23059aae55e8}{numnames}} < \mbox{\hyperlink{ng__base_8c_a615ed8121628e631b8eb8d93ccb999c5}{V\_ng\_named\_nodes}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02732}02732                                     (\textcolor{stringliteral}{"{}\%s: no space"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02733}02733                                 nl-\/>\mbox{\hyperlink{structnamelist_a2b2e18f17711fb2f414d23059aae55e8}{numnames}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02734}02734                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02735}02735                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02736}02736                 \mbox{\hyperlink{ng__base_8c_a6675e9790d9d4e39414826450f46b734}{NAMEHASH\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02737}02737                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02738}02738             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02739}02739 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02740}02740         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a6a83554981dbf3473c7a3c7665d1d4b6}{NGM\_LISTTYPES}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02741}02741             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02742}02742                 \textcolor{keyword}{struct }\mbox{\hyperlink{structtypelist}{typelist}} *tl;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02743}02743                 \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02744}02744                 \textcolor{keywordtype}{int} num = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02745}02745 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02746}02746                 \mbox{\hyperlink{ng__base_8c_ad792d0dd51964515d36b0d8fe4a5fcd1}{TYPELIST\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02747}02747                 \textcolor{comment}{/* Count number of types */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02748}02748                 LIST\_FOREACH(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \&ng\_typelist, types)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02749}02749                         num++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02750}02750 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02751}02751                 \textcolor{comment}{/* Get response struct */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02752}02752                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(*tl) +}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02753}02753                     (num * \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structtypeinfo}{typeinfo}})), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02754}02754                 \textcolor{keywordflow}{if} (resp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02755}02755                         \mbox{\hyperlink{ng__base_8c_a708532d52448aee33f5f494c088c6c19}{TYPELIST\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02756}02756                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02757}02757                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02758}02758                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02759}02759                 tl = (\textcolor{keyword}{struct }\mbox{\hyperlink{structtypelist}{typelist}} *) resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02760}02760 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02761}02761                 \textcolor{comment}{/* Cycle through the linked list of types */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02762}02762                 tl-\/>\mbox{\hyperlink{structtypelist_abb657e1af02deb230efd66d3adf37fe2}{numtypes}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02763}02763                 LIST\_FOREACH(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \&ng\_typelist, types) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02764}02764                         \textcolor{keyword}{struct }\mbox{\hyperlink{structtypeinfo}{typeinfo}} *\textcolor{keyword}{const} tp = \&tl-\/>\mbox{\hyperlink{structtypelist_a9db02f34795277650fc65cbf45f23c5f}{typeinfo}}[tl-\/>\mbox{\hyperlink{structtypelist_abb657e1af02deb230efd66d3adf37fe2}{numtypes}}];}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02765}02765 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02766}02766                         strcpy(tp-\/>\mbox{\hyperlink{structtypeinfo_afaecae3a113545357a98e7178634ceaa}{type\_name}}, \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>name);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02767}02767                         tp-\/>\mbox{\hyperlink{structtypeinfo_a10abb8384cd03a521fa0f4fc4ae197e3}{numnodes}} = \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>refs -\/ 1; \textcolor{comment}{/* don't count list */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02768}02768                         KASSERT(tl-\/>\mbox{\hyperlink{structtypelist_abb657e1af02deb230efd66d3adf37fe2}{numtypes}} < num, (\textcolor{stringliteral}{"{}\%s: no space"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02769}02769                         tl-\/>\mbox{\hyperlink{structtypelist_abb657e1af02deb230efd66d3adf37fe2}{numtypes}}++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02770}02770                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02771}02771                 \mbox{\hyperlink{ng__base_8c_a708532d52448aee33f5f494c088c6c19}{TYPELIST\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02772}02772                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02773}02773             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02774}02774 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02775}02775         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0ac5d95002a62b4e73972b30792b0a5253}{NGM\_BINARY2ASCII}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02776}02776             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02777}02777                 \textcolor{keywordtype}{int} bufSize = 1024;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02778}02778                 \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} *argstype;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02779}02779                 \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__cmdlist}{ng\_cmdlist}} *c;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02780}02780                 \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *binary, *ascii;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02781}02781 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02782}02782                 \textcolor{comment}{/* Data area must contain a valid netgraph message */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02783}02783                 binary = (\textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *)msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02784}02784                 if (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} < \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}}) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02785}02785                     (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} -\/ \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}) <}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02786}02786                     binary-\/>\mbox{\hyperlink{ng__ubt__var_8h_a4e2bc94c11cf069e7b329842b29bd068}{header}}.arglen)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02787}02787                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02788}02788                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02789}02789                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02790}02790                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02791}02791 retry\_b2a:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02792}02792                 \textcolor{comment}{/* Get a response message with lots of room */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02793}02793                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(*ascii) + bufSize, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02794}02794                 \textcolor{keywordflow}{if} (resp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02795}02795                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02796}02796                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02797}02797                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02798}02798                 ascii = (\textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *)resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02799}02799 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02800}02800                 \textcolor{comment}{/* Copy binary message header to response message payload */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02801}02801                 bcopy(binary, ascii, \textcolor{keyword}{sizeof}(*binary));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02802}02802 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02803}02803                 \textcolor{comment}{/* Find command by matching typecookie and command number */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02804}02804                 \textcolor{keywordflow}{for} (c = here-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a276b914a1726bf979501c92a9fd6bbf9}{cmdlist}}; c != NULL \&\& c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}} != NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02805}02805                     c++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02806}02806                         \textcolor{keywordflow}{if} (binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_ab59e14593b69a406ed5ca4209d489a10}{typecookie}} == c-\/>\mbox{\hyperlink{structng__cmdlist_a5bd60f3994192d20c361a56dc36e2c3c}{cookie}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02807}02807                             binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} == c-\/>\mbox{\hyperlink{structng__cmdlist_a768791e9f1f90565f4ecf2dc865b2ae7}{cmd}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02808}02808                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02809}02809                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02810}02810                 \textcolor{keywordflow}{if} (c == NULL || c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02811}02811                         \textcolor{keywordflow}{for} (c = \mbox{\hyperlink{ng__base_8c_a802f80fc0639e0767d35c63b7e35fd5b}{ng\_generic\_cmds}}; c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}} != NULL; c++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02812}02812                                 \textcolor{keywordflow}{if} (binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_ab59e14593b69a406ed5ca4209d489a10}{typecookie}} == c-\/>\mbox{\hyperlink{structng__cmdlist_a5bd60f3994192d20c361a56dc36e2c3c}{cookie}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02813}02813                                     binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} == c-\/>\mbox{\hyperlink{structng__cmdlist_a768791e9f1f90565f4ecf2dc865b2ae7}{cmd}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02814}02814                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02815}02815                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02816}02816                         \textcolor{keywordflow}{if} (c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02817}02817                                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(resp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02818}02818                                 error = ENOSYS;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02819}02819                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02820}02820                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02821}02821                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02822}02822 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02823}02823                 \textcolor{comment}{/* Convert command name to ASCII */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02824}02824                 snprintf(ascii-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a37ee96bc4ef485cb9b7a715adbf20d0f}{cmdstr}}, \textcolor{keyword}{sizeof}(ascii-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a37ee96bc4ef485cb9b7a715adbf20d0f}{cmdstr}}),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02825}02825                     \textcolor{stringliteral}{"{}\%s"{}}, c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02826}02826 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02827}02827                 \textcolor{comment}{/* Convert command arguments to ASCII */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02828}02828                 argstype = (binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_afb60eeac4395f18a7900d6bd5b0f35a6}{flags}} \& \mbox{\hyperlink{ng__message_8h_a5fe4082cbb0ac2567dde73b46d0eabd3}{NGF\_RESP}}) ?}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02829}02829                     c-\/>\mbox{\hyperlink{structng__cmdlist_a491efffabf24aea42561450a3d12b461}{respType}} : c-\/>\mbox{\hyperlink{structng__cmdlist_abbfe5e190dcbd6297892abacea2470f3}{mesgType}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02830}02830                 if (argstype == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02831}02831                         *ascii-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}} = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02832}02832                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02833}02833                         error = \mbox{\hyperlink{ng__parse_8c_a639354b921287eb2c5d92ff8a5348cd1}{ng\_unparse}}(argstype, (u\_char *)binary-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02834}02834                             ascii-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}, bufSize);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02835}02835                         \textcolor{keywordflow}{if} (error == ERANGE) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02836}02836                                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(resp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02837}02837                                 bufSize *= 2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02838}02838                                 \textcolor{keywordflow}{goto} retry\_b2a;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02839}02839                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02840}02840                                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(resp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02841}02841                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02842}02842                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02843}02843                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02844}02844 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02845}02845                 \textcolor{comment}{/* Return the result as struct ng\_mesg plus ASCII string */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02846}02846                 bufSize = strlen(ascii-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}) + 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02847}02847                 ascii-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} = bufSize;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02848}02848                 resp-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} = \textcolor{keyword}{sizeof}(*ascii) + bufSize;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02849}02849                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02850}02850             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02851}02851 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02852}02852         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0ad2c43c923c2238df21c860962cd497f3}{NGM\_ASCII2BINARY}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02853}02853             \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02854}02854                 \textcolor{keywordtype}{int} bufSize = 20 * 1024;        \textcolor{comment}{/* XXX hard coded constant */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02855}02855                 \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__cmdlist}{ng\_cmdlist}} *c;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02856}02856                 \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} *argstype;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02857}02857                 \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *ascii, *binary;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02858}02858                 \textcolor{keywordtype}{int} off = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02859}02859 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02860}02860                 \textcolor{comment}{/* Data area must contain at least a struct ng\_mesg + '\(\backslash\)0' */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02861}02861                 ascii = (\textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *)msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02862}02862                 if ((msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} < \textcolor{keyword}{sizeof}(*ascii) + 1) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02863}02863                     (ascii-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} < 1) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02864}02864                     (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} < \textcolor{keyword}{sizeof}(*ascii) +}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02865}02865                     ascii-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}})) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02866}02866                         \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02867}02867                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02868}02868                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02869}02869                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02870}02870                 ascii-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}[ascii-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02871}02871 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02872}02872                 \textcolor{comment}{/* Get a response message with lots of room */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02873}02873                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(*binary) + bufSize, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02874}02874                 \textcolor{keywordflow}{if} (resp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02875}02875                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02876}02876                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02877}02877                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02878}02878                 binary = (\textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *)resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02879}02879 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02880}02880                 \textcolor{comment}{/* Copy ASCII message header to response message payload */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02881}02881                 bcopy(ascii, binary, \textcolor{keyword}{sizeof}(*ascii));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02882}02882 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02883}02883                 \textcolor{comment}{/* Find command by matching ASCII command string */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02884}02884                 \textcolor{keywordflow}{for} (c = here-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a276b914a1726bf979501c92a9fd6bbf9}{cmdlist}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02885}02885                     c != NULL \&\& c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}} != NULL; c++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02886}02886                         \textcolor{keywordflow}{if} (strcmp(ascii-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a37ee96bc4ef485cb9b7a715adbf20d0f}{cmdstr}}, c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}}) == 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02887}02887                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02888}02888                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02889}02889                 \textcolor{keywordflow}{if} (c == NULL || c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02890}02890                         \textcolor{keywordflow}{for} (c = \mbox{\hyperlink{ng__base_8c_a802f80fc0639e0767d35c63b7e35fd5b}{ng\_generic\_cmds}}; c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}} != NULL; c++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02891}02891                                 \textcolor{keywordflow}{if} (strcmp(ascii-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a37ee96bc4ef485cb9b7a715adbf20d0f}{cmdstr}}, c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}}) == 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02892}02892                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02893}02893                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02894}02894                         \textcolor{keywordflow}{if} (c-\/>\mbox{\hyperlink{structng__cmdlist_a2c34f1791a3d17250921343e903f8759}{name}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02895}02895                                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(resp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02896}02896                                 error = ENOSYS;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02897}02897                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02898}02898                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02899}02899                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02900}02900 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02901}02901                 \textcolor{comment}{/* Convert command name to binary */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02902}02902                 binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} = c-\/>\mbox{\hyperlink{structng__cmdlist_a768791e9f1f90565f4ecf2dc865b2ae7}{cmd}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02903}02903                 binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_ab59e14593b69a406ed5ca4209d489a10}{typecookie}} = c-\/>\mbox{\hyperlink{structng__cmdlist_a5bd60f3994192d20c361a56dc36e2c3c}{cookie}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02904}02904 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02905}02905                 \textcolor{comment}{/* Convert command arguments to binary */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02906}02906                 argstype = (binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_afb60eeac4395f18a7900d6bd5b0f35a6}{flags}} \& \mbox{\hyperlink{ng__message_8h_a5fe4082cbb0ac2567dde73b46d0eabd3}{NGF\_RESP}}) ?}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02907}02907                     c-\/>\mbox{\hyperlink{structng__cmdlist_a491efffabf24aea42561450a3d12b461}{respType}} : c-\/>\mbox{\hyperlink{structng__cmdlist_abbfe5e190dcbd6297892abacea2470f3}{mesgType}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02908}02908                 if (argstype == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02909}02909                         bufSize = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02910}02910                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02911}02911                         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__parse_8c_af471abdcd18dbd8963a8ad144a028471}{ng\_parse}}(argstype, ascii-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}, \&off,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02912}02912                             (u\_char *)binary-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}, \&bufSize)) != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02913}02913                                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(resp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02914}02914                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02915}02915                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02916}02916                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02917}02917 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02918}02918                 \textcolor{comment}{/* Return the result */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02919}02919                 binary-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} = bufSize;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02920}02920                 resp-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} = \textcolor{keyword}{sizeof}(*binary) + bufSize;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02921}02921                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02922}02922             \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02923}02923 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02924}02924         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0a5be276b7d12ec0ce60c7743a0e97394c}{NGM\_TEXT\_CONFIG}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02925}02925         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__message_8h_ae8a3b6a5d0d3244ed73924ab2421a0d0af7e8d918ab39873056284fe1b8dfe71b}{NGM\_TEXT\_STATUS}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02926}02926                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02927}02927 \textcolor{comment}{                 * This one is tricky as it passes the command down to the}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02928}02928 \textcolor{comment}{                 * actual node, even though it is a generic type command.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02929}02929 \textcolor{comment}{                 * This means we must assume that the item/msg is already freed}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02930}02930 \textcolor{comment}{                 * when control passes back to us.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02931}02931 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02932}02932                 \textcolor{keywordflow}{if} (here-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a66db0c248a3c20594061723005122526}{rcvmsg}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02933}02933                         \mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item) = msg; \textcolor{comment}{/* put it back as we found it */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02934}02934                         \textcolor{keywordflow}{return}((*here-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a66db0c248a3c20594061723005122526}{rcvmsg}})(here, item, lasthook));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02935}02935                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02936}02936                 \textcolor{comment}{/* Fall through if rcvmsg not supported */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02937}02937         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02938}02938                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02939}02939                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02940}02940         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02941}02941         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02942}02942 \textcolor{comment}{         * Sometimes a generic message may be statically allocated}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02943}02943 \textcolor{comment}{         * to avoid problems with allocating when in tight memory situations.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02944}02944 \textcolor{comment}{         * Don't free it if it is so.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02945}02945 \textcolor{comment}{         * I break them apart here, because erros may cause a free if the item}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02946}02946 \textcolor{comment}{         * in which case we'd be doing it twice.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02947}02947 \textcolor{comment}{         * they are kept together above, to simplify freeing.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02948}02948 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02949}02949 out:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02950}02950         \mbox{\hyperlink{netgraph_8h_a69db50ed7f968e936580df029ab5c5dc}{NG\_RESPOND\_MSG}}(error, here, item, resp);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02951}02951         \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02952}02952         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02953}02953 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02954}02954 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02955}02955 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02956}02956 \textcolor{comment}{                        Queue element get/free routines}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02957}02957 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02958}02958 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02959}\mbox{\hyperlink{ng__base_8c_aca7a04177bc11609f960768e241127b3}{02959}} uma\_zone\_t                      \mbox{\hyperlink{ng__base_8c_aca7a04177bc11609f960768e241127b3}{ng\_qzone}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02960}\mbox{\hyperlink{ng__base_8c_a48e7a06dfd60da3906f8716409319e03}{02960}} uma\_zone\_t                      \mbox{\hyperlink{ng__base_8c_a48e7a06dfd60da3906f8716409319e03}{ng\_qdzone}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02961}\mbox{\hyperlink{ng__base_8c_ae67ea59b9a965d5201c366cdf8766329}{02961}} \textcolor{keyword}{static} \textcolor{keywordtype}{int}                      \mbox{\hyperlink{ng__base_8c_ae67ea59b9a965d5201c366cdf8766329}{numthreads}} = 0; \textcolor{comment}{/* number of queue threads */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02962}\mbox{\hyperlink{ng__base_8c_a57cdfec45012933e8eef4f402cf766ab}{02962}} \textcolor{keyword}{static} \textcolor{keywordtype}{int}                      \mbox{\hyperlink{ng__base_8c_a57cdfec45012933e8eef4f402cf766ab}{maxalloc}} = 4096;\textcolor{comment}{/* limit the damage of a leak */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02963}\mbox{\hyperlink{ng__base_8c_a1fedfc3927bd12a57fbf54e04cdad720}{02963}} \textcolor{keyword}{static} \textcolor{keywordtype}{int}                      \mbox{\hyperlink{ng__base_8c_a1fedfc3927bd12a57fbf54e04cdad720}{maxdata}} = 4096;  \textcolor{comment}{/* limit the damage of a DoS */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02964}02964 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02965}\mbox{\hyperlink{ng__base_8c_a978f1fd0811c0aed12cf6c3c5d4a5b2b}{02965}} \mbox{\hyperlink{ng__base_8c_a978f1fd0811c0aed12cf6c3c5d4a5b2b}{SYSCTL\_INT}}(\_net\_graph, OID\_AUTO, threads, CTLFLAG\_RDTUN, \&\mbox{\hyperlink{ng__base_8c_ae67ea59b9a965d5201c366cdf8766329}{numthreads}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02966}02966     0, \textcolor{stringliteral}{"{}Number of queue processing threads"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02967}\mbox{\hyperlink{ng__base_8c_a2ff942b42c3c54cd50d6141df0324532}{02967}} \mbox{\hyperlink{ng__base_8c_a978f1fd0811c0aed12cf6c3c5d4a5b2b}{SYSCTL\_INT}}(\_net\_graph, OID\_AUTO, \mbox{\hyperlink{ng__base_8c_a57cdfec45012933e8eef4f402cf766ab}{maxalloc}}, CTLFLAG\_RDTUN, \&\mbox{\hyperlink{ng__base_8c_a57cdfec45012933e8eef4f402cf766ab}{maxalloc}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02968}02968     0, \textcolor{stringliteral}{"{}Maximum number of non-\/data queue items to allocate"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02969}\mbox{\hyperlink{ng__base_8c_ae94d7bb5e06da8f380e146d3cb327cf1}{02969}} \mbox{\hyperlink{ng__base_8c_a978f1fd0811c0aed12cf6c3c5d4a5b2b}{SYSCTL\_INT}}(\_net\_graph, OID\_AUTO, \mbox{\hyperlink{ng__base_8c_a1fedfc3927bd12a57fbf54e04cdad720}{maxdata}}, CTLFLAG\_RDTUN, \&\mbox{\hyperlink{ng__base_8c_a1fedfc3927bd12a57fbf54e04cdad720}{maxdata}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02970}02970     0, \textcolor{stringliteral}{"{}Maximum number of data queue items to allocate"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02971}02971 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02972}02972 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02973}02973 \textcolor{keyword}{static} \mbox{\hyperlink{ng__sscfu__cust_8h_a5b4f81dc58372defede121a42cfd89c8}{TAILQ\_HEAD}}(, \mbox{\hyperlink{structng__item}{ng\_item}}) ng\_itemlist = TAILQ\_HEAD\_INITIALIZER(ng\_itemlist);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02974}02974 \textcolor{keyword}{static} \textcolor{keywordtype}{int} allocated;   \textcolor{comment}{/* number of items malloc'd */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02975}02975 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02976}02976 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02977}02977 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02978}02978 \textcolor{comment}{ * Get a queue entry.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02979}02979 \textcolor{comment}{ * This is usually called when a packet first enters netgraph.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02980}02980 \textcolor{comment}{ * By definition, this is usually from an interrupt, or from a user.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02981}02981 \textcolor{comment}{ * Users are not so important, but try be quick for the times that it's}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02982}02982 \textcolor{comment}{ * an interrupt.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02983}02983 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02984}02984 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02985}\mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{02985}} \mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{ng\_alloc\_item}}(\textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \textcolor{keywordtype}{int} \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02986}02986 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02987}02987         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02988}02988 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02989}02989         KASSERT(((\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}} \& \string~\mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) == 0),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02990}02990             (\textcolor{stringliteral}{"{}\%s: incorrect item type: \%d"{}}, \_\_func\_\_, \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02991}02991 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02992}02992         item = uma\_zalloc((\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}} == \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}}) ? \mbox{\hyperlink{ng__base_8c_a48e7a06dfd60da3906f8716409319e03}{ng\_qdzone}} : \mbox{\hyperlink{ng__base_8c_aca7a04177bc11609f960768e241127b3}{ng\_qzone}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02993}02993             ((\mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}} \& \mbox{\hyperlink{netgraph_8h_a6c3be6c2980a342765a62e72e62e4c06}{NG\_WAITOK}}) ? M\_WAITOK : M\_NOWAIT) | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02994}02994 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02995}02995         \textcolor{keywordflow}{if} (item) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02996}02996                 item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} = \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02997}02997 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02998}02998                 mtx\_lock(\&ngq\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l02999}02999                 TAILQ\_INSERT\_TAIL(\&ng\_itemlist, item, all);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03000}03000                 allocated++;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03001}03001                 mtx\_unlock(\&ngq\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03002}03002 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03003}03003         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03004}03004 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03005}03005         \textcolor{keywordflow}{return} (item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03006}03006 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03007}03007 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03008}03008 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03009}03009 \textcolor{comment}{ * Release a queue entry}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03010}03010 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03011}03011 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03012}\mbox{\hyperlink{netgraph_8h_a2f1d253226c10786917f47287b93b466}{03012}} \mbox{\hyperlink{ng__base_8c_a2f1d253226c10786917f47287b93b466}{ng\_free\_item}}(\mbox{\hyperlink{structng__item}{item\_p}} item)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03013}03013 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03014}03014         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03015}03015 \textcolor{comment}{         * The item may hold resources on its own. We need to free}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03016}03016 \textcolor{comment}{         * these before we can free the item. What they are depends upon}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03017}03017 \textcolor{comment}{         * what kind of item it is. it is important that nodes zero}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03018}03018 \textcolor{comment}{         * out pointers to resources that they remove from the item}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03019}03019 \textcolor{comment}{         * or we release them again here.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03020}03020 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03021}03021         \textcolor{keywordflow}{switch} (item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03022}03022         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03023}03023                 \textcolor{comment}{/* If we have an mbuf still attached.. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03024}03024                 \mbox{\hyperlink{netgraph_8h_a2461bfcdc9e024484ed8037d386620e3}{NG\_FREE\_M}}(\mbox{\hyperlink{netgraph_8h_ad28d8f0628f848c8aa890d9424dacd01}{\_NGI\_M}}(item));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03025}03025                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03026}03026         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a9e3984d767a278bf9893ae7145a143a8}{NGQF\_MESG}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03027}03027                 \mbox{\hyperlink{netgraph_8h_a03a96f057cc0cb02ddfd46ceb8e50d44}{\_NGI\_RETADDR}}(item) = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03028}03028                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(\mbox{\hyperlink{netgraph_8h_a2e08902bb82fa382275ab4aef2cda802}{\_NGI\_MSG}}(item));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03029}03029                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03030}03030         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_ad51ccd1f1dc08a7ba45702b1f40153b4}{NGQF\_FN}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03031}03031         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a7f371ec83585e8fefb12ac2402cafc2e}{NGQF\_FN2}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03032}03032                 \textcolor{comment}{/* nothing to free really, */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03033}03033                 \mbox{\hyperlink{netgraph_8h_ac66bfe0a988065efb377ce19e2293663}{\_NGI\_FN}}(item) = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03034}03034                 \mbox{\hyperlink{netgraph_8h_a1851b3d294e97a97205fbf0634995914}{\_NGI\_ARG1}}(item) = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03035}03035                 \mbox{\hyperlink{netgraph_8h_ab55631fc157e682a4d300327e3e3a842}{\_NGI\_ARG2}}(item) = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03036}03036                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03037}03037         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03038}03038         \textcolor{comment}{/* If we still have a node or hook referenced... */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03039}03039         \mbox{\hyperlink{netgraph_8h_a090049e75f3237bce1ff3737b4a15c08}{\_NGI\_CLR\_NODE}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03040}03040         \mbox{\hyperlink{netgraph_8h_a2c4b0102e7f658fb0c20b2b1f1065b2a}{\_NGI\_CLR\_HOOK}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03041}03041 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03042}03042 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03043}03043         mtx\_lock(\&ngq\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03044}03044         TAILQ\_REMOVE(\&ng\_itemlist, item, all);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03045}03045         allocated-\/-\/;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03046}03046         mtx\_unlock(\&ngq\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03047}03047 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03048}03048         uma\_zfree(((item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) == \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}}) ?}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03049}03049             \mbox{\hyperlink{ng__base_8c_a48e7a06dfd60da3906f8716409319e03}{ng\_qdzone}} : \mbox{\hyperlink{ng__base_8c_aca7a04177bc11609f960768e241127b3}{ng\_qzone}}, item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03050}03050 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03051}03051 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03052}03052 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03053}03053 \textcolor{comment}{ * Change type of the queue entry.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03054}03054 \textcolor{comment}{ * Possibly reallocates it from another UMA zone.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03055}03055 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03056}03056 \textcolor{keyword}{static} \_\_inline \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03057}\mbox{\hyperlink{ng__base_8c_a67dcf33286684352f689e3236f556ee9}{03057}} \mbox{\hyperlink{ng__base_8c_a67dcf33286684352f689e3236f556ee9}{ng\_realloc\_item}}(\mbox{\hyperlink{structng__item}{item\_p}} pitem, \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \textcolor{keywordtype}{int} \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03058}03058 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03059}03059         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03060}03060         \textcolor{keywordtype}{int} from, to;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03061}03061 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03062}03062         KASSERT((pitem != NULL), (\textcolor{stringliteral}{"{}\%s: can't reallocate NULL"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03063}03063         KASSERT(((\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}} \& \string~\mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) == 0),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03064}03064             (\textcolor{stringliteral}{"{}\%s: incorrect item type: \%d"{}}, \_\_func\_\_, \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03065}03065 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03066}03066         from = ((pitem-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) == \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03067}03067         to = (\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}} == \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03068}03068         \textcolor{keywordflow}{if} (from != to) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03069}03069                 \textcolor{comment}{/* If reallocation is required do it and copy item. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03070}03070                 \textcolor{keywordflow}{if} ((item = \mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{ng\_alloc\_item}}(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})) == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03071}03071                         \mbox{\hyperlink{ng__base_8c_a2f1d253226c10786917f47287b93b466}{ng\_free\_item}}(pitem);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03072}03072                         \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03073}03073                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03074}03074                 *item = *pitem;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03075}03075                 \mbox{\hyperlink{ng__base_8c_a2f1d253226c10786917f47287b93b466}{ng\_free\_item}}(pitem);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03076}03076         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03077}03077                 item = pitem;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03078}03078         item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} = (item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \string~NGQF\_TYPE) | \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03079}03079 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03080}03080         \textcolor{keywordflow}{return} (item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03081}03081 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03082}03082 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03083}03083 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03084}03084 \textcolor{comment}{                        Module routines}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03085}03085 \textcolor{comment}{************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03086}03086 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03087}03087 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03088}03088 \textcolor{comment}{ * Handle the loading/unloading of a netgraph node type module}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03089}03089 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03090}03090 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03091}\mbox{\hyperlink{netgraph_8h_a01b7bd0a69ed703183e58eb172b6b6b2}{03091}} \mbox{\hyperlink{ng__base_8c_a4174decb4e4a238c748341a45b09389b}{ng\_mod\_event}}(module\_t mod, \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__ubt__var_8h_aeef6900f411bc223febdd92c9435693b}{event}}, \textcolor{keywordtype}{void} *\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03092}03092 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03093}03093         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} *\textcolor{keyword}{const} \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}} = \mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03094}03094         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03095}03095 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03096}03096         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{ng__ubt__var_8h_aeef6900f411bc223febdd92c9435693b}{event}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03097}03097         \textcolor{keywordflow}{case} MOD\_LOAD:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03098}03098 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03099}03099                 \textcolor{comment}{/* Register new netgraph node type */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03100}03100                 \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__base_8c_a67f567d871dc683c4cb7a75dcfedf458}{ng\_newtype}}(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}})) != 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03101}03101                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03102}03102 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03103}03103                 \textcolor{comment}{/* Call type specific code */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03104}03104                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>mod\_event != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03105}03105                         \textcolor{keywordflow}{if} ((error = (*\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>mod\_event)(mod, \mbox{\hyperlink{ng__ubt__var_8h_aeef6900f411bc223febdd92c9435693b}{event}}, \mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}}))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03106}03106                                 \mbox{\hyperlink{ng__base_8c_add5cd5fbd97c58f0434a25ebde39bfda}{TYPELIST\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03107}03107                                 \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>refs-\/-\/;       \textcolor{comment}{/* undo it */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03108}03108                                 LIST\_REMOVE(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, types);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03109}03109                                 \mbox{\hyperlink{ng__base_8c_a8b788036e6feb332405dc003726502b6}{TYPELIST\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03110}03110                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03111}03111                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03112}03112 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03113}03113         \textcolor{keywordflow}{case} MOD\_UNLOAD:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03114}03114                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>refs > 1) \{               \textcolor{comment}{/* make sure no nodes exist! */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03115}03115                         error = EBUSY;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03116}03116                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03117}03117                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>refs == 0) \textcolor{comment}{/* failed load, nothing to undo */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03118}03118                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03119}03119                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>mod\_event != NULL) \{      \textcolor{comment}{/* check with type */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03120}03120                                 error = (*\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>mod\_event)(mod, \mbox{\hyperlink{ng__ubt__var_8h_aeef6900f411bc223febdd92c9435693b}{event}}, \mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03121}03121                                 \textcolor{keywordflow}{if} (error != 0) \textcolor{comment}{/* type refuses.. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03122}03122                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03123}03123                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03124}03124                         \mbox{\hyperlink{ng__base_8c_add5cd5fbd97c58f0434a25ebde39bfda}{TYPELIST\_WLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03125}03125                         LIST\_REMOVE(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}, types);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03126}03126                         \mbox{\hyperlink{ng__base_8c_a8b788036e6feb332405dc003726502b6}{TYPELIST\_WUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03127}03127                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03128}03128                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03129}03129 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03130}03130         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03131}03131                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>mod\_event != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03132}03132                         error = (*\mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}-\/>mod\_event)(mod, \mbox{\hyperlink{ng__ubt__var_8h_aeef6900f411bc223febdd92c9435693b}{event}}, \mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03133}03133                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03134}03134                         error = EOPNOTSUPP;             \textcolor{comment}{/* XXX ? */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03135}03135                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03136}03136         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03137}03137         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03138}03138 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03139}03139 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03140}03140 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03141}\mbox{\hyperlink{ng__base_8c_a234191e5b3758094892aef24ae041b5e}{03141}} \mbox{\hyperlink{ng__base_8c_a234191e5b3758094892aef24ae041b5e}{vnet\_netgraph\_init}}(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *unused \_\_unused)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03142}03142 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03143}03143 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03144}03144         \textcolor{comment}{/* We start with small hashes, but they can grow. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03145}03145         \mbox{\hyperlink{ng__base_8c_ad0a4773cb27c547300c11cc1cdc74780}{V\_ng\_ID\_hash}} = hashinit(16, M\_NETGRAPH\_NODE, \&\mbox{\hyperlink{ng__base_8c_aa28823cd95db08aaf3e195ad052d261c}{V\_ng\_ID\_hmask}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03146}03146         \mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}} = hashinit(16, M\_NETGRAPH\_NODE, \&\mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03147}03147 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03148}\mbox{\hyperlink{ng__base_8c_ab6c1e8e57412f6f82b77b71b4a47078d}{03148}} \mbox{\hyperlink{ng__base_8c_ab6c1e8e57412f6f82b77b71b4a47078d}{VNET\_SYSINIT}}(\mbox{\hyperlink{ng__base_8c_a234191e5b3758094892aef24ae041b5e}{vnet\_netgraph\_init}}, SI\_SUB\_NETGRAPH, SI\_ORDER\_FIRST,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03149}03149     \mbox{\hyperlink{ng__base_8c_a234191e5b3758094892aef24ae041b5e}{vnet\_netgraph\_init}}, NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03150}03150 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03151}03151 \textcolor{preprocessor}{\#ifdef VIMAGE}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03152}03152 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03153}03153 vnet\_netgraph\_uninit(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *unused \_\_unused)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03154}03154 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03155}03155         \mbox{\hyperlink{structng__node}{node\_p}} node = NULL, last\_killed = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03156}03156         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03157}03157 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03158}03158         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03159}03159                 \textcolor{comment}{/* Find a node to kill */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03160}03160                 \mbox{\hyperlink{ng__base_8c_ac31008b26fb640721ee68fc1692094e3}{IDHASH\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03161}03161                 \textcolor{keywordflow}{for} (i = 0; i <= \mbox{\hyperlink{ng__base_8c_aa28823cd95db08aaf3e195ad052d261c}{V\_ng\_ID\_hmask}}; i++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03162}03162                         LIST\_FOREACH(node, \&\mbox{\hyperlink{ng__base_8c_ad0a4773cb27c547300c11cc1cdc74780}{V\_ng\_ID\_hash}}[i], nd\_idnodes) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03163}03163                                 \textcolor{keywordflow}{if} (node != \&\mbox{\hyperlink{ng__base_8c_a696a31653667f1aa94797901263d77b7}{ng\_deadnode}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03164}03164                                         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03165}03165                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03166}03166                                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03167}03167                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03168}03168                         \textcolor{keywordflow}{if} (node != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03169}03169                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03170}03170                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03171}03171                 \mbox{\hyperlink{ng__base_8c_af5200c0955f48c3220918e108cb12e7f}{IDHASH\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03172}03172 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03173}03173                 \textcolor{comment}{/* Attempt to kill it only if it is a regular node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03174}03174                 \textcolor{keywordflow}{if} (node != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03175}03175                         \textcolor{keywordflow}{if} (node == last\_killed) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03176}03176                                 \textcolor{keywordflow}{if} (node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} \& \mbox{\hyperlink{netgraph_8h_a46dcde626b52a54a8da9c668b83eca5d}{NGF\_REALLY\_DIE}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03177}03177                                         panic(\textcolor{stringliteral}{"{}ng node \%s won't die"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03178}03178                                             node-\/>\mbox{\hyperlink{structng__node_a77d22883183afc7a1b1b9f2df4617b66}{nd\_name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03179}03179                                 \textcolor{comment}{/* The node persisted itself.  Try again. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03180}03180                                 node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}} |= \mbox{\hyperlink{netgraph_8h_a46dcde626b52a54a8da9c668b83eca5d}{NGF\_REALLY\_DIE}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03181}03181                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03182}03182                         \mbox{\hyperlink{ng__base_8c_ab520be4e5d1381a533005595bd229616}{ng\_rmnode}}(node, NULL, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03183}03183                         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03184}03184                         last\_killed = node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03185}03185                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03186}03186         \} \textcolor{keywordflow}{while} (node != NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03187}03187 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03188}03188         hashdestroy(\mbox{\hyperlink{ng__base_8c_ae4c610a76668dc7b77345e4fb809cc51}{V\_ng\_name\_hash}}, M\_NETGRAPH\_NODE, \mbox{\hyperlink{ng__base_8c_a0fcf882d40d1a9addf0bce85cc0eed8e}{V\_ng\_name\_hmask}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03189}03189         hashdestroy(\mbox{\hyperlink{ng__base_8c_ad0a4773cb27c547300c11cc1cdc74780}{V\_ng\_ID\_hash}}, M\_NETGRAPH\_NODE, \mbox{\hyperlink{ng__base_8c_aa28823cd95db08aaf3e195ad052d261c}{V\_ng\_ID\_hmask}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03190}03190 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03191}03191 \mbox{\hyperlink{ng__eiface_8c_aa078ff232016a41064bdada416f0cd80}{VNET\_SYSUNINIT}}(vnet\_netgraph\_uninit, SI\_SUB\_NETGRAPH, SI\_ORDER\_FIRST,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03192}03192     vnet\_netgraph\_uninit, NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03193}03193 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* VIMAGE */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03194}03194 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03195}03195 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03196}03196 \textcolor{comment}{ * Handle loading and unloading for this code.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03197}03197 \textcolor{comment}{ * The only thing we need to link into is the NETISR strucure.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03198}03198 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03199}03199 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03200}\mbox{\hyperlink{ng__base_8c_a396817d48f5ba91f0db49c527b4dc21a}{03200}} \mbox{\hyperlink{ng__base_8c_a396817d48f5ba91f0db49c527b4dc21a}{ngb\_mod\_event}}(module\_t mod, \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__ubt__var_8h_aeef6900f411bc223febdd92c9435693b}{event}}, \textcolor{keywordtype}{void} *\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03201}03201 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03202}03202         \textcolor{keyword}{struct }proc *p;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03203}03203         \textcolor{keyword}{struct }thread *td;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03204}03204         \textcolor{keywordtype}{int} i, error = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03205}03205 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03206}03206         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{ng__ubt__var_8h_aeef6900f411bc223febdd92c9435693b}{event}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03207}03207         \textcolor{keywordflow}{case} MOD\_LOAD:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03208}03208                 \textcolor{comment}{/* Initialize everything. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03209}03209                 \mbox{\hyperlink{ng__base_8c_a0c93924bd56b270781b46bbd17d07ea9}{NG\_WORKLIST\_LOCK\_INIT}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03210}03210                 rw\_init(\&ng\_typelist\_lock, \textcolor{stringliteral}{"{}netgraph types"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03211}03211                 rw\_init(\&ng\_idhash\_lock, \textcolor{stringliteral}{"{}netgraph idhash"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03212}03212                 rw\_init(\&ng\_namehash\_lock, \textcolor{stringliteral}{"{}netgraph namehash"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03213}03213                 rw\_init(\&\mbox{\hyperlink{ng__base_8c_a9f7903387702ed64f0d8f9d6a1fe2c44}{ng\_topo\_lock}}, \textcolor{stringliteral}{"{}netgraph topology mutex"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03214}03214 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03215}03215                 mtx\_init(\&ng\_nodelist\_mtx, \textcolor{stringliteral}{"{}netgraph nodelist mutex"{}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03216}03216                     MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03217}03217                 mtx\_init(\&ngq\_mtx, \textcolor{stringliteral}{"{}netgraph item list mutex"{}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03218}03218                     MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03219}03219 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03220}03220                 \mbox{\hyperlink{ng__base_8c_aca7a04177bc11609f960768e241127b3}{ng\_qzone}} = uma\_zcreate(\textcolor{stringliteral}{"{}NetGraph items"{}}, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__item}{ng\_item}}),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03221}03221                     NULL, NULL, NULL, NULL, UMA\_ALIGN\_CACHE, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03222}03222                 uma\_zone\_set\_max(\mbox{\hyperlink{ng__base_8c_aca7a04177bc11609f960768e241127b3}{ng\_qzone}}, \mbox{\hyperlink{ng__base_8c_a57cdfec45012933e8eef4f402cf766ab}{maxalloc}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03223}03223                 \mbox{\hyperlink{ng__base_8c_a48e7a06dfd60da3906f8716409319e03}{ng\_qdzone}} = uma\_zcreate(\textcolor{stringliteral}{"{}NetGraph data items"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03224}03224                     \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__item}{ng\_item}}), NULL, NULL, NULL, NULL,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03225}03225                     UMA\_ALIGN\_CACHE, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03226}03226                 uma\_zone\_set\_max(\mbox{\hyperlink{ng__base_8c_a48e7a06dfd60da3906f8716409319e03}{ng\_qdzone}}, \mbox{\hyperlink{ng__base_8c_a1fedfc3927bd12a57fbf54e04cdad720}{maxdata}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03227}03227                 \textcolor{comment}{/* Autoconfigure number of threads. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03228}03228                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__base_8c_ae67ea59b9a965d5201c366cdf8766329}{numthreads}} <= 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03229}03229                         \mbox{\hyperlink{ng__base_8c_ae67ea59b9a965d5201c366cdf8766329}{numthreads}} = mp\_ncpus;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03230}03230                 \textcolor{comment}{/* Create threads. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03231}03231                 p = NULL; \textcolor{comment}{/* start with no process */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03232}03232                 \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{ng__base_8c_ae67ea59b9a965d5201c366cdf8766329}{numthreads}}; i++) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03233}03233                         \textcolor{keywordflow}{if} (kproc\_kthread\_add(\mbox{\hyperlink{ng__base_8c_a7d51ab82df99dad752e4dd859ced10ca}{ngthread}}, NULL, \&p, \&td,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03234}03234                             RFHIGHPID, 0, \textcolor{stringliteral}{"{}ng\_queue"{}}, \textcolor{stringliteral}{"{}ng\_queue\%d"{}}, i)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03235}03235                                 \mbox{\hyperlink{ng__base_8c_ae67ea59b9a965d5201c366cdf8766329}{numthreads}} = i;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03236}03236                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03237}03237                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03238}03238                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03239}03239                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03240}03240         \textcolor{keywordflow}{case} MOD\_UNLOAD:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03241}03241                 \textcolor{comment}{/* You can't unload it because an interface may be using it. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03242}03242                 error = EBUSY;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03243}03243                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03244}03244         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03245}03245                 error = EOPNOTSUPP;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03246}03246                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03247}03247         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03248}03248         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03249}03249 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03250}03250 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03251}\mbox{\hyperlink{ng__base_8c_a6ff0a08197cd0203dce31fbc09a0acb6}{03251}} \textcolor{keyword}{static} moduledata\_t \mbox{\hyperlink{ng__base_8c_a6ff0a08197cd0203dce31fbc09a0acb6}{netgraph\_mod}} = \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03252}03252         \textcolor{stringliteral}{"{}netgraph"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03253}03253         \mbox{\hyperlink{ng__base_8c_a396817d48f5ba91f0db49c527b4dc21a}{ngb\_mod\_event}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03254}03254         (NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03255}03255 \};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03256}\mbox{\hyperlink{ng__base_8c_ab06e4c1fbbe868079286395ac5adaefe}{03256}} \mbox{\hyperlink{ng__base_8c_ab06e4c1fbbe868079286395ac5adaefe}{DECLARE\_MODULE}}(netgraph, \mbox{\hyperlink{ng__base_8c_a6ff0a08197cd0203dce31fbc09a0acb6}{netgraph\_mod}}, SI\_SUB\_NETGRAPH, SI\_ORDER\_FIRST);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03257}\mbox{\hyperlink{ng__base_8c_af2bb2b48b243e8b21d149f35a77ddc6b}{03257}} \mbox{\hyperlink{ng__base_8c_af2bb2b48b243e8b21d149f35a77ddc6b}{SYSCTL\_NODE}}(\_net, OID\_AUTO, graph, CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03258}03258     \textcolor{stringliteral}{"{}netgraph Family"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03259}\mbox{\hyperlink{ng__base_8c_a7cbddac62b26ec0bde6455ec2b1f79df}{03259}} \mbox{\hyperlink{ng__base_8c_a978f1fd0811c0aed12cf6c3c5d4a5b2b}{SYSCTL\_INT}}(\_net\_graph, OID\_AUTO, abi\_version, CTLFLAG\_RD, SYSCTL\_NULL\_INT\_PTR, \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}},\textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03260}\mbox{\hyperlink{ng__base_8c_ad98d291c8ca666cee56fe654a5922578}{03260}} \mbox{\hyperlink{ng__base_8c_a978f1fd0811c0aed12cf6c3c5d4a5b2b}{SYSCTL\_INT}}(\_net\_graph, OID\_AUTO, msg\_version, CTLFLAG\_RD, SYSCTL\_NULL\_INT\_PTR, \mbox{\hyperlink{ng__message_8h_a34630a5f9e316eae0b4c688a21424e97}{NG\_VERSION}}, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03261}03261 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03262}03262 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03263}03263 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03264}03264 dumphook (\mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{char} *file, \textcolor{keywordtype}{int} line)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03265}03265 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03266}03266         printf(\textcolor{stringliteral}{"{}hook: name \%s, \%d refs, Last touched:\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03267}03267                 \mbox{\hyperlink{netgraph_8h_a379c84100aa5d60855b83c858c100109}{\_NG\_HOOK\_NAME}}(hook), hook-\/>\mbox{\hyperlink{structng__hook_af63714658d050321cf7cb8402fbe6809}{hk\_refs}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03268}03268         printf(\textcolor{stringliteral}{"{}        Last active @ \%s, line \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03269}03269                 hook-\/>lastfile, hook-\/>lastline);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03270}03270         \textcolor{keywordflow}{if} (line) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03271}03271                 printf(\textcolor{stringliteral}{"{} problem discovered at file \%s, line \%d\(\backslash\)n"{}}, file, line);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03272}03272 \textcolor{preprocessor}{\#ifdef KDB}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03273}03273                 kdb\_backtrace();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03274}03274 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03275}03275         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03276}03276 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03277}03277 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03278}03278 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03279}03279 dumpnode(\mbox{\hyperlink{structng__node}{node\_p}} node, \textcolor{keywordtype}{char} *file, \textcolor{keywordtype}{int} line)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03280}03280 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03281}03281         printf(\textcolor{stringliteral}{"{}node: ID [\%x]: type '\%s', \%d hooks, flags 0x\%x, \%d refs, \%s:\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03282}03282                 \mbox{\hyperlink{netgraph_8h_a8891629674eac1b788bd06ac82560056}{\_NG\_NODE\_ID}}(node), node-\/>\mbox{\hyperlink{structng__node_a157d0f55d31fd35633f47f54011866d6}{nd\_type}}-\/>\mbox{\hyperlink{structng__type_a7be0a2326d841f2d3e347eb682eef992}{name}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03283}03283                 node-\/>\mbox{\hyperlink{structng__node_a55e56dfb6c3134af0533343b4d0be160}{nd\_numhooks}}, node-\/>\mbox{\hyperlink{structng__node_af3c113361b68278c4fbc309e2a6f97d2}{nd\_flags}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03284}03284                 node-\/>\mbox{\hyperlink{structng__node_a3c5445a7a1b01bbb5c8a4e09d9b6bd6e}{nd\_refs}}, node-\/>\mbox{\hyperlink{structng__node_a77d22883183afc7a1b1b9f2df4617b66}{nd\_name}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03285}03285         printf(\textcolor{stringliteral}{"{}        Last active @ \%s, line \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03286}03286                 node-\/>lastfile, node-\/>lastline);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03287}03287         \textcolor{keywordflow}{if} (line) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03288}03288                 printf(\textcolor{stringliteral}{"{} problem discovered at file \%s, line \%d\(\backslash\)n"{}}, file, line);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03289}03289 \textcolor{preprocessor}{\#ifdef KDB}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03290}03290                 kdb\_backtrace();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03291}03291 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03292}03292         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03293}03293 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03294}03294 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03295}03295 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03296}03296 dumpitem(\mbox{\hyperlink{structng__item}{item\_p}} item, \textcolor{keywordtype}{char} *file, \textcolor{keywordtype}{int} line)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03297}03297 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03298}03298         printf(\textcolor{stringliteral}{"{} ACTIVE item, last used at \%s, line \%d"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03299}03299                 item-\/>lastfile, item-\/>lastline);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03300}03300         \textcolor{keywordflow}{switch}(item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03301}03301         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03302}03302                 printf(\textcolor{stringliteral}{"{} -\/ [data]\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03303}03303                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03304}03304         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a9e3984d767a278bf9893ae7145a143a8}{NGQF\_MESG}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03305}03305                 printf(\textcolor{stringliteral}{"{} -\/ retaddr[\%d]:\(\backslash\)n"{}}, \mbox{\hyperlink{netgraph_8h_a03a96f057cc0cb02ddfd46ceb8e50d44}{\_NGI\_RETADDR}}(item));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03306}03306                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03307}03307         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_ad51ccd1f1dc08a7ba45702b1f40153b4}{NGQF\_FN}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03308}03308                 printf(\textcolor{stringliteral}{"{} -\/ fn@\%p (\%p, \%p, \%p, \%d (\%x))\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03309}03309                         \mbox{\hyperlink{netgraph_8h_ac66bfe0a988065efb377ce19e2293663}{\_NGI\_FN}}(item),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03310}03310                         \mbox{\hyperlink{netgraph_8h_a8c8312cc63f33d87013adef547ea9eea}{\_NGI\_NODE}}(item),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03311}03311                         \mbox{\hyperlink{netgraph_8h_a69acc1e755d9042f22d6f0c0ebb090e1}{\_NGI\_HOOK}}(item),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03312}03312                         item-\/>\mbox{\hyperlink{structng__item_a0f95481a742a5feba2d83c9c44c82a70}{body}}.\mbox{\hyperlink{structng__item_ac967d2318b8d858fc151c3737eebb40d}{fn}}.\mbox{\hyperlink{structng__item_a526eeb625196141aed13a09f81718338}{fn\_arg1}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03313}03313                         item-\/>\mbox{\hyperlink{structng__item_a0f95481a742a5feba2d83c9c44c82a70}{body}}.\mbox{\hyperlink{structng__item_ac967d2318b8d858fc151c3737eebb40d}{fn}}.\mbox{\hyperlink{structng__item_ab2b91c2d1fedf21f30b090134f45b284}{fn\_arg2}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03314}03314                         item-\/>\mbox{\hyperlink{structng__item_a0f95481a742a5feba2d83c9c44c82a70}{body}}.\mbox{\hyperlink{structng__item_ac967d2318b8d858fc151c3737eebb40d}{fn}}.\mbox{\hyperlink{structng__item_ab2b91c2d1fedf21f30b090134f45b284}{fn\_arg2}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03315}03315                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03316}03316         \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a7f371ec83585e8fefb12ac2402cafc2e}{NGQF\_FN2}}:}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03317}03317                 printf(\textcolor{stringliteral}{"{} -\/ fn2@\%p (\%p, \%p, \%p, \%d (\%x))\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03318}03318                         \mbox{\hyperlink{netgraph_8h_a7d3f45933f02b471126533aea46c66c9}{\_NGI\_FN2}}(item),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03319}03319                         \mbox{\hyperlink{netgraph_8h_a8c8312cc63f33d87013adef547ea9eea}{\_NGI\_NODE}}(item),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03320}03320                         \mbox{\hyperlink{netgraph_8h_a69acc1e755d9042f22d6f0c0ebb090e1}{\_NGI\_HOOK}}(item),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03321}03321                         item-\/>\mbox{\hyperlink{structng__item_a0f95481a742a5feba2d83c9c44c82a70}{body}}.\mbox{\hyperlink{structng__item_ac967d2318b8d858fc151c3737eebb40d}{fn}}.\mbox{\hyperlink{structng__item_a526eeb625196141aed13a09f81718338}{fn\_arg1}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03322}03322                         item-\/>\mbox{\hyperlink{structng__item_a0f95481a742a5feba2d83c9c44c82a70}{body}}.\mbox{\hyperlink{structng__item_ac967d2318b8d858fc151c3737eebb40d}{fn}}.\mbox{\hyperlink{structng__item_ab2b91c2d1fedf21f30b090134f45b284}{fn\_arg2}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03323}03323                         item-\/>\mbox{\hyperlink{structng__item_a0f95481a742a5feba2d83c9c44c82a70}{body}}.\mbox{\hyperlink{structng__item_ac967d2318b8d858fc151c3737eebb40d}{fn}}.\mbox{\hyperlink{structng__item_ab2b91c2d1fedf21f30b090134f45b284}{fn\_arg2}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03324}03324                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03325}03325         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03326}03326         \textcolor{keywordflow}{if} (line) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03327}03327                 printf(\textcolor{stringliteral}{"{} problem discovered at file \%s, line \%d\(\backslash\)n"{}}, file, line);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03328}03328                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_a8c8312cc63f33d87013adef547ea9eea}{\_NGI\_NODE}}(item)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03329}03329                         printf(\textcolor{stringliteral}{"{}node \%p ([\%x])\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03330}03330                                 \mbox{\hyperlink{netgraph_8h_a8c8312cc63f33d87013adef547ea9eea}{\_NGI\_NODE}}(item), \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(\mbox{\hyperlink{netgraph_8h_a8c8312cc63f33d87013adef547ea9eea}{\_NGI\_NODE}}(item)));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03331}03331                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03332}03332         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03333}03333 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03334}03334 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03335}03335 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03336}03336 ng\_dumpitems(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03337}03337 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03338}03338         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03339}03339         \textcolor{keywordtype}{int} i = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03340}03340         TAILQ\_FOREACH(item, \&ng\_itemlist, all) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03341}03341                 printf(\textcolor{stringliteral}{"{}[\%d] "{}}, i++);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03342}03342                 dumpitem(item, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03343}03343         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03344}03344 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03345}03345 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03346}03346 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03347}03347 ng\_dumpnodes(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03348}03348 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03349}03349         \mbox{\hyperlink{structng__node}{node\_p}} node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03350}03350         \textcolor{keywordtype}{int} i = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03351}03351         mtx\_lock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03352}03352         SLIST\_FOREACH(node, \&ng\_allnodes, nd\_all) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03353}03353                 printf(\textcolor{stringliteral}{"{}[\%d] "{}}, i++);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03354}03354                 dumpnode(node, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03355}03355         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03356}03356         mtx\_unlock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03357}03357 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03358}03358 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03359}03359 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03360}03360 ng\_dumphooks(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03361}03361 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03362}03362         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03363}03363         \textcolor{keywordtype}{int} i = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03364}03364         mtx\_lock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03365}03365         SLIST\_FOREACH(hook, \&ng\_allhooks, hk\_all) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03366}03366                 printf(\textcolor{stringliteral}{"{}[\%d] "{}}, i++);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03367}03367                 dumphook(hook, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03368}03368         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03369}03369         mtx\_unlock(\&ng\_nodelist\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03370}03370 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03371}03371 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03372}03372 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03373}03373 sysctl\_debug\_ng\_dump\_items(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03374}03374 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03375}03375         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03376}03376         \textcolor{keywordtype}{int} val;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03377}03377         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03378}03378 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03379}03379         val = allocated;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03380}03380         i = 1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03381}03381         error = sysctl\_handle\_int(oidp, \&val, 0, req);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03382}03382         \textcolor{keywordflow}{if} (error != 0 || req-\/>newptr == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03383}03383                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03384}03384         \textcolor{keywordflow}{if} (val == 42) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03385}03385                 ng\_dumpitems();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03386}03386                 ng\_dumpnodes();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03387}03387                 ng\_dumphooks();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03388}03388         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03389}03389         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03390}03390 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03391}03391 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03392}03392 \mbox{\hyperlink{ng__bluetooth_8c_ae5bba1ee2e61c652667edcf298148751}{SYSCTL\_PROC}}(\_debug, OID\_AUTO, ng\_dump\_items,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03393}03393     CTLTYPE\_INT | CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0, \textcolor{keyword}{sizeof}(\textcolor{keywordtype}{int}),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03394}03394     sysctl\_debug\_ng\_dump\_items, \textcolor{stringliteral}{"{}I"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03395}03395     \textcolor{stringliteral}{"{}Number of allocated items"{}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03396}03396 \textcolor{preprocessor}{\#endif  }\textcolor{comment}{/* NETGRAPH\_DEBUG */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03397}03397 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03398}03398 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03399}03399 \textcolor{comment}{* Worklist routines}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03400}03400 \textcolor{comment}{**********************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03401}03401 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03402}03402 \textcolor{comment}{ * Pick a node off the list of nodes with work,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03403}03403 \textcolor{comment}{ * try get an item to process off it. Remove the node from the list.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03404}03404 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03405}03405 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03406}\mbox{\hyperlink{ng__base_8c_a7d51ab82df99dad752e4dd859ced10ca}{03406}} \mbox{\hyperlink{ng__base_8c_a7d51ab82df99dad752e4dd859ced10ca}{ngthread}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03407}03407 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03408}03408         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03409}03409                 \textcolor{keyword}{struct }epoch\_tracker et;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03410}03410                 \mbox{\hyperlink{structng__node}{node\_p}}  node;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03411}03411 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03412}03412                 \textcolor{comment}{/* Get node from the worklist. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03413}03413                 \mbox{\hyperlink{ng__base_8c_aa0e6d07336fefe81da89e918280c0e94}{NG\_WORKLIST\_LOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03414}03414                 \textcolor{keywordflow}{while} ((node = STAILQ\_FIRST(\&ng\_worklist)) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03415}03415                         \mbox{\hyperlink{ng__base_8c_ae81040ecce1b13d8ff084d7da4fa4379}{NG\_WORKLIST\_SLEEP}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03416}03416                 STAILQ\_REMOVE\_HEAD(\&ng\_worklist, nd\_input\_queue.q\_work);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03417}03417                 \mbox{\hyperlink{ng__base_8c_aae51773935317f2811f55b60e94792a1}{NG\_WORKLIST\_UNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03418}03418                 CURVNET\_SET(node-\/>nd\_vnet);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03419}03419                 CTR3(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) taken off worklist"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03420}03420                     \_\_func\_\_, node-\/>nd\_ID, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03421}03421                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03422}03422 \textcolor{comment}{                 * We have the node. We also take over the reference}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03423}03423 \textcolor{comment}{                 * that the list had on it.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03424}03424 \textcolor{comment}{                 * Now process as much as you can, until it won't}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03425}03425 \textcolor{comment}{                 * let you have another item off the queue.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03426}03426 \textcolor{comment}{                 * All this time, keep the reference}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03427}03427 \textcolor{comment}{                 * that lets us be sure that the node still exists.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03428}03428 \textcolor{comment}{                 * Let the reference go at the last minute.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03429}03429 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03430}03430                 NET\_EPOCH\_ENTER(et);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03431}03431                 \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03432}03432                         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03433}03433                         \textcolor{keywordtype}{int} rw;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03434}03434 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03435}03435                         \mbox{\hyperlink{ng__base_8c_ad44d725964133ec727d4071d4faf23a1}{NG\_QUEUE\_LOCK}}(\&node-\/>nd\_input\_queue);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03436}03436                         item = \mbox{\hyperlink{ng__base_8c_a3071a7c84b79acd625c9009ab858aa5a}{ng\_dequeue}}(node, \&rw);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03437}03437                         \textcolor{keywordflow}{if} (item == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03438}03438                                 node-\/>nd\_input\_queue.q\_flags2 \&= \string~NGQ2\_WORKQ;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03439}03439                                 \mbox{\hyperlink{ng__base_8c_a31e37f4f425bc8027b90ed416cbdb02f}{NG\_QUEUE\_UNLOCK}}(\&node-\/>nd\_input\_queue);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03440}03440                                 \textcolor{keywordflow}{break}; \textcolor{comment}{/* go look for another node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03441}03441                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03442}03442                                 \mbox{\hyperlink{ng__base_8c_a31e37f4f425bc8027b90ed416cbdb02f}{NG\_QUEUE\_UNLOCK}}(\&node-\/>nd\_input\_queue);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03443}03443                                 \mbox{\hyperlink{netgraph_8h_a168fc2ed5239f5d498db599d0ef36db4}{NGI\_GET\_NODE}}(item, node); \textcolor{comment}{/* zaps stored node */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03444}03444                                 \mbox{\hyperlink{ng__base_8c_ab25445fc9c3b61a1a811723785c6a01d}{ng\_apply\_item}}(node, item, rw);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03445}03445                                 \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03446}03446                         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03447}03447                 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03448}03448                 NET\_EPOCH\_EXIT(et);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03449}03449                 \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03450}03450                 CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03451}03451         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03452}03452 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03453}03453 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03454}03454 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03455}03455 \textcolor{comment}{ * XXX}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03456}03456 \textcolor{comment}{ * It's possible that a debugging NG\_NODE\_REF may need}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03457}03457 \textcolor{comment}{ * to be outside the mutex zone}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03458}03458 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03459}03459 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03460}\mbox{\hyperlink{ng__base_8c_a9d715d2e185b01588e7a07fb218c1d22}{03460}} \mbox{\hyperlink{ng__base_8c_a9d715d2e185b01588e7a07fb218c1d22}{ng\_worklist\_add}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03461}03461 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03462}03462 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03463}03463         mtx\_assert(\&node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_af8931ff60a46e61cf4ae98af76d95621}{q\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03464}03464 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03465}03465         \textcolor{keywordflow}{if} ((node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_a194d8a41e050971fb50ab3cc7dc43fc4}{q\_flags2}} \& \mbox{\hyperlink{ng__base_8c_ab1201e0899217addc29a99b7e6b28491}{NGQ2\_WORKQ}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03466}03466                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03467}03467 \textcolor{comment}{                 * If we are not already on the work queue,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03468}03468 \textcolor{comment}{                 * then put us on.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03469}03469 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03470}03470                 node-\/>\mbox{\hyperlink{structng__node_ab3d6ec10fc34842838c3d91ff36f245b}{nd\_input\_queue}}.\mbox{\hyperlink{structng__queue_a194d8a41e050971fb50ab3cc7dc43fc4}{q\_flags2}} |= \mbox{\hyperlink{ng__base_8c_ab1201e0899217addc29a99b7e6b28491}{NGQ2\_WORKQ}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03471}03471                 \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node); \textcolor{comment}{/* XXX safe in mutex? */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03472}03472                 \mbox{\hyperlink{ng__base_8c_aa0e6d07336fefe81da89e918280c0e94}{NG\_WORKLIST\_LOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03473}03473                 STAILQ\_INSERT\_TAIL(\&ng\_worklist, node, nd\_input\_queue.q\_work);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03474}03474                 \mbox{\hyperlink{ng__base_8c_aae51773935317f2811f55b60e94792a1}{NG\_WORKLIST\_UNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03475}03475                 CTR3(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) put on worklist"{}}, \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03476}03476                     node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03477}03477                 \mbox{\hyperlink{ng__base_8c_abf30ac164b7896a4af963b53ee7a72ab}{NG\_WORKLIST\_WAKEUP}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03478}03478         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03479}03479                 CTR3(KTR\_NET, \textcolor{stringliteral}{"{}\%20s: node [\%x] (\%p) already on worklist"{}},}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03480}03480                     \_\_func\_\_, node-\/>\mbox{\hyperlink{structng__node_a36c6d6eb87594c229db7f0dabf43a8fc}{nd\_ID}}, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03481}03481         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03482}03482 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03483}03483 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03484}03484 \textcolor{comment}{/***********************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03485}03485 \textcolor{comment}{* Externally useable functions to set up a queue item ready for sending}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03486}03486 \textcolor{comment}{***********************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03487}03487 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03488}03488 \textcolor{preprocessor}{\#ifdef  NETGRAPH\_DEBUG}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03489}03489 \textcolor{preprocessor}{\#define ITEM\_DEBUG\_CHECKS                                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03490}03490 \textcolor{preprocessor}{        do \{                                                            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03491}03491 \textcolor{preprocessor}{                if (NGI\_NODE(item) ) \{                                  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03492}03492 \textcolor{preprocessor}{                        printf("{}item already has node"{}});                \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03493}03493                         kdb\_enter(KDB\_WHY\_NETGRAPH, "{}has node"{});        \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03494}03494                         NGI\_CLR\_NODE(item);                             \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03495}03495                 \}                                                       \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03496}03496                 if (NGI\_HOOK(item) ) \{                                  \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03497}03497                         printf("{}item already has hook"{});                \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03498}03498                         kdb\_enter(KDB\_WHY\_NETGRAPH, "{}has hook"{});        \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03499}03499                         NGI\_CLR\_HOOK(item);                             \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03500}03500                 \}                                                       \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03501}03501         \} while (0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03502}03502 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03503}\mbox{\hyperlink{ng__base_8c_afcb9f88e79319491cdef7f5a5e52926e}{03503}} \textcolor{preprocessor}{\#define ITEM\_DEBUG\_CHECKS}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03504}03504 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03505}03505 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03506}03506 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03507}03507 \textcolor{comment}{ * Put mbuf into the item.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03508}03508 \textcolor{comment}{ * Hook and node references will be removed when the item is dequeued.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03509}03509 \textcolor{comment}{ * (or equivalent)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03510}03510 \textcolor{comment}{ * (XXX) Unsafe because no reference held by peer on remote node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03511}03511 \textcolor{comment}{ * remote node might go away in this timescale.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03512}03512 \textcolor{comment}{ * We know the hooks can't go away because that would require getting}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03513}03513 \textcolor{comment}{ * a writer item on both nodes and we must have at least a  reader}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03514}03514 \textcolor{comment}{ * here to be able to do this.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03515}03515 \textcolor{comment}{ * Note that the hook loaded is the REMOTE hook.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03516}03516 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03517}03517 \textcolor{comment}{ * This is possibly in the critical path for new data.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03518}03518 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03519}03519 \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03520}\mbox{\hyperlink{netgraph_8h_a8af7a2701f1bafe727431b849e1137a5}{03520}} \mbox{\hyperlink{ng__base_8c_a8af7a2701f1bafe727431b849e1137a5}{ng\_package\_data}}(\textcolor{keyword}{struct} mbuf *m, \textcolor{keywordtype}{int} \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03521}03521 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03522}03522         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03523}03523 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03524}03524         \textcolor{keywordflow}{if} ((item = \mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{ng\_alloc\_item}}(\mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}}, \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})) == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03525}03525                 \mbox{\hyperlink{netgraph_8h_a2461bfcdc9e024484ed8037d386620e3}{NG\_FREE\_M}}(m);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03526}03526                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03527}03527         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03528}03528         \mbox{\hyperlink{ng__base_8c_afcb9f88e79319491cdef7f5a5e52926e}{ITEM\_DEBUG\_CHECKS}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03529}03529         item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} |= \mbox{\hyperlink{netgraph_8h_ac90bd5e2711fb95c74a980c868d20055}{NGQF\_READER}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03530}03530         \mbox{\hyperlink{netgraph_8h_a08cf471587aa844de10e9c3c1d7a8c28}{NGI\_M}}(item) = m;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03531}03531         \textcolor{keywordflow}{return} (item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03532}03532 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03533}03533 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03534}03534 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03535}03535 \textcolor{comment}{ * Allocate a queue item and put items into it..}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03536}03536 \textcolor{comment}{ * Evaluate the address as this will be needed to queue it and}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03537}03537 \textcolor{comment}{ * to work out what some of the fields should be.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03538}03538 \textcolor{comment}{ * Hook and node references will be removed when the item is dequeued.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03539}03539 \textcolor{comment}{ * (or equivalent)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03540}03540 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03541}03541 \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03542}\mbox{\hyperlink{netgraph_8h_abfc6b6f3a8376d39b3ac50861be8c933}{03542}} \mbox{\hyperlink{ng__base_8c_abfc6b6f3a8376d39b3ac50861be8c933}{ng\_package\_msg}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg, \textcolor{keywordtype}{int} \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03543}03543 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03544}03544         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03545}03545 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03546}03546         \textcolor{keywordflow}{if} ((item = \mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{ng\_alloc\_item}}(\mbox{\hyperlink{netgraph_8h_a9e3984d767a278bf9893ae7145a143a8}{NGQF\_MESG}}, \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})) == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03547}03547                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03548}03548                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03549}03549         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03550}03550         \mbox{\hyperlink{ng__base_8c_afcb9f88e79319491cdef7f5a5e52926e}{ITEM\_DEBUG\_CHECKS}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03551}03551         \textcolor{comment}{/* Messages items count as writers unless explicitly exempted. */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03552}03552         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} \& \mbox{\hyperlink{ng__message_8h_ab2c857f1265636d0ced413d173207240}{NGM\_READONLY}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03553}03553                 item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} |= \mbox{\hyperlink{netgraph_8h_ac90bd5e2711fb95c74a980c868d20055}{NGQF\_READER}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03554}03554         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03555}03555                 item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} |= \mbox{\hyperlink{netgraph_8h_a67a819fdd211467138c305a66cf53f8e}{NGQF\_WRITER}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03556}03556         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03557}03557 \textcolor{comment}{         * Set the current lasthook into the queue item}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03558}03558 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03559}03559         \mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item) = msg;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03560}03560         \mbox{\hyperlink{netgraph_8h_a5f4f927f601a420c5dfec90ceedbcbf2}{NGI\_RETADDR}}(item) = 0;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03561}03561         \textcolor{keywordflow}{return} (item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03562}03562 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03563}03563 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03564}\mbox{\hyperlink{ng__base_8c_a66184f2070ec90c5ebdb56d2b5476b31}{03564}} \textcolor{preprocessor}{\#define SET\_RETADDR(item, here, retaddr)                                \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03565}03565 \textcolor{preprocessor}{        do \{    }\textcolor{comment}{/* Data or fn items don't have retaddrs */}\textcolor{preprocessor}{              \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03566}03566 \textcolor{preprocessor}{                if ((item-\/>el\_flags \& NGQF\_TYPE) == NGQF\_MESG) \{        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03567}03567 \textcolor{preprocessor}{                        if (retaddr) \{                                  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03568}03568 \textcolor{preprocessor}{                                NGI\_RETADDR(item) = retaddr;            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03569}03569 \textcolor{preprocessor}{                        \} else \{                                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03570}03570 \textcolor{preprocessor}{                                }\textcolor{comment}{/*                                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03571}03571 \textcolor{comment}{                                 * The old return address should be ok. \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03572}03572 \textcolor{comment}{                                 * If there isn't one, use the address  \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03573}03573 \textcolor{comment}{                                 * here.                                \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03574}03574 \textcolor{comment}{                                 */}\textcolor{preprocessor}{                                     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03575}03575 \textcolor{preprocessor}{                                if (NGI\_RETADDR(item) == 0) \{           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03576}03576 \textcolor{preprocessor}{                                        NGI\_RETADDR(item)               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03577}03577 \textcolor{preprocessor}{                                                = ng\_node2ID(here);     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03578}03578 \textcolor{preprocessor}{                                \}                                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03579}03579 \textcolor{preprocessor}{                        \}                                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03580}\mbox{\hyperlink{netgraph_8h_ad326f03adb74b032a640fba11e11f32a}{03580}} \textcolor{preprocessor}{                \}                                                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03581}03581 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03582}03582 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03583}03583 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03584}03584 \mbox{\hyperlink{ng__base_8c_ad326f03adb74b032a640fba11e11f32a}{ng\_address\_hook}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}} retaddr)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03585}03585 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03586}03586         \mbox{\hyperlink{structng__hook}{hook\_p}} peer;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03587}03587         \mbox{\hyperlink{structng__node}{node\_p}} peernode;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03588}03588         \mbox{\hyperlink{ng__base_8c_afcb9f88e79319491cdef7f5a5e52926e}{ITEM\_DEBUG\_CHECKS}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03589}03589         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03590}03590 \textcolor{comment}{         * Quick sanity check..}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03591}03591 \textcolor{comment}{         * Since a hook holds a reference on its node, once we know}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03592}03592 \textcolor{comment}{         * that the peer is still connected (even if invalid,) we know}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03593}03593 \textcolor{comment}{         * that the peer node is present, though maybe invalid.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03594}03594 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03595}03595         \mbox{\hyperlink{ng__base_8c_ae5b87416a2b11accb2a7f3271b033b21}{TOPOLOGY\_RLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03596}03596         \textcolor{keywordflow}{if} ((hook == NULL) || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03597}03597             \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(peer = \mbox{\hyperlink{netgraph_8h_a74d793bf65c44f5732dbaf331d871681}{NG\_HOOK\_PEER}}(hook)) ||}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03598}03598             \mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(peernode = \mbox{\hyperlink{netgraph_8h_a2422a9fbdceb03a36586612af27100fb}{NG\_PEER\_NODE}}(hook))) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03599}03599                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03600}03600                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03601}03601                 \mbox{\hyperlink{ng__base_8c_ac1083cc6c0f464103baed3f28488e144}{TOPOLOGY\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03602}03602                 \textcolor{keywordflow}{return} (ENETDOWN);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03603}03603         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03604}03604 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03605}03605         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03606}03606 \textcolor{comment}{         * Transfer our interest to the other (peer) end.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03607}03607 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03608}03608         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(peer);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03609}03609         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(peernode);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03610}03610         \mbox{\hyperlink{netgraph_8h_a022a652da5adecfd757ff7b5906a9957}{NGI\_SET\_HOOK}}(item, peer);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03611}03611         \mbox{\hyperlink{netgraph_8h_a056ea0d487e2a735c8e628dd122a198f}{NGI\_SET\_NODE}}(item, peernode);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03612}03612         \mbox{\hyperlink{ng__base_8c_a66184f2070ec90c5ebdb56d2b5476b31}{SET\_RETADDR}}(item, here, retaddr);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03613}03613 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03614}03614         \mbox{\hyperlink{ng__base_8c_ac1083cc6c0f464103baed3f28488e144}{TOPOLOGY\_RUNLOCK}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03615}03615 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03616}\mbox{\hyperlink{netgraph_8h_a99f3f4510fac4f800574d9e2c8fdd724}{03616}}         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03617}03617 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03618}03618 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03619}03619 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03620}03620 \mbox{\hyperlink{ng__base_8c_a9df3bb7b2107cbc34cfa2eab38309340}{ng\_address\_path}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \mbox{\hyperlink{structng__item}{item\_p}} item, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_aae3c1824fe47b66db79327a8ae360e3b}{address}}, \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}} retaddr)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03621}03621 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03622}03622         \mbox{\hyperlink{structng__node}{node\_p}}    dest = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03623}03623         \mbox{\hyperlink{structng__hook}{hook\_p}}    hook = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03624}03624         \textcolor{keywordtype}{int}     error;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03625}03625 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03626}03626         \mbox{\hyperlink{ng__base_8c_afcb9f88e79319491cdef7f5a5e52926e}{ITEM\_DEBUG\_CHECKS}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03627}03627         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03628}03628 \textcolor{comment}{         * Note that ng\_path2noderef increments the reference count}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03629}03629 \textcolor{comment}{         * on the node for us if it finds one. So we don't have to.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03630}03630 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03631}03631         error = \mbox{\hyperlink{ng__base_8c_a4e328a30d6a99603f9b47e5e02e76178}{ng\_path2noderef}}(here, \mbox{\hyperlink{ng__btsocket__rfcomm_8h_aae3c1824fe47b66db79327a8ae360e3b}{address}}, \&dest, \&hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03632}03632         \textcolor{keywordflow}{if} (error) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03633}03633                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03634}03634                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03635}03635         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03636}03636         \mbox{\hyperlink{netgraph_8h_a056ea0d487e2a735c8e628dd122a198f}{NGI\_SET\_NODE}}(item, dest);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03637}03637         \textcolor{keywordflow}{if} (hook)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03638}03638                 \mbox{\hyperlink{netgraph_8h_a022a652da5adecfd757ff7b5906a9957}{NGI\_SET\_HOOK}}(item, hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03639}03639 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03640}03640         \mbox{\hyperlink{ng__base_8c_a66184f2070ec90c5ebdb56d2b5476b31}{SET\_RETADDR}}(item, here, retaddr);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03641}\mbox{\hyperlink{netgraph_8h_a8e57b12af3826877e69e5b33fde08669}{03641}}         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03642}03642 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03643}03643 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03644}03644 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03645}03645 \mbox{\hyperlink{ng__base_8c_a8e57b12af3826877e69e5b33fde08669}{ng\_address\_ID}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}} ID, \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}} retaddr)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03646}03646 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03647}03647         \mbox{\hyperlink{structng__node}{node\_p}} dest;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03648}03648 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03649}03649         \mbox{\hyperlink{ng__base_8c_afcb9f88e79319491cdef7f5a5e52926e}{ITEM\_DEBUG\_CHECKS}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03650}03650         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03651}03651 \textcolor{comment}{         * Find the target node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03652}03652 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03653}03653         dest = \mbox{\hyperlink{ng__base_8c_ab22a4b7ba7932993a29f6f9426d5ddda}{ng\_ID2noderef}}(ID); \textcolor{comment}{/* GETS REFERENCE! */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03654}03654         \textcolor{keywordflow}{if} (dest == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03655}03655                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03656}03656                 \mbox{\hyperlink{ng__base_8c_a2a4a3bd6732bb448a3188f0348527f3e}{TRAP\_ERROR}}();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03657}03657                 \textcolor{keywordflow}{return}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03658}03658         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03659}03659         \textcolor{comment}{/* Fill out the contents */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03660}03660         \mbox{\hyperlink{netgraph_8h_a056ea0d487e2a735c8e628dd122a198f}{NGI\_SET\_NODE}}(item, dest);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03661}03661         \mbox{\hyperlink{netgraph_8h_a9ff305a7e7c36c49e90b06891637d05f}{NGI\_CLR\_HOOK}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03662}03662         \mbox{\hyperlink{ng__base_8c_a66184f2070ec90c5ebdb56d2b5476b31}{SET\_RETADDR}}(item, here, retaddr);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03663}03663         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03664}03664 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03665}03665 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03666}03666 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03667}03667 \textcolor{comment}{ * special case to send a message to self (e.g. destroy node)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03668}\mbox{\hyperlink{netgraph_8h_a3bdb8387dae2e43142711433894d7740}{03668}} \textcolor{comment}{ * Possibly indicate an arrival hook too.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03669}03669 \textcolor{comment}{ * Useful for removing that hook :-\/)}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03670}03670 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03671}03671 \mbox{\hyperlink{structng__item}{item\_p}}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03672}03672 \mbox{\hyperlink{ng__base_8c_a3bdb8387dae2e43142711433894d7740}{ng\_package\_msg\_self}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03673}03673 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03674}03674         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03675}03675 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03676}03676         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03677}03677 \textcolor{comment}{         * Find the target node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03678}03678 \textcolor{comment}{         * If there is a HOOK argument, then use that in preference}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03679}03679 \textcolor{comment}{         * to the address.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03680}03680 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03681}03681         \textcolor{keywordflow}{if} ((item = \mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{ng\_alloc\_item}}(\mbox{\hyperlink{netgraph_8h_a9e3984d767a278bf9893ae7145a143a8}{NGQF\_MESG}}, \mbox{\hyperlink{netgraph_8h_a1c75827c8804a03bc15ada5001f5e985}{NG\_NOFLAGS}})) == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03682}03682                 \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03683}03683                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03684}03684         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03685}03685 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03686}03686         \textcolor{comment}{/* Fill out the contents */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03687}03687         item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} |= \mbox{\hyperlink{netgraph_8h_a67a819fdd211467138c305a66cf53f8e}{NGQF\_WRITER}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03688}03688         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(here);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03689}03689         \mbox{\hyperlink{netgraph_8h_a056ea0d487e2a735c8e628dd122a198f}{NGI\_SET\_NODE}}(item, here);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03690}03690         \textcolor{keywordflow}{if} (hook) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03691}03691                 \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03692}03692                 \mbox{\hyperlink{netgraph_8h_a022a652da5adecfd757ff7b5906a9957}{NGI\_SET\_HOOK}}(item, hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03693}03693         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03694}03694         \mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item) = msg;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03695}03695         \mbox{\hyperlink{netgraph_8h_a5f4f927f601a420c5dfec90ceedbcbf2}{NGI\_RETADDR}}(item) = \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(here);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03696}03696         \textcolor{keywordflow}{return} (item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03697}03697 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03698}03698 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03699}03699 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03700}\mbox{\hyperlink{netgraph_8h_abc5e657ef87b4ec66eceab40a5344831}{03700}} \textcolor{comment}{ * Send ng\_item\_fn function call to the specified node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03701}03701 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03702}03702 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03703}03703 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03704}03704 \mbox{\hyperlink{ng__base_8c_abc5e657ef87b4ec66eceab40a5344831}{ng\_send\_fn}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \mbox{\hyperlink{netgraph_8h_a73733a324ccf189ca16e284b19c0128c}{ng\_item\_fn}} *\mbox{\hyperlink{ng__ppp_8c_a355d89edd2d1ef1705ee8cdb3f3eca50}{fn}}, \textcolor{keywordtype}{void} * arg1, \textcolor{keywordtype}{int} arg2)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03705}03705 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03706}03706 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03707}\mbox{\hyperlink{netgraph_8h_a87dfc8b3dc4f97de3403646a1555e2d7}{03707}}         \textcolor{keywordflow}{return} \mbox{\hyperlink{ng__base_8c_a87dfc8b3dc4f97de3403646a1555e2d7}{ng\_send\_fn1}}(node, hook, \mbox{\hyperlink{ng__ppp_8c_a355d89edd2d1ef1705ee8cdb3f3eca50}{fn}}, arg1, arg2, \mbox{\hyperlink{netgraph_8h_a1c75827c8804a03bc15ada5001f5e985}{NG\_NOFLAGS}});}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03708}03708 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03709}03709 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03710}03710 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03711}03711 \mbox{\hyperlink{ng__base_8c_a87dfc8b3dc4f97de3403646a1555e2d7}{ng\_send\_fn1}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \mbox{\hyperlink{netgraph_8h_a73733a324ccf189ca16e284b19c0128c}{ng\_item\_fn}} *\mbox{\hyperlink{ng__ppp_8c_a355d89edd2d1ef1705ee8cdb3f3eca50}{fn}}, \textcolor{keywordtype}{void} * arg1, \textcolor{keywordtype}{int} arg2,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03712}03712         \textcolor{keywordtype}{int} \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03713}03713 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03714}03714         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03715}03715 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03716}03716         \textcolor{keywordflow}{if} ((item = \mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{ng\_alloc\_item}}(\mbox{\hyperlink{netgraph_8h_ad51ccd1f1dc08a7ba45702b1f40153b4}{NGQF\_FN}}, \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})) == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03717}03717                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03718}03718         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03719}03719         item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} |= \mbox{\hyperlink{netgraph_8h_a67a819fdd211467138c305a66cf53f8e}{NGQF\_WRITER}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03720}03720         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node); \textcolor{comment}{/* and one for the item */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03721}03721         \mbox{\hyperlink{netgraph_8h_a056ea0d487e2a735c8e628dd122a198f}{NGI\_SET\_NODE}}(item, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03722}03722         \textcolor{keywordflow}{if} (hook) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03723}03723                 \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03724}03724                 \mbox{\hyperlink{netgraph_8h_a022a652da5adecfd757ff7b5906a9957}{NGI\_SET\_HOOK}}(item, hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03725}03725         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03726}03726         \mbox{\hyperlink{netgraph_8h_a1e699611762d50d1a1128aa2ba34046b}{NGI\_FN}}(item) = \mbox{\hyperlink{ng__ppp_8c_a355d89edd2d1ef1705ee8cdb3f3eca50}{fn}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03727}03727         \mbox{\hyperlink{netgraph_8h_a0de706e5902f9465d04d1f46935665b6}{NGI\_ARG1}}(item) = arg1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03728}03728         \mbox{\hyperlink{netgraph_8h_a562a3d1e8b0d9278c48c07c855f9b711}{NGI\_ARG2}}(item) = arg2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03729}03729         \textcolor{keywordflow}{return}(\mbox{\hyperlink{ng__base_8c_a898d23f9c7a120c6d28ffb0d75b37db0}{ng\_snd\_item}}(item, \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03730}03730 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03731}03731 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03732}03732 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03733}03733 \textcolor{comment}{ * Send ng\_item\_fn2 function call to the specified node.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03734}03734 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03735}03735 \textcolor{comment}{ * If an optional pitem parameter is supplied, its apply}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03736}03736 \textcolor{comment}{ * callback will be copied to the new item. If also NG\_REUSE\_ITEM}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03737}\mbox{\hyperlink{netgraph_8h_ae6eed3e0eff8b28cfbf7eef24626df73}{03737}} \textcolor{comment}{ * flag is set, no new item will be allocated, but pitem will}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03738}03738 \textcolor{comment}{ * be used.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03739}03739 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03740}03740 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03741}03741 \mbox{\hyperlink{ng__base_8c_ae6eed3e0eff8b28cfbf7eef24626df73}{ng\_send\_fn2}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \mbox{\hyperlink{structng__item}{item\_p}} pitem, \mbox{\hyperlink{netgraph_8h_a12fd4e08cf92fdf3a4a638f6d1f03b16}{ng\_item\_fn2}} *\mbox{\hyperlink{ng__ppp_8c_a355d89edd2d1ef1705ee8cdb3f3eca50}{fn}}, \textcolor{keywordtype}{void} *arg1,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03742}03742         \textcolor{keywordtype}{int} arg2, \textcolor{keywordtype}{int} \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03743}03743 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03744}03744         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03745}03745 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03746}03746         KASSERT((pitem != NULL || (\mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}} \& \mbox{\hyperlink{netgraph_8h_a62719900a67b93f52470baf2cff3ed42}{NG\_REUSE\_ITEM}}) == 0),}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03747}03747             (\textcolor{stringliteral}{"{}\%s: NG\_REUSE\_ITEM but no pitem"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03748}03748 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03749}03749         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03750}03750 \textcolor{comment}{         * Allocate a new item if no supplied or}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03751}03751 \textcolor{comment}{         * if we can't use supplied one.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03752}03752 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03753}03753         \textcolor{keywordflow}{if} (pitem == NULL || (\mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}} \& \mbox{\hyperlink{netgraph_8h_a62719900a67b93f52470baf2cff3ed42}{NG\_REUSE\_ITEM}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03754}03754                 \textcolor{keywordflow}{if} ((item = \mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{ng\_alloc\_item}}(\mbox{\hyperlink{netgraph_8h_a7f371ec83585e8fefb12ac2402cafc2e}{NGQF\_FN2}}, \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03755}03755                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03756}03756                 \textcolor{keywordflow}{if} (pitem != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03757}03757                         item-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}} = pitem-\/>\mbox{\hyperlink{structng__item_a9e850efb67389297137997d604791fd3}{apply}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03758}03758         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03759}03759                 \textcolor{keywordflow}{if} ((item = \mbox{\hyperlink{ng__base_8c_a67dcf33286684352f689e3236f556ee9}{ng\_realloc\_item}}(pitem, \mbox{\hyperlink{netgraph_8h_a7f371ec83585e8fefb12ac2402cafc2e}{NGQF\_FN2}}, \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}})) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03760}03760                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03761}03761         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03762}03762 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03763}03763         item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} = (item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \string~NGQF\_RW) | \mbox{\hyperlink{netgraph_8h_a67a819fdd211467138c305a66cf53f8e}{NGQF\_WRITER}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03764}03764         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node); \textcolor{comment}{/* and one for the item */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03765}03765         \mbox{\hyperlink{netgraph_8h_a056ea0d487e2a735c8e628dd122a198f}{NGI\_SET\_NODE}}(item, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03766}03766         \textcolor{keywordflow}{if} (hook) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03767}03767                 \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03768}03768                 \mbox{\hyperlink{netgraph_8h_a022a652da5adecfd757ff7b5906a9957}{NGI\_SET\_HOOK}}(item, hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03769}03769         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03770}03770         \mbox{\hyperlink{netgraph_8h_a90ce7966244748e4028b0446b0f0332b}{NGI\_FN2}}(item) = \mbox{\hyperlink{ng__ppp_8c_a355d89edd2d1ef1705ee8cdb3f3eca50}{fn}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03771}03771         \mbox{\hyperlink{netgraph_8h_a0de706e5902f9465d04d1f46935665b6}{NGI\_ARG1}}(item) = arg1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03772}03772         \mbox{\hyperlink{netgraph_8h_a562a3d1e8b0d9278c48c07c855f9b711}{NGI\_ARG2}}(item) = arg2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03773}03773         \textcolor{keywordflow}{return}(\mbox{\hyperlink{ng__base_8c_a898d23f9c7a120c6d28ffb0d75b37db0}{ng\_snd\_item}}(item, \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}}));}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03774}03774 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03775}03775 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03776}\mbox{\hyperlink{ng__base_8c_a5f86f6fdebb77d28b6d39f1849633ced}{03776}} \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03777}03777 \textcolor{comment}{ * Official timeout routines for Netgraph nodes.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03778}03778 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03779}03779 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03780}03780 \mbox{\hyperlink{ng__base_8c_a5f86f6fdebb77d28b6d39f1849633ced}{ng\_callout\_trampoline}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03781}03781 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03782}03782         \textcolor{keyword}{struct }epoch\_tracker et;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03783}03783         \mbox{\hyperlink{structng__item}{item\_p}} item = arg;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03784}03784 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03785}03785         NET\_EPOCH\_ENTER(et);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03786}03786         CURVNET\_SET(\mbox{\hyperlink{netgraph_8h_a97b667178feea9a4527e2c7d9e7a0372}{NGI\_NODE}}(item)-\/>nd\_vnet);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03787}03787         \mbox{\hyperlink{ng__base_8c_a898d23f9c7a120c6d28ffb0d75b37db0}{ng\_snd\_item}}(item, 0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03788}03788         CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03789}\mbox{\hyperlink{netgraph_8h_aed70061429167aaa4b93a6129c959f0f}{03789}}         NET\_EPOCH\_EXIT(et);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03790}03790 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03791}03791 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03792}03792 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03793}03793 \mbox{\hyperlink{ng__base_8c_aed70061429167aaa4b93a6129c959f0f}{ng\_callout}}(\textcolor{keyword}{struct} callout *c, \mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{int} ticks,}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03794}03794     \mbox{\hyperlink{netgraph_8h_a73733a324ccf189ca16e284b19c0128c}{ng\_item\_fn}} *\mbox{\hyperlink{ng__ppp_8c_a355d89edd2d1ef1705ee8cdb3f3eca50}{fn}}, \textcolor{keywordtype}{void} * arg1, \textcolor{keywordtype}{int} arg2)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03795}03795 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03796}03796         \mbox{\hyperlink{structng__item}{item\_p}} item, oitem;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03797}03797 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03798}03798         \textcolor{keywordflow}{if} ((item = \mbox{\hyperlink{ng__base_8c_ae9ff5201c324ce509fac993ad532a606}{ng\_alloc\_item}}(\mbox{\hyperlink{netgraph_8h_ad51ccd1f1dc08a7ba45702b1f40153b4}{NGQF\_FN}}, \mbox{\hyperlink{netgraph_8h_a1c75827c8804a03bc15ada5001f5e985}{NG\_NOFLAGS}})) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03799}03799                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03800}03800 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03801}03801         item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} |= \mbox{\hyperlink{netgraph_8h_a67a819fdd211467138c305a66cf53f8e}{NGQF\_WRITER}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03802}03802         \mbox{\hyperlink{netgraph_8h_ae56ab867b81374fbf1a9f5d18228d49c}{NG\_NODE\_REF}}(node);           \textcolor{comment}{/* and one for the item */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03803}03803         \mbox{\hyperlink{netgraph_8h_a056ea0d487e2a735c8e628dd122a198f}{NGI\_SET\_NODE}}(item, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03804}03804         \textcolor{keywordflow}{if} (hook) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03805}03805                 \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03806}03806                 \mbox{\hyperlink{netgraph_8h_a022a652da5adecfd757ff7b5906a9957}{NGI\_SET\_HOOK}}(item, hook);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03807}03807         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03808}03808         \mbox{\hyperlink{netgraph_8h_a1e699611762d50d1a1128aa2ba34046b}{NGI\_FN}}(item) = \mbox{\hyperlink{ng__ppp_8c_a355d89edd2d1ef1705ee8cdb3f3eca50}{fn}};}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03809}03809         \mbox{\hyperlink{netgraph_8h_a0de706e5902f9465d04d1f46935665b6}{NGI\_ARG1}}(item) = arg1;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03810}03810         \mbox{\hyperlink{netgraph_8h_a562a3d1e8b0d9278c48c07c855f9b711}{NGI\_ARG2}}(item) = arg2;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03811}03811         oitem = c-\/>c\_arg;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03812}03812         \textcolor{keywordflow}{if} (callout\_reset(c, ticks, \&\mbox{\hyperlink{ng__base_8c_a5f86f6fdebb77d28b6d39f1849633ced}{ng\_callout\_trampoline}}, item) == 1 \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03813}03813             oitem != NULL)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03814}03814                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(oitem);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03815}03815         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03816}03816 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03817}03817 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03818}03818 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03819}03819 \textcolor{comment}{ * Free references and item if callout\_stop/callout\_drain returned 1,}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03820}\mbox{\hyperlink{ng__base_8c_aafd8677101f31ff6781f7eb61a233a42}{03820}} \textcolor{comment}{ * meaning that callout was successfully stopped and now references}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03821}03821 \textcolor{comment}{ * belong to us.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03822}03822 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03823}03823 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03824}03824 \mbox{\hyperlink{ng__base_8c_aafd8677101f31ff6781f7eb61a233a42}{ng\_uncallout\_internal}}(\textcolor{keyword}{struct} callout *c, \mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03825}03825 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03826}03826         \mbox{\hyperlink{structng__item}{item\_p}} item;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03827}03827 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03828}03828         item = c-\/>c\_arg;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03829}03829         \textcolor{keywordflow}{if} ((c-\/>c\_func == \&\mbox{\hyperlink{ng__base_8c_a5f86f6fdebb77d28b6d39f1849633ced}{ng\_callout\_trampoline}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03830}03830             (item != NULL) \&\& (\mbox{\hyperlink{netgraph_8h_a97b667178feea9a4527e2c7d9e7a0372}{NGI\_NODE}}(item) == node)) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03831}03831                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03832}03832 \textcolor{comment}{                 * We successfully removed it from the queue before it ran}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03833}03833 \textcolor{comment}{                 * So now we need to unreference everything that was}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03834}03834 \textcolor{comment}{                 * given extra references. (NG\_FREE\_ITEM does this).}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03835}03835 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03836}03836                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03837}03837         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03838}03838         c-\/>c\_arg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03839}03839 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03840}\mbox{\hyperlink{netgraph_8h_aabe13cf527f80501a761c71c9b4888db}{03840}} }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03841}03841 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03842}03842 \textcolor{comment}{/* A special modified version of callout\_stop() */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03843}03843 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03844}03844 \mbox{\hyperlink{ng__base_8c_aabe13cf527f80501a761c71c9b4888db}{ng\_uncallout}}(\textcolor{keyword}{struct} callout *c, \mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03845}03845 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03846}03846         \textcolor{keywordtype}{int} rval;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03847}03847 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03848}03848         rval = callout\_stop(c);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03849}03849         \textcolor{keywordflow}{if} (rval > 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03850}03850                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03851}03851 \textcolor{comment}{                 * XXXGL: in case if callout is already running and next}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03852}03852 \textcolor{comment}{                 * invocation is scheduled at the same time, callout\_stop()}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03853}03853 \textcolor{comment}{                 * returns 0. See d153eeee97d. In this case netgraph(4) would}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03854}03854 \textcolor{comment}{                 * leak resources. However, no nodes are known to induce such}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03855}03855 \textcolor{comment}{                 * behavior.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03856}03856 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03857}03857                 \mbox{\hyperlink{ng__base_8c_aafd8677101f31ff6781f7eb61a233a42}{ng\_uncallout\_internal}}(c, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03858}03858 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03859}03859         \textcolor{keywordflow}{return} (rval);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03860}\mbox{\hyperlink{netgraph_8h_a268be95aa6c288b75143dfa47874b036}{03860}} \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03861}03861 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03862}03862 \textcolor{comment}{/* A special modified version of callout\_drain() */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03863}03863 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03864}03864 \mbox{\hyperlink{ng__base_8c_a268be95aa6c288b75143dfa47874b036}{ng\_uncallout\_drain}}(\textcolor{keyword}{struct} callout *c, \mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03865}03865 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03866}03866         \textcolor{keywordtype}{int} rval;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03867}03867 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03868}03868         rval = callout\_drain(c);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03869}03869         \textcolor{keywordflow}{if} (rval > 0)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03870}03870                 \mbox{\hyperlink{ng__base_8c_aafd8677101f31ff6781f7eb61a233a42}{ng\_uncallout\_internal}}(c, node);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03871}03871 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03872}03872         \textcolor{keywordflow}{return} (rval);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03873}03873 \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03874}03874 }
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03875}\mbox{\hyperlink{netgraph_8h_aa1b48df317f644266b784ef22695373f}{03875}} \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03876}03876 \textcolor{comment}{ * Set the address, if none given, give the node here.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03877}03877 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03878}03878 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03879}03879 \mbox{\hyperlink{ng__base_8c_aa1b48df317f644266b784ef22695373f}{ng\_replace\_retaddr}}(\mbox{\hyperlink{structng__node}{node\_p}} here, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{ng__message_8h_aa187b4ec2a9994dc1dd8b06703b22d18}{ng\_ID\_t}} retaddr)}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03880}03880 \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03881}03881         \textcolor{keywordflow}{if} (retaddr) \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03882}03882                 \mbox{\hyperlink{netgraph_8h_a5f4f927f601a420c5dfec90ceedbcbf2}{NGI\_RETADDR}}(item) = retaddr;}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03883}03883         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03884}03884                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03885}03885 \textcolor{comment}{                 * The old return address should be ok.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03886}03886 \textcolor{comment}{                 * If there isn't one, use the address here.}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03887}03887 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03888}03888                 \mbox{\hyperlink{netgraph_8h_a5f4f927f601a420c5dfec90ceedbcbf2}{NGI\_RETADDR}}(item) = \mbox{\hyperlink{ng__base_8c_ac91f2c547b34db13ef98bb895defc729}{ng\_node2ID}}(here);}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03889}03889         \}}
\DoxyCodeLine{\Hypertarget{ng__base_8c_source_l03890}03890 \}}

\end{DoxyCode}
