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 class unix_socket : public socket_t { 
00017   protected: 
00018     int           fd; 
00019     int           errcode;     // error code of last failed operation 
00020     char*         address;     // host address
00021     socket_domain domain;      // Unix domain or INET socket
00022     bool          create_file; // Unix domain sockets use files for connection
00023 
00024     enum error_codes { 
00025         ok = 0,
00026         not_opened = -1,
00027         bad_address = -2,
00028         connection_failed = -3,
00029         broken_pipe = -4, 
00030         invalid_access_mode = -5
00031     };
00032 
00033   public: 
00034     //
00035     // Directory for Unix Domain socket files. This directory should be 
00036     // either empty or be terminated with "/". Dafault value is "/tmp/"
00037     //
00038     static char* unix_socket_dir; 
00039 
00040     bool      open(int listen_queue_size);
00041     bool      connect(int max_attempts, time_t timeout);
00042 
00043     int       read(void* buf, size_t min_size, size_t max_size, 
00044                    time_t timeout);
00045     bool      write(void const* buf, size_t size);
00046 
00047     bool      is_ok(); 
00048     bool      shutdown();
00049     bool      close();
00050     char*     get_peer_name();
00051     void      get_error_text(char* buf, size_t buf_size);
00052 
00053     socket_t* accept();
00054     bool      cancel_accept();
00055     
00056     int get_handle();
00057 
00058     unix_socket(const char* address, socket_domain domain); 
00059     unix_socket(int new_fd);
00060 
00061     ~unix_socket();
00062 };
00063 
00064 #endif
00065 
00066 
00067 
00068 
00069 

Generated on Fri Nov 15 21:06:29 2002 for FastDB by doxygen1.2.15