summaryrefslogtreecommitdiff
path: root/comm/Socket.h
diff options
context:
space:
mode:
authorchatty1993-04-07 11:50:31 +0000
committerchatty1993-04-07 11:50:31 +0000
commitba066c34dde204aa192d03a23a81356374d93731 (patch)
tree39391f6235d2cf8a59a0634ac5ea430cdd21f5d4 /comm/Socket.h
parent05ab076e1c2a9ca16472f9a6b47b8d22914b3783 (diff)
downloadivy-league-ba066c34dde204aa192d03a23a81356374d93731.zip
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.gz
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.bz2
ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.xz
Initial revision
Diffstat (limited to 'comm/Socket.h')
-rw-r--r--comm/Socket.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/comm/Socket.h b/comm/Socket.h
new file mode 100644
index 0000000..db84209
--- /dev/null
+++ b/comm/Socket.h
@@ -0,0 +1,60 @@
+/*
+ * The Unix Channel
+ *
+ * by Michel Beaudouin-Lafon
+ *
+ * Copyright 1990-1993
+ * Laboratoire de Recherche en Informatique (LRI)
+ *
+ * Sockets
+ *
+ * $Id$
+ * $CurLog$
+ */
+
+#ifndef Socket_H_
+#define Socket_H_
+
+#include "cplus_bugs.h"
+#include "Channel.h"
+#include "Address.h"
+
+extern char* StrReprBuf;
+
+#define SOCK_UNSPEC 0
+
+// Virtual base class for sockets.
+// A socket is a channel and an address.
+// As a channel, it is immutable, and must be initialized once and for all at creation.
+//
+class UchSocket : public UchChannel {
+protected:
+ pUchAddress BAddr;
+ pUchAddress CAddr;
+ int AddrFamily;
+public:
+ UchSocket ();
+ UchSocket (UchAddress*, UchAddress*);
+ ~UchSocket ();
+ UchSocket (const UchSocket& s);
+
+ UchChannel* Copy () const;
+virtual int SockType (); // SOCK_UNSPEC, SOCK_STREAM, SOCK_DGRAM
+inline int Family () { return AddrFamily; }
+inline void SetFamily (int f) { AddrFamily = f; }
+
+ void BindTo (UchAddress*);
+ void ConnectTo (UchAddress*);
+inline UchAddress* BoundTo () { return BAddr; }
+inline UchAddress* ConnectedTo () { return CAddr; }
+ bool Open ();
+ int Bind ();
+ int Bind (UchAddress*);
+ int Connect ();
+ int Connect (UchAddress*);
+ bool Setup ();
+ char* StrRepr (char* = StrReprBuf);
+};
+
+#endif /* Socket_H_ */
+