server.h

Go to the documentation of this file.
00001 /*!
00002  * \file   log/include/server.h
00003  * \brief  Logging facility - functions for server communication
00004  *
00005  * \date   03/14/2001
00006  * \author Jork Loeser <jork.loeser@inf.tu-dresden.de>
00007  */
00008 /* (c) 2003 Technische Universitaet Dresden
00009  * This file is part of DROPS, which is distributed under the terms of the
00010  * GNU General Public License 2. Please see the COPYING file for details.
00011  */
00012 #ifndef __LOG_INCLUDE_ARCH_X86_SERVER_H_
00013 #define __LOG_INCLUDE_ARCH_X86_SERVER_H_
00014 
00015 #if ! ( defined L4API_l4v2 || defined L4API_l4x0 )
00016 #error This file must not be directly included
00017 #endif
00018 
00019 #include <l4/sys/types.h>
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 /*!\brief variable containing the ID of the logserver.
00026  *
00027  * If you use the logserver, but you do not want the lib to call
00028  * the nameserver for resolving names, you can set the id directly.
00029  */
00030 L4_CV void LOG_server_setid(l4_threadid_t id);
00031 
00032 /*!\brief Open a binary output channel
00033  *
00034  * \ingroup muxed_api
00035  *
00036  * This function opens a binary output channel at the logserver. Multiple
00037  * clients/programs can send data to the same output channel at the logserver,
00038  * the output is merged then. To do so, the clients must specify the same
00039  * channel nr when opening. A reference counter holds the number of
00040  * clients that opened that channel. Channel 1 is used for sending the
00041  * standard logging text on, using it for sending binary data is not
00042  * recommended.
00043  *
00044  * The caller of this function must specify a flexpage which is mapped to the
00045  * logserver. This flexpage is used for transfering data later when using
00046  * LOG_channel_write().
00047  *
00048  * \param  channel      channel nr of the channel to open
00049  * \param  fpage        a flexpage that will later be used for writing data.
00050  *                      The flexpage must contain pinned pages prior to
00051  *                      calling this function. The flexpage must not exceed
00052  *                      2MB in its size.
00053  *
00054  * \retval >=0          the id of the connection to use later
00055  * \retval -L4_ENOMEM   the specified fpage exceeded the maximum size
00056  * \retval -L4_ENOMAP   if the server did not have a free area to receive the
00057  *                      fpage or is otherwise short on resources
00058  * \retval -L4_EIPC     some problem with server communication occured
00059  * \retval -L4_EBUSY    the server is configured using normal mode,
00060  *                      not multiplexed mode for TCP-output. Sending binary
00061  *                      data to the client requires multiplexed output.  See
00062  *                      \ref p_server on how to configure multiplexed mode.
00063  *
00064  * \see  LOG_channel_write(), LOG_channel_close().
00065  * \note This function is only available when using the logserver!
00066  */
00067 L4_CV int LOG_channel_open(int channel, l4_fpage_t fpage);
00068 
00069 /*!\brief Send data to a binary output channel
00070  *
00071  * \ingroup muxed_api
00072  *
00073  * This function sends data to an open binary output channel at the
00074  * logserver. This function does not wait until the data is actually
00075  * sent. Therefore, you should not overwrite the data beeing sent,
00076  * until a subsequently call to LOG_channel_flush() returns.
00077  *
00078  * Multiple clients/programs can send to the same output channel at
00079  * the logserver, the output is merged then. It is ensured, that data
00080  * of different calls to LOG_channel_write() does not intercept each
00081  * other. When multiple clients/programs use the same channel, it is
00082  * recommended to use an additional encapsulation to demultiplex the
00083  * data lateron.
00084  *
00085  * \param  id    id of the connection as returned from LOG_channel_open()
00086  * \param  off   offset of the data in the flexpage provided on
00087  *               LOG_channel_open()
00088  * \param  size  number of bytes to write
00089  *
00090  * \retval 0  no error
00091  * \retval <0 in the case of error
00092  *
00093  * \see  LOG_channel_open(), LOG_channel_flush(), LOG_channel_close().
00094  * \note This function is only available when using the logserver! */
00095 L4_CV int LOG_channel_write(int id, unsigned off, unsigned size);
00096 
00097 
00098 /*!\brief Wait until data is sent by the logserver
00099  *
00100  * \ingroup muxed_api
00101  *
00102  * This function waits until the prior write-request is fulfilled and the
00103  * according memory in the mapped fpage can be reused.
00104  *
00105  * \param  id    id of the connection as returned from LOG_channel_open()
00106  *
00107  * \retval 0  no error
00108  * \retval <0 in the case of error
00109  *
00110  * \see  LOG_channel_write.
00111  * \note This function is only available when using the logserver!
00112  */
00113 L4_CV int LOG_channel_flush(int id);
00114 
00115 
00116 /*!\brief Close a binary output channel
00117  *
00118  * \ingroup muxed_api
00119  *
00120  * This function removes the mapping and decrements the reference counter to
00121  * an open binary output channel at the logserver. If the reference counter
00122  * becomes 0, the channel is actually closed, i.e. the resources are freed
00123  * in the logserver.
00124  *
00125  * \param  id    id of the connection as returned from LOG_channel_open()
00126  *
00127  * \retval 0  no error
00128  * \retval <0 in the case of error
00129  *
00130  * \see  LOG_channel_open(), LOG_channel_write(), LOG_channel_flush().
00131  * \note This function is only available when using the logserver!
00132  */
00133 L4_CV int LOG_channel_close(int id);
00134 
00135 #ifdef __cplusplus
00136 }
00137 #endif
00138 #endif

Generated on Wed Apr 11 06:40:52 2012 for Logging and output facility for DROPS by  doxygen 1.5.6