# Unit blcksock

Description | uses | Classes, Interfaces, Objects and Records | Functions and Procedures | Types | Constants | Variables

## Description

## uses

- SysUtils
- Classes
- synafpc
- synsock
- synautil
- synacode
- synaip

## Overview

### Classes, Interfaces, Objects and Records

Name | Description
--- | ---
Class `ESynapseError` | Exception clas used by Synapse
Class `TSynaOption` | this object is used for remember delayed socket option set.
Class `TBlockSocket` | Basic IP object.
Class `TSocksBlockSocket` | Support for SOCKS4 and SOCKS5 proxy
Class `TTCPBlockSocket` | Implementation of TCP socket.
Class `TDgramBlockSocket` | Datagram based communication
Class `TUDPBlockSocket` | Implementation of UDP socket.
Class `TICMPBlockSocket` | Implementation of RAW ICMP socket.
Class `TRAWBlockSocket` | Implementation of RAW socket.
Class `TPGMMessageBlockSocket` | Implementation of PGM-message socket.
Class `TPGMStreamBlockSocket` | Implementation of PGM-stream socket.
Class `TCustomSSL` | Parent class for all SSL plugins.
Class `TSSLNone` | Default SSL plugin with no SSL support.
record `TIPHeader` | Record with definition of IP packet header.
Class `TSynaClient` | Parent class of application protocol implementations.

### Types

`THookSocketReason = (...);`
`THookSocketStatus = procedure(Sender: TObject; Reason: THookSocketReason; const Value: String) of object;`
`THookDataFilter = procedure(Sender: TObject; var Value: AnsiString) of object;`
`THookCreateSocket = procedure(Sender: TObject) of object;`
`THookMonitor = procedure(Sender: TObject; Writing: Boolean; const Buffer: TMemory; Len: Integer) of object;`
`THookAfterConnect = procedure(Sender: TObject) of object;`
`THookVerifyCert = function(Sender: TObject):boolean of object;`
`THookHeartbeat = procedure(Sender: TObject) of object;`
`TSocketFamily = (...);`
`TSocksType = (...);`
`TSSLType = (...);`
`TSynaOptionType = (...);`
`TSSLClass = class of TCustomSSL;`

### Constants

`SynapseRelease = '38';`
`cLocalhost = '127.0.0.1';`
`cAnyHost = '0.0.0.0';`
`cBroadcast = '255.255.255.255';`
`c6Localhost = '::1';`
`c6AnyHost = '::0';`
`c6Broadcast = 'ffff::1';`
`cAnyPort = '0';`
`CR = #$0d;`
`LF = #$0a;`
`CRLF = CR + LF;`
`c64k = 65536;`

### Variables

`SSLImplementation: TSSLClass = TSSLNone;`

## Description

### Types

`THookSocketReason = (...);`

Types of OnStatus events

- HR_ResolvingBegin: Resolving is begin. Resolved IP and port is in parameter in format like: 'localhost.somewhere.com:25'.
- HR_ResolvingEnd: Resolving is done. Resolved IP and port is in parameter in format like: 'localhost.somewhere.com:25'. It is always same as in HR_ResolvingBegin!
- HR_SocketCreate: Socket created by CreateSocket method. It reporting Family of created socket too!
- HR_SocketClose: Socket closed by CloseSocket method.
- HR_Bind: Socket binded to IP and Port. Binded IP and Port is in parameter in format like: 'localhost.somewhere.com:25'.
- HR_Connect: Socket connected to IP and Port. Connected IP and Port is in parameter in format like: 'localhost.somewhere.com:25'.
- HR_CanRead: Called when CanRead method is used with `True` result.
- HR_CanWrite: Called when CanWrite method is used with `True` result.
- HR_Listen: Socket is swithed to Listen mode. (TCP socket only)
- HR_Accept: Socket Accepting client connection. (TCP socket only)
- HR_ReadCount: report count of bytes readed from socket. Number is in parameter string. If you need is in integer, you must use StrToInt function!
- HR_WriteCount: report count of bytes writed to socket. Number is in parameter string. If you need is in integer, you must use StrToInt function!
- HR_Wait: If is limiting of bandwidth on, then this reason is called when sending or receiving is stopped for satisfy bandwidth limit. Parameter is count of waiting milliseconds.
- HR_Error: report situation where communication error occured. When raiseexcept is `True`, then exception is called after this Hook reason.

`THookSocketStatus = procedure(Sender: TObject; Reason: THookSocketReason; const Value: String) of object;`

Procedural type for OnStatus event. Sender is calling TBlockSocket object, Reason is one of set Status events and value is optional data.

`THookDataFilter = procedure(Sender: TObject; var Value: AnsiString) of object;`

This procedural type is used for DataFilter hooks.

`THookCreateSocket = procedure(Sender: TObject) of object;`

This procedural type is used for hook OnCreateSocket. By this hook you can insert your code after initialisation of socket. (you can set special socket options, etc.)

`THookMonitor = procedure(Sender: TObject; Writing: Boolean; const Buffer: TMemory; Len: Integer) of object;`

This procedural type is used for monitoring of communication.

`THookAfterConnect = procedure(Sender: TObject) of object;`

This procedural type is used for hook OnAfterConnect. By this hook you can insert your code after TCP socket has been sucessfully connected.

`THookVerifyCert = function(Sender: TObject):boolean of object;`

This procedural type is used for hook OnVerifyCert. By this hook you can insert your additional certificate verification code. Usefull to verify server CN against URL.

`THookHeartbeat = procedure(Sender: TObject) of object;`

This procedural type is used for hook OnHeartbeat. By this hook you can call your code repeately during long socket operations. You must enable heartbeats by `HeartbeatRate` property!

`TSocketFamily = (...);`

Specify family of socket.

- SF_Any: Default mode. Socket family is defined by target address for connection. It allows instant access to IPv4 and IPv6 nodes. When you need IPv6 address as destination, then is used IPv6 mode. othervise is used IPv4 mode. However this mode not working properly with preliminary IPv6 supports!
- SF_IP4: Turn this class to pure IPv4 mode. This mode is totally compatible with previous Synapse releases.
- SF_IP6: Turn to only IPv6 mode.

`TSocksType = (...);`

specify possible values of SOCKS modes.

- ST_Socks5:
- ST_Socks4:

`TSSLType = (...);`

Specify requested SSL/TLS version for secure connection.

- LT_all:
- LT_SSLv2:
- LT_SSLv3:
- LT_TLSv1:
- LT_TLSv1_1:
- LT_SSHv2:

`TSynaOptionType = (...);`

Specify type of socket delayed option.

- SOT_Linger:
- SOT_RecvBuff:
- SOT_SendBuff:
- SOT_NonBlock:
- SOT_RecvTimeout:
- SOT_SendTimeout:
- SOT_Reuse:
- SOT_TTL:
- SOT_Broadcast:
- SOT_MulticastTTL:
- SOT_MulticastLoop:

`TSSLClass = class of TCustomSSL;`

### Constants

`SynapseRelease = '38';`

`cLocalhost = '127.0.0.1';`

`cAnyHost = '0.0.0.0';`

`cBroadcast = '255.255.255.255';`

`c6Localhost = '::1';`

`c6AnyHost = '::0';`

`c6Broadcast = 'ffff::1';`

`cAnyPort = '0';`

`CR = #$0d;`

`LF = #$0a;`

`CRLF = CR + LF;`

`c64k = 65536;`

### Variables

`SSLImplementation: TSSLClass = TSSLNone;`

Selected SSL plugin. Default is TSSLNone.

Do not change this value directly!!!

Just add your plugin unit to your project uses instead. Each plugin unit have initialization code what modify this variable.

Generated by PasDoc 0.9.0 on 2012-04-23 21:38:50