Difference between revisions of "HSL"

From Halon, SMTP software for hosting providers
Jump to: navigation, search
Line 5: Line 5:
 
The '''Halon Scripting Language''' ('''HSL''') is an email-centric, [https://en.wikipedia.org/wiki/Domain-specific_language domain-specific] language that's at the core of the {{HalonProdName}}.
 
The '''Halon Scripting Language''' ('''HSL''') is an email-centric, [https://en.wikipedia.org/wiki/Domain-specific_language domain-specific] language that's at the core of the {{HalonProdName}}.
  
The language itself implements a set of [[HSL core functions|standard library]] functions. In addition to that, there are ''contexts'' (or extensions) that are implemented by the different [https://en.wikipedia.org/wiki/Daemon_(computing) daemon processes]; most importantly the e-mail oriented flows that maps to SMTP commands; [http://docs.halon.se/hsl/connect.html CONNECT], [[HSL Mail Authentication|AUTH]] (SASL), [http://docs.halon.se/hsl/mailfrom.html MAIL FROM], [[HSL Mail Recipient|RCPT TO]], [[HSL Mail Content|DATA]] and queue processing [[HSL Mail Queue|pre-]] and [[HSL Mail Transport|post-]] delivery, but also the [[HSL System Authentication|API authentication]] and [[HSL IP Policy|IP firewall]] context (used to control access to HTTP, SNMP, SSH and FTP - not SMTP, for that use the [http://docs.halon.se/hsl/connect.html CONNECT] context). The contexts define additional functions, as well as pre-defined variables.
+
The language itself implements a set of [[HSL core functions|standard library]] functions. In addition to that, there are ''contexts'' (or extensions) that are implemented by the different [https://en.wikipedia.org/wiki/Daemon_(computing) daemon processes]; most importantly the e-mail oriented flows that maps to SMTP commands; [http://docs.halon.se/hsl/connect.html CONNECT], [http://docs.halon.se/hsl/auth.html AUTH] (SASL), [http://docs.halon.se/hsl/mailfrom.html MAIL FROM], [http://docs.halon.se/hsl/rcptto.html RCPT TO], [http://docs.halon.se/hsl/data.html DATA] and queue processing [[HSL Mail Queue|pre-]] and [[HSL Mail Transport|post-]] delivery, but also the [[HSL System Authentication|API authentication]] and [[HSL IP Policy|IP firewall]] context (used to control access to HTTP, SNMP, SSH and FTP - not SMTP, for that use the [http://docs.halon.se/hsl/connect.html CONNECT] context). The contexts define additional functions, as well as pre-defined variables.
  
 
Although the syntax and function names in HSL are very much similar to PHP, Python, Perl and C, it's important to remember that HSL is a completely different language. There are syntax differences, and the performance characteristics of different coding styles are not comparable between these languages.
 
Although the syntax and function names in HSL are very much similar to PHP, Python, Perl and C, it's important to remember that HSL is a completely different language. There are syntax differences, and the performance characteristics of different coding styles are not comparable between these languages.

Revision as of 12:39, 19 January 2018

The scripting language is documented in the HSL reference manual.
At its core, Halon is a scriptable SMTP server

The Halon Scripting Language (HSL) is an email-centric, domain-specific language that's at the core of the Halon platform.

The language itself implements a set of standard library functions. In addition to that, there are contexts (or extensions) that are implemented by the different daemon processes; most importantly the e-mail oriented flows that maps to SMTP commands; CONNECT, AUTH (SASL), MAIL FROM, RCPT TO, DATA and queue processing pre- and post- delivery, but also the API authentication and IP firewall context (used to control access to HTTP, SNMP, SSH and FTP - not SMTP, for that use the CONNECT context). The contexts define additional functions, as well as pre-defined variables.

Although the syntax and function names in HSL are very much similar to PHP, Python, Perl and C, it's important to remember that HSL is a completely different language. There are syntax differences, and the performance characteristics of different coding styles are not comparable between these languages.

Functions and contexts

Standard library functions are recognized by their lowercase names, and can be used in any context. Most functions are indeed standard library functions, for re-usability. The other (context) functions, such as Reject($msg) (giving a 500 SMTP error), have capitalized names.

Below is a table relating functions and SMTP commands to HSL contexts

Context Process Description
Standard library all processes Shared among all contexts
CONNECT smtpd Handling IP packets, like a scripted firewall
AUTH smtpd Handling SMTP AUTH (SASL) requests
MAIL FROM smtpd Handling the SMTP MAIL FROM commands
RCPT TO smtpd Handling the SMTP RCPT TO commands
DATA smtpd Handling the SMTP DATA command; in other words "the mail message"
Pre-delivery mailqueued Decides what is to be done before a delivery is attempted
Post-delivery mailqueued Decides what is to be done when a delivery attempt is done
API authentication backend Handling administration (SOAP API) sign-ins, suitable for RADIUS/TACACS+ integration
IP Firewall (http, snmp, ssh, ftp) Firewall processing for services (not SMTP related)