@@ -2358,6 +2358,7 @@ static bool ctl_rxed(struct mesh_net *net, uint32_t net_key_id,
uint8_t rsp_ttl = DEFAULT_TTL;
uint8_t n = 0;
uint16_t net_idx;
+ int i;
/* TODO: If length is greater than 11, it must be segmented, so it must
* be able to handle Segmented Control messages when acting as a friend
@@ -2474,6 +2475,10 @@ static bool ctl_rxed(struct mesh_net *net, uint32_t net_key_id,
net->hb_sub.max_hops);
}
break;
+ case 0x4F:
+ l_debug("Get ctl message len: %d", len);
+ print_packet("Test RX", pkt, len);
+ break;
}
if (n)
@@ -3277,6 +3282,8 @@ bool mesh_net_set_key(struct mesh_net *net, uint16_t idx, const uint8_t *key,
return true;
}
+static void mesh_net_test_seg_transport_send(struct l_timeout *test_timeout, void *user_data);
+
bool mesh_net_attach(struct mesh_net *net, struct mesh_io *io)
{
bool first;
@@ -3311,6 +3318,8 @@ bool mesh_net_attach(struct mesh_net *net, struct mesh_io *io)
net->io = io;
+ l_timeout_create(10, mesh_net_test_seg_transport_send, net, NULL);
+
return true;
}
@@ -3693,6 +3702,34 @@ void mesh_net_ack_send(struct mesh_net *net, uint32_t net_key_id,
print_packet("TX: Friend ACK", pkt + 1, pkt_len);
}
+#define LOCAL 0x1001
+#define REMOTE 0x1003
+
+static void mesh_net_test_seg_transport_send(struct l_timeout *test_timeout, void *user_data)
+{
+ struct mesh_net *net = user_data;
+ uint32_t hdr;
+ uint8_t msg[33];
+ uint32_t hexa = 0xDEADBEEF;
+ int n = 0;
+ int i;
+
+ l_timeout_remove(test_timeout);
+
+ hdr = (0x4F << OPCODE_HDR_SHIFT) | ((uint32_t) 0x1 << SEG_HDR_SHIFT);
+ l_put_be32(hdr, msg);
+ l_debug("Send ctl message len: %d", 32);
+ for (i = 1; i < 33; i += 4) {
+ l_put_be32(hexa, msg + i);
+ }
+ print_packet("Test TX", msg + 1, sizeof(msg) - 1);
+ mesh_net_transport_send(net, 0, 0, mesh_net_get_iv_index(net),
+ 20, 0, 0, LOCAL, msg, sizeof(msg));
+ mesh_net_transport_send(net, 0, 0, mesh_net_get_iv_index(net),
+ 20, 0, 0, REMOTE, msg, sizeof(msg));
+ l_timeout_create(15, mesh_net_test_seg_transport_send, net, NULL);
+}
+
void mesh_net_transport_send(struct mesh_net *net, uint32_t net_key_id,
uint16_t net_idx, uint32_t iv_index,
uint8_t ttl, uint32_t seq, uint16_t src,