You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/04/28 02:14:27 UTC
[28/50] [abbrv] incubator-mynewt-core git commit: ble host - make
priv header filenames consistent.
ble host - make priv header filenames consistent.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/832637db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/832637db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/832637db
Branch: refs/heads/master
Commit: 832637dbb20a9d5c0bee09aa1dfab157beecce96
Parents: 99dc724
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Apr 20 16:10:54 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Apr 20 16:11:49 2016 -0700
----------------------------------------------------------------------
apps/bletiny/src/main.c | 4 +-
net/nimble/host/src/ble_att_cmd.h | 390 -------------------------
net/nimble/host/src/ble_att_cmd_priv.h | 390 +++++++++++++++++++++++++
net/nimble/host/src/ble_hci_cmd.c | 2 +-
net/nimble/host/src/ble_hci_util.h | 27 --
net/nimble/host/src/ble_hci_util_priv.h | 27 ++
net/nimble/host/src/ble_hs_atomic.h | 30 --
net/nimble/host/src/ble_hs_atomic_priv.h | 30 ++
net/nimble/host/src/ble_hs_conn.h | 74 -----
net/nimble/host/src/ble_hs_conn_priv.h | 74 +++++
net/nimble/host/src/ble_hs_endian.h | 57 ----
net/nimble/host/src/ble_hs_endian_priv.h | 57 ++++
net/nimble/host/src/ble_hs_priv.h | 16 +-
net/nimble/host/src/ble_hs_startup.h | 25 --
net/nimble/host/src/ble_hs_startup_priv.h | 25 ++
net/nimble/host/src/ble_l2cap_priv.h | 76 +----
net/nimble/host/src/ble_l2cap_sig.h | 27 --
net/nimble/host/src/ble_l2cap_sig_priv.h | 77 +++++
net/nimble/host/src/ble_l2cap_sm.h | 161 ----------
net/nimble/host/src/ble_l2cap_sm_priv.h | 161 ++++++++++
net/nimble/host/src/host_dbg.h | 25 --
net/nimble/host/src/host_dbg_priv.h | 25 ++
net/nimble/host/src/host_hci.c | 2 +-
net/nimble/host/src/host_hci_cmd.c | 2 +-
24 files changed, 890 insertions(+), 894 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index 70193fc..bbbf171 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -46,8 +46,8 @@
/* XXX: An app should not include private headers from a library. The bletiny
* app uses some of nimble's internal details for logging.
*/
-#include "../src/ble_hs_conn.h"
-#include "../src/ble_hci_util.h"
+#include "../src/ble_hs_conn_priv.h"
+#include "../src/ble_hci_util_priv.h"
#define BSWAP16(x) ((uint16_t)(((x) << 8) | (((x) & 0xff00) >> 8)))
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_att_cmd.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_cmd.h b/net/nimble/host/src/ble_att_cmd.h
deleted file mode 100644
index 0dd8f0c..0000000
--- a/net/nimble/host/src/ble_att_cmd.h
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_ATT_CMD_
-#define H_BLE_ATT_CMD_
-
-#include <inttypes.h>
-struct ble_l2cap_chan;
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Request Opcode In Error | 1 |
- * | Attribute Handle In Error | 2 |
- * | Error Code | 1 |
- */
-#define BLE_ATT_ERROR_RSP_SZ 5
-struct ble_att_error_rsp {
- uint8_t baep_req_op;
- uint16_t baep_handle;
- uint8_t baep_error_code;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Server Rx MTU | 2 |
- */
-#define BLE_ATT_MTU_CMD_SZ 3
-struct ble_att_mtu_cmd {
- uint16_t bamc_mtu;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Starting Handle | 2 |
- * | Ending Handle | 2 |
- */
-#define BLE_ATT_FIND_INFO_REQ_SZ 5
-struct ble_att_find_info_req {
- uint16_t bafq_start_handle;
- uint16_t bafq_end_handle;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Format | 1 |
- * | Information Data | 4 to (ATT_MTU-2) |
- */
-#define BLE_ATT_FIND_INFO_RSP_BASE_SZ 2
-struct ble_att_find_info_rsp {
- uint8_t bafp_format;
- /* Followed by information data. */
-} __attribute__((packed));
-
-#define BLE_ATT_FIND_INFO_RSP_FORMAT_16BIT 1
-#define BLE_ATT_FIND_INFO_RSP_FORMAT_128BIT 2
-
-#define BLE_ATT_FIND_INFO_IDATA_16_SZ 4
-#define BLE_ATT_FIND_INFO_IDATA_128_SZ 18
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Starting Handle | 2 |
- * | Ending Handle | 2 |
- * | Attribute Type | 2 |
- * | Attribute Value | 0 to (ATT_MTU-7) |
- */
-#define BLE_ATT_FIND_TYPE_VALUE_REQ_BASE_SZ 7
-struct ble_att_find_type_value_req {
- uint16_t bavq_start_handle;
- uint16_t bavq_end_handle;
- uint16_t bavq_attr_type;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Information Data | 4 to (ATT_MTU-1) |
- */
-#define BLE_ATT_FIND_TYPE_VALUE_RSP_BASE_SZ 1
-#define BLE_ATT_FIND_TYPE_VALUE_HINFO_BASE_SZ 4
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Starting Handle | 2 |
- * | Ending Handle | 2 |
- * | Attribute Type | 2 or 16 |
- */
-#define BLE_ATT_READ_TYPE_REQ_BASE_SZ 5
-#define BLE_ATT_READ_TYPE_REQ_SZ_16 7
-#define BLE_ATT_READ_TYPE_REQ_SZ_128 21
-struct ble_att_read_type_req {
- uint16_t batq_start_handle;
- uint16_t batq_end_handle;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Length | 1 |
- * | Attribute Data List | 2 to (ATT_MTU-2) |
- */
-#define BLE_ATT_READ_TYPE_RSP_BASE_SZ 2
-struct ble_att_read_type_rsp {
- uint8_t batp_length;
-} __attribute__((packed));
-
-#define BLE_ATT_READ_TYPE_ADATA_BASE_SZ 2
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Attribute Handle | 2 |
- */
-#define BLE_ATT_READ_REQ_SZ 3
-struct ble_att_read_req {
- uint16_t barq_handle;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Attribute Value | 0 to (ATT_MTU-1) |
- */
-#define BLE_ATT_READ_RSP_BASE_SZ 1
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Attribute Handle | 2 |
- * | Value Offset | 2 |
- */
-#define BLE_ATT_READ_BLOB_REQ_SZ 5
-struct ble_att_read_blob_req {
- uint16_t babq_handle;
- uint16_t babq_offset;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Attribute Value | 0 to (ATT_MTU-1) |
- */
-#define BLE_ATT_READ_BLOB_RSP_BASE_SZ 1
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Set Of Handles | 4 to (ATT_MTU-1) |
- */
-#define BLE_ATT_READ_MULT_REQ_BASE_SZ 1
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Set Of Values | 4 to (ATT_MTU-1) |
- */
-#define BLE_ATT_READ_MULT_RSP_BASE_SZ 1
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Starting Handle | 2 |
- * | Ending Handle | 2 |
- * | Attribute Group Type | 2 or 16 |
- */
-#define BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ 5
-#define BLE_ATT_READ_GROUP_TYPE_REQ_SZ_16 7
-#define BLE_ATT_READ_GROUP_TYPE_REQ_SZ_128 21
-struct ble_att_read_group_type_req {
- uint16_t bagq_start_handle;
- uint16_t bagq_end_handle;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Length | 1 |
- * | Attribute Data List | 2 to (ATT_MTU-2) |
- */
-#define BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ 2
-struct ble_att_read_group_type_rsp {
- uint8_t bagp_length;
-} __attribute__((packed));
-
-#define BLE_ATT_READ_GROUP_TYPE_ADATA_BASE_SZ 4
-#define BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_16 6
-#define BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_128 20
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Attribute Handle | 2 |
- * | Attribute Value | 0 to (ATT_MTU-3) |
- */
-#define BLE_ATT_WRITE_REQ_BASE_SZ 3
-struct ble_att_write_req {
- uint16_t bawq_handle;
-} __attribute__((packed));
-
-#define BLE_ATT_WRITE_RSP_SZ 1
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Attribute Handle | 2 |
- * | Value Offset | 2 |
- * | Part Attribute Value | 0 to (ATT_MTU-5) |
- */
-#define BLE_ATT_PREP_WRITE_CMD_BASE_SZ 5
-struct ble_att_prep_write_cmd {
- uint16_t bapc_handle;
- uint16_t bapc_offset;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Flags | 1 |
- */
-#define BLE_ATT_EXEC_WRITE_REQ_SZ 2
-struct ble_att_exec_write_req {
- uint8_t baeq_flags;
-} __attribute__((packed));
-
-#define BLE_ATT_EXEC_WRITE_F_CONFIRM 0x01
-#define BLE_ATT_EXEC_WRITE_F_RESERVED 0xfe
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- */
-#define BLE_ATT_EXEC_WRITE_RSP_SZ 1
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Attribute Handle | 2 |
- * | Attribute Value | 0 to (ATT_MTU-3) |
- */
-#define BLE_ATT_NOTIFY_REQ_BASE_SZ 3
-struct ble_att_notify_req {
- uint16_t banq_handle;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- * | Attribute Handle | 2 |
- * | Attribute Value | 0 to (ATT_MTU-3) |
- */
-#define BLE_ATT_INDICATE_REQ_BASE_SZ 3
-struct ble_att_indicate_req {
- uint16_t baiq_handle;
-} __attribute__((packed));
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | Attribute Opcode | 1 |
- */
-#define BLE_ATT_INDICATE_RSP_SZ 1
-
-void ble_att_error_rsp_parse(void *payload, int len,
- struct ble_att_error_rsp *rsp);
-void ble_att_error_rsp_write(void *payload, int len,
- struct ble_att_error_rsp *rsp);
-void ble_att_mtu_cmd_parse(void *payload, int len,
- struct ble_att_mtu_cmd *cmd);
-void ble_att_mtu_req_write(void *payload, int len,
- struct ble_att_mtu_cmd *cmd);
-void ble_att_mtu_rsp_write(void *payload, int len,
- struct ble_att_mtu_cmd *cmd);
-void ble_att_find_info_req_parse(void *payload, int len,
- struct ble_att_find_info_req *req);
-void ble_att_find_info_req_write(void *payload, int len,
- struct ble_att_find_info_req *req);
-void ble_att_find_info_rsp_parse(void *payload, int len,
- struct ble_att_find_info_rsp *rsp);
-void ble_att_find_info_rsp_write(void *payload, int len,
- struct ble_att_find_info_rsp *rsp);
-void ble_att_find_type_value_req_parse(void *payload, int len,
- struct ble_att_find_type_value_req *req);
-void ble_att_find_type_value_req_write(void *payload, int len,
- struct ble_att_find_type_value_req *req);
-void ble_att_read_type_req_parse(void *payload, int len,
- struct ble_att_read_type_req *req);
-void ble_att_read_type_req_write(void *payload, int len,
- struct ble_att_read_type_req *req);
-void ble_att_read_type_rsp_parse(void *payload, int len,
- struct ble_att_read_type_rsp *rsp);
-void ble_att_read_type_rsp_write(void *payload, int len,
- struct ble_att_read_type_rsp *rsp);
-void ble_att_read_req_parse(void *payload, int len,
- struct ble_att_read_req *req);
-void ble_att_read_req_write(void *payload, int len,
- struct ble_att_read_req *req);
-void ble_att_read_blob_req_parse(void *payload, int len,
- struct ble_att_read_blob_req *req);
-void ble_att_read_blob_req_write(void *payload, int len,
- struct ble_att_read_blob_req *req);
-void ble_att_read_mult_req_parse(void *payload, int len);
-void ble_att_read_mult_req_write(void *payload, int len);
-void ble_att_read_mult_rsp_parse(void *payload, int len);
-void ble_att_read_mult_rsp_write(void *payload, int len);
-void ble_att_read_group_type_req_parse(void *payload, int len,
- struct ble_att_read_group_type_req *req);
-void ble_att_read_group_type_req_write(void *payload, int len,
- struct ble_att_read_group_type_req *req);
-void ble_att_read_group_type_rsp_parse(void *payload, int len,
- struct ble_att_read_group_type_rsp *rsp);
-void ble_att_read_group_type_rsp_write(void *payload, int len,
- struct ble_att_read_group_type_rsp *rsp);
-void ble_att_write_req_parse(void *payload, int len,
- struct ble_att_write_req *req);
-void ble_att_write_req_write(void *payload, int len,
- struct ble_att_write_req *req);
-void ble_att_write_cmd_parse(void *payload, int len,
- struct ble_att_write_req *req);
-void ble_att_write_cmd_write(void *payload, int len,
- struct ble_att_write_req *req);
-void ble_att_prep_write_req_parse(void *payload, int len,
- struct ble_att_prep_write_cmd *cmd);
-void ble_att_prep_write_req_write(void *payload, int len,
- struct ble_att_prep_write_cmd *cmd);
-void ble_att_prep_write_rsp_parse(void *payload, int len,
- struct ble_att_prep_write_cmd *cmd);
-void ble_att_prep_write_rsp_write(void *payload, int len,
- struct ble_att_prep_write_cmd *cmd);
-void ble_att_exec_write_req_parse(void *payload, int len,
- struct ble_att_exec_write_req *req);
-void ble_att_exec_write_req_write(void *payload, int len,
- struct ble_att_exec_write_req *req);
-void ble_att_exec_write_rsp_parse(void *payload, int len);
-void ble_att_exec_write_rsp_write(void *payload, int len);
-void ble_att_notify_req_parse(void *payload, int len,
- struct ble_att_notify_req *req);
-void ble_att_notify_req_write(void *payload, int len,
- struct ble_att_notify_req *req);
-void ble_att_indicate_req_parse(void *payload, int len,
- struct ble_att_indicate_req *req);
-void ble_att_indicate_req_write(void *payload, int len,
- struct ble_att_indicate_req *req);
-void ble_att_indicate_rsp_parse(void *payload, int len);
-void ble_att_indicate_rsp_write(void *payload, int len);
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_att_cmd_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_cmd_priv.h b/net/nimble/host/src/ble_att_cmd_priv.h
new file mode 100644
index 0000000..0dd8f0c
--- /dev/null
+++ b/net/nimble/host/src/ble_att_cmd_priv.h
@@ -0,0 +1,390 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_ATT_CMD_
+#define H_BLE_ATT_CMD_
+
+#include <inttypes.h>
+struct ble_l2cap_chan;
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Request Opcode In Error | 1 |
+ * | Attribute Handle In Error | 2 |
+ * | Error Code | 1 |
+ */
+#define BLE_ATT_ERROR_RSP_SZ 5
+struct ble_att_error_rsp {
+ uint8_t baep_req_op;
+ uint16_t baep_handle;
+ uint8_t baep_error_code;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Server Rx MTU | 2 |
+ */
+#define BLE_ATT_MTU_CMD_SZ 3
+struct ble_att_mtu_cmd {
+ uint16_t bamc_mtu;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Starting Handle | 2 |
+ * | Ending Handle | 2 |
+ */
+#define BLE_ATT_FIND_INFO_REQ_SZ 5
+struct ble_att_find_info_req {
+ uint16_t bafq_start_handle;
+ uint16_t bafq_end_handle;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Format | 1 |
+ * | Information Data | 4 to (ATT_MTU-2) |
+ */
+#define BLE_ATT_FIND_INFO_RSP_BASE_SZ 2
+struct ble_att_find_info_rsp {
+ uint8_t bafp_format;
+ /* Followed by information data. */
+} __attribute__((packed));
+
+#define BLE_ATT_FIND_INFO_RSP_FORMAT_16BIT 1
+#define BLE_ATT_FIND_INFO_RSP_FORMAT_128BIT 2
+
+#define BLE_ATT_FIND_INFO_IDATA_16_SZ 4
+#define BLE_ATT_FIND_INFO_IDATA_128_SZ 18
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Starting Handle | 2 |
+ * | Ending Handle | 2 |
+ * | Attribute Type | 2 |
+ * | Attribute Value | 0 to (ATT_MTU-7) |
+ */
+#define BLE_ATT_FIND_TYPE_VALUE_REQ_BASE_SZ 7
+struct ble_att_find_type_value_req {
+ uint16_t bavq_start_handle;
+ uint16_t bavq_end_handle;
+ uint16_t bavq_attr_type;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Information Data | 4 to (ATT_MTU-1) |
+ */
+#define BLE_ATT_FIND_TYPE_VALUE_RSP_BASE_SZ 1
+#define BLE_ATT_FIND_TYPE_VALUE_HINFO_BASE_SZ 4
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Starting Handle | 2 |
+ * | Ending Handle | 2 |
+ * | Attribute Type | 2 or 16 |
+ */
+#define BLE_ATT_READ_TYPE_REQ_BASE_SZ 5
+#define BLE_ATT_READ_TYPE_REQ_SZ_16 7
+#define BLE_ATT_READ_TYPE_REQ_SZ_128 21
+struct ble_att_read_type_req {
+ uint16_t batq_start_handle;
+ uint16_t batq_end_handle;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Length | 1 |
+ * | Attribute Data List | 2 to (ATT_MTU-2) |
+ */
+#define BLE_ATT_READ_TYPE_RSP_BASE_SZ 2
+struct ble_att_read_type_rsp {
+ uint8_t batp_length;
+} __attribute__((packed));
+
+#define BLE_ATT_READ_TYPE_ADATA_BASE_SZ 2
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Attribute Handle | 2 |
+ */
+#define BLE_ATT_READ_REQ_SZ 3
+struct ble_att_read_req {
+ uint16_t barq_handle;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Attribute Value | 0 to (ATT_MTU-1) |
+ */
+#define BLE_ATT_READ_RSP_BASE_SZ 1
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Attribute Handle | 2 |
+ * | Value Offset | 2 |
+ */
+#define BLE_ATT_READ_BLOB_REQ_SZ 5
+struct ble_att_read_blob_req {
+ uint16_t babq_handle;
+ uint16_t babq_offset;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Attribute Value | 0 to (ATT_MTU-1) |
+ */
+#define BLE_ATT_READ_BLOB_RSP_BASE_SZ 1
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Set Of Handles | 4 to (ATT_MTU-1) |
+ */
+#define BLE_ATT_READ_MULT_REQ_BASE_SZ 1
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Set Of Values | 4 to (ATT_MTU-1) |
+ */
+#define BLE_ATT_READ_MULT_RSP_BASE_SZ 1
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Starting Handle | 2 |
+ * | Ending Handle | 2 |
+ * | Attribute Group Type | 2 or 16 |
+ */
+#define BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ 5
+#define BLE_ATT_READ_GROUP_TYPE_REQ_SZ_16 7
+#define BLE_ATT_READ_GROUP_TYPE_REQ_SZ_128 21
+struct ble_att_read_group_type_req {
+ uint16_t bagq_start_handle;
+ uint16_t bagq_end_handle;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Length | 1 |
+ * | Attribute Data List | 2 to (ATT_MTU-2) |
+ */
+#define BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ 2
+struct ble_att_read_group_type_rsp {
+ uint8_t bagp_length;
+} __attribute__((packed));
+
+#define BLE_ATT_READ_GROUP_TYPE_ADATA_BASE_SZ 4
+#define BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_16 6
+#define BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_128 20
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Attribute Handle | 2 |
+ * | Attribute Value | 0 to (ATT_MTU-3) |
+ */
+#define BLE_ATT_WRITE_REQ_BASE_SZ 3
+struct ble_att_write_req {
+ uint16_t bawq_handle;
+} __attribute__((packed));
+
+#define BLE_ATT_WRITE_RSP_SZ 1
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Attribute Handle | 2 |
+ * | Value Offset | 2 |
+ * | Part Attribute Value | 0 to (ATT_MTU-5) |
+ */
+#define BLE_ATT_PREP_WRITE_CMD_BASE_SZ 5
+struct ble_att_prep_write_cmd {
+ uint16_t bapc_handle;
+ uint16_t bapc_offset;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Flags | 1 |
+ */
+#define BLE_ATT_EXEC_WRITE_REQ_SZ 2
+struct ble_att_exec_write_req {
+ uint8_t baeq_flags;
+} __attribute__((packed));
+
+#define BLE_ATT_EXEC_WRITE_F_CONFIRM 0x01
+#define BLE_ATT_EXEC_WRITE_F_RESERVED 0xfe
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ */
+#define BLE_ATT_EXEC_WRITE_RSP_SZ 1
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Attribute Handle | 2 |
+ * | Attribute Value | 0 to (ATT_MTU-3) |
+ */
+#define BLE_ATT_NOTIFY_REQ_BASE_SZ 3
+struct ble_att_notify_req {
+ uint16_t banq_handle;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ * | Attribute Handle | 2 |
+ * | Attribute Value | 0 to (ATT_MTU-3) |
+ */
+#define BLE_ATT_INDICATE_REQ_BASE_SZ 3
+struct ble_att_indicate_req {
+ uint16_t baiq_handle;
+} __attribute__((packed));
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | Attribute Opcode | 1 |
+ */
+#define BLE_ATT_INDICATE_RSP_SZ 1
+
+void ble_att_error_rsp_parse(void *payload, int len,
+ struct ble_att_error_rsp *rsp);
+void ble_att_error_rsp_write(void *payload, int len,
+ struct ble_att_error_rsp *rsp);
+void ble_att_mtu_cmd_parse(void *payload, int len,
+ struct ble_att_mtu_cmd *cmd);
+void ble_att_mtu_req_write(void *payload, int len,
+ struct ble_att_mtu_cmd *cmd);
+void ble_att_mtu_rsp_write(void *payload, int len,
+ struct ble_att_mtu_cmd *cmd);
+void ble_att_find_info_req_parse(void *payload, int len,
+ struct ble_att_find_info_req *req);
+void ble_att_find_info_req_write(void *payload, int len,
+ struct ble_att_find_info_req *req);
+void ble_att_find_info_rsp_parse(void *payload, int len,
+ struct ble_att_find_info_rsp *rsp);
+void ble_att_find_info_rsp_write(void *payload, int len,
+ struct ble_att_find_info_rsp *rsp);
+void ble_att_find_type_value_req_parse(void *payload, int len,
+ struct ble_att_find_type_value_req *req);
+void ble_att_find_type_value_req_write(void *payload, int len,
+ struct ble_att_find_type_value_req *req);
+void ble_att_read_type_req_parse(void *payload, int len,
+ struct ble_att_read_type_req *req);
+void ble_att_read_type_req_write(void *payload, int len,
+ struct ble_att_read_type_req *req);
+void ble_att_read_type_rsp_parse(void *payload, int len,
+ struct ble_att_read_type_rsp *rsp);
+void ble_att_read_type_rsp_write(void *payload, int len,
+ struct ble_att_read_type_rsp *rsp);
+void ble_att_read_req_parse(void *payload, int len,
+ struct ble_att_read_req *req);
+void ble_att_read_req_write(void *payload, int len,
+ struct ble_att_read_req *req);
+void ble_att_read_blob_req_parse(void *payload, int len,
+ struct ble_att_read_blob_req *req);
+void ble_att_read_blob_req_write(void *payload, int len,
+ struct ble_att_read_blob_req *req);
+void ble_att_read_mult_req_parse(void *payload, int len);
+void ble_att_read_mult_req_write(void *payload, int len);
+void ble_att_read_mult_rsp_parse(void *payload, int len);
+void ble_att_read_mult_rsp_write(void *payload, int len);
+void ble_att_read_group_type_req_parse(void *payload, int len,
+ struct ble_att_read_group_type_req *req);
+void ble_att_read_group_type_req_write(void *payload, int len,
+ struct ble_att_read_group_type_req *req);
+void ble_att_read_group_type_rsp_parse(void *payload, int len,
+ struct ble_att_read_group_type_rsp *rsp);
+void ble_att_read_group_type_rsp_write(void *payload, int len,
+ struct ble_att_read_group_type_rsp *rsp);
+void ble_att_write_req_parse(void *payload, int len,
+ struct ble_att_write_req *req);
+void ble_att_write_req_write(void *payload, int len,
+ struct ble_att_write_req *req);
+void ble_att_write_cmd_parse(void *payload, int len,
+ struct ble_att_write_req *req);
+void ble_att_write_cmd_write(void *payload, int len,
+ struct ble_att_write_req *req);
+void ble_att_prep_write_req_parse(void *payload, int len,
+ struct ble_att_prep_write_cmd *cmd);
+void ble_att_prep_write_req_write(void *payload, int len,
+ struct ble_att_prep_write_cmd *cmd);
+void ble_att_prep_write_rsp_parse(void *payload, int len,
+ struct ble_att_prep_write_cmd *cmd);
+void ble_att_prep_write_rsp_write(void *payload, int len,
+ struct ble_att_prep_write_cmd *cmd);
+void ble_att_exec_write_req_parse(void *payload, int len,
+ struct ble_att_exec_write_req *req);
+void ble_att_exec_write_req_write(void *payload, int len,
+ struct ble_att_exec_write_req *req);
+void ble_att_exec_write_rsp_parse(void *payload, int len);
+void ble_att_exec_write_rsp_write(void *payload, int len);
+void ble_att_notify_req_parse(void *payload, int len,
+ struct ble_att_notify_req *req);
+void ble_att_notify_req_write(void *payload, int len,
+ struct ble_att_notify_req *req);
+void ble_att_indicate_req_parse(void *payload, int len,
+ struct ble_att_indicate_req *req);
+void ble_att_indicate_req_write(void *payload, int len,
+ struct ble_att_indicate_req *req);
+void ble_att_indicate_rsp_parse(void *payload, int len);
+void ble_att_indicate_rsp_write(void *payload, int len);
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hci_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hci_cmd.c b/net/nimble/host/src/ble_hci_cmd.c
index 76b7b0e..f47e9f2 100644
--- a/net/nimble/host/src/ble_hci_cmd.c
+++ b/net/nimble/host/src/ble_hci_cmd.c
@@ -22,7 +22,7 @@
#include <stdio.h>
#include "os/os.h"
#include "ble_hs_priv.h"
-#include "host_dbg.h"
+#include "host_dbg_priv.h"
#define BLE_HCI_CMD_TIMEOUT (OS_TICKS_PER_SEC)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hci_util.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hci_util.h b/net/nimble/host/src/ble_hci_util.h
deleted file mode 100644
index f73dd47..0000000
--- a/net/nimble/host/src/ble_hci_util.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_HCI_UTIL_
-#define H_BLE_HCI_UTIL_
-
-int ble_hci_util_read_adv_tx_pwr(int8_t *out_pwr);
-int ble_hci_util_rand(void *dst, int len);
-int ble_hci_util_read_rssi(uint16_t conn_handle, int8_t *out_rssi);
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hci_util_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hci_util_priv.h b/net/nimble/host/src/ble_hci_util_priv.h
new file mode 100644
index 0000000..f73dd47
--- /dev/null
+++ b/net/nimble/host/src/ble_hci_util_priv.h
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_HCI_UTIL_
+#define H_BLE_HCI_UTIL_
+
+int ble_hci_util_read_adv_tx_pwr(int8_t *out_pwr);
+int ble_hci_util_rand(void *dst, int len);
+int ble_hci_util_read_rssi(uint16_t conn_handle, int8_t *out_rssi);
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_atomic.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_atomic.h b/net/nimble/host/src/ble_hs_atomic.h
deleted file mode 100644
index 29852f8..0000000
--- a/net/nimble/host/src/ble_hs_atomic.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_HS_ATOMIC_
-#define H_BLE_HS_ATOMIC_
-
-#include "ble_hs_conn.h"
-
-int ble_hs_atomic_conn_delete(uint16_t conn_handle);
-void ble_hs_atomic_conn_insert(struct ble_hs_conn *conn);
-int ble_hs_atomic_conn_flags(uint16_t conn_handle,
- ble_hs_conn_flags_t *out_flags);
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_atomic_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_atomic_priv.h b/net/nimble/host/src/ble_hs_atomic_priv.h
new file mode 100644
index 0000000..63a9a36
--- /dev/null
+++ b/net/nimble/host/src/ble_hs_atomic_priv.h
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_HS_ATOMIC_
+#define H_BLE_HS_ATOMIC_
+
+#include "ble_hs_conn_priv.h"
+
+int ble_hs_atomic_conn_delete(uint16_t conn_handle);
+void ble_hs_atomic_conn_insert(struct ble_hs_conn *conn);
+int ble_hs_atomic_conn_flags(uint16_t conn_handle,
+ ble_hs_conn_flags_t *out_flags);
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_conn.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn.h b/net/nimble/host/src/ble_hs_conn.h
deleted file mode 100644
index c470c3d..0000000
--- a/net/nimble/host/src/ble_hs_conn.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_HS_CONN_
-#define H_BLE_HS_CONN_
-
-#include "ble_l2cap_priv.h"
-#include "ble_gatt_priv.h"
-#include "ble_att_priv.h"
-struct hci_le_conn_complete;
-struct hci_create_conn;
-struct ble_l2cap_chan;
-
-typedef uint8_t ble_hs_conn_flags_t;
-
-#define BLE_HS_CONN_F_MASTER 0x01
-#define BLE_HS_CONN_F_UPDATE 0x02
-
-struct ble_hs_conn {
- SLIST_ENTRY(ble_hs_conn) bhc_next;
- uint16_t bhc_handle;
- uint8_t bhc_addr_type;
- uint8_t bhc_addr[6];
-
- uint16_t bhc_itvl;
- uint16_t bhc_latency;
- uint16_t bhc_supervision_timeout;
-
- ble_hs_conn_flags_t bhc_flags;
-
- struct ble_l2cap_chan_list bhc_channels;
- struct ble_l2cap_chan *bhc_rx_chan; /* Channel rxing current packet. */
- uint16_t bhc_outstanding_pkts;
-
- struct ble_att_svr_conn bhc_att_svr;
- struct ble_gatts_conn bhc_gatt_svr;
-
- struct ble_gap_sec_params bhc_sec_params;
-
- ble_gap_conn_fn *bhc_cb;
- void *bhc_cb_arg;
-};
-
-int ble_hs_conn_can_alloc(void);
-struct ble_hs_conn *ble_hs_conn_alloc(void);
-void ble_hs_conn_free(struct ble_hs_conn *conn);
-void ble_hs_conn_insert(struct ble_hs_conn *conn);
-void ble_hs_conn_remove(struct ble_hs_conn *conn);
-struct ble_hs_conn *ble_hs_conn_find(uint16_t conn_handle);
-int ble_hs_conn_exists(uint16_t conn_handle);
-struct ble_hs_conn *ble_hs_conn_first(void);
-struct ble_l2cap_chan *ble_hs_conn_chan_find(struct ble_hs_conn *conn,
- uint16_t cid);
-int ble_hs_conn_chan_insert(struct ble_hs_conn *conn,
- struct ble_l2cap_chan *chan);
-int ble_hs_conn_init(void);
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_conn_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn_priv.h b/net/nimble/host/src/ble_hs_conn_priv.h
new file mode 100644
index 0000000..c470c3d
--- /dev/null
+++ b/net/nimble/host/src/ble_hs_conn_priv.h
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_HS_CONN_
+#define H_BLE_HS_CONN_
+
+#include "ble_l2cap_priv.h"
+#include "ble_gatt_priv.h"
+#include "ble_att_priv.h"
+struct hci_le_conn_complete;
+struct hci_create_conn;
+struct ble_l2cap_chan;
+
+typedef uint8_t ble_hs_conn_flags_t;
+
+#define BLE_HS_CONN_F_MASTER 0x01
+#define BLE_HS_CONN_F_UPDATE 0x02
+
+struct ble_hs_conn {
+ SLIST_ENTRY(ble_hs_conn) bhc_next;
+ uint16_t bhc_handle;
+ uint8_t bhc_addr_type;
+ uint8_t bhc_addr[6];
+
+ uint16_t bhc_itvl;
+ uint16_t bhc_latency;
+ uint16_t bhc_supervision_timeout;
+
+ ble_hs_conn_flags_t bhc_flags;
+
+ struct ble_l2cap_chan_list bhc_channels;
+ struct ble_l2cap_chan *bhc_rx_chan; /* Channel rxing current packet. */
+ uint16_t bhc_outstanding_pkts;
+
+ struct ble_att_svr_conn bhc_att_svr;
+ struct ble_gatts_conn bhc_gatt_svr;
+
+ struct ble_gap_sec_params bhc_sec_params;
+
+ ble_gap_conn_fn *bhc_cb;
+ void *bhc_cb_arg;
+};
+
+int ble_hs_conn_can_alloc(void);
+struct ble_hs_conn *ble_hs_conn_alloc(void);
+void ble_hs_conn_free(struct ble_hs_conn *conn);
+void ble_hs_conn_insert(struct ble_hs_conn *conn);
+void ble_hs_conn_remove(struct ble_hs_conn *conn);
+struct ble_hs_conn *ble_hs_conn_find(uint16_t conn_handle);
+int ble_hs_conn_exists(uint16_t conn_handle);
+struct ble_hs_conn *ble_hs_conn_first(void);
+struct ble_l2cap_chan *ble_hs_conn_chan_find(struct ble_hs_conn *conn,
+ uint16_t cid);
+int ble_hs_conn_chan_insert(struct ble_hs_conn *conn,
+ struct ble_l2cap_chan *chan);
+int ble_hs_conn_init(void);
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_endian.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_endian.h b/net/nimble/host/src/ble_hs_endian.h
deleted file mode 100644
index c2342ff..0000000
--- a/net/nimble/host/src/ble_hs_endian.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_HS_ENDIAN_
-#define H_BLE_HS_ENDIAN_
-
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-
-#define TOFROMLE16(x) ((uint16_t) (x))
-#define TOFROMLE32(x) ((uint32_t) (x))
-#define TOFROMLE64(x) ((uint64_t) (x))
-
-#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-
-#define TOFROMLE16(x) ((uint16_t) \
- ((((x) & 0xff00) >> 8) | \
- (((x) & 0x00ff) << 8)))
-
-#define TOFROMLE32(x) ((uint32_t) \
- ((((x) & 0xff000000) >> 24) | \
- (((x) & 0x00ff0000) >> 8) | \
- (((x) & 0x0000ff00) << 8) | \
- (((x) & 0x000000ff) << 24)))
-
-#define TOFROMLE64(x) ((uint64_t) \
- ((((x) & 0xff00000000000000ull) >> 56) | \
- (((x) & 0x00ff000000000000ull) >> 40) | \
- (((x) & 0x0000ff0000000000ull) >> 24) | \
- (((x) & 0x000000ff00000000ull) >> 8) | \
- (((x) & 0x00000000ff000000ull) << 8) | \
- (((x) & 0x0000000000ff0000ull) << 24) | \
- (((x) & 0x000000000000ff00ull) << 40) | \
- (((x) & 0x00000000000000ffull) << 56)))
-
-#else
-
-#error Unsupported endianness.
-
-#endif
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_endian_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_endian_priv.h b/net/nimble/host/src/ble_hs_endian_priv.h
new file mode 100644
index 0000000..c2342ff
--- /dev/null
+++ b/net/nimble/host/src/ble_hs_endian_priv.h
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_HS_ENDIAN_
+#define H_BLE_HS_ENDIAN_
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
+#define TOFROMLE16(x) ((uint16_t) (x))
+#define TOFROMLE32(x) ((uint32_t) (x))
+#define TOFROMLE64(x) ((uint64_t) (x))
+
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+
+#define TOFROMLE16(x) ((uint16_t) \
+ ((((x) & 0xff00) >> 8) | \
+ (((x) & 0x00ff) << 8)))
+
+#define TOFROMLE32(x) ((uint32_t) \
+ ((((x) & 0xff000000) >> 24) | \
+ (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0x0000ff00) << 8) | \
+ (((x) & 0x000000ff) << 24)))
+
+#define TOFROMLE64(x) ((uint64_t) \
+ ((((x) & 0xff00000000000000ull) >> 56) | \
+ (((x) & 0x00ff000000000000ull) >> 40) | \
+ (((x) & 0x0000ff0000000000ull) >> 24) | \
+ (((x) & 0x000000ff00000000ull) >> 8) | \
+ (((x) & 0x00000000ff000000ull) << 8) | \
+ (((x) & 0x0000000000ff0000ull) << 24) | \
+ (((x) & 0x000000000000ff00ull) << 40) | \
+ (((x) & 0x00000000000000ffull) << 56)))
+
+#else
+
+#error Unsupported endianness.
+
+#endif
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_priv.h b/net/nimble/host/src/ble_hs_priv.h
index cf77b9e..024b964 100644
--- a/net/nimble/host/src/ble_hs_priv.h
+++ b/net/nimble/host/src/ble_hs_priv.h
@@ -22,19 +22,19 @@
#include <assert.h>
#include <inttypes.h>
-#include "ble_att_cmd.h"
+#include "ble_att_cmd_priv.h"
#include "ble_att_priv.h"
#include "ble_gap_priv.h"
#include "ble_gatt_priv.h"
-#include "ble_hci_util.h"
+#include "ble_hci_util_priv.h"
#include "ble_hs_adv_priv.h"
-#include "ble_hs_atomic.h"
-#include "ble_hs_conn.h"
-#include "ble_hs_endian.h"
-#include "ble_hs_startup.h"
+#include "ble_hs_atomic_priv.h"
+#include "ble_hs_conn_priv.h"
+#include "ble_hs_endian_priv.h"
+#include "ble_hs_startup_priv.h"
#include "ble_l2cap_priv.h"
-#include "ble_l2cap_sig.h"
-#include "ble_l2cap_sm.h"
+#include "ble_l2cap_sig_priv.h"
+#include "ble_l2cap_sm_priv.h"
#include "host/ble_hs.h"
#include "log/log.h"
#include "nimble/nimble_opt.h"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_startup.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_startup.h b/net/nimble/host/src/ble_hs_startup.h
deleted file mode 100644
index 2a5867e..0000000
--- a/net/nimble/host/src/ble_hs_startup.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_HS_STARTUP_
-#define H_BLE_HS_STARTUP_
-
-int ble_hs_startup_go(void);
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_hs_startup_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_startup_priv.h b/net/nimble/host/src/ble_hs_startup_priv.h
new file mode 100644
index 0000000..2a5867e
--- /dev/null
+++ b/net/nimble/host/src/ble_hs_startup_priv.h
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_HS_STARTUP_
+#define H_BLE_HS_STARTUP_
+
+int ble_hs_startup_go(void);
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_l2cap_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_priv.h b/net/nimble/host/src/ble_l2cap_priv.h
index 2a728fc..ecf7d17 100644
--- a/net/nimble/host/src/ble_l2cap_priv.h
+++ b/net/nimble/host/src/ble_l2cap_priv.h
@@ -42,59 +42,18 @@ STATS_SECT_START(ble_l2cap_stats)
STATS_SECT_END
extern STATS_SECT_DECL(ble_l2cap_stats) ble_l2cap_stats;
-#define BLE_L2CAP_SIG_HDR_SZ 4
-struct ble_l2cap_sig_hdr {
- uint8_t op;
- uint8_t identifier;
- uint16_t length;
-} __attribute__((packed));
-
-#define BLE_L2CAP_SIG_REJECT_MIN_SZ 2
-struct ble_l2cap_sig_reject {
- uint16_t reason;
-} __attribute__((packed));
-
-#define BLE_L2CAP_SIG_UPDATE_REQ_SZ 8
-struct ble_l2cap_sig_update_req {
- uint16_t itvl_min;
- uint16_t itvl_max;
- uint16_t slave_latency;
- uint16_t timeout_multiplier;
-} __attribute__((packed));
-
-#define BLE_L2CAP_SIG_UPDATE_RSP_SZ 2
-struct ble_l2cap_sig_update_rsp {
- uint16_t result;
-} __attribute__((packed));
-
-#define BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT 0x0000
-#define BLE_L2CAP_SIG_UPDATE_RSP_RESULT_REJECT 0x0001
-
#define BLE_L2CAP_CID_ATT 4
#define BLE_L2CAP_CID_SIG 5
#define BLE_L2CAP_CID_SM 6
#define BLE_L2CAP_HDR_SZ 4
-struct ble_l2cap_hdr
-{
- uint16_t blh_len;
- uint16_t blh_cid;
-};
-
-struct ble_l2cap_chan;
+typedef uint8_t ble_l2cap_chan_flags;
typedef int ble_l2cap_rx_fn(uint16_t conn_handle,
struct os_mbuf **om);
-typedef int ble_l2cap_tx_fn(struct ble_hs_conn *conn,
- struct ble_l2cap_chan *chan);
-
-typedef uint8_t ble_l2cap_chan_flags;
-#define BLE_L2CAP_CHAN_F_TXED_MTU 0x01 /* We have sent our MTU. */
-
-struct ble_l2cap_chan
-{
+struct ble_l2cap_chan {
SLIST_ENTRY(ble_l2cap_chan) blc_next;
uint16_t blc_cid;
uint16_t blc_my_mtu;
@@ -108,6 +67,15 @@ struct ble_l2cap_chan
ble_l2cap_rx_fn *blc_rx_fn;
};
+struct ble_l2cap_hdr {
+ uint16_t blh_len;
+ uint16_t blh_cid;
+};
+
+typedef int ble_l2cap_tx_fn(struct ble_hs_conn *conn,
+ struct ble_l2cap_chan *chan);
+
+#define BLE_L2CAP_CHAN_F_TXED_MTU 0x01 /* We have sent our MTU. */
SLIST_HEAD(ble_l2cap_chan_list, ble_l2cap_chan);
@@ -116,26 +84,6 @@ int ble_l2cap_parse_hdr(struct os_mbuf *om, int off,
struct os_mbuf *ble_l2cap_prepend_hdr(struct os_mbuf *om, uint16_t cid,
uint16_t len);
-int ble_l2cap_sig_init_cmd(uint8_t op, uint8_t id, uint8_t payload_len,
- struct os_mbuf **out_om, void **out_payload_buf);
-void ble_l2cap_sig_hdr_parse(void *payload, uint16_t len,
- struct ble_l2cap_sig_hdr *hdr);
-void ble_l2cap_sig_hdr_write(void *payload, uint16_t len,
- struct ble_l2cap_sig_hdr *hdr);
-int ble_l2cap_sig_reject_tx(uint16_t conn_handle, uint8_t id, uint16_t reason);
-void ble_l2cap_sig_update_req_parse(void *payload, int len,
- struct ble_l2cap_sig_update_req *req);
-void ble_l2cap_sig_update_req_write(void *payload, int len,
- struct ble_l2cap_sig_update_req *src);
-int ble_l2cap_sig_update_req_tx(uint16_t conn_handle, uint8_t id,
- struct ble_l2cap_sig_update_req *req);
-void ble_l2cap_sig_update_rsp_parse(void *payload, int len,
- struct ble_l2cap_sig_update_rsp *cmd);
-void ble_l2cap_sig_update_rsp_write(void *payload, int len,
- struct ble_l2cap_sig_update_rsp *src);
-int ble_l2cap_sig_update_rsp_tx(uint16_t conn_handle, uint8_t id,
- uint16_t result);
-
struct ble_l2cap_chan *ble_l2cap_chan_alloc(void);
void ble_l2cap_chan_free(struct ble_l2cap_chan *chan);
@@ -150,8 +98,6 @@ int ble_l2cap_rx(struct ble_hs_conn *conn,
int ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
struct os_mbuf *om);
-void ble_l2cap_sig_heartbeat(void);
-int ble_l2cap_sig_init(void);
int ble_l2cap_init(void);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_l2cap_sig.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.h b/net/nimble/host/src/ble_l2cap_sig.h
deleted file mode 100644
index b46f17a..0000000
--- a/net/nimble/host/src/ble_l2cap_sig.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_L2CAP_SIG_
-#define H_BLE_L2CAP_SIG_
-
-#define BLE_L2CAP_SIG_MTU 100 /* This is our own default. */
-
-struct ble_l2cap_chan *ble_l2cap_sig_create_chan(void);
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_l2cap_sig_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig_priv.h b/net/nimble/host/src/ble_l2cap_sig_priv.h
new file mode 100644
index 0000000..da6d3b4
--- /dev/null
+++ b/net/nimble/host/src/ble_l2cap_sig_priv.h
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_L2CAP_SIG_
+#define H_BLE_L2CAP_SIG_
+
+#define BLE_L2CAP_SIG_MTU 100 /* This is our own default. */
+
+#define BLE_L2CAP_SIG_HDR_SZ 4
+struct ble_l2cap_sig_hdr {
+ uint8_t op;
+ uint8_t identifier;
+ uint16_t length;
+} __attribute__((packed));
+
+#define BLE_L2CAP_SIG_REJECT_MIN_SZ 2
+struct ble_l2cap_sig_reject {
+ uint16_t reason;
+} __attribute__((packed));
+
+#define BLE_L2CAP_SIG_UPDATE_REQ_SZ 8
+struct ble_l2cap_sig_update_req {
+ uint16_t itvl_min;
+ uint16_t itvl_max;
+ uint16_t slave_latency;
+ uint16_t timeout_multiplier;
+} __attribute__((packed));
+
+#define BLE_L2CAP_SIG_UPDATE_RSP_SZ 2
+struct ble_l2cap_sig_update_rsp {
+ uint16_t result;
+} __attribute__((packed));
+
+#define BLE_L2CAP_SIG_UPDATE_RSP_RESULT_ACCEPT 0x0000
+#define BLE_L2CAP_SIG_UPDATE_RSP_RESULT_REJECT 0x0001
+
+int ble_l2cap_sig_init_cmd(uint8_t op, uint8_t id, uint8_t payload_len,
+ struct os_mbuf **out_om, void **out_payload_buf);
+void ble_l2cap_sig_hdr_parse(void *payload, uint16_t len,
+ struct ble_l2cap_sig_hdr *hdr);
+void ble_l2cap_sig_hdr_write(void *payload, uint16_t len,
+ struct ble_l2cap_sig_hdr *hdr);
+int ble_l2cap_sig_reject_tx(uint16_t conn_handle, uint8_t id, uint16_t reason);
+void ble_l2cap_sig_update_req_parse(void *payload, int len,
+ struct ble_l2cap_sig_update_req *req);
+void ble_l2cap_sig_update_req_write(void *payload, int len,
+ struct ble_l2cap_sig_update_req *src);
+int ble_l2cap_sig_update_req_tx(uint16_t conn_handle, uint8_t id,
+ struct ble_l2cap_sig_update_req *req);
+void ble_l2cap_sig_update_rsp_parse(void *payload, int len,
+ struct ble_l2cap_sig_update_rsp *cmd);
+void ble_l2cap_sig_update_rsp_write(void *payload, int len,
+ struct ble_l2cap_sig_update_rsp *src);
+int ble_l2cap_sig_update_rsp_tx(uint16_t conn_handle, uint8_t id,
+ uint16_t result);
+
+void ble_l2cap_sig_heartbeat(void);
+struct ble_l2cap_chan *ble_l2cap_sig_create_chan(void);
+int ble_l2cap_sig_init(void);
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_l2cap_sm.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sm.h b/net/nimble/host/src/ble_l2cap_sm.h
deleted file mode 100644
index 9ecbeaf..0000000
--- a/net/nimble/host/src/ble_l2cap_sm.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_BLE_L2CAP_SM_
-#define H_BLE_L2CAP_SM_
-
-struct ble_gap_sec_params;
-struct hci_le_lt_key_req;
-
-#define BLE_L2CAP_SM_MTU 65
-
-#define BLE_L2CAP_SM_HDR_SZ 1
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | (Code=0x01/0x02 [req/rsp]) | 1 |
- * | IO Capability | 1 |
- * | OOB data flag | 1 |
- * | AuthReq | 1 |
- * | Maximum Encryption Key Size | 1 |
- * | Initiator Key Distribution | 1 |
- * | Responder Key Distribution | 1 |
- */
-#define BLE_L2CAP_SM_PAIR_CMD_SZ 6
-struct ble_l2cap_sm_pair_cmd {
- uint8_t io_cap;
- uint8_t oob_data_flag;
- uint8_t authreq;
- uint8_t max_enc_key_size;
- uint8_t init_key_dist;
- uint8_t resp_key_dist;
-};
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | (Code=0x03) | 1 |
- * | Confirm Value | 16 |
- */
-#define BLE_L2CAP_SM_PAIR_CONFIRM_SZ 16
-struct ble_l2cap_sm_pair_confirm {
- uint8_t value[16];
-};
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | (Code=0x04) | 1 |
- * | Random Value | 16 |
- */
-#define BLE_L2CAP_SM_PAIR_RANDOM_SZ 16
-struct ble_l2cap_sm_pair_random {
- uint8_t value[16];
-};
-
-/**
- * | Parameter | Size (octets) |
- * +------------------------------------+-------------------+
- * | (Code=0x05) | 1 |
- * | Reason | 1 |
- */
-#define BLE_L2CAP_SM_PAIR_FAIL_SZ 1
-struct ble_l2cap_sm_pair_fail {
- uint8_t reason;
-};
-
-#if NIMBLE_OPT_SM
-
-#ifdef BLE_HS_DEBUG
-void ble_l2cap_sm_dbg_set_next_pair_rand(uint8_t *next_pair_rand);
-void ble_l2cap_sm_dbg_set_next_ediv(uint16_t next_ediv);
-void ble_l2cap_sm_dbg_set_next_start_rand(uint64_t next_start_rand);
-int ble_l2cap_sm_dbg_num_procs(void);
-#endif
-
-struct ble_l2cap_chan *ble_l2cap_sm_create_chan(void);
-
-void ble_l2cap_sm_pair_cmd_parse(void *payload, int len,
- struct ble_l2cap_sm_pair_cmd *cmd);
-void ble_l2cap_sm_pair_cmd_write(void *payload, int len, int is_req,
- struct ble_l2cap_sm_pair_cmd *cmd);
-int ble_l2cap_sm_pair_cmd_tx(uint16_t conn_handle, int is_req,
- struct ble_l2cap_sm_pair_cmd *cmd);
-void ble_l2cap_sm_pair_confirm_parse(void *payload, int len,
- struct ble_l2cap_sm_pair_confirm *cmd);
-void ble_l2cap_sm_pair_confirm_write(void *payload, int len,
- struct ble_l2cap_sm_pair_confirm *cmd);
-int ble_l2cap_sm_pair_confirm_tx(uint16_t conn_handle,
- struct ble_l2cap_sm_pair_confirm *cmd);
-void ble_l2cap_sm_pair_random_parse(void *payload, int len,
- struct ble_l2cap_sm_pair_random *cmd);
-void ble_l2cap_sm_pair_random_write(void *payload, int len,
- struct ble_l2cap_sm_pair_random *cmd);
-int ble_l2cap_sm_pair_random_tx(uint16_t conn_handle,
- struct ble_l2cap_sm_pair_random *cmd);
-void ble_l2cap_sm_pair_fail_parse(void *payload, int len,
- struct ble_l2cap_sm_pair_fail *cmd);
-void ble_l2cap_sm_pair_fail_write(void *payload, int len,
- struct ble_l2cap_sm_pair_fail *cmd);
-int ble_l2cap_sm_pair_fail_tx(uint16_t conn_handle, uint8_t reason);
-
-int ble_l2cap_sm_alg_s1(uint8_t *k, uint8_t *r1, uint8_t *r2, uint8_t *out);
-int ble_l2cap_sm_alg_c1(uint8_t *k, uint8_t *r,
- uint8_t *preq, uint8_t *pres,
- uint8_t iat, uint8_t rat,
- uint8_t *ia, uint8_t *ra,
- uint8_t *out_enc_data);
-
-void ble_l2cap_sm_rx_encryption_change(struct hci_encrypt_change *evt);
-int ble_l2cap_sm_rx_lt_key_req(struct hci_le_lt_key_req *evt);
-
-void ble_l2cap_sm_heartbeat(void);
-int ble_l2cap_sm_initiate(uint16_t conn_handle);
-int ble_l2cap_sm_init(void);
-
-#else
-
-#ifdef BLE_HS_DEBUG
-#define ble_l2cap_sm_dbg_set_next_rand(next_rand)
-#define ble_l2cap_sm_dbg_num_procs() 0
-#endif
-
-#define ble_l2cap_sm_create_chan() NULL
-
-#define ble_l2cap_sm_pair_cmd_tx(conn_handle, is_req, cmd) BLE_HS_ENOTSUP
-#define ble_l2cap_sm_pair_confirm_tx(conn_handle, cmd) BLE_HS_ENOTSUP
-#define ble_l2cap_sm_pair_random_tx(conn_handle, cmd) BLE_HS_ENOTSUP
-#define ble_l2cap_sm_pair_fail_tx(conn_handle, cmd) BLE_HS_ENOTSUP
-
-#define ble_l2cap_sm_alg_s1(k, r1, r2, out) BLE_HS_ENOTSUP
-#define ble_l2cap_sm_alg_c1(k, r, preq, pres, iat, rat, ia, ra, out_enc_data) \
- BLE_HS_ENOTSUP
-
-#define ble_l2cap_sm_rx_encryption_change(evt) ((void)(evt))
-#define ble_l2cap_sm_rx_lt_key_req(evt) ((void)(evt))
-
-#define ble_l2cap_sm_connection_broken(conn_handle)
-
-#define ble_l2cap_sm_heartbeat()
-#define ble_l2cap_sm_init() 0
-
-#endif
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/ble_l2cap_sm_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sm_priv.h b/net/nimble/host/src/ble_l2cap_sm_priv.h
new file mode 100644
index 0000000..9ecbeaf
--- /dev/null
+++ b/net/nimble/host/src/ble_l2cap_sm_priv.h
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_L2CAP_SM_
+#define H_BLE_L2CAP_SM_
+
+struct ble_gap_sec_params;
+struct hci_le_lt_key_req;
+
+#define BLE_L2CAP_SM_MTU 65
+
+#define BLE_L2CAP_SM_HDR_SZ 1
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | (Code=0x01/0x02 [req/rsp]) | 1 |
+ * | IO Capability | 1 |
+ * | OOB data flag | 1 |
+ * | AuthReq | 1 |
+ * | Maximum Encryption Key Size | 1 |
+ * | Initiator Key Distribution | 1 |
+ * | Responder Key Distribution | 1 |
+ */
+#define BLE_L2CAP_SM_PAIR_CMD_SZ 6
+struct ble_l2cap_sm_pair_cmd {
+ uint8_t io_cap;
+ uint8_t oob_data_flag;
+ uint8_t authreq;
+ uint8_t max_enc_key_size;
+ uint8_t init_key_dist;
+ uint8_t resp_key_dist;
+};
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | (Code=0x03) | 1 |
+ * | Confirm Value | 16 |
+ */
+#define BLE_L2CAP_SM_PAIR_CONFIRM_SZ 16
+struct ble_l2cap_sm_pair_confirm {
+ uint8_t value[16];
+};
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | (Code=0x04) | 1 |
+ * | Random Value | 16 |
+ */
+#define BLE_L2CAP_SM_PAIR_RANDOM_SZ 16
+struct ble_l2cap_sm_pair_random {
+ uint8_t value[16];
+};
+
+/**
+ * | Parameter | Size (octets) |
+ * +------------------------------------+-------------------+
+ * | (Code=0x05) | 1 |
+ * | Reason | 1 |
+ */
+#define BLE_L2CAP_SM_PAIR_FAIL_SZ 1
+struct ble_l2cap_sm_pair_fail {
+ uint8_t reason;
+};
+
+#if NIMBLE_OPT_SM
+
+#ifdef BLE_HS_DEBUG
+void ble_l2cap_sm_dbg_set_next_pair_rand(uint8_t *next_pair_rand);
+void ble_l2cap_sm_dbg_set_next_ediv(uint16_t next_ediv);
+void ble_l2cap_sm_dbg_set_next_start_rand(uint64_t next_start_rand);
+int ble_l2cap_sm_dbg_num_procs(void);
+#endif
+
+struct ble_l2cap_chan *ble_l2cap_sm_create_chan(void);
+
+void ble_l2cap_sm_pair_cmd_parse(void *payload, int len,
+ struct ble_l2cap_sm_pair_cmd *cmd);
+void ble_l2cap_sm_pair_cmd_write(void *payload, int len, int is_req,
+ struct ble_l2cap_sm_pair_cmd *cmd);
+int ble_l2cap_sm_pair_cmd_tx(uint16_t conn_handle, int is_req,
+ struct ble_l2cap_sm_pair_cmd *cmd);
+void ble_l2cap_sm_pair_confirm_parse(void *payload, int len,
+ struct ble_l2cap_sm_pair_confirm *cmd);
+void ble_l2cap_sm_pair_confirm_write(void *payload, int len,
+ struct ble_l2cap_sm_pair_confirm *cmd);
+int ble_l2cap_sm_pair_confirm_tx(uint16_t conn_handle,
+ struct ble_l2cap_sm_pair_confirm *cmd);
+void ble_l2cap_sm_pair_random_parse(void *payload, int len,
+ struct ble_l2cap_sm_pair_random *cmd);
+void ble_l2cap_sm_pair_random_write(void *payload, int len,
+ struct ble_l2cap_sm_pair_random *cmd);
+int ble_l2cap_sm_pair_random_tx(uint16_t conn_handle,
+ struct ble_l2cap_sm_pair_random *cmd);
+void ble_l2cap_sm_pair_fail_parse(void *payload, int len,
+ struct ble_l2cap_sm_pair_fail *cmd);
+void ble_l2cap_sm_pair_fail_write(void *payload, int len,
+ struct ble_l2cap_sm_pair_fail *cmd);
+int ble_l2cap_sm_pair_fail_tx(uint16_t conn_handle, uint8_t reason);
+
+int ble_l2cap_sm_alg_s1(uint8_t *k, uint8_t *r1, uint8_t *r2, uint8_t *out);
+int ble_l2cap_sm_alg_c1(uint8_t *k, uint8_t *r,
+ uint8_t *preq, uint8_t *pres,
+ uint8_t iat, uint8_t rat,
+ uint8_t *ia, uint8_t *ra,
+ uint8_t *out_enc_data);
+
+void ble_l2cap_sm_rx_encryption_change(struct hci_encrypt_change *evt);
+int ble_l2cap_sm_rx_lt_key_req(struct hci_le_lt_key_req *evt);
+
+void ble_l2cap_sm_heartbeat(void);
+int ble_l2cap_sm_initiate(uint16_t conn_handle);
+int ble_l2cap_sm_init(void);
+
+#else
+
+#ifdef BLE_HS_DEBUG
+#define ble_l2cap_sm_dbg_set_next_rand(next_rand)
+#define ble_l2cap_sm_dbg_num_procs() 0
+#endif
+
+#define ble_l2cap_sm_create_chan() NULL
+
+#define ble_l2cap_sm_pair_cmd_tx(conn_handle, is_req, cmd) BLE_HS_ENOTSUP
+#define ble_l2cap_sm_pair_confirm_tx(conn_handle, cmd) BLE_HS_ENOTSUP
+#define ble_l2cap_sm_pair_random_tx(conn_handle, cmd) BLE_HS_ENOTSUP
+#define ble_l2cap_sm_pair_fail_tx(conn_handle, cmd) BLE_HS_ENOTSUP
+
+#define ble_l2cap_sm_alg_s1(k, r1, r2, out) BLE_HS_ENOTSUP
+#define ble_l2cap_sm_alg_c1(k, r, preq, pres, iat, rat, ia, ra, out_enc_data) \
+ BLE_HS_ENOTSUP
+
+#define ble_l2cap_sm_rx_encryption_change(evt) ((void)(evt))
+#define ble_l2cap_sm_rx_lt_key_req(evt) ((void)(evt))
+
+#define ble_l2cap_sm_connection_broken(conn_handle)
+
+#define ble_l2cap_sm_heartbeat()
+#define ble_l2cap_sm_init() 0
+
+#endif
+
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/host_dbg.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_dbg.h b/net/nimble/host/src/host_dbg.h
deleted file mode 100644
index 8d548ca..0000000
--- a/net/nimble/host/src/host_dbg.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_HOST_DBG_
-#define H_HOST_DBG_
-
-void host_hci_dbg_event_disp(uint8_t *evbuf);
-
-#endif /* H_HOST_DBG_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/host_dbg_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_dbg_priv.h b/net/nimble/host/src/host_dbg_priv.h
new file mode 100644
index 0000000..8d548ca
--- /dev/null
+++ b/net/nimble/host/src/host_dbg_priv.h
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_HOST_DBG_
+#define H_HOST_DBG_
+
+void host_hci_dbg_event_disp(uint8_t *evbuf);
+
+#endif /* H_HOST_DBG_ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/host_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_hci.c b/net/nimble/host/src/host_hci.c
index 4994cb6..a030c89 100644
--- a/net/nimble/host/src/host_hci.c
+++ b/net/nimble/host/src/host_hci.c
@@ -26,7 +26,7 @@
#include "nimble/hci_transport.h"
#include "host/host_hci.h"
#include "ble_hs_priv.h"
-#include "host_dbg.h"
+#include "host_dbg_priv.h"
_Static_assert(sizeof (struct hci_data_hdr) == BLE_HCI_DATA_HDR_SZ,
"struct hci_data_hdr must be 4 bytes");
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/832637db/net/nimble/host/src/host_hci_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/host_hci_cmd.c b/net/nimble/host/src/host_hci_cmd.c
index 8ed0395..c8c79f1 100644
--- a/net/nimble/host/src/host_hci_cmd.c
+++ b/net/nimble/host/src/host_hci_cmd.c
@@ -26,7 +26,7 @@
#include "nimble/hci_common.h"
#include "nimble/hci_transport.h"
#include "host/host_hci.h"
-#include "host_dbg.h"
+#include "host_dbg_priv.h"
#include "ble_hs_priv.h"
#ifdef PHONY_TRANSPORT
#include "host/ble_hs_test.h"