mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 12:35:25 +00:00
add security level to l2cap service registration
This commit is contained in:
parent
fb8ba0dbcd
commit
62f901df97
@ -244,7 +244,7 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
case L2CAP_REGISTER_SERVICE:
|
||||
psm = READ_BT_16(packet, 3);
|
||||
mtu = READ_BT_16(packet, 5);
|
||||
l2cap_register_service_internal(connection, NULL, psm, mtu);
|
||||
l2cap_register_service_internal(connection, NULL, psm, mtu, LEVEL_0);
|
||||
break;
|
||||
case L2CAP_UNREGISTER_SERVICE:
|
||||
psm = READ_BT_16(packet, 3);
|
||||
|
@ -1231,7 +1231,7 @@ l2cap_service_t * l2cap_get_service(uint16_t psm){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu){
|
||||
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu, gap_security_level_t security_level){
|
||||
|
||||
log_info("L2CAP_REGISTER_SERVICE psm 0x%x mtu %u", psm, mtu);
|
||||
|
||||
@ -1258,7 +1258,8 @@ void l2cap_register_service_internal(void *connection, btstack_packet_handler_t
|
||||
service->mtu = mtu;
|
||||
service->connection = connection;
|
||||
service->packet_handler = packet_handler;
|
||||
|
||||
service->security_level = security_level;
|
||||
|
||||
// add to services list
|
||||
linked_list_add(&l2cap_services, (linked_item_t *) service);
|
||||
|
||||
|
@ -233,7 +233,7 @@ uint16_t l2cap_get_remote_mtu_for_local_cid(uint16_t local_cid);
|
||||
int l2cap_send_internal(uint16_t local_cid, uint8_t *data, uint16_t len);
|
||||
|
||||
// Registers L2CAP service with given PSM and MTU, and assigns a packet handler. On embedded systems, use NULL for connection parameter.
|
||||
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu);
|
||||
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu, gap_security_level_t security_level);
|
||||
|
||||
// Unregisters L2CAP service with given PSM. On embedded systems, use NULL for connection parameter.
|
||||
void l2cap_unregister_service_internal(void *connection, uint16_t psm);
|
||||
|
@ -2122,7 +2122,7 @@ void rfcomm_register_service2(void * connection, uint8_t channel, uint16_t max_f
|
||||
|
||||
// register with l2cap if not registered before, max MTU
|
||||
if (linked_list_empty(&rfcomm_services)){
|
||||
l2cap_register_service_internal(NULL, rfcomm_packet_handler, PSM_RFCOMM, 0xffff);
|
||||
l2cap_register_service_internal(NULL, rfcomm_packet_handler, PSM_RFCOMM, 0xffff, LEVEL_0);
|
||||
}
|
||||
|
||||
// fill in
|
||||
|
@ -74,7 +74,7 @@ static uint16_t sdp_response_size = 0;
|
||||
|
||||
void sdp_init(){
|
||||
// register with l2cap psm sevices - max MTU
|
||||
l2cap_register_service_internal(NULL, sdp_packet_handler, PSM_SDP, 0xffff);
|
||||
l2cap_register_service_internal(NULL, sdp_packet_handler, PSM_SDP, 0xffff, LEVEL_0);
|
||||
}
|
||||
|
||||
// register packet handler
|
||||
|
Loading…
x
Reference in New Issue
Block a user