some doc fixing
[senf.git] / Socket / Protocols / UN / UNProtocol.cc
index d04192d..7f7f85f 100644 (file)
@@ -1,6 +1,7 @@
-// $Id$
-//
 // Copyright (C) 2007 
+// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
+// Kompetenzzentrum NETwork research (NET)
+//     David Wagner <david.wagner@fokus.fraunhofer.de>
 //
 // 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
 
 // Custom includes
 #include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <linux/sockios.h> // for SIOCINQ / SIOCOUTQ
 #include "../../../Utils/Exception.hh"
 
 //#include "UNProtocol.mpp"
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
+prefix_ unsigned senf::UNProtocol::available()
+    const
+{
+    int n;
+    if (::ioctl(body().fd(),SIOCINQ,&n) < 0)
+        throw senf::SystemException(errno);
+    return n;
+}
+
+prefix_ bool senf::UNProtocol::eof()
+    const
+{
+    return false;
+}
+
 prefix_ void senf::UNProtocol::connect(UNSocketAddress const & address) 
     const 
 {