TEST(DupSend, DuplicateSend) { auto &opts = WdtOptions::getMutable(); opts.skip_writes = true; opts.enable_download_resumption = false; // Tmpfile (deleted) FILE *tmp = tmpfile(); EXPECT_NE(tmp, nullptr); // We keep the fd around int fd = fileno(tmp); WLOG(INFO) << "tmp file fd " << fd; fclose(tmp); WdtTransferRequest req(/* start port */ 0, /* num ports */ 3, "/tmp/wdtTest"); Receiver r(req); req = r.init(); EXPECT_EQ(OK, req.errorCode); EXPECT_EQ(OK, r.transferAsync()); // Not even using the actual name (which we don't know) req.fileInfo.push_back(WdtFileInfo(fd, 0, "notexisting23r4")); Sender s(req); req = s.init(); EXPECT_EQ(OK, req.errorCode); ErrorCode ret1 = s.transferAsync(); EXPECT_EQ(OK, ret1); ErrorCode ret2 = s.transferAsync(); EXPECT_EQ(ALREADY_EXISTS, ret2); auto report = s.finish(); EXPECT_EQ(OK, report->getSummary().getErrorCode()); }
void aiPoints::readSampleBody(Sample & sample, uint64_t idx) { auto ss = aiIndexToSampleSelector(idx); auto ss2 = aiIndexToSampleSelector(idx + 1); auto& summary = getSummary(); readVisibility(sample, ss); // points if (m_summary.has_points) { auto prop = m_schema.getPositionsProperty(); prop.get(sample.m_points_sp, ss); if (summary.interpolate_points) { prop.get(sample.m_points_sp2, ss2); } } // velocities sample.m_velocities_sp.reset(); if (m_summary.has_velocities) { m_schema.getVelocitiesProperty().get(sample.m_velocities_sp, ss); } // IDs sample.m_ids_sp.reset(); if (m_summary.has_ids) { m_schema.getIdsProperty().get(sample.m_ids_sp, ss); } }
void basicTest(bool resumption) { auto &opts = WdtOptions::getMutable(); opts.skip_writes = true; opts.enable_download_resumption = false; // Tmpfile (deleted) FILE *tmp = tmpfile(); EXPECT_NE(tmp, nullptr); // We keep the fd around int fd = fileno(tmp); WLOG(INFO) << "tmp file fd " << fd; fclose(tmp); std::string recvDir; folly::toAppend("/tmp/wdtTest/recv", rand32(), &recvDir); WdtTransferRequest req(/* start port */ 0, /* num ports */ 3, recvDir); Receiver r(req); req = r.init(); EXPECT_EQ(OK, req.errorCode); EXPECT_EQ(OK, r.transferAsync()); // Not even using the actual name (which we don't know) req.fileInfo.push_back(WdtFileInfo(fd, 0, "notexisting23r4")); Sender s(req); // setWdtOptions not needed if change of option happens before sender cstror // but this indirectly tests that API (but need to manually see // "entered READ_FILE_CHUNKS" in the logs) TODO: test that programatically opts.enable_download_resumption = resumption; s.setWdtOptions(opts); req = s.init(); EXPECT_EQ(OK, req.errorCode); auto report = s.transfer(); EXPECT_EQ(OK, report->getSummary().getErrorCode()); struct stat dirStat; int sret = stat(recvDir.c_str(), &dirStat); EXPECT_EQ(sret, -1); EXPECT_EQ(errno, ENOENT); }
int main (int argc, char **argv) { int i, nocase = 0; FILE *fd; char filename[20]; ACSM_STRUCT * acsm; if (argc < 3) { fprintf (stderr,"Usage: acsmx filename pattern1 pattern2 ... -nocase\n"); exit (0); } acsm = acsmNew (); strcpy (filename, argv[1]); fd = fopen(filename,"r"); if(fd == NULL) { fprintf(stderr,"Open file error!\n"); exit(1); } for (i = 1; i < argc; i++) if (strcmp (argv[i], "-nocase") == 0) nocase = 1; for (i = 2; i < argc; i++) { if (argv[i][0] == '-') continue; printf("%s,%d\n",argv[i],strlen (argv[i])); acsmAddPattern (acsm, argv[i], strlen (argv[i]), nocase,1); } fgets(text,MAXLEN,fd); /* Generate GtoTo Table and Fail Table */ acsmCompile (acsm); printf("--------------------------------\n"); NS_TIME(time); NS_TIME_START(time); /*Search Pattern*/ //while ( fgets(text,MAXLEN,fd) ) //{ acsmSearch (acsm, text, strlen (text), PrintMatch); // nline++; //} NS_TIME_END(time); PrintSummary(acsm->acsmPatterns); int a[10]={45,45,45,4,1}; #ifdef __HAVE__LOAD__ printf("-------%d\n", getSummary (acsm->acsmPatterns,a)); #endif acsmFree (acsm); printf ("\n### AC Match Finished ###\n"); // system("pause"); return (0); }
void Receiver::progressTracker() { // Progress tracker will check for progress after the time specified // in milliseconds. int progressReportIntervalMillis = options_.progress_report_interval_millis; int throughputUpdateIntervalMillis = options_.throughput_update_interval_millis; if (progressReportIntervalMillis <= 0 || throughputUpdateIntervalMillis < 0 || !isJoinable_) { return; } int throughputUpdateInterval = throughputUpdateIntervalMillis / progressReportIntervalMillis; int64_t lastEffectiveBytes = 0; std::chrono::time_point<Clock> lastUpdateTime = Clock::now(); int intervalsSinceLastUpdate = 0; double currentThroughput = 0; WLOG(INFO) << "Progress reporter updating every " << progressReportIntervalMillis << " ms"; auto waitingTime = std::chrono::milliseconds(progressReportIntervalMillis); int64_t totalSenderBytes = -1; while (true) { { std::unique_lock<std::mutex> lock(mutex_); conditionFinished_.wait_for(lock, waitingTime); if (transferStatus_ == THREADS_JOINED) { break; } } double totalTime = durationSeconds(Clock::now() - startTime_); TransferStats globalStats; for (const auto &receiverThread : receiverThreads_) { globalStats += receiverThread->getTransferStats(); } totalSenderBytes = globalStats.getTotalSenderBytes(); if (totalSenderBytes == -1) { continue; } auto transferReport = folly::make_unique<TransferReport>( std::move(globalStats), totalTime, totalSenderBytes); intervalsSinceLastUpdate++; if (intervalsSinceLastUpdate >= throughputUpdateInterval) { auto curTime = Clock::now(); int64_t curEffectiveBytes = transferReport->getSummary().getEffectiveDataBytes(); double time = durationSeconds(curTime - lastUpdateTime); currentThroughput = (curEffectiveBytes - lastEffectiveBytes) / time; lastEffectiveBytes = curEffectiveBytes; lastUpdateTime = curTime; intervalsSinceLastUpdate = 0; } transferReport->setCurrentThroughput(currentThroughput); progressReporter_->progress(transferReport); if (reportPerfSignal_.notified()) { logPerfStats(); } } }
std::ostream& DataOverview::dump(std::ostream& o) const { o << "DataOverview[getSummary()="; o << common::to_quoted_string(getSummary()); o << ", getIconName()="; o << common::to_quoted_string(getIconName()); o << ']'; return o; }
ErrorCode Wdt::wdtSend(const std::string &wdtNamespace, const WdtTransferRequest &req, std::shared_ptr<IAbortChecker> abortChecker, bool terminateExistingOne) { if (!settingsApplied_) { applySettings(); } if (req.errorCode != OK) { LOG(ERROR) << "Transfer request error " << errorCodeToStr(req.errorCode); return req.errorCode; } // Protocol issues will/should be flagged as error when we call createSender // try to create sender SenderPtr sender; auto wdtController = WdtResourceController::get(); // TODO should be using recoverid const std::string secondKey = req.hostName; ErrorCode errCode = wdtController->createSender(wdtNamespace, secondKey, req, sender); if (errCode == ALREADY_EXISTS && terminateExistingOne) { LOG(WARNING) << "Found pre-existing sender for " << wdtNamespace << " " << secondKey << " aborting it and making a new one"; sender->abort(ABORTED_BY_APPLICATION); // This may log an error too wdtController->releaseSender(wdtNamespace, secondKey); // Try#2 errCode = wdtController->createSender(wdtNamespace, secondKey, req, sender); } if (errCode != OK) { LOG(ERROR) << "Failed to create sender " << errorCodeToStr(errCode) << " " << wdtNamespace << " " << secondKey; return errCode; } wdtSetAbortSocketCreatorAndReporter(wdtNamespace, sender.get(), req, abortChecker); auto transferReport = sender->transfer(); ErrorCode ret = transferReport->getSummary().getErrorCode(); wdtController->releaseSender(wdtNamespace, secondKey); LOG(INFO) << "wdtSend for " << wdtNamespace << " " << secondKey << " " << " ended with " << errorCodeToStr(ret); return ret; }
int main() { initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); //open file and write intro data to file FILE *file; file = openFile(); //collect summary data from user and write to file char *title = ""; char *desc = ""; char *loc = ""; char temp[3] = ""; //sprintf(temp,"a"); getSummary(title, desc, loc); //collect data/time data from user and write to file char *startdatetime; char *enddatetime; getDateTime(startdatetime,enddatetime); //!!!!!!remember: [date]T[time]!!!!!!!!!!!!! //clean up getch(); endwin(); //print data to file printIntro(file); printCurrentTime(file); fprintf(file,"ORGANIZER;CN=Derek Redfern:mailto:[email protected]\n\ DESCRIPTION:%s\nSUMMARY;LANGUAGE=en-us:%s\nLOCATION:%s\n",\ desc,title,loc); fprintf(file,"DTSTART;TZID=\"Eastern Standard Time\":%s\n",startdatetime); fprintf(file,"DTEND;TZID=\"Eastern Standard Time\":%s\n",enddatetime); fprintf(file,"END:VEVENT\nEND:VCALENDAR\n"); fclose(file); return 0; }
ArrayElement* ToDo::clone() { ToDo* ret = new ToDo(); if (getClass()) ret->setClass(*classEvent); if (getCompleted()) ret->setCompleted(*completed); if (getCreated()) ret->setCreated(*created); if (getDescription()) ret->setDescription(*description); if (getDtStamp()) ret->setDtStamp(*dtStamp); if (getDtStart()) ret->setDtStart(*dtStart); if (getGeo()) ret->setGeo(*geo); if (getLastMod()) ret->setLastMod(*lastMod); if (getLocation()) ret->setLocation(*location); if (getOrganizer()) ret->setOrganizer(*organizer); if (getPercent()) ret->setPercent(*percent); if (getPriority()) ret->setPriority(*priority); if (getRecurID()) ret->setRecurID(*recurID); if (getSequence()) ret->setSequence(*seq); if (getStatus()) ret->setStatus(*status); if (getSummary()) ret->setSummary(*summary); if (getUid()) ret->setUid(*uid); if (getUrl()) ret->setUrl(*url); if (getDue()) ret->setDue(*due); if (getDuration()) ret->setDuration(*duration); if (getAttach()) ret->setAttach(*attach); if (getAttendee()) ret->setAttendee(*attendee); if (getCategories()) ret->setCategories(*categories); if (getComment()) ret->setComment(*comment); if (getContact()) ret->setContact(*contact); if (getExDate()) ret->setExDate(*exDate); if (getExRule()) ret->setExRule(*exRule); if (getRStatus()) ret->setRStatus(*rStatus); if (getRelated()) ret->setRelated(*related); if (getResources()) ret->setResources(*resources); if (getRDate()) ret->setRDate(*rDate); if (getRRule()) ret->setRRule(*rRule); if (getXProp()) ret->setXProp(*xProp); return ret; }
/* Yet !!! main funtion in here */ int main (int argc, char *argv[]) { if (RaiseItsPriority ()) { printf ("Raise it's priority failed.\n"); } memset (&zfs, 0, sizeof (ZFS)); PZFS pzfs = &zfs; /* Parse command line */ if (parseArgv (pzfs, argc, argv) != 0) exit (-1); getFileSupport(CONFIG_SUPPORT_FILE, pzfs); //add by Joe ZError(DBG_MISC, "pzfs->audioConfig = %d\n", pzfs->audioConfig); ZError(DBG_MISC, "pzfs->photoConfig = %d\n", pzfs->photoConfig); ZError(DBG_MISC, "pzfs->videoConfig = %d\n", pzfs->videoConfig); /* Check, if /data/ImportsummaryDB exists */ if (fileExists (IMPORT_SUMMARY_DB) == 0) { ZError (DBG_MISC, "Will create database->%s", IMPORT_SUMMARY_DB); if (createImportSummaryDB () != 0) { ZError (DBG_MISC, "Create database failed."); exit (-1); } } /* initialize zfs */ if (initZFS (pzfs) != 0) exit (-1); /* Sync persist data */ if (getSummary (pzfs) != 0) { ZError (DBG_MISC, "Get persist data failed"); exit (-1); } /* Check to see if the DIR_IMPORT and DIR_IMPORTED exists NOTE: The zfs will make sure DIR_IMPORTED (/data/AudioLibrary1exists, if it doesn't exists, create it */ if (fixImportFolder () != 0) exit (-1); if (fixImportedFolder () != 0) exit (-1); if (fixExtractedFolder () != 0) exit (-1); if (fixTmpFolder () != 0) exit (-1); /* NOTE:Don't give SIGINT signal, just uncommit it when we want debug it */ //signal(SIGINT, catchKill); /* ctr+c */ signal (SIGKILL, catchKill); signal (SIGTERM, catchKill); /* add_inotify_watch to DIR_IMPORT */ if (addWatchDir (pzfs, DIR_IMPORT) != 0) { ZError (DBG_MISC, "Add watch to %s failed", DIR_IMPORT); exit (-1); } /* Send ide event to zqdevice for our policy */ zfsSendIdleEvent (); /* TCP & UDP */ ZUtilStartThread (&pzfs->tcpThr, "ZFS_TCP", pzfs, requestThread); ZUtilStartThread (&pzfs->udpThr, "ZFS_UDP", pzfs, eventThread); /* Watch thread */ ZUtilStartThread (&pzfs->watchThr, "ZFS_WATCH", pzfs, watchThread); //scan import folder on start scanImportFolder(pzfs, REMOVE_UNSUPPORTED_FILE); /* Task thread */ sleep (2); /* TBD */ ZUtilStartThread (&pzfs->taskThr, "ZFS_TASK", pzfs, taskThead); /* NOTE: May we can move one thread in here, May be it can cut down spend */ while (1) { #ifdef Z_CFG_SMBPRIORITY // printf ("this is raise smb priority"); if(pzfs-> b_renice == TRUE) { // printf ("raise sma success 222222222222...."); ZInfo4 (DBG_MISC,"will RaiseItsPriority."); if(RaiseSMBPriority() == 0) { ZInfo4 (DBG_MISC,"RaiseSMBPriority success."); } else { ZError (DBG_MISC,"RaiseSMBPriority failed."); } } #endif sleep (1); } return 0; }
int Xform::eachSample(const SampleCallback & cb) { if (getSummary().type == XformSummary::Type::TRS) { // gather time samples std::map<Time, int> times; eachAttribute([×](Attribute *a) { if (strncmp(a->getName(), "xformOp:translate", 17) == 0) { auto ts = a->getTimeSamples(); int flag = (int)XformData::Flags::UpdatedPosition; if (ts.empty()) { times[usdiDefaultTime()] |= flag; } else { for (auto& t : ts) { times[t] |= flag; } } } else if (strncmp(a->getName(), "xformOp:scale", 13) == 0) { auto ts = a->getTimeSamples(); int flag = (int)XformData::Flags::UpdatedScale; if (ts.empty()) { times[usdiDefaultTime()] |= flag; } else { for (auto& t : ts) { times[t] |= flag; } } } else if (strncmp(a->getName(), "xformOp:rotate", 14) == 0 || strncmp(a->getName(), "xformOp:orient", 14) == 0) { auto ts = a->getTimeSamples(); int flag = (int)XformData::Flags::UpdatedRotation; if (ts.empty()) { times[usdiDefaultTime()] |= flag; } else { for (auto& t : ts) { times[t] |= flag; } } } }); XformData data; for (const auto& t : times) { readSample(data, t.first); data.flags = t.second;; cb(data, t.first); } return (int)times.size(); } else { // gather time samples std::map<Time, int> times; eachAttribute([×](Attribute *a) { if (strncmp(a->getName(), "xformOp:", 8) == 0) { auto ts = a->getTimeSamples(); if (ts.empty()) { times[usdiDefaultTime()] = 0; } else { for (auto& t : ts) { times[t] = 0; } } } }); XformData data; for (const auto& t : times) { readSample(data, t.first); cb(data, t.first); } return (int)times.size(); } }
void aiPoints::cookSampleBody(Sample& sample) { auto& summary = getSummary(); auto& config = getConfig(); if (!summary.interpolate_points && !m_sample_index_changed) return; int point_count = (int)sample.m_points_sp->size(); if (m_sample_index_changed) { if (m_sort) { sample.m_sort_data.resize(point_count); for (int i = 0; i < point_count; ++i) { sample.m_sort_data[i].first = ((*sample.m_points_sp)[i] - getSortPosition()).length(); sample.m_sort_data[i].second = i; } #ifdef _WIN32 concurrency::parallel_sort #else std::sort #endif (sample.m_sort_data.begin(), sample.m_sort_data.end(), [](const std::pair<float, int>& a, const std::pair<float, int>& b) { return a.first > b.first; }); Remap(sample.m_points, sample.m_points_sp, sample.m_sort_data); if (summary.interpolate_points) Remap(sample.m_points2, sample.m_points_sp2, sample.m_sort_data); if (!summary.compute_velocities && sample.m_velocities_sp) Remap(sample.m_velocities, sample.m_velocities_sp, sample.m_sort_data); if (sample.m_ids_sp) Remap(sample.m_ids, sample.m_ids_sp, sample.m_sort_data); } else { Assign(sample.m_points, sample.m_points_sp, point_count); if (summary.interpolate_points) Assign(sample.m_points2, sample.m_points_sp2, point_count); if (!summary.compute_velocities && sample.m_velocities_sp) Assign(sample.m_velocities, sample.m_velocities_sp, point_count); if (sample.m_ids_sp) Assign(sample.m_ids, sample.m_ids_sp, point_count); } sample.m_points_ref = sample.m_points; auto& config = getConfig(); if (config.swap_handedness) { SwapHandedness(sample.m_points.data(), (int)sample.m_points.size()); SwapHandedness(sample.m_points2.data(), (int)sample.m_points2.size()); SwapHandedness(sample.m_velocities.data(), (int)sample.m_velocities.size()); } if (config.scale_factor != 1.0f) { ApplyScale(sample.m_points.data(), (int)sample.m_points.size(), config.scale_factor); ApplyScale(sample.m_points2.data(), (int)sample.m_points2.size(), config.scale_factor); ApplyScale(sample.m_velocities.data(), (int)sample.m_velocities.size(), config.scale_factor); } { abcV3 bbmin, bbmax; MinMax(bbmin, bbmax, sample.m_points.data(), (int)sample.m_points.size()); sample.m_bb_center = (bbmin + bbmax) * 0.5f; sample.m_bb_size = bbmax - bbmin; } } if (summary.interpolate_points) { if (summary.compute_velocities) sample.m_points_int.swap(sample.m_points_prev); sample.m_points_int.resize_discard(sample.m_points.size()); Lerp(sample.m_points_int.data(), sample.m_points.data(), sample.m_points2.data(), (int)sample.m_points.size(), m_current_time_offset); sample.m_points_ref = sample.m_points_int; if (summary.compute_velocities) { sample.m_velocities.resize_discard(sample.m_points.size()); if (sample.m_points_int.size() == sample.m_points_prev.size()) { GenerateVelocities(sample.m_velocities.data(), sample.m_points_int.data(), sample.m_points_prev.data(), (int)sample.m_points_int.size(), config.vertex_motion_scale); } else { sample.m_velocities.zeroclear(); } } } }
void my_callback(u_char *useless,const struct pcap_pkthdr* pkthdr,const u_char* packet) { packet_num++; packet_len+=pkthdr->caplen; static int count = 0; //static int nn=0; static int i; static unsigned short eth_type; static int vlan_flag=0; //sem_getvalue(&shmp[i]->sem,&semnum); //printf("sem:%d\n",semnum); //usleep(1000); static int semnum; // sem_getvalue(&bin_sem,&semnum); // printf("sem:%d\n",semnum); //printf("mmmmmmmmmmmmmm\n"); if(exitflag) { /*for(i=0;i<snortnum;++i) { memcpy(shmp[i]->data[shmp[i]->tail],"########",strlen("########")); shmp[i]->tail=(shmp[i]->tail+1)%shmp[i]->looplen; my_lock_release(shmp[i]); } sleep(4); for(i=0;i<snortnum;++i) { destroy_loop(shmp[i]); DeleteShm(shmid[i]); }*/ for(i=0;i<PRO_MAX+2;++i) { printf("%s:%lld\n",pro_map[i],pronum[i]); } printf("losepacket=%lld\n",losepacket); //sem_post(&bin_sem); NS_TIME_END(time); speed1(NS_GET_TIMEP(time),packet_num,packet_len); printf("count=%d,\nfind_pro=%lld\n",count,find_pro); printf("exit\n"); del_HB(&hb); acsmFree (acsm); // exitflag=0; exit(0); } //return; mac=(struct ether_header*)packet; eth_type=ntohs(mac->ether_type); if((eth_type==0x8100)) { vlan_flag=1; //msg("W:****0X%04X\n",eth_type); eth_type=(packet[16])*256+packet[17]; } else vlan_flag=0; // msg("W:0X%04X\n",eth_type); if((eth_type!=0x0800))//不是ip数据报 return; if(vlan_flag) ip=(struct ip*)(packet+size_mac+4); else ip=(struct ip*)(packet+size_mac); /*char ipdotdecs[20]={0}; char ipdotdecc[20]={0}; inet_ntop(AF_INET,(void*)&(ip->ip_src),ipdotdecs,16); inet_ntop(AF_INET,(void*)&(ip->ip_dst),ipdotdecc,16);*/ //printf("%s-->%s: len:%d\n",ipdotdecs,ipdotdecc,pkthdr->caplen); if((ip->ip_p==6))//tcp { // msg("EIStcp\n"); //tcp=(struct fniff_tcp*)(packet+size_mac+size_ip); tcp=(struct fniff_tcp*)((char*)ip+size_ip); sd.b_ip=(ip->ip_src.s_addr); sd.l_ip=(ip->ip_dst.s_addr); if(sd.b_ip>sd.l_ip) { sd.b_port=ntohs(tcp->th_sport); sd.l_port=ntohs(tcp->th_dport); } else { sd.b_ip^=sd.l_ip; sd.l_ip^=sd.b_ip; sd.b_ip^=sd.l_ip; sd.b_port=ntohs(tcp->th_dport); sd.l_port=ntohs(tcp->th_sport); } hash=hash_HB(sd.b_ip,sd.b_port,sd.l_ip,sd.l_port); tcplen=ntohs(ip->ip_len)-(ip->ip_hl*4)-(tcp->th_off*4); // msg("EIStcp11111111111\n"); // printf("ntohs(ip->ip_len)=%d\n",ntohs(ip->ip_len)+14); // packet.tcp_URG=tcp->th_flags&TH_URG; ack=tcp->th_flags&TH_ACK; // packet.tcp_PSH=tcp->th_flags&TH_PUSH; rst=tcp->th_flags&TH_RST; syn=tcp->th_flags&TH_SYN; fin=tcp->th_flags&TH_FIN; datalen=pkthdr->caplen; ptcp=(unsigned char*)tcp+(tcp->th_off*4); temp=find_node(hb[hash].virtual_sn,&sd); if(temp==NULL&&syn&&!ack&&tcplen==0)//not find { //msg("E no\n"); SN* q=get_node(); q->sdipport=sd; q->state=1; insert_node(&(hb[hash].virtual_sn),q); hb[hash].virtual_sn_num++; //msg("**********=%ld\n",hb[hash].virtual_sn_num); #if 0 if(sd.b_port==21||sd.l_port==21) { q->state=10; pronum[FTP]++; } else if(sd.b_port==80||sd.l_port==80) { q->state=10; pronum[HTTP]++; } memcpy(fortest,packet,pkthdr->caplen); #endif } else if(temp!=NULL) { // printf("state:%d\n",temp->state); if((temp->state==1)&&syn&&ack&&(tcplen==0)) { //msg("W:my ooooooooooooooooooo\n"); temp->state=2; } else if(temp->state==2&&ack&&!syn&&tcplen==0) { temp->state=3; //msg("W:its ===============================static\n"); //msg("W:my hash:%u\n",hash); } else if(temp->state>=3&&temp->state<9) { //if(tcplen==0) // return; //msg("W:my hash:%u\n",hash); //msg("+++++\n"); //msg("ttttttttttttt\n"); p=get_BC_node(); //msg("mmmmmmmmm\n"); if(p==NULL) {msg("EISget bc node error\n");exit(0);} p->datalen=pkthdr->caplen; p->tcplen=tcplen; //msg("tcplen=%d,pkthdr->caplen=%d\n",tcplen,pkthdr->caplen); if(tcplen<0) { msg("EIS tcp<0\n"); exit(0); } p->next=NULL; memcpy(p->buf,packet,pkthdr->caplen); p->ptcp=(unsigned char*)(p->buf)+(tcp->th_off*4)+((unsigned char*)tcp-(unsigned char*)mac);//ptcp; temp->tcp_content_len+=tcplen; if(temp->bc_head==NULL) { temp->bc_head=temp->bc_tail=p; } else { temp->bc_tail->next=p; temp->bc_tail=p; } temp->state++; if((temp->state==9)||rst||fin||(temp->tcp_content_len>150)) { //msg("EIS static\n"); #if 0 p=temp->bc_head; while(p!=NULL) { if(p->tcplen!=0) acsmSearch(acsm,p->ptcp,p->tcplen,PrintMatch); p=p->next; } #else acSearch(acsm,temp->bc_head); acSearch(acsm,temp->bc_head); #endif i=getSummary(acsm->acsmPatterns,feature_num); pronum[i]++; temp->proto=i; if(rst||fin) { temp->state=10; resume_BC_node(temp->bc_head); resume_node(temp); hb[hash].virtual_sn_num--; //msg("*********=%ld\n",hb[hash].virtual_sn_num); if(hb[hash].virtual_sn_num==0) hb[hash].virtual_sn=NULL; return; } temp->state=10; resume_BC_node(temp->bc_head); temp->bc_head=NULL; temp->bc_tail=NULL; } } else if(temp->state>=10) { if(rst||fin) { //resume_node(temp); move_node(&(hb[hash].virtual_sn),temp); hb[hash].virtual_sn_num--; //msg("**************=%ld\n",hb[hash].virtual_sn_num); if(hb[hash].virtual_sn_num==0) hb[hash].virtual_sn=NULL; return; } } else { msg("ggggggggggg\n"); } } }//tcp else if(ip->ip_p==1)//icmp { //printf("2222\n"); //static char pro_map[PRO_MAX+2][20]={"HTTP","FTP","POP3","SMTP","UNKOWN","UDP","ICMP"}; pronum[PRO_MAX+1]++; } else if(ip->ip_p==17)//udp { //printf("1111111\n"); pronum[PRO_MAX]++; } else { printf("no\n"); } }
string CTodo::toString() { CAlarm *pAlarm; CRecurrence *cRec; string szRet; string szTemp; time_t temp = 0; std::stringstream ss; ss << "ID="; if (getId().c_str()){ szTemp= getId().substr(0,100); ss << szTemp; szTemp.clear(); } else ss << NULL_STRING; ss << ",CalendarId="; ss << getCalendarId(); ss << ",summary="; if (getSummary().c_str()){ szTemp= getSummary().substr(0,100); ss << szTemp; szTemp.clear(); } else ss << NULL_STRING; ss << ",description="; if (getDescription().c_str()){ szTemp= getDescription().substr(0,100); ss << szTemp; szTemp.clear(); } else ss << NULL_STRING; ss << ",location="; if (getLocation().c_str()){ szTemp= getLocation().substr(0,100); ss << szTemp; szTemp.clear(); } else ss << NULL_STRING; ss << ",UId="; if (getGUid().c_str()){ szTemp= getGUid().substr(0,100); ss << szTemp; szTemp.clear(); } else ss << NULL_STRING; ss << ",TimeZone="; if (getTzid().c_str()){ szTemp= getTzid().substr(0,100); ss << szTemp; szTemp.clear(); } else ss << NULL_STRING; ss << ",Type="; ss << getType() ; ss << ",Flags="; switch (getFlags()){ case HAS_ATTENDEE: ss << "Has Attendee"; break; case HAS_ORGANIZER: ss << "Has Organizer"; break; case HAS_RECURRENCE: ss << "Has Recurrence"; break; case HAS_ALARM: ss << "Has Alarm"; break; case HAS_RECURRENCE_ALARM : ss << "Has Recurrent Alarm"; break; case HAS_PARTICIPANT : ss << "Has Participant"; break; case HAS_CATEGORIES : ss << "Has Categories"; break; case HAS_COMMENT: ss << "Has Comment "; break; case HAS_EXTRA: ss << "Has Extra "; break; default: break; } ss << ",Status="; ss << getStatus(); ss << ",Start date="; temp = getDateStart(); ss << ctime(&temp); ss << ",End date="; temp = getDateEnd(); ss << ctime(&temp); ss << ",Last modified="; temp = getLastModified(); ss << ctime(&temp); ss << ",created="; temp = getCreatedTime(); ss << ctime(&temp); ss << ",until="; temp = getUntil(); ss << ctime(&temp); ss << ",All day="; ss << getAllDay(); ss << ",Geo="; if (szGeo.c_str()){ szTemp= szGeo.substr(0,100); ss << szTemp; szTemp.clear(); } else ss << NULL_STRING; ss << ",TodoDue="; ss << iDue; ss << ",Completed="; ss << iCompleted; ss << ",Percent"; ss << iPercentComplete; ss << ",Priority"; ss << iPriority; pAlarm=getAlarm(); if(pAlarm) ss << pAlarm->toString(); else ss << ",Alarm=NULL"; cRec=getRecurrence(); if(cRec) ss << cRec->toString(); else ss << ",Rec=NULL"; szRet.append(ss.str()); return szRet; }