TABLE OF CONTENTS


libram-rpc/libram_hashdirection [ Structures ]

[ Top ] [ libram-rpc ] [ Structures ]

NAME

libram_hashdirection - direction for building hashes

DESCRIPTION

The libram_hashdirection enumeration defines the direction in which libramrpcserver_hashid should perform the hash.

SOURCE

enum libram_hashdirection {
        hash,
        revert,
};

ATTRIBUTES

SEE ALSO

libramrpcserver_hashid(3), libramrpcserver_reply(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_addseq [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_addseq - add sequence number counter for id

SYNOPSIS

long libramrpcserver_addseq(long id)

DESCRIPTION

libramrpcserver_addseq initializes the sequence number for the connection, It checks if there is already a sequence number for the connection, and reuses this connection number. Else a new node is allocated and initilized to 0.

ATTRIBUTES

RETURNS * -1: failed to allocate node structuer * else: sequence number initialized

SEE ALSO

libramrpcserver_nextseq(3), libramrpcserver_rmseq(3), libramrpcserver_seqnode(3), libram(3)


libram-rpc/libramrpcserver_config [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_config - return configuration information about libram-rpcserver

SYNOPSIS

char *libramrpcserver_config(enum libramrpcserver_config_detail detail)

DESCRIPTION

libramrpcserver_config() returns information about the configuration of libram-rpcserver. The argument defines what information is returned.

ARGUMENTS

RETURN

SEE ALSO

libramrpcserver_config_detail(3), libramrpcserver_printconfig(3), libram-rpcserver(3)


libram-rpc/libramrpcserver_connect [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_connect - handle new client connect

SYNOPSIS

void libramrpcserver_connect(int fd)

DESCRIPTION

libramrpcserver_connect(3) is called when a new client connects to libram-rpcserver(3). It calls the c_connect callback from the libramrpcserver_callbacks(3) structure.

ATTRIBUTES

SEE ALSO

libramrpcserver_disconnect(3), libramrpcserver_fdset(3), libramrpcserver_callbacks(3) libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_copy_reply [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_copy_reply - copies reply structure

SYNOPSIS

static reply *libramrpcserver_copy_reply(reply *result)

DESCRIPTION

libramrpcserver_copy_reply(3) allocates a private copy of a non NULL reply result from a libramrpcserver_callbacks(3) if the reply has to be put on the list of open requests, see libramrpcserver_replynode(3).

libramrpcserver_free_reply(3) frees the memory allocated by libramrpcserver_copy_reply(3).

ATTRIBUTES

RETURN

SEE ALSO

libramrpcserver_free_reply(3), libramrpcserver_replynode(3), libramrpcserver_replylist_add(3), libramrpcserver_replylist_free(3), libramrpcserver_reply(3), libramrpcserver_callbacks(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_disconnect [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_disconnect - handle client disconnect

SYNOPSIS

void libramrpcserver_disconnect(int fd)

DESCRIPTION

libramrpcserver_disconnect(3) is called when a client disconnects to libram-rpcserver(3). It removes all entries on the list of open requests for this client, see libramrpcserver_replynode(3). It also removes the squence number for the ids in this list.

It also calls the c_disconnect(3) callback of the libramrpcserver_callbacks(3) structure.

ATTRIBUTES

*fd: file descriptor of new client

SEE ALSO

libramrpcserver_connect(3), libramrpcserver_fdset(3), libramrpcserver_callbacks(3), libramrpcserver_replynode(3), libramrpcserver_rmseq(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_exit [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_exit - finalize libramrpcserver

SYNOPSIS

int libramrpcserver_exit()

DESCRIPTION

libramrpcserver_exit closes the libram-rpcserver library.

RETURN

SEE ALSO

libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_fdset [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_fdset - get filedescriptors used by libramrpcserver

SYNOPSIS

int libramrpcserver_fdset(fd_set *fds)

DESCRIPTION

libramrpcserver_fdset is used to get the file descriptors used internally in libram-rpcserver. The file descriptors are saved in fds. libramrpcserver_fdset(3) returns the number of the highest filedescriptor set.

libramrpcserver_fdset(3) also monitors if a client connects or disconnects, ie. if threre is a new file descriptor or a file descriptor vanishes. and call libramrpcserver_connect(3) or libramrpcserver_disconnect(3).

ARGUMENTS

RETURN

highest file descriptor set in fds.

NOTES

Contrary to libram_fdset(3), the file descriptor set fds is cleared.

SEE ALSO

libram-rpcserver(3), libramrpcserver_process(3), libramrpcserver_loop(3), libramrpcserver_stop(3), libramrpcserver_connect(3), libramrpcserver_disconnect(3), libram(3)


libram-rpc/libramrpcserver_free_reply [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_free_reply - free reply structure

SYNOPSIS

static void libramrpcserver_free_reply(reply *result)

DESCRIPTION

libramrpcserver_free_reply(3) frees the memory allocated by libramrpcserver_copy_reply(3).

ATTRIBUTES

SEE ALSO

libramrpcserver_copy_reply(3), libramrpcserver_replylist_add(3), libramrpcserver_replylist_free(3), libramrpcserver_reply(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_hashid [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_hashid - build or revert hash

SYNOPSIS

static long libramrpcserver_hashid(long id, int fd,
                                enum libram_hashdirection dir)

DESCRIPTION

The libramrpcserver allows more than one client to connect to the libramrpceserver services. libramrpcserver must therefore be prepared to handle more than one connection.

This involves the quality of the connection id. Since some clients may possibly enumerate them from 0 onwards, there will be a soon a collision in the id's used by several clients.

To allow the clients to enumerate the client id's, libramrpcserver adds information about the client to the client id before passing it to the libramrpcserver_callbacks callbacks. The information about the client is the file descriptor of the socket that connects to the client. The libramrpcserver_hashid is the function that adds and removes this additional information.

Since on return the id has to be replaced by the original id, libramrpcserver_hashid has two direction of mode to operation:

     * hash: perform the hash on the id
     * revert: revert the hash and return original id

ATTRIBUTES

RETURNS depending on the dir parameter, returns the hashed or original client id.

NOTES

The current impementation builds a xor with the rotated file descriptor. This might need to be changed in future versions.

SEE ALSO

libram_hashdirection(3), libramrpcserver_reply(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_init [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_init - initalize libramrpcserver

SYNOPSIS

int libramrpcserver_init(char *connect, struct libramrpcserver_callbacks *cb)

DESCRIPTION

libramrpcserver_init initializes libram-rpcserver. It opens the specified port and registers the callback functions.

The connect string consists of key=value pairs, seperated by semicolon. The possible values are:

ARGUMENTS

RETURN

NOTES

connect is parsed with strtok(3). strtok(3) alters the string and adds null characters to the string.

The version v4+v6 may not work on all operating systems.

SEE ALSO

libram-rpcserver(3), libram(3), strtok(3)


libram-rpc/libramrpcserver_loop [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_loop - event loop of libramrpcserver

SYNOPSIS

void libramrpcserver_loop()

DESCRIPTION

libramrpcserver_loop is the event loop of libram-rpcserver. If the client needs to impelement its own event loop, this can be done with a call to libramrpcserver_fdset(3), to get the file descriptors used internally in libram-rpcserver, and to process the data on the file descriptors with libramrpcserver_process(3).

The function libramrpcserver_stop(3) sets a flag that stops the event loop of libramrpcserver_loop(3).

libramrpcserver_loop(3) uses exactly this approch in the following code

SOURCE

        fd_set readfds;
        int mfd;
        extern int libramrpcserver_stopflag;

        libramrpcserver_stopflag = 0;

        while( !libramrpcserver_stopflag ) {
                mfd = libramrpcserver_fdset(&readfds);
                switch (select(mfd+1, &readfds, NULL, NULL,
                        (struct timeval *) 0)) {
                case -1:
                        if( errno == EINTR ) {
                                continue;
                        }
                        perror("select");
                        return;
                        break;
                case 0:
                        continue;
                default:
                        libramrpcserver_process(&readfds);
                }
        }

SEE ALSO

libram-rpcserver(3), libramrpcserver_fdset(3), libramrpcserver_process(3), libramrpcserver_stop(3), libram(3)


libram-rpc/libramrpcserver_nextseq [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_nextseq - get next sequence number for id

SYNOPSIS

long libramrpcserver_nextseq(long id)

DESCRIPTION

libramrpcserver_nextseq returns the next sequence number for the connection id.

ATTRIBUTES

RETURNS * -1: failed to find sequence number for connection id * else: next sequence number initialized

SEE ALSO

libramrpcserver_addseq(3), libramrpcserver_rmseq(3), libramrpcserver_seqnode(3), libram(3)


libram-rpc/libramrpcserver_process [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_process - process data on libramrpcserver file descriptor

SYNOPSIS

void libramrpcserver_process(fd_set *fds)

DESCRIPTION

libramrpcserver_process processes data that arrives on one of the file descriptors used by libram-rpcserver.

ARGUMENTS

SEE ALSO

libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_process_result [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_process_result - check if reply needs to be queued

SYNOPSIS

static reply *libramrpcserver_process_result(long id, long seq, reply *result,
                SVCXPRT* resprt)

DESCRIPTION

libramrpcserver_process_result(3) checks if the result has to be queued on the list of open results, see libramrpcserver_replynode(3) for a description.

The result must be queued either if result is NULL, i.e. it is not immediate available and is later passed with libramrpcserver_reply(3), or if there is an entry on the list of open requests for the same client, i.e. there was a NULL reply that still is waiting for a result.

ATTRIBUTES

RETURN

SEE ALSO

libramrpcserver_replylist_findbyfd(3), libramrpcserver_replylist_add(3), libramrpcserver_reply(3), libramrpcserver_replynode(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_reply [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_reply - send a delayed reply to client

SYNOPSIS

void libramrpcserver_reply(struct reply *result, long seq)

DESCRIPTION

The callbacks of the libramrpcserver_callbacks structure may return NULL to indicate that the result is not yet available. In this case the result may later be passed with libramrpcserver_reply(3).

libramrpcserver_reply(3) searches for the corresponging entry on the list of open replies (see libramrpcserver_replynode(3)), based on the id and the sequence number. libramrpcserver_reply(3) adds the missing result entry and sends all pending results in sequence until it finds the first entry with NULL reply, i.e. the first entry where there is no result available.

ARGUMENTS

SEE ALSO

libramrpcserver_callbacks(3), libramrpcserver_hashid(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_replylist_add [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_replylist_add - add a node to the list of open replies

SYNOPSIS

static void *libramrpcserver_replylist_add(long id, long seq, reply * result,
                SVCXPRT* resprt)

DESCRIPTION

libramrpcserver_replylist_add(3) adds a libramrpcserver_replynode(3) entry to the list of open requests.

It allocates the node, copies the reply structure if it is non NULL, and adds the node to the end of the list.

libramrpcserver_replylist_free(3) frees the memory allocated by libramrpcserver_replylist_add(3).

ATTRIBUTES

RETURN

SEE ALSO

libramrpcserver_replylist_free(3), libramrpcserver_copy_reply(3), libramrpcserver_replynode(3), libramrpcserver_replylist_findbyfd(3), libramrpcserver_replylist_findbyid(3), libramrpcserver_process_result(3), libram_list_add(3), libram_list(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_replylist_findbyfd [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_replylist_findbyfd - search replylist by fd

SYNOPSIS

static struct libram_list_node **
        libramrpcserver_replylist_findbyfd(int fd) 

DESCRIPTION

libramrpcserver_replylist_findbyfd(3) searches the list of open requests for one entry with client socket descriptor fd.

ATTRIBUTES

RETURN

SEE ALSO

libramrpcserver_replylist_findbyid(3), libramrpcserver_process_result(3), libramrpcserver_reply(3), libramrpcserver_replynode(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_replylist_findbyid [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_replylist_findbyid - search replylist by id and seq

SYNOPSIS

static struct libram_list_node **
        libramrpcserver_replylist_findbyid(long id, long seq)

DESCRIPTION

libramrpcserver_replylist_findbyid(3) searches the list of open replies for one entry with connection identifier id and sequence number seq. If seq is -1, the first reply for id is returned.

ATTRIBUTES

RETURN

SEE ALSO

libramrpcserver_replylist_findbyfd(3), libramrpcserver_process_result(3), libramrpcserver_reply(3), libramrpcserver_replynode(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_replylist_free [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_replylist_free - free a libramrpcserver_replynode

SYNOPSIS

static void libramrpcserver_replylist_free(struct libramrpcserver_replynode *n)

DESCRIPTION

libramrpcserver_replylist_free(3) frees the memory allocated by libramrpcserver_replylist_add(3). If the result component is non NULL, it is freed with libramrpcserver_free_reply(3).

ATTRIBUTES

SEE ALSO

libramrpcserver_replylist_add(3), libramrpcserver_free_reply(3), libramrpcserver_reply(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_replynode [ Structures ]

[ Top ] [ libram-rpc ] [ Structures ]

NAME

libramrpcserver_replynode - structure for list of replies

DESCRIPTION

The libramrpcserver_callbacks functions may either return the analysis result immediate, or return NULL if the analysis result is not avaiable at call time. In the later case, the result is passed with libramrpcserver_reply(3) to libramrpcserver.

The libram clients expect the answers in the order of the the requests. The libramrpcserver must therefore build a list of open requests for each client if the analysis result is not immediate available, i.e. once the callbacks returns NULL.

If later one of the callbacks returns a non NULL result, this result value has also to be put on the list until all preceeding requests have been answered.

The result for those callbacks that returned NULL is later passed to libram using libramrpcserver_reply(3).

The callback functions are called with as sequence number, which is passed back to libram-rpcserver in the libramrpcserver_reply(3) function. Using this sequence number, the replies can be returned in the order of the requests.

The libramrpcserver_replynode(3) structure defines the component that are necessary to build the list of open requests.

SOURCE

struct libramrpcserver_replynode {
        reply *result;
        int fd;
        long id;
        long seq;
        SVCXPRT *resprt;
};

ATTRIBUTES

SEE ALSO

libram_list(3), libramrpcserver_reply(3), libramrpcserver_replylist_add(3), ibramrpcserver_replylist_free(3), libramrpcserver_replylist_findbyid(3), libramrpcserver_replylist_findbyfd(3), libramrpcserver_process_result(3), libramrpcserver_disconnect(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_rmseq [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_rmseq - remove sequence number for id

SYNOPSIS

long libramrpcserver_rmseq(long id)

DESCRIPTION

libramrpcserver_rmseq returns the next sequence number for the connection id and removes the entry for connection id.

ATTRIBUTES

RETURNS * -1: failed to find sequence number for connection id * else: next sequence number initialized

SEE ALSO

libramrpcserver_addseq(3), libramrpcserver_nextseq(3), libramrpcserver_seqnode(3), libram(3)


libram-rpc/libramrpcserver_seqnode [ Structures ]

[ Top ] [ libram-rpc ] [ Structures ]

NAME

libramrpcserver_seqnode - structure for mapping id to seq

DESCRIPTION

The libramrpcserver_callbacks enumerate the requests for each connection id to reply the results in the same order. The libramrpcserver_seqnode defines the structure to save the sequence nubmer for each connection.

SOURCE

struct libramrpcserver_seqnode {
        long seq;
        long id;
};

ATTRIBUTES

SEE ALSO

libram_list(3), libramrpcserver_addseq(3), libramrpcserver_nextseq(3), libramrpcserver_rmseq(3), libramrpcserver_disconnect(3), libram-rpcserver(3), libram(3)


libram-rpc/libramrpcserver_stop [ Functions ]

[ Top ] [ libram-rpc ] [ Functions ]

NAME

libramrpcserver_stop - stop event loop of libramrpcserver

SYNOPSIS

void libramrpcserver_stop()

DESCRIPTION

The function libramrpcserver_stop(3) sets a flag that stops the event loop of libramrpcserver_loop(3). It can either be used in a callback or in a signal handler.

SEE ALSO

libram-rpcserver(3), libramrpcserver_fdset(3), libramrpcserver_process(3), libramserver_loop(3), libram(3)


libram/libramrpcserver_printconfig [ Functions ]

[ Top ] [ libram ] [ Functions ]

NAME

libramrpcserver_printconfig - write configuration information to file

SYNOPSIS

void libramrpcserver_printconfig(char *name, FILE *fh, int what)

DESCRIPTION

libramrpcserver_printconfig() writes the configuration information to a file. The argument what defines what information is written to the file:

      * 0: no output
      * 1: package version
      * 2: package version, name, version and moduledir
      * 3: package version, name, version, moduledir, configure arguments
      * else: package version, name, version, moduledir,
              configure arguments and bugreport address

ARGUMENTS

SEE ALSO

libramrpcserver_config(3), libramrpcserver_config_detail(3), libram-rpcserver(3)