Back: CSharp Reference Implementation

Overview

The Direct C# Reference implementation supplies :
  • A reusable object model and class library
  • Out of the box components

The C# Direct Object Model implements the Direct protocol. It is designed as a set of reusable classes that you can incorporate into your products to build fully customized Direct nodes.

The Direct components listed (services, exes) below use the object model to create turn-key exemplar implementations you may use as is, or refer to as samples or sample source code.

Object Model and Libraries


Xml Documentation

The Object Model source is well documented.
  • The build automatically compiles documentation embedded in the source into Xml Documents.
  • You can transform these documents into MSDN style docs using open source tools like Sandcastle

If you have Sandcastle installed, you can use the helper csharp\build\sc_help.bat batch file.

Health.Direct.Common.dll

Contains object model for implementing and managing:

  • S/MIME Crypto
  • Certificates & Anchors
  • Certificate Resolvers, including Dns
  • Messaging
    • MIME Parsing/Serialization
    • Mail Parsing/Serialization
    • MDN
  • DNS
    • Parsing/Serialization
    • DNS Resolver - TCP & UDP
  • Routing
  • Caching
  • Diagnostics
  • IOC Container
  • Useful Extensions
  • Etc

Source code

csharp\common

Binaries

csharp\common\bin

Dependencies

None

Health.Direct.Agent.dll

  • Direct Security Agent
  • Domains and MailAddresses
  • Trust Model
    • Trust Chain Validation

Source code

csharp\agent

Binaries

csharp\agent\bin

Dependencies

  • Health.Direct.Common.dll

Health.Direct.DnsResponder.dll

Implements a multi-threaded DNS server that is hosted by the Direct Dns Windows Service.
  • Socket Server/services
  • Dns TCP Responder
  • Dns UDP Responder

Source code

csharp\dnsresponder

Binaries

csharp\dnsresponder\bin\debug

Dependencies

  • Health.Direct.Common.dll
  • Health.Direct.Config.Client.dll

Health.Direct.Config.Store.dll

Data access layer and object model over the Direct Database.
  • Certificates
  • Trust Anchors
  • Domains
  • Addresses
  • Dns Records
  • Blobs
  • Properties

Used by the Config WCF Middle Tier service, which is a thin WCF wrapper around the objects in this assembly.

Source code

csharp\config\store

Binaries

csharp\config\bin

Dependencies

  • Health.Direct.Common.dll

Health.Direct.Config.Client.dll

All .NET Direct components interact with the middle using this assembly.
  • Canned, pre-built WCF Proxies so you don't have to generate them yourself
  • Extension methods to simplify some access patterns
  • Simplified WCF configuration that works
  • Wrapper Business logic [in process of being migrated out of ConfigConsole.exe]

Source code

csharp\config\client

Binaries

csharp\config\client\bin

Dependencies

  • Health.Direct.Common.dll
  • Health.Direct.Config.Store.dll

Health.Direct.Diagnostics.NLog.dll

Integrates NLog, the popular .NET Open Source logging framework.

Source code

csharp\diagnostics

Binaries

csharp\diagnostics\bin

Dependencies

  • Health.Direct.Common.dll
  • NLog.dll


Direct Gateway

The Direct Gateway integrates the Direct Security Agent with the the free Smtp Server service in Windows 2008/2003. It adds additional Smtp Server specific logic and hooks.

  • Automatically applies and enforces the Direct protocol and security model on all incoming and outbound messages.
  • Integrates with Config Middle Tier
  • Address/Domain verification
  • Message Routing

You can use the Gateway standalone, or you can set it up to work with the Config Middle Tier.

Health.Direct.SmtpAgent.dll

This assembly implements the Gateway entirely in C#. It works with message objects exposed by Smtp Server using COM Interop.
  • You can use the SmtpAgent or other classes directly.

Source code

  • csharp\gateway\smtpagent

Binaries

  • csharp\gateway\smtpagent\bin

Dependencies

  • Health.Direct.Common.dll
  • Health.Direct.Agent.dll
  • Health.Direct.Config.Client.dll
  • Health.Direct.Config.Store.dll
  • Interop.ADODB.dll
  • Interop.CDO.dll

smtpEventHandler.dll

  • A tiny COM C++ hook that subscribes to SMTP Server events.
  • Invokes Health.Direct.SmtpAgent.dll

Source code

  • csharp\gateway\smtpEventHandler

Binaries

  • csharp\gateway\smtpeventhandler\bin

Dependencies

None.


Config Web Service

This WCF service provides CRUD interfaces for the Direct Database store. Interfaces exist to manage:
  • Certificates
  • Anchors
  • Addresses
  • Domains
  • DNS Records
  • Blobs
  • Properties

The service is a very thin layer over Health.Direct.Config.Store.dll, which does the actual work of interacting with the database.

Source Code

  • csharp\config\service

Binaries

Health.Direct.Config.Service.dll
  • csharp\config\service\bin
  • csharp\config\service\*.svc*

Dependencies

  • Health.Direct.Common.dll
  • Health.Direct.Config.Store.dll
  • Health.Direct.Diagnostics.NLog.dll
  • NLog.dll

Dns Web Service

The WCF Dns Web Service - provides read-only access to Dns Records stored in the Direct Database. The Direct DNS Server calls this web service to retrieve data.

Source Code

csharp\dnsresponder.service

Binaries

Health.Direct.DnsResponder.Service.dll

  • csharp\dnsresponder.service\bin
  • csharp\dnsresponder.service\*.svc*


Direct Dns Server

The Direct DNS Server is a multi-threaded Dns server distinguished by the following features:
  • Supports CERT records, unlike Windows DNS Server
  • Seamless integration with Direct Config Middle Tier
    • Automatically serves up stored certificates
    • You manage and configure your Dns needs using the same centralized repository as the rest of the system
    • No Zone files or other bindings required
  • Full Support for both TCP & UDP responders

The Direct DNS Server is a Windows Service. It is a thin wrapper around Health.Direct.DnResponder.dll - which contains all the actual server logic.

The server comes with a built in Installer.
  • You can install it using the .NET Framework utility installutil.exe

Source Code

  • csharp\windows services\dnsResponder.winsrv

Binaries

DirectDnsResponderSvc.exe

  • csharp\dnsresponder\bin

Dependencies

  • Health.Direct.DnsResponder.dll
  • Health.Direct.Common.dll
  • Health.Direct.Config.Client.dll
  • Health.Direct.Config.Store.dll
  • Health.Direct.Diagnostics.NLog.dll
  • NLog.dll


Management Tools

ConfigConsole

The ConfigConsole is a command line application used to manage the system. It does this by calling the WCF Config Middle Tier service.

Source Code

  • csharp\config\console

Dependencies

  • Health.Direct.Common.dll
  • Health.Direct.Config.Store.dll
  • Health.Direct.Diagnostics.NLog.dll
  • NLog.dll

AgentConsole

AgentConsole is a command line tool that implements useful diagnostics commands, especially for DNS.