\hypertarget{ng__hole_8c_source}{}\doxysection{ng\+\_\+hole.\+c}
\label{ng__hole_8c_source}\index{netgraph/ng\_hole.c@{netgraph/ng\_hole.c}}
\mbox{\hyperlink{ng__hole_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00002}00002 \textcolor{comment}{ * ng\_hole.c}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00003}00003 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00004}00004 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00005}00005 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 1996-\/1999 Whistle Communications, Inc.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00007}00007 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00008}00008 \textcolor{comment}{ * }}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00009}00009 \textcolor{comment}{ * Subject to the following obligations and disclaimer of warranty, use and}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00010}00010 \textcolor{comment}{ * redistribution of this software, in source or object code forms, with or}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00011}00011 \textcolor{comment}{ * without modifications are expressly permitted by Whistle Communications;}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00012}00012 \textcolor{comment}{ * provided, however, that:}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00013}00013 \textcolor{comment}{ * 1. Any and all reproductions of the source or object code must include the}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00014}00014 \textcolor{comment}{ *    copyright notice above and the following disclaimer of warranties; and}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00015}00015 \textcolor{comment}{ * 2. No rights are granted, in any manner or form, to use Whistle}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00016}00016 \textcolor{comment}{ *    Communications, Inc. trademarks, including the mark "{}WHISTLE}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00017}00017 \textcolor{comment}{ *    COMMUNICATIONS"{} on advertising, endorsements, or otherwise except as}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00018}00018 \textcolor{comment}{ *    such appears in the above copyright notice or in the software.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00019}00019 \textcolor{comment}{ * }}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00020}00020 \textcolor{comment}{ * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "{}AS IS"{}, AND}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00021}00021 \textcolor{comment}{ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00022}00022 \textcolor{comment}{ * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00023}00023 \textcolor{comment}{ * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00024}00024 \textcolor{comment}{ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-\/INFRINGEMENT.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00025}00025 \textcolor{comment}{ * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00026}00026 \textcolor{comment}{ * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00027}00027 \textcolor{comment}{ * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00028}00028 \textcolor{comment}{ * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00029}00029 \textcolor{comment}{ * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00030}00030 \textcolor{comment}{ * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00031}00031 \textcolor{comment}{ * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00032}00032 \textcolor{comment}{ * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00033}00033 \textcolor{comment}{ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00034}00034 \textcolor{comment}{ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00035}00035 \textcolor{comment}{ * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00036}00036 \textcolor{comment}{ * OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00037}00037 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00038}00038 \textcolor{comment}{ * Author: Julian Elisher <julian@freebsd.org>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00039}00039 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00040}00040 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00041}00041 \textcolor{comment}{ * \$Whistle: ng\_hole.c,v 1.10 1999/11/01 09:24:51 julian Exp \$}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00042}00042 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00044}00044 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00045}00045 \textcolor{comment}{ * This node is a 'black hole' that simply discards everything it receives}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00046}00046 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00047}00047 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00053}00053 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__message_8h}{netgraph/ng\_message.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{netgraph_8h}{netgraph/netgraph.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00055}00055 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__parse_8h}{netgraph/ng\_parse.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hole_8h}{netgraph/ng\_hole.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00057}00057 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00058}00058 \textcolor{comment}{/* Per hook private info. */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00059}\mbox{\hyperlink{structng__hole__hookinfo}{00059}} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__hole__hookinfo}{ng\_hole\_hookinfo}} \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00060}\mbox{\hyperlink{structng__hole__hookinfo_a257b5079410444be7b5d6ade876671b2}{00060}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__hole__hookstat}{ng\_hole\_hookstat}} \mbox{\hyperlink{structstats}{stats}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00061}00061 \};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00062}\mbox{\hyperlink{ng__hole_8c_a40fbf30f2b0906ef92fddd7be8cda873}{00062}} \textcolor{keyword}{typedef} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__hole__hookinfo}{ng\_hole\_hookinfo}} *\mbox{\hyperlink{ng__hole_8c_a40fbf30f2b0906ef92fddd7be8cda873}{hinfo\_p}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00063}00063 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00064}00064 \textcolor{comment}{/* Parse type for struct ng\_hole\_hookstat. */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00065}\mbox{\hyperlink{ng__hole_8c_a7bdf54a33ab8ac643176c2813fcd9f6c}{00065}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__struct__field}{ng\_parse\_struct\_field}} \mbox{\hyperlink{ng__hole_8c_a7bdf54a33ab8ac643176c2813fcd9f6c}{ng\_hole\_hookstat\_type\_fields}}[] =}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00066}00066         \mbox{\hyperlink{ng__hole_8h_a7f8c25f0ed5e22ae1e6b8a88bffa663e}{NG\_HOLE\_HOOKSTAT\_TYPE\_INFO}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00067}\mbox{\hyperlink{ng__hole_8c_aa4f22d47f02c635e34e070be99598fb5}{00067}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__hole_8c_aa4f22d47f02c635e34e070be99598fb5}{ng\_hole\_hookstat\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00068}00068         \&\mbox{\hyperlink{ng__parse_8c_aa8b7049fbd698972a3d2ce77dfd7d079}{ng\_parse\_struct\_type}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00069}00069         \&\mbox{\hyperlink{ng__hole_8c_a7bdf54a33ab8ac643176c2813fcd9f6c}{ng\_hole\_hookstat\_type\_fields}}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00070}00070 \};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00071}00071 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00072}00072 \textcolor{comment}{/* List of commands and how to convert arguments to/from ASCII. */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00073}\mbox{\hyperlink{ng__hole_8c_a8d293f7feea6e641134899e0df76b45a}{00073}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__cmdlist}{ng\_cmdlist}} \mbox{\hyperlink{ng__hole_8c_a8d293f7feea6e641134899e0df76b45a}{ng\_hole\_cmdlist}}[] = \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00074}00074         \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00075}00075           \mbox{\hyperlink{ng__hole_8h_a810508dd28d28902e29ce834720093af}{NGM\_HOLE\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00076}00076           \mbox{\hyperlink{ng__hole_8h_afa231099d07583c3ed0981e0bb665f55af985cfad120a1063aa6b03e3588e3f28}{NGM\_HOLE\_GET\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00077}00077           \textcolor{stringliteral}{"{}getstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00078}00078           \&\mbox{\hyperlink{ng__parse_8c_ac9eae8ccc783218af009d28e23672249}{ng\_parse\_hookbuf\_type}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00079}00079           \&\mbox{\hyperlink{ng__hole_8c_aa4f22d47f02c635e34e070be99598fb5}{ng\_hole\_hookstat\_type}}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00080}00080         \},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00081}00081         \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00082}00082           \mbox{\hyperlink{ng__hole_8h_a810508dd28d28902e29ce834720093af}{NGM\_HOLE\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00083}00083           \mbox{\hyperlink{ng__hole_8h_afa231099d07583c3ed0981e0bb665f55af1c38f091d7acf0678ffcc43f4b9c24c}{NGM\_HOLE\_CLR\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00084}00084           \textcolor{stringliteral}{"{}clrstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00085}00085           \&\mbox{\hyperlink{ng__parse_8c_ac9eae8ccc783218af009d28e23672249}{ng\_parse\_hookbuf\_type}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00086}00086           NULL}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00087}00087         \},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00088}00088         \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00089}00089           \mbox{\hyperlink{ng__hole_8h_a810508dd28d28902e29ce834720093af}{NGM\_HOLE\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00090}00090           \mbox{\hyperlink{ng__hole_8h_afa231099d07583c3ed0981e0bb665f55a4e12613e909135893d1a578defa05ba4}{NGM\_HOLE\_GETCLR\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00091}00091           \textcolor{stringliteral}{"{}getclrstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00092}00092           \&\mbox{\hyperlink{ng__parse_8c_ac9eae8ccc783218af009d28e23672249}{ng\_parse\_hookbuf\_type}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00093}00093           \&\mbox{\hyperlink{ng__hole_8c_aa4f22d47f02c635e34e070be99598fb5}{ng\_hole\_hookstat\_type}}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00094}00094         \},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00095}00095         \{ 0 \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00096}00096 \};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00097}00097 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00098}00098 \textcolor{comment}{/* Netgraph methods */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00099}\mbox{\hyperlink{ng__hole_8c_a453f6ef309cc67d73abac523f884769a}{00099}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_abb75b9ed2849e15851d6402d2ab5b899}{ng\_constructor\_t}} \mbox{\hyperlink{ng__hole_8c_a453f6ef309cc67d73abac523f884769a}{ngh\_cons}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00100}\mbox{\hyperlink{ng__hole_8c_a3611caa2010f57a3a4ae22e49ee3c851}{00100}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a47b860e2900386e775707cc1ae661162}{ng\_rcvmsg\_t}}   \mbox{\hyperlink{ng__hole_8c_a3611caa2010f57a3a4ae22e49ee3c851}{ngh\_rcvmsg}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00101}\mbox{\hyperlink{ng__hole_8c_ad74d92b62b50dad6f607f60047b718fe}{00101}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_afa50639df4ed6eb400f8220a890d56e6}{ng\_newhook\_t}} \mbox{\hyperlink{ng__hole_8c_ad74d92b62b50dad6f607f60047b718fe}{ngh\_newhook}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00102}\mbox{\hyperlink{ng__hole_8c_aa53ba825389e9a801801fc6a1b053ed4}{00102}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_aa87ef7415b345b801747ceaf99de6c43}{ng\_rcvdata\_t}} \mbox{\hyperlink{ng__hole_8c_aa53ba825389e9a801801fc6a1b053ed4}{ngh\_rcvdata}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00103}\mbox{\hyperlink{ng__hole_8c_a2be22530693a61552986a5925ec059d9}{00103}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a669e1783335f933b4a4f90f17d22f381}{ng\_disconnect\_t}}   \mbox{\hyperlink{ng__hole_8c_a2be22530693a61552986a5925ec059d9}{ngh\_disconnect}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00104}00104 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00105}\mbox{\hyperlink{ng__hole_8c_a80a131770518c7fa3758d85054006e7a}{00105}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} \mbox{\hyperlink{ng__hole_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}} = \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00106}00106         .\mbox{\hyperlink{structng__type_adbc1c8884ff0e625c19c4b513262fd0e}{version}} =       \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00107}00107         .name =         \mbox{\hyperlink{ng__hole_8h_a0002bf281aca47dd4dad057e8cbdf0fa}{NG\_HOLE\_NODE\_TYPE}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00108}00108         .constructor =  \mbox{\hyperlink{ng__hole_8c_a453f6ef309cc67d73abac523f884769a}{ngh\_cons}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00109}00109         .rcvmsg =       \mbox{\hyperlink{ng__hole_8c_a3611caa2010f57a3a4ae22e49ee3c851}{ngh\_rcvmsg}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00110}00110         .newhook =      \mbox{\hyperlink{ng__hole_8c_ad74d92b62b50dad6f607f60047b718fe}{ngh\_newhook}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00111}00111         .rcvdata =      \mbox{\hyperlink{ng__hole_8c_aa53ba825389e9a801801fc6a1b053ed4}{ngh\_rcvdata}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00112}00112         .disconnect =   \mbox{\hyperlink{ng__hole_8c_a2be22530693a61552986a5925ec059d9}{ngh\_disconnect}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00113}00113         .cmdlist =      \mbox{\hyperlink{ng__hole_8c_a8d293f7feea6e641134899e0df76b45a}{ng\_hole\_cmdlist}},}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00114}00114 \};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00115}\mbox{\hyperlink{ng__hole_8c_af2ad3206aaa34f1fc4324ade4cfbe53e}{00115}} \mbox{\hyperlink{ng__hole_8c_af2ad3206aaa34f1fc4324ade4cfbe53e}{NETGRAPH\_INIT}}(hole, \&\mbox{\hyperlink{ng__hole_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}});}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00116}00116 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00117}00117 \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00118}00118 \textcolor{comment}{ * Be obliging. but no work to do.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00119}00119 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00120}00120 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00121}\mbox{\hyperlink{ng__hole_8c_a5329adb5fe4b29e3b8f633ce6a3e606b}{00121}} \mbox{\hyperlink{ng__hole_8c_a453f6ef309cc67d73abac523f884769a}{ngh\_cons}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00122}00122 \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00123}00123         \textcolor{keywordflow}{return}(0);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00124}00124 \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00125}00125 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00126}00126 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00127}00127 \textcolor{comment}{ * Add a hook.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00128}00128 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00129}00129 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00130}\mbox{\hyperlink{ng__hole_8c_ad5e97de4336909ad1eaa08d460d04e48}{00130}} \mbox{\hyperlink{ng__hole_8c_ad74d92b62b50dad6f607f60047b718fe}{ngh\_newhook}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}})}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00131}00131 \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00132}00132         \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} hip;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00134}00134         \textcolor{comment}{/* Create hook private structure. */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00135}00135         hip = malloc(\textcolor{keyword}{sizeof}(*hip), M\_NETGRAPH, M\_NOWAIT | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00136}00136         \textcolor{keywordflow}{if} (hip == NULL)}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00137}00137                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00138}00138         \mbox{\hyperlink{netgraph_8h_a8167c04e701189ca4bc1bc3af5454ce6}{NG\_HOOK\_SET\_PRIVATE}}(hook, hip);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00139}00139         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00140}00140 \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00142}00142 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00143}00143 \textcolor{comment}{ * Receive a control message.}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00144}00144 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00145}00145 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00146}\mbox{\hyperlink{ng__hole_8c_a893317e6ca568c205e0dad005525d3d7}{00146}} \mbox{\hyperlink{ng__hole_8c_a3611caa2010f57a3a4ae22e49ee3c851}{ngh\_rcvmsg}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} lasthook)}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00147}00147 \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00148}00148         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00149}00149         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *resp = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00150}00150         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00151}00151         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__hole__hookstat}{ng\_hole\_hookstat}} *\mbox{\hyperlink{structstats}{stats}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00152}00152         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00153}00153 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00154}00154         \mbox{\hyperlink{netgraph_8h_adc9a04fd174ef3c29ecae94016b84839}{NGI\_GET\_MSG}}(item, msg);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00155}00155         \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_ab59e14593b69a406ed5ca4209d489a10}{typecookie}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00156}00156         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hole_8h_a810508dd28d28902e29ce834720093af}{NGM\_HOLE\_COOKIE}}:}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00157}00157                 \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00158}00158                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hole_8h_afa231099d07583c3ed0981e0bb665f55af985cfad120a1063aa6b03e3588e3f28}{NGM\_HOLE\_GET\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00159}00159                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hole_8h_afa231099d07583c3ed0981e0bb665f55af1c38f091d7acf0678ffcc43f4b9c24c}{NGM\_HOLE\_CLR\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00160}00160                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__hole_8h_afa231099d07583c3ed0981e0bb665f55a4e12613e909135893d1a578defa05ba4}{NGM\_HOLE\_GETCLR\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00161}00161                         \textcolor{comment}{/* Sanity check. */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00162}00162                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \mbox{\hyperlink{ng__message_8h_a2fadb5752a5c456671b0aea53179c2dd}{NG\_HOOKSIZ}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00163}00163                                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00164}00164                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00165}00165                         \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00166}00166                         \textcolor{comment}{/* Find hook. */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00167}00167                         hook = \mbox{\hyperlink{netgraph_8h_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(node, (\textcolor{keywordtype}{char} *)msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00168}00168                         \textcolor{keywordflow}{if} (hook == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00169}00169                                 error = ENOENT;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00170}00170                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00171}00171                         \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00172}00172                         \mbox{\hyperlink{structstats}{stats}} = \&((\mbox{\hyperlink{ng__hole_8c_a40fbf30f2b0906ef92fddd7be8cda873}{hinfo\_p}})\mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook))-\/>\mbox{\hyperlink{structstats}{stats}};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00173}00173                         \textcolor{comment}{/* Build response (if desired). */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00174}00174                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} != \mbox{\hyperlink{ng__hole_8h_afa231099d07583c3ed0981e0bb665f55af1c38f091d7acf0678ffcc43f4b9c24c}{NGM\_HOLE\_CLR\_STATS}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00175}00175                                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structstats}{stats}}),}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00176}00176                                     M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00177}00177                                 \textcolor{keywordflow}{if} (resp == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00178}00178                                         error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00179}00179                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00180}00180                                 \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00181}00181                                 bcopy(\mbox{\hyperlink{structstats}{stats}}, resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}, \textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structstats}{stats}}));}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00182}00182                         \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00183}00183                         \textcolor{comment}{/* Clear stats (if desired). */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00184}00184                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} != \mbox{\hyperlink{ng__hole_8h_afa231099d07583c3ed0981e0bb665f55af985cfad120a1063aa6b03e3588e3f28}{NGM\_HOLE\_GET\_STATS}})}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00185}00185                                 bzero(\mbox{\hyperlink{structstats}{stats}}, \textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structstats}{stats}}));}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00186}00186                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00187}00187                 \textcolor{keywordflow}{default}:                \textcolor{comment}{/* Unknown command. */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00188}00188                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00189}00189                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00190}00190                 \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00191}00191                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00192}00192         \textcolor{keywordflow}{default}:                        \textcolor{comment}{/* Unknown type cookie. */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00193}00193                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00194}00194                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00195}00195         \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00196}00196         \mbox{\hyperlink{netgraph_8h_a69db50ed7f968e936580df029ab5c5dc}{NG\_RESPOND\_MSG}}(error, node, item, resp);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00197}00197         \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00198}00198         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00199}00199 \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00200}00200 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00201}00201 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00202}00202 \textcolor{comment}{ * Receive data}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00203}00203 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00204}00204 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00205}\mbox{\hyperlink{ng__hole_8c_a56b9834ab12ace61a32fae566c4365c3}{00205}} \mbox{\hyperlink{ng__hole_8c_aa53ba825389e9a801801fc6a1b053ed4}{ngh\_rcvdata}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook, \mbox{\hyperlink{structng__item}{item\_p}} item)}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00206}00206 \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00207}00207         \textcolor{keyword}{const} \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} hip = \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00208}00208 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00209}00209         hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{stats}}.frames++;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00210}00210         hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{stats}}.octets += \mbox{\hyperlink{netgraph_8h_a08cf471587aa844de10e9c3c1d7a8c28}{NGI\_M}}(item)-\/>m\_pkthdr.len;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00211}00211         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00212}00212         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00213}00213 \}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00214}00214 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00215}00215 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00216}00216 \textcolor{comment}{ * Hook disconnection}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00217}00217 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00218}00218 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00219}\mbox{\hyperlink{ng__hole_8c_a5742bda169dc9970adacaffd9aff416b}{00219}} \mbox{\hyperlink{ng__hole_8c_a2be22530693a61552986a5925ec059d9}{ngh\_disconnect}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00220}00220 \{}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00221}00221 }
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00222}00222         free(\mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook), M\_NETGRAPH);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00223}00223         \mbox{\hyperlink{netgraph_8h_a8167c04e701189ca4bc1bc3af5454ce6}{NG\_HOOK\_SET\_PRIVATE}}(hook, NULL);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00224}00224         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_ad47e204c5b3adaddfa4bf0c380234f48}{NG\_NODE\_NUMHOOKS}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00225}00225                 \mbox{\hyperlink{netgraph_8h_a85914ce0da2b314478aaf7efcdcd3ff0}{ng\_rmnode\_self}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00226}00226         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hole_8c_source_l00227}00227 \}}

\end{DoxyCode}
