node_remove(node);
}
-static bool cfg_srv_pkt(uint16_t src, uint32_t dst, uint16_t unicast,
- uint16_t app_idx, uint16_t net_idx,
- const uint8_t *data, uint16_t size,
- uint8_t ttl, const void *user_data)
+static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx,
+ uint16_t net_idx, const uint8_t *data,
+ uint16_t size, const void *user_data)
{
struct mesh_node *node = (struct mesh_node *) user_data;
struct mesh_net *net;
if (size != 25 && size != 27)
return true;
- config_pub_set(node, net_idx, src, unicast, pkt, 14, size == 27,
+ config_pub_set(node, net_idx, src, dst, pkt, 14, size == 27,
!!(opcode & OP_UNRELIABLE));
break;
if (size != 11 && size != 13)
return true;
- config_pub_set(node, net_idx, src, unicast, pkt, 0, size == 13,
+ config_pub_set(node, net_idx, src, dst, pkt, 0, size == 13,
!!(opcode & OP_UNRELIABLE));
break;
case OP_CONFIG_MODEL_PUB_GET:
- config_pub_get(node, net_idx, src, unicast, pkt, size);
+ config_pub_get(node, net_idx, src, dst, pkt, size);
break;
case OP_CONFIG_VEND_MODEL_SUB_GET:
if (size != 6)
return true;
- config_sub_get(node, net_idx, src, unicast, pkt, size);
+ config_sub_get(node, net_idx, src, dst, pkt, size);
break;
case OP_CONFIG_MODEL_SUB_GET:
if (size != 4)
return true;
- config_sub_get(node, net_idx, src, unicast, pkt, size);
+ config_sub_get(node, net_idx, src, dst, pkt, size);
break;
case OP_CONFIG_MODEL_SUB_VIRT_OVERWRITE:
case OP_CONFIG_MODEL_SUB_DELETE:
case OP_CONFIG_MODEL_SUB_ADD:
case OP_CONFIG_MODEL_SUB_DELETE_ALL:
- config_sub_set(node, net_idx, src, unicast, pkt, size, virt,
+ config_sub_set(node, net_idx, src, dst, pkt, size, virt,
opcode);
break;
case OP_MODEL_APP_BIND:
case OP_MODEL_APP_UNBIND:
- model_app_bind(node, net_idx, src, unicast, pkt, size,
+ model_app_bind(node, net_idx, src, dst, pkt, size,
opcode != OP_MODEL_APP_BIND);
break;
case OP_VEND_MODEL_APP_GET:
if (size != 6)
return true;
- model_app_list(node, net_idx, src, unicast, pkt, size);
+ model_app_list(node, net_idx, src, dst, pkt, size);
break;
case OP_MODEL_APP_GET:
if (size != 4)
return true;
- model_app_list(node, net_idx, src, unicast, pkt, size);
+ model_app_list(node, net_idx, src, dst, pkt, size);
break;
case OP_CONFIG_HEARTBEAT_PUB_SET:
case OP_NODE_RESET:
n = mesh_model_opcode_set(OP_NODE_RESET_STATUS, msg);
/*
- * delay node removal to give it a chance to send back the
+ * Delay node removal to give it a chance to send back the
* status
*/
l_timeout_create(1, node_reset, node, NULL);
if (n) {
/* print_packet("App Tx", long_msg ? long_msg : msg, n); */
- mesh_model_send(node, unicast, src,
+ mesh_model_send(node, dst, src,
APP_IDX_DEV_LOCAL, net_idx, DEFAULT_TTL,
long_msg ? long_msg : msg, n);
}
uint16_t app_idx;
uint16_t net_idx;
uint16_t size;
- uint8_t ttl;
int8_t rssi;
bool szmict;
bool has_dst;
uint16_t dst;
bool result;
- l_debug("model %8.8x with idx %3.3x", mod->id, fwd->app_idx);
-
if (fwd->app_idx != APP_IDX_DEV_LOCAL &&
fwd->app_idx != APP_IDX_DEV_REMOTE &&
!has_binding(mod->bindings, fwd->app_idx))
return;
dst = fwd->dst;
- if (dst == fwd->unicast || IS_FIXED_GROUP_ADDRESS(dst))
+
+ if (dst == fwd->unicast || IS_FIXED_GROUP_ADDRESS(dst)) {
fwd->has_dst = true;
- else if (fwd->virt) {
+ } else if (fwd->virt) {
virt = l_queue_find(mod->virtuals, simple_match, fwd->virt);
if (virt) {
fwd->has_dst = true;
result = false;
if (mod->cbs->recv)
- result = mod->cbs->recv(fwd->src, dst, fwd->unicast,
- fwd->app_idx, fwd->net_idx,
- fwd->data, fwd->size, fwd->ttl, mod->user_data);
+ result = mod->cbs->recv(fwd->src, dst, fwd->app_idx,
+ fwd->net_idx,
+ fwd->data, fwd->size, mod->user_data);
if (dst == fwd->unicast && result)
fwd->done = true;
}
bool mesh_model_rx(struct mesh_node *node, bool szmict, uint32_t seq0,
- uint32_t seq, uint32_t iv_index, uint8_t ttl,
+ uint32_t seq, uint32_t iv_index,
uint16_t net_idx, uint16_t src, uint16_t dst,
uint8_t key_aid, const uint8_t *data, uint16_t size)
{
.dst = dst,
.data = NULL,
.size = size - (szmict ? 8 : 4),
- .ttl = ttl,
.virt = NULL,
};
struct mesh_net *net = node_get_net(node);
};
typedef void (*mesh_model_unregister)(void *user_data);
-typedef bool (*mesh_model_recv_cb)(uint16_t src, uint32_t dst, uint16_t unicast,
+typedef bool (*mesh_model_recv_cb)(uint16_t src, uint16_t unicast,
uint16_t app_idx, uint16_t net_idx,
- const uint8_t *data,
- uint16_t len, uint8_t ttl,
+ const uint8_t *data, uint16_t len,
const void *user_data);
typedef int (*mesh_model_bind_cb)(uint16_t app_idx, int action);
typedef int (*mesh_model_pub_cb)(struct mesh_model_pub *pub);
int mesh_model_publish(struct mesh_node *node, uint32_t mod_id, uint16_t src,
uint8_t ttl, const void *msg, uint16_t msg_len);
bool mesh_model_rx(struct mesh_node *node, bool szmict, uint32_t seq0,
- uint32_t seq, uint32_t iv_index, uint8_t ttl,
- uint16_t net_idx, uint16_t src, uint16_t dst,
- uint8_t key_aid, const uint8_t *data, uint16_t size);
+ uint32_t seq, uint32_t iv_index, uint16_t net_idx,
+ uint16_t src, uint16_t dst, uint8_t key_aid,
+ const uint8_t *data, uint16_t size);
void mesh_model_app_key_generate_new(struct mesh_node *node, uint16_t net_idx);
void mesh_model_app_key_delete(struct mesh_node *node, struct l_queue *models,
uint16_t idx);