|
|
@@ -1,177 +0,0 @@
|
|
|
-.\"/*
|
|
|
-.\" * Copyright (c) 2009 Red Hat, Inc.
|
|
|
-.\" *
|
|
|
-.\" * All rights reserved.
|
|
|
-.\" *
|
|
|
-.\" * Author: Steven Dake (sdake@redhat.com)
|
|
|
-.\" *
|
|
|
-.\" * This software licensed under BSD license, the text of which follows:
|
|
|
-.\" *
|
|
|
-.\" * Redistribution and use in source and binary forms, with or without
|
|
|
-.\" * modification, are permitted provided that the following conditions are met:
|
|
|
-.\" *
|
|
|
-.\" * - Redistributions of source code must retain the above copyright notice,
|
|
|
-.\" * this list of conditions and the following disclaimer.
|
|
|
-.\" * - Redistributions in binary form must reproduce the above copyright notice,
|
|
|
-.\" * this list of conditions and the following disclaimer in the documentation
|
|
|
-.\" * and/or other materials provided with the distribution.
|
|
|
-.\" * - Neither the name of the MontaVista Software, Inc. nor the names of its
|
|
|
-.\" * contributors may be used to endorse or promote products derived from this
|
|
|
-.\" * software without specific prior written permission.
|
|
|
-.\" *
|
|
|
-.\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
-.\" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
-.\" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
-.\" * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
-.\" * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
-.\" * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
-.\" * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
-.\" * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
-.\" * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
-.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
-.\" * THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
-.\" */
|
|
|
-.TH COROIPC_OVERVIEW 8 2009-03-21 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
|
|
-.SH NAME
|
|
|
-coroipc_overview \- Overview of coroipc libraries
|
|
|
-.SH OVERVIEW
|
|
|
-The coroipcs and coroipcc libraries provide a generically reusable very high
|
|
|
-performance shared memory IPC sytem for client and service applications.
|
|
|
-It supports many features including:
|
|
|
-.PP
|
|
|
-65536 user services and 65536 command ids per service.
|
|
|
-.PP
|
|
|
-Shared memory implementation for very high performance.
|
|
|
-.PP
|
|
|
-A synchronous request/response channel and asynchronous response channel
|
|
|
-per ipc connection.
|
|
|
-.PP
|
|
|
-User defined private data per IPC connection.
|
|
|
-.PP
|
|
|
-Ability to call a function per service on ipc connection and disconnection.
|
|
|
-.PP
|
|
|
-Authenticated IPC connection with ability for developer to define which
|
|
|
-UIDs and GIDs are valid at connection time.
|
|
|
-.PP
|
|
|
-Fully abstracted poll system so that any poll library may be used.
|
|
|
-.PP
|
|
|
-User defined selector for determining the proper function to call per
|
|
|
-service and id.
|
|
|
-
|
|
|
-.SH Description of the libraries
|
|
|
-There are two shared libraries available for developing IPC client applications.
|
|
|
-
|
|
|
-The first library is coroipcs.so which is responsible for the server
|
|
|
-implementation. This library should be linked with the server and then
|
|
|
-initialized with coroipcs_init(3).
|
|
|
-
|
|
|
-Once the library is initialized, it will provide service to coroipcc.so library
|
|
|
-users.
|
|
|
-
|
|
|
-The second library is coroipcc.so which is responsible for the client
|
|
|
-implementation. This library should be linked with the client and requires
|
|
|
-no initialization. This library provides communication functions for sending
|
|
|
-and receiving synchronous requests, and also reading asynchronous message
|
|
|
-requests from the server.
|
|
|
-
|
|
|
-.SH Initializing the coroipcs library
|
|
|
-To use the coroipcs library, the developer creates a coroipcs_init_state
|
|
|
-structure and populates it with function names. The functions do various
|
|
|
-operations described in coroipcs_init(3) man page. Not all operations must
|
|
|
-be specified. If some are missing, the corosync ipcs library will
|
|
|
-automatically populate the structure with internal versions which provide
|
|
|
-basic functionality.
|
|
|
-
|
|
|
-.SH Communicating with the coroipcc clients
|
|
|
-Every ipc connection is represented by a void * pointer which uniquely
|
|
|
-identifies the data set for the IPC connection. Each IPC connection also
|
|
|
-contains user defined private data. To obtain this private data pointer, the
|
|
|
-function coroipcs_private_data_get(3) function can be called.
|
|
|
-
|
|
|
-There are two channels for communication. The primary channel is the
|
|
|
-synchronous request/response channel. Another channel is available for out of
|
|
|
-band asynchronous responses from the server.
|
|
|
-
|
|
|
-To send a response on the syncronous channel, coroipcs_response_send(3) or
|
|
|
-coroipcs_response_iov_send(3) should be used. To send a message on the
|
|
|
-asynchronous channel, coroipcs_dispatch_send(3) or coroipc_dispatch_iov_send(3)
|
|
|
-should be used.
|
|
|
-
|
|
|
-.SH The abstracted poll system
|
|
|
-There are many different poll systems in use in applications. They are usually
|
|
|
-intricately tied up in the implementation of the application and each provide
|
|
|
-different APIs and functionality. To manage this, the coroipcs library
|
|
|
-provides callbacks in coroipcs_init(3) which should be called when a new
|
|
|
-connection should be added for accept system calls or to dispatch messages.
|
|
|
-
|
|
|
-These callbacks add the relevant fd to the application's poll system. When the
|
|
|
-application poll system triggers the callback registered by the user defined
|
|
|
-poll adding functions, they then call either coroipc_handler_accept(3) or
|
|
|
-coroipc_handler_dispatch(3).
|
|
|
-
|
|
|
-.SH Initializing the coroipcc library
|
|
|
-No initialization is required in the coroipcc library.
|
|
|
-
|
|
|
-.SH Lifecycle of an IPC connection.
|
|
|
-An IPC connection is made to the server with coroipcc_service_connect(3). This
|
|
|
-function connects to the server and requests channels be created for
|
|
|
-communication. To disconnect, the client either exits or executes the
|
|
|
-function coroipcc_service_disconnect(3).
|
|
|
-
|
|
|
-.SH Synchronous communication
|
|
|
-There are two functions for sending a request and receiving a response. The
|
|
|
-first function coroipcc_msg_send_reply_receive(3) sends an iovector request
|
|
|
-and receives a response. This function copies the response into the response
|
|
|
-buffer. the second function coroipcc_msg_end_reply_receive_in_buf(3) does not
|
|
|
-copy the response buffer and allows for zero-copy reading of the response
|
|
|
-when the lifetime of the response buffer is known.
|
|
|
-
|
|
|
-.SH Asynchronous communication
|
|
|
-The coroipcc_dispatch_recv(3) function receives an out-of-band asyncronous
|
|
|
-message. Unlike the synchronous communication channel, the asynchronous
|
|
|
-messages are queued and can provide very high out-of-band performance.
|
|
|
-
|
|
|
-To determine when to call coroipcc_dispatch_recv(3) the corosync_fd_get(3) call
|
|
|
-is used to obtain a file descriptor used in the poll(2) or select(2) system
|
|
|
-calls.
|
|
|
-
|
|
|
-Finally the current dispatch flow control state can be obtained with
|
|
|
-coroipcc_flow_control_get(3).
|
|
|
-
|
|
|
-.SH Performance
|
|
|
-The ipc system is tuned for very high performance while also being comletely
|
|
|
-abstracted from the underlying poll mechanism and any internalisms required
|
|
|
-by the server. The ipc system achieves such high performance by using shared
|
|
|
-memory as oppossed to slower techniques such as UNIX_PF sockets.
|
|
|
-
|
|
|
-We intend to do further development to allow syncronous requests to return
|
|
|
-messages in an asyncronous way to avoid blocking involved in the syncronous
|
|
|
-request/response model used today for higher throughput in some use cases.
|
|
|
-
|
|
|
-.SH Security
|
|
|
-The ipc system uses default operating system security mechanics to ensure
|
|
|
-ipc connections are validated. A callback used with coroipcs_init(3) is called
|
|
|
-for every new ipc connection with the parameters of UID and GID. The callback
|
|
|
-then determines if the UID and GID are authenticated for communication. More
|
|
|
-about this topic can be viewed in the coroipcs_init(3) man page.
|
|
|
-
|
|
|
-.SH "SEE ALSO"
|
|
|
-.BR coroipcs_ipc_init (3),
|
|
|
-.BR coroipcs_ipc_exit (3),
|
|
|
-.BR coroipcs_private_data_get (3),
|
|
|
-.BR coroipcs_respone_send (3),
|
|
|
-.BR coroipcs_response_iov_send (3),
|
|
|
-.BR coroipcs_dispatch_send (3),
|
|
|
-.BR coroipcs_dispatch_iov_send (3),
|
|
|
-.BR coroipcs_refcount_inc (3),
|
|
|
-.BR coroipcs_refcount_dec (3),
|
|
|
-.BR coroipcs_handler_accept (3),
|
|
|
-.BR coroipcs_handler_dispatch (3),
|
|
|
-
|
|
|
-.BR cooripcc_service_connect (3),
|
|
|
-.BR coroipcc_service_disconnect (3),
|
|
|
-.BR coroipcc_msg_send_reply_receive (3),
|
|
|
-.BR coroipcc_msg_send_reply_receive_in_buf (3),
|
|
|
-.BR coroipcc_dispatch_recv (3),
|
|
|
-.BR coroipcc_fd_get(3),
|
|
|
-.BR coroipcc_dispatch_flow_control_get (3)
|