Home

Awesome

This is an attempt to write a proper, liberally licensed DHCP server library in Erlang.

It is written as a extendable library, allowing to delegate the relevant calls on discover / request and release without burdening the implementation with the bookkeeping details required by DHCP.

Running it is pretty simple:

The handler

The handler is a module implementing the dhcp_handler behaviour it has to export the functions, a handler is created for every release request (identified by xid and chaddr):

init/0

The initialising function it takes no parameters but has to return a tupel of the form: {ok, state(), server_id()} where the server_id() is the IP address used to identify the server.

discover/3

Discover is called on a discover request, it takes three parameters:

The function has to return either:

request/3

A request in reply to the offer, it is already checked if the requested IP is equal to the offered IP, the parameters passed are in accordance with the discover function:

The funcion has to return:

release/2

Only for informative reasons, the function does not have to return a package, it is passed it's state and the release package and can return either:

Configuration

There are three configuration options that can adjust the behavior of the FSM, namely the timeouts.