Some stuff.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3865 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-02-20 01:03:56 +00:00
parent 7a353e6722
commit f8c8f6e983
11 changed files with 475 additions and 53 deletions
@@ -0,0 +1,49 @@
//
// $Id: EventNotification.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.net {
import com.threerings.io.ObjectInputStream;
import com.threerings.presents.dobj.DEvent;
public class EventNotification extends DownstreamMessage
{
public function getEvent () :DEvent
{
return _event;
}
public override function toString () :String
{
return "[type=EVT, evt=" + _event + "]";
}
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_event = ins.readObject();
}
/** The event which we are forwarding. */
protected var _event :DEvent;
}
}
@@ -0,0 +1,46 @@
//
// $Id: FailureResponse.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.net {
import com.threerings.io.ObjectInputStream;
public class FailureResponse extends DownstreamMessage
{
public function getOid () :int
{
return _oid;
}
public function toString () :String
{
return "[type=FAIL, msgid=" + messageId + ", oid=" + _oid + "]";
}
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_oid = ins.readInt();
}
protected int _oid;
}
}
@@ -0,0 +1,31 @@
//
// $Id: LogoffRequest.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.net {
public class LogoffRequest extends UpstreamMessage
{
public function toString () :String
{
return "[type=LOGOFF, msgid=" + messageId + "]";
}
}
}
@@ -0,0 +1,49 @@
//
// $Id: ObjectResponse.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.net {
import com.threerings.presents.dobj.DObject;
import com.threerings.io.ObjectInputStream;
public class ObjectResponse extends DownstreamMessage
{
public function getObject () :DObject
{
return _dobj;
}
public function toString () :String
{
return "[type=ORSP, msgid=" + messageId + ", obj=" + _dobj + "]";
}
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_dobj = ins.readObject();
}
/** The object which is associated with this response. */
protected var _dobj :DObject;
}
}
@@ -0,0 +1,62 @@
//
// $Id: SubscribeRequest.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.net {
import com.threerings.io.ObjectOutputStream;
public class SubscribeRequest extends UpstreamMessage
{
/**
* Constructs a subscribe request for the distributed object with the
* specified object id.
*/
public function SubscribeRequest (oid :int)
{
_oid = oid;
}
/**
* Returns the oid of the object to which we desire subscription.
*/
public function getOid () :int
{
return _oid;
}
public override function toString () :String
{
return "[type=SUB, msgid=" + messageId + ", oid=" + _oid + "]";
}
public override function writeObject (out :ObjectOutputStream) :void
{
super.writeObject(out);
out.writeInt(_oid);
}
/**
* The object id of the distributed object to which we are
* subscribing.
*/
protected var _oid :int;
}
}
@@ -0,0 +1,62 @@
//
// $Id: UnsubscribeRequest.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.net {
import com.threerings.io.ObjectOutputStream;
public class UnsubscribeRequest extends UpstreamMessage
{
/**
* Constructs a unsubscribe request for the distributed object
* with the specified object id.
*/
public function UnsubscribeRequest (oid :int)
{
_oid = oid;
}
/**
* Returns the oid of the object from which we are unsubscribing.
*/
public function getOid () :int
{
return _oid;
}
public function toString () :String
{
return "[type=UNSUB, msgid=" + messageId + ", oid=" + _oid + "]";
}
public function writeObject (out :ObjectOutputStream) :void
{
super.writeObject(out);
out.writeInt(_oid);
}
/**
* The object id of the distributed object from which we are
* unsubscribing.
*/
protected var _oid :int;
}
}
@@ -0,0 +1,51 @@
//
// $Id: UnsubscribeResponse.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.net {
import com.threerings.io.ObjectInputStream;
/**
* Used to communicate to the client that we received their unsubscribe
* request and that it is now OK to remove an object mapping from their
* local object table.
*/
public class UnsubscribeResponse extends DownstreamMessage
{
public function getOid () :int
{
return _oid;
}
public function toString () :String
{
return "[type=UNACK, msgid=" + messageId + ", oid=" + _oid + "]";
}
public function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_oid = ins.readInt();
}
protected var _oid :int;
}
}
@@ -1,6 +1,8 @@
package com.threerings.presents.net {
import com.threerings.io.Streamable;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
public class UpstreamMessage
implements Streamable
@@ -0,0 +1,66 @@
//
// $Id: UsernamePasswordCreds.java 3099 2004-08-27 02:21:06Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.threerings.presents.net {
import com.threerings.util.Name;
import com.threerrings.io.ObjectInputStream;
import com.threerrings.io.ObjectOutputStream;
public class UsernamePasswordCreds extends Credentials
{
/**
* Construct credentials with the supplied username and password.
*/
public function UsernamePasswordCreds (username :Name, password :String)
{
super(username);
_password = password;
}
public function getPassword () :String
{
return _password;
}
public override function writeObject (out :ObjectOutputStream) :void
{
super.writeObject(out);
out.writeField(_password);
}
public override function readObject (ins :ObjectInputStream) :void
{
super.readObject(ins);
_password = ins.readField(String);
}
// documentation inherited
protected override function toString (buf :StringBuilder)
{
super.toString(buf);
buf.append(", password=", _password);
}
protected var _password :String;
}
}