\hypertarget{ng__bpf_8c_source}{}\doxysection{ng\+\_\+bpf.\+c}
\label{ng__bpf_8c_source}\index{netgraph/ng\_bpf.c@{netgraph/ng\_bpf.c}}
\mbox{\hyperlink{ng__bpf_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00002}00002 \textcolor{comment}{ * ng\_bpf.c}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00003}00003 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00004}00004 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00005}00005 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 1999 Whistle Communications, Inc.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00007}00007 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00008}00008 \textcolor{comment}{ * }}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00009}00009 \textcolor{comment}{ * Subject to the following obligations and disclaimer of warranty, use and}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00010}00010 \textcolor{comment}{ * redistribution of this software, in source or object code forms, with or}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00011}00011 \textcolor{comment}{ * without modifications are expressly permitted by Whistle Communications;}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00012}00012 \textcolor{comment}{ * provided, however, that:}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00013}00013 \textcolor{comment}{ * 1. Any and all reproductions of the source or object code must include the}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00014}00014 \textcolor{comment}{ *    copyright notice above and the following disclaimer of warranties; and}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00015}00015 \textcolor{comment}{ * 2. No rights are granted, in any manner or form, to use Whistle}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00016}00016 \textcolor{comment}{ *    Communications, Inc. trademarks, including the mark "{}WHISTLE}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00017}00017 \textcolor{comment}{ *    COMMUNICATIONS"{} on advertising, endorsements, or otherwise except as}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00018}00018 \textcolor{comment}{ *    such appears in the above copyright notice or in the software.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00019}00019 \textcolor{comment}{ * }}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00020}00020 \textcolor{comment}{ * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "{}AS IS"{}, AND}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00021}00021 \textcolor{comment}{ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00022}00022 \textcolor{comment}{ * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00023}00023 \textcolor{comment}{ * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00024}00024 \textcolor{comment}{ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-\/INFRINGEMENT.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00025}00025 \textcolor{comment}{ * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00026}00026 \textcolor{comment}{ * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00027}00027 \textcolor{comment}{ * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00028}00028 \textcolor{comment}{ * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00029}00029 \textcolor{comment}{ * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00030}00030 \textcolor{comment}{ * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00031}00031 \textcolor{comment}{ * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00032}00032 \textcolor{comment}{ * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00033}00033 \textcolor{comment}{ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00034}00034 \textcolor{comment}{ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00035}00035 \textcolor{comment}{ * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00036}00036 \textcolor{comment}{ * OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00037}00037 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00038}00038 \textcolor{comment}{ * Author: Archie Cobbs <archie@freebsd.org>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00039}00039 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00040}00040 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00041}00041 \textcolor{comment}{ * \$Whistle: ng\_bpf.c,v 1.3 1999/12/03 20:30:23 archie Exp \$}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00042}00042 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00044}00044 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00045}00045 \textcolor{comment}{ * BPF NETGRAPH NODE TYPE}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00046}00046 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00047}00047 \textcolor{comment}{ * This node type accepts any number of hook connections.  With each hook}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00048}00048 \textcolor{comment}{ * is associated a bpf(4) filter program, and two hook names (each possibly}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00049}00049 \textcolor{comment}{ * the empty string).  Incoming packets are compared against the filter;}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00050}00050 \textcolor{comment}{ * matching packets are delivered out the first named hook (or dropped if}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00051}00051 \textcolor{comment}{ * the empty string), and non-\/matching packets are delivered out the second}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00052}00052 \textcolor{comment}{ * named hook (or dropped if the empty string).}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00053}00053 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00054}00054 \textcolor{comment}{ * Each hook also keeps statistics about how many packets have matched, etc.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00055}00055 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00056}00056 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00057}00057 \textcolor{preprocessor}{\#include "{}opt\_bpf.h"{}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00061}00061 \textcolor{preprocessor}{\#include <sys/errno.h>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00062}00062 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00063}00063 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00064}00064 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00066}00066 \textcolor{preprocessor}{\#include <net/bpf.h>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00067}00067 \textcolor{preprocessor}{\#ifdef BPF\_JITTER}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00068}00068 \textcolor{preprocessor}{\#include <net/bpf\_jitter.h>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00069}00069 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00071}00071 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__message_8h}{netgraph/ng\_message.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00072}00072 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{netgraph_8h}{netgraph/netgraph.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00073}00073 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__parse_8h}{netgraph/ng\_parse.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00074}00074 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__bpf_8h}{netgraph/ng\_bpf.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00075}00075 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00076}00076 \textcolor{preprocessor}{\#ifdef NG\_SEPARATE\_MALLOC}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00077}00077 \textcolor{keyword}{static} \mbox{\hyperlink{ng__ccatm_8c_ae738595abd0b2c23262b81953927d5f8}{MALLOC\_DEFINE}}(\mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}}, \textcolor{stringliteral}{"{}netgraph\_bpf"{}}, \textcolor{stringliteral}{"{}netgraph bpf node"{}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00078}00078 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00079}\mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{00079}} \textcolor{preprocessor}{\#define M\_NETGRAPH\_BPF M\_NETGRAPH}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00080}00080 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00082}\mbox{\hyperlink{ng__bpf_8c_aef34c7ae735fc1dcce6a222cc9252ab3}{00082}} \textcolor{preprocessor}{\#define OFFSETOF(s, e) ((char *)\&((s *)0)-\/>e -\/ (char *)((s *)0))}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00084}\mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{00084}} \textcolor{preprocessor}{\#define ERROUT(x)       do \{ error = (x); goto done; \} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00086}00086 \textcolor{comment}{/* Per hook private info */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00087}\mbox{\hyperlink{structng__bpf__hookinfo}{00087}} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookinfo}{ng\_bpf\_hookinfo}} \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00088}\mbox{\hyperlink{structng__bpf__hookinfo_a32f1a11b868db13a490c1446d498ef53}{00088}}         \mbox{\hyperlink{structng__hook}{hook\_p}}                    \mbox{\hyperlink{structng__bpf__hookinfo_a32f1a11b868db13a490c1446d498ef53}{hook}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00089}\mbox{\hyperlink{structng__bpf__hookinfo_ae04c91d581466c36a9d84eb37586a096}{00089}}         \mbox{\hyperlink{structng__hook}{hook\_p}}                    \mbox{\hyperlink{structng__bpf__hookinfo_ae04c91d581466c36a9d84eb37586a096}{match}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00090}\mbox{\hyperlink{structng__bpf__hookinfo_a6168d2ca2f76e84ef394a47829df5c95}{00090}}         \mbox{\hyperlink{structng__hook}{hook\_p}}                    \mbox{\hyperlink{structng__bpf__hookinfo_a6168d2ca2f76e84ef394a47829df5c95}{nomatch}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00091}\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{00091}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}}   *\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00092}00092 \textcolor{preprocessor}{\#ifdef BPF\_JITTER}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00093}00093         bpf\_jit\_filter          *jit\_prog;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00094}00094 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00095}\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{00095}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookstat}{ng\_bpf\_hookstat}}   \mbox{\hyperlink{structstats}{stats}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00096}00096 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00097}\mbox{\hyperlink{ng__bpf_8c_ad1ccef44f965fa9d77a1a99c47fb1e98}{00097}} \textcolor{keyword}{typedef} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookinfo}{ng\_bpf\_hookinfo}} *\mbox{\hyperlink{ng__bpf_8c_ad1ccef44f965fa9d77a1a99c47fb1e98}{hinfo\_p}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00098}00098 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00099}00099 \textcolor{comment}{/* Netgraph methods */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00100}\mbox{\hyperlink{ng__bpf_8c_adfb6ef0651eef2e9126ae3bf27d045c5}{00100}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_abb75b9ed2849e15851d6402d2ab5b899}{ng\_constructor\_t}} \mbox{\hyperlink{ng__bpf_8c_adfb6ef0651eef2e9126ae3bf27d045c5}{ng\_bpf\_constructor}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00101}\mbox{\hyperlink{ng__bpf_8c_afe23dc980481cb58a24717bbc5a2f233}{00101}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a47b860e2900386e775707cc1ae661162}{ng\_rcvmsg\_t}}   \mbox{\hyperlink{ng__bpf_8c_afe23dc980481cb58a24717bbc5a2f233}{ng\_bpf\_rcvmsg}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00102}\mbox{\hyperlink{ng__bpf_8c_a2f2d1edb50cf8eb1d351f09a45325a72}{00102}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_aab0a679789a1af312a7f856b4668ad74}{ng\_shutdown\_t}}       \mbox{\hyperlink{ng__bpf_8c_a2f2d1edb50cf8eb1d351f09a45325a72}{ng\_bpf\_shutdown}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00103}\mbox{\hyperlink{ng__bpf_8c_a6eac1ae0600e11b4c0d883f0e899a49f}{00103}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_afa50639df4ed6eb400f8220a890d56e6}{ng\_newhook\_t}} \mbox{\hyperlink{ng__bpf_8c_a6eac1ae0600e11b4c0d883f0e899a49f}{ng\_bpf\_newhook}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00104}\mbox{\hyperlink{ng__bpf_8c_afe8be7e285d2bcef9fb0b692a0e5ff0d}{00104}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_aa87ef7415b345b801747ceaf99de6c43}{ng\_rcvdata\_t}} \mbox{\hyperlink{ng__bpf_8c_afe8be7e285d2bcef9fb0b692a0e5ff0d}{ng\_bpf\_rcvdata}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00105}\mbox{\hyperlink{ng__bpf_8c_add793024eafd394774ff4805cb1828d0}{00105}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a669e1783335f933b4a4f90f17d22f381}{ng\_disconnect\_t}}   \mbox{\hyperlink{ng__bpf_8c_add793024eafd394774ff4805cb1828d0}{ng\_bpf\_disconnect}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00107}00107 \textcolor{comment}{/* Maximum bpf program instructions */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00108}00108 \textcolor{keyword}{extern} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__bpf_8c_ab18dfee80612346a1859ded7abee730f}{bpf\_maxinsns}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00110}00110 \textcolor{comment}{/* Internal helper functions */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00111}00111 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{ng__bpf_8c_a9394f1fbf40002629f373980d7ab0a7f}{ng\_bpf\_setprog}}(\mbox{\hyperlink{structng__hook}{hook\_p}} \mbox{\hyperlink{structng__bpf__hookinfo_a32f1a11b868db13a490c1446d498ef53}{hook}}, \textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} *hp);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00112}00112 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00113}00113 \textcolor{comment}{/* Parse type for one struct bfp\_insn */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00114}\mbox{\hyperlink{ng__bpf_8c_acecdd0bd9b33300907a8a66140d02e83}{00114}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__struct__field}{ng\_parse\_struct\_field}} \mbox{\hyperlink{ng__bpf_8c_acecdd0bd9b33300907a8a66140d02e83}{ng\_bpf\_insn\_type\_fields}}[] = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00115}00115         \{ \textcolor{stringliteral}{"{}code"{}},       \&\mbox{\hyperlink{ng__parse_8c_aeeb928df33d1ea4702549d3b4ce8bc0b}{ng\_parse\_hint16\_type}}       \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00116}00116         \{ \textcolor{stringliteral}{"{}jt"{}},         \&\mbox{\hyperlink{ng__parse_8c_ad9b579abf3953b9655aec194529ddc1d}{ng\_parse\_uint8\_type}} \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00117}00117         \{ \textcolor{stringliteral}{"{}jf"{}},         \&\mbox{\hyperlink{ng__parse_8c_ad9b579abf3953b9655aec194529ddc1d}{ng\_parse\_uint8\_type}} \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00118}00118         \{ \textcolor{stringliteral}{"{}k"{}},          \&\mbox{\hyperlink{ng__parse_8c_ac8ed58dbf4650a5ddc5bfd882e064519}{ng\_parse\_uint32\_type}}       \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00119}00119         \{ NULL \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00120}00120 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00121}\mbox{\hyperlink{ng__bpf_8c_a8f5dfd915223714b44afe2e5025cf1f0}{00121}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__bpf_8c_a8f5dfd915223714b44afe2e5025cf1f0}{ng\_bpf\_insn\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00122}00122         \&\mbox{\hyperlink{ng__parse_8c_aa8b7049fbd698972a3d2ce77dfd7d079}{ng\_parse\_struct\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00123}00123         \&\mbox{\hyperlink{ng__bpf_8c_acecdd0bd9b33300907a8a66140d02e83}{ng\_bpf\_insn\_type\_fields}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00124}00124 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00125}00125 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00126}00126 \textcolor{comment}{/* Parse type for the field 'bpf\_prog' in struct ng\_bpf\_hookprog */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00127}00127 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00128}\mbox{\hyperlink{ng__bpf_8c_a18cd39078e824aebc77d60a6fda27c53}{00128}} \mbox{\hyperlink{ng__bpf_8c_a18cd39078e824aebc77d60a6fda27c53}{ng\_bpf\_hookprogary\_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__bpf_8c_source_l00129}00129         \textcolor{keyword}{const} u\_char *start, \textcolor{keyword}{const} u\_char *buf)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00130}00130 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00131}00131         \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} *hp;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00132}00132 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00133}00133         hp = (\textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} *)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00134}00134             (buf -\/ \mbox{\hyperlink{ng__bpf_8c_aef34c7ae735fc1dcce6a222cc9252ab3}{OFFSETOF}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}}, \mbox{\hyperlink{structng__bpf__hookprog_ace8576b134f2326907f8ffc5bdd09f5c}{bpf\_prog}}));}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00135}00135         \textcolor{keywordflow}{return} hp-\/>\mbox{\hyperlink{structng__bpf__hookprog_a2013dadab510ed6cdbba254866fc8254}{bpf\_prog\_len}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00136}00136 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00137}00137 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00138}\mbox{\hyperlink{ng__bpf_8c_a63ee7d1de31aa024ba92997271252bdc}{00138}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__array__info}{ng\_parse\_array\_info}} \mbox{\hyperlink{ng__bpf_8c_a63ee7d1de31aa024ba92997271252bdc}{ng\_bpf\_hookprogary\_info}} = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00139}00139         \&\mbox{\hyperlink{ng__bpf_8c_a8f5dfd915223714b44afe2e5025cf1f0}{ng\_bpf\_insn\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00140}00140         \&\mbox{\hyperlink{ng__bpf_8c_a18cd39078e824aebc77d60a6fda27c53}{ng\_bpf\_hookprogary\_getLength}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00141}00141         NULL}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00142}00142 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00143}\mbox{\hyperlink{ng__bpf_8c_ac2dc4c59be00a8a65d89be5d9e2a11c4}{00143}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__bpf_8c_ac2dc4c59be00a8a65d89be5d9e2a11c4}{ng\_bpf\_hookprogary\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00144}00144         \&\mbox{\hyperlink{ng__parse_8c_a979248410eaad0c3e86262fe53840012}{ng\_parse\_array\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00145}00145         \&\mbox{\hyperlink{ng__bpf_8c_a63ee7d1de31aa024ba92997271252bdc}{ng\_bpf\_hookprogary\_info}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00146}00146 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00147}00147 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00148}00148 \textcolor{comment}{/* Parse type for struct ng\_bpf\_hookprog */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00149}\mbox{\hyperlink{ng__bpf_8c_aeae116f341f20db1a2cf4bc5f45610b7}{00149}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__struct__field}{ng\_parse\_struct\_field}} \mbox{\hyperlink{ng__bpf_8c_aeae116f341f20db1a2cf4bc5f45610b7}{ng\_bpf\_hookprog\_type\_fields}}[]}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00150}00150         = \mbox{\hyperlink{ng__bpf_8h_a3fd68be5e90c0ccd1cf607baebac7b5f}{NG\_BPF\_HOOKPROG\_TYPE\_INFO}}(\&\mbox{\hyperlink{ng__bpf_8c_ac2dc4c59be00a8a65d89be5d9e2a11c4}{ng\_bpf\_hookprogary\_type}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00151}\mbox{\hyperlink{ng__bpf_8c_ad784940f0980b36734ec02568154fe42}{00151}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__bpf_8c_ad784940f0980b36734ec02568154fe42}{ng\_bpf\_hookprog\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00152}00152         \&\mbox{\hyperlink{ng__parse_8c_aa8b7049fbd698972a3d2ce77dfd7d079}{ng\_parse\_struct\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00153}00153         \&\mbox{\hyperlink{ng__bpf_8c_aeae116f341f20db1a2cf4bc5f45610b7}{ng\_bpf\_hookprog\_type\_fields}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00154}00154 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00155}00155 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00156}00156 \textcolor{comment}{/* Parse type for struct ng\_bpf\_hookstat */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00157}\mbox{\hyperlink{ng__bpf_8c_a1dbff499e23850afdd5896665d311326}{00157}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__struct__field}{ng\_parse\_struct\_field}} \mbox{\hyperlink{ng__bpf_8c_a1dbff499e23850afdd5896665d311326}{ng\_bpf\_hookstat\_type\_fields}}[]}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00158}00158         = \mbox{\hyperlink{ng__bpf_8h_a21f384bb7a106bdf8218e8c0d14a3550}{NG\_BPF\_HOOKSTAT\_TYPE\_INFO}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00159}\mbox{\hyperlink{ng__bpf_8c_a9ff3ded6b6e9353adc60c1b1a43965d6}{00159}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__bpf_8c_a9ff3ded6b6e9353adc60c1b1a43965d6}{ng\_bpf\_hookstat\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00160}00160         \&\mbox{\hyperlink{ng__parse_8c_aa8b7049fbd698972a3d2ce77dfd7d079}{ng\_parse\_struct\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00161}00161         \&\mbox{\hyperlink{ng__bpf_8c_a1dbff499e23850afdd5896665d311326}{ng\_bpf\_hookstat\_type\_fields}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00162}00162 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00163}00163 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00164}00164 \textcolor{comment}{/* List of commands and how to convert arguments to/from ASCII */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00165}\mbox{\hyperlink{ng__bpf_8c_aee8a63826027f5efd4f9f3226a4327f5}{00165}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__cmdlist}{ng\_cmdlist}} \mbox{\hyperlink{ng__bpf_8c_aee8a63826027f5efd4f9f3226a4327f5}{ng\_bpf\_cmdlist}}[] = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00166}00166         \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00167}00167           \mbox{\hyperlink{ng__bpf_8h_aeb582eebbb45129e1f863c181c0bd16c}{NGM\_BPF\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00168}00168           \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fabebd4457e9715fbc2c3e5b4be5006f4d}{NGM\_BPF\_SET\_PROGRAM}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00169}00169           \textcolor{stringliteral}{"{}setprogram"{}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00170}00170           \&\mbox{\hyperlink{ng__bpf_8c_ad784940f0980b36734ec02568154fe42}{ng\_bpf\_hookprog\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00171}00171           NULL}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00172}00172         \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00173}00173         \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00174}00174           \mbox{\hyperlink{ng__bpf_8h_aeb582eebbb45129e1f863c181c0bd16c}{NGM\_BPF\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00175}00175           \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fa13fb7d6a688b1971aef2935ae5a59860}{NGM\_BPF\_GET\_PROGRAM}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00176}00176           \textcolor{stringliteral}{"{}getprogram"{}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00177}00177           \&\mbox{\hyperlink{ng__parse_8c_ac9eae8ccc783218af009d28e23672249}{ng\_parse\_hookbuf\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00178}00178           \&\mbox{\hyperlink{ng__bpf_8c_ad784940f0980b36734ec02568154fe42}{ng\_bpf\_hookprog\_type}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00179}00179         \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00180}00180         \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00181}00181           \mbox{\hyperlink{ng__bpf_8h_aeb582eebbb45129e1f863c181c0bd16c}{NGM\_BPF\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00182}00182           \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fa91ef58cd3206e2bfab473ac0f2e2d959}{NGM\_BPF\_GET\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00183}00183           \textcolor{stringliteral}{"{}getstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00184}00184           \&\mbox{\hyperlink{ng__parse_8c_ac9eae8ccc783218af009d28e23672249}{ng\_parse\_hookbuf\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00185}00185           \&\mbox{\hyperlink{ng__bpf_8c_a9ff3ded6b6e9353adc60c1b1a43965d6}{ng\_bpf\_hookstat\_type}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00186}00186         \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00187}00187         \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00188}00188           \mbox{\hyperlink{ng__bpf_8h_aeb582eebbb45129e1f863c181c0bd16c}{NGM\_BPF\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00189}00189           \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fae6f295d37c89700cee8c8775c9be765f}{NGM\_BPF\_CLR\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00190}00190           \textcolor{stringliteral}{"{}clrstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00191}00191           \&\mbox{\hyperlink{ng__parse_8c_ac9eae8ccc783218af009d28e23672249}{ng\_parse\_hookbuf\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00192}00192           NULL}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00193}00193         \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00194}00194         \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00195}00195           \mbox{\hyperlink{ng__bpf_8h_aeb582eebbb45129e1f863c181c0bd16c}{NGM\_BPF\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00196}00196           \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fae1c94a1b0c8431bb2f272457d077eef8}{NGM\_BPF\_GETCLR\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00197}00197           \textcolor{stringliteral}{"{}getclrstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00198}00198           \&\mbox{\hyperlink{ng__parse_8c_ac9eae8ccc783218af009d28e23672249}{ng\_parse\_hookbuf\_type}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00199}00199           \&\mbox{\hyperlink{ng__bpf_8c_a9ff3ded6b6e9353adc60c1b1a43965d6}{ng\_bpf\_hookstat\_type}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00200}00200         \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00201}00201         \{ 0 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00202}00202 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00203}00203 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00204}00204 \textcolor{comment}{/* Netgraph type descriptor */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00205}\mbox{\hyperlink{ng__bpf_8c_a80a131770518c7fa3758d85054006e7a}{00205}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} \mbox{\hyperlink{ng__bpf_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}} = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00206}00206         .\mbox{\hyperlink{structng__type_adbc1c8884ff0e625c19c4b513262fd0e}{version}} =       \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00207}00207         .name =         \mbox{\hyperlink{ng__bpf_8h_aae7fc69a31ff5ed5efa347ef4603328d}{NG\_BPF\_NODE\_TYPE}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00208}00208         .constructor =  \mbox{\hyperlink{ng__bpf_8c_adfb6ef0651eef2e9126ae3bf27d045c5}{ng\_bpf\_constructor}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00209}00209         .rcvmsg =       \mbox{\hyperlink{ng__bpf_8c_afe23dc980481cb58a24717bbc5a2f233}{ng\_bpf\_rcvmsg}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00210}00210         .shutdown =     \mbox{\hyperlink{ng__bpf_8c_a2f2d1edb50cf8eb1d351f09a45325a72}{ng\_bpf\_shutdown}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00211}00211         .newhook =      \mbox{\hyperlink{ng__bpf_8c_a6eac1ae0600e11b4c0d883f0e899a49f}{ng\_bpf\_newhook}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00212}00212         .rcvdata =      \mbox{\hyperlink{ng__bpf_8c_afe8be7e285d2bcef9fb0b692a0e5ff0d}{ng\_bpf\_rcvdata}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00213}00213         .disconnect =   \mbox{\hyperlink{ng__bpf_8c_add793024eafd394774ff4805cb1828d0}{ng\_bpf\_disconnect}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00214}00214         .cmdlist =      \mbox{\hyperlink{ng__bpf_8c_aee8a63826027f5efd4f9f3226a4327f5}{ng\_bpf\_cmdlist}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00215}00215 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00216}\mbox{\hyperlink{ng__bpf_8c_a9302d6701326dd81c5aa166c0417f16e}{00216}} \mbox{\hyperlink{ng__bpf_8c_a9302d6701326dd81c5aa166c0417f16e}{NETGRAPH\_INIT}}(bpf, \&\mbox{\hyperlink{ng__bpf_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00217}00217 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00218}00218 \textcolor{comment}{/* Default BPF program for a hook that matches nothing */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00219}\mbox{\hyperlink{ng__bpf_8c_accec94ef83fa333088f6c4df456c0c2a}{00219}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} \mbox{\hyperlink{ng__bpf_8c_accec94ef83fa333088f6c4df456c0c2a}{ng\_bpf\_default\_prog}} = \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00220}00220         \{ \textcolor{charliteral}{'\(\backslash\)0'} \},               \textcolor{comment}{/* to be filled in at hook creation time */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00221}00221         \{ \textcolor{charliteral}{'\(\backslash\)0'} \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00222}00222         \{ \textcolor{charliteral}{'\(\backslash\)0'} \},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00223}00223         1,}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00224}00224         \{ BPF\_STMT(BPF\_RET+BPF\_K, 0) \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00225}00225 \};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00226}00226 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00227}00227 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00228}00228 \textcolor{comment}{ * Node constructor}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00229}00229 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00230}00230 \textcolor{comment}{ * We don't keep any per-\/node private data}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00231}00231 \textcolor{comment}{ * We go via the hooks.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00232}00232 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00233}00233 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00234}\mbox{\hyperlink{ng__bpf_8c_a9180009c76cde59664562591c251b71d}{00234}} \mbox{\hyperlink{ng__bpf_8c_adfb6ef0651eef2e9126ae3bf27d045c5}{ng\_bpf\_constructor}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00235}00235 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00236}00236         \mbox{\hyperlink{netgraph_8h_a674a9dcfdef6a73d16cccde37234f470}{NG\_NODE\_SET\_PRIVATE}}(node, NULL);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00237}00237         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00238}00238 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00239}00239 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00240}00240 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00241}00241 \textcolor{comment}{ * Callback functions to be used by NG\_NODE\_FOREACH\_HOOK() macro.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00242}00242 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00243}00243 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00244}\mbox{\hyperlink{ng__bpf_8c_a8833ea8a574135a7b3b029d04fb28ae5}{00244}} \mbox{\hyperlink{ng__bpf_8c_a8833ea8a574135a7b3b029d04fb28ae5}{ng\_bpf\_addrefs}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{void}* arg)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00245}00245 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00246}00246         \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} hip = \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00247}00247         \mbox{\hyperlink{structng__hook}{hook\_p}} h = (\mbox{\hyperlink{netgraph_8h_ab3a2553a36b03752ec05a6d4ca11d8a3}{hook\_p}})arg;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00248}00248 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00249}00249         \textcolor{keywordflow}{if} (strcmp(hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}-\/>\mbox{\hyperlink{structng__bpf__hookprog_a05104024916138f07fae477ea0a3ad3d}{ifMatch}}, \mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(h)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00250}00250             hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_ae04c91d581466c36a9d84eb37586a096}{match}} = h;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00251}00251         if (strcmp(hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}-\/>\mbox{\hyperlink{structng__bpf__hookprog_a13beed3f12a3d3c8ae63d57e1b6506a2}{ifNotMatch}}, \mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(h)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00252}00252             hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a6168d2ca2f76e84ef394a47829df5c95}{nomatch}} = h;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00253}00253         return (1);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00254}00254 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00255}00255 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00256}00256 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00257}\mbox{\hyperlink{ng__bpf_8c_a3d21d55a3a864b98e38125308a5dd41e}{00257}} \mbox{\hyperlink{ng__bpf_8c_a3d21d55a3a864b98e38125308a5dd41e}{ng\_bpf\_remrefs}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{void}* arg)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00258}00258 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00259}00259         \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} hip = \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00260}00260         \mbox{\hyperlink{structng__hook}{hook\_p}} h = (\mbox{\hyperlink{netgraph_8h_ab3a2553a36b03752ec05a6d4ca11d8a3}{hook\_p}})arg;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00261}00261 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00262}00262         \textcolor{keywordflow}{if} (hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_ae04c91d581466c36a9d84eb37586a096}{match}} == h)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00263}00263             hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_ae04c91d581466c36a9d84eb37586a096}{match}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00264}00264         \textcolor{keywordflow}{if} (hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a6168d2ca2f76e84ef394a47829df5c95}{nomatch}} == h)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00265}00265             hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a6168d2ca2f76e84ef394a47829df5c95}{nomatch}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00266}00266         \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00267}00267 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00268}00268 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00269}00269 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00270}00270 \textcolor{comment}{ * Add a hook}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00271}00271 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00272}00272 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00273}\mbox{\hyperlink{ng__bpf_8c_a10cf6e05934ee5018d5850a467c8e104}{00273}} \mbox{\hyperlink{ng__bpf_8c_a6eac1ae0600e11b4c0d883f0e899a49f}{ng\_bpf\_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__bpf_8c_source_l00274}00274 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00275}00275         \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} hip;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00276}00276         \mbox{\hyperlink{structng__hook}{hook\_p}} tmp;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00277}00277         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00278}00278 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00279}00279         \textcolor{comment}{/* Create hook private structure */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00280}00280         hip = malloc(\textcolor{keyword}{sizeof}(*hip), \mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}}, M\_NOWAIT | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00281}00281         \textcolor{keywordflow}{if} (hip == NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00282}00282                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00283}00283         hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a32f1a11b868db13a490c1446d498ef53}{hook}} = hook;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00284}00284         \mbox{\hyperlink{netgraph_8h_a8167c04e701189ca4bc1bc3af5454ce6}{NG\_HOOK\_SET\_PRIVATE}}(hook, hip);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00285}00285 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00286}00286         \textcolor{comment}{/* Add our reference into other hooks data. */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00287}00287         \mbox{\hyperlink{netgraph_8h_a3336b8c73262860d1727ccc49c7cd9e6}{NG\_NODE\_FOREACH\_HOOK}}(node, \mbox{\hyperlink{ng__bpf_8c_a8833ea8a574135a7b3b029d04fb28ae5}{ng\_bpf\_addrefs}}, hook, tmp);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00288}00288 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00289}00289         \textcolor{comment}{/* Attach the default BPF program */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00290}00290         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__bpf_8c_a9394f1fbf40002629f373980d7ab0a7f}{ng\_bpf\_setprog}}(hook, \&\mbox{\hyperlink{ng__bpf_8c_accec94ef83fa333088f6c4df456c0c2a}{ng\_bpf\_default\_prog}})) != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00291}00291                 free(hip, \mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00292}00292                 \mbox{\hyperlink{netgraph_8h_a8167c04e701189ca4bc1bc3af5454ce6}{NG\_HOOK\_SET\_PRIVATE}}(hook, NULL);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00293}00293                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00294}00294         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00295}00295 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00296}00296         \textcolor{comment}{/* Set hook name */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00297}00297         strlcpy(hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}-\/>\mbox{\hyperlink{structng__bpf__hookprog_ac7d0d3b2a8f4791ea1ce3295e4c3e3d3}{thisHook}}, \mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \textcolor{keyword}{sizeof}(hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}-\/>\mbox{\hyperlink{structng__bpf__hookprog_ac7d0d3b2a8f4791ea1ce3295e4c3e3d3}{thisHook}}));}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00298}00298         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00299}00299 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00300}00300 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00301}00301 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00302}00302 \textcolor{comment}{ * Receive a control message}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00303}00303 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00304}00304 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00305}\mbox{\hyperlink{ng__bpf_8c_a9bdc9ce3519e5f0db7f45413726ac0f3}{00305}} \mbox{\hyperlink{ng__bpf_8c_afe23dc980481cb58a24717bbc5a2f233}{ng\_bpf\_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__bpf_8c_source_l00306}00306 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00307}00307         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00308}00308         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *resp = NULL;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00309}00309         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00310}00310 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00311}00311         \mbox{\hyperlink{netgraph_8h_adc9a04fd174ef3c29ecae94016b84839}{NGI\_GET\_MSG}}(item, msg);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00312}00312         \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_ab59e14593b69a406ed5ca4209d489a10}{typecookie}}) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00313}00313         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__bpf_8h_aeb582eebbb45129e1f863c181c0bd16c}{NGM\_BPF\_COOKIE}}:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00314}00314                 \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}}) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00315}00315                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fabebd4457e9715fbc2c3e5b4be5006f4d}{NGM\_BPF\_SET\_PROGRAM}}:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00316}00316                     \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00317}00317                         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} *\textcolor{keyword}{const}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00318}00318                             hp = (\textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} *)msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00319}00319                         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00320}00320 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00321}00321                         \textcolor{comment}{/* Sanity check */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00322}00322                         if (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} < \textcolor{keyword}{sizeof}(*hp)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00323}00323                             || msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00324}00324                               != \mbox{\hyperlink{ng__bpf_8h_ac719ffd21e2e1a5c26b5ad7814ee1f34}{NG\_BPF\_HOOKPROG\_SIZE}}(hp-\/>\mbox{\hyperlink{structng__bpf__hookprog_a2013dadab510ed6cdbba254866fc8254}{bpf\_prog\_len}}))}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00325}00325                                 \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00326}00326 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00327}00327                         \textcolor{comment}{/* Find hook */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00328}00328                         \textcolor{keywordflow}{if} ((hook = \mbox{\hyperlink{netgraph_8h_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(node, hp-\/>\mbox{\hyperlink{structng__bpf__hookprog_ac7d0d3b2a8f4791ea1ce3295e4c3e3d3}{thisHook}})) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00329}00329                                 \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00330}00330 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00331}00331                         \textcolor{comment}{/* Set new program */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00332}00332                         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{ng__bpf_8c_a9394f1fbf40002629f373980d7ab0a7f}{ng\_bpf\_setprog}}(hook, hp)) != 0)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00333}00333                                 \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(error);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00334}00334                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00335}00335                     \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00336}00336 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00337}00337                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fa13fb7d6a688b1971aef2935ae5a59860}{NGM\_BPF\_GET\_PROGRAM}}:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00338}00338                     \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00339}00339                         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} *hp;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00340}00340                         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00341}00341 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00342}00342                         \textcolor{comment}{/* Sanity check */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00343}00343                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} == 0)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00344}00344                                 \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00345}00345                         msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}[msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00346}00346 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00347}00347                         \textcolor{comment}{/* Find hook */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00348}00348                         \textcolor{keywordflow}{if} ((hook = \mbox{\hyperlink{netgraph_8h_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(node, msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}})) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00349}00349                                 \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00350}00350 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00351}00351                         \textcolor{comment}{/* Build response */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00352}00352                         hp = ((\mbox{\hyperlink{ng__bpf_8c_ad1ccef44f965fa9d77a1a99c47fb1e98}{hinfo\_p}})\mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook))-\/>prog;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00353}00353                         \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg,}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00354}00354                             \mbox{\hyperlink{ng__bpf_8h_ac719ffd21e2e1a5c26b5ad7814ee1f34}{NG\_BPF\_HOOKPROG\_SIZE}}(hp-\/>\mbox{\hyperlink{structng__bpf__hookprog_a2013dadab510ed6cdbba254866fc8254}{bpf\_prog\_len}}), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00355}00355                         \textcolor{keywordflow}{if} (resp == NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00356}00356                                 \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00357}00357                         bcopy(hp, resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}},}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00358}00358                            \mbox{\hyperlink{ng__bpf_8h_ac719ffd21e2e1a5c26b5ad7814ee1f34}{NG\_BPF\_HOOKPROG\_SIZE}}(hp-\/>\mbox{\hyperlink{structng__bpf__hookprog_a2013dadab510ed6cdbba254866fc8254}{bpf\_prog\_len}}));}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00359}00359                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00360}00360                     \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00361}00361 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00362}00362                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fa91ef58cd3206e2bfab473ac0f2e2d959}{NGM\_BPF\_GET\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00363}00363                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fae6f295d37c89700cee8c8775c9be765f}{NGM\_BPF\_CLR\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00364}00364                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fae1c94a1b0c8431bb2f272457d077eef8}{NGM\_BPF\_GETCLR\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00365}00365                     \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00366}00366                         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookstat}{ng\_bpf\_hookstat}} *\mbox{\hyperlink{structstats}{stats}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00367}00367                         \mbox{\hyperlink{structng__hook}{hook\_p}} hook;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00368}00368 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00369}00369                         \textcolor{comment}{/* Sanity check */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00370}00370                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} == 0)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00371}00371                                 \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00372}00372                         msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}[msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} -\/ 1] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00373}00373 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00374}00374                         \textcolor{comment}{/* Find hook */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00375}00375                         \textcolor{keywordflow}{if} ((hook = \mbox{\hyperlink{netgraph_8h_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(node, msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}})) == NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00376}00376                                 \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00377}00377                         \mbox{\hyperlink{structstats}{stats}} = \&((\mbox{\hyperlink{ng__bpf_8c_ad1ccef44f965fa9d77a1a99c47fb1e98}{hinfo\_p}})\mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook))-\/>\mbox{\hyperlink{structstats}{stats}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00378}00378 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00379}00379                         \textcolor{comment}{/* Build response (if desired) */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00380}00380                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} != \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fae6f295d37c89700cee8c8775c9be765f}{NGM\_BPF\_CLR\_STATS}}) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00381}00381                                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp,}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00382}00382                                     msg, \textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structstats}{stats}}), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00383}00383                                 \textcolor{keywordflow}{if} (resp == NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00384}00384                                         \mbox{\hyperlink{ng__bpf_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00385}00385                                 bcopy(\mbox{\hyperlink{structstats}{stats}}, resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}, \textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structstats}{stats}}));}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00386}00386                         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00387}00387 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00388}00388                         \textcolor{comment}{/* Clear stats (if desired) */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00389}00389                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} != \mbox{\hyperlink{ng__bpf_8h_a5d76b81b0ad4c19007a781d4edb8181fa91ef58cd3206e2bfab473ac0f2e2d959}{NGM\_BPF\_GET\_STATS}})}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00390}00390                                 bzero(\mbox{\hyperlink{structstats}{stats}}, \textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structstats}{stats}}));}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00391}00391                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00392}00392                     \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00393}00393 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00394}00394                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00395}00395                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00396}00396                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00397}00397                 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00398}00398                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00399}00399         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00400}00400                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00401}00401                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00402}00402         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00403}00403 done:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00404}00404         \mbox{\hyperlink{netgraph_8h_a69db50ed7f968e936580df029ab5c5dc}{NG\_RESPOND\_MSG}}(error, node, item, resp);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00405}00405         \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00406}00406         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00407}00407 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00408}00408 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00409}00409 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00410}00410 \textcolor{comment}{ * Receive data on a hook}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00411}00411 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00412}00412 \textcolor{comment}{ * Apply the filter, and then drop or forward packet as appropriate.}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00413}00413 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00414}00414 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00415}\mbox{\hyperlink{ng__bpf_8c_adf0a754d4412c5cd6973d7694e824e78}{00415}} \mbox{\hyperlink{ng__bpf_8c_afe8be7e285d2bcef9fb0b692a0e5ff0d}{ng\_bpf\_rcvdata}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook, \mbox{\hyperlink{structng__item}{item\_p}} item)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00416}00416 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00417}00417         \textcolor{keyword}{const} \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} hip = \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00418}00418         \textcolor{keywordtype}{int} totlen;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00419}00419         \textcolor{keywordtype}{int} needfree = 0, error = 0, usejit = 0;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00420}00420         u\_char *\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00421}00421         \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} dhip;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00422}00422         \mbox{\hyperlink{structng__hook}{hook\_p}} dest;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00423}00423         u\_int len;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00424}00424         \textcolor{keyword}{struct }mbuf *m;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00425}00425 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00426}00426         m = \mbox{\hyperlink{netgraph_8h_a08cf471587aa844de10e9c3c1d7a8c28}{NGI\_M}}(item);   \textcolor{comment}{/* 'item' still owns it.. we are peeking */} }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00427}00427         totlen = m-\/>m\_pkthdr.len;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00428}00428         \textcolor{comment}{/* Update stats on incoming hook. XXX Can we do 64 bits atomically? */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00429}00429         \textcolor{comment}{/* atomic\_add\_int64(\&hip-\/>stats.recvFrames, 1); */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00430}00430         \textcolor{comment}{/* atomic\_add\_int64(\&hip-\/>stats.recvOctets, totlen); */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00431}00431         hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{stats}}.\mbox{\hyperlink{structng__bpf__hookstat_a3a0a7230e33ce672cc91cb1d1adbb968}{recvFrames}}++; }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00432}00432         hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{stats}}.\mbox{\hyperlink{structng__bpf__hookstat_a8239b075bb100ab45d0cbae9dc8a3d27}{recvOctets}} += totlen;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00433}00433 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00434}00434         \textcolor{comment}{/* Don't call bpf\_filter() with totlen == 0! */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00435}00435         \textcolor{keywordflow}{if} (totlen == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00436}00436                 len = 0;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00437}00437                 \textcolor{keywordflow}{goto} ready;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00438}00438         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00439}00439 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00440}00440 \textcolor{preprocessor}{\#ifdef BPF\_JITTER}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00441}00441         \textcolor{keywordflow}{if} (bpf\_jitter\_enable != 0 \&\& hip-\/>jit\_prog != NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00442}00442                 usejit = 1;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00443}00443 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00444}00444 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00445}00445         \textcolor{comment}{/* Need to put packet in contiguous memory for bpf */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00446}00446         \textcolor{keywordflow}{if} (m-\/>m\_next != NULL \&\& totlen > MHLEN) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00447}00447                 \textcolor{keywordflow}{if} (usejit) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00448}00448                         \mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}} = malloc(totlen, \mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}}, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00449}00449                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00450}00450                                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00451}00451                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00452}00452                         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00453}00453                         needfree = 1;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00454}00454                         m\_copydata(m, 0, totlen, (caddr\_t)\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00455}00455                 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00456}00456         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00457}00457                 \textcolor{keywordflow}{if} (m-\/>m\_next != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00458}00458                         \mbox{\hyperlink{netgraph_8h_a08cf471587aa844de10e9c3c1d7a8c28}{NGI\_M}}(item) = m = m\_pullup(m, totlen);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00459}00459                         \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00460}00460                                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00461}00461                                 \textcolor{keywordflow}{return} (ENOBUFS);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00462}00462                         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00463}00463                 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00464}00464                 \mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}} = mtod(m, u\_char *);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00465}00465         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00466}00466 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00467}00467         \textcolor{comment}{/* Run packet through filter */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00468}00468 \textcolor{preprocessor}{\#ifdef BPF\_JITTER}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00469}00469         \textcolor{keywordflow}{if} (usejit)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00470}00470                 len = (*(hip-\/>jit\_prog-\/>func))(\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}}, totlen, totlen);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00471}00471         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00472}00472 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00473}00473         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}})}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00474}00474                 len = bpf\_filter(hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}-\/>\mbox{\hyperlink{structng__bpf__hookprog_ace8576b134f2326907f8ffc5bdd09f5c}{bpf\_prog}}, \mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}}, totlen, totlen);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00475}00475         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00476}00476                 len = bpf\_filter(hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}-\/>\mbox{\hyperlink{structng__bpf__hookprog_ace8576b134f2326907f8ffc5bdd09f5c}{bpf\_prog}}, (u\_char *)m, totlen, 0);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00477}00477         \textcolor{keywordflow}{if} (needfree)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00478}00478                 free(\mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}}, \mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00479}00479 ready:}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00480}00480         \textcolor{comment}{/* See if we got a match and find destination hook */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00481}00481         \textcolor{keywordflow}{if} (len > 0) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00482}00482                 \textcolor{comment}{/* Update stats */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00483}00483                 \textcolor{comment}{/* XXX atomically? */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00484}00484                 hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{stats}}.\mbox{\hyperlink{structng__bpf__hookstat_a1bab6b9f07031d3c031fe20d410a7d46}{recvMatchFrames}}++;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00485}00485                 hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{stats}}.\mbox{\hyperlink{structng__bpf__hookstat_a1e8a264f8c286712b3f2e728db2e69fd}{recvMatchOctets}} += totlen;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00486}00486 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00487}00487                 \textcolor{comment}{/* Truncate packet length if required by the filter */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00488}00488                 \textcolor{comment}{/* Assume this never changes m */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00489}00489                 \textcolor{keywordflow}{if} (len < totlen) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00490}00490                         m\_adj(m, -\/(totlen -\/ len));}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00491}00491                         totlen = len;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00492}00492                 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00493}00493                 dest = hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_ae04c91d581466c36a9d84eb37586a096}{match}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00494}00494         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00495}00495                 dest = hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a6168d2ca2f76e84ef394a47829df5c95}{nomatch}};}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00496}00496         \textcolor{keywordflow}{if} (dest == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00497}00497                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00498}00498                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00499}00499         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00500}00500 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00501}00501         \textcolor{comment}{/* Deliver frame out destination hook */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00502}00502         dhip = \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(dest);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00503}00503         dhip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{stats}}.\mbox{\hyperlink{structng__bpf__hookstat_a3977b63ec090c5876690e8f2ecfd02fc}{xmitOctets}} += totlen;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00504}00504         dhip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a5e3dc3efa95588cab679530ef2c66c43}{stats}}.\mbox{\hyperlink{structng__bpf__hookstat_a7c2bdf411a4ec88401c09198b471fcf4}{xmitFrames}}++;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00505}00505         \mbox{\hyperlink{netgraph_8h_a52b448e5f7440d396bb16d481af55b64}{NG\_FWD\_ITEM\_HOOK}}(error, item, dest);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00506}00506         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00507}00507 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00508}00508 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00509}00509 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00510}00510 \textcolor{comment}{ * Shutdown processing}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00511}00511 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00512}00512 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00513}\mbox{\hyperlink{ng__bpf_8c_a8e35f3a04e29e23322045b74f4248b47}{00513}} \mbox{\hyperlink{ng__bpf_8c_a2f2d1edb50cf8eb1d351f09a45325a72}{ng\_bpf\_shutdown}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00514}00514 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00515}00515         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00516}00516         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00517}00517 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00518}00518 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00519}00519 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00520}00520 \textcolor{comment}{ * Hook disconnection}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00521}00521 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00522}00522 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00523}\mbox{\hyperlink{ng__bpf_8c_afb4ee1d6b40875c63c88b0ea8b1eaa5c}{00523}} \mbox{\hyperlink{ng__bpf_8c_add793024eafd394774ff4805cb1828d0}{ng\_bpf\_disconnect}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00524}00524 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00525}00525         \textcolor{keyword}{const} \mbox{\hyperlink{structng__node}{node\_p}} node = \mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00526}00526         \textcolor{keyword}{const} \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} hip = \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00527}00527         \mbox{\hyperlink{structng__hook}{hook\_p}} tmp;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00528}00528 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00529}00529         KASSERT(hip != NULL, (\textcolor{stringliteral}{"{}\%s: null info"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00530}00530 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00531}00531         \textcolor{comment}{/* Remove our reference from other hooks data. */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00532}00532         \mbox{\hyperlink{netgraph_8h_a3336b8c73262860d1727ccc49c7cd9e6}{NG\_NODE\_FOREACH\_HOOK}}(node, \mbox{\hyperlink{ng__bpf_8c_a3d21d55a3a864b98e38125308a5dd41e}{ng\_bpf\_remrefs}}, hook, tmp);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00533}00533 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00534}00534         free(hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}, \mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00535}00535 \textcolor{preprocessor}{\#ifdef BPF\_JITTER}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00536}00536         \textcolor{keywordflow}{if} (hip-\/>jit\_prog != NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00537}00537                 bpf\_destroy\_jit\_filter(hip-\/>jit\_prog);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00538}00538 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00539}00539         free(hip, \mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00540}00540         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{netgraph_8h_ad47e204c5b3adaddfa4bf0c380234f48}{NG\_NODE\_NUMHOOKS}}(node) == 0) \&\&}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00541}00541             (\mbox{\hyperlink{netgraph_8h_a6bdd56e0f33084eeaadbe696febcbbd8}{NG\_NODE\_IS\_VALID}}(node))) \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00542}00542                 \mbox{\hyperlink{netgraph_8h_a85914ce0da2b314478aaf7efcdcd3ff0}{ng\_rmnode\_self}}(node);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00543}00543         \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00544}00544         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00545}00545 \}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00546}00546 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00547}00547 \textcolor{comment}{/************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00548}00548 \textcolor{comment}{                        HELPER STUFF}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00549}00549 \textcolor{comment}{ ************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00550}00550 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00551}00551 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00552}00552 \textcolor{comment}{ * Set the BPF program associated with a hook}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00553}00553 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00554}00554 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00555}\mbox{\hyperlink{ng__bpf_8c_a9394f1fbf40002629f373980d7ab0a7f}{00555}} \mbox{\hyperlink{ng__bpf_8c_a9394f1fbf40002629f373980d7ab0a7f}{ng\_bpf\_setprog}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} *hp0)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00556}00556 \{}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00557}00557         \textcolor{keyword}{const} \mbox{\hyperlink{structng__bpf__hookinfo}{hinfo\_p}} hip = \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00558}00558         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bpf__hookprog}{ng\_bpf\_hookprog}} *hp;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00559}00559 \textcolor{preprocessor}{\#ifdef BPF\_JITTER}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00560}00560         bpf\_jit\_filter *jit\_prog;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00561}00561 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00562}00562         \textcolor{keywordtype}{int} size;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00563}00563 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00564}00564         \textcolor{comment}{/* Check program for validity */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00565}00565         \textcolor{keywordflow}{if} (hp0-\/>\mbox{\hyperlink{structng__bpf__hookprog_a2013dadab510ed6cdbba254866fc8254}{bpf\_prog\_len}} > \mbox{\hyperlink{ng__bpf_8c_ab18dfee80612346a1859ded7abee730f}{bpf\_maxinsns}} ||}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00566}00566             !bpf\_validate(hp0-\/>\mbox{\hyperlink{structng__bpf__hookprog_ace8576b134f2326907f8ffc5bdd09f5c}{bpf\_prog}}, hp0-\/>\mbox{\hyperlink{structng__bpf__hookprog_a2013dadab510ed6cdbba254866fc8254}{bpf\_prog\_len}}))}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00567}00567                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00568}00568 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00569}00569         \textcolor{comment}{/* Make a copy of the program */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00570}00570         size = \mbox{\hyperlink{ng__bpf_8h_ac719ffd21e2e1a5c26b5ad7814ee1f34}{NG\_BPF\_HOOKPROG\_SIZE}}(hp0-\/>\mbox{\hyperlink{structng__bpf__hookprog_a2013dadab510ed6cdbba254866fc8254}{bpf\_prog\_len}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00571}00571         hp = malloc(size, \mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}}, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00572}00572         \textcolor{keywordflow}{if} (hp == NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00573}00573                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00574}00574         bcopy(hp0, hp, size);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00575}00575 \textcolor{preprocessor}{\#ifdef BPF\_JITTER}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00576}00576         jit\_prog = bpf\_jitter(hp-\/>\mbox{\hyperlink{structng__bpf__hookprog_ace8576b134f2326907f8ffc5bdd09f5c}{bpf\_prog}}, hp-\/>\mbox{\hyperlink{structng__bpf__hookprog_a2013dadab510ed6cdbba254866fc8254}{bpf\_prog\_len}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00577}00577 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00578}00578 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00579}00579         \textcolor{comment}{/* Free previous program, if any, and assign new one */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00580}00580         \textcolor{keywordflow}{if} (hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}} != NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00581}00581                 free(hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}, \mbox{\hyperlink{ng__bpf_8c_a061b5a7359a550e25ad84d7c694a9cd4}{M\_NETGRAPH\_BPF}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00582}00582         hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}} = hp;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00583}00583 \textcolor{preprocessor}{\#ifdef BPF\_JITTER}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00584}00584         \textcolor{keywordflow}{if} (hip-\/>jit\_prog != NULL)}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00585}00585                 bpf\_destroy\_jit\_filter(hip-\/>jit\_prog);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00586}00586         hip-\/>jit\_prog = jit\_prog;}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00587}00587 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00588}00588 }
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00589}00589         \textcolor{comment}{/* Prepare direct references on target hooks. */}}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00590}00590         hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_ae04c91d581466c36a9d84eb37586a096}{match}} = \mbox{\hyperlink{netgraph_8h_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook), hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}-\/>\mbox{\hyperlink{structng__bpf__hookprog_a05104024916138f07fae477ea0a3ad3d}{ifMatch}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00591}00591         hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a6168d2ca2f76e84ef394a47829df5c95}{nomatch}} = \mbox{\hyperlink{netgraph_8h_afe7f3ef6e4db622ef5c1578ba08d3d9c}{ng\_findhook}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook), hip-\/>\mbox{\hyperlink{structng__bpf__hookinfo_a98627b2917cf2119086dbe2f100a0c2b}{prog}}-\/>\mbox{\hyperlink{structng__bpf__hookprog_a13beed3f12a3d3c8ae63d57e1b6506a2}{ifNotMatch}});}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00592}00592         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__bpf_8c_source_l00593}00593 \}}

\end{DoxyCode}
