\hypertarget{ng__l2cap__misc_8c_source}{}\doxysection{ng\+\_\+l2cap\+\_\+misc.\+c}
\label{ng__l2cap__misc_8c_source}\index{netgraph/bluetooth/l2cap/ng\_l2cap\_misc.c@{netgraph/bluetooth/l2cap/ng\_l2cap\_misc.c}}
\mbox{\hyperlink{ng__l2cap__misc_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00002}00002 \textcolor{comment}{ * ng\_l2cap\_misc.c}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00003}00003 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00004}00004 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00005}00005 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00006}00006 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00007}00007 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00008}00008 \textcolor{comment}{ * Copyright (c) Maksim Yevmenkin <m\_evmenkin@yahoo.com>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00009}00009 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00011}00011 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00012}00012 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00013}00013 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00014}00014 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00015}00015 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00016}00016 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00017}00017 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00018}00018 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00019}00019 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00020}00020 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00021}00021 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00022}00022 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00023}00023 \textcolor{comment}{ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00024}00024 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00025}00025 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00026}00026 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00027}00027 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00028}00028 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00029}00029 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00030}00030 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00031}00031 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00032}00032 \textcolor{comment}{ * \$Id: ng\_l2cap\_misc.c,v 1.5 2003/09/08 19:11:45 max Exp \$}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00033}00033 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00034}00034 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00035}00035 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__message_8h}{netgraph/ng\_message.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{netgraph_8h}{netgraph/netgraph.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__bluetooth_8h}{netgraph/bluetooth/include/ng\_bluetooth.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci_8h}{netgraph/bluetooth/include/ng\_hci.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__l2cap_8h}{netgraph/bluetooth/include/ng\_l2cap.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__l2cap__var_8h}{netgraph/bluetooth/l2cap/ng\_l2cap\_var.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__l2cap__cmds_8h}{netgraph/bluetooth/l2cap/ng\_l2cap\_cmds.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__l2cap__evnt_8h}{netgraph/bluetooth/l2cap/ng\_l2cap\_evnt.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__l2cap__llpi_8h}{netgraph/bluetooth/l2cap/ng\_l2cap\_llpi.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__l2cap__ulpi_8h}{netgraph/bluetooth/l2cap/ng\_l2cap\_ulpi.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__l2cap__misc_8h}{netgraph/bluetooth/l2cap/ng\_l2cap\_misc.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00054}00054 \textcolor{keyword}{static} u\_int16\_t        \mbox{\hyperlink{ng__l2cap__misc_8c_a8586bc9160688bea6c85a0b964bd7c86}{ng\_l2cap\_get\_cid}}        (\mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}}, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00056}00056 \textcolor{comment}{/******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00057}00057 \textcolor{comment}{ ******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00058}00058 \textcolor{comment}{ **                              Utility routines}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00059}00059 \textcolor{comment}{ ******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00060}00060 \textcolor{comment}{ ******************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00061}00061 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00062}00062 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00063}00063 \textcolor{comment}{ * Send hook information to the upper layer}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00064}00064 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00066}00066 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00067}\mbox{\hyperlink{ng__l2cap__misc_8c_a258697c67ec7cb43bbc847007e866e91}{00067}} \mbox{\hyperlink{ng__l2cap__misc_8c_a258697c67ec7cb43bbc847007e866e91}{ng\_l2cap\_send\_hook\_info}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{void} *arg1, \textcolor{keywordtype}{int} arg2)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00068}00068 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00069}00069         \mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}}     l2cap = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00070}00070         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}   *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00071}00071         \textcolor{keywordtype}{int}              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00072}00072         \mbox{\hyperlink{structng__l2cap__node__hook__info__ep}{ng\_l2cap\_node\_hook\_info\_ep}} *ep ;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00073}00073 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00074}00074         \textcolor{keywordflow}{if} (node == NULL || \mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node) ||}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00075}00075             hook == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00076}00076                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00077}00077 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00078}00078         l2cap = (\mbox{\hyperlink{ng__l2cap__var_8h_a9fc9fb34a07cfa571c657856a90e7e3b}{ng\_l2cap\_p}}) \mbox{\hyperlink{netgraph_8h_ae76b377c72ed8b60e8cbe1a204f70598}{NG\_NODE\_PRIVATE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00079}00079         \textcolor{keywordflow}{if} (l2cap-\/>\mbox{\hyperlink{structng__l2cap_a172d5f25847c25ff23c494910c1ab6fb}{hci}} == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(l2cap-\/>\mbox{\hyperlink{structng__l2cap_a172d5f25847c25ff23c494910c1ab6fb}{hci}}) ||}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00080}00080             bcmp(\&l2cap-\/>\mbox{\hyperlink{structng__l2cap_aa5554feb391290e98540d17340d51b63}{bdaddr}}, \mbox{\hyperlink{ng__hci_8h_a5087b37d7deab31f2b7c7580982b4c1c}{NG\_HCI\_BDADDR\_ANY}}, \textcolor{keyword}{sizeof}(l2cap-\/>\mbox{\hyperlink{structng__l2cap_aa5554feb391290e98540d17340d51b63}{bdaddr}})) == 0)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00081}00081                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00082}00082 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00083}00083         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__l2cap_8h_a7e452e3322a39653affa38cdea2c761a}{NGM\_L2CAP\_COOKIE}}, \mbox{\hyperlink{ng__l2cap_8h_af0d5230b3b003fe1b19b8827f3ae7e0c}{NGM\_L2CAP\_NODE\_HOOK\_INFO}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00084}00084                      \textcolor{keyword}{sizeof}(*ep), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00086}00086         \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00087}00087                 ep = (\mbox{\hyperlink{structng__l2cap__node__hook__info__ep}{ng\_l2cap\_node\_hook\_info\_ep}} *) \&msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00088}00088                 bcopy(\&l2cap-\/>\mbox{\hyperlink{structng__l2cap_aa5554feb391290e98540d17340d51b63}{bdaddr}}, \&ep-\/>\mbox{\hyperlink{structng__l2cap__node__hook__info__ep_a9d2112bbde388e005674e17dad8f3da3}{addr}}, \textcolor{keyword}{sizeof}(bdaddr\_t));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00089}00089                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, node, msg, hook, 0);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00090}00090         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00091}00091                 error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00092}00092 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00093}00093         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00094}00094                 \mbox{\hyperlink{ng__l2cap__var_8h_abbcb1094bde93c3795827c6b68ee0715}{NG\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00095}00095 \textcolor{stringliteral}{"{}\%s: \%s -\/ failed to send HOOK\_INFO message to hook \(\backslash\)"{}\%s\(\backslash\)"{}, error=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00096}00096                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(l2cap-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}), \mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(hook),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00097}00097                         error);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00098}00098 \} \textcolor{comment}{/* ng\_l2cap\_send\_hook\_info */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00100}00100 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00101}00101 \textcolor{comment}{ * Create new connection descriptor for the "{}remote"{} unit. }}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00102}00102 \textcolor{comment}{ * Will link connection descriptor to the l2cap node.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00103}00103 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00104}00104 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00105}00105 \mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00106}\mbox{\hyperlink{ng__l2cap__misc_8c_a70cea4838493b1b68cded1a81588626c}{00106}} \mbox{\hyperlink{ng__l2cap__misc_8c_a70cea4838493b1b68cded1a81588626c}{ng\_l2cap\_new\_con}}(\mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}} l2cap, \mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}} bdaddr, \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00107}00107 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00108}00108         \textcolor{keyword}{static} \textcolor{keywordtype}{int}      fake\_con\_handle = 0x0f00;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00109}00109         \mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}}    con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00110}00110 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00111}00111         \textcolor{comment}{/* Create new connection descriptor */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00112}00112         con = malloc(\textcolor{keyword}{sizeof}(*con), \mbox{\hyperlink{ng__l2cap__main_8c_a1b99c7b1fc3b3558be780b0fab36b5c9}{M\_NETGRAPH\_L2CAP}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00113}00113                 M\_NOWAIT|M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00114}00114         \textcolor{keywordflow}{if} (con == NULL)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00115}00115                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00116}00116 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00117}00117         con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}} = l2cap;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00118}00118         con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}} = \mbox{\hyperlink{ng__l2cap_8h_aa9fe15dde067058ddedbb3918718caf3}{NG\_L2CAP\_CON\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00119}00119         con-\/>\mbox{\hyperlink{structng__l2cap__con_adf31e83a3c890b73ebc541288e909b76}{encryption}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00120}00120         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00121}00121 \textcolor{comment}{         * XXX}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00122}00122 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00123}00123 \textcolor{comment}{         * Assign fake connection handle to the connection descriptor.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00124}00124 \textcolor{comment}{         * Bluetooth specification marks 0x0f00 -\/ 0x0fff connection }}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00125}00125 \textcolor{comment}{         * handles as reserved. We need this fake connection handles }}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00126}00126 \textcolor{comment}{         * for timeouts. Connection handle will be passed as argument}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00127}00127 \textcolor{comment}{         * to timeout so when timeout happens we can find the right}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00128}00128 \textcolor{comment}{         * connection descriptor. We can not pass pointers, because}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00129}00129 \textcolor{comment}{         * timeouts are external (to Netgraph) events and there might}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00130}00130 \textcolor{comment}{         * be a race when node/hook goes down and timeout event already}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00131}00131 \textcolor{comment}{         * went into node's queue}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00132}00132 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00134}00134         con-\/>\mbox{\hyperlink{structng__l2cap__con_a77637ed971bb4ea93602fedd47774133}{con\_handle}} = fake\_con\_handle ++;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00135}00135         \textcolor{keywordflow}{if} (fake\_con\_handle > 0x0fff)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00136}00136                 fake\_con\_handle = 0x0f00;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00137}00137 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00138}00138         bcopy(bdaddr, \&con-\/>\mbox{\hyperlink{structng__l2cap__con_a557dedd620bc15dddcfe54afb13391a4}{remote}}, \textcolor{keyword}{sizeof}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a557dedd620bc15dddcfe54afb13391a4}{remote}}));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00139}00139         con-\/>\mbox{\hyperlink{structng__l2cap__con_a1eef8c09d534fca225eeef47c77ad517}{linktype}} = \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00140}00140         \mbox{\hyperlink{netgraph_8h_a86218dc6ee6651399a66c7cbcba144e4}{ng\_callout\_init}}(\&con-\/>\mbox{\hyperlink{structng__l2cap__con_a344746ddccba2d1e809c4c748e3f4fb1}{con\_timo}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00142}00142         con-\/>\mbox{\hyperlink{structng__l2cap__con_a60ae4ebd729c5362e6f0df75a43422d9}{ident}} = \mbox{\hyperlink{ng__l2cap__var_8h_ac320be745fcfd1a292d47af18cfd917c}{NG\_L2CAP\_FIRST\_IDENT}} -\/ 1;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00143}00143         TAILQ\_INIT(\&con-\/>cmd\_list);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00144}00144 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00145}00145         \textcolor{comment}{/* Link connection */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00146}00146         LIST\_INSERT\_HEAD(\&l2cap-\/>con\_list, con, next); }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00147}00147 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00148}00148         \textcolor{keywordflow}{return} (con);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00149}00149 \} \textcolor{comment}{/* ng\_l2cap\_new\_con */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00150}00150 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00151}00151 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00152}00152 \textcolor{comment}{ * Add reference to the connection descriptor}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00153}00153 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00154}00154 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00155}00155 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00156}\mbox{\hyperlink{ng__l2cap__misc_8c_a1b9b175ed5fd709df0020b61e9188ad5}{00156}} \mbox{\hyperlink{ng__l2cap__misc_8c_a1b9b175ed5fd709df0020b61e9188ad5}{ng\_l2cap\_con\_ref}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00157}00157 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00158}00158         con-\/>\mbox{\hyperlink{structng__l2cap__con_a8911216678388759e89275ce006846c3}{refcnt}} ++;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00159}00159 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00160}00160         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& \mbox{\hyperlink{ng__l2cap_8h_a741cb6bd5b5915cbfc91475b50b6aa0b}{NG\_L2CAP\_CON\_AUTO\_DISCON\_TIMO}}) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00161}00161                 \textcolor{keywordflow}{if} ((con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}} != \mbox{\hyperlink{ng__l2cap_8h_a95d25a00efdd7ce10de2272272505d3f}{NG\_L2CAP\_CON\_OPEN}}) ||}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00162}00162                     (con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& \mbox{\hyperlink{ng__l2cap_8h_a8183182edc24631192a728bebf74a219}{NG\_L2CAP\_CON\_OUTGOING}}) == 0)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00163}00163                         panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00164}00164 \textcolor{stringliteral}{"{}\%s: \%s -\/ bad auto disconnect timeout, state=\%d, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00165}00165                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00166}00166                                 con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00167}00167 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00168}00168                 \mbox{\hyperlink{ng__l2cap__misc_8c_a5d5934749d5e48a33ec78d422cfd5f1c}{ng\_l2cap\_discon\_untimeout}}(con);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00169}00169         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00170}00170 \} \textcolor{comment}{/* ng\_l2cap\_con\_ref */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00171}00171 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00172}00172 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00173}00173 \textcolor{comment}{ * Remove reference from the connection descriptor}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00174}00174 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00175}00175 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00176}00176 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00177}\mbox{\hyperlink{ng__l2cap__misc_8c_a76a7ffc4ada75e33a52c13f56a48550a}{00177}} \mbox{\hyperlink{ng__l2cap__misc_8c_a76a7ffc4ada75e33a52c13f56a48550a}{ng\_l2cap\_con\_unref}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00178}00178 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00179}00179         con-\/>\mbox{\hyperlink{structng__l2cap__con_a8911216678388759e89275ce006846c3}{refcnt}} -\/-\/;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00180}00180 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00181}00181         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__l2cap__con_a8911216678388759e89275ce006846c3}{refcnt}} < 0)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00182}00182                 panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00183}00183 \textcolor{stringliteral}{"{}\%s: \%s -\/ con-\/>refcnt < 0\(\backslash\)n"{}}, \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00184}00184 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00185}00185         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00186}00186 \textcolor{comment}{         * Set auto disconnect timer only if the following conditions are met:}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00187}00187 \textcolor{comment}{         * 1) we have no reference on the connection}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00188}00188 \textcolor{comment}{         * 2) connection is in OPEN state}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00189}00189 \textcolor{comment}{         * 3) it is an outgoing connection}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00190}00190 \textcolor{comment}{         * 4) disconnect timeout > 0}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00191}00191 \textcolor{comment}{         * 5) connection is not dying}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00192}00192 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00193}00193 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00194}00194         \textcolor{keywordflow}{if} ((con-\/>\mbox{\hyperlink{structng__l2cap__con_a8911216678388759e89275ce006846c3}{refcnt}} == 0) \&\&}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00195}00195             (con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}} == \mbox{\hyperlink{ng__l2cap_8h_a95d25a00efdd7ce10de2272272505d3f}{NG\_L2CAP\_CON\_OPEN}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00196}00196             (con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& \mbox{\hyperlink{ng__l2cap_8h_a8183182edc24631192a728bebf74a219}{NG\_L2CAP\_CON\_OUTGOING}}) \&\& }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00197}00197             (con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_af4b14280734259d0388d0cb8ef8eed0c}{discon\_timo}} > 0) \&\&}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00198}00198             ((con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& \mbox{\hyperlink{ng__l2cap_8h_a9612a7f2b93d39fd18be56a188c533c2}{NG\_L2CAP\_CON\_DYING}}) == 0))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00199}00199                 \mbox{\hyperlink{ng__l2cap__misc_8c_a07fdee62c4be8a535b806ccc6a738e86}{ng\_l2cap\_discon\_timeout}}(con);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00200}00200 \} \textcolor{comment}{/* ng\_l2cap\_con\_unref */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00201}00201 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00202}00202 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00203}00203 \textcolor{comment}{ * Set auto disconnect timeout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00204}00204 \textcolor{comment}{ * XXX FIXME: check return code from ng\_callout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00205}00205 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00206}00206 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00207}00207 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00208}\mbox{\hyperlink{ng__l2cap__misc_8c_a07fdee62c4be8a535b806ccc6a738e86}{00208}} \mbox{\hyperlink{ng__l2cap__misc_8c_a07fdee62c4be8a535b806ccc6a738e86}{ng\_l2cap\_discon\_timeout}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00209}00209 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00210}00210         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& (\mbox{\hyperlink{ng__l2cap_8h_a10d3786bd006c0effd58f6d00ef9a1ac}{NG\_L2CAP\_CON\_LP\_TIMO}}|\mbox{\hyperlink{ng__l2cap_8h_a741cb6bd5b5915cbfc91475b50b6aa0b}{NG\_L2CAP\_CON\_AUTO\_DISCON\_TIMO}}))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00211}00211                 panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00212}00212 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid timeout, state=\%d, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00213}00213                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00214}00214                         con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00215}00215 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00216}00216         con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} |= \mbox{\hyperlink{ng__l2cap_8h_a741cb6bd5b5915cbfc91475b50b6aa0b}{NG\_L2CAP\_CON\_AUTO\_DISCON\_TIMO}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00217}00217         \mbox{\hyperlink{netgraph_8h_aed70061429167aaa4b93a6129c959f0f}{ng\_callout}}(\&con-\/>\mbox{\hyperlink{structng__l2cap__con_a344746ddccba2d1e809c4c748e3f4fb1}{con\_timo}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00218}00218                                 con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_af4b14280734259d0388d0cb8ef8eed0c}{discon\_timo}} * hz,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00219}00219                                 \mbox{\hyperlink{ng__l2cap__llpi_8c_a030edc8a758fcea13463a2d957374752}{ng\_l2cap\_process\_discon\_timeout}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00220}00220                                 con-\/>\mbox{\hyperlink{structng__l2cap__con_a77637ed971bb4ea93602fedd47774133}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00221}00221 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00222}00222         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00223}00223 \} \textcolor{comment}{/* ng\_l2cap\_discon\_timeout */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00224}00224 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00225}00225 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00226}00226 \textcolor{comment}{ * Unset auto disconnect timeout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00227}00227 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00228}00228 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00229}00229 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00230}\mbox{\hyperlink{ng__l2cap__misc_8c_a5d5934749d5e48a33ec78d422cfd5f1c}{00230}} \mbox{\hyperlink{ng__l2cap__misc_8c_a5d5934749d5e48a33ec78d422cfd5f1c}{ng\_l2cap\_discon\_untimeout}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00231}00231 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00232}00232         \textcolor{keywordflow}{if} (!(con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& \mbox{\hyperlink{ng__l2cap_8h_a741cb6bd5b5915cbfc91475b50b6aa0b}{NG\_L2CAP\_CON\_AUTO\_DISCON\_TIMO}}))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00233}00233                 panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00234}00234 \textcolor{stringliteral}{"{}\%s: \%s -\/ no disconnect timeout, state=\%d, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00235}00235                         \_\_func\_\_,  \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00236}00236                         con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00237}00237 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00238}00238         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_aabe13cf527f80501a761c71c9b4888db}{ng\_uncallout}}(\&con-\/>\mbox{\hyperlink{structng__l2cap__con_a344746ddccba2d1e809c4c748e3f4fb1}{con\_timo}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}) < 1)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00239}00239                 \textcolor{keywordflow}{return} (ETIMEDOUT);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00240}00240 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00241}00241         con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \&= \string~NG\_L2CAP\_CON\_AUTO\_DISCON\_TIMO;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00242}00242 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00243}00243         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00244}00244 \} \textcolor{comment}{/* ng\_l2cap\_discon\_untimeout */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00245}00245 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00246}00246 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00247}00247 \textcolor{comment}{ * Free connection descriptor. Will unlink connection and free everything.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00248}00248 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00249}00249 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00250}00250 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00251}\mbox{\hyperlink{ng__l2cap__misc_8c_a0226e33750a22ea3fedeb4cbc3a9f322}{00251}} \mbox{\hyperlink{ng__l2cap__misc_8c_a0226e33750a22ea3fedeb4cbc3a9f322}{ng\_l2cap\_free\_con}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00252}00252 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00253}00253         \mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}} f = NULL, n = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00254}00254 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00255}00255         con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}} = \mbox{\hyperlink{ng__l2cap_8h_aa9fe15dde067058ddedbb3918718caf3}{NG\_L2CAP\_CON\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00256}00256 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00257}00257         \textcolor{keywordflow}{while} (con-\/>\mbox{\hyperlink{structng__l2cap__con_ad56e55183a368800b9dca5739ba5e057}{tx\_pkt}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00258}00258                 \textcolor{keyword}{struct }mbuf     *m = con-\/>\mbox{\hyperlink{structng__l2cap__con_ad56e55183a368800b9dca5739ba5e057}{tx\_pkt}}-\/>m\_nextpkt;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00259}00259 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00260}00260                 m\_freem(con-\/>\mbox{\hyperlink{structng__l2cap__con_ad56e55183a368800b9dca5739ba5e057}{tx\_pkt}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00261}00261                 con-\/>\mbox{\hyperlink{structng__l2cap__con_ad56e55183a368800b9dca5739ba5e057}{tx\_pkt}} = m;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00262}00262         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00263}00263 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00264}00264         \mbox{\hyperlink{netgraph_8h_a2461bfcdc9e024484ed8037d386620e3}{NG\_FREE\_M}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a4523142060a30160ea4aa3b53e4c249c}{rx\_pkt}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00265}00265 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00266}00266         \textcolor{keywordflow}{for} (f = LIST\_FIRST(\&con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>chan\_list); f != NULL; ) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00267}00267                 n = LIST\_NEXT(f, next);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00268}00268 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00269}00269                 \textcolor{keywordflow}{if} (f-\/>\mbox{\hyperlink{structng__l2cap__chan_ac4593dfe0cdf8db2fba2839ae025ac0a}{con}} == con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00270}00270                         \mbox{\hyperlink{ng__l2cap__misc_8c_a0e135e0146251e7cb3845c5cf76adb02}{ng\_l2cap\_free\_chan}}(f);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00271}00271 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00272}00272                 f = n;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00273}00273         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00274}00274 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00275}00275         \textcolor{keywordflow}{while} (!TAILQ\_EMPTY(\&con-\/>cmd\_list)) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00276}00276                 \mbox{\hyperlink{structng__l2cap__cmd}{ng\_l2cap\_cmd\_p}}    \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}} = TAILQ\_FIRST(\&con-\/>cmd\_list);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00277}00277 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00278}00278                 \mbox{\hyperlink{ng__l2cap__misc_8h_a427d0e7386bdb85aece9893978f01f0b}{ng\_l2cap\_unlink\_cmd}}(\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00279}00279                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>flags \& \mbox{\hyperlink{ng__l2cap__var_8h_afd66ea2371433c454cb0bcb205178eb7}{NG\_L2CAP\_CMD\_PENDING}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00280}00280                         \mbox{\hyperlink{ng__l2cap__misc_8c_a7247a12d28f8d6b6fe376ae99ebe8ec4}{ng\_l2cap\_command\_untimeout}}(\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00281}00281                 \mbox{\hyperlink{ng__l2cap__misc_8h_a9e4ae982d415e25d8710170a88c3b6d0}{ng\_l2cap\_free\_cmd}}(\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00282}00282         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00283}00283 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00284}00284         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& (\mbox{\hyperlink{ng__l2cap_8h_a741cb6bd5b5915cbfc91475b50b6aa0b}{NG\_L2CAP\_CON\_AUTO\_DISCON\_TIMO}}|\mbox{\hyperlink{ng__l2cap_8h_a10d3786bd006c0effd58f6d00ef9a1ac}{NG\_L2CAP\_CON\_LP\_TIMO}}))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00285}00285                 panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00286}00286 \textcolor{stringliteral}{"{}\%s: \%s -\/ timeout pending! state=\%d, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00287}00287                         \_\_func\_\_,  \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00288}00288                         con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00289}00289 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00290}00290         LIST\_REMOVE(con, next);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00291}00291 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00292}00292         bzero(con, \textcolor{keyword}{sizeof}(*con));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00293}00293         free(con, \mbox{\hyperlink{ng__l2cap__main_8c_a1b99c7b1fc3b3558be780b0fab36b5c9}{M\_NETGRAPH\_L2CAP}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00294}00294 \} \textcolor{comment}{/* ng\_l2cap\_free\_con */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00295}00295 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00296}00296 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00297}00297 \textcolor{comment}{ * Get connection by "{}remote"{} address}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00298}00298 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00299}00299 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00300}00300 \mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00301}\mbox{\hyperlink{ng__l2cap__misc_8c_a2e0274703f582a5c0bdbc2df42579e62}{00301}} \mbox{\hyperlink{ng__l2cap__misc_8c_a2e0274703f582a5c0bdbc2df42579e62}{ng\_l2cap\_con\_by\_addr}}(\mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}} l2cap, \mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}} bdaddr, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00302}00302 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00303}00303         \mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}}    con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00304}00304 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00305}00305         LIST\_FOREACH(con, \&l2cap-\/>con\_list, next)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00306}00306                 \textcolor{keywordflow}{if} ((bcmp(bdaddr, \&con-\/>\mbox{\hyperlink{structng__l2cap__con_a557dedd620bc15dddcfe54afb13391a4}{remote}}, \textcolor{keyword}{sizeof}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a557dedd620bc15dddcfe54afb13391a4}{remote}})) == 0)\&\&}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00307}00307                     (con-\/>\mbox{\hyperlink{structng__l2cap__con_a1eef8c09d534fca225eeef47c77ad517}{linktype}} == \mbox{\hyperlink{ng__btsocket__rfcomm_8h_a3cce6e7fc609fa524af48647bd518f51}{type}}))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00308}00308                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00309}00309 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00310}00310         \textcolor{keywordflow}{return} (con);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00311}00311 \} \textcolor{comment}{/* ng\_l2cap\_con\_by\_addr */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00312}00312 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00313}00313 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00314}00314 \textcolor{comment}{ * Get connection by "{}handle"{} }}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00315}00315 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00316}00316 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00317}00317 \mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00318}\mbox{\hyperlink{ng__l2cap__misc_8c_a209c7f85609e238e10570902623ef949}{00318}} \mbox{\hyperlink{ng__l2cap__misc_8c_a209c7f85609e238e10570902623ef949}{ng\_l2cap\_con\_by\_handle}}(\mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}} l2cap, u\_int16\_t con\_handle)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00319}00319 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00320}00320         \mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}}    con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00321}00321 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00322}00322         LIST\_FOREACH(con, \&l2cap-\/>con\_list, next)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00323}00323                 \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__l2cap__con_a77637ed971bb4ea93602fedd47774133}{con\_handle}} == con\_handle)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00324}00324                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00325}00325 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00326}00326         \textcolor{keywordflow}{return} (con);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00327}00327 \} \textcolor{comment}{/* ng\_l2cap\_con\_by\_handle */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00328}00328 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00329}00329 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00330}00330 \textcolor{comment}{ * Allocate new L2CAP channel descriptor on "{}con"{} connection with "{}psm"{}.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00331}00331 \textcolor{comment}{ * Will link the channel to the l2cap node}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00332}00332 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00333}00333 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00334}00334 \mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00335}\mbox{\hyperlink{ng__l2cap__misc_8c_ad938c336d8593d0649bb1a47d3d15a31}{00335}} \mbox{\hyperlink{ng__l2cap__misc_8c_ad938c336d8593d0649bb1a47d3d15a31}{ng\_l2cap\_new\_chan}}(\mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}} l2cap, \mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con, u\_int16\_t psm, \textcolor{keywordtype}{int} idtype)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00336}00336 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00337}00337         \mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}}  ch = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00338}00338 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00339}00339         ch = malloc(\textcolor{keyword}{sizeof}(*ch), \mbox{\hyperlink{ng__l2cap__main_8c_a1b99c7b1fc3b3558be780b0fab36b5c9}{M\_NETGRAPH\_L2CAP}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00340}00340                 M\_NOWAIT|M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00341}00341         \textcolor{keywordflow}{if} (ch == NULL)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00342}00342                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00343}00343         \textcolor{keywordflow}{if}(idtype == \mbox{\hyperlink{ng__l2cap_8h_aa28ed4e421ee5ca6057d264e6fa0c9a7}{NG\_L2CAP\_L2CA\_IDTYPE\_ATT}})\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00344}00344                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a93e5a7358c7c8d338d32b61d9698fc6c}{scid}} = ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a0cc6d8a4805df988cb4f14f076a5b6e2}{dcid}} = \mbox{\hyperlink{ng__l2cap_8h_a6dc8898d2bd24090e4ad2f77766e2838}{NG\_L2CAP\_ATT\_CID}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00345}00345         \}\textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(idtype == \mbox{\hyperlink{ng__l2cap_8h_a4d8f2b5d106fe39d83d37c8d1a418b09}{NG\_L2CAP\_L2CA\_IDTYPE\_SMP}})\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00346}00346                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a93e5a7358c7c8d338d32b61d9698fc6c}{scid}} = ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a0cc6d8a4805df988cb4f14f076a5b6e2}{dcid}} = \mbox{\hyperlink{ng__l2cap_8h_a13d0089b6298564c03c96b6211c640f6}{NG\_L2CAP\_SMP\_CID}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00347}00347         \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00348}00348                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a93e5a7358c7c8d338d32b61d9698fc6c}{scid}} = \mbox{\hyperlink{ng__l2cap__misc_8c_a8586bc9160688bea6c85a0b964bd7c86}{ng\_l2cap\_get\_cid}}(l2cap,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00349}00349                                             (con-\/>\mbox{\hyperlink{structng__l2cap__con_a1eef8c09d534fca225eeef47c77ad517}{linktype}}!= \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}}));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00350}00350         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00351}00351 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00352}00352         ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ab0d4ad8ac82cab372de73bd06a54443d}{idtype}} = idtype;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00353}00353         \textcolor{keywordflow}{if} (ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a93e5a7358c7c8d338d32b61d9698fc6c}{scid}} != \mbox{\hyperlink{ng__l2cap_8h_a6614817d494c0b6a0812c6a42aa7b6a6}{NG\_L2CAP\_NULL\_CID}}) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00354}00354                 \textcolor{comment}{/* Initialize channel */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00355}00355                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a86734c0120fa566e72bea42df59b1751}{psm}} = psm;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00356}00356                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac4593dfe0cdf8db2fba2839ae025ac0a}{con}} = con;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00357}00357                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a92ce80c638392f92eebc2dc44dce9b52}{state}} = \mbox{\hyperlink{ng__l2cap_8h_a09bc94e598c1b0ec9b88f488824d3d61}{NG\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00358}00358 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00359}00359                 \textcolor{comment}{/* Set MTU and flow control settings to defaults */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00360}00360                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a5818f9c7785d1ea1ed4d77c815bfbfcb}{imtu}} = \mbox{\hyperlink{ng__l2cap_8h_a98b0eab62d7464f4c95df05ef865f423}{NG\_L2CAP\_MTU\_DEFAULT}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00361}00361                 bcopy(\mbox{\hyperlink{ng__l2cap__misc_8c_a8e7270a2ecad1099435734e4682003bc}{ng\_l2cap\_default\_flow}}(), \&ch-\/>\mbox{\hyperlink{structng__l2cap__chan_adedeaa6f80c010de65635d433006b6a0}{iflow}}, \textcolor{keyword}{sizeof}(ch-\/>\mbox{\hyperlink{structng__l2cap__chan_adedeaa6f80c010de65635d433006b6a0}{iflow}}));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00362}00362 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00363}00363                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ae9e9e828260da4cc120850924e111a06}{omtu}} = \mbox{\hyperlink{ng__l2cap_8h_a98b0eab62d7464f4c95df05ef865f423}{NG\_L2CAP\_MTU\_DEFAULT}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00364}00364                 bcopy(\mbox{\hyperlink{ng__l2cap__misc_8c_a8e7270a2ecad1099435734e4682003bc}{ng\_l2cap\_default\_flow}}(), \&ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac8abda562670bc603e21ed273be62039}{oflow}}, \textcolor{keyword}{sizeof}(ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac8abda562670bc603e21ed273be62039}{oflow}}));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00365}00365 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00366}00366                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a3877eb1c45b6f7d2c3dada4de666f260}{flush\_timo}} = \mbox{\hyperlink{ng__l2cap_8h_a6d7d92c17e580f84fb2f5e33eafa1595}{NG\_L2CAP\_FLUSH\_TIMO\_DEFAULT}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00367}00367                 ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a3449980566744509a81b4b2169d52e2c}{link\_timo}} = \mbox{\hyperlink{ng__l2cap_8h_aee326f3e2a0ea131a25cb2446059398c}{NG\_L2CAP\_LINK\_TIMO\_DEFAULT}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00368}00368 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00369}00369                 LIST\_INSERT\_HEAD(\&l2cap-\/>chan\_list, ch, next);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00370}00370 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00371}00371                 \mbox{\hyperlink{ng__l2cap__misc_8c_a1b9b175ed5fd709df0020b61e9188ad5}{ng\_l2cap\_con\_ref}}(con);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00372}00372         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00373}00373                 bzero(ch, \textcolor{keyword}{sizeof}(*ch));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00374}00374                 free(ch, \mbox{\hyperlink{ng__l2cap__main_8c_a1b99c7b1fc3b3558be780b0fab36b5c9}{M\_NETGRAPH\_L2CAP}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00375}00375                 ch = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00376}00376         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00377}00377 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00378}00378         \textcolor{keywordflow}{return} (ch);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00379}00379 \} \textcolor{comment}{/* ng\_l2cap\_new\_chan */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00380}00380 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00381}00381 \mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00382}\mbox{\hyperlink{ng__l2cap__misc_8c_af3b629dfef958c078a630c80861bd86c}{00382}} \mbox{\hyperlink{ng__l2cap__misc_8c_af3b629dfef958c078a630c80861bd86c}{ng\_l2cap\_chan\_by\_scid}}(\mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}} l2cap, u\_int16\_t \mbox{\hyperlink{ng__l2cap_8h_ad666c0aad70262237acbd26f11ab0fee}{scid}}, \textcolor{keywordtype}{int} idtype)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00383}00383 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00384}00384         \mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}}  ch = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00385}00385 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00386}00386         \textcolor{keywordflow}{if}((idtype == \mbox{\hyperlink{ng__l2cap_8h_aa28ed4e421ee5ca6057d264e6fa0c9a7}{NG\_L2CAP\_L2CA\_IDTYPE\_ATT}})||}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00387}00387            (idtype == \mbox{\hyperlink{ng__l2cap_8h_a4d8f2b5d106fe39d83d37c8d1a418b09}{NG\_L2CAP\_L2CA\_IDTYPE\_SMP}}))\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00388}00388                 \textcolor{keywordflow}{return} NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00389}00389         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00390}00390 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00391}00391         LIST\_FOREACH(ch, \&l2cap-\/>chan\_list, next)\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00392}00392                 \textcolor{keywordflow}{if}((idtype != \mbox{\hyperlink{ng__l2cap_8h_a446404915983b7f7db08a8faeaf67e9d}{NG\_L2CAP\_L2CA\_IDTYPE\_BREDR}})\&\&}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00393}00393                    (ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac4593dfe0cdf8db2fba2839ae025ac0a}{con}}-\/>\mbox{\hyperlink{structng__l2cap__con_a1eef8c09d534fca225eeef47c77ad517}{linktype}} == \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}} ))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00394}00394                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00395}00395                 \textcolor{keywordflow}{if}((idtype != \mbox{\hyperlink{ng__l2cap_8h_a2534bcfe1122fdcfa67c5dbd92b2232e}{NG\_L2CAP\_L2CA\_IDTYPE\_LE}})\&\&}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00396}00396                    (ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac4593dfe0cdf8db2fba2839ae025ac0a}{con}}-\/>\mbox{\hyperlink{structng__l2cap__con_a1eef8c09d534fca225eeef47c77ad517}{linktype}} != \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}} ))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00397}00397                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00398}00398                 \textcolor{keywordflow}{if} (ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a93e5a7358c7c8d338d32b61d9698fc6c}{scid}} == \mbox{\hyperlink{ng__l2cap_8h_ad666c0aad70262237acbd26f11ab0fee}{scid}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00399}00399                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00400}00400         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00401}00401         \textcolor{keywordflow}{return} (ch);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00402}00402 \} \textcolor{comment}{/* ng\_l2cap\_chan\_by\_scid */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00403}00403 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00404}00404 \mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00405}\mbox{\hyperlink{ng__l2cap__misc_8c_aba91978082e234eed8783a39b2049911}{00405}} \mbox{\hyperlink{ng__l2cap__misc_8c_aba91978082e234eed8783a39b2049911}{ng\_l2cap\_chan\_by\_conhandle}}(\mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}} l2cap, uint16\_t \mbox{\hyperlink{ng__l2cap_8h_ad666c0aad70262237acbd26f11ab0fee}{scid}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00406}00406                            u\_int16\_t con\_handle)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00407}00407 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00408}00408         \mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}}  ch = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00409}00409 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00410}00410         LIST\_FOREACH(ch, \&l2cap-\/>chan\_list, next)\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00411}00411                 \textcolor{keywordflow}{if} ((ch-\/>\mbox{\hyperlink{structng__l2cap__chan_a93e5a7358c7c8d338d32b61d9698fc6c}{scid}} == \mbox{\hyperlink{ng__l2cap_8h_ad666c0aad70262237acbd26f11ab0fee}{scid}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00412}00412                     (ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac4593dfe0cdf8db2fba2839ae025ac0a}{con}}-\/>\mbox{\hyperlink{structng__l2cap__con_a77637ed971bb4ea93602fedd47774133}{con\_handle}} == con\_handle))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00413}00413                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00414}00414         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00415}00415         \textcolor{keywordflow}{return} (ch);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00416}00416 \} \textcolor{comment}{/* ng\_l2cap\_chan\_by\_scid */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00417}00417 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00418}00418 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00419}00419 \textcolor{comment}{ * Free channel descriptor.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00420}00420 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00421}00421 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00422}00422 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00423}\mbox{\hyperlink{ng__l2cap__misc_8c_a0e135e0146251e7cb3845c5cf76adb02}{00423}} \mbox{\hyperlink{ng__l2cap__misc_8c_a0e135e0146251e7cb3845c5cf76adb02}{ng\_l2cap\_free\_chan}}(\mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}} ch)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00424}00424 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00425}00425         \mbox{\hyperlink{structng__l2cap__cmd}{ng\_l2cap\_cmd\_p}}    f = NULL, n = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00426}00426 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00427}00427         f = TAILQ\_FIRST(\&ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac4593dfe0cdf8db2fba2839ae025ac0a}{con}}-\/>cmd\_list);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00428}00428 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00429}00429         \textcolor{keywordflow}{while} (f != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00430}00430                 n = TAILQ\_NEXT(f, next);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00431}00431 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00432}00432                 \textcolor{keywordflow}{if} (f-\/>\mbox{\hyperlink{structng__l2cap__cmd_a4418995a16fb96b9526384710236e648}{ch}} == ch) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00433}00433                         \mbox{\hyperlink{ng__l2cap__misc_8h_a427d0e7386bdb85aece9893978f01f0b}{ng\_l2cap\_unlink\_cmd}}(f);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00434}00434                         \textcolor{keywordflow}{if} (f-\/>\mbox{\hyperlink{structng__l2cap__cmd_a895a2a822f516d115d1edee455050bbf}{flags}} \& \mbox{\hyperlink{ng__l2cap__var_8h_afd66ea2371433c454cb0bcb205178eb7}{NG\_L2CAP\_CMD\_PENDING}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00435}00435                                 \mbox{\hyperlink{ng__l2cap__misc_8c_a7247a12d28f8d6b6fe376ae99ebe8ec4}{ng\_l2cap\_command\_untimeout}}(f);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00436}00436                         \mbox{\hyperlink{ng__l2cap__misc_8h_a9e4ae982d415e25d8710170a88c3b6d0}{ng\_l2cap\_free\_cmd}}(f);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00437}00437                 \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00438}00438 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00439}00439                 f = n;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00440}00440         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00441}00441 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00442}00442         LIST\_REMOVE(ch, next);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00443}00443 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00444}00444         \mbox{\hyperlink{ng__l2cap__misc_8c_a76a7ffc4ada75e33a52c13f56a48550a}{ng\_l2cap\_con\_unref}}(ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac4593dfe0cdf8db2fba2839ae025ac0a}{con}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00445}00445 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00446}00446         bzero(ch, \textcolor{keyword}{sizeof}(*ch));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00447}00447         free(ch, \mbox{\hyperlink{ng__l2cap__main_8c_a1b99c7b1fc3b3558be780b0fab36b5c9}{M\_NETGRAPH\_L2CAP}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00448}00448 \} \textcolor{comment}{/* ng\_l2cap\_free\_chan */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00449}00449 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00450}00450 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00451}00451 \textcolor{comment}{ * Create new L2CAP command descriptor. WILL NOT add command to the queue.}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00452}00452 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00453}00453 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00454}00454 \mbox{\hyperlink{structng__l2cap__cmd}{ng\_l2cap\_cmd\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00455}\mbox{\hyperlink{ng__l2cap__misc_8c_a8f0ec1ae88ee371fb121407175e17a31}{00455}} \mbox{\hyperlink{ng__l2cap__misc_8c_a8f0ec1ae88ee371fb121407175e17a31}{ng\_l2cap\_new\_cmd}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con, \mbox{\hyperlink{structng__l2cap__chan}{ng\_l2cap\_chan\_p}} ch, u\_int8\_t ident,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00456}00456                 u\_int8\_t code, u\_int32\_t token)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00457}00457 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00458}00458         \mbox{\hyperlink{structng__l2cap__cmd}{ng\_l2cap\_cmd\_p}}    \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00459}00459 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00460}00460         KASSERT((ch == NULL || ch-\/>\mbox{\hyperlink{structng__l2cap__chan_ac4593dfe0cdf8db2fba2839ae025ac0a}{con}} == con),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00461}00461 (\textcolor{stringliteral}{"{}\%s: \%s -\/ invalid channel pointer!\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00462}00462                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}})));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00463}00463 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00464}00464         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}} = malloc(\textcolor{keyword}{sizeof}(*\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}), \mbox{\hyperlink{ng__l2cap__main_8c_a1b99c7b1fc3b3558be780b0fab36b5c9}{M\_NETGRAPH\_L2CAP}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00465}00465                 M\_NOWAIT|M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00466}00466         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}} == NULL)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00467}00467                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00468}00468 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00469}00469         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>con = con;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00470}00470         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>ch = ch;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00471}00471         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>\mbox{\hyperlink{structng__l2cap__chan_afa464bd98abab7544249a30e1dc9e091}{ident}} = ident;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00472}00472         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>code = code;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00473}00473         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>token = token;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00474}00474         \mbox{\hyperlink{netgraph_8h_a86218dc6ee6651399a66c7cbcba144e4}{ng\_callout\_init}}(\&\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>timo);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00475}00475 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00476}00476         \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00477}00477 \} \textcolor{comment}{/* ng\_l2cap\_new\_cmd */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00478}00478 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00479}00479 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00480}00480 \textcolor{comment}{ * Get pending (i.e. initiated by local side) L2CAP command descriptor by ident}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00481}00481 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00482}00482 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00483}00483 \mbox{\hyperlink{structng__l2cap__cmd}{ng\_l2cap\_cmd\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00484}\mbox{\hyperlink{ng__l2cap__misc_8c_a0b6f0df4c38dc1ad196e7d8458f8333b}{00484}} \mbox{\hyperlink{ng__l2cap__misc_8c_a0b6f0df4c38dc1ad196e7d8458f8333b}{ng\_l2cap\_cmd\_by\_ident}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con, u\_int8\_t ident)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00485}00485 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00486}00486         \mbox{\hyperlink{structng__l2cap__cmd}{ng\_l2cap\_cmd\_p}}    \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00487}00487 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00488}00488         TAILQ\_FOREACH(\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}, \&con-\/>cmd\_list, next) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00489}00489                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>flags \& \mbox{\hyperlink{ng__l2cap__var_8h_afd66ea2371433c454cb0bcb205178eb7}{NG\_L2CAP\_CMD\_PENDING}}) \&\& \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>ident == ident) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00490}00490                         KASSERT((\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>con == con),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00491}00491 (\textcolor{stringliteral}{"{}\%s: \%s -\/ invalid connection pointer!\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00492}00492                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}})));}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00493}00493 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00494}00494                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00495}00495                 \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00496}00496         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00497}00497 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00498}00498         \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00499}00499 \} \textcolor{comment}{/* ng\_l2cap\_cmd\_by\_ident */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00500}00500 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00501}00501 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00502}00502 \textcolor{comment}{ * Set LP timeout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00503}00503 \textcolor{comment}{ * XXX FIXME: check return code from ng\_callout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00504}00504 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00505}00505 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00506}00506 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00507}\mbox{\hyperlink{ng__l2cap__misc_8c_a6336e54f243a86688e937fdb69bd6bd8}{00507}} \mbox{\hyperlink{ng__l2cap__misc_8c_a6336e54f243a86688e937fdb69bd6bd8}{ng\_l2cap\_lp\_timeout}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00508}00508 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00509}00509         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& (\mbox{\hyperlink{ng__l2cap_8h_a10d3786bd006c0effd58f6d00ef9a1ac}{NG\_L2CAP\_CON\_LP\_TIMO}}|\mbox{\hyperlink{ng__l2cap_8h_a741cb6bd5b5915cbfc91475b50b6aa0b}{NG\_L2CAP\_CON\_AUTO\_DISCON\_TIMO}}))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00510}00510                 panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00511}00511 \textcolor{stringliteral}{"{}\%s: \%s -\/ invalid timeout, state=\%d, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00512}00512                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00513}00513                         con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00514}00514 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00515}00515         con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} |= \mbox{\hyperlink{ng__l2cap_8h_a10d3786bd006c0effd58f6d00ef9a1ac}{NG\_L2CAP\_CON\_LP\_TIMO}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00516}00516         \mbox{\hyperlink{netgraph_8h_aed70061429167aaa4b93a6129c959f0f}{ng\_callout}}(\&con-\/>\mbox{\hyperlink{structng__l2cap__con_a344746ddccba2d1e809c4c748e3f4fb1}{con\_timo}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00517}00517                                 \mbox{\hyperlink{ng__bluetooth_8c_a2d8e4ead16f9446f313222c1049e5d65}{bluetooth\_hci\_connect\_timeout}}(),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00518}00518                                 \mbox{\hyperlink{ng__l2cap__llpi_8c_a50402cc450d60848324d68b16e852dc2}{ng\_l2cap\_process\_lp\_timeout}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00519}00519                                 con-\/>\mbox{\hyperlink{structng__l2cap__con_a77637ed971bb4ea93602fedd47774133}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00520}00520 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00521}00521         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00522}00522 \} \textcolor{comment}{/* ng\_l2cap\_lp\_timeout */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00523}00523 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00524}00524 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00525}00525 \textcolor{comment}{ * Unset LP timeout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00526}00526 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00527}00527 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00528}00528 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00529}\mbox{\hyperlink{ng__l2cap__misc_8c_a7e7a0f3b8287dc2e755f39b118eb4140}{00529}} \mbox{\hyperlink{ng__l2cap__misc_8c_a7e7a0f3b8287dc2e755f39b118eb4140}{ng\_l2cap\_lp\_untimeout}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00530}00530 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00531}00531         \textcolor{keywordflow}{if} (!(con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \& \mbox{\hyperlink{ng__l2cap_8h_a10d3786bd006c0effd58f6d00ef9a1ac}{NG\_L2CAP\_CON\_LP\_TIMO}}))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00532}00532                 panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00533}00533 \textcolor{stringliteral}{"{}\%s: \%s -\/ no LP connection timeout, state=\%d, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00534}00534                         \_\_func\_\_,  \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00535}00535                         con-\/>\mbox{\hyperlink{structng__l2cap__con_a85c08648a0c5a2594284c6870e936318}{state}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00536}00536 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00537}00537         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_aabe13cf527f80501a761c71c9b4888db}{ng\_uncallout}}(\&con-\/>\mbox{\hyperlink{structng__l2cap__con_a344746ddccba2d1e809c4c748e3f4fb1}{con\_timo}}, con-\/>\mbox{\hyperlink{structng__l2cap__con_a75f9b93b8daec311875f3693c23b568d}{l2cap}}-\/>\mbox{\hyperlink{structng__l2cap_a8e2ae1107407741d54c6b5cefd87966c}{node}}) < 1)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00538}00538                 \textcolor{keywordflow}{return} (ETIMEDOUT);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00539}00539 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00540}00540         con-\/>\mbox{\hyperlink{structng__l2cap__con_af0e3bea60017050a1f4798883cf00efc}{flags}} \&= \string~NG\_L2CAP\_CON\_LP\_TIMO;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00541}00541 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00542}00542         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00543}00543 \} \textcolor{comment}{/* ng\_l2cap\_lp\_untimeout */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00544}00544 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00545}00545 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00546}00546 \textcolor{comment}{ * Set L2CAP command timeout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00547}00547 \textcolor{comment}{ * XXX FIXME: check return code from ng\_callout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00548}00548 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00549}00549 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00550}00550 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00551}\mbox{\hyperlink{ng__l2cap__misc_8c_a8303d8c61822f1a153ff38cbdfa80a00}{00551}} \mbox{\hyperlink{ng__l2cap__misc_8c_a8303d8c61822f1a153ff38cbdfa80a00}{ng\_l2cap\_command\_timeout}}(\mbox{\hyperlink{structng__l2cap__cmd}{ng\_l2cap\_cmd\_p}} \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}, \textcolor{keywordtype}{int} timo)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00552}00552 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00553}00553         \textcolor{keywordtype}{int}     arg;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00554}00554 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00555}00555         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>flags \& \mbox{\hyperlink{ng__l2cap__var_8h_afd66ea2371433c454cb0bcb205178eb7}{NG\_L2CAP\_CMD\_PENDING}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00556}00556                 panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00557}00557 \textcolor{stringliteral}{"{}\%s: \%s -\/ duplicated command timeout, code=\%\#x, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00558}00558                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>con-\/>l2cap-\/>node),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00559}00559                         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>code, \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>flags);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00560}00560 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00561}00561         arg = ((\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>ident << 16) | \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>con-\/>con\_handle);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00562}00562         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>flags |= \mbox{\hyperlink{ng__l2cap__var_8h_afd66ea2371433c454cb0bcb205178eb7}{NG\_L2CAP\_CMD\_PENDING}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00563}00563         \mbox{\hyperlink{netgraph_8h_aed70061429167aaa4b93a6129c959f0f}{ng\_callout}}(\&\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>timo, \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>con-\/>l2cap-\/>node, NULL, timo,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00564}00564                                 \mbox{\hyperlink{ng__l2cap__cmds_8c_a86898778c49ea5ef0c56a32e13b1eb15}{ng\_l2cap\_process\_command\_timeout}}, NULL, arg);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00565}00565 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00566}00566         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00567}00567 \} \textcolor{comment}{/* ng\_l2cap\_command\_timeout */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00568}00568 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00569}00569 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00570}00570 \textcolor{comment}{ * Unset L2CAP command timeout}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00571}00571 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00572}00572 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00573}00573 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00574}\mbox{\hyperlink{ng__l2cap__misc_8c_a7247a12d28f8d6b6fe376ae99ebe8ec4}{00574}} \mbox{\hyperlink{ng__l2cap__misc_8c_a7247a12d28f8d6b6fe376ae99ebe8ec4}{ng\_l2cap\_command\_untimeout}}(\mbox{\hyperlink{structng__l2cap__cmd}{ng\_l2cap\_cmd\_p}} \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00575}00575 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00576}00576         \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>flags \& \mbox{\hyperlink{ng__l2cap__var_8h_afd66ea2371433c454cb0bcb205178eb7}{NG\_L2CAP\_CMD\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00577}00577                 panic(}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00578}00578 \textcolor{stringliteral}{"{}\%s: \%s -\/ no command timeout, code=\%\#x, flags=\%\#x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00579}00579                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>con-\/>l2cap-\/>node),}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00580}00580                         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>code, \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>flags);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00581}00581 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00582}00582         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_aabe13cf527f80501a761c71c9b4888db}{ng\_uncallout}}(\&\mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>timo, \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>con-\/>l2cap-\/>node) < 1)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00583}00583                 \textcolor{keywordflow}{return} (ETIMEDOUT);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00584}00584 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00585}00585         \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}-\/>flags \&= \string~NG\_L2CAP\_CMD\_PENDING;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00586}00586 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00587}00587         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00588}00588 \} \textcolor{comment}{/* ng\_l2cap\_command\_untimeout */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00589}00589 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00590}00590 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00591}00591 \textcolor{comment}{ * Prepend "{}m"{}buf with "{}size"{} bytes}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00592}00592 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00593}00593 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00594}00594 \textcolor{keyword}{struct }mbuf *}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00595}\mbox{\hyperlink{ng__l2cap__misc_8c_a89d6d4272f2c3bea1b980f405b5d1a61}{00595}} \mbox{\hyperlink{ng__l2cap__misc_8c_a89d6d4272f2c3bea1b980f405b5d1a61}{ng\_l2cap\_prepend}}(\textcolor{keyword}{struct} mbuf *m, \textcolor{keywordtype}{int} size)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00596}00596 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00597}00597         M\_PREPEND(m, size, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00598}00598         \textcolor{keywordflow}{if} (m == NULL || (m-\/>m\_len < size \&\& (m = m\_pullup(m, size)) == NULL))}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00599}00599                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00600}00600 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00601}00601         \textcolor{keywordflow}{return} (m);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00602}00602 \} \textcolor{comment}{/* ng\_l2cap\_prepend */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00603}00603 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00604}00604 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00605}00605 \textcolor{comment}{ * Default flow settings}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00606}00606 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00607}00607 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00608}00608 \mbox{\hyperlink{ng__l2cap_8h_a0ff21f2d895801efa143f361a57c3870}{ng\_l2cap\_flow\_p}}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00609}\mbox{\hyperlink{ng__l2cap__misc_8c_a8e7270a2ecad1099435734e4682003bc}{00609}} \mbox{\hyperlink{ng__l2cap__misc_8c_a8e7270a2ecad1099435734e4682003bc}{ng\_l2cap\_default\_flow}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00610}00610 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00611}00611         \textcolor{keyword}{static} ng\_l2cap\_flow\_t  default\_flow = \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00612}00612                 \textcolor{comment}{/* flags */}             0x0,}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00613}00613                 \textcolor{comment}{/* service\_type */}      \mbox{\hyperlink{ng__hci_8h_ac21f8a42bec4999467b25ac636a9d846}{NG\_HCI\_SERVICE\_TYPE\_BEST\_EFFORT}},}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00614}00614                 \textcolor{comment}{/* token\_rate */}        0xffffffff, \textcolor{comment}{/* maximum */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00615}00615                 \textcolor{comment}{/* token\_bucket\_size */} 0xffffffff, \textcolor{comment}{/* maximum */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00616}00616                 \textcolor{comment}{/* peak\_bandwidth */}    0x00000000, \textcolor{comment}{/* maximum */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00617}00617                 \textcolor{comment}{/* latency */}           0xffffffff, \textcolor{comment}{/* don't care */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00618}00618                 \textcolor{comment}{/* delay\_variation */}   0xffffffff  \textcolor{comment}{/* don't care */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00619}00619         \};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00620}00620 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00621}00621         \textcolor{keywordflow}{return} (\&default\_flow);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00622}00622 \} \textcolor{comment}{/* ng\_l2cap\_default\_flow */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00623}00623 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00624}00624 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00625}00625 \textcolor{comment}{ * Get next available channel ID}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00626}00626 \textcolor{comment}{ * XXX FIXME this is *UGLY* but will do for now}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00627}00627 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00628}00628 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00629}00629 \textcolor{keyword}{static} u\_int16\_t}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00630}\mbox{\hyperlink{ng__l2cap__misc_8c_a8586bc9160688bea6c85a0b964bd7c86}{00630}} \mbox{\hyperlink{ng__l2cap__misc_8c_a8586bc9160688bea6c85a0b964bd7c86}{ng\_l2cap\_get\_cid}}(\mbox{\hyperlink{structng__l2cap}{ng\_l2cap\_p}} l2cap,\textcolor{keywordtype}{int} isle)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00631}00631 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00632}00632         u\_int16\_t       cid ;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00633}00633         u\_int16\_t       endcid;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00634}00634         uint16\_t         mask;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00635}00635         \textcolor{keywordtype}{int} idtype;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00636}00636         \textcolor{keywordflow}{if}(isle)\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00637}00637                 endcid = l2cap-\/>\mbox{\hyperlink{structng__l2cap_a97d83a5bf6967cefd29b848c31c83b54}{lecid}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00638}00638                 \textcolor{comment}{/*Assume Last CID is 2\string^n-\/1 */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00639}00639                 mask = \mbox{\hyperlink{ng__l2cap_8h_a735ed843f3efe3b82c08b4ea45fe7975}{NG\_L2CAP\_LELAST\_CID}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00640}00640                 idtype = \mbox{\hyperlink{ng__l2cap_8h_a2534bcfe1122fdcfa67c5dbd92b2232e}{NG\_L2CAP\_L2CA\_IDTYPE\_LE}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00641}00641         \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00642}00642                 endcid = l2cap-\/>\mbox{\hyperlink{structng__l2cap_aeafe30fbdd53f5019cb12b3289b2ffa5}{cid}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00643}00643                 \textcolor{comment}{/*Assume Last CID is 2\string^n-\/1 */}           }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00644}00644                 mask = \mbox{\hyperlink{ng__l2cap_8h_ace4850ee2a72e151c88ca25cf2a29980}{NG\_L2CAP\_LAST\_CID}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00645}00645                 idtype = \mbox{\hyperlink{ng__l2cap_8h_a446404915983b7f7db08a8faeaf67e9d}{NG\_L2CAP\_L2CA\_IDTYPE\_BREDR}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00646}00646         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00647}00647         cid = (endcid+1) \& mask;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00648}00648              }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00649}00649         \textcolor{keywordflow}{if} (cid < \mbox{\hyperlink{ng__l2cap_8h_af16136f034e794db8756c762e6d32372}{NG\_L2CAP\_FIRST\_CID}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00650}00650                 cid = \mbox{\hyperlink{ng__l2cap_8h_af16136f034e794db8756c762e6d32372}{NG\_L2CAP\_FIRST\_CID}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00651}00651 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00652}00652         \textcolor{keywordflow}{while} (cid != endcid) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00653}00653                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__l2cap__misc_8c_af3b629dfef958c078a630c80861bd86c}{ng\_l2cap\_chan\_by\_scid}}(l2cap, cid, idtype) == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00654}00654                         \textcolor{keywordflow}{if}(!isle)\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00655}00655                                 l2cap-\/>\mbox{\hyperlink{structng__l2cap_aeafe30fbdd53f5019cb12b3289b2ffa5}{cid}} = cid;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00656}00656                         \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00657}00657                                 l2cap-\/>\mbox{\hyperlink{structng__l2cap_a97d83a5bf6967cefd29b848c31c83b54}{lecid}} = cid;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00658}00658                         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00659}00659                         \textcolor{keywordflow}{return} (cid);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00660}00660                 \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00661}00661 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00662}00662                 cid ++;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00663}00663                 cid \&= mask;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00664}00664                 \textcolor{keywordflow}{if} (cid < \mbox{\hyperlink{ng__l2cap_8h_af16136f034e794db8756c762e6d32372}{NG\_L2CAP\_FIRST\_CID}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00665}00665                         cid = \mbox{\hyperlink{ng__l2cap_8h_af16136f034e794db8756c762e6d32372}{NG\_L2CAP\_FIRST\_CID}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00666}00666         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00667}00667                 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00668}00668         \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__l2cap_8h_a6614817d494c0b6a0812c6a42aa7b6a6}{NG\_L2CAP\_NULL\_CID}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00669}00669 \} \textcolor{comment}{/* ng\_l2cap\_get\_cid */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00670}00670 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00671}00671 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00672}00672 \textcolor{comment}{ * Get next available command ident}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00673}00673 \textcolor{comment}{ * XXX FIXME this is *UGLY* but will do for now}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00674}00674 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00675}00675 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00676}00676 u\_int8\_t}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00677}\mbox{\hyperlink{ng__l2cap__misc_8c_a19bdfb1ccba4bfe5703566d1a1ea4377}{00677}} \mbox{\hyperlink{ng__l2cap__misc_8c_a19bdfb1ccba4bfe5703566d1a1ea4377}{ng\_l2cap\_get\_ident}}(\mbox{\hyperlink{structng__l2cap__con}{ng\_l2cap\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00678}00678 \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00679}00679         u\_int8\_t        ident = con-\/>\mbox{\hyperlink{structng__l2cap__con_a60ae4ebd729c5362e6f0df75a43422d9}{ident}} + 1;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00680}00680 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00681}00681         \textcolor{keywordflow}{if} (ident < \mbox{\hyperlink{ng__l2cap__var_8h_ac320be745fcfd1a292d47af18cfd917c}{NG\_L2CAP\_FIRST\_IDENT}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00682}00682                 ident = \mbox{\hyperlink{ng__l2cap__var_8h_ac320be745fcfd1a292d47af18cfd917c}{NG\_L2CAP\_FIRST\_IDENT}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00683}00683 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00684}00684         \textcolor{keywordflow}{while} (ident != con-\/>\mbox{\hyperlink{structng__l2cap__con_a60ae4ebd729c5362e6f0df75a43422d9}{ident}}) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00685}00685                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__l2cap__misc_8c_a0b6f0df4c38dc1ad196e7d8458f8333b}{ng\_l2cap\_cmd\_by\_ident}}(con, ident) == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00686}00686                         con-\/>\mbox{\hyperlink{structng__l2cap__con_a60ae4ebd729c5362e6f0df75a43422d9}{ident}} = ident;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00687}00687 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00688}00688                         \textcolor{keywordflow}{return} (ident);}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00689}00689                 \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00690}00690 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00691}00691                 ident ++;}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00692}00692                 \textcolor{keywordflow}{if} (ident < \mbox{\hyperlink{ng__l2cap__var_8h_ac320be745fcfd1a292d47af18cfd917c}{NG\_L2CAP\_FIRST\_IDENT}})}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00693}00693                         ident = \mbox{\hyperlink{ng__l2cap__var_8h_ac320be745fcfd1a292d47af18cfd917c}{NG\_L2CAP\_FIRST\_IDENT}};}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00694}00694         \}}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00695}00695 }
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00696}00696         \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__l2cap__var_8h_ae5b87cf344736105227500c4419705b4}{NG\_L2CAP\_NULL\_IDENT}});}
\DoxyCodeLine{\Hypertarget{ng__l2cap__misc_8c_source_l00697}00697 \} \textcolor{comment}{/* ng\_l2cap\_get\_ident */}}

\end{DoxyCode}
