stuff.h

Go to the documentation of this file.
00001 /*!
00002  * \file        log/server/src/stuff.h
00003  * \brief       Log-Server, div. stuff like locking and thread creation.
00004  *
00005  * \date        03/02/2001
00006  * \author      Jork Loeser <jork.loeser@inf.tu-dresden.de>
00007  *
00008  */
00009 /* (c) 2003 Technische Universitaet Dresden
00010  * This file is part of DROPS, which is distributed under the terms of the
00011  * GNU General Public License 2. Please see the COPYING file for details.
00012  */
00013 
00014 #ifndef __LOG_SERVER_SRC_STUFF_H_
00015 #define __LOG_SERVER_SRC_STUFF_H_
00016 
00017 #include <l4/sys/types.h>
00018 
00019 
00020 #define MAXTHREADS 3    /* max number of thread to be created by the
00021                          * logserver thread lib. */
00022 
00023 /*!\brief Connection descriptor
00024  *
00025  * A connection is a unit, related to a client. A connection is bound to a
00026  * channel, multiple connections can use the same channel.
00027  *
00028  * A connection is unused if the channel id is 0.
00029  *
00030  * The protocol when writing data to a connection is as follows: One
00031  * packet can be buffered in the connection descriptor. Each time the
00032  * main-thread wants to store a packet in the connection descriptor, it
00033  * writes the address and size in the addr and size fields and increments
00034  * the written field. The flusher thread increments the flushed field, if the
00035  * buffer was successfully flushed. Therefore, the main-thread can determine
00036  * if the buffer is free by comparing the written and the flushed field.
00037  */
00038 typedef struct{
00039     int  channel;       // channel id this connection sends on
00040     int  written;       // nr of packets written into this connection
00041     int  flushed;       // nr of packets flushed on this connection
00042     void *addr;         // addr of the current packet
00043     int  size;          // size of the current packet
00044     l4_fpage_t fpage;   // the buffers flexpage
00045 } bin_conn_t;
00046 
00047 
00048 #define MAX_BIN_CONNS 64
00049 extern bin_conn_t bin_conns[MAX_BIN_CONNS];
00050 
00051 extern unsigned buffer_head, buffer_tail, buffer_size;
00052 extern char buffer_array[];
00053 extern int flush_local, flush_serial, flush_to_net, flush_muxed;
00054 extern int serial_esc;
00055 
00056 extern int thread_create(void(*func)(void), l4_threadid_t *id,
00057                          const char*name);
00058 int serial_flush(const char*addr, int size);
00059 
00060 #endif

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