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 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 39 40 /* 41 * btstsack_memory.h 42 * 43 * @brief BTstack memory management via configurable memory pools 44 * 45 */ 46 47 #ifndef __BTSTACK_MEMORY_H 48 #define __BTSTACK_MEMORY_H 49 50 #if defined __cplusplus 51 extern "C" { 52 #endif 53 54 #include "btstack-config.h" 55 56 #include "hci.h" 57 #include "l2cap.h" 58 #include "rfcomm.h" 59 #include "bnep.h" 60 #include "hfp.h" 61 #include "remote_device_db.h" 62 63 #ifdef HAVE_BLE 64 #include "gatt_client.h" 65 #endif 66 67 /* API_START */ 68 69 /** 70 * @brief Initializes BTstack memory pools. 71 */ 72 void btstack_memory_init(void); 73 74 /* API_END */ 75 76 // hci_connection 77 hci_connection_t * btstack_memory_hci_connection_get(void); 78 void btstack_memory_hci_connection_free(hci_connection_t *hci_connection); 79 80 // l2cap_service, l2cap_channel 81 l2cap_service_t * btstack_memory_l2cap_service_get(void); 82 void btstack_memory_l2cap_service_free(l2cap_service_t *l2cap_service); 83 l2cap_channel_t * btstack_memory_l2cap_channel_get(void); 84 void btstack_memory_l2cap_channel_free(l2cap_channel_t *l2cap_channel); 85 86 // rfcomm_multiplexer, rfcomm_service, rfcomm_channel 87 rfcomm_multiplexer_t * btstack_memory_rfcomm_multiplexer_get(void); 88 void btstack_memory_rfcomm_multiplexer_free(rfcomm_multiplexer_t *rfcomm_multiplexer); 89 rfcomm_service_t * btstack_memory_rfcomm_service_get(void); 90 void btstack_memory_rfcomm_service_free(rfcomm_service_t *rfcomm_service); 91 rfcomm_channel_t * btstack_memory_rfcomm_channel_get(void); 92 void btstack_memory_rfcomm_channel_free(rfcomm_channel_t *rfcomm_channel); 93 94 // db_mem_device_name, db_mem_device_link_key, db_mem_service 95 db_mem_device_name_t * btstack_memory_db_mem_device_name_get(void); 96 void btstack_memory_db_mem_device_name_free(db_mem_device_name_t *db_mem_device_name); 97 db_mem_device_link_key_t * btstack_memory_db_mem_device_link_key_get(void); 98 void btstack_memory_db_mem_device_link_key_free(db_mem_device_link_key_t *db_mem_device_link_key); 99 db_mem_service_t * btstack_memory_db_mem_service_get(void); 100 void btstack_memory_db_mem_service_free(db_mem_service_t *db_mem_service); 101 102 // bnep_service, bnep_channel 103 bnep_service_t * btstack_memory_bnep_service_get(void); 104 void btstack_memory_bnep_service_free(bnep_service_t *bnep_service); 105 bnep_channel_t * btstack_memory_bnep_channel_get(void); 106 void btstack_memory_bnep_channel_free(bnep_channel_t *bnep_channel); 107 108 // hfp_connection 109 hfp_connection_t * btstack_memory_hfp_connection_get(void); 110 void btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection); 111 112 #ifdef HAVE_BLE 113 // gatt_client, gatt_subclient, whitelist_entry 114 gatt_client_t * btstack_memory_gatt_client_get(void); 115 void btstack_memory_gatt_client_free(gatt_client_t *gatt_client); 116 gatt_subclient_t * btstack_memory_gatt_subclient_get(void); 117 void btstack_memory_gatt_subclient_free(gatt_subclient_t *gatt_subclient); 118 whitelist_entry_t * btstack_memory_whitelist_entry_get(void); 119 void btstack_memory_whitelist_entry_free(whitelist_entry_t *whitelist_entry); 120 #endif 121 122 #if defined __cplusplus 123 } 124 #endif 125 126 #endif // __BTSTACK_MEMORY_H 127 128