att_server.c (c61037cc77c8186ed1a8cb389419343a0c648995) | att_server.c (e7af4f1f3fbacefcfce6ef51ec9a88ab3110367d) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 572 unchanged lines hidden (view full) --- 581 att_response_buffer[3] = 0; 582 att_response_buffer[4] = ATT_ERROR_REQUEST_NOT_SUPPORTED; 583 } else { 584 att_response_size = att_handle_request(att_connection, att_server->request_buffer, att_server->request_size, att_response_buffer); 585 } 586 587#ifdef ENABLE_ATT_DELAYED_RESPONSE 588 if ((att_response_size == ATT_READ_RESPONSE_PENDING) || (att_response_size == ATT_INTERNAL_WRITE_RESPONSE_PENDING)){ | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 572 unchanged lines hidden (view full) --- 581 att_response_buffer[3] = 0; 582 att_response_buffer[4] = ATT_ERROR_REQUEST_NOT_SUPPORTED; 583 } else { 584 att_response_size = att_handle_request(att_connection, att_server->request_buffer, att_server->request_size, att_response_buffer); 585 } 586 587#ifdef ENABLE_ATT_DELAYED_RESPONSE 588 if ((att_response_size == ATT_READ_RESPONSE_PENDING) || (att_response_size == ATT_INTERNAL_WRITE_RESPONSE_PENDING)){ |
589 // free reserved buffer 590 if (eatt_buffer == NULL){ 591 l2cap_release_packet_buffer(); 592 } 593 |
|
589 // update state 590 att_server->state = ATT_SERVER_RESPONSE_PENDING; 591 592 // callback with handle ATT_READ_RESPONSE_PENDING for reads 593 if (att_response_size == ATT_READ_RESPONSE_PENDING){ 594 // notify services that returned response pending 595 btstack_linked_list_iterator_t it; 596 btstack_linked_list_iterator_init(&it, &service_handlers); --- 6 unchanged lines hidden (view full) --- 603 } 604 // notify main read callback if it returned response pending 605 if ((att_server_flags & ATT_SERVICE_FLAGS_DELAYED_RESPONSE) != 0){ 606 // flag was set by read callback 607 btstack_assert(att_server_client_read_callback != NULL); 608 (*att_server_client_read_callback)(att_connection->con_handle, ATT_READ_RESPONSE_PENDING, 0, NULL, 0); 609 } 610 } | 594 // update state 595 att_server->state = ATT_SERVER_RESPONSE_PENDING; 596 597 // callback with handle ATT_READ_RESPONSE_PENDING for reads 598 if (att_response_size == ATT_READ_RESPONSE_PENDING){ 599 // notify services that returned response pending 600 btstack_linked_list_iterator_t it; 601 btstack_linked_list_iterator_init(&it, &service_handlers); --- 6 unchanged lines hidden (view full) --- 608 } 609 // notify main read callback if it returned response pending 610 if ((att_server_flags & ATT_SERVICE_FLAGS_DELAYED_RESPONSE) != 0){ 611 // flag was set by read callback 612 btstack_assert(att_server_client_read_callback != NULL); 613 (*att_server_client_read_callback)(att_connection->con_handle, ATT_READ_RESPONSE_PENDING, 0, NULL, 0); 614 } 615 } |
611 612 // free reserved buffer 613 if (eatt_buffer == NULL){ 614 l2cap_release_packet_buffer(); 615 } | |
616 return 0; 617 } 618#endif 619 620 // intercept "insufficient authorization" for authenticated connections to allow for user authorization 621 if ((att_response_size >= 4u) 622 && (att_response_buffer[0] == ATT_ERROR_RESPONSE) 623 && (att_response_buffer[4] == ATT_ERROR_INSUFFICIENT_AUTHORIZATION) --- 1059 unchanged lines hidden --- | 616 return 0; 617 } 618#endif 619 620 // intercept "insufficient authorization" for authenticated connections to allow for user authorization 621 if ((att_response_size >= 4u) 622 && (att_response_buffer[0] == ATT_ERROR_RESPONSE) 623 && (att_response_buffer[4] == ATT_ERROR_INSUFFICIENT_AUTHORIZATION) --- 1059 unchanged lines hidden --- |