本文整理汇总了C++中InPacket::getBytesLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ InPacket::getBytesLeft方法的具体用法?C++ InPacket::getBytesLeft怎么用?C++ InPacket::getBytesLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InPacket
的用法示例。
在下文中一共展示了InPacket::getBytesLeft方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deliverPacket
void SessionManager::deliverPacket(InPacket &in)
{
ICQ_STR to, from;
uint8 online;
uint16 cmd;
in >> to >> from >> online >> cmd;
PACKET p;
p.to = to.text;
p.from = from.text;
p.cmd = cmd;
p.online = online;
p.data = in.cursor;
p.dataLen = in.getBytesLeft();
if (strchr(to.text, '@')) {
s2s->deliver(&p);
return;
}
Session *s = sessionHash.get(to.text);
Client *client = NULL;
if (s)
client = s->client;
else if (!online) {
ICQ_LOG("%s is offline, bounce it\n", to.text);
client = chooseClient();
}
if (client)
client->deliver(&p);
}
示例2: onPacketReceived
void ICQMain::onPacketReceived(const char *from, uint16 cmd, InPacket &in)
{
ClientSession *s = sessionHash->get(from);
if (!s)
return;
PACKET p;
p.cmd = cmd;
p.data = in.cursor;
p.dataLen = in.getBytesLeft();
p.from = NULL;
p.to = NULL;
postEvent(EV_S_OUT, s, &p);
}
示例3: addSession
void ICQMain::addSession(ClientSession *s, InPacket &in)
{
PACKET p;
p.cmd = CMD_LOGIN;
p.data = in.cursor;
p.dataLen = in.getBytesLeft();
p.from = NULL;
p.to = NULL;
// Select an event queue
s->queue = selectQueue();
// Increase reference count, so that we should not be delete after processed
s->addRef();
// Put it to the hash
sessionHash->put(s);
postEvent(EV_SESSION, s, &p);
}