14d1874976f34786c076e5ffe184ef096103ca2a
[senf.git] / Socket / Protocols / UN / ConnectedUNDatagramSocketHandle.cc
1 // Copyright (C) 2007 
2 // Fraunhofer Institute for Open Communication Systems (FOKUS) 
3 // Kompetenzzentrum NETwork research (NET)
4 //     David Wagner <dw6@berlios.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 /** \file
22     \brief ConnectedUNDatagramSocketHandle non-inline non-template implementation */
23
24 #include "ConnectedUNDatagramSocketHandle.hh"
25
26 // Custom includes
27 #include <sys/socket.h>
28 #include <sys/types.h>
29 #include <sys/ioctl.h>
30
31 #include "../../../Utils/Exception.hh"
32
33 //#include "UNDatagramSocketHandle.mpp"
34 #define prefix_
35 ///////////////////////////////cc.p////////////////////////////////////////
36
37 prefix_ void senf::ConnectedUNDatagramSocketProtocol::init_client() const
38 {
39     int sock = ::socket(PF_UNIX,SOCK_DGRAM,0);
40     if (sock < 0)
41         throwErrno();
42    fd(sock);
43 }
44
45 prefix_ void senf::ConnectedUNDatagramSocketProtocol::init_client(UNSocketAddress const & address) const 
46 {
47     init_client();
48     connect(address);
49 }
50
51 prefix_ std::auto_ptr<senf::SocketProtocol> senf::ConnectedUNDatagramSocketProtocol::clone()
52     const
53 {
54     return std::auto_ptr<SocketProtocol>(new ConnectedUNDatagramSocketProtocol());
55 }
56
57 ///////////////////////////////cc.e////////////////////////////////////////
58 #undef prefix_
59 //#include "UNDatagramSocketHandle.mpp"