CipUX::RPC::Server(3) RPC server class for CipUX

VERSION

version 3.4.0.9

SYNOPSIS


use CipUX::RPC::Server;

DESCRIPTION

Provides the functions for CipUX RPC server.

ABSTRACT

The CipUX rpc server is a generic abstract class, which can be used by other classes or scripts.

SUBROUTINES/METHODS

The following functions are implemented or supported by CipUX::RPC::Server.

BUILD

Constructor, see new.

DEMOLISH

Destructor.

new

Constructor

Syntax:

  my $cipux_rpc = CipUX::RPC::Server->new();

check_authentication

Check weather the login has access or not.

is_ticket_bad

Return 1 if a ticket is OK otherwise 0;

signal_handler

Install signal_handler alias time to die.

Syntax:

 $server->signal_handler({});

answer_requests

Answer Requests.

Syntax:

 $server->answer_requests({
     port=>8000,
     address=>'localhost',
     reuse=>0,
     proto=>'tcp',
     meth_hr=>TODO
     task_hr=>TODO
 });

check_access_to_task

Check the access for login to a task.

check_access_to_rpc_intern

Check the access for login to the rpc_intern section.

check_access_to_cat_module

Check the access for login to a CAT module.

error

Construct an error message.

evaluate_access

Evaluate the access to login or a given user depending on the sub command (subcmd) of rpc_info or rpc_intern for one or more realms. Known realms are: task, cat_module, rpc_intern.

update_task

Check and update tasks entries.

update_cat_module

Check and update CAT modules entries.

log2syslog

Log a given message to syslog.

get_config

Return the value for a given configuration variable.

rpc_list_functions

List the rpc functions.

rpc_start

Start the RPC server.

Syntax:

 $server->rpc_start({});

ping

The function 'ping' is for testing the connection. It requires not to log in and no arguments. It returns 'OK'.

version

Return the CipUX version.

sum

The function 'sum' is for testing the connection. It requires not to log in and 2 arguments. It returns the sum of the arguments as a hash reference with a single line.

login

Perform a login.

logout

Perform a logout.

session

Check the ticket and if it is valid update and return a new ticket.

ttl

Return the Time To Live. Default 900 seconds.

rpc_task

Execute a CipUX::Task.

rpc_info

Execute a rpc_info sub-command.

task_access

Needs parameter: TASK

task_access_survey

Needs parameter: TASK [TASK] ...

cat_module_access

Needs parameter: MODULE

cat_module_access_survey

Needs parameter: MODULE [MODULE] ...

rpc_intern_access

Needs parameter: COMMAND

rpc_intern_access_survey

Needs parameter: COMMAND [COMMAND] ...

rpc_intern

Execute a rpc_intern sub-command.

ttl

Prints current TTL in seconds

cat_module_cache_size

Prints current cat module cache size

rpc_intern_cache_size

Prints current rpc intern cache size

task_cache_size

Prints current task_cache_size of cache

user_task_access

Needs parameter: USER TASK

user_task_access_survey

Needs parameter: $USER TASK [TASK] ...

user_cat_module_access

Needs parameter: USER MODULE

user_cat_module_access_survey

Needs parameter: USER MODULE [MODULE] ...

user_rpc_intern_access

Needs parameter: USER COMMAND

user_rpc_intern_access_survey

Needs parameter: USER COMMAND [COMMAND] ...

flush_cache

Flush RPC server RBAC cache

Public XML-RPC functions.

All the following CipUX::Task methods are public. Public means that they could be executed remotely. Public means not that everybody can do this remotely.

There are two kinds of public functions:

(1) Functions without authorization

 - login
 - ping
 - sum

(2) Every other function is available only after using 'login' function, with a uid as first parameter and a valid ticket as second parameter.

Examples (pseudo code):

 - (reference to user list) = cipux_task_list_users( uid, ticket );
 - (true|false) = logout( uid, ticket );
 - (new ticket|false) = session( uid, ticket );

If the uid do not match, or the uid has not the authorization to use the function, or the group of the uid has not the authorization to use the function, or the ticket is expired, or the ticket is not valid the request will not be fulfilled.

In other words: if the uid match and has the right and the role also has the right and the ticket is valid and is not expired, the request will be executed.

To see real examples have a look at CipUX::RPC::Client client.

DIAGNOSTICS

TODO

CONFIGURATION AND ENVIRONMENT

Need no environment variables. But do need a configuration file. For example cipux-rpc.ini

DEPENDENCIES

 Authen::Simple::PAM
 Authen::Simple::Password
 Carp
 CipUX::Task
 CipUX::RBAC::Simple
 Class::Std
 Data::Dumper
 English
 Frontier::Daemon
 Frontier::RPC2
 List::MoreUtils
 Log::Log4perl
 Log::Dispatch
 POSIX
 Readonly
 Ticket::Simple

INCOMPATIBILITIES

Not known.

BUGS AND LIMITATIONS

Not known.

AUTHOR

Christian Kuelker <[email protected]>

LICENSE AND COPYRIGHT

Copyright (C) 2007 - 2010 by Christian Kuelker

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA