---
name: "CipUX::RPC::Server"
section: "3pm"
platform: "linux"
package: "libcipux-rpc-perl"
version: "3.4.0.9-3.1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/CipUX::RPC::Server"
---

# CipUX::RPC::Server(3pm)

RPC server class for CipUX

## NAME

CipUX::RPC::Server - 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.

## SEE ALSO

See the CipUX webpage and the manual at \<http://www.cipux.org\>

See the mailing list \<http://sympa.cipworx.org/wws/info/cipux-devel\>

## AUTHOR

Christian Kuelker  \<christian.kuelker@cipworx.org\>

## 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
