Lines Matching refs:sub

183 		.sub = rx->sub,  in send_filter_status()
321 struct bt_mesh_subnet *sub) in beacon_send() argument
330 err = bt_mesh_beacon_create(sub, &buf, client->privacy); in beacon_send()
332 err = bt_mesh_beacon_create(sub, &buf, false); in beacon_send()
342 static bool send_beacon_cb(struct bt_mesh_subnet *sub, void *cb_data) in send_beacon_cb() argument
346 return beacon_send(client, sub) != 0; in send_beacon_cb()
358 void bt_mesh_proxy_beacon_send(struct bt_mesh_subnet *sub) in bt_mesh_proxy_beacon_send() argument
362 if (!sub) { in bt_mesh_proxy_beacon_send()
370 beacon_send(&clients[i], sub); in bt_mesh_proxy_beacon_send()
375 static void identity_enabled(struct bt_mesh_subnet *sub) in identity_enabled() argument
377 sub->node_id = BT_MESH_NODE_IDENTITY_RUNNING; in identity_enabled()
378 sub->node_id_start = k_uptime_get_32(); in identity_enabled()
382 cb->identity_enabled(sub->net_idx); in identity_enabled()
387 static void node_id_start(struct bt_mesh_subnet *sub) in node_id_start() argument
390 sub->priv_beacon_ctx.node_id = false; in node_id_start()
393 identity_enabled(sub); in node_id_start()
396 static void private_node_id_start(struct bt_mesh_subnet *sub) in private_node_id_start() argument
399 sub->priv_beacon_ctx.node_id = true; in private_node_id_start()
402 identity_enabled(sub); in private_node_id_start()
405 void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub, bool private) in bt_mesh_proxy_identity_start() argument
408 private_node_id_start(sub); in bt_mesh_proxy_identity_start()
410 node_id_start(sub); in bt_mesh_proxy_identity_start()
414 beacon_sub = sub; in bt_mesh_proxy_identity_start()
417 void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub) in bt_mesh_proxy_identity_stop() argument
419 sub->node_id = BT_MESH_NODE_IDENTITY_STOPPED; in bt_mesh_proxy_identity_stop()
420 sub->node_id_start = 0U; in bt_mesh_proxy_identity_stop()
424 cb->identity_disabled(sub->net_idx); in bt_mesh_proxy_identity_stop()
492 static int enc_id_adv(struct bt_mesh_subnet *sub, uint8_t type, in enc_id_adv() argument
510 err = bt_mesh_encrypt(&sub->keys[SUBNET_KEY_TX_IDX(sub)].identity, hash, hash); in enc_id_adv()
546 static int node_id_adv(struct bt_mesh_subnet *sub, int32_t duration) in node_id_adv() argument
552 LOG_DBG("0x%03x", sub->net_idx); in node_id_adv()
563 return enc_id_adv(sub, BT_MESH_ID_TYPE_NODE, tmp, duration); in node_id_adv()
566 static int priv_node_id_adv(struct bt_mesh_subnet *sub, int32_t duration) in priv_node_id_adv() argument
572 LOG_DBG("0x%03x", sub->net_idx); in priv_node_id_adv()
584 return enc_id_adv(sub, BT_MESH_ID_TYPE_PRIV_NODE, tmp, duration); in priv_node_id_adv()
587 static int priv_net_id_adv(struct bt_mesh_subnet *sub, int32_t duration) in priv_net_id_adv() argument
593 LOG_DBG("0x%03x", sub->net_idx); in priv_net_id_adv()
600 memcpy(&tmp[0], sub->keys[SUBNET_KEY_TX_IDX(sub)].net_id, 8); in priv_net_id_adv()
603 return enc_id_adv(sub, BT_MESH_ID_TYPE_PRIV_NET, tmp, duration); in priv_net_id_adv()
606 static int net_id_adv(struct bt_mesh_subnet *sub, int32_t duration) in net_id_adv() argument
618 LOG_DBG("Advertising with NetId %s", bt_hex(sub->keys[SUBNET_KEY_TX_IDX(sub)].net_id, 8)); in net_id_adv()
620 memcpy(proxy_svc_data + 3, sub->keys[SUBNET_KEY_TX_IDX(sub)].net_id, 8); in net_id_adv()
641 static bool is_sub_proxy_active(struct bt_mesh_subnet *sub) in is_sub_proxy_active() argument
643 if (sub->net_idx == BT_MESH_KEY_UNUSED) { in is_sub_proxy_active()
647 return (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING || in is_sub_proxy_active()
649 (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited) || in is_sub_proxy_active()
655 static bool active_proxy_sub_cnt_cb(struct bt_mesh_subnet *sub, void *cb_data) in active_proxy_sub_cnt_cb() argument
659 if (is_sub_proxy_active(sub)) { in active_proxy_sub_cnt_cb()
678 static void proxy_adv_timeout_eval(struct bt_mesh_subnet *sub) in proxy_adv_timeout_eval() argument
682 if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) { in proxy_adv_timeout_eval()
683 time_passed = k_uptime_get_32() - sub->node_id_start; in proxy_adv_timeout_eval()
685 bt_mesh_proxy_identity_stop(sub); in proxy_adv_timeout_eval()
686 LOG_DBG("Node ID stopped for subnet %d after %dms", sub->net_idx, in proxy_adv_timeout_eval()
692 if (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited && sub->priv_net_id_sent) { in proxy_adv_timeout_eval()
693 time_passed = k_uptime_get_32() - sub->priv_net_id_sent; in proxy_adv_timeout_eval()
695 sub->priv_net_id_sent = 0; in proxy_adv_timeout_eval()
696 sub->solicited = false; in proxy_adv_timeout_eval()
699 sub->net_idx, time_passed); in proxy_adv_timeout_eval()
718 static bool proxy_adv_request_get(struct bt_mesh_subnet *sub, struct proxy_adv_request *request) in proxy_adv_request_get() argument
720 if (!sub) { in proxy_adv_request_get()
724 if (sub->net_idx == BT_MESH_KEY_UNUSED) { in proxy_adv_request_get()
736 if (bt_mesh_od_priv_proxy_get() > 0 && sub->solicited) { in proxy_adv_request_get()
740 request->duration = !sub->priv_net_id_sent in proxy_adv_request_get()
742 : timeout - (k_uptime_get_32() - sub->priv_net_id_sent); in proxy_adv_request_get()
747 if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) { in proxy_adv_request_get()
748 request->duration = NODE_ID_TIMEOUT - (k_uptime_get_32() - sub->node_id_start); in proxy_adv_request_get()
751 sub->priv_beacon_ctx.node_id ? PRIV_NODE_ID : in proxy_adv_request_get()
791 struct bt_mesh_subnet *sub; member
801 struct bt_mesh_subnet *sub; in gatt_proxy_advertise() local
833 proxy_adv_request_get(sub_adv.sub, &request) && in gatt_proxy_advertise()
839 sub = sub_adv.sub; in gatt_proxy_advertise()
846 sub = adv_sub_get_next(sub_adv.sub, &request); in gatt_proxy_advertise()
847 if (!sub) { in gatt_proxy_advertise()
860 sub_adv.sub = sub; in gatt_proxy_advertise()
865 err = net_id_adv(sub, request.duration); in gatt_proxy_advertise()
869 if (!sub->priv_net_id_sent) { in gatt_proxy_advertise()
870 sub->priv_net_id_sent = k_uptime_get(); in gatt_proxy_advertise()
875 err = priv_net_id_adv(sub, request.duration); in gatt_proxy_advertise()
878 err = node_id_adv(sub, request.duration); in gatt_proxy_advertise()
881 err = priv_node_id_adv(sub, request.duration); in gatt_proxy_advertise()
893 LOG_DBG("Advertising %d ms for net_idx 0x%04x", request.duration, sub->net_idx); in gatt_proxy_advertise()
897 static void subnet_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt) in subnet_evt() argument
900 if (sub == beacon_sub) { in subnet_evt()
904 bt_mesh_proxy_beacon_send(sub); in subnet_evt()
1124 static void solicitation_reset(struct bt_mesh_subnet *sub) in solicitation_reset() argument
1127 sub->solicited = false; in solicitation_reset()
1128 sub->priv_net_id_sent = 0; in solicitation_reset()