本文整理汇总了C++中PyRep::TypeString方法的典型用法代码示例。如果您正苦于以下问题:C++ PyRep::TypeString方法的具体用法?C++ PyRep::TypeString怎么用?C++ PyRep::TypeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyRep
的用法示例。
在下文中一共展示了PyRep::TypeString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Decode
bool PyPacket::Decode(PyRep **in_packet)
{
PyRep *packet = *in_packet; //consume
*in_packet = NULL;
PySafeDecRef(payload);
PySafeDecRef(named_payload);
if(packet->IsChecksumedStream())
{
PyChecksumedStream* cs = packet->AsChecksumedStream();
//TODO: check cs->checksum
packet = cs->stream();
PyIncRef( packet );
PyDecRef( cs );
}
//Dragon nuance... it gets wrapped again
if(packet->IsSubStream())
{
PySubStream* ss = packet->AsSubStream();
ss->DecodeData();
if(ss->decoded() == NULL)
{
codelog(NET__PACKET_ERROR, "failed: unable to decode initial packet substream.");
PyDecRef(packet);
return false;
}
packet = ss->decoded();
PyIncRef( packet );
PyDecRef( ss );
}
if(!packet->IsObject())
{
codelog(NET__PACKET_ERROR, "failed: packet body is not an 'Object': %s", packet->TypeString());
PyDecRef(packet);
return false;
}
PyObject *packeto = (PyObject *) packet;
type_string = packeto->type()->content();
if(!packeto->arguments()->IsTuple())
{
codelog(NET__PACKET_ERROR, "failed: packet body does not contain a tuple");
PyDecRef(packet);
return false;
}
PyTuple *tuple = (PyTuple *) packeto->arguments();
if(tuple->items.size() != 7)
{
codelog(NET__PACKET_ERROR, "failed: packet body does not contain a tuple of length 7");
PyDecRef(packet);
return false;
}
if(!tuple->items[0]->IsInt())
{
codelog(NET__PACKET_ERROR, "failed: First main tuple element is not an integer");
PyDecRef(packet);
return false;
}
PyInt *typer = (PyInt *) tuple->items[0];
switch(typer->value()) {
case AUTHENTICATION_REQ:
case AUTHENTICATION_RSP:
case IDENTIFICATION_REQ:
case IDENTIFICATION_RSP:
case CALL_REQ:
case CALL_RSP:
case TRANSPORTCLOSED:
case RESOLVE_REQ:
case RESOLVE_RSP:
case NOTIFICATION:
case ERRORRESPONSE:
case SESSIONCHANGENOTIFICATION:
case SESSIONINITIALSTATENOTIFICATION:
case PING_REQ:
case PING_RSP:
type = (MACHONETMSG_TYPE) typer->value();
break;
default:
codelog(NET__PACKET_ERROR, "failed: Unknown message type %"PRIu64, typer->value());
PyDecRef(packet);
return false;
break;
}
//source address
//.........这里部分代码省略.........