att_server.c (a444112b406376bc18e3f277b8a3fc8f65f825ef) | att_server.c (e0463bdc5e724397e304bcf530700cc196885bd8) |
---|---|
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 --- 644 unchanged lines hidden (view full) --- 653 // note: signed write cannot be handled directly as authentication needs to be verified 654 if (packet[0] == ATT_WRITE_COMMAND){ 655 att_handle_request(&att_server->connection, packet, size, 0); 656 return; 657 } 658 659 // check size 660 if (size > sizeof(att_server->request_buffer)) { | 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 --- 644 unchanged lines hidden (view full) --- 653 // note: signed write cannot be handled directly as authentication needs to be verified 654 if (packet[0] == ATT_WRITE_COMMAND){ 655 att_handle_request(&att_server->connection, packet, size, 0); 656 return; 657 } 658 659 // check size 660 if (size > sizeof(att_server->request_buffer)) { |
661 log_info("att_packet_handler: dropping att pdu 0x%02x as size %u > att_server->request_buffer %u", packet[0], size, (int) sizeof(att_server->request_buffer)); | 661 log_info("drop att pdu 0x%02x as size %u > att_server->request_buffer %u", packet[0], size, (int) sizeof(att_server->request_buffer)); |
662 return; 663 } 664 | 662 return; 663 } 664 |
665#ifdef ENABLE_LE_SIGNED_WRITE 666 // abort signed write validation if a new request comes in (but finish previous signed write if possible) 667 if (att_server->state == ATT_SERVER_W4_SIGNED_WRITE_VALIDATION){ 668 if (packet[0] == ATT_SIGNED_WRITE_COMMAND){ 669 log_info("skip new signed write request as previous is in validation"); 670 return; 671 } else { 672 log_info("abort signed write validation to process new request"); 673 att_server->state = ATT_SERVER_IDLE; 674 } 675 } 676#endif |
|
665 // last request still in processing? 666 if (att_server->state != ATT_SERVER_IDLE){ | 677 // last request still in processing? 678 if (att_server->state != ATT_SERVER_IDLE){ |
667 log_info("att_packet_handler: skipping att pdu 0x%02x as server not idle (state %u)", packet[0], att_server->state); | 679 log_info("skip att pdu 0x%02x as server not idle (state %u)", packet[0], att_server->state); |
668 return; 669 } 670 671 // store request 672 att_server->state = ATT_SERVER_REQUEST_RECEIVED; 673 att_server->request_size = size; 674 memcpy(att_server->request_buffer, packet, size); 675 --- 351 unchanged lines hidden --- | 680 return; 681 } 682 683 // store request 684 att_server->state = ATT_SERVER_REQUEST_RECEIVED; 685 att_server->request_size = size; 686 memcpy(att_server->request_buffer, packet, size); 687 --- 351 unchanged lines hidden --- |