This is automatically generated documentation. Edit after the "COMMENTS" heading; changes to the main body will be lost.
ControlSocket -- Click element; opens control sockets for other programs
ControlSocket("TCP", PORTNUMBER [, keywords READONLY, PROXY, VERBOSE, LOCALHOST, RETRIES, RETRY_WARNINGS])
ControlSocket("UNIX", FILENAME [, keywords])
Ports: none
Drivers: userlevel
Package: userlevel (core)
Opens a control socket that allows other user-level programs to call read or write handlers on the router. Depending on its configuration string, ControlSocket will listen on TCP port PORTNUMBER, or on a UNIX-domain socket named FILENAME. With the PROXY keyword argument, you can make ControlSocket speak to a kernel driver; see below. The "server" (that is, the ControlSocket element) speaks a relatively simple line-based protocol. Commands sent to the server are single lines of text; they consist of words separated by spaces. The server responds to every command with at least one message line followed optionally by some data. Message lines start with a three-digit response code, as in FTP. When multiple message lines are sent in response to a single command, all but the last begin with the response code and a hyphen (as in "200-Hello!"); the last line begins with the response code and a space (as in "200 Hello!"). The server will accept lines terminated by CR, LF, or CRLF. Its response lines are always terminated by CRLF. When a connection is opened, the server responds by stating its protocol version number with a line like "Click::ControlSocket/1.3". The current version number is 1.3. Changes in minor version number will only add commands and functionality to this specification, not change existing functionality. ControlSocket supports hot-swapping, meaning you can change configurations without interrupting existing clients. The hot-swap will succeed only if the old ControlSocket and the new ControlSocket have the same element name, and the same socket type and port/filename parameters. Additionally, the new ControlSocket must have RETRIES set to 1 or more, since the old ControlSocket has already bound the relevant socket. Keyword arguments are:
The server currently supports the following six commands. Many of the commands take a handler argument. These arguments name handlers, and take one of three forms: elementname.handlername names a particular element's handler; elementnumber.handlername also names an element handler, but the element is identified by index, starting from 1; and handlername names a global handler. (There are seven global read handlers, named version, list, classes, config, flatconfig, packages, and requirements. See click.o(8) for more information.)
element#hexnumber. The hexnumber is the LLRPC number, from <click/llrpc.h>, in hexadecimal network format. Translate CLICK_LLRPC constants to network format by calling CLICK_LLRPC_HTON(CLICK_LLRPC_...). If n is given, then the n bytes immediately following (the CRLF that terminates) the LLRPC line are passed in as an argument. The results are returned after a "DATA nn" line, as in READ. ControlSocket will not call an LLRPC unless it can determine (from the command number) how much data the LLRPC expects and returns. (Only "flat" LLRPCs may be called; they are declared using the _CLICK_IOC_[RWS]F macros.)
ControlSocket(unix, /tmp/clicksocket);
ChatterSocket, KernelHandlerProxy
Generated by 'click-elem2man' from '../elements/userlevel/controlsocket.hh' on 7/Mar/2009.