mesh: Remove unused functions from net.c
authorInga Stotland <inga.stotland@intel.com>
Sun, 31 May 2020 04:41:28 +0000 (21:41 -0700)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Fri, 18 Dec 2020 05:40:30 +0000 (11:10 +0530)
The folllowing functionsa are not being used anywhere in the code and
have been removed:
mesh_net_flush()
mesh_net_prov_caps_get()
mesh_net_priv_key_get()
mesh_net_priv_key_set()
mesh_net_prov_rand()
mesh_net_prov_uni()
mesh_net_id_uuid_set()
mesh_net_test_addr()
mesh_net_test_mode()
mesh_net_uni_range_set()
mesh_net_uni_range_get()
mesh_net_set_window_accuracy()

Change-Id: Id8226cd2349d4a8b5dbd2e95ff976b5d2c04a692
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
mesh/net.c
mesh/net.h

index 031c7cf..1d426fe 100644 (file)
@@ -122,7 +122,6 @@ struct mesh_net {
        uint8_t chan; /* Channel of recent Rx */
        uint8_t default_ttl;
        uint8_t tid;
-       uint8_t window_accuracy;
 
        struct {
                bool enable;
@@ -142,21 +141,6 @@ struct mesh_net {
        struct l_queue *friends;
        struct l_queue *negotiations;
        struct l_queue *destinations;
-
-       uint8_t prov_priv_key[32];
-
-       /* Unprovisioned Identity */
-       char id_name[20];
-       uint8_t id_uuid[16];
-
-       /* Provisioner: unicast address range */
-       struct mesh_net_addr_range prov_uni_addr;
-
-       /* Test Data */
-       uint8_t prov_rand[16];
-       uint8_t test_bd_addr[6];
-       struct mesh_net_prov_caps prov_caps;
-       bool test_mode;
 };
 
 struct mesh_msg {
@@ -646,9 +630,6 @@ struct mesh_net *mesh_net_new(struct mesh_node *node)
        net->seq_num = DEFAULT_SEQUENCE_NUMBER;
        net->default_ttl = TTL_MASK;
 
-       memset(&net->prov_caps, 0, sizeof(net->prov_caps));
-       net->prov_caps.algorithms = 1;
-
        net->tx_cnt = DEFAULT_TRANSMIT_COUNT;
        net->tx_interval = DEFAULT_TRANSMIT_INTERVAL;
 
@@ -827,93 +808,6 @@ bool mesh_net_set_relay_mode(struct mesh_net *net, bool enable,
        return true;
 }
 
-struct mesh_net_prov_caps *mesh_net_prov_caps_get(struct mesh_net *net)
-{
-       if (net)
-               return &net->prov_caps;
-
-       return NULL;
-}
-
-char *mesh_net_id_name(struct mesh_net *net)
-{
-       if (net && net->id_name[0])
-               return net->id_name;
-
-       return NULL;
-}
-
-bool mesh_net_id_uuid_set(struct mesh_net *net, uint8_t uuid[16])
-{
-       if (!net)
-               return false;
-
-       memcpy(net->id_uuid, uuid, 16);
-
-       return true;
-}
-
-uint8_t *mesh_net_priv_key_get(struct mesh_net *net)
-{
-       if (net)
-               return net->prov_priv_key;
-
-       return NULL;
-}
-
-bool mesh_net_priv_key_set(struct mesh_net *net, uint8_t key[32])
-{
-       if (!net)
-               return false;
-
-       memcpy(net->prov_priv_key, key, 32);
-       return true;
-}
-
-uint8_t *mesh_net_test_addr(struct mesh_net *net)
-{
-       const uint8_t zero_addr[] = {0, 0, 0, 0, 0, 0};
-
-       if (net && memcmp(net->test_bd_addr, zero_addr, 6))
-               return net->test_bd_addr;
-
-       return NULL;
-}
-
-uint8_t *mesh_net_prov_rand(struct mesh_net *net)
-{
-       if (net)
-               return net->prov_rand;
-
-       return NULL;
-}
-
-uint16_t mesh_net_prov_uni(struct mesh_net *net, uint8_t ele_cnt)
-{
-       uint16_t uni;
-       uint16_t next;
-
-       if (!net)
-               return 0;
-
-       next = net->prov_uni_addr.next + ele_cnt;
-       if (next > 0x8000 || next > net->prov_uni_addr.high)
-               return UNASSIGNED_ADDRESS;
-
-       uni = net->prov_uni_addr.next;
-       net->prov_uni_addr.next = next;
-
-       return uni;
-}
-
-bool mesh_net_test_mode(struct mesh_net *net)
-{
-       if (net)
-               return net->test_mode;
-
-       return false;
-}
-
 int mesh_net_get_identity_mode(struct mesh_net *net, uint16_t idx,
                                                                uint8_t *mode)
 {
@@ -1024,11 +918,6 @@ int mesh_net_add_key(struct mesh_net *net, uint16_t idx, const uint8_t *value)
        return MESH_STATUS_SUCCESS;
 }
 
-void mesh_net_flush_msg_queues(struct mesh_net *net)
-{
-       l_queue_clear(net->msg_cache, l_free);
-}
-
 uint32_t mesh_net_get_iv_index(struct mesh_net *net)
 {
        if (!net)
@@ -2541,7 +2430,7 @@ static void iv_upd_to(struct l_timeout *upd_timeout, void *user_data)
                                                        net->iv_index, false);
                l_queue_foreach(net->subnets, refresh_beacon, net);
                queue_friend_update(net);
-               mesh_net_flush_msg_queues(net);
+               l_queue_clear(net->msg_cache, l_free);
                break;
 
        case IV_UPD_INIT:
@@ -2935,7 +2824,7 @@ bool mesh_net_iv_index_update(struct mesh_net *net)
                return false;
 
        l_debug("iv_upd_state = IV_UPD_UPDATING");
-       mesh_net_flush_msg_queues(net);
+       l_queue_clear(net->msg_cache, l_free);
 
        if (!mesh_config_write_iv_index(node_config_get(net->node),
                                                net->iv_index + 1, true))
@@ -2997,15 +2886,6 @@ bool mesh_net_dst_unreg(struct mesh_net *net, uint16_t dst)
        return true;
 }
 
-bool mesh_net_flush(struct mesh_net *net)
-{
-       if (!net)
-               return false;
-
-       /* TODO mesh-io Flush */
-       return true;
-}
-
 static bool send_seg(struct mesh_net *net, struct mesh_sar *msg, uint8_t segO)
 {
        struct mesh_subnet *subnet;
@@ -3428,7 +3308,7 @@ int mesh_net_update_key(struct mesh_net *net, uint16_t idx,
        return MESH_STATUS_SUCCESS;
 }
 
-uint16_t mesh_net_get_features(struct mesh_net *net)
+static uint16_t get_features(struct mesh_net *net)
 {
        uint16_t features = 0;
 
@@ -3471,20 +3351,7 @@ void mesh_net_heartbeat_init(struct mesh_net *net)
 
        memset(hb, 0, sizeof(struct mesh_net_heartbeat));
        hb->sub_min_hops = 0xff;
-       hb->features = mesh_net_get_features(net);
-}
-
-void mesh_net_uni_range_set(struct mesh_net *net,
-                               struct mesh_net_addr_range *range)
-{
-       net->prov_uni_addr.low = range->low;
-       net->prov_uni_addr.high = range->high;
-       net->prov_uni_addr.next = range->next;
-}
-
-struct mesh_net_addr_range mesh_net_uni_range_get(struct mesh_net *net)
-{
-       return net->prov_uni_addr;
+       hb->features = get_features(net);
 }
 
 void mesh_net_set_iv_index(struct mesh_net *net, uint32_t index, bool update)
@@ -3580,14 +3447,6 @@ bool mesh_net_is_local_address(struct mesh_net *net, uint16_t src,
                        (last >= net->src_addr && last <= net->last_addr);
 }
 
-void mesh_net_set_window_accuracy(struct mesh_net *net, uint8_t accuracy)
-{
-       if (!net)
-               return;
-
-       net->window_accuracy = accuracy;
-}
-
 void mesh_net_transmit_params_set(struct mesh_net *net, uint8_t count,
                                                        uint16_t interval)
 {
index 12808ce..84e7c15 100644 (file)
@@ -120,12 +120,6 @@ struct mesh_node;
 #define DEFAULT_MIN_DELAY              0
 #define DEFAULT_MAX_DELAY              25
 
-struct mesh_net_addr_range {
-       uint16_t low;
-       uint16_t high;
-       uint16_t next;
-};
-
 struct mesh_net_prov_caps {
        uint8_t num_ele;
        uint16_t algorithms;
@@ -264,7 +258,6 @@ typedef void (*mesh_status_func_t)(void *user_data, bool result);
 struct mesh_net *mesh_net_new(struct mesh_node *node);
 void mesh_net_free(void *net);
 void mesh_net_cleanup(void);
-void mesh_net_flush_msg_queues(struct mesh_net *net);
 void mesh_net_set_iv_index(struct mesh_net *net, uint32_t index, bool update);
 bool mesh_net_iv_index_update(struct mesh_net *net);
 bool mesh_net_set_seq_num(struct mesh_net *net, uint32_t number);
@@ -300,7 +293,6 @@ bool mesh_net_attach(struct mesh_net *net, struct mesh_io *io);
 struct mesh_io *mesh_net_detach(struct mesh_net *net);
 struct l_queue *mesh_net_get_app_keys(struct mesh_net *net);
 
-bool mesh_net_flush(struct mesh_net *net);
 void mesh_net_transport_send(struct mesh_net *net, uint32_t key_id,
                                uint16_t net_idx, uint32_t iv_index,
                                uint8_t ttl, uint32_t seq, uint16_t src,
@@ -316,17 +308,9 @@ void mesh_net_ack_send(struct mesh_net *net, uint32_t key_id,
                                uint32_t iv_index, uint8_t ttl, uint32_t seq,
                                uint16_t src, uint16_t dst, bool rly,
                                uint16_t seqZero, uint32_t ack_flags);
-struct mesh_net_prov_caps *mesh_net_prov_caps_get(struct mesh_net *net);
-uint8_t *mesh_net_priv_key_get(struct mesh_net *net);
-bool mesh_net_priv_key_set(struct mesh_net *net, uint8_t key[32]);
-uint8_t *mesh_net_prov_rand(struct mesh_net *net);
-uint16_t mesh_net_prov_uni(struct mesh_net *net, uint8_t ele_cnt);
-bool mesh_net_id_uuid_set(struct mesh_net *net, uint8_t uuid[16]);
-uint8_t *mesh_net_test_addr(struct mesh_net *net);
 int mesh_net_get_identity_mode(struct mesh_net *net, uint16_t idx,
                                                                uint8_t *mode);
 char *mesh_net_id_name(struct mesh_net *net);
-bool mesh_net_test_mode(struct mesh_net *net);
 bool mesh_net_dst_reg(struct mesh_net *net, uint16_t dst);
 bool mesh_net_dst_unreg(struct mesh_net *net, uint16_t dst);
 struct mesh_friend *mesh_friend_new(struct mesh_net *net, uint16_t dst,
@@ -348,13 +332,9 @@ void mesh_net_send_seg(struct mesh_net *net, uint32_t key_id,
                                uint32_t iv_index, uint8_t ttl, uint32_t seq,
                                uint16_t src, uint16_t dst, uint32_t hdr,
                                const void *seg, uint16_t seg_len);
-uint16_t mesh_net_get_features(struct mesh_net *net);
 struct mesh_net_heartbeat *mesh_net_heartbeat_get(struct mesh_net *net);
 void mesh_net_heartbeat_init(struct mesh_net *net);
 void mesh_net_heartbeat_send(struct mesh_net *net);
-void mesh_net_uni_range_set(struct mesh_net *net,
-                               struct mesh_net_addr_range *range);
-struct mesh_net_addr_range mesh_net_uni_range_get(struct mesh_net *net);
 void mesh_net_provisioner_mode_set(struct mesh_net *net, bool mode);
 bool mesh_net_provisioner_mode_get(struct mesh_net *net);
 bool mesh_net_key_list_get(struct mesh_net *net, uint8_t *buf, uint16_t *count);
@@ -365,7 +345,6 @@ struct mesh_node *mesh_net_node_get(struct mesh_net *net);
 bool mesh_net_have_key(struct mesh_net *net, uint16_t net_idx);
 bool mesh_net_is_local_address(struct mesh_net *net, uint16_t src,
                                                        uint16_t count);
-void mesh_net_set_window_accuracy(struct mesh_net *net, uint8_t accuracy);
 void mesh_net_transmit_params_set(struct mesh_net *net, uint8_t count,
                                                        uint16_t interval);
 void mesh_net_transmit_params_get(struct mesh_net *net, uint8_t *count,