Return Type | Function name | Arguments |
---|---|---|
hzEcode | hzLogger::OpenPublic | (const char*,hzLogRotate,) |
Declared in file: hzProcess.h
Defined in file : hzLogger.cpp
Function Logic:
Function body:
hzEcode hzLogger::OpenPublic (const char* fpath, hzLogRotate eRotate) { _hzfunc("hzLogger::OpenPublic") ; uint32_t nSize ; uint32_t nUsr ; uint32_t nGrp ; uint32_t nProcID ; uchar* u ; m_pConnection = new hzTcpClient() ; if (m_pConnection->ConnectStd(s_LocalHost, PORT_LOGSERVER) != E_OK) return E_HOSTFAIL ; nSize = 16+strlen(fpath) ; nProcID = getpid() ; nUsr = geteuid() ; nGrp = getegid() ; u = (uchar*) m_cvData ; u[0]= LS_OPEN_PUB ; u[1]= (nSize & 0xff00)>>8; u[2]= (nSize & 0xff); u[3]= (nProcID & 0xff000000)>>24; u[4]= (nProcID & 0xff0000)>>16; u[5]= (nProcID & 0xff00)>>8; u[6]= (nProcID & 0xff); u[7]= (nUsr & 0xff000000)>>24; u[8]= (nUsr & 0xff0000)>>16; u[9]= (nUsr & 0xff00)>>8; u[10]=(nUsr & 0xff); u[11]=(nGrp & 0xff000000)>>24; u[12]=(nGrp & 0xff0000)>>16; u[13]=(nGrp & 0xff00)>>8; u[14]=(nGrp & 0xff); strncpy(m_cvData + 15,fpath,HZ_MAXPATHLEN) ; if (m_pConnection->Send(m_cvData, nSize) != E_OK) return E_SENDFAIL ; if (m_pConnection->Recv(m_cvData, nSize, 64)!=E_OK) return E_RECVFAIL ; if (nSize == 4&& m_cvData[0]== LS_OK) { m_nSessID = 0; m_nSessID |= (u[1]<< 16); m_nSessID |= (u[2]<< 8); m_nSessID |= u[3]; return E_OK ; } if (m_cvData[0]== LS_ERR_PERM) return E_WRITEFAIL ; m_pDataPtr = m_cvData + 10; return E_PROTOCOL ; }