\hypertarget{ng__btsocket__l2cap_8c_source}{}\doxysection{ng\+\_\+btsocket\+\_\+l2cap.\+c}
\label{ng__btsocket__l2cap_8c_source}\index{netgraph/bluetooth/socket/ng\_btsocket\_l2cap.c@{netgraph/bluetooth/socket/ng\_btsocket\_l2cap.c}}
\mbox{\hyperlink{ng__btsocket__l2cap_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00002}00002 \textcolor{comment}{ * ng\_btsocket\_l2cap.c}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00003}00003 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00004}00004 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00005}00005 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00006}00006 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00007}00007 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00008}00008 \textcolor{comment}{ * Copyright (c) 2001-\/2002 Maksim Yevmenkin <m\_evmenkin@yahoo.com>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00009}00009 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00011}00011 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00012}00012 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00013}00013 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00014}00014 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00015}00015 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00016}00016 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00017}00017 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00018}00018 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00019}00019 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00020}00020 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00021}00021 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00022}00022 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00023}00023 \textcolor{comment}{ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00024}00024 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00025}00025 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00026}00026 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00027}00027 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00028}00028 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00029}00029 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00030}00030 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00031}00031 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00032}00032 \textcolor{comment}{ * \$Id: ng\_btsocket\_l2cap.c,v 1.16 2003/09/14 23:29:06 max Exp \$}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00033}00033 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00034}00034 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00035}00035 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/bitstring.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/domain.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/errno.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/filedesc.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/ioccom.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/protosw.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <sys/socket.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <sys/socketvar.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00053}00053 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <sys/taskqueue.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <net/vnet.h>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00057}00057 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00058}00058 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__message_8h}{netgraph/ng\_message.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{netgraph_8h}{netgraph/netgraph.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__bluetooth_8h}{netgraph/bluetooth/include/ng\_bluetooth.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00061}00061 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci_8h}{netgraph/bluetooth/include/ng\_hci.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00062}00062 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__l2cap_8h}{netgraph/bluetooth/include/ng\_l2cap.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00063}00063 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__btsocket_8h}{netgraph/bluetooth/include/ng\_btsocket.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00064}00064 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__btsocket__l2cap_8h}{netgraph/bluetooth/include/ng\_btsocket\_l2cap.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00066}00066 \textcolor{comment}{/* MALLOC define */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00067}00067 \textcolor{preprocessor}{\#ifdef NG\_SEPARATE\_MALLOC}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00068}00068 \textcolor{keyword}{static} \mbox{\hyperlink{ng__ccatm_8c_ae738595abd0b2c23262b81953927d5f8}{MALLOC\_DEFINE}}(\mbox{\hyperlink{ng__btsocket__l2cap_8c_a3faae7ab72087cb5a1a8e9166d018d1c}{M\_NETGRAPH\_BTSOCKET\_L2CAP}}, \textcolor{stringliteral}{"{}netgraph\_btsocks\_l2cap"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00069}00069                 \textcolor{stringliteral}{"{}Netgraph Bluetooth L2CAP sockets"{}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00070}00070 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00071}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a3faae7ab72087cb5a1a8e9166d018d1c}{00071}} \textcolor{preprocessor}{\#define M\_NETGRAPH\_BTSOCKET\_L2CAP M\_NETGRAPH}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00072}00072 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* NG\_SEPARATE\_MALLOC */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00073}00073 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00074}00074 \textcolor{comment}{/* Netgraph node methods */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00075}\mbox{\hyperlink{ng__btsocket__l2cap_8c_ab4981ee53237b219d8511372d3743c30}{00075}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_abb75b9ed2849e15851d6402d2ab5b899}{ng\_constructor\_t}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ab4981ee53237b219d8511372d3743c30}{ng\_btsocket\_l2cap\_node\_constructor}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00076}\mbox{\hyperlink{ng__btsocket__l2cap_8c_affcb6e7006b6e3f7df25f8254d355d6e}{00076}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a47b860e2900386e775707cc1ae661162}{ng\_rcvmsg\_t}}   \mbox{\hyperlink{ng__btsocket__l2cap_8c_affcb6e7006b6e3f7df25f8254d355d6e}{ng\_btsocket\_l2cap\_node\_rcvmsg}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00077}\mbox{\hyperlink{ng__btsocket__l2cap_8c_ab6416df1fc859748d16ada951d2dade5}{00077}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_aab0a679789a1af312a7f856b4668ad74}{ng\_shutdown\_t}}       \mbox{\hyperlink{ng__btsocket__l2cap_8c_ab6416df1fc859748d16ada951d2dade5}{ng\_btsocket\_l2cap\_node\_shutdown}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00078}\mbox{\hyperlink{ng__btsocket__l2cap_8c_ae46f2b1f7e3f107b0eb49a07c19667de}{00078}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_afa50639df4ed6eb400f8220a890d56e6}{ng\_newhook\_t}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ae46f2b1f7e3f107b0eb49a07c19667de}{ng\_btsocket\_l2cap\_node\_newhook}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00079}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a6941ca6aaca86c8bcc3befd5c927b172}{00079}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a0e4a4a62e48409635e5f33c548baaea7}{ng\_connect\_t}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6941ca6aaca86c8bcc3befd5c927b172}{ng\_btsocket\_l2cap\_node\_connect}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00080}\mbox{\hyperlink{ng__btsocket__l2cap_8c_ada379a045df403320852e058f6ec63c4}{00080}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_aa87ef7415b345b801747ceaf99de6c43}{ng\_rcvdata\_t}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ada379a045df403320852e058f6ec63c4}{ng\_btsocket\_l2cap\_node\_rcvdata}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00081}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a1476f2027341c08c4ab21bc2861c3714}{00081}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a669e1783335f933b4a4f90f17d22f381}{ng\_disconnect\_t}}   \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1476f2027341c08c4ab21bc2861c3714}{ng\_btsocket\_l2cap\_node\_disconnect}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00082}00082 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00083}00083 \textcolor{keyword}{static} \textcolor{keywordtype}{void}             \mbox{\hyperlink{ng__btsocket__l2cap_8c_a0d7fc77988ea975ada7df30fcb4edab7}{ng\_btsocket\_l2cap\_input}}   (\textcolor{keywordtype}{void} *, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00084}00084 \textcolor{keyword}{static} \textcolor{keywordtype}{void}             \mbox{\hyperlink{ng__btsocket__l2cap_8c_a0b8a0f04db34ced5b5ec71fb5635424d}{ng\_btsocket\_l2cap\_rtclean}} (\textcolor{keywordtype}{void} *, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00086}00086 \textcolor{comment}{/* Netgraph type descriptor */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00087}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a80a131770518c7fa3758d85054006e7a}{00087}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}}    \mbox{\hyperlink{ng__btsocket__l2cap_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}} = \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00088}00088         .\mbox{\hyperlink{structng__type_adbc1c8884ff0e625c19c4b513262fd0e}{version}} =       \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00089}00089         .name =         \mbox{\hyperlink{ng__btsocket_8h_ab557b67dfb9b578da59b77846423ffe4}{NG\_BTSOCKET\_L2CAP\_NODE\_TYPE}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00090}00090         .constructor =  \mbox{\hyperlink{ng__btsocket__l2cap_8c_ab4981ee53237b219d8511372d3743c30}{ng\_btsocket\_l2cap\_node\_constructor}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00091}00091         .rcvmsg =       \mbox{\hyperlink{ng__btsocket__l2cap_8c_affcb6e7006b6e3f7df25f8254d355d6e}{ng\_btsocket\_l2cap\_node\_rcvmsg}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00092}00092         .shutdown =     \mbox{\hyperlink{ng__btsocket__l2cap_8c_ab6416df1fc859748d16ada951d2dade5}{ng\_btsocket\_l2cap\_node\_shutdown}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00093}00093         .newhook =      \mbox{\hyperlink{ng__btsocket__l2cap_8c_ae46f2b1f7e3f107b0eb49a07c19667de}{ng\_btsocket\_l2cap\_node\_newhook}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00094}00094         .connect =      \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6941ca6aaca86c8bcc3befd5c927b172}{ng\_btsocket\_l2cap\_node\_connect}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00095}00095         .rcvdata =      \mbox{\hyperlink{ng__btsocket__l2cap_8c_ada379a045df403320852e058f6ec63c4}{ng\_btsocket\_l2cap\_node\_rcvdata}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00096}00096         .disconnect =   \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1476f2027341c08c4ab21bc2861c3714}{ng\_btsocket\_l2cap\_node\_disconnect}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00097}00097 \};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00098}00098 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00099}00099 \textcolor{comment}{/* Globals */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00100}00100 \textcolor{keyword}{extern} \textcolor{keywordtype}{int}                                      \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4ae44a4904f51f52d1275cc443a960a4}{ifqmaxlen}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00101}\mbox{\hyperlink{ng__btsocket__l2cap_8c_acef2131902542e3eeb034e7e04a2c39f}{00101}} \textcolor{keyword}{static} u\_int32\_t                                \mbox{\hyperlink{ng__btsocket__l2cap_8c_acef2131902542e3eeb034e7e04a2c39f}{ng\_btsocket\_l2cap\_debug\_level}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00102}\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{00102}} \textcolor{keyword}{static} \mbox{\hyperlink{structng__node}{node\_p}}                                     \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00103}\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{00103}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__bt__itemq}{ng\_bt\_itemq}}                    \mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00104}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{00104}} \textcolor{keyword}{static} \textcolor{keyword}{struct }mtx                               \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{ng\_btsocket\_l2cap\_queue\_mtx}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00105}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a3b70fc529bdf2ed4ef662583f96310be}{00105}} \textcolor{keyword}{static} \textcolor{keyword}{struct }task                              \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3b70fc529bdf2ed4ef662583f96310be}{ng\_btsocket\_l2cap\_queue\_task}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00106}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a183f01bc03fd9c6169bf1af399918f04}{00106}} \textcolor{keyword}{static} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a183f01bc03fd9c6169bf1af399918f04}{LIST\_HEAD}}(, \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb}}) ng\_btsocket\_l2cap\_sockets;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00107}00107 \textcolor{keyword}{static} \textcolor{keyword}{struct }mtx                               ng\_btsocket\_l2cap\_sockets\_mtx;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00108}00108 \textcolor{keyword}{static} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a183f01bc03fd9c6169bf1af399918f04}{LIST\_HEAD}}(, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry}}) ng\_btsocket\_l2cap\_rt;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00109}00109 \textcolor{keyword}{static} \textcolor{keyword}{struct }mtx                               ng\_btsocket\_l2cap\_rt\_mtx;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00110}00110 \textcolor{keyword}{static} \textcolor{keyword}{struct }task                              ng\_btsocket\_l2cap\_rt\_task;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00111}00111 \textcolor{keyword}{static} \textcolor{keyword}{struct }timeval                           ng\_btsocket\_l2cap\_lasttime;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00112}00112 \textcolor{keyword}{static} \textcolor{keywordtype}{int}                                      ng\_btsocket\_l2cap\_curpps;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00113}00113 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00114}00114 \textcolor{comment}{/* Sysctl tree */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00115}00115 SYSCTL\_DECL(\_net\_bluetooth\_l2cap\_sockets);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00116}00116 \textcolor{keyword}{static} \mbox{\hyperlink{ng__bluetooth_8c_a3c59ac7d808011194bfbbe652810f4e4}{SYSCTL\_NODE}}(\_net\_bluetooth\_l2cap\_sockets, OID\_AUTO, seq,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00117}00117     CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00118}00118     \textcolor{stringliteral}{"{}Bluetooth SEQPACKET L2CAP sockets family"{}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00119}00119 \mbox{\hyperlink{ng__bluetooth_8c_aeae145f2f7d2b59105b827ec16deecf3}{SYSCTL\_UINT}}(\_net\_bluetooth\_l2cap\_sockets\_seq, OID\_AUTO, debug\_level,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00120}00120         CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00121}00121         \&\mbox{\hyperlink{ng__btsocket__l2cap_8c_acef2131902542e3eeb034e7e04a2c39f}{ng\_btsocket\_l2cap\_debug\_level}}, \mbox{\hyperlink{ng__btsocket_8h_add6a7e27a470c8b3aeb4793e015b84bb}{NG\_BTSOCKET\_WARN\_LEVEL}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00122}00122         \textcolor{stringliteral}{"{}Bluetooth SEQPACKET L2CAP sockets debug level"{}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00123}00123 \mbox{\hyperlink{ng__bluetooth_8c_aeae145f2f7d2b59105b827ec16deecf3}{SYSCTL\_UINT}}(\_net\_bluetooth\_l2cap\_sockets\_seq, OID\_AUTO, queue\_len,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00124}00124         CTLFLAG\_RD,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00125}00125         \&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}}.\mbox{\hyperlink{structng__bt__itemq_ae75502ec4557ae00201acb1a16ae9505}{len}}, 0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00126}00126         \textcolor{stringliteral}{"{}Bluetooth SEQPACKET L2CAP sockets input queue length"{}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00127}00127 \mbox{\hyperlink{ng__bluetooth_8c_aeae145f2f7d2b59105b827ec16deecf3}{SYSCTL\_UINT}}(\_net\_bluetooth\_l2cap\_sockets\_seq, OID\_AUTO, queue\_maxlen,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00128}00128         CTLFLAG\_RD,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00129}00129         \&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}}.\mbox{\hyperlink{structng__bt__itemq_a1881770a6bd0fce44c8e330779971f3f}{maxlen}}, 0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00130}00130         \textcolor{stringliteral}{"{}Bluetooth SEQPACKET L2CAP sockets input queue max. length"{}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00131}00131 \mbox{\hyperlink{ng__bluetooth_8c_aeae145f2f7d2b59105b827ec16deecf3}{SYSCTL\_UINT}}(\_net\_bluetooth\_l2cap\_sockets\_seq, OID\_AUTO, queue\_drops,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00132}00132         CTLFLAG\_RD,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00133}00133         \&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}}.\mbox{\hyperlink{structng__bt__itemq_aac338b6d45f4722ae204e7596ab24afd}{drops}}, 0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00134}00134         \textcolor{stringliteral}{"{}Bluetooth SEQPACKET L2CAP sockets input queue drops"{}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00135}00135 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00136}00136 \textcolor{comment}{/* Debug */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00137}00137 \textcolor{preprocessor}{\#define NG\_BTSOCKET\_L2CAP\_INFO \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00138}00138 \textcolor{preprocessor}{        if (ng\_btsocket\_l2cap\_debug\_level >= NG\_BTSOCKET\_INFO\_LEVEL \&\& \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00139}00139 \textcolor{preprocessor}{            ppsratecheck(\&ng\_btsocket\_l2cap\_lasttime, \&ng\_btsocket\_l2cap\_curpps, 1)) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00140}00140 \textcolor{preprocessor}{                printf}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00142}00142 \textcolor{preprocessor}{\#define NG\_BTSOCKET\_L2CAP\_WARN \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00143}00143 \textcolor{preprocessor}{        if (ng\_btsocket\_l2cap\_debug\_level >= NG\_BTSOCKET\_WARN\_LEVEL \&\& \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00144}00144 \textcolor{preprocessor}{            ppsratecheck(\&ng\_btsocket\_l2cap\_lasttime, \&ng\_btsocket\_l2cap\_curpps, 1)) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00145}00145 \textcolor{preprocessor}{                printf}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00146}00146 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00147}00147 \textcolor{preprocessor}{\#define NG\_BTSOCKET\_L2CAP\_ERR \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00148}00148 \textcolor{preprocessor}{        if (ng\_btsocket\_l2cap\_debug\_level >= NG\_BTSOCKET\_ERR\_LEVEL \&\& \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00149}00149 \textcolor{preprocessor}{            ppsratecheck(\&ng\_btsocket\_l2cap\_lasttime, \&ng\_btsocket\_l2cap\_curpps, 1)) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00150}00150 \textcolor{preprocessor}{                printf}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00151}00151 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00152}00152 \textcolor{preprocessor}{\#define NG\_BTSOCKET\_L2CAP\_ALERT \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00153}00153 \textcolor{preprocessor}{        if (ng\_btsocket\_l2cap\_debug\_level >= NG\_BTSOCKET\_ALERT\_LEVEL \&\& \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00154}00154 \textcolor{preprocessor}{            ppsratecheck(\&ng\_btsocket\_l2cap\_lasttime, \&ng\_btsocket\_l2cap\_curpps, 1)) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00155}00155 \textcolor{preprocessor}{                printf}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00156}00156 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00157}00157 \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00158}00158 \textcolor{comment}{ * Netgraph message processing routines}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00159}00159 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00160}00160 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00161}00161 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6087cf99e374800f5fb5ca36bd23e85f}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_req\_rsp}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00162}00162         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00163}00163 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a05c69d373982338382400e9b20f18a12}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_rsp\_rsp}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00164}00164         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00165}00165 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a8e240f7f7482f2602394f31ffc089472}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_ind}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00166}00166         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00167}00167 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00168}00168 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a870a62b8ef1faad1b53bc998722b9a8f}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_req\_rsp}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00169}00169         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00170}00170 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3be8a1439ebd87a8707f2fa8ce4e478b}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_rsp\_rsp}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00171}00171         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00172}00172 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa709183e7489314abb5fd1fb144ac917}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_ind}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00173}00173         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00174}00174 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00175}00175 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ae18f6782aca72e0450937f6e1eb5c602}{ng\_btsocket\_l2cap\_process\_l2ca\_discon\_rsp}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00176}00176         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00177}00177 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a51ad96b4ba31495e41b8d668bb035484}{ng\_btsocket\_l2cap\_process\_l2ca\_discon\_ind}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00178}00178         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00179}00179 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00180}00180 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a268f3698c4d5b1be38fe28eb5350a973}{ng\_btsocket\_l2cap\_process\_l2ca\_write\_rsp}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00181}00181         (\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00182}00182 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00183}00183 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00184}00184 \textcolor{comment}{ * Send L2CA\_xxx messages to the lower layer}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00185}00185 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00186}00186 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00187}00187 \textcolor{keyword}{static} \textcolor{keywordtype}{int}  \mbox{\hyperlink{ng__btsocket__l2cap_8c_a9106e565b3d4b10ec30e72e1cfbf8c95}{ng\_btsocket\_l2cap\_send\_l2ca\_con\_req}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00188}00188         (\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00189}00189 \textcolor{keyword}{static} \textcolor{keywordtype}{int}  \mbox{\hyperlink{ng__btsocket__l2cap_8c_a85c65d62afe556b2a9c3a0760793e31b}{ng\_btsocket\_l2cap\_send\_l2ca\_con\_rsp\_req}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00190}00190         (u\_int32\_t, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}}, \mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}}, \textcolor{keywordtype}{int}, \textcolor{keywordtype}{int}, \textcolor{keywordtype}{int}, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00191}00191 \textcolor{keyword}{static} \textcolor{keywordtype}{int}  \mbox{\hyperlink{ng__btsocket__l2cap_8c_a99b3902ad3f7837bceeb1e5a7a0227eb}{ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_req}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00192}00192         (\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00193}00193 \textcolor{keyword}{static} \textcolor{keywordtype}{int}  \mbox{\hyperlink{ng__btsocket__l2cap_8c_a126f95a94d7ce702ee09febf98b9665d}{ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_rsp}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00194}00194         (\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00195}00195 \textcolor{keyword}{static} \textcolor{keywordtype}{int}  \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00196}00196         (u\_int32\_t, \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00197}00197 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00198}00198 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6bf5d2757d63f922ed0e06613fe109dd}{ng\_btsocket\_l2cap\_send2}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00199}00199         (\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00200}00200 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00201}00201 \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00202}00202 \textcolor{comment}{ * Timeout processing routines}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00203}00203 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00204}00204 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00205}00205 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}         (\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00206}00206 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}       (\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00207}00207 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4e395c2948c1db7ef8243883ac4484bf}{ng\_btsocket\_l2cap\_process\_timeout}} (\textcolor{keywordtype}{void} *);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00208}00208 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00209}00209 \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00210}00210 \textcolor{comment}{ * Other stuff }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00211}00211 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00212}00212 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00213}00213 \textcolor{keyword}{static} \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}     \mbox{\hyperlink{ng__btsocket__l2cap_8c_a5d95f4ec25ed0ca9f708f12fa6696d27}{ng\_btsocket\_l2cap\_pcb\_by\_addr}}(\mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}}, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00214}00214 \textcolor{keyword}{static} \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}     \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{ng\_btsocket\_l2cap\_pcb\_by\_token}}(u\_int32\_t);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00215}00215 \textcolor{keyword}{static} \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}     \mbox{\hyperlink{ng__btsocket__l2cap_8c_abadc2c7cc4f9dffa7233af08dd085d2e}{ng\_btsocket\_l2cap\_pcb\_by\_cid}} (\mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}}, \textcolor{keywordtype}{int},\textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00216}00216 \textcolor{keyword}{static} \textcolor{keywordtype}{int}                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a950fa90ca97e8ca76082845ac01fe4e5}{ng\_btsocket\_l2cap\_result2errno}}(\textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00217}00217 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00218}00218 \textcolor{keyword}{static} \textcolor{keywordtype}{int} ng\_btsock\_l2cap\_addrtype\_to\_linktype(\textcolor{keywordtype}{int} addrtype);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00219}00219 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00220}00220 \textcolor{preprocessor}{\#define ng\_btsocket\_l2cap\_wakeup\_input\_task() \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00221}00221 \textcolor{preprocessor}{        taskqueue\_enqueue(taskqueue\_swi\_giant, \&ng\_btsocket\_l2cap\_queue\_task)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00222}00222 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00223}00223 \textcolor{preprocessor}{\#define ng\_btsocket\_l2cap\_wakeup\_route\_task() \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00224}00224 \textcolor{preprocessor}{        taskqueue\_enqueue(taskqueue\_swi\_giant, \&ng\_btsocket\_l2cap\_rt\_task)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00225}00225 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00226}00226 \textcolor{keywordtype}{int} ng\_btsock\_l2cap\_addrtype\_to\_linktype(\textcolor{keywordtype}{int} addrtype)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00227}00227 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00228}00228         \textcolor{keywordflow}{switch}(addrtype)\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00229}00229         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__bluetooth_8h_ad09494a7a7e9ad5d99de277cbfd61255}{BDADDR\_LE\_PUBLIC}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00230}00230                 \textcolor{keywordflow}{return} \mbox{\hyperlink{ng__hci_8h_afecc38805812b20f02942504b17892f4}{NG\_HCI\_LINK\_LE\_PUBLIC}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00231}00231         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__bluetooth_8h_af6cca9801bb94cff8de64fa757032326}{BDADDR\_LE\_RANDOM}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00232}00232                 \textcolor{keywordflow}{return} \mbox{\hyperlink{ng__hci_8h_a557665f3f28bb33759ed8ec4eb28d385}{NG\_HCI\_LINK\_LE\_RANDOM}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00233}00233         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00234}00234                 \textcolor{keywordflow}{return} \mbox{\hyperlink{ng__hci_8h_aac64c463cc734bbdf8ba030619e8a64d}{NG\_HCI\_LINK\_ACL}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00235}00235         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00236}00236 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00237}00237 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00238}00238 \textcolor{comment}{/*****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00239}00239 \textcolor{comment}{ *****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00240}00240 \textcolor{comment}{ **                        Netgraph node interface}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00241}00241 \textcolor{comment}{ *****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00242}00242 \textcolor{comment}{ *****************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00243}00243 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00244}00244 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00245}00245 \textcolor{comment}{ * Netgraph node constructor. Do not allow to create node of this type.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00246}00246 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00247}00247 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00248}00248 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00249}\mbox{\hyperlink{ng__btsocket__l2cap_8c_ac1b834e83ff28f4170608457c79eb127}{00249}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ab4981ee53237b219d8511372d3743c30}{ng\_btsocket\_l2cap\_node\_constructor}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00250}00250 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00251}00251         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00252}00252 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_node\_constructor */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00253}00253 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00254}00254 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00255}00255 \textcolor{comment}{ * Do local shutdown processing. Let old node go and create new fresh one.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00256}00256 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00258}00258 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00259}\mbox{\hyperlink{ng__btsocket__l2cap_8c_aeddbf0bd7db71dc56a567c949bbdce3f}{00259}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ab6416df1fc859748d16ada951d2dade5}{ng\_btsocket\_l2cap\_node\_shutdown}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00260}00260 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00261}00261         \textcolor{keywordtype}{int}     error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00262}00262 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00263}00263         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00264}00264 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00265}00265         \textcolor{comment}{/* Create new node */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00266}00266         error = \mbox{\hyperlink{netgraph_8h_aba2cbbfc891d71bd283ce2368c8392db}{ng\_make\_node\_common}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}}, \&\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00267}00267         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00268}00268                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00269}00269 \textcolor{stringliteral}{"{}\%s: Could not create Netgraph node, error=\%d\(\backslash\)n"{}}, \_\_func\_\_, error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00270}00270 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00271}00271                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00272}00272 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00273}00273                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00274}00274         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00275}00275 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00276}00276         error = \mbox{\hyperlink{netgraph_8h_abae5851c9f312eebd398b1cd085fe067}{ng\_name\_node}}(\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00277}00277                                 \mbox{\hyperlink{ng__btsocket_8h_ab557b67dfb9b578da59b77846423ffe4}{NG\_BTSOCKET\_L2CAP\_NODE\_TYPE}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00278}00278         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00279}00279                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00280}00280 \textcolor{stringliteral}{"{}\%s: Could not name Netgraph node, error=\%d\(\backslash\)n"{}}, \_\_func\_\_, error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00281}00281 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00282}00282                 \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00283}00283                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00284}00284 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00285}00285                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00286}00286         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00287}00287                 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00288}00288         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00289}00289 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_node\_shutdown */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00290}00290 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00291}00291 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00292}00292 \textcolor{comment}{ * We allow any hook to be connected to the node.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00293}00293 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00294}00294 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00295}00295 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00296}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a25334fffce9b6ce03a3bc5c93ec8fdcb}{00296}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ae46f2b1f7e3f107b0eb49a07c19667de}{ng\_btsocket\_l2cap\_node\_newhook}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{char} \textcolor{keyword}{const} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00297}00297 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00298}00298         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00299}00299 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_node\_newhook */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00300}00300 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00301}00301 \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00302}00302 \textcolor{comment}{ * Just say "{}YEP, that's OK by me!"{}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00303}00303 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00304}00304 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00305}00305 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00306}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a81156a24ec359b1c6b1058ac877a3194}{00306}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6941ca6aaca86c8bcc3befd5c927b172}{ng\_btsocket\_l2cap\_node\_connect}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00307}00307 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00308}00308         \mbox{\hyperlink{netgraph_8h_a8167c04e701189ca4bc1bc3af5454ce6}{NG\_HOOK\_SET\_PRIVATE}}(hook, NULL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00309}00309         \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook); \textcolor{comment}{/* Keep extra reference to the hook */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00310}00310 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00311}00311 \textcolor{preprocessor}{\#if 0}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00312}00312         \mbox{\hyperlink{netgraph_8h_aa1237a32cabb47ae66cce0f75d2baceb}{NG\_HOOK\_FORCE\_QUEUE}}(\mbox{\hyperlink{netgraph_8h_a74d793bf65c44f5732dbaf331d871681}{NG\_HOOK\_PEER}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00313}00313         \mbox{\hyperlink{netgraph_8h_aa1237a32cabb47ae66cce0f75d2baceb}{NG\_HOOK\_FORCE\_QUEUE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00314}00314 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00315}00315 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00316}00316         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00317}00317 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_node\_connect */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00318}00318 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00319}00319 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00320}00320 \textcolor{comment}{ * Hook disconnection. Schedule route cleanup task}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00321}00321 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00322}00322 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00323}00323 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00324}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a26969a8ec5236371fdfe0ba06a9bed10}{00324}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1476f2027341c08c4ab21bc2861c3714}{ng\_btsocket\_l2cap\_node\_disconnect}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00325}00325 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00326}00326         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00327}00327 \textcolor{comment}{         * If hook has private information than we must have this hook in}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00328}00328 \textcolor{comment}{         * the routing table and must schedule cleaning for the routing table.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00329}00329 \textcolor{comment}{         * Otherwise hook was connected but we never got "{}hook\_info"{} message,}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00330}00330 \textcolor{comment}{         * so we have never added this hook to the routing table and it save}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00331}00331 \textcolor{comment}{         * to just delete it.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00332}00332 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00333}00333 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00334}00334         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook) != NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00335}00335                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_a5dbd2054949df30d6c246de82fdc62c3}{ng\_btsocket\_l2cap\_wakeup\_route\_task}}());}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00336}00336 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00337}00337         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook); \textcolor{comment}{/* Remove extra reference */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00338}00338 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00339}00339         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00340}00340 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_node\_disconnect */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00341}00341 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00342}00342 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00343}00343 \textcolor{comment}{ * Process incoming messages }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00344}00344 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00345}00345 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00346}00346 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00347}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a51cc26dd22743dd696caffc1545a63}{00347}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_affcb6e7006b6e3f7df25f8254d355d6e}{ng\_btsocket\_l2cap\_node\_rcvmsg}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00348}00348 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00349}00349         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}   *msg = \mbox{\hyperlink{netgraph_8h_a1377b8149d9d15b4856104076930fd88}{NGI\_MSG}}(item); \textcolor{comment}{/* item still has message */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00350}00350         \textcolor{keywordtype}{int}              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00351}00351 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00352}00352         \textcolor{keywordflow}{if} (msg != NULL \&\& msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_ab59e14593b69a406ed5ca4209d489a10}{typecookie}} == \mbox{\hyperlink{ng__l2cap_8h_a7e452e3322a39653affa38cdea2c761a}{NGM\_L2CAP\_COOKIE}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00353}00353                 mtx\_lock(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{ng\_btsocket\_l2cap\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00354}00354                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__bluetooth_8h_a0d7b74f8b75184a1b93e5d7cb81945ce}{NG\_BT\_ITEMQ\_FULL}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00355}00355                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00356}00356 \textcolor{stringliteral}{"{}\%s: Input queue is full (msg)\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00357}00357 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00358}00358                         \mbox{\hyperlink{ng__bluetooth_8h_aeabfe2b533d531ed490f22826e86eb82}{NG\_BT\_ITEMQ\_DROP}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00359}00359                         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00360}00360                         error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00361}00361                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00362}00362                         \textcolor{keywordflow}{if} (hook != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00363}00363                                 \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00364}00364                                 \mbox{\hyperlink{netgraph_8h_a022a652da5adecfd757ff7b5906a9957}{NGI\_SET\_HOOK}}(item, hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00365}00365                         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00366}00366 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00367}00367                         \mbox{\hyperlink{ng__bluetooth_8h_a0a1d3e4078540c449e00e7bfd3dcea3c}{NG\_BT\_ITEMQ\_ENQUEUE}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}}, item);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00368}00368                         error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_ac3b15aaef536a36e8a665a6e4de213f2}{ng\_btsocket\_l2cap\_wakeup\_input\_task}}();}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00369}00369                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00370}00370                 mtx\_unlock(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{ng\_btsocket\_l2cap\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00371}00371         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00372}00372                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00373}00373                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00374}00374         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00375}00375 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00376}00376         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00377}00377 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_node\_rcvmsg */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00378}00378 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00379}00379 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00380}00380 \textcolor{comment}{ * Receive data on a hook}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00381}00381 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00382}00382 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00383}00383 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00384}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a943b4fa703df9542a31fdf2cc819c2d0}{00384}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ada379a045df403320852e058f6ec63c4}{ng\_btsocket\_l2cap\_node\_rcvdata}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook, \mbox{\hyperlink{structng__item}{item\_p}} item)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00385}00385 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00386}00386         \textcolor{keywordtype}{int}     error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00387}00387 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00388}00388         mtx\_lock(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{ng\_btsocket\_l2cap\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00389}00389         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__bluetooth_8h_a0d7b74f8b75184a1b93e5d7cb81945ce}{NG\_BT\_ITEMQ\_FULL}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00390}00390                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00391}00391 \textcolor{stringliteral}{"{}\%s: Input queue is full (data)\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00392}00392 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00393}00393                 \mbox{\hyperlink{ng__bluetooth_8h_aeabfe2b533d531ed490f22826e86eb82}{NG\_BT\_ITEMQ\_DROP}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00394}00394                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00395}00395                 error = ENOBUFS;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00396}00396         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00397}00397                 \mbox{\hyperlink{netgraph_8h_aa62902771ada6bf2c313d96abadb3c85}{NG\_HOOK\_REF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00398}00398                 \mbox{\hyperlink{netgraph_8h_a022a652da5adecfd757ff7b5906a9957}{NGI\_SET\_HOOK}}(item, hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00399}00399 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00400}00400                 \mbox{\hyperlink{ng__bluetooth_8h_a0a1d3e4078540c449e00e7bfd3dcea3c}{NG\_BT\_ITEMQ\_ENQUEUE}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}}, item);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00401}00401                 error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_ac3b15aaef536a36e8a665a6e4de213f2}{ng\_btsocket\_l2cap\_wakeup\_input\_task}}();}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00402}00402         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00403}00403         mtx\_unlock(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{ng\_btsocket\_l2cap\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00404}00404 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00405}00405         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00406}00406 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_node\_rcvdata */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00407}00407 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00408}00408 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00409}00409 \textcolor{comment}{ * Process L2CA\_Connect respose. Socket layer must have initiated connection,}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00410}00410 \textcolor{comment}{ * so we have to have a socket associated with message token.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00411}00411 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00412}00412 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00413}00413 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00414}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a6087cf99e374800f5fb5ca36bd23e85f}{00414}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6087cf99e374800f5fb5ca36bd23e85f}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_req\_rsp}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00415}00415                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00416}00416 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00417}00417         \mbox{\hyperlink{structng__l2cap__l2ca__con__op}{ng\_l2cap\_l2ca\_con\_op}}        *op = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00418}00418         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}  *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00419}00419         \textcolor{keywordtype}{int}                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00420}00420 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00421}00421         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*op))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00422}00422                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00423}00423 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00424}00424         op = (\mbox{\hyperlink{structng__l2cap__l2ca__con__op}{ng\_l2cap\_l2ca\_con\_op}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00425}00425 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00426}00426         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00427}00427 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00428}00428         \textcolor{comment}{/* Look for the socket with the token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00429}00429         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{ng\_btsocket\_l2cap\_pcb\_by\_token}}(msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00430}00430         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00431}00431                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00432}00432                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00433}00433         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00434}00434 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00435}00435         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00436}00436 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00437}00437         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00438}00438 \textcolor{stringliteral}{"{}\%s: Got L2CA\_Connect response, token=\%d, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00439}00439 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, result=\%d, status=\%d, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00440}00440 \textcolor{stringliteral}{"{}state=\%d\(\backslash\)n"{}},   \_\_func\_\_, msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00441}00441                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00442}00442                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00443}00443                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00444}00444                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00445}00445                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a9d4949c1ad9b7caa4eb01b995a453de7}{lcid}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a855a8d72d57d3afe902f0220123cbdb4}{result}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_ad32ad74e07ca03d890ce3ad88c6be7cd}{status}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00446}00446                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00447}00447 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00448}00448         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_a1bef328ad25d99c18012e0f9db9246db}{NG\_BTSOCKET\_L2CAP\_CONNECTING}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00449}00449                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00450}00450                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00451}00451 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00452}00452                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00453}00453         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00454}00454 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00455}00455         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00456}00456 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00457}00457         \textcolor{keywordflow}{if} (op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a855a8d72d57d3afe902f0220123cbdb4}{result}} == \mbox{\hyperlink{ng__l2cap_8h_a2e2fb686722a079d57684184f778e292}{NG\_L2CAP\_PENDING}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00458}00458                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00459}00459                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00460}00460                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00461}00461 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00462}00462                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00463}00463         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00464}00464 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00465}00465         \textcolor{keywordflow}{if} (op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a855a8d72d57d3afe902f0220123cbdb4}{result}} == \mbox{\hyperlink{ng__l2cap_8h_aa58b6924d7adc5c9f97973bb5a6642ce}{NG\_L2CAP\_SUCCESS}})\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00466}00466                 \textcolor{keywordflow}{if}((pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a25725146b54a9789b596ce2e417487ba}{idtype}} == \mbox{\hyperlink{ng__l2cap_8h_aa28ed4e421ee5ca6057d264e6fa0c9a7}{NG\_L2CAP\_L2CA\_IDTYPE\_ATT}})||}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00467}00467                    (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a25725146b54a9789b596ce2e417487ba}{idtype}} == \mbox{\hyperlink{ng__l2cap_8h_a4d8f2b5d106fe39d83d37c8d1a418b09}{NG\_L2CAP\_L2CA\_IDTYPE\_SMP}}))\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00468}00468                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4b57c41af69797c7a2802b576e3fb178}{encryption}} = op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a2f0d03aeb6f77f5997ef9286484863a0}{encryption}};                                   pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}} = op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a9d4949c1ad9b7caa4eb01b995a453de7}{lcid}};     }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00469}00469                         \textcolor{keywordflow}{if}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_abe0b47708a419f4e9840080242348fd6}{need\_encrypt}} \&\& !(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4b57c41af69797c7a2802b576e3fb178}{encryption}}))\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00470}00470                                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00471}00471                                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a9aa68f78b2908d9e193caf4e271fcde0}{NG\_BTSOCKET\_L2CAP\_W4\_ENC\_CHANGE}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00472}00472                         \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00473}00473                                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00474}00474                                 soisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00475}00475                         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00476}00476                 \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00477}00477                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00478}00478 \textcolor{comment}{                         * Channel is now open, so update local channel ID and }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00479}00479 \textcolor{comment}{                         * start configuration process. Source and destination}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00480}00480 \textcolor{comment}{                         * addresses as well as route must be already set.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00481}00481 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00482}00482                         }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00483}00483                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}} = op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a9d4949c1ad9b7caa4eb01b995a453de7}{lcid}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00484}00484                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4b57c41af69797c7a2802b576e3fb178}{encryption}} = op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a2f0d03aeb6f77f5997ef9286484863a0}{encryption}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00485}00485                         error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a99b3902ad3f7837bceeb1e5a7a0227eb}{ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_req}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00486}00486                         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00487}00487                                 \textcolor{comment}{/* Send disconnect request with "{}zero"{} token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00488}00488                                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(0, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00489}00489                                 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00490}00490                                 \textcolor{comment}{/* ... and close the socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00491}00491                                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00492}00492                                 soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00493}00493                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00494}00494                                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_ad5699ba89cc86e1179466bcf26ea9ddf}{NG\_BTSOCKET\_L2CAP\_CFG\_IN\_SENT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00495}00495                                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_ae0e9aad23bcdb71d3bbcd783363edf29}{NG\_BTSOCKET\_L2CAP\_CONFIGURING}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00496}00496                                 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00497}00497                                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00498}00498                         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00499}00499                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00500}00500         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00501}00501                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00502}00502 \textcolor{comment}{                 * We have failed to open connection, so convert result}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00503}00503 \textcolor{comment}{                 * code to "{}errno"{} code and disconnect the socket. Channel}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00504}00504 \textcolor{comment}{                 * already has been closed.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00505}00505 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00506}00506 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00507}00507                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a950fa90ca97e8ca76082845ac01fe4e5}{ng\_btsocket\_l2cap\_result2errno}}(op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__op_a855a8d72d57d3afe902f0220123cbdb4}{result}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00508}00508                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00509}00509                 soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}); }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00510}00510         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00511}00511         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00512}00512         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00513}00513 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00514}00514         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00515}00515 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_l2ca\_con\_req\_rsp */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00516}00516 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00517}00517 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00518}00518 \textcolor{comment}{ * Process L2CA\_ConnectRsp response}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00519}00519 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00520}00520 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00521}00521 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00522}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a05c69d373982338382400e9b20f18a12}{00522}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a05c69d373982338382400e9b20f18a12}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_rsp\_rsp}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00523}00523                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00524}00524 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00525}00525         \mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__op}{ng\_l2cap\_l2ca\_con\_rsp\_op}}        *op = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00526}00526         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}          *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00527}00527 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00528}00528         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*op)) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00529}00529                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00530}00530 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00531}00531         op = (\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__op}{ng\_l2cap\_l2ca\_con\_rsp\_op}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00532}00532 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00533}00533         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00534}00534 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00535}00535         \textcolor{comment}{/* Look for the socket with the token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00536}00536         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{ng\_btsocket\_l2cap\_pcb\_by\_token}}(msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00537}00537         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00538}00538                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00539}00539                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00540}00540         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00541}00541 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00542}00542         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00543}00543 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00544}00544         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00545}00545 \textcolor{stringliteral}{"{}\%s: Got L2CA\_ConnectRsp response, token=\%d, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00546}00546 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, result=\%d, state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00547}00547                 \_\_func\_\_, msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00548}00548                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00549}00549                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00550}00550                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00551}00551                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00552}00552                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__op_aabcc908b0d6273b37464ae259c4f94c8}{result}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00553}00553 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00554}00554         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_a1bef328ad25d99c18012e0f9db9246db}{NG\_BTSOCKET\_L2CAP\_CONNECTING}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00555}00555                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00556}00556                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00557}00557 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00558}00558                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00559}00559         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00560}00560 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00561}00561         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00562}00562 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00563}00563         \textcolor{comment}{/* Check the result and disconnect the socket on failure */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00564}00564         \textcolor{keywordflow}{if} (op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__op_aabcc908b0d6273b37464ae259c4f94c8}{result}} != \mbox{\hyperlink{ng__l2cap_8h_aa58b6924d7adc5c9f97973bb5a6642ce}{NG\_L2CAP\_SUCCESS}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00565}00565                 \textcolor{comment}{/* Close the socket -\/ channel already closed */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00566}00566                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a950fa90ca97e8ca76082845ac01fe4e5}{ng\_btsocket\_l2cap\_result2errno}}(op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__op_aabcc908b0d6273b37464ae259c4f94c8}{result}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00567}00567                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00568}00568                 soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00569}00569         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00570}00570                 \textcolor{comment}{/* Move to CONFIGURING state and wait for CONFIG\_IND */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00571}00571                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00572}00572                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_ae0e9aad23bcdb71d3bbcd783363edf29}{NG\_BTSOCKET\_L2CAP\_CONFIGURING}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00573}00573                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00574}00574         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00575}00575 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00576}00576         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00577}00577         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00578}00578 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00579}00579         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00580}00580 \} \textcolor{comment}{/* ng\_btsocket\_process\_l2ca\_con\_rsp\_rsp */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00581}00581 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00582}00582 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00583}00583 \textcolor{comment}{ * Process L2CA\_Connect indicator. Find socket that listens on address }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00584}00584 \textcolor{comment}{ * and PSM. Find exact or closest match. Create new socket and initiate }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00585}00585 \textcolor{comment}{ * connection.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00586}00586 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00587}00587 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00588}00588 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00589}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a8e240f7f7482f2602394f31ffc089472}{00589}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a8e240f7f7482f2602394f31ffc089472}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_ind}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00590}00590                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00591}00591 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00592}00592         \mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip}{ng\_l2cap\_l2ca\_con\_ind\_ip}}        *ip = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00593}00593         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}          *pcb = NULL, *pcb1 = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00594}00594         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00595}00595         u\_int32\_t                        token = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00596}00596         u\_int16\_t                        result = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00597}00597 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00598}00598         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*ip))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00599}00599                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00600}00600 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00601}00601         ip = (\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip}{ng\_l2cap\_l2ca\_con\_ind\_ip}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00602}00602 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00603}00603         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00604}00604 \textcolor{stringliteral}{"{}\%s: Got L2CA\_Connect indicator, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00605}00605 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, ident=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00606}00606                 \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00607}00607                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00608}00608                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00609}00609                 ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_add430d8ee46fbf365ee6dc34b9f3d067}{bdaddr}}.b[5], ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_add430d8ee46fbf365ee6dc34b9f3d067}{bdaddr}}.b[4], ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_add430d8ee46fbf365ee6dc34b9f3d067}{bdaddr}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00610}00610                 ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_add430d8ee46fbf365ee6dc34b9f3d067}{bdaddr}}.b[2], ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_add430d8ee46fbf365ee6dc34b9f3d067}{bdaddr}}.b[1], ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_add430d8ee46fbf365ee6dc34b9f3d067}{bdaddr}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00611}00611                 ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_acb90185a30cda2a3de092a2f2a8db821}{psm}}, ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_a077d8df376a5acfe759a4cb784a5b5ff}{lcid}}, ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_a89587cb236203802fef999317cadf6b9}{ident}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00612}00612 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00613}00613         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00614}00614 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00615}00615         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a5d95f4ec25ed0ca9f708f12fa6696d27}{ng\_btsocket\_l2cap\_pcb\_by\_addr}}(\&rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}, ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_acb90185a30cda2a3de092a2f2a8db821}{psm}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00616}00616         \textcolor{keywordflow}{if} (pcb != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00617}00617                 \textcolor{keyword}{struct }socket *so1;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00618}00618 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00619}00619                 mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00620}00620 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00621}00621                 CURVNET\_SET(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_vnet);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00622}00622                 so1 = sonewconn(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00623}00623                 CURVNET\_RESTORE();}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00624}00624                 \textcolor{keywordflow}{if} (so1 == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00625}00625                         result = \mbox{\hyperlink{ng__l2cap_8h_ad8f850dc8606527f1ce5a2e217b7d2d6}{NG\_L2CAP\_NO\_RESOURCES}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00626}00626                         \textcolor{keywordflow}{goto} respond;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00627}00627                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00628}00628 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00629}00629                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00630}00630 \textcolor{comment}{                 * If we got here than we have created new socket. So complete }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00631}00631 \textcolor{comment}{                 * connection. If we we listening on specific address then copy }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00632}00632 \textcolor{comment}{                 * source address from listening socket, otherwise copy source }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00633}00633 \textcolor{comment}{                 * address from hook's routing information.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00634}00634 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00635}00635 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00636}00636                 pcb1 = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so1);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00637}00637                 KASSERT((pcb1 != NULL),}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00638}00638 (\textcolor{stringliteral}{"{}\%s: pcb1 == NULL\(\backslash\)n"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00639}00639 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00640}00640                 mtx\_lock(\&pcb1-\/>pcb\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00641}00641 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00642}00642                 \textcolor{keywordflow}{if} (bcmp(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \mbox{\hyperlink{ng__hci_8h_a5087b37d7deab31f2b7c7580982b4c1c}{NG\_HCI\_BDADDR\_ANY}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}})) != 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00643}00643                         bcopy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \&pcb1-\/>src, \textcolor{keyword}{sizeof}(pcb1-\/>src));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00644}00644                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00645}00645                         bcopy(\&rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}, \&pcb1-\/>src, \textcolor{keyword}{sizeof}(pcb1-\/>src));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00646}00646 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00647}00647                 pcb1-\/>flags \&= \string~NG\_BTSOCKET\_L2CAP\_CLIENT;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00648}00648 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00649}00649                 bcopy(\&ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_add430d8ee46fbf365ee6dc34b9f3d067}{bdaddr}}, \&pcb1-\/>dst, \textcolor{keyword}{sizeof}(pcb1-\/>dst));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00650}00650                 pcb1-\/>psm = ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_acb90185a30cda2a3de092a2f2a8db821}{psm}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00651}00651                 pcb1-\/>cid = ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_a077d8df376a5acfe759a4cb784a5b5ff}{lcid}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00652}00652                 pcb1-\/>rt = rt;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00653}00653 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00654}00654                 \textcolor{comment}{/* Copy socket settings */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00655}00655                 pcb1-\/>imtu = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00656}00656                 bcopy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}, \&pcb1-\/>oflow, \textcolor{keyword}{sizeof}(pcb1-\/>oflow));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00657}00657                 pcb1-\/>flush\_timo = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a733ff83b9b31d09d9c50af47d8df753c}{flush\_timo}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00658}00658 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00659}00659                 token = pcb1-\/>token;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00660}00660         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00661}00661                 \textcolor{comment}{/* Nobody listens on requested BDADDR/PSM */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00662}00662                 result = \mbox{\hyperlink{ng__l2cap_8h_a27fdd55826cf9d2ad89e9bc50731bc77}{NG\_L2CAP\_PSM\_NOT\_SUPPORTED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00663}00663 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00664}00664 respond:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00665}00665         error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a85c65d62afe556b2a9c3a0760793e31b}{ng\_btsocket\_l2cap\_send\_l2ca\_con\_rsp\_req}}(token, rt,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00666}00666                                                         \&ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_add430d8ee46fbf365ee6dc34b9f3d067}{bdaddr}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00667}00667                                                         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_a89587cb236203802fef999317cadf6b9}{ident}}, ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_a077d8df376a5acfe759a4cb784a5b5ff}{lcid}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00668}00668                                                         result,ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ind__ip_a18c7c32c6f4979823e998233d8cdf802}{linktype}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00669}00669         \textcolor{keywordflow}{if} (pcb1 != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00670}00670                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00671}00671                         pcb1-\/>so-\/>so\_error = error;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00672}00672                         pcb1-\/>state = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00673}00673                         soisdisconnected(pcb1-\/>so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00674}00674                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00675}00675                         pcb1-\/>state = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a1bef328ad25d99c18012e0f9db9246db}{NG\_BTSOCKET\_L2CAP\_CONNECTING}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00676}00676                         soisconnecting(pcb1-\/>so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00677}00677 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00678}00678                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb1);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00679}00679                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00680}00680 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00681}00681                 mtx\_unlock(\&pcb1-\/>pcb\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00682}00682         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00683}00683 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00684}00684         \textcolor{keywordflow}{if} (pcb != NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00685}00685                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00686}00686 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00687}00687         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00688}00688 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00689}00689         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00690}00690 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_l2ca\_con\_ind */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00691}00691 \textcolor{comment}{/*Encryption Change*/}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00692}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a4634ca5641c044b9ec137ac870c3686c}{00692}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4634ca5641c044b9ec137ac870c3686c}{ng\_btsocket\_l2cap\_process\_l2ca\_enc\_change}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg, \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00693}00693 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00694}00694         \mbox{\hyperlink{structng__l2cap__l2ca__enc__chg__op}{ng\_l2cap\_l2ca\_enc\_chg\_op}}        *op = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00695}00695         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}          *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00696}00696 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00697}00697         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*op))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00698}00698                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00699}00699 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00700}00700         op = (\mbox{\hyperlink{structng__l2cap__l2ca__enc__chg__op}{ng\_l2cap\_l2ca\_enc\_chg\_op}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00701}00701 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00702}00702         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00703}00703 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00704}00704         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_abadc2c7cc4f9dffa7233af08dd085d2e}{ng\_btsocket\_l2cap\_pcb\_by\_cid}}(\&rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__enc__chg__op_a89eb7d1ba3fc38b4feb4fc92d47c9b2a}{lcid}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00705}00705                                            op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__enc__chg__op_a9be98337626098dbd93e2efc02211bbb}{idtype}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00706}00706         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00707}00707                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00708}00708                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00709}00709         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00710}00710 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00711}00711         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00712}00712         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4b57c41af69797c7a2802b576e3fb178}{encryption}} = op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__enc__chg__op_a920e9b0ea23b7a0ca52b41d5a32ed1c7}{result}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00713}00713 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00714}00714         \textcolor{keywordflow}{if}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_abe0b47708a419f4e9840080242348fd6}{need\_encrypt}})\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00715}00715                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);            }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00716}00716                 \textcolor{keywordflow}{if}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_a9aa68f78b2908d9e193caf4e271fcde0}{NG\_BTSOCKET\_L2CAP\_W4\_ENC\_CHANGE}})\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00717}00717                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4df4821a3f8e41755b7c6a130c3579cc}{NG\_BTSOCKET\_L2CAP\_WARN}}(\textcolor{stringliteral}{"{}\%s: Invalid pcb status \%d"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00718}00718                                                \_\_func\_\_, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00719}00719                 \}\textcolor{keywordflow}{else} \textcolor{keywordflow}{if}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4b57c41af69797c7a2802b576e3fb178}{encryption}})\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00720}00720                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00721}00721                         soisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00722}00722                 \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00723}00723                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = EPERM;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00724}00724                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(0, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00725}00725                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00726}00726                         soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00727}00727                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00728}00728         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00729}00729         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00730}00730         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00731}00731 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00732}00732         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00733}00733 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00734}00734 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00735}00735 \textcolor{comment}{ * Process L2CA\_Config response}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00736}00736 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00737}00737 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00738}00738 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00739}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a870a62b8ef1faad1b53bc998722b9a8f}{00739}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a870a62b8ef1faad1b53bc998722b9a8f}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_req\_rsp}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00740}00740                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00741}00741 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00742}00742         \mbox{\hyperlink{structng__l2cap__l2ca__cfg__op}{ng\_l2cap\_l2ca\_cfg\_op}}        *op = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00743}00743         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}   pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00744}00744 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00745}00745         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*op))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00746}00746                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00747}00747 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00748}00748         op = (\mbox{\hyperlink{structng__l2cap__l2ca__cfg__op}{ng\_l2cap\_l2ca\_cfg\_op}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00749}00749 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00750}00750         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00751}00751 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00752}00752         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00753}00753 \textcolor{comment}{         * Socket must have issued a Configure request, so we must have a }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00754}00754 \textcolor{comment}{         * socket that wants to be configured. Use Netgraph message token }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00755}00755 \textcolor{comment}{         * to find it}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00756}00756 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00757}00757 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00758}00758         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{ng\_btsocket\_l2cap\_pcb\_by\_token}}(msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00759}00759         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00760}00760                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00761}00761 \textcolor{comment}{                 * XXX FIXME what to do here? We could not find a}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00762}00762 \textcolor{comment}{                 * socket with requested token. We even can not send}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00763}00763 \textcolor{comment}{                 * Disconnect, because we do not know channel ID}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00764}00764 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00765}00765 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00766}00766                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00767}00767                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00768}00768         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00769}00769 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00770}00770         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00771}00771 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00772}00772         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00773}00773 \textcolor{stringliteral}{"{}\%s: Got L2CA\_Config response, token=\%d, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00774}00774 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, result=\%d, state=\%d, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00775}00775 \textcolor{stringliteral}{"{}cfg\_state=\%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00776}00776                 \_\_func\_\_, msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00777}00777                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00778}00778                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00779}00779                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00780}00780                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00781}00781                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__op_a269751df5ae5a8b6ec987633030fa4c2}{result}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00782}00782 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00783}00783         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_ae0e9aad23bcdb71d3bbcd783363edf29}{NG\_BTSOCKET\_L2CAP\_CONFIGURING}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00784}00784                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00785}00785                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00786}00786 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00787}00787                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00788}00788         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00789}00789 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00790}00790         \textcolor{keywordflow}{if} (op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__op_a269751df5ae5a8b6ec987633030fa4c2}{result}} == \mbox{\hyperlink{ng__l2cap_8h_aa58b6924d7adc5c9f97973bb5a6642ce}{NG\_L2CAP\_SUCCESS}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00791}00791                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00792}00792 \textcolor{comment}{                 * XXX FIXME Actually set flush and link timeout.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00793}00793 \textcolor{comment}{                 * Set QoS here if required. Resolve conficts (flush\_timo). }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00794}00794 \textcolor{comment}{                 * Save incoming MTU (peer's outgoing MTU) and outgoing flow }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00795}00795 \textcolor{comment}{                 * spec.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00796}00796 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00797}00797 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00798}00798                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}} = op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__op_a184c334f91ba2a0ac78b744ca43071db}{imtu}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00799}00799                 bcopy(\&op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__op_a72fed229f21f78670b77966aab92a517}{oflow}}, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00800}00800                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a733ff83b9b31d09d9c50af47d8df753c}{flush\_timo}} = op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__op_adc72d2f5553aa65ce1d59d4d4aee70cf}{flush\_timo}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00801}00801 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00802}00802                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00803}00803 \textcolor{comment}{                 * We have configured incoming side, so record it and check }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00804}00804 \textcolor{comment}{                 * if configuration is complete. If complete then mark socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00805}00805 \textcolor{comment}{                 * as connected, otherwise wait for the peer.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00806}00806 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00807}00807 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00808}00808                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} \&= \string~NG\_BTSOCKET\_L2CAP\_CFG\_IN\_SENT;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00809}00809                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} |= \mbox{\hyperlink{ng__btsocket__l2cap_8h_a74d7fd642ebdd331930b852feaab43fa}{NG\_BTSOCKET\_L2CAP\_CFG\_IN}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00810}00810 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00811}00811                 \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} == \mbox{\hyperlink{ng__btsocket__l2cap_8h_a7add56fc4ebd78d73c99b3e1fb150c9b}{NG\_BTSOCKET\_L2CAP\_CFG\_BOTH}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00812}00812                         \textcolor{comment}{/* Configuration complete -\/ mark socket as open */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00813}00813                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00814}00814                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00815}00815                         soisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}); }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00816}00816                 \} }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00817}00817         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00818}00818                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00819}00819 \textcolor{comment}{                 * Something went wrong. Could be unacceptable parameters,}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00820}00820 \textcolor{comment}{                 * reject or unknown option. That's too bad, but we will}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00821}00821 \textcolor{comment}{                 * not negotiate. Send Disconnect and close the channel.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00822}00822 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00823}00823 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00824}00824                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00825}00825 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00826}00826                 \textcolor{keywordflow}{switch} (op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__op_a269751df5ae5a8b6ec987633030fa4c2}{result}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00827}00827                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_ab1ea8deb89ef4859fefa87a450e39bee}{NG\_L2CAP\_UNACCEPTABLE\_PARAMS}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00828}00828                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_aeb4d7614fe3c4e35acd90e5cf7111d54}{NG\_L2CAP\_UNKNOWN\_OPTION}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00829}00829                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00830}00830                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00831}00831 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00832}00832                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00833}00833                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = ECONNRESET;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00834}00834                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00835}00835                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00836}00836 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00837}00837                 \textcolor{comment}{/* Send disconnect with "{}zero"{} token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00838}00838                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(0, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00839}00839 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00840}00840                 \textcolor{comment}{/* ... and close the socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00841}00841                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00842}00842                 soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00843}00843         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00844}00844 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00845}00845         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00846}00846         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00847}00847 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00848}00848         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00849}00849 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_req\_rsp */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00850}00850 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00851}00851 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00852}00852 \textcolor{comment}{ * Process L2CA\_ConfigRsp response}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00853}00853 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00854}00854 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00855}00855 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00856}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a3be8a1439ebd87a8707f2fa8ce4e478b}{00856}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3be8a1439ebd87a8707f2fa8ce4e478b}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_rsp\_rsp}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00857}00857                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00858}00858 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00859}00859         \mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__op}{ng\_l2cap\_l2ca\_cfg\_rsp\_op}}        *op = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00860}00860         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}          *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00861}00861         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00862}00862 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00863}00863         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*op))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00864}00864                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00865}00865 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00866}00866         op = (\mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__op}{ng\_l2cap\_l2ca\_cfg\_rsp\_op}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00867}00867 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00868}00868         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00869}00869 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00870}00870         \textcolor{comment}{/* Look for the socket with the token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00871}00871         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{ng\_btsocket\_l2cap\_pcb\_by\_token}}(msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00872}00872         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00873}00873                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00874}00874                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00875}00875         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00876}00876 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00877}00877         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00878}00878 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00879}00879         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00880}00880 \textcolor{stringliteral}{"{}\%s: Got L2CA\_ConfigRsp response, token=\%d, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00881}00881 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, result=\%d, state=\%d, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00882}00882 \textcolor{stringliteral}{"{}cfg\_state=\%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00883}00883                 \_\_func\_\_, msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00884}00884                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00885}00885                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00886}00886                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00887}00887                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00888}00888                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__op_a14bdad46b0579e041de9e67b03f06598}{result}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00889}00889 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00890}00890         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_ae0e9aad23bcdb71d3bbcd783363edf29}{NG\_BTSOCKET\_L2CAP\_CONFIGURING}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00891}00891                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00892}00892                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00893}00893 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00894}00894                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00895}00895         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00896}00896 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00897}00897         \textcolor{comment}{/* Check the result and disconnect socket of failure */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00898}00898         \textcolor{keywordflow}{if} (op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__op_a14bdad46b0579e041de9e67b03f06598}{result}} != \mbox{\hyperlink{ng__l2cap_8h_aa58b6924d7adc5c9f97973bb5a6642ce}{NG\_L2CAP\_SUCCESS}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00899}00899                 \textcolor{keywordflow}{goto} disconnect;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00900}00900 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00901}00901         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00902}00902 \textcolor{comment}{         * Now we done with remote side configuration. Configure local }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00903}00903 \textcolor{comment}{         * side if we have not done it yet.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00904}00904 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00905}00905 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00906}00906         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} \&= \string~NG\_BTSOCKET\_L2CAP\_CFG\_OUT\_SENT;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00907}00907         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} |= \mbox{\hyperlink{ng__btsocket__l2cap_8h_a5528cfb10243944c7ea116f314cfebdf}{NG\_BTSOCKET\_L2CAP\_CFG\_OUT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00908}00908 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00909}00909         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} == \mbox{\hyperlink{ng__btsocket__l2cap_8h_a7add56fc4ebd78d73c99b3e1fb150c9b}{NG\_BTSOCKET\_L2CAP\_CFG\_BOTH}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00910}00910                 \textcolor{comment}{/* Configuration complete -\/ mask socket as open */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00911}00911                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00912}00912                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00913}00913                 soisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00914}00914         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00915}00915                 \textcolor{keywordflow}{if} (!(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_ad5699ba89cc86e1179466bcf26ea9ddf}{NG\_BTSOCKET\_L2CAP\_CFG\_IN\_SENT}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00916}00916                         \textcolor{comment}{/* Send L2CA\_Config request -\/ incoming path */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00917}00917                         error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a99b3902ad3f7837bceeb1e5a7a0227eb}{ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_req}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00918}00918                         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00919}00919                                 \textcolor{keywordflow}{goto} disconnect;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00920}00920 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00921}00921                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} |= \mbox{\hyperlink{ng__btsocket__l2cap_8h_ad5699ba89cc86e1179466bcf26ea9ddf}{NG\_BTSOCKET\_L2CAP\_CFG\_IN\_SENT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00922}00922                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00923}00923         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00924}00924 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00925}00925         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00926}00926         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00927}00927 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00928}00928         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00929}00929 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00930}00930 disconnect:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00931}00931         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00932}00932 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00933}00933         \textcolor{comment}{/* Send disconnect with "{}zero"{} token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00934}00934         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(0, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00935}00935 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00936}00936         \textcolor{comment}{/* ... and close the socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00937}00937         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00938}00938         soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00939}00939 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00940}00940         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00941}00941         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00942}00942 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00943}00943         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00944}00944 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_rsp\_rsp */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00945}00945 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00946}00946 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00947}00947 \textcolor{comment}{ * Process L2CA\_Config indicator}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00948}00948 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00949}00949 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00950}00950 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00951}\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa709183e7489314abb5fd1fb144ac917}{00951}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa709183e7489314abb5fd1fb144ac917}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_ind}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00952}00952                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00953}00953 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00954}00954         \mbox{\hyperlink{structng__l2cap__l2ca__cfg__ind__ip}{ng\_l2cap\_l2ca\_cfg\_ind\_ip}}        *ip = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00955}00955         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}          *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00956}00956         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00957}00957 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00958}00958         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*ip))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00959}00959                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00960}00960 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00961}00961         ip = (\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ind__ip}{ng\_l2cap\_l2ca\_cfg\_ind\_ip}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00962}00962 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00963}00963         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00964}00964 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00965}00965         \textcolor{comment}{/* Check for the open socket that has given channel ID */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00966}00966         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_abadc2c7cc4f9dffa7233af08dd085d2e}{ng\_btsocket\_l2cap\_pcb\_by\_cid}}(\&rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}, ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ind__ip_a026c21f69061efa7dbf0cacbb7e92117}{lcid}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00967}00967                                            \mbox{\hyperlink{ng__l2cap_8h_a446404915983b7f7db08a8faeaf67e9d}{NG\_L2CAP\_L2CA\_IDTYPE\_BREDR}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00968}00968         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00969}00969                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00970}00970                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00971}00971         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00972}00972 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00973}00973         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00974}00974 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00975}00975         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00976}00976 \textcolor{stringliteral}{"{}\%s: Got L2CA\_Config indicator, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00977}00977 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, state=\%d, cfg\_state=\%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00978}00978                 \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00979}00979                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00980}00980                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00981}00981                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00982}00982                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00983}00983                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00984}00984 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00985}00985         \textcolor{comment}{/* XXX FIXME re-\/configuration on open socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00986}00986         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_ae0e9aad23bcdb71d3bbcd783363edf29}{NG\_BTSOCKET\_L2CAP\_CONFIGURING}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00987}00987                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00988}00988                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00989}00989 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00990}00990                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00991}00991         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00992}00992 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00993}00993         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00994}00994 \textcolor{comment}{         * XXX FIXME Actually set flush and link timeout. Set QoS here if}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00995}00995 \textcolor{comment}{         * required. Resolve conficts (flush\_timo). Note outgoing MTU (peer's }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00996}00996 \textcolor{comment}{         * incoming MTU) and incoming flow spec.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00997}00997 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00998}00998 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l00999}00999         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a97537ea63c9964e085fa3f22d0ce8bb5}{omtu}} = ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ind__ip_ae0513f17579f03bf14c51db22a54b24f}{omtu}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01000}01000         bcopy(\&ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ind__ip_a50929681be07887db0b0513dd74d5414}{iflow}}, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01001}01001         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a733ff83b9b31d09d9c50af47d8df753c}{flush\_timo}} = ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ind__ip_a78f5d9ccce6c03c6757220e1d4f2fe75}{flush\_timo}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01002}01002 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01003}01003         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01004}01004 \textcolor{comment}{         * Send L2CA\_Config response to our peer and check for the errors, }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01005}01005 \textcolor{comment}{         * if any send disconnect to close the channel. }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01006}01006 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01007}01007 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01008}01008         \textcolor{keywordflow}{if} (!(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_a3bebe84942e77fe1abe5187d3153de27}{NG\_BTSOCKET\_L2CAP\_CFG\_OUT\_SENT}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01009}01009                 error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a126f95a94d7ce702ee09febf98b9665d}{ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_rsp}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01010}01010                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01011}01011                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01012}01012 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01013}01013                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = error;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01014}01014 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01015}01015                         \textcolor{comment}{/* Send disconnect with "{}zero"{} token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01016}01016                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(0, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01017}01017 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01018}01018                         \textcolor{comment}{/* ... and close the socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01019}01019                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01020}01020                         soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01021}01021                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01022}01022                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_afee7af1d62ab0e7f825eede6ca59a228}{cfg\_state}} |= \mbox{\hyperlink{ng__btsocket__l2cap_8h_a3bebe84942e77fe1abe5187d3153de27}{NG\_BTSOCKET\_L2CAP\_CFG\_OUT\_SENT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01023}01023         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01024}01024 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01025}01025         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01026}01026         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01027}01027 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01028}01028         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01029}01029 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_l2cap\_cfg\_ind */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01030}01030 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01031}01031 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01032}01032 \textcolor{comment}{ * Process L2CA\_Disconnect response}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01033}01033 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01034}01034 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01035}01035 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01036}\mbox{\hyperlink{ng__btsocket__l2cap_8c_ae18f6782aca72e0450937f6e1eb5c602}{01036}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ae18f6782aca72e0450937f6e1eb5c602}{ng\_btsocket\_l2cap\_process\_l2ca\_discon\_rsp}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01037}01037                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01038}01038 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01039}01039         \mbox{\hyperlink{structng__l2cap__l2ca__discon__op}{ng\_l2cap\_l2ca\_discon\_op}}  *op = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01040}01040         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}  *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01041}01041 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01042}01042         \textcolor{comment}{/* Check message */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01043}01043         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*op))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01044}01044                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01045}01045 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01046}01046         op = (\mbox{\hyperlink{structng__l2cap__l2ca__discon__op}{ng\_l2cap\_l2ca\_discon\_op}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01047}01047 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01048}01048         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01049}01049 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01050}01050         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01051}01051 \textcolor{comment}{         * Socket layer must have issued L2CA\_Disconnect request, so there }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01052}01052 \textcolor{comment}{         * must be a socket that wants to be disconnected. Use Netgraph }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01053}01053 \textcolor{comment}{         * message token to find it.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01054}01054 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01055}01055 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01056}01056         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{ng\_btsocket\_l2cap\_pcb\_by\_token}}(msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01057}01057         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01058}01058                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01059}01059                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01060}01060         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01061}01061 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01062}01062         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01063}01063 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01064}01064         \textcolor{comment}{/* XXX Close socket no matter what op-\/>result says */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01065}01065         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01066}01066                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01067}01067 \textcolor{stringliteral}{"{}\%s: Got L2CA\_Disconnect response, token=\%d, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01068}01068 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, result=\%d, state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01069}01069                         \_\_func\_\_, msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01070}01070                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01071}01071                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01072}01072                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01073}01073                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01074}01074                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__discon__op_a01493caf4f3e374a057e90b7ced019bd}{result}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01075}01075 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01076}01076                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01077}01077 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01078}01078                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01079}01079                 soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01080}01080         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01081}01081 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01082}01082         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01083}01083         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01084}01084 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01085}01085         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01086}01086 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_l2ca\_discon\_rsp */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01087}01087 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01088}01088 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01089}01089 \textcolor{comment}{ * Process L2CA\_Disconnect indicator}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01090}01090 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01091}01091 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01092}01092 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01093}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a51ad96b4ba31495e41b8d668bb035484}{01093}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a51ad96b4ba31495e41b8d668bb035484}{ng\_btsocket\_l2cap\_process\_l2ca\_discon\_ind}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01094}01094                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01095}01095 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01096}01096         \mbox{\hyperlink{structng__l2cap__l2ca__discon__ip}{ng\_l2cap\_l2ca\_discon\_ind\_ip}}  *ip = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01097}01097         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}          *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01098}01098 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01099}01099         \textcolor{comment}{/* Check message */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01100}01100         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*ip))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01101}01101                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01102}01102 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01103}01103         ip = (\mbox{\hyperlink{structng__l2cap__l2ca__discon__ip}{ng\_l2cap\_l2ca\_discon\_ind\_ip}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01104}01104 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01105}01105         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01106}01106 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01107}01107         \textcolor{comment}{/* Look for the socket with given channel ID */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01108}01108         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_abadc2c7cc4f9dffa7233af08dd085d2e}{ng\_btsocket\_l2cap\_pcb\_by\_cid}}(\&rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}, ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__discon__ip_a367e04bbd06a5383a502ec3f796b7273}{lcid}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01109}01109                                            ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__discon__ip_a88b09e8513f481021d0d3f8321478cfc}{idtype}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01110}01110         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01111}01111                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01112}01112                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01113}01113         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01114}01114 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01115}01115         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01116}01116 \textcolor{comment}{         * Channel has already been destroyed, so disconnect the socket }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01117}01117 \textcolor{comment}{         * and be done with it. If there was any pending request we can}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01118}01118 \textcolor{comment}{         * not do anything here anyway.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01119}01119 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01120}01120 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01121}01121         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01122}01122 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01123}01123         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01124}01124 \textcolor{stringliteral}{"{}\%s: Got L2CA\_Disconnect indicator, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01125}01125 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01126}01126                 \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01127}01127                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01128}01128                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01129}01129                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01130}01130                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01131}01131                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01132}01132 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01133}01133         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_a427bf6e6db2d643af5dac6c8068a362a}{NG\_BTSOCKET\_L2CAP\_TIMO}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01134}01134                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01135}01135 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01136}01136         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01137}01137         soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01138}01138 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01139}01139         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01140}01140         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01141}01141 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01142}01142         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01143}01143 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_l2ca\_discon\_ind */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01144}01144 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01145}01145 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01146}01146 \textcolor{comment}{ * Process L2CA\_Write response}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01147}01147 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01148}01148 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01149}01149 \textcolor{keyword}{static} \textcolor{keywordtype}{int} }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01150}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a268f3698c4d5b1be38fe28eb5350a973}{01150}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a268f3698c4d5b1be38fe28eb5350a973}{ng\_btsocket\_l2cap\_process\_l2ca\_write\_rsp}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01151}01151                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01152}01152 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01153}01153         \mbox{\hyperlink{structng__l2cap__l2ca__write__op}{ng\_l2cap\_l2ca\_write\_op}}    *op = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01154}01154         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}  *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01155}01155 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01156}01156         \textcolor{comment}{/* Check message */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01157}01157         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*op))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01158}01158                 \textcolor{keywordflow}{return} (EMSGSIZE);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01159}01159 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01160}01160         op = (\mbox{\hyperlink{structng__l2cap__l2ca__write__op}{ng\_l2cap\_l2ca\_write\_op}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01161}01161 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01162}01162         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01163}01163 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01164}01164         \textcolor{comment}{/* Look for the socket with given token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01165}01165         pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{ng\_btsocket\_l2cap\_pcb\_by\_token}}(msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01166}01166         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01167}01167                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01168}01168                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01169}01169         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01170}01170 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01171}01171         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01172}01172 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01173}01173         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01174}01174 \textcolor{stringliteral}{"{}\%s: Got L2CA\_Write response, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01175}01175 \textcolor{stringliteral}{"{}dst bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, lcid=\%d, result=\%d, length=\%d, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01176}01176 \textcolor{stringliteral}{"{}state=\%d\(\backslash\)n"{}},           \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01177}01177                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01178}01178                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01179}01179                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[5], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[4], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01180}01180                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[2], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[1], pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01181}01181                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}}, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__write__op_a1c639b9505acf35e4ad39db04400fe33}{result}}, op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__write__op_a9c836ce470ec7799716e14761b1cc83d}{length}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01182}01182                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01183}01183 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01184}01184         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01185}01185                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01186}01186                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01187}01187 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01188}01188                 \textcolor{keywordflow}{return} (ENOENT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01189}01189         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01190}01190 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01191}01191         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01192}01192 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01193}01193         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01194}01194 \textcolor{comment}{         * Check if we have more data to send}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01195}01195 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01196}01196         sbdroprecord(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01197}01197         \textcolor{keywordflow}{if} (sbavail(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_snd) > 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01198}01198                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_a6bf5d2757d63f922ed0e06613fe109dd}{ng\_btsocket\_l2cap\_send2}}(pcb) == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01199}01199                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01200}01200                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01201}01201                         sbdroprecord(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_snd); \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01202}01202         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01203}01203 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01204}01204         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01205}01205 \textcolor{comment}{         * Now set the result, drop packet from the socket send queue and }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01206}01206 \textcolor{comment}{         * ask for more (wakeup sender)}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01207}01207 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01208}01208 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01209}01209         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a950fa90ca97e8ca76082845ac01fe4e5}{ng\_btsocket\_l2cap\_result2errno}}(op-\/>\mbox{\hyperlink{structng__l2cap__l2ca__write__op_a1c639b9505acf35e4ad39db04400fe33}{result}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01210}01210         sowwakeup(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01211}01211 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01212}01212         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01213}01213         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01214}01214 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01215}01215         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01216}01216 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_l2ca\_write\_rsp */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01217}01217 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01218}01218 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01219}01219 \textcolor{comment}{ * Send L2CA\_Connect request}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01220}01220 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01221}01221 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01222}01222 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01223}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a9106e565b3d4b10ec30e72e1cfbf8c95}{01223}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a9106e565b3d4b10ec30e72e1cfbf8c95}{ng\_btsocket\_l2cap\_send\_l2ca\_con\_req}}(\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}} pcb)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01224}01224 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01225}01225         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01226}01226         \mbox{\hyperlink{structng__l2cap__l2ca__con__ip}{ng\_l2cap\_l2ca\_con\_ip}}        *ip = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01227}01227         \textcolor{keywordtype}{int}                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01228}01228 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01229}01229         mtx\_assert(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01230}01230 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01231}01231         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} == NULL || }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01232}01232             pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01233}01233                 \textcolor{keywordflow}{return} (ENETDOWN); }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01234}01234 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01235}01235         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__l2cap_8h_a7e452e3322a39653affa38cdea2c761a}{NGM\_L2CAP\_COOKIE}}, \mbox{\hyperlink{ng__l2cap_8h_ace9661dc2dedf1c6c927b462d91735a5}{NGM\_L2CAP\_L2CA\_CON}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01236}01236                 \textcolor{keyword}{sizeof}(*ip), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01237}01237         \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01238}01238                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01239}01239 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01240}01240         msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a63340d46b20c1fff6f5c94540690c676}{token}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01241}01241 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01242}01242         ip = (\mbox{\hyperlink{structng__l2cap__l2ca__con__ip}{ng\_l2cap\_l2ca\_con\_ip}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01243}01243         bcopy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}, \&ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ip_a462a143a60b4bd3f7f1dfed96df21682}{bdaddr}}, \textcolor{keyword}{sizeof}(ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ip_a462a143a60b4bd3f7f1dfed96df21682}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01244}01244         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ip_a1ce58b7a4265528c231192125c6f8ceb}{psm}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01245}01245         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ip_a1936a8fddc46a2290d28aa44fd70a9f1}{linktype}} = ng\_btsock\_l2cap\_addrtype\_to\_linktype(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a73c93556e78281c5a6dcc4360a68145f}{dsttype}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01246}01246         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__ip_a9f206ef83463a6692ebd416cba42eb62}{idtype}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a25725146b54a9789b596ce2e417487ba}{idtype}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01247}01247         \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}}, msg,pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01248}01248 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01249}01249         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01250}01250 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_send\_l2ca\_con\_req */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01251}01251 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01252}01252 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01253}01253 \textcolor{comment}{ * Send L2CA\_Connect response}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01254}01254 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01255}01255 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01256}01256 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01257}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a85c65d62afe556b2a9c3a0760793e31b}{01257}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a85c65d62afe556b2a9c3a0760793e31b}{ng\_btsocket\_l2cap\_send\_l2ca\_con\_rsp\_req}}(u\_int32\_t token,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01258}01258                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}} rt, \mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}} dst, \textcolor{keywordtype}{int} ident, }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01259}01259                                         \textcolor{keywordtype}{int} lcid, \textcolor{keywordtype}{int} result, \textcolor{keywordtype}{int} linktype)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01260}01260 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01261}01261         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}                   *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01262}01262         \mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip}{ng\_l2cap\_l2ca\_con\_rsp\_ip}}        *ip = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01263}01263         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01264}01264 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01265}01265         \textcolor{keywordflow}{if} (rt == NULL || rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01266}01266                 \textcolor{keywordflow}{return} (ENETDOWN); }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01267}01267 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01268}01268         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__l2cap_8h_a7e452e3322a39653affa38cdea2c761a}{NGM\_L2CAP\_COOKIE}}, \mbox{\hyperlink{ng__l2cap_8h_abf977d23c6c4625104627ec0546a6227}{NGM\_L2CAP\_L2CA\_CON\_RSP}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01269}01269                 \textcolor{keyword}{sizeof}(*ip), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01270}01270         \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01271}01271                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01272}01272 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01273}01273         msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}} = token;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01274}01274 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01275}01275         ip = (\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip}{ng\_l2cap\_l2ca\_con\_rsp\_ip}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01276}01276         bcopy(dst, \&ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip_a0578a1d9457ec481c35c66818c12c683}{bdaddr}}, \textcolor{keyword}{sizeof}(ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip_a0578a1d9457ec481c35c66818c12c683}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01277}01277         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip_a9302f70e9cb09fbf23c7fcec3a6e1895}{ident}} = ident;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01278}01278         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip_aea5e233a4e3a658b05cbed42272ffc76}{lcid}} = lcid;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01279}01279         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip_a5a21646af65576764ea6ebabec8497ad}{linktype}} = linktype;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01280}01280         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip_a948c834153e96fd2f9608b97933aa45b}{result}} = result;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01281}01281         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__con__rsp__ip_a86e6c1fcb2c886a524046ef4be7cc602}{status}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01282}01282 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01283}01283         \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}}, msg, rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01284}01284 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01285}01285         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01286}01286 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_send\_l2ca\_con\_rsp\_req */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01287}01287 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01288}01288 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01289}01289 \textcolor{comment}{ * Send L2CA\_Config request}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01290}01290 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01291}01291 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01292}01292 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01293}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a99b3902ad3f7837bceeb1e5a7a0227eb}{01293}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a99b3902ad3f7837bceeb1e5a7a0227eb}{ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_req}}(\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}} pcb)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01294}01294 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01295}01295         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01296}01296         \mbox{\hyperlink{structng__l2cap__l2ca__cfg__ip}{ng\_l2cap\_l2ca\_cfg\_ip}}        *ip = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01297}01297         \textcolor{keywordtype}{int}                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01298}01298 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01299}01299         mtx\_assert(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01300}01300 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01301}01301         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} == NULL || }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01302}01302             pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01303}01303                 \textcolor{keywordflow}{return} (ENETDOWN); }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01304}01304 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01305}01305         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__l2cap_8h_a7e452e3322a39653affa38cdea2c761a}{NGM\_L2CAP\_COOKIE}}, \mbox{\hyperlink{ng__l2cap_8h_a82ddcd3904d91b3308203476be62837b}{NGM\_L2CAP\_L2CA\_CFG}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01306}01306                 \textcolor{keyword}{sizeof}(*ip), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01307}01307         \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01308}01308                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01309}01309 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01310}01310         msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a63340d46b20c1fff6f5c94540690c676}{token}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01311}01311 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01312}01312         ip = (\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ip}{ng\_l2cap\_l2ca\_cfg\_ip}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01313}01313         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ip_a07c60c30e5493ff74d4782ff03ccd171}{lcid}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01314}01314         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ip_a726e69e17458421cb1fb655194e8370b}{imtu}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01315}01315         bcopy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}, \&ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ip_a9fe7494d0023193219472aa143c49131}{oflow}}, \textcolor{keyword}{sizeof}(ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ip_a9fe7494d0023193219472aa143c49131}{oflow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01316}01316         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ip_a7c9ee049da35482115e76eff2c6170e3}{flush\_timo}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a733ff83b9b31d09d9c50af47d8df753c}{flush\_timo}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01317}01317         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__ip_a6f86ed6f3d309e0549d3e5738aadd032}{link\_timo}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2f46ae92d6beb0a0fa3268e330f666c0}{link\_timo}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01318}01318 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01319}01319         \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}}, msg,pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01320}01320 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01321}01321         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01322}01322 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_req */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01323}01323 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01324}01324 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01325}01325 \textcolor{comment}{ * Send L2CA\_Config response}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01326}01326 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01327}01327 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01328}01328 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01329}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a126f95a94d7ce702ee09febf98b9665d}{01329}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a126f95a94d7ce702ee09febf98b9665d}{ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_rsp}}(\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}} pcb)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01330}01330 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01331}01331         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}                   *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01332}01332         \mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__ip}{ng\_l2cap\_l2ca\_cfg\_rsp\_ip}}        *ip = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01333}01333         \textcolor{keywordtype}{int}                              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01334}01334 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01335}01335         mtx\_assert(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01336}01336 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01337}01337         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} == NULL || }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01338}01338             pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01339}01339                 \textcolor{keywordflow}{return} (ENETDOWN); }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01340}01340 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01341}01341         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__l2cap_8h_a7e452e3322a39653affa38cdea2c761a}{NGM\_L2CAP\_COOKIE}}, \mbox{\hyperlink{ng__l2cap_8h_a2b0297e88bf1260de41258ea38be4792}{NGM\_L2CAP\_L2CA\_CFG\_RSP}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01342}01342                 \textcolor{keyword}{sizeof}(*ip), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01343}01343         \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01344}01344                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01345}01345 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01346}01346         msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a63340d46b20c1fff6f5c94540690c676}{token}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01347}01347 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01348}01348         ip = (\mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__ip}{ng\_l2cap\_l2ca\_cfg\_rsp\_ip}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01349}01349         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__ip_a8aa90d267ca5c79ec5b3358449678224}{lcid}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01350}01350         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__ip_aed6849c101e28cd044999efc80bff4a5}{omtu}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a97537ea63c9964e085fa3f22d0ce8bb5}{omtu}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01351}01351         bcopy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}, \&ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__ip_addbd42fe763296ec1fc1f6a788bda168}{iflow}}, \textcolor{keyword}{sizeof}(ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__cfg__rsp__ip_addbd42fe763296ec1fc1f6a788bda168}{iflow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01352}01352 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01353}01353         \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}}, msg, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01354}01354 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01355}01355         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01356}01356 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_send\_l2ca\_cfg\_rsp */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01357}01357 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01358}01358 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01359}01359 \textcolor{comment}{ * Send L2CA\_Disconnect request}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01360}01360 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01361}01361 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01362}01362 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01363}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{01363}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(u\_int32\_t token,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01364}01364                 \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}} pcb)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01365}01365 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01366}01366         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01367}01367         \mbox{\hyperlink{structng__l2cap__l2ca__discon__ip}{ng\_l2cap\_l2ca\_discon\_ip}}  *ip = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01368}01368         \textcolor{keywordtype}{int}                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01369}01369 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01370}01370         mtx\_assert(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01371}01371 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01372}01372         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} == NULL || }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01373}01373             pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01374}01374                 \textcolor{keywordflow}{return} (ENETDOWN); }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01375}01375 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01376}01376         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg, \mbox{\hyperlink{ng__l2cap_8h_a7e452e3322a39653affa38cdea2c761a}{NGM\_L2CAP\_COOKIE}}, \mbox{\hyperlink{ng__l2cap_8h_a05a47c70240872fc452b424287e085c9}{NGM\_L2CAP\_L2CA\_DISCON}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01377}01377                 \textcolor{keyword}{sizeof}(*ip), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01378}01378         \textcolor{keywordflow}{if} (msg == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01379}01379                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01380}01380 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01381}01381         msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_aad8fce296b9145aca0485d0fcb080627}{token}} = token;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01382}01382 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01383}01383         ip = (\mbox{\hyperlink{structng__l2cap__l2ca__discon__ip}{ng\_l2cap\_l2ca\_discon\_ip}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01384}01384         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__discon__ip_a367e04bbd06a5383a502ec3f796b7273}{lcid}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01385}01385         ip-\/>\mbox{\hyperlink{structng__l2cap__l2ca__discon__ip_a88b09e8513f481021d0d3f8321478cfc}{idtype}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a25725146b54a9789b596ce2e417487ba}{idtype}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01386}01386 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01387}01387         \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}}, msg,pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01388}01388 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01389}01389         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01390}01390 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01391}01391 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01392}01392 \textcolor{comment}{/*****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01393}01393 \textcolor{comment}{ *****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01394}01394 \textcolor{comment}{ **                              Socket interface}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01395}01395 \textcolor{comment}{ *****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01396}01396 \textcolor{comment}{ *****************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01397}01397 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01398}01398 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01399}01399 \textcolor{comment}{ * L2CAP sockets data input routine}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01400}01400 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01401}01401 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01402}01402 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01403}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a420fde92842d8a6849fb4d630f1a789f}{01403}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a420fde92842d8a6849fb4d630f1a789f}{ng\_btsocket\_l2cap\_data\_input}}(\textcolor{keyword}{struct} mbuf *m, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01404}01404 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01405}01405         ng\_l2cap\_hdr\_t                  *hdr = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01406}01406         ng\_l2cap\_clt\_hdr\_t              *clt\_hdr = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01407}01407         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}          *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01408}01408         \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_t}}  *rt = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01409}01409         uint16\_t idtype;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01410}01410 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01411}01411         \textcolor{keywordflow}{if} (hook == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01412}01412                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01413}01413 \textcolor{stringliteral}{"{}\%s: Invalid source hook for L2CAP data packet\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01414}01414                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01415}01415         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01416}01416 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01417}01417         rt = (\mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_t}} *) \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01418}01418         \textcolor{keywordflow}{if} (rt == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01419}01419                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01420}01420 \textcolor{stringliteral}{"{}\%s: Could not find out source bdaddr for L2CAP data packet\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01421}01421                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01422}01422         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01423}01423 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01424}01424         m = m\_pullup(m, \textcolor{keyword}{sizeof}(uint16\_t));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01425}01425         idtype = *mtod(m, uint16\_t *);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01426}01426         m\_adj(m, \textcolor{keyword}{sizeof}(uint16\_t));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01427}01427 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01428}01428         \textcolor{comment}{/* Make sure we can access header */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01429}01429         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.len < \textcolor{keyword}{sizeof}(*hdr)) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01430}01430                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01431}01431 \textcolor{stringliteral}{"{}\%s: L2CAP data packet too small, len=\%d\(\backslash\)n"{}}, \_\_func\_\_, m-\/>m\_pkthdr.len);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01432}01432                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01433}01433         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01434}01434 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01435}01435         \textcolor{keywordflow}{if} (m-\/>m\_len < \textcolor{keyword}{sizeof}(*hdr)) \{ }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01436}01436                 m = m\_pullup(m, \textcolor{keyword}{sizeof}(*hdr));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01437}01437                 \textcolor{keywordflow}{if} (m == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01438}01438                         \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01439}01439         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01440}01440 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01441}01441         \textcolor{comment}{/* Strip L2CAP packet header and verify packet length */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01442}01442         hdr = mtod(m, ng\_l2cap\_hdr\_t *);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01443}01443         m\_adj(m, \textcolor{keyword}{sizeof}(*hdr));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01444}01444 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01445}01445         \textcolor{keywordflow}{if} (hdr-\/>length != m-\/>m\_pkthdr.len) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01446}01446                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01447}01447 \textcolor{stringliteral}{"{}\%s: Bad L2CAP data packet length, len=\%d, length=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01448}01448                         \_\_func\_\_, m-\/>m\_pkthdr.len, hdr-\/>length);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01449}01449                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01450}01450         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01451}01451 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01452}01452         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01453}01453 \textcolor{comment}{         * Now process packet. Two cases:}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01454}01454 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01455}01455 \textcolor{comment}{         * 1) Normal packet (cid != 2) then find connected socket and append}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01456}01456 \textcolor{comment}{         *    mbuf to the socket queue. Wakeup socket.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01457}01457 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01458}01458 \textcolor{comment}{         * 2) Broadcast packet (cid == 2) then find all sockets that connected}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01459}01459 \textcolor{comment}{         *    to the given PSM and have SO\_BROADCAST bit set and append mbuf}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01460}01460 \textcolor{comment}{         *    to the socket queue. Wakeup socket.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01461}01461 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01462}01462 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01463}01463         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01464}01464 \textcolor{stringliteral}{"{}\%s: Received L2CAP data packet: src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01465}01465 \textcolor{stringliteral}{"{}dcid=\%d, length=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01466}01466                 \_\_func\_\_, }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01467}01467                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01468}01468                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01469}01469                 hdr-\/>dcid, hdr-\/>length);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01470}01470 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01471}01471         \textcolor{keywordflow}{if} ((hdr-\/>dcid >= \mbox{\hyperlink{ng__l2cap_8h_af16136f034e794db8756c762e6d32372}{NG\_L2CAP\_FIRST\_CID}}) ||}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01472}01472             (idtype == \mbox{\hyperlink{ng__l2cap_8h_aa28ed4e421ee5ca6057d264e6fa0c9a7}{NG\_L2CAP\_L2CA\_IDTYPE\_ATT}})||}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01473}01473             (idtype == \mbox{\hyperlink{ng__l2cap_8h_a4d8f2b5d106fe39d83d37c8d1a418b09}{NG\_L2CAP\_L2CA\_IDTYPE\_SMP}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01474}01474             )\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01475}01475                 mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01476}01476 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01477}01477                 \textcolor{comment}{/* Normal packet: find connected socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01478}01478                 pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8c_abadc2c7cc4f9dffa7233af08dd085d2e}{ng\_btsocket\_l2cap\_pcb\_by\_cid}}(\&rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}, hdr-\/>dcid,idtype);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01479}01479                 \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01480}01480                         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01481}01481                         \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01482}01482                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01483}01483 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01484}01484                 mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01485}01485 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01486}01486                 \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01487}01487                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01488}01488 \textcolor{stringliteral}{"{}\%s: No connected socket found, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, dcid=\%d, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01489}01489 \textcolor{stringliteral}{"{}state=\%d\(\backslash\)n"{}},                   \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01490}01490                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01491}01491                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01492}01492                                 hdr-\/>dcid, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01493}01493 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01494}01494                         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01495}01495                         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01496}01496                         \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01497}01497                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01498}01498 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01499}01499                 \textcolor{comment}{/* Check packet size against socket's incoming MTU */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01500}01500                 \textcolor{keywordflow}{if} (hdr-\/>length > pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01501}01501                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01502}01502 \textcolor{stringliteral}{"{}\%s: L2CAP data packet too big, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01503}01503 \textcolor{stringliteral}{"{}dcid=\%d, length=\%d, imtu=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01504}01504                                 \_\_func\_\_, }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01505}01505                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01506}01506                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01507}01507                                 hdr-\/>dcid, hdr-\/>length, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01508}01508 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01509}01509                         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01510}01510                         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01511}01511                         \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01512}01512                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01513}01513 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01514}01514                 \textcolor{comment}{/* Check if we have enough space in socket receive queue */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01515}01515                 \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.len > sbspace(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_rcv)) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01516}01516                         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01517}01517 \textcolor{comment}{                         * This is really bad. Receive queue on socket does}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01518}01518 \textcolor{comment}{                         * not have enough space for the packet. We do not }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01519}01519 \textcolor{comment}{                         * have any other choice but drop the packet. L2CAP }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01520}01520 \textcolor{comment}{                         * does not provide any flow control.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01521}01521 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01522}01522 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01523}01523                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01524}01524 \textcolor{stringliteral}{"{}\%s: Not enough space in socket receive queue. Dropping L2CAP data packet, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01525}01525 \textcolor{stringliteral}{"{}src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, dcid=\%d, len=\%d, space=\%ld\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01526}01526                                 \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01527}01527                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01528}01528                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01529}01529                                 hdr-\/>dcid, m-\/>m\_pkthdr.len,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01530}01530                                 sbspace(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_rcv));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01531}01531 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01532}01532                         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01533}01533                         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01534}01534                         \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01535}01535                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01536}01536 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01537}01537                 \textcolor{comment}{/* Append packet to the socket receive queue and wakeup */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01538}01538                 sbappendrecord(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_rcv, m);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01539}01539                 m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01540}01540 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01541}01541                 sorwakeup(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01542}01542 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01543}01543                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01544}01544                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01545}01545         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (hdr-\/>dcid == \mbox{\hyperlink{ng__l2cap_8h_a24e26c53ee0593d00f91ce48f368f475}{NG\_L2CAP\_CLT\_CID}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01546}01546                 \textcolor{comment}{/* Broadcast packet: give packet to all sockets  */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01547}01547 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01548}01548                 \textcolor{comment}{/* Check packet size against connectionless MTU */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01549}01549                 \textcolor{keywordflow}{if} (hdr-\/>length > \mbox{\hyperlink{ng__l2cap_8h_a98b0eab62d7464f4c95df05ef865f423}{NG\_L2CAP\_MTU\_DEFAULT}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01550}01550                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01551}01551 \textcolor{stringliteral}{"{}\%s: Connectionless L2CAP data packet too big, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01552}01552 \textcolor{stringliteral}{"{}src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, length=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01553}01553                                 \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01554}01554                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01555}01555                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01556}01556                                 hdr-\/>length);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01557}01557                         \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01558}01558                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01559}01559 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01560}01560                 \textcolor{comment}{/* Make sure we can access connectionless header */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01561}01561                 \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.len < \textcolor{keyword}{sizeof}(*clt\_hdr)) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01562}01562                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01563}01563 \textcolor{stringliteral}{"{}\%s: Can not get L2CAP connectionless packet header, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01564}01564 \textcolor{stringliteral}{"{}src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, length=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01565}01565                                 \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01566}01566                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01567}01567                                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01568}01568                                 hdr-\/>length);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01569}01569                         \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01570}01570                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01571}01571 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01572}01572                 \textcolor{keywordflow}{if} (m-\/>m\_len < \textcolor{keyword}{sizeof}(*clt\_hdr)) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01573}01573                         m = m\_pullup(m, \textcolor{keyword}{sizeof}(*clt\_hdr));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01574}01574                         \textcolor{keywordflow}{if} (m == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01575}01575                                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01576}01576                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01577}01577 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01578}01578                 \textcolor{comment}{/* Strip connectionless header and deliver packet */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01579}01579                 clt\_hdr = mtod(m, ng\_l2cap\_clt\_hdr\_t *);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01580}01580                 m\_adj(m, \textcolor{keyword}{sizeof}(*clt\_hdr));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01581}01581 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01582}01582                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01583}01583 \textcolor{stringliteral}{"{}\%s: Got L2CAP connectionless data packet, "{}} \(\backslash\)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01584}01584 \textcolor{stringliteral}{"{}src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x, psm=\%d, length=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01585}01585                         \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01586}01586                         rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01587}01587                         rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0],}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01588}01588                         clt\_hdr-\/>psm, hdr-\/>length);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01589}01589 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01590}01590                 mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01591}01591 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01592}01592                 LIST\_FOREACH(pcb, \&ng\_btsocket\_l2cap\_sockets, next) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01593}01593                         \textcolor{keyword}{struct }mbuf     *copy = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01594}01594 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01595}01595                         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01596}01596 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01597}01597                         \textcolor{keywordflow}{if} (bcmp(\&rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}})) != 0 ||}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01598}01598                             pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}} != clt\_hdr-\/>psm || }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01599}01599                             pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}} || }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01600}01600                             (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_options \& SO\_BROADCAST) == 0 || }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01601}01601                             m-\/>m\_pkthdr.len > sbspace(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_rcv))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01602}01602                                 \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01603}01603 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01604}01604                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01605}01605 \textcolor{comment}{                         * Create a copy of the packet and append it to the }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01606}01606 \textcolor{comment}{                         * socket's queue. If m\_dup() failed -\/ no big deal}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01607}01607 \textcolor{comment}{                         * it is a broadcast traffic after all}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01608}01608 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01609}01609 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01610}01610                         copy = m\_dup(m, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01611}01611                         \textcolor{keywordflow}{if} (copy != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01612}01612                                 sbappendrecord(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_rcv, copy);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01613}01613                                 sorwakeup(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01614}01614                         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01615}01615 next:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01616}01616                         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01617}01617                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01618}01618 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01619}01619                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01620}01620         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01621}01621 drop:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01622}01622         \mbox{\hyperlink{netgraph_8h_a2461bfcdc9e024484ed8037d386620e3}{NG\_FREE\_M}}(m); \textcolor{comment}{/* checks for m != NULL */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01623}01623 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_data\_input */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01624}01624 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01625}01625 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01626}01626 \textcolor{comment}{ * L2CAP sockets default message input routine}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01627}01627 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01628}01628 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01629}01629 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01630}\mbox{\hyperlink{ng__btsocket__l2cap_8c_af88ba63bc81c47f8d218e6b120e5e878}{01630}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_af88ba63bc81c47f8d218e6b120e5e878}{ng\_btsocket\_l2cap\_default\_msg\_input}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01631}01631 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01632}01632         \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01633}01633         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_af0d5230b3b003fe1b19b8827f3ae7e0c}{NGM\_L2CAP\_NODE\_HOOK\_INFO}}: \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01634}01634                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_t}}  *rt = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01635}01635                 \mbox{\hyperlink{structng__l2cap__node__hook__info__ep}{ng\_l2cap\_node\_hook\_info\_ep}} *ep =}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01636}01636                   (\mbox{\hyperlink{structng__l2cap__node__hook__info__ep}{ng\_l2cap\_node\_hook\_info\_ep}} *)msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01637}01637                 if (hook == NULL || msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(*ep))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01638}01638                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01639}01639 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01640}01640                 \textcolor{keywordflow}{if} (bcmp(\&ep-\/>\mbox{\hyperlink{structng__l2cap__node__hook__info__ep_a9d2112bbde388e005674e17dad8f3da3}{addr}}, \mbox{\hyperlink{ng__hci_8h_a5087b37d7deab31f2b7c7580982b4c1c}{NG\_HCI\_BDADDR\_ANY}}, \textcolor{keyword}{sizeof}(bdaddr\_t)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01641}01641                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01642}01642 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01643}01643                 mtx\_lock(\&ng\_btsocket\_l2cap\_rt\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01644}01644 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01645}01645                 rt = (\mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_t}} *) \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01646}01646                 \textcolor{keywordflow}{if} (rt == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01647}01647                         rt = malloc(\textcolor{keyword}{sizeof}(*rt),}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01648}01648                                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3faae7ab72087cb5a1a8e9166d018d1c}{M\_NETGRAPH\_BTSOCKET\_L2CAP}}, M\_NOWAIT|M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01649}01649                         \textcolor{keywordflow}{if} (rt == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01650}01650                                 mtx\_unlock(\&ng\_btsocket\_l2cap\_rt\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01651}01651                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01652}01652                         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01653}01653 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01654}01654                         LIST\_INSERT\_HEAD(\&ng\_btsocket\_l2cap\_rt, rt, next);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01655}01655 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01656}01656                         \mbox{\hyperlink{netgraph_8h_a8167c04e701189ca4bc1bc3af5454ce6}{NG\_HOOK\_SET\_PRIVATE}}(hook, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01657}01657                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01658}01658 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01659}01659                 bcopy(\&ep-\/>\mbox{\hyperlink{structng__l2cap__node__hook__info__ep_a9d2112bbde388e005674e17dad8f3da3}{addr}}, \&rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}, \textcolor{keyword}{sizeof}(rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01660}01660                 rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} = hook;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01661}01661 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01662}01662                 mtx\_unlock(\&ng\_btsocket\_l2cap\_rt\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01663}01663 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01664}01664                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01665}01665 \textcolor{stringliteral}{"{}\%s: Updating hook \(\backslash\)"{}\%s\(\backslash\)"{}, src bdaddr=\%x:\%x:\%x:\%x:\%x:\%x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01666}01666                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(hook), }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01667}01667                         rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[5], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[4], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[3], }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01668}01668                         rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[2], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[1], rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a3f85803ece1961c834829e2230a144ef}{src}}.b[0]);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01669}01669                 \} \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01670}01670 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01671}01671         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01672}01672                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4df4821a3f8e41755b7c6a130c3579cc}{NG\_BTSOCKET\_L2CAP\_WARN}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01673}01673 \textcolor{stringliteral}{"{}\%s: Unknown message, cmd=\%d\(\backslash\)n"{}}, \_\_func\_\_, msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01674}01674                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01675}01675         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01676}01676 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01677}01677         \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg); \textcolor{comment}{/* Checks for msg != NULL */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01678}01678 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_default\_msg\_input */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01679}01679 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01680}01680 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01681}01681 \textcolor{comment}{ * L2CAP sockets L2CA message input routine}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01682}01682 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01683}01683 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01684}01684 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01685}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2096918c8f7d23384587490c88db1f57}{01685}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2096918c8f7d23384587490c88db1f57}{ng\_btsocket\_l2cap\_l2ca\_msg\_input}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg, \mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01686}01686 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01687}01687         \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}}  rt = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01688}01688 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01689}01689         \textcolor{keywordflow}{if} (hook == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01690}01690                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01691}01691 \textcolor{stringliteral}{"{}\%s: Invalid source hook for L2CA message\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01692}01692                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01693}01693         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01694}01694 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01695}01695         rt = (\mbox{\hyperlink{ng__btsocket__l2cap_8h_ac07ca1d11a869a93ffa00f6083e97bd8}{ng\_btsocket\_l2cap\_rtentry\_p}}) \mbox{\hyperlink{netgraph_8h_afe8dccb32c473a2098104a16179e754b}{NG\_HOOK\_PRIVATE}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01696}01696         \textcolor{keywordflow}{if} (rt == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01697}01697                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01698}01698 \textcolor{stringliteral}{"{}\%s: Could not find out source bdaddr for L2CA message\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01699}01699                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01700}01700         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01701}01701 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01702}01702         \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01703}01703         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_ace9661dc2dedf1c6c927b462d91735a5}{NGM\_L2CAP\_L2CA\_CON}}: \textcolor{comment}{/* L2CA\_Connect response */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01704}01704                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6087cf99e374800f5fb5ca36bd23e85f}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_req\_rsp}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01705}01705                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01706}01706 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01707}01707         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_abf977d23c6c4625104627ec0546a6227}{NGM\_L2CAP\_L2CA\_CON\_RSP}}: \textcolor{comment}{/* L2CA\_ConnectRsp response */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01708}01708                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a05c69d373982338382400e9b20f18a12}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_rsp\_rsp}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01709}01709                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01710}01710 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01711}01711         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_ad7eba780e4b8cb214e06a5bacdb7e954}{NGM\_L2CAP\_L2CA\_CON\_IND}}: \textcolor{comment}{/* L2CA\_Connect indicator */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01712}01712                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a8e240f7f7482f2602394f31ffc089472}{ng\_btsocket\_l2cap\_process\_l2ca\_con\_ind}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01713}01713                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01714}01714 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01715}01715         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a82ddcd3904d91b3308203476be62837b}{NGM\_L2CAP\_L2CA\_CFG}}: \textcolor{comment}{/* L2CA\_Config response */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01716}01716                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a870a62b8ef1faad1b53bc998722b9a8f}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_req\_rsp}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01717}01717                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01718}01718 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01719}01719         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a2b0297e88bf1260de41258ea38be4792}{NGM\_L2CAP\_L2CA\_CFG\_RSP}}: \textcolor{comment}{/* L2CA\_ConfigRsp response */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01720}01720                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3be8a1439ebd87a8707f2fa8ce4e478b}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_rsp\_rsp}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01721}01721                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01722}01722 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01723}01723         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_aaa9730653733375295643ce601e52bf9}{NGM\_L2CAP\_L2CA\_CFG\_IND}}: \textcolor{comment}{/* L2CA\_Config indicator */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01724}01724                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa709183e7489314abb5fd1fb144ac917}{ng\_btsocket\_l2cap\_process\_l2ca\_cfg\_ind}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01725}01725                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01726}01726 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01727}01727         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a05a47c70240872fc452b424287e085c9}{NGM\_L2CAP\_L2CA\_DISCON}}: \textcolor{comment}{/* L2CA\_Disconnect response */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01728}01728                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_ae18f6782aca72e0450937f6e1eb5c602}{ng\_btsocket\_l2cap\_process\_l2ca\_discon\_rsp}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01729}01729                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01730}01730 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01731}01731         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a847bbe0341a1d3c8113e62d0de06b4d2}{NGM\_L2CAP\_L2CA\_DISCON\_IND}}: \textcolor{comment}{/* L2CA\_Disconnect indicator */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01732}01732                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a51ad96b4ba31495e41b8d668bb035484}{ng\_btsocket\_l2cap\_process\_l2ca\_discon\_ind}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01733}01733                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01734}01734 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01735}01735         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a4441c57e1161405be92dff116260279a}{NGM\_L2CAP\_L2CA\_WRITE}}: \textcolor{comment}{/* L2CA\_Write response */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01736}01736                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a268f3698c4d5b1be38fe28eb5350a973}{ng\_btsocket\_l2cap\_process\_l2ca\_write\_rsp}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01737}01737                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01738}01738         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a0f4cf2c4b92d43ba5e1dc6f34fa6929a}{NGM\_L2CAP\_L2CA\_ENC\_CHANGE}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01739}01739                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4634ca5641c044b9ec137ac870c3686c}{ng\_btsocket\_l2cap\_process\_l2ca\_enc\_change}}(msg, rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01740}01740 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01741}01741                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01742}01742         \textcolor{comment}{/* XXX FIXME add other L2CA messages */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01743}01743 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01744}01744         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01745}01745                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4df4821a3f8e41755b7c6a130c3579cc}{NG\_BTSOCKET\_L2CAP\_WARN}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01746}01746 \textcolor{stringliteral}{"{}\%s: Unknown L2CA message, cmd=\%d\(\backslash\)n"{}}, \_\_func\_\_, msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01747}01747                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01748}01748         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01749}01749 drop:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01750}01750         \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01751}01751 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_l2ca\_msg\_input */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01752}01752 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01753}01753 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01754}01754 \textcolor{comment}{ * L2CAP sockets input routine}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01755}01755 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01756}01756 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01757}01757 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01758}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a0d7fc77988ea975ada7df30fcb4edab7}{01758}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a0d7fc77988ea975ada7df30fcb4edab7}{ng\_btsocket\_l2cap\_input}}(\textcolor{keywordtype}{void} *context, \textcolor{keywordtype}{int} pending)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01759}01759 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01760}01760         \mbox{\hyperlink{structng__item}{item\_p}}    item = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01761}01761         \mbox{\hyperlink{structng__hook}{hook\_p}}    hook = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01762}01762 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01763}01763         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01764}01764                 mtx\_lock(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{ng\_btsocket\_l2cap\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01765}01765                 \mbox{\hyperlink{ng__bluetooth_8h_ac75bfc439cac72b87f9e8fe561a6eb03}{NG\_BT\_ITEMQ\_DEQUEUE}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}}, item);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01766}01766                 mtx\_unlock(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{ng\_btsocket\_l2cap\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01767}01767 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01768}01768                 \textcolor{keywordflow}{if} (item == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01769}01769                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01770}01770 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01771}01771                 \mbox{\hyperlink{netgraph_8h_a1d7f4586c2c27938d66748ba39a1c792}{NGI\_GET\_HOOK}}(item, hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01772}01772                 \textcolor{keywordflow}{if} (hook != NULL \&\& \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01773}01773                         \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01774}01774 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01775}01775                 \textcolor{keywordflow}{switch}(item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01776}01776                 \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a620a63554ce51c6f4bc74027fe43975c}{NGQF\_DATA}}: \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01777}01777                         \textcolor{keyword}{struct }mbuf     *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01778}01778 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01779}01779                         \mbox{\hyperlink{netgraph_8h_abbb0acb5f480576cff9901caddeef57f}{NGI\_GET\_M}}(item, m);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01780}01780                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a420fde92842d8a6849fb4d630f1a789f}{ng\_btsocket\_l2cap\_data\_input}}(m, hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01781}01781                         \} \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01782}01782 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01783}01783                 \textcolor{keywordflow}{case} \mbox{\hyperlink{netgraph_8h_a9e3984d767a278bf9893ae7145a143a8}{NGQF\_MESG}}: \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01784}01784                         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}  *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01785}01785 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01786}01786                         \mbox{\hyperlink{netgraph_8h_adc9a04fd174ef3c29ecae94016b84839}{NGI\_GET\_MSG}}(item, msg);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01787}01787 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01788}01788                         \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01789}01789                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_ace9661dc2dedf1c6c927b462d91735a5}{NGM\_L2CAP\_L2CA\_CON}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01790}01790                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_abf977d23c6c4625104627ec0546a6227}{NGM\_L2CAP\_L2CA\_CON\_RSP}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01791}01791                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_ad7eba780e4b8cb214e06a5bacdb7e954}{NGM\_L2CAP\_L2CA\_CON\_IND}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01792}01792                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a82ddcd3904d91b3308203476be62837b}{NGM\_L2CAP\_L2CA\_CFG}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01793}01793                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a2b0297e88bf1260de41258ea38be4792}{NGM\_L2CAP\_L2CA\_CFG\_RSP}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01794}01794                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_aaa9730653733375295643ce601e52bf9}{NGM\_L2CAP\_L2CA\_CFG\_IND}}: }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01795}01795                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a05a47c70240872fc452b424287e085c9}{NGM\_L2CAP\_L2CA\_DISCON}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01796}01796                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a847bbe0341a1d3c8113e62d0de06b4d2}{NGM\_L2CAP\_L2CA\_DISCON\_IND}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01797}01797                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a4441c57e1161405be92dff116260279a}{NGM\_L2CAP\_L2CA\_WRITE}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01798}01798                         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a0f4cf2c4b92d43ba5e1dc6f34fa6929a}{NGM\_L2CAP\_L2CA\_ENC\_CHANGE}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01799}01799                         \textcolor{comment}{/* XXX FIXME add other L2CA messages */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01800}01800                                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2096918c8f7d23384587490c88db1f57}{ng\_btsocket\_l2cap\_l2ca\_msg\_input}}(msg, hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01801}01801                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01802}01802 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01803}01803                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01804}01804                                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_af88ba63bc81c47f8d218e6b120e5e878}{ng\_btsocket\_l2cap\_default\_msg\_input}}(msg, hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01805}01805                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01806}01806                         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01807}01807                         \} \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01808}01808 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01809}01809                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01810}01810                         KASSERT(0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01811}01811 (\textcolor{stringliteral}{"{}\%s: invalid item type=\%ld\(\backslash\)n"{}}, \_\_func\_\_, (item-\/>\mbox{\hyperlink{structng__item_a838ef946fef909f08e5e85f13484cd5e}{el\_flags}} \& \mbox{\hyperlink{netgraph_8h_a4cd46f025f7a1982e34ac54745b59bd1}{NGQF\_TYPE}})));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01812}01812                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01813}01813                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01814}01814 drop:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01815}01815                 \textcolor{keywordflow}{if} (hook != NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01816}01816                         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(hook);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01817}01817 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01818}01818                 \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01819}01819         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01820}01820 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_input */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01821}01821 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01822}01822 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01823}01823 \textcolor{comment}{ * Route cleanup task. Gets scheduled when hook is disconnected. Here we }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01824}01824 \textcolor{comment}{ * will find all sockets that use "{}invalid"{} hook and disconnect them.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01825}01825 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01826}01826 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01827}01827 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01828}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a0b8a0f04db34ced5b5ec71fb5635424d}{01828}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a0b8a0f04db34ced5b5ec71fb5635424d}{ng\_btsocket\_l2cap\_rtclean}}(\textcolor{keywordtype}{void} *context, \textcolor{keywordtype}{int} pending)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01829}01829 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01830}01830         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}          pcb = NULL, pcb\_next = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01831}01831         \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}}  rt = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01832}01832 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01833}01833         mtx\_lock(\&ng\_btsocket\_l2cap\_rt\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01834}01834         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01835}01835 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01836}01836         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01837}01837 \textcolor{comment}{         * First disconnect all sockets that use "{}invalid"{} hook}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01838}01838 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01839}01839 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01840}01840         \textcolor{keywordflow}{for} (pcb = LIST\_FIRST(\&ng\_btsocket\_l2cap\_sockets); pcb != NULL; ) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01841}01841                 mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01842}01842                 pcb\_next = LIST\_NEXT(pcb, next);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01843}01843 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01844}01844                 \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} != NULL \&\&}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01845}01845                     pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01846}01846                         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_a427bf6e6db2d643af5dac6c8068a362a}{NG\_BTSOCKET\_L2CAP\_TIMO}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01847}01847                                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01848}01848 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01849}01849                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = ENETDOWN;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01850}01850                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01851}01851                         soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01852}01852 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01853}01853                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a63340d46b20c1fff6f5c94540690c676}{token}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01854}01854                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01855}01855                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01856}01856                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01857}01857 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01858}01858                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01859}01859                 pcb = pcb\_next;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01860}01860         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01861}01861 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01862}01862         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01863}01863 \textcolor{comment}{         * Now cleanup routing table}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01864}01864 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01865}01865 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01866}01866         \textcolor{keywordflow}{for} (rt = LIST\_FIRST(\&ng\_btsocket\_l2cap\_rt); rt != NULL; ) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01867}01867                 \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_p}}  rt\_next = LIST\_NEXT(rt, next);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01868}01868 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01869}01869                 \textcolor{keywordflow}{if} (rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01870}01870                         LIST\_REMOVE(rt, next);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01871}01871 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01872}01872                         \mbox{\hyperlink{netgraph_8h_a8167c04e701189ca4bc1bc3af5454ce6}{NG\_HOOK\_SET\_PRIVATE}}(rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}, NULL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01873}01873                         \mbox{\hyperlink{netgraph_8h_a2b9c519a8b574618def581e0091cbf49}{NG\_HOOK\_UNREF}}(rt-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}); \textcolor{comment}{/* Remove extra reference */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01874}01874 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01875}01875                         bzero(rt, \textcolor{keyword}{sizeof}(*rt));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01876}01876                         free(rt, \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3faae7ab72087cb5a1a8e9166d018d1c}{M\_NETGRAPH\_BTSOCKET\_L2CAP}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01877}01877                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01878}01878 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01879}01879                 rt = rt\_next;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01880}01880         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01881}01881 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01882}01882         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01883}01883         mtx\_unlock(\&ng\_btsocket\_l2cap\_rt\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01884}01884 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_rtclean */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01885}01885 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01886}01886 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01887}01887 \textcolor{comment}{ * Initialize everything}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01888}01888 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01889}01889 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01890}01890 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01891}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a06cd72e4c848e871658fbeb962e0bf0e}{01891}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a06cd72e4c848e871658fbeb962e0bf0e}{ng\_btsocket\_l2cap\_init}}(\textcolor{keywordtype}{void} *arg \_\_unused)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01892}01892 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01893}01893         \textcolor{keywordtype}{int}     error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01894}01894 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01895}01895         \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01896}01896         \mbox{\hyperlink{ng__btsocket__l2cap_8c_acef2131902542e3eeb034e7e04a2c39f}{ng\_btsocket\_l2cap\_debug\_level}} = \mbox{\hyperlink{ng__btsocket_8h_add6a7e27a470c8b3aeb4793e015b84bb}{NG\_BTSOCKET\_WARN\_LEVEL}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01897}01897 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01898}01898         \textcolor{comment}{/* Register Netgraph node type */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01899}01899         error = \mbox{\hyperlink{netgraph_8h_a67f567d871dc683c4cb7a75dcfedf458}{ng\_newtype}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01900}01900         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01901}01901                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01902}01902 \textcolor{stringliteral}{"{}\%s: Could not register Netgraph node type, error=\%d\(\backslash\)n"{}}, \_\_func\_\_, error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01903}01903 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01904}01904                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01905}01905         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01906}01906 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01907}01907         \textcolor{comment}{/* Create Netgrapg node */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01908}01908         error = \mbox{\hyperlink{netgraph_8h_aba2cbbfc891d71bd283ce2368c8392db}{ng\_make\_node\_common}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}}, \&\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01909}01909         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01910}01910                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01911}01911 \textcolor{stringliteral}{"{}\%s: Could not create Netgraph node, error=\%d\(\backslash\)n"{}}, \_\_func\_\_, error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01912}01912 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01913}01913                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01914}01914 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01915}01915                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01916}01916         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01917}01917 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01918}01918         error = \mbox{\hyperlink{netgraph_8h_abae5851c9f312eebd398b1cd085fe067}{ng\_name\_node}}(\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01919}01919                                 \mbox{\hyperlink{ng__btsocket_8h_ab557b67dfb9b578da59b77846423ffe4}{NG\_BTSOCKET\_L2CAP\_NODE\_TYPE}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01920}01920         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01921}01921                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a266eeb7897a59731e35b5761c62fccf7}{NG\_BTSOCKET\_L2CAP\_ALERT}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01922}01922 \textcolor{stringliteral}{"{}\%s: Could not name Netgraph node, error=\%d\(\backslash\)n"{}}, \_\_func\_\_, error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01923}01923 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01924}01924                 \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01925}01925                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01926}01926 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01927}01927                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01928}01928         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01929}01929 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01930}01930         \textcolor{comment}{/* Create input queue */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01931}01931         \mbox{\hyperlink{ng__bluetooth_8h_aac74453fd1344531d8b0d6544142da25}{NG\_BT\_ITEMQ\_INIT}}(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_abd5f4c262777a006031b3a74c74b4d0a}{ng\_btsocket\_l2cap\_queue}}, \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4ae44a4904f51f52d1275cc443a960a4}{ifqmaxlen}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01932}01932         mtx\_init(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a2a3e51663a28a1dcb4440a332245a57c}{ng\_btsocket\_l2cap\_queue\_mtx}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01933}01933                 \textcolor{stringliteral}{"{}btsocks\_l2cap\_queue\_mtx"{}}, NULL, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01934}01934         TASK\_INIT(\&\mbox{\hyperlink{ng__btsocket__l2cap_8c_a3b70fc529bdf2ed4ef662583f96310be}{ng\_btsocket\_l2cap\_queue\_task}}, 0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01935}01935                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a0d7fc77988ea975ada7df30fcb4edab7}{ng\_btsocket\_l2cap\_input}}, NULL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01936}01936 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01937}01937         \textcolor{comment}{/* Create list of sockets */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01938}01938         LIST\_INIT(\&ng\_btsocket\_l2cap\_sockets);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01939}01939         mtx\_init(\&ng\_btsocket\_l2cap\_sockets\_mtx,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01940}01940                 \textcolor{stringliteral}{"{}btsocks\_l2cap\_sockets\_mtx"{}}, NULL, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01941}01941 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01942}01942         \textcolor{comment}{/* Routing table */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01943}01943         LIST\_INIT(\&ng\_btsocket\_l2cap\_rt);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01944}01944         mtx\_init(\&ng\_btsocket\_l2cap\_rt\_mtx,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01945}01945                 \textcolor{stringliteral}{"{}btsocks\_l2cap\_rt\_mtx"{}}, NULL, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01946}01946         TASK\_INIT(\&ng\_btsocket\_l2cap\_rt\_task, 0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01947}01947                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a0b8a0f04db34ced5b5ec71fb5635424d}{ng\_btsocket\_l2cap\_rtclean}}, NULL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01948}01948 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_init */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01949}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a03bab74356e386f8169f3bcb1b9a1633}{01949}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a03bab74356e386f8169f3bcb1b9a1633}{SYSINIT}}(\mbox{\hyperlink{ng__btsocket__l2cap_8c_a06cd72e4c848e871658fbeb962e0bf0e}{ng\_btsocket\_l2cap\_init}}, SI\_SUB\_PROTO\_DOMAIN, SI\_ORDER\_THIRD,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01950}01950     \mbox{\hyperlink{ng__btsocket__l2cap_8c_a06cd72e4c848e871658fbeb962e0bf0e}{ng\_btsocket\_l2cap\_init}}, NULL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01951}01951 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01952}01952 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01953}01953 \textcolor{comment}{ * Abort connection on socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01954}01954 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01955}01955 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01956}01956 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01957}\mbox{\hyperlink{ng__btsocket__l2cap_8h_ae3c4fecf2479af94c1c69187aa69cf79}{01957}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_abb837ea4b7618f96fd582e6909046db7}{ng\_btsocket\_l2cap\_abort}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01958}01958 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01959}01959         so-\/>so\_error = ECONNABORTED;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01960}01960 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01961}01961         (void)\mbox{\hyperlink{ng__btsocket__l2cap_8c_a92bbd2189c0bde4c4a0d54168e874161}{ng\_btsocket\_l2cap\_disconnect}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01962}01962 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_abort */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01963}01963 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01964}01964 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01965}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a396c7200d2fc3dd2b16a4a82da10ddf2}{01965}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1a98328118383283d86019228c9f05f8}{ng\_btsocket\_l2cap\_close}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01966}01966 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01967}01967 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01968}01968         (void)\mbox{\hyperlink{ng__btsocket__l2cap_8c_a92bbd2189c0bde4c4a0d54168e874161}{ng\_btsocket\_l2cap\_disconnect}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01969}01969 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_close */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01970}01970 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01971}01971 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01972}01972 \textcolor{comment}{ * Accept connection on socket. Nothing to do here, socket must be connected}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01973}01973 \textcolor{comment}{ * and ready, so just return peer address and be done with it.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01974}01974 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01975}01975 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01976}01976 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01977}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a5c149ca0507728355e49fc2d9eff7c59}{01977}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a282988d438b7bef2392b549ae02caf87}{ng\_btsocket\_l2cap\_accept}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **nam)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01978}01978 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01979}01979         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01980}01980                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01981}01981 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01982}01982         \textcolor{keywordflow}{return} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_a8878f4df2495c2fc8c61c4dd6fbe4c1c}{ng\_btsocket\_l2cap\_peeraddr}}(so, nam));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01983}01983 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_accept */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01984}01984 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01985}01985 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01986}01986 \textcolor{comment}{ * Create and attach new socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01987}01987 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01988}01988 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01989}01989 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01990}\mbox{\hyperlink{ng__btsocket__l2cap_8h_aff5766369b2039d2c5468de92afdf506}{01990}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_adaced2a14d2290b6191eb3dc1a70c986}{ng\_btsocket\_l2cap\_attach}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} proto, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01991}01991 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01992}01992         \textcolor{keyword}{static} u\_int32\_t        token = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01993}01993         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01994}01994         \textcolor{keywordtype}{int}                     error;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01995}01995 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01996}01996         \textcolor{comment}{/* Check socket and protocol */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01997}01997         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01998}01998                 \textcolor{keywordflow}{return} (EPROTONOSUPPORT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l01999}01999         \textcolor{keywordflow}{if} (so-\/>so\_type != SOCK\_SEQPACKET)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02000}02000                 \textcolor{keywordflow}{return} (ESOCKTNOSUPPORT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02001}02001 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02002}02002 \textcolor{preprocessor}{\#if 0 }\textcolor{comment}{/* XXX sonewconn() calls "{}pru\_attach"{} with proto == 0 */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02003}02003         \textcolor{keywordflow}{if} (proto != 0) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02004}02004                 \textcolor{keywordflow}{if} (proto != \mbox{\hyperlink{ng__btsocket_8h_a9f401402f7651e43b00d9147bc10460b}{BLUETOOTH\_PROTO\_L2CAP}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02005}02005                         \textcolor{keywordflow}{return} (EPROTONOSUPPORT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02006}02006 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* XXX */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02007}02007 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02008}02008         \textcolor{keywordflow}{if} (pcb != NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02009}02009                 \textcolor{keywordflow}{return} (EISCONN);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02010}02010 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02011}02011         \textcolor{comment}{/* Reserve send and receive space if it is not reserved yet */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02012}02012         \textcolor{keywordflow}{if} ((so-\/>so\_snd.sb\_hiwat == 0) || (so-\/>so\_rcv.sb\_hiwat == 0)) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02013}02013                 error = soreserve(so, \mbox{\hyperlink{ng__btsocket__l2cap_8h_ad1c2e644dabf38ea2d06027c8074675f}{NG\_BTSOCKET\_L2CAP\_SENDSPACE}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02014}02014                                         \mbox{\hyperlink{ng__btsocket__l2cap_8h_a6c66ad8c197f05afc51c3cc000dda812}{NG\_BTSOCKET\_L2CAP\_RECVSPACE}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02015}02015                 \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02016}02016                         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02017}02017         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02018}02018 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02019}02019         \textcolor{comment}{/* Allocate the PCB */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02020}02020         pcb = malloc(\textcolor{keyword}{sizeof}(*pcb),}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02021}02021                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3faae7ab72087cb5a1a8e9166d018d1c}{M\_NETGRAPH\_BTSOCKET\_L2CAP}}, M\_NOWAIT | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02022}02022         \textcolor{keywordflow}{if} (pcb == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02023}02023                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02024}02024 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02025}02025         \textcolor{comment}{/* Link the PCB and the socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02026}02026         so-\/>so\_pcb = (caddr\_t) pcb;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02027}02027         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}} = so;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02028}02028         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02029}02029 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02030}02030         \textcolor{comment}{/* Initialize PCB */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02031}02031         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a97537ea63c9964e085fa3f22d0ce8bb5}{omtu}} = \mbox{\hyperlink{ng__l2cap_8h_a98b0eab62d7464f4c95df05ef865f423}{NG\_L2CAP\_MTU\_DEFAULT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02032}02032 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02033}02033         \textcolor{comment}{/* Default flow */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02034}02034         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}.flags = 0x0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02035}02035         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}.service\_type = \mbox{\hyperlink{ng__hci_8h_ac21f8a42bec4999467b25ac636a9d846}{NG\_HCI\_SERVICE\_TYPE\_BEST\_EFFORT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02036}02036         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}.token\_rate = 0xffffffff; \textcolor{comment}{/* maximum */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02037}02037         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}.token\_bucket\_size = 0xffffffff; \textcolor{comment}{/* maximum */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02038}02038         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}.peak\_bandwidth = 0x00000000; \textcolor{comment}{/* maximum */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02039}02039         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}.latency = 0xffffffff; \textcolor{comment}{/* don't care */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02040}02040         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}.delay\_variation = 0xffffffff; \textcolor{comment}{/* don't care */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02041}02041 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02042}02042         bcopy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02043}02043 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02044}02044         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a733ff83b9b31d09d9c50af47d8df753c}{flush\_timo}} = \mbox{\hyperlink{ng__l2cap_8h_a6d7d92c17e580f84fb2f5e33eafa1595}{NG\_L2CAP\_FLUSH\_TIMO\_DEFAULT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02045}02045         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2f46ae92d6beb0a0fa3268e330f666c0}{link\_timo}} = \mbox{\hyperlink{ng__l2cap_8h_aee326f3e2a0ea131a25cb2446059398c}{NG\_L2CAP\_LINK\_TIMO\_DEFAULT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02046}02046 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02047}02047         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02048}02048 \textcolor{comment}{         * XXX Mark PCB mutex as DUPOK to prevent "{}duplicated lock of}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02049}02049 \textcolor{comment}{         * the same type"{} message. When accepting new L2CAP connection }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02050}02050 \textcolor{comment}{         * ng\_btsocket\_l2cap\_process\_l2ca\_con\_ind() holds both PCB mutexes }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02051}02051 \textcolor{comment}{         * for "{}old"{} (accepting) PCB and "{}new"{} (created) PCB.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02052}02052 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02053}02053                 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02054}02054         mtx\_init(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, \textcolor{stringliteral}{"{}btsocks\_l2cap\_pcb\_mtx"{}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02055}02055                 MTX\_DEF|MTX\_DUPOK);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02056}02056         callout\_init\_mtx(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4375ada3761ae664b7f8441707802e61}{timo}}, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02057}02057 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02058}02058         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02059}02059 \textcolor{comment}{         * Add the PCB to the list}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02060}02060 \textcolor{comment}{         * }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02061}02061 \textcolor{comment}{         * XXX FIXME VERY IMPORTANT!}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02062}02062 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02063}02063 \textcolor{comment}{         * This is totally FUBAR. We could get here in two cases:}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02064}02064 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02065}02065 \textcolor{comment}{         * 1) When user calls socket()}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02066}02066 \textcolor{comment}{         * 2) When we need to accept new incoming connection and call }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02067}02067 \textcolor{comment}{         *    sonewconn()}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02068}02068 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02069}02069 \textcolor{comment}{         * In the first case we must acquire ng\_btsocket\_l2cap\_sockets\_mtx.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02070}02070 \textcolor{comment}{         * In the second case we hold ng\_btsocket\_l2cap\_sockets\_mtx already.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02071}02071 \textcolor{comment}{         * So we now need to distinguish between these cases. From reading}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02072}02072 \textcolor{comment}{         * /sys/kern/uipc\_socket.c we can find out that sonewconn() calls}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02073}02073 \textcolor{comment}{         * pru\_attach with proto == 0 and td == NULL. For now use this fact}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02074}02074 \textcolor{comment}{         * to figure out if we were called from socket() or from sonewconn().}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02075}02075 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02076}02076 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02077}02077         \textcolor{keywordflow}{if} (td != NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02078}02078                 mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02079}02079         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02080}02080                 mtx\_assert(\&ng\_btsocket\_l2cap\_sockets\_mtx, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02081}02081 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02082}02082         \textcolor{comment}{/* Set PCB token. Use ng\_btsocket\_l2cap\_sockets\_mtx for protection */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02083}02083         \textcolor{keywordflow}{if} (++ token == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02084}02084                 token ++;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02085}02085 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02086}02086         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a63340d46b20c1fff6f5c94540690c676}{token}} = token;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02087}02087 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02088}02088         LIST\_INSERT\_HEAD(\&ng\_btsocket\_l2cap\_sockets, pcb, next);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02089}02089 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02090}02090         \textcolor{keywordflow}{if} (td != NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02091}02091                 mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02092}02092 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02093}02093         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02094}02094 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_attach */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02095}02095 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02096}02096 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02097}02097 \textcolor{comment}{ * Bind socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02098}02098 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02099}02099 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02100}02100 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02101}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a637003e56f9b30dc5411e45538454b05}{02101}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ab169a948d8ae016c426dde03b506d876}{ng\_btsocket\_l2cap\_bind}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam, }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02102}02102                 \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02103}02103 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02104}02104         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}  *pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02105}02105         \textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap}{sockaddr\_l2cap}}     *sa = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap}{sockaddr\_l2cap}} *) nam;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02106}02106         \textcolor{keywordtype}{int}                      psm, error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02107}02107 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02108}02108         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02109}02109                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02110}02110 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02111}02111         \textcolor{comment}{/* Verify address */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02112}02112         \textcolor{keywordflow}{if} (sa == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02113}02113                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02114}02114         \textcolor{keywordflow}{if} (sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_ab83019b07d4bc193848ecbab48a37d74}{l2cap\_family}} != AF\_BLUETOOTH)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02115}02115                 \textcolor{keywordflow}{return} (EAFNOSUPPORT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02116}02116         \textcolor{comment}{/*For the time being, Not support LE binding.*/}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02117}02117         \textcolor{keywordflow}{if} ((sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a2873ac0f21c26fbe6ec34259c5006ba0}{l2cap\_len}} != \textcolor{keyword}{sizeof}(*sa))\&\&}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02118}02118             (sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a2873ac0f21c26fbe6ec34259c5006ba0}{l2cap\_len}} != \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap__compat}{sockaddr\_l2cap\_compat}})))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02119}02119                 return (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02120}02120 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02121}02121         psm = le16toh(sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a4b54ce6ea97267b165f6d03296017a45}{l2cap\_psm}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02122}02122 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02123}02123         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02124}02124 \textcolor{comment}{         * Check if other socket has this address already (look for exact}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02125}02125 \textcolor{comment}{         * match PSM and bdaddr) and assign socket address if it's available.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02126}02126 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02127}02127 \textcolor{comment}{         * Note: socket can be bound to ANY PSM (zero) thus allowing several}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02128}02128 \textcolor{comment}{         * channels with the same PSM between the same pair of BD\_ADDR'es.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02129}02129 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02130}02130 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02131}02131         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02132}02132 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02133}02133         LIST\_FOREACH(pcb, \&ng\_btsocket\_l2cap\_sockets, next)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02134}02134                 \textcolor{keywordflow}{if} (psm != 0 \&\& psm == pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02135}02135                     bcmp(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \&sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a62f797ac0225bfd8fcf54729775561cb}{l2cap\_bdaddr}}, \textcolor{keyword}{sizeof}(bdaddr\_t)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02136}02136                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02137}02137 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02138}02138         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02139}02139                 \textcolor{comment}{/* Set socket address */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02140}02140                 pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02141}02141                 \textcolor{keywordflow}{if} (pcb != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02142}02142                         bcopy(\&sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a62f797ac0225bfd8fcf54729775561cb}{l2cap\_bdaddr}}, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02143}02143                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}} = psm;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02144}02144                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02145}02145                         error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02146}02146         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02147}02147                 error = EADDRINUSE;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02148}02148 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02149}02149         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02150}02150 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02151}02151         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02152}02152 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_bind */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02153}02153 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02154}02154 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02155}02155 \textcolor{comment}{ * Connect socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02156}02156 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02157}02157 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02158}02158 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02159}\mbox{\hyperlink{ng__btsocket__l2cap_8h_aef58162f0850d43c2c37c3ec3ab324a2}{02159}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_ad4f870307c6675ee9ddb7e8c7c23ff89}{ng\_btsocket\_l2cap\_connect}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr *nam, }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02160}02160                 \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02161}02161 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02162}02162         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}          *pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02163}02163         \textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap__compat}{sockaddr\_l2cap\_compat}}       *sal = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap__compat}{sockaddr\_l2cap\_compat}} *) nam;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02164}02164         \textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap}{sockaddr\_l2cap}} *sa  = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap}{sockaddr\_l2cap}} *)nam;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02165}02165         \textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap}{sockaddr\_l2cap}}  ba;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02166}02166         \mbox{\hyperlink{structng__btsocket__l2cap__rtentry}{ng\_btsocket\_l2cap\_rtentry\_t}}  *rt = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02167}02167         \textcolor{keywordtype}{int}                              have\_src, error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02168}02168         \textcolor{keywordtype}{int} idtype = \mbox{\hyperlink{ng__l2cap_8h_a446404915983b7f7db08a8faeaf67e9d}{NG\_L2CAP\_L2CA\_IDTYPE\_BREDR}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02169}02169         \textcolor{comment}{/* Check socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02170}02170         \textcolor{keywordflow}{if} (pcb == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02171}02171                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02172}02172         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02173}02173                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02174}02174         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} == \mbox{\hyperlink{ng__btsocket__l2cap_8h_a1bef328ad25d99c18012e0f9db9246db}{NG\_BTSOCKET\_L2CAP\_CONNECTING}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02175}02175                 \textcolor{keywordflow}{return} (EINPROGRESS);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02176}02176 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02177}02177         \textcolor{comment}{/* Verify address */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02178}02178         \textcolor{keywordflow}{if} (sa == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02179}02179                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02180}02180         \textcolor{keywordflow}{if} (sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_ab83019b07d4bc193848ecbab48a37d74}{l2cap\_family}} != AF\_BLUETOOTH)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02181}02181                 \textcolor{keywordflow}{return} (EAFNOSUPPORT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02182}02182         \textcolor{keywordflow}{if} (sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a2873ac0f21c26fbe6ec34259c5006ba0}{l2cap\_len}} == \textcolor{keyword}{sizeof}(*sal))\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02183}02183                 bcopy(sal, \&ba, \textcolor{keyword}{sizeof}(*sal));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02184}02184                 sa = \&ba;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02185}02185                 sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a2873ac0f21c26fbe6ec34259c5006ba0}{l2cap\_len}} = \textcolor{keyword}{sizeof}(*sa);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02186}02186                 sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a398183a3a841fa5ec842bb5c36a190a1}{l2cap\_bdaddr\_type}} = \mbox{\hyperlink{ng__bluetooth_8h_a84acdd31fe3b4424a3499bdfcd0c5856}{BDADDR\_BREDR}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02187}02187         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02188}02188         \textcolor{keywordflow}{if} (sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a2873ac0f21c26fbe6ec34259c5006ba0}{l2cap\_len}} != \textcolor{keyword}{sizeof}(*sa))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02189}02189                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02190}02190         \textcolor{keywordflow}{if} ((sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a4b54ce6ea97267b165f6d03296017a45}{l2cap\_psm}} \&\&  sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a38c4767bfc057e400a77b8de2b1df741}{l2cap\_cid}}))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02191}02191                 \textcolor{keywordflow}{return} EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02192}02192         \textcolor{keywordflow}{if} (bcmp(\&sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a62f797ac0225bfd8fcf54729775561cb}{l2cap\_bdaddr}}, \mbox{\hyperlink{ng__hci_8h_a5087b37d7deab31f2b7c7580982b4c1c}{NG\_HCI\_BDADDR\_ANY}}, \textcolor{keyword}{sizeof}(bdaddr\_t)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02193}02193                 \textcolor{keywordflow}{return} (EDESTADDRREQ);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02194}02194         \textcolor{keywordflow}{if}((sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a398183a3a841fa5ec842bb5c36a190a1}{l2cap\_bdaddr\_type}} == \mbox{\hyperlink{ng__bluetooth_8h_a84acdd31fe3b4424a3499bdfcd0c5856}{BDADDR\_BREDR}})\&\&}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02195}02195            (sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a4b54ce6ea97267b165f6d03296017a45}{l2cap\_psm}} == 0))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02196}02196                 \textcolor{keywordflow}{return} EDESTADDRREQ;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02197}02197         \textcolor{keywordflow}{if}(sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a398183a3a841fa5ec842bb5c36a190a1}{l2cap\_bdaddr\_type}} != \mbox{\hyperlink{ng__bluetooth_8h_a84acdd31fe3b4424a3499bdfcd0c5856}{BDADDR\_BREDR}})\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02198}02198                 \textcolor{keywordflow}{if}(sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a38c4767bfc057e400a77b8de2b1df741}{l2cap\_cid}} == \mbox{\hyperlink{ng__l2cap_8h_a6dc8898d2bd24090e4ad2f77766e2838}{NG\_L2CAP\_ATT\_CID}})\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02199}02199                         idtype = \mbox{\hyperlink{ng__l2cap_8h_aa28ed4e421ee5ca6057d264e6fa0c9a7}{NG\_L2CAP\_L2CA\_IDTYPE\_ATT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02200}02200                 \}\textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a38c4767bfc057e400a77b8de2b1df741}{l2cap\_cid}} == \mbox{\hyperlink{ng__l2cap_8h_a13d0089b6298564c03c96b6211c640f6}{NG\_L2CAP\_SMP\_CID}})\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02201}02201                         idtype =\mbox{\hyperlink{ng__l2cap_8h_a4d8f2b5d106fe39d83d37c8d1a418b09}{NG\_L2CAP\_L2CA\_IDTYPE\_SMP}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02202}02202                 \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02203}02203                         \textcolor{comment}{//if cid == 0 idtype = NG\_L2CAP\_L2CA\_IDTYPE\_LE;}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02204}02204                         \textcolor{comment}{// Not supported yet}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02205}02205                         \textcolor{keywordflow}{return} EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02206}02206                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02207}02207         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02208}02208         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}} != 0 \&\& pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}} != le16toh(sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a4b54ce6ea97267b165f6d03296017a45}{l2cap\_psm}}))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02209}02209                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02210}02210         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02211}02211 \textcolor{comment}{         * Routing. Socket should be bound to some source address. The source}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02212}02212 \textcolor{comment}{         * address can be ANY. Destination address must be set and it must not}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02213}02213 \textcolor{comment}{         * be ANY. If source address is ANY then find first rtentry that has}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02214}02214 \textcolor{comment}{         * src != dst.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02215}02215 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02216}02216 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02217}02217         mtx\_lock(\&ng\_btsocket\_l2cap\_rt\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02218}02218         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02219}02219         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02220}02220 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02221}02221         \textcolor{comment}{/* Send destination address and PSM */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02222}02222         bcopy(\&sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a62f797ac0225bfd8fcf54729775561cb}{l2cap\_bdaddr}}, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02223}02223         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}} = le16toh(sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a4b54ce6ea97267b165f6d03296017a45}{l2cap\_psm}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02224}02224         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a73c93556e78281c5a6dcc4360a68145f}{dsttype}} = sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a398183a3a841fa5ec842bb5c36a190a1}{l2cap\_bdaddr\_type}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02225}02225         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02226}02226         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a25725146b54a9789b596ce2e417487ba}{idtype}} = idtype;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02227}02227         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02228}02228         have\_src = bcmp(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \mbox{\hyperlink{ng__hci_8h_a5087b37d7deab31f2b7c7580982b4c1c}{NG\_HCI\_BDADDR\_ANY}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02229}02229 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02230}02230         LIST\_FOREACH(rt, \&ng\_btsocket\_l2cap\_rt, next) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02231}02231                 \textcolor{keywordflow}{if} (rt-\/>hook == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(rt-\/>hook))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02232}02232                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02233}02233 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02234}02234                 \textcolor{comment}{/* Match src and dst */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02235}02235                 \textcolor{keywordflow}{if} (have\_src) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02236}02236                         \textcolor{keywordflow}{if} (bcmp(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \&rt-\/>src, \textcolor{keyword}{sizeof}(rt-\/>src)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02237}02237                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02238}02238                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02239}02239                         \textcolor{keywordflow}{if} (bcmp(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}, \&rt-\/>src, \textcolor{keyword}{sizeof}(rt-\/>src)) != 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02240}02240                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02241}02241                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02242}02242         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02243}02243 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02244}02244         \textcolor{keywordflow}{if} (rt != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02245}02245                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} = rt;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02246}02246 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02247}02247                 \textcolor{keywordflow}{if} (!have\_src)\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02248}02248                         bcopy(\&rt-\/>src, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02249}02249                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab39081b75770347a07069036129ba45b}{srctype}} =}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02250}02250                           (sa-\/>\mbox{\hyperlink{structsockaddr__l2cap_a398183a3a841fa5ec842bb5c36a190a1}{l2cap\_bdaddr\_type}} == \mbox{\hyperlink{ng__bluetooth_8h_a84acdd31fe3b4424a3499bdfcd0c5856}{BDADDR\_BREDR}})?}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02251}02251                           \mbox{\hyperlink{ng__bluetooth_8h_a84acdd31fe3b4424a3499bdfcd0c5856}{BDADDR\_BREDR}} : \mbox{\hyperlink{ng__bluetooth_8h_ad09494a7a7e9ad5d99de277cbfd61255}{BDADDR\_LE\_PUBLIC}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02252}02252                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02253}02253         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02254}02254                 error = EHOSTUNREACH;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02255}02255 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02256}02256         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02257}02257 \textcolor{comment}{         * Send L2CA\_Connect request }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02258}02258 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02259}02259 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02260}02260         \textcolor{keywordflow}{if} (error == 0) \{       }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02261}02261                 error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a9106e565b3d4b10ec30e72e1cfbf8c95}{ng\_btsocket\_l2cap\_send\_l2ca\_con\_req}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02262}02262                 \textcolor{keywordflow}{if} (error == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02263}02263                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} |= \mbox{\hyperlink{ng__btsocket__l2cap_8h_a0bcf09a805e89db8c54172b22d12cdd0}{NG\_BTSOCKET\_L2CAP\_CLIENT}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02264}02264                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a1bef328ad25d99c18012e0f9db9246db}{NG\_BTSOCKET\_L2CAP\_CONNECTING}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02265}02265                         soisconnecting(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02266}02266 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02267}02267                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02268}02268                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02269}02269         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02270}02270 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02271}02271         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02272}02272         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02273}02273         mtx\_unlock(\&ng\_btsocket\_l2cap\_rt\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02274}02274 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02275}02275         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02276}02276 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_connect */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02277}02277 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02278}02278 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02279}02279 \textcolor{comment}{ * Process ioctl's calls on socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02280}02280 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02281}02281 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02282}02282 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02283}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a1297b195097a61e760ad29553b4328ee}{02283}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2e300e63329a4dea9abbec4bbf5b4f4f}{ng\_btsocket\_l2cap\_control}}(\textcolor{keyword}{struct} socket *so, u\_long \mbox{\hyperlink{ng__pppoe_8h_adfc5ba7e22f5e4a6221c12a70503bef3}{cmd}}, caddr\_t \mbox{\hyperlink{ng__ubt__var_8h_a7f897df1949af68456ee830f2468e476}{data}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02284}02284                 \textcolor{keyword}{struct} ifnet *ifp, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02285}02285 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02286}02286         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02287}02287 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_control */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02288}02288 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02289}02289 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02290}02290 \textcolor{comment}{ * Process getsockopt/setsockopt system calls}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02291}02291 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02292}02292 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02293}02293 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02294}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a4a80bae9ed3e6419005e6db37a20602b}{02294}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a7142052482f450cbca92f9b1a5f96271}{ng\_btsocket\_l2cap\_ctloutput}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockopt *sopt)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02295}02295 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02296}02296         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02297}02297         \textcolor{keywordtype}{int}                     error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02298}02298         \mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t}{ng\_l2cap\_cfg\_opt\_val\_t}}    v;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02299}02299 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02300}02300         \textcolor{keywordflow}{if} (pcb == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02301}02301                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02302}02302         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02303}02303                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02304}02304 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02305}02305         \textcolor{keywordflow}{if} (sopt-\/>sopt\_level != \mbox{\hyperlink{ng__btsocket_8h_a31062ffb1f482be7ad2fcb59287807e4}{SOL\_L2CAP}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02306}02306                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02307}02307 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02308}02308         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02309}02309 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02310}02310         \textcolor{keywordflow}{switch} (sopt-\/>sopt\_dir) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02311}02311         \textcolor{keywordflow}{case} SOPT\_GET:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02312}02312                 \textcolor{keywordflow}{switch} (sopt-\/>sopt\_name) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02313}02313                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_a001d5092f54d1467201eea9ad372e913}{SO\_L2CAP\_IMTU}}: \textcolor{comment}{/* get incoming MTU */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02314}02314                         error = sooptcopyout(sopt, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02315}02315                                                 \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02316}02316                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02317}02317 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02318}02318                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_af095666b1f9a617f2d8ce34956971ad5}{SO\_L2CAP\_OMTU}}: \textcolor{comment}{/* get outgoing (peer incoming) MTU */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02319}02319                         error = sooptcopyout(sopt, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a97537ea63c9964e085fa3f22d0ce8bb5}{omtu}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02320}02320                                                 \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a97537ea63c9964e085fa3f22d0ce8bb5}{omtu}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02321}02321                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02322}02322 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02323}02323                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_a3c1e29781eb21e184d997bc5ed1cd07f}{SO\_L2CAP\_IFLOW}}: \textcolor{comment}{/* get incoming flow spec. */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02324}02324                         error = sooptcopyout(sopt, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02325}02325                                                 \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aee4fd572213c585d5db79cf74e997b1d}{iflow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02326}02326                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02327}02327 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02328}02328                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_adf681d6879df5d5b599f56467d73dd4b}{SO\_L2CAP\_OFLOW}}: \textcolor{comment}{/* get outgoing flow spec. */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02329}02329                         error = sooptcopyout(sopt, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02330}02330                                                 \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02331}02331                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02332}02332 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02333}02333                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_a8f766d6ea81b17cd46806c673a616c5d}{SO\_L2CAP\_FLUSH}}: \textcolor{comment}{/* get flush timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02334}02334                         error = sooptcopyout(sopt, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a733ff83b9b31d09d9c50af47d8df753c}{flush\_timo}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02335}02335                                                 \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a733ff83b9b31d09d9c50af47d8df753c}{flush\_timo}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02336}02336                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02337}02337                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_ada500017bd5795c073f37d85e8732420}{SO\_L2CAP\_ENCRYPTED}}: \textcolor{comment}{/* get encrypt required */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02338}02338                         error = sooptcopyout(sopt, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_abe0b47708a419f4e9840080242348fd6}{need\_encrypt}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02339}02339                                                 \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_abe0b47708a419f4e9840080242348fd6}{need\_encrypt}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02340}02340                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02341}02341 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02342}02342                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02343}02343                         error = ENOPROTOOPT;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02344}02344                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02345}02345                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02346}02346                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02347}02347 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02348}02348         \textcolor{keywordflow}{case} SOPT\_SET:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02349}02349                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02350}02350 \textcolor{comment}{                 * XXX}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02351}02351 \textcolor{comment}{                 * We do not allow to change these parameters while socket is }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02352}02352 \textcolor{comment}{                 * connected or we are in the process of creating a connection.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02353}02353 \textcolor{comment}{                 * May be this should indicate re-\/configuration of the open }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02354}02354 \textcolor{comment}{                 * channel?}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02355}02355 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02356}02356 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02357}02357                 \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02358}02358                         error = EACCES;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02359}02359                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02360}02360                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02361}02361 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02362}02362                 \textcolor{keywordflow}{switch} (sopt-\/>sopt\_name) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02363}02363                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_a001d5092f54d1467201eea9ad372e913}{SO\_L2CAP\_IMTU}}: \textcolor{comment}{/* set incoming MTU */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02364}02364                         error = sooptcopyin(sopt, \&v, \textcolor{keyword}{sizeof}(v), \textcolor{keyword}{sizeof}(v.\mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t_a53c2fc192a7ceb2b0ee4b24bf2d414c9}{mtu}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02365}02365                         \textcolor{keywordflow}{if} (error == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02366}02366                                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a35c8f52e597a0125b4336bf01aa7636f}{imtu}} = v.\mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t_a53c2fc192a7ceb2b0ee4b24bf2d414c9}{mtu}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02367}02367                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02368}02368 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02369}02369                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_adf681d6879df5d5b599f56467d73dd4b}{SO\_L2CAP\_OFLOW}}: \textcolor{comment}{/* set outgoing flow spec. */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02370}02370                         error = sooptcopyin(sopt, \&v, \textcolor{keyword}{sizeof}(v),\textcolor{keyword}{sizeof}(v.\mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t_a8503cbaffef8f8e7043e6041b17578cd}{flow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02371}02371                         \textcolor{keywordflow}{if} (error == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02372}02372                                 bcopy(\&v.\mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t_a8503cbaffef8f8e7043e6041b17578cd}{flow}}, \&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}, \textcolor{keyword}{sizeof}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ac5523a7d9a53893ed129feb9da7f0627}{oflow}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02373}02373                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02374}02374 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02375}02375                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_a8f766d6ea81b17cd46806c673a616c5d}{SO\_L2CAP\_FLUSH}}: \textcolor{comment}{/* set flush timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02376}02376                         error = sooptcopyin(sopt, \&v, \textcolor{keyword}{sizeof}(v),}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02377}02377                                                 \textcolor{keyword}{sizeof}(v.\mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t_ab7bf867da9cfcbb981e06a8edf6cb6db}{flush\_timo}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02378}02378                         \textcolor{keywordflow}{if} (error == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02379}02379                                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a733ff83b9b31d09d9c50af47d8df753c}{flush\_timo}} = v.\mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t_ab7bf867da9cfcbb981e06a8edf6cb6db}{flush\_timo}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02380}02380                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02381}02381                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket_8h_ada500017bd5795c073f37d85e8732420}{SO\_L2CAP\_ENCRYPTED}}: \textcolor{comment}{/*set connect encryption opt*/}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02382}02382                         \textcolor{keywordflow}{if}((pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}}) \&\&}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02383}02383                            (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_a9aa68f78b2908d9e193caf4e271fcde0}{NG\_BTSOCKET\_L2CAP\_W4\_ENC\_CHANGE}}))\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02384}02384                                 error = sooptcopyin(sopt, \&v, \textcolor{keyword}{sizeof}(v),}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02385}02385                                                     \textcolor{keyword}{sizeof}(v.\mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t_adad36e48bf6bb5620c657e3d9f14e85c}{encryption}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02386}02386                                 \textcolor{keywordflow}{if}(error == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02387}02387                                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_abe0b47708a419f4e9840080242348fd6}{need\_encrypt}} = (v.\mbox{\hyperlink{unionng__l2cap__cfg__opt__val__t_adad36e48bf6bb5620c657e3d9f14e85c}{encryption}})?1:0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02388}02388                         \}\textcolor{keywordflow}{else}\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02389}02389                                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02390}02390                         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02391}02391                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02392}02392                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02393}02393                         error = ENOPROTOOPT;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02394}02394                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02395}02395                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02396}02396                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02397}02397 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02398}02398         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02399}02399                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02400}02400                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02401}02401         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02402}02402 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02403}02403         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02404}02404 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02405}02405         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02406}02406 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_ctloutput */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02407}02407 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02408}02408 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02409}02409 \textcolor{comment}{ * Detach and destroy socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02410}02410 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02411}02411 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02412}02412 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02413}\mbox{\hyperlink{ng__btsocket__l2cap_8h_abcbc44b0714268cac09a90df7da74e03}{02413}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_accec4156d38fbc20c40a71e02d5db564}{ng\_btsocket\_l2cap\_detach}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02414}02414 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02415}02415         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02416}02416 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02417}02417         KASSERT(pcb != NULL, (\textcolor{stringliteral}{"{}ng\_btsocket\_l2cap\_detach: pcb == NULL"{}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02418}02418 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02419}02419         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02420}02420                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02421}02421 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02422}02422         mtx\_lock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02423}02423         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02424}02424 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02425}02425         \textcolor{comment}{/* XXX what to do with pending request? */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02426}02426         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_a427bf6e6db2d643af5dac6c8068a362a}{NG\_BTSOCKET\_L2CAP\_TIMO}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02427}02427                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02428}02428 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02429}02429         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}} \&\&}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02430}02430             pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_a0278cb3eb7f0c2b11b04c6f2d319f4c7}{NG\_BTSOCKET\_L2CAP\_DISCONNECTING}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02431}02431                 \textcolor{comment}{/* Send disconnect request with "{}zero"{} token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02432}02432                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(0, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02433}02433 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02434}02434         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02435}02435 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02436}02436         LIST\_REMOVE(pcb, next);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02437}02437 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02438}02438         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02439}02439         mtx\_unlock(\&ng\_btsocket\_l2cap\_sockets\_mtx);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02440}02440 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02441}02441         mtx\_destroy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02442}02442         bzero(pcb, \textcolor{keyword}{sizeof}(*pcb));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02443}02443         free(pcb, \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3faae7ab72087cb5a1a8e9166d018d1c}{M\_NETGRAPH\_BTSOCKET\_L2CAP}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02444}02444 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02445}02445         soisdisconnected(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02446}02446         so-\/>so\_pcb = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02447}02447 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_detach */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02448}02448 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02449}02449 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02450}02450 \textcolor{comment}{ * Disconnect socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02451}02451 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02452}02452 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02453}02453 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02454}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a78a17b60f75f4e846e029500877302d1}{02454}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a92bbd2189c0bde4c4a0d54168e874161}{ng\_btsocket\_l2cap\_disconnect}}(\textcolor{keyword}{struct} socket *so)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02455}02455 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02456}02456         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02457}02457         \textcolor{keywordtype}{int}                     error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02458}02458 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02459}02459         \textcolor{keywordflow}{if} (pcb == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02460}02460                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02461}02461         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02462}02462                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02463}02463 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02464}02464         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02465}02465 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02466}02466         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} == \mbox{\hyperlink{ng__btsocket__l2cap_8h_a0278cb3eb7f0c2b11b04c6f2d319f4c7}{NG\_BTSOCKET\_L2CAP\_DISCONNECTING}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02467}02467                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02468}02468                 \textcolor{keywordflow}{return} (EINPROGRESS);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02469}02469         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02470}02470 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02471}02471         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02472}02472                 \textcolor{comment}{/* XXX FIXME what to do with pending request? */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02473}02473                 \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_a427bf6e6db2d643af5dac6c8068a362a}{NG\_BTSOCKET\_L2CAP\_TIMO}})}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02474}02474                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02475}02475 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02476}02476                 error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a63340d46b20c1fff6f5c94540690c676}{token}}, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02477}02477                 \textcolor{keywordflow}{if} (error == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02478}02478                         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a0278cb3eb7f0c2b11b04c6f2d319f4c7}{NG\_BTSOCKET\_L2CAP\_DISCONNECTING}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02479}02479                         soisdisconnecting(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02480}02480 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02481}02481                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02482}02482                 \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02483}02483 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02484}02484                 \textcolor{comment}{/* XXX FIXME what to do if error != 0 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02485}02485         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02486}02486 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02487}02487         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02488}02488 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02489}02489         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02490}02490 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_disconnect */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02491}02491 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02492}02492 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02493}02493 \textcolor{comment}{ * Listen on socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02494}02494 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02495}02495 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02496}02496 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02497}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a465632c1f538f7b6c970e5be4ef671ec}{02497}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_abc9c85f80c5fea8b38b2379cfa4aad0c}{ng\_btsocket\_l2cap\_listen}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} backlog, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02498}02498 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02499}02499         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02500}02500         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02501}02501 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02502}02502         SOCK\_LOCK(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02503}02503         error = solisten\_proto\_check(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02504}02504         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02505}02505                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02506}02506         \textcolor{keywordflow}{if} (pcb == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02507}02507                 solisten\_proto\_abort(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02508}02508                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02509}02509                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02510}02510         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02511}02511         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02512}02512                 solisten\_proto\_abort(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02513}02513                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02514}02514                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02515}02515         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02516}02516         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}} == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02517}02517                 solisten\_proto\_abort(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02518}02518                 error = EADDRNOTAVAIL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02519}02519                 \textcolor{keywordflow}{goto} out;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02520}02520         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02521}02521         solisten\_proto(so, backlog);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02522}02522 out:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02523}02523         SOCK\_UNLOCK(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02524}02524         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02525}02525 \} \textcolor{comment}{/* ng\_btsocket\_listen */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02526}02526 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02527}02527 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02528}02528 \textcolor{comment}{ * Get peer address}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02529}02529 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02530}02530 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02531}02531 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02532}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a28f762927b2707611190eed3c54df8c7}{02532}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a8878f4df2495c2fc8c61c4dd6fbe4c1c}{ng\_btsocket\_l2cap\_peeraddr}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **nam)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02533}02533 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02534}02534         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02535}02535         \textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap}{sockaddr\_l2cap}}     sa;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02536}02536 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02537}02537         \textcolor{keywordflow}{if} (pcb == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02538}02538                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02539}02539         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02540}02540                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02541}02541 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02542}02542         bcopy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a777b535be4c6ca1a2d12f935d8281b81}{dst}}, \&sa.\mbox{\hyperlink{structsockaddr__l2cap_a62f797ac0225bfd8fcf54729775561cb}{l2cap\_bdaddr}}, \textcolor{keyword}{sizeof}(sa.\mbox{\hyperlink{structsockaddr__l2cap_a62f797ac0225bfd8fcf54729775561cb}{l2cap\_bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02543}02543         sa.\mbox{\hyperlink{structsockaddr__l2cap_a4b54ce6ea97267b165f6d03296017a45}{l2cap\_psm}} = htole16(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02544}02544         sa.\mbox{\hyperlink{structsockaddr__l2cap_a2873ac0f21c26fbe6ec34259c5006ba0}{l2cap\_len}} = \textcolor{keyword}{sizeof}(sa);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02545}02545         sa.\mbox{\hyperlink{structsockaddr__l2cap_ab83019b07d4bc193848ecbab48a37d74}{l2cap\_family}} = AF\_BLUETOOTH;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02546}02546         \textcolor{keywordflow}{switch}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a25725146b54a9789b596ce2e417487ba}{idtype}})\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02547}02547         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_aa28ed4e421ee5ca6057d264e6fa0c9a7}{NG\_L2CAP\_L2CA\_IDTYPE\_ATT}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02548}02548                 sa.\mbox{\hyperlink{structsockaddr__l2cap_a38c4767bfc057e400a77b8de2b1df741}{l2cap\_cid}} = \mbox{\hyperlink{ng__l2cap_8h_a6dc8898d2bd24090e4ad2f77766e2838}{NG\_L2CAP\_ATT\_CID}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02549}02549                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02550}02550         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__l2cap_8h_a4d8f2b5d106fe39d83d37c8d1a418b09}{NG\_L2CAP\_L2CA\_IDTYPE\_SMP}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02551}02551                 sa.\mbox{\hyperlink{structsockaddr__l2cap_a38c4767bfc057e400a77b8de2b1df741}{l2cap\_cid}} = \mbox{\hyperlink{ng__l2cap_8h_a13d0089b6298564c03c96b6211c640f6}{NG\_L2CAP\_SMP\_CID}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02552}02552                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02553}02553         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02554}02554                 sa.\mbox{\hyperlink{structsockaddr__l2cap_a38c4767bfc057e400a77b8de2b1df741}{l2cap\_cid}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02555}02555                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02556}02556         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02557}02557         sa.\mbox{\hyperlink{structsockaddr__l2cap_a398183a3a841fa5ec842bb5c36a190a1}{l2cap\_bdaddr\_type}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a73c93556e78281c5a6dcc4360a68145f}{dsttype}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02558}02558         *nam = sodupsockaddr((\textcolor{keyword}{struct} sockaddr *) \&sa, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02559}02559 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02560}02560         \textcolor{keywordflow}{return} ((*nam == NULL)? ENOMEM : 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02561}02561 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_peeraddr */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02562}02562 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02563}02563 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02564}02564 \textcolor{comment}{ * Send data to socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02565}02565 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02566}02566 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02567}02567 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02568}\mbox{\hyperlink{ng__btsocket__l2cap_8h_a18c8e4746d883942abc53eff71cf7b83}{02568}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a8afafe35565ba64add3b5e44e58661b7}{ng\_btsocket\_l2cap\_send}}(\textcolor{keyword}{struct} socket *so, \textcolor{keywordtype}{int} \mbox{\hyperlink{netflow_8h_aa2585d779da0ab21273a8d92de9a0ebe}{flags}}, \textcolor{keyword}{struct} mbuf *m,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02569}02569                 \textcolor{keyword}{struct} sockaddr *nam, \textcolor{keyword}{struct} mbuf *\mbox{\hyperlink{ng__btsocket__rfcomm_8h_ad817e591b4b470ae7791851e6d78896a}{control}}, \textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02570}02570 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02571}02571         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_t}}  *pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02572}02572         \textcolor{keywordtype}{int}                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02573}02573 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02574}02574         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02575}02575                 error = ENETDOWN;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02576}02576                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02577}02577         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02578}02578 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02579}02579         \textcolor{comment}{/* Check socket and input */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02580}02580         \textcolor{keywordflow}{if} (pcb == NULL || m == NULL || \mbox{\hyperlink{ng__btsocket__rfcomm_8h_ad817e591b4b470ae7791851e6d78896a}{control}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02581}02581                 error = EINVAL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02582}02582                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02583}02583         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02584}02584 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02585}02585         mtx\_lock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02586}02586 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02587}02587         \textcolor{comment}{/* Make sure socket is connected */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02588}02588         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} != \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02589}02589                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02590}02590                 error = ENOTCONN;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02591}02591                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02592}02592         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02593}02593 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02594}02594         \textcolor{comment}{/* Check route */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02595}02595         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}} == NULL ||}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02596}02596             pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}} == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02597}02597                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02598}02598                 error = ENETDOWN;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02599}02599                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02600}02600         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02601}02601 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02602}02602         \textcolor{comment}{/* Check packet size against outgoing (peer's incoming) MTU) */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02603}02603         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.len > pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a97537ea63c9964e085fa3f22d0ce8bb5}{omtu}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02604}02604                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02605}02605 \textcolor{stringliteral}{"{}\%s: Packet too big, len=\%d, omtu=\%d\(\backslash\)n"{}}, \_\_func\_\_, m-\/>m\_pkthdr.len, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a97537ea63c9964e085fa3f22d0ce8bb5}{omtu}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02606}02606 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02607}02607                 mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02608}02608                 error = EMSGSIZE;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02609}02609                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02610}02610         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02611}02611 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02612}02612         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02613}02613 \textcolor{comment}{         * First put packet on socket send queue. Then check if we have}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02614}02614 \textcolor{comment}{         * pending timeout. If we do not have timeout then we must send}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02615}02615 \textcolor{comment}{         * packet and schedule timeout. Otherwise do nothing and wait for}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02616}02616 \textcolor{comment}{         * L2CA\_WRITE\_RSP.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02617}02617 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02618}02618 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02619}02619         sbappendrecord(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_snd, m);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02620}02620         m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02621}02621 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02622}02622         \textcolor{keywordflow}{if} (!(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_a427bf6e6db2d643af5dac6c8068a362a}{NG\_BTSOCKET\_L2CAP\_TIMO}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02623}02623                 error = \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6bf5d2757d63f922ed0e06613fe109dd}{ng\_btsocket\_l2cap\_send2}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02624}02624                 \textcolor{keywordflow}{if} (error == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02625}02625                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02626}02626                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02627}02627                         sbdroprecord(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_snd); \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02628}02628         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02629}02629 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02630}02630         mtx\_unlock(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02631}02631 drop:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02632}02632         \mbox{\hyperlink{netgraph_8h_a2461bfcdc9e024484ed8037d386620e3}{NG\_FREE\_M}}(m); \textcolor{comment}{/* checks for != NULL */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02633}02633         \mbox{\hyperlink{netgraph_8h_a2461bfcdc9e024484ed8037d386620e3}{NG\_FREE\_M}}(\mbox{\hyperlink{ng__btsocket__rfcomm_8h_ad817e591b4b470ae7791851e6d78896a}{control}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02634}02634 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02635}02635         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02636}02636 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_send */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02637}02637 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02638}02638 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02639}02639 \textcolor{comment}{ * Send first packet in the socket queue to the L2CAP layer}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02640}02640 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02641}02641 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02642}02642 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02643}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a6bf5d2757d63f922ed0e06613fe109dd}{02643}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6bf5d2757d63f922ed0e06613fe109dd}{ng\_btsocket\_l2cap\_send2}}(\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}} pcb)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02644}02644 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02645}02645         \textcolor{keyword}{struct  }mbuf            *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02646}02646         ng\_l2cap\_l2ca\_hdr\_t     *hdr = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02647}02647         \textcolor{keywordtype}{int}                      error = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02648}02648 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02649}02649         mtx\_assert(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02650}02650 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02651}02651         \textcolor{keywordflow}{if} (sbavail(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_snd) == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02652}02652                 \textcolor{keywordflow}{return} (EINVAL); \textcolor{comment}{/* XXX */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02653}02653 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02654}02654         m = m\_dup(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_snd.sb\_mb, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02655}02655         \textcolor{keywordflow}{if} (m == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02656}02656                 \textcolor{keywordflow}{return} (ENOBUFS);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02657}02657 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02658}02658         \textcolor{comment}{/* Create L2CA packet header */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02659}02659         M\_PREPEND(m, \textcolor{keyword}{sizeof}(*hdr), M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02660}02660         \textcolor{keywordflow}{if} (m != NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02661}02661                 \textcolor{keywordflow}{if} (m-\/>m\_len < \textcolor{keyword}{sizeof}(*hdr))}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02662}02662                         m = m\_pullup(m, \textcolor{keyword}{sizeof}(*hdr));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02663}02663 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02664}02664         \textcolor{keywordflow}{if} (m == NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02665}02665                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02666}02666 \textcolor{stringliteral}{"{}\%s: Failed to create L2CA packet header\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02667}02667 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02668}02668                 \textcolor{keywordflow}{return} (ENOBUFS);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02669}02669         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02670}02670 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02671}02671         hdr = mtod(m, ng\_l2cap\_l2ca\_hdr\_t *);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02672}02672         hdr-\/>token = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a63340d46b20c1fff6f5c94540690c676}{token}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02673}02673         hdr-\/>length = m-\/>m\_pkthdr.len -\/ \textcolor{keyword}{sizeof}(*hdr);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02674}02674         hdr-\/>lcid = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02675}02675         hdr-\/>idtype = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a25725146b54a9789b596ce2e417487ba}{idtype}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02676}02676         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a3f10d8122f652d868d5d35615519173d}{NG\_BTSOCKET\_L2CAP\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02677}02677 \textcolor{stringliteral}{"{}\%s: Sending packet: len=\%d, length=\%d, lcid=\%d, token=\%d, state=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02678}02678                 \_\_func\_\_, m-\/>m\_pkthdr.len, hdr-\/>length, hdr-\/>lcid, }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02679}02679                 hdr-\/>token, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02680}02680 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02681}02681         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02682}02682 \textcolor{comment}{         * If we got here than we have successfully creates new L2CAP }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02683}02683 \textcolor{comment}{         * data packet and now we can send it to the L2CAP layer}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02684}02684 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02685}02685 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02686}02686         \mbox{\hyperlink{netgraph_8h_a8c5e877ed70dff86bb57062afe4cee38}{NG\_SEND\_DATA\_ONLY}}(error, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ad50fa83cfd9d6a6fe0db91f7150c00db}{rt}}-\/>\mbox{\hyperlink{structng__btsocket__l2cap__rtentry_a383377bd8995aec5f652ec12553c1050}{hook}}, m);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02687}02687 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02688}02688         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02689}02689 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_send2 */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02690}02690 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02691}02691 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02692}02692 \textcolor{comment}{ * Get socket address}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02693}02693 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02694}02694 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02695}02695 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02696}\mbox{\hyperlink{ng__btsocket__l2cap_8h_acaf820d9350e652da10d033e36fa6c43}{02696}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a076929f4f2512178593e91e95bf272db}{ng\_btsocket\_l2cap\_sockaddr}}(\textcolor{keyword}{struct} socket *so, \textcolor{keyword}{struct} sockaddr **nam)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02697}02697 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02698}02698         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  pcb = \mbox{\hyperlink{ng__btsocket__l2cap_8h_a34a0fa5af94c3717d2edc61642ac90a1}{so2l2cap\_pcb}}(so);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02699}02699         \textcolor{keyword}{struct }\mbox{\hyperlink{structsockaddr__l2cap}{sockaddr\_l2cap}}     sa;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02700}02700 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02701}02701         \textcolor{keywordflow}{if} (pcb == NULL)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02702}02702                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02703}02703         \textcolor{keywordflow}{if} (\mbox{\hyperlink{ng__btsocket__l2cap_8c_aa71b0115960b2ad6eb1ec467cb10d658}{ng\_btsocket\_l2cap\_node}} == NULL) }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02704}02704                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02705}02705 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02706}02706         bcopy(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \&sa.\mbox{\hyperlink{structsockaddr__l2cap_a62f797ac0225bfd8fcf54729775561cb}{l2cap\_bdaddr}}, \textcolor{keyword}{sizeof}(sa.\mbox{\hyperlink{structsockaddr__l2cap_a62f797ac0225bfd8fcf54729775561cb}{l2cap\_bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02707}02707         sa.\mbox{\hyperlink{structsockaddr__l2cap_a4b54ce6ea97267b165f6d03296017a45}{l2cap\_psm}} = htole16(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02708}02708         sa.\mbox{\hyperlink{structsockaddr__l2cap_a2873ac0f21c26fbe6ec34259c5006ba0}{l2cap\_len}} = \textcolor{keyword}{sizeof}(sa);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02709}02709         sa.\mbox{\hyperlink{structsockaddr__l2cap_ab83019b07d4bc193848ecbab48a37d74}{l2cap\_family}} = AF\_BLUETOOTH;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02710}02710         sa.\mbox{\hyperlink{structsockaddr__l2cap_a38c4767bfc057e400a77b8de2b1df741}{l2cap\_cid}} = 0;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02711}02711         sa.\mbox{\hyperlink{structsockaddr__l2cap_a398183a3a841fa5ec842bb5c36a190a1}{l2cap\_bdaddr\_type}} = pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab39081b75770347a07069036129ba45b}{srctype}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02712}02712 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02713}02713         *nam = sodupsockaddr((\textcolor{keyword}{struct} sockaddr *) \&sa, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02714}02714 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02715}02715         \textcolor{keywordflow}{return} ((*nam == NULL)? ENOMEM : 0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02716}02716 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_sockaddr */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02717}02717 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02718}02718 \textcolor{comment}{/*****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02719}02719 \textcolor{comment}{ *****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02720}02720 \textcolor{comment}{ **                              Misc. functions}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02721}02721 \textcolor{comment}{ *****************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02722}02722 \textcolor{comment}{ *****************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02723}02723 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02724}02724 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02725}02725 \textcolor{comment}{ * Look for the socket that listens on given PSM and bdaddr. Returns exact or}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02726}02726 \textcolor{comment}{ * close match (if any). Caller must hold ng\_btsocket\_l2cap\_sockets\_mtx.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02727}02727 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02728}02728 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02729}02729 \textcolor{keyword}{static} \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02730}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a5d95f4ec25ed0ca9f708f12fa6696d27}{02730}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a5d95f4ec25ed0ca9f708f12fa6696d27}{ng\_btsocket\_l2cap\_pcb\_by\_addr}}(\mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}} bdaddr, \textcolor{keywordtype}{int} psm)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02731}02731 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02732}02732         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  p = NULL, p1 = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02733}02733 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02734}02734         mtx\_assert(\&ng\_btsocket\_l2cap\_sockets\_mtx, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02735}02735 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02736}02736         LIST\_FOREACH(p, \&ng\_btsocket\_l2cap\_sockets, next) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02737}02737                 \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}} == NULL || !SOLISTENING(p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}) || p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab678f280f54dab4e38b394999350022f}{psm}} != psm)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02738}02738                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02739}02739 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02740}02740                 \textcolor{keywordflow}{if} (bcmp(\&p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, bdaddr, \textcolor{keyword}{sizeof}(p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}})) == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02741}02741                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02742}02742 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02743}02743                 \textcolor{keywordflow}{if} (bcmp(\&p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \mbox{\hyperlink{ng__hci_8h_a5087b37d7deab31f2b7c7580982b4c1c}{NG\_HCI\_BDADDR\_ANY}}, \textcolor{keyword}{sizeof}(p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}})) == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02744}02744                         p1 = p;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02745}02745         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02746}02746 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02747}02747         \textcolor{keywordflow}{return} ((p != NULL)? p : p1);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02748}02748 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_pcb\_by\_addr */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02749}02749 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02750}02750 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02751}02751 \textcolor{comment}{ * Look for the socket that has given token.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02752}02752 \textcolor{comment}{ * Caller must hold ng\_btsocket\_l2cap\_sockets\_mtx.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02753}02753 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02754}02754 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02755}02755 \textcolor{keyword}{static} \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02756}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{02756}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a6e74fb251f3e56785f836fde6b9ce1ea}{ng\_btsocket\_l2cap\_pcb\_by\_token}}(u\_int32\_t token)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02757}02757 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02758}02758         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  p = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02759}02759 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02760}02760         \textcolor{keywordflow}{if} (token == 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02761}02761                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02762}02762 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02763}02763         mtx\_assert(\&ng\_btsocket\_l2cap\_sockets\_mtx, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02764}02764 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02765}02765         LIST\_FOREACH(p, \&ng\_btsocket\_l2cap\_sockets, next)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02766}02766                 \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a63340d46b20c1fff6f5c94540690c676}{token}} == token)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02767}02767                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02768}02768 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02769}02769         \textcolor{keywordflow}{return} (p);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02770}02770 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_pcb\_by\_token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02771}02771 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02772}02772 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02773}02773 \textcolor{comment}{ * Look for the socket that assigned to given source address and channel ID.}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02774}02774 \textcolor{comment}{ * Caller must hold ng\_btsocket\_l2cap\_sockets\_mtx}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02775}02775 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02776}02776 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02777}02777 \textcolor{keyword}{static} \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02778}\mbox{\hyperlink{ng__btsocket__l2cap_8c_abadc2c7cc4f9dffa7233af08dd085d2e}{02778}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_abadc2c7cc4f9dffa7233af08dd085d2e}{ng\_btsocket\_l2cap\_pcb\_by\_cid}}(\mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}} src, \textcolor{keywordtype}{int} cid, \textcolor{keywordtype}{int} idtype)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02779}02779 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02780}02780         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  p = NULL;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02781}02781 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02782}02782         mtx\_assert(\&ng\_btsocket\_l2cap\_sockets\_mtx, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02783}02783 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02784}02784         LIST\_FOREACH(p, \&ng\_btsocket\_l2cap\_sockets, next)\{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02785}02785                 \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}} == cid \&\&}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02786}02786                     bcmp(src, \&p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}}, \textcolor{keyword}{sizeof}(p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab452d19ab212aafb53ff627a4edb2d88}{src}})) == 0\&\&}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02787}02787                     p-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a25725146b54a9789b596ce2e417487ba}{idtype}} == idtype)              }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02788}02788                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02789}02789         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02790}02790         \textcolor{keywordflow}{return} (p);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02791}02791 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_pcb\_by\_cid */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02792}02792 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02793}02793 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02794}02794 \textcolor{comment}{ * Set timeout on socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02795}02795 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02796}02796 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02797}02797 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02798}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{02798}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a96b7caa4845ee2fb971663a850801b7d}{ng\_btsocket\_l2cap\_timeout}}(\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}} pcb)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02799}02799 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02800}02800         mtx\_assert(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02801}02801 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02802}02802         \textcolor{keywordflow}{if} (!(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_a427bf6e6db2d643af5dac6c8068a362a}{NG\_BTSOCKET\_L2CAP\_TIMO}})) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02803}02803                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} |= \mbox{\hyperlink{ng__btsocket__l2cap_8h_a427bf6e6db2d643af5dac6c8068a362a}{NG\_BTSOCKET\_L2CAP\_TIMO}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02804}02804                 callout\_reset(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4375ada3761ae664b7f8441707802e61}{timo}}, \mbox{\hyperlink{ng__bluetooth_8c_a0b2550e31c19c286b6c2de6f2dbf0736}{bluetooth\_l2cap\_ertx\_timeout}}(),}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02805}02805                     \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4e395c2948c1db7ef8243883ac4484bf}{ng\_btsocket\_l2cap\_process\_timeout}}, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02806}02806         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02807}02807                 KASSERT(0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02808}02808 (\textcolor{stringliteral}{"{}\%s: Duplicated socket timeout?!\(\backslash\)n"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02809}02809 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02810}02810 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02811}02811 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02812}02812 \textcolor{comment}{ * Unset timeout on socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02813}02813 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02814}02814 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02815}02815 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02816}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{02816}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a60eef14a2312d57aaf076e3735f4cbf4}{ng\_btsocket\_l2cap\_untimeout}}(\mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}} pcb)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02817}02817 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02818}02818         mtx\_assert(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02819}02819 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02820}02820         \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \& \mbox{\hyperlink{ng__btsocket__l2cap_8h_a427bf6e6db2d643af5dac6c8068a362a}{NG\_BTSOCKET\_L2CAP\_TIMO}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02821}02821                 callout\_stop(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4375ada3761ae664b7f8441707802e61}{timo}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02822}02822                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \&= \string~NG\_BTSOCKET\_L2CAP\_TIMO;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02823}02823         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02824}02824                 KASSERT(0,}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02825}02825 (\textcolor{stringliteral}{"{}\%s: No socket timeout?!\(\backslash\)n"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02826}02826 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_untimeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02827}02827 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02828}02828 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02829}02829 \textcolor{comment}{ * Process timeout on socket}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02830}02830 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02831}02831 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02832}02832 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02833}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a4e395c2948c1db7ef8243883ac4484bf}{02833}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a4e395c2948c1db7ef8243883ac4484bf}{ng\_btsocket\_l2cap\_process\_timeout}}(\textcolor{keywordtype}{void} *xpcb)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02834}02834 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02835}02835         \mbox{\hyperlink{structng__btsocket__l2cap__pcb}{ng\_btsocket\_l2cap\_pcb\_p}}  pcb = (\mbox{\hyperlink{ng__btsocket__l2cap_8h_a7c623847faa1372373bff85c5a1230fa}{ng\_btsocket\_l2cap\_pcb\_p}}) xpcb;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02836}02836 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02837}02837         mtx\_assert(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a2518b31000b199c552dab31b697e9439}{pcb\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02838}02838 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02839}02839         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_ab7edb3109d687e3963c727d502d587b2}{flags}} \&= \string~NG\_BTSOCKET\_L2CAP\_TIMO;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02840}02840         pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_error = ETIMEDOUT;}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02841}02841 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02842}02842         \textcolor{keywordflow}{switch} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}}) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02843}02843         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket__l2cap_8h_a1bef328ad25d99c18012e0f9db9246db}{NG\_BTSOCKET\_L2CAP\_CONNECTING}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02844}02844         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket__l2cap_8h_ae0e9aad23bcdb71d3bbcd783363edf29}{NG\_BTSOCKET\_L2CAP\_CONFIGURING}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02845}02845         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket__l2cap_8h_a9aa68f78b2908d9e193caf4e271fcde0}{NG\_BTSOCKET\_L2CAP\_W4\_ENC\_CHANGE}}:            }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02846}02846                 \textcolor{comment}{/* Send disconnect request with "{}zero"{} token */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02847}02847                 \textcolor{keywordflow}{if} (pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_aa9a96f21ae3df4d8eeadfa776b4975bb}{cid}} != 0)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02848}02848                         \mbox{\hyperlink{ng__btsocket__l2cap_8c_a1ef7503a8d3939edd709d673fd0024f4}{ng\_btsocket\_l2cap\_send\_l2ca\_discon\_req}}(0, pcb);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02849}02849 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02850}02850                 \textcolor{comment}{/* ... and close the socket */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02851}02851                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02852}02852                 soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02853}02853                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02854}02854 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02855}02855         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket__l2cap_8h_af45f7ea5c795266bd90522145949129e}{NG\_BTSOCKET\_L2CAP\_OPEN}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02856}02856                 \textcolor{comment}{/* Send timeout -\/ drop packet and wakeup sender */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02857}02857                 sbdroprecord(\&pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}}-\/>so\_snd);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02858}02858                 sowwakeup(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02859}02859                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02860}02860 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02861}02861         \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__btsocket__l2cap_8h_a0278cb3eb7f0c2b11b04c6f2d319f4c7}{NG\_BTSOCKET\_L2CAP\_DISCONNECTING}}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02862}02862                 \textcolor{comment}{/* Disconnect timeout -\/ disconnect the socket anyway */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02863}02863                 pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}} = \mbox{\hyperlink{ng__btsocket__l2cap_8h_aab62dc5c2057d94cf16106fa3c69ba98}{NG\_BTSOCKET\_L2CAP\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02864}02864                 soisdisconnected(pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a4cc3318e19be2cc3e0150b0d9bf5d709}{so}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02865}02865                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02866}02866 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02867}02867         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02868}02868                 \mbox{\hyperlink{ng__btsocket__l2cap_8c_a2f4288e99bfbcf4cfbd9076b231dc9b6}{NG\_BTSOCKET\_L2CAP\_ERR}}(}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02869}02869 \textcolor{stringliteral}{"{}\%s: Invalid socket state=\%d\(\backslash\)n"{}}, \_\_func\_\_, pcb-\/>\mbox{\hyperlink{structng__btsocket__l2cap__pcb_a60b665f68416e90c3534877cca371d5d}{state}});}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02870}02870                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02871}02871         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02872}02872 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_process\_timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02873}02873 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02874}02874 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02875}02875 \textcolor{comment}{ * Translate HCI/L2CAP error code into "{}errno"{} code}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02876}02876 \textcolor{comment}{ * XXX Note: Some L2CAP and HCI error codes have the same value, but }}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02877}02877 \textcolor{comment}{ *     different meaning}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02878}02878 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02879}02879 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02880}02880 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02881}\mbox{\hyperlink{ng__btsocket__l2cap_8c_a950fa90ca97e8ca76082845ac01fe4e5}{02881}} \mbox{\hyperlink{ng__btsocket__l2cap_8c_a950fa90ca97e8ca76082845ac01fe4e5}{ng\_btsocket\_l2cap\_result2errno}}(\textcolor{keywordtype}{int} result)}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02882}02882 \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02883}02883         \textcolor{keywordflow}{switch} (result) \{}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02884}02884         \textcolor{keywordflow}{case} 0x00: \textcolor{comment}{/* No error */} }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02885}02885                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02886}02886 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02887}02887         \textcolor{keywordflow}{case} 0x01: \textcolor{comment}{/* Unknown HCI command */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02888}02888                 \textcolor{keywordflow}{return} (ENODEV);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02889}02889 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02890}02890         \textcolor{keywordflow}{case} 0x02: \textcolor{comment}{/* No connection */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02891}02891                 \textcolor{keywordflow}{return} (ENOTCONN);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02892}02892 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02893}02893         \textcolor{keywordflow}{case} 0x03: \textcolor{comment}{/* Hardware failure */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02894}02894                 \textcolor{keywordflow}{return} (EIO);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02895}02895 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02896}02896         \textcolor{keywordflow}{case} 0x04: \textcolor{comment}{/* Page timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02897}02897                 \textcolor{keywordflow}{return} (EHOSTDOWN);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02898}02898 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02899}02899         \textcolor{keywordflow}{case} 0x05: \textcolor{comment}{/* Authentication failure */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02900}02900         \textcolor{keywordflow}{case} 0x06: \textcolor{comment}{/* Key missing */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02901}02901         \textcolor{keywordflow}{case} 0x18: \textcolor{comment}{/* Pairing not allowed */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02902}02902         \textcolor{keywordflow}{case} 0x21: \textcolor{comment}{/* Role change not allowed */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02903}02903         \textcolor{keywordflow}{case} 0x24: \textcolor{comment}{/* LMP PSU not allowed */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02904}02904         \textcolor{keywordflow}{case} 0x25: \textcolor{comment}{/* Encryption mode not acceptable */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02905}02905         \textcolor{keywordflow}{case} 0x26: \textcolor{comment}{/* Unit key used */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02906}02906                 \textcolor{keywordflow}{return} (EACCES);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02907}02907 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02908}02908         \textcolor{keywordflow}{case} 0x07: \textcolor{comment}{/* Memory full */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02909}02909                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02910}02910 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02911}02911         \textcolor{keywordflow}{case} 0x08:   \textcolor{comment}{/* Connection timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02912}02912         \textcolor{keywordflow}{case} 0x10:   \textcolor{comment}{/* Host timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02913}02913         \textcolor{keywordflow}{case} 0x22:   \textcolor{comment}{/* LMP response timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02914}02914         \textcolor{keywordflow}{case} 0xee:   \textcolor{comment}{/* HCI timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02915}02915         \textcolor{keywordflow}{case} 0xeeee: \textcolor{comment}{/* L2CAP timeout */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02916}02916                 \textcolor{keywordflow}{return} (ETIMEDOUT);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02917}02917 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02918}02918         \textcolor{keywordflow}{case} 0x09: \textcolor{comment}{/* Max number of connections */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02919}02919         \textcolor{keywordflow}{case} 0x0a: \textcolor{comment}{/* Max number of SCO connections to a unit */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02920}02920                 \textcolor{keywordflow}{return} (EMLINK);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02921}02921 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02922}02922         \textcolor{keywordflow}{case} 0x0b: \textcolor{comment}{/* ACL connection already exists */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02923}02923                 \textcolor{keywordflow}{return} (EEXIST);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02924}02924 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02925}02925         \textcolor{keywordflow}{case} 0x0c: \textcolor{comment}{/* Command disallowed */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02926}02926                 \textcolor{keywordflow}{return} (EBUSY);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02927}02927 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02928}02928         \textcolor{keywordflow}{case} 0x0d: \textcolor{comment}{/* Host rejected due to limited resources */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02929}02929         \textcolor{keywordflow}{case} 0x0e: \textcolor{comment}{/* Host rejected due to securiity reasons */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02930}02930         \textcolor{keywordflow}{case} 0x0f: \textcolor{comment}{/* Host rejected due to remote unit is a personal unit */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02931}02931         \textcolor{keywordflow}{case} 0x1b: \textcolor{comment}{/* SCO offset rejected */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02932}02932         \textcolor{keywordflow}{case} 0x1c: \textcolor{comment}{/* SCO interval rejected */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02933}02933         \textcolor{keywordflow}{case} 0x1d: \textcolor{comment}{/* SCO air mode rejected */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02934}02934                 \textcolor{keywordflow}{return} (ECONNREFUSED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02935}02935 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02936}02936         \textcolor{keywordflow}{case} 0x11: \textcolor{comment}{/* Unsupported feature or parameter value */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02937}02937         \textcolor{keywordflow}{case} 0x19: \textcolor{comment}{/* Unknown LMP PDU */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02938}02938         \textcolor{keywordflow}{case} 0x1a: \textcolor{comment}{/* Unsupported remote feature */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02939}02939         \textcolor{keywordflow}{case} 0x20: \textcolor{comment}{/* Unsupported LMP parameter value */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02940}02940         \textcolor{keywordflow}{case} 0x27: \textcolor{comment}{/* QoS is not supported */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02941}02941         \textcolor{keywordflow}{case} 0x29: \textcolor{comment}{/* Paring with unit key not supported */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02942}02942                 \textcolor{keywordflow}{return} (EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02943}02943 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02944}02944         \textcolor{keywordflow}{case} 0x12: \textcolor{comment}{/* Invalid HCI command parameter */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02945}02945         \textcolor{keywordflow}{case} 0x1e: \textcolor{comment}{/* Invalid LMP parameters */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02946}02946                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02947}02947 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02948}02948         \textcolor{keywordflow}{case} 0x13: \textcolor{comment}{/* Other end terminated connection: User ended connection */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02949}02949         \textcolor{keywordflow}{case} 0x14: \textcolor{comment}{/* Other end terminated connection: Low resources */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02950}02950         \textcolor{keywordflow}{case} 0x15: \textcolor{comment}{/* Other end terminated connection: About to power off */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02951}02951                 \textcolor{keywordflow}{return} (ECONNRESET);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02952}02952 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02953}02953         \textcolor{keywordflow}{case} 0x16: \textcolor{comment}{/* Connection terminated by local host */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02954}02954                 \textcolor{keywordflow}{return} (ECONNABORTED);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02955}02955 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02956}02956 \textcolor{preprocessor}{\#if 0 }\textcolor{comment}{/* XXX not yet */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02957}02957         \textcolor{keywordflow}{case} 0x17: \textcolor{comment}{/* Repeated attempts */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02958}02958         \textcolor{keywordflow}{case} 0x1f: \textcolor{comment}{/* Unspecified error */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02959}02959         \textcolor{keywordflow}{case} 0x23: \textcolor{comment}{/* LMP error transaction collision */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02960}02960         \textcolor{keywordflow}{case} 0x28: \textcolor{comment}{/* Instant passed */}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02961}02961 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02962}02962         \}}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02963}02963 }
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02964}02964         \textcolor{keywordflow}{return} (ENOSYS);}
\DoxyCodeLine{\Hypertarget{ng__btsocket__l2cap_8c_source_l02965}02965 \} \textcolor{comment}{/* ng\_btsocket\_l2cap\_result2errno */}}

\end{DoxyCode}
