Module stun

Incomplete STUN-server.

Introduced in: 9 Feb 2006 by Fredrik Thulin <ft@it.su.se>

Authors: Fredrik Thulin (ft@it.su.se).

Description

Incomplete STUN-server. Based on draft-ietf-behave-rfc3489bis-03 but only a subset currently implemented. You have been warned!

This module is written to be totally side-effects free, in order to be totally testable. This requires us to pass quite a few arguments about the world to the process(...) function though, such as our own sockets IP address, the alternate sockets IP address and so on.

Data Types

stun_error()

stun_error() = {stun_error, stun_error_code(), stun_error_attr()}

STUN parsing/handling error. Thrown by various functions on error. Never seen outside this module though.

stun_error_attr()

stun_error_attr() = [binary()]

Encoded STUN attributes.

stun_error_code()

stun_error_code() = integer() | {integer(), string()}

STUN error code (gets default reason phrase) or code and reason phrase.

Function Index

process/2 Process a STUN packet received from the network.
process_stream/2 Process a binary stream of data received from the network.

Function Details

process/2

process(Packet, Env) -> StunResult | ignore | {error, not_stun}

Process a STUN packet received from the network. Relies on the caller to send the actual response, if one is returned from this function (in order to be fully testable).

process_stream/2

process_stream(Stream, Env) -> {ok, StunResult, StreamRest} | {need_more_data, Num} | {error, not_stun} | ignore

Process a binary stream of data received from the network. Relies on the caller to send the actual response, if one is returned from this function (in order to be fully testable).


Generated by EDoc, Oct 17 2007, 16:48:21.