void Http2PushedStream::AdjustInitialWindow() { LOG3(("Http2PushStream %p 0x%X AdjustInitialWindow", this, mStreamID)); if (mConsumerStream) { LOG3(("Http2PushStream::AdjustInitialWindow %p 0x%X " "calling super consumer %p 0x%X\n", this, mStreamID, mConsumerStream, mConsumerStream->StreamID())); Http2Stream::AdjustInitialWindow(); // Http2PushedStream::ReadSegments is needed to call TransmitFrame() // and actually get this information into the session bytestream mSession->TransactionHasDataToWrite(this); } // Otherwise, when we get hooked up, the initial window will get bumped // anyway, so we're good to go. }
UINT8 sc499_device::dack_read() { UINT8 data = 0xff; // set_dma_drq(CLEAR_LINE); if (m_ctape_block_index >= SC499_CTAPE_BLOCK_SIZE) { LOG3(("dack_read: read_block")); read_block(); m_nasty_readahead++; if (block_is_filemark()) { set_dma_drq(CLEAR_LINE); m_status &= ~SC499_STAT_EXC; m_status &= ~SC499_STAT_DIR; } } data = m_ctape_block_buffer[m_ctape_block_index++]; if (m_ctape_block_index < 2 || m_ctape_block_index > 511) { LOG2(("dack_read: data[%d]=%x status=%x", m_ctape_block_index-1, data, m_status)); } // if (m_ctape_block_index < SC499_CTAPE_BLOCK_SIZE) // { // set_dma_drq(ASSERT_LINE); // } return data; }
int openSocket(const int port, const char * peer) { int fd,res,opt; struct sockaddr_in addr; socklen_t addrlen; #ifndef DONT_USE_GETHOSTBYNAME struct hostent *he; #endif if (daveDebug & daveDebugOpen) { LOG1(ThisModule "enter OpenSocket"); FLUSH; } addr.sin_family = AF_INET; addr.sin_port =htons(port); // (((port) & 0xff) << 8) | (((port) & 0xff00) >> 8); #ifndef DONT_USE_GETHOSTBYNAME he = gethostbyname(peer); if (!he) return 0; // bug reported by Nick Hibma memcpy(&addr.sin_addr, he->h_addr_list[0], sizeof(addr.sin_addr)); #else inet_aton(peer, &addr.sin_addr); #endif fd = socket(AF_INET, SOCK_STREAM, 0); if (daveDebug & daveDebugOpen) { LOG2(ThisModule "OpenSocket: socket is %d\n", fd); } addrlen = sizeof(addr); if (connect(fd, (struct sockaddr *) & addr, addrlen)) { LOG2(ThisModule "Socket error: %s \n", strerror(errno)); close(fd); fd = 0; } else { if (daveDebug & daveDebugOpen) { LOG2(ThisModule "Connected to host: %s \n", peer); } /* Need this, so we can read a packet with a single read call and make read return if there are too few bytes. */ errno=0; // res=fcntl(fd, F_SETFL, O_NONBLOCK); // if (daveDebug & daveDebugOpen) // LOG3(ThisModule "Set mode to O_NONBLOCK %s %d\n", strerror(errno),res); /* I thought this might solve Marc's problem with the CP closing a connection after 30 seconds or so, but the Standrad keepalive time on my box is 7200 seconds. */ errno=0; opt=1; res=setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &opt, 4); if (daveDebug & daveDebugOpen) { LOG3(ThisModule "setsockopt %s %d\n", strerror(errno),res); } } FLUSH; return fd; }
void SpdyStream::ChangeState(enum stateType newState) { LOG3(("SpdyStream::ChangeState() %p from %X to %X", this, mUpstreamState, newState)); mUpstreamState = newState; return; }
void CVwsSession::CancelRequestViewEvent() { LOG3(CVwsLog::ENormal,_L("Client \"%x\" requested cancelation of view event request"),iAppUid.iUid); if (iState==EClientRequestPending) { CompleteViewEvent(KErrCancel); } }
void NestedStructMap::createReplacement(const IR::Type_Struct* type) { auto repl = ::get(replacement, type); if (repl != nullptr) return; repl = new StructTypeReplacement(typeMap, type); LOG3("Replacement for " << type << " is " << repl); replacement.emplace(type, repl); }
const IR::Node* DoRemoveActionParameters::postorder(IR::P4Action* action) { LOG1("Visiting " << dbp(action)); BUG_CHECK(getParent<IR::P4Control>() || getParent<IR::P4Program>(), "%1%: unexpected parent %2%", getOriginal(), getContext()->node); auto result = new IR::IndexedVector<IR::Declaration>(); auto leftParams = new IR::IndexedVector<IR::Parameter>(); auto initializers = new IR::IndexedVector<IR::StatOrDecl>(); auto postamble = new IR::IndexedVector<IR::StatOrDecl>(); auto invocation = invocations->get(getOriginal<IR::P4Action>()); if (invocation == nullptr) return action; auto args = invocation->arguments; ParameterSubstitution substitution; substitution.populate(action->parameters, args); bool removeAll = invocations->removeAllParameters(getOriginal<IR::P4Action>()); for (auto p : action->parameters->parameters) { if (p->direction == IR::Direction::None && !removeAll) { leftParams->push_back(p); } else { auto decl = new IR::Declaration_Variable(p->srcInfo, p->name, p->annotations, p->type, nullptr); LOG3("Added declaration " << decl << " annotations " << p->annotations); result->push_back(decl); auto arg = substitution.lookup(p); if (arg == nullptr) { ::error("action %1%: parameter %2% must be bound", invocation, p); continue; } if (p->direction == IR::Direction::In || p->direction == IR::Direction::InOut || p->direction == IR::Direction::None) { auto left = new IR::PathExpression(p->name); auto assign = new IR::AssignmentStatement(arg->srcInfo, left, arg->expression); initializers->push_back(assign); } if (p->direction == IR::Direction::Out || p->direction == IR::Direction::InOut) { auto right = new IR::PathExpression(p->name); auto assign = new IR::AssignmentStatement(arg->srcInfo, arg->expression, right); postamble->push_back(assign); } } } if (result->empty()) return action; initializers->append(action->body->components); initializers->append(*postamble); action->parameters = new IR::ParameterList(action->parameters->srcInfo, *leftParams); action->body = new IR::BlockStatement(action->body->srcInfo, *initializers); LOG1("To replace " << dbp(action)); result->push_back(action); return result; }
void Http2BaseCompressor::UpdateReferenceSet(int32_t delta) { if (!delta) return; uint32_t headerTableSize = mHeaderTable.VariableLength(); uint32_t oldHeaderTableSize = headerTableSize + delta; for (int32_t i = mReferenceSet.Length() - 1; i >= 0; --i) { uint32_t indexRef = mReferenceSet[i]; if (indexRef >= headerTableSize) { if (indexRef < oldHeaderTableSize) { // This one got dropped LOG3(("HTTP base compressor reference to index %u removed.\n", indexRef)); mReferenceSet.RemoveElementAt(i); } else { // This pointed to the static table, need to adjust uint32_t newRef = indexRef - delta; LOG3(("HTTP base compressor reference to index %u changed to %d (%s)\n", mReferenceSet[i], newRef, mHeaderTable[newRef]->mName.get())); mReferenceSet[i] = newRef; } } } for (int32_t i = mAlternateReferenceSet.Length() - 1; i >= 0; --i) { uint32_t indexRef = mAlternateReferenceSet[i]; if (indexRef >= headerTableSize) { if (indexRef < oldHeaderTableSize) { // This one got dropped LOG3(("HTTP base compressor new reference to index %u removed.\n", indexRef)); mAlternateReferenceSet.RemoveElementAt(i); } else { // This pointed to the static table, need to adjust uint32_t newRef = indexRef - delta; LOG3(("HTTP base compressor new reference to index %u changed to %d (%s)\n", mAlternateReferenceSet[i], newRef, mHeaderTable[newRef]->mName.get())); mAlternateReferenceSet[i] = newRef; } } } }
// ----------------------------------------------------------------------------- // Helper function to define a property and log result // ----------------------------------------------------------------------------- // TInt DefineProperty(TUid aCategory, TUint aKey, TInt aAttr, const TSecurityPolicy & aReadPolicy, const TSecurityPolicy& aWritePolicy) { TInt err = RProperty::Define( aCategory, aKey, aAttr, aReadPolicy, aWritePolicy ); LOG3( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ConstructL: property %d defined, err=%d", aKey, err); return err; }
nsresult Http2PushedStream::ReadSegments(nsAHttpSegmentReader *reader, uint32_t, uint32_t *count) { nsresult rv = NS_OK; *count = 0; switch (mUpstreamState) { case GENERATING_HEADERS: // The request headers for this has been processed, so we need to verify // that :authority, :scheme, and :path MUST be present. :method MUST NOT be // present CreatePushHashKey(mHeaderScheme, mHeaderHost, mSession->Serial(), mHeaderPath, mOrigin, mHashKey); LOG3(("Http2PushStream 0x%X hash key %s\n", mStreamID, mHashKey.get())); // the write side of a pushed transaction just involves manipulating a little state SetSentFin(true); Http2Stream::mRequestHeadersDone = 1; Http2Stream::mOpenGenerated = 1; Http2Stream::ChangeState(UPSTREAM_COMPLETE); break; case UPSTREAM_COMPLETE: // Let's just clear the stream's transmit buffer by pushing it into // the session. This is probably a window adjustment. LOG3(("Http2Push::ReadSegments 0x%X \n", mStreamID)); mSegmentReader = reader; rv = TransmitFrame(nullptr, nullptr, true); mSegmentReader = nullptr; break; case GENERATING_BODY: case SENDING_BODY: case SENDING_FIN_STREAM: default: break; } return rv; }
int sc499_device::block_is_filemark() { static const UINT8 fm_pattern[] = {0xDE, 0xAF, 0xFA, 0xED}; int is_filemark = memcmp(m_ctape_block_buffer, fm_pattern, 4) == 0 && memcmp(m_ctape_block_buffer, m_ctape_block_buffer+4, SC499_CTAPE_BLOCK_SIZE-4) == 0; LOG3(("block_is_filemark for block %d = %d", m_tape_pos-1, is_filemark)); return is_filemark; }
Http2PushedStream * SpdyPushCache::RemovePushedStreamHttp2(nsCString key) { Http2PushedStream *rv = mHashHttp2.Get(key); LOG3(("SpdyPushCache::RemovePushedStreamHttp2 %s 0x%X\n", key.get(), rv ? rv->StreamID() : 0)); if (rv) mHashHttp2.Remove(key); return rv; }
static int __sdriq_connect (sdriq_t *sdriq) { if (unlikely(sdriq == NULL)) LOG_ERROR_AND_RETURN(-1, "null sdriq_t"); LOG3("[%s]", sdriq->device.desc.name); return 0; }
void CVwsSession::HandleActivationL(const TVwsViewId& aActivatedViewId, const TVwsViewId& aViewToBeDeactivatedId) { if (iActivationNotification.IsViewToNotify(aActivatedViewId)) { LOG3(CVwsLog::ENormal,_L("Requesting activation notification in \"%x\""),iAppUid); iActivationNotification.ClearRequest(); CVwsSessionEvent* activationNotificationEvent=new(ELeave) CVwsSessionEvent_ActivationNotification(*this,*iEventQueue,aActivatedViewId,aViewToBeDeactivatedId); iEventQueue->ProcessEventL(activationNotificationEvent); } }
SpdyPushedStream31 * SpdyPushCache::RemovePushedStreamSpdy31(nsCString key) { SpdyPushedStream31 *rv = mHashSpdy31.Get(key); LOG3(("SpdyPushCache::RemovePushedStream %s 0x%X\n", key.get(), rv ? rv->StreamID() : 0)); if (rv) mHashSpdy31.Remove(key); return rv; }
bool SpdyPushCache::RegisterPushedStreamHttp2(nsCString key, Http2PushedStream *stream) { LOG3(("SpdyPushCache::RegisterPushedStreamHttp2 %s 0x%X\n", key.get(), stream->StreamID())); if(mHashHttp2.Get(key)) return false; mHashHttp2.Put(key, stream); return true; }
const IR::Node* ReplaceStructs::preorder(IR::P4Control* control) { for (auto p : control->getApplyParameters()->parameters) { auto pt = replacementMap->typeMap->getType(p, true); auto repl = replacementMap->getReplacement(pt); if (repl != nullptr) { toReplace.emplace(p, repl); LOG3("Replacing parameter " << dbp(p) << " of " << dbp(control)); } } return control; }
bool SpdyPushCache::RegisterPushedStreamSpdy31(nsCString key, SpdyPushedStream31 *stream) { LOG3(("SpdyPushCache::RegisterPushedStreamSpdy31 %s 0x%X\n", key.get(), stream->StreamID())); if(mHashSpdy31.Get(key)) return false; mHashSpdy31.Put(key, stream); return true; }
void CVwsSession::CompleteViewEventL(TInt aNotification,const TVwsViewEvent& aEvent) { ASSERT(iState==EClientRequestPending); if (aNotification==KErrNone && iState==EClientRequestPending) { LOG3(CVwsLog::ENormal,_L("Writing view event buffer to client \"%x\""),iAppUid.iUid); iViewEventMessage.WriteL(0,TPckgC<TVwsViewEvent>(aEvent)); } CompleteViewEvent(aNotification); }
const IR::Node* DoReplaceTuples::insertReplacements(const IR::Node* before) { // Check that we are in the top-level P4Program list of declarations. if (!getParent<IR::P4Program>()) return before; auto result = repl->getNewReplacements(); if (result == nullptr) return before; LOG3("Inserting replacements before " << dbp(before)); result->push_back(before); return result; }
const IR::Type* ReplacementMap::convertType(const IR::Type* type) { auto it = replacement.find(type); if (it != replacement.end()) return it->second; if (type->is<IR::Type_Struct>()) { auto st = type->to<IR::Type_Struct>(); bool changes = false; IR::IndexedVector<IR::StructField> fields; for (auto f : st->fields) { auto ftype = typeMap->getType(f); auto cftype = convertType(ftype); if (cftype != ftype) changes = true; auto field = new IR::StructField(f->name, f->annotations, cftype->getP4Type()); fields.push_back(field); } if (changes) { auto result = new IR::Type_Struct(st->srcInfo, st->name, st->annotations, fields); LOG3("Converted " << dbp(type) << " to " << dbp(result)); replacement.emplace(type, result); return result; } else { return type; } } else if (type->is<IR::Type_Tuple>()) { cstring name = ng->newName("tuple"); IR::IndexedVector<IR::StructField> fields; for (auto t : type->to<IR::Type_Tuple>()->components) { auto ftype = convertType(t); auto fname = ng->newName("field"); auto field = new IR::StructField(IR::ID(fname), ftype->getP4Type()); fields.push_back(field); } auto result = new IR::Type_Struct(name, fields); LOG3("Converted " << dbp(type) << " to " << dbp(result)); replacement.emplace(type, result); return result; } return type; }
nsresult SpdyStream::OnWriteSegment(char *buf, PRUint32 count, PRUint32 *countWritten) { LOG3(("SpdyStream::OnWriteSegment %p count=%d state=%x", this, count, mUpstreamState)); NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); NS_ABORT_IF_FALSE(mSegmentWriter, "OnWriteSegment with null mSegmentWriter"); return mSegmentWriter->OnWriteSegment(buf, count, countWritten); }
nsresult Http2Decompressor::DecodeFinalHuffmanCharacter(HuffmanIncomingTable *table, uint8_t &c, uint8_t &bitsLeft) { uint8_t mask = (1 << bitsLeft) - 1; uint8_t idx = mData[mOffset - 1] & mask; idx <<= (8 - bitsLeft); // Don't update bitsLeft yet, because we need to check that value against the // number of bits used by our encoding later on. We'll update when we are sure // how many bits we've actually used. HuffmanIncomingEntry *entry = &(table->mEntries[idx]); if (entry->mPtr) { // Can't chain to another table when we're all out of bits in the encoding LOG3(("DecodeFinalHuffmanCharacter trying to chain when we're out of bits")); return NS_ERROR_ILLEGAL_VALUE; } if (bitsLeft < entry->mPrefixLen) { // We don't have enough bits to actually make a match, this is some sort of // invalid coding LOG3(("DecodeFinalHuffmanCharacter does't have enough bits to match")); return NS_ERROR_ILLEGAL_VALUE; } // This is a character! if (entry->mValue == 256) { // EOS LOG3(("DecodeFinalHuffmanCharacter actually decoded an EOS")); return NS_ERROR_ILLEGAL_VALUE; } c = static_cast<uint8_t>(entry->mValue & 0xFF); bitsLeft -= entry->mPrefixLen; return NS_OK; }
nsresult Http2Decompressor::DecodeHeaderBlock(const uint8_t *data, uint32_t datalen, nsACString &output) { mAlternateReferenceSet.Clear(); mOffset = 0; mData = data; mDataLen = datalen; mOutput = &output; mOutput->Truncate(); mHeaderStatus.Truncate(); mHeaderHost.Truncate(); mHeaderScheme.Truncate(); mHeaderPath.Truncate(); mHeaderMethod.Truncate(); nsresult rv = NS_OK; while (NS_SUCCEEDED(rv) && (mOffset < datalen)) { if (mData[mOffset] & 0x80) { rv = DoIndexed(); } else if (mData[mOffset] & 0x40) { rv = DoLiteralWithIncremental(); } else if (mData[mOffset] & 0x20) { rv = DoContextUpdate(); } else if (mData[mOffset] & 0x10) { rv = DoLiteralNeverIndexed(); } else { rv = DoLiteralWithoutIndex(); } } // after processing the input the decompressor comapres the alternate // set to the inherited reference set and generates headers for // anything implicit in reference - alternate. uint32_t setLen = mReferenceSet.Length(); for (uint32_t index = 0; index < setLen; ++index) { if (!mAlternateReferenceSet.Contains(mReferenceSet[index])) { LOG3(("HTTP decompressor carryover in reference set with index %u %s %s\n", mReferenceSet[index], mHeaderTable[mReferenceSet[index]]->mName.get(), mHeaderTable[mReferenceSet[index]]->mValue.get())); OutputHeader(mReferenceSet[index]); } } mAlternateReferenceSet.Clear(); return rv; }
static void LogHeaders(const char *lines) { nsCAutoString buf; char *p; while ((p = PL_strstr(lines, "\r\n")) != nsnull) { buf.Assign(lines, p - lines); if (PL_strcasestr(buf.get(), "authorization: ") != nsnull) { char *p = PL_strchr(PL_strchr(buf.get(), ' ')+1, ' '); while (*++p) *p = '*'; } LOG3((" %s\n", buf.get())); lines = p + 2; } }
void CVwsSession::CompleteViewEvent(TInt aNotification) { ASSERT(iState==EClientRequestPending); if (iState==EClientRequestPending) { LOG4(CVwsLog::ENormal,_L("Completing view event in client \"%x\" with \"%d\""),iAppUid.iUid,aNotification); iViewEventMessage.Complete(aNotification); iState=EWaitingForClientRequest; } else { LOG3(CVwsLog::ELoud,_L("Completing view event in client \"%x\" - ERROR: No pending client request!"),iAppUid.iUid); } }
void CRemConBulkServer::LogSessions() const { const TUint count = iSessions.Count(); LOG1(_L8("\tNumber of sessions = %d"), count); for ( TUint ii = 0 ; ii < count ; ++ii ) { CRemConBulkSession* const session = iSessions[ii]; ASSERT_DEBUG(session); LOG3(_L8("\t\tsession %d [0x%08x], Id = %d"), ii, session, session->Id() ); } }
void DoSetHeaders::generateSetValid( const IR::Expression* dest, const IR::Expression* src, const IR::Type* destType, IR::Vector<IR::StatOrDecl>* insert) { auto structType = destType->to<IR::Type_StructLike>(); if (structType == nullptr) return; auto srcType = typeMap->getType(src, true); auto list = src->to<IR::ListExpression>(); auto si = src->to<IR::StructInitializerExpression>(); if (list == nullptr && si == nullptr) return; if (structType->is<IR::Type_Header>()) { LOG3("Inserting setValid for " << dest); auto method = new IR::Member(dest->srcInfo, dest, IR::Type_Header::setValid); auto mc = new IR::MethodCallExpression( dest->srcInfo, method, new IR::Vector<IR::Argument>()); auto stat = new IR::MethodCallStatement(mc->srcInfo, mc); insert->push_back(stat); return; } // Recurse on fields of structType if (list != nullptr) { auto tt = srcType->to<IR::Type_Tuple>(); CHECK_NULL(tt); auto it = list->components.begin(); for (auto f : structType->fields) { auto member = new IR::Member(dest, f->name); auto ft = typeMap->getType(f); generateSetValid(member, *it, ft, insert); ++it; } return; } CHECK_NULL(si); for (auto f : structType->fields) { auto member = new IR::Member(dest, f->name); auto srcMember = si->components.getDeclaration<IR::NamedExpression>(f->name); auto ft = typeMap->getType(f); CHECK_NULL(srcMember); generateSetValid(member, srcMember->expression, ft, insert); } }
// ---------------------------------------------------------------------------- // CWmDrmDlaDefaultHttpManager::RunL // Overrides CActive::RunL // ---------------------------------------------------------------------------- void CWmDrmDlaDefaultHttpManager::RunL() { LOGFN( "CWmDrmDlaDefaultHttpManager::RunL" ); TInt error( iStatus.Int() ); LOG3( "CWmDrmDlaDefaultHttpManager State: %d Status: %d", iState, error ); if ( iState == EOpen && error == KErrNotFound ) { iState=EOpenFailed; } else { User::LeaveIfError( error ); } switch (iState) { case EStart: InitializeL(); break; case EInitialize: OpenL(); break; case EOpenFailed: // Called only if open fails ReconnectL(); break; case EReconnect: iState=EOpen; // Note: intentionally no break // Successfully completed EReconnect is same as EOpen. case EOpen: SubmitL(); break; default: // Panic if called while in ESubmit ASSERT( 0 ); break; } // Do not advance the state if the transaction was submitted // MHFRunL will be called by the HTTP stack while the transaction // progresses if ( iState != ESubmit ) { // Go to the next state if not finished CompleteSelf(); } }
nsresult SpdyStream::WriteSegments(nsAHttpSegmentWriter *writer, PRUint32 count, PRUint32 *countWritten) { LOG3(("SpdyStream::WriteSegments %p count=%d state=%x", this, count, mUpstreamState)); NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread"); NS_ABORT_IF_FALSE(!mSegmentWriter, "segment writer in progress"); mSegmentWriter = writer; nsresult rv = mTransaction->WriteSegments(writer, count, countWritten); mSegmentWriter = nsnull; return rv; }