Mbuf CcpDataInput(Bund b, Mbuf comp) { CcpState const ccp = &b->ccp; Mbuf plain; LogDumpBp(LG_FRAME, comp, "[%s] %s: recv comp", Pref(&ccp->fsm), Fsm(&ccp->fsm)); /* Decompress packet */ if ((!ccp->recv) || (!ccp->recv->Decompress)) { Log(LG_ERR, ("[%s] %s: no compression for recv", Pref(&ccp->fsm), Fsm(&ccp->fsm))); mbfree(comp); return(NULL); } plain = (*ccp->recv->Decompress)(b, comp); /* Encrypted ok? */ if (plain == NULL) { Log(LG_CCP, ("[%s] %s: decompression failed", Pref(&ccp->fsm), Fsm(&ccp->fsm))); return(NULL); } LogDumpBp(LG_FRAME, plain, "[%s] %s: recv plain", Pref(&ccp->fsm), Fsm(&ccp->fsm)); return(plain); }
void CTestStepVidPlayerARN::MaoscPlayCompleteTest(TInt aError,CTestGenericAosCallback& aGenericAosCallback) { if(&aGenericAosCallback == iAudStreamACallback) { Fsm(EAudioStreamA, EAudioPlayComplete, aError); } else if(&aGenericAosCallback == iAudStreamBCallback) { Fsm(EAudioStreamB, EAudioPlayComplete, aError); } }
void CTestStepVidPlayerARN::MaoscBufferCopiedTest(TInt aError, const TDesC8& /* aBuffer */, CTestGenericAosCallback& aGenericAosCallback) { if(&aGenericAosCallback == iAudStreamACallback) { Fsm(EAudioStreamA, EAudioBufferCopied, aError); } else if(&aGenericAosCallback == iAudStreamBCallback) { Fsm(EAudioStreamB, EAudioBufferCopied, aError); } }
void CTestStepVidPlayerARN0702::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& /* aNotificationData */, CTestGenericArnCallback & aGenericArnCallback) { if(&aGenericArnCallback == iAudClientAArnCallback && aNotificationEventId == KMMFEventCategoryAudioResourceAvailable) { iAudStreamANotified = ETrue; Fsm(EAudioStreamA, EArnAvailable, 0); } else if(&aGenericArnCallback == iVidClientArnCallback && aNotificationEventId == KMMFEventCategoryAudioResourceAvailable) { Fsm(EVideo, EArnAvailable, 0); } }
void RA3FDevSoundTestBase::KickoffTestL() { INFO_PRINTF1(_L("__________ Creating DevSound object ___________")); // Create devsound object TRAPD(err, iMMFDevSound = CMMFDevSound::NewL()); if (err != KErrNone) { ERR_PRINTF2(_L("Could not create DevSound object. Error = %d"), err); StopTest(err); return; } INFO_PRINTF1(_L("DevSound State: EStateCreated")); iDevSoundState = EStateCreated; // Connect RFs err = iFs.Connect(); if (err != KErrNone) { ERR_PRINTF2(_L("Could not connect to Filesystem. Error = %d"), err); StopTest(err); return; } DoKickoffTestL(); INFO_PRINTF1(_L("DevSound Event: EEventInitialize")); Fsm(EEventInitialize, KErrNone); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void WlanConfigureTxQueueParams::ChangeInternalState( WlanContextImpl& aCtxImpl, TState aNewState ) { iState = aNewState; Fsm( aCtxImpl, ESTATEENTRY ); }
void RA3FDevSoundTestBase::BufferToBeEmptied(CMMFBuffer* aBuffer) { INFO_PRINTF1(_L("DevSound called BufferToBeEmptied.")); if (!aBuffer) { INFO_PRINTF1(_L("BufferToBeEmptied callback received a NULL CMMFBuffer")); StopTest(KErrGeneral); return; } iBuffer = aBuffer; if(aBuffer->LastBuffer()) { if(iDevSoundState == EStatePause) { // We need to call CMMFDevSound->Stop() here if last buffer flag set INFO_PRINTF1(_L("Devsound is in Paused state and CMMFBuffer::LastBuffer is set")); INFO_PRINTF1(_L("iMMFDevSound->Stop()")); iMMFDevSound->Stop(); StopTest(); } else { INFO_PRINTF1(_L("***** Unknown behaviour: Last buffer flag set before calling CMMFDevSound->Pause()")); StopTest(KErrUnknown); } } else { INFO_PRINTF1(_L("DevSound Event: EEventBTBE")); Fsm(EEventBTBE, KErrNone); } }
int CcpStat(Context ctx, int ac, char *av[], void *arg) { CcpState const ccp = &ctx->bund->ccp; char buf[64]; Printf("[%s] %s [%s]\r\n", Pref(&ccp->fsm), Fsm(&ccp->fsm), FsmStateName(ccp->fsm.state)); Printf("Enabled protocols:\r\n"); OptStat(ctx, &ccp->options, gConfList); #ifdef CCP_MPPC MppcStat(ctx, ac, av, arg); #endif Printf("Outgoing compression:\r\n"); Printf("\tProto\t: %s (%s)\r\n", !ccp->xmit ? "none" : ccp->xmit->name, (ccp->xmit && ccp->xmit->Describe) ? (*ccp->xmit->Describe)(ctx->bund, COMP_DIR_XMIT, buf, sizeof(buf)) : ""); if (ccp->xmit && ccp->xmit->Stat) ccp->xmit->Stat(ctx, COMP_DIR_XMIT); Printf("\tResets\t: %d\r\n", ccp->xmit_resets); Printf("Incoming decompression:\r\n"); Printf("\tProto\t: %s (%s)\r\n", !ccp->recv ? "none" : ccp->recv->name, (ccp->recv && ccp->recv->Describe) ? (*ccp->recv->Describe)(ctx->bund, COMP_DIR_RECV, buf, sizeof(buf)) : ""); if (ccp->recv && ccp->recv->Stat) ccp->recv->Stat(ctx, COMP_DIR_RECV); Printf("\tResets\t: %d\r\n", ccp->recv_resets); return(0); }
void CTestStepVidPlayerARN0701::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& /* aNotificationData */, CTestGenericArnCallback & aGenericArnCallback) { if(&aGenericArnCallback == iVidClientArnCallback && aNotificationEventId == KMMFEventCategoryAudioResourceAvailable) { INFO_PRINTF1(_L("Video: Got Audio Resource Notification")); Fsm(EVideo, EArnAvailable, 0); } }
void RA3FDevSoundTestBase::SendEventToClient(const TMMFEvent& aEvent) { INFO_PRINTF3(_L("RA3FDevSoundTestBase::SendEventToClient type=0x%08x errorCode=%d"),aEvent.iEventType, aEvent.iErrorCode); if(aEvent.iEventType == KMMFEventCategoryAudioResourceAvailable) { INFO_PRINTF1(_L("Received KMMFEventCategoryAudioResourceAvailable")); Fsm(EResourceAvailable, aEvent.iErrorCode); } }
TVerdict CTestStepVidPlayerARN0703::DoTestStepL() { Fsm(ETestStep, ETestStart, 0); CActiveScheduler::Start(); INFO_PRINTF1(_L("finished with this test step")); // test steps return a result return iTestStepResult; }
void RA3FDevSoundTestBase::InitializeComplete(TInt aError) { INFO_PRINTF1(_L("========== DevSound InitializeComplete() callback ==========")); INFO_PRINTF3(KMsgErrorDevSoundCallback, &KInitializeCompleteText, aError); if(iDevSoundState == EStateInitializing) { INFO_PRINTF1(_L("DevSound Event: EEventInitComplete")); Fsm(EEventInitComplete, aError); } }
void CcpSendResetReq(Bund b) { CcpState const ccp = &b->ccp; CompType const ct = ccp->recv; Fsm const fp = &ccp->fsm; Mbuf bp = NULL; if (ct == NULL) { Log(LG_ERR, ("[%s] %s: CcpSendResetReq() call from undefined decompressor!", Pref(fp), Fsm(fp))); return; } ccp->recv_resets++; if (ct->SendResetReq) bp = (*ct->SendResetReq)(b); Log(LG_CCP, ("[%s] %s: SendResetReq #%d link %d (%s)", Pref(fp), Fsm(fp), fp->reqid, 0, FsmStateName(fp->state))); FsmOutputMbuf(fp, CODE_RESETREQ, fp->reqid++, bp); }
Mbuf CcpDataOutput(Bund b, Mbuf plain) { CcpState const ccp = &b->ccp; Mbuf comp; LogDumpBp(LG_FRAME, plain, "[%s] %s: xmit plain", Pref(&ccp->fsm), Fsm(&ccp->fsm)); /* Compress packet */ if ((!ccp->xmit) || (!ccp->xmit->Compress)) { Log(LG_ERR, ("[%s] %s: no encryption for xmit", Pref(&ccp->fsm), Fsm(&ccp->fsm))); mbfree(plain); return(NULL); } comp = (*ccp->xmit->Compress)(b, plain); LogDumpBp(LG_FRAME, comp, "[%s] %s: xmit comp", Pref(&ccp->fsm), Fsm(&ccp->fsm)); return(comp); }
void CcpRecvMsg(Bund b, struct ng_mesg *msg, int len) { CcpState const ccp = &b->ccp; Fsm const fp = &ccp->fsm; switch (msg->header.typecookie) { #ifdef USE_NG_MPPC case NGM_MPPC_COOKIE: switch (msg->header.cmd) { case NGM_MPPC_RESETREQ: { CcpSendResetReq(b); return; } default: break; } break; #endif #ifdef USE_NG_DEFLATE case NGM_DEFLATE_COOKIE: switch (msg->header.cmd) { case NGM_DEFLATE_RESETREQ: { CcpSendResetReq(b); return; } default: break; } break; #endif #ifdef USE_NG_PRED1 case NGM_PRED1_COOKIE: switch (msg->header.cmd) { case NGM_PRED1_RESETREQ: { CcpSendResetReq(b); return; } default: break; } break; #endif default: break; } /* Unknown! */ Log(LG_ERR, ("[%s] %s: rec'd unknown netgraph message: cookie=%d, cmd=%d", Pref(fp), Fsm(fp), msg->header.typecookie, msg->header.cmd)); }
static int CcpCheckEncryption(Bund b) { #if 0 CcpState const ccp = &b->ccp; /* Already checked? */ if (ccp->crypt_check) return(0); ccp->crypt_check = 1; /* Is encryption required? */ if (Enabled(&ccp->options, gMppePolicy)) { if (b->params.msoft.policy != MPPE_POLICY_REQUIRED) return(0); } else { if (!Enabled(&b->conf.options, BUND_CONF_CRYPT_REQD)) return(0); } /* Was MPPE encryption enabled? If not, ignore requirement */ if (!Enabled(&ccp->options, gMppe40) && !Enabled(&ccp->options, gMppe56) && !Enabled(&ccp->options, gMppe128) && !Enabled(&ccp->options, gMppePolicy)) return(0); /* Make sure MPPE was negotiated in both directions */ if (!OPEN_STATE(ccp->fsm.state) || !ccp->xmit || ccp->xmit->type != CCP_TY_MPPC || !ccp->recv || ccp->recv->type != CCP_TY_MPPC #ifdef CCP_MPPC || !(ccp->mppc.recv_bits & MPPE_BITS) || !(ccp->mppc.xmit_bits & MPPE_BITS) #endif ) goto fail; /* Looks OK */ return(0); fail: Log(LG_ERR, ("[%s] %s: encryption required, but MPPE was not" " negotiated in both directions", Pref(&ccp->fsm), Fsm(&ccp->fsm))); FsmFailure(&ccp->fsm, FAIL_CANT_ENCRYPT); FsmFailure(&b->ipcp.fsm, FAIL_CANT_ENCRYPT); FsmFailure(&b->ipv6cp.fsm, FAIL_CANT_ENCRYPT); return(-1); #endif return (0); }
void CTestStepVidPlayerARN::MvpuoOpenComplete(TInt aError) { INFO_PRINTF2(_L("Video open:%d"),aError); #ifndef SYMBIAN_MMF_MODEL_CONTROLLERS if(aError == KErrNotSupported) { INFO_PRINTF1(_L("Feature not supported")); iTestStepResult = EPass; CActiveScheduler::Stop(); return; } #endif Fsm(EVideo, EVideoOpenComplete, aError); }
void RA3FDevSoundTestBase::BufferToBeFilled(CMMFBuffer* aBuffer) { INFO_PRINTF1(_L("========== DevSound BufferToBeFilled() callback ==========")); if (!aBuffer) { ERR_PRINTF1(_L("BufferToBeFilled callback received a NULL CMMFBuffer!")); StopTest(KErrGeneral); } else { iBuffer = aBuffer; INFO_PRINTF1(_L("DevSound Event: EEventBTBF")); Fsm(EEventBTBF, KErrNone); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void WlanConfigureTxQueueParams::Entry( WlanContextImpl& aCtxImpl ) { if ( aCtxImpl.WsaCmdActive() ) { // sanity checking code OsAssert( (TUint8*)("UMAC * panic"), (TUint8*)(WLAN_FILE), __LINE__ ); } if ( iState != EINIT ) { // this is NOT the start of the the FSM actions // note that we send the ETXCOMPLETE event as the states // that wait for it are the only ones that can be interrupted // as they are asynchronous operations by nature // and wait for corresponding WHA completion method Fsm( aCtxImpl, ETXCOMPLETE ); } else { // this is the start of the the FSM actions Fsm( aCtxImpl, ESTATEENTRY ); } }
static void CcpRecvResetReq(Fsm fp, int id, Mbuf bp) { Bund b = (Bund)fp->arg; CcpState const ccp = &b->ccp; CompType const ct = ccp->xmit; int noAck = 0; ccp->xmit_resets++; bp = (ct && ct->RecvResetReq) ? (*ct->RecvResetReq)(b, id, bp, &noAck) : NULL; if (!noAck) { Log(LG_CCP, ("[%s] %s: SendResetAck #%d link %d (%s)", Pref(fp), Fsm(fp), id, 0, FsmStateName(fp->state))); FsmOutputMbuf(fp, CODE_RESETACK, id, bp); } }
int Ipv6cpStat(Context ctx, int ac, char *av[], void *arg) { Ipv6cpState const ipv6cp = &ctx->bund->ipv6cp; Fsm fp = &ipv6cp->fsm; Printf("[%s] %s [%s]\r\n", Pref(fp), Fsm(fp), FsmStateName(fp->state)); Printf("Interface identificators:\r\n"); Printf("\tSelf: %02x%02x:%02x%02x:%02x%02x:%02x%02x\r\n", ipv6cp->myintid[0], ipv6cp->myintid[1], ipv6cp->myintid[2], ipv6cp->myintid[3], ipv6cp->myintid[4], ipv6cp->myintid[5], ipv6cp->myintid[6], ipv6cp->myintid[7]); Printf("\tPeer: %02x%02x:%02x%02x:%02x%02x:%02x%02x\r\n", ipv6cp->hisintid[0], ipv6cp->hisintid[1], ipv6cp->hisintid[2], ipv6cp->hisintid[3], ipv6cp->hisintid[4], ipv6cp->hisintid[5], ipv6cp->hisintid[6], ipv6cp->hisintid[7]); Printf("IPV6CP Options:\r\n"); OptStat(ctx, &ipv6cp->conf.options, gConfList); return (0); }
int IpcpStat(Context ctx, int ac, char *av[], void *arg) { #ifdef USE_NG_VJC char path[NG_PATHSIZ]; #endif IpcpState const ipcp = &ctx->bund->ipcp; Fsm fp = &ipcp->fsm; #ifdef USE_NG_VJC union { u_char buf[sizeof(struct ng_mesg) + sizeof(struct slcompress)]; struct ng_mesg reply; } u; struct slcompress *const sls = (struct slcompress *)(void *)u.reply.data; #endif char buf[48]; Printf("[%s] %s [%s]\r\n", Pref(fp), Fsm(fp), FsmStateName(fp->state)); Printf("Allowed IP address ranges:\r\n"); if (ipcp->conf.self_ippool[0]) { Printf("\tPeer: ippool %s\r\n", ipcp->conf.self_ippool); } else { Printf("\tSelf: %s\r\n", u_rangetoa(&ipcp->conf.self_allow,buf,sizeof(buf))); } if (ipcp->conf.ippool[0]) { Printf("\tPeer: ippool %s\r\n", ipcp->conf.ippool); } else { Printf("\tPeer: %s\r\n", u_rangetoa(&ipcp->conf.peer_allow,buf,sizeof(buf))); } Printf("IPCP Options:\r\n"); OptStat(ctx, &ipcp->conf.options, gConfList); Printf("Current addressing:\r\n"); Printf("\tSelf: %s\r\n", inet_ntoa(ipcp->want_addr)); Printf("\tPeer: %s\r\n", inet_ntoa(ipcp->peer_addr)); #ifdef USE_NG_VJC Printf("Compression:\r\n"); Printf("\tSelf: "); if (ipcp->want_comp.proto != 0) Printf("%s, %d compression channels, CID %scompressible\r\n", ProtoName(ntohs(ipcp->want_comp.proto)), ipcp->want_comp.maxchan + 1, ipcp->want_comp.compcid ? "" : "not "); else Printf("None\r\n"); Printf("\tPeer: "); if (ipcp->peer_comp.proto != 0) Printf("%s, %d compression channels, CID %scompressible\n", ProtoName(ntohs(ipcp->peer_comp.proto)), ipcp->peer_comp.maxchan + 1, ipcp->peer_comp.compcid ? "" : "not "); else Printf("None\r\n"); #endif /* USE_NG_VJC */ Printf("Server info we give to peer:\r\n"); Printf("DNS servers : %15s", inet_ntoa(ipcp->conf.peer_dns[0])); Printf(" %15s\r\n", inet_ntoa(ipcp->conf.peer_dns[1])); Printf("NBNS servers: %15s", inet_ntoa(ipcp->conf.peer_nbns[0])); Printf(" %15s\r\n", inet_ntoa(ipcp->conf.peer_nbns[1])); Printf("Server info peer gave to us:\r\n"); Printf("DNS servers : %15s", inet_ntoa(ipcp->want_dns[0])); Printf(" %15s\r\n", inet_ntoa(ipcp->want_dns[1])); Printf("NBNS servers: %15s", inet_ntoa(ipcp->want_nbns[0])); Printf(" %15s\r\n", inet_ntoa(ipcp->want_nbns[1])); #ifdef USE_NG_VJC /* Get VJC state */ snprintf(path, sizeof(path), "mpd%d-%s:%s", gPid, ctx->bund->name, NG_PPP_HOOK_VJC_IP); if (NgFuncSendQuery(path, NGM_VJC_COOKIE, NGM_VJC_GET_STATE, NULL, 0, &u.reply, sizeof(u), NULL) < 0) return(0); Printf("VJ Compression:\r\n"); Printf("\tOut comp : %d\r\n", sls->sls_compressed); Printf("\tOut total: %d\r\n", sls->sls_packets); Printf("\tMissed : %d\r\n", sls->sls_misses); Printf("\tSearched : %d\r\n", sls->sls_searches); Printf("\tIn comp : %d\r\n", sls->sls_compressedin); Printf("\tIn uncomp: %d\r\n", sls->sls_uncompressedin); Printf("\tIn error : %d\r\n", sls->sls_errorin); Printf("\tIn tossed: %d\r\n", sls->sls_tossed); #endif /* USE_NG_VJC */ return(0); }
static void CcpLayerUp(Fsm fp) { Bund b = (Bund)fp->arg; CcpState const ccp = &b->ccp; struct ngm_connect cn; char buf[64]; /* If nothing was negotiated in either direction, close CCP */ if ((!ccp->recv || !(*ccp->recv->Negotiated)(b, COMP_DIR_RECV)) && (!ccp->xmit || !(*ccp->xmit->Negotiated)(b, COMP_DIR_XMIT))) { Log(LG_CCP, ("[%s] %s: No compression negotiated", Pref(fp), Fsm(fp))); FsmFailure(fp, FAIL_NEGOT_FAILURE); return; } /* Check for required encryption */ if (CcpCheckEncryption(b) < 0) { return; } /* Initialize each direction */ if (ccp->xmit != NULL && ccp->xmit->Init != NULL && (*ccp->xmit->Init)(b, COMP_DIR_XMIT) < 0) { Log(LG_CCP, ("[%s] %s: compression init failed", Pref(fp), Fsm(fp))); FsmFailure(fp, FAIL_NEGOT_FAILURE); /* XXX */ return; } if (ccp->recv != NULL && ccp->recv->Init != NULL && (*ccp->recv->Init)(b, COMP_DIR_RECV) < 0) { Log(LG_CCP, ("[%s] %s: decompression init failed", Pref(fp), Fsm(fp))); FsmFailure(fp, FAIL_NEGOT_FAILURE); /* XXX */ return; } if (ccp->xmit != NULL && ccp->xmit->Compress != NULL) { /* Connect a hook from the ppp node to our socket node */ snprintf(cn.path, sizeof(cn.path), "[%x]:", b->nodeID); snprintf(cn.ourhook, sizeof(cn.ourhook), "c%d", b->id); strcpy(cn.peerhook, NG_PPP_HOOK_COMPRESS); if (NgSendMsg(gCcpCsock, ".:", NGM_GENERIC_COOKIE, NGM_CONNECT, &cn, sizeof(cn)) < 0) { Perror("[%s] can't connect \"%s\"->\"%s\" and \"%s\"->\"%s\"", b->name, ".:", cn.ourhook, cn.path, cn.peerhook); } } if (ccp->recv != NULL && ccp->recv->Decompress != NULL) { /* Connect a hook from the ppp node to our socket node */ snprintf(cn.path, sizeof(cn.path), "[%x]:", b->nodeID); snprintf(cn.ourhook, sizeof(cn.ourhook), "d%d", b->id); strcpy(cn.peerhook, NG_PPP_HOOK_DECOMPRESS); if (NgSendMsg(gCcpCsock, ".:", NGM_GENERIC_COOKIE, NGM_CONNECT, &cn, sizeof(cn)) < 0) { Perror("[%s] can't connect \"%s\"->\"%s\" and \"%s\"->\"%s\"", b->name, ".:", cn.ourhook, cn.path, cn.peerhook); } } /* Report what we're doing */ Log(LG_CCP, ("[%s] CCP: Compress using: %s (%s)", b->name, !ccp->xmit ? "none" : ccp->xmit->name, (ccp->xmit && ccp->xmit->Describe) ? (*ccp->xmit->Describe)(b, COMP_DIR_XMIT, buf, sizeof(buf)) : "")); Log(LG_CCP, ("[%s] CCP: Decompress using: %s (%s)", b->name, !ccp->recv ? "none" : ccp->recv->name, (ccp->recv && ccp->recv->Describe) ? (*ccp->recv->Describe)(b, COMP_DIR_RECV, buf, sizeof(buf)) : "")); /* Update PPP node config */ b->pppConfig.bund.enableCompression = (ccp->xmit != NULL)?ccp->xmit->mode:0; b->pppConfig.bund.enableDecompression = (ccp->recv != NULL)?ccp->recv->mode:0; NgFuncSetConfig(b); /* Update interface MTU */ BundUpdateParams(b); }
void CTestStepVidPlayerARN::MvpuoPrepareComplete(TInt aError) { INFO_PRINTF2(_L("Video prepare:%d"),aError); Fsm(EVideo, EVideoPrepareComplete, aError); }
void CTestStepVidPlayerARN::MvpuoPlayComplete(TInt aError) { Fsm(EVideo, EVideoPlayComplete, aError); }