PUBLIC void setTimeout(void *proc, MprTicks timeout, void *data) { mprCreateEvent(getStream()->dispatcher, "setTimeout", (int) timeout, proc, data, 0); }
void StreamFilter::flush() { getStream()->flush(); }
bool StreamFilter::isReady() const { return getStream()->isReady(); }
void CClientProxy1_0::screensaver(bool on) { LOG((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0)); CProtocolUtil::writef(getStream(), kMsgCScreenSaver, on ? 1 : 0); }
UInt32 StreamFilter::read(void* buffer, UInt32 n) { return getStream()->read(buffer, n); }
File* FLACInputStream::getFile(void* client_data) { return getStream(client_data)->m_file.get(); }
void CClientProxy1_0::mouseUp(ButtonID button) { LOG((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getName().c_str(), button)); CProtocolUtil::writef(getStream(), kMsgDMouseUp, button); }
string Kernel::respond(const string &input, const string &id, Responder *r, int, bool srai, const string &prefix) { if (!srai) { recursionDepth = 0; timingResponse = timerMillis(); } // I want this to be configurable... if (++recursionDepth > maxRecursiveDepth) { predicates->addHistory("that", id, ""); cerr << "AIML contains an infinite loop" << endl; cerr << "Input involved in loop: " << input << endl; return ""; } string currentResponse = "", buffer = ""; Match *m = NULL; if (!srai) { predicates->addHistory("input", id, input); } string sentence, inString = input; while (!(sentence = getSentence(inString)).empty()) { sentence = trim(sentence); string originalInput = sentence; if (sentence.length() < 1) { continue; } sentence = prefix + " " + Substituter::substitute(sentence); string context = predicates->getValue("context", id); context = Substituter::substitute(context); string that = predicates->getValue("that", id); if (!srai) { StringTokenizer stThat(that, ".?!"); while (stThat.hasMoreTokens()) { string t = stThat.nextToken(); t = trim(t); if (!t.empty()) { that = t; predicates->addHistory("that", id, that); } } } that = Substituter::substitute(that); string topic = predicates->getValue("topic", id); topic = Substituter::substitute(topic); if (that.empty()) { that = "*"; } if (topic.empty()) { topic = "*"; } if (context.empty()) { context = "*"; } //-- DEBUGGING LINE string ktr = sentence + "\n"; getStream("Kernel")->Read(ktr.c_str()); m = match(context, sentence, that, topic); if (m == NULL) { cerr << "There is no match for input: " << sentence << endl; } else { cerr << endl; cerr << "INPUT: " << originalInput << endl; cerr << "MATCH PATH: " << m->getPath() << endl; cerr << "FILENAME: " << m->getNode()->getActualTemplate()->getFilename() << endl; string tmpl = "<template>" + m->getTemplate() + "</template>"; strstream ss; ss << tmpl << endl; SaxParser *p = new SaxParser(new Parser()); p->parse(ss); currentResponse = Kernel::process(m, ((Parser *)p->getListener())->getRoot(), r, id); predicates->setValue("beforethat", id, that); predicates->setValue("that", id, currentResponse); delete p; } if (m != NULL) { delete m; if (srai) { --recursionDepth; return currentResponse; } else { buffer += currentResponse + " "; } } } string result = Substituter::substitute(buffer, "output"); --recursionDepth; if (!srai) { timingResponse = timerMillis() - timingResponse; cerr << "TIME: " << timingResponse << "ms" << endl; } //-- DEBUGGING LINE string ktw = result + "\n"; getStream("Kernel")->Write(ktw.c_str()); if (trimming) { return trim(result, " \t\r\n"); } return result; }
// ---------------------------------------------------------------------------- int RiffWavReader::getSamples(void* buf, const size_t& count) { return getStream(buf, count * getBlockAlign()); }
PUBLIC void dontAutoFinalize() { espSetAutoFinalizing(getStream(), 0); }
/* <% stylesheets(patterns); %> Where patterns may contain *, ** and !pattern for exclusion */ PUBLIC void stylesheets(cchar *patterns) { HttpStream *stream; HttpRx *rx; HttpRoute *route; EspRoute *eroute; MprList *files; cchar *filename, *ext, *uri, *path, *kind, *version, *clientDir; int next; stream = getStream(); rx = stream->rx; route = rx->route; eroute = route->eroute; patterns = httpExpandRouteVars(route, patterns); clientDir = httpGetDir(route, "documents"); if (!patterns || !*patterns) { version = espGetConfig(route, "version", "1.0.0"); if (eroute->combineSheet) { /* Previously computed combined stylesheet filename */ stylesheets(eroute->combineSheet); } else if (espGetConfig(route, "http.content.combine[@=css]", 0)) { if (espGetConfig(route, "http.content.minify[@=css]", 0)) { eroute->combineSheet = sfmt("css/all-%s.min.css", version); } else { eroute->combineSheet = sfmt("css/all-%s.css", version); } stylesheets(eroute->combineSheet); } else { /* Not combining into a single stylesheet, so give priority to all.less over all.css if present Load a pure CSS incase some styles need to be applied before the lesssheet is parsed */ ext = espGetConfig(route, "http.content.stylesheets", "css"); filename = mprJoinPathExt("css/all", ext); path = mprJoinPath(clientDir, filename); if (mprPathExists(path, R_OK)) { stylesheets(filename); } else if (!smatch(ext, "less")) { path = mprJoinPath(clientDir, "css/all.less"); if (mprPathExists(path, R_OK)) { stylesheets("css/all.less"); } } } } else { if (sends(patterns, "all.less")) { path = mprJoinPath(clientDir, "css/fix.css"); if (mprPathExists(path, R_OK)) { stylesheets("css/fix.css"); } } if ((files = mprGlobPathFiles(clientDir, patterns, MPR_PATH_RELATIVE)) == 0 || mprGetListLength(files) == 0) { files = mprCreateList(0, 0); mprAddItem(files, patterns); } for (ITERATE_ITEMS(files, path, next)) { path = sjoin("~/", strim(path, ".gz", MPR_TRIM_END), NULL); uri = httpLink(stream, path); kind = mprGetPathExt(path); if (smatch(kind, "css")) { espRender(stream, "<link rel='stylesheet' type='text/css' href='%s' />\n", uri); } else { espRender(stream, "<link rel='stylesheet/%s' type='text/css' href='%s' />\n", kind, uri); } } } }
PUBLIC void updateCache(cchar *uri, cchar *data, int lifesecs) { espUpdateCache(getStream(), uri, data, lifesecs); }
/* Destroy a session and erase the session state data. This emits an expired Set-Cookie header to the browser to force it to erase the cookie. */ PUBLIC void destroySession() { httpDestroySession(getStream()); }
PUBLIC void showRequest() { espShowRequest(getStream()); }
/* * New incoming feedback */ void ScreamTx::incomingFeedback(guint64 time_us, guint32 ssrc, guint32 timestamp, guint16 highestSeqNr, guint8 nLoss, gboolean qBit) { /* fix -Werror=unused-parameter */ (void) qBit; if (!isInitialized) initialize(time_us); Stream *stream = getStream(ssrc); accBytesInFlightMax += bytesInFlight(); nAccBytesInFlightMax++; for (int n=0; n < kMaxTxPackets; n++) { /* * Loop through TX packets with matching SSRC */ Transmitted *tmp = &txPackets[n]; if (tmp->isUsed == TRUE) { /* * RTP packet is in flight */ if (stream->isMatch(tmp->ssrc)) { if (tmp->seqNr == highestSeqNr) { ackedOwd = timestamp - tmp->timestamp; guint64 rtt = time_us - tmp->timeTx_us; sRttSh_us = (7 * sRttSh_us + rtt) / 8; if (time_us - lastSRttUpdateT_us > sRttSh_us) { sRtt_us = (7 * sRtt_us + sRttSh_us) / 8; lastSRttUpdateT_us = time_us; } } /* * Wrap-around safety net */ guint32 seqNrExt = tmp->seqNr; guint32 highestSeqNrExt = highestSeqNr; if (seqNrExt < highestSeqNrExt && highestSeqNrExt-seqNrExt > 20000) seqNrExt += 65536; else if (seqNrExt > highestSeqNrExt && seqNrExt - highestSeqNrExt > 20000) highestSeqNrExt += 65536; /* * RTP packets with a sequence number lower * than or equal to the highest received sequence number * are treated as received even though they are not * This advances the send window, similar to what * SACK does in TCP */ if (seqNrExt <= highestSeqNrExt) { bytesNewlyAcked += tmp->size; stream->bytesAcked += tmp->size; tmp->isUsed = FALSE; } } } } /* * Determine if a loss event has occurred */ if (stream->nLoss != nLoss) { /* * The loss counter has increased */ stream->nLoss = nLoss; if (time_us - lastLossEventT_us > sRtt_us) { /* * The loss counter has increased and it is more than one RTT since last * time loss was detected */ lossEvent = TRUE; lastLossEventT_us = time_us; } } if (lossEvent) { cerr << "LOSS " << (int)nLoss << endl; lastLossEventT_us = time_us; for (int n=0; n < nStreams; n++) { Stream *tmp = streams[n]; tmp->lossEventFlag = TRUE; } } updateCwnd(time_us); }
// ---------------------------------------------------------------------------- int RiffWavReader::getStream(void* buf, const size_t& count) { size_t a; return getStream(buf, count, a); }
gfloat ScreamTx::getTargetBitrate(guint32 ssrc) { return getStream(ssrc)->targetBitrate; }
/** Constructor. Writes a prefix to the stream after acquiring the output lock. */ LockedOutputStream(StreamT & stream_, std::string const & prefix, bool append_newline_ = false) : stream(&stream_), append_newline(append_newline_) { setOutputLock(true); getStream() << prefix; }
void CClientProxy1_0::keyUp(KeyID key, KeyModifierMask mask, KeyButton) { LOG((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask)); CProtocolUtil::writef(getStream(), kMsgDKeyUp1_0, key, mask); }
tokenInfo getNextToken(FILE *fp, buffersize k, tokenInfo t) { if(t==NULL) { tokenInfo ts,tl; int i,j,s=0,ln=1,l=0,temp=0,x=0; char c,d,e, id[20]; ret r; flush(id); ts=(tokenInfo)malloc(sizeof(tokenlist)); ts->next=NULL; t=ts; do { buffer B; r=getStream(fp,B,k); for(i=0; i<SIZE_BUFFER; i++) { if(0<=i<SIZE_BUFFER) { c=B[i]; } switch(s) { case -2: { c=d; s=0; } case 0: { if(c=='$') { x=1; t->lineno=-1; break; } else if(c=='%') { s=50; break; } else if(c==' ' || c=='\t') { break; } else if(c=='\n') { ln++; break; } else if(c==',') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]=','; t->token="TK_COMMA"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='[') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='['; t->token="TK_SQL"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c==']') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]=']'; t->token="TK_SQR"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c==';') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]=';'; t->token="TK_SEM"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c==':') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]=':'; t->token="TK_COLON"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='.') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='.'; t->token="TK_DOT"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='(') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='('; t->token="TK_OP"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c==')') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]=')'; t->token="TK_CL"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='+') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='+'; t->token="TK_PLUS"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='-') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='-'; t->token="TK_MINUS"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='*') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='*'; t->token="TK_MUL"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='/') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='/'; t->token="TK_DIV"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='&') { id[l]=c; s=12; break; } else if(c=='@') { id[l]=c; s=13; break; } else if(c=='~') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='~'; t->token="TK_NOT"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; s=0; break; } else if(c=='=') { id[l]=c; s=15; break; } else if(c=='!') { id[l]=c; s=16; break; } else if(c=='#') { s=18; id[l]=c; break; } else if(c=='<') { id[l]=c; s=17; break; } else if(c=='>') { id[l]=c; s=20; break; } else if('0'<=c && c<='9') { s=19; id[l]=c;//INCOMPLETE break; } else if(c=='_') { id[l]=c; s=21; break; } else if('b'<=c && c<='d') { id[l]=c; s=35; break; } else if(c=='a' || 'e'<=c && c<='z') { id[l]=c; s=36; break; } else { printf("ERROR_2: Unknown Symbol %c at line %d\n",c,ln); s=0; break; } } case 50: { if(c=='\n' || c=='$') { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='%'; t->token="TK_COMMENT"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; ln++; s=0; break; } else { s=50; break; } } case 12: { if(c=='&') { l++; id[l]=c; s=23; break; } else { s=100; d=c; break; } } case 23: { if(c=='&') { l++; id[l]=c; t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_AND"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); s=0; break; } else { s=100; d=c; break; } } case 13: { if(c=='@') { l++; id[l]=c; s=24; break; } else { s=100; d=c; break; } } case 24: { if(c=='@') { l++; id[l]=c; t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_OR"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); s=0; break; } else { s=100; d=c; break; } } case 15: { if(c=='=') { l++; id[l]=c; t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_EQ"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); s=0; break; } else { s=100; d=c; break; } } case 16: { if(c=='=') { l++; id[l]=c; t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_NE"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); s=0; break; } else { s=100; d=c; break; } } case 17: { if(c=='=') { l++; id[l]=c; t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_LE"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); s=0; break; } if(c=='-') { l++; id[l]=c; s=25; break; } else { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='<'; t->token="TK_LT"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; i--; d=c; s=0; break; } } case 25: { if(c=='-') { l++; id[l]=c; s=26; break; } else { s=100; d=c; break; } } case 26: { if(c=='-') { l++; id[l]=c; t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_ASSIGNOP"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); s=0; break; } else { s=100; d=c; break; } } case 20: { if(c=='=') { l++; id[l]=c; t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_GE"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); s=0; break; } else { t->lineno=ln; flush(t->lexeme); t->lexeme[0]='>'; t->token="TK_GT"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; i--; d=c; s=0; break; } } case 18: { if('a'<=c && c<'=z') { l++; id[l]=c; s=27; break; } else { s=100; d=c; break; } } case 27: { if('a'<=c && c<'=z') { l++; if(l<20) { id[l]=c; break; } else { s=31; break; } } else { t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_RECORDID"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); i--; s=0; break; } } case 19: { //DO NUM AND RNUM if('0'<=c && c<='9') { l++; if(l<20) { id[l]=c; break; } else { s=41; break; } } else if(c=='.') { l++; if(l<18) { id[l]=c; s=30; break; } else { id[l]=c; s=39; break; } } else { t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_NUM"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); i--; s=0; break; } } case 30: { if('0'<=c && c<='9') { l++; if(l<19) { id[l]=c; s=34; break; } else { id[l]=c; s=39; break; } } else { s=100; d=c; break; } } case 34: { if('0'<=c && c<='9') { l++; id[l]=c; t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_RNUM"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); //i--; s=0; break; } else { s=100; d=c; break; } } case 39: { if('0'<=c && c<='9') { l++; if(l<20) { id[l]=c; break; } else { s=41; break; } } else { s=100; d=c; break; } } case 21: { if('a'<=c && c<'=z' || 'A'<=c && c<='Z') { l++; id[l]=c; s=28; break; } else { s=100; d=c; break; } } case 28: { if('a'<=c && c<'=z' || 'A'<=c && c<='Z') { l++; if(l<20) { id[l]=c; break; } else { s=42; break; } } else if('0'<=c && c<='9') { s=29; } else { t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_FUNID"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); i--; s=0; break; } } case 29: { if('0'<=c && c<='9') { l++; if(l<20) { id[l]=c; break; } else { s=41; break; } } else { t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_FUNID"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); i--; s=0; break; } } case 35: { if('2'<=c && c<='7') { l++; id[l]=c; s=37; break; } else if('a'<=c && c<='z') { l++; id[l]=c; s=36; break; } else { t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_FIELDID"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); i--; s=0; break; } } case 36: { if('a'<=c && c<'=z') { l++; if(l<20) { id[l]=c; break; } else { s=31; break; } } else { t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_FIELDID"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); i--; s=0; break; } } case 37: { if('b'<=c && c<='d') { l++; if(l<20) { id[l]=c; break; } else { s=43; break; } } else if('2'<=c && c<='7') { s=38; } else { t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_ID"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); i--; s=0; break; } } case 38: { if('2'<=c && c<='7') { l++; if(l<20) { id[l]=c; break; } else { s=44; break; } } else { t->lineno=ln; strcpy(t->lexeme,id); t->token="TK_ID"; t->next=(tokenInfo)malloc(sizeof(tokenlist)); t=t->next; t->lineno=-1; t->next=NULL; l=0; flush(id); i--; s=0; break; } } case 31: { if('a'<=c && c<'=z') { break; } else { printf("ERROR_1 : Identifier at line %d is longer than the prescribed length of 20 characters\n",ln); l=0; flush(id); i--; d=c; s=0; break; } } case 41: { if('0'<=c && c<='9') { break; } else { printf("ERROR_1 : Identifier at line %d is longer than the prescribed length of 20 characters\n",ln); l=0; flush(id); i--; d=c; s=0; break; } } case 42: { if('a'<=c && c<'=z' || 'A'<=c && c<='Z') { break; } else { printf("ERROR_1 : Identifier at line %d is longer than the prescribed length of 20 characters\n",ln); l=0; flush(id); i--; d=c; s=0; break; } } case 43: { if('b'<=c && c<='d') { break; } else { printf("ERROR_1 : Identifier at line %d is longer than the prescribed length of 20 characters\n",ln); l=0; flush(id); i--; d=c; s=0; break; } } case 44: { if('2'<=c && c<='7') { break; } else { printf("ERROR_1 : Identifier at line %d is longer than the prescribed length of 20 characters\n",ln); l=0; flush(id); i--; d=c; s=0; break; } } case 100: { printf("ERROR_3: Unknown pattern <%s> at line number <%d>\n",id,ln); l=0; flush(id); if(i==0) { s=-2; i=-2; break; } else i=i-2; s=0; break; } } if(x==1) { break; } } if(temp==1 || x==1) { break; } } while(!feof(r.fp)); tl=ts; char *A="TK_FUNID"; char *Z="TK_FIELDID"; while(tl->lineno!=-1) { if(strcmp(tl->token,A)==0) { char* C="_main"; else if(strcmp(tl->lexeme,C)==0) { tl->token="TK_MAIN"; } }
void CClientProxy1_0::mouseMove(SInt32 xAbs, SInt32 yAbs) { LOG((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs)); CProtocolUtil::writef(getStream(), kMsgDMouseMove, xAbs, yAbs); }
void ClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize) { FileChunk::send(getStream(), mark, data, dataSize); }
void StreamFilter::close() { getStream()->close(); }
void CClientProxy1_3::handleKeepAlive(const CEvent&, void*) { CProtocolUtil::writef(getStream(), kMsgCKeepAlive); }
void StreamFilter::write(const void* buffer, UInt32 n) { getStream()->write(buffer, n); }
void CClientProxy1_3::mouseWheel(SInt32 xDelta, SInt32 yDelta) { LOG((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d,%+d", getName().c_str(), xDelta, yDelta)); CProtocolUtil::writef(getStream(), kMsgDMouseWheel, xDelta, yDelta); }
void StreamFilter::shutdownOutput() { getStream()->shutdownOutput(); }
/* * RTP packet transmitted */ gfloat ScreamTx::addTransmitted(guint64 time_us, guint32 ssrc, gint size, guint16 seqNr) { if (!isInitialized) initialize(time_us); int k = 0; int ix = -1; while (k < kMaxTxPackets) { if (txPackets[k].isUsed == FALSE) { ix = k; break; } k++; } if (ix == -1) { /* * If you end up here then it is necessary to increase * kMaxTxPackets */ ix = 0; cerr << "Max number of txPackets allocated" << endl; } txPackets[ix].timestamp = (guint32) (time_us/1000); txPackets[ix].timeTx_us = time_us; txPackets[ix].ssrc = ssrc; txPackets[ix].size = size; txPackets[ix].seqNr = seqNr; txPackets[ix].isUsed = TRUE; Stream* stream = getStream(ssrc); stream->bytesTransmitted += size; lastTransmitT_us = time_us; /* * Add credit to unserved streams */ addCredit(time_us, stream, size); /* * Reduce used credit for served stream */ subtractCredit(time_us, stream, size); /* * compute paceInterval, we assume a min bw of 50kbps and a min tp of 1ms * for stable operation * this function implements the packet pacing */ gfloat paceInterval = kMinPaceInterval; pacingBitrate = MAX(kMinimumBandwidth,cwnd * 8.0f / MAX(0.001f,getSRtt())); gfloat tp = (size * 8.0f) / pacingBitrate; if (owdFractionAvg > 0.1f && kEnablePacketPacing) { paceInterval = MAX(kMinPaceInterval,tp); } if (kBypassTxSheduling) { paceInterval = 0.0; } guint64 paceInterval_us = (guint64) (paceInterval*1000000); /* * Update MSS and cwndMin */ mss = MAX(mss, size); cwndMin = 2 * mss; /* * Determine when next RTP packet can be transmitted */ nextTransmitT_us = time_us + paceInterval_us; return paceInterval; }
UInt32 StreamFilter::getSize() const { return getStream()->getSize(); }
PUBLIC void setStatus(int status) { espSetStatus(getStream(), status); }