summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-01-26 02:08:01 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-01-26 02:08:01 +0000
commit1798ef015acd1da838f3a265bb0003efe94757ad (patch)
tree626c310f1bc8397109ff77e8f417551d775e5aef /hcid
parent30fa99ad8cc79b6e4cb4620a31510d5a6cd31acd (diff)
Update for different storage methods
Diffstat (limited to 'hcid')
-rw-r--r--hcid/Makefile.am2
-rw-r--r--hcid/dbus.c2
-rw-r--r--hcid/hcid.h8
-rw-r--r--hcid/kword.c2
-rw-r--r--hcid/kword.h2
-rw-r--r--hcid/lexer.l2
-rw-r--r--hcid/lib.c2
-rw-r--r--hcid/lib.h2
-rw-r--r--hcid/main.c7
-rw-r--r--hcid/parser.y2
-rw-r--r--hcid/security.c22
-rw-r--r--hcid/storage.c48
12 files changed, 82 insertions, 19 deletions
diff --git a/hcid/Makefile.am b/hcid/Makefile.am
index ac56726e..32b02005 100644
--- a/hcid/Makefile.am
+++ b/hcid/Makefile.am
@@ -18,7 +18,7 @@ dbus_hcid_libs =
dbus_hcid_cflags =
endif
-hcid_SOURCES = main.c security.c hcid.h lib.c lib.h parser.h parser.y lexer.l kword.h kword.c glib-ectomy.h glib-ectomy.c $(dbus_hcid_sources)
+hcid_SOURCES = main.c security.c storage.c hcid.h lib.c lib.h parser.h parser.y lexer.l kword.h kword.c glib-ectomy.h glib-ectomy.c $(dbus_hcid_sources)
LIBS = $(dbus_hcid_libs) @BLUEZ_LIBS@
diff --git a/hcid/dbus.c b/hcid/dbus.c
index 04e7c757..4d12bf11 100644
--- a/hcid/dbus.c
+++ b/hcid/dbus.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
diff --git a/hcid/hcid.h b/hcid/hcid.h
index 87875beb..845e3889 100644
--- a/hcid/hcid.h
+++ b/hcid/hcid.h
@@ -4,7 +4,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
@@ -31,6 +31,7 @@
#include <sys/types.h>
#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
#include "glib-ectomy.h"
@@ -99,9 +100,6 @@ int read_config(char *file);
struct device_opts *alloc_device_opts(char *ref);
-gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer data);
-gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data);
-
void init_security_data(void);
void start_security_manager(int hdev);
void stop_security_manager(int hdev);
@@ -111,3 +109,5 @@ void toggle_pairing(int enable);
void hcid_dbus_request_pin(int dev, struct hci_conn_info *ci);
gboolean hcid_dbus_init(void);
#endif
+
+int write_device_name(const bdaddr_t *local, const bdaddr_t *peer, const char *name);
diff --git a/hcid/kword.c b/hcid/kword.c
index 13adfcc2..895b2410 100644
--- a/hcid/kword.c
+++ b/hcid/kword.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
diff --git a/hcid/kword.h b/hcid/kword.h
index 2f6cae4a..735e119d 100644
--- a/hcid/kword.h
+++ b/hcid/kword.h
@@ -4,7 +4,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
diff --git a/hcid/lexer.l b/hcid/lexer.l
index 1031ea51..ce34af12 100644
--- a/hcid/lexer.l
+++ b/hcid/lexer.l
@@ -5,7 +5,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
diff --git a/hcid/lib.c b/hcid/lib.c
index bbc78950..9b09ca2a 100644
--- a/hcid/lib.c
+++ b/hcid/lib.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
diff --git a/hcid/lib.h b/hcid/lib.h
index 4ff07e66..49ddfb14 100644
--- a/hcid/lib.h
+++ b/hcid/lib.h
@@ -4,7 +4,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
diff --git a/hcid/main.c b/hcid/main.c
index abd7f14c..95f21656 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
@@ -64,9 +64,6 @@ static struct device_list *device_list = NULL;
static GMainLoop *event_loop;
-gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer data);
-gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data);
-
static void usage(void)
{
printf("hcid - HCI daemon ver %s\n", VERSION);
@@ -406,7 +403,7 @@ static inline void device_event(GIOChannel *chan, evt_stack_internal *si)
}
}
-gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer data)
+static gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer data)
{
unsigned char buf[HCI_MAX_FRAME_SIZE], *ptr;
evt_stack_internal *si;
diff --git a/hcid/parser.y b/hcid/parser.y
index c5bb80a4..b56bd588 100644
--- a/hcid/parser.y
+++ b/hcid/parser.y
@@ -5,7 +5,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
diff --git a/hcid/security.c b/hcid/security.c
index 1cb07da4..eaa791b7 100644
--- a/hcid/security.c
+++ b/hcid/security.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
- * Copyright (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
@@ -380,7 +380,18 @@ reject:
return;
}
-gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data)
+static void remote_name_information(int dev, bdaddr_t *sba, void *ptr)
+{
+ evt_remote_name_req_complete *evt = ptr;
+ bdaddr_t *dba = &evt->bdaddr;
+
+ if (!evt->status)
+ return;
+
+ write_device_name(sba, dba, evt->name);
+}
+
+static gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data)
{
unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr = buf;
struct hci_dev_info *di = (void *) data;
@@ -415,6 +426,12 @@ gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data)
ioctl(dev, HCIGETDEVINFO, (void *) di);
+ switch (eh->evt) {
+ case EVT_REMOTE_NAME_REQ_COMPLETE:
+ remote_name_information(dev, &di->bdaddr, ptr);
+ break;
+ }
+
if (hci_test_bit(HCI_SECMGR, &di->flags))
return TRUE;
@@ -459,6 +476,7 @@ void start_security_manager(int hdev)
hci_filter_set_event(EVT_PIN_CODE_REQ, &flt);
hci_filter_set_event(EVT_LINK_KEY_REQ, &flt);
hci_filter_set_event(EVT_LINK_KEY_NOTIFY, &flt);
+ hci_filter_set_event(EVT_REMOTE_NAME_REQ_COMPLETE, &flt);
if (setsockopt(dev, SOL_HCI, HCI_FILTER, &flt, sizeof(flt)) < 0) {
syslog(LOG_ERR, "Can't set filter on hci%d. %s(%d)",
hdev, strerror(errno), errno);
diff --git a/hcid/storage.c b/hcid/storage.c
new file mode 100644
index 00000000..cd04b254
--- /dev/null
+++ b/hcid/storage.c
@@ -0,0 +1,48 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2000-2001 Qualcomm Incorporated
+ * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
+ * Copyright (C) 2002-2005 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+ * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+ * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+ * SOFTWARE IS DISCLAIMED.
+ *
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <sys/socket.h>
+
+#include <bluetooth/bluetooth.h>
+
+#include "hcid.h"
+
+#define DEVPATH "/etc/bluetooth/devices"
+
+int write_device_name(const bdaddr_t *local, const bdaddr_t *peer, const char *name)
+{
+ return -EIO;
+}