xref: /btstack/platform/windows/btstack_tlv_windows.h (revision 239538048535c1f2ee18383cbbb03b20b0ee8bbc)
1*23953804SMatthias Ringwald /*
2*23953804SMatthias Ringwald  * Copyright (C) 2017 BlueKitchen GmbH
3*23953804SMatthias Ringwald  *
4*23953804SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5*23953804SMatthias Ringwald  * modification, are permitted provided that the following conditions
6*23953804SMatthias Ringwald  * are met:
7*23953804SMatthias Ringwald  *
8*23953804SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9*23953804SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10*23953804SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11*23953804SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12*23953804SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13*23953804SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14*23953804SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15*23953804SMatthias Ringwald  *    from this software without specific prior written permission.
16*23953804SMatthias Ringwald  *
17*23953804SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
18*23953804SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19*23953804SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20*23953804SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
21*23953804SMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22*23953804SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23*23953804SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24*23953804SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25*23953804SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26*23953804SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27*23953804SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*23953804SMatthias Ringwald  * SUCH DAMAGE.
29*23953804SMatthias Ringwald  *
30*23953804SMatthias Ringwald  */
31*23953804SMatthias Ringwald 
32*23953804SMatthias Ringwald /*
33*23953804SMatthias Ringwald  *  btstack_tlv_posix.h
34*23953804SMatthias Ringwald  *
35*23953804SMatthias Ringwald  *  Implementation for BTstack's Tag Value Length Persistent Storage implementations
36*23953804SMatthias Ringwald  *  using in-memory storage (RAM & malloc) and append-only log files on disc
37*23953804SMatthias Ringwald  */
38*23953804SMatthias Ringwald 
39*23953804SMatthias Ringwald #ifndef BTSTACK_TLV_WINDOWS_H
40*23953804SMatthias Ringwald #define BTSTACK_TLV_WINDOWS_H
41*23953804SMatthias Ringwald 
42*23953804SMatthias Ringwald #include <Windows.h>
43*23953804SMatthias Ringwald 
44*23953804SMatthias Ringwald #include "btstack_tlv.h"
45*23953804SMatthias Ringwald #include "btstack_linked_list.h"
46*23953804SMatthias Ringwald 
47*23953804SMatthias Ringwald #if defined __cplusplus
48*23953804SMatthias Ringwald extern "C" {
49*23953804SMatthias Ringwald #endif
50*23953804SMatthias Ringwald 
51*23953804SMatthias Ringwald typedef struct {
52*23953804SMatthias Ringwald 	btstack_linked_list_t entry_list;
53*23953804SMatthias Ringwald 	const char * db_path;
54*23953804SMatthias Ringwald 	HANDLE file;
55*23953804SMatthias Ringwald } btstack_tlv_windows_t;
56*23953804SMatthias Ringwald 
57*23953804SMatthias Ringwald /**
58*23953804SMatthias Ringwald  * Init Tag Length Value Store
59*23953804SMatthias Ringwald  * @param context btstack_tlv_windows_t
60*23953804SMatthias Ringwald  * @param db_path on disc
61*23953804SMatthias Ringwald  */
62*23953804SMatthias Ringwald const btstack_tlv_t * btstack_tlv_windows_init_instance(btstack_tlv_windows_t * context, const char * db_path);
63*23953804SMatthias Ringwald 
64*23953804SMatthias Ringwald /**
65*23953804SMatthias Ringwald  * Free TLV entries
66*23953804SMatthias Ringwald  * @param self
67*23953804SMatthias Ringwald  */
68*23953804SMatthias Ringwald void btstack_tlv_windows_deinit(btstack_tlv_windows_t * self);
69*23953804SMatthias Ringwald 
70*23953804SMatthias Ringwald #if defined __cplusplus
71*23953804SMatthias Ringwald }
72*23953804SMatthias Ringwald #endif
73*23953804SMatthias Ringwald #endif // BTSTACK_TLV_WINDOWS_H
74