1 /* obex.c - Internal for IrDA Oject Exchange Protocol handling */
2 
3 /*
4  * Copyright 2024-2025 NXP
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 #define BT_OBEX_VERSION 0x10
10 
11 #define BT_OBEX_MIN_MTU 255
12 
13 #define BT_OBEX_OPCODE_CONNECT  0x80
14 #define BT_OBEX_OPCODE_DISCONN  0x81
15 #define BT_OBEX_OPCODE_PUT      0x02
16 #define BT_OBEX_OPCODE_PUT_F    0x82
17 #define BT_OBEX_OPCODE_GET      0x03
18 #define BT_OBEX_OPCODE_GET_F    0x83
19 #define BT_OBEX_OPCODE_SETPATH  0x85
20 #define BT_OBEX_OPCODE_ACTION   0x06
21 #define BT_OBEX_OPCODE_ACTION_F 0x86
22 #define BT_OBEX_OPCODE_SESSION  0x87
23 #define BT_OBEX_OPCODE_ABORT    0xFF
24 
25 struct bt_obex_req_hdr {
26 	uint8_t code;
27 	uint16_t len;
28 } __packed;
29 
30 struct bt_obex_rsp_hdr {
31 	uint8_t code;
32 	uint16_t len;
33 } __packed;
34 
35 struct bt_obex_conn_req_hdr {
36 	uint8_t version;
37 	uint8_t flags;
38 	uint16_t mopl;
39 } __packed;
40 
41 struct bt_obex_conn_rsp_hdr {
42 	uint8_t version;
43 	uint8_t flags;
44 	uint16_t mopl;
45 } __packed;
46 
47 struct bt_obex_setpath_req_hdr {
48 	uint8_t flags;
49 	uint8_t constants;
50 } __packed;
51 
52 /* OBEX initialization */
53 int bt_obex_reg_transport(struct bt_obex *obex, const struct bt_obex_transport_ops *ops);
54 
55 /* Process the received OBEX packet */
56 int bt_obex_recv(struct bt_obex *obex, struct net_buf *buf);
57 
58 /* Notify OBEX that the transport has been connected */
59 int bt_obex_transport_connected(struct bt_obex *obex);
60 
61 /* Notify OBEX that the transport has been disconnected */
62 int bt_obex_transport_disconnected(struct bt_obex *obex);
63