attribute for ‘struct XXXX’ must follow the ‘struct’ keyword
[AROS.git] / compiler / include / bluetooth / l2cap.h
blob8fc07c580e244f342224192ba4541984ccf55e1d
1 #ifndef BLUETOOTH_L2CAP_H
2 #define BLUETOOTH_L2CAP_H
3 /*
4 ** $VER: l2cap.h 1.0 (23.04.06)
5 **
6 ** Bluetooth L2CAP definitions include file
7 **
8 ** (C) Copyright 2006 Chris Hodges
9 ** All Rights Reserved
12 #if defined(__GNUC__)
13 # pragma pack(1)
14 #endif
16 #define L2CAP_CID_NULL 0x0000
17 #define L2CAP_CID_SIGCHAN 0x0001
18 #define L2CAP_CID_CONNLESS 0x0002
19 #define L2CAP_CID_USERSTART 0x0040
21 struct BTL2CAPBasicFrame
23 UWORD l2bf_Length; /* Length field (payload, without header) */
24 UWORD l2bf_ChannelID; /* Channel ID (CID) for channel endpoint */
25 UBYTE l2bf_Payload[0]; /* Data Payload */
28 struct BTL2CAPConnLessFrame
30 UWORD l2cf_Length; /* Length field (payload, without header) */
31 UWORD l2cf_ChannelID; /* Channel ID (CID) for channel endpoint */
32 UWORD l2cf_PSM; /* Protocol Service Multiplexer, minimum 2 bytes */
33 UBYTE l2cf_Payload[0]; /* Data Payload */
36 struct BTL2CAPSuperFrame
38 UWORD l2sf_Length; /* Length field (payload, without header) */
39 UWORD l2sf_ChannelID; /* Channel ID (CID) for channel endpoint */
40 UWORD l2sf_Control; /* Control field */
41 UWORD l2sf_FCS; /* Frame Check Sequence */
44 struct BTL2CAPInfoFrame
46 UWORD l2if_Length; /* Length field (payload, without header) */
47 UWORD l2if_ChannelID; /* Channel ID (CID) for channel endpoint */
48 UWORD l2if_Control; /* Control field */
49 UWORD l2if_SDULength; /* optional SDU Length field */
50 UBYTE l2if_Payload[0]; /* Payload */
51 //UWORD l2if_FCS; /* Frame Check Sequence at the end */
54 #define L2CF_SUPERFRAME 0x0001 /* This is a supervisor frame instead of informational frame */
55 #define L2CF_NORESEND 0x0080 /* Disable retransmitting of lost/corrupt packets */
57 #define L2CF_SAR_NOFRAG 0x0000 /* SDU is not segmented */
58 #define L2CF_SAR_START 0x4000 /* Start of SDU */
59 #define L2CF_SAR_END 0x8000 /* End of SDU */
60 #define L2CF_SAR_CONT 0xc000 /* Continuation of SDU */
61 #define L2CM_SAR 0xc000 /* SAR mask */
63 #define L2CM_REQSEQ 0x3f00 /* Receiver sequence number */
64 #define L2CS_REQSEQ 9
65 #define L2CM_TXSEQ 0x007e /* Transmission sequence number */
66 #define L2CS_TXSEQ 1
68 #define L2CF_SUPER_RR 0x0000 /* Supervisor: Receiver ready */
69 #define L2CF_SUPER_REJ 0x0004 /* Supervisor: Reject */
70 #define L2CM_SUPER 0x000c /* Supervisor mask */
72 struct BTL2CAPCommand
74 UBYTE l2c_Code; /* Code */
75 UBYTE l2c_Identifier; /* Identifier */
76 UWORD l2c_DataLength; /* Length of Command Data */
77 UBYTE l2c_Data[0]; /* Command payload */
80 #define L2CMD_COMMAND_REJECT 0x01
81 #define L2CMD_CONNECTION_REQUEST 0x02
82 #define L2CMD_CONNECTION_RESPONSE 0x03
83 #define L2CMD_CONFIGURATION_REQUEST 0x04
84 #define L2CMD_CONFIGURATION_RESPONSE 0x05
85 #define L2CMD_DISCONNECTION_REQUEST 0x06
86 #define L2CMD_DISCONNECTION_RESPONSE 0x07
87 #define L2CMD_ECHO_REQUEST 0x08
88 #define L2CMD_ECHO_RESPONSE 0x09
89 #define L2CMD_INFORMATION_REQUEST 0x0a
90 #define L2CMD_INFORMATION_RESPONSE 0x0b
92 /* error/status codes for different responses */
94 // Command reject
95 #define L2ERR_COMMAND_NOT_UNDERSTOOD 0x0000
96 #define L2ERR_SIGNALLING_MTU_EXCEEDED 0x0001
97 #define L2ERR_INVALID_CID_IN_REQUEST 0x0002
99 // Connection response
100 #define L2ERR_CONN_SUCCESSFUL 0x0000
101 #define L2ERR_CONN_PENDING 0x0001
102 #define L2ERR_CONN_REFUSED_BAD_PSM 0x0002
103 #define L2ERR_CONN_REFUSED_SECURITY 0x0003
104 #define L2ERR_CONN_REFUSED_UNAVAIL 0x0004
105 #define L2STS_NO_INFO 0x0000
106 #define L2STS_AUTHENTICATION_PENDING 0x0001
107 #define L2STS_AUTHORIZATION_PENDING 0x0002
109 // Configuration response
110 #define L2ERR_CFG_SUCCESS 0x0000
111 #define L2ERR_CFG_FAIL_BAD_PARAMS 0x0001
112 #define L2ERR_CFG_FAIL_REJECTED 0x0002
113 #define L2ERR_CFG_FAIL_UNKNOWN_OPTS 0x0003
115 // Information response
116 #define L2ERR_INFO_SUCCESS 0x0000
117 #define L2ERR_INFO_NOT_SUPPORTED 0x0001
119 #define L2CAP_INFOTYPE_CONNLESS_MTU 0x0001
120 #define L2CAP_INFOTYPE_EXT_FEAT_MASK 0x0002
122 /* MTU sizes for L2CAP */
123 #define L2CAP_DEFAULT_MTU 672
124 #define L2CAP_MIN_MTU 48
126 #if defined(__GNUC__)
127 # pragma pack()
128 #endif
130 #endif /* BLUETOOTH_L2CAP_H */