[1166] | 1 | /**
|
---|
| 2 | * This file is part of the mingw-w64 runtime package.
|
---|
| 3 | * No warranty is given; refer to the file DISCLAIMER within this package.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | #include <winapifamily.h>
|
---|
| 7 |
|
---|
| 8 | #ifndef __WS2BTH__H
|
---|
| 9 | #define __WS2BTH__H
|
---|
| 10 |
|
---|
| 11 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
|
---|
| 12 |
|
---|
| 13 | #include <bthdef.h>
|
---|
| 14 | #include <bthsdpdef.h>
|
---|
| 15 | #include <pshpack1.h>
|
---|
| 16 |
|
---|
| 17 | #define BT_PORT_ANY ((ULONG)-1)
|
---|
| 18 | #define BT_PORT_MIN 0x1
|
---|
| 19 | #define BT_PORT_MAX 0xffff
|
---|
| 20 | #define BT_PORT_DYN_FIRST 0x1001
|
---|
| 21 |
|
---|
| 22 | #ifndef AF_BTH
|
---|
| 23 | #define AF_BTH 32
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
| 26 | #ifndef PF_BTH
|
---|
| 27 | #define PF_BTH AF_BTH
|
---|
| 28 | #endif
|
---|
| 29 |
|
---|
| 30 | #ifndef NS_BTH
|
---|
| 31 | #define NS_BTH 16
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | typedef struct _SOCKADDR_BTH {
|
---|
| 35 | USHORT addressFamily;
|
---|
| 36 | BTH_ADDR btAddr;
|
---|
| 37 | GUID serviceClassId;
|
---|
| 38 | ULONG port;
|
---|
| 39 | } SOCKADDR_BTH,*PSOCKADDR_BTH;
|
---|
| 40 |
|
---|
| 41 | DEFINE_GUID (SVCID_BTH_PROVIDER, 0x6aa63e0, 0x7d60, 0x41ff, 0xaf, 0xb2, 0x3e, 0xe6, 0xd2, 0xd9, 0x39, 0x2d);
|
---|
| 42 |
|
---|
| 43 | #define BTH_ADDR_STRING_SIZE 12
|
---|
| 44 |
|
---|
| 45 | #define BTHPROTO_RFCOMM 0x0003
|
---|
| 46 | #define BTHPROTO_L2CAP 0x0100
|
---|
| 47 |
|
---|
| 48 | #define SOL_RFCOMM BTHPROTO_RFCOMM
|
---|
| 49 | #define SOL_L2CAP BTHPROTO_L2CAP
|
---|
| 50 | #define SOL_SDP 0x0101
|
---|
| 51 |
|
---|
| 52 | #define SO_BTH_AUTHENTICATE 0x80000001
|
---|
| 53 | #define SO_BTH_ENCRYPT 0x00000002
|
---|
| 54 | #define SO_BTH_MTU 0x80000007
|
---|
| 55 | #define SO_BTH_MTU_MAX 0x80000008
|
---|
| 56 | #define SO_BTH_MTU_MIN 0x8000000a
|
---|
| 57 |
|
---|
| 58 | #define RFCOMM_MAX_MTU 0x000003f3
|
---|
| 59 | #define RFCOMM_MIN_MTU 0x00000017
|
---|
| 60 |
|
---|
| 61 | #define BTH_SDP_VERSION 1
|
---|
| 62 |
|
---|
| 63 | typedef struct _BTH_SET_SERVICE {
|
---|
| 64 | PULONG pSdpVersion;
|
---|
| 65 | HANDLE *pRecordHandle;
|
---|
| 66 | ULONG fCodService;
|
---|
| 67 | ULONG Reserved[5];
|
---|
| 68 | ULONG ulRecordLength;
|
---|
| 69 | UCHAR pRecord[1];
|
---|
| 70 | } BTH_SET_SERVICE,*PBTH_SET_SERVICE;
|
---|
| 71 |
|
---|
| 72 | #define SDP_DEFAULT_INQUIRY_SECONDS 6
|
---|
| 73 | #define SDP_MAX_INQUIRY_SECONDS 60
|
---|
| 74 |
|
---|
| 75 | #define SDP_DEFAULT_INQUIRY_MAX_RESPONSES 255
|
---|
| 76 |
|
---|
| 77 | #define SDP_SERVICE_SEARCH_REQUEST 1
|
---|
| 78 | #define SDP_SERVICE_ATTRIBUTE_REQUEST 2
|
---|
| 79 | #define SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST 3
|
---|
| 80 |
|
---|
| 81 | typedef struct _BTH_QUERY_DEVICE {
|
---|
| 82 | ULONG LAP;
|
---|
| 83 | UCHAR length;
|
---|
| 84 | } BTH_QUERY_DEVICE,*PBTH_QUERY_DEVICE;
|
---|
| 85 | typedef struct _BTH_QUERY_SERVICE {
|
---|
| 86 | ULONG type;
|
---|
| 87 | ULONG serviceHandle;
|
---|
| 88 | SdpQueryUuid uuids[MAX_UUIDS_IN_QUERY];
|
---|
| 89 | ULONG numRange;
|
---|
| 90 | SdpAttributeRange pRange[1];
|
---|
| 91 | } BTH_QUERY_SERVICE,*PBTH_QUERY_SERVICE;
|
---|
| 92 |
|
---|
| 93 | #define BTHNS_RESULT_DEVICE_CONNECTED 0x00010000
|
---|
| 94 | #define BTHNS_RESULT_DEVICE_REMEMBERED 0x00020000
|
---|
| 95 | #define BTHNS_RESULT_DEVICE_AUTHENTICATED 0x00040000
|
---|
| 96 |
|
---|
| 97 | #define SIO_RFCOMM_SEND_COMMAND _WSAIORW (IOC_VENDOR, 101)
|
---|
| 98 | #define SIO_RFCOMM_WAIT_COMMAND _WSAIORW (IOC_VENDOR, 102)
|
---|
| 99 |
|
---|
| 100 | #define SIO_BTH_PING _WSAIORW (IOC_VENDOR, 8)
|
---|
| 101 | #define SIO_BTH_INFO _WSAIORW (IOC_VENDOR, 9)
|
---|
| 102 | #define SIO_RFCOMM_SESSION_FLOW_OFF _WSAIORW (IOC_VENDOR, 103)
|
---|
| 103 | #define SIO_RFCOMM_TEST _WSAIORW (IOC_VENDOR, 104)
|
---|
| 104 | #define SIO_RFCOMM_USECFC _WSAIORW (IOC_VENDOR, 105)
|
---|
| 105 |
|
---|
| 106 | #ifndef BIT
|
---|
| 107 | #define BIT(b) (1 << (b))
|
---|
| 108 | #endif
|
---|
| 109 |
|
---|
| 110 | #define MSC_EA_BIT EA_BIT
|
---|
| 111 | #define MSC_FC_BIT BIT (1)
|
---|
| 112 | #define MSC_RTC_BIT BIT (2)
|
---|
| 113 | #define MSC_RTR_BIT BIT (3)
|
---|
| 114 | #define MSC_RESERVED (BIT (4)|BIT (5))
|
---|
| 115 | #define MSC_IC_BIT BIT (6)
|
---|
| 116 | #define MSC_DV_BIT BIT (7)
|
---|
| 117 |
|
---|
| 118 | #define MSC_BREAK_BIT BIT (1)
|
---|
| 119 | #define MSC_SET_BREAK_LENGTH (b, l) ((b) = ((b) &0x3) | (((l) &0xf) << 4))
|
---|
| 120 |
|
---|
| 121 | #define RLS_ERROR 0x01
|
---|
| 122 | #define RLS_OVERRUN 0x02
|
---|
| 123 | #define RLS_PARITY 0x04
|
---|
| 124 | #define RLS_FRAMING 0x08
|
---|
| 125 |
|
---|
| 126 | #define RPN_BAUD_2400 0
|
---|
| 127 | #define RPN_BAUD_4800 1
|
---|
| 128 | #define RPN_BAUD_7200 2
|
---|
| 129 | #define RPN_BAUD_9600 3
|
---|
| 130 | #define RPN_BAUD_19200 4
|
---|
| 131 | #define RPN_BAUD_38400 5
|
---|
| 132 | #define RPN_BAUD_57600 6
|
---|
| 133 | #define RPN_BAUD_115200 7
|
---|
| 134 | #define RPN_BAUD_230400 8
|
---|
| 135 |
|
---|
| 136 | #define RPN_DATA_5 0x0
|
---|
| 137 | #define RPN_DATA_6 0x1
|
---|
| 138 | #define RPN_DATA_7 0x2
|
---|
| 139 | #define RPN_DATA_8 0x3
|
---|
| 140 |
|
---|
| 141 | #define RPN_STOP_1 0x0
|
---|
| 142 | #define RPN_STOP_1_5 0x4
|
---|
| 143 |
|
---|
| 144 | #define RPN_PARITY_NONE 0x00
|
---|
| 145 | #define RPN_PARITY_ODD 0x08
|
---|
| 146 | #define RPN_PARITY_EVEN 0x18
|
---|
| 147 | #define RPN_PARITY_MARK 0x28
|
---|
| 148 | #define RPN_PARITY_SPACE 0x38
|
---|
| 149 |
|
---|
| 150 | #define RPN_FLOW_X_IN 0x01
|
---|
| 151 | #define RPN_FLOW_X_OUT 0x02
|
---|
| 152 | #define RPN_FLOW_RTR_IN 0x04
|
---|
| 153 | #define RPN_FLOW_RTR_OUT 0x08
|
---|
| 154 | #define RPN_FLOW_RTC_IN 0x10
|
---|
| 155 | #define RPN_FLOW_RTC_OUT 0x20
|
---|
| 156 |
|
---|
| 157 | #define RPN_PARAM_BAUD 0x01
|
---|
| 158 | #define RPN_PARAM_DATA 0x02
|
---|
| 159 | #define RPN_PARAM_STOP 0x04
|
---|
| 160 | #define RPN_PARAM_PARITY 0x08
|
---|
| 161 | #define RPN_PARAM_P_TYPE 0x10
|
---|
| 162 | #define RPN_PARAM_XON 0x20
|
---|
| 163 | #define RPN_PARAM_XOFF 0x40
|
---|
| 164 |
|
---|
| 165 | #define RPN_PARAM_X_IN 0x01
|
---|
| 166 | #define RPN_PARAM_X_OUT 0x02
|
---|
| 167 | #define RPN_PARAM_RTR_IN 0x04
|
---|
| 168 | #define RPN_PARAM_RTR_OUT 0x08
|
---|
| 169 | #define RPN_PARAM_RTC_IN 0x10
|
---|
| 170 | #define RPN_PARAM_RTC_OUT 0x20
|
---|
| 171 |
|
---|
| 172 | #define RFCOMM_CMD_NONE 0
|
---|
| 173 | #define RFCOMM_CMD_MSC 1
|
---|
| 174 | #define RFCOMM_CMD_RLS 2
|
---|
| 175 | #define RFCOMM_CMD_RPN 3
|
---|
| 176 | #define RFCOMM_CMD_RPN_REQUEST 4
|
---|
| 177 | #define RFCOMM_CMD_RPN_RESPONSE 5
|
---|
| 178 |
|
---|
| 179 | typedef struct _RFCOMM_MSC_DATA {
|
---|
| 180 | UCHAR Signals;
|
---|
| 181 | UCHAR Break;
|
---|
| 182 | } RFCOMM_MSC_DATA,*PRFCOMM_MSC_DATA;
|
---|
| 183 |
|
---|
| 184 | typedef struct _RFCOMM_RLS_DATA {
|
---|
| 185 | UCHAR LineStatus;
|
---|
| 186 | } RFCOMM_RLS_DATA,*PRFCOMM_RLS_DATA;
|
---|
| 187 |
|
---|
| 188 | typedef struct _RFCOMM_RPN_DATA {
|
---|
| 189 | UCHAR Baud;
|
---|
| 190 | UCHAR Data;
|
---|
| 191 | UCHAR FlowControl;
|
---|
| 192 | UCHAR XonChar;
|
---|
| 193 | UCHAR XoffChar;
|
---|
| 194 | UCHAR ParameterMask1;
|
---|
| 195 | UCHAR ParameterMask2;
|
---|
| 196 | } RFCOMM_RPN_DATA,*PRFCOMM_RPN_DATA;
|
---|
| 197 |
|
---|
| 198 | typedef struct _RFCOMM_COMMAND {
|
---|
| 199 | ULONG CmdType;
|
---|
| 200 | union {
|
---|
| 201 | RFCOMM_MSC_DATA MSC;
|
---|
| 202 | RFCOMM_RLS_DATA RLS;
|
---|
| 203 | RFCOMM_RPN_DATA RPN;
|
---|
| 204 | } Data;
|
---|
| 205 | } RFCOMM_COMMAND,*PRFCOMM_COMMAND;
|
---|
| 206 |
|
---|
| 207 | typedef struct _BTH_PING_REQ {
|
---|
| 208 | BTH_ADDR btAddr;
|
---|
| 209 | UCHAR dataLen;
|
---|
| 210 | UCHAR data[MAX_L2CAP_PING_DATA_LENGTH];
|
---|
| 211 | } BTH_PING_REQ,*PBTH_PING_REQ;
|
---|
| 212 |
|
---|
| 213 | typedef struct _BTH_PING_RSP {
|
---|
| 214 | UCHAR dataLen;
|
---|
| 215 | UCHAR data[MAX_L2CAP_PING_DATA_LENGTH];
|
---|
| 216 | } BTH_PING_RSP,*PBTH_PING_RSP;
|
---|
| 217 |
|
---|
| 218 | typedef struct _BTH_INFO_REQ {
|
---|
| 219 | BTH_ADDR btAddr;
|
---|
| 220 | USHORT infoType;
|
---|
| 221 | } BTH_INFO_REQ,*PBTH_INFO_REQ;
|
---|
| 222 |
|
---|
| 223 | typedef struct _BTH_INFO_RSP {
|
---|
| 224 | USHORT result;
|
---|
| 225 | UCHAR dataLen;
|
---|
| 226 | __C89_NAMELESS union {
|
---|
| 227 | USHORT connectionlessMTU;
|
---|
| 228 | UCHAR data[MAX_L2CAP_INFO_DATA_LENGTH];
|
---|
| 229 | };
|
---|
| 230 | } BTH_INFO_RSP,*PBTH_INFO_RSP;
|
---|
| 231 |
|
---|
| 232 | typedef struct _BTH_SET_SERVICE BTHNS_SETBLOB,*PBTHNS_SETBLOB;
|
---|
| 233 | typedef struct _BTH_QUERY_DEVICE BTHNS_INQUIRYBLOB,*PBTHNS_INQUIRYBLOB;
|
---|
| 234 | typedef struct _BTH_QUERY_SERVICE BTHNS_RESTRICTIONBLOB,*PBTHNS_RESTRICTIONBLOB;
|
---|
| 235 |
|
---|
| 236 | #include <poppack.h>
|
---|
| 237 |
|
---|
| 238 | #endif
|
---|
| 239 |
|
---|
| 240 | #endif
|
---|