OONF HTTP Plugin

From OLSR.org Wiki
Jump to: navigation, search

The OONF HTTP Plugin is a lightweight http server that can handle both HTTP GET and HTTP POST requests.

It uses the OONF Stream Socket Plugin to provide both IPv4 and IPv6 access to the webpages.

Each content provider can either setup a buffer with the content of the HTTP response or provide a callback to generate the response dynamically.

The plugin contains a bridge to the telnet server and can also (optionally) work as a file-server for a directory on the computer.

Configuration

The plugin defines the http configuration section with three settings.

Key Default Type Limits
acl default_accept ACL ipv4, ipv6
bindto 127.0.0.1, ::1, default_reject ACL ipv4, ipv6
port 1980 integer 1-65535, no fractions
webserver string

acl defines the IP addresses that are allowed to use the HTTP socket.

bindto defines the IP addresses which the HTTP socket will be bound to.

port defines the TCP port number of the HTTP socket. The value must be between 1 and 65535 without fractional digits.

webserver defines the directory on the computer that will be accessible through the http plugin.

Telnet Bridge

The plugin contains a bridge to the OONF Telnet Plugin to make it easy to query telnet commands over http.

The bridge is accessible through the /telnet/ subdirectory. The telnet command (including parameters) just have to be added to the URL as it would be a file- or pathname. Multiple telnet commands can be chained with an additional path separator.

wget "http://localhost:1980/telnet/netjsoninfo graph"
wget "http://localhost:1980/telnet/nhdpinfo link/olsrv2info node"

Webserver

The plugin can also act as a normal webserver, delivering the content of a directory (including subdirectories) over http.

The webserver is accessible through the /www/ subdirectory. All files delivered will be delivered as content type "text/html" at the moment.

Please notice that OONF is a single-threaded framework that is not meant to replace any kind of real webserver, it is just a lightweight solution to deliver small scripts to a webserver.