SNIF REMOTING FRAMEWORK
SNIF is the Secure Network Interface Framework included in StreamSec Tools 4.x: an easy-to-use remoting framework for Embarcadero Delphi TM that lets one Delphi program call methods on another across the network, as if the remote object were local. It is built directly on Delphi RTTI, so there is no IDL, no WSDL, no code generation and no proxy classes to maintain - you publish an ordinary class and consume it through an ordinary interface.
WHAT IT IS
SNIF is a strongly-typed class-remoting and application-server framework, in the spirit of DataSnap or RemObjects, but with security as a first-class feature and with the wire format driven entirely by RTTI. It has three parts:
- Server (Snif) - you register a Delphi class, and the framework dispatches incoming calls to it by RTTI.
- Client (Snic) - you ask for an interface, and the framework hands back a proxy; calling a method marshals the call to the server.
- Transport (Snip) - the calls travel over a secure SSH or TLS connection, or over an in-memory channel for testing.
Scalars, records, dynamic arrays and byte buffers are marshalled automatically - you never write serialization code.
HOW YOU USE IT
On the server, publish a class and register it:
{$METHODINFO ON}
type
[Roles('user')]
TCalculator = class
public
function Add(A, B: Integer): Integer;
end;
ClassServer.RegisterServerClass(TCalculator);
On the client, declare a matching interface - carrying a GUID and method RTTI (via {$M+} or by descending from IInvokable) so the proxy has something to work with - and ask for an instance:
type
{$M+}
ICalculator = interface
['{7F3C1A20-9D4E-4B6A-8C11-2E5B7A0C0901}']
function Add(A, B: Integer): Integer;
end;
{$M-}
var
Calc: ICalculator;
begin
// Client is already connected and logged in.
if Client.MakeInstance('Calc.TCalculator', TypeInfo(ICalculator), Calc, 'user') then
ShowMessage(IntToStr(Calc.Add(2, 3))); // Add runs on the server
end;
That is the whole pattern: a class on one side, an interface on the other, and RTTI in between. Both types live in a unit's interface section. Declarative attributes control the rest - InstanceKind sets whether an instance is created per call, per connection, per session, per user or per application, and the server can call back into a client interface for publish/subscribe scenarios such as chat or live notifications.
SECURITY AND ACCESS CONTROL
- Every call runs over an authenticated, encrypted StreamSec SSH or TLS connection.
- Built-in login classes provide challenge-response and PAKE authentication, password change and one-time-password recovery.
- Access is role-based and deny-by-default: a service class is reachable only if it is explicitly marked with the roles allowed to use it, or marked anonymous. A forgotten annotation denies access rather than silently exposing the class.
WHEN TO USE IT
- You are building a Delphi client that talks to a Delphi server and want strongly-typed calls without hand-written REST endpoints, JSON DTOs or SOAP/WSDL.
- You already use StreamSec Tools for TLS or SSH and want your application protocol to ride securely on the same stack, instead of bolting security onto a separate remoting product.
- You need authentication and role-based access control built in, rather than writing your own.
- You want server-to-client callbacks or publish/subscribe delivered in a typed, secure way.
- You are building a multi-tier application server and want per-call, per-session or per-user instance lifetimes controlled by a single attribute.
See also SSH and TLS, or return to the StreamSec Tools 4.x overview.