• Main Page
  • Classes
  • Files
  • File List

unisock.h

00001 //-< UNISOCK.H >-----------------------------------------------------*--------*
00002 // GigaBASE                  Version 1.0         (c) 1999  GARRET    *     ?  *
00003 // (Post Relational 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_GIGABASE_NAMESPACE
00017 
00018 class unix_socket : public socket_t {
00019   protected:
00020     int           fd;
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_t* buf, size_t buf_size);
00052 
00053     socket_t* accept();
00054     bool      cancel_accept();
00055 
00056     unix_socket(const char* address, socket_domain domain);
00057     unix_socket(int new_fd);
00058 
00059     ~unix_socket();
00060 };
00061 
00062 END_GIGABASE_NAMESPACE
00063 
00064 #endif
00065 
00066 
00067 
00068 
00069 

Generated on Mon Aug 23 2010 00:04:01 for GigaBASE by  doxygen 1.7.1