1/*
2 * Copyright 2024, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _L2CAP_COMMAND_H_
6#define _L2CAP_COMMAND_H_
7
8#include <ByteOrder.h>
9#include <NetBufferUtilities.h>
10
11#include <bluetooth/l2cap.h>
12
13
14#define htole16(x) B_HOST_TO_LENDIAN_INT16(x)
15#define le16toh(x) B_LENDIAN_TO_HOST_INT16(x)
16#define htole32(x) B_HOST_TO_LENDIAN_INT16(x)
17#define le32toh(x) B_LENDIAN_TO_HOST_INT32(x)
18
19
20net_buffer*	make_l2cap_command_reject(uint8& code,
21	uint16 reason, uint16 mtu, uint16 scid, uint16 dcid);
22
23net_buffer*	make_l2cap_connection_req(uint8& code, uint16 psm, uint16 scid);
24net_buffer*	make_l2cap_connection_rsp(uint8& code,
25	uint16 dcid, uint16 scid, uint16 result, uint16 status);
26
27net_buffer*	make_l2cap_configuration_req(uint8& code, uint16 dcid, uint16 flags,
28	uint16* mtu, uint16* flush_timeout, l2cap_qos* flow);
29net_buffer*	make_l2cap_configuration_rsp(uint8& code, uint16 scid, uint16 flags,
30	uint16 result, net_buffer* opt);
31
32net_buffer*	make_l2cap_disconnection_req(uint8& code, uint16 dcid, uint16 scid);
33net_buffer*	make_l2cap_disconnection_rsp(uint8& code, uint16 dcid, uint16 scid);
34
35net_buffer*	make_l2cap_information_req(uint8& code, uint16 type);
36net_buffer*	make_l2cap_information_rsp(uint8& code, uint16 type, uint16 result, uint16 mtu);
37
38
39#endif /* _L2CAP_COMMAND_H_ */
40