summaryrefslogtreecommitdiff
path: root/comm/UnixAddress.cc
diff options
context:
space:
mode:
authorsc2000-11-28 17:07:47 +0000
committersc2000-11-28 17:07:47 +0000
commitee937667fd0ecd82faab4c88d756b906fb625f1a (patch)
tree19e679318b5cb87e8be1a05a7bbc9ba5568d0814 /comm/UnixAddress.cc
parent1326b11d65f7020f5f6c691305d2c090b064bd04 (diff)
downloadivy-league-ee937667fd0ecd82faab4c88d756b906fb625f1a.zip
ivy-league-ee937667fd0ecd82faab4c88d756b906fb625f1a.tar.gz
ivy-league-ee937667fd0ecd82faab4c88d756b906fb625f1a.tar.bz2
ivy-league-ee937667fd0ecd82faab4c88d756b906fb625f1a.tar.xz
Integration into IvyLeague
Uvh -> Ivl Multiplexer.* is renamed into Scheduler.* A few name conflicts in the merger with ex-DNN have been solved Imakefile is replaced by Makefile Created InetAddress.* and UnixAddress.* from Address.* Created IrdaAddress.* OLD/TextStream has been updated
Diffstat (limited to 'comm/UnixAddress.cc')
-rw-r--r--comm/UnixAddress.cc86
1 files changed, 86 insertions, 0 deletions
diff --git a/comm/UnixAddress.cc b/comm/UnixAddress.cc
new file mode 100644
index 0000000..469fa2e
--- /dev/null
+++ b/comm/UnixAddress.cc
@@ -0,0 +1,86 @@
+/*
+ * The Unix Channel
+ *
+ * by Michel Beaudouin-Lafon
+ *
+ * Copyright 1990-1997
+ * Laboratoire de Recherche en Informatique (LRI)
+ *
+ * Unix Addresses
+ *
+ * $Id$
+ * $CurLog$
+ * Created from Address.cc
+ */
+
+#include "UnixAddress.h"
+#include "error.h"
+
+#include <stdio.h>
+
+// constructors for Unix addresses
+// a Unix domain address is just a filename
+// -> some problems: check for access, when to unlink it ?
+// to do : generate name from a template (for uniqueness)
+//
+
+/*?nodoc?*/
+IvlUnixAddress :: IvlUnixAddress ()
+: IvlAddress ()
+{
+}
+
+/*?
+Create a Unix domain address associated to file \var{filename}.
+The file is not unlinked when the address is destroyed;
+it should be unlinked by the application whenever the last socket using this address is closed.
+?*/
+IvlUnixAddress :: IvlUnixAddress (const char* filename)
+: IvlAddress ()
+{
+ Addr.sun_family = AF_UNIX;
+ strcpy (Addr.sun_path, filename);
+ Valid = true;
+ // should check access to file ???
+ // unlink if already there ?
+}
+
+/*?nodoc?*/
+IvlUnixAddress :: ~IvlUnixAddress ()
+{
+ // how to unlink the file ??
+}
+
+/*?nodoc?*/
+int
+IvlUnixAddress :: Family ()
+{
+ return AF_UNIX;
+}
+
+/*?nodoc?*/
+int
+IvlUnixAddress :: Length ()
+{
+ if (Valid)
+ return (Addr.sun_path + strlen (Addr.sun_path)) - (char*) &Addr;
+ return 0;
+}
+
+/*?nodoc?*/
+SockAddr*
+IvlUnixAddress :: GetSockAddr ()
+{
+ return (SockAddr*) &Addr;
+}
+
+/*?nodoc?*/
+char*
+IvlUnixAddress :: StrRepr (char* buf)
+{
+ sprintf (buf, "%s", Addr.sun_path);
+ return buf;
+}
+
+
+