📄 etransport.pas
字号:
// of the program
// Notes : Make sure there are no open transports anymore
// when you deinitialise the library.
// ----------------------------------------------------------
procedure EpFinalize(); stdcall; external DLL_NAME name '_EpFinalize@0';
// ----------------------------------------------------------
// Purpose: Creates a new transport
// Usage : Use this function to start a communication
// session. The transport_type parameter specifies the
// type of transport to be created (rs232, tcpip, etc).
// Notes: : None
// ----------------------------------------------------------
function EpCreateTransport(transport_type : Integer; prop : PTransportProperties) : TRANSPORT_HANDLE; stdcall; external DLL_NAME name '_EpCreateTransport@8';
// ----------------------------------------------------------
// Purpose: Creates a new communication transport
// Usage : This function is essentially the same as
// EpCreatePlug, but differs in a way that it accepts
// a EpConnectionRequest structure.
// Notes : This function shouldn't be used with manually
// allocated handles or by handles already in use with
// another transport. Doing so might crash the dll.
// ----------------------------------------------------------
function EpAcceptTransport(request : PEpConnectionRequest) : TRANSPORT_HANDLE; stdcall; external DLL_NAME name '_EpAcceptTransport@4';
// ----------------------------------------------------------
// Purpose: Destroys a previously created transport
// Usage : None
// Notes : None
// ----------------------------------------------------------
procedure EpDestroyTransport(transport : TRANSPORT_HANDLE); stdcall; external DLL_NAME name '_EpDestroyTransport@4';
// ----------------------------------------------------------
// Purpose: Retrieves the number of created transports
// Usage : None
// Notes : None
// ----------------------------------------------------------
function EpGetTransportCount() : Integer; stdcall; external DLL_NAME name '_EpGetTransportCount@4';
// ----------------------------------------------------------
// Purpose: Sets a transport option
// Usage : None
// Notes : None
// ----------------------------------------------------------
procedure EpSetOption(transport : TRANSPORT_HANDLE; option : integer; value : Pointer; size : Integer); stdcall; external DLL_NAME name '_EpSetOption@16';
// ----------------------------------------------------------
// Purpose: Registers a new protocol
// Usage : Call this function to add support for a new
// protocol in the system.
// Notes : Protocol ids must be unique GUIDs. Use GUIDGEN
// to create a new GUID number.
// ----------------------------------------------------------
function EpRegisterProtocol(id : TGUID; protocol : PProtocol) : Boolean; stdcall; external DLL_NAME name '_EpRegisterProtocol@20';
// ----------------------------------------------------------
// Purpose: Retrieves the protocol handle from a GUID
// Usage : Internally used function
// Notes : None
// ----------------------------------------------------------
function EpProtocolHandle(id : TGUID) : PProtocol; stdcall; external DLL_NAME name '_EpProtocolHandle@16';
// ----------------------------------------------------------
// Purpose: Retrieves the protocol handle from a GUID
// Usage : Internally used function
// Notes : None
// ----------------------------------------------------------
function EpAttachProtocol(transport : TRANSPORT_HANDLE; id : TGUID) : Boolean; stdcall; external DLL_NAME name '_EpAttachProtocol@20';
// ----------------------------------------------------------
// Purpose: Connects to an external source
// Usage : Use this function to connect a transport to
// an external host, such as a modem or an internet
// service.
// Notes : Each transport-type has its own way, non compatible
// way of plugging into external servers. However,
// EPlug tries to unify them by sending an
// internal event SYSTEM_CONNECTED when a connection
// was successfulor SYSTEM_CONNECTION_FAILED when the
// connection couldn't be made.
// ----------------------------------------------------------
procedure EpConnect(transport : TRANSPORT_HANDLE; host : PChar; port, timeout : Integer); stdcall; external DLL_NAME name '_EpConnect@16';
// ----------------------------------------------------------
// Purpose: Disconnects from an external source
// Usage : Use this function to disconnect a transport from an
// external host, such as a modem or an internet
// service.
// Notes : Each transport-type has its own, non compatible
// way of plugging to external sources. However,
// EPlug tries to unify them by sending an
// internal event SYSTEM_DISCONNECTED when a connection
// was successfully aborted. If a connection could not me
// aborted SYSTEM_DISCONNECTION_FAILED is sent. Any
// internal events for the specific transport-type are
// also sent.
// ----------------------------------------------------------
procedure EpDisconnect(transport : TRANSPORT_HANDLE); stdcall; external DLL_NAME name '_EpDisconnect@4';
// ----------------------------------------------------------
// Purpose: Sends an event to a transport
// Usage : Whenever you want to send some data to a transport
// you have to create an event for it. The transport
// accepts the event, transforms it to data for
// the target device via a protocol router, and then
// sends the data to the target device. When data
// is received, the data is once again lead through
// the protocol and transformed to an EpEvent. Then
// the event is sent to the Grid's callback function.
// Notes : The event data is sent to the protocol, transformed,
// and immediately sent to the transport, When this function
// ----------------------------------------------------------
function EpSendAction(transport : TRANSPORT_HANDLE; action : PEpAction) : Boolean; stdcall; external DLL_NAME name '_EpSendAction@8';
// ----------------------------------------------------------
// Purpose: Dispatches an EpEvent to the grid callback
// Usage : This function is probably only of use in
// protocols. It takes a EpEvent, and sends it
// to a grid's callback function. The user can
// then do something according to the EpEvent he
// received.
// Notes : The event data is copied and stored in a queue.
// You may immediately clean up the event after
// this function returns.
// Notes : When the user handled the dispatched message,
// he must call EpHandledEvent to notify ePlug that
// the event data can be destroyed.
// Notes : If the size member in the event is larger than 0,
// the data member is ignored.
// ----------------------------------------------------------
procedure EpDispatchEvent(transport : TRANSPORT_HANDLE; event : PEpEvent); stdcall; external DLL_NAME name '_EpDispatchEvent@8';
// ----------------------------------------------------------
// Purpose: Sends transformed data from the protocol to the
// transport
// Usage : This function initiates the actual data transfer
// in the transport. You should only use this
// function in a protocol implementation.
// Notes : The sent data is copied inside the transport, to
// ensure reliable communication. When this function
// returns, you can immediately delete the data.
// Notes : If the protocol member in the EpEvent is nonzero,
// then the data in the data member is send through
// a assigned protocol object. The protocol then calls
// EpCompleteEvent to send the actual (translated) data.
// If the protocol member is zero, EPlug sees the
// data in the data member as raw data and sends
// immediately.
// ----------------------------------------------------------
procedure EpCompleteAction(transport : TRANSPORT_HANDLE; data : PByte; size : Integer); stdcall; external DLL_NAME name '_EpCompleteAction@12';
// ----------------------------------------------------------
// Purpose: Adds a event filter to a grid
// Usage : None
// Notes : None
// ----------------------------------------------------------
procedure EpInstallEventFilter(transport : TRANSPORT_HANDLE; proc : FilterProc); stdcall; external DLL_NAME name '_EpInstallEventFilter@8';
// ----------------------------------------------------------
// Purpose: Removes a previously installed event filter
// Usage : None
// Notes : None
// ----------------------------------------------------------
procedure EpRemoveEventFilter(transport : TRANSPORT_HANDLE; proc : FilterProc); stdcall; external DLL_NAME name '_EpRemoveEventFilter@8';
// ----------------------------------------------------------
// Purpose: Retrieves some extra reference data from an event
// Usage : A transport might store some extra reference data
// when it posts an event. For example an UDP
// transport stores the ip address of the user that
// sent the packet.
// Notes : None
// ----------------------------------------------------------
function EpGetEventRefData(transport : TRANSPORT_HANDLE; reference : Integer) : Pointer; stdcall; external DLL_NAME name '_EpGetEventRefData@8';
// ----------------------------------------------------------
// Purpose: Sends raw data to a transport
// Usage : This is a convenient wrapper to directly
// pass raw data to a transport, without creating a
// EpEvent. Normally you would create a EpEvent
// with the protocol member set to 0.
// Notes : Because there is no protocol attached to raw
// data, you may decide what kind of event you
// want to see in return. If the reply_protocol
// parameter is 0, the reply event will be a
// system event. Otherwise it will be an event
// of the protocol assigned to the transport on creation.
// ----------------------------------------------------------
function EpSendRawData(transport : TRANSPORT_HANDLE; data : PByte; size : Integer; reply_protocol : TGUID; reply_msg, timeout : Integer) : Boolean; stdcall; external DLL_NAME name '_EpSendRawData@36';
// ----------------------------------------------------------
// Purpose: Sends unidentified data to the previous protocol
// in the inheritance chain.
// Usage : Whenever a protocol finds data it can't handle,
// it can send it to the previous protocol in the
// inheritance chain and ultimately to a built
// in protocol for a particular transport (the
// 'system' protocol)
// ----------------------------------------------------------
procedure EpInheritedRecv(transport : TRANSPORT_HANDLE; data : PByte; size : Integer); stdcall; external DLL_NAME name '_EpInheritedRecv@12';
// ----------------------------------------------------------
// Purpose: Notifies EPlug that a reply arrived for an event.
// Usage : When an event is sent with a positive value time-
// out, EPlug will send an SYSTEM_TIMEOUT event
// when the given time has elapsed. When this function
// is called, the timeout event is supressed.
// Notes : When there were sent multiple events with the same
// type, EpHandledEvent removes them in the order they
// were sent, regardless of differences in the time-out
// values.
// ----------------------------------------------------------
function EpCancelTimeout(transport : TRANSPORT_HANDLE; protocol : TGUID; msg : Integer) : Boolean; stdcall; external DLL_NAME name '_EpCancelTimeout@24';
implementation
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -