summaryrefslogtreecommitdiffstats
path: root/private/ntos/tdi/irda/inc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--private/ntos/tdi/irda/inc/af_irda.h100
-rw-r--r--private/ntos/tdi/irda/inc/decdirda.h174
-rw-r--r--private/ntos/tdi/irda/inc/irda.h857
-rw-r--r--private/ntos/tdi/irda/inc/irdalink.h34
-rw-r--r--private/ntos/tdi/irda/inc/irerr.h110
-rw-r--r--private/ntos/tdi/irda/inc/irlap.h66
-rw-r--r--private/ntos/tdi/irda/inc/irlaplog.h44
-rw-r--r--private/ntos/tdi/irda/inc/irlmp.h60
-rw-r--r--private/ntos/tdi/irda/inc/irmac.h32
-rw-r--r--private/ntos/tdi/irda/inc/oscfg.h62
-rw-r--r--private/ntos/tdi/irda/inc/tmp.h31
11 files changed, 1570 insertions, 0 deletions
diff --git a/private/ntos/tdi/irda/inc/af_irda.h b/private/ntos/tdi/irda/inc/af_irda.h
new file mode 100644
index 000000000..5e5d36b0d
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/af_irda.h
@@ -0,0 +1,100 @@
+//
+// this is the header file that describes the IRDA address family
+//
+// CREATED 4/28: AldenG
+//
+
+#ifndef __AFIRDA__
+#define __AFIRDA__
+
+#include <winsock.h>
+
+#define AF_IRDA 22 // see winsock.h
+#define PF_IRDA AF_IRDA
+
+#define SOL_IRLMP 0x00FF
+
+#define IRLMP_ENUMDEVICES 0x00000010
+#define IRLMP_IAS_SET 0x00000011
+#define IRLMP_IAS_QUERY 0x00000012
+#define IRLMP_SEND_PDU_LEN 0x00000013
+#define IRLMP_EXCLUSIVE_MODE 0x00000014
+#define IRLMP_IRLPT_MODE 0x00000015
+#define IRLMP_9WIRE_MODE 0x00000016
+
+#define IAS_ATTRIB_NO_CLASS 0x00000010
+#define IAS_ATTRIB_NO_ATTRIB 0x00000000
+#define IAS_ATTRIB_INT 0x00000001
+#define IAS_ATTRIB_OCTETSEQ 0x00000002
+#define IAS_ATTRIB_STR 0x00000003
+
+typedef struct _SOCKADDR_IRDA
+{
+ u_short irdaAddressFamily;
+ u_char irdaDeviceID[4];
+ char irdaServiceName[25];
+} SOCKADDR_IRDA, *PSOCKADDR_IRDA;
+
+typedef struct _IRDA_DEVICE_INFO
+{
+ u_char irdaDeviceID[4];
+ char irdaDeviceName[22];
+ u_char Reserved[2];
+} IRDA_DEVICE_INFO, *PIRDA_DEVICE_INFO, FAR *LPIRDA_DEVICE_INFO;
+
+typedef struct _DEVICELIST
+{
+ ULONG numDevice;
+ IRDA_DEVICE_INFO Device[1];
+} DEVICELIST, *PDEVICELIST, FAR *LPDEVICELIST;
+
+typedef struct _IAS_SET
+{
+ char irdaClassName[61];
+ char irdaAttribName[61];
+ u_short irdaAttribType;
+ union
+ {
+ int irdaAttribInt;
+ struct
+ {
+ int Len;
+ u_char OctetSeq[1];
+ u_char Reserved[3];
+ } irdaAttribOctetSeq;
+ struct
+ {
+ int Len;
+ u_char CharSet;
+ u_char UsrStr[1];
+ u_char Reserved[2];
+ } irdaAttribUsrStr;
+ } irdaAttribute;
+} IAS_SET, *PIAS_SET, FAR *LPIAS_SET;
+
+typedef struct _IAS_QUERY
+{
+ u_char irdaDeviceID[4];
+ char irdaClassName[61];
+ char irdaAttribName[61];
+ u_short irdaAttribType;
+ union
+ {
+ int irdaAttribInt;
+ struct
+ {
+ int Len;
+ u_char OctetSeq[1];
+ u_char Reserved[3];
+ } irdaAttribOctetSeq;
+ struct
+ {
+ int Len;
+ u_char CharSet;
+ u_char UsrStr[1];
+ u_char Reserved[2];
+ } irdaAttribUsrStr;
+ } irdaAttribute;
+} IAS_QUERY, *PIAS_QUERY, FAR *LPIAS_QUERY;
+
+#endif // __AFIRDA__
diff --git a/private/ntos/tdi/irda/inc/decdirda.h b/private/ntos/tdi/irda/inc/decdirda.h
new file mode 100644
index 000000000..d93b0d9e3
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/decdirda.h
@@ -0,0 +1,174 @@
+// returns pointers pOutStr
+TCHAR *DecodeIRDA(int *pFrameType,// return frame type (-1 = bad frame)
+ BYTE *pFrameBuf, // pointer to buffer containing IRLAP frame
+ UINT FrameLen, // length of buffer
+ TCHAR *pOutStr, // string where decode packet is placed
+ UINT DecodeLayer,// 2-LAP only, 3-LAP/LMP, 4-LAP/LMP/TTP
+ BOOL fNoConnAddr,// TRUE->Don't show connection address in str
+ int DispMode // DISP_ASCII/HEX/BOTH
+);
+
+#define DISP_ASCII 1
+#define DISP_HEX 2
+#define DISP_BOTH 3
+
+extern int BaudBitMask;
+
+#define IRLAP_BOF 0xC0
+#define IRLAP_EOF 0xC1
+#define IRLAP_ESC 0x7D
+#define IRLAP_COMP_BIT 0x20
+
+#define IRLAP_BROADCAST 0xfe
+#define _IRLAP_CMD 0x01
+#define _IRLAP_RSP 0x00
+
+#define IRLAP_I_FRM 0x00
+#define IRLAP_S_FRM 0x01
+#define IRLAP_U_FRM 0x03
+
+/*
+** Unnumbered Frame types with P/F bit set to 0
+*/
+#define IRLAP_UI 0x03
+#define IRLAP_XID_CMD 0x2f
+#define IRLAP_TEST 0xe3
+#define IRLAP_SNRM 0x83
+#define IRLAP_DISC 0x43
+#define IRLAP_UA 0x63
+#define IRLAP_FRMR 0x87
+#define IRLAP_DM 0x0f
+#define IRLAP_XID_RSP 0xaf
+
+/*
+** Supervisory Frames
+*/
+#define IRLAP_RR 0x01
+#define IRLAP_RNR 0x05
+#define IRLAP_REJ 0x09
+#define IRLAP_SREJ 0x0d
+
+
+#define IRLAP_GET_ADDR(addr) (addr >> 1)
+#define IRLAP_GET_CRBIT(addr) (addr & 1)
+#define IRLAP_GET_PFBIT(cntl) ((cntl >>4) & 1)
+#define IRLAP_GET_UCNTL(cntl) (cntl & 0xEF)
+#define IRLAP_GET_SCNTL(cntl) (cntl & 0x0F)
+#define IRLAP_FRAME_TYPE(cntl) (cntl & 0x01 ? (cntl & 3) : 0)
+#define IRLAP_GET_NR(cntl) ((cntl & 0xE0) >> 5)
+#define IRLAP_GET_NS(cntl) ((cntl & 0xE) >> 1)
+
+/*
+** XID stuff
+*/
+#define XID_DISCV_FORMAT_ID 0x01
+#define XID_NEGPARMS_FORMAT_ID 0x02
+
+typedef struct
+{
+ BYTE SrcAddr[4];
+ BYTE DestAddr[4];
+ BYTE NoOfSlots:2;
+ BYTE GenNewAddr:1;
+ BYTE Reserved:5;
+ BYTE SlotNo;
+ BYTE Version;
+} XID_DISCV_FORMAT;
+
+/*
+** SNRM
+*/
+typedef struct
+{
+ BYTE SrcAddr[4];
+ BYTE DestAddr[4];
+ BYTE ConnAddr;
+ BYTE FirstPI;
+} SNRM_FORMAT;
+
+/*
+** UA
+*/
+typedef struct
+{
+ BYTE SrcAddr[4];
+ BYTE DestAddr[4];
+ BYTE FirstPI;
+} UA_FORMAT;
+
+/*
+** LM-PDU stuff
+*/
+typedef struct
+{
+ BYTE DLSAP_SEL:7;
+ BYTE CntlBit:1;
+ BYTE SLSAP_SEL:7;
+ BYTE RsvrdBi1:1;
+} LM_HEADER;
+
+/* LM-PDU frame types */
+#define LM_PDU_CNTL_FRAME 1
+#define LM_PDU_DATA_FRAME 0
+
+typedef struct
+{
+ BYTE OpCode:7;
+ BYTE ABit:1;
+} LM_CNTL_FORMAT;
+
+/* Opcodes */
+#define LM_PDU_CONNECT 1
+#define LM_PDU_DISCONNECT 2
+#define LM_PDU_ACCESSMODE 3
+
+#define LM_PDU_REQUEST 0
+#define LM_PDU_CONFIRM 1
+
+#define LM_PDU_SUCCESS 0
+#define LM_PDU_FAILURE 1
+#define LM_PDU_UNSUPPORTED 0xFF
+
+#define LM_PDU_MULTIPLEXED 0
+#define LM_PDU_EXCLUSIVE 1
+
+/* Max disconnect reason code, see _LM_PDU_DscReason[] in decdirda.c */
+#define LM_PDU_MAX_DSC_REASON 0x8
+
+/*
+** Negotiation Parameter Identifiers
+*/
+#define NEG_PI_BAUD 0x01
+#define NEG_PI_MAX_TAT 0x82
+#define NEG_PI_DATA_SZ 0x83
+#define NEG_PI_WIN_SZ 0x84
+#define NEG_PI_BOFS 0x85
+#define NEG_PI_MIN_TAT 0x86
+#define NEG_PI_DISC_THRESH 0x08
+
+// Tiny TP!
+
+#define TTP_PFLAG_NO_PARMS 0
+#define TTP_PFLAG_PARMS 1
+
+#define TTP_MBIT_NOT_FINAL 1
+#define TTP_MBIT_FINAL 0
+
+typedef struct
+{
+ BYTE InitialCredit : 7;
+ BYTE ParmFlag : 1;
+} TTP_CONN_HEADER;
+
+typedef struct
+{
+ BYTE AdditionalCredit : 7;
+ BYTE MoreBit : 1;
+} TTP_DATA_HEADER;
+
+#define net_short(x) ((((x)&0xff) << 8) | (((x)&0xff00) >> 8))
+
+#define net_long(x) (((((DWORD UNALIGNED)(x))&0xffL)<<24) | \
+ ((((DWORD UNALIGNED)(x))&0xff00L)<<8) | \
+ ((((DWORD UNALIGNED)(x))&0xff0000L)>>8) | \
+ ((((DWORD UNALIGNED)(x))&0xff000000L)>>24))
diff --git a/private/ntos/tdi/irda/inc/irda.h b/private/ntos/tdi/irda/inc/irda.h
new file mode 100644
index 000000000..ab9d55674
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/irda.h
@@ -0,0 +1,857 @@
+/*****************************************************************************
+*
+* Copyright (c) 1995 Microsoft Corporation
+*
+* File: irda.h
+*
+* Description: Definitions used across the IRDA stack
+*
+* Author: mbert
+*
+* Date: 4/15/95
+*
+* This file primarily defines the IRDA message (IRDA_MSG) used for
+* communicating with the stack and communication between the layers
+* of the stack. IRDA_MSG provides the following services:
+* MAC_CONTROL_SERVICE
+* IRLAP_DISCOVERY_SERVICE
+* IRDA_DISCONNECT_SERVICE
+* IRDA_CONNECT_SERVICE
+* IRDA_DATA_SERVICE
+* IRLMP_ACCESSMODE_SERVICE
+* IRLMP_IAS_SERVICE
+*
+* IRDA_MSG usage:
+*
+* +-------+
+* | IRLAP |
+* +-------+
+* |
+* | IRMAC_Down(IRDA_MSG)
+* \|/
+* +-------+
+* | IRMAC |
+* +-------+
+* |**************************************************************************|
+* | Prim | MsgType and parameters |
+* |==========================================================================|
+* | MAC_DATA_REQ | IRDA_DATA_SERVICE |
+* | | o IRDA_MSG_pHdrRead = start of IRDA headers |
+* | | o IRDA_MSG_pHdrWrite = end of header |
+* | | o IRDA_MSG_pRead = start of data |
+* | | o IRDA_MSG_pWrite = end of data |
+* |--------------------------+-----------------------------------------------|
+* | MAC_CONTROL_REQ | MAC_CONTROL_SERVICE |
+* | | o IRDA_MSG_Op = MAC_INITIALIZIE_LINK |
+* | | - IRDA_MSG_Port |
+* | | - IRDA_MSG_Baud |
+* | | - IRDA_MSG_MinTat = min turn time |
+* | | - IRDA_MSG_NumBOFs = # added when tx'ing |
+* | | - IRDA_MSG_DataSize = max rx frame |
+* | | - IRDA_MSG_SetIR = TRUE/FALSE (does an |
+* | | EscapeComm(SETIR) to select int/ext |
+* | | dongle) |
+* | | o IRDA_MSG_Op = MAC_MEDIA_SENSE |
+* | | - IRDA_MSG_SenseTime (in ms) |
+* | | o IRDA_MSG_Op = MAC_RECONFIG_LINK |
+* | | - IRDA_MSG_Baud |
+* | | - IRDA_MSG_NumBOFs = # added when tx'ing |
+* | | - IRDA_MSG_DataSize = max rx frame |
+* | | - IRDA_MSG_MinTat = min turn time |
+* | | o IRDA_MSG_OP = MAC_SHUTDOWN_LINK |
+* |--------------------------------------------------------------------------|
+*
+* +-------+
+* | IRLAP |
+* +-------+
+* /|\
+* | IRLAP_Up(IRDA_MSG)
+* |
+* +-------+
+* | IRMAC |
+* +-------+
+* |**************************************************************************|
+* | Prim | MsgType and parameters |
+* |==========================================================================|
+* | MAC_DATA_IND | IRDA_DATA_SERVICE |
+* | | o IRDA_MSG_pRead = start of frame |
+* | | (includes IRLAP header) |
+* | | o IRDA_MSG_pWrite = end of frame |
+* | | (excludes FCS) |
+* |--------------------------+-----------------------------------------------|
+* | MAC_CONTROL_CONF | MAC_CONTROL_SERVICE |
+* | | o IRDA_MSG_Op = MAC_MEDIA_SENSE |
+* | | - IRDA_MSG_OpStatus = MAC_MEDIA_BUSY |
+* | | MAC_MEDIA_CLEAR |
+* |--------------------------------------------------------------------------|
+*
+* +-------+
+* | IRLMP |
+* +-------+
+* |
+* | IRLAP_Down(IRDA_MSG)
+* \|/
+* +-------+
+* | IRLAP |
+* +-------+
+* |**************************************************************************|
+* | Prim | MsgType and parameters |
+* |==========================================================================|
+* | IRLAP_DISCOVERY_REQ | IRLAP_DISCOVERY_SERVICE |
+* | IRLAP_Down() returns | o IRDA_MSG_SenseMedia = TRUE/FALSE |
+* | IRLAP_REMOTE_DISCOVERY_IN_PROGRESS_ERR or |
+* | IRLAP_REMOTE_CONNECT_IN_PROGRESS_ERR when indicated |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_CONNECT_REQ | IRDA_CONNECT_SERVICE |
+* | | o IRDA_MSG_RemoteDevAddr |
+* | IRLAP_Down() returns | |
+* | IRLAP_REMOTE_DISCOVERY_IN_PROGRESS_ERR when indicated |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_CONNECT_RESP | no parms |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_DISCONNECT_REQ | no parms |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_DATA_REQ | IRDA_DATA_SERVICE |
+* | IRLAP_UDATA_REQ | o IRDA_MSG_pHdrRead = start of IRLMP header |
+* | IRLAP_Down() returns | o IRDA_MSG_pHdrWrite = end of header |
+* | IRLAP_REMOTE_BUSY to | o IRDA_MSG_pRead = start of data |
+* | to flow off LMP. | o IRDA_MSG_pWrite = end of data |
+* |--------------------------------------------------------------------------|
+* | IRLAP_FLOWON_REQ | no parms |
+* |--------------------------------------------------------------------------|
+*
+* +-------+
+* | IRLMP |
+* +-------+
+* /|\
+* | IRLMP_Up(IRDA_MSG)
+* |
+* +-------+
+* | IRLAP |
+* +-------+
+* |**************************************************************************|
+* | Prim | MsgType and parameters |
+* |==========================================================================|
+* | IRLAP_DISCOVERY_IND | IRLAP_DISCOVERY_SERVICE |
+* | | o pDevList = Discovery info of device that |
+* | | initiated discovery |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_DISCOVERY_CONF | IRLAP_DISCOVERY_SERVICE |
+* | | o IRDA_MSG_pDevList = list of discovered |
+* | | devices, NULL when |
+* | | status != IRLAP_DISCOVERY_COMPLETED |
+* | | o IRDA_MSG_DscvStatus = |
+* | | MAC_MEDIA_BUSY |
+* | | IRLAP_REMOTE_DISCOVERY_IN_PROGRESS |
+* | | IRLAP_DISCOVERY_COLLISION |
+* | | IRLAP_REMOTE_CONNECTION_IN_PROGRESS |
+* | | IRLAP_DISCOVERY_COMPLETED |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_CONNECT_IND | IRDA_CONNECT_SERVICE |
+* | | o IRDA_MSG_RemoteDevAddr |
+* | | o IRDA_MSG_pQOS = Negotiated QOS |
+* |--------------------------------------------------------------------------|
+* | IRLAP_CONNECT_CONF | IRDA_CONNECT_SERVICE |
+* | | o IRDA_MSG_pQOS = Negotiated QOS, only when |
+* | | successful |
+* | | o IRDA_MSG_ConnStatus = |
+* | | IRLAP_CONNECTION_COMPLETE |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_DISCONNECT_IND | IRDA_DISCONNECT_SERVICE |
+* | | o IRDA_MSG_DiscStatus = |
+* | | IRLAP_DISCONNECT_COMPLETED |
+* | | IRLAP_REMOTED_INITIATED |
+* | | IRLAP_PRIMARY_CONFLICT |
+* | | IRLAP_REMOTE_DISCOVERY_IN_PROGRESS |
+* | | IRLAP_NO_RESPONSE |
+* | | IRLAP_DECLINE_RESET |
+* | | MAC_MEDIA_BUSY |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_DATA_IND | IRDA_DATA_SERVICE |
+* | IRLAP_UDATA_IND | o IRDA_MSG_pRead = start of IRLMP packet |
+* | | o IRDA_MSG_pWrite = end of IRLMP packet |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_DATA_CONF | IRDA_DATA_SERVICE |
+* | IRLAP_UDATA_CONF | o IRDA_MSG_DataStatus = |
+* | | ILAP_DATA_REQUEST_COMPLETED |
+* | | IRLAP_DATA_REQUEST_FAILED_LINK_RESET |
+* |--------------------------+-----------------------------------------------|
+* | IRLAP_STATUS_IND | no parms |
+* |--------------------------------------------------------------------------|
+*
+* +--------------+
+* | TransportAPI |
+* +--------------+
+* |
+* | IRLMP_Down(IRLMPContext, IRDA_MSG)
+* \|/
+* +-------+
+* | IRLMP |
+* +-------+
+* |**************************************************************************|
+* | Prim | MsgType and parameters |
+* |==========================================================================|
+* | IRLMP_DISCOVERY_REQ | no parms |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_CONNECT_REQ | IRDA_CONNECT_SERVICE |
+* | IRLMP_Down() returns | o IRDA_MSG_RemoteDevAddr |
+* | IRLMP_LINK_IN_USE | o IRDA_MSG_RemoteLSAPSel |
+* | when the requested | o IRDA_MSG_pQOS (may be NULL) |
+* | connection is to a | o IRDA_MSG_pConnData |
+* | remote device other | o IRDA_MSG_ConnDataLen |
+* | than the one the link | o IRDA_MSG_LocalLSAPSel |
+* | is currently connected | o IRDA_MSG_pContext |
+* | or connecting to. | o IRDA_MSG_UseTTP |
+* | | o IRDA_MSG_TTPCredits |
+* | | o IRDA_MSG_MaxSDUSize - Max size that this |
+* | | IRLMP client can receive. |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_CONNECT_RESP | IRDA_CONNECT_SERVICE |
+* | | o IRDA_MSG_pConnData |
+* | | o IRDA_MSG_ConnDataLen |
+* | | o IRDA_MSG_pContext |
+* | | o IRDA_MSG_MaxSDUSize - Max size that this |
+* | | IRLMP client can receive. |
+* | | o IRDA_MSG_TTPCredits |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_DISCONNECT_REQ | IRDA_DISCONNECT_SERVICE |
+* | | o IRDA_MSG_pDiscData |
+* | | o IRDA_MSG_DiscDataLen |
+* | | |
+* | | |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_DATA/UDATA_REQ | IRDA_DATA_SERVICE |
+* | IRLMP_Down() may return| o IRDA_MSG_pDataContext = ptr to NDIS_BUFFER|
+* | IRLMP_REMOTE_BUSY, | o IRDA_MSG_IrCOMM_9Wire = TRUE/FALSE |
+* | when tx cred exhausted| |
+* | in multiplexed mode. | |
+* | IRLAP_REMOTE_BUSY, | |
+* | when remote IRLAP | |
+* | flowed off in exclMode| |
+* | In either case the req | |
+* | was successful. | |
+* |--------------------------------------------------------------------------|
+* | IRLMP_ACCESSMODE_REQ | IRLMP_ACCESSMODE_SERVICE |
+* | IRLMP_Down() may return| o IRDA_MSG_AccessMode = IRLMP_MULTIPLEXED |
+* | IRLMP_IN_EXCLUSIVE_MODE| IRLMP_EXCLUSIVE |
+* | if already in excl-mode| o IRDA_MSG_IrLPTMode - TRUE, doesn't send |
+* | IRLMP_IN_MULTIPLEXED...| the Access PDU |
+* | if other LSAPs exist or| |
+* | requesting trans to this state when already in it. |
+* |--------------------------------------------------------------------------|
+* | IRLMP_FLOWON_REQ | no parms |
+* |--------------------------------------------------------------------------|
+* | IRLMP_MORECREDIT_REQ | IRDA_CONNECT_SERVICE (cuz parm is defined) |
+* | | o IRDA_MSG_TTPCredits |
+* |--------------------------------------------------------------------------|
+* | IRLMP_GETVALUEBYCLASS_REQ| IRDA_IAS_SERVICE |
+* | | o IRDA_MSG_pIASQuery |
+* | | o IRDA_MSG_AttribLen |
+* | | o IRDA_MSG_IASQueryPerms |
+* |--------------------------------------------------------------------------|
+*
+*
+* +--------------+
+* | TransportAPI |
+* +--------------+
+* /|\
+* | TransportAPI_Up(TransportAPIContext, IRDA_MSG)
+* |
+* +-------+
+* | IRLMP |
+* +-------+
+* |**************************************************************************|
+* | Prim | MsgType and parameters |
+* |==========================================================================|
+* | IRLAP_DISCOVERY_IND | IRLAP_DISCOVERY_SERVICE |
+* | | o pDevList = aged Discovery list |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_DISCOVERY_CONF | same as IRLAP_DISCOVERY_CONF. The device list |
+* | | however is the one maintained in IRLMP |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_DISCONNECT_IND | IRDA_DISCONNECT_SERVICE |
+* | | o IRDA_MSG_DiscReason = |
+* | | see IRLMP_DISC_REASON below |
+* | | o IRDA_MSG_pDiscData - may be NULL |
+* | | o IRDA_MSG_DiscDataLen |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_CONNECT_IND | IRDA_CONNECT_SERVICE |
+* | | o IRDA_MSG_RemoteDevAddr |
+* | | o IRDA_MSG_RemoteLSAPSel; |
+* | | o IRDA_MSG_LocalLSAPSel; |
+* | | o IRDA_MSG_pQOS |
+* | | o IRDA_MSG_pConnData |
+* | | o IRDA_MSG_ConnDataLen |
+* | | o IRDA_MSG_pContext |
+* | | o IRDA_MSG_MaxSDUSize - Max size that this |
+* | | IRLMP client can send to peer |
+* | | o IRDA_MSG_MaxPDUSize |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_CONNECT_CONF | IRDA_CONNECT_SERVICE |
+* | | o IRDA_MSG_pQOS |
+* | | o IRDA_MSG_pConnData |
+* | | o IRDA_MSG_ConnDataLen |
+* | | o IRDA_MSG_pContext |
+* | | o IRDA_MSG_MaxSDUSize - Max size that this |
+* | | IRLMP client can send to peer |
+* | | o IRDA_MSG_MaxPDUSize |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_DATA_IND | IRDA_DATA_SERVICE |
+* | | o IRDA_MSG_pRead = start of User Data |
+* | | o IRDA_MSG_pWrite = end of User Data |
+* | | o IRDA_MSG_FinalSeg = TRUE/FALSE |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_DATA_CONF | IRDA_DATA_SERVICE |
+* | | o IRDA_MSG_pDataContext = ptr to NDIS_BUFFER|
+* | | o IRDA_MSG_DataStatus = |
+* | | IRLMP_DATA_REQUEST_COMPLETED |
+* | | IRLMP_DATA_REQUEST_FAILED |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_ACCESSMODE_IND | IRLMP_ACCESSMODE_SERVICE |
+* | | o IRDA_MSG_AccessMode = |
+* | | IRLMP_EXCLUSIVE |
+* | | IRLMP_MULTIPLEXED |
+* |--------------------------+-----------------------------------------------|
+* | IRLMP_ACCESSMODE_CONF | IRLMP_ACCESSMODE_SERVICE |
+* | | o IRDA_MSG_AccessMode = |
+* | | IRLMP_EXCLUSIVE |
+* | | IRLMP_MULTIPLEXED |
+* | | o IRDA_MSG_ModeStatus = |
+* | | IRLMP_ACCESSMODE_SUCCESS |
+* | | IRLMP_ACCESSMODE_FAILURE |
+* |--------------------------+-----------------------------------------------|
+* |IRLMP_GETVALUEBYCLASS_CONF| IRDA_DATA_SERVICE |
+* | | o IRDA_MSG_pIASQuery |
+* | | o IRDA_MSG_IASStatus = An IRLMP_DISC_REASON |
+* | | (see below) |
+* |--------------------------------------------------------------------------|
+*/
+
+#include <nt.h>
+#include <ntos.h>
+#include <ntrtl.h>
+#include <nturtl.h>
+
+#include <windef.h>
+#include <winbase.h>
+#include <winsock.h>
+#include <wsahelp.h>
+#include <basetyps.h>
+
+#include <ndis.h>
+
+#include <af_irda.h>
+
+#include <cxport.h>
+
+#include <irerr.h>
+
+#include <tmp.h>
+
+#define TEMPERAMENTAL_SERIAL_DRIVER // drivers busted. intercharacter delays cause
+ // IrLAP to reset.
+
+#ifdef DEBUG
+// Prototypes for Debugging Output
+void IRDA_DebugOut (TCHAR *pFormat, ...);
+void IRDA_DebugStartLog (void);
+void IRDA_DebugEndLog (void *, void *);
+#endif
+
+// Debug zone definitions.
+/*
+#define ZONE_IRDA DEBUGZONE(0)
+#define ZONE_IRLAP DEBUGZONE(2)
+#ifdef PEG
+#define ZONE_IRMAC DEBUGZONE(1)
+#define ZONE_IRLMP DEBUGZONE(3)
+#define ZONE_IRLMP_CONN DEBUGZONE(4)
+#define ZONE_IRLMP_CRED DEBUGZONE(5)
+#else
+extern int ZONE_IRMAC;
+extern int ZONE_IRLMP;
+extern int ZONE_IRLMP_CONN;
+extern int ZONE_IRLMP_CRED;
+#endif
+#define ZONE_DISCOVER DEBUGZONE(8)
+#define ZONE_PRINT DEBUGZONE(9)
+#define ZONE_ADDR DEBUGZONE(10)
+#define ZONE_MISC DEBUGZONE(11)
+#define ZONE_ALLOC DEBUGZONE(12)
+#define ZONE_FUNCTION DEBUGZONE(13)
+#define ZONE_WARN DEBUGZONE(14)
+#define ZONE_ERROR DEBUGZONE(15)
+*/
+
+
+#define IRDA_ALLOC_MEM(ptr, sz, id) ((ptr) = CTEAllocMem(sz))
+#define IRDA_FREE_MEM(ptr) CTEFreeMem((ptr))
+
+//extern CRITICAL_SECTION IrdaCS;
+
+// Time how low we wait for the critical section
+/*
+#define ENTER_IRDA_WITH_CRITICAL_SECTION(s) do { \
+ LPWSTR Owner = IrdaCSOwner; \
+ DWORD StartTick = GetTickCount(); \
+ EnterCriticalSection (&IrdaCS); \
+ IrdaCSOwner = s; \
+ StartTick = GetTickCount() - StartTick; \
+ if (StartTick > MaxWaitIrdaCS) { \
+ DEBUGMSG (1, (TEXT("%s: IRDA Wait for CS %dms (Owner=%s)\r\n"), \
+ s, StartTick, Owner)); \
+ MaxWaitIrdaCS = StartTick; \
+ } \
+ } while (0)
+
+
+#define LEAVE_IRDA_WITH_CRITICAL_SECTION IrdaCSOwner = TEXT(""), LeaveCriticalSection(&IrdaCS)
+
+#else // TIME_CS
+#define ENTER_IRDA_WITH_CRITICAL_SECTION(s) EnterCriticalSection(&IrdaCS)
+
+#define LEAVE_IRDA_WITH_CRITICAL_SECTION LeaveCriticalSection(&IrdaCS)
+#endif // TIME_CS
+*/
+#define STATIC static
+
+#define RetOnErr(func) do {if((_rc = func) != SUCCESS) return _rc;} while(0)
+
+typedef struct
+{
+ CTETimer CteTimer;
+ VOID (*ExpFunc)(PVOID Context);
+ PVOID Context;
+ UINT Timeout;
+ BOOL Late;
+#ifdef DEBUG
+ char *pName;
+#endif
+} IRDA_TIMER, *PIRDA_TIMER;
+
+#define IRMAC_CONTEXT(ilcb) ((ilcb)->IrmacContext)
+#define IRLAP_CONTEXT(ilcb) ((ilcb)->IrlapContext)
+#define IRLMP_CONTEXT(ilcb) ((ilcb)->IrlmpContext)
+
+// Device/Discovery Information
+#define IRLAP_DSCV_INFO_LEN 32
+#define IRDA_DEV_ADDR_LEN 4
+
+typedef struct
+{
+ LIST_ENTRY Linkage;
+ BYTE DevAddr[IRDA_DEV_ADDR_LEN];
+ int DscvMethod;
+ int IRLAP_Version;
+ BYTE DscvInfo[IRLAP_DSCV_INFO_LEN];
+ int DscvInfoLen;
+ int NotSeenCnt; // used by IRLMP to determine when to remove
+ // the device from its list
+ PVOID LinkContext; // Link on which device was discovered
+} IRDA_DEVICE;
+
+// IRLAP Quality of Service
+#define BIT_0 1
+#define BIT_1 2
+#define BIT_2 4
+#define BIT_3 8
+#define BIT_4 16
+#define BIT_5 32
+#define BIT_6 64
+#define BIT_7 128
+#define BIT_8 256
+
+#define BPS_2400 BIT_0 // Baud Rates
+#define BPS_9600 BIT_1
+#define BPS_19200 BIT_2
+#define BPS_38400 BIT_3
+#define BPS_57600 BIT_4
+#define BPS_115200 BIT_5
+#define BPS_4000000 BIT_8
+
+#define MAX_TAT_500 BIT_0 // Maximum Turnaround Time (millisecs)
+#define MAX_TAT_250 BIT_1
+#define MAX_TAT_100 BIT_2
+#define MAX_TAT_50 BIT_3
+#define MAX_TAT_25 BIT_4
+#define MAX_TAT_10 BIT_5
+#define MAX_TAT_5 BIT_6
+
+#define DATA_SIZE_64 BIT_0 // Data Size (bytes)
+#define DATA_SIZE_128 BIT_1
+#define DATA_SIZE_256 BIT_2
+#define DATA_SIZE_512 BIT_3
+#define DATA_SIZE_1024 BIT_4
+#define DATA_SIZE_2048 BIT_5
+
+#define FRAMES_1 BIT_0 // Window Size
+#define FRAMES_2 BIT_1
+#define FRAMES_3 BIT_2
+#define FRAMES_4 BIT_3
+#define FRAMES_5 BIT_4
+#define FRAMES_6 BIT_5
+#define FRAMES_7 BIT_6
+
+#define BOFS_48 BIT_0 // Additional Beginning of Frame Flags
+#define BOFS_24 BIT_1
+#define BOFS_12 BIT_2
+#define BOFS_5 BIT_3
+#define BOFS_3 BIT_4
+#define BOFS_2 BIT_5
+#define BOFS_1 BIT_6
+#define BOFS_0 BIT_7
+
+#define MIN_TAT_10 BIT_0 // Minumum Turnaround Time (millisecs)
+#define MIN_TAT_5 BIT_1
+#define MIN_TAT_1 BIT_2
+#define MIN_TAT_0_5 BIT_3
+#define MIN_TAT_0_1 BIT_4
+#define MIN_TAT_0_05 BIT_5
+#define MIN_TAT_0_01 BIT_6
+#define MIN_TAT_0 BIT_7
+
+#define DISC_TIME_3 BIT_0 // Link Disconnect/Threshold Time (seconds)
+#define DISC_TIME_8 BIT_1
+#define DISC_TIME_12 BIT_2
+#define DISC_TIME_16 BIT_3
+#define DISC_TIME_20 BIT_4
+#define DISC_TIME_25 BIT_5
+#define DISC_TIME_30 BIT_6
+#define DISC_TIME_40 BIT_7
+
+typedef struct
+{
+ UINT bfBaud;
+ UINT bfMaxTurnTime;
+ UINT bfDataSize;
+ UINT bfWindowSize;
+ UINT bfBofs;
+ UINT bfMinTurnTime;
+ UINT bfDisconnectTime; // holds threshold time also
+} IRDA_QOS_PARMS;
+
+
+// IrDA Message Primitives
+typedef enum
+{
+ MAC_DATA_REQ = 0, // Keep in sync with table in irlaplog.c
+ MAC_DATA_IND,
+ MAC_CONTROL_REQ,
+ MAC_CONTROL_CONF,
+ IRLAP_DISCOVERY_REQ,
+ IRLAP_DISCOVERY_IND,
+ IRLAP_DISCOVERY_CONF,
+ IRLAP_CONNECT_REQ,
+ IRLAP_CONNECT_IND,
+ IRLAP_CONNECT_RESP,
+ IRLAP_CONNECT_CONF,
+ IRLAP_DISCONNECT_REQ,
+ IRLAP_DISCONNECT_IND,
+ IRLAP_DATA_REQ, // Don't fuss with the order, CONF must be 2 from REQ
+ IRLAP_DATA_IND,
+ IRLAP_DATA_CONF,
+ IRLAP_UDATA_REQ,
+ IRLAP_UDATA_IND,
+ IRLAP_UDATA_CONF,
+ IRLAP_STATUS_IND,
+ IRLAP_FLOWON_REQ,
+ IRLAP_FLOWON_IND,
+ IRLMP_DISCOVERY_REQ,
+ IRLMP_DISCOVERY_IND,
+ IRLMP_DISCOVERY_CONF,
+ IRLMP_CONNECT_REQ,
+ IRLMP_CONNECT_IND,
+ IRLMP_CONNECT_RESP,
+ IRLMP_CONNECT_CONF,
+ IRLMP_DISCONNECT_REQ,
+ IRLMP_DISCONNECT_IND,
+ IRLMP_DATA_REQ,
+ IRLMP_DATA_IND,
+ IRLMP_DATA_CONF,
+ IRLMP_UDATA_REQ,
+ IRLMP_UDATA_IND,
+ IRLMP_UDATA_CONF,
+ IRLMP_ACCESSMODE_REQ,
+ IRLMP_ACCESSMODE_IND,
+ IRLMP_ACCESSMODE_CONF,
+ IRLMP_FLOWON_REQ,
+ IRLMP_FLOWON_IND,
+ IRLMP_MORECREDIT_REQ,
+ IRLMP_GETVALUEBYCLASS_REQ,
+ IRLMP_GETVALUEBYCLASS_CONF
+} IRDA_SERVICE_PRIM;
+
+typedef enum
+{
+ MAC_MEDIA_BUSY, // keep in sync with IRDA_StatStr in irlaplog.c
+ MAC_MEDIA_CLEAR,
+ IRLAP_DISCOVERY_COLLISION,
+ IRLAP_REMOTE_DISCOVERY_IN_PROGRESS,
+ IRLAP_REMOTE_CONNECT_IN_PROGRSS,
+ IRLAP_DISCOVERY_COMPLETED,
+ IRLAP_REMOTE_CONNECTION_IN_PROGRESS,
+ IRLAP_CONNECTION_COMPLETED,
+ IRLAP_REMOTE_INITIATED,
+ IRLAP_PRIMARY_CONFLICT,
+ IRLAP_DISCONNECT_COMPLETED,
+ IRLAP_NO_RESPONSE,
+ IRLAP_DECLINE_RESET,
+ IRLAP_DATA_REQUEST_COMPLETED,
+ IRLAP_DATA_REQUEST_FAILED_LINK_RESET,
+ IRLAP_DATA_REQUEST_FAILED_REMOTE_BUSY,
+ IRLMP_NO_RESPONSE,
+ IRLMP_ACCESSMODE_SUCCESS,
+ IRLMP_ACCESSMODE_FAILURE,
+ IRLMP_DATA_REQUEST_COMPLETED,
+ IRLMP_DATA_REQUEST_FAILED
+} IRDA_SERVICE_STATUS;
+
+// MAC Control Service Request Message - MAC_CONTROL_REQ/CONF
+typedef enum
+{
+ MAC_INITIALIZE_LINK, // keep in sync with MAC_OpStr in irlaplog.c
+ MAC_SHUTDOWN_LINK,
+ MAC_RECONFIG_LINK,
+ MAC_MEDIA_SENSE,
+} MAC_CONTROL_OPERATION;
+
+typedef struct
+{
+ MAC_CONTROL_OPERATION Op;
+ int Port;
+ int Baud;
+ int NumBOFs;
+ int MinTat;
+ int DataSize;
+ int SenseTime;
+ IRDA_SERVICE_STATUS OpStatus;
+ BOOL SetIR;
+} MAC_CONTROL_SERVICE;
+
+// IRLAP Discovery Service Request Message - IRLAP_DISCOVERY_IND/CONF
+typedef struct
+{
+ LIST_ENTRY *pDevList;
+ IRDA_SERVICE_STATUS DscvStatus;
+ BOOL SenseMedia;
+} IRLAP_DISCOVERY_SERVICE;
+
+// IRDA Connection Service Request Message - IRLAP_CONNECT_REQ/IND/CONF
+// IRLMP_CONNECT_REQ/CONF
+typedef struct
+{
+ BYTE RemoteDevAddr[IRDA_DEV_ADDR_LEN];
+ IRDA_QOS_PARMS *pQOS;
+ int LocalLSAPSel;
+ int RemoteLSAPSel;
+ BYTE *pConnData;
+ int ConnDataLen;
+ void *pContext;
+ int MaxPDUSize;
+ int MaxSDUSize;
+ int TTPCredits;
+ IRDA_SERVICE_STATUS ConnStatus;
+ BOOL UseTTP;
+} IRDA_CONNECT_SERVICE;
+
+// IRDA Disconnection Service Request Message - IRLAP_DISCONNECT_REQ/IND
+// IRLMP_DISCONNECT_REQ/IND
+typedef enum
+{
+ IRLMP_USER_REQUEST = 1,
+ IRLMP_UNEXPECTED_IRLAP_DISC,
+ IRLMP_IRLAP_CONN_FAILED,
+ IRLMP_IRLAP_RESET,
+ IRLMP_LM_INITIATED_DISC,
+ IRLMP_DISC_LSAP,
+ IRLMP_NO_RESPONSE_LSAP,
+ IRLMP_NO_AVAILABLE_LSAP,
+ IRLMP_MAC_MEDIA_BUSY,
+ IRLMP_IRLAP_REMOTE_DISCOVERY_IN_PROGRESS,
+
+ IRLMP_IAS_NO_SUCH_OBJECT, // these are added for the IAS_GetValueByClass.Conf
+ IRLMP_IAS_NO_SUCH_ATTRIB,
+ IRLMP_IAS_SUCCESS,
+ IRLMP_IAS_SUCCESS_LISTLEN_GREATER_THAN_ONE,
+
+ IRLMP_UNSPECIFIED_DISC = 0xFF
+} IRLMP_DISC_REASON;
+
+typedef struct
+{
+ BYTE *pDiscData; // IRLMP_DISCONNECT_REQ/IND only
+ int DiscDataLen; // IRLMP_DISCONNECT_REQ/IND only
+ IRLMP_DISC_REASON DiscReason; // IRLMP_DISCONNECT_REQ/IND only
+ IRDA_SERVICE_STATUS DiscStatus; // Indication only
+} IRDA_DISCONNECT_SERVICE;
+
+// IRDA Data Service Request Message
+#define IRLAP_HEADER_LEN 2
+#define IRLMP_HEADER_LEN 6
+#define TTP_HEADER_LEN 8
+#define IRDA_HEADER_LEN IRLAP_HEADER_LEN+IRLMP_HEADER_LEN+TTP_HEADER_LEN+1
+ // + 1 IRComm WACK!!
+
+typedef struct
+{
+ void *pOwner;
+ void *pDataContext; // How IRDA gets user data
+ int SegCount; // Number of segments
+ BOOL FinalSeg;
+ BYTE *pBase;
+ BYTE *pLimit;
+ BYTE *pRead;
+ BYTE *pWrite;
+ void *pTdiSendComp;
+ void *pTdiSendCompCnxt;
+ BOOL IrCOMM_9Wire;
+#ifdef TEMPERAMENTAL_SERIAL_DRIVER
+ int FCS;
+#endif
+ IRDA_SERVICE_STATUS DataStatus; // for CONF
+ // |------------------------|
+ // | pRead o-------------
+ // |------------------------| |
+ // | pWrite o---------- |
+ // |------------------------| | |
+ // | pBase o------- | |
+ // |------------------------| | | |
+ // | pLimit o---- | | |
+ // |------------------------| | | | |
+ // | | | | |
+ // ------------------------ | | | |
+ // | |<---- | |
+ // | | | | |
+ // | |<--------<-
+ // | | |
+ // | |<-
+ // ------------------------
+ BYTE *pHdrRead;
+ BYTE *pHdrWrite;
+ BYTE Header[IRDA_HEADER_LEN];
+ // |------------------------|
+ // | pHdrRead o-------------
+ // |------------------------| |
+ // | pHdrWrite o---------- |
+ // |------------------------| | |
+ // Header--->| | | |
+ // | | | |
+ // | |<--------<-
+ // | | |
+ // | |<-------
+ // ------------------------
+ //
+ // On the receive side, all headers are contained
+ // at pRead, not in the above Header array
+ //
+} IRDA_DATA_SERVICE;
+
+typedef enum
+{
+ IRLMP_MULTIPLEXED,
+ IRLMP_EXCLUSIVE
+} IRLMP_ACCESSMODE;
+
+typedef struct
+{
+ IRLMP_ACCESSMODE AccessMode;
+ IRDA_SERVICE_STATUS ModeStatus;
+ BOOL IrLPTMode; // if true don't send PDU
+} IRLMP_ACCESSMODE_SERVICE;
+
+typedef struct
+{
+ IAS_QUERY *pIASQuery;
+ int AttribLen; // OctetSeq or UsrStr len
+ int IASQueryPerms;
+ IRLMP_DISC_REASON IASStatus;
+} IRLMP_IAS_SERVICE;
+
+typedef struct irda_msg
+{
+ LIST_ENTRY Linkage;
+ IRDA_SERVICE_PRIM Prim;
+ union
+ {
+ MAC_CONTROL_SERVICE MAC_ControlService;
+ IRLAP_DISCOVERY_SERVICE IRLAP_DiscoveryService;
+ IRDA_DISCONNECT_SERVICE IRDA_DisconnectService;
+ IRDA_CONNECT_SERVICE IRDA_ConnectService;
+ IRDA_DATA_SERVICE IRDA_DataService;
+ IRLMP_ACCESSMODE_SERVICE IRLMP_AccessModeService;
+ IRLMP_IAS_SERVICE IRLMP_IASService;
+ } MsgType;
+
+} IRDA_MSG, *PIRDA_MSG;
+
+#define IRDA_MSG_Op MsgType.MAC_ControlService.Op
+#define IRDA_MSG_Port MsgType.MAC_ControlService.Port
+#define IRDA_MSG_Baud MsgType.MAC_ControlService.Baud
+#define IRDA_MSG_NumBOFs MsgType.MAC_ControlService.NumBOFs
+#define IRDA_MSG_MinTat MsgType.MAC_ControlService.MinTat
+#define IRDA_MSG_DataSize MsgType.MAC_ControlService.DataSize
+#define IRDA_MSG_OpStatus MsgType.MAC_ControlService.OpStatus
+#define IRDA_MSG_SetIR MsgType.MAC_ControlService.SetIR
+#define IRDA_MSG_SenseTime MsgType.MAC_ControlService.SenseTime
+
+#define IRDA_MSG_pOwner MsgType.IRDA_DataService.pOwner
+#define IRDA_MSG_pDataContext MsgType.IRDA_DataService.pDataContext
+#define IRDA_MSG_SegCount MsgType.IRDA_DataService.SegCount
+#define IRDA_MSG_FinalSeg MsgType.IRDA_DataService.FinalSeg
+#define IRDA_MSG_pHdrRead MsgType.IRDA_DataService.pHdrRead
+#define IRDA_MSG_pHdrWrite MsgType.IRDA_DataService.pHdrWrite
+#define IRDA_MSG_Header MsgType.IRDA_DataService.Header
+#define IRDA_MSG_pBase MsgType.IRDA_DataService.pBase
+#define IRDA_MSG_pLimit MsgType.IRDA_DataService.pLimit
+#define IRDA_MSG_pRead MsgType.IRDA_DataService.pRead
+#define IRDA_MSG_pWrite MsgType.IRDA_DataService.pWrite
+#define IRDA_MSG_DataStatus MsgType.IRDA_DataService.DataStatus
+#define IRDA_MSG_pTdiSendComp MsgType.IRDA_DataService.pTdiSendComp
+#define IRDA_MSG_pTdiSendCompCnxt MsgType.IRDA_DataService.pTdiSendCompCnxt
+#define IRDA_MSG_IrCOMM_9Wire MsgType.IRDA_DataService.IrCOMM_9Wire
+#ifdef TEMPERAMENTAL_SERIAL_DRIVER
+#define IRDA_MSG_FCS MsgType.IRDA_DataService.FCS
+#endif
+
+#define IRDA_MSG_pDevList MsgType.IRLAP_DiscoveryService.pDevList
+#define IRDA_MSG_DscvStatus MsgType.IRLAP_DiscoveryService.DscvStatus
+#define IRDA_MSG_SenseMedia MsgType.IRLAP_DiscoveryService.SenseMedia
+
+#define IRDA_MSG_RemoteDevAddr MsgType.IRDA_ConnectService.RemoteDevAddr
+#define IRDA_MSG_pQOS MsgType.IRDA_ConnectService.pQOS
+#define IRDA_MSG_LocalLSAPSel MsgType.IRDA_ConnectService.LocalLSAPSel
+#define IRDA_MSG_RemoteLSAPSel MsgType.IRDA_ConnectService.RemoteLSAPSel
+#define IRDA_MSG_pConnData MsgType.IRDA_ConnectService.pConnData
+#define IRDA_MSG_ConnDataLen MsgType.IRDA_ConnectService.ConnDataLen
+#define IRDA_MSG_ConnStatus MsgType.IRDA_ConnectService.ConnStatus
+#define IRDA_MSG_pContext MsgType.IRDA_ConnectService.pContext
+#define IRDA_MSG_UseTTP MsgType.IRDA_ConnectService.UseTTP
+#define IRDA_MSG_MaxSDUSize MsgType.IRDA_ConnectService.MaxSDUSize
+#define IRDA_MSG_MaxPDUSize MsgType.IRDA_ConnectService.MaxPDUSize
+#define IRDA_MSG_TTPCredits MsgType.IRDA_ConnectService.TTPCredits
+
+#define IRDA_MSG_pDiscData MsgType.IRDA_DisconnectService.pDiscData
+#define IRDA_MSG_DiscDataLen MsgType.IRDA_DisconnectService.DiscDataLen
+#define IRDA_MSG_DiscReason MsgType.IRDA_DisconnectService.DiscReason
+#define IRDA_MSG_DiscStatus MsgType.IRDA_DisconnectService.DiscStatus
+
+#define IRDA_MSG_AccessMode MsgType.IRLMP_AccessModeService.AccessMode
+#define IRDA_MSG_ModeStatus MsgType.IRLMP_AccessModeService.ModeStatus
+#define IRDA_MSG_IrLPTMode MsgType.IRLMP_AccessModeService.IrLPTMode
+
+#define IRDA_MSG_pIASQuery MsgType.IRLMP_IASService.pIASQuery
+#define IRDA_MSG_AttribLen MsgType.IRLMP_IASService.AttribLen
+#define IRDA_MSG_IASQueryPerms MsgType.IRLMP_IASService.IASQueryPerms
+#define IRDA_MSG_IASStatus MsgType.IRLMP_IASService.IASStatus
+
+extern LIST_ENTRY IrdaLinkCbList;
+
+VOID IrdaTimerInitialize(PIRDA_TIMER pTimer,
+ VOID (*ExpFunc)(PVOID Context),
+ UINT Timeout,
+ PVOID Context);
+
+VOID IrdaTimerStart(PIRDA_TIMER pTimer);
+
+VOID IrdaTimerStop(PIRDA_TIMER pTimer);
+
diff --git a/private/ntos/tdi/irda/inc/irdalink.h b/private/ntos/tdi/irda/inc/irdalink.h
new file mode 100644
index 000000000..e96f13665
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/irdalink.h
@@ -0,0 +1,34 @@
+NTSTATUS IrdaNdisInitialize();
+
+#define IRDA_NDIS_BUFFER_POOL_SIZE 4
+#define IRDA_NDIS_PACKET_POOL_SIZE 4
+#define IRDA_MSG_LIST_LEN 2
+#define IRDA_MSG_DATA_SIZE 64
+
+typedef struct
+{
+ PIRDA_MSG pIMsg;
+ MEDIA_SPECIFIC_INFORMATION MediaInfo;
+} IRDA_PROTOCOL_RESERVED, *PIRDA_PROTOCOL_RESERVED;
+
+typedef struct IrdaLinkControlBlock
+{
+ LIST_ENTRY Linkage;
+ NDIS_SPIN_LOCK SpinLock;
+ NDIS_HANDLE BindContext;
+ NDIS_HANDLE NdisBindingHandle;
+ NDIS_EVENT SyncEvent;
+ NDIS_STATUS SyncStatus;
+ int MediaBusy;
+ PVOID IrlapContext;
+ PVOID IrlmpContext;
+ NDIS_HANDLE BufferPool;
+ NDIS_HANDLE PacketPool;
+ LIST_ENTRY IMsgList;
+ int IMsgListLen;
+ UINT ExtraBofs; // These should be per connection for
+ UINT MinTat; // multipoint
+} IRDA_LINK_CB, *PIRDA_LINK_CB;
+
+IRDA_MSG *AllocMacIMsg(PIRDA_LINK_CB);
+
diff --git a/private/ntos/tdi/irda/inc/irerr.h b/private/ntos/tdi/irda/inc/irerr.h
new file mode 100644
index 000000000..7490c6fba
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/irerr.h
@@ -0,0 +1,110 @@
+/*****************************************************************************
+*
+* Copyright (c) 1995 Microsoft Corporation
+*
+* File: irerr.h
+*
+* Description: IR error defines
+*
+* Author: mmiller
+*
+* Date: 4/25/95
+*
+*/
+
+#ifndef SUCCESS
+#define SUCCESS 0
+#endif
+
+#define IR_ERROR_BASE 20000
+#define IRLAP_ERROR_BASE IR_ERROR_BASE + 100
+#define IRLMP_ERROR_BASE IR_ERROR_BASE + 200
+
+#define IRMAC_TX_OVERFLOW (IR_ERROR_BASE+0)
+#define IRMAC_WRITE_FAILED (IR_ERROR_BASE+1)
+#define IRMAC_READ_FAILED (IR_ERROR_BASE+2)
+#define IRMAC_BAD_FCS (IR_ERROR_BASE+3)
+#define IRMAC_RX_OVERFLOW (IR_ERROR_BASE+4)
+#define IRMAC_TIMEOUT (IR_ERROR_BASE+5)
+#define IRMAC_BAD_PRIM (IR_ERROR_BASE+6)
+#define IRMAC_BAD_OP (IR_ERROR_BASE+7)
+#define IRMAC_OPEN_PORT_FAILED (IR_ERROR_BASE+8)
+#define IRMAC_SET_BAUD_FAILED (IR_ERROR_BASE+9)
+#define IRMAC_MALLOC_FAILED (IR_ERROR_BASE+10)
+#define IRMAC_ALREADY_INIT (IR_ERROR_BASE+11)
+#define IRMAC_BAD_TIMER (IR_ERROR_BASE+12)
+#define IRMAC_NOT_INITIALIZED (IR_ERROR_BASE+13)
+#define IRMAC_LINK_RESET (IR_ERROR_BASE+14)
+
+#define IRLAP_NOT_INITIALIZED (IRLAP_ERROR_BASE + 0)
+#define IRLAP_BAD_PRIM (IRLAP_ERROR_BASE + 1)
+#define IRLAP_BAD_STATE (IRLAP_ERROR_BASE + 2)
+#define IRLAP_BAD_OPSTATUS (IRLAP_ERROR_BASE + 3)
+#define IRLAP_BAD_OP (IRLAP_ERROR_BASE + 4)
+#define IRLAP_MALLOC_FAILED (IRLAP_ERROR_BASE + 5)
+#define IRLAP_BAUD_NEG_ERR (IRLAP_ERROR_BASE + 6)
+#define IRLAP_DISC_NEG_ERR (IRLAP_ERROR_BASE + 7)
+#define IRLAP_MAXTAT_NEG_ERR (IRLAP_ERROR_BASE + 8)
+#define IRLAP_MINTAT_NEG_ERR (IRLAP_ERROR_BASE + 9)
+#define IRLAP_DATASIZE_NEG_ERR (IRLAP_ERROR_BASE + 10)
+#define IRLAP_WINSIZE_NEG_ERR (IRLAP_ERROR_BASE + 11)
+#define IRLAP_BOFS_NEG_ERR (IRLAP_ERROR_BASE + 12)
+#define IRLAP_LINECAP_ERR (IRLAP_ERROR_BASE + 13)
+#define IRLAP_BAD_SLOTNO (IRLAP_ERROR_BASE + 14)
+#define IRLAP_XID_CMD_NOT_P (IRLAP_ERROR_BASE + 15)
+#define IRLAP_SNRM_NO_QOS (IRLAP_ERROR_BASE + 16)
+#define IRLAP_UA_NO_QOS (IRLAP_ERROR_BASE + 17)
+#define IRLAP_XID_CMD_RSP (IRLAP_ERROR_BASE + 18)
+#define IRLAP_SNRM_NOT_CMD (IRLAP_ERROR_BASE + 19)
+#define IRLAP_SNRM_NOT_P (IRLAP_ERROR_BASE + 20)
+#define IRLAP_UA_NOT_RSP (IRLAP_ERROR_BASE + 21)
+#define IRLAP_UA_NOT_F (IRLAP_ERROR_BASE + 22)
+#define IRLAP_MSG_LIST_EMPTY (IRLAP_ERROR_BASE + 23)
+#define IRLAP_MSG_LIST_FULL (IRLAP_ERROR_BASE + 24)
+#define IRLAP_RXD_BAD_FRAME (IRLAP_ERROR_BASE + 25)
+#define IRLAP_BAD_CRBIT_IFRAME (IRLAP_ERROR_BASE + 26)
+#define IRLAP_BAD_DATA_REQUEST (IRLAP_ERROR_BASE + 27)
+#define IRLAP_DISC_CMD_RSP (IRLAP_ERROR_BASE + 28)
+#define IRLAP_DISC_CMD_NOT_P (IRLAP_ERROR_BASE + 29)
+#define IRLAP_DM_RSP_NOT_F (IRLAP_ERROR_BASE + 30)
+#define IRLAP_DM_RSP_CMD (IRLAP_ERROR_BASE + 31)
+#define IRLAP_FRMR_RSP_CMD (IRLAP_ERROR_BASE + 32)
+#define IRLAP_FRMR_RSP_NOT_F (IRLAP_ERROR_BASE + 33)
+#define IRLAP_BAD_QOS (IRLAP_ERROR_BASE + 34)
+#define IRLAP_NULL_MSG (IRLAP_ERROR_BASE + 35)
+#define IRLAP_BAD_MAX_SLOT (IRLAP_ERROR_BASE + 36)
+#define IRLAP_REMOTE_DISCOVERY_IN_PROGRESS_ERR (IRLAP_ERROR_BASE + 37)
+#define IRLAP_REMOTE_CONNECTION_IN_PROGRESS_ERR (IRLAP_ERROR_BASE + 38)
+#define IRLAP_REMOTE_BUSY (IRLAP_ERROR_BASE + 39)
+
+#define IRLMP_NOT_INITIALIZED (IRLMP_ERROR_BASE + 0)
+#define IRLMP_LSAP_BAD_STATE (IRLMP_ERROR_BASE + 1)
+#define IRLMP_USER_DATA_LEN_EXCEEDED (IRLMP_ERROR_BASE + 2)
+#define IRLMP_LINK_IN_USE (IRLMP_ERROR_BASE + 3)
+#define IRLMP_TIMER_START_FAILED (IRLMP_ERROR_BASE + 4)
+#define IRLMP_ALLOC_FAILED (IRLMP_ERROR_BASE + 5)
+#define IRLMP_LINK_BAD_STATE (IRLMP_ERROR_BASE + 6)
+#define IRLMP_LSAP_SEL_IN_USE (IRLMP_ERROR_BASE + 7)
+#define IRLMP_CREDIT_CALC_ERROR (IRLMP_ERROR_BASE + 8)
+#define IRLMP_NO_TX_CREDIT (IRLMP_ERROR_BASE + 9)
+#define IRLMP_TX_DATA_LEN_EXCEEDED (IRLMP_ERROR_BASE + 10)
+#define IRLMP_DATA_IND_BAD_FRAME (IRLMP_ERROR_BASE + 11)
+#define IRLMP_SCHEDULE_EVENT_FAILED (IRLMP_ERROR_BASE + 12)
+#define IRLMP_LOCAL_BUSY (IRLMP_ERROR_BASE + 13)
+#define IRLMP_BAD_PRIM (IRLMP_ERROR_BASE + 14)
+#define IRLMP_BAD_ACCESSMODE (IRLMP_ERROR_BASE + 15)
+#define IRLMP_LINK_BUSY (IRLMP_ERROR_BASE + 16)
+#define IRLMP_IN_MULTIPLEXED_MODE (IRLMP_ERROR_BASE + 17)
+#define IRLMP_IN_EXCLUSIVE_MODE (IRLMP_ERROR_BASE + 18)
+#define IRLMP_NOT_LSAP_IN_EXCLUSIVE_MODE (IRLMP_ERROR_BASE + 19)
+#define IRLMP_INVALID_LSAP_CB (IRLMP_ERROR_BASE + 20)
+#define IRLMP_REMOTE_BUSY (IRLMP_ERROR_BASE + 21)
+#define IRLMP_TIMER_STOP_FAILED (IRLMP_ERROR_BASE + 22)
+#define IRLMP_BAD_IAS_OBJECT_ID (IRLMP_ERROR_BASE + 23)
+#define IRLMP_NO_SUCH_IAS_CLASS (IRLMP_ERROR_BASE + 24)
+#define IRLMP_NO_SUCH_IAS_ATTRIBUTE (IRLMP_ERROR_BASE + 25)
+#define IRLMP_UNSUPPORTED_IAS_OPERATION (IRLMP_ERROR_BASE + 26)
+#define IRLMP_BAD_IAS_QUERY_FROM_REMOTE (IRLMP_ERROR_BASE + 27)
+#define IRLMP_IAS_QUERY_IN_PROGRESS (IRLMP_ERROR_BASE + 28)
+#define IRLMP_UNSOLICITED_IAS_RESPONSE (IRLMP_ERROR_BASE + 29)
+#define IRLMP_SHUTDOWN_IN_PROGESS (IRLMP_ERROR_BASE + 30)
diff --git a/private/ntos/tdi/irda/inc/irlap.h b/private/ntos/tdi/irda/inc/irlap.h
new file mode 100644
index 000000000..dbcc68361
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/irlap.h
@@ -0,0 +1,66 @@
+/*****************************************************************************
+*
+* Copyright (c) 1995 Microsoft Corporation
+*
+* File: irlap.h
+*
+* Description: IRLAP Protocol and control block definitions
+*
+* Author: mbert
+*
+* Date: 4/15/95
+*
+*/
+
+// Sequence number modulus
+#define IRLAP_MOD 8
+#define PV_TABLE_MAX_BIT 8
+
+extern UINT vBaudTable[];
+extern UINT vMaxTATTable[];
+extern UINT vMinTATTable[];
+extern UINT vDataSizeTable[];
+extern UINT vWinSizeTable[];
+extern UINT vBOFSTable[];
+extern UINT vDiscTable[];
+extern UINT vThreshTable[];
+extern UINT vBOFSDivTable[];
+
+VOID IrlapOpenLink(
+ OUT PNTSTATUS Status,
+ IN PIRDA_LINK_CB pIrdaLinkCb,
+ IN IRDA_QOS_PARMS *pQos,
+ IN BYTE *pDscvInfo,
+ IN int DscvInfoLen,
+ IN UINT MaxSlot);
+
+UINT IrlapDown(IN PVOID Context,
+ IN PIRDA_MSG);
+
+UINT IrlapUp(IN PVOID Context,
+ IN PIRDA_MSG);
+
+UINT IRLAP_Shutdown();
+
+UINT IrlapGetQosParmVal(UINT[], UINT, UINT *);
+
+void IRLAP_PrintState();
+
+
+
+typedef struct
+{
+ LIST_ENTRY ListHead;
+ int Len;
+} IRDA_MSG_LIST;
+
+// I've exported these for the tester
+UINT DequeMsgList(IRDA_MSG_LIST *, IRDA_MSG **);
+UINT EnqueMsgList(IRDA_MSG_LIST *, IRDA_MSG *, int);
+void InitMsgList(IRDA_MSG_LIST *);
+
+
+
+
+
+
diff --git a/private/ntos/tdi/irda/inc/irlaplog.h b/private/ntos/tdi/irda/inc/irlaplog.h
new file mode 100644
index 000000000..71f67866f
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/irlaplog.h
@@ -0,0 +1,44 @@
+/*****************************************************************************
+*
+* Copyright (c) 1995 Microsoft Corporation
+*
+* File: irlaplog.h
+*
+* Description: IRLAP state machine logging and errors
+*
+* Author: mbert
+*
+* Date: 4/15/95
+*
+*/
+
+#ifdef DEBUG
+
+extern TCHAR *IRDA_PrimStr[];
+extern TCHAR *IRLAP_StateStr[];
+extern TCHAR *MAC_OpStr[];
+extern TCHAR *IRDA_TimerStr[];
+extern TCHAR *IRDA_StatStr[];
+
+#define SPRINT_BUF_LEN 1000
+
+#define EXPAND_ADDR(Addr) (Addr[0], Addr[1], Addr[2], Addr[3])
+
+void IRLAP_EventLogStart(PIRLAP_CB, TCHAR *pFormat, ...);
+void __cdecl IRLAP_LogAction(PIRLAP_CB, TCHAR *pFormat, ...);
+void IRLAP_EventLogComplete(PIRLAP_CB);
+TCHAR *FrameToStr(IRDA_MSG *);
+
+#define IRLAP_LOG_START(X) IRLAP_EventLogStart X
+#define IRLAP_LOG_ACTION(X) IRLAP_LogAction X
+#define IRLAP_LOG_COMPLETE(X) IRLAP_EventLogComplete(X)
+
+#else
+
+#define IRLAP_LOG_START(X) (0)
+#define IRLAP_LOG_ACTION(X) (0)
+#define IRLAP_LOG_COMPLETE(X) (0)
+
+#endif
+
+
diff --git a/private/ntos/tdi/irda/inc/irlmp.h b/private/ntos/tdi/irda/inc/irlmp.h
new file mode 100644
index 000000000..ac46e4107
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/irlmp.h
@@ -0,0 +1,60 @@
+/*****************************************************************************
+*
+* Copyright (c) 1995 Microsoft Corporation
+*
+* File: irlmp.h
+*
+* Description: IRLMP Protocol and control block definitions
+*
+* Author: mbert
+*
+* Date: 4/15/95
+*
+*/
+
+#define IRLMP_MAX_USER_DATA_LEN 53
+
+// IrLMP Entry Points
+
+UINT IRLMP_Initialize(int Port, BOOL SetIR, BYTE DscvInfo[], int DscvInfoLen,
+ IRDA_QOS_PARMS *pQOS, int MaxSlot, CHAR *pDeviceName,
+ int DeviceNameLen);
+
+UINT IrlmpDown(PVOID IrlmpContext, PIRDA_MSG pIMsg);
+UINT IrlmpUp(PVOID IrlmpContext, PIRDA_MSG pIMsg);
+
+UINT IRLMP_RegisterLSAPProtocol(int LSAP, BOOL UseTTP);
+UINT IRLMP_Shutdown();
+
+#ifdef DEBUG
+void IRLMP_PrintState();
+#endif
+
+// IAS
+
+#define IAS_ASCII_CHAR_SET 0
+
+// IAS Attribute value types
+#define IAS_ATTRIB_VAL_MISSING 0
+#define IAS_ATTRIB_VAL_INTEGER 1
+#define IAS_ATTRIB_VAL_BINARY 2
+#define IAS_ATTRIB_VAL_STRING 3
+
+// IAS Operation codes
+#define IAS_OPCODE_GET_VALUE_BY_CLASS 4 // The only one I do
+
+extern const CHAR IAS_ClassName_Device[];
+extern const CHAR IAS_AttribName_DeviceName[];
+extern const CHAR IAS_AttribName_IrLMPSupport[];
+extern const CHAR IAS_AttribName_TTPLsapSel[];
+extern const CHAR IAS_AttribName_IrLMPLsapSel[];
+
+extern const BYTE IAS_ClassNameLen_Device;
+extern const BYTE IAS_AttribNameLen_DeviceName;
+extern const BYTE IAS_AttribNameLen_IRLMPSupport;
+extern const BYTE IAS_AttribNameLen_TTPLsapSel;
+extern const BYTE IAS_AttribNameLen_IrLMPLsapSel;
+
+UINT IAS_AddAttribute(IAS_SET *pIASSet);
+
+UINT IAS_DeleteObject(CHAR *pClassName);
diff --git a/private/ntos/tdi/irda/inc/irmac.h b/private/ntos/tdi/irda/inc/irmac.h
new file mode 100644
index 000000000..534e83525
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/irmac.h
@@ -0,0 +1,32 @@
+/*****************************************************************************
+*
+* Copyright (c) 1995 Microsoft Corporation
+*
+* File: irmac.h
+*
+* Description: IRLAP MAC definitions and entry point prototypes
+*
+* Author: mbert
+*
+* Date: 4/15/95
+*
+*/
+
+// Entry Points
+
+UINT IrmacInitialize();
+
+UINT IrmacDown(
+ IN PVOID IrmacContext,
+ PIRDA_MSG pMsg);
+
+UINT IRMAC_RxFrame(IRDA_MSG *pMsg);
+UINT IRMAC_TimerExpired(IRDA_TIMER Timer);
+void IRMAC_PrintState();
+
+
+
+
+
+
+
diff --git a/private/ntos/tdi/irda/inc/oscfg.h b/private/ntos/tdi/irda/inc/oscfg.h
new file mode 100644
index 000000000..49eab5e00
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/oscfg.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+*
+* Copyright (c) 1995 Microsoft Corporation
+*
+* File: oscfg.h
+*
+* Description: OS configuration section
+*
+* Author: mmiller
+*
+* Date: 4/25/95
+*
+*/
+#ifdef PEG
+
+// Pegasus specific includes/defines
+#include "peg.h"
+
+#define DbgPrint NKDbgPrintfW
+
+#else // PEG
+
+#include <ntos.h>
+//#include <nt.h>
+//#include <ntrtl.h>
+//#include <nturtl.h>
+
+//#include <zwapi.h>
+//#include <ntddk.h>
+//#include <windows.h>
+
+#define RETAILMSG(exp,p) (0)
+#define DEBUGMSG(exp,p) (0)
+
+// NT specific includes/defines
+//#include "windows.h"
+//#include "stdio.h"
+
+//#define DbgPrint printf
+//typedef char TCHAR;
+
+//#define RETAILMSG(exp,p) ((exp)?DbgPrint p,1:0)
+
+//#ifdef DEBUG
+
+//#define DEBUGMSG(exp,p) ((exp)?DbgPrint p,1:0)
+//#undef NDEBUG
+
+//#define DEBUGZONE(x) 1<<x
+
+//#else // DEBUG
+
+//#define DEBUGMSG(exp,p) (0)
+//#define NDEBUG
+
+//#endif // DEBUG
+
+//#define ASSERT assert
+//#include "assert.h"
+
+
+#endif // PEG
diff --git a/private/ntos/tdi/irda/inc/tmp.h b/private/ntos/tdi/irda/inc/tmp.h
new file mode 100644
index 000000000..85ca9f294
--- /dev/null
+++ b/private/ntos/tdi/irda/inc/tmp.h
@@ -0,0 +1,31 @@
+extern int irdaDbgSettings;
+
+#define DBG_NDIS (1 << 1)
+
+#define DBG_IRMAC (1 << 4)
+
+#define DBG_IRLAP (1 << 8)
+#define DBG_IRLAPLOG (1 << 9)
+
+#define DBG_IRLMP (1 << 12)
+#define DBG_IRLMP_CONN (1 << 13)
+#define DBG_IRLMP_CRED (1 << 14)
+
+#define DBG_DISCOVERY (1 << 16)
+#define DBG_PRINT (1 << 17)
+#define DBG_ADDR (1 << 18)
+
+#define DBG_MISC (1 << 27)
+#define DBG_ALLOC (1 << 28)
+#define DBG_FUNCTION (1 << 29)
+#define DBG_WARN (1 << 30)
+#define DBG_ERROR (1 << 31)
+
+
+#ifdef DEBUG
+#define DEBUGMSG(dbgs,format) ((dbgs & irdaDbgSettings)? DbgPrint format:0)
+#else
+#define DEBUGMSG(dbgs,format) (0)
+#endif
+
+