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