dded Support for 64bit Server Channels

----------------------------------------------------------------------
 	src/dcparser/dcClass.cxx src/dcparser/dcClass.h
 	src/dcparser/dcField.cxx src/dcparser/dcField.h
 	src/dcparser/dcPacker.h src/dcparser/dcbase.h
 	src/distributed/DistributedObjectAI.py
 	src/distributed/PyDatagram.py
 	src/distributed/PyDatagramIterator.py
 	src/distributed/cConnectionRepository.I
 	src/distributed/cConnectionRepository.cxx
 	src/distributed/cConnectionRepository.h
 ----------------------------------------------------------------------
This commit is contained in:
Roger Hughston 2004-07-21 21:18:06 +00:00
parent f62de075c8
commit d74707423c
11 changed files with 41 additions and 19 deletions

View File

@ -635,7 +635,7 @@ client_format_update(const string &field_name, int do_id,
////////////////////////////////////////////////////////////////////
Datagram DCClass::
ai_format_update(const string &field_name, int do_id,
int to_id, int from_id, PyObject *args) const {
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
DCField *field = get_field_by_name(field_name);
if (field == (DCField *)NULL) {
ostringstream strm;
@ -663,12 +663,14 @@ ai_format_update(const string &field_name, int do_id,
////////////////////////////////////////////////////////////////////
Datagram DCClass::
ai_format_generate(PyObject *distobj, int do_id,
int zone_id, int district_id, int from_channel_id,
int zone_id, CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
PyObject *optional_fields) const {
DCPacker packer;
packer.raw_pack_uint32(district_id);
packer.raw_pack_uint32(from_channel_id);
packer.RAW_PACK_CHANNEL(district_channel_id);
packer.RAW_PACK_CHANNEL(from_channel_id);
packer.raw_pack_uint8('A');
bool has_optional_fields = (PyObject_IsTrue(optional_fields) != 0);
@ -678,7 +680,7 @@ ai_format_generate(PyObject *distobj, int do_id,
} else {
packer.raw_pack_uint16(STATESERVER_OBJECT_GENERATE_WITH_REQUIRED);
}
packer.raw_pack_uint32(zone_id);
packer.raw_pack_uint16(_number);
packer.raw_pack_uint32(do_id);

View File

@ -78,12 +78,13 @@ PUBLISHED:
const DCField *field) const;
Datagram client_format_update(const string &field_name,
int do_id, PyObject *args) const;
Datagram ai_format_update(const string &field_name, int do_id,
int to_id, int from_id, PyObject *args) const;
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const;
Datagram ai_format_generate(PyObject *distobj, int do_id, int zone_id,
int district_id, int from_channel_id,
CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
PyObject *optional_fields) const;
#endif

View File

@ -516,11 +516,11 @@ client_format_update(int do_id, PyObject *args) const {
// object from the AI.
////////////////////////////////////////////////////////////////////
Datagram DCField::
ai_format_update(int do_id, int to_id, int from_id, PyObject *args) const {
ai_format_update(int do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
DCPacker packer;
packer.raw_pack_uint32(to_id);
packer.raw_pack_uint32(from_id);
packer.RAW_PACK_CHANNEL(to_id);
packer.RAW_PACK_CHANNEL(from_id);
packer.raw_pack_uint8('A');
packer.raw_pack_uint16(STATESERVER_OBJECT_UPDATE_FIELD);
packer.raw_pack_uint32(do_id);

View File

@ -79,7 +79,7 @@ PUBLISHED:
void receive_update(DCPacker &packer, PyObject *distobj) const;
Datagram client_format_update(int do_id, PyObject *args) const;
Datagram ai_format_update(int do_id, int to_id, int from_id,
Datagram ai_format_update(int do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id,
PyObject *args) const;
#endif

View File

@ -151,6 +151,11 @@ PUBLISHED:
INLINE void raw_pack_float64(double value);
INLINE void raw_pack_string(const string &value);
// this is a hack to allw me to get in and out of 32bit Mode Faster
// need to agree with channel_type in dcbase.h
#define RAW_PACK_CHANNEL(in) raw_pack_int64(in)
INLINE int raw_unpack_int8();
INLINE int raw_unpack_int16();
INLINE int raw_unpack_int32();

View File

@ -111,6 +111,11 @@ typedef long long PN_int64;
typedef unsigned long long PN_uint64;
#endif
#endif // WITHIN_PANDA
//typedef unsigned long CHANNEL_TYPE;
typedef PN_uint64 CHANNEL_TYPE;
#endif // DCBASE_H

View File

@ -27,6 +27,9 @@ class PyDatagram(Datagram):
STBlob32 : (Datagram.addString32, None),
}
addChannel = Datagram.addUint64
def putArg(self, arg, subatomicType, divisor=1):
if (divisor == 1):
funcSpecs = self.FuncDict.get(subatomicType)

View File

@ -27,6 +27,8 @@ class PyDatagramIterator(DatagramIterator):
STBlob32 : DatagramIterator.getString32,
}
getChannel = DatagramIterator.getUint64
def getArg(self, subatomicType, divisor=1):
# Import the type numbers
if divisor == 1:

View File

@ -141,7 +141,7 @@ get_datagram_iterator(DatagramIterator &di) {
// was sent, according to the datagram headers. This
// information is not available to the client.
////////////////////////////////////////////////////////////////////
INLINE unsigned int CConnectionRepository::
INLINE CHANNEL_TYPE CConnectionRepository::
get_msg_channel() const {
return _msg_channel;
}
@ -153,7 +153,7 @@ get_msg_channel() const {
// according to the datagram headers. This information
// is not available to the client.
////////////////////////////////////////////////////////////////////
INLINE unsigned int CConnectionRepository::
INLINE CHANNEL_TYPE CConnectionRepository::
get_msg_sender() const {
return _msg_sender;
}

View File

@ -133,8 +133,8 @@ check_datagram() {
_di = DatagramIterator(_dg);
if (!_client_datagram) {
_msg_channel = _di.get_uint32();
_msg_sender = _di.get_uint32();
_msg_channel = _di.get_uint64();
_msg_sender = _di.get_uint64();
_sec_code = _di.get_uint8();
#ifdef HAVE_PYTHON
@ -142,7 +142,9 @@ check_datagram() {
// structure, to support legacy code that expects to find it
// there.
if (_python_repository != (PyObject *)NULL) {
// Dave Needs to fix interage..
PyObject *value = PyInt_FromLong(_msg_sender);
// PyObject *value = PyLong_FromUnsignedLongLong(_msg_sender);
PyObject_SetAttrString(_python_repository, "msgSender", value);
Py_DECREF(value);
}

View File

@ -21,6 +21,8 @@
#include "directbase.h"
#include "pointerTo.h"
#include "dcbase.h"
#include "dcFile.h"
#include "dcField.h" // to pick up Python.h
@ -78,8 +80,8 @@ PUBLISHED:
bool check_datagram();
INLINE void get_datagram(Datagram &dg);
INLINE void get_datagram_iterator(DatagramIterator &di);
INLINE unsigned int get_msg_channel() const;
INLINE unsigned int get_msg_sender() const;
INLINE CHANNEL_TYPE get_msg_channel() const;
INLINE CHANNEL_TYPE get_msg_sender() const;
INLINE unsigned char get_sec_code() const;
INLINE unsigned int get_msg_type() const;
@ -122,8 +124,8 @@ private:
Datagram _dg;
DatagramIterator _di;
unsigned int _msg_channel;
unsigned int _msg_sender;
CHANNEL_TYPE _msg_channel;
CHANNEL_TYPE _msg_sender;
unsigned char _sec_code;
unsigned int _msg_type;