Fawkes API  Fawkes Development Version
datagram.cpp
1 
2 /***************************************************************************
3  * datagram.cpp - Fawkes datagram socket (TCP)
4  *
5  * Created: Fri Nov 10 10:02:54 2006 (on train to Google, Hamburg)
6  * Copyright 2006 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <netcomm/socket/datagram.h>
25 #include <sys/socket.h>
26 
27 namespace fawkes {
28 
29 /** @class DatagramSocket netcomm/socket/datagram.h
30  * Datagram socket. A UDP socket on top of IP.
31  *
32  * @ingroup NetComm
33  * @author Tim Niemueller
34  */
35 
36 /** Constructor.
37  * @param addr_type Specify IPv4 or IPv6
38  * @param timeout timeout, if 0 all operationsare blocking, otherwise it
39  * is tried for timeout seconds.
40  */
41 DatagramSocket::DatagramSocket(AddrType addr_type, float timeout) : Socket(addr_type, UDP, timeout)
42 {
43 }
44 
45 /** Copy constructor.
46  * @param datagram_socket socket to copy.
47  */
48 DatagramSocket::DatagramSocket(DatagramSocket &datagram_socket) : Socket(datagram_socket)
49 {
50 }
51 
52 /** Assingment operator.
53  * @param s socket to copy from
54  * @return reference to this
55  */
58 {
60  return *this;
61 }
62 
63 /** Clone socket.
64  * @return a copied instance of DatagramSocket.
65  */
66 Socket *
68 {
69  return new DatagramSocket(*this);
70 }
71 
72 } // end namespace fawkes
fawkes::DatagramSocket::operator=
DatagramSocket & operator=(DatagramSocket &s)
Assingment operator.
Definition: datagram.cpp:57
fawkes::Socket::operator=
Socket & operator=(Socket &socket)
Copy constructor.
Definition: socket.cpp:250
fawkes
Fawkes library namespace.
fawkes::Socket::AddrType
AddrType
Address type specification.
Definition: socket.h:75
fawkes::DatagramSocket::DatagramSocket
DatagramSocket(AddrType addr_type, float timeout=0.f)
Constructor.
Definition: datagram.cpp:41
fawkes::Socket
Socket base class.
Definition: socket.h:64
fawkes::DatagramSocket
Datagram socket.
Definition: datagram.h:32
fawkes::DatagramSocket::clone
virtual Socket * clone()
Clone socket.
Definition: datagram.cpp:67