nimble/sm: Remove unused functions

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/4bdaa471
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4bdaa471
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4bdaa471

Branch: refs/heads/develop
Commit: 4bdaa471bc75bfdc3cc23466f218fb00145ba59c
Parents: bd23aef
Author: Szymon Janc <[email protected]>
Authored: Tue Jan 17 19:24:43 2017 +0100
Committer: Szymon Janc <[email protected]>
Committed: Wed Jan 25 15:44:15 2017 +0100

----------------------------------------------------------------------
 net/nimble/host/src/ble_sm_cmd.c  | 311 ---------------------------------
 net/nimble/host/src/ble_sm_priv.h |  17 --
 2 files changed, 328 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4bdaa471/net/nimble/host/src/ble_sm_cmd.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_cmd.c b/net/nimble/host/src/ble_sm_cmd.c
index 5251dae..92fc3b4 100644
--- a/net/nimble/host/src/ble_sm_cmd.c
+++ b/net/nimble/host/src/ble_sm_cmd.c
@@ -64,32 +64,6 @@ ble_sm_tx(uint16_t conn_handle, struct os_mbuf *txom)
 }
 
 #if NIMBLE_BLE_SM
-static int
-ble_sm_init_req(uint16_t initial_sz, struct os_mbuf **out_txom)
-{
-    void *buf;
-    int rc;
-
-    *out_txom = ble_hs_mbuf_l2cap_pkt();
-    if (*out_txom == NULL) {
-        rc = BLE_HS_ENOMEM;
-        goto err;
-    }
-
-    buf = os_mbuf_extend(*out_txom, sizeof(struct ble_sm_hdr) + initial_sz);
-    if (buf == NULL) {
-        rc = BLE_HS_ENOMEM;
-        goto err;
-    }
-
-    return 0;
-
-err:
-    os_mbuf_free_chain(*out_txom);
-    *out_txom = NULL;
-    return rc;
-}
-
 void
 ble_sm_pair_cmd_parse(void *payload, int len, struct ble_sm_pair_cmd *cmd)
 {
@@ -124,30 +98,6 @@ ble_sm_pair_cmd_write(void *payload, int len, int is_req,
     u8ptr[6] = cmd->resp_key_dist;
 }
 
-int
-ble_sm_pair_cmd_tx(uint16_t conn_handle, int is_req,
-                   struct ble_sm_pair_cmd *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_pair_cmd), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    ble_sm_pair_cmd_write(txom->om_data, txom->om_len, is_req, cmd);
-    BLE_SM_LOG_CMD(1, is_req ? "pair req" : "pair rsp", conn_handle,
-                   ble_sm_pair_cmd_log, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_pair_cmd_log(struct ble_sm_pair_cmd *cmd)
 {
@@ -181,28 +131,6 @@ ble_sm_pair_confirm_write(void *payload, int len,
     memcpy(u8ptr + sizeof(struct ble_sm_hdr), cmd->value, sizeof cmd->value);
 }
 
-int
-ble_sm_pair_confirm_tx(uint16_t conn_handle, struct ble_sm_pair_confirm *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_pair_confirm), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    ble_sm_pair_confirm_write(txom->om_data, txom->om_len, cmd);
-    BLE_SM_LOG_CMD(1, "confirm", conn_handle, ble_sm_pair_confirm_log, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_pair_confirm_log(struct ble_sm_pair_confirm *cmd)
 {
@@ -233,28 +161,6 @@ ble_sm_pair_random_write(void *payload, int len,
     memcpy(u8ptr + sizeof(struct ble_sm_hdr), cmd->value, sizeof cmd->value);
 }
 
-int
-ble_sm_pair_random_tx(uint16_t conn_handle, struct ble_sm_pair_random *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_pair_random), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    ble_sm_pair_random_write(txom->om_data, txom->om_len, cmd);
-    BLE_SM_LOG_CMD(1, "random", conn_handle, ble_sm_pair_random_log, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_pair_random_log(struct ble_sm_pair_random *cmd)
 {
@@ -286,34 +192,6 @@ ble_sm_pair_fail_write(void *payload, int len, struct 
ble_sm_pair_fail *cmd)
     u8ptr[1] = cmd->reason;
 }
 
-/* XXX: Should not require locked. */
-int
-ble_sm_pair_fail_tx(uint16_t conn_handle, uint8_t reason)
-{
-    struct ble_sm_pair_fail cmd;
-    struct os_mbuf *txom;
-    int rc;
-
-    BLE_HS_DBG_ASSERT(reason > 0 && reason < BLE_SM_ERR_MAX_PLUS_1);
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_pair_fail), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    cmd.reason = reason;
-
-    ble_sm_pair_fail_write(txom->om_data, txom->om_len, &cmd);
-    BLE_SM_LOG_CMD(1, "fail", conn_handle, ble_sm_pair_fail_log, &cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_pair_fail_log(struct ble_sm_pair_fail *cmd)
 {
@@ -339,29 +217,6 @@ ble_sm_enc_info_write(void *payload, int len, struct 
ble_sm_enc_info *cmd)
     memcpy(u8ptr + 1, cmd->ltk, sizeof cmd->ltk);
 }
 
-int
-ble_sm_enc_info_tx(uint16_t conn_handle, struct ble_sm_enc_info *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_enc_info), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    ble_sm_enc_info_write(txom->om_data, txom->om_len, cmd);
-
-    BLE_SM_LOG_CMD(1, "enc info", conn_handle, ble_sm_enc_info_log, cmd);
-    
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_enc_info_log(struct ble_sm_enc_info *cmd)
 {
@@ -394,31 +249,6 @@ ble_sm_master_id_write(void *payload, int len, struct 
ble_sm_master_id *cmd)
     put_le64(u8ptr + 3, cmd->rand_val);
 }
 
-int
-ble_sm_master_id_tx(uint16_t conn_handle, struct ble_sm_master_id *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_master_id), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    txom->om_data[0] = BLE_SM_OP_MASTER_ID;
-    put_le16(txom->om_data + 1, cmd->ediv);
-    put_le64(txom->om_data + 3, cmd->rand_val);
-
-    BLE_SM_LOG_CMD(1, "master id", conn_handle, ble_sm_master_id_log, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_master_id_log(struct ble_sm_master_id *cmd)
 {
@@ -448,29 +278,6 @@ ble_sm_id_info_write(void *payload, int len, struct 
ble_sm_id_info *cmd)
     memcpy(u8ptr + sizeof(struct ble_sm_hdr), cmd->irk, sizeof cmd->irk);
 }
 
-int
-ble_sm_id_info_tx(uint16_t conn_handle, struct ble_sm_id_info *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    BLE_SM_LOG_CMD(1, "id info", conn_handle, ble_sm_id_info_log, cmd);
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_id_info), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    ble_sm_id_info_write(txom->om_data, txom->om_len, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_id_info_log(struct ble_sm_id_info *cmd)
 {
@@ -502,30 +309,6 @@ ble_sm_id_addr_info_write(void *payload, int len,
     memcpy(u8ptr + 2, cmd->bd_addr, sizeof cmd->bd_addr);
 }
 
-int
-ble_sm_id_addr_info_tx(uint16_t conn_handle, struct ble_sm_id_addr_info *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    BLE_SM_LOG_CMD(1, "id addr info", conn_handle, ble_sm_id_addr_info_log,
-                   cmd);
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_id_addr_info), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    ble_sm_id_addr_info_write(txom->om_data, txom->om_len, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_id_addr_info_log(struct ble_sm_id_addr_info *cmd)
 {
@@ -552,29 +335,6 @@ ble_sm_sign_info_write(void *payload, int len, struct 
ble_sm_sign_info *cmd)
     memcpy(u8ptr + sizeof(struct ble_sm_hdr), cmd->sig_key, sizeof 
cmd->sig_key);
 }
 
-int
-ble_sm_sign_info_tx(uint16_t conn_handle, struct ble_sm_sign_info *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    BLE_SM_LOG_CMD(1, "sign info", conn_handle, ble_sm_sign_info_log, cmd);
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_sign_info), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    ble_sm_sign_info_write(txom->om_data, txom->om_len, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_sign_info_log(struct ble_sm_sign_info *cmd)
 {
@@ -606,29 +366,6 @@ ble_sm_sec_req_write(void *payload, int len, struct 
ble_sm_sec_req *cmd)
     u8ptr[1] = cmd->authreq;
 }
 
-int
-ble_sm_sec_req_tx(uint16_t conn_handle, struct ble_sm_sec_req *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_sec_req), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    ble_sm_sec_req_write(txom->om_data, txom->om_len, cmd);
-
-    BLE_SM_LOG_CMD(1, "sec req", conn_handle, ble_sm_sec_req_log, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_sec_req_log(struct ble_sm_sec_req *cmd)
 {
@@ -669,30 +406,6 @@ ble_sm_public_key_write(void *payload, int len, struct 
ble_sm_public_key *cmd)
     return 0;
 }
 
-int
-ble_sm_public_key_tx(uint16_t conn_handle, struct ble_sm_public_key *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_public_key), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    rc = ble_sm_public_key_write(txom->om_data, txom->om_len, cmd);
-    assert(rc == 0);
-
-    BLE_SM_LOG_CMD(1, "public key", conn_handle, ble_sm_public_key_log, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_public_key_log(struct ble_sm_public_key *cmd)
 {
@@ -729,30 +442,6 @@ ble_sm_dhkey_check_write(void *payload, int len,
     return 0;
 }
 
-int
-ble_sm_dhkey_check_tx(uint16_t conn_handle, struct ble_sm_dhkey_check *cmd)
-{
-    struct os_mbuf *txom;
-    int rc;
-
-    rc = ble_sm_init_req(sizeof(struct ble_sm_dhkey_check), &txom);
-    if (rc != 0) {
-        return BLE_HS_ENOMEM;
-    }
-
-    rc = ble_sm_dhkey_check_write(txom->om_data, txom->om_len, cmd);
-    assert(rc == 0);
-
-    BLE_SM_LOG_CMD(1, "dhkey check", conn_handle, ble_sm_dhkey_check_log, cmd);
-
-    rc = ble_sm_tx(conn_handle, txom);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 void
 ble_sm_dhkey_check_log(struct ble_sm_dhkey_check *cmd)
 {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4bdaa471/net/nimble/host/src/ble_sm_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_priv.h 
b/net/nimble/host/src/ble_sm_priv.h
index 6c2bc74..403772f 100644
--- a/net/nimble/host/src/ble_sm_priv.h
+++ b/net/nimble/host/src/ble_sm_priv.h
@@ -299,74 +299,57 @@ void ble_sm_pair_cmd_parse(void *payload, int len,
                            struct ble_sm_pair_cmd *cmd);
 void ble_sm_pair_cmd_write(void *payload, int len, int is_req,
                            struct ble_sm_pair_cmd *cmd);
-int ble_sm_pair_cmd_tx(uint16_t conn_handle, int is_req,
-                       struct ble_sm_pair_cmd *cmd);
 void ble_sm_pair_cmd_log(struct ble_sm_pair_cmd *cmd);
 void ble_sm_pair_confirm_parse(void *payload, int len,
                                struct ble_sm_pair_confirm *cmd);
 void ble_sm_pair_confirm_write(void *payload, int len,
                                struct ble_sm_pair_confirm *cmd);
-int ble_sm_pair_confirm_tx(uint16_t conn_handle,
-                           struct ble_sm_pair_confirm *cmd);
 void ble_sm_pair_confirm_log(struct ble_sm_pair_confirm *cmd);
 void ble_sm_pair_random_parse(void *payload, int len,
                               struct ble_sm_pair_random *cmd);
 void ble_sm_pair_random_write(void *payload, int len,
                               struct ble_sm_pair_random *cmd);
-int ble_sm_pair_random_tx(uint16_t conn_handle,
-                          struct ble_sm_pair_random *cmd);
 void ble_sm_pair_random_log(struct ble_sm_pair_random *cmd);
 void ble_sm_pair_fail_parse(void *payload, int len,
                             struct ble_sm_pair_fail *cmd);
 void ble_sm_pair_fail_write(void *payload, int len,
                             struct ble_sm_pair_fail *cmd);
-int ble_sm_pair_fail_tx(uint16_t conn_handle, uint8_t reason);
 void ble_sm_pair_fail_log(struct ble_sm_pair_fail *cmd);
 void ble_sm_enc_info_parse(void *payload, int len,
                            struct ble_sm_enc_info *cmd);
 void ble_sm_enc_info_write(void *payload, int len,
                            struct ble_sm_enc_info *cmd);
-int ble_sm_enc_info_tx(uint16_t conn_handle, struct ble_sm_enc_info *cmd);
 void ble_sm_enc_info_log(struct ble_sm_enc_info *cmd);
 void ble_sm_master_id_parse(void *payload, int len,
                             struct ble_sm_master_id *cmd);
 void ble_sm_master_id_write(void *payload, int len,
                             struct ble_sm_master_id *cmd);
-int ble_sm_master_id_tx(uint16_t conn_handle, struct ble_sm_master_id *cmd);
 void ble_sm_master_id_log(struct ble_sm_master_id *cmd);
 void ble_sm_id_info_parse(void *payload, int len, struct ble_sm_id_info *cmd);
-int ble_sm_id_info_tx(uint16_t conn_handle, struct ble_sm_id_info *cmd);
 void ble_sm_id_info_write(void *payload, int len, struct ble_sm_id_info *cmd);
 void ble_sm_id_info_log(struct ble_sm_id_info *cmd);
 void ble_sm_id_addr_info_parse(void *payload, int len,
                             struct ble_sm_id_addr_info *cmd);
-int ble_sm_id_addr_info_tx(uint16_t conn_handle,
-                           struct ble_sm_id_addr_info *cmd);
 void ble_sm_id_addr_info_write(void *payload, int len,
                                struct ble_sm_id_addr_info *cmd);
 void ble_sm_id_addr_info_log(struct ble_sm_id_addr_info *cmd);
 void ble_sm_sign_info_parse(void *payload, int len,
                             struct ble_sm_sign_info *cmd);
-int ble_sm_sign_info_tx(uint16_t conn_handle, struct ble_sm_sign_info *cmd);
 void ble_sm_sign_info_write(void *payload, int len,
                             struct ble_sm_sign_info *cmd);
 void ble_sm_sign_info_log(struct ble_sm_sign_info *cmd);
 void ble_sm_sec_req_parse(void *payload, int len, struct ble_sm_sec_req *cmd);
 void ble_sm_sec_req_write(void *payload, int len, struct ble_sm_sec_req *cmd);
-int ble_sm_sec_req_tx(uint16_t conn_handle, struct ble_sm_sec_req *cmd);
 void ble_sm_sec_req_log(struct ble_sm_sec_req *cmd);
 void ble_sm_public_key_parse(void *payload, int len,
                              struct ble_sm_public_key *cmd);
 int ble_sm_public_key_write(void *payload, int len,
                             struct ble_sm_public_key *cmd);
-int ble_sm_public_key_tx(uint16_t conn_handle, struct ble_sm_public_key *cmd);
 void ble_sm_public_key_log(struct ble_sm_public_key *cmd);
 void ble_sm_dhkey_check_parse(void *payload, int len,
                               struct ble_sm_dhkey_check *cmd);
 int ble_sm_dhkey_check_write(void *payload, int len,
                              struct ble_sm_dhkey_check *cmd);
-int ble_sm_dhkey_check_tx(uint16_t conn_handle,
-                          struct ble_sm_dhkey_check *cmd);
 void ble_sm_dhkey_check_log(struct ble_sm_dhkey_check *cmd);
 
 int ble_sm_alg_s1(uint8_t *k, uint8_t *r1, uint8_t *r2, uint8_t *out);

Reply via email to