home *** CD-ROM | disk | FTP | other *** search
- [ 2. Physical Driver Interface]
- EMBEDDED LAN PHYSICAL DRIVER INTERFACE (PDI)
- ═════════════════════════════════════════════════════════════════════════
- The Embedded LAN Physical Driver Interface (PDI) is an interface your
- applications can use to directly drive the LAN interface at the packet
- level. You supply all the headers and all the data. PDI transports
- the packets your application sends to one or more destination machines.
- PDI also provides a unique "indication-based" packet reception system
- that lets you register a C function to be executed whenever a packet
- arrives for your application.
-
- QUALITY OF SERVICE CONTROLS:
-
- PDI also supports the Embedded LAN quality-of-service options. For
- example, your application can specify that it wants to use connection-
- oriented services (point-to-point or modem links), connectionless
- services (true local area networking, such as Ethernet), or receive
- directed, multicast, or broadcast packets on the LAN. PDI can even
- receive all packets in a special "promiscuous mode" so that your
- application can watch all traffic on the LAN.
-
- PHYSICAL DRIVER INTERFACE API:
-
- API PdiOpenEndpoint (
- IN UCHAR * DriverName, // ASCIIZ name of NIC.
- IN OUT PPHYSICAL_ADDRESS LocalAddress, // psap, telno, etc.
- IN PDIBITMASK QualityOfService, // service bitflags.
- IN PVOID Context, // indication token.
- OUT PPDIHANDLE Handle); // handle assigned by PDI.
-
- API PdiCloseEndpoint (
- IN PDIHANDLE Handle);
-
- API PdiConnect (
- IN PDIHANDLE Handle, // handle to endpoint.
- IN PPHYSICAL_ADDRESS RemoteAddress); // partner psap, telno.
-
- API PdiDisconnect (
- IN PDIHANDLE Handle,
- IN PDIBITMASK Flags);
-
- #define PDI_DISCONNECT_ORDERLY_RELEASE 0x0001 // discon sends complete.
- #define PDI_DISCONNECT_ABORT 0x0002 // abort connection.
-
- API PdiSend (
- IN PDIHANDLE Handle,
- IN PDIBITMASK Flags,
- IN PVOID Buffer,
- IN USHORT BufferLength);
-
- #define PDI_SEND_FLAGS_EOR 0x0001 // PDU's end of record.
-
- API PdiQueryInformation (
- IN PDIHANDLE Handle,
- IN USHORT InformationType,
- OUT PVOID Buffer,
- IN USHORT BufferLength);
-
- #define PDI_INFO_REMOTE_ADDRESS 0 // remote transport address.
- #define PDI_INFO_LOCAL_ADDRESS 1 // local transport address.
- #define PDI_INFO_ENDPOINT_STATISTICS 2 // statistics about endpoint.
- #define PDI_INFO_CONNECTION_STATISTICS 3 // statistics about connection.
- #define PDI_INFO_PROVIDER_STATISTICS 4 // provider characteristics.
-
- typedef struct _PHYSICAL_HARDWARE {
- USHORT HardwareType;
- } PHYSICAL_HARDWARE, *PPHYSICAL_HARDWARE;
-
- #define PHYSICAL_HARDWARE_TYPE_UNKNOWN 0 // hardware type not known.
- #define PHYSICAL_HARDWARE_TYPE_802_3 1 // IEEE 802.3 (Ethernet).
- #define PHYSICAL_HARDWARE_TYPE_BLUE 2 // Xerox Ethernet.
- #define PHYSICAL_HARDWARE_TYPE_802_4 3 // IEEE 802.4/Arcnet (Token Bus).
- #define PHYSICAL_HARDWARE_TYPE_802_5 4 // IEEE 802.5 (Token Ring).
-
- typedef struct _PHYSICAL_STATISTICS {
-
- //
- // Data throughput information.
- //
-
- QUADINT Sends; // count of PdiSend requests.
- QUADINT BytesSent; // # bytes sent through PdiSend.
- QUADINT ReceiveIndications; // # receive indications delivered.
- QUADINT BytesReceived; // # bytes delivered through recv ind's.
-
- //
- // Error & packet type information.
- //
-
- QUADINT ReceiveErrors; // packets dropped in MAC/card.
- QUADINT OversizePackets; // oversized packets received.
- QUADINT UndersizePackets; // undersized packets received.
- QUADINT MulticastPackets; // multicast packets received.
- QUADINT BroadcastPackets; // broadcast packets received.
- QUADINT FunctionalPackets; // functional packets received.
-
- //
- // Connection information.
- //
-
- QUADINT ConnectIndications; // count of connection indications.
- QUADINT DisconnectIndications; // count of disconnection indications.
- QUADINT StatusIndications; // count of status indications.
- QUADINT ConnectionsInitiated; // connections started at endpoint.
- QUADINT ConnectionsAccepted; // connections started from remote.
-
- //
- // Control information.
- //
-
- ULONG PriorityLevel; // priority of this endpoint/connection.
- ULONG SecurityLevel; // security level/this endpoint/connection.
- ULONG SecurityCompartment; // compartment for some protocols.
- } PHYSICAL_STATISTICS, *PPHYSICAL_STATISTICS;
-
- typedef union _PDI_INFORMATION_BUFFER {
- PHYSICAL_ADDRESS LocalAddress;
- PHYSICAL_ADDRESS RemoteAddress;
- PHYSICAL_STATISTICS EndpointStatistics;
- PHYSICAL_STATISTICS ConnectionStatistics;
- PHYSICAL_STATISTICS ProviderStatistics;
- } PDI_INFORMATION_BUFFER, *PPDI_INFORMATION_BUFFER;
-
- API PdiSetInformation (
- IN PDIHANDLE Handle,
- IN USHORT InformationType,
- IN PVOID Buffer,
- IN USHORT BufferLength);
-
- API PdiSetIndicationHandler (
- IN PDIHANDLE Handle,
- IN USHORT PdiIndType,
- IN PPDI_INDICATION IndicationHandler);
-
- #define PDI_IND_RECEIVE 0 // connection-oriented receive.
- #define PDI_IND_STATUS 1 // status indication.
- #define PDI_IND_CONNECT 2 // connection request.
- #define PDI_IND_DISCONNECT 3 // disconnection request.
-
- //
- // Physical Driver Interface (PDI) indication routine (user supplied) types.
- //
-
- //
- // Connection-oriented receive indication handler.
- //
-
- typedef VOID (*PIND_PDIRECEIVE)(
- IN PVOID EndpointContext,
- IN PDIBITMASK ReceiveFlags,
- IN PVOID Buffer,
- IN USHORT BufferLength);
-
- #define PDI_RECEIVE_OVERSIZE 0x0001 // PDU was oversized for media.
- #define PDI_RECEIVE_UNDERSIZE 0x0002 // PDU was too short for media.
- #define PDI_RECEIVE_DATA_ERROR 0x0004 // PDU had CRC or data error.
- #define PDI_RECEIVE_EOR 0x0008 // PDU end of record encountered.
- #define PDI_RECEIVE_BROADCAST 0x0010 // PDU was broadcast to all nodes.
- #define PDI_RECEIVE_MULTICAST 0x0020 // PDU was multicast to all nodes.
-
- //
- // Change in endpoint status indication handler.
- //
-
- typedef VOID (*PIND_PDISTATUS)(
- IN PVOID EndpointContext,
- IN PDIBITMASK StatusFlags,
- IN PVOID Buffer,
- IN USHORT BufferLength);
-
- #define PDI_STATUS_IDLE 0x0000 // endpoint is idle.
- #define PDI_STATUS_CONNECTION 0x0001 // a connection is active.
-
- //
- // Connection request indication handler.
- //
-
- typedef VOID (*PIND_PDICONNECT)(
- IN PVOID EndpointContext,
- IN PPHYSICAL_ADDRESS RemoteAddress,
- OUT PVOID *ConnectionContext);
-
- //
- // Disconnection notification indication handler.
- //
-
- typedef VOID (*PIND_PDIDISCONNECT)(
- IN PVOID EndpointContext,
- IN PDIBITMASK DisconnectFlags);
-