From 4274450c3fa6617a6a9a87618cfbdac01472b565 Mon Sep 17 00:00:00 2001 From: bobbybee Date: Thu, 14 Aug 2014 17:26:41 -0400 Subject: [PATCH 1/8] Set AI --- direct/src/distributed/AstronInternalRepository.py | 10 ++++++++++ direct/src/distributed/DistributedObjectAI.py | 3 +++ 2 files changed, 13 insertions(+) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index f05f12efb0..e177e6595d 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -421,3 +421,13 @@ class AstronInternalRepository(ConnectionRepository): for arg in args: dg.addString(str(arg)) self.eventSocket.Send(dg.getMessage()) + + def setAI(self, doID, aiChannel): + """ + Sets the AI of the specified DistributedObjectAI to be the specified channel. + Generally, you should not call this method, and instead call DistributedObjectAI.setAI. + """ + dg = PyDatagram() + dg.addServerHeader(doID, aiChannel, MsgTypes.STATESERVER_OBJECT_SET_AI) + dg.add_uint64(aiChannel) + dg.send(dg) \ No newline at end of file diff --git a/direct/src/distributed/DistributedObjectAI.py b/direct/src/distributed/DistributedObjectAI.py index 3e3261d0dc..5a47194d82 100644 --- a/direct/src/distributed/DistributedObjectAI.py +++ b/direct/src/distributed/DistributedObjectAI.py @@ -568,4 +568,7 @@ class DistributedObjectAI(DistributedObjectBase): def _retrieveCachedData(self): """ This is a no-op on the AI. """ pass + + def setAI(self, aiChannel): + self.air.setAI(self.doId, aiChannel) From 6e0b6bd62214d826f94b39b3ec22fa1bc5beae24 Mon Sep 17 00:00:00 2001 From: bobbybee Date: Thu, 14 Aug 2014 20:47:28 -0400 Subject: [PATCH 2/8] Eject method; bug fix; style --- .../distributed/AstronInternalRepository.py | 22 ++++++++++++++----- direct/src/distributed/DistributedObjectAI.py | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index e177e6595d..19d924fa29 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -422,12 +422,22 @@ class AstronInternalRepository(ConnectionRepository): dg.addString(str(arg)) self.eventSocket.Send(dg.getMessage()) - def setAI(self, doID, aiChannel): + def setAI(self, doId, aiChannel): + """ + Sets the AI of the specified DistributedObjectAI to be the specified channel. + Generally, you should not call this method, and instead call DistributedObjectAI.setAI. + """ + dg = PyDatagram() + dg.addServerHeader(doId, aiChannel, STATESERVER_OBJECT_SET_AI) + dg.add_uint64(aiChannel) + self.send(dg) + + def eject(self, clientChannel, reasonCode, reason): """ - Sets the AI of the specified DistributedObjectAI to be the specified channel. - Generally, you should not call this method, and instead call DistributedObjectAI.setAI. + Kicks the client residing at the specified clientChannel, using the specifed reasoning. """ dg = PyDatagram() - dg.addServerHeader(doID, aiChannel, MsgTypes.STATESERVER_OBJECT_SET_AI) - dg.add_uint64(aiChannel) - dg.send(dg) \ No newline at end of file + dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_EJECT) + dg.addUint16(reasonCode) + dg.addString(reason) + self.send(dg) \ No newline at end of file diff --git a/direct/src/distributed/DistributedObjectAI.py b/direct/src/distributed/DistributedObjectAI.py index 5a47194d82..cef89b70c6 100644 --- a/direct/src/distributed/DistributedObjectAI.py +++ b/direct/src/distributed/DistributedObjectAI.py @@ -569,6 +569,6 @@ class DistributedObjectAI(DistributedObjectBase): """ This is a no-op on the AI. """ pass - def setAI(self, aiChannel): - self.air.setAI(self.doId, aiChannel) + def setAI(self, aiChannel): + self.air.setAI(self.doId, aiChannel) From 8fd0a0b45b4c019896cd8c2a09d63c0ba423c375 Mon Sep 17 00:00:00 2001 From: bobbybee Date: Thu, 14 Aug 2014 20:55:26 -0400 Subject: [PATCH 3/8] Client set state abstraction; more cleanup --- .../src/distributed/AstronInternalRepository.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index 19d924fa29..bf671b3a1b 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -427,6 +427,7 @@ class AstronInternalRepository(ConnectionRepository): Sets the AI of the specified DistributedObjectAI to be the specified channel. Generally, you should not call this method, and instead call DistributedObjectAI.setAI. """ + dg = PyDatagram() dg.addServerHeader(doId, aiChannel, STATESERVER_OBJECT_SET_AI) dg.add_uint64(aiChannel) @@ -436,8 +437,20 @@ class AstronInternalRepository(ConnectionRepository): """ Kicks the client residing at the specified clientChannel, using the specifed reasoning. """ + dg = PyDatagram() dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_EJECT) - dg.addUint16(reasonCode) + dg.add_uint16(reasonCode) dg.addString(reason) + self.send(dg) + + def setClientState(self, clientChannel, state): + """ + Sets the state of the client on the CA. + Useful for logging in and logging out, and for little else. + """ + + dg = PyDatagram() + dg.addServerHeader(cleintChannel, self.ourChannel, CLIENTAGENT_SET_STATE) + dg.add_uint16(state) self.send(dg) \ No newline at end of file From 1905086ad1182a73939fd97684724ca9dd8418c9 Mon Sep 17 00:00:00 2001 From: bobbybee Date: Thu, 14 Aug 2014 20:57:58 -0400 Subject: [PATCH 4/8] Client add session object; typo --- direct/src/distributed/AstronInternalRepository.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index bf671b3a1b..496392ebf0 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -451,6 +451,18 @@ class AstronInternalRepository(ConnectionRepository): """ dg = PyDatagram() - dg.addServerHeader(cleintChannel, self.ourChannel, CLIENTAGENT_SET_STATE) + dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_SET_STATE) dg.add_uint16(state) + self.send(dg) + + def clientAddSessionObject(self, clientChannel, doId): + """ + Declares the specified DistributedObject to be a "session object", + meaning that it is destroyed when the client disconnects. + Generally used for avatars owned by the client. + """ + + dg = PyDatagram() + dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_ADD_SESSION_OBJECT) + dg.add_uint32(doId) self.send(dg) \ No newline at end of file From 9b1ae61632a0bd5fc670196ec147645cb80aee69 Mon Sep 17 00:00:00 2001 From: bobbybee Date: Thu, 14 Aug 2014 21:06:36 -0400 Subject: [PATCH 5/8] Stateserver set owner --- direct/src/distributed/AstronInternalRepository.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index 496392ebf0..e18f7e3dad 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -433,7 +433,7 @@ class AstronInternalRepository(ConnectionRepository): dg.add_uint64(aiChannel) self.send(dg) - def eject(self, clientChannel, reasonCode, reason): + def eject(self, clientChannel, reasonCode, reason): """ Kicks the client residing at the specified clientChannel, using the specifed reasoning. """ @@ -465,4 +465,15 @@ class AstronInternalRepository(ConnectionRepository): dg = PyDatagram() dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_ADD_SESSION_OBJECT) dg.add_uint32(doId) + self.send(dg) + + def setOwner(self, doId, newOwner): + """ + Sets the owner of a DistributedObject. This will enable the new owner to send "ownsend" fields, + and will generate an OwnerView. + """ + + dg = PyDatagram() + dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_SET_OWNER) + dg.add_uint64(newOwner) self.send(dg) \ No newline at end of file From 51d3b12c006ab4c1befc6b5ab14f145c69b3e5d4 Mon Sep 17 00:00:00 2001 From: bobbybee Date: Thu, 14 Aug 2014 21:12:19 -0400 Subject: [PATCH 6/8] Tabs darnit --- direct/src/distributed/AstronInternalRepository.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index e18f7e3dad..5aed3d7b4d 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -434,11 +434,11 @@ class AstronInternalRepository(ConnectionRepository): self.send(dg) def eject(self, clientChannel, reasonCode, reason): - """ - Kicks the client residing at the specified clientChannel, using the specifed reasoning. - """ - - dg = PyDatagram() + """ + Kicks the client residing at the specified clientChannel, using the specifed reasoning. + """ + + dg = PyDatagram() dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_EJECT) dg.add_uint16(reasonCode) dg.addString(reason) From 882fb179f0449c18a240551fda9fb8013611ea9c Mon Sep 17 00:00:00 2001 From: bobbybee Date: Fri, 15 Aug 2014 19:25:06 -0400 Subject: [PATCH 7/8] CLIENTAGENT_ADD_INTEREST method --- direct/src/distributed/AstronInternalRepository.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index 5aed3d7b4d..e86b9cfdf6 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -467,6 +467,20 @@ class AstronInternalRepository(ConnectionRepository): dg.add_uint32(doId) self.send(dg) + def clientAddInterest(self, clientChannel, interestId, parentId, zoneId): + """ + Opens an interest on the behalf of the client. This, used in conjunction + with add_interest: visible (or preferably, disabled altogether), will mitigate + possible security risks. + """ + + dg = PyDatagram() + dg.addServerHeader(clientChanel, self.ourChannel, CLIENTAGENT_ADD_INTEREST) + dg.add_uint16(interestId) + dg.add_uint32(parentId) + dg.add_uint32(zoneId) + self.send(dg) + def setOwner(self, doId, newOwner): """ Sets the owner of a DistributedObject. This will enable the new owner to send "ownsend" fields, From b1236b31a808248bff93dd38f52ce0084250aa56 Mon Sep 17 00:00:00 2001 From: bobbybee Date: Fri, 15 Aug 2014 21:21:18 -0400 Subject: [PATCH 8/8] Hopefully fixing styling --- .../distributed/AstronInternalRepository.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/direct/src/distributed/AstronInternalRepository.py b/direct/src/distributed/AstronInternalRepository.py index e86b9cfdf6..1cec09e662 100644 --- a/direct/src/distributed/AstronInternalRepository.py +++ b/direct/src/distributed/AstronInternalRepository.py @@ -421,18 +421,18 @@ class AstronInternalRepository(ConnectionRepository): for arg in args: dg.addString(str(arg)) self.eventSocket.Send(dg.getMessage()) - + def setAI(self, doId, aiChannel): """ Sets the AI of the specified DistributedObjectAI to be the specified channel. Generally, you should not call this method, and instead call DistributedObjectAI.setAI. """ - + dg = PyDatagram() dg.addServerHeader(doId, aiChannel, STATESERVER_OBJECT_SET_AI) dg.add_uint64(aiChannel) self.send(dg) - + def eject(self, clientChannel, reasonCode, reason): """ Kicks the client residing at the specified clientChannel, using the specifed reasoning. @@ -449,45 +449,45 @@ class AstronInternalRepository(ConnectionRepository): Sets the state of the client on the CA. Useful for logging in and logging out, and for little else. """ - + dg = PyDatagram() dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_SET_STATE) dg.add_uint16(state) self.send(dg) - + def clientAddSessionObject(self, clientChannel, doId): """ Declares the specified DistributedObject to be a "session object", meaning that it is destroyed when the client disconnects. Generally used for avatars owned by the client. """ - + dg = PyDatagram() dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_ADD_SESSION_OBJECT) dg.add_uint32(doId) self.send(dg) - + def clientAddInterest(self, clientChannel, interestId, parentId, zoneId): """ Opens an interest on the behalf of the client. This, used in conjunction with add_interest: visible (or preferably, disabled altogether), will mitigate possible security risks. """ - + dg = PyDatagram() dg.addServerHeader(clientChanel, self.ourChannel, CLIENTAGENT_ADD_INTEREST) dg.add_uint16(interestId) dg.add_uint32(parentId) dg.add_uint32(zoneId) self.send(dg) - + def setOwner(self, doId, newOwner): """ Sets the owner of a DistributedObject. This will enable the new owner to send "ownsend" fields, and will generate an OwnerView. """ - + dg = PyDatagram() dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_SET_OWNER) dg.add_uint64(newOwner) - self.send(dg) \ No newline at end of file + self.send(dg)