Libraries
TLS/SSL Source Code
 previous   up   next 

Types
tlsFile
File implementation type for TLS.

tlsFile

const type: tlsFile

File implementation type for TLS. This type supports communication TLS. A tlsFile is not seekable. The functions length, seek and tell raise FILE_ERROR.


Function Summary
file
openTlsSocket (inout file: sock, in string: hostName)
Return a connected TLS socket file based on the given sock.
file
openTlsSocket (inout file: sock)
Return a connected TLS socket file based on the given sock.
file
openTlsSocket (in string: hostName, in integer: portNumber)
Return a connected TLS socket file at a port at hostName.
file
openServerTls (inout file: sock, in certAndKey: certificateAndKey)
Return a connected TLS socket file based on the given sock.
void
close (inout tlsFile: aFile)
Close a tlsFile. This closes also the socket below.
boolean
eof (in tlsFile: inFile)
Determine the end-of-file indicator.
void
write (inout tlsFile: outFile, in string: stri)
Write a string to a tlsFile.
void
writeln (inout tlsFile: outFile, in string: stri)
Write a string followed by end-of-line to outSocket.
string
gets (inout tlsFile: inFile, in integer: maxLength)
Read a string with a maximum length from a tlsFile.
string
getln (inout tlsFile: inFile)
Read a line from a tlsFile.

Function Detail

openTlsSocket

const func file: openTlsSocket (inout file: sock, in string: hostName)

Return a connected TLS socket file based on the given sock.

Parameters:
sock - A connected internet socket file (client side).
hostName - The server host name.
Returns:
an open TLS socket file, or STD_NULL if it could not be opened.
Raises:
MEMORY_ERROR - An out of memory situation occurred.

openTlsSocket

const func file: openTlsSocket (inout file: sock)

Return a connected TLS socket file based on the given sock.

Parameters:
sock - A connected internet socket file (client side).
Returns:
an open TLS socket file, or STD_NULL if it could not be opened.
Raises:
MEMORY_ERROR - An out of memory situation occurred.

openTlsSocket

const func file: openTlsSocket (in string: hostName, in integer: portNumber)

Return a connected TLS socket file at a port at hostName. Here hostName is either a host name (e.g.: "www.example.org"), or an IPv4 address in standard dot notation (e.g.: "192.0.2.235"). Operating systems supporting IPv6 may also accept an IPv6 address in colon notation.

Returns:
an open TLS socket file, or STD_NULL if it could not be opened.
Raises:
MEMORY_ERROR - An out of memory situation occurred.

openServerTls

const func file: openServerTls (inout file: sock, in certAndKey: certificateAndKey)

Return a connected TLS socket file based on the given sock.

Parameters:
sock - A connected internet socket file (server side).
certificateAndKey - Server certificate and corresponding private key.
Returns:
an open TLS socket file, or STD_NULL if it could not be opened.
Raises:
MEMORY_ERROR - An out of memory situation occurred.

close

const proc: close (inout tlsFile: aFile)

Close a tlsFile. This closes also the socket below.

Raises:
FILE_ERROR - A system function returns an error.

eof

const func boolean: eof (in tlsFile: inFile)

Determine the end-of-file indicator. The end-of-file indicator is set if at least one request to read from the socket failed. The socket functions getc, gets, getln and getwd indicate the end-of-file situation by setting bufferChar to EOF.

Returns:
TRUE if the end-of-file indicator is set, FALSE otherwise.

write

const proc: write (inout tlsFile: outFile, in string: stri)

Write a string to a tlsFile.

Raises:
FILE_ERROR - A system function returns an error.
RANGE_ERROR - The string contains a character that does not fit into a byte.

writeln

const proc: writeln (inout tlsFile: outFile, in string: stri)

Write a string followed by end-of-line to outSocket. This function assures that string and '\n' are sent together.


gets

const func string: gets (inout tlsFile: inFile, in integer: maxLength)

Read a string with a maximum length from a tlsFile.

Returns:
the string read.
Raises:
RANGE_ERROR - The parameter maxLength is negative.
MEMORY_ERROR - Not enough memory to represent the result.

getln

const func string: getln (inout tlsFile: inFile)

Read a line from a tlsFile. The function accepts lines ending with '\n', "\r\n" or EOF. The line ending characters are not copied into the string. That means that the '\r' of a "\r\n" sequence is silently removed. When the function is left inFile.bufferChar contains '\n' or EOF.

Returns:
the line read.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.


 previous   up   next