    AXIGEN Command Line Interface
    version <v1.0.0>
    
    The Command Line Interface (in short CLI) is, as its name suggests an
    interface for configuring AXIGEN. In order to do that, a socket will listen
    on a specified address for connections, thus the commands can be issued
    using common tools such as telnet, netcut, etc.
    
    Description
    
    CLI is for AXIGEN another service and more accuratly a TCP service just
    like SMTP, IMAP, POP3, etc. The CLI service can be configured like the 
    others either from the configuration files or the remote configuration
    tools like CLI and Webadmin. It has common properties such as maxErrors,
    logLevel, etc. and also a list of listeners for configuring incoming
    connections.
    
    The connection to the service must be authenticated using an username
    (<v0.10.0> for the moment admin) and a password. The password, when first
    starting AXIGEN must be set at command line and may be changed later from
    CLI.
    
    CLI is structured in contexts, each of them having a specific set of
    commands, and also a common set of commands. In each contexts, there exist
    commands to switch to the previous and next context and a HELP command to
    view the available commands there. When connected, the login context is
    actovated and an usernbame and password must be provided; after activation,
    the initial context becomes active. The initial context is the only one not
    having a name in the command prompt.
    
    The commands are to be entered in an caseless way, that means that you can
    enter HELP, help, Help, HeLP, it will still mean HELP. Also, when values 
    must be given to parameters of certain commands, these values can be
    entered in 3 ways: as is, quoted and double quoted. This is usefull when
    entering regular expressions and spaces. Thus several restrictions apply:
    when entering a string as is, the spaces, '"' and ''' characters must be
    escaped with '\' and also, non-printable characters are not allowd. When
    using quoted or double quoted notation, only the quote and double quote
    must be escaped and the NPC are allowed.
    
    The notion of child contexts can be defined when looking in the
    configuration file where some objects are childs of others. In general,
    a context that has COMMIT for saving changes is considered a parent and
    one that has DONE for saving changes can be considered a child.
    Contexts are with a few exceptions associated with configuration objects
    that appear in the config file.
    
    The notion of key parameter-value pair is related to the primary key
    concep. It uniquely identifyes an object in a list of objects. The key
    value cannot be changed if the context was created with an ADD command.
    
    The configuration contexts related to config objects (like server,
    all services, etc.) update only when entering and leaveing and when one of
    the reset commands is issued. Thus if anything is changed form another
    ersion of CLI or from WEBADMIN, these will be present only when leaving and
    entering the context and after reset will be issued.
    When leaving the context with commit, if the commit fails, an update of the
    context will NOT be made because there may be modifications which would be
    lost. But because of this, invalid setting may appear to exist in config,
    so if a reset of the configuration for that context is desired, a cancel
    or a reset should be issued.
    
    Any changes made to a TCP service like: CLI, WEBMAIL, WEBADMIN, etc. will
    affect only new connections to that service and not the active ones.
    
    Common commands
    
    The commands common to a subset of contexts are: HELP, QUIT, EXIT, CANCEL, 
    BACK, COMMIT|DONE, SHOW, LIST, SET, ADD, REMOVE, UPDATE, CONFIG, RESET.
    Some of the commands described above, apply only to a set of contexts,
    others apply to all contexts, and others have different flavours according
    to certain contexts. Other command exist in CLI but these are the common
    and most important ones.
    
    HELP   - the help command is present in all contexts, including Login and 
             is used for displaying a list of available commands in that
             context
    QUIT   - this command exits CLI. It is available from all contexts
    EXIT   - the same as QUIT
    CANCEL - this command, cancels any changes and switches back to the 
             previous context
    BACK   - is used in the contexts that do not make modifications in config
             The action is the same as CANCEL.
    COMMIT - this command will save the changes and also will write these
             changes to the server configuration. This also includes the
             changes done in child contexts and saved with DONE. A switch
             back to the previous context is also done.
    DONE   - this command saves the changes for a child context and switches
             back to the prevoius context but does not write anything to the
             server's configuration.
    SHOW   - the SHOW command has two favours, one without parameters, and in
             this case, the value parameters (that means not the childs or
             child lists) are shown, and one with parameters, in this case, the
             value parameters of a child from a child list are shown.
    LIST   - this command lists the members of a given child list in the form
             of a table. If the list has a separate context, some parameters
             are put in the table, otherwise all value parameters are present.
    SET    - the SET command, sets a value for a specified value parameter of
             the given object associated with the context (if there is one). 
             To the set command, one or several parameter-value pair can be
             given.
    ADD    - This command has several flavours. The simplest one, if for
             adding values to a value list. In this case the parameter is the
             name of the value list and a value (for ex ADD nameserver ip)
             Another for is to add objects to list of objects. This has three
             forms: one that takes the list and the key parameter-value pair of
             the object and the changes context; another that is the same
             except it takes additional requires parameter-value pairs; and one
             that takes the key param-value pair and other optional pairs and 
             doesn't change context but directly adds the object to the list.
    UPDATE - This command changes an object from a list of objects. It is
             similar to add, except it does not apply to value lists.
    REMOVE - This usualy takes as parameters the list name, and key param-value
             pair for object lists, and list name and value for value lists and
             as the name suggests, removes an object from a list. It does not
             change the context.
    CONFIG - The config command changes the context for configuring a child
             object. A child object is different form a list by the fact that
             it is a single object and it exists permanently. A list may have
             one, none or several objects.
    RESET  - The RESET command will update the context to the active one in the
    		 server. This also means that any changes made to that part of the
    		 context will be lost. The reset command, depending on the
    		 parameter, will reset the value atributes, or a list of objects or
    		 values.
             
    The action of each command may differ in specific contexts that represent
    an exception to the general behaviour. As said before, some contexts have
    additional commands that have an exceptional character. Thus a detailed
    overview of each context is presented next.
    
    Contexts
    
    Login Context
    prompt: <login>
    parent: none
    
    The login context is used only for authentication and has the following
    commands: HELP, USER, PASS, EXIT/QUIT. The USER and PASS usage is
        USER <username> 
        PASS <passwd>
    This context has the maxAuthErrors config parameter related such that when
    it is exceded, the connection is closed.
    
    Initial Context
    prompt: <#>
    parent: none
    
    The initial context is the starting point of configuring the server. Here,
    several actions can be started: domains configuration (including accounts
    and lists), server configuration and also reports can be viewed. Other
    actions present are: setting the password for CLI authentication, saving
    the configuration, viewing the entire configuration, starting/stoping a
    service, etc.
    
    The START/STOP service command will start/stop a service immediatly without
    the need for COMMIT command.
    
    The command SAVE CONFIG, saves the configuration. If no parameter is given,
    it will be saved in the default location. If a path parameter is given, it
    will be saved in that location but for security reasons, a suffix will be
    added to the file.
    
    This context does not have commit/done or cancel commands because it is the
    first context and does not have show without parameters because it is not
    related to any config object.
    
    The command ENTER REPORTING is for entering the Reporting context where
    reports can be viewed. The LIST DOMAINDATA command is here because a domain
    database location must be provided when adding a domain.
    
    The ADD DOMAIN command, takes 2 parameter-value pairs, one for setting the
    domain name and one for specifying in which domain database location sould
    the domain be created.
    
    The initial context has a command for trying to force all mail in the queue
    to be processed and/or sent, regardless of their rescheduled time. This
    command is FORCE QUEUE.
    
    Reporting Context
    prompt: <reprting#>
    parent: Initial
    
    This context is for viewing various reports for the server. It has the
    Cancel command for switching back to the Initial context but does not
    have COMMIT/DONE because it is a read-only context.
    
    The command available are: VIEW CONTORS with a parameter of all, others and
    domain. If domain is the paramter, a value must be specified which is a
    list of domains separated by '+'. The list must be in double quoted format.
    Another command is VIEW QUEUE which presents an instant of the mail queue
    with several information on the mails that are in processing stage.
    
    The VIEW CONTORS domain command, makes a sum of all contors of the domains
    given as parameters. If a domain does not exist, it will not be counted in
    the sum. This means, to an extent, that  if the list is made of one
    or more domains that do not exist, the list will show for all contors,
    a value of 0.
    
    Server Context
    prompt: <server#>
    parent: Initial
    
    The server context is where the server configuration is started. It has
    commands for entering the configuration context of every service,for
    configuring filters and domain database locations ,etc.
    
    It has the common commands CANCEL, COMMIT, HELP, QUIT/EXIT, and SHOW. The
    SHOW command will show the value parameters of the server like services,
    primaryDomain, etc. In the case of the services param, it will show the
    services started but it is updated only when the server context is entered
    or left with commit or cancel. So if a service was stopped while in the
    server context, it will not show up stopped.
    
    The SET command, will set the one or more param-value pairs that are given
    as parameters. In the case of the services value paramter, it will stop or
    start the services only when COMMIT is issued. If cli is removed from the
    list of service, it will be stopped at COMMIT but it will show up as
    started when SHOW is issued.
    
    The ADD FILTER command, takes 3 parameter-value pairs because the
    respective values are required.
    
    The commands for configuring the services are CONFIG <SERVICE_NAME> and
    the context will be switched to that of every service.
    
    From this context domains database locations can be managed. Thus there are
    functions to LIST, ADD, REMOVE, CREATE and DESTROY a domain database
    location. Before a location can be added, it must be created otherwise the
    commit command will fail and no location will be added. The CREATE command,
    aside from the path, takes an additional parameter: an unique id that has
    to be form 0 to 255. There can be no locations added to the server's list
    with the same id.
    
    Filter Context
    prompt: <server-filter#>
    parent: Server
    
    The commands available for this context, are the common ones: DONE, CANCEL,
    HELP, QUIT/EXIT, SHOW and SET. The SHOW command does not take any
    parameters and shows the value parameters of the filter.
    
    Log Context
    prompt: <server-log#>
    parent: Server
    
    This context is used for configuring the log service. It has common
    paramters DONE, CANCEL, HELP, QUIT/EXIT, SHOW. It does not have the SET
    command because the only value parameter is path and cannot be changed.
    
    The Log service has three child object lists: Actions, Rules and Listeners.
    Every list has a separate context and can be configured using the usual
    commands: ADD, REMOVE, UPDATE, SHOW, LIST. The ADD and UPDATE LISTENER
    commands, will enter the Listener context which is different from the 
    listener common to all TCP services.
    
    In case of the list of rules, the ADD command will take two parameters,
    the rule's priority and the rule's action.
    
    Log Rule Context
    prompt: <server-log-rule#>
    parent: Log
    
    The commands available for this context, are the common ones: DONE, CANCEL,
    HELP, QUIT/EXIT, SHOW and SET. The SHOW command does not take any
    parameters and shows the value parameters of the rule.

    Log Action Context
    prompt: <server-log-action#>
    parent: Log
    
    The commands available for this context, are the common ones: DONE, CANCEL,
    HELP, QUIT/EXIT, SHOW and SET. The SHOW command does not take any
    parameters and shows the value parameters of the action.

    Log Listener Context
    prompt: <server-log-listener#>
    parent: Log
    
    The commands available for this context, are the common ones: DONE, CANCEL,
    HELP, QUIT/EXIT, SHOW and SET. In addition, there exist commands for
    configuring the two lists of Allow and Deny rules.
    
    The commands for configuring allow and deny rules, do not change the
    context, thus ADD and UPDATE commands take, beside the ipSet argument,
    additional optional parameter-value pairs.

    Cli Context
    prompt: <server-cli#>
    parent: Server
    
    The CLI context is associated with CLI service which is a TCP service. Thus
    it has a list of listeners that can be configured using the ADD, REMOVE, 
    UPDATE, SHOW, LIST commands. It also has the common commands including
    commands for viewing and setting the value parameters.
    
    The modifications made in this context will affect only new connections
    made to this service, as is the case with all TCP services.

