"Fossies" - the Fresh Open Source Software Archive

Member "ivtools-ivtools-2.0.4/src/OverlayUnidraw/aceimport.h" (9 Oct 2020, 2948 Bytes) of package /linux/misc/ivtools-ivtools-2.0.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "aceimport.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (c) 1996-1999 Vectaport Inc.
    3  *
    4  * Permission to use, copy, modify, distribute, and sell this software and
    5  * its documentation for any purpose is hereby granted without fee, provided
    6  * that the above copyright notice appear in all copies and that both that
    7  * copyright notice and this permission notice appear in supporting
    8  * documentation, and that the names of the copyright holders not be used in
    9  * advertising or publicity pertaining to distribution of the software
   10  * without specific, written prior permission.  The copyright holders make
   11  * no representations about the suitability of this software for any purpose.
   12  * It is provided "as is" without express or implied warranty.
   13  *
   14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
   15  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
   16  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
   17  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
   18  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
   19  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
   20  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   21  * 
   22  */
   23 
   24 #ifdef HAVE_ACE
   25 
   26 #ifndef _unidraw_import_handler_
   27 #define _unidraw_import_handler_
   28 
   29 #include <stdio.h>
   30 #include <signal.h>
   31 #include <ace/Acceptor.h>
   32 #include <ace/Reactor.h>
   33 #include <ace/Singleton.h>
   34 #include <ace/Svc_Handler.h>
   35 #include <ace/SOCK_Acceptor.h>
   36 #include <ace/Test_and_Set.h>
   37 
   38 class OvImportCmd;
   39 #include <fstream.h>
   40 #include <iosfwd>
   41 
   42 // GNU HURD has no fixed limit
   43 #ifndef MAXHOSTNAMELEN
   44 #define MAXHOSTNAMELEN 4096
   45 #endif
   46 
   47 //: handler for import by socket into OverlayUnidraw.
   48 class UnidrawImportHandler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
   49 {
   50 
   51 public:
   52   UnidrawImportHandler ();
   53 
   54   virtual void destroy (void);  
   55   // ensure dynamic deallocation.
   56 
   57   virtual int open (void *);    
   58   // hook for opening handlers.
   59   virtual int close (u_long);   
   60   // hook for closing handlers.
   61 
   62 protected:
   63   virtual int handle_input (ACE_HANDLE); 
   64   // called when input ready on 'ACE_HANDLE'.
   65   virtual int handle_timeout (const ACE_Time_Value &tv, 
   66                   const void *arg); 
   67   // called when timeout occurs.
   68 
   69   char peer_name_[MAXHOSTNAMELEN + 1];
   70   // host we are connected to.
   71 
   72   OvImportCmd* _import_cmd; // associated import command
   73 #if __GNUC__<3
   74   filebuf* _filebuf;
   75 #else                
   76   fileptr_filebuf* _filebuf;        // associated input buffer#
   77 #endif
   78   istream* _inptr;          // associated input stream
   79   FILE* _infptr;            // associated FILE*
   80 };
   81 
   82 //: an ACE_Test_and_Set Singleton for Ctrl-C.
   83 typedef ACE_Singleton<ACE_Test_and_Set <ACE_Null_Mutex, sig_atomic_t>, ACE_Null_Mutex> 
   84     IMPORT_QUIT_HANDLER;
   85 
   86 //: acceptor specialized on UnidrawImportHandler.
   87 typedef ACE_Acceptor <UnidrawImportHandler, ACE_SOCK_ACCEPTOR> 
   88     UnidrawImportAcceptor;
   89 
   90 #endif /* _unidraw_import_handler_ */
   91 
   92 #endif /* HAVE_ACE */