xref: /btstack/src/classic/obex_srm_server.h (revision 91a1f2a16a6219ef8c1850155a07ed9b602e02eb)
1e001955aSMatthias Ringwald /*
2e001955aSMatthias Ringwald  * Copyright (C) 2023 BlueKitchen GmbH
3e001955aSMatthias Ringwald  *
4e001955aSMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5e001955aSMatthias Ringwald  * modification, are permitted provided that the following conditions
6e001955aSMatthias Ringwald  * are met:
7e001955aSMatthias Ringwald  *
8e001955aSMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9e001955aSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10e001955aSMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11e001955aSMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12e001955aSMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13e001955aSMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14e001955aSMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15e001955aSMatthias Ringwald  *    from this software without specific prior written permission.
16e001955aSMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17e001955aSMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18e001955aSMatthias Ringwald  *    monetary gain.
19e001955aSMatthias Ringwald  *
20e001955aSMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21e001955aSMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22e001955aSMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23e001955aSMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24e001955aSMatthias Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25e001955aSMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26e001955aSMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27e001955aSMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28e001955aSMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29e001955aSMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30e001955aSMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31e001955aSMatthias Ringwald  * SUCH DAMAGE.
32e001955aSMatthias Ringwald  *
33e001955aSMatthias Ringwald  * Please inquire about commercial licensing options at
34e001955aSMatthias Ringwald  * [email protected]
35e001955aSMatthias Ringwald  *
36e001955aSMatthias Ringwald  */
37e001955aSMatthias Ringwald 
38e001955aSMatthias Ringwald #ifndef OBEX_SRM_H
39e001955aSMatthias Ringwald #define OBEX_SRM_H
40e001955aSMatthias Ringwald 
41e001955aSMatthias Ringwald #include <stdint.h>
42e001955aSMatthias Ringwald 
43e001955aSMatthias Ringwald #if defined __cplusplus
44e001955aSMatthias Ringwald extern "C" {
45e001955aSMatthias Ringwald #endif
46e001955aSMatthias Ringwald 
47e001955aSMatthias Ringwald typedef enum {
48e001955aSMatthias Ringwald     OBEX_SRM_STATE_DISABLED,
49e001955aSMatthias Ringwald     OBEX_SRM_STATE_SEND_CONFIRM,
50e001955aSMatthias Ringwald     OBEX_SRM_STATE_SEND_CONFIRM_WAIT,
51e001955aSMatthias Ringwald     OBEX_SRM_STATE_ENABLED,
52e001955aSMatthias Ringwald     OBEX_SRM_STATE_ENABLED_WAIT,
530173416cSMatthias Ringwald } obex_srm_server_state_t;
54e001955aSMatthias Ringwald 
55e001955aSMatthias Ringwald typedef struct {
560173416cSMatthias Ringwald     obex_srm_server_state_t srm_state;
57e001955aSMatthias Ringwald 
58e001955aSMatthias Ringwald     uint8_t srm_value;
59e001955aSMatthias Ringwald     uint8_t srmp_value;
600173416cSMatthias Ringwald } obex_srm_server_t;
61e001955aSMatthias Ringwald 
620173416cSMatthias Ringwald void obex_srm_server_init           (obex_srm_server_t    *obex_srm);
630173416cSMatthias Ringwald void obex_srm_server_header_store   (obex_srm_server_t    *obex_srm,
64e001955aSMatthias Ringwald                                      uint8_t        header_id,
65e001955aSMatthias Ringwald                                      uint16_t       total_len,
66e001955aSMatthias Ringwald                                      uint16_t       data_offset,
67e001955aSMatthias Ringwald                                      const uint8_t *data_buffer,
68e001955aSMatthias Ringwald                                      uint16_t       data_len);
69*91a1f2a1SMatthias Ringwald void obex_srm_server_handle_headers  (obex_srm_server_t *obex_srm);
700173416cSMatthias Ringwald void obex_srm_server_add_srm_headers (obex_srm_server_t   *obex_srm,
71e001955aSMatthias Ringwald                                       uint16_t      goep_cid);
720173416cSMatthias Ringwald bool obex_srm_server_is_enabled      (obex_srm_server_t   *obex_srm);
73e001955aSMatthias Ringwald 
74e001955aSMatthias Ringwald #if defined __cplusplus
75e001955aSMatthias Ringwald }
76e001955aSMatthias Ringwald #endif
77e001955aSMatthias Ringwald 
78e001955aSMatthias Ringwald #endif
79