Module exmpp_tls

The module exmpp_tls provides functions to handle a TLS session.

Behaviours: gen_server.

Authors: Jean-Sébastien Pédron (js.pedron@meetic-corp.com).

Description

The module exmpp_tls provides functions to handle a TLS session.

Data Types

tls_socket()

abstract datatype: tls_socket()

TLS socket obtained with connect/4 or accept/4.

Function Index

accept/4Start TLS handshake as a server.
close/1Shutdown the TLS session and close the underlying socket.
connect/4Start TLS handshake as a client.
controlling_process/2Change the controlling socket of the underlying socket.
get_auth_methods/0Return the list of supported auth methods.
get_engine_driver/1Return the port driver name associated to the given engine.
get_engine_names/0Return the list of TLS engines.
get_engine_names/1Return the list of TLS engines which support the given auth method.
get_peer_certificate/1Return the peer certificate if he provided one.
get_prefered_engine_name/1Return the name of the prefered TLS engines which support the given auth method.
get_verify_result/1Return verify result.
getopts/2Gets one or more options for a socket.
is_engine_available/1Tell if Engine_Name is available.
peername/1Returns the address and port for the other end of a connection.
quiet_shutdown/1Flag the TLS session as down but do not exchange "close notify".
recv/1Receive data over a TLS-protected connection.
recv/2Receive data over a TLS-protected connection.
recv_data/2Decrypt already received data.
register_engine/3Add a new TLS engine.
register_engine/4Add a new TLS engine.
send/2Send Orig_Packet over a TLS-protected connection.
setopts/2Sets one or more options for a socket.
shutdown/1Shutdown the TLS session.
shutdown/2Shutdown the TLS session.
shutdown/3Shutdown the TLS session.
sockname/1Returns the local address and port number for a socket.

Function Details

accept/4

accept(Socket_Desc, Identity, Peer_Verification, Options) -> TLS_Socket

Start TLS handshake as a server.

close/1

close(Tls_socket::TLS_Socket) -> ok | {error, Reason}

Shutdown the TLS session and close the underlying socket.

connect/4

connect(Socket_Desc, Identity, Peer_Verification, Options) -> TLS_Socket

Start TLS handshake as a client.

controlling_process/2

controlling_process(Tls_socket::TLS_Socket, Pid) -> ok | {error, Reason}

Change the controlling socket of the underlying socket.

get_auth_methods/0

get_auth_methods() -> [Auth_Method]

Return the list of supported auth methods.

get_engine_driver/1

get_engine_driver(Engine_Name) -> Driver_Name

Return the port driver name associated to the given engine.

get_engine_names/0

get_engine_names() -> [Engine_Name]

Return the list of TLS engines.

get_engine_names/1

get_engine_names(Auth_Method) -> [Engine_Name]

Return the list of TLS engines which support the given auth method.

The list is sorted from the most to the least prefered engine.

get_peer_certificate/1

get_peer_certificate(Tls_socket::TLS_Socket) -> Certificate | undefined

Return the peer certificate if he provided one.

get_prefered_engine_name/1

get_prefered_engine_name(Auth_Method) -> [Engine_Name]

Return the name of the prefered TLS engines which support the given auth method.

get_verify_result/1

get_verify_result(Tls_socket::TLS_Socket) -> Result

Return verify result.

getopts/2

getopts(Tls_socket::TLS_Socket, Options) -> {ok, Option_Values} | {error, posix()}

Gets one or more options for a socket.

is_engine_available/1

is_engine_available(Engine_Name) -> bool()

Tell if Engine_Name is available.

peername/1

peername(Tls_socket::TLS_Socket) -> {ok, {Address, Port}} | {error, posix()}

Returns the address and port for the other end of a connection.

quiet_shutdown/1

quiet_shutdown(Tls_socket::TLS_Socket) -> Socket_Desc

Flag the TLS session as down but do not exchange "close notify".

The underlying socket is NOT closed.

recv/1

recv(TLS_Socket) -> {ok, Orig_Packet} | {error, Reason}

Receive data over a TLS-protected connection.

recv/2

recv(Tls_socket::TLS_Socket, Timeout) -> {ok, Orig_Packet} | {error, Reason}

Receive data over a TLS-protected connection.

recv_data/2

recv_data(Tls_socket::TLS_Socket, Packet) -> {ok, Orig_Packet} | {error, Reason}

Decrypt already received data.

This function won't read anything from the underlying socket but WILL write to it.

register_engine/3

register_engine(Name, Driver, Auth_Methods) -> ok

Add a new TLS engine.

register_engine/4

register_engine(Name, Driver_Path, Driver, Auth_Methods) -> ok

Add a new TLS engine.

send/2

send(Tls_socket::TLS_Socket, Packet::Orig_Packet) -> ok | {error, Reason}

Send Orig_Packet over a TLS-protected connection.

setopts/2

setopts(Tls_socket::TLS_Socket, Options) -> ok | {error, posix()}

Sets one or more options for a socket.

shutdown/1

shutdown(TLS_Socket) -> Socket_Desc

Shutdown the TLS session.

Only a unidirectional shutdown is made.

The underlying socket is NOT closed.

shutdown/2

shutdown(TLS_Socket, Mode) -> Socket_Desc

Shutdown the TLS session.

For bidirectional shutdown, there's no timeout for the peer's "close notify".

The underlying socket is NOT closed.

shutdown/3

shutdown(Tls_socket::TLS_Socket, Mode, Timeout) -> Socket_Desc

Shutdown the TLS session.

For bidirectional shutdown, the peer must send his "close notify" within Timeout milliseconds.

If the peer doesn't send its "close notify" or if the underlying socket is closed, the function still succeeds.

The underlying socket is NOT closed by this function.

sockname/1

sockname(Tls_socket::TLS_Socket) -> {ok, {Address, Port}} | {error, posix()}

Returns the local address and port number for a socket.


Generated by EDoc, Jan 21 2011, 01:43:52.