本文整理汇总了C++中LE函数的典型用法代码示例。如果您正苦于以下问题:C++ LE函数的具体用法?C++ LE怎么用?C++ LE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BEGIN_IF
bool CCBuffer::isReadable(unsigned int u_len) const
{
BEGIN_IF(LH(LE(_u_content_size, 0), LE(u_len, 0)))
DO_RETURN_FLASE;
END_IF
DO_RETURN_R(LXE(CA(_u_read_pos, u_len), _u_content_size));
}
示例2: GetTypeModuleSessionInfo
RTConnectionManager::ModuleInfo* RTConnectionManager::findConnectorInfoById(const std::string& userid)
{
RTConnectionManager::ModuleInfo* pInfo = NULL;
std::string connectorid;
std::string sessionid;
if (RTHiredisLocal::Instance()->CmdHGet(HI_USER_CONNECTOR_ID, userid, connectorid) && connectorid.length()>0) {
TypeModuleSessionInfoLists* infoList = GetTypeModuleSessionInfo();
TypeModuleSessionInfoLists::iterator it = infoList->begin();
TypeModuleSessionInfo* t_pInfo = NULL;
for (; it!=infoList->end(); it++) {
t_pInfo = *it;
if (t_pInfo && t_pInfo->moduleId.compare(connectorid) == 0) {
sessionid = t_pInfo->sessionIds.front();
LI("find transfer sessionid:%s", sessionid.c_str());
break;
}
}
} else {
LE("RTHiredis CmdHGet error\n");
}
if (sessionid.length()>0) {
pInfo = findModuleInfoBySid(sessionid);
} else {
LE("findConnectorInfoById sessionid is null\n");
}
return pInfo;
}
示例3: Assert
int MRTMeeting::Start(const char*pConnIp, unsigned short usConnPort, const char*pDispIp, unsigned short usDispPort, const char* pHttpIp, unsigned short usHttpPort)
{
Assert(g_inited);
Assert(pConnIp != NULL && strlen(pConnIp)>0);
Assert(pDispIp != NULL && strlen(pDispIp)>0);
Assert(pHttpIp != NULL && strlen(pHttpIp)>0);
char hh[24] = {0};
sprintf(hh, "%s:%u", pHttpIp, usHttpPort);
std::string mid;
GenericSessionId(mid);
MRTConnManager::Instance().SetMeetingId(mid);
LI("[][]MeetingId:%s\n", mid.c_str());
char addr[24] = {0};
sprintf(addr, "%s %u", pConnIp, usConnPort);
MRTConnManager::Instance().GetAddrsList()->push_front(addr);
if (!(MRTConnManager::Instance().ConnectConnector())) {
LE("Start to ConnectConnector failed\n");
return -1;
}
if (!(MRTRoomManager::Instance().Init(pDispIp, usDispPort, pHttpIp, usHttpPort, hh))) {
LE("Start to RoomManager Init failed\n");
return -1;
}
return 0;
}
示例4: fopen_tmpfile
FILE *fopentmpfile(PCStr(path),int remove)
{ FILE *fp;
int fd;
if( isWindowsCE() ){
fp = fopen_tmpfile(path);
add_FILEY(FL_ARG,"fopentmpfile",fp);
}else
if( ACT_UNLINKABLE ){
if( fp = fopen(path,FOPEN_RWB) )
if( remove )
unlink(path);
}else{
fd = newtmp(path);
if( 0 <= fd ){
if( fp = fdopen(fd,FOPEN_RWB) ){
addtmp(fd,path);
add_FILEY(FL_ARG,"fopentmpfile",fp);
LV("fopentmpfile(%s) %x/%d",path,p2i(fp),fileno(fp));
}else LE("cannot fdopen(%d) %s",fd,path);
}else{
LE("cannot open tmpfile(%s)",path);
fp = NULL;
}
}
return fp;
}
示例5: decode
DLLEXPORT void decode(int link_type UNUSED,const char *packet,unsigned len)
{
unsigned int offset=0;
int value;
int more = 0;
LE(value,20); printf(" MPLS: Label: %d\n",value);
LE(value,3); printf(" MPLS: Class of service: %d\n",value);
LE(value,1); printf(" MPLS: Stack: %s\n",value?"Last" :"More");
if (value == 0) more = 1;
LE(value,8); printf(" MPLS: TTL: %d\n",value);
/* MPLS doesn't say what it's encapsulating, so we make an educated
* guess and pray.
*/
if (more)
decode_next(packet+offset/8,len-4,"eth",0x8847);
else if ((*(packet+4)&0xF0) == 0x40)
decode_next(packet+offset/8,len-4,"eth",0x0800);
else if ((*(packet+4)&0xF0) == 0x60)
decode_next(packet+offset/8,len-4,"eth",0x86DD);
else
decode_next(packet+offset/8,len-4,"link",1);
return;
}
示例6: LE
//* For RTConnHttp
void CRTConnection::OnLogin(const char* pUserid, const char* pPass, const char* pNname)
{
bool ok = false;
{
//check & auth
#if 0
std::string pass;
RTHiredisRemote::Instance().CmdGet(pUserid, pass);
if (pass.compare(pPass)!=0) {
LE("OnLogin pass not same redis error\n");
return;
}
#endif
m_userId = pUserid;
m_token = pPass;
m_nname = pNname;
}
//if (ok) {
if (false) {
std::string sid;
//store userid & pass
CRTConnManager::ConnectionInfo* pci = new CRTConnManager::ConnectionInfo();
if (pci) {
GenericSessionId(sid);
m_connectorId = CRTConnManager::Instance().ConnectorId();
pci->_connId = sid;
pci->_connAddr = CRTConnManager::Instance().ConnectorIp();
pci->_connPort = CRTConnManager::Instance().ConnectorPort();
pci->_userId = pUserid;
pci->_token = pPass;
pci->_pConn = NULL;
pci->_connType = CONNECTIONTYPE::_chttp;
pci->_flag = 1;
std::string uid(pUserid);
CRTConnManager::Instance().AddUser(CONNECTIONTYPE::_chttp, uid, pci);
} else {
LE("new ConnectionInfo error!!!\n");
}
} else {
std::string uid(pUserid);
CRTConnManager::ConnectionInfo* pci = NULL;
CRTConnManager::Instance().AddUser(CONNECTIONTYPE::_chttp, uid, pci);
}
{
// send response
rapidjson::Document jsonDoc;
rapidjson::StringBuffer jsonStr;
rapidjson::Writer<rapidjson::StringBuffer> jsonWriter(jsonStr);
jsonDoc.SetObject();
if (ok) {
jsonDoc.AddMember("login", "success", jsonDoc.GetAllocator());
} else {
jsonDoc.AddMember("login", "failed", jsonDoc.GetAllocator());
}
jsonDoc.Accept(jsonWriter);
SendResponse(HPS_OK, jsonStr.GetString());
}
}
示例7: b64_char_to_byte
/*
* Convert character c to the corresponding 6-bit value. If character c
* is not a Base64 character, then 0xFF (255) is returned.
*/
static unsigned b64_char_to_byte(int c) {
unsigned x;
x = (GE(c, 'A') & LE(c, 'Z') & (c - 'A')) |
(GE(c, 'a') & LE(c, 'z') & (c - ('a' - 26))) |
(GE(c, '0') & LE(c, '9') & (c - ('0' - 52))) | (EQ(c, '+') & 62) |
(EQ(c, '/') & 63);
return x | (EQ(x, 0) & (EQ(c, 'A') ^ 0xFF));
}
示例8: switch
bool RTHiredis::HandleReply(redisReply* reply, std::string* res)
{
switch (reply->type) {
case REDIS_REPLY_STRING:
{
if (res) {
res->assign(reply->str);
} else {
LI("reply str:%s\n", reply->str);
}
}
break;
case REDIS_REPLY_ARRAY:
{
LE("Is this Possible REPLY_ARRAY?\n");
}
break;
case REDIS_REPLY_INTEGER:
{
if (res) {
char c[12] = {0};
sprintf(c, "%lld", reply->integer);
res->assign(c);
} else {
LI("reply int:%lld\n", reply->integer);
}
}
break;
case REDIS_REPLY_NIL:
{
LI("reply nil\n");
}
break;
case REDIS_REPLY_STATUS:
{
LI("reply status\n");
}
break;
case REDIS_REPLY_ERROR:
{
if (res) {
res->assign(reply->str);
} else {
LI("reply err:%s\n", reply->str);
}
}
break;
default:
{
LE("reply default handle\n");
}
break;
}
return true;
}
示例9: LE
void MRTTransferSession::OnTypeConn(const std::string& str)
{
#if DEF_PROTO
pms::ConnMsg c_msg;
if (!c_msg.ParseFromString(str)) {
LE("OnTypeConn c_msg.ParseFromString error\n");
}
LI("OnTypeConn connmsg--->:\n");
//c_msg.PrintDebugString();
if ((c_msg.conn_tag() == pms::EConnTag::THELLO)) {
// when ME connector to other:
if (c_msg.transferid().length()>0) {
m_transferSessId = c_msg.transferid();
{
MRTConnManager::ModuleInfo* pmi = new MRTConnManager::ModuleInfo();
if (pmi) {
pmi->flag = 1;
pmi->othModuleType = c_msg.tr_module();
pmi->othModuleId = m_transferSessId;
pmi->pModule = this;
//bind session and transfer id
MRTConnManager::Instance().AddModuleInfo(pmi, m_transferSessId);
//store which moudle connect to this connector
MRTConnManager::Instance().AddTypeModuleSession(c_msg.tr_module(), c_msg.moduleid(), m_transferSessId);
LI("store other moduleid:%s, transfersessionid:%s\n", c_msg.moduleid().c_str(), m_transferSessId.c_str());
} else {
LE("new ModuleInfo error\n");
}
}
pms::TransferMsg t_msg;
c_msg.set_tr_module(pms::ETransferModule::MMEETING);
c_msg.set_conn_tag(pms::EConnTag::THELLOHI);
c_msg.set_transferid(m_transferSessId);
//send self module id to other
c_msg.set_moduleid(MRTConnManager::Instance().MeetingId());
t_msg.set_type(pms::ETransferType::TCONN);
t_msg.set_flag(pms::ETransferFlag::FNEEDACK);
t_msg.set_priority(pms::ETransferPriority::PHIGH);
t_msg.set_content(c_msg.SerializeAsString());
std::string s = t_msg.SerializeAsString();
SendTransferData(s.c_str(), (int)s.length());
} else {
LE("Connection id:%s error!!!\n", c_msg.transferid().c_str());
}
}
#else
LE("not define DEF_PROTO\n")
#endif
}
示例10: Assert
int RTMsgQueue::Start(const char*pConnIp, unsigned short usConnPort, const char*pModuleIp, unsigned short usModulePort)
{
Assert(g_inited);
Assert(pConnIp != NULL && strlen(pConnIp)>0);
Assert(pModuleIp != NULL && strlen(pModuleIp)>0);
RTHiredisLocal::Instance()->Connect();
std::string mid;
RTConnectionManager::Instance()->GenericSessionId(mid);
RTConnectionManager::Instance()->SetMsgQueueId(mid);
LI("[][]MsgQueueId:%s\n", mid.c_str());
if(usConnPort == 0)
{
LE("MsgQueue server need usConnPort...!");
Assert(false);
}
if(usConnPort > 0)
{
char addr[24] = {0};
sprintf(addr, "%s %u", pConnIp, usConnPort);
RTConnectionManager::Instance()->GetAddrsList()->push_front(addr);
if (!(RTConnectionManager::Instance()->ConnectConnector())) {
LE("Start to ConnectConnector failed\n");
return -1;
}
}
if(usModulePort == 0)
{
LE("MsgQueue server need usModulePort...!!");
Assert(false);
}
if(usModulePort > 0)
{
m_pModuleListener = new RTModuleListener();
OS_Error err = m_pModuleListener->Initialize(INADDR_ANY, usModulePort);
if (err!=OS_NoErr)
{
LE("CreateMeetingListener error port=%d \n", usModulePort);
delete m_pModuleListener;
m_pModuleListener=NULL;
return -1;
}
LI("Start MsgQueue service meet:(%d) ok...,socketFD:%d\n", usModulePort, m_pModuleListener->GetSocketFD());
m_pModuleListener->RequestEvent(EV_RE);
}
return 0;
}
示例11: point_in_rectangle
bool point_in_rectangle(const point &p, const point &v, double w, double h) {
static const bool EDGE_IS_INSIDE = true;
if (w < 0) {
return point_in_rectangle(p, point(v.x + w, v.y), -w, h);
}
if (h < 0) {
return point_in_rectangle(p, point(v.x, v.y + h), w, -h);
}
return EDGE_IS_INSIDE
? (GE(p.x, v.x) && LE(p.x, v.x + w) && GE(p.y, v.y) && LE(p.y, v.y + h))
: (GT(p.x, v.x) && LT(p.x, v.x + w) && GT(p.y, v.y) && LT(p.y, v.y + h));
}
示例12: LE
bool CRTTransferSession::Connect(const std::string addr, int port)
{
if (addr.empty() || port < 2048) {
LE("%s invalid params addr:%s, port:%d\n", __FUNCTION__, addr.c_str(), port);
return false;
}
OS_Error err = GetSocket()->Connect(SocketUtils::ConvertStringToAddr(addr.c_str()), port);
if (err == OS_NoErr || err == EISCONN) {
return true;
} else {
LE("%s ERR:%d\n", __FUNCTION__, err);
return false;
}
}
示例13: LE
void RTConnectionTcp::OnSndMsg(MSGTYPE mType, long long mseq, const char* pUserid, const char* pData, int dLen)
{
if (!pData) {
LE("%s invalid params\n", __FUNCTION__);
std::string resp;
GenericResponse(SIGNALTYPE::reqsndmsg, mType, mseq, RTCommCode::_invparams, GetRTCommStatus(RTCommCode::_invparams), resp);
SendResponse(0, resp.c_str());
return;
}
//no matter mType is meet or callcenter or p2p or others
//the following code should be same
//find an TrasnferSession By mtype
//transfer msg by TransferSession
TRANSFERMSG t_trmsg;
TRANSMSG t_msg;
t_msg._flag = 0;
t_msg._touser = "";
t_msg._connector = RTConnectionManager::Instance()->ConnectorId();
t_msg._content = pData;
t_trmsg._action = TRANSFERACTION::req;
t_trmsg._fmodule = TRANSFERMODULE::mconnector;
t_trmsg._type = TRANSFERTYPE::trans;
t_trmsg._trans_seq = GenericTransSeq();
t_trmsg._trans_seq_ack = 0;
t_trmsg._valid = 1;
t_trmsg._content = t_msg.ToJson();
const std::string s = t_trmsg.ToJson();
RTConnectionManager::ModuleInfo* pmi = RTConnectionManager::Instance()->findModuleInfo(pUserid, (TRANSFERMODULE)mType);
if (pmi && pmi->pModule) {
pmi->pModule->SendTransferData(s.c_str(), (int)s.length());
} else {
LE("pmi->pModule is NULL\n");
std::string resp;
GenericResponse(SIGNALTYPE::reqsndmsg, mType, mseq, RTCommCode::_errmoduinfo, GetRTCommStatus(RTCommCode::_errmoduinfo), resp);
SendResponse(0, resp.c_str());
return;
}
{
std::string resp;
GenericResponse(SIGNALTYPE::reqsndmsg, mType, mseq, RTCommCode::_ok, GetRTCommStatus(RTCommCode::_ok), resp);
SendResponse(0, resp.c_str());
return;
}
}
示例14: LE
const char* RTConnHttp::GenerateRequest(http_method method, const std::string& path, const std::string& data, int &outLen) const
{
if (path.length()==0) {
LE("params error!!!\n");
outLen = 0;
return "";
}
http_message *httpMsg = http_generator_create(HTTP_REQUEST);
http_generator_set_method(httpMsg, method);
http_generator_set_path(httpMsg, path.c_str(), (int)path.length());
http_generator_add_header(httpMsg, HPR_HOST, m_host.c_str(), (int)m_host.length());
http_generator_add_header(httpMsg, HPR_ACCEPT, "application/json", 16);
if(data.length()>0)
{
http_generator_set_content(httpMsg, data.c_str(), (int)data.length(), "application/x-www-form-urlencoded");
}
int nLen = 0;
char* pMsg = http_generator_tostring(httpMsg, &nLen);
outLen = nLen;
http_generator_destroy(httpMsg);
httpMsg = NULL;
return pMsg;
}
示例15: while
int RTConnHttp::ProcessData(const char*pData, int nLen)
{
int parsed = 0;
enum http_errno err;
while (parsed < nLen)
{
const char* pMsg = pData + parsed;
int msgLen = nLen - parsed;
int nlen = do_http_parse(HTTP_RESPONSE, (char *)pMsg, msgLen, &err, &RTConnHttp::OnParsedHttpMessage, this);
parsed += nlen;
if (err != HPE_OK)
{
LE("do_http_parse error!!!!!!\n");
parsed = nLen;
break;
}
else if (nlen == 0)
{
break;
}
else
{
//LI(">Recv:%.*s \r\n", parsed, pMsg);
}
}
return parsed;
}