summaryrefslogtreecommitdiff
path: root/mesh/cfgmod-server.c
diff options
context:
space:
mode:
authorMichaƂ Lowas-Rzechonek <michal.lowas-rzechonek@silvair.com>2019-07-04 14:33:36 +0200
committerBrian Gix <brian.gix@intel.com>2019-07-04 10:18:44 -0700
commit9dfc56d7d4e73da42b3f4c81728ec57f5ac1c4f9 (patch)
tree05cc5d324ddd019be87d21e0a43623973e0eecb2 /mesh/cfgmod-server.c
parente3c5b38f0943846d2322062d9d9140c32f0847b8 (diff)
downloadbluez-9dfc56d7d4e73da42b3f4c81728ec57f5ac1c4f9.tar.gz
mesh: Split APP_IDX_DEV into APP_IDX_DEV_LOCAL and APP_IDX_DEV_REMOTE
This is needed to distinguish incoming messages encrypted using a device key: if the key is local, the message can be forwarded to internal models. If the key is a known remote one, it will be forwarded to the application via DevKeyMessageReceived() API.
Diffstat (limited to 'mesh/cfgmod-server.c')
-rw-r--r--mesh/cfgmod-server.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index bb78cead6..a19ddc72e 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -69,7 +69,8 @@ static void send_pub_status(struct mesh_node *node, uint16_t src, uint16_t dst,
n += 2;
}
- mesh_model_send(node, dst, src, APP_IDX_DEV, DEFAULT_TTL, msg, n);
+ mesh_model_send(node, dst, src, APP_IDX_DEV_LOCAL, DEFAULT_TTL,
+ msg, n);
}
static bool config_pub_get(struct mesh_node *node, uint16_t src, uint16_t dst,
@@ -254,7 +255,7 @@ static void send_sub_status(struct mesh_node *node, uint16_t src, uint16_t dst,
n += 2;
}
- mesh_model_send(node, dst, src, APP_IDX_DEV, DEFAULT_TTL, msg, n);
+ mesh_model_send(node, dst, src, APP_IDX_DEV_LOCAL, DEFAULT_TTL, msg, n);
}
static bool config_sub_get(struct mesh_node *node, uint16_t src, uint16_t dst,
@@ -312,7 +313,7 @@ static bool config_sub_get(struct mesh_node *node, uint16_t src, uint16_t dst,
*msg_status = (uint8_t) status;
- mesh_model_send(node, dst, src, APP_IDX_DEV, DEFAULT_TTL, msg, n);
+ mesh_model_send(node, dst, src, APP_IDX_DEV_LOCAL, DEFAULT_TTL, msg, n);
return true;
}
@@ -487,7 +488,7 @@ static void send_model_app_status(struct mesh_node *node, uint16_t src,
l_put_le16(id, msg + n);
n += 2;
- mesh_model_send(node, dst, src, APP_IDX_DEV, DEFAULT_TTL, msg, n);
+ mesh_model_send(node, dst, src, APP_IDX_DEV_LOCAL, DEFAULT_TTL, msg, n);
}
static void model_app_list(struct mesh_node *node, uint16_t src, uint16_t dst,
@@ -540,7 +541,7 @@ static void model_app_list(struct mesh_node *node, uint16_t src, uint16_t dst,
if (result >= 0) {
*status = result;
- mesh_model_send(node, dst, src, APP_IDX_DEV, DEFAULT_TTL,
+ mesh_model_send(node, dst, src, APP_IDX_DEV_LOCAL, DEFAULT_TTL,
msg, n);
}
@@ -758,7 +759,7 @@ static bool cfg_srv_pkt(uint16_t src, uint32_t dst,
uint16_t interval;
uint16_t n;
- if (idx != APP_IDX_DEV)
+ if (idx != APP_IDX_DEV_LOCAL)
return false;
if (mesh_model_opcode_get(pkt, size, &opcode, &n)) {
@@ -1259,7 +1260,7 @@ static bool cfg_srv_pkt(uint16_t src, uint32_t dst,
if (n) {
/* print_packet("App Tx", long_msg ? long_msg : msg, n); */
mesh_model_send(node, unicast, src,
- APP_IDX_DEV, DEFAULT_TTL,
+ APP_IDX_DEV_LOCAL, DEFAULT_TTL,
long_msg ? long_msg : msg, n);
}
l_free(long_msg);