MP2017.2 changes
Support for short int encoded values (32 bits with 16 bit for ID and 16 bits for value) Added extra debugging options 1. Debug level bit 1 - loopback (show your own model as an MP model) bit 2 - dump outgoing packets bit 3 - dump incoming packets bit 4 - hexdump outgoing packets 2. Update property (/simwith packet - configurable debug (loopback, packet trace (in,out), packet dump) - prevent properties from being visible to V1 clients - to ensure reliable compatibility, with just the basic position message being processed. This allows more changes to the V2 protocol whilst giving basic V1 support - add debug
This commit is contained in:
parent
4f04975508
commit
3fceba7a24
5 changed files with 635 additions and 664 deletions
|
@ -71,7 +71,7 @@ struct T_MsgHdr {
|
||||||
xdr_data_t Version; // Protocoll version
|
xdr_data_t Version; // Protocoll version
|
||||||
xdr_data_t MsgId; // Message identifier
|
xdr_data_t MsgId; // Message identifier
|
||||||
xdr_data_t MsgLen; // absolute length of message
|
xdr_data_t MsgLen; // absolute length of message
|
||||||
xdr_data_t MsgLen2; // Used to be - ReplyAddress; // (player's receiver address
|
xdr_data_t RequestedRangeNm; // start of second partition of message
|
||||||
xdr_data_t ReplyPort; // player's receiver port
|
xdr_data_t ReplyPort; // player's receiver port
|
||||||
char Callsign[MAX_CALLSIGN_LEN]; // Callsign used by the player
|
char Callsign[MAX_CALLSIGN_LEN]; // Callsign used by the player
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -74,14 +74,11 @@ private:
|
||||||
}
|
}
|
||||||
int getProtocolToUse()
|
int getProtocolToUse()
|
||||||
{
|
{
|
||||||
return mProtocolVersion;
|
int protocolVersion = pProtocolVersion->getIntValue();
|
||||||
}
|
if (protocolVersion >= MIN_MP_PROTOCOL_VERSION && protocolVersion <= MAX_MP_PROTOCOL_VERSION)
|
||||||
void setProtocolToUse(int protocolVersion)
|
return protocolVersion;
|
||||||
{
|
else
|
||||||
if (protocolVersion >= MIN_MP_PROTOCOL_VERSION && protocolVersion <= MAX_MP_PROTOCOL_VERSION)
|
return MIN_MP_PROTOCOL_VERSION;
|
||||||
mProtocolVersion = protocolVersion;
|
|
||||||
else
|
|
||||||
mProtocolVersion = MIN_MP_PROTOCOL_VERSION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void findProperties();
|
void findProperties();
|
||||||
|
@ -113,12 +110,15 @@ private:
|
||||||
// and the property nodes
|
// and the property nodes
|
||||||
typedef std::map<unsigned int, SGSharedPtr<SGPropertyNode> > PropertyMap;
|
typedef std::map<unsigned int, SGSharedPtr<SGPropertyNode> > PropertyMap;
|
||||||
PropertyMap mPropertyMap;
|
PropertyMap mPropertyMap;
|
||||||
|
SGPropertyNode *pProtocolVersion;
|
||||||
|
SGPropertyNode *pXmitLen;
|
||||||
|
SGPropertyNode *pMultiPlayDebugLevel;
|
||||||
|
SGPropertyNode *pMultiPlayRange;
|
||||||
|
|
||||||
typedef std::map<unsigned int, const struct IdPropertyList*> PropertyDefinitionMap;
|
typedef std::map<unsigned int, const struct IdPropertyList*> PropertyDefinitionMap;
|
||||||
PropertyDefinitionMap mPropertyDefinition;
|
PropertyDefinitionMap mPropertyDefinition;
|
||||||
|
|
||||||
bool mPropertiesChanged;
|
bool mPropertiesChanged;
|
||||||
int mProtocolVersion;
|
|
||||||
|
|
||||||
MPPropertyListener* mListener;
|
MPPropertyListener* mListener;
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,34 @@ XDR_encode_int32 ( const int32_t & n_Val )
|
||||||
return (SWAP32(static_cast<xdr_data_t> (n_Val)));
|
return (SWAP32(static_cast<xdr_data_t> (n_Val)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static short convert_int_to_short(int v1)
|
||||||
|
{
|
||||||
|
if (v1 < -32767)
|
||||||
|
v1 = -32767;
|
||||||
|
|
||||||
|
if (v1 > 32767)
|
||||||
|
v1 = 32767;
|
||||||
|
|
||||||
|
return (short)v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pack two 16bit shorts into a 32 bit int. By convention v1 is packed in the highword
|
||||||
|
*/
|
||||||
|
xdr_data_t XDR_encode_shortints32(const int v1, const int v2)
|
||||||
|
{
|
||||||
|
return XDR_encode_uint32( (convert_int_to_short(v1) << 16) | (convert_int_to_short(v2)));
|
||||||
|
}
|
||||||
|
/* Decode packed shorts into two ints. V1 in the highword ($V1..V2..)*/
|
||||||
|
void XDR_decode_shortints32(const xdr_data_t & n_Val, int &v1, int &v2)
|
||||||
|
{
|
||||||
|
int _v1 = XDR_decode_int32(n_Val);
|
||||||
|
short s2 = (short)(_v1 & 0xffff);
|
||||||
|
short s1 = (short)(_v1 >> 16);
|
||||||
|
v1 = s1;
|
||||||
|
v2 = s2;
|
||||||
|
}
|
||||||
|
|
||||||
xdr_data_t
|
xdr_data_t
|
||||||
XDR_encode_uint32 ( const uint32_t & n_Val )
|
XDR_encode_uint32 ( const uint32_t & n_Val )
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,9 @@ xdr_data2_t XDR_encode_uint64 ( const uint64_t & n_Val );
|
||||||
int64_t XDR_decode_int64 ( const xdr_data2_t & n_Val );
|
int64_t XDR_decode_int64 ( const xdr_data2_t & n_Val );
|
||||||
uint64_t XDR_decode_uint64 ( const xdr_data2_t & n_Val );
|
uint64_t XDR_decode_uint64 ( const xdr_data2_t & n_Val );
|
||||||
|
|
||||||
|
xdr_data_t XDR_encode_shortints32(const int v1, const int v2);
|
||||||
|
void XDR_decode_shortints32(const xdr_data_t & n_Val, int &v1, int &v2);
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// FIXME: #1 these funtions must be fixed for
|
// FIXME: #1 these funtions must be fixed for
|
||||||
|
|
Loading…
Reference in a new issue