/* * 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 _UNS_SOCKET_H #define _UNS_SOCKET_H #pragma interface #include #include #include #include class UNSSocket: public Socket { public: UNSSocket(); UNSSocket(const char *address, const char *param = NULL, size_t parlen = 0); virtual ~UNSSocket(); public: bool connect(flags_t mode); Socket *accept(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 async(bool, pid_t pid = 0); bool noblock(bool); 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 = full_duplex | send_recv | multiplex | accept_able | async_mode | noblock_mode | leafnode; const flags_t _cap_minus = 0; private: int _sd; struct sockaddr_un _saddr; struct sockaddr_un _paddr; bool _saddr_bound; Signal _sigpipe; void parse_args(const char *s, int l = -1); void setaddr(const char *serv, const char *host = NULL); 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 UNSSocket(const UNSSocket&); const UNSSocket &operator=(const UNSSocket &s); }; #endif