4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Definition of non-inline non-template functions
25 #include "TCPProtocol.hh"
26 //#include "TCPProtocol.ih"
29 #include <sys/socket.h>
30 #include <netinet/in.h>
31 #include <netinet/tcp.h>
32 #include <sys/ioctl.h>
33 #include <linux/sockios.h> // for SIOCINQ / SIOCOUTQ
34 #include "SocketHandle.hh"
36 //#include "TCPProtocol.mpp"
38 ///////////////////////////////cc.p////////////////////////////////////////
40 prefix_ bool satcom::lib::TCPProtocol::nodelay()
44 socklen_t len (sizeof(value));
45 if (::getsockopt(body().fd(),SOL_TCP,TCP_NODELAY,&value,&len) < 0)
46 throw SystemException(errno);
50 prefix_ void satcom::lib::TCPProtocol::nodelay(bool value)
54 if (::setsockopt(body().fd(),SOL_TCP,TCP_NODELAY,&ivalue,sizeof(ivalue)) < 0)
55 throw SystemException(errno);
58 prefix_ unsigned satcom::lib::TCPProtocol::siocinq()
62 if (::ioctl(body().fd(),SIOCINQ,&n) < 0)
63 throw SystemException(errno);
67 prefix_ unsigned satcom::lib::TCPProtocol::siocoutq()
71 if (::ioctl(body().fd(),SIOCOUTQ,&n) < 0)
72 throw SystemException(errno);
76 prefix_ unsigned satcom::lib::TCPProtocol::available()
82 prefix_ bool satcom::lib::TCPProtocol::eof()
85 return body().readable() && available()==0;
89 ///////////////////////////////cc.e////////////////////////////////////////
91 //#include "TCPProtocol.mpp"
96 // c-file-style: "satcom"