\hypertarget{ng__hci__misc_8c_source}{}\doxysection{ng\+\_\+hci\+\_\+misc.\+c}
\label{ng__hci__misc_8c_source}\index{netgraph/bluetooth/hci/ng\_hci\_misc.c@{netgraph/bluetooth/hci/ng\_hci\_misc.c}}
\mbox{\hyperlink{ng__hci__misc_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00001}00001 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00002}00002 \textcolor{comment}{ * ng\_hci\_misc.c}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00003}00003 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00004}00004 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00005}00005 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00006}00006 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00007}00007 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00008}00008 \textcolor{comment}{ * Copyright (c) Maksim Yevmenkin <m\_evmenkin@yahoo.com>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00009}00009 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00011}00011 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00012}00012 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00013}00013 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00014}00014 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00015}00015 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00016}00016 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00017}00017 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00018}00018 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00019}00019 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00020}00020 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00021}00021 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00022}00022 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00023}00023 \textcolor{comment}{ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00024}00024 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00025}00025 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00026}00026 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00027}00027 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00028}00028 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00029}00029 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00030}00030 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00031}00031 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00032}00032 \textcolor{comment}{ * \$Id: ng\_hci\_misc.c,v 1.5 2003/09/08 18:57:51 max Exp \$}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00033}00033 \textcolor{comment}{ * \$FreeBSD\$}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00034}00034 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00035}00035 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__message_8h}{netgraph/ng\_message.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{netgraph_8h}{netgraph/netgraph.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__bluetooth_8h}{netgraph/bluetooth/include/ng\_bluetooth.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci_8h}{netgraph/bluetooth/include/ng\_hci.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__var_8h}{netgraph/bluetooth/hci/ng\_hci\_var.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__cmds_8h}{netgraph/bluetooth/hci/ng\_hci\_cmds.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__evnt_8h}{netgraph/bluetooth/hci/ng\_hci\_evnt.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__ulpi_8h}{netgraph/bluetooth/hci/ng\_hci\_ulpi.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__hci__misc_8h}{netgraph/bluetooth/hci/ng\_hci\_misc.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00051}00051 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00052}00052 \textcolor{comment}{/******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00053}00053 \textcolor{comment}{ ******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00054}00054 \textcolor{comment}{ **                              Utility routines}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00055}00055 \textcolor{comment}{ ******************************************************************************}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00056}00056 \textcolor{comment}{ ******************************************************************************/}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00057}00057 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00058}00058 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00059}00059 \textcolor{comment}{ * Give packet to RAW hook}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00060}00060 \textcolor{comment}{ * Assumes input mbuf is read only.}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00061}00061 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00062}00062 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00063}00063 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00064}\mbox{\hyperlink{ng__hci__misc_8c_ad3c03037f3f36deb03b8bd60ed4f0c46}{00064}} \mbox{\hyperlink{ng__hci__misc_8c_ad3c03037f3f36deb03b8bd60ed4f0c46}{ng\_hci\_mtap}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \textcolor{keyword}{struct} mbuf *m0)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00065}00065 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00066}00066         \textcolor{keyword}{struct }mbuf     *m = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00067}00067         \textcolor{keywordtype}{int}              error = 0;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00068}00068 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00069}00069         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_a164e63fc1ae0521386992437f0e040fb}{raw}} != NULL \&\& \mbox{\hyperlink{netgraph_8h_ac8409b5ecd2c70db4911cc5d9fe66901}{NG\_HOOK\_IS\_VALID}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a164e63fc1ae0521386992437f0e040fb}{raw}})) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00070}00070                 m = m\_dup(m0, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00071}00071                 \textcolor{keywordflow}{if} (m != NULL)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00072}00072                         \mbox{\hyperlink{netgraph_8h_a8c5e877ed70dff86bb57062afe4cee38}{NG\_SEND\_DATA\_ONLY}}(error, unit-\/>\mbox{\hyperlink{structng__hci__unit_a164e63fc1ae0521386992437f0e040fb}{raw}}, m);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00073}00073 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00074}00074                 \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00075}00075                         \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00076}00076 \textcolor{stringliteral}{"{}\%s: \%s -\/ Could not forward packet, error=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00077}00077                                 \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), error);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00078}00078         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00079}00079 \} \textcolor{comment}{/* ng\_hci\_mtap */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00080}00080 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00081}00081 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00082}00082 \textcolor{comment}{ * Send notification to the upper layer's}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00083}00083 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00084}00084 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00085}00085 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00086}\mbox{\hyperlink{ng__hci__misc_8c_a8a503b08370044178955aa387455fdd1}{00086}} \mbox{\hyperlink{ng__hci__misc_8c_a8a503b08370044178955aa387455fdd1}{ng\_hci\_node\_is\_up}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keywordtype}{void} *arg1, \textcolor{keywordtype}{int} arg2)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00087}00087 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00088}00088         \mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}}               unit = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00089}00089         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}}           *msg = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00090}00090         \mbox{\hyperlink{structng__hci__node__up__ep}{ng\_hci\_node\_up\_ep}}      *ep = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00091}00091         \textcolor{keywordtype}{int}                      error;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00092}00092 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00093}00093         \textcolor{keywordflow}{if} (node == NULL || \mbox{\hyperlink{netgraph_8h_a3c4a1fe59f790fb8c07b77dee4ad2b28}{NG\_NODE\_NOT\_VALID}}(node) ||}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00094}00094             hook == NULL || \mbox{\hyperlink{netgraph_8h_a360d005d270d1ff7e5133d800678321f}{NG\_HOOK\_NOT\_VALID}}(hook))}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00095}00095                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00096}00096 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00097}00097         unit = (\mbox{\hyperlink{ng__hci__var_8h_ae9ddc466aacad997aa8685ab61d77a56}{ng\_hci\_unit\_p}}) \mbox{\hyperlink{netgraph_8h_ae76b377c72ed8b60e8cbe1a204f70598}{NG\_NODE\_PRIVATE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00098}00098         \textcolor{keywordflow}{if} ((unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}}) != \mbox{\hyperlink{ng__hci_8h_a9d234f4b5c2b5367f39038a94a5c913f}{NG\_HCI\_UNIT\_READY}})}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00099}00099                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00100}00100 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00101}00101         \textcolor{keywordflow}{if} (hook != unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}} \&\& hook != unit-\/>\mbox{\hyperlink{structng__hci__unit_ad221eefe183cbd0ff5ed2ed600e8cc46}{sco}})}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00102}00102                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00103}00103 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00104}00104         \mbox{\hyperlink{ng__message_8h_ae4949040eaeb6dbcf2007eb8881b9d9a}{NG\_MKMESSAGE}}(msg,\mbox{\hyperlink{ng__hci_8h_a88d50dc5f2ad81304c0c5d498f3e18d5}{NGM\_HCI\_COOKIE}},\mbox{\hyperlink{ng__hci_8h_aef99c6a2c18dd3d20cd73caa41d18550}{NGM\_HCI\_NODE\_UP}},\textcolor{keyword}{sizeof}(*ep),M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00105}00105         \textcolor{keywordflow}{if} (msg != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00106}00106                 ep = (\mbox{\hyperlink{structng__hci__node__up__ep}{ng\_hci\_node\_up\_ep}} *)(msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00107}00107 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00108}00108                 \textcolor{keywordflow}{if} (hook == unit-\/>\mbox{\hyperlink{structng__hci__unit_a77aaa67e35c0a4d7c3ebcd9d208b1f99}{acl}}) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00109}00109                         \mbox{\hyperlink{ng__hci__var_8h_abf1e5453148b00ad44dc708f87652f23}{NG\_HCI\_BUFF\_ACL\_SIZE}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, ep-\/>\mbox{\hyperlink{structng__hci__node__up__ep_a5952f088a3e1b154a5842d9292e8037c}{pkt\_size}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00110}00110                         \mbox{\hyperlink{ng__hci__var_8h_a0b901baa5e7044eaee78463791b0f15c}{NG\_HCI\_BUFF\_ACL\_TOTAL}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, ep-\/>\mbox{\hyperlink{structng__hci__node__up__ep_a49410d00b260a12714a558588510b1cc}{num\_pkts}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00111}00111                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00112}00112                         \mbox{\hyperlink{ng__hci__var_8h_af8192d2a1bd2464ee2cad8bce14ecd8a}{NG\_HCI\_BUFF\_SCO\_SIZE}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, ep-\/>\mbox{\hyperlink{structng__hci__node__up__ep_a5952f088a3e1b154a5842d9292e8037c}{pkt\_size}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00113}00113                         \mbox{\hyperlink{ng__hci__var_8h_a8ab1ea34915c7262c7dc583ca84a2abb}{NG\_HCI\_BUFF\_SCO\_TOTAL}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, ep-\/>\mbox{\hyperlink{structng__hci__node__up__ep_a49410d00b260a12714a558588510b1cc}{num\_pkts}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00114}00114                 \} }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00115}00115 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00116}00116                 bcopy(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_adf536cb9e87b01fe0d1087bc35e8c3e8}{bdaddr}}, \&ep-\/>\mbox{\hyperlink{structng__hci__node__up__ep_ad76a203501a13660613bae92e91152d6}{bdaddr}}, \textcolor{keyword}{sizeof}(ep-\/>\mbox{\hyperlink{structng__hci__node__up__ep_ad76a203501a13660613bae92e91152d6}{bdaddr}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00117}00117 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00118}00118                 \mbox{\hyperlink{netgraph_8h_ae8298dadbe3b9101589fd6f978306c4d}{NG\_SEND\_MSG\_HOOK}}(error, node, msg, hook, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00119}00119         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00120}00120                 error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00121}00121 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00122}00122         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00123}00123                 \mbox{\hyperlink{ng__hci__var_8h_a4ce50ea1a4240b3fa3999028dc40deb5}{NG\_HCI\_INFO}}(}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00124}00124 \textcolor{stringliteral}{"{}\%s: \%s -\/ failed to send NODE\_UP message to hook \(\backslash\)"{}\%s\(\backslash\)"{}, error=\%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00125}00125                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}), }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00126}00126                         \mbox{\hyperlink{netgraph_8h_ab077a5607cd5a2e82cc67326badd440a}{NG\_HOOK\_NAME}}(hook), error);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00127}00127 \} \textcolor{comment}{/* ng\_hci\_node\_is\_up */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00128}00128 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00129}00129 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00130}00130 \textcolor{comment}{ * Clean unit (helper)}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00131}00131 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00132}00132 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00133}00133 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00134}\mbox{\hyperlink{ng__hci__misc_8c_a6bdf6ed14a329c6f47751916232cf0bd}{00134}} \mbox{\hyperlink{ng__hci__misc_8c_a6bdf6ed14a329c6f47751916232cf0bd}{ng\_hci\_unit\_clean}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \textcolor{keywordtype}{int} reason)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00135}00135 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00136}00136         \textcolor{keywordtype}{int}     size;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00137}00137 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00138}00138         \textcolor{comment}{/* Drain command queue */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00139}00139         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}})}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00140}00140                 \mbox{\hyperlink{ng__hci__misc_8c_afcb51af64a022d9b152d55579beb35ed}{ng\_hci\_command\_untimeout}}(unit);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00142}00142         \mbox{\hyperlink{ng__bluetooth_8h_a08c470db29c52e343e355cceb74f92c0}{NG\_BT\_MBUFQ\_DRAIN}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a0d4ba7641d93dd9b0b4aa9c4b67718e6}{cmdq}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00143}00143         \mbox{\hyperlink{ng__hci__var_8h_aa66df0bec39c7c3254f4df0893a5027a}{NG\_HCI\_BUFF\_CMD\_SET}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, 1);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00144}00144 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00145}00145         \textcolor{comment}{/* Clean up connection list */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00146}00146         \textcolor{keywordflow}{while} (!LIST\_EMPTY(\&unit-\/>con\_list)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00147}00147                 \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}      con = LIST\_FIRST(\&unit-\/>con\_list);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00148}00148 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00149}00149                 \textcolor{comment}{/* Remove all timeouts (if any) */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00150}00150                 \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \& \mbox{\hyperlink{ng__hci__var_8h_ad12efc8076041274c18cd976c0004ef5}{NG\_HCI\_CON\_TIMEOUT\_PENDING}})}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00151}00151                         \mbox{\hyperlink{ng__hci__misc_8c_aec1ab0e4733596907113e77d1313c9a7}{ng\_hci\_con\_untimeout}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00152}00152 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00153}00153                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00154}00154 \textcolor{comment}{                 * Notify upper layer protocol and destroy connection }}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00155}00155 \textcolor{comment}{                 * descriptor. Do not really care about the result.}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00156}00156 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00157}00157 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00158}00158                 \mbox{\hyperlink{ng__hci__ulpi_8c_a5c014f20dea1cb50e4b6024465377b06}{ng\_hci\_lp\_discon\_ind}}(con, reason);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00159}00159                 \mbox{\hyperlink{ng__hci__misc_8c_aef20383c1edac9d052a97cdd534ec9c7}{ng\_hci\_free\_con}}(con);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00160}00160         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00161}00161 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00162}00162         \mbox{\hyperlink{ng__hci__var_8h_a0b901baa5e7044eaee78463791b0f15c}{NG\_HCI\_BUFF\_ACL\_TOTAL}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, size);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00163}00163         \mbox{\hyperlink{ng__hci__var_8h_ae9efc317475cfdd78b25bc159155a7d7}{NG\_HCI\_BUFF\_ACL\_FREE}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, size);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00164}00164 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00165}00165         \mbox{\hyperlink{ng__hci__var_8h_a8ab1ea34915c7262c7dc583ca84a2abb}{NG\_HCI\_BUFF\_SCO\_TOTAL}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, size);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00166}00166         \mbox{\hyperlink{ng__hci__var_8h_ad3c25df52552584c7d58c06f13c23a66}{NG\_HCI\_BUFF\_SCO\_FREE}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, size);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00167}00167 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00168}00168         \textcolor{comment}{/* Clean up neighbors list */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00169}00169         \mbox{\hyperlink{ng__hci__misc_8c_ac9576b180403d3331386c91fce811547}{ng\_hci\_flush\_neighbor\_cache}}(unit);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00170}00170 \} \textcolor{comment}{/* ng\_hci\_unit\_clean */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00171}00171 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00172}00172 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00173}00173 \textcolor{comment}{ * Allocate and link new unit neighbor cache entry}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00174}00174 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00175}00175 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00176}00176 \mbox{\hyperlink{structng__hci__neighbor}{ng\_hci\_neighbor\_p}}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00177}\mbox{\hyperlink{ng__hci__misc_8c_a27064102479d8203c42f5ddfa980c029}{00177}} \mbox{\hyperlink{ng__hci__misc_8c_a27064102479d8203c42f5ddfa980c029}{ng\_hci\_new\_neighbor}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00178}00178 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00179}00179         \mbox{\hyperlink{structng__hci__neighbor}{ng\_hci\_neighbor\_p}}      n = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00180}00180 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00181}00181         n = malloc(\textcolor{keyword}{sizeof}(*n), \mbox{\hyperlink{ng__hci__main_8c_af6b938415e7a223856de6c93f4008b57}{M\_NETGRAPH\_HCI}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00182}00182                 M\_NOWAIT | M\_ZERO); }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00183}00183         \textcolor{keywordflow}{if} (n != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00184}00184                 getmicrotime(\&n-\/>\mbox{\hyperlink{structng__hci__neighbor_ada2f574a39016f8415ea44335795347d}{updated}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00185}00185                 LIST\_INSERT\_HEAD(\&unit-\/>neighbors, n, next);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00186}00186         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00187}00187 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00188}00188         \textcolor{keywordflow}{return} (n);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00189}00189 \} \textcolor{comment}{/* ng\_hci\_new\_neighbor */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00190}00190 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00191}00191 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00192}00192 \textcolor{comment}{ * Free unit neighbor cache entry}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00193}00193 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00194}00194 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00195}00195 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00196}\mbox{\hyperlink{ng__hci__misc_8c_a3cfa198df9a5b26ab13092951a29b71c}{00196}} \mbox{\hyperlink{ng__hci__misc_8c_a3cfa198df9a5b26ab13092951a29b71c}{ng\_hci\_free\_neighbor}}(\mbox{\hyperlink{structng__hci__neighbor}{ng\_hci\_neighbor\_p}} n)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00197}00197 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00198}00198         LIST\_REMOVE(n, next);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00199}00199         bzero(n, \textcolor{keyword}{sizeof}(*n));}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00200}00200         free(n, \mbox{\hyperlink{ng__hci__main_8c_af6b938415e7a223856de6c93f4008b57}{M\_NETGRAPH\_HCI}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00201}00201 \} \textcolor{comment}{/* ng\_hci\_free\_neighbor */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00202}00202 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00203}00203 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00204}00204 \textcolor{comment}{ * Flush neighbor cache }}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00205}00205 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00206}00206 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00207}00207 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00208}\mbox{\hyperlink{ng__hci__misc_8c_ac9576b180403d3331386c91fce811547}{00208}} \mbox{\hyperlink{ng__hci__misc_8c_ac9576b180403d3331386c91fce811547}{ng\_hci\_flush\_neighbor\_cache}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00209}00209 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00210}00210         \textcolor{keywordflow}{while} (!LIST\_EMPTY(\&unit-\/>neighbors))}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00211}00211                 \mbox{\hyperlink{ng__hci__misc_8c_a3cfa198df9a5b26ab13092951a29b71c}{ng\_hci\_free\_neighbor}}(LIST\_FIRST(\&unit-\/>neighbors));}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00212}00212 \} \textcolor{comment}{/* ng\_hci\_flush\_neighbor\_cache */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00213}00213 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00214}00214 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00215}00215 \textcolor{comment}{ * Lookup unit in neighbor cache}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00216}00216 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00217}00217 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00218}00218 \mbox{\hyperlink{structng__hci__neighbor}{ng\_hci\_neighbor\_p}}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00219}\mbox{\hyperlink{ng__hci__misc_8c_afd85df2950d8d6fd0e5237667595c655}{00219}} \mbox{\hyperlink{ng__hci__misc_8c_afd85df2950d8d6fd0e5237667595c655}{ng\_hci\_get\_neighbor}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}} bdaddr,\textcolor{keywordtype}{int} link\_type)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00220}00220 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00221}00221         \mbox{\hyperlink{structng__hci__neighbor}{ng\_hci\_neighbor\_p}}      n = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00222}00222 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00223}00223         \textcolor{keywordflow}{for} (n = LIST\_FIRST(\&unit-\/>neighbors); n != NULL; ) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00224}00224                 \mbox{\hyperlink{structng__hci__neighbor}{ng\_hci\_neighbor\_p}}      nn = LIST\_NEXT(n, next);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00225}00225 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00226}00226                 \textcolor{keywordflow}{if} (!\mbox{\hyperlink{ng__hci__misc_8c_a9d3d7488f2f296eff865df260966dbf0}{ng\_hci\_neighbor\_stale}}(n)) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00227}00227                         \textcolor{keywordflow}{if} (n-\/>\mbox{\hyperlink{structng__hci__neighbor_a17508a20bea1459561a655c952746f53}{addrtype}} == link\_type \&\& }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00228}00228                             bcmp(\&n-\/>\mbox{\hyperlink{structng__hci__neighbor_a9c92229bd13342eb3bcdef1c0c558308}{bdaddr}}, bdaddr, \textcolor{keyword}{sizeof}(*bdaddr)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00229}00229                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00230}00230                 \} \textcolor{keywordflow}{else} }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00231}00231                         \mbox{\hyperlink{ng__hci__misc_8c_a3cfa198df9a5b26ab13092951a29b71c}{ng\_hci\_free\_neighbor}}(n); \textcolor{comment}{/* remove old entry */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00232}00232 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00233}00233                 n = nn;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00234}00234         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00235}00235 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00236}00236         \textcolor{keywordflow}{return} (n);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00237}00237 \} \textcolor{comment}{/* ng\_hci\_get\_neighbor */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00238}00238 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00239}00239 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00240}00240 \textcolor{comment}{ * Check if neighbor entry is stale}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00241}00241 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00242}00242 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00243}00243 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00244}\mbox{\hyperlink{ng__hci__misc_8c_a9d3d7488f2f296eff865df260966dbf0}{00244}} \mbox{\hyperlink{ng__hci__misc_8c_a9d3d7488f2f296eff865df260966dbf0}{ng\_hci\_neighbor\_stale}}(\mbox{\hyperlink{structng__hci__neighbor}{ng\_hci\_neighbor\_p}} n)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00245}00245 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00246}00246         \textcolor{keyword}{struct }timeval  now;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00247}00247 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00248}00248         getmicrotime(\&now);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00249}00249 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00250}00250         \textcolor{keywordflow}{return} (now.tv\_sec -\/ n-\/>\mbox{\hyperlink{structng__hci__neighbor_ada2f574a39016f8415ea44335795347d}{updated}}.tv\_sec > \mbox{\hyperlink{ng__bluetooth_8c_af6b15612774003dd542a9cfee107373b}{bluetooth\_hci\_max\_neighbor\_age}}());}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00251}00251 \} \textcolor{comment}{/* ng\_hci\_neighbor\_stale */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00252}00252 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00253}00253 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00254}00254 \textcolor{comment}{ * Allocate and link new connection descriptor}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00255}00255 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00256}00256 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00257}00257 \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00258}\mbox{\hyperlink{ng__hci__misc_8c_ad17315e3c4e8e2524030e436a48d740b}{00258}} \mbox{\hyperlink{ng__hci__misc_8c_ad17315e3c4e8e2524030e436a48d740b}{ng\_hci\_new\_con}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \textcolor{keywordtype}{int} link\_type)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00259}00259 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00260}00260         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}      con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00261}00261         \textcolor{keywordtype}{int}                     num\_pkts;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00262}00262         \textcolor{keyword}{static} \textcolor{keywordtype}{int}              fake\_con\_handle = 0x0f00;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00263}00263 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00264}00264         con = malloc(\textcolor{keyword}{sizeof}(*con), \mbox{\hyperlink{ng__hci__main_8c_af6b938415e7a223856de6c93f4008b57}{M\_NETGRAPH\_HCI}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00265}00265                 M\_NOWAIT | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00266}00266         \textcolor{keywordflow}{if} (con != NULL) \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00267}00267                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}} = unit;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00268}00268                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a7620ea8c44d5b7f7b48728f224c8fad3}{state}} = \mbox{\hyperlink{ng__hci_8h_a2fb898cd4cd02a85da00d741ab594902}{NG\_HCI\_CON\_CLOSED}};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00269}00269 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00270}00270                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00271}00271 \textcolor{comment}{                 * XXX}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00272}00272 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00273}00273 \textcolor{comment}{                 * Assign fake connection handle to the connection descriptor.}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00274}00274 \textcolor{comment}{                 * Bluetooth specification marks 0x0f00 -\/ 0x0fff connection}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00275}00275 \textcolor{comment}{                 * handles as reserved. We need this fake connection handles}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00276}00276 \textcolor{comment}{                 * for timeouts. Connection handle will be passed as argument}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00277}00277 \textcolor{comment}{                 * to timeout so when timeout happens we can find the right}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00278}00278 \textcolor{comment}{                 * connection descriptor. We can not pass pointers, because}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00279}00279 \textcolor{comment}{                 * timeouts are external (to Netgraph) events and there might}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00280}00280 \textcolor{comment}{                 * be a race when node/hook goes down and timeout event already}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00281}00281 \textcolor{comment}{                 * went into node's queue}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00282}00282 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00283}00283 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00284}00284                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}} = fake\_con\_handle ++;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00285}00285                 \textcolor{keywordflow}{if} (fake\_con\_handle > 0x0fff)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00286}00286                         fake\_con\_handle = 0x0f00;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00287}00287 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00288}00288                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} = link\_type;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00289}00289 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00290}00290                 \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} != \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}})}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00291}00291                         \mbox{\hyperlink{ng__hci__var_8h_a0b901baa5e7044eaee78463791b0f15c}{NG\_HCI\_BUFF\_ACL\_TOTAL}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, num\_pkts);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00292}00292                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00293}00293                         \mbox{\hyperlink{ng__hci__var_8h_a8ab1ea34915c7262c7dc583ca84a2abb}{NG\_HCI\_BUFF\_SCO\_TOTAL}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, num\_pkts);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00294}00294 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00295}00295                 \mbox{\hyperlink{ng__bluetooth_8h_aac74453fd1344531d8b0d6544142da25}{NG\_BT\_ITEMQ\_INIT}}(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_af20ed149a4ddf303eb6d253c3f362c24}{conq}}, num\_pkts);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00296}00296 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00297}00297                 \mbox{\hyperlink{netgraph_8h_a86218dc6ee6651399a66c7cbcba144e4}{ng\_callout\_init}}(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_aa2a78b1b11836571600e3a79ac83d30b}{con\_timo}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00298}00298 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00299}00299                 LIST\_INSERT\_HEAD(\&unit-\/>con\_list, con, next);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00300}00300         \}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00301}00301 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00302}00302         \textcolor{keywordflow}{return} (con);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00303}00303 \} \textcolor{comment}{/* ng\_hci\_new\_con */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00304}00304 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00305}00305 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00306}00306 \textcolor{comment}{ * Free connection descriptor}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00307}00307 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00308}00308 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00309}00309 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00310}\mbox{\hyperlink{ng__hci__misc_8c_aef20383c1edac9d052a97cdd534ec9c7}{00310}} \mbox{\hyperlink{ng__hci__misc_8c_aef20383c1edac9d052a97cdd534ec9c7}{ng\_hci\_free\_con}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00311}00311 \{ }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00312}00312         LIST\_REMOVE(con, next);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00313}00313 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00314}00314         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00315}00315 \textcolor{comment}{         * If we have pending packets then assume that Host Controller has }}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00316}00316 \textcolor{comment}{         * flushed these packets and we can free them too}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00317}00317 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00318}00318 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00319}00319         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} != \mbox{\hyperlink{ng__hci_8h_af8bd621d46e75d10e745698aa7b543b2}{NG\_HCI\_LINK\_SCO}})}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00320}00320                 \mbox{\hyperlink{ng__hci__var_8h_ae9efc317475cfdd78b25bc159155a7d7}{NG\_HCI\_BUFF\_ACL\_FREE}}(con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}}-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, con-\/>\mbox{\hyperlink{structng__hci__unit__con_aa23024b50578ed77f37979afcad6539f}{pending}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00321}00321         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00322}00322                 \mbox{\hyperlink{ng__hci__var_8h_ad3c25df52552584c7d58c06f13c23a66}{NG\_HCI\_BUFF\_SCO\_FREE}}(con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}}-\/>\mbox{\hyperlink{structng__hci__unit_ae360e0f96519ea18d18b3ed06a5198f8}{buffer}}, con-\/>\mbox{\hyperlink{structng__hci__unit__con_aa23024b50578ed77f37979afcad6539f}{pending}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00323}00323 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00324}00324         \mbox{\hyperlink{ng__bluetooth_8h_a5f7184f25c75896c8c7b6717e9ec9b29}{NG\_BT\_ITEMQ\_DESTROY}}(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_af20ed149a4ddf303eb6d253c3f362c24}{conq}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00325}00325 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00326}00326         bzero(con, \textcolor{keyword}{sizeof}(*con));}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00327}00327         free(con, \mbox{\hyperlink{ng__hci__main_8c_af6b938415e7a223856de6c93f4008b57}{M\_NETGRAPH\_HCI}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00328}00328 \} \textcolor{comment}{/* ng\_hci\_free\_con */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00329}00329 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00330}00330 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00331}00331 \textcolor{comment}{ * Lookup connection for given unit and connection handle.}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00332}00332 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00333}00333 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00334}00334 \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00335}\mbox{\hyperlink{ng__hci__misc_8c_a3b509cac93de160d32cdfb5a59ccff54}{00335}} \mbox{\hyperlink{ng__hci__misc_8c_a3b509cac93de160d32cdfb5a59ccff54}{ng\_hci\_con\_by\_handle}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \textcolor{keywordtype}{int} con\_handle)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00336}00336 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00337}00337         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}      con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00338}00338 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00339}00339         LIST\_FOREACH(con, \&unit-\/>con\_list, next)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00340}00340                 \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}} == con\_handle)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00341}00341                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00342}00342 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00343}00343         \textcolor{keywordflow}{return} (con);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00344}00344 \} \textcolor{comment}{/* ng\_hci\_con\_by\_handle */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00345}00345 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00346}00346 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00347}00347 \textcolor{comment}{ * Lookup connection for given unit, link type and remove unit address}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00348}00348 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00349}00349 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00350}00350 \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00351}\mbox{\hyperlink{ng__hci__misc_8c_ad9bc4055b9ba79cb181bd3b6ddf1e500}{00351}} \mbox{\hyperlink{ng__hci__misc_8c_ad9bc4055b9ba79cb181bd3b6ddf1e500}{ng\_hci\_con\_by\_bdaddr}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit, \mbox{\hyperlink{ng__hci_8h_aa562cff353d22278f085dec9815ce222}{bdaddr\_p}} bdaddr, \textcolor{keywordtype}{int} link\_type)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00352}00352 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00353}00353         \mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}}      con = NULL;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00354}00354 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00355}00355         LIST\_FOREACH(con, \&unit-\/>con\_list, next)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00356}00356                 \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a3a396246ceda9716f91a480f401bdc7b}{link\_type}} == link\_type \&\&}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00357}00357                     bcmp(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_a42808804831d9632a2db0e8f1f6367f5}{bdaddr}}, bdaddr, \textcolor{keyword}{sizeof}(bdaddr\_t)) == 0)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00358}00358                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00359}00359 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00360}00360         \textcolor{keywordflow}{return} (con);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00361}00361 \} \textcolor{comment}{/* ng\_hci\_con\_by\_bdaddr */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00362}00362 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00363}00363 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00364}00364 \textcolor{comment}{ * Set HCI command timeout}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00365}00365 \textcolor{comment}{ * XXX FIXME: check return code from ng\_callout}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00366}00366 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00367}00367 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00368}00368 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00369}\mbox{\hyperlink{ng__hci__misc_8c_a2fa5e84fd67d769ab76e8bb2c18b8336}{00369}} \mbox{\hyperlink{ng__hci__misc_8c_a2fa5e84fd67d769ab76e8bb2c18b8336}{ng\_hci\_command\_timeout}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00370}00370 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00371}00371         \textcolor{keywordflow}{if} (unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}})}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00372}00372                 panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00373}00373 \textcolor{stringliteral}{"{}\%s: \%s -\/ Duplicated command timeout!\(\backslash\)n"{}}, \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00374}00374 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00375}00375         unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} |= \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00376}00376         \mbox{\hyperlink{netgraph_8h_aed70061429167aaa4b93a6129c959f0f}{ng\_callout}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a793e0750e4909cb3ffd84d9ba4c5aba7}{cmd\_timo}}, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00377}00377                                 \mbox{\hyperlink{ng__bluetooth_8c_afbc08d7a7a46dba29e40a3755f8b079f}{bluetooth\_hci\_command\_timeout}}(),}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00378}00378                                 \mbox{\hyperlink{ng__hci__cmds_8c_aad856ecc72d65d4c9944b2d72dcd5cc4}{ng\_hci\_process\_command\_timeout}}, NULL, 0);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00379}00379 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00380}00380         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00381}00381 \} \textcolor{comment}{/* ng\_hci\_command\_timeout */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00382}00382 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00383}00383 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00384}00384 \textcolor{comment}{ * Unset HCI command timeout}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00385}00385 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00386}00386 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00387}00387 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00388}\mbox{\hyperlink{ng__hci__misc_8c_afcb51af64a022d9b152d55579beb35ed}{00388}} \mbox{\hyperlink{ng__hci__misc_8c_afcb51af64a022d9b152d55579beb35ed}{ng\_hci\_command\_untimeout}}(\mbox{\hyperlink{structng__hci__unit}{ng\_hci\_unit\_p}} unit)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00389}00389 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00390}00390         \textcolor{keywordflow}{if} (!(unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \& \mbox{\hyperlink{ng__hci_8h_ac72a62e2f4654b99a9f1ad9797c2e557}{NG\_HCI\_UNIT\_COMMAND\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00391}00391                 panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00392}00392 \textcolor{stringliteral}{"{}\%s: \%s -\/ No command timeout!\(\backslash\)n"{}}, \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00393}00393 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00394}00394         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_aabe13cf527f80501a761c71c9b4888db}{ng\_uncallout}}(\&unit-\/>\mbox{\hyperlink{structng__hci__unit_a793e0750e4909cb3ffd84d9ba4c5aba7}{cmd\_timo}}, unit-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}) < 1)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00395}00395                 \textcolor{keywordflow}{return} (ETIMEDOUT);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00396}00396 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00397}00397         unit-\/>\mbox{\hyperlink{structng__hci__unit_a0e60c241953c2263d2ee904b1914e7e7}{state}} \&= \string~NG\_HCI\_UNIT\_COMMAND\_PENDING;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00398}00398 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00399}00399         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00400}00400 \} \textcolor{comment}{/* ng\_hci\_command\_untimeout */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00401}00401 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00402}00402 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00403}00403 \textcolor{comment}{ * Set HCI connection timeout}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00404}00404 \textcolor{comment}{ * XXX FIXME: check return code from ng\_callout}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00405}00405 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00406}00406 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00407}00407 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00408}\mbox{\hyperlink{ng__hci__misc_8c_a2b1f5439028dcbc3404fea5c0234bff5}{00408}} \mbox{\hyperlink{ng__hci__misc_8c_a2b1f5439028dcbc3404fea5c0234bff5}{ng\_hci\_con\_timeout}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00409}00409 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00410}00410         \textcolor{keywordflow}{if} (con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \& \mbox{\hyperlink{ng__hci__var_8h_ad12efc8076041274c18cd976c0004ef5}{NG\_HCI\_CON\_TIMEOUT\_PENDING}})}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00411}00411                 panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00412}00412 \textcolor{stringliteral}{"{}\%s: \%s -\/ Duplicated connection timeout!\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00413}00413                         \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}}-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00414}00414 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00415}00415         con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} |= \mbox{\hyperlink{ng__hci__var_8h_ad12efc8076041274c18cd976c0004ef5}{NG\_HCI\_CON\_TIMEOUT\_PENDING}};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00416}00416         \mbox{\hyperlink{netgraph_8h_aed70061429167aaa4b93a6129c959f0f}{ng\_callout}}(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_aa2a78b1b11836571600e3a79ac83d30b}{con\_timo}}, con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}}-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00417}00417                                 \mbox{\hyperlink{ng__bluetooth_8c_a2d8e4ead16f9446f313222c1049e5d65}{bluetooth\_hci\_connect\_timeout}}(),}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00418}00418                                 \mbox{\hyperlink{ng__hci__ulpi_8c_a82e1cb9b5e42bb451132a4fc1ed680d5}{ng\_hci\_process\_con\_timeout}}, NULL,}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00419}00419                                 con-\/>\mbox{\hyperlink{structng__hci__unit__con_a02c77256cfd83dca50038f1281f78c2d}{con\_handle}});}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00420}00420 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00421}00421         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00422}00422 \} \textcolor{comment}{/* ng\_hci\_con\_timeout */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00423}00423 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00424}00424 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00425}00425 \textcolor{comment}{ * Unset HCI connection timeout}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00426}00426 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00427}00427 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00428}00428 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00429}\mbox{\hyperlink{ng__hci__misc_8c_aec1ab0e4733596907113e77d1313c9a7}{00429}} \mbox{\hyperlink{ng__hci__misc_8c_aec1ab0e4733596907113e77d1313c9a7}{ng\_hci\_con\_untimeout}}(\mbox{\hyperlink{structng__hci__unit__con}{ng\_hci\_unit\_con\_p}} con)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00430}00430 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00431}00431         \textcolor{keywordflow}{if} (!(con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \& \mbox{\hyperlink{ng__hci__var_8h_ad12efc8076041274c18cd976c0004ef5}{NG\_HCI\_CON\_TIMEOUT\_PENDING}}))}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00432}00432                 panic(}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00433}00433 \textcolor{stringliteral}{"{}\%s: \%s -\/ No connection timeout!\(\backslash\)n"{}}, \_\_func\_\_, \mbox{\hyperlink{netgraph_8h_a810ab9f272b092d488c5a52c6d5349e6}{NG\_NODE\_NAME}}(con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}}-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}));}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00434}00434 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00435}00435         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_aabe13cf527f80501a761c71c9b4888db}{ng\_uncallout}}(\&con-\/>\mbox{\hyperlink{structng__hci__unit__con_aa2a78b1b11836571600e3a79ac83d30b}{con\_timo}}, con-\/>\mbox{\hyperlink{structng__hci__unit__con_a908bd0db5dea3b2d6785399f71d811d2}{unit}}-\/>\mbox{\hyperlink{structng__hci__unit_a532226e8a5d24b9b0f2528e580326ef2}{node}}) < 1)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00436}00436                 \textcolor{keywordflow}{return} (ETIMEDOUT);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00437}00437 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00438}00438         con-\/>\mbox{\hyperlink{structng__hci__unit__con_a1a30e40ae9ab7aebe3d872859c5c5ca6}{flags}} \&= \string~NG\_HCI\_CON\_TIMEOUT\_PENDING;}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00439}00439 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00440}00440         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00441}00441 \} \textcolor{comment}{/* ng\_hci\_con\_untimeout */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00442}00442 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00443}00443 \textcolor{preprocessor}{\#if 0}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00444}00444 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00445}00445 \textcolor{comment}{ * Convert numeric error code/reason to a string}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00446}00446 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00447}00447 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00448}00448 \textcolor{keywordtype}{char} \textcolor{keyword}{const} * \textcolor{keyword}{const}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00449}00449 ng\_hci\_str\_error(u\_int16\_t code)}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00450}00450 \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00451}00451 \textcolor{preprocessor}{\#define LAST\_ERROR\_CODE                 ((sizeof(s)/sizeof(s[0]))-\/1)}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00452}00452         \textcolor{keyword}{static} \textcolor{keywordtype}{char} \textcolor{keyword}{const} * \textcolor{keyword}{const}       s[] = \{}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00453}00453         \textcolor{comment}{/* 0x00 */} \textcolor{stringliteral}{"{}No error"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00454}00454         \textcolor{comment}{/* 0x01 */} \textcolor{stringliteral}{"{}Unknown HCI command"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00455}00455         \textcolor{comment}{/* 0x02 */} \textcolor{stringliteral}{"{}No connection"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00456}00456         \textcolor{comment}{/* 0x03 */} \textcolor{stringliteral}{"{}Hardware failure"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00457}00457         \textcolor{comment}{/* 0x04 */} \textcolor{stringliteral}{"{}Page timeout"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00458}00458         \textcolor{comment}{/* 0x05 */} \textcolor{stringliteral}{"{}Authentication failure"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00459}00459         \textcolor{comment}{/* 0x06 */} \textcolor{stringliteral}{"{}Key missing"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00460}00460         \textcolor{comment}{/* 0x07 */} \textcolor{stringliteral}{"{}Memory full"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00461}00461         \textcolor{comment}{/* 0x08 */} \textcolor{stringliteral}{"{}Connection timeout"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00462}00462         \textcolor{comment}{/* 0x09 */} \textcolor{stringliteral}{"{}Max number of connections"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00463}00463         \textcolor{comment}{/* 0x0a */} \textcolor{stringliteral}{"{}Max number of SCO connections to a unit"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00464}00464         \textcolor{comment}{/* 0x0b */} \textcolor{stringliteral}{"{}ACL connection already exists"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00465}00465         \textcolor{comment}{/* 0x0c */} \textcolor{stringliteral}{"{}Command disallowed"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00466}00466         \textcolor{comment}{/* 0x0d */} \textcolor{stringliteral}{"{}Host rejected due to limited resources"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00467}00467         \textcolor{comment}{/* 0x0e */} \textcolor{stringliteral}{"{}Host rejected due to securiity reasons"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00468}00468         \textcolor{comment}{/* 0x0f */} \textcolor{stringliteral}{"{}Host rejected due to remote unit is a personal unit"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00469}00469         \textcolor{comment}{/* 0x10 */} \textcolor{stringliteral}{"{}Host timeout"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00470}00470         \textcolor{comment}{/* 0x11 */} \textcolor{stringliteral}{"{}Unsupported feature or parameter value"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00471}00471         \textcolor{comment}{/* 0x12 */} \textcolor{stringliteral}{"{}Invalid HCI command parameter"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00472}00472         \textcolor{comment}{/* 0x13 */} \textcolor{stringliteral}{"{}Other end terminated connection: User ended connection"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00473}00473         \textcolor{comment}{/* 0x14 */} \textcolor{stringliteral}{"{}Other end terminated connection: Low resources"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00474}00474         \textcolor{comment}{/* 0x15 */} \textcolor{stringliteral}{"{}Other end terminated connection: About to power off"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00475}00475         \textcolor{comment}{/* 0x16 */} \textcolor{stringliteral}{"{}Connection terminated by local host"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00476}00476         \textcolor{comment}{/* 0x17 */} \textcolor{stringliteral}{"{}Repeated attempts"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00477}00477         \textcolor{comment}{/* 0x18 */} \textcolor{stringliteral}{"{}Pairing not allowed"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00478}00478         \textcolor{comment}{/* 0x19 */} \textcolor{stringliteral}{"{}Unknown LMP PDU"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00479}00479         \textcolor{comment}{/* 0x1a */} \textcolor{stringliteral}{"{}Unsupported remote feature"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00480}00480         \textcolor{comment}{/* 0x1b */} \textcolor{stringliteral}{"{}SCO offset rejected"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00481}00481         \textcolor{comment}{/* 0x1c */} \textcolor{stringliteral}{"{}SCO interval rejected"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00482}00482         \textcolor{comment}{/* 0x1d */} \textcolor{stringliteral}{"{}SCO air mode rejected"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00483}00483         \textcolor{comment}{/* 0x1e */} \textcolor{stringliteral}{"{}Invalid LMP parameters"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00484}00484         \textcolor{comment}{/* 0x1f */} \textcolor{stringliteral}{"{}Unspecified error"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00485}00485         \textcolor{comment}{/* 0x20 */} \textcolor{stringliteral}{"{}Unsupported LMP parameter value"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00486}00486         \textcolor{comment}{/* 0x21 */} \textcolor{stringliteral}{"{}Role change not allowed"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00487}00487         \textcolor{comment}{/* 0x22 */} \textcolor{stringliteral}{"{}LMP response timeout"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00488}00488         \textcolor{comment}{/* 0x23 */} \textcolor{stringliteral}{"{}LMP error transaction collision"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00489}00489         \textcolor{comment}{/* 0x24 */} \textcolor{stringliteral}{"{}LMP PSU not allowed"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00490}00490         \textcolor{comment}{/* 0x25 */} \textcolor{stringliteral}{"{}Encryption mode not acceptable"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00491}00491         \textcolor{comment}{/* 0x26 */} \textcolor{stringliteral}{"{}Unit key used"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00492}00492         \textcolor{comment}{/* 0x27 */} \textcolor{stringliteral}{"{}QoS is not supported"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00493}00493         \textcolor{comment}{/* 0x28 */} \textcolor{stringliteral}{"{}Instant passed"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00494}00494         \textcolor{comment}{/* 0x29 */} \textcolor{stringliteral}{"{}Pairing with unit key not supported"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00495}00495         \textcolor{comment}{/* 0x2a */} \textcolor{stringliteral}{"{}Different Transaction Collision"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00496}00496         \textcolor{comment}{/* 0x2b */} \textcolor{stringliteral}{"{}Unknown error (Reserved for future use)"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00497}00497         \textcolor{comment}{/* 0x2c */} \textcolor{stringliteral}{"{}QoS Unacceptable Parameter"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00498}00498         \textcolor{comment}{/* 0x2d */} \textcolor{stringliteral}{"{}QoS Rejected"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00499}00499         \textcolor{comment}{/* 0x2e */} \textcolor{stringliteral}{"{}Channel Classification Not Supported"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00500}00500         \textcolor{comment}{/* 0x2f */} \textcolor{stringliteral}{"{}Insufficient Security"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00501}00501         \textcolor{comment}{/* 0x30 */} \textcolor{stringliteral}{"{}Parameter Out Of Mandatory Range"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00502}00502         \textcolor{comment}{/* 0x31 */} \textcolor{stringliteral}{"{}Unknown error (Reserved for future use)"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00503}00503         \textcolor{comment}{/* 0x32 */} \textcolor{stringliteral}{"{}Role Switch Pending"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00504}00504         \textcolor{comment}{/* 0x33 */} \textcolor{stringliteral}{"{}Unknown error (Reserved for future use)"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00505}00505         \textcolor{comment}{/* 0x34 */} \textcolor{stringliteral}{"{}Reserved Slot Violation"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00506}00506         \textcolor{comment}{/* 0x35 */} \textcolor{stringliteral}{"{}Role Switch Failed"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00507}00507         \textcolor{comment}{/* 0x36 */} \textcolor{stringliteral}{"{}Extended Inquiry Response Too Large"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00508}00508         \textcolor{comment}{/* 0x37 */} \textcolor{stringliteral}{"{}Secure Simple Pairing Not Supported By Host"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00509}00509         \textcolor{comment}{/* 0x38 */} \textcolor{stringliteral}{"{}Host Busy -\/ Pairing"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00510}00510         \textcolor{comment}{/* 0x39 */} \textcolor{stringliteral}{"{}Connection Rejected due to No Suitable Channel Found"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00511}00511         \textcolor{comment}{/* 0x3a */} \textcolor{stringliteral}{"{}Controller Busy"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00512}00512         \textcolor{comment}{/* 0x3b */} \textcolor{stringliteral}{"{}Unacceptable Connection Parameters"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00513}00513         \textcolor{comment}{/* 0x3c */} \textcolor{stringliteral}{"{}Advertising Timeout"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00514}00514         \textcolor{comment}{/* 0x3d */} \textcolor{stringliteral}{"{}Connection Terminated due to MIC Failure"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00515}00515         \textcolor{comment}{/* 0x3e */} \textcolor{stringliteral}{"{}Connection Failed to be Established / Synchronization Timeout"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00516}00516         \textcolor{comment}{/* 0x3f */} \textcolor{stringliteral}{"{}MAC Connection Failed"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00517}00517         \textcolor{comment}{/* 0x40 */} \textcolor{stringliteral}{"{}Coarse Clock Adjustment Rejected but Will Try to Adjust Using Clock Dragging"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00518}00518         \textcolor{comment}{/* 0x41 */} \textcolor{stringliteral}{"{}Type0 Submap Not Defined"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00519}00519         \textcolor{comment}{/* 0x42 */} \textcolor{stringliteral}{"{}Unknown Advertising Identifier"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00520}00520         \textcolor{comment}{/* 0x43 */} \textcolor{stringliteral}{"{}Limit Reached"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00521}00521         \textcolor{comment}{/* 0x44 */} \textcolor{stringliteral}{"{}Operation Cancelled by Host"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00522}00522         \textcolor{comment}{/* 0x45 */} \textcolor{stringliteral}{"{}Packet Too Long"{}},}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00523}00523         \textcolor{comment}{/* SHOULD ALWAYS BE LAST */} \textcolor{stringliteral}{"{}Unknown error"{}}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00524}00524         \};}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00525}00525 }
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00526}00526         \textcolor{keywordflow}{return} ((code >= LAST\_ERROR\_CODE)? s[LAST\_ERROR\_CODE] : s[code]);}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00527}00527 \} \textcolor{comment}{/* ng\_hci\_str\_error */}}
\DoxyCodeLine{\Hypertarget{ng__hci__misc_8c_source_l00528}00528 \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
