bool ProcessMonitorData::GetRawData(char *databuf,int len) //取得原始数据 { if(databuf==NULL) return false; int dlen=GetRawDataSize(); if(len<dlen) return false; char *pt=databuf; memmove(pt,&dlen,sizeof(int)); pt+=sizeof(int); memmove(pt,&m_state,sizeof(int)); pt+=sizeof(int); memmove(pt,&m_datalen,sizeof(int)); pt+=sizeof(int); memmove(pt,m_data,m_datalen); pt+=m_datalen; strcpy(pt,m_dllname.c_str()); pt+=m_dllname.size()+1; strcpy(pt,m_funname.c_str()); pt+=m_funname.size()+1; return true; }
char* Resource::GetRawData(char *lpbuf,S_UINT bufsize) { if(lpbuf==NULL) return NULL; if(bufsize<GetRawDataSize()) return NULL; S_UINT len=0,tlen=sizeof(S_UINT); char *pt=lpbuf; strcpy(pt,m_Language); pt+=strlen(m_Language); pt[0]='\0'; pt++; len=m_ResourceDict.GetRawDataSize(); memmove(pt,&len,tlen); pt+=tlen; if(m_ResourceDict.GetRawData(pt,len)==NULL) return NULL; pt+=len; return lpbuf; }
char* Monitor::GetRawData(char *lpbuf,S_UINT bufsize) { if(lpbuf==NULL) return NULL; if(bufsize<GetRawDataSize()) return NULL; S_UINT len=0,tlen=sizeof(S_UINT); char *pt=lpbuf; strcpy(pt,m_ID); pt+=strlen(m_ID); pt[0]='\0'; pt++; len=m_Property.GetRawDataSize(); memmove(pt,&len,tlen); pt+=tlen; if(m_Property.GetRawData(pt,len)==NULL) return NULL; pt+=len; len=m_Parameters.GetRawDataSize(); memmove(pt,&len,tlen); pt+=tlen; if(m_Parameters.GetRawData(pt,len)==NULL) return NULL; pt+=len; len=m_ADParameters.GetRawDataSize(); memmove(pt,&len,tlen); pt+=tlen; if(m_ADParameters.GetRawData(pt,len)==NULL) return NULL; pt+=len; for(int i=0;i<3;i++) { len=m_AlertCondition[i].GetRawDataSize(); memmove(pt,&len,tlen); pt+=tlen; if(m_AlertCondition[i].GetRawData(pt,len)==NULL) return NULL; pt+=len; } return lpbuf; }
char* CommonData::GetRawData(char *lpbuf,S_UINT bufsize) { if(lpbuf==NULL) return NULL; if(bufsize<GetRawDataSize()) return NULL; S_UINT len=0,tlen=sizeof(S_UINT); char *pt=lpbuf; memmove(pt,&m_DataType,sizeof(int)); pt+=sizeof(int); memmove(pt,&m_DataLen,tlen); pt+=tlen; memmove(pt,m_data,m_DataLen); pt+=m_DataLen; return lpbuf; }
char* QueueRecord::GetRawData(char *lpbuf,S_UINT bufsize) { if(lpbuf==NULL) return NULL; S_UINT dsize=GetRawDataSize(); if(bufsize<dsize) return NULL; S_UINT len=0,tlen=sizeof(S_UINT); char *pt=lpbuf; memmove(pt,&dsize,sizeof(S_UINT)); pt+=sizeof(S_UINT); memmove(pt,&m_createtime,sizeof(svutil::TTime)); pt+=sizeof(svutil::TTime); strcpy(pt,m_label.c_str()); pt+=m_label.size(); pt[0]='\0'; pt++; memmove(pt,&m_level,sizeof(int)); pt+=sizeof(int); memmove(pt,&m_datalen,sizeof(S_UINT)); pt+=sizeof(S_UINT); if(m_data==NULL) { if(m_datalen!=0) return NULL; } memmove(pt,m_data,m_datalen); pt+=m_datalen; return lpbuf; }
char* Section::GetRawData(char *lpbuf,S_UINT bufsize) { if(lpbuf==NULL) return NULL; if(bufsize<GetRawDataSize()) return NULL; S_UINT len=0,tlen=sizeof(S_UINT); char *pt=lpbuf; memmove(pt,&m_hashtablesize,tlen); pt+=tlen; strcpy(pt,m_SectionName); pt+=strlen(m_SectionName); pt[0]='\0'; pt++; // len=m_data.size(); len=m_KeyOrder.size(); memmove(pt,&len,tlen); pt+=tlen; WORDLIST::iterator wit; CommonData **pdata=NULL; for(wit=m_KeyOrder.begin();wit!=m_KeyOrder.end();wit++) { pdata=m_data.find((*wit)); if(pdata!=NULL) { strcpy(pt,(*wit).getword()); pt+=strlen((*wit).getword()); pt[0]='\0'; pt++; len=(*pdata)->GetRawDataSize(); memmove(pt,&len,tlen); pt+=tlen; if(!(*pdata)->GetRawData(pt,len)) return false; pt+=len; } } /* SECTIONDATA::iterator it; while(m_data.findnext(it)) { strcpy(pt,(*it).getkey().getword()); pt+=strlen((*it).getkey().getword()); pt[0]='\0'; pt++; len=(*it).getvalue()->GetRawDataSize(); memmove(pt,&len,tlen); pt+=tlen; if(!(*it).getvalue()->GetRawData(pt,len)) return false; pt+=len; } */ return lpbuf; }