summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Crane <steve.crane@rococosoft.com>2003-02-11 10:22:23 +0000
committerStephen Crane <steve.crane@rococosoft.com>2003-02-11 10:22:23 +0000
commit109bfa547ab9e24672472371e2183dcec24d0058 (patch)
tree55dcd30597464569faff8ffc70874260b1f80676 /src
parentbff9ecffc1771df893e0cccc59fe708cf9ba43bb (diff)
add const to fn sigs; fns to auth and enc links
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth.c18
-rw-r--r--src/hci.c39
2 files changed, 42 insertions, 15 deletions
diff --git a/src/bluetooth.c b/src/bluetooth.c
index 4548b121..bc0eb238 100644
--- a/src/bluetooth.c
+++ b/src/bluetooth.c
@@ -35,16 +35,16 @@
#include <bluetooth.h>
#include <hci.h>
-void baswap(bdaddr_t *dst, bdaddr_t *src)
+void baswap(bdaddr_t *dst, const bdaddr_t *src)
{
- register unsigned char * d = (unsigned char *)dst;
- register unsigned char * s = (unsigned char *)src;
+ register unsigned char *d = (unsigned char *)dst;
+ register const unsigned char *s = (const unsigned char *)src;
register int i;
for(i=0; i<6; i++)
d[i] = s[5-i];
}
-char *batostr(bdaddr_t *ba)
+char *batostr(const bdaddr_t *ba)
{
char *str = malloc(18);
if (!str)
@@ -56,9 +56,9 @@ char *batostr(bdaddr_t *ba)
return str;
}
-bdaddr_t *strtoba(char *str)
+bdaddr_t *strtoba(const char *str)
{
- char *ptr = str;
+ const char *ptr = str;
int i;
uint8_t *ba = malloc(sizeof(bdaddr_t));
@@ -74,7 +74,7 @@ bdaddr_t *strtoba(char *str)
return (bdaddr_t *) ba;
}
-int ba2str(bdaddr_t *ba, char *str)
+int ba2str(const bdaddr_t *ba, char *str)
{
uint8_t b[6];
@@ -83,10 +83,10 @@ int ba2str(bdaddr_t *ba, char *str)
b[0], b[1], b[2], b[3], b[4], b[5]);
}
-int str2ba(char *str, bdaddr_t *ba)
+int str2ba(const char *str, bdaddr_t *ba)
{
uint8_t b[6];
- char *ptr = str;
+ const char *ptr = str;
int i;
for (i=0; i < 6; i++) {
diff --git a/src/hci.c b/src/hci.c
index ddc15672..abcfb447 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -419,7 +419,7 @@ int hci_get_route(bdaddr_t *bdaddr)
return hci_for_each_dev(HCI_UP, NULL, 0);
}
-int hci_devid(char *str)
+int hci_devid(const char *str)
{
bdaddr_t ba;
int id = -1;
@@ -467,7 +467,7 @@ int hci_devba(int dev_id, bdaddr_t *ba)
return 0;
}
-int hci_inquiry(int dev_id, int len, int nrsp, uint8_t *lap, inquiry_info **ii, long flags)
+int hci_inquiry(int dev_id, int len, int nrsp, const uint8_t *lap, inquiry_info **ii, long flags)
{
struct hci_inquiry_req *ir;
void *buf;
@@ -697,7 +697,7 @@ done:
return 0;
}
-int hci_create_connection(int dd, bdaddr_t *ba, uint16_t ptype, uint16_t clkoffset, uint8_t rswitch, uint16_t *handle, int to)
+int hci_create_connection(int dd, const bdaddr_t *ba, uint16_t ptype, uint16_t clkoffset, uint8_t rswitch, uint16_t *handle, int to)
{
evt_conn_complete rp;
create_conn_cp cp;
@@ -788,7 +788,7 @@ int hci_read_local_name(int dd, int len, char *name, int to)
return 0;
}
-int hci_write_local_name(int dd, char *name, int to)
+int hci_write_local_name(int dd, const char *name, int to)
{
change_local_name_cp cp;
struct hci_request rq;
@@ -805,12 +805,12 @@ int hci_write_local_name(int dd, char *name, int to)
return 0;
}
-int hci_remote_name(int dd, bdaddr_t *ba, int len, char *name, int to)
+int hci_remote_name(int dd, const bdaddr_t *ba, int len, char *name, int to)
{
return hci_read_remote_name(dd, ba, len, name, to);
}
-int hci_read_remote_name(int dd, bdaddr_t *ba, int len, char *name, int to)
+int hci_read_remote_name(int dd, const bdaddr_t *ba, int len, char *name, int to)
{
evt_remote_name_req_complete rn;
remote_name_req_cp cp;
@@ -1047,3 +1047,30 @@ int hci_write_current_iac_lap(int dd, uint8_t num_iac, uint8_t *lap, int to)
rq.clen = WRITE_CURRENT_IAC_LAP_CP_SIZE;
return hci_send_req(dd, &rq, to);
}
+
+int hci_authenticate_link(int dd, uint16_t handle, int to)
+{
+ auth_requested_cp cp;
+ struct hci_request rq;
+
+ cp.handle = handle;
+ rq.ogf = OGF_LINK_CTL;
+ rq.ocf = OCF_AUTH_REQUESTED;
+ rq.cparam = &cp;
+ rq.clen = AUTH_REQUESTED_CP_SIZE;
+ return hci_send_req(dd, &rq, to);
+}
+
+int hci_encrypt_link(int dd, uint16_t handle, int on, int to)
+{
+ set_conn_encrypt_cp cp;
+ struct hci_request rq;
+
+ cp.handle = handle;
+ cp.encrypt = on;
+ rq.ogf = OGF_LINK_CTL;
+ rq.ocf = OCF_SET_CONN_ENCRYPT;
+ rq.cparam = &cp;
+ rq.clen = SET_CONN_ENCRYPT_CP_SIZE;
+ return hci_send_req(dd, &rq, to);
+}