Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

socket.hh

Go to the documentation of this file.
00001 // socket.hh - source file for the mailfilter program
00002 // Copyright (c) 2003  Andreas Bauer <baueran@in.tum.de>
00003 //
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 2 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00017 // USA.
00018 
00019 #ifndef SOCKET_HH
00020 #define SOCKET_HH
00021 
00022 #include <string>
00023 #include <csignal>
00024 #include "connection.hh"
00025 
00026 using namespace std;
00027 
00028 #ifndef MAX_BYTES
00029 #define MAX_BYTES 512
00030 #endif
00031 
00032 class Socket : public Connection
00033 {
00034 private:
00035   int         sd;                     // Socket descriptor.
00036   int         time_out;               // Time out.
00037   static void connect_alarm (int);    // Alarm handler.
00038   string*     read_buffer;            // Server replies after read ().
00039 
00040 public:
00041   void        clear         (void);
00042   int         c_open        (const char* host,
00043                  int port,
00044                  int time_out);
00045   int         c_close       (void);
00046   int         c_write       (const char* command);
00047   int         c_read        (bool = false);
00048   string*     c_reply       (void);
00049 };
00050 
00051 #endif

Generated on Sat Feb 14 18:38:55 2004 for mailfilter by doxygen 1.3.5