Main Page   Class Hierarchy   Compound List   File List   Compound Members  

unisock.h

00001 //-< UNISOCK.H >-----------------------------------------------------*--------*
00002 // FastDB                    Version 1.0         (c) 1997  GARRET    *     ?  *
00003 // (Main Memory Database Management System)                          *   /\|  *
00004 //                                                                   *  /  \  *
00005 //                          Created:      7-Jan-97    K.A. Knizhnik  * / [] \ *
00006 //                          Last update:  7-Jan-97    K.A. Knizhnik  * GARRET *
00007 //-------------------------------------------------------------------*--------*
00008 // Unix socket 
00009 //-------------------------------------------------------------------*--------*
00010 
00011 #ifndef __UNISOCK_H__
00012 #define __UNISOCK_H__
00013 
00014 #include "sockio.h"
00015 
00016 BEGIN_FASTDB_NAMESPACE
00017 
00018 class unix_socket : public socket_t { 
00019   protected: 
00020     int           fd; 
00021     int           errcode;     // error code of last failed operation 
00022     char*         address;     // host address
00023     socket_domain domain;      // Unix domain or INET socket
00024     bool          create_file; // Unix domain sockets use files for connection
00025 
00026     enum error_codes { 
00027         ok = 0,
00028         not_opened = -1,
00029         bad_address = -2,
00030         connection_failed = -3,
00031         broken_pipe = -4, 
00032         invalid_access_mode = -5
00033     };
00034 
00035   public: 
00036     //
00037     // Directory for Unix Domain socket files. This directory should be 
00038     // either empty or be terminated with "/". Dafault value is "/tmp/"
00039     //
00040     static char* unix_socket_dir; 
00041 
00042     bool      open(int listen_queue_size);
00043     bool      connect(int max_attempts, time_t timeout);
00044 
00045     int       read(void* buf, size_t min_size, size_t max_size, 
00046                    time_t timeout);
00047     bool      write(void const* buf, size_t size);
00048 
00049     bool      is_ok(); 
00050     bool      shutdown();
00051     bool      close();
00052     char*     get_peer_name();
00053     void      get_error_text(char* buf, size_t buf_size);
00054 
00055     socket_t* accept();
00056     bool      cancel_accept();
00057     
00058     int get_handle();
00059 
00060     unix_socket(const char* address, socket_domain domain); 
00061     unix_socket(int new_fd);
00062 
00063     ~unix_socket();
00064 };
00065 
00066 END_FASTDB_NAMESPACE
00067 
00068 #endif
00069 
00070 
00071 
00072 
00073 

Generated on Mon Oct 23 13:23:58 2006 for FastDB by doxygen1.2.18