|
|
1.1 ! root 1: /*++ ! 2: ! 3: Copyright (c) 1989 Microsoft Corporation ! 4: ! 5: Module Name: ! 6: ! 7: tdi.h ! 8: ! 9: Abstract: ! 10: ! 11: This header file contains interface definitions for NT transport ! 12: providers. This interface is documented in the NT Transport ! 13: Driver Interface (TDI) Specification, Version 2. ! 14: ! 15: Author: ! 16: ! 17: Dave Beaver (dbeaver) 1 June 1991 ! 18: ! 19: Revision History: ! 20: ! 21: --*/ ! 22: ! 23: // ! 24: // Include the types which are common to TDI and other network users ! 25: // ! 26: ! 27: #ifndef _TDI_USER_ ! 28: #define _TDI_USER_ ! 29: ! 30: #include <nettypes.h> ! 31: ! 32: #include <ntddtdi.h> ! 33: ! 34: // ! 35: // Include Transport driver interface definitions ! 36: // All of the following have two definitions; ones that correspond exactly to ! 37: // the TDI spec, and those that correspond to the NT coding standards. They ! 38: // should be equivalent. ! 39: // ! 40: ! 41: typedef int TDI_STATUS; ! 42: typedef PVOID CONNECTION_CONTEXT; // connection context ! 43: ! 44: // ! 45: // Basic type used to represent an address at the transport level. There may ! 46: // be many addresses represented in a single address structure. If there are ! 47: // multiple addresses, a given provider must understand all of them or it can ! 48: // use none of them. Note that it is acceptible for the provider to not know ! 49: // how to use the address, as long as it knows the address type. Thus, a ! 50: // TCP/IP NetBIOS provider may know both NetBIOS and TCP/IP addresses, but ! 51: // use only the NetBIOS address; the TCP/IP address would (likely) be passed on ! 52: // to the TCP/IP provider. ! 53: // ! 54: ! 55: typedef struct _TA_ADDRESS { ! 56: USHORT AddressLength; // length in bytes of Address[] in this ! 57: USHORT AddressType; // type of this address ! 58: UCHAR Address[1]; // actually AddressLength bytes long ! 59: } TA_ADDRESS, *PTA_ADDRESS; ! 60: ! 61: ! 62: typedef struct _TRANSPORT_ADDRESS { ! 63: int TAAddressCount; // number of addresses following ! 64: TA_ADDRESS Address[1]; // actually TAAddressCount elements long ! 65: } TRANSPORT_ADDRESS, *PTRANSPORT_ADDRESS; ! 66: ! 67: // ! 68: // define some names for the EAs so people don't have to make them up. ! 69: // ! 70: ! 71: #define TdiTransportAddress "TransportAddress" ! 72: #define TdiConnectionContext "ConnectionContext" ! 73: #define TDI_TRANSPORT_ADDRESS_LENGTH (sizeof (TdiTransportAddress) - 1) ! 74: #define TDI_CONNECTION_CONTEXT_LENGTH (sizeof (TdiConnectionContext) - 1) ! 75: ! 76: // ! 77: // Known Address types ! 78: // ! 79: ! 80: #define TDI_ADDRESS_TYPE_UNSPEC ((USHORT)0) // unspecified ! 81: #define TDI_ADDRESS_TYPE_UNIX ((USHORT)1) // local to host (pipes, portals) ! 82: #define TDI_ADDRESS_TYPE_IP ((USHORT)2) // internetwork: UDP, TCP, etc. ! 83: #define TDI_ADDRESS_TYPE_IMPLINK ((USHORT)3) // arpanet imp addresses ! 84: #define TDI_ADDRESS_TYPE_PUP ((USHORT)4) // pup protocols: e.g. BSP ! 85: #define TDI_ADDRESS_TYPE_CHAOS ((USHORT)5) // mit CHAOS protocols ! 86: #define TDI_ADDRESS_TYPE_NS ((USHORT)6) // XEROX NS protocols ! 87: #define TDI_ADDRESS_TYPE_IPX ((USHORT)6) // Netware IPX ! 88: #define TDI_ADDRESS_TYPE_NBS ((USHORT)7) // nbs protocols ! 89: #define TDI_ADDRESS_TYPE_ECMA ((USHORT)8) // european computer manufacturers ! 90: #define TDI_ADDRESS_TYPE_DATAKIT ((USHORT)9) // datakit protocols ! 91: #define TDI_ADDRESS_TYPE_CCITT ((USHORT)10) // CCITT protocols, X.25 etc ! 92: #define TDI_ADDRESS_TYPE_SNA ((USHORT)11) // IBM SNA ! 93: #define TDI_ADDRESS_TYPE_DECnet ((USHORT)12) // DECnet ! 94: #define TDI_ADDRESS_TYPE_DLI ((USHORT)13) // Direct data link interface ! 95: #define TDI_ADDRESS_TYPE_LAT ((USHORT)14) // LAT ! 96: #define TDI_ADDRESS_TYPE_HYLINK ((USHORT)15) // NSC Hyperchannel ! 97: #define TDI_ADDRESS_TYPE_APPLETALK ((USHORT)16) // AppleTalk ! 98: #define TDI_ADDRESS_TYPE_NETBIOS ((USHORT)17) // Netbios Addresses ! 99: #define TDI_ADDRESS_TYPE_8022 ((USHORT)18) // ! 100: #define TDI_ADDRESS_TYPE_OSI_TSAP ((USHORT)19) // ! 101: #define TDI_ADDRESS_TYPE_NETONE ((USHORT)20) // for WzMail ! 102: ! 103: ! 104: // ! 105: // Definition of address structures. These need to be packed ! 106: // and misaligned where necessary. ! 107: // ! 108: ! 109: #include <packon.h> ! 110: ! 111: ! 112: // ! 113: // NetBIOS ! 114: // ! 115: ! 116: typedef struct _TDI_ADDRESS_NETBIOS { ! 117: USHORT NetbiosNameType; ! 118: UCHAR NetbiosName[16]; ! 119: } TDI_ADDRESS_NETBIOS, *PTDI_ADDRESS_NETBIOS; ! 120: ! 121: #define TDI_ADDRESS_NETBIOS_TYPE_UNIQUE ((USHORT)0x0000) ! 122: #define TDI_ADDRESS_NETBIOS_TYPE_GROUP ((USHORT)0x0001) ! 123: #define TDI_ADDRESS_NETBIOS_TYPE_QUICK_UNIQUE ((USHORT)0x0002) ! 124: #define TDI_ADDRESS_NETBIOS_TYPE_QUICK_GROUP ((USHORT)0x0003) ! 125: ! 126: #define TDI_ADDRESS_LENGTH_NETBIOS sizeof (TDI_ADDRESS_NETBIOS) ! 127: ! 128: ! 129: // ! 130: // Xns address for UB ! 131: // ! 132: ! 133: typedef struct _TDI_ADDRESS_NETONE { ! 134: USHORT NetoneNameType; ! 135: UCHAR NetoneName[20]; ! 136: } TDI_ADDRESS_NETONE, *PTDI_ADDRESS_NETONE; ! 137: ! 138: #define TDI_ADDRESS_NETONE_TYPE_UNIQUE ((USHORT)0x0000) ! 139: #define TDI_ADDRESS_NETONE_TYPE_ROTORED ((USHORT)0x0001) ! 140: ! 141: #define TDI_ADDRESS_LENGTH_NETONE sizeof (TDI_ADDRESS_NETONE) ! 142: ! 143: ! 144: // ! 145: // AppleTalk ! 146: // ! 147: ! 148: typedef struct _TDI_ADDRESS_APPLETALK { ! 149: USHORT Network; ! 150: UCHAR Node; ! 151: UCHAR Socket; ! 152: } TDI_ADDRESS_APPLETALK, *PTDI_ADDRESS_APPLETALK; ! 153: ! 154: #define TDI_ADDRESS_LENGTH_APPLETALK sizeof (TDI_ADDRESS_APPLETALK) ! 155: ! 156: ! 157: // ! 158: // 802.2 MAC addresses ! 159: // ! 160: ! 161: typedef struct _TDI_ADDRESS_8022 { ! 162: UCHAR MACAddress[6]; ! 163: } TDI_ADDRESS_8022, *PTDI_ADDRESS_8022; ! 164: ! 165: #define TDI_ADDRESS_LENGTH_8022 sizeof (TDI_ADDRESS_8022); ! 166: ! 167: ! 168: // ! 169: // IP address ! 170: // ! 171: ! 172: typedef struct _TDI_ADDRESS_IP { ! 173: USHORT sin_port; ! 174: ULONG in_addr; ! 175: UCHAR sin_zero[8]; ! 176: } TDI_ADDRESS_IP, *PTDI_ADDRESS_IP; ! 177: ! 178: #define TDI_ADDRESS_LENGTH_IP sizeof (TDI_ADDRESS_IP) ! 179: ! 180: ! 181: // ! 182: // IPX address ! 183: // ! 184: ! 185: typedef struct _TDI_ADDRESS_IPX { ! 186: ULONG NetworkAddress; ! 187: UCHAR NodeAddress[6]; ! 188: USHORT Socket; ! 189: } TDI_ADDRESS_IPX, *PTDI_ADDRESS_IPX; ! 190: ! 191: ! 192: #define TDI_ADDRESS_LENGTH_IPX sizeof (TDI_ADDRESS_IPX) ! 193: ! 194: // ! 195: // XNS address (same as IPX) ! 196: // ! 197: ! 198: typedef struct _TDI_ADDRESS_NS { ! 199: ULONG NetworkAddress; ! 200: UCHAR NodeAddress[6]; ! 201: USHORT Socket; ! 202: } TDI_ADDRESS_NS, *PTDI_ADDRESS_NS; ! 203: ! 204: ! 205: #define TDI_ADDRESS_LENGTH_NS sizeof (TDI_ADDRESS_NS) ! 206: ! 207: ! 208: // OSI TSAP ! 209: ! 210: // TBD ! 211: ! 212: #include <packoff.h> ! 213: ! 214: ! 215: // ! 216: // Some pre-defined structures to make life easier for ! 217: // the 99.99% of us who use but one address. ! 218: // ! 219: ! 220: typedef struct _TA_ADDRESS_NETBIOS { ! 221: int TAAddressCount; ! 222: struct _Addr { ! 223: USHORT AddressLength; // length in bytes of this address == 18 ! 224: USHORT AddressType; // this will == TDI_ADDRESS_TYPE_NETBIOS ! 225: TDI_ADDRESS_NETBIOS Address[1]; ! 226: } Address [1]; ! 227: } TA_NETBIOS_ADDRESS, *PTA_NETBIOS_ADDRESS; ! 228: ! 229: typedef struct _TA_APPLETALK_ADDR { ! 230: int TAAddressCount; ! 231: struct _AddrAtalk { ! 232: USHORT AddressLength; // length in bytes of this address == 4 ! 233: USHORT AddressType; // this will == TDI_ADDRESS_TYPE_APPLETALK ! 234: TDI_ADDRESS_APPLETALK Address[1]; ! 235: } Address[1]; ! 236: } TA_APPLETALK_ADDRESS, *PTA_APPLETALK_ADDRESS; ! 237: ! 238: typedef struct _TA_ADDRESS_IP { ! 239: int TAAddressCount; ! 240: struct _AddrIp { ! 241: USHORT AddressLength; // length in bytes of this address == 14 ! 242: USHORT AddressType; // this will == TDI_ADDRESS_TYPE_IP ! 243: TDI_ADDRESS_IP Address[1]; ! 244: } Address [1]; ! 245: } TA_IP_ADDRESS, *PTA_IP_ADDRESS; ! 246: ! 247: typedef struct _TA_ADDRESS_IPX { ! 248: int TAAddressCount; ! 249: struct _AddrIpx { ! 250: USHORT AddressLength; // length in bytes of this address == 12 ! 251: USHORT AddressType; // this will == TDI_ADDRESS_TYPE_IPX ! 252: TDI_ADDRESS_IPX Address[1]; ! 253: } Address [1]; ! 254: } TA_IPX_ADDRESS, *PTA_IPX_ADDRESS; ! 255: ! 256: typedef struct _TA_ADDRESS_NS { ! 257: int TAAddressCount; ! 258: struct _AddrNs { ! 259: USHORT AddressLength; // length in bytes of this address == 12 ! 260: USHORT AddressType; // this will == TDI_ADDRESS_TYPE_NS ! 261: TDI_ADDRESS_NS Address[1]; ! 262: } Address [1]; ! 263: } TA_NS_ADDRESS, *PTA_NS_ADDRESS; ! 264: ! 265: // ! 266: // This structure is passed with every request to TDI. It describes that ! 267: // request and the parameters to it. ! 268: // ! 269: ! 270: typedef struct _TDI_REQUEST { ! 271: union { ! 272: HANDLE AddressHandle; ! 273: CONNECTION_CONTEXT ConnectionContext; ! 274: HANDLE ControlChannel; ! 275: } Handle; ! 276: ! 277: PVOID RequestNotifyObject; ! 278: PVOID RequestContext; ! 279: TDI_STATUS TdiStatus; ! 280: } TDI_REQUEST, *PTDI_REQUEST; ! 281: ! 282: // ! 283: // Structure for information returned by the TDI provider. This structure is ! 284: // filled in upon request completion. ! 285: // ! 286: ! 287: typedef struct _TDI_REQUEST_STATUS { ! 288: TDI_STATUS Status; // status of request completion ! 289: PVOID RequestContext; // the request Context ! 290: ULONG BytesTransferred; // number of bytes transferred in the request ! 291: ! 292: } TDI_REQUEST_STATUS, *PTDI_REQUEST_STATUS; ! 293: ! 294: // ! 295: // connection primitives information structure. This is passed to the TDI calls ! 296: // (Accept, Connect, xxx) that do connecting sorts of things. ! 297: // ! 298: ! 299: typedef struct _TDI_CONNECTION_INFORMATION { ! 300: int UserDataLength; // length of user data buffer ! 301: PVOID UserData; // pointer to user data buffer ! 302: int OptionsLength; // length of follwoing buffer ! 303: PVOID Options; // pointer to buffer containing options ! 304: int RemoteAddressLength; // length of following buffer ! 305: PVOID RemoteAddress; // buffer containing the remote address ! 306: } TDI_CONNECTION_INFORMATION, *PTDI_CONNECTION_INFORMATION; ! 307: ! 308: // ! 309: // structure defining a counted string is defined in ! 310: // \nt\public\sdk\inc\ntdefs.h as ! 311: // typedef struct _STRING { ! 312: // USHORT Length; ! 313: // USHORT MaximumLength; ! 314: // PCHAR Buffer; ! 315: // } STRING; ! 316: // typedef STRING *PSTRING; ! 317: // typedef STRING ANSI_STRING; ! 318: // typedef PSTRING PANSI_STRING; ! 319: // ! 320: ! 321: // ! 322: // Event types that are known ! 323: // ! 324: ! 325: #define TDI_EVENT_CONNECT ((USHORT)0) // TDI_IND_CONNECT event handler. ! 326: #define TDI_EVENT_DISCONNECT ((USHORT)1) // TDI_IND_DISCONNECT event handler. ! 327: #define TDI_EVENT_ERROR ((USHORT)2) // TDI_IND_ERROR event handler. ! 328: #define TDI_EVENT_RECEIVE ((USHORT)3) // TDI_IND_RECEIVE event handler. ! 329: #define TDI_EVENT_RECEIVE_DATAGRAM ((USHORT)4) // TDI_IND_RECEIVE_DATAGRAM event handler. ! 330: #define TDI_EVENT_RECEIVE_EXPEDITED ((USHORT)5) // TDI_IND_RECEIVE_EXPEDITED event handler. ! 331: #define TDI_EVENT_SEND_POSSIBLE ((USHORT)6) // TDI_IND_SEND_POSSIBLE event handler ! 332: ! 333: // ! 334: // Associate Address is done through NtDeviceIoControlFile, which passes this ! 335: // structure as its input buffer. The Handle specified in the ! 336: // NtDeviceIoControlFile is the handle of the connection returned in the ! 337: // NtCreateFile call. ! 338: // ! 339: ! 340: typedef struct _TDI_REQUEST_ASSOCIATE { ! 341: TDI_REQUEST Request; ! 342: HANDLE AddressHandle; ! 343: } TDI_REQUEST_ASSOCIATE_ADDRESS, *PTDI_REQUEST_ASSOCIATE_ADDRESS; ! 344: ! 345: ! 346: // ! 347: // Disassociate Address passes no structure, uses the request code ! 348: // IOCTL_TDI_DISASSOCIATE_ADDRESS. This call will never pend. ! 349: // ! 350: ! 351: // ! 352: // Connect is done through NtDeviceIoControlFile, which passes this ! 353: // structure as its input buffer. The Handle specified in the ! 354: // NtDeviceIoControlFile is the handle of the connection returned in the ! 355: // NtCreateFile call. ! 356: // ! 357: ! 358: typedef struct _TDI_CONNECT_REQUEST { ! 359: TDI_REQUEST Request; ! 360: PTDI_CONNECTION_INFORMATION RequestConnectionInformation; ! 361: PTDI_CONNECTION_INFORMATION ReturnConnectionInformation; ! 362: LARGE_INTEGER Timeout; ! 363: } TDI_REQUEST_CONNECT, *PTDI_REQUEST_CONNECT; ! 364: ! 365: // ! 366: // Accept is done through NtDeviceIoControlFile, which passes this ! 367: // structure as its input buffer. The Handle specified in the ! 368: // NtDeviceIoControlFile is the handle of the connection returned in the ! 369: // NtCreateFile call. Accept is called by the user when a listen completes, ! 370: // before any activity can occur on a connection. AcceptConnectionId specifies ! 371: // the connection on which the connection is accepted; in most cases, this ! 372: // will be null, which that the connection is to be accepted on the ! 373: // connection on which the listen completed. If the transport provider supports ! 374: // "forwarding" of connections (the idea that a particular connection listens ! 375: // all the time, and creates new connections as needed for incoming connection ! 376: // requests and attaches them to the listen), this is the mechanism used to ! 377: // associate connections with the listen. ! 378: // ! 379: ! 380: typedef struct _TDI_REQUEST_ACCEPT { ! 381: TDI_REQUEST Request; ! 382: PTDI_CONNECTION_INFORMATION RequestConnectionInformation; ! 383: PTDI_CONNECTION_INFORMATION ReturnConnectionInformation; ! 384: } TDI_REQUEST_ACCEPT, *PTDI_REQUEST_ACCEPT; ! 385: ! 386: // ! 387: // Listen is done through NtDeviceIoControlFile, which passes this ! 388: // structure as its input buffer. The Handle specified in the ! 389: // NtDeviceIoControlFile is the handle of the connection returned in the ! 390: // NtCreateFile call. RequestConnectionInformation contains information about ! 391: // the remote address to be listen for connections from; if NULL, any address ! 392: // is accepted. ReturnConnectionInformation returns information about the ! 393: // remote node that actually connected. ! 394: // ! 395: ! 396: typedef struct _TDI_REQUEST_LISTEN { ! 397: TDI_REQUEST Request; ! 398: PTDI_CONNECTION_INFORMATION RequestConnectionInformation; ! 399: PTDI_CONNECTION_INFORMATION ReturnConnectionInformation; ! 400: USHORT ListenFlags; ! 401: } TDI_REQUEST_LISTEN, *PTDI_REQUEST_LISTEN; ! 402: ! 403: // ! 404: // Disconnect is done through NtDeviceIoControlFile, which passes this ! 405: // structure as its input buffer. The Handle specified in the ! 406: // NtDeviceIoControlFile is the handle of the connection returned in the ! 407: // NtCreateFile call. Disconnect differs from Close in offering more options. ! 408: // For example, Close terminates all activity on a connection (immediately), ! 409: // failing all outstanding requests, and tearing down the connection. With ! 410: // some providers, Disconnect allows a "graceful" disconnect, causing new activity ! 411: // to be rejected but allowing old activity to run down to completion. ! 412: // ! 413: ! 414: typedef struct _TDI_DISCONNECT_REQUEST { ! 415: TDI_REQUEST Request; ! 416: LARGE_INTEGER Timeout; ! 417: } TDI_REQUEST_DISCONNECT, *PTDI_REQUEST_DISCONNECT; ! 418: ! 419: // ! 420: // Send is done through NtDeviceIoControlFile, which passes this ! 421: // structure as its input buffer. The Handle specified in the ! 422: // NtDeviceIoControlFile is the handle of the connection returned in the ! 423: // NtCreateFile call. Note that it is possible to Send using the file system's ! 424: // Write call. This will have the same effect as doing a Send with all flags ! 425: // set to null. ! 426: // ! 427: ! 428: typedef struct _TDI_REQUEST_SEND { ! 429: TDI_REQUEST Request; ! 430: USHORT SendFlags; ! 431: } TDI_REQUEST_SEND, *PTDI_REQUEST_SEND; ! 432: ! 433: // ! 434: // Receive is done through NtDeviceIoControlFile, which passes this ! 435: // structure as its input buffer. The Handle specified in the ! 436: // NtDeviceIoControlFile is the handle of the connection returned in the ! 437: // NtCreateFile call. Note that it is possible to Receive using the file ! 438: // system's Read call. Note further that receive returns a number of TDI_STATUS ! 439: // values, which indicate things such as partial receives. ! 440: // ! 441: ! 442: typedef struct _TDI_REQUEST_RECEIVE { ! 443: TDI_REQUEST Request; ! 444: USHORT ReceiveFlags; ! 445: } TDI_REQUEST_RECEIVE, *PTDI_REQUEST_RECEIVE; ! 446: ! 447: // ! 448: // SendDatagram is done through NtDeviceIoControlFile, which passes this ! 449: // structure as its input buffer. The Handle specified in the ! 450: // NtDeviceIoControlFile is the handle of the ADDRESS (note this is ! 451: // different than above!!) returned in the NtCreateFile call. Send Datagram ! 452: // specifies the address of the receiver through the SendDatagramInformation ! 453: // structure, using RemoteAddress to point to the transport address of the ! 454: // destination of the datagram. ! 455: // ! 456: ! 457: typedef struct _TDI_REQUEST_SEND_DATAGRAM { ! 458: TDI_REQUEST Request; ! 459: PTDI_CONNECTION_INFORMATION SendDatagramInformation; ! 460: } TDI_REQUEST_SEND_DATAGRAM, *PTDI_REQUEST_SEND_DATAGRAM; ! 461: ! 462: // ! 463: // ReceiveDatagram is done through NtDeviceIoControlFile, which passes this ! 464: // structure as its input buffer. The Handle specified in the ! 465: // NtDeviceIoControlFile is the handle of the ADDRESS (note this is ! 466: // different than above!!) returned in the NtCreateFile call. Receive Datagram ! 467: // specifies the address from which to receive a datagram through the ! 468: // ReceiveDatagramInformation structure, using RemoteAddress to point to the ! 469: // transport address of the origin of the datagram. (Broadcast datagrams are ! 470: // received by making the pointer NULL.) The actual address of the sender of ! 471: // the datagram is returned in ReturnInformation. ! 472: // ! 473: // for the receive datagram call ! 474: // ! 475: ! 476: typedef struct _TDI_REQUEST_RECEIVE_DATAGRAM { ! 477: TDI_REQUEST Request; ! 478: PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation; ! 479: PTDI_CONNECTION_INFORMATION ReturnInformation; ! 480: USHORT ReceiveFlags; ! 481: } TDI_REQUEST_RECEIVE_DATAGRAM, *PTDI_REQUEST_RECEIVE_DATAGRAM; ! 482: ! 483: // ! 484: // SetEventHandler is done through NtDeviceIoControlFile, which passes this ! 485: // structure as its input buffer. The Handle specified in the ! 486: // NtDeviceIoControlFile is the handle of the ADDRESS (note this is ! 487: // different than above!!) returned in the NtCreateFile call. ! 488: ! 489: typedef struct _TDI_REQUEST_SET_EVENT { ! 490: TDI_REQUEST Request; ! 491: int EventType; ! 492: PVOID EventHandler; ! 493: PVOID EventContext; ! 494: } TDI_REQUEST_SET_EVENT_HANDLER, *PTDI_REQUEST_SET_EVENT_HANDLER; ! 495: ! 496: // ! 497: // ReceiveIndicator values (from TdiReceive and TdiReceiveDatagram requests, ! 498: // and also presented at TDI_IND_RECEIVE and TDI_IND_RECEIVE_DATAGRAM time). ! 499: // ! 500: // The TDI_RECEIVE_PARTIAL bit is no longer used at the kernel level ! 501: // interface. TDI_RECEIVE_ENTIRE_MESSAGE has replaced it. Providers ! 502: // may continue to set TDI_RECEIVE_PARTIAL when appropriate if they so ! 503: // desire, but the TDI_RECEIVE_ENTIRE_MESSAGE bit must be set or ! 504: // cleared as appropriate on all receive indications. ! 505: // ! 506: ! 507: #if 0 ! 508: #define TDI_RECEIVE_TRUNCATED 0x00000001 // received TSDU was truncated. ! 509: #define TDI_RECEIVE_FRAGMENT 0x00000002 // received TSDU was fragmented. ! 510: #endif ! 511: #define TDI_RECEIVE_BROADCAST 0x00000004 // received TSDU was broadcast. ! 512: #define TDI_RECEIVE_MULTICAST 0x00000008 // received TSDU was multicast. ! 513: #define TDI_RECEIVE_PARTIAL 0x00000010 // received TSDU is not fully presented. ! 514: #define TDI_RECEIVE_NORMAL 0x00000020 // received TSDU is normal data ! 515: #define TDI_RECEIVE_EXPEDITED 0x00000040 // received TSDU is expedited data ! 516: #define TDI_RECEIVE_PEEK 0x00000080 // received TSDU is not released ! 517: #define TDI_RECEIVE_NO_RESPONSE_EXP 0x00000100 // HINT: no back-traffic expected ! 518: #define TDI_RECEIVE_COPY_LOOKAHEAD 0x00000200 // for kernel-mode indications ! 519: #define TDI_RECEIVE_ENTIRE_MESSAGE 0x00000400 // opposite of RECEIVE_PARTIAL ! 520: // (for kernel-mode indications) ! 521: ! 522: ! 523: // ! 524: // Listen Flags ! 525: // ! 526: ! 527: #define TDI_QUERY_ACCEPT 0x00000001 // complete TdiListen ! 528: // without accepting ! 529: // connection ! 530: ! 531: // ! 532: // Options which are used for both SendOptions and ReceiveIndicators. ! 533: // ! 534: ! 535: #define TDI_SEND_EXPEDITED ((USHORT)0x0020) // TSDU is/was urgent/expedited. ! 536: #define TDI_SEND_PARTIAL ((USHORT)0x0040) // TSDU is/was terminated by an EOR. ! 537: #define TDI_SEND_NO_RESPONSE_EXPECTED ((USHORT)0x0080) // HINT: no back traffic expected. ! 538: #define TDI_SEND_NON_BLOCKING ((USHORT)0x0100) // don't block if no buffer space in protocol ! 539: ! 540: ! 541: // ! 542: // Disconnect Flags ! 543: // ! 544: ! 545: #define TDI_DISCONNECT_WAIT ((USHORT)0x0001) // used for disconnect ! 546: // notification ! 547: #define TDI_DISCONNECT_ABORT ((USHORT)0x0002) // immediately terminate ! 548: // connection ! 549: #define TDI_DISCONNECT_RELEASE ((USHORT)0x0004) // initiate graceful ! 550: // disconnect ! 551: #define TDI_DISCONNECT_CONFIRM ((USHORT)0x0008) // confirm a graceful ! 552: // close ! 553: #define TDI_DISCONNECT_ASYNC ((USHORT)0x0010) // asynchronous ! 554: // graceful disconnect ! 555: ! 556: // ! 557: // TdiRequest structure for TdiQueryInformation request. ! 558: // ! 559: ! 560: typedef struct _TDI_REQUEST_QUERY_INFORMATION { ! 561: TDI_REQUEST Request; ! 562: ULONG QueryType; // class of information to be queried. ! 563: PTDI_CONNECTION_INFORMATION RequestConnectionInformation; ! 564: } TDI_REQUEST_QUERY_INFORMATION, *PTDI_REQUEST_QUERY_INFORMATION; ! 565: ! 566: // ! 567: // TdiRequest structure for TdiSetInformation request. ! 568: // ! 569: ! 570: typedef struct _TDI_REQUEST_SET_INFORMATION { ! 571: TDI_REQUEST Request; ! 572: ULONG SetType; // class of information to be set. ! 573: PTDI_CONNECTION_INFORMATION RequestConnectionInformation; ! 574: } TDI_REQUEST_SET_INFORMATION, *PTDI_REQUEST_SET_INFORMATION; ! 575: ! 576: // ! 577: // This is the old name, do not use it. ! 578: // ! 579: ! 580: typedef TDI_REQUEST_SET_INFORMATION TDI_REQ_SET_INFORMATION, *PTDI_REQ_SET_INFORMATION; ! 581: ! 582: // ! 583: // Convenient universal request type. ! 584: // ! 585: ! 586: typedef union _TDI_REQUEST_TYPE { ! 587: TDI_REQUEST_ACCEPT TdiAccept; ! 588: TDI_REQUEST_CONNECT TdiConnect; ! 589: TDI_REQUEST_DISCONNECT TdiDisconnect; ! 590: TDI_REQUEST_LISTEN TdiListen; ! 591: TDI_REQUEST_QUERY_INFORMATION TdiQueryInformation; ! 592: TDI_REQUEST_RECEIVE TdiReceive; ! 593: TDI_REQUEST_RECEIVE_DATAGRAM TdiReceiveDatagram; ! 594: TDI_REQUEST_SEND TdiSend; ! 595: TDI_REQUEST_SEND_DATAGRAM TdiSendDatagram; ! 596: TDI_REQUEST_SET_EVENT_HANDLER TdiSetEventHandler; ! 597: TDI_REQUEST_SET_INFORMATION TdiSetInformation; ! 598: } TDI_REQUEST_TYPE, *PTDI_REQUEST_TYPE; ! 599: ! 600: ! 601: // ! 602: // Query information types ! 603: // ! 604: ! 605: // ! 606: // Generic query info types, must be supported by all transports. ! 607: // ! 608: ! 609: #define TDI_QUERY_BROADCAST_ADDRESS 0x00000001 ! 610: #define TDI_QUERY_PROVIDER_INFORMATION 0x00000002 // temp, renamed ... ! 611: #define TDI_QUERY_PROVIDER_INFO 0x00000002 // ... to this ! 612: #define TDI_QUERY_ADDRESS_INFO 0x00000003 ! 613: #define TDI_QUERY_CONNECTION_INFO 0x00000004 ! 614: #define TDI_QUERY_PROVIDER_STATISTICS 0x00000005 ! 615: #define TDI_QUERY_DATAGRAM_INFO 0x00000006 ! 616: #define TDI_QUERY_DATA_LINK_ADDRESS 0x00000007 ! 617: #define TDI_QUERY_NETWORK_ADDRESS 0x00000008 ! 618: ! 619: // ! 620: // netbios specific query information types, must be supported by netbios ! 621: // providers. Query adapter status returns the ADAPTER_STATUS struture defined ! 622: // in the file NB30.H. Query session status returns the SESSION_HEADER/ ! 623: // SESSION_BUFFER structures defined in NB30.H. Query find name returns ! 624: // the FIND_NAME_HEADER/FIND_NAME_BUFFER structures defined in NB30.H. ! 625: // ! 626: ! 627: #define TDI_QUERY_ADAPTER_STATUS 0x00000100 ! 628: #define TDI_QUERY_SESSION_STATUS 0x00000200 ! 629: #define TDI_QUERY_FIND_NAME 0x00000300 ! 630: ! 631: // ! 632: // The following structures are returned by TdiQueryInformation and are read ! 633: // by TdiSetInformation. Note that a provider with netbios support will also ! 634: // return the adapter status ! 635: // ! 636: ! 637: typedef struct _TDI_ENDPOINT_INFO { ! 638: ULONG State; // current state of the endpoint. ! 639: ULONG Event; // last event at the endpoint. ! 640: ULONG TransmittedTsdus; // TSDUs sent from this endpoint. ! 641: ULONG ReceivedTsdus; // TSDUs received at this endpoint. ! 642: ULONG TransmissionErrors; // TSDUs transmitted in error. ! 643: ULONG ReceiveErrors; // TSDUs received in error. ! 644: ULONG MinimumLookaheadData; // guaranteed min size of lookahead data. ! 645: ULONG MaximumLookaheadData; // maximum size of lookahead data. ! 646: ULONG PriorityLevel; // priority class assigned to outgoing data. ! 647: ULONG SecurityLevel; // security level assigned to outgoing data. ! 648: ULONG SecurityCompartment; // security compartment assigned to outgoing data. ! 649: } TDI_ENDPOINT_INFO, *PTDI_ENDPOINT_INFO; ! 650: ! 651: typedef struct _TDI_CONNECTION_INFO { ! 652: ULONG State; // current state of the connection. ! 653: ULONG Event; // last event on the connection. ! 654: ULONG TransmittedTsdus; // TSDUs sent on this connection. ! 655: ULONG ReceivedTsdus; // TSDUs received on this connection. ! 656: ULONG TransmissionErrors; // TSDUs transmitted in error/this connection. ! 657: ULONG ReceiveErrors; // TSDUs received in error/this connection. ! 658: LARGE_INTEGER Throughput; // estimated throughput on this connection. ! 659: LARGE_INTEGER Delay; // estimated delay on this connection. ! 660: ULONG SendBufferSize; // size of buffer for sends - only ! 661: // meaningful for internal buffering ! 662: // protocols like tcp ! 663: ULONG ReceiveBufferSize; // size of buffer for receives - only ! 664: // meaningful for internal buffering ! 665: // protocols like tcp ! 666: BOOLEAN Unreliable; // is this connection "unreliable". ! 667: } TDI_CONNECTION_INFO, *PTDI_CONNECTION_INFO; ! 668: ! 669: typedef struct _TDI_ADDRESS_INFO { ! 670: ULONG ActivityCount; // outstanding open file objects/this address. ! 671: TRANSPORT_ADDRESS Address; // the actual address & its components. ! 672: } TDI_ADDRESS_INFO, *PTDI_ADDRESS_INFO; ! 673: ! 674: typedef struct _TDI_DATAGRAM_INFO { ! 675: ULONG MaximumDatagramBytes; ! 676: ULONG MaximumDatagramCount; ! 677: } TDI_DATAGRAM_INFO, *PTDI_DATAGRAM_INFO; ! 678: ! 679: ! 680: typedef struct _TDI_PROVIDER_INFO { ! 681: ULONG Version; // TDI version: 0xaabb, aa=major, bb=minor ! 682: ULONG MaxSendSize; // max size of user send. ! 683: ULONG MaxConnectionUserData; // max size of user-specified connect data. ! 684: ULONG MaxDatagramSize; // max datagram length in bytes. ! 685: ULONG ServiceFlags; // service options, defined below. ! 686: ULONG MinimumLookaheadData; // guaranteed min size of lookahead data. ! 687: ULONG MaximumLookaheadData; // maximum size of lookahead data. ! 688: ULONG NumberOfResources; // how many TDI_RESOURCE_STATS for provider. ! 689: LARGE_INTEGER StartTime; // when the provider became active. ! 690: } TDI_PROVIDER_INFO, *PTDI_PROVIDER_INFO; ! 691: ! 692: #define TDI_SERVICE_CONNECTION_MODE 0x00000001 // connection mode supported. ! 693: #define TDI_SERVICE_ORDERLY_RELEASE 0x00000002 // orderly release supported. ! 694: #define TDI_SERVICE_CONNECTIONLESS_MODE 0x00000004 // connectionless mode supported. ! 695: #define TDI_SERVICE_ERROR_FREE_DELIVERY 0x00000008 // error free delivery supported. ! 696: #define TDI_SERVICE_SECURITY_LEVEL 0x00000010 // security wrapper supported. ! 697: #define TDI_SERVICE_BROADCAST_SUPPORTED 0x00000020 // broadcast datagrams supported. ! 698: #define TDI_SERVICE_MULTICAST_SUPPORTED 0x00000040 // multicast datagrams supported. ! 699: #define TDI_SERVICE_DELAYED_ACCEPTANCE 0x00000080 // use of TDI_ACCEPT_OR_REJECT is supported. ! 700: #define TDI_SERVICE_EXPEDITED_DATA 0x00000100 // expedited data supported. ! 701: #define TDI_SERVICE_INTERNAL_BUFFERING 0x00000200 // protocol does internal buffering ! 702: #define TDI_SERVICE_ROUTE_DIRECTED 0x00000400 // directed packets may go further than MC. ! 703: #define TDI_SERVICE_NO_ZERO_LENGTH 0x00000800 // zero-length sends NOT supported ! 704: #define TDI_SERVICE_POINT_TO_POINT 0x00001000 // transport is functioning as a RAS gateway ! 705: ! 706: ! 707: typedef struct _TDI_PROVIDER_RESOURCE_STATS { ! 708: ULONG ResourceId; // identifies resource in question. ! 709: ULONG MaximumResourceUsed; // maximum number in use at once. ! 710: ULONG AverageResourceUsed; // average number in use. ! 711: ULONG ResourceExhausted; // number of times resource not available. ! 712: } TDI_PROVIDER_RESOURCE_STATS, *PTDI_PROVIDER_RESOURCE_STATS; ! 713: ! 714: typedef struct _TDI_PROVIDER_STATISTICS { ! 715: ULONG Version; // TDI version: 0xaabb, aa=major, bb=minor ! 716: ULONG OpenConnections; // currently active connections. ! 717: ULONG ConnectionsAfterNoRetry; // successful connections, no retries. ! 718: ULONG ConnectionsAfterRetry; // successful connections after retry. ! 719: ULONG LocalDisconnects; // connection disconnected locally. ! 720: ULONG RemoteDisconnects; // connection disconnected by remote. ! 721: ULONG LinkFailures; // connections dropped, link failure. ! 722: ULONG AdapterFailures; // connections dropped, adapter failure. ! 723: ULONG SessionTimeouts; // connections dropped, session timeout. ! 724: ULONG CancelledConnections; // connect attempts cancelled. ! 725: ULONG RemoteResourceFailures; // connections failed, remote resource problems. ! 726: ULONG LocalResourceFailures; // connections failed, local resource problems. ! 727: ULONG NotFoundFailures; // connections failed, remote not found. ! 728: ULONG NoListenFailures; // connections rejected, we had no listens. ! 729: ULONG DatagramsSent; ! 730: LARGE_INTEGER DatagramBytesSent; ! 731: ULONG DatagramsReceived; ! 732: LARGE_INTEGER DatagramBytesReceived; ! 733: ULONG PacketsSent; // total packets given to NDIS. ! 734: ULONG PacketsReceived; // total packets received from NDIS. ! 735: ULONG DataFramesSent; ! 736: LARGE_INTEGER DataFrameBytesSent; ! 737: ULONG DataFramesReceived; ! 738: LARGE_INTEGER DataFrameBytesReceived; ! 739: ULONG DataFramesResent; ! 740: LARGE_INTEGER DataFrameBytesResent; ! 741: ULONG DataFramesRejected; ! 742: LARGE_INTEGER DataFrameBytesRejected; ! 743: ULONG ResponseTimerExpirations; // e.g. T1 for Netbios ! 744: ULONG AckTimerExpirations; // e.g. T2 for Netbios ! 745: ULONG MaximumSendWindow; // in bytes ! 746: ULONG AverageSendWindow; // in bytes ! 747: ULONG PiggybackAckQueued; // attempts to wait to piggyback ack. ! 748: ULONG PiggybackAckTimeouts; // times that wait timed out. ! 749: LARGE_INTEGER WastedPacketSpace; // total amount of "wasted" packet space. ! 750: ULONG WastedSpacePackets; // how many packets contributed to that. ! 751: ULONG NumberOfResources; // how many TDI_RESOURCE_STATS follow. ! 752: TDI_PROVIDER_RESOURCE_STATS ResourceStats[1]; // variable array of them. ! 753: } TDI_PROVIDER_STATISTICS, *PTDI_PROVIDER_STATISTICS; ! 754: ! 755: #if 0 ! 756: ! 757: typedef struct _TDI_NETMAN_INFO { ! 758: OFFSET VariableName; // name of variable (a FLAT_STRING). ! 759: OFFSET VariableValue; // value of variable (a TDI_NETMAN_VARIABLE). ! 760: } TDI_NETMAN_INFO, *PTDI_NETMAN_INFO; ! 761: ! 762: typedef struct _TDI_NETMAN_VARIABLE { ! 763: ULONG VariableType; // selector for union, below. ! 764: union { ! 765: ULONG LongValue; ! 766: HARDWARE_ADDRESS HardwareAddressValue; ! 767: FLAT_STRING StringValue; ! 768: } Value; ! 769: } TDI_NETMAN_VARIABLE, *PTDI_NETMAN_VARIABLE; ! 770: ! 771: #define NETMAN_VARTYPE_ULONG 0 // type is a ULONG. ! 772: #define NETMAN_VARTYPE_HARDWARE_ADDRESS 1 // type is a HARDWARE_ADDRESS. ! 773: #define NETMAN_VARTYPE_STRING 2 // type is a FLAT_STRING. ! 774: ! 775: typedef union _TDI_INFO_BUFFER { ! 776: TDI_ENDPOINT_INFO EndpointInfo; ! 777: TDI_CONNECTION_INFO ConnectionInfo; ! 778: TDI_ADDRESS_INFO AddressInfo; ! 779: TDI_PROVIDER_INFO ProviderInfo; ! 780: TDI_NETMAN_INFO NetmanVariable; ! 781: } TDI_INFO_BUFFER, *PTDI_INFO_BUFFER; ! 782: ! 783: #define TDI_INFO_CLASS_ENDPOINT 0 // endpoint information class. ! 784: #define TDI_INFO_CLASS_CONNECTION 1 // connection information class. ! 785: #define TDI_INFO_CLASS_ADDRESS 2 // address information class. ! 786: #define TDI_INFO_CLASS_PROVIDER 3 // provider information class. ! 787: #define TDI_INFO_CLASS_NETMAN 4 // network management info class. ! 788: ! 789: #endif ! 790: ! 791: NTSTATUS ! 792: TdiOpenNetbiosAddress ( ! 793: IN OUT PHANDLE FileHandle, ! 794: IN PUCHAR Buffer, ! 795: IN PVOID DeviceName, ! 796: IN PVOID Name ! 797: ); ! 798: ! 799: ! 800: ! 801: #define IOCTL_TDI_MAGIC_BULLET _TDI_CONTROL_CODE( 0x7f, METHOD_NEITHER ) ! 802: ! 803: // ! 804: // NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for ! 805: // this device. ! 806: // ! 807: ! 808: #if 0 ! 809: ! 810: // ! 811: // These are the old definitions ! 812: // ! 813: ! 814: typedef struct _TDI_REQUEST_USER_ASSOCIATE { ! 815: HANDLE AddressHandle; ! 816: } TDI_REQUEST_USER_ASSOCIATE, *PTDI_REQUEST_USER_ASSOCIATE; ! 817: ! 818: typedef struct _TDI_REQUEST_USER_CONNECT { ! 819: TDI_CONNECTION_INFORMATION CallInformation; ! 820: //CHAR UserData[CallInformation.UserDataLength]; ! 821: //CHAR Options[CallInformation.OptionsLength]; ! 822: //CHAR RemoteAddress[CallInformation.RemoteAddressLength]; ! 823: } TDI_REQUEST_USER_CONNECT, *PTDI_REQUEST_USER_CONNECT; ! 824: ! 825: typedef struct _TDI_REQUEST_USER_QUERY_INFO { ! 826: int QueryType; ! 827: } TDI_REQUEST_USER_QUERY_INFO, *PTDI_REQUEST_USER_QUERY_INFO; ! 828: ! 829: #else ! 830: ! 831: // ! 832: // Define these to match the kernel ones for compatibility; eventually ! 833: // these will be removed. ! 834: // ! 835: ! 836: typedef TDI_REQUEST_ASSOCIATE_ADDRESS TDI_REQUEST_USER_ASSOCIATE, *PTDI_REQUEST_USER_ASSOCIATE; ! 837: typedef TDI_REQUEST_CONNECT TDI_REQUEST_USER_CONNECT, *PTDI_REQUEST_USER_CONNECT; ! 838: typedef TDI_REQUEST_QUERY_INFORMATION TDI_REQUEST_USER_QUERY_INFO, *PTDI_REQUEST_USER_QUERY_INFO; ! 839: ! 840: #endif ! 841: ! 842: ! 843: // ! 844: // The header in the OutputBuffer passed to TdiAction ! 845: // ! 846: ! 847: typedef struct _TDI_ACTION_HEADER { ! 848: ULONG TransportId; ! 849: USHORT ActionCode; ! 850: USHORT Reserved; ! 851: } TDI_ACTION_HEADER, *PTDI_ACTION_HEADER; ! 852: ! 853: typedef struct _STREAMS_TDI_ACTION { ! 854: TDI_ACTION_HEADER Header; ! 855: BOOLEAN DatagramOption; ! 856: ULONG BufferLength; ! 857: CHAR Buffer[1]; ! 858: } STREAMS_TDI_ACTION, *PSTREAMS_TDI_ACTION; ! 859: ! 860: #endif // ndef _TDI_USER_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.