1
0
mirror of https://github.com/bluekitchen/btstack.git synced 2025-03-28 19:20:54 +00:00

mesh: move sequence number to mesh_iv_index_seq_number

This commit is contained in:
Matthias Ringwald 2019-07-10 12:32:34 +02:00
parent 2e60b5d9a3
commit 04875b115d
7 changed files with 118 additions and 17 deletions

@ -45,6 +45,7 @@
#include "btstack_memory.h"
#include "mesh_peer.h"
#include "mesh_lower_transport.h"
#include "mesh_iv_index_seq_number.h"
static uint16_t primary_element_address;
static void (*higher_layer_handler)( mesh_transport_callback_type_t callback_type, mesh_transport_status_t status, mesh_pdu_t * pdu);
@ -670,18 +671,6 @@ static void mesh_lower_transport_run(void){
}
}
uint32_t mesh_lower_transport_next_seq(void){
return lower_transport_seq++;
}
uint32_t mesh_lower_transport_peek_seq(void){
return lower_transport_seq;
}
void mesh_lower_transport_set_seq(uint32_t seq){
lower_transport_seq = seq;
}
static void mesh_lower_transport_dump_network_pdus(const char *name, btstack_linked_list_t *list){
printf("List: %s:\n", name);
btstack_linked_list_iterator_t it;

@ -97,10 +97,6 @@ void mesh_lower_transport_init();
void mesh_lower_transport_set_primary_element_address(uint16_t unicast_address);
void mesh_lower_transport_set_higher_layer_handler(void (*pdu_handler)( mesh_transport_callback_type_t callback_type, mesh_transport_status_t status, mesh_pdu_t * pdu));
void mesh_lower_transport_set_seq(uint32_t seq);
uint32_t mesh_lower_transport_next_seq(void);;
uint32_t mesh_lower_transport_peek_seq(void);
void mesh_lower_transport_message_processed_by_higher_layer(mesh_pdu_t * pdu);
void mesh_lower_transport_send_pdu(mesh_pdu_t * pdu);

@ -48,6 +48,7 @@
#include "mesh_peer.h"
#include "mesh_keys.h"
#include "mesh_virtual_addresses.h"
#include "mesh_iv_index_seq_number.h"
static uint16_t primary_element_address;

@ -18,6 +18,7 @@ CORE += \
hci_transport_h2_libusb.c \
hci_transport_h4.c \
btstack_tlv_posix.c \
mesh_iv_index_seq_number.c \
le_device_db_fs.c \
l2cap.c \
uECC.c \
@ -59,7 +60,7 @@ mesh: mesh.h ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${GATT_SERVER_OBJ} ${SM_OBJ} p
provisioner: ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${SM_OBJ} pb_adv.o mesh_crypto.o provisioning_provisioner.o mesh_keys.o mesh_foundation.o mesh_network.o provisioner.o
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
mesh_message_test: mesh_foundation.o mesh_message_test.c mesh_network.o mesh_peer.o mesh_lower_transport.o mesh_upper_transport.o mesh_virtual_addresses.o mesh_keys.o mesh_crypto.o btstack_memory.o btstack_memory_pool.o btstack_util.o btstack_crypto.o btstack_linked_list.o hci_dump.o uECC.o mock.o rijndael.o hci_cmd.o
mesh_message_test: mesh_foundation.o mesh_message_test.c mesh_iv_index_seq_number.o mesh_network.o mesh_peer.o mesh_lower_transport.o mesh_upper_transport.o mesh_virtual_addresses.o mesh_keys.o mesh_crypto.o btstack_memory.o btstack_memory_pool.o btstack_util.o btstack_crypto.o btstack_linked_list.o hci_dump.o uECC.o mock.o rijndael.o hci_cmd.o
g++ $^ ${CFLAGS} ${LDFLAGS} -o $@
sniffer: ${CORE_OBJ} ${COMMON_OBJ} ${ATT_OBJ} ${SM_OBJ} mesh_keys.o mesh_network.o mesh_foundation.o sniffer.c

@ -0,0 +1,55 @@
/*
* Copyright (C) 2014 BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. Any redistribution, use, or modification is done solely for
* personal benefit and not for any commercial purpose or for
* monetary gain.
*
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Please inquire about commercial licensing options at
* contact@bluekitchen-gmbh.com
*
*/
#define __BTSTACK_FILE__ "mesh_iv_index_seq_number.c"
#include "mesh_iv_index_seq_number.h"
static uint32_t lower_transport_seq;
uint32_t mesh_lower_transport_next_seq(void){
return lower_transport_seq++;
}
uint32_t mesh_lower_transport_peek_seq(void){
return lower_transport_seq;
}
void mesh_lower_transport_set_seq(uint32_t seq){
lower_transport_seq = seq;
}

@ -0,0 +1,58 @@
/*
* Copyright (C) 2019 BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. Any redistribution, use, or modification is done solely for
* personal benefit and not for any commercial purpose or for
* monetary gain.
*
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Please inquire about commercial licensing options at
* contact@bluekitchen-gmbh.com
*
*/
#ifndef __MESH_IV_INDEX_SEQ_NUMBER_H
#define __MESH_IV_INDEX_SEQ_NUMBER_H
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
void mesh_lower_transport_set_seq(uint32_t seq);
uint32_t mesh_lower_transport_next_seq(void);;
uint32_t mesh_lower_transport_peek_seq(void);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif

@ -16,6 +16,7 @@
#include "btstack_util.h"
#include "provisioning.h"
#include "btstack_memory.h"
#include "mesh_iv_index_seq_number.h"
extern "C" int mock_process_hci_cmd(void);