More progress.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3849 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-02-14 04:07:02 +00:00
parent 8366c150f4
commit 4d7fb64b8c
16 changed files with 582 additions and 38 deletions
@@ -0,0 +1,21 @@
package com.threerings.presents.net {
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
public class AuthResponse extends DownstreamMessage
{
public function getData () :AuthResponseData
{
return _data;
}
public function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_data = ins.readField(AuthResponseData);
}
protected var _data :AuthResponseData;
}
}
@@ -0,0 +1,31 @@
package com.threerings.presents.net {
import com.threerings.presents.dobj.DObject;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
public class AuthResponseData extends DObject
{
/** A constant used to indicate a successful authentication. */
public static const SUCCESS :String = "success";
/** Either the SUCCESS constant or a reason code indicating
* why the authentication failed. */
public var code :String;
// documentation inherited
public function writeObject (out :ObjectOutputStream) :void
{
super.writeObject(out);
out.writeField(code);
}
// documentation inherited
public function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
code = ins.readField(String);
}
}
}
@@ -0,0 +1,38 @@
package com.threerings.presents.net {
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
import com.threerings.util.StreamableArrayList;
/**
* A BoostrapData object is communicated back to the client
* after authentication has succeeded and after the server is fully
* prepared to deal with the client. It contains information the client
* will need to interact with the server.
*/
public class BootstrapData
implements Streamable
{
/** The oid of this client's associated distributed object. */
public var clientOid :int;
/** A list of handles to invocation services. */
public var services :StreamableArrayList;
// documentation inherited from interface Streamable
public function writeObject (out :ObjectOutputStream) :void
{
trace("This is client code: BootstrapData shouldn't be written");
//out.writeShort(messageId);
}
// documentation inherited from interface Streamable
public function readObject (ins :ObjectInputStream) :void
{
clientOid = ins.readInt();
services = ins.readField(StreamableArrayList);
}
}
}
@@ -0,0 +1,21 @@
package com.threerings.presents.net {
import com.threerings.io.ObjectInputStream;
public class BootstrapNotification extends DownstreamMessage
{
public function getData () :BootstrapData
{
return _data;
}
public function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_data = ins.readField(BootstrapData);
}
/** The data associated with this notification. */
protected var _data :BootstrapData;
}
}
@@ -1,5 +1,7 @@
package com.threerings.presents.net {
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
public class DownstreamMessage
@@ -13,7 +15,8 @@ public class DownstreamMessage
// documentation inherited from interface Streamable
public function writeObject (out :ObjectOutputStream) :void
{
out.writeShort(messageId);
trace("This is client code: Downstream messages shouldn't be written");
//out.writeShort(messageId);
}
// documentation inherited from interface Streamable
@@ -26,12 +26,6 @@ public class PingRequest extends UpstreamMessage
super.writeObject(out);
}
// documentation inherited
public function readObject (ins :ObjectInputStream)
{
trace("read PingRequest on the client?");
}
/** A time stamp obtained when we serialize this object. */
protected var _packStamp :Number;
}
@@ -28,11 +28,6 @@ public class PongResponse extends DownstreamMessage
return _unpackStamp;
}
public function writeObject (out :ObjectOutputStream)
{
trace("write a pong on the client??");
}
public function readObject (ins :ObjectInputStream)
{
_unpackStamp = new Date().getTime();
@@ -29,7 +29,8 @@ public class UpstreamMessage
// documentation inherited from interface Streamable
public function readObject (ins :ObjectInputStream) :void
{
messageId = ins.readShort();
trace("This is client code: Upstream messages shouldn't be read");
//messageId = ins.readShort();
}
/**