/* * Copyright (c) 1996 Gunther Schadow. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _FILE_SOCKET_H #define _FILE_SOCKET_H #pragma interface #include class FileSocket: public Socket { public: FileSocket(const char *address, const char *param = NULL, size_t parlen = 0); FileSocket(); virtual ~FileSocket(); public: bool connect(flags_t mode); size_t send(const char *buf, size_t len, int msgf = 0); size_t recv(char *buf, size_t max, int msgf = 0); void shutdown(flags_t mode); void close(flags_t); bool is_sendready(int sec, int usec = 0) const; bool is_recvready(int sec, int usec = 0) const; bool is_exception(int sec, int usec = 0) const; const flags_t _cap_plus = send_recv | leafnode; const flags_t _cap_minus = any_duplex; private: int _fd; char *_filename; int _rwmode; int _oflags; int _omode; void parse_args(const char *s, int l = -1); private: flags_t cap_plus() const { return _cap_plus; } flags_t cap_minus() const { return _cap_minus; } Socket *ctor(); static Socket *ctor(const char *address, const char *param = NULL, size_t parlen = 0); friend class Socket; // make ctor accessible; private: // disallowed FileSocket(const FileSocket &); const FileSocket &operator=(const FileSocket &s); }; #endif