Socket.h

Go to the documentation of this file.
00001 /* $Id: Socket.h 566 2007-12-02 08:20:52Z mindstorm2600 $ */
00002 /*
00003  *  This program is free software; you can redistribute it and/or modify
00004  *  it under the terms of the GNU General Public License as published by
00005  *  the Free Software Foundation; either version 2 of the License, or
00006  *  (at your option) any later version.
00007  *
00008  *  This program is distributed in the hope that it will be useful,
00009  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  *  GNU General Public License for more details.
00012  *
00013  *  You should have received a copy of the GNU General Public License
00014  *  along with this program; if not, write to the Free Software
00015  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016  */
00017 #ifndef __XVR2_NET_SOCKET_H__
00018 #define __XVR2_NET_SOCKET_H__
00019 #include<xvr2/Object.h>
00020 #include<xvr2/Net/SocketExceptions.h>
00021 #include<xvr2/Net/IPv4Address.h>
00022 #include<xvr2/FileException.h>
00023 #include<sys/types.h>
00024 #include<sys/socket.h>
00025 
00026 namespace xvr2 {
00027         namespace Net {
00028 
00031                 class Socket:public Object {
00032                         private:
00033                         protected:
00035                                 int _socket;
00038                                 bool is_ipv4;
00044                                 virtual void create(int protoid = 0) = 0;
00053                                 virtual void getsockopt(int level, int optname, void *optval, socklen_t *optlen);
00062                                 virtual void setsockopt(int level, int optname, const void *optval, socklen_t optlen);
00063                         public:
00065                                 Socket();
00070                                 Socket(const Socket &s);
00072                                 virtual ~Socket();
00074                                 virtual void close();
00084                                 void bind(const IPv4Address &ip);
00091                                 bool debug(bool enabled);
00094                                 bool debug();
00101                                 bool reuseAddr(bool enabled);
00104                                 bool reuseAddr();
00114                                 bool keepalive(bool enabled);
00117                                 bool keepalive();
00124                                 bool dontroute(bool enabled);
00127                                 bool dontroute();
00136                                 void linger(bool enabled, int secs = 1);
00140                                 int linger();
00145                                 bool broadcast(bool enabled);
00148                                 bool broadcast();
00153                                 bool recvOOBInline(bool enabled);
00156                                 bool recvOOBInline();
00159                                 int sendBufSize(int newsize);
00162                                 int sendBufSize();
00165                                 int recvBufSize(int newsize);
00168                                 int recvBufSize();
00171                                 bool isStream();
00176                                 bool isDatagram();
00182                                 bool isRaw();
00185                                 bool isIPv4();
00188                                 bool isIPv6();
00189                 };
00190 
00191         };
00192 };
00193 
00194 #endif
00195 

Generated on Fri Jun 20 22:55:48 2008 for X-VR2 SDK by  doxygen 1.5.5