summaryrefslogtreecommitdiff
path: root/accel-pppd/cli/cli.c
AgeCommit message (Collapse)Author
2014-11-22remove trailing whitespacesDmitry Kozlov
2013-02-13cli: Notify user of failed commandsGuillaume Nault
Handle CLI_CMD_FAILED like other command errors (i.e. return 0 to the caller and send a generic error message). This makes the CLI handler to flush its input buffer, so that processing of the next command will be made correctly. This also makes the telnet handler to send its prompt message. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-02-12cli: Skip leading spaces before calling regexp cmdsGuillaume Nault
Call regexp command handler without command line's leading spaces. This makes leading spaces handling consistent between the exec and help command handlers (leading spaces are already skipped before calling help handlers). This also gives the possibility to register an anchored regexp command without having to manage the leading spaces in that regexp. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-02-12cli: Handle arguments to the "help" commandGuillaume Nault
When arguments are supplied to the "help" command, only display help messages corresponding to the command these arguments refer to (e.g. "help pppoe" will only show help messages for commands starting with "pppoe"). Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-02-12cli: Modify regexp command handler registrationGuillaume Nault
Pass a full string, instead of an array of words, to the "help" callback of regexp command handlers. Also register these command handlers using a regexp to apply on "help" commands, just like for exec commands. The "help" callback will then be called only if the command matches the "help" regexp. As a side effect, the "help" word and its following spaces are skipped before calling the "help" callback for both simple and regexp commands. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-02-12cli: Improve word splitting functionsGuillaume Nault
* skip_word(): ensure the for() loop won't pass over a '\0' character * split(): ensure the for() loop won't try to fill buf[MAX_CMD_ITEMS] * split(): skip leading spaces. * split(): fix exit value if no item is found (return 0 instead of 1) Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-02-12cli: Pass complete command line to regexp handlersGuillaume Nault
Split regexp and simple command handling from the generic command processing function and handle regexp commands before simple ones. This avoids splitting the original command line before processing regexp command handlers, so that these handlers get the full command line instead of only the first word. The regexp command handlers are now only called when the command matches the regexp (regexp handlers were called unconditionaly before this patch). The rest of the processing properties should remain unchanged. Command processing summary: -If the command starts with the "help" keyword, then all help commands are called, starting with regexp help commands. -Otherwise, regexp command handlers whose regexp matches the command line are called. Then, simple command handlers whose header matches the command line are called. Any command handler that returns a value different from CLI_CMD_OK stops the process, thus preventing the following handlers from being called. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-02-12cli: Use dedicated "help" command handlerGuillaume Nault
Process "help" commands in a separated function with no side effect when the command doesn't match. This avoids splitting the input command line if not necessary (regexp command handlers need to receive the entire command line for being useful). Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-02-12cli: Fix regexp command handlingGuillaume Nault
* Call pcre_compile2() with all mandatory arguments and improve error message. * Register regexp commands in regexp_cmd_list instead of simple_cmd_list. * Fix "help" function call. * Interpret regexp command return codes (CLI_CMD_*) in the same way as for simple commands. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-01-24backport 1.7Kozlov Dmitry
* l2tp: Fix allocation checking when adding octets AVP * cli, tcp: Fix non-NULL terminated string reception * Fix va_end() missing calls * chap-secrets: implemented encryption * auth_pap: make messages like other auth modules * cli: check xmit_buf is not null at enter to write function * pppoe: implemented regular expression support * chap-secrets: implemented encryption * ippool: fixed initialization order * optional shaper compiling * ppp: dns/wins code cleanup
2011-12-27snmp: implemneted new node (ACCEL-PPP-MIB::cli.0) which can be used to send ↵Kozlov Dmitry
cli commands
2011-05-30rewrited initialization procedure (fix gcc-4.6 builds)Kozlov Dmitry
2011-01-05rename accel-pptp to accel-pppDmitry Kozlov