Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 0.5

  • Loading branch information...
commit c70b1af104de1eb0f13e536d0d1efb5e488aeb3a 1 parent 3a0cd9d
asergey authored
Showing with 2,542 additions and 934 deletions.
  1. +293 −193 lib/otp.net/Otp/AbstractConnection.cs
  2. +77 −44 lib/otp.net/Otp/AbstractNode.cs
  3. +346 −0 lib/otp.net/Otp/ClassDiagram1.cd
  4. +71 −43 lib/otp.net/Otp/Erlang/List.cs
  5. +52 −8 lib/otp.net/Otp/Erlang/Tuple.cs
  6. +35 −15 lib/otp.net/Otp/GenericQueue.cs
  7. +300 −0 lib/otp.net/Otp/Otp.2008.bdsproj
  8. +104 −0 lib/otp.net/Otp/Otp.2008.csproj
  9. +26 −0 lib/otp.net/Otp/Otp.2008.sln
  10. +23 −23 lib/otp.net/Otp/Otp.csproj
  11. +13 −5 lib/otp.net/Otp/Otp.sln
  12. +66 −135 lib/otp.net/Otp/OtpConnection.cs
  13. +32 −6 lib/otp.net/Otp/OtpCookedConnection.cs
  14. +55 −40 lib/otp.net/Otp/OtpEpmd.cs
  15. +5 −2 lib/otp.net/Otp/OtpExternal.cs
  16. +109 −63 lib/otp.net/Otp/OtpInputStream.cs
  17. +125 −31 lib/otp.net/Otp/OtpLocalNode.cs
  18. +142 −75 lib/otp.net/Otp/OtpMbox.cs
  19. +95 −65 lib/otp.net/Otp/OtpMsg.cs
  20. +93 −103 lib/otp.net/Otp/OtpNode.cs
  21. +115 −72 lib/otp.net/Otp/OtpNodeStatus.cs
  22. +12 −2 lib/otp.net/Otp/OtpOutputStream.cs
  23. +1 −1  lib/otp.net/Otp/OtpSelf.cs
  24. +1 −1  lib/otp.net/Otp/OtpSystem.cs
  25. +49 −0 lib/otp.net/Otp/OtpTrace.cs
  26. +7 −7 lib/otp.net/Otp/Test.cs
  27. +17 −0 lib/otp.net/Otp/release_notes.txt
  28. +33 −0 lib/otp.net/OtpTest/Properties/AssemblyInfo.cs
  29. +57 −0 lib/otp.net/OtpTest1/OtpTest1.2008.csproj
  30. +60 −0 lib/otp.net/OtpTest1/OtpTest1.csproj
  31. +128 −0 lib/otp.net/OtpTest1/Test1.cs
486 lib/otp.net/Otp/AbstractConnection.cs
View
@@ -53,41 +53,13 @@ public abstract class AbstractConnection
static AbstractConnection()
{
- {
- // trace this connection?
- System.String trace = "0"; // value "0" to "4"
- try
- {
- if (trace != null)
- defaultLevel = System.Int32.Parse(trace);
- }
- catch (System.FormatException)
- {
- defaultLevel = 0;
- }
- random = new System.Random();
- }
+ random = new System.Random();
}
protected internal const int headerLen = 2048; // more than enough
protected internal static readonly byte passThrough = 0x70;
protected internal static readonly byte version = 0x83;
- // Erlang message header tags
- protected internal const int linkTag = 1;
- protected internal const int sendTag = 2;
- protected internal const int exitTag = 3;
- protected internal const int unlinkTag = 4;
- protected internal const int nodeLinkTag = 5;
- protected internal const int regSendTag = 6;
- protected internal const int groupLeaderTag = 7;
- protected internal const int exit2Tag = 8;
-
- protected internal const int sendTTTag = 12;
- protected internal const int exitTTTag = 13;
- protected internal const int regSendTTTag = 16;
- protected internal const int exit2TTTag = 18;
-
// MD5 challenge messsage tags
protected internal const int ChallengeReply = 'r';
protected internal const int ChallengeAck = 'a';
@@ -107,43 +79,20 @@ static AbstractConnection()
protected internal System.Threading.Thread thread;
// tracelevel constants
- protected internal static int defaultLevel = 0;
- protected internal static int sendThreshold = 1;
- protected internal static int ctrlThreshold = 2;
- protected internal static int handshakeThreshold = 3;
-
- protected internal int _traceLevel;
- public int traceLevel
- {
- get
- {
- return _traceLevel;
- }
- /*
- * <p> Set the trace level for this connection. Normally tracing is
- * off by default unless System property OtpConnection.trace was
- * set. </p>
- *
- * <p> The following levels are valid: 0 turns off tracing
- * completely, 1 shows ordinary send and receive messages, 2 shows
- * control messages such as link and unlink, 3 shows handshaking at
- * connection setup, and 4 shows communication with Epmd. Each level
- * includes the information shown by the lower ones. </p>
- *
- **/
- set
- {
- int oldLevel = _traceLevel;
-
- // pin the value
- if (value < 0)
- _traceLevel = 0;
- else if (value > 4)
- _traceLevel = 4;
- else
- _traceLevel = value;
- }
- }
+
+ /*
+ * <p> Set the trace level for this connection. Normally tracing is
+ * off by default unless System property OtpConnection.trace was
+ * set. </p>
+ *
+ * <p> The following levels are valid: 0 turns off tracing
+ * completely, 1 shows ordinary send and receive messages, 2 shows
+ * control messages such as link and unlink, 3 shows handshaking at
+ * connection setup, and 4 shows communication with Epmd. Each level
+ * includes the information shown by the lower ones. </p>
+ *
+ **/
+ public static OtpTrace.Type traceLevel = OtpTrace.traceLevel;
protected internal static System.Random random = null;
@@ -161,22 +110,24 @@ protected internal AbstractConnection(OtpLocalNode self, System.Net.Sockets.TcpC
this.self = self;
this.peer = new OtpPeer();
this.socket = s;
-
+
this.socket.NoDelay = true;
-
- this.traceLevel = defaultLevel;
+ // Use keepalive timer
+ this.socket.Client.SetSocketOption(
+ System.Net.Sockets.SocketOptionLevel.Socket,
+ System.Net.Sockets.SocketOptionName.KeepAlive, true);
+ // Close socket gracefully
+ this.socket.Client.SetSocketOption(
+ System.Net.Sockets.SocketOptionLevel.Socket,
+ System.Net.Sockets.SocketOptionName.DontLinger, true);
- if (traceLevel >= handshakeThreshold)
+ //this.socket.ReceiveTimeout = 5000;
+
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("<- ACCEPT FROM ?");
-/*
- System.Net.Sockets.Socket sock = s.Client;
- //UPGRADE_TODO: Expression C#.net.Socket.getInetAddress could not be converted.;
- //UPGRADE_TODO: Expression C#.net.Socket.getPort could not be converted.;
- System.Console.Out.WriteLine("<- ACCEPT FROM " +
- IPAddress.Parse(((IPEndPoint)s.RemoteEndPoint).Address.ToString())+ ":" +
- ((IPEndPoint)s.RemoteEndPoint).Port.ToString());
-*/
+ OtpTrace.TraceEvent("<- ACCEPT FROM " +
+ System.Net.IPAddress.Parse(s.Client.RemoteEndPoint.ToString()).ToString() + ":" +
+ (s.Client.RemoteEndPoint as System.Net.IPEndPoint).Port.ToString());
}
// get his info
@@ -208,7 +159,6 @@ protected internal AbstractConnection(OtpLocalNode self, OtpPeer other)
this.socket = null;
int port;
- this.traceLevel = defaultLevel;
//this.IsBackground = true;
// now get a connection between the two...
@@ -263,7 +213,7 @@ protected internal virtual void sendBuf(Erlang.Pid from, System.String dest, Ot
// header info
header.write_tuple_head(4);
- header.write_long(regSendTag);
+ header.write_long((long)OtpMsg.Tag.regSendTag);
header.write_any(from);
if (sendCookie)
header.write_atom(self.cookie());
@@ -304,7 +254,7 @@ protected internal virtual void sendBuf(Erlang.Pid from, Erlang.Pid dest, OtpOu
// header info
header.write_tuple_head(3);
- header.write_long(sendTag);
+ header.write_long((long)OtpMsg.Tag.sendTag);
if (sendCookie)
header.write_atom(self.cookie());
else
@@ -336,7 +286,7 @@ private void cookieError(OtpLocalNode local, Erlang.Atom cookie)
header.write1(version);
header.write_tuple_head(4);
- header.write_long(regSendTag);
+ header.write_long((long)OtpMsg.Tag.regSendTag);
header.write_any(local.createPid()); // disposable pid
header.write_atom(cookie.atomValue()); // important: his cookie, not mine...
header.write_atom("auth");
@@ -407,7 +357,7 @@ protected internal virtual void sendLink(Erlang.Pid from, Erlang.Pid dest)
// header
header.write_tuple_head(3);
- header.write_long(linkTag);
+ header.write_long((long)OtpMsg.Tag.linkTag);
header.write_any(from);
header.write_any(dest);
@@ -442,7 +392,7 @@ protected internal virtual void sendUnlink(Erlang.Pid from, Erlang.Pid dest)
// header
header.write_tuple_head(3);
- header.write_long(unlinkTag);
+ header.write_long((long)OtpMsg.Tag.unlinkTag);
header.write_any(from);
header.write_any(dest);
@@ -455,7 +405,7 @@ protected internal virtual void sendUnlink(Erlang.Pid from, Erlang.Pid dest)
/*used internally when "processes" terminate */
protected internal virtual void sendExit(Erlang.Pid from, Erlang.Pid dest, System.String reason)
{
- sendExit(exitTag, from, dest, reason);
+ sendExit((int)OtpMsg.Tag.exitTag, from, dest, reason);
}
/*
@@ -469,7 +419,7 @@ protected internal virtual void sendExit(Erlang.Pid from, Erlang.Pid dest, Syst
**/
protected internal virtual void sendExit2(Erlang.Pid from, Erlang.Pid dest, System.String reason)
{
- sendExit(exit2Tag, from, dest, reason);
+ sendExit((int)OtpMsg.Tag.exit2Tag, from, dest, reason);
}
private void sendExit(int tag, Erlang.Pid from, Erlang.Pid dest, System.String reason)
@@ -523,7 +473,10 @@ public virtual void Start()
{
// read 4 bytes - get length of incoming packet
// socket.getInputStream().read(lbuf);
- readSock(socket, lbuf);
+ int n;
+ if ((n = readSock(socket, lbuf)) < lbuf.Length)
+ throw new System.Exception("Read " + n + " out of " + lbuf.Length + " bytes!");
+
ibuf = new OtpInputStream(lbuf);
len = ibuf.read4BE();
@@ -543,7 +496,10 @@ public virtual void Start()
// got a real message (maybe) - read len bytes
byte[] tmpbuf = new byte[len];
// i = socket.getInputStream().read(tmpbuf);
- readSock(socket, tmpbuf);
+ int m = readSock(socket, tmpbuf);
+ if (m < len)
+ throw new System.Exception("Read " + m + " out of " + len + " bytes!");
+
ibuf = new OtpInputStream(tmpbuf);
if (ibuf.read1() != passThrough)
@@ -559,7 +515,7 @@ public virtual void Start()
Erlang.Atom toName;
Erlang.Pid to;
Erlang.Pid from;
- int tag;
+ Erlang.Ref eref;
// decode the header
tmp = ibuf.read_any();
@@ -575,12 +531,12 @@ public virtual void Start()
}
// lets see what kind of message this is
- tag = (int) ((Erlang.Long) (head.elementAt(0))).longValue();
+ OtpMsg.Tag tag = (OtpMsg.Tag)((Erlang.Long)(head.elementAt(0))).longValue();
switch (tag)
{
- case sendTag:
- case sendTTTag:
+ case OtpMsg.Tag.sendTag:
+ case OtpMsg.Tag.sendTTTag:
// { SEND, Cookie, ToPid, TraceToken }
if (!cookieOk)
{
@@ -607,18 +563,18 @@ public virtual void Start()
cookieOk = true;
}
- if (traceLevel >= sendThreshold)
+ if (traceLevel >= OtpTrace.Type.sendThreshold)
{
- System.Console.Out.WriteLine("<- " + headerType(head) + " " + head.ToString());
+ OtpTrace.TraceEvent("<- " + headerType(head) + " " + head.ToString());
/*show received payload too */
long mark = ibuf.Position;
traceobj = ibuf.read_any();
if (traceobj != null)
- System.Console.Out.WriteLine(" " + traceobj.ToString());
+ OtpTrace.TraceEvent(" " + traceobj.ToString());
else
- System.Console.Out.WriteLine(" (null)");
+ OtpTrace.TraceEvent(" (null)");
ibuf.Seek(mark, System.IO.SeekOrigin.Begin);
}
@@ -627,8 +583,8 @@ public virtual void Start()
deliver(new OtpMsg(to, ibuf));
break;
- case regSendTag:
- case regSendTTTag:
+ case OtpMsg.Tag.regSendTag:
+ case OtpMsg.Tag.regSendTTTag:
// { REG_SEND, FromPid, Cookie, ToName, TraceToken }
if (!cookieOk)
{
@@ -654,19 +610,19 @@ public virtual void Start()
}
cookieOk = true;
}
-
- if (traceLevel >= sendThreshold)
+
+ if (traceLevel >= OtpTrace.Type.sendThreshold)
{
- System.Console.Out.WriteLine("<- " + headerType(head) + " " + head.ToString());
+ OtpTrace.TraceEvent("<- " + headerType(head) + " " + head.ToString());
/*show received payload too */
long mark = ibuf.Position;
traceobj = ibuf.read_any();
if (traceobj != null)
- System.Console.Out.WriteLine(" " + traceobj.ToString());
+ OtpTrace.TraceEvent(" " + traceobj.ToString());
else
- System.Console.Out.WriteLine(" (null)");
+ OtpTrace.TraceEvent(" (null)");
ibuf.Seek(mark, System.IO.SeekOrigin.Begin);
}
@@ -676,16 +632,16 @@ public virtual void Start()
deliver(new OtpMsg(from, toName.atomValue(), ibuf));
break;
- case exitTag:
- case exit2Tag:
+ case OtpMsg.Tag.exitTag:
+ case OtpMsg.Tag.exit2Tag:
// { EXIT2, FromPid, ToPid, Reason }
if (!(head.elementAt(3) is Erlang.Atom))
{
goto receive_loop_brk;
}
- if (traceLevel >= ctrlThreshold)
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
{
- System.Console.Out.WriteLine("<- " + headerType(head) + " " + head.ToString());
+ OtpTrace.TraceEvent("<- " + headerType(head) + " " + head.ToString());
}
from = (Erlang.Pid) (head.elementAt(1));
@@ -695,17 +651,17 @@ public virtual void Start()
deliver(new OtpMsg(tag, from, to, reason));
break;
- case exitTTTag:
- case exit2TTTag:
+ case OtpMsg.Tag.exitTTTag:
+ case OtpMsg.Tag.exit2TTTag:
// { EXIT2, FromPid, ToPid, TraceToken, Reason }
// as above, but bifferent element number
if (!(head.elementAt(4) is Erlang.Atom))
{
goto receive_loop_brk;
}
- if (traceLevel >= ctrlThreshold)
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
{
- System.Console.Out.WriteLine("<- " + headerType(head) + " " + head.ToString());
+ OtpTrace.TraceEvent("<- " + headerType(head) + " " + head.ToString());
}
from = (Erlang.Pid) (head.elementAt(1));
@@ -715,12 +671,12 @@ public virtual void Start()
deliver(new OtpMsg(tag, from, to, reason));
break;
- case linkTag:
- case unlinkTag:
+ case OtpMsg.Tag.linkTag:
+ case OtpMsg.Tag.unlinkTag:
// { UNLINK, FromPid, ToPid}
- if (traceLevel >= ctrlThreshold)
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
{
- System.Console.Out.WriteLine("<- " + headerType(head) + " " + head.ToString());
+ OtpTrace.TraceEvent("<- " + headerType(head) + " " + head.ToString());
}
from = (Erlang.Pid) (head.elementAt(1));
@@ -730,18 +686,49 @@ public virtual void Start()
break;
// absolutely no idea what to do with these, so we ignore them...
- case groupLeaderTag:
- case nodeLinkTag:
+ case OtpMsg.Tag.groupLeaderTag:
+ case OtpMsg.Tag.nodeLinkTag:
// { NODELINK }
// (just show trace)
- if (traceLevel >= ctrlThreshold)
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
{
- System.Console.Out.WriteLine("<- " + headerType(head) + " " + head.ToString());
+ OtpTrace.TraceEvent("<- " + headerType(head) + " " + head.ToString());
}
break;
+ case OtpMsg.Tag.monitorPTag:
+ // {MONITOR_P, FromPid, ToProc, Ref}
+ case OtpMsg.Tag.demonitorPTag:
+ // {DEMONITOR_P, FromPid, ToProc, Ref}
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
+ {
+ OtpTrace.TraceEvent("<- " + headerType(head) + " " + head.ToString());
+ }
+ from = (Erlang.Pid)(head.elementAt(1));
+ to = (Erlang.Pid)(head.elementAt(2));
+ eref = (Erlang.Ref)(head.elementAt(3));
+ deliver(new OtpMsg(tag, from, to, eref));
+ break;
+
+ case OtpMsg.Tag.monitorPexitTag:
+ // {MONITOR_P_EXIT, FromPid, ToProc, Ref, Reason}
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
+ {
+ OtpTrace.TraceEvent("<- " + headerType(head) + " " + head.ToString());
+ }
+ from = (Erlang.Pid)(head.elementAt(1));
+ to = (Erlang.Pid)(head.elementAt(2));
+ eref = (Erlang.Ref)(head.elementAt(3));
+
+ deliver(new OtpMsg(tag, from, to, eref, reason));
+ break;
+
default:
// garbage?
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
+ {
+ OtpTrace.TraceEvent("<- Unknown tag " + headerType(head) + " " + head.ToString());
+ }
goto receive_loop_brk;
}
}
@@ -757,18 +744,19 @@ public virtual void Start()
{
deliver(e);
}
- catch (Erlang.DecodeException)
+ catch (Erlang.DecodeException e)
{
- deliver(new Erlang.Exit("Remote is sending garbage"));
+ OtpTrace.TraceEvent(e.ToString());
+ deliver(new Erlang.Exit("Remote is sending garbage: " + e.ToString()));
}
- catch (System.IO.IOException)
+ catch (System.Exception e)
{
- deliver(new Erlang.Exit("Remote has closed connection"));
+ deliver(new Erlang.Exit("Remote has closed connection: " + e.ToString()));
}
finally
{
close();
- System.Console.Out.WriteLine("exit connection "+System.Threading.Thread.CurrentThread.Name);
+ OtpTrace.TraceEvent("exit connection "+System.Threading.Thread.CurrentThread.Name);
}
}
@@ -785,15 +773,15 @@ public virtual void close()
{
if (socket != null)
{
- if (traceLevel >= ctrlThreshold)
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
{
- System.Console.Out.WriteLine("-> CLOSE");
+ OtpTrace.TraceEvent("-> CLOSE");
}
socket.Close();
//thread.Interrupt();
}
}
- catch (System.IO.IOException)
+ catch (System.Net.Sockets.SocketException)
{
/*ignore socket close errors */
}
@@ -821,7 +809,95 @@ public virtual bool isConnected()
{
return connected;
}
-
+
+ /*
+ * Send an RPC request to the remote Erlang node. This convenience
+ * function creates the following message and sends it to 'rex' on
+ * the remote node:
+ *
+ * <pre>
+ * { self, { call, Mod, Fun, Args, user }}
+ * </pre>
+ *
+ * <p> Note that this method has unpredicatble results if the remote
+ * node is not an Erlang node. </p>
+ *
+ * @param mod the name of the Erlang module containing the function to be called.
+ * @param fun the name of the function to call.
+ * @param args a list of Erlang terms, to be used as arguments to the function.
+ *
+ * @exception C#.io.IOException if the connection is not active
+ * or a communication error occurs.
+ **/
+ public virtual void sendRPC(Erlang.Pid from, System.String mod, System.String fun, Erlang.List args)
+ {
+ Erlang.Object rpc = encodeRPC(from, mod, fun, args, new Erlang.Atom("user"));
+ sendBuf(from, "rex", new OtpOutputStream(rpc));
+ }
+
+ internal static Erlang.Tuple encodeRPC(
+ Erlang.Pid from, string mod, string fun, Erlang.List args, Erlang.Object gleader)
+ {
+ return encodeRPC(from, new Erlang.Atom(mod), new Erlang.Atom(fun), args, gleader);
+ }
+
+ internal static Erlang.Tuple encodeRPC(
+ Erlang.Pid from, Erlang.Atom mod, Erlang.Atom fun, Erlang.List args, Erlang.Object gleader)
+ {
+ /*{self, { call, Mod, Fun, Args, user}} */
+ return new Erlang.Tuple(
+ from,
+ new Erlang.Tuple(new Erlang.Atom("call"), mod, fun, args, gleader)
+ );
+ }
+
+ internal static Erlang.Object decodeRPC(Erlang.Object msg)
+ {
+ if (msg is Erlang.Tuple)
+ {
+ Erlang.Tuple t = (Erlang.Tuple)msg;
+ if (t.arity() == 2)
+ {
+ Erlang.Atom rex = t[0] as Erlang.Atom;
+ if (rex != null && rex.atomValue() == "rex")
+ return t[1];
+ // obs: second element
+ }
+ }
+ return null;
+ }
+
+ internal static string decodeIO(Erlang.Object msg)
+ {
+ if (msg is Erlang.Tuple)
+ {
+ Erlang.Tuple t = (Erlang.Tuple)msg;
+ if (t.arity() == 4)
+ {
+ Erlang.Atom ios = t[0] as Erlang.Atom;
+ Erlang.Tuple data = t[3] as Erlang.Tuple;
+ if (ios != null && ios.atomValue() == "io_request" && data != null)
+ {
+ if ((data[0] as Erlang.Atom).atomValue() == "put_chars")
+ {
+ if (data[1] is Erlang.String)
+ return (data[1] as Erlang.String).stringValue();
+ else if (data[1] is Erlang.Binary)
+ {
+ byte[] bin = (data[1] as Erlang.Binary).binaryValue();
+ char[] s = new char[bin.Length];
+ bin.CopyTo(s, 0);
+ return new string(s);
+ }
+ else
+ return data[1].ToString();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
// used by send and send_reg (message types with payload)
protected internal virtual void do_send(OtpOutputStream header, OtpOutputStream payload)
{
@@ -829,28 +905,33 @@ protected internal virtual void do_send(OtpOutputStream header, OtpOutputStream
{
try
{
- if (traceLevel >= sendThreshold)
+ if (traceLevel >= OtpTrace.Type.sendThreshold)
{
// Need to decode header and output buffer to show trace message!
// First make OtpInputStream, then decode.
try
{
Erlang.Object h = (header.getOtpInputStream(5)).read_any();
- System.Console.Out.WriteLine("-> " + headerType(h) + " " + h.ToString());
+ OtpTrace.TraceEvent("-> " + headerType(h) + " " + h.ToString());
Erlang.Object o = (payload.getOtpInputStream(0)).read_any();
- System.Console.Out.WriteLine(" " + o.ToString());
+ OtpTrace.TraceEvent(" " + o.ToString());
o = null;
}
catch (Erlang.DecodeException e)
{
- System.Console.Out.WriteLine(" " + "can't decode output buffer:" + e);
+ OtpTrace.TraceEvent(" " + "can't decode output buffer:" + e);
}
}
header.writeTo((System.IO.Stream) socket.GetStream());
payload.writeTo((System.IO.Stream) socket.GetStream());
}
+ catch (System.Net.Sockets.SocketException e)
+ {
+ close();
+ throw e;
+ }
catch (System.IO.IOException e)
{
close();
@@ -866,20 +947,25 @@ protected internal virtual void do_send(OtpOutputStream header)
{
try
{
- if (traceLevel >= ctrlThreshold)
+ if (traceLevel >= OtpTrace.Type.ctrlThreshold)
{
try
{
Erlang.Object h = (header.getOtpInputStream(5)).read_any();
- System.Console.Out.WriteLine("-> " + headerType(h) + " " + h);
+ OtpTrace.TraceEvent("-> " + headerType(h) + " " + h);
}
catch (Erlang.DecodeException e)
{
- System.Console.Out.WriteLine(" " + "can't decode output buffer: " + e);
+ OtpTrace.TraceEvent(" " + "can't decode output buffer: " + e);
}
}
header.writeTo((System.IO.Stream) socket.GetStream());
}
+ catch (System.Net.Sockets.SocketException e)
+ {
+ close();
+ throw e;
+ }
catch (System.IO.IOException e)
{
close();
@@ -890,50 +976,59 @@ protected internal virtual void do_send(OtpOutputStream header)
protected internal virtual System.String headerType(Erlang.Object h)
{
- int tag = - 1;
+ OtpMsg.Tag tag = OtpMsg.Tag.undefined;
if (h is Erlang.Tuple)
{
- tag = (int) (((Erlang.Long) (((Erlang.Tuple) h).elementAt(0))).longValue());
+ tag = (OtpMsg.Tag) (((Erlang.Long) (((Erlang.Tuple) h).elementAt(0))).longValue());
}
switch (tag)
{
- case linkTag:
+ case OtpMsg.Tag.linkTag:
return "LINK";
- case sendTag:
+ case OtpMsg.Tag.sendTag:
return "SEND";
- case exitTag:
+ case OtpMsg.Tag.exitTag:
return "EXIT";
- case unlinkTag:
+ case OtpMsg.Tag.unlinkTag:
return "UNLINK";
- case nodeLinkTag:
+ case OtpMsg.Tag.nodeLinkTag:
return "NODELINK";
- case regSendTag:
+ case OtpMsg.Tag.regSendTag:
return "REG_SEND";
- case groupLeaderTag:
+ case OtpMsg.Tag.groupLeaderTag:
return "GROUP_LEADER";
- case exit2Tag:
+ case OtpMsg.Tag.exit2Tag:
return "EXIT2";
- case sendTTTag:
+ case OtpMsg.Tag.sendTTTag:
return "SEND_TT";
- case exitTTTag:
+ case OtpMsg.Tag.exitTTTag:
return "EXIT_TT";
- case regSendTTTag:
+ case OtpMsg.Tag.regSendTTTag:
return "REG_SEND_TT";
- case exit2TTTag:
+ case OtpMsg.Tag.exit2TTTag:
return "EXIT2_TT";
+
+ case OtpMsg.Tag.monitorPTag:
+ return "MONITOR_P";
+
+ case OtpMsg.Tag.demonitorPTag:
+ return "DEMONITOR_P";
+
+ case OtpMsg.Tag.monitorPexitTag:
+ return "MONITOR_P_EXIT";
}
return "(unknown type)";
}
@@ -946,22 +1041,26 @@ protected internal virtual int readSock(System.Net.Sockets.TcpClient s, byte[] b
int i;
System.IO.Stream is_Renamed = null;
- lock(this)
+ lock (this)
{
if (s == null)
{
throw new System.IO.IOException("expected " + len + " bytes, socket was closed");
}
- is_Renamed = (System.IO.Stream) s.GetStream();
+ is_Renamed = (System.IO.Stream)s.GetStream();
}
-
- while (got < len)
+
+ while (got < len && is_Renamed.CanRead)
{
i = is_Renamed.Read(b, got, len - got);
-
+
if (i < 0)
{
- throw new System.IO.IOException("expected " + len + " bytes, got EOF after " + got + " bytes");
+ throw new System.IO.IOException("Expected " + len + " bytes, got EOF after " + got + " bytes");
+ }
+ else if (i == 0)
+ {
+ throw new System.IO.IOException("Remote connection closed");
}
else
got += i;
@@ -983,10 +1082,10 @@ protected internal virtual void doAccept()
cookieOk = true;
sendCookie = false;
}
- catch (System.IO.IOException ie)
+ catch (System.Net.Sockets.SocketException ie)
{
close();
- throw ie;
+ throw new System.IO.IOException(ie.ToString());
}
catch (OtpAuthException ae)
{
@@ -999,8 +1098,8 @@ protected internal virtual void doAccept()
close();
throw new System.IO.IOException("Error accepting connection from " + nn);
}
- if (traceLevel >= handshakeThreshold)
- System.Console.Out.WriteLine("<- MD5 ACCEPTED " + peer.host());
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
+ OtpTrace.TraceEvent("<- MD5 ACCEPTED " + peer.host());
}
protected internal virtual void doConnect(int port)
@@ -1012,8 +1111,8 @@ protected internal virtual void doConnect(int port)
Debug.WriteLine("-> MD5 CONNECT TO " + peer.host() + ": " + port);
- if (traceLevel >= handshakeThreshold)
- System.Console.Out.WriteLine("-> MD5 CONNECT TO " + peer.host() + ":" + port);
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
+ OtpTrace.TraceEvent("-> MD5 CONNECT TO " + peer.host() + ":" + port);
sendName(peer.distChoose, self.flags);
recvStatus();
int her_challenge = recvChallenge();
@@ -1029,11 +1128,11 @@ protected internal virtual void doConnect(int port)
close();
throw ae;
}
- //catch (System.Exception)
- //{
- // close();
- // throw new System.IO.IOException("Cannot connect to peer node");
- //}
+ catch (System.Net.Sockets.SocketException e)
+ {
+ close();
+ throw new System.IO.IOException("Cannot connect to peer node: " + e.ToString());
+ }
}
// This is nooo good as a challenge,
@@ -1128,9 +1227,9 @@ protected internal virtual void sendName(int dist, int flags)
obuf.writeTo((System.IO.Stream) socket.GetStream());
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("-> " + "HANDSHAKE sendName" + " flags=" + flags + " dist=" + dist + " local=" + self);
+ OtpTrace.TraceEvent("-> " + "HANDSHAKE sendName" + " flags=" + flags + " dist=" + dist + " local=" + self);
}
}
@@ -1160,9 +1259,9 @@ protected internal virtual void sendChallenge(int dist, int flags, int challeng
obuf.writeTo((System.IO.Stream) socket.GetStream());
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("-> " + "HANDSHAKE sendChallenge" + " flags=" + flags + " dist=" + dist + " challenge=" + challenge + " local=" + self);
+ OtpTrace.TraceEvent("-> " + "HANDSHAKE sendChallenge" + " flags=" + flags + " dist=" + dist + " challenge=" + challenge + " local=" + self);
}
}
@@ -1227,9 +1326,6 @@ protected internal virtual void recvName(OtpPeer peer)
{
throw new System.IO.IOException("Handshake failed - peer cannot handle extended pids and ports");
}
-
-
-
}
catch (Erlang.DecodeException)
{
@@ -1242,10 +1338,9 @@ protected internal virtual void recvName(OtpPeer peer)
peer._alive = hisname.Substring(0, (i) - (0));
peer._host = hisname.Substring(i + 1, (hisname.Length) - (i + 1));
-
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("<- " + "HANDSHAKE" + " ntype=" + peer.ntype + " dist=" + peer._distHigh + " remote=" + peer);
+ OtpTrace.TraceEvent("<- " + "HANDSHAKE" + " ntype=" + peer.ntype + " dist=" + peer._distHigh + " remote=" + peer);
}
}
@@ -1282,9 +1377,9 @@ protected internal virtual int recvChallenge()
throw new System.IO.IOException("Handshake failed - not enough data");
}
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("<- " + "HANDSHAKE recvChallenge" + " from=" + peer._node + " challenge=" + challenge + " local=" + self);
+ OtpTrace.TraceEvent("<- " + "HANDSHAKE recvChallenge" + " from=" + peer._node + " challenge=" + challenge + " local=" + self);
}
return challenge;
@@ -1300,9 +1395,9 @@ protected internal virtual void sendChallengeReply(int challenge, byte[] digest
obuf.write(digest);
obuf.writeTo((System.IO.Stream) socket.GetStream());
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("-> " + "HANDSHAKE sendChallengeReply" + " challenge=" + challenge + " digest=" + hex(digest) + " local=" + self);
+ OtpTrace.TraceEvent("-> " + "HANDSHAKE sendChallengeReply" + " challenge=" + challenge + " digest=" + hex(digest) + " local=" + self);
}
}
@@ -1344,9 +1439,9 @@ protected internal virtual int recvChallengeReply(int our_challenge)
throw new System.IO.IOException("Handshake failed - not enough data");
}
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("<- " + "HANDSHAKE recvChallengeReply" + " from=" + peer._node + " challenge=" + challenge + " digest=" + hex(her_digest) + " local=" + self);
+ OtpTrace.TraceEvent("<- " + "HANDSHAKE recvChallengeReply" + " from=" + peer._node + " challenge=" + challenge + " digest=" + hex(her_digest) + " local=" + self);
}
return challenge;
@@ -1362,9 +1457,9 @@ protected internal virtual void sendChallengeAck(byte[] digest)
obuf.writeTo((System.IO.Stream) socket.GetStream());
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("-> " + "HANDSHAKE sendChallengeAck" + " digest=" + hex(digest) + " local=" + self);
+ OtpTrace.TraceEvent("-> " + "HANDSHAKE sendChallengeAck" + " digest=" + hex(digest) + " local=" + self);
}
}
@@ -1397,9 +1492,9 @@ protected internal virtual void recvChallengeAck(int our_challenge)
throw new OtpAuthException("Peer authentication error.");
}
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("<- " + "HANDSHAKE recvChallengeAck" + " from=" + peer._node + " digest=" + hex(her_digest) + " local=" + self);
+ OtpTrace.TraceEvent("<- " + "HANDSHAKE recvChallengeAck" + " from=" + peer._node + " digest=" + hex(her_digest) + " local=" + self);
}
}
@@ -1425,15 +1520,15 @@ protected internal virtual void sendStatus(System.String status)
obuf.writeTo((System.IO.Stream) socket.GetStream());
- if (traceLevel >= handshakeThreshold)
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("-> " + "HANDSHAKE sendStatus" + " status=" + status + " local=" + self);
+ OtpTrace.TraceEvent("-> " + "HANDSHAKE sendStatus" + " status=" + status + " local=" + self);
}
}
protected internal virtual void recvStatus()
{
-
+
try
{
byte[] buf = read2BytePackage();
@@ -1449,7 +1544,7 @@ protected internal virtual void recvStatus()
tmpChar = new char[tmpbuf.Length];
tmpbuf.CopyTo(tmpChar, 0);
System.String status = new System.String(tmpChar);
-
+
if (status.CompareTo("ok") != 0)
{
throw new System.IO.IOException("Peer replied with status '" + status + "' instead of 'ok'");
@@ -1459,9 +1554,14 @@ protected internal virtual void recvStatus()
{
throw new System.IO.IOException("Handshake failed - not enough data");
}
- if (traceLevel >= handshakeThreshold)
+ catch (System.Net.Sockets.SocketException e)
+ {
+ throw new System.IO.IOException("Peer dropped connection: " + e.ToString());
+ }
+
+ if (traceLevel >= OtpTrace.Type.handshakeThreshold)
{
- System.Console.Out.WriteLine("<- " + "HANDSHAKE recvStatus (ok)" + " local=" + self);
+ OtpTrace.TraceEvent("<- " + "HANDSHAKE recvStatus (ok)" + " local=" + self);
}
}
121 lib/otp.net/Otp/AbstractNode.cs
View
@@ -57,8 +57,8 @@ public class AbstractNode
{
private void InitBlock()
{
- ntype = NTYPE_R6;
- flags = dFlagExtendedReferences | dFlagExtendedPidsPorts;
+ //ntype = NTYPE_R6;
+ //flags = dFlagExtendedReferences | dFlagExtendedPidsPorts;
}
static AbstractNode()
{
@@ -78,34 +78,40 @@ static AbstractNode()
}
catch
{
- defaultCookie = string.Empty;
+ defaultCookie = null;
+ }
+
+ if (defaultCookie == null)
+ {
+ System.String dotCookieFilename = System.Environment.GetEnvironmentVariable("HOME")
+ + System.IO.Path.DirectorySeparatorChar
+ + ".erlang.cookie";
+ System.IO.StreamReader br = null;
+ try
+ {
+ System.IO.FileInfo dotCookieFile = new System.IO.FileInfo(dotCookieFilename);
+ br = new System.IO.StreamReader(new System.IO.StreamReader(dotCookieFile.FullName).BaseStream);
+ defaultCookie = br.ReadLine().Trim();
+ }
+ catch (System.IO.IOException)
+ {
+ defaultCookie = null;
+ }
+ finally
+ {
+ try
+ {
+ if (br != null)
+ br.Close();
+ }
+ catch (System.IO.IOException)
+ {
+ }
+ }
}
- //System.String dotCookieFilename = System.Environment.GetEnvironmentVariable("HOME")
- // + System.IO.Path.DirectorySeparatorChar
- // + ".erlang.cookie";
- //System.IO.StreamReader br = null;
- //try
- //{
- // System.IO.FileInfo dotCookieFile = new System.IO.FileInfo(dotCookieFilename);
- // br = new System.IO.StreamReader(new System.IO.StreamReader(dotCookieFile.FullName).BaseStream);
- // defaultCookie = br.ReadLine().Trim();
- //}
- //catch (System.IO.IOException)
- //{
- // defaultCookie = "";
- //}
- //finally
- //{
- // try
- // {
- // if (br != null)
- // br.Close();
- // }
- // catch (System.IO.IOException)
- // {
- // }
- //}
+ if (defaultCookie == null)
+ defaultCookie = string.Empty;
}
}
internal static System.String localHost = null;
@@ -113,15 +119,17 @@ static AbstractNode()
internal System.String _host;
internal System.String _alive;
internal System.String _cookie;
- internal static System.String defaultCookie = null;
-
+ internal System.String _longName;
+ public static string defaultCookie = null;
+ public static bool useShortNames = false;
+
// Node types
internal const int NTYPE_R6 = 110; // 'n' post-r5, all nodes
internal const int NTYPE_R4_ERLANG = 109;
// 'm' Only for source compatibility
internal const int NTYPE_R4_HIDDEN = 104;
// 'h' Only for source compatibility
-
+
// Node capability flags
internal const int dFlagPublished = 1;
internal const int dFlagAtomCache = 2;
@@ -129,13 +137,16 @@ static AbstractNode()
internal const int dFlagDistMonitor = 8;
internal const int dFlagFunTags = 16;
internal const int dFlagExtendedPidsPorts = 256; // pshaffer
+ internal const int dFlagBitBinaries = 1024;
+ internal const int dFlagNewFloats = 2048;
internal int ntype = NTYPE_R6; // pshaffer
internal int _proto = 0; // tcp/ip
internal int _distHigh = 5; // Cannot talk to nodes before R6
internal int _distLow = 5; // Cannot talk to nodes before R6
internal int _creation = 0;
- internal int flags = dFlagExtendedReferences | dFlagExtendedPidsPorts; // pshaffer
+ internal int flags = dFlagExtendedReferences | dFlagExtendedPidsPorts
+ | dFlagBitBinaries | dFlagNewFloats | dFlagDistMonitor; // pshaffer
/*initialize hostname and default cookie */
protected internal AbstractNode()
@@ -146,19 +157,20 @@ protected internal AbstractNode()
/*
* Create a node with the given name and the default cookie.
**/
- protected internal AbstractNode(System.String node):this(node, defaultCookie)
+ protected internal AbstractNode(System.String node)
+ : this(node, defaultCookie, false)
{
}
-
+
/*
* Create a node with the given name and cookie.
**/
- protected internal AbstractNode(System.String name, System.String cookie)
+ protected internal AbstractNode(System.String name, System.String cookie, bool shortName)
{
InitBlock();
this._cookie = cookie;
-
- int i = name.IndexOf((System.Char) '@', 0);
+
+ int i = name.IndexOf((System.Char)'@', 0);
if (i < 0)
{
_alive = name;
@@ -169,25 +181,46 @@ protected internal AbstractNode(System.String name, System.String cookie)
_alive = name.Substring(0, (i) - (0));
_host = name.Substring(i + 1, (name.Length) - (i + 1));
}
-
+
if (_alive.Length > 0xff)
{
_alive = _alive.Substring(0, (0xff) - (0));
}
-
- _node = _alive + "@" + _host;
+
+ _longName = _alive + "@" + _host;
+ _node = node(_longName, shortName);
}
-
+
+ public static string node(System.String _node, bool _shortName)
+ {
+ if (_shortName || useShortNames)
+ {
+ int i = _node.IndexOf('@');
+ i = i < 0 ? 0 : i + 1;
+ int j = _node.IndexOf((System.Char)'.', i);
+ return (j < 0) ? _node : _node.Substring(0, i + j - 2);
+ }
+ else
+ {
+ return _node;
+ }
+ }
+
/*
* Get the name of this node.
*
* @return the name of the node represented by this object.
**/
- public virtual System.String node()
+ public string node()
{
- return _node;
+ return useShortNames ? _node : _longName;
}
-
+
+ public string nodeLongName()
+ {
+ return _longName;
+ }
+
/*
* Get the hostname part of the nodename. Nodenames are composed of
* two parts, an alivename and a hostname, separated by '@'. This
346 lib/otp.net/Otp/ClassDiagram1.cd
View
@@ -0,0 +1,346 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1">
+ <Font Name="Tahoma" Size="9.75" />
+ <Class Name="Otp.AbstractConnection" Collapsed="true">
+ <Position X="1.75" Y="10.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>AbstractConnection.cs</FileName>
+ <HashCode>KEkAASFAQKMAAUEABEgIcAoABgQEAQEIIYUAEAgIQIU=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.AbstractNode" Collapsed="true">
+ <Position X="11" Y="9.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>AbstractNode.cs</FileName>
+ <HashCode>kQoBIBBAEABCAArEAEAAEAABAUBJAEBAgA4ABCCACAQ=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.GenericQueue" Collapsed="true">
+ <Position X="37.75" Y="0.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>GenericQueue.cs</FileName>
+ <HashCode>AAQACAAAgAAAAAAABCAFQAAAAAAAAAIAAIgAAAAEAgA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Link" Collapsed="true">
+ <Position X="39.5" Y="0.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Link.cs</FileName>
+ <HashCode>AhAAABAAAACAAAAAAAAAAAAEAAAAAAAAQAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Links" Collapsed="true">
+ <Position X="41.25" Y="0.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Links.cs</FileName>
+ <HashCode>AAAgAAAAAAAAABAABAAAAAAAAAAIAAAECQCAAEAAIAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpAuthException" Collapsed="true">
+ <Position X="7.5" Y="8" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpAuthException.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpConnection">
+ <Position X="2.75" Y="11.75" Width="1.75" />
+ <TypeIdentifier>
+ <FileName>OtpConnection.cs</FileName>
+ <HashCode>AAgAAAAAAAEQQAEABABAAEAAAAAAAAAAIAAAECAABEc=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpCookedConnection">
+ <Position X="0.5" Y="11.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpCookedConnection.cs</FileName>
+ <HashCode>AAAAAAAAAAMAQAEAAAAAAAAEAAAIAAAAAIAAgCAABEA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpEpmd" Collapsed="true">
+ <Position X="36" Y="1.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpEpmd.cs</FileName>
+ <HashCode>EJAAAEAAEAAAAAIBAAQAAAEAMqAAAEAAAAAgACAAAAg=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpException" Collapsed="true">
+ <Position X="4" Y="6.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpException.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpExternal" Collapsed="true">
+ <Position X="37.75" Y="1.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpExternal.cs</FileName>
+ <HashCode>AAAAAEhCAACBAAAQAgAABAAACAkAAHAAAAAAAAQAAIg=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpInputStream" Collapsed="true">
+ <Position X="39.5" Y="1.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpInputStream.cs</FileName>
+ <HashCode>GgAAiISACgAAQAEBIAAAIAAAgAAKABQMIAAAAgKBAwg=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpLocalNode">
+ <Position X="13" Y="10.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpLocalNode.cs</FileName>
+ <HashCode>AEAAAAggAAAAQAgAAAAAEAABEAAAIAoAgCIAABACIoA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpMbox">
+ <Position X="17" Y="10.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpMbox.cs</FileName>
+ <HashCode>AAAAAAAAAAEQQAEAgABAAABEAAAMBIAEIIAEECkABEU=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpMsg" Collapsed="true">
+ <Position X="36" Y="2.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpMsg.cs</FileName>
+ <HashCode>AAAAACIACAAAQDAAABAAAggAAAABAAAAAAAAAEBAACA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpNode">
+ <Position X="10.5" Y="12.25" Width="2" />
+ <TypeIdentifier>
+ <FileName>OtpNode.cs</FileName>
+ <HashCode>QABAAAAAACUAAIAAAACBQABBAAAARBIAIIAABAgBAAA=</HashCode>
+ </TypeIdentifier>
+ <NestedTypes>
+ <Class Name="Otp.OtpNode.Mailboxes" Collapsed="true">
+ <TypeIdentifier>
+ <NewMemberFileName>OtpNode.cs</NewMemberFileName>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpNode.Acceptor" Collapsed="true">
+ <TypeIdentifier>
+ <NewMemberFileName>OtpNode.cs</NewMemberFileName>
+ </TypeIdentifier>
+ </Class>
+ </NestedTypes>
+ </Class>
+ <Class Name="Otp.OtpNodeStatus" Collapsed="true">
+ <Position X="37.75" Y="2.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpNodeStatus.cs</FileName>
+ <HashCode>AEAAAAAgAAAAAAQAAAAAAAABEAAAAEAAAAAAAAAAAgA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpOutputStream" Collapsed="true">
+ <Position X="39.5" Y="2.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpOutputStream.cs</FileName>
+ <HashCode>AAAAAAgGKgioegAABIAAAQAIAAAIYAAABSCAIYYIABQ=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpPeer">
+ <Position X="8.75" Y="10.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpPeer.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAgAAAAAIAAAAAAAgAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpSelf">
+ <Position X="15" Y="12.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpSelf.cs</FileName>
+ <HashCode>AIAAAACAEAAAAAIAgAAAAAAAAAAAgAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.OtpSystem" Collapsed="true">
+ <Position X="41.25" Y="2.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>OtpSystem.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAABAAgAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Test" Collapsed="true">
+ <Position X="37.75" Y="3.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Test.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Atom" Collapsed="true">
+ <Position X="8.75" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Atom.cs</FileName>
+ <HashCode>AAAAAEACAAAAgABEhgAACAAAAAAAAoAAACACAAIAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Binary" Collapsed="true">
+ <Position X="13.25" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Binary.cs</FileName>
+ <HashCode>AIAAAEAAAAAIAAAEgKAAAAAAAAAAAIAAAAAAEIAAAAg=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Boolean" Collapsed="true">
+ <Position X="8.75" Y="4.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Boolean.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Byte" Collapsed="true">
+ <Position X="26.75" Y="4.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Byte.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Char" Collapsed="true">
+ <Position X="31.25" Y="4.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Char.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.DecodeException" Collapsed="true">
+ <Position X="0.75" Y="9.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\DecodeException.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Double" Collapsed="true">
+ <Position X="4.25" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Double.cs</FileName>
+ <HashCode>AAAAAEAAAAAAAAAEgAAAAAAAAAAAAIAEAABAACAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.ErlangException" Collapsed="true">
+ <Position X="3" Y="8" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\ErlangException.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Exit" Collapsed="true">
+ <Position X="3" Y="9.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Exit.cs</FileName>
+ <HashCode>AgAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Int" Collapsed="true">
+ <Position X="24.5" Y="4.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Int.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.List" Collapsed="true">
+ <Position X="17.75" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\List.cs</FileName>
+ <HashCode>AAAAAEAAAAAAABAEiABAAABAAgQAAIAAAAAAEAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Long" Collapsed="true">
+ <Position X="25.5" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Long.cs</FileName>
+ <HashCode>AAAAAMAAAgAQAgAEgAAABAAAAAAAAIAAACAAAAAAAEA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Object" Collapsed="true">
+ <Position X="17.75" Y="1.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Object.cs</FileName>
+ <HashCode>AAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Pid" Collapsed="true">
+ <Position X="6.5" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Pid.cs</FileName>
+ <HashCode>AQoAAFAAAAAAAAAEgABAEAAAAEAAAICAAAAAAAAAAgA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Port" Collapsed="true">
+ <Position X="11" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Port.cs</FileName>
+ <HashCode>AQIAAFAAAAAAAAAEgABAAAAAAEAAAIAAAAAAAAAAAgA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.RangeException" Collapsed="true">
+ <Position X="5.25" Y="9.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\RangeException.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Ref" Collapsed="true">
+ <Position X="15.5" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Ref.cs</FileName>
+ <HashCode>AQIAAFAAAAAAAAAEgAAAAAAAAEAAAIAAIIAAEAAAAgA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Short" Collapsed="true">
+ <Position X="29" Y="4.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Short.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.String" Collapsed="true">
+ <Position X="33.5" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\String.cs</FileName>
+ <HashCode>AAAAAEAAAAAAAAAkgAAAAAAAAAAAAKAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.Tuple" Collapsed="true">
+ <Position X="2" Y="3.25" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\Tuple.cs</FileName>
+ <HashCode>AAAAAEAAAAAAABAEiABAAAAAAgQAAIAAAAAAEAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.UInt" Collapsed="true">
+ <Position X="20" Y="4.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\UInt.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Otp.Erlang.UShort" Collapsed="true">
+ <Position X="22.25" Y="4.75" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\UShort.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="BigInteger" Collapsed="true">
+ <Position X="36" Y="0.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\BigInteger.cs</FileName>
+ <HashCode>EAECMIEkgAHQAgAE4AWLp4iCAkIAAJICYgwSAAAAJyA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="SupportClass" Collapsed="true">
+ <Position X="36" Y="3.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>SupportClass.cs</FileName>
+ <HashCode>AAAAQAAAAAAAAAAAAAAAAAAAACBAAAAAAAAAAAAAEAA=</HashCode>
+ </TypeIdentifier>
+ </Class>
+ <Class Name="Amir_Harel.Cloning.BaseObject" Collapsed="true">
+ <Position X="17.75" Y="0.5" Width="1.5" />
+ <TypeIdentifier>
+ <FileName>Erlang\CloneObject.cs</FileName>
+ <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA=</HashCode>
+ </TypeIdentifier>
+ <Lollipop Position="0.2" />
+ </Class>
+</ClassDiagram>
114 lib/otp.net/Otp/Erlang/List.cs
View
@@ -49,70 +49,87 @@ public List()
* Create a list of characters.
*
* @param str the characters from which to create the list.
- **/
+ *
public List(System.String str)
{
- int len = 0;
-
- if (str != null)
- len = str.Length;
-
- if (len > 0)
- {
- this.elems = new Object[len];
-
- for (int i = 0; i < len; i++)
- {
- this.elems[i] = new Char(str[i]);
- }
- }
+ this.elems = new Object[] { new Erlang.String(str) };
}
- /*
* Create a list containing one element.
*
* @param elem the elememet to make the list from.
- **/
+ *
public List(Object elem)
{
this.elems = new Object[1];
elems[0] = elem;
}
-
+ */
+
/*
- * Create a list from an array of arbitrary Erlang terms.
+ * Create a list from an array of arbitrary Erlang terms.
*
* @param elems the array of terms from which to create the list.
- **/
- public List(Object[] elems):this(elems, 0, elems.Length)
- {
- }
-
+ * @param count the number of terms to insert.
+ */
+ public List(Object[] elems): this(elems, 0, elems.Length)
+ {
+ }
+
/*
- * Create a list from an array of arbitrary Erlang terms.
+ * Create a list from an array of arbitrary Erlang terms.
*
* @param elems the array of terms from which to create the list.
* @param start the offset of the first term to insert.
* @param count the number of terms to insert.
- **/
- public List(Object[] elems, int start, int count)
+ */
+ public List(Object[] elems, int start, int count)
{
if ((elems != null) && (count > 0))
{
this.elems = new Object[count];
- Array.Copy(elems, start, this.elems, 0, count);
- }
+ Array.Copy(elems, 0, this.elems, start, count);
+ }
}
-
- /*
- * Create a list from a stream containing an list encoded in Erlang
- * external format.
- *
- * @param buf the stream containing the encoded list.
- *
- * @exception DecodeException if the buffer does not
- * contain a valid external representation of an Erlang list.
- **/
+
+ /*
+ * Create a list from an array of arbitrary Erlang terms.
+ *
+ * @param elems the array of terms from which to create the list.
+ **/
+ public List(params System.Object[] elems)
+ {
+ if ((elems != null) && (elems.Length > 0))
+ {
+ this.elems = new Object[elems.Length];
+
+ for (int i=0; i < elems.Length; i++)
+ {
+ System.Object o = elems[i];
+ if (o is int) this.elems[i] = new Int((int)o);
+ else if (o is string) this.elems[i] = new String((string)o);
+ else if (o is float) this.elems[i] = new Double((float)o);
+ else if (o is double) this.elems[i] = new Double((double)o);
+ else if (o is Erlang.Object) this.elems[i] = (o as Erlang.Object);
+ //else if (o is BigInteger) this.elems[i] = (BigInteger)o;
+ else if (o is uint) this.elems[i] = new UInt((int)o);
+ else if (o is short) this.elems[i] = new Short((short)o);
+ else if (o is ushort) this.elems[i] = new UShort((short)o);
+ else
+ throw new System.ArgumentException("Unknown type of element[" + i + "]: " + o.GetType().ToString());
+ }
+ }
+ }
+
+ /*
+ * Create a list from a stream containing an list encoded in Erlang
+ * external format.
+ *
+ * @param buf the stream containing the encoded list.
+ *
+ * @exception DecodeException if the buffer does not
+ * contain a valid external representation of an Erlang list.
+ **/
public List(OtpInputStream buf)
{
this.elems = null;
@@ -138,7 +155,7 @@ public List(OtpInputStream buf)
*
* @return the number of elements contained in the list.
**/
- public virtual int arity()
+ public int arity()
{
if (elems == null)
return 0;
@@ -155,7 +172,7 @@ public virtual int arity()
* @return the requested element, of null if i is not a valid
* element index.
**/
- public virtual Object elementAt(int i)
+ public Object elementAt(int i)
{
if ((i >= arity()) || (i < 0))
return null;
@@ -167,7 +184,7 @@ public virtual Object elementAt(int i)
*
* @return an array containing all of the list's elements.
**/
- public virtual Object[] elements()
+ public Object[] elements()
{
if (arity() == 0)
return null;
@@ -178,7 +195,18 @@ public virtual Object[] elements()
return res;
}
}
-
+
+ public Object this[int index]
+ {
+ get { return elementAt(index); }
+ set { this.elems[index] = value; }
+ }
+
+ public int Length
+ {
+ get { return this.elems.Length; }
+ }
+
/*
* Get the string representation of the list.
*
60 lib/otp.net/Otp/Erlang/Tuple.cs
View
@@ -39,7 +39,7 @@ public class Tuple:Erlang.Object
*
* @exception C#.lang.IllegalArgumentException if the array is
* empty (null).
- **/
+ *
public Tuple(Object elem)
{
if (elem == null)
@@ -49,7 +49,7 @@ public Tuple(Object elem)
this.elems = new Object[1];
elems[0] = elem;
}
-
+ */
/*
* Create a tuple from an array of terms.
*
@@ -57,11 +57,11 @@ public Tuple(Object elem)
*
* @exception C#.lang.IllegalArgumentException if the array is
* empty (null) or contains null elements.
- **/
+ */
public Tuple(Object[] elems):this(elems, 0, elems.Length)
{
}
-
+
/*
* Create a tuple from an array of terms.
*
@@ -71,7 +71,7 @@ public Tuple(Object[] elems):this(elems, 0, elems.Length)
*
* @exception C#.lang.IllegalArgumentException if the array is
* empty (null) or contains null elements.
- **/
+ */
public Tuple(Object[] elems, int start, int count)
{
if ((elems == null) || (count < 1))
@@ -94,9 +94,48 @@ public Tuple(Object[] elems, int start, int count)
}
}
}
-
+
+ /*
+ * Create a tuple from an array of terms.
+ *
+ * @param elems the array of terms to create the tuple from.
+ * @param start the offset of the first term to insert.
+ * @param count the number of terms to insert.
+ *
+ * @exception C#.lang.IllegalArgumentException if the array is
+ * empty (null) or contains null elements.
+ **/
+ public Tuple(params System.Object[] elems)
+ {
+ if (elems == null)
+ elems = new Object[] {};
+ else
+ {
+ this.elems = new Object[elems.Length];
+ for (int i = 0; i < elems.Length; i++)
+ {
+ if (elems[i] == null)
+ throw new System.ArgumentException("Tuple element cannot be null (element" + i + ")");
+ else
+ {
+ System.Object o = elems[i];
+ if (o is int) this.elems[i] = new Int((int)o);
+ else if (o is string) this.elems[i] = new String((string)o);
+ else if (o is float) this.elems[i] = new Double((float)o);
+ else if (o is double) this.elems[i] = new Double((double)o);
+ else if (o is Erlang.Object) this.elems[i] = (Erlang.Object)o;
+ //else if (o is BigInteger) this.elems[i] = (BigInteger)o;
+ else if (o is uint) this.elems[i] = new UInt((int)o);
+ else if (o is short) this.elems[i] = new Short((short)o);
+ else if (o is ushort) this.elems[i] = new UShort((short)o);
+ else
+ throw new System.ArgumentException("Unknown type of element[" + i + "]: " + o.GetType().ToString());
+ }
+ }
+ }
+ }
/*
- * Create a tuple from a stream containing an tuple encoded in Erlang
+ * Create a tuple from a stream containing an tuple encoded in Erlang
* external format.
*
* @param buf the stream containing the encoded tuple.
@@ -157,7 +196,12 @@ public virtual Object[] elements()
return res;
}
-
+ public Object this[int index]
+ {
+ get { return this.elems[index]; }
+ set { this.elems[index] = value; }
+ }
+
/*
* Get the string representation of the tuple.
*
50 lib/otp.net/Otp/GenericQueue.cs
View
@@ -28,7 +28,7 @@ public class GenericQueue
private const int closing = 1;
private const int closed = 2;
- private int status;
+ private int status = closed;
private Bucket head;
private Bucket tail;
private int count;
@@ -43,20 +43,31 @@ private void init()
/*Create an empty queue */
public GenericQueue()
{
- init();
- status = open;
- }
+ init();
+ status = open;
+ }
/*Clear a queue */
public virtual void flush()
{
+ close();
init();
+ status = open;
}
public virtual void close()
{
status = closing;
- }
+ init();
+ try
+ {
+ System.Threading.Monitor.PulseAll(this);
+ }
+ catch
+ {
+ }
+ status = closed;
+ }
/*Add an object to the tail of the queue.
* @param o Object to insert in the queue
@@ -85,18 +96,13 @@ public virtual void put(System.Object o)
}
}
- /*Retrieve an object from the head of the queue, or block until
- * one arrives.
- *
- * @return The object at the head of the queue.
- */
- public virtual System.Object get()
- {
+ private System.Object get(bool once)
+ {
lock(this)
{
System.Object o = null;
- while ((o = tryGet()) == null)
+ while ((o = tryGet()) == null && !once && status == open)
{
try
{
@@ -109,6 +115,15 @@ public virtual System.Object get()
}
return o;
}
+ }
+ /*Retrieve an object from the head of the queue, or block until
+ * one arrives.
+ *
+ * @return The object at the head of the queue.
+ */
+ public virtual System.Object get()
+ {
+ return get(false);
}
/*Retrieve an object from the head of the queue, blocking until
@@ -122,9 +137,14 @@ public virtual System.Object get()
*/
public virtual System.Object get(long timeout)
{
+ if (timeout == -1)
+ return get(false);
+ else if (timeout == 0)
+ return get(true);
+
lock(this)
{
- if (status == closed)
+ if (status != open)
return null;
long currentTime = SupportClass.currentTimeMillis();
@@ -133,7 +153,7 @@ public virtual System.Object get(long timeout)
while (true)
{
- if ((o = tryGet()) != null)
+ if (status != open || (o = tryGet()) != null)
return o;
currentTime = SupportClass.currentTimeMillis();
300 lib/otp.net/Otp/Otp.2008.bdsproj
View
@@ -0,0 +1,300 @@
+<?xml version="1.0" encoding="utf-8"?>
+<BorlandProject>
+ <PersonalityInfo>
+ <Option>
+ <Option Name="Personality" Type="String">CSharp.Personality</Option>
+ <Option Name="GUID" Type="String">{71378BB0-72DB-4D89-97EA-E667752C9A7C}</Option>
+ <Option Name="ProjectType" Type="String">Application</Option>
+ <Option Name="Version" Type="String">1.0</Option>
+ </Option>
+ </PersonalityInfo>
+ <CSharp.Personality>
+ <Options>
+ <SelectedOptionSet Name="OptionsSet" Type="String">Debug <SelectedOptionSet Name="OptionsSet" Type="String">Debug</SelectedOptionSet>
+ </SelectedOptionSet>
+ <OptionsSet Name="Debug">
+ <Options>
+ <Options Name="DebugInformation" Type="Boolean">True</Options>
+ <Options Name="Optimization" Type="Boolean">False</Options>
+ <Options Name="Incremental" Type="Boolean">False</Options>
+ <Options Name="Overflow" Type="Boolean">True</Options>
+ <Options Name="DocumentationFile" Type="String"></Options>
+ <Options Name="ivUnsafe" Type="Boolean">False</Options>
+ <Options Name="WarningAsError" Type="Boolean">False</Options>
+ <Options Name="Warning" Type="Integer">4</Options>
+ <Options Name="Defines" Type="String">TRACE;DEBUG</Options>
+ <Options Name="TargetName" Type="String"></Options>
+ <Options Name="TargetType" Type="String">Console</Options>
+ <Options Name="BaseAddress" Type="String">285212672</Options>
+ <Options Name="OutputDirectory" Type="String">bin\</Options>
+ <Options Name="DefaultNamespace" Type="String">Otp.Net</Options>
+ <Options Name="Main" Type="String"></Options>
+ <Options Name="RunParams" Type="String">wolf</Options>
+ <Options Name="HostApplication" Type="String"></Options>
+ <Options Name="Launcher" Type="String"></Options>
+ <Options Name="UseLauncher" Type="Boolean">False</Options>
+ <Options Name="DebugCWD" Type="String"></Options>
+ <Options Name="RemotePath" Type="String"></Options>
+ <Options Name="RemoteHost" Type="String"></Options>
+ <Options Name="RemoteLauncher" Type="String"></Options>
+ <Options Name="RemoteDebug" Type="Boolean">False</Options>
+ <Options Name="AspNetUseHostServer" Type="Boolean">False</Options>
+ <Options Name="AspNetLaunchBrowser" Type="Boolean">False</Options>
+ <Options Name="AspNetStartPage" Type="String"></Options>
+ <Options Name="AspNetHostServer" Type="String">IIS</Options>
+ <Options Name="AspNetCassiniVirtualDirectory" Type="String"></Options>
+ <Options Name="AspNetIISVirtualDirectory" Type="String"></Options>
+ <Options Name="AspNetHTTPAddress" Type="String"></Options>
+ <Options Name="ApplicationIcon" Type="String"></Options>
+ <Options Name="BuildInOutput" Type="Boolean">True</Options>
+ <Options Name="RemoteCWD" Type="String"></Options>
+ </Options>
+ </OptionsSet>
+ <OptionsSet Name="Release">
+ <Options>
+ <Options Name="DebugInformation" Type="Boolean">False</Options>
+ <Options Name="Optimization" Type="Boolean">True</Options>
+ <Options Name="Incremental" Type="Boolean">False</Options>
+ <Options Name="Overflow" Type="Boolean">False</Options>
+ <Options Name="DocumentationFile" Type="String"></Options>
+ <Options Name="ivUnsafe" Type="Boolean">False</Options>
+ <Options Name="WarningAsError" Type="Boolean">False</Options>
+ <Options Name="Warning" Type="Integer">4</Options>
+ <Options Name="Defines" Type="String">TRACE</Options>
+ <Options Name="TargetName" Type="String"></Options>
+ <Options Name="TargetType" Type="String">Console</Options>
+ <Options Name="BaseAddress" Type="String">285212672</Options>
+ <Options Name="OutputDirectory" Type="String">C:\Documents and Settings\vladum\Mina dokument\Visual Studio Projects\Otp.Net\bin\</Options>
+ <Options Name="DefaultNamespace" Type="String">Otp.Net</Options>
+ <Options Name="Main" Type="String"></Options>
+ <Options Name="RunParams" Type="String"></Options>
+ <Options Name="HostApplication" Type="String"></Options>
+ <Options Name="Launcher" Type="String"></Options>
+ <Options Name="UseLauncher" Type="Boolean">False</Options>
+ <Options Name="DebugCWD" Type="String"></Options>
+ <Options Name="RemotePath" Type="String"></Options>
+ <Options Name="RemoteHost" Type="String"></Options>
+ <Options Name="RemoteLauncher" Type="String"></Options>
+ <Options Name="RemoteDebug" Type="Boolean">False</Options>
+ <Options Name="AspNetUseHostServer" Type="Boolean">False</Options>
+ <Options Name="AspNetLaunchBrowser" Type="Boolean">False</Options>
+ <Options Name="AspNetStartPage" Type="String"></Options>
+ <Options Name="AspNetHostServer" Type="String">IIS</Options>
+ <Options Name="AspNetCassiniVirtualDirectory" Type="String"></Options>
+ <Options Name="AspNetIISVirtualDirectory" Type="String"></Options>
+ <Options Name="AspNetHTTPAddress" Type="String"></Options>
+ <Options Name="ApplicationIcon" Type="String"></Options>
+ <Options Name="BuildInOutput" Type="Boolean">True</Options>
+ <Options Name="RemoteCWD" Type="String"></Options>
+ </Options>
+ </OptionsSet>
+ </Options>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <FileList>
+ <File FileName="c:\windows\microsoft.net\framework\v1.1.4322\System.dll" ContainerId="DotNetAssemblyCompiler" ModuleName="System" AssemblyName="System" Version="1.0.5000.0"/>
+ <File FileName="c:\windows\microsoft.net\framework\v1.1.4322\System.Data.dll" ContainerId="DotNetAssemblyCompiler" ModuleName="System.Data" AssemblyName="System.Data" Version="1.0.5000.0"/>
+ <File FileName="c:\windows\microsoft.net\framework\v1.1.4322\System.XML.dll" ContainerId="DotNetAssemblyCompiler" ModuleName="System.XML" AssemblyName="System.Xml" Version="1.0.5000.0"/>
+ <File FileName="AbstractConnection.cs" ContainerId="CSharpCompiler" ModuleName="AbstractConnection"/>
+ <File FileName="AbstractNode.cs" ContainerId="CSharpCompiler" ModuleName="AbstractNode"/>
+ <File FileName="AssemblyInfo.cs" ContainerId="CSharpCompiler" ModuleName="AssemblyInfo"/>
+ <File FileName="Link.cs" ContainerId="CSharpCompiler" ModuleName="Link"/>
+ <File FileName="Links.cs" ContainerId="CSharpCompiler" ModuleName="Links"/>
+ <File FileName="OtpAuthException.cs" ContainerId="CSharpCompiler" ModuleName="OtpAuthException"/>
+ <File FileName="OtpConnection.cs" ContainerId="CSharpCompiler" ModuleName="OtpConnection"/>
+ <File FileName="OtpCookedConnection.cs" ContainerId="CSharpCompiler" ModuleName="OtpCookedConnection"/>
+ <File FileName="OtpEpmd.cs" ContainerId="CSharpCompiler" ModuleName="OtpEpmd"/>
+ <File FileName="OtpException.cs" ContainerId="CSharpCompiler" ModuleName="OtpException"/>
+ <File FileName="OtpExternal.cs" ContainerId="CSharpCompiler" ModuleName="OtpExternal"/>
+ <File FileName="OtpInputStream.cs" ContainerId="CSharpCompiler" ModuleName="OtpInputStream"/>
+ <File FileName="OtpLocalNode.cs" ContainerId="CSharpCompiler" ModuleName="OtpLocalNode"/>
+ <File FileName="OtpMbox.cs" ContainerId="CSharpCompiler" ModuleName="OtpMbox"/>
+ <File FileName="OtpMsg.cs" ContainerId="CSharpCompiler" ModuleName="OtpMsg"/>
+ <File FileName="OtpNode.cs" ContainerId="CSharpCompiler" ModuleName="OtpNode"/>
+ <File FileName="OtpNodeStatus.cs" ContainerId="CSharpCompiler" ModuleName="OtpNodeStatus"/>
+ <File FileName="OtpOutputStream.cs" ContainerId="CSharpCompiler" ModuleName="OtpOutputStream"/>
+ <File FileName="OtpPeer.cs" ContainerId="CSharpCompiler" ModuleName="OtpPeer"/>
+ <File FileName="OtpSelf.cs" ContainerId="CSharpCompiler" ModuleName="OtpSelf"/>
+ <File FileName="OtpServer.cs" ContainerId="CSharpCompiler" ModuleName="OtpServer"/>
+ <File FileName="SupportClass.cs" ContainerId="CSharpCompiler" ModuleName="SupportClass"/>
+ <File FileName="Erlang\Atom.cs" ContainerId="CSharpCompiler" ModuleName="Atom"/>
+ <File FileName="Erlang\Binary.cs" ContainerId="CSharpCompiler" ModuleName="Binary"/>
+ <File FileName="Erlang\Boolean.cs" ContainerId="CSharpCompiler" ModuleName="Boolean"/>
+ <File FileName="Erlang\Byte.cs" ContainerId="CSharpCompiler" ModuleName="Byte"/>
+ <File FileName="Erlang\Char.cs" ContainerId="CSharpCompiler" ModuleName="Char"/>
+ <File FileName="Erlang\DecodeException.cs" ContainerId="CSharpCompiler" ModuleName="DecodeException"/>
+ <File FileName="Erlang\Double.cs" ContainerId="CSharpCompiler" ModuleName="Double"/>
+ <File FileName="Erlang\ErlangException.cs" ContainerId="CSharpCompiler" ModuleName="ErlangException"/>
+ <File FileName="Erlang\Exit.cs" ContainerId="CSharpCompiler" ModuleName="Exit"/>
+ <File FileName="Erlang\Int.cs" ContainerId="CSharpCompiler" ModuleName="Int"/>
+ <File FileName="Erlang\List.cs" ContainerId="CSharpCompiler" ModuleName="List"/>
+ <File FileName="Erlang\Long.cs" ContainerId="CSharpCompiler" ModuleName="Long"/>
+ <File FileName="Erlang\Object.cs" ContainerId="CSharpCompiler" ModuleName="Object"/>
+ <File FileName="Erlang\Pid.cs" ContainerId="CSharpCompiler" ModuleName="Pid"/>
+ <File FileName="Erlang\Port.cs" ContainerId="CSharpCompiler" ModuleName="Port"/>
+ <File FileName="Erlang\RangeException.cs" ContainerId="CSharpCompiler" ModuleName="RangeException"/>
+ <File FileName="Erlang\Ref.cs" ContainerId="CSharpCompiler" ModuleName="Ref"/>
+ <File FileName="Erlang\Short.cs" ContainerId="CSharpCompiler" ModuleName="Short"/>
+ <File FileName="Erlang\String.cs" ContainerId="CSharpCompiler" ModuleName="String"/>
+ <File FileName="Erlang\Tuple.cs" ContainerId="CSharpCompiler" ModuleName="Tuple"/>
+ <File FileName="Erlang\UInt.cs" ContainerId="CSharpCompiler" ModuleName="UInt"/>
+ <File FileName="Erlang\UShort.cs" ContainerId="CSharpCompiler" ModuleName="UShort"/>
+ <File FileName="Test.cs" ContainerId="CSharpCompiler" ModuleName="Test"/>
+ <File FileName="GenericQueue.cs" ContainerId="CSharpCompiler" ModuleName="GenericQueue"/>
+ <File FileName="Erlang\CloneObject.cs" ContainerId="CSharpCompiler" ModuleName="CloneObject"/>
+ <File FileName="Erlang\BigInteger.cs" ContainerId="CSharpCompiler" ModuleName="BigInteger"/>
+ </FileList>
+ </CSharp.Personality>
+ <ImportData>
+ <CSharpProjectOptions ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="Otp.Net" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Exe" RootNamespace="Otp.Net" StartupObject=""/>
+ <CSharpLocalOptions Name="Debug" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="DEBUG;TRACE" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="true" Optimize="false" OutputPath="C:\Documents and Settings\vladum\Mina dokument\Visual Studio Projects\Otp.Net\bin\Debug\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>
+ <CSharpLocalOptions Name="Release" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="TRACE" DocumentationFile="" DebugSymbols="false" FileAlignment="4096" IncrementalBuild="false" Optimize="true" OutputPath="C:\Documents and Settings\vladum\Mina dokument\Visual Studio Projects\Otp.Net\bin\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4"/>
+ </ImportData>
+</BorlandProject>
104 lib/otp.net/Otp/Otp.2008.csproj
View
@@ -0,0 +1,104 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8155F56B-4925-406C-8619-7D0E57DD7FE1}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Otp</RootNamespace>
+ <AssemblyName>Otp</AssemblyName>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AbstractConnection.cs" />
+ <Compile Include="AbstractNode.cs" />
+ <Compile Include="OtpTrace.cs" />
+ <Compile Include="Erlang\Atom.cs" />
+ <Compile Include="Erlang\BigInteger.cs" />
+ <Compile Include="Erlang\Binary.cs" />
+ <Compile Include="Erlang\Boolean.cs" />
+ <Compile Include="Erlang\Byte.cs" />
+ <Compile Include="Erlang\Char.cs" />
+ <Compile Include="Erlang\CloneObject.cs" />
+ <Compile Include="Erlang\DecodeException.cs" />
+ <Compile Include="Erlang\Double.cs" />
+ <Compile Include="Erlang\ErlangException.cs" />
+ <Compile Include="Erlang\Exit.cs" />
+ <Compile Include="Erlang\Int.cs" />
+ <Compile Include="Erlang\List.cs" />
+ <Compile Include="Erlang\Long.cs" />
+ <Compile Include="Erlang\Object.cs" />
+ <Compile Include="Erlang\Pid.cs" />
+ <Compile Include="Erlang\Port.cs" />
+ <Compile Include="Erlang\RangeException.cs" />
+ <Compile Include="Erlang\Ref.cs" />
+ <Compile Include="Erlang\Short.cs" />
+ <Compile Include="Erlang\String.cs" />
+ <Compile Include="Erlang\Tuple.cs" />
+ <Compile Include="Erlang\UInt.cs" />
+ <Compile Include="Erlang\UShort.cs" />
+ <Compile Include="GenericQueue.cs" />
+ <Compile Include="Link.cs" />
+ <Compile Include="Links.cs" />
+ <Compile Include="OtpAuthException.cs" />
+ <Compile Include="OtpConnection.cs" />
+ <Compile Include="OtpCookedConnection.cs" />
+ <Compile Include="OtpEpmd.cs" />
+ <Compile Include="OtpException.cs" />
+ <Compile Include="OtpExternal.cs" />
+ <Compile Include="OtpInputStream.cs" />
+ <Compile Include="OtpLocalNode.cs" />
+ <Compile Include="OtpMbox.cs" />
+ <Compile Include="OtpMsg.cs" />
+ <Compile Include="OtpNode.cs" />
+ <Compile Include="OtpNodeStatus.cs" />
+ <Compile Include="OtpOutputStream.cs" />
+ <Compile Include="OtpPeer.cs" />
+ <Compile Include="OtpSelf.cs" />
+ <Compile Include="OtpSystem.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SupportClass.cs" />
+ <Compile Include="Test.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="ClassDiagram1.cd" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
26 lib/otp.net/Otp/Otp.2008.sln
View
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Otp", "Otp.csproj", "{8155F56B-4925-406C-8619-7D0E57DD7FE1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OtpTest1", "..\OtpTest1\OtpTest1.csproj", "{E1AC898B-1B0C-4DFC-82A8-0D547EBDFA8A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8155F56B-4925-406C-8619-7D0E57DD7FE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8155F56B-4925-406C-8619-7D0E57DD7FE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8155F56B-4925-406C-8619-7D0E57DD7FE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8155F56B-4925-406C-8619-7D0E57DD7FE1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E1AC898B-1B0C-4DFC-82A8-0D547EBDFA8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E1AC898B-1B0C-4DFC-82A8-0D547EBDFA8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E1AC898B-1B0C-4DFC-82A8-0D547EBDFA8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E1AC898B-1B0C-4DFC-82A8-0D547EBDFA8A}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
46 lib/otp.net/Otp/Otp.csproj
View
@@ -2,40 +2,36 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{8155F56B-4925-406C-8619-7D0E57DD7FE1}</ProjectGuid>
+ <ProjectGuid>{9A16CEEB-FC26-4D35-8F9E-42DA30212F69}</ProjectGuid>
<OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Otp</RootNamespace>
- <AssemblyName>Otp</AssemblyName>
+ <NoStandardLibraries>false</NoStandardLibraries>
+ <AssemblyName>otp</AssemblyName>
+ <RootNamespace>otp</RootNamespace>
+ <SignAssembly>true</SignAssembly>
+ <AssemblyOriginatorKeyFile>dotnet_keyfile.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
+ <OutputPath>.\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
+ <OutputPath>.\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
- <Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AbstractConnection.cs" />
<Compile Include="AbstractNode.cs" />
+ <Compile Include="AssemblyInfo.cs" />
<Compile Include="Erlang\Atom.cs" />
<Compile Include="Erlang\BigInteger.cs" />
<Compile Include="Erlang\Binary.cs" />
@@ -78,21 +74,25 @@