Home | History | Annotate | Download | only in src
      1 /*
      2  *
      3  *  BlueZ - Bluetooth protocol stack for Linux
      4  *
      5  *  Copyright (C) 2006-2010  Nokia Corporation
      6  *  Copyright (C) 2004-2010  Marcel Holtmann <marcel (at) holtmann.org>
      7  *
      8  *
      9  *  This program is free software; you can redistribute it and/or modify
     10  *  it under the terms of the GNU General Public License as published by
     11  *  the Free Software Foundation; either version 2 of the License, or
     12  *  (at your option) any later version.
     13  *
     14  *  This program is distributed in the hope that it will be useful,
     15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17  *  GNU General Public License for more details.
     18  *
     19  *  You should have received a copy of the GNU General Public License
     20  *  along with this program; if not, write to the Free Software
     21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     22  *
     23  */
     24 
     25 struct agent;
     26 
     27 typedef void (*agent_cb) (struct agent *agent, DBusError *err,
     28 				void *user_data);
     29 
     30 typedef void (*agent_pincode_cb) (struct agent *agent, DBusError *err,
     31 					const char *pincode, void *user_data);
     32 
     33 typedef void (*agent_passkey_cb) (struct agent *agent, DBusError *err,
     34 					uint32_t passkey, void *user_data);
     35 
     36 typedef void (*agent_oob_data_cb) (struct agent *agent, DBusError *err,
     37 					uint8_t *hash, uint8_t *randomizer,
     38 					void *user_data);
     39 
     40 typedef void (*agent_remove_cb) (struct agent *agent, void *user_data);
     41 
     42 struct agent *agent_create(struct btd_adapter *adapter, const char *name,
     43 				const char *path, uint8_t capability,
     44 				gboolean oob, agent_remove_cb cb,
     45 				void *remove_cb_data);
     46 
     47 void agent_free(struct agent *agent);
     48 
     49 int agent_authorize(struct agent *agent, const char *path,
     50 			const char *uuid, agent_cb cb, void *user_data,
     51 			GDestroyNotify destroy);
     52 
     53 int agent_request_pincode(struct agent *agent, struct btd_device *device,
     54 				agent_pincode_cb cb, void *user_data,
     55 				GDestroyNotify destroy);
     56 
     57 int agent_confirm_mode_change(struct agent *agent, const char *new_mode,
     58 				agent_cb cb, void *user_data,
     59 				GDestroyNotify destroy);
     60 
     61 int agent_request_passkey(struct agent *agent, struct btd_device *device,
     62 				agent_passkey_cb cb, void *user_data,
     63 				GDestroyNotify destroy);
     64 
     65 int agent_request_oob_data(struct agent *agent, struct btd_device *device,
     66 				agent_oob_data_cb cb, void *user_data,
     67 				GDestroyNotify destroy);
     68 
     69 int agent_request_oob_availability(struct agent *agent,
     70                                         const char *path, agent_cb cb,
     71                                         void *user_data, GDestroyNotify destroy);
     72 
     73 int agent_request_confirmation(struct agent *agent, struct btd_device *device,
     74 				uint32_t passkey, agent_cb cb,
     75 				void *user_data, GDestroyNotify destroy);
     76 
     77 int agent_display_passkey(struct agent *agent, struct btd_device *device,
     78 				uint32_t passkey);
     79 
     80 int agent_cancel(struct agent *agent);
     81 
     82 gboolean agent_is_busy(struct agent *agent, void *user_data);
     83 
     84 uint8_t agent_get_io_capability(struct agent *agent);
     85 gboolean agent_get_oob_capability(struct agent *agent);
     86 
     87 gboolean agent_matches(struct agent *agent, const char *name, const char *path);
     88 
     89 void agent_init(void);
     90 void agent_exit(void);
     91 
     92